From 09afe8b3b6555b3163a470a9cb3b29d7de60a1cf Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Tue, 25 Apr 2000 18:29:12 +0000 Subject: New macros CF_CHECK_FUNCDECL, CF_CHECK_FUNCDECLS, CF_UPPER. These are slightly modified versions of T. E. Dickey's macros from the lynx distribution. (From Lars Hecking.) --- m4/funcdecl.m4 | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 m4/funcdecl.m4 (limited to 'm4') diff --git a/m4/funcdecl.m4 b/m4/funcdecl.m4 new file mode 100644 index 00000000..f46be2ef --- /dev/null +++ b/m4/funcdecl.m4 @@ -0,0 +1,62 @@ +dnl --------------------------------------------------------------------------- +dnl Check if a function is declared by including a set of include files. +dnl Invoke the corresponding actions according to whether it is found or not. +dnl +dnl Gcc (unlike other compilers) will only warn about the miscast assignment +dnl in the first test, but most compilers will oblige with an error in the +dnl second test. +dnl +dnl CF_CHECK_FUNCDECL(INCLUDES, FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN([CF_CHECK_FUNCDECL], +[ +AC_MSG_CHECKING([for $2 declaration]) +AC_CACHE_VAL(ac_cv_func_decl_$2, +[AC_TRY_COMPILE([$1], +[#ifndef ${ac_func} +extern int ${ac_func}(); +#endif],[ +AC_TRY_COMPILE([$1], +[#ifndef ${ac_func} +int (*p)() = ${ac_func}; +#endif],[ +eval "ac_cv_func_decl_$2=yes"],[ +eval "ac_cv_func_decl_$2=no"])],[ +eval "ac_cv_func_decl_$2=yes"])]) +if eval "test \"`echo '$ac_cv_func_'decl_$2`\" = yes"; then + AC_MSG_RESULT(yes) + ifelse([$3], , :, [$3]) +else + AC_MSG_RESULT(no) +ifelse([$4], , , [$4 +])dnl +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl Check if functions are declared by including a set of include files. +dnl and define DECL_XXX if not. +dnl +dnl CF_CHECK_FUNCDECLS(INCLUDES, FUNCTION... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN([CF_CHECK_FUNCDECLS], +[for ac_func in $2 +do +CF_CHECK_FUNCDECL([$1], $ac_func, +[ + CF_UPPER(ac_tr_func,HAVE_$ac_func) + AC_DEFINE_UNQUOTED($ac_tr_func) $3], +[$4])dnl +dnl [$3], +dnl [ +dnl CF_UPPER(ac_tr_func,DECL_$ac_func) +dnl AC_DEFINE_UNQUOTED($ac_tr_func) $4])dnl +done +])dnl +dnl --------------------------------------------------------------------------- +dnl Make an uppercase version of a variable +dnl $1=uppercase($2) +AC_DEFUN([CF_UPPER], +[ +changequote(,)dnl +$1=`echo $2 | tr '[a-z]' '[A-Z]'` +changequote([,])dnl +])dnl +dnl --------------------------------------------------------------------------- -- cgit v1.2.3