diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-04-26 00:03:37 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-04-26 00:03:37 +0000 |
commit | 3c014a930187ab65de7a53d280de8f465d4aca7f (patch) | |
tree | 7527fe573b9186c6c89e984b8638b44c3877d5ed /gcc/aclocal.m4 | |
parent | e5411b4772ac4b1c2c84fa440f4c396542883f26 (diff) | |
download | gcc-3c014a930187ab65de7a53d280de8f465d4aca7f.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33428 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/aclocal.m4')
-rw-r--r-- | gcc/aclocal.m4 | 69 |
1 files changed, 27 insertions, 42 deletions
diff --git a/gcc/aclocal.m4 b/gcc/aclocal.m4 index 9ef6b64855c..6e8e7556f18 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]) |