This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

PATCH RFA: Support --enable-build-with-cxx at top level


This patch adds support for --enable-build-with-cxx at the top level.
When --enable-build-with-cxx is used, c++ is configured at stage1, and
libstdc++-v3 is bootstrapped.  This also passes down CXX and
CXX_FOR_BUILD to the post-stage1 passes.  (The --enable option must be
mechanically convertible into the name of a shell variable, so it
can't be --enable-build-with-c++).

This doesn't actually enable building with C++; this is just the top
level build machinery to make it work.  I will send a follow-up patch
for the gcc subdirectory.

This patch requires approval from a build machinery maintainer.

Bootstrapped with and without the new --enable-build-with-cxx option.
OK for mainline?

Ian


2009-06-21  Ian Lance Taylor  <iant@google.com>

	* configure.ac: Add --enable-build-with-cxx argument.  When set, add
	c++ to stage1_languages.  Bootstrap libstdc++-v3 only if
	--enable-build-with-cxx.
	* Makefile.def: For target_module libstdc++-v3, set bootstrap=true.
	* Makefile.tpl (POSTSTAGE1_HOST_EXPORTS): Set CXX and
	CXX_FOR_BUILD.
	(POSTSTAGE1_FLAGS_TO_PASS): Likewise.
	* configure, Makefile.in: Rebuild.


Index: configure.ac
===================================================================
--- configure.ac	(revision 148707)
+++ configure.ac	(working copy)
@@ -1191,6 +1191,12 @@ fi
 ACX_PROG_GNAT
 ACX_PROG_CMP_IGNORE_INITIAL
 
+# See if we are building gcc with C++.
+AC_ARG_ENABLE(build-with-cxx,
+[  --enable-build-with-cxx build with C++ compiler instead of C compiler],
+ENABLE_BUILD_WITH_CXX=$enableval,
+ENABLE_BUILD_WITH_CXX=no)
+
 # Check for GMP, MPFR and MPC
 gmplibs="-lmpfr -lgmp"
 gmpinc=
@@ -1535,8 +1541,12 @@ AC_SUBST(clooglibs)
 AC_SUBST(clooginc)
 
 
-# By default, C is the only stage 1 language.
+# By default, C is the only stage 1 language, except when building
+# with C++.
 stage1_languages=,c,
+if test "$ENABLE_BUILD_WITH_CXX" = "yes"; then
+  stage1_languages="${stage1_languages}c++,"
+fi
 
 # Figure out what language subdirectories are present.
 # Look if the user specified --enable-languages="..."; if not, use
@@ -2420,11 +2430,21 @@ for module in ${target_configdirs} ; do
     echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure"
     rm -f ${target_subdir}/${module}/Makefile
   fi
+
+  # libstdc++-v3 is a special case: we bootstrap it only if
+  # ENABLE_BUILD_WITH_CXX is "yes".
+  target_bootstrap_suffix="${bootstrap_suffix}"
+  if test "${module}" = "libstdc++-v3"; then
+    if test "$ENABLE_BUILD_WITH_CXX" != "yes"; then
+      target_bootstrap_suffix=no-bootstrap
+    fi
+  fi
+
   extrasub="$extrasub
 /^@if target-$module\$/d
 /^@endif target-$module\$/d
-/^@if target-$module-$bootstrap_suffix\$/d
-/^@endif target-$module-$bootstrap_suffix\$/d"
+/^@if target-$module-$target_bootstrap_suffix\$/d
+/^@endif target-$module-$target_bootstrap_suffix\$/d"
 done
 
 extrasub="$extrasub
Index: Makefile.def
===================================================================
--- Makefile.def	(revision 148707)
+++ Makefile.def	(working copy)
@@ -141,7 +141,10 @@ host_modules= { module= libtermcap; no_c
 host_modules= { module= utils; no_check=true; };
 host_modules= { module= gnattools; };
 
-target_modules = { module= libstdc++-v3; lib_path=.libs; raw_cxx=true; };
+target_modules = { module= libstdc++-v3;
+		   bootstrap=true;
+		   lib_path=.libs;
+		   raw_cxx=true; };
 target_modules = { module= libmudflap; lib_path=.libs; };
 target_modules = { module= libssp; lib_path=.libs; };
 target_modules = { module= newlib; };
Index: Makefile.tpl
===================================================================
--- Makefile.tpl	(revision 148707)
+++ Makefile.tpl	(working copy)
@@ -218,6 +218,13 @@ POSTSTAGE1_HOST_EXPORTS = \
 	  -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ \
 	  $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
 	CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \
+	CXX="$(STAGE_CC_WRAPPER) $$r/$(HOST_SUBDIR)/prev-gcc/g++$(exeext) \
+	  -B$$r/$(HOST_SUBDIR)/prev-gcc/ -B$(build_tooldir)/bin/ -nostdinc++ \
+	  -I$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include/$(TARGET_SUBDIR) \
+	  -I$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/include \
+	  -I$$r/$(srcdir)/libstdc++-v3/libsupc++ \
+	  -L$$r/prev-$(TARGET_SUBDIR)/libstdc++-v3/src/.libs"; export CXX; \
+	CXX_FOR_BUILD="$$CXX"; export CXX_FOR_BUILD; \
 	GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND \
 	LDFLAGS="$(BOOT_LDFLAGS)"; export LDFLAGS;
 
@@ -540,7 +547,9 @@ X11_FLAGS_TO_PASS = \
 # Flags to pass to stage2 and later makes.
 
 POSTSTAGE1_FLAGS_TO_PASS = \
-	CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" GNATBIND="$${GNATBIND}" \
+	CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
+	CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
+	GNATBIND="$${GNATBIND}" \
 	LDFLAGS="$(BOOT_LDFLAGS)" \
 	"`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
 

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