This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

v3: Move AC_PROG_CC/CXX code block into configure.ac.


Autoconf 2.64 has more stringent checks and expansion of macro
dependencies (often exposing ordering issues that were latent before).
One of them is that you cannot have a situation where, inside a macro
(GLIBCXX_CONFIGURE), you first expand a macro (AC_PROG_CC) and then
later call another macro (AC_EGREP_CPP) that requires the second one:

$ autoconf
configure.ac:83: warning: AC_REQUIRE: `AC_PROG_CC' was expanded before it was required
../../../autoconf/lib/autoconf/c.m4:433: AC_LANG_COMPILER(C) is expanded from...
../../../autoconf/lib/autoconf/lang.m4:315: AC_LANG_COMPILER_REQUIRE is expanded from...
../../../autoconf/lib/autoconf/lang.m4:358: AC_LANG_PREPROC_REQUIRE is expanded from...
../../../autoconf/lib/autoconf/general.m4:2525: AC_EGREP_CPP is expanded from...
acinclude.m4:48: GLIBCXX_CONFIGURE is expanded from...
configure.ac:83: the top level

This is because the ordering will end up wrong in the configure script.

OK to pull the check into configure.ac instead, as below?
Another possibility would be to copy the code block into a new macro,
say GLIBCXX_CONFIGURE_CC, and AC_REQUIRE it.  That would also go to
ensure that ordering is preserved.

Thanks,
Ralf

libstdc++-v3/ChangeLog:
2009-07-30  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* configure.ac: Move guarded checks for CC and CXX ...
	* acinclude.m4 (GLIBCXX_CONFIGURE): ... from here.
	* configure: Regenerate.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index b0b6241..45e0229 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -79,35 +79,6 @@ AC_DEFUN([GLIBCXX_CONFIGURE], [
     AC_HELP_STRING([--with-newlib],
                    [assume newlib as a system C library]))
 
-  # We're almost certainly being configured before anything else which uses
-  # C++, so all of our AC_PROG_* discoveries will be cached.  It's vital that
-  # we not cache the value of CXX that we "discover" here, because it's set
-  # to something unique for us and libjava.  Other target libraries need to
-  # find CXX for themselves.  We yank the rug out from under the normal AC_*
-  # process by sneakily renaming the cache variable.  This also lets us debug
-  # the value of "our" CXX in postmortems.
-  #
-  # We must also force CXX to /not/ be a precious variable, otherwise the
-  # wrong (non-multilib-adjusted) value will be used in multilibs.  This
-  # little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS.  And as a side
-  # effect, CXXFLAGS is no longer automagically subst'd, so we have to do
-  # that ourselves.  Un-preciousing AC_PROG_CC also affects CC and CFLAGS.
-  #
-  # -fno-builtin must be present here so that a non-conflicting form of
-  # std::exit can be guessed by AC_PROG_CXX, and used in later tests.
-
-  m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX])
-  m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS])
-  m4_define([_AC_ARG_VAR_PRECIOUS],[])
-  save_CXXFLAGS="$CXXFLAGS"
-  CXXFLAGS="$CXXFLAGS -fno-builtin"
-  AC_PROG_CC
-  AC_PROG_CXX
-  CXXFLAGS="$save_CXXFLAGS"
-  m4_rename_force([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
-  AC_SUBST(CFLAGS)
-  AC_SUBST(CXXFLAGS)
-
   # Will set LN_S to either 'ln -s', 'ln', or 'cp -p' (if linking isn't
   # available).  Uncomment the next line to force a particular method.
   AC_PROG_LN_S
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 977e12c..0b1edfd 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -78,7 +78,36 @@ AM_INIT_AUTOMAKE([1.9.3 no-define foreign no-dependencies -Wall -Wno-portability
 AH_TEMPLATE(PACKAGE, [Name of package])
 AH_TEMPLATE(VERSION, [Version number of package])
 
-# Runs configure.host, finds CC, CXX, and assorted other critical bits.  Sets
+# We're almost certainly being configured before anything else which uses
+# C++, so all of our AC_PROG_* discoveries will be cached.  It's vital that
+# we not cache the value of CXX that we "discover" here, because it's set
+# to something unique for us and libjava.  Other target libraries need to
+# find CXX for themselves.  We yank the rug out from under the normal AC_*
+# process by sneakily renaming the cache variable.  This also lets us debug
+# the value of "our" CXX in postmortems.
+#
+# We must also force CXX to /not/ be a precious variable, otherwise the
+# wrong (non-multilib-adjusted) value will be used in multilibs.  This
+# little trick also affects CPPFLAGS, CXXFLAGS, and LDFLAGS.  And as a side
+# effect, CXXFLAGS is no longer automagically subst'd, so we have to do
+# that ourselves.  Un-preciousing AC_PROG_CC also affects CC and CFLAGS.
+#
+# -fno-builtin must be present here so that a non-conflicting form of
+# std::exit can be guessed by AC_PROG_CXX, and used in later tests.
+
+m4_define([ac_cv_prog_CXX],[glibcxx_cv_prog_CXX])
+m4_rename([_AC_ARG_VAR_PRECIOUS],[glibcxx_PRECIOUS])
+m4_define([_AC_ARG_VAR_PRECIOUS],[])
+save_CXXFLAGS="$CXXFLAGS"
+CXXFLAGS="$CXXFLAGS -fno-builtin"
+AC_PROG_CC
+AC_PROG_CXX
+CXXFLAGS="$save_CXXFLAGS"
+m4_rename_force([glibcxx_PRECIOUS],[_AC_ARG_VAR_PRECIOUS])
+AC_SUBST(CFLAGS)
+AC_SUBST(CXXFLAGS)
+
+# Runs configure.host, and assorted other critical bits.  Sets
 # up critical shell variables.
 GLIBCXX_CONFIGURE
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]