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