I noticed that in the config.h generated for libiberty has HAVE_DECL_ASPRINTF defined as 0. This hapens because _GNU_SOURCE is not used when running the test programs.
Coping the test that enables _GNU_SOURCE from gcc/configure.ac to libiberty/configure.ac results in HAVE_DECL_ASPRINTF being defined as 1. I am not sure where in libiberty/configure.ac should the test be added (if it should). Is the attached patch correct? If so, I will submit a formal patch to gcc-patches. I am currently bootstraping the trunk with the patch applied. Thanks, Rafael
Index: libiberty/configure.ac =================================================================== --- libiberty/configure.ac (revision 107446) +++ libiberty/configure.ac (working copy) @@ -227,6 +227,21 @@ AC_SUBST_FILE(host_makefile_frag) # It's OK to check for header files. Although the compiler may not be # able to link anything, it had better be able to at least compile # something. + +AC_MSG_CHECKING(for GNU C library) +AC_CACHE_VAL(gcc_cv_glibc, +[AC_COMPILE_IFELSE([AC_LANG_PROGRAM( + [[#include <features.h>]], [[ +#if ! (defined __GLIBC__ || defined __GNU_LIBRARY__) +#error Not a GNU C library system +#endif]])], + [gcc_cv_glibc=yes], + [gcc_cv_glibc=no])]) +AC_MSG_RESULT($gcc_cv_glibc) +if test $gcc_cv_glibc = yes; then + AC_DEFINE(_GNU_SOURCE, 1, [Always define this when using the GNU C Library]) +fi + AC_CHECK_HEADERS(sys/file.h sys/param.h limits.h stdlib.h malloc.h string.h unistd.h strings.h sys/time.h time.h sys/resource.h sys/stat.h sys/mman.h fcntl.h alloca.h sys/pstat.h sys/sysmp.h sys/sysinfo.h machine/hal_sysinfo.h sys/table.h sys/sysctl.h sys/systemcfg.h stdint.h stdio_ext.h) AC_HEADER_SYS_WAIT AC_HEADER_TIME Index: libiberty/configure =================================================================== --- libiberty/configure (revision 107446) +++ libiberty/configure (working copy) @@ -3594,6 +3594,71 @@ host_makefile_frag=${frag} # able to link anything, it had better be able to at least compile # something. +echo "$as_me:$LINENO: checking for GNU C library" >&5 +echo $ECHO_N "checking for GNU C library... $ECHO_C" >&6 +if test "${gcc_cv_glibc+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. */ +#include <features.h> +int +main () +{ + +#if ! (defined __GLIBC__ || defined __GNU_LIBRARY__) +#error Not a GNU C library system +#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 + gcc_cv_glibc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +gcc_cv_glibc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +echo "$as_me:$LINENO: result: $gcc_cv_glibc" >&5 +echo "${ECHO_T}$gcc_cv_glibc" >&6 +if test $gcc_cv_glibc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define _GNU_SOURCE 1 +_ACEOF + +fi + + @@ -6424,18 +6489,24 @@ else ac_cv_func_fork_works=cross else cat >conftest.$ac_ext <<_ACEOF -/* By Ruediger Kuhlmann. */ - #include <sys/types.h> - #if HAVE_UNISTD_H - # include <unistd.h> - #endif - /* Some systems only have a dummy stub for fork() */ - int main () - { - if (fork() < 0) - exit (1); - exit (0); - } +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* By Ruediger Kuhlmann. */ + if (fork() < 0) + exit (1); + exit (0); + + ; + return 0; +} _ACEOF rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
pgpNR8WIn5qoA.pgp
Description: PGP signature