From patchwork Wed Nov 3 14:23:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 70008 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 62A7BB70EA for ; Thu, 4 Nov 2010 01:23:31 +1100 (EST) Received: (qmail 3791 invoked by alias); 3 Nov 2010 14:23:24 -0000 Received: (qmail 3640 invoked by uid 22791); 3 Nov 2010 14:23:20 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 03 Nov 2010 14:23:15 +0000 Received: from wpaz24.hot.corp.google.com (wpaz24.hot.corp.google.com [172.24.198.88]) by smtp-out.google.com with ESMTP id oA3ENDCR008745 for ; Wed, 3 Nov 2010 07:23:13 -0700 Received: from pva4 (pva4.prod.google.com [10.241.209.4]) by wpaz24.hot.corp.google.com with ESMTP id oA3EMeHc012473 for ; Wed, 3 Nov 2010 07:23:11 -0700 Received: by pva4 with SMTP id 4so245036pva.23 for ; Wed, 03 Nov 2010 07:23:11 -0700 (PDT) Received: by 10.142.172.9 with SMTP id u9mr155379wfe.197.1288794191313; Wed, 03 Nov 2010 07:23:11 -0700 (PDT) Received: from coign.google.com ([67.218.104.238]) by mx.google.com with ESMTPS id p8sm13668608wff.4.2010.11.03.07.23.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 03 Nov 2010 07:23:10 -0700 (PDT) From: Ian Lance Taylor To: Ralf Wildenhues Cc: gcc-patches@gcc.gnu.org Subject: Re: PATCH RFA: Build system: Check for -static-libstdc++ References: <20101103060857.GD6183@gmx.de> Date: Wed, 03 Nov 2010 07:23:05 -0700 In-Reply-To: <20101103060857.GD6183@gmx.de> (Ralf Wildenhues's message of "Wed, 3 Nov 2010 07:08:57 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Ralf Wildenhues writes: > This will not work with non-GCC compilers that print something other > than "unrecognized option" upon such an option. I think you should at > least check that you can form a command with the flag that exits zero, > that way you may still have warnings during Stage 1 but at least not a > hard build failure. > > Alternatively, you could check whether $GXX is yes, to be sure to only > accept the flag for GCC. Good point. I think testing $GXX is fine. How about this patch? Ian 2010-11-03 Ian Lance Taylor * configure.ac: Set and substitute STATIC_LIBSTDCXX. * Makefile.in (STATIC_LIBSTDCXX): New variable. * configure: Rebuild. Index: configure.ac =================================================================== --- configure.ac (revision 166249) +++ configure.ac (working copy) @@ -4497,6 +4497,24 @@ done # UNSORTED # -------- +# Test whether $CXX supports -static-libstdc++ +AC_CACHE_CHECK([whether $CXX supports -static-libstdc++], + gcc_cv_cxx_supports_static_libstdcxx, + [if test "$GXX" != "yes"; then + gcc_cv_cxx_supports_static_libstdcxx=no + elif $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: Makefile.in =================================================================== --- Makefile.in (revision 166249) +++ 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 # -------------------------------------------