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]

Re: [v3] Fix race condition in libstdc++-v3/configure.ac


* Paolo Bonzini wrote on Tue, Sep 01, 2009 at 10:06:06AM CEST:
> On 08/31/2009 11:26 PM, Ralf Wildenhues wrote:
> >I wasn't quite sure whether the 'cd include&&  make' is necessary each
> >time include/Makefile is changed, or only when config.status is invoked
> >without arguments (i.e., after configure runs).  The patch assumes the
> >latter and introduces a 'generate-headers' tag for this.
> 
> It seems safest to invoke "make -C include pch_build=" on every
> include/Makefile change, and leave the pch to be created by the
> recursive make invocation.  In principle, the task of
> include/Makefile could be done all by AC_CONFIG_LINKS, but not pch
> creation.

So you are saying that the fact that the precompiled headers are created
early is by accident, not intentional?  Doesn't the rest of the build
then possibly *use* these precompiled headers for compilation, and thus
possibly behave differently when they are not present?  (Yes, I
understand that that would be a bug in the pch, but it seems useful to
expose such a bug.)

One problem with entering include and running 'make' there right after
creating include/Makefile is that config.h typically does not exist yet,
because we build config files before config headers.  config.h is
required by bits/c++config.h.  That's why the patch below is broken.

> Also, you probably need to modify the configure-[+prefix+][+module+]
> definition in the toplevel, and add a : $(MAKE) there.

Probably.  Adding $(MAKE) in this case makes
  make -n configure-foodir

less useful (as it will change files, not just show what would happen)
but OTOH it would allow parallel make to work in libstdc++-v3/include
(when triggered from config.status).  Tough choice.  (Hmm, maybe I
should report this to bug-make again.)

Cheers,
Ralf

v3: fix config.status instantiation of subdir makefiles.

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

	* configure.ac: Replace AC_CONFIG_COMMANDS([default])
	instantiation with additional commands issued for each Makefile
	in glibcxx_SUBDIRS, so `./config.status subdir/Makefile' also
	runs these commands.  When generating include/Makefile, also
	run `make' in include.
	* configure: Regenerate.

diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index bc05d2d..fb061ba 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -388,44 +388,29 @@ AC_SUBST(LIBSUPCXX_PICFLAGS)
 dnl In autoconf 2.5x, AC_OUTPUT is replaced by four AC_CONFIG_* macros,
 dnl which can all be called multiple times as needed, plus one (different)
 dnl AC_OUTPUT macro.  This one lists the files to be created:
-AC_CONFIG_FILES( \
-  Makefile \
-  AC_FOREACH([DIR], glibcxx_SUBDIRS, [DIR/Makefile ])
-  )
+AC_CONFIG_FILES(Makefile)
 AC_CONFIG_FILES([scripts/testsuite_flags],[chmod +x scripts/testsuite_flags])
 
-dnl These commands are run at the end of config.status:
-AC_CONFIG_COMMANDS([default],
-[if test -n "$CONFIG_FILES"; then
-   # Multilibs need MULTISUBDIR defined correctly in certain makefiles so
-   # that multilib installs will end up installed in the correct place.
-   # The testsuite needs it for multilib-aware ABI baseline files.
-   # To work around this not being passed down from config-ml.in ->
-   # srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually
-   # append it here.  Only modify Makefiles that have just been created.
-   #
-   # Also, get rid of this simulated-VPATH thing that automake does.
-   cat > vpsed << \_EOF
+# Multilibs need MULTISUBDIR defined correctly in certain makefiles so
+# that multilib installs will end up installed in the correct place.
+# The testsuite needs it for multilib-aware ABI baseline files.
+# To work around this not being passed down from config-ml.in ->
+# srcdir/Makefile.am -> srcdir/{src,libsupc++,...}/Makefile.am, manually
+# append it here.  Only modify Makefiles that have just been created.
+#
+# Also, get rid of this simulated-VPATH thing that automake does.
+AC_FOREACH([DIR], glibcxx_SUBDIRS,
+  [AC_CONFIG_FILES(DIR[/Makefile ],
+     [cat > vpsed$$ << \_EOF
 s!`test -f '$<' || echo '$(srcdir)/'`!!
 _EOF
-   for i in $SUBDIRS; do
-    case $CONFIG_FILES in
-     *${i}/Makefile*)
-       #echo "Adding MULTISUBDIR to $i/Makefile"
-       sed -f vpsed $i/Makefile > tmp
-       grep '^MULTISUBDIR =' Makefile >> tmp
-       mv tmp $i/Makefile
-       ;;
-    esac
-   done
-   rm vpsed
- fi
- (cd include && ${MAKE-make})
-],
-[
-# Variables needed in config.status (file generation) which aren't already
-# passed by autoconf.
-SUBDIRS="$SUBDIRS"
+      sed -f vpsed$$ $ac_file > tmp$$
+      grep '^MULTISUBDIR =' Makefile >> tmp$$
+      mv tmp$$ $ac_file
+      rm vpsed$$
+  ]m4_if(DIR, [include],
+	 [(cd include && ${MAKE-make} pch_build=)])[
+  ])
 ])
 
 dnl And this actually makes things happen:


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