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: Build system: Check for -static-libstdc++


The -static-libstdc++ option was added to g++ in the gcc 4.5 release.
The Go frontend wants to use it when linking, so that the Go frontend is
independent of the installed libstdc++.so.  This is particularly useful
when bootstrapping, and is generally desirable as it permits moving the
compiler around.

This patch to gcc/configure.ac checks whether $(CXX) supports
-static-libstdc++, and sets a variable in Makefile.in.  This is not used
yet, but it will be used by the Go frontend when it goes in.

Bootstrapped on x86_64-unknown-linux-gnu.  OK for mainline?

Ian


2010-11-02  Ian Lance Taylor  <iant@google.com>

	* configure.ac: Set and substitute STATIC_LIBSTDCXX.
	* Makefile.in (STATIC_LIBSTDCXX): New variable.
	* configure: Rebuild.


Index: gcc/configure.ac
===================================================================
--- gcc/configure.ac	(revision 166230)
+++ gcc/configure.ac	(working copy)
@@ -4497,6 +4497,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++ 2>&1 >/dev/null | 
+	    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: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 166230)
+++ gcc/Makefile.in	(working copy)
@@ -233,6 +233,10 @@ LINKER_FLAGS = $(CFLAGS)
 endif
 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
 # -------------------------------------------

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