aboutsummaryrefslogtreecommitdiff
path: root/gcc/aclocal.m4
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2000-04-26 00:03:37 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2000-04-26 00:03:37 +0000
commit86cf1cbd5f7e4cf869bb8b02867fd074caef8694 (patch)
tree7527fe573b9186c6c89e984b8638b44c3877d5ed /gcc/aclocal.m4
parent62076024ce4f6f781b484ff049f78354a2b041b9 (diff)
downloadgcc-86cf1cbd5f7e4cf869bb8b02867fd074caef8694.zip
gcc-86cf1cbd5f7e4cf869bb8b02867fd074caef8694.tar.gz
gcc-86cf1cbd5f7e4cf869bb8b02867fd074caef8694.tar.bz2
aclocal.m4 (gcc_AC_NEED_DECLARATION): This macro now requires INCLUDES to search and does not provide any of its own.
* aclocal.m4 (gcc_AC_NEED_DECLARATION): This macro now requires INCLUDES to search and does not provide any of its own. Also it now accepts optional ACTION-IF-NEEDED and ACTION-IF-NOT-NEEDED parameters. Also it does not call AC_DEFINE. (gcc_AC_NEED_DECLARATIONS): Likewise. Also this macro now calls AC_DEFINE and provides for automatic entries for autoheader. (gcc_AC_FUNC_PRINTF_PTR): Cleanup C code in test. * configure.in (gcc_AC_NEED_DECLARATIONS): Save and restore CFLAGS so we can pass -I flags and include gansidecl.h/system.h in this test. * acconfig.h: Delete all NEED_DECLARATION_* entries. From-SVN: r33428
Diffstat (limited to 'gcc/aclocal.m4')
-rw-r--r--gcc/aclocal.m469
1 files changed, 27 insertions, 42 deletions
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4
index 9ef6b64..6e8e755 100644
--- a/gcc/aclocal.m4
+++ b/gcc/aclocal.m4
@@ -10,59 +10,44 @@ fi
])
dnl See whether we need a declaration for a function.
-dnl gcc_AC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
+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([
-#include <stdio.h>
-#ifdef STRING_WITH_STRINGS
-# include <string.h>
-# include <strings.h>
-#else
-# ifdef HAVE_STRING_H
-# include <string.h>
-# else
-# ifdef HAVE_STRINGS_H
-# include <strings.h>
-# endif
-# endif
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifndef HAVE_RINDEX
-#ifndef rindex
-#define rindex strrchr
-#endif
-#endif
-#ifndef HAVE_INDEX
-#ifndef index
-#define index strchr
-#endif
-#endif
-$2],
-[char *(*pfn) = (char *(*)) $1],
-eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
+[AC_TRY_COMPILE([$2],
+[#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)
- gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
- AC_DEFINE_UNQUOTED($gcc_tr_decl)
+ AC_MSG_RESULT(yes) ; ifelse([$3], , :, [$3])
else
- AC_MSG_RESULT(no)
+ AC_MSG_RESULT(no) ; ifelse([$4], , :, [$4])
fi
])dnl
dnl Check multiple functions to see whether each needs a declaration.
-dnl gcc_AC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
+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,
[for ac_func in $1
do
-gcc_AC_NEED_DECLARATION($ac_func, $2)
+gcc_AC_NEED_DECLARATION($ac_func, [$2],
+[changequote(, )dnl
+ ac_tr_decl=NEED_DECLARATION_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+changequote([, ])dnl
+ AC_DEFINE_UNQUOTED($ac_tr_decl) $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
+fi
])
dnl Check if we have vprintf and possibly _doprnt.
@@ -87,13 +72,13 @@ AC_DEFUN(gcc_AC_FUNC_PRINTF_PTR,
gcc_cv_func_printf_ptr,
[AC_TRY_RUN([#include <stdio.h>
-main()
+int main()
{
char buf[64];
char *p = buf, *q = NULL;
sprintf(buf, "%p", p);
sscanf(buf, "%p", &q);
- exit (p != q);
+ return (p != q);
}], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
gcc_cv_func_printf_ptr=no)
rm -f core core.* *.core])