diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index d06406a3e87..72b421b54dd 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,16 @@ +2005-04-13 Gabriel Dos Reis + + * asprintf.c: Include config.h. + * basename.c: Likewise. + * fdmatch.c: Likewise. + * hex.c: Likewise. + * lbasename.c: Likewise. + * spaces.c: Likewise. + * xatexit.c:Likewise. + * configure.ac: Do check declarations for basename, ffs, asprintf + and vasprintf for real. + * configure: Regenerate. + 2005-04-13 Gabriel Dos Reis * argv.c (dupargv): Allocate space of argv[argc], not diff --git a/libiberty/argv.c b/libiberty/argv.c index ad4c9a79388..bfa3896d089 100644 --- a/libiberty/argv.c +++ b/libiberty/argv.c @@ -22,6 +22,9 @@ Boston, MA 02111-1307, USA. */ /* Create and destroy argument vectors. An argument vector is simply an array of string pointers, terminated by a NULL pointer. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "ansidecl.h" #include "libiberty.h" diff --git a/libiberty/asprintf.c b/libiberty/asprintf.c index 3ef067ffac7..adcdcc28404 100644 --- a/libiberty/asprintf.c +++ b/libiberty/asprintf.c @@ -19,6 +19,9 @@ License along with libiberty; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "ansidecl.h" #include "libiberty.h" diff --git a/libiberty/basename.c b/libiberty/basename.c index 037a9060145..0f2c069f0cc 100644 --- a/libiberty/basename.c +++ b/libiberty/basename.c @@ -12,6 +12,9 @@ Behavior is undefined if the pathname ends in a directory separator. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "ansidecl.h" #include "libiberty.h" #include "safe-ctype.h" diff --git a/libiberty/configure b/libiberty/configure index c518aecb7ad..d9c54256425 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -6915,6 +6915,288 @@ _ACEOF fi done + echo "$as_me:$LINENO: checking whether basename is declared" >&5 +echo $ECHO_N "checking whether basename is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_basename+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 basename + char *p = (char *) basename; +#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_basename=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_basename=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_basename" >&5 +echo "${ECHO_T}$ac_cv_have_decl_basename" >&6 +if test $ac_cv_have_decl_basename = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_BASENAME 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_BASENAME 0 +_ACEOF + + +fi +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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +#ifndef ffs + char *p = (char *) ffs; +#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_ffs=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +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 + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FFS 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_FFS 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether asprintf is declared" >&5 +echo $ECHO_N "checking whether asprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_asprintf+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 asprintf + char *p = (char *) asprintf; +#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_asprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_asprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_asprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_asprintf" >&6 +if test $ac_cv_have_decl_asprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ASPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_ASPRINTF 0 +_ACEOF + + +fi +echo "$as_me:$LINENO: checking whether vasprintf is declared" >&5 +echo $ECHO_N "checking whether vasprintf is declared... $ECHO_C" >&6 +if test "${ac_cv_have_decl_vasprintf+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 vasprintf + char *p = (char *) vasprintf; +#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_vasprintf=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_have_decl_vasprintf=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_have_decl_vasprintf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_vasprintf" >&6 +if test $ac_cv_have_decl_vasprintf = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VASPRINTF 1 +_ACEOF + + +else + cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_VASPRINTF 0 +_ACEOF + + +fi + + echo "$as_me:$LINENO: checking whether canonicalize_file_name must be declared" >&5 echo $ECHO_N "checking whether canonicalize_file_name must be declared... $ECHO_C" >&6 if test "${libiberty_cv_decl_needed_canonicalize_file_name+set}" = set; then diff --git a/libiberty/configure.ac b/libiberty/configure.ac index b7932ec0846..92362d0b8b6 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -518,6 +518,7 @@ if test -z "${setobjs}"; then [AC_MSG_RESULT([no])]) AC_CHECK_FUNCS($checkfuncs) + AC_CHECK_DECLS([basename, ffs, asprintf, vasprintf]) libiberty_NEED_DECLARATION(canonicalize_file_name) fi diff --git a/libiberty/fdmatch.c b/libiberty/fdmatch.c index 76ad36f1de8..84df7845bbd 100644 --- a/libiberty/fdmatch.c +++ b/libiberty/fdmatch.c @@ -41,6 +41,9 @@ BUGS */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "ansidecl.h" #include "libiberty.h" #include diff --git a/libiberty/hex.c b/libiberty/hex.c index 9e4e306a7d4..5738762a7b2 100644 --- a/libiberty/hex.c +++ b/libiberty/hex.c @@ -18,6 +18,9 @@ not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include /* for EOF */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "libiberty.h" #include "safe-ctype.h" /* for HOST_CHARSET_ASCII */ diff --git a/libiberty/lbasename.c b/libiberty/lbasename.c index 4afe890013e..45858c84de9 100644 --- a/libiberty/lbasename.c +++ b/libiberty/lbasename.c @@ -37,6 +37,9 @@ and a path ending in @code{/} returns the empty string after it. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "ansidecl.h" #include "libiberty.h" #include "safe-ctype.h" diff --git a/libiberty/spaces.c b/libiberty/spaces.c index 6df0b13f0d2..8666abe2026 100644 --- a/libiberty/spaces.c +++ b/libiberty/spaces.c @@ -29,6 +29,9 @@ valid until at least the next call. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "ansidecl.h" #include "libiberty.h" diff --git a/libiberty/xatexit.c b/libiberty/xatexit.c index f29338a9f2a..6fdad9ed806 100644 --- a/libiberty/xatexit.c +++ b/libiberty/xatexit.c @@ -22,6 +22,9 @@ failure. If you use @code{xatexit} to register functions, you must use /* Adapted from newlib/libc/stdlib/{,at}exit.[ch]. If you use xatexit, you must call xexit instead of exit. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif #include "ansidecl.h" #include "libiberty.h"