This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gccgo] Use -static-libstdc++ when building the Go compiler
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 20 Nov 2009 15:26:39 -0800
- Subject: [gccgo] Use -static-libstdc++ when building the Go compiler
When bootstrapping gccgo, the Go compiler winds up being built with
the current version of libstdc++. That makes it a pain to run if the
current version of libstdc++ is newer than the system version.
Fortunately I introduced the -static-libstdc++ option to avoid just
this issue for the build-with-cxx branch. This patch uses the option,
if it is supported, when building the Go compiler. Committed to gccgo
branch.
Ian
Index: go/Make-lang.in
===================================================================
--- go/Make-lang.in (revision 154350)
+++ go/Make-lang.in (working copy)
@@ -66,7 +66,7 @@ GO_OBJS = \
go/unsafe.o
go1$(exeext): $(GO_OBJS) attribs.o $(BACKEND) $(LIBDEPS)
- $(CXX) $(ALL_CXXFLAGS) $(LDFLAGS) -o $@ \
+ $(CXX) $(STATIC_LIBSTDCXX) $(ALL_CXXFLAGS) $(LDFLAGS) -o $@ \
$(GO_OBJS) attribs.o $(BACKEND) $(LIBS) $(BACKENDLIBS)
# Build hooks.
Index: configure.ac
===================================================================
--- configure.ac (revision 154350)
+++ configure.ac (working copy)
@@ -4118,6 +4118,22 @@ done
# UNSORTED
# --------
+# Test whether $CXX supports -static-libstdc++
+AC_CACHE_CHECK([whether $CXX supports -static-libstdc++],
+ gcc_cv_cxx_supports_static_libstdcxx,
+ [if $CXX -static-libstdc++ >/dev/null 2>&1 |
+ grep 'unrecognized option' >/dev/null; then
+ gcc_cv_cxx_supports_static_libstdcxx=no
+ else
+ gcc_cv_cxx_supports_static_libstdcxx=yes
+ fi])
+if test "$gcc_cv_cxx_supports_static_libstdcxx" = yes; then
+ STATIC_LIBSTDCXX=-static-libstdc++
+else
+ STATIC_LIBSTDCXX=
+fi
+AC_SUBST(STATIC_LIBSTDCXX)
+
# Create .gdbinit.
echo "dir ." > .gdbinit
Index: Makefile.in
===================================================================
--- Makefile.in (revision 154350)
+++ Makefile.in (working copy)
@@ -220,6 +220,10 @@ LINKER = $(CXX)
LINKER_FLAGS = $(CXXFLAGS)
endif
+# This is set by the configure script to be -static-libstdc++ if
+# $(CXX) supports the option.
+STATIC_LIBSTDCXX = @STATIC_LIBSTDCXX@
+
# -------------------------------------------
# Programs which operate on the build machine
# -------------------------------------------