From d34a2b1dc9d8e59c41f630002ffa70c4de1100f9 Mon Sep 17 00:00:00 2001 From: Jerome Guitton Date: Fri, 22 Apr 2005 13:58:14 +0000 Subject: [PATCH] * configure.in: Replace BFD_NEED_DECLARATION checks by the corresponding AC_CHECK_DECLS. * sysdep.h: Replace NEED_DECLARATION_* checks by the corresponding HAVE_DECL_*. * bfd.m4 (BFD_NEED_DECLARATION): Remove, obsolete. * configure: Regenerate. * config.in: Ditto. --- bfd/ChangeLog | 10 ++ bfd/bfd.m4 | 30 ----- bfd/config.in | 41 ++++--- bfd/configure | 288 ++++++++++++++++++++++------------------------- bfd/configure.in | 12 +- bfd/sysdep.h | 12 +- 6 files changed, 177 insertions(+), 216 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c14161efb8..5e9f707685 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,13 @@ +2005-04-21 Jerome Guitton + + * configure.in: Replace BFD_NEED_DECLARATION checks by the + corresponding AC_CHECK_DECLS. + * sysdep.h: Replace NEED_DECLARATION_* checks by the corresponding + HAVE_DECL_*. + * bfd.m4 (BFD_NEED_DECLARATION): Remove, obsolete. + * configure: Regenerate. + * config.in: Ditto. + 2005-04-21 Andreas Schwab * elfxx-sparc.h (struct _bfd_sparc_elf_link_hash_table): Remove diff --git a/bfd/bfd.m4 b/bfd/bfd.m4 index cb0cb46463..1d7d53a1f2 100644 --- a/bfd/bfd.m4 +++ b/bfd/bfd.m4 @@ -1,36 +1,6 @@ dnl This file was derived from acinclude.m4. -dnl See whether we need a declaration for a function. - -AC_DEFUN([BFD_NEED_DECLARATION], -[AC_MSG_CHECKING([whether $1 must be declared]) -AC_CACHE_VAL(bfd_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], -[char *(*pfn) = (char *(*)) $1], -bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)]) -AC_MSG_RESULT($bfd_cv_decl_needed_$1) -if test $bfd_cv_decl_needed_$1 = yes; then - AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1, - [Define if $1 is not declared in system header files.]) -fi -])dnl - - dnl Check for existence of a type $1 in sys/procfs.h AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE], diff --git a/bfd/config.in b/bfd/config.in index 12f7239069..decd1f7112 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -28,6 +28,13 @@ don't. */ #undef HAVE_DECL_BASENAME +/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */ +#undef HAVE_DECL_FFS + +/* Define to 1 if you have the declaration of `free', and to 0 if you don't. + */ +#undef HAVE_DECL_FREE + /* Define to 1 if you have the declaration of `fseeko', and to 0 if you don't. */ #undef HAVE_DECL_FSEEKO @@ -44,6 +51,22 @@ don't. */ #undef HAVE_DECL_FTELLO64 +/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. + */ +#undef HAVE_DECL_GETENV + +/* Define to 1 if you have the declaration of `malloc', and to 0 if you don't. + */ +#undef HAVE_DECL_MALLOC + +/* Define to 1 if you have the declaration of `realloc', and to 0 if you + don't. */ +#undef HAVE_DECL_REALLOC + +/* Define to 1 if you have the declaration of `strstr', and to 0 if you don't. + */ +#undef HAVE_DECL_STRSTR + /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H @@ -257,24 +280,6 @@ /* Define to 1 if you have the `__argz_stringify' function. */ #undef HAVE___ARGZ_STRINGIFY -/* Define if ffs is not declared in system header files. */ -#undef NEED_DECLARATION_FFS - -/* Define if free is not declared in system header files. */ -#undef NEED_DECLARATION_FREE - -/* Define if getenv is not declared in system header files. */ -#undef NEED_DECLARATION_GETENV - -/* Define if malloc is not declared in system header files. */ -#undef NEED_DECLARATION_MALLOC - -/* Define if realloc is not declared in system header files. */ -#undef NEED_DECLARATION_REALLOC - -/* Define if strstr is not declared in system header files. */ -#undef NEED_DECLARATION_STRSTR - /* Name of package */ #undef PACKAGE diff --git a/bfd/configure b/bfd/configure index 43af5887ab..3258a3bf90 100755 --- a/bfd/configure +++ b/bfd/configure @@ -9916,9 +9916,9 @@ _ACEOF ;; esac -echo "$as_me:$LINENO: checking whether ffs must be declared" >&5 -echo $ECHO_N "checking whether ffs must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_ffs+set}" = set; then +echo "$as_me:$LINENO: checking whether ffs is declared" >&5 +echo $ECHO_N "checking whether ffs is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_ffs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -9927,25 +9927,14 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#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 +$ac_includes_default int main () { -char *(*pfn) = (char *(*)) ffs +#ifndef ffs + char *p = (char *) ffs; +#endif + ; return 0; } @@ -9972,29 +9961,36 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - bfd_cv_decl_needed_ffs=no + ac_cv_have_decl_ffs=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -bfd_cv_decl_needed_ffs=yes +ac_cv_have_decl_ffs=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_ffs" >&5 +echo "${ECHO_T}$ac_cv_have_decl_ffs" >&6 +if test $ac_cv_have_decl_ffs = yes; then -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_ffs" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_ffs" >&6 -if test $bfd_cv_decl_needed_ffs = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FFS 1 +_ACEOF -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_FFS 1 + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FFS 0 _ACEOF + fi -echo "$as_me:$LINENO: checking whether free must be declared" >&5 -echo $ECHO_N "checking whether free must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_free+set}" = set; then + +echo "$as_me:$LINENO: checking whether free is declared" >&5 +echo $ECHO_N "checking whether free is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_free+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -10003,25 +9999,14 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#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 +$ac_includes_default int main () { -char *(*pfn) = (char *(*)) free +#ifndef free + char *p = (char *) free; +#endif + ; return 0; } @@ -10048,29 +10033,36 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - bfd_cv_decl_needed_free=no + ac_cv_have_decl_free=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -bfd_cv_decl_needed_free=yes +ac_cv_have_decl_free=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_free" >&5 +echo "${ECHO_T}$ac_cv_have_decl_free" >&6 +if test $ac_cv_have_decl_free = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FREE 1 +_ACEOF -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_free" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_free" >&6 -if test $bfd_cv_decl_needed_free = yes; then -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_FREE 1 +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FREE 0 _ACEOF + fi -echo "$as_me:$LINENO: checking whether getenv must be declared" >&5 -echo $ECHO_N "checking whether getenv must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_getenv+set}" = set; then + +echo "$as_me:$LINENO: checking whether getenv is declared" >&5 +echo $ECHO_N "checking whether getenv is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_getenv+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -10079,25 +10071,14 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#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 +$ac_includes_default int main () { -char *(*pfn) = (char *(*)) getenv +#ifndef getenv + char *p = (char *) getenv; +#endif + ; return 0; } @@ -10124,29 +10105,36 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - bfd_cv_decl_needed_getenv=no + ac_cv_have_decl_getenv=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -bfd_cv_decl_needed_getenv=yes +ac_cv_have_decl_getenv=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_getenv" >&5 +echo "${ECHO_T}$ac_cv_have_decl_getenv" >&6 +if test $ac_cv_have_decl_getenv = yes; then -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_getenv" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_getenv" >&6 -if test $bfd_cv_decl_needed_getenv = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETENV 1 +_ACEOF -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_GETENV 1 + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_GETENV 0 _ACEOF + fi -echo "$as_me:$LINENO: checking whether malloc must be declared" >&5 -echo $ECHO_N "checking whether malloc must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_malloc+set}" = set; then + +echo "$as_me:$LINENO: checking whether malloc is declared" >&5 +echo $ECHO_N "checking whether malloc is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_malloc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -10155,25 +10143,14 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#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 +$ac_includes_default int main () { -char *(*pfn) = (char *(*)) malloc +#ifndef malloc + char *p = (char *) malloc; +#endif + ; return 0; } @@ -10200,29 +10177,36 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - bfd_cv_decl_needed_malloc=no + ac_cv_have_decl_malloc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -bfd_cv_decl_needed_malloc=yes +ac_cv_have_decl_malloc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_malloc" >&5 +echo "${ECHO_T}$ac_cv_have_decl_malloc" >&6 +if test $ac_cv_have_decl_malloc = yes; then -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_malloc" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_malloc" >&6 -if test $bfd_cv_decl_needed_malloc = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_MALLOC 1 +_ACEOF -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_MALLOC 1 + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_MALLOC 0 _ACEOF + fi -echo "$as_me:$LINENO: checking whether realloc must be declared" >&5 -echo $ECHO_N "checking whether realloc must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_realloc+set}" = set; then + +echo "$as_me:$LINENO: checking whether realloc is declared" >&5 +echo $ECHO_N "checking whether realloc is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_realloc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -10231,25 +10215,14 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#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 +$ac_includes_default int main () { -char *(*pfn) = (char *(*)) realloc +#ifndef realloc + char *p = (char *) realloc; +#endif + ; return 0; } @@ -10276,29 +10249,36 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - bfd_cv_decl_needed_realloc=no + ac_cv_have_decl_realloc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -bfd_cv_decl_needed_realloc=yes +ac_cv_have_decl_realloc=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_realloc" >&5 +echo "${ECHO_T}$ac_cv_have_decl_realloc" >&6 +if test $ac_cv_have_decl_realloc = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_REALLOC 1 +_ACEOF -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_realloc" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_realloc" >&6 -if test $bfd_cv_decl_needed_realloc = yes; then -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_REALLOC 1 +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_REALLOC 0 _ACEOF + fi -echo "$as_me:$LINENO: checking whether strstr must be declared" >&5 -echo $ECHO_N "checking whether strstr must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_strstr+set}" = set; then + +echo "$as_me:$LINENO: checking whether strstr is declared" >&5 +echo $ECHO_N "checking whether strstr is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_strstr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -10307,25 +10287,14 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ - -#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 +$ac_includes_default int main () { -char *(*pfn) = (char *(*)) strstr +#ifndef strstr + char *p = (char *) strstr; +#endif + ; return 0; } @@ -10352,27 +10321,34 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - bfd_cv_decl_needed_strstr=no + ac_cv_have_decl_strstr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -bfd_cv_decl_needed_strstr=yes +ac_cv_have_decl_strstr=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_strstr" >&5 +echo "${ECHO_T}$ac_cv_have_decl_strstr" >&6 +if test $ac_cv_have_decl_strstr = yes; then -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_strstr" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_strstr" >&6 -if test $bfd_cv_decl_needed_strstr = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRSTR 1 +_ACEOF -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_STRSTR 1 + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_STRSTR 0 _ACEOF + fi + # If we are configured native, pick a core file support file. COREFILE= COREFLAG= diff --git a/bfd/configure.in b/bfd/configure.in index 97b22bea33..3870090d95 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -135,12 +135,12 @@ AC_CHECK_DECLS(fseeko64) BFD_BINARY_FOPEN -BFD_NEED_DECLARATION(ffs) -BFD_NEED_DECLARATION(free) -BFD_NEED_DECLARATION(getenv) -BFD_NEED_DECLARATION(malloc) -BFD_NEED_DECLARATION(realloc) -BFD_NEED_DECLARATION(strstr) +AC_CHECK_DECLS(ffs) +AC_CHECK_DECLS(free) +AC_CHECK_DECLS(getenv) +AC_CHECK_DECLS(malloc) +AC_CHECK_DECLS(realloc) +AC_CHECK_DECLS(strstr) # If we are configured native, pick a core file support file. COREFILE= diff --git a/bfd/sysdep.h b/bfd/sysdep.h index b3c917f052..d51ebfa13a 100644 --- a/bfd/sysdep.h +++ b/bfd/sysdep.h @@ -105,27 +105,27 @@ extern char *strrchr (); #include "filenames.h" -#ifdef NEED_DECLARATION_FFS +#if !HAVE_DECL_FFS extern int ffs (int); #endif -#ifdef NEED_DECLARATION_FREE +#if !HAVE_DECL_FREE extern void free (); #endif -#ifdef NEED_DECLARATION_GETENV +#if !HAVE_DECL_GETENV extern char *getenv (); #endif -#ifdef NEED_DECLARATION_MALLOC +#if !HAVE_DECL_MALLOC extern PTR malloc (); #endif -#ifdef NEED_DECLARATION_REALLOC +#if !HAVE_DECL_REALLOC extern PTR realloc (); #endif -#ifdef NEED_DECLARATION_STRSTR +#if !HAVE_DECL_STRSTR extern char *strstr (); #endif -- 2.34.1