mutt stable branch with some hacks
1dnl ---------------------------------------------------------------------------
2dnl Check if a function is declared by including a set of include files.
3dnl Invoke the corresponding actions according to whether it is found or not.
4dnl
5dnl Gcc (unlike other compilers) will only warn about the miscast assignment
6dnl in the first test, but most compilers will oblige with an error in the
7dnl second test.
8dnl
9dnl CF_CHECK_FUNCDECL(INCLUDES, FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
10AC_DEFUN([CF_CHECK_FUNCDECL],
11[
12AC_MSG_CHECKING([for $2 declaration])
13AC_CACHE_VAL(ac_cv_func_decl_$2,
14[AC_TRY_COMPILE([$1],
15[#ifndef ${ac_func}
16extern int ${ac_func}();
17#endif],[
18AC_TRY_COMPILE([$1],
19[#ifndef ${ac_func}
20int (*p)() = ${ac_func};
21#endif],[
22eval "ac_cv_func_decl_$2=yes"],[
23eval "ac_cv_func_decl_$2=no"])],[
24eval "ac_cv_func_decl_$2=yes"])])
25if eval "test \"`echo '$ac_cv_func_'decl_$2`\" = yes"; then
26 AC_MSG_RESULT(yes)
27 ifelse([$3], , :, [$3])
28else
29 AC_MSG_RESULT(no)
30ifelse([$4], , , [$4
31])dnl
32fi
33])dnl
34dnl ---------------------------------------------------------------------------
35dnl Check if functions are declared by including a set of include files.
36dnl and define DECL_XXX if not.
37dnl
38dnl CF_CHECK_FUNCDECLS(INCLUDES, FUNCTION... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
39AC_DEFUN([CF_CHECK_FUNCDECLS],
40[for ac_func in $2
41do
42CF_CHECK_FUNCDECL([$1], $ac_func,
43[
44 CF_UPPER(ac_tr_func,HAVE_$ac_func)
45 AC_DEFINE_UNQUOTED($ac_tr_func) $3],
46[$4])dnl
47dnl [$3],
48dnl [
49dnl CF_UPPER(ac_tr_func,DECL_$ac_func)
50dnl AC_DEFINE_UNQUOTED($ac_tr_func) $4])dnl
51done
52])dnl
53dnl ---------------------------------------------------------------------------
54dnl Make an uppercase version of a variable
55dnl $1=uppercase($2)
56AC_DEFUN([CF_UPPER],
57[
58changequote(,)dnl
59$1=`echo $2 | tr '[a-z]' '[A-Z]'`
60changequote([,])dnl
61])dnl
62dnl ---------------------------------------------------------------------------