From db50c8404c624dfe903294d439c54a6db7c6d6c8 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Thu, 9 Feb 2006 11:49:53 +0000 Subject: [PATCH] * configure.in (CHECK_DECLS): Add snprintf and vsnprintf. * configure: Regenerate. * objdump.c (fprintf): Remove declaration. * bucomm.h (fprintf): Declare if not already declared. (snprintf): Likewise. (vsnprintf): Likewise. --- binutils/ChangeLog | 9 +++ binutils/bucomm.h | 12 ++++ binutils/configure | 140 ++++++++++++++++++++++++++++++++++++++++++ binutils/configure.in | 3 +- binutils/objdump.c | 5 -- 5 files changed, 163 insertions(+), 6 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index fc78333e158..982523a6f67 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,12 @@ +2006-02-09 Eric Botcazou + + * configure.in (CHECK_DECLS): Add snprintf and vsnprintf. + * configure: Regenerate. + * objdump.c (fprintf): Remove declaration. + * bucomm.h (fprintf): Declare if not already declared. + (snprintf): Likewise. + (vsnprintf): Likewise. + 2006-02-08 H.J. Lu * readelf.c (process_program_headers): Match PT_TLS segment diff --git a/binutils/bucomm.h b/binutils/bucomm.h index 2c662c8e0af..9f914adeb58 100644 --- a/binutils/bucomm.h +++ b/binutils/bucomm.h @@ -90,6 +90,18 @@ extern char *getenv (); extern char **environ; #endif +#if !HAVE_DECL_FPRINTF +extern int fprintf (FILE *, const char *, ...); +#endif + +#if !HAVE_DECL_SNPRINTF +extern int snprintf(char *, size_t, const char *, ...); +#endif + +#if !HAVE_DECL_VSNPRINTF +extern int vsnprintf(char *, size_t, const char *, va_list); +#endif + #ifndef O_RDONLY #define O_RDONLY 0 #endif diff --git a/binutils/configure b/binutils/configure index 686f8c96df6..6ce8f23d76d 100755 --- a/binutils/configure +++ b/binutils/configure @@ -10490,6 +10490,146 @@ else _ACEOF +fi +echo "$as_me:$LINENO: checking whether snprintf is declared" >&5 +echo $ECHO_N "checking whether snprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_snprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef snprintf + char *p = (char *) snprintf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_snprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_snprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_snprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_snprintf" >&6 +if test $ac_cv_have_decl_snprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SNPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_SNPRINTF 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether vsnprintf is declared" >&5 +echo $ECHO_N "checking whether vsnprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_vsnprintf+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef vsnprintf + char *p = (char *) vsnprintf; +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_have_decl_vsnprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_vsnprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_vsnprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_vsnprintf" >&6 +if test $ac_cv_have_decl_vsnprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VSNPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VSNPRINTF 0 +_ACEOF + + fi diff --git a/binutils/configure.in b/binutils/configure.in index ed23e346b87..1d426afb87f 100644 --- a/binutils/configure.in +++ b/binutils/configure.in @@ -172,7 +172,8 @@ if test $bu_cv_header_utime_h = yes; then AC_DEFINE(HAVE_GOOD_UTIME_H, 1, [Does define struct utimbuf?]) fi -AC_CHECK_DECLS([fprintf, stpcpy, strstr, sbrk, getenv, environ, getc_unlocked]) +AC_CHECK_DECLS([fprintf, stpcpy, strstr, sbrk, getenv, environ, getc_unlocked, + snprintf, vsnprintf]) BFD_BINARY_FOPEN diff --git a/binutils/objdump.c b/binutils/objdump.c index fc9600c26ea..838f083f7ae 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -66,11 +66,6 @@ #define BYTES_IN_WORD 32 #include "aout/aout64.h" -#if !HAVE_DECL_FPRINTF -/* This is needed by init_disassemble_info(). */ -extern int fprintf (FILE *, const char *, ...); -#endif - /* Exit status. */ static int exit_status = 0; -- 2.30.2