This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
gcc_AC_INITFINI_ARRAY
- From: Andreas Schwab <schwab at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 1 Dec 2002 03:12:23 +0100
- Subject: gcc_AC_INITFINI_ARRAY
--enable-initfini-array didn't do anything.
Andreas.
2002-12-01 Andreas Schwab <schwab@suse.de>
* configure.in: Restore CFLAGS before gcc_AC_INITFINI_ARRAY.
Move --enable-initfini-array check ...
* aclocal.m4 (gcc_AC_INITFINI_ARRAY): ... here. Define
HAVE_INITFINI_ARRAY also when --enable-initfini-array is given.
Don't AC_SUBST gcc_cv_initfinit_array. Use AC_TRY_RUN.
* configure: Rebuild.
--- gcc/aclocal.m4.~1.61.~ 2002-11-25 11:17:02.000000000 +0100
+++ gcc/aclocal.m4 2002-12-01 03:09:03.000000000 +0100
@@ -1697,27 +1697,21 @@ strdup strtoul tsearch __argz_count __ar
])
AC_DEFUN(gcc_AC_INITFINI_ARRAY,
-[AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
+[AC_ARG_ENABLE(initfini-array,
+ [ --enable-initfini-array use .init_array/.fini_array sections],
+ [], [
+AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
gcc_cv_initfinit_array, [dnl
- cat > conftest.c <<EOF
+ AC_TRY_RUN([
static int x = -1;
int main (void) { return x; }
int foo (void) { x = 0; }
-int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
-EOF
- if AC_TRY_COMMAND([${CC-cc} -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
- then
- if ./conftest; then
- gcc_cv_initfinit_array=yes
- else
- gcc_cv_initfinit_array=no
- fi
- else
- gcc_cv_initfinit_array=no
- fi
- rm -f conftest*])
- AC_SUBST(gcc_cv_initfinit_array)
- if test $gcc_cv_initfinit_array = yes; then
- AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
- [Define .init_array/.fini_array sections are available and working.])
- fi])
+int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;],
+ [gcc_cv_initfinit_array=yes], [gcc_cv_initfinit_array=no],
+ [gcc_cv_initfinit_array=no])])
+ enable_initfini_array=$gcc_cv_initfini_array
+])
+if test $enable_initfini_array = yes; then
+ AC_DEFINE(HAVE_INITFINI_ARRAY, 1,
+ [Define .init_array/.fini_array sections are available and working.])
+fi])
--- gcc/configure.in.~1.626.~ 2002-11-27 11:14:29.000000000 +0100
+++ gcc/configure.in 2002-12-01 03:03:32.000000000 +0100
@@ -764,13 +764,11 @@ if test $gcc_cv_type_clock_t = yes; then
[Define if <time.h> defines clock_t.])
fi
-AC_ARG_ENABLE(initfini-array,
- [ --enable-initfini-array use .init_array/.fini_array sections],
- gcc_cv_initfinit_array=$enableval, [gcc_AC_INITFINI_ARRAY])
-
# Restore CFLAGS from before the gcc_AC_NEED_DECLARATIONS tests.
CFLAGS="$saved_CFLAGS"
+gcc_AC_INITFINI_ARRAY
+
# mkdir takes a single argument on some systems.
gcc_AC_FUNC_MKDIR_TAKES_ONE_ARG