From 04472528403b0c43456e46b3fda3669c02949ee2 Mon Sep 17 00:00:00 2001 From: Raja R Harinath Date: Wed, 15 Jul 1998 23:47:31 +0000 Subject: Add `need-declaration.m4'. * Makefile.am (MACROS): Add `need-declaration.m4'. * gnome-support.m4 (AC_REPLACE_FUNCS): Add memmove, strtod, strtol, strtoul. (GCC_NEED_DECLARATIONS): New check. Check whether `gethostname' needs to be declared. * need-declaration.m4: New file. Stolen from EGCS. svn path=/trunk/; revision=281 --- macros/need-declaration.m4 | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 macros/need-declaration.m4 (limited to 'macros/need-declaration.m4') diff --git a/macros/need-declaration.m4 b/macros/need-declaration.m4 new file mode 100644 index 0000000000..d5b7bc66d5 --- /dev/null +++ b/macros/need-declaration.m4 @@ -0,0 +1,42 @@ +dnl See whether we need a declaration for a function. +dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES]) +AC_DEFUN(GCC_NEED_DECLARATION, +[AC_MSG_CHECKING([whether $1 must be declared]) +AC_CACHE_VAL(gcc_cv_decl_needed_$1, +[AC_TRY_COMPILE([ +#include +#ifdef HAVE_STRING_H +#include +#else +#ifdef HAVE_STRINGS_H +#include +#endif +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +$2], +[char *(*pfn) = (char *(*)) $1], +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) + gcc_need_declarations="$gcc_need_declarations $1" + gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + AC_DEFINE_UNQUOTED($gcc_tr_decl) +else + AC_MSG_RESULT(no) +fi +])dnl + +dnl Check multiple functions to see whether each needs a declaration. +dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES]) +AC_DEFUN(GCC_NEED_DECLARATIONS, +[for ac_func in $1 +do +GCC_NEED_DECLARATION($ac_func, $2) +done +] +) -- cgit v1.2.3