aboutsummaryrefslogtreecommitdiff
path: root/gcc/aclocal.m4
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2000-05-23 17:42:19 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2000-05-23 17:42:19 +0000
commitf31e826ba314bc910beec6de5bf534f2462a00c7 (patch)
tree2d8c701cdb99568d7922c37d21a7fda0f8ea9913 /gcc/aclocal.m4
parent04de731462db7abf438903fa71b850ac046f1067 (diff)
downloadgcc-f31e826ba314bc910beec6de5bf534f2462a00c7.zip
gcc-f31e826ba314bc910beec6de5bf534f2462a00c7.tar.gz
gcc-f31e826ba314bc910beec6de5bf534f2462a00c7.tar.bz2
getopt.h (getopt): Also check HAVE_DECL_* when prototyping.
include: * getopt.h (getopt): Also check HAVE_DECL_* when prototyping. * libiberty.h (basename): Likewise. gcc: * aclocal.m4 (gcc_AC_CHECK_DECL, gcc_AC_CHECK_DECLS): New macros rewritten from the internals of gcc_AC_NEED_DECLARATION{S}. * configure.in (gcc_AC_CHECK_DECLS): Call this instead of gcc_AC_NEED_DECLARATIONS. * dwarfout.c: Don't prototype time(). * gcc.c: Check HAVE_DECL_* instead of NEED_DECLARATION_*. * system.h: Likewise. * toplev.c: Likewise. From-SVN: r34108
Diffstat (limited to 'gcc/aclocal.m4')
-rw-r--r--gcc/aclocal.m443
1 files changed, 23 insertions, 20 deletions
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
index ddfc651..7de3d38 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
])