summaryrefslogtreecommitdiff
path: root/gcc/aclocal.m4
diff options
context:
space:
mode:
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-23 17:42:19 +0000
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>2000-05-23 17:42:19 +0000
commit07c927cb9ef632d1c55c3a87d4c1e9e41ab299ef (patch)
tree2d8c701cdb99568d7922c37d21a7fda0f8ea9913 /gcc/aclocal.m4
parente8f79093d0b9c14a499799f2ee0d8479931e8b43 (diff)
downloadgcc-07c927cb9ef632d1c55c3a87d4c1e9e41ab299ef.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34108 138bc75d-0d04-0410-961f-82ee72b054a4
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 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
])