db08f62f5d474e0da83d24540cd2c6df32ab4055
[m6w6/ext-psi] / config.psi_const.m4
1 PSI_CONSTS=""
2 # add_str_const(name, value)
3 add_str_const() {
4 PSI_CONSTS="{PSI_T_STRING, \"string\", \"psi\\\\$1\", $2, PSI_T_QUOTED_STRING}, $PSI_CONSTS"
5 }
6 # add_int_const(name, value)
7 add_int_const() {
8 PSI_CONSTS="{PSI_T_INT, \"int\", \"psi\\\\$1\", \"$2\", PSI_T_NUMBER}, $PSI_CONSTS"
9 }
10 dnl PSI_CONST(const name, type)
11 AC_DEFUN(PSI_CONST, [
12 AC_CACHE_CHECK(value of $1, psi_cv_const_$1, [
13 psi_const_val=
14 case $2 in
15 str*)
16 if test "$cross_compiling" = "yes"
17 then
18 AC_TRY_CPP(PSI_INCLUDES $1, psi_const_val=`eval "$ac_try|tail -n1"`, psi_const_val=)
19 else
20 PSI_COMPUTE_STR(psi_const_val, $1, PSI_INCLUDES)
21 fi
22 ;;
23 int)
24 AC_COMPUTE_INT(psi_const_val, $1, PSI_INCLUDES)
25 ;;
26 esac
27 psi_cv_const_$1=$psi_const_val
28 ])
29 if test "$psi_cv_const_$1"
30 then
31 case $2 in
32 str*)
33 add_str_const "$1" "$psi_cv_const_$1"
34 ;;
35 int)
36 add_int_const "$1" "$psi_cv_const_$1"
37 ;;
38 esac
39 fi
40 ])