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 # -------------------------------------------