diff options
author | Paul Brook <paul@codesourcery.com> | 2006-09-20 21:06:36 +0400 |
---|---|---|
committer | Paul Brook <paul@codesourcery.com> | 2006-09-20 21:06:36 +0400 |
commit | ad544ba1cd40539d87c6357dbd74bc753e546340 (patch) | |
tree | a43f995577f2f2d566f838b341845aecbc1ac562 /libgloss | |
parent | 51172826e0dcace6fec478d1727ee53914b6f0a6 (diff) |
2006-09-20 Paul Brook <paul@codesourcery.com>
libgloss/
* configure.in: Add check for .init_array.
* configure: Regenerate.
Diffstat (limited to 'libgloss')
-rwxr-xr-x | libgloss/configure | 35 | ||||
-rw-r--r-- | libgloss/configure.in | 25 |
2 files changed, 60 insertions, 0 deletions
diff --git a/libgloss/configure b/libgloss/configure index 1b2f62305..fd765dc01 100755 --- a/libgloss/configure +++ b/libgloss/configure @@ -1031,6 +1031,40 @@ else fi +echo $ac_n "checking for .preinit_array/.init_array/.fini_array support""... $ac_c" 1>&6 +echo "configure:1036: checking for .preinit_array/.init_array/.fini_array support" >&5 +if eval "test \"`echo '$''{'libc_cv_initfinit_array'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +int _start (void) { return 0; } +int __start (void) { return 0; } +int foo (void) { return 1; } +int (*fp) (void) __attribute__ ((section (".init_array"))) = foo; +EOF +if { ac_try='${CC} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c + -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD'; { (eval echo configure:1047: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } +then + if readelf -S conftest | grep -e INIT_ARRAY > /dev/null; then + libc_cv_initfinit_array=yes + else + libc_cv_initfinit_array=no + fi +else + libc_cv_initfinit_array=no +fi +rm -f conftest* +fi + +echo "$ac_t""$libc_cv_initfinit_array" 1>&6 + +if test $libc_cv_initfinit_array = yes; then + cat >> confdefs.h <<EOF +#define HAVE_INITFINI_ARRAY 1 +EOF + +fi + host_makefile_frag=${srcdir}/config/default.mh host_makefile_frag_path=$host_makefile_frag @@ -1207,6 +1241,7 @@ s%@AS@%$AS%g s%@AR@%$AR%g s%@LD@%$LD%g s%@RANLIB@%$RANLIB%g +s%@libc_cv_initfinit_array@%$libc_cv_initfinit_array%g s%@host_makefile_frag_path@%$host_makefile_frag_path%g /@host_makefile_frag@/r $host_makefile_frag s%@host_makefile_frag@%%g diff --git a/libgloss/configure.in b/libgloss/configure.in index 3eca088ec..fa5f459d7 100644 --- a/libgloss/configure.in +++ b/libgloss/configure.in @@ -181,6 +181,31 @@ LD=${LD-ld} AC_SUBST(LD) AC_PROG_RANLIB +AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support, + libc_cv_initfinit_array, [dnl +cat > conftest.c <<EOF +int _start (void) { return 0; } +int __start (void) { return 0; } +int foo (void) { return 1; } +int (*fp) (void) __attribute__ ((section (".init_array"))) = foo; +EOF +if AC_TRY_COMMAND([${CC} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c + -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD]) +then + if readelf -S conftest | grep -e INIT_ARRAY > /dev/null; then + libc_cv_initfinit_array=yes + else + libc_cv_initfinit_array=no + fi +else + libc_cv_initfinit_array=no +fi +rm -f conftest*]) +AC_SUBST(libc_cv_initfinit_array) +if test $libc_cv_initfinit_array = yes; then + AC_DEFINE_UNQUOTED(HAVE_INITFINI_ARRAY) +fi + host_makefile_frag=${srcdir}/config/default.mh dnl We have to assign the same value to other variables because autoconf |