This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH RFA: Support --enable-build-with-cxx at top level
- From: Ian Lance Taylor <iant at google dot com>
- To: Paolo Bonzini <bonzini at gnu dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 22 Jun 2009 11:42:38 -0700
- Subject: Re: PATCH RFA: Support --enable-build-with-cxx at top level
- References: <m3eitdxd48.fsf@pepe.airs.com> <4A3F3986.4050400@gnu.org>
Paolo Bonzini <bonzini@gnu.org> writes:
> Ian Lance Taylor wrote:
>> 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++).
>
> Can you please try the approach of modifying
> boot_language=${enable_build_with_cxx}? I would very much prefer to
> have a generic mechanism that bootstraps the target libraries for a
> language if it is marked as a boot_language, rather than the special
> casing of
Good idea.
This is my attempt to address all issues raised by use and Joseph. This
combines the two previous patches into one, as they are now more
interdependent. I hope this is not getting too complicated. I would
not be surprised if some cleanup is required as more cases are tested.
If you have any particular cases to test, I'm happy to try them.
Bootstrapped on x86_64-unknown-linux-gnu. OK for mainline?
Ian
ChangeLog:
2009-06-22 Ian Lance Taylor <iant@google.com>
* configure.ac: Add --enable-build-with-cxx. When set, add c++ to
boot_languages. Only bootstrap target libraries listed in
target_libs for some boot language. Add --with-stage1-ldflags,
--with-stage1-libs, --with-boot-ldflags, --with-boot-libs. Remove
with_host_libstdcxx from ppllibs. Only add -fkeep-inline-functions
if not building with C++.
* Makefile.def: For target_module libstdc++-v3, set bootstrap=true.
* Makefile.tpl (STAGE1_LDFLAGS, STAGE1_LIBS): New variables.
(POSTSTAGE1_LDFLAGS, POSTSTAGE1_LIBS): New variables.
(HOST_EXPORTS): Add STAGE1_LDFLAGS to LDFLAGS. Export HOST_LIBS.
(POSTSTAGE1_HOST_EXPORTS): Set CXX and CXX_FOR_BUILD. Add
POSTSTAGE1_LDFLAGS to LDFLAGS. Export HOST_LIBS.
(POSTSTAGE1_FLAGS_TO_PASS): Likewise.
* configure, Makefile.in: Rebuild.
gcc/ChangeLog:
2009-06-22 Ian Lance Taylor <iant@google.com>
* configure.ac: Invoke AC_PROG_CXX. Separate C specific warnings
from loose_warn into c_loose_warn and from strict_warn into
c_strict_warn. Set and substitute warn_cxxflags. Check for
--enable-build-with-cxx. Set and substitute
ENABLE_BUILD_WITH_CXX. Set and substitute HOST_LIBS.
* Makefile.in (CXXFLAGS): New variable.
(C_LOOSE_WARN, C_STRICT_WARN): New variables.
(GCC_WARN_CFLAGS): Add $(C_LOOSE_WARN). Add $(C_STRICT_WARN) if
the default is the same as $(STRICT_WARN).
(GCC_WARN_CXXFLAGS, WARN_CXXFLAGS): New variables.
(CXX): New variable.
(COMPILER): New value if ENABLE_BUILD_WITH_CXX.
(COMPILER_FLAGS, LINKER, LINKER_FLAGS): Likewise.
(ALL_COMPILERFLAGS, ALL_LINKERFLAGS): Likewise.
(HOST_LIBS): New variable.
(GCC_CFLAGS): Add $(C_LOOSE_WARN).
(ALL_CXXFLAGS): New variable.
(LIBS, BACKENDLIBS): Add $(HOST_LIBS).
* doc/install.texi (Configuration): Document
--enable-build-with-cxx, --with-stage1-ldflags,
--with-stage1-libs, --with-boot-ldflags, --with-boot-libs.
* configure: Rebuild.
Index: gcc/doc/install.texi
===================================================================
--- gcc/doc/install.texi (revision 148809)
+++ gcc/doc/install.texi (working copy)
@@ -1204,6 +1204,10 @@ opposite effect. If neither option is s
will try to guess whether the @code{.init_array} and
@code{.fini_array} sections are supported and, if they are, use them.
+@item --enable-build-with-cxx
+Build GCC using a C++ compiler rather than a C compiler. This is an
+experimental option which may become the default in a later release.
+
@item --enable-maintainer-mode
The build rules that
regenerate the GCC master message catalog @file{gcc.pot} are normally
@@ -1549,6 +1553,27 @@ linking with a shared copy of PPL, you p
option; shared library dependencies will cause the linker to search
for the standard C++ library automatically.
+@item --with-stage1-ldflags=@var{flags}
+This option may be used to set linker flags to be used when linking
+stage 1 of GCC. These are also used when linking GCC if configured with
+@option{--disable-bootstrap}. By default no special flags are used.
+
+@item --with-stage1-libs=@var{libs}
+This option may be used to set libraries to be used when linking stage 1
+of GCC. These are also used when linking GCC if configured with
+@option{--disable-bootstrap}. The default is the argument to
+@option{--with-host-libstdcxx}, if specified.
+
+@item --with-boot-ldflags=@var{flags}
+This option may be used to set linker flags to be used when linking
+stage 2 and later when bootstrapping GCC. By default no special flags
+are used.
+
+@item --with-boot-libs=@var{libs}
+This option may be used to set libraris to be used when linking stage 2
+and later when bootstrapping GCC. The default is the argument to
+@option{--with-host-libstdcxx}, if specified.
+
@item --with-debug-prefix-map=@var{map}
Convert source directory names using @option{-fdebug-prefix-map} when
building runtime libraries. @samp{@var{map}} is a space-separated
Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac (revision 148809)
+++ gcc/configure.ac (working copy)
@@ -276,6 +276,7 @@ rm -f a.out a.exe b.out
# Find the native compiler
AC_PROG_CC
AM_PROG_CC_C_O
+AC_PROG_CXX
ACX_PROG_GNAT([-I"$srcdir"/ada])
# autoconf is lame and doesn't give us any substitution variable for this.
@@ -323,24 +324,30 @@ AC_CHECK_TYPES([__int64], [AC_CHECK_SIZE
# So, we only use -pedantic if we can disable those warnings.
ACX_PROG_CC_WARNING_OPTS(
- m4_quote(m4_do([-W -Wall -Wwrite-strings -Wstrict-prototypes ],
- [-Wmissing-prototypes -Wcast-qual])), [loose_warn])
+ m4_quote(m4_do([-W -Wall -Wwrite-strings -Wcast-qual])), [loose_warn])
ACX_PROG_CC_WARNING_OPTS(
- m4_quote(m4_do([-Wold-style-definition -Wc++-compat ],
- [-Wmissing-format-attribute])), [strict_warn])
+ m4_quote(m4_do([-Wstrict-prototypes -Wmissing-prototypes])),
+ [c_loose_warn])
+ACX_PROG_CC_WARNING_OPTS(
+ m4_quote(m4_do([-Wmissing-format-attribute])), [strict_warn])
+ACX_PROG_CC_WARNING_OPTS(
+ m4_quote(m4_do([-Wold-style-definition -Wc++-compat])), [c_strict_warn])
ACX_PROG_CC_WARNING_ALMOST_PEDANTIC(
m4_quote(m4_do([-Wno-long-long -Wno-variadic-macros ],
[-Wno-overlength-strings])), [strict_warn])
ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual], [strict_warn])
# The above macros do nothing if the compiler is not GCC. However, the
-# Makefile has more goo to add other flags, so this variabl is used to
-# enables warnings only for GCC.
+# Makefile has more goo to add other flags, so these variables are used
+# to enable warnings only for GCC.
warn_cflags=
+warn_cxxflags=
if test "x$GCC" = "xyes"; then
warn_cflags='$(GCC_WARN_CFLAGS)'
+ warn_cxxflags='$(GCC_WARN_CXXFLAGS)'
fi
AC_SUBST(warn_cflags)
+AC_SUBST(warn_cxxflags)
# Enable expensive internal checks
is_release=
@@ -573,6 +580,13 @@ fi
# Miscenalleous configure options
# -------------------------------
+# 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)
+AC_SUBST(ENABLE_BUILD_WITH_CXX)
+
# With stabs
AC_ARG_WITH(stabs,
[ --with-stabs arrange to use stabs instead of host debug format],
@@ -3721,6 +3735,13 @@ esac],
AC_SUBST(GGC)
echo "Using $GGC for garbage collection."
+# Libraries to use on the host. This will normally be set by the top
+# level Makefile. Here we simply capture the value for our Makefile.
+if ! test -n "${HOST_LIBS+set}"; then
+ HOST_LIBS=
+fi
+AC_SUBST(HOST_LIBS)
+
# Use the system's zlib library.
zlibdir=-L../zlib
zlibinc="-I\$(srcdir)/../zlib"
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in (revision 148809)
+++ gcc/Makefile.in (working copy)
@@ -134,6 +134,7 @@ LANGUAGES = c gcov$(exeext) gcov-dump$(e
T_CFLAGS =
TCFLAGS =
CFLAGS = @CFLAGS@
+CXXFLAGS = @CXXFLAGS@
LDFLAGS = @LDFLAGS@
# Flags to determine code coverage. When coverage is disabled, this will
@@ -149,11 +150,15 @@ coverageexts = .{gcda,gcno}
# off if they wish.
# LOOSE_WARN are the warning flags to use when compiling something
# which is only compiled with gcc, such as libgcc.
+# C_LOOSE_WARN is similar, but with C-only warnings.
# STRICT_WARN are the additional warning flags to
# apply to the back end and some front ends, which may be compiled
# with other compilers.
+# C_STRICT_WARN is similar, with C-only warnings.
LOOSE_WARN = @loose_warn@
+C_LOOSE_WARN = @c_loose_warn@
STRICT_WARN = @strict_warn@
+C_STRICT_WARN = @c_strict_warn@
# This is set by --enable-checking. The idea is to catch forgotten
# "extern" tags in header files.
@@ -169,7 +174,8 @@ VALGRIND_DRIVER_DEFINES = @valgrind_path
# This is how we control whether or not the additional warnings are applied.
.-warn = $(STRICT_WARN)
build-warn = $(STRICT_WARN)
-GCC_WARN_CFLAGS = $(LOOSE_WARN) $($(@D)-warn) $(NOCOMMON_FLAG) $($@-warn)
+GCC_WARN_CFLAGS = $(LOOSE_WARN) $(C_LOOSE_WARN) $($(@D)-warn) $(if $(filter-out $(STRICT_WARN),$($(@D)-warn)),,$(C_STRICT_WARN)) $(NOCOMMON_FLAG) $($@-warn)
+GCC_WARN_CXXFLAGS = $(LOOSE_WARN) $($(@D)-warn) $(NOCOMMON_FLAG) $($@-warn)
# These files are to have specific diagnostics suppressed, or are not to
# be subject to -Werror:
@@ -180,13 +186,16 @@ mips-tfile.o-warn = -Wno-error
# All warnings have to be shut off in stage1 if the compiler used then
# isn't gcc; configure determines that. WARN_CFLAGS will be either
-# $(GCC_WARN_CFLAGS), or nothing.
+# $(GCC_WARN_CFLAGS), or nothing. Similarly, WARN_CXXFLAGS will be
+# either $(GCC_WARN_CXXFLAGS), or nothing.
WARN_CFLAGS = @warn_cflags@
+WARN_CXXFLAGS = @warn_cxxflags@
CPPFLAGS = @CPPFLAGS@
AWK = @AWK@
CC = @CC@
+CXX = @CXX@
BISON = @BISON@
BISONFLAGS =
FLEX = @FLEX@
@@ -197,12 +206,19 @@ NM = @NM@
RANLIB = @RANLIB@
RANLIB_FLAGS = @ranlib_flags@
-# The name of the compiler to use. Currently always $(CC). In the
-# future this may change to $(CXX).
+# The name of the compiler to use.
+ENABLE_BUILD_WITH_CXX = @ENABLE_BUILD_WITH_CXX@
+ifneq ($(ENABLE_BUILD_WITH_CXX),yes)
COMPILER = $(CC)
COMPILER_FLAGS = $(CFLAGS)
LINKER = $(CC)
LINKER_FLAGS = $(CFLAGS)
+else
+COMPILER = $(CXX)
+COMPILER_FLAGS = $(CXXFLAGS)
+LINKER = $(CXX)
+LINKER_FLAGS = $(CXXFLAGS)
+endif
# -------------------------------------------
# Programs which operate on the build machine
@@ -272,6 +288,9 @@ write_entries_to_file = $(shell rm -f $(
# In stage2 and beyond, we force this to "-o $@" since we know we're using gcc.
OUTPUT_OPTION = @OUTPUT_OPTION@
+# Libraries to use on the host.
+HOST_LIBS = @HOST_LIBS@
+
# This is where we get zlib from. zlibdir is -L../zlib and zlibinc is
# -I../zlib, unless we were configured with --with-system-zlib, in which
# case both are empty.
@@ -330,7 +349,7 @@ GCC_FOR_TARGET = $(STAGE_CC_WRAPPER) ./x
# This is used instead of ALL_CFLAGS when compiling with GCC_FOR_TARGET.
# It specifies -B./.
# It also specifies -isystem ./include to find, e.g., stddef.h.
-GCC_CFLAGS=$(CFLAGS_FOR_TARGET) $(INTERNAL_CFLAGS) $(T_CFLAGS) $(LOOSE_WARN) -Wold-style-definition $($@-warn) -isystem ./include $(TCFLAGS)
+GCC_CFLAGS=$(CFLAGS_FOR_TARGET) $(INTERNAL_CFLAGS) $(T_CFLAGS) $(LOOSE_WARN) $(C_LOOSE_WARN) -Wold-style-definition $($@-warn) -isystem ./include $(TCFLAGS)
# ---------------------------------------------------
# Programs which produce files for the target machine
@@ -917,16 +936,28 @@ INTERNAL_CFLAGS = -DIN_GCC @CROSS@
ALL_CFLAGS = $(T_CFLAGS) \
$(CFLAGS) $(INTERNAL_CFLAGS) $(COVERAGE_FLAGS) $(WARN_CFLAGS) @DEFS@
+# The C++ version.
+ALL_CXXFLAGS = $(T_CFLAGS) $(CXXFLAGS) $(INTERNAL_CFLAGS) \
+ $(COVERAGE_FLAGS) $(WARN_CXXFLAGS) @DEFS@
+
# Likewise. Put INCLUDES at the beginning: this way, if some autoconf macro
# puts -I options in CPPFLAGS, our include files in the srcdir will always
# win against random include files in /usr/include.
ALL_CPPFLAGS = $(INCLUDES) $(CPPFLAGS)
# This is the variable to use when using $(COMPILER).
+ifneq ($(ENABLE_BUILD_WITH_CXX),yes)
ALL_COMPILERFLAGS = $(ALL_CFLAGS)
+else
+ALL_COMPILERFLAGS = $(ALL_CXXFLAGS)
+endif
# This is the variable to use when using $(LINKER).
+ifneq ($(ENABLE_BUILD_WITH_CXX),yes)
ALL_LINKERFLAGS = $(ALL_CFLAGS)
+else
+ALL_LINKERFLAGS = $(ALL_CXXFLAGS)
+endif
# Build and host support libraries.
LIBIBERTY = ../libiberty/libiberty.a
@@ -941,8 +972,9 @@ BUILD_LIBDEPS= $(BUILD_LIBIBERTY)
# How to link with both our special library facilities
# and the system's installed libraries.
-LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(LIBDECNUMBER)
-BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS) $(PLUGINLIBS)
+LIBS = @LIBS@ $(CPPLIB) $(LIBINTL) $(LIBICONV) $(LIBIBERTY) $(LIBDECNUMBER) \
+ $(HOST_LIBS)
+BACKENDLIBS = $(CLOOGLIBS) $(PPLLIBS) $(GMPLIBS) $(PLUGINLIBS) $(HOST_LIBS)
# Any system libraries needed just for GNAT.
SYSLIBS = @GNAT_LIBEXC@
Index: configure.ac
===================================================================
--- configure.ac (revision 148809)
+++ 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=
@@ -1422,10 +1428,59 @@ case $with_host_libstdcxx in
;;
esac
+# Linker flags to use for stage1 or when not boostrapping.
+AC_ARG_WITH(stage1-ldflags,
+[ --with-stage1-ldflags=FLAGS Linker flags for stage1],
+[if test $withval = no -o $withval = yes; then
+ stage1_ldflags=
+ else
+ stage1_ldflags=$withval
+ fi],
+[stage1_ldflags=])
+AC_SUBST(stage1_ldflags)
+
+# Libraries to use for stage1 or when not bootstrapping.
+AC_ARG_WITH(stage1-libs,
+[ -with-stage1-libs=LIBS Libraries for stage1],
+[if test $withval = no -o $withval = yes; then
+ stage1_libs=
+ else
+ stage1_libs=$withval
+ fi],
+[stage1_libs=$with_host_libstdcxx])
+AC_SUBST(stage1_libs)
+
+# Linker flags to use for stage2 and later builds.
+AC_ARG_WITH(boot-ldflags,
+[ --with-boot-ldflags=FLAGS Linker flags for stage2 and later],
+[if test $withval = no -o $withval = yes; then
+ poststage1_ldflags=
+ else
+ poststage1_ldflags=$withval
+ fi],
+[if test "$ENABLE_BUILD_WITH_CXX" = "yes"; then
+ poststage1_ldflags=-static-libstdc++
+ else
+ poststage1_ldflags=
+ fi])
+AC_SUBST(poststage1_ldflags)
+
+# Libraries to use for stage2 and later builds. This defaults to the
+# argument passed to --with-host-libstdcxx.
+AC_ARG_WITH(boot-libs,
+[ --with-boot-libs=LIBS Libraries for stage2 and later]
+[if test $withval = no -o $withval = yes; then
+ poststage1_libs=
+ else
+ poststage1_libs=$withval
+ fi],
+[poststage1_libs=$with_host_libstdcxx])
+AC_SUBST(poststage1_libs)
+
# Check for PPL
ppl_major_version=0
ppl_minor_version=10
-ppllibs=" -lppl_c -lppl -lgmpxx $with_host_libstdcxx "
+ppllibs=" -lppl_c -lppl -lgmpxx"
pplinc=
AC_ARG_WITH(ppl, [ --with-ppl=PATH Specify prefix directory for the installed PPL package
@@ -1439,7 +1494,7 @@ case $with_ppl in
ppllibs=
;;
*)
- ppllibs="-L$with_ppl/lib -lppl_c -lppl -lgmpxx $with_host_libstdcxx"
+ ppllibs="-L$with_ppl/lib -lppl_c -lppl -lgmpxx"
pplinc="-I$with_ppl/include $pplinc"
LIBS="$ppllibs $LIBS"
;;
@@ -1448,11 +1503,11 @@ if test "x$with_ppl_include" != x; then
pplinc="-I$with_ppl_include $pplinc"
fi
if test "x$with_ppl_lib" != x; then
- ppllibs="-L$with_ppl_lib -lppl_c -lppl -lgmpxx $with_host_libstdcxx"
+ ppllibs="-L$with_ppl_lib -lppl_c -lppl -lgmpxx"
LIBS="$ppllibs $LIBS"
fi
if test "x$with_ppl$with_ppl_include$with_ppl_lib" = x && test -d ${srcdir}/ppl; then
- ppllibs='-L$$r/$(HOST_SUBDIR)/ppl/.libs -L$$r/$(HOST_SUBDIR)/ppl/_libs -lppl_c -lppl -lgmpxx '"$with_host_libstdcxx "
+ ppllibs='-L$$r/$(HOST_SUBDIR)/ppl/.libs -L$$r/$(HOST_SUBDIR)/ppl/_libs -lppl_c -lppl -lgmpxx '
pplinc='-I$$r/$(HOST_SUBDIR)/ppl/include -I$$s/ppl/include '
LIBS="$ppllibs $LIBS"
fi
@@ -1538,6 +1593,9 @@ AC_SUBST(clooginc)
# By default, C is the only stage 1 language.
stage1_languages=,c,
+# Target libraries that we bootstrap.
+bootstrap_target_libs=,target-libgcc,
+
# Figure out what language subdirectories are present.
# Look if the user specified --enable-languages="..."; if not, use
# the environment variable $LANGUAGES if defined. $LANGUAGES might
@@ -1623,6 +1681,10 @@ if test -d ${srcdir}/gcc; then
exit 1
fi
+ if test "$language" = "c++" -a "$ENABLE_BUILD_WITH_CXX" = "yes"; then
+ boot_language=yes
+ fi
+
case ,${enable_languages}, in
*,${language},*)
# Language was explicitly selected; include it.
@@ -1689,6 +1751,8 @@ if test -d ${srcdir}/gcc; then
yes)
# Add to (comma-separated) list of stage 1 languages.
stage1_languages="${stage1_languages}${language},"
+ # We need to bootstrap any supporting libraries.
+ bootstrap_target_libs="${bootstrap_target_libs}${target_libs},"
;;
esac
;;
@@ -2420,11 +2484,18 @@ for module in ${target_configdirs} ; do
echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure"
rm -f ${target_subdir}/${module}/Makefile
fi
+
+ # We only bootstrap target libraries listed in bootstrap_target_libs.
+ case $bootstrap_target_libs in
+ *,target-$module,*) target_bootstrap_suffix=$bootstrap_suffix ;;
+ *) target_bootstrap_suffix=no-bootstrap ;;
+ esac
+
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
@@ -2988,7 +3059,7 @@ case $build in
esac
# This is aimed to mimic bootstrap with a non-GCC compiler to catch problems.
-if test "$GCC" = yes; then
+if test "$GCC" = yes -a "$ENABLE_BUILD_WITH_CXX" != yes; then
saved_CFLAGS="$CFLAGS"
# Pass -fkeep-inline-functions for stage 1 if the GCC version supports it.
Index: Makefile.def
===================================================================
--- Makefile.def (revision 148809)
+++ 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 148809)
+++ Makefile.tpl (working copy)
@@ -120,6 +120,19 @@ BUILD_SUBDIR = @build_subdir@
# directories built for the build system.
BUILD_CONFIGARGS = @build_configargs@ --with-build-subdir="$(BUILD_SUBDIR)"
+# Linker flags to use on the host, for stage1 or when not
+# bootstrapping.
+STAGE1_LDFLAGS = @stage1_ldflags@
+
+# Libraries to use on the host, for stage1 or when not bootstrapping.
+STAGE1_LIBS = @stage1_libs@
+
+# Linker flags to use for stage2 and later.
+POSTSTAGE1_LDFLAGS = @poststage1_ldflags@
+
+# Libraries to use for stage2 and later.
+POSTSTAGE1_LIBS = @poststage1_libs@
+
# This is the list of variables to export in the environment when
# configuring any subdirectory. It must also be exported whenever
# recursing into a build directory in case that directory's Makefile
@@ -185,7 +198,7 @@ HOST_EXPORTS = \
CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
LD="$(LD)"; export LD; \
- LDFLAGS="$(LDFLAGS)"; export LDFLAGS; \
+ LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
NM="$(NM)"; export NM; \
RANLIB="$(RANLIB)"; export RANLIB; \
WINDRES="$(WINDRES)"; export WINDRES; \
@@ -200,6 +213,7 @@ HOST_EXPORTS = \
OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
+ HOST_LIBS="$(STAGE1_LIBS)"; export HOST_LIBS; \
GMPLIBS="$(HOST_GMPLIBS)"; export GMPLIBS; \
GMPINC="$(HOST_GMPINC)"; export GMPINC; \
PPLLIBS="$(HOST_PPLLIBS)"; export PPLLIBS; \
@@ -218,8 +232,16 @@ 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; \
- GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND \
- LDFLAGS="$(BOOT_LDFLAGS)"; export LDFLAGS;
+ 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="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)"; export LDFLAGS; \
+ HOST_LIBS="$(POSTSTAGE1_LIBS)"; export HOST_LIBS;
# Target libraries are put under this directory:
TARGET_SUBDIR = @target_subdir@
@@ -540,8 +562,11 @@ 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}" \
- LDFLAGS="$(BOOT_LDFLAGS)" \
+ CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
+ CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
+ GNATBIND="$${GNATBIND}" \
+ LDFLAGS="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)" \
+ HOST_LIBS="$(POSTSTAGE1_LIBS)" \
"`echo 'ADAFLAGS=$(BOOT_ADAFLAGS)' | sed -e s'/[^=][^=]*=$$/XFOO=/'`"
# Flags to pass down to makes which are built with the target environment.