From: Steve Ellcey Date: Fri, 1 Jul 2005 15:19:47 +0000 (+0000) Subject: * configure.in (AM_BINUTILS_WARNINGS): Add. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=398ee8f162e94e0808230e60ea153d16de7755b0;p=binutils-gdb.git * configure.in (AM_BINUTILS_WARNINGS): Add. (BFD_NEED_DECLARATION): Replace with AC_CHECK_DECLS. * configure: Regenerate. * config.in: Regenerate. * objdump.c (NEED_DECLARATION_*): Replace with !HAVE_DECL_*. * bucomm.h: (NEED_DECLARATION_*): Ditto. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index ea8e6f82ecc..3e255868619 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,12 @@ +2005-07-01 Steve Ellcey + + * configure.in (AM_BINUTILS_WARNINGS): Add. + (BFD_NEED_DECLARATION): Replace with AC_CHECK_DECLS. + * configure: Regenerate. + * config.in: Regenerate. + * objdump.c (NEED_DECLARATION_*): Replace with !HAVE_DECL_*. + * bucomm.h: (NEED_DECLARATION_*): Ditto. + 2005-06-30 Ben Elliston * Makefile.am (check-DEJAGNU): Don't search for expect. diff --git a/binutils/bucomm.h b/binutils/bucomm.h index 863964611ca..df89ea5b00b 100644 --- a/binutils/bucomm.h +++ b/binutils/bucomm.h @@ -72,21 +72,21 @@ extern char *strrchr (); #endif #endif -#ifdef NEED_DECLARATION_STRSTR +#if !HAVE_DECL_STRSTR extern char *strstr (); #endif #ifdef HAVE_SBRK -#ifdef NEED_DECLARATION_SBRK +#if !HAVE_DECL_SBRK extern char *sbrk (); #endif #endif -#ifdef NEED_DECLARATION_GETENV +#if !HAVE_DECL_GETENV extern char *getenv (); #endif -#ifdef NEED_DECLARATION_ENVIRON +#if !HAVE_DECL_ENVIRON extern char **environ; #endif diff --git a/binutils/config.in b/binutils/config.in index ee95a12d0ed..b690906d2f4 100644 --- a/binutils/config.in +++ b/binutils/config.in @@ -27,13 +27,33 @@ /* Define to 1 if you have the `dcgettext' function. */ #undef HAVE_DCGETTEXT +/* Define to 1 if you have the declaration of `environ', and to 0 if you + don't. */ +#undef HAVE_DECL_ENVIRON + +/* Define to 1 if you have the declaration of `fprintf', and to 0 if you + don't. */ +#undef HAVE_DECL_FPRINTF + /* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you don't. */ #undef HAVE_DECL_GETC_UNLOCKED +/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. + */ +#undef HAVE_DECL_GETENV + /* Is the prototype for getopt in in the expected format? */ #undef HAVE_DECL_GETOPT +/* Define to 1 if you have the declaration of `sbrk', and to 0 if you don't. + */ +#undef HAVE_DECL_SBRK + +/* Define to 1 if you have the declaration of `strstr', and to 0 if you don't. + */ +#undef HAVE_DECL_STRSTR + /* Does the platform use an executable suffix? */ #undef HAVE_EXECUTABLE_SUFFIX @@ -166,21 +186,6 @@ /* Define to 1 if you have the `__argz_stringify' function. */ #undef HAVE___ARGZ_STRINGIFY -/* Define if environ is not declared in system header files. */ -#undef NEED_DECLARATION_ENVIRON - -/* Define if fprintf is not declared in system header files. */ -#undef NEED_DECLARATION_FPRINTF - -/* Define if getenv is not declared in system header files. */ -#undef NEED_DECLARATION_GETENV - -/* Define if sbrk is not declared in system header files. */ -#undef NEED_DECLARATION_SBRK - -/* Define if strstr is not declared in system header files. */ -#undef NEED_DECLARATION_STRSTR - /* Name of package */ #undef PACKAGE diff --git a/binutils/configure b/binutils/configure index 899f044e1d1..967cd06a895 100755 --- a/binutils/configure +++ b/binutils/configure @@ -4074,6 +4074,7 @@ echo "$as_me: error: bad value ${enableval} for BFD commonbfdlib option" >&2;} { (exit 1); exit 1; }; } ;; esac fi; + WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" # Check whether --enable-werror or --disable-werror was given. @@ -4120,6 +4121,7 @@ fi + ac_config_headers="$ac_config_headers config.h:config.in" @@ -9885,9 +9887,9 @@ _ACEOF fi -echo "$as_me:$LINENO: checking whether fprintf must be declared" >&5 -echo $ECHO_N "checking whether fprintf must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_fprintf+set}" = set; then +echo "$as_me:$LINENO: checking whether fprintf is declared" >&5 +echo $ECHO_N "checking whether fprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_fprintf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -9896,25 +9898,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 *(*)) fprintf +#ifndef fprintf + char *p = (char *) fprintf; +#endif + ; return 0; } @@ -9941,29 +9932,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_fprintf=no + ac_cv_have_decl_fprintf=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -bfd_cv_decl_needed_fprintf=yes +ac_cv_have_decl_fprintf=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_fprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_fprintf" >&6 +if test $ac_cv_have_decl_fprintf = yes; then -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_fprintf" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_fprintf" >&6 -if test $bfd_cv_decl_needed_fprintf = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FPRINTF 1 +_ACEOF -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_FPRINTF 1 + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FPRINTF 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 +fi +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 @@ -9972,25 +9968,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; } @@ -10017,29 +10002,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 -echo "$as_me:$LINENO: checking whether sbrk must be declared" >&5 -echo $ECHO_N "checking whether sbrk must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_sbrk+set}" = set; then +fi +echo "$as_me:$LINENO: checking whether sbrk is declared" >&5 +echo $ECHO_N "checking whether sbrk is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_sbrk+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -10048,25 +10038,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 *(*)) sbrk +#ifndef sbrk + char *p = (char *) sbrk; +#endif + ; return 0; } @@ -10093,29 +10072,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_sbrk=no + ac_cv_have_decl_sbrk=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -bfd_cv_decl_needed_sbrk=yes +ac_cv_have_decl_sbrk=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_sbrk" >&5 +echo "${ECHO_T}$ac_cv_have_decl_sbrk" >&6 +if test $ac_cv_have_decl_sbrk = yes; then -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_sbrk" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_sbrk" >&6 -if test $bfd_cv_decl_needed_sbrk = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SBRK 1 +_ACEOF -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_SBRK 1 + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SBRK 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 +fi +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 @@ -10124,25 +10108,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; } @@ -10169,29 +10142,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_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 environ must be declared" >&5 -echo $ECHO_N "checking whether environ must be declared... $ECHO_C" >&6 -if test "${bfd_cv_decl_needed_environ+set}" = set; then +fi +echo "$as_me:$LINENO: checking whether environ is declared" >&5 +echo $ECHO_N "checking whether environ is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_environ+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -10200,25 +10178,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 *(*)) environ +#ifndef environ + char *p = (char *) environ; +#endif + ; return 0; } @@ -10245,26 +10212,31 @@ 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_environ=no + ac_cv_have_decl_environ=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -bfd_cv_decl_needed_environ=yes +ac_cv_have_decl_environ=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_environ" >&5 +echo "${ECHO_T}$ac_cv_have_decl_environ" >&6 +if test $ac_cv_have_decl_environ = yes; then -echo "$as_me:$LINENO: result: $bfd_cv_decl_needed_environ" >&5 -echo "${ECHO_T}$bfd_cv_decl_needed_environ" >&6 -if test $bfd_cv_decl_needed_environ = yes; then +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ENVIRON 1 +_ACEOF -cat >>confdefs.h <<\_ACEOF -#define NEED_DECLARATION_ENVIRON 1 + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ENVIRON 0 _ACEOF -fi +fi echo "$as_me:$LINENO: checking whether getc_unlocked is declared" >&5 echo $ECHO_N "checking whether getc_unlocked is declared... $ECHO_C" >&6 if test "${ac_cv_have_decl_getc_unlocked+set}" = set; then diff --git a/binutils/configure.in b/binutils/configure.in index 2dcd3644287..0f328a34e15 100644 --- a/binutils/configure.in +++ b/binutils/configure.in @@ -29,49 +29,8 @@ AC_ARG_ENABLE(commonbfdlib, *) AC_MSG_ERROR([bad value ${enableval} for BFD commonbfdlib option]) ;; esac])dnl -dnl FIXME: The following is bfd/warning.m4 contents expanded -dnl When converting to current autotools, please replace with -dnl AM_BINUTILS_WARNINGS -WARN_CFLAGS="-W -Wall -Wstrict-prototypes -Wmissing-prototypes" - -AC_ARG_ENABLE(werror, - [ --enable-werror treat compile warnings as errors], - [case "${enableval}" in - yes | y) ERROR_ON_WARNING="yes" ;; - no | n) ERROR_ON_WARNING="no" ;; - *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;; - esac]) - -# Enable -Werror by default when using gcc -if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then - ERROR_ON_WARNING=yes -fi - -NO_WERROR= -if test "${ERROR_ON_WARNING}" = yes ; then - WARN_CFLAGS="$WARN_CFLAGS -Werror" - NO_WERROR="-Wno-error" -fi +AM_BINUTILS_WARNINGS -AC_ARG_ENABLE(build-warnings, -[ --enable-build-warnings Enable build-time compiler warnings], -[case "${enableval}" in - yes) ;; - no) WARN_CFLAGS="-w";; - ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"` - WARN_CFLAGS="${WARN_CFLAGS} ${t}";; - *,) t=`echo "${enableval}" | sed -e "s/,/ /g"` - WARN_CFLAGS="${t} ${WARN_CFLAGS}";; - *) WARN_CFLAGS=`echo "${enableval}" | sed -e "s/,/ /g"`;; -esac]) - -if test x"$silent" != x"yes" && test x"$WARN_CFLAGS" != x""; then - echo "Setting warning flags = $WARN_CFLAGS" 6>&1 -fi - -AC_SUBST(WARN_CFLAGS) -AC_SUBST(NO_WERROR) - AM_CONFIG_HEADER(config.h:config.in) if test -z "$target" ; then @@ -212,12 +171,7 @@ if test $bu_cv_header_utime_h = yes; then AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does define struct utimbuf?]) fi -BFD_NEED_DECLARATION(fprintf) -BFD_NEED_DECLARATION(strstr) -BFD_NEED_DECLARATION(sbrk) -BFD_NEED_DECLARATION(getenv) -BFD_NEED_DECLARATION(environ) -AC_CHECK_DECLS(getc_unlocked) +AC_CHECK_DECLS([fprintf, strstr, sbrk, getenv, environ, getc_unlocked]) BFD_BINARY_FOPEN diff --git a/binutils/objdump.c b/binutils/objdump.c index e598a23a9ed..195b9c1198a 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -65,7 +65,7 @@ #define BYTES_IN_WORD 32 #include "aout/aout64.h" -#ifdef NEED_DECLARATION_FPRINTF +#if !HAVE_DECL_FPRINTF /* This is needed by init_disassemble_info(). */ extern int fprintf (FILE *, const char *, ...); #endif