From 574669dceff09f7cb164ee203e9e1dbb4c79f205 Mon Sep 17 00:00:00 2001 From: Jerome Guitton Date: Wed, 20 Apr 2005 15:00:15 +0000 Subject: [PATCH] * configure.in: Fix the check for basename declaration. Add check for declarations of ftello, ftello64, fseeko, fseeko64. * configure: Regenerate. * config.in: Ditto. * sysdep.h: If needed, declare ftello, ftello64, fseeko, fseeko64. --- bfd/ChangeLog | 8 ++ bfd/config.in | 16 +++ bfd/configure | 291 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- bfd/configure.in | 6 +- bfd/sysdep.h | 24 +++++ 5 files changed, 342 insertions(+), 3 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index db0ca17aed..a01796ea57 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2005-04-20 Jerome Guitton + + * configure.in: Fix the check for basename declaration. Add check + for declarations of ftello, ftello64, fseeko, fseeko64. + * configure: Regenerate. + * config.in: Ditto. + * sysdep.h: If needed, declare ftello, ftello64, fseeko, fseeko64. + 2005-04-19 David S. Miller * elfxx-sparc.c: New file. diff --git a/bfd/config.in b/bfd/config.in index 9ddd8787be..12f7239069 100644 --- a/bfd/config.in +++ b/bfd/config.in @@ -28,6 +28,22 @@ don't. */ #undef HAVE_DECL_BASENAME +/* Define to 1 if you have the declaration of `fseeko', and to 0 if you don't. + */ +#undef HAVE_DECL_FSEEKO + +/* Define to 1 if you have the declaration of `fseeko64', and to 0 if you + don't. */ +#undef HAVE_DECL_FSEEKO64 + +/* Define to 1 if you have the declaration of `ftello', and to 0 if you don't. + */ +#undef HAVE_DECL_FTELLO + +/* Define to 1 if you have the declaration of `ftello64', and to 0 if you + don't. */ +#undef HAVE_DECL_FTELLO64 + /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H diff --git a/bfd/configure b/bfd/configure index 8d75a92dcb..43af5887ab 100755 --- a/bfd/configure +++ b/bfd/configure @@ -9556,8 +9556,7 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include "sysdep.h" - +$ac_includes_default int main () { @@ -9618,6 +9617,294 @@ _ACEOF fi +echo "$as_me:$LINENO: checking whether ftello is declared" >&5 +echo $ECHO_N "checking whether ftello is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_ftello+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 ftello + char *p = (char *) ftello; +#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_ftello=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_ftello=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_ftello" >&5 +echo "${ECHO_T}$ac_cv_have_decl_ftello" >&6 +if test $ac_cv_have_decl_ftello = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FTELLO 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FTELLO 0 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking whether ftello64 is declared" >&5 +echo $ECHO_N "checking whether ftello64 is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_ftello64+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 ftello64 + char *p = (char *) ftello64; +#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_ftello64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_ftello64=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_ftello64" >&5 +echo "${ECHO_T}$ac_cv_have_decl_ftello64" >&6 +if test $ac_cv_have_decl_ftello64 = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FTELLO64 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FTELLO64 0 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking whether fseeko is declared" >&5 +echo $ECHO_N "checking whether fseeko is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_fseeko+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 fseeko + char *p = (char *) fseeko; +#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_fseeko=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_fseeko=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_fseeko" >&5 +echo "${ECHO_T}$ac_cv_have_decl_fseeko" >&6 +if test $ac_cv_have_decl_fseeko = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FSEEKO 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FSEEKO 0 +_ACEOF + + +fi + + +echo "$as_me:$LINENO: checking whether fseeko64 is declared" >&5 +echo $ECHO_N "checking whether fseeko64 is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_fseeko64+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 fseeko64 + char *p = (char *) fseeko64; +#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_fseeko64=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_fseeko64=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_fseeko64" >&5 +echo "${ECHO_T}$ac_cv_have_decl_fseeko64" >&6 +if test $ac_cv_have_decl_fseeko64 = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FSEEKO64 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FSEEKO64 0 +_ACEOF + + +fi + + case "${host}" in diff --git a/bfd/configure.in b/bfd/configure.in index d5b7554f18..97b22bea33 100644 --- a/bfd/configure.in +++ b/bfd/configure.in @@ -127,7 +127,11 @@ AC_HEADER_DIRENT AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid) AC_CHECK_FUNCS(strtoull) -AC_CHECK_DECLS(basename, , , [#include "sysdep.h"]) +AC_CHECK_DECLS(basename) +AC_CHECK_DECLS(ftello) +AC_CHECK_DECLS(ftello64) +AC_CHECK_DECLS(fseeko) +AC_CHECK_DECLS(fseeko64) BFD_BINARY_FOPEN diff --git a/bfd/sysdep.h b/bfd/sysdep.h index e94491d984..b3c917f052 100644 --- a/bfd/sysdep.h +++ b/bfd/sysdep.h @@ -129,6 +129,30 @@ extern PTR realloc (); extern char *strstr (); #endif +#ifdef HAVE_FTELLO +#if !HAVE_DECL_FTELLO +extern off_t ftello (FILE *stream); +#endif +#endif + +#ifdef HAVE_FTELLO64 +#if !HAVE_DECL_FTELLO64 +extern off64_t ftello64 (FILE *stream); +#endif +#endif + +#ifdef HAVE_FSEEKO +#if !HAVE_DECL_FSEEKO +extern int fseeko (FILE *stream, off_t offset, int whence); +#endif +#endif + +#ifdef HAVE_FSEEKO64 +#if !HAVE_DECL_FSEEKO64 +extern int fseeko64 (FILE *stream, off64_t offset, int whence); +#endif +#endif + /* Define offsetof for those systems which lack it */ #ifndef offsetof -- 2.11.0