diff --git a/ChangeLog b/ChangeLog index ab8a0b26c08..73859b46fb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-11-21 Ian Lance Taylor + + * configure.ac: Change default of poststage1_ldflags to be empty if + poststage1_libs is set. When poststage1_libs is empty, and + ENABLE_BUILD_WITH_CXX is set, add -static-libgcc. + * configure: Rebuild. + 2009-11-21 Adam Nemet * MAINTAINERS (Write After Approval): Update my email address. diff --git a/configure b/configure index ba4aa10dc80..52ca8b20622 100755 --- a/configure +++ b/configure @@ -683,8 +683,8 @@ clooginc clooglibs pplinc ppllibs -poststage1_libs poststage1_ldflags +poststage1_libs stage1_libs stage1_ldflags extra_mpc_mpfr_configure_flags @@ -796,8 +796,8 @@ with_gmp_lib with_host_libstdcxx with_stage1_ldflags with_stage1_libs -with_boot_ldflags with_boot_libs +with_boot_ldflags with_ppl with_ppl_include with_ppl_lib @@ -1531,8 +1531,8 @@ Optional Packages: when linking with PPL --with-stage1-ldflags=FLAGS Linker flags for stage1 -with-stage1-libs=LIBS Libraries for stage1 - --with-boot-ldflags=FLAGS Linker flags for stage2 and later --with-boot-libs=LIBS Libraries for stage2 and later + --with-boot-ldflags=FLAGS Linker flags for stage2 and later --with-ppl=PATH Specify prefix directory for the installed PPL package Equivalent to --with-ppl-include=PATH/include plus --with-ppl-lib=PATH/lib @@ -5706,25 +5706,6 @@ fi -# Linker flags to use for stage2 and later builds. - -# Check whether --with-boot-ldflags was given. -if test "${with_boot_ldflags+set}" = set; then : - withval=$with_boot_ldflags; if test "$withval" = "no" -o "$withval" = "yes"; then - poststage1_ldflags= - else - poststage1_ldflags=$withval - fi -else - if test "$ENABLE_BUILD_WITH_CXX" = "yes"; then - poststage1_ldflags=-static-libstdc++ - else - poststage1_ldflags= - fi -fi - - - # Libraries to use for stage2 and later builds. This defaults to the # argument passed to --with-host-libstdcxx. @@ -5741,6 +5722,27 @@ fi +# Linker flags to use for stage2 and later builds. + +# Check whether --with-boot-ldflags was given. +if test "${with_boot_ldflags+set}" = set; then : + withval=$with_boot_ldflags; if test "$withval" = "no" -o "$withval" = "yes"; then + poststage1_ldflags= + else + poststage1_ldflags=$withval + fi +else + poststage1_ldflags= + # With --enable-build-with-cxx, default to linking libstdc++ and + # libgcc statically. But if the user explicitly specified the + # libraries to use, trust that they are doing what they want. + if test "$ENABLE_BUILD_WITH_CXX" = "yes" -a "$poststage1_libs" = ""; then + poststage1_ldflags="-static-libstdc++ -static-libgcc" + fi +fi + + + # Check for PPL ppl_major_version=0 ppl_minor_version=10 diff --git a/configure.ac b/configure.ac index 5651e3c06b6..66a9e8db0f2 100644 --- a/configure.ac +++ b/configure.ac @@ -1481,21 +1481,6 @@ AC_ARG_WITH(stage1-libs, [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, @@ -1508,6 +1493,23 @@ AC_ARG_WITH(boot-libs, [poststage1_libs=$with_host_libstdcxx]) AC_SUBST(poststage1_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], +[poststage1_ldflags= + # With --enable-build-with-cxx, default to linking libstdc++ and + # libgcc statically. But if the user explicitly specified the + # libraries to use, trust that they are doing what they want. + if test "$ENABLE_BUILD_WITH_CXX" = "yes" -a "$poststage1_libs" = ""; then + poststage1_ldflags="-static-libstdc++ -static-libgcc" + fi]) +AC_SUBST(poststage1_ldflags) + # Check for PPL ppl_major_version=0 ppl_minor_version=10 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e14b895fcd4..31dcdb6cbb9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-11-21 Ian Lance Taylor + + * Makefile.in (HOST_LIBS): Move higher in file. + (LINKER, LINKER_FLAGS): If ENABLE_BUILD_WITH_CXX, but $(HOST_LIBS) + is not empty, set to $(CC) and $(CFLAGS). + 2009-11-22 Martin Jambor * tree-cfg.c (verify_types_in_gimple_reference): Error out on diff --git a/gcc/Makefile.in b/gcc/Makefile.in index 4e153092c06..c2b06437854 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -206,6 +206,9 @@ NM = @NM@ RANLIB = @RANLIB@ RANLIB_FLAGS = @ranlib_flags@ +# Libraries to use on the host. +HOST_LIBS = @HOST_LIBS@ + # The name of the compiler to use. ENABLE_BUILD_WITH_CXX = @ENABLE_BUILD_WITH_CXX@ ifneq ($(ENABLE_BUILD_WITH_CXX),yes) @@ -216,8 +219,17 @@ LINKER_FLAGS = $(CFLAGS) else COMPILER = $(CXX) COMPILER_FLAGS = $(CXXFLAGS) +# If HOST_LIBS is set, then the user is controlling the libraries to +# link against. In that case, link with $(CC) so that the -lstdc++ +# library is not introduced. If HOST_LIBS is not set, link with +# $(CXX) to pick up -lstdc++. +ifeq ($(HOST_LIBS),) LINKER = $(CXX) LINKER_FLAGS = $(CXXFLAGS) +else +LINKER = $(CC) +LINKER_FLAGS = $(CFLAGS) +endif endif # ------------------------------------------- @@ -288,9 +300,6 @@ write_entries_to_file = $(shell rm -f $(2) || :) $(shell touch $(2)) \ # 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.