diff options
Diffstat (limited to 'gcc/aclocal.m4')
-rw-r--r-- | gcc/aclocal.m4 | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4 index ddfc65131f6..7de3d38e4a5 100644 --- a/gcc/aclocal.m4 +++ b/gcc/aclocal.m4 @@ -13,40 +13,43 @@ dnl See whether we need a declaration for a function. dnl The result is highly dependent on the INCLUDES passed in, so make sure dnl to use a different cache variable name in this macro if it is invoked dnl in a different context somewhere else. -dnl gcc_AC_NEED_DECLARATION(FUNCTION, INCLUDES, -dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED]]) -AC_DEFUN(gcc_AC_NEED_DECLARATION, -[AC_MSG_CHECKING([whether $1 must be declared]) -AC_CACHE_VAL(gcc_cv_decl_needed_$1, -[AC_TRY_COMPILE([$2], +dnl gcc_AC_CHECK_DECL(SYMBOL, +dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, INCLUDES]]]) +AC_DEFUN(gcc_AC_CHECK_DECL, +[AC_MSG_CHECKING([whether $1 is declared]) +AC_CACHE_VAL(gcc_cv_have_decl_$1, +[AC_TRY_COMPILE([$4], [#ifndef $1 char *(*pfn) = (char *(*)) $1 ; -#endif], eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")]) -if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then - AC_MSG_RESULT(yes) ; ifelse([$3], , :, [$3]) +#endif], eval "gcc_cv_have_decl_$1=yes", eval "gcc_cv_have_decl_$1=no")]) +if eval "test \"`echo '$gcc_cv_have_decl_'$1`\" = yes"; then + AC_MSG_RESULT(yes) ; ifelse([$2], , :, [$2]) else - AC_MSG_RESULT(no) ; ifelse([$4], , :, [$4]) + AC_MSG_RESULT(no) ; ifelse([$3], , :, [$3]) fi ])dnl dnl Check multiple functions to see whether each needs a declaration. -dnl Arrange to define NEED_DECLARATION_<FUNCTION> if appropriate. -dnl gcc_AC_NEED_DECLARATIONS(FUNCTION... , INCLUDES, -dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED]]) -AC_DEFUN(gcc_AC_NEED_DECLARATIONS, +dnl Arrange to define HAVE_DECL_<FUNCTION> to 0 or 1 as appropriate. +dnl gcc_AC_CHECK_DECLS(SYMBOLS, +dnl [ACTION-IF-NEEDED [, ACTION-IF-NOT-NEEDED [, INCLUDES]]]) +AC_DEFUN(gcc_AC_CHECK_DECLS, [for ac_func in $1 do -gcc_AC_NEED_DECLARATION($ac_func, [$2], -[changequote(, )dnl - ac_tr_decl=NEED_DECLARATION_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` +changequote(, )dnl + ac_tr_decl=HAVE_DECL_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` changequote([, ])dnl - AC_DEFINE_UNQUOTED($ac_tr_decl) $3], $4) +gcc_AC_CHECK_DECL($ac_func, + [AC_DEFINE_UNQUOTED($ac_tr_decl, 1) $2], + [AC_DEFINE_UNQUOTED($ac_tr_decl, 0) $3], + $4 +) done dnl Automatically generate config.h entries via autoheader. if test x = y ; then patsubst(translit([$1], [a-z], [A-Z]), [\w+], - AC_DEFINE([NEED_DECLARATION_\&], 1, - [Define if you need to provide a declaration for this function.]))dnl + AC_DEFINE([HAVE_DECL_\&], 1, + [Define to 1 if we found this declaration otherwise define to 0.]))dnl fi ]) |