From patchwork Fri Oct 23 21:34:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 535285 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 219F514076E for ; Sat, 24 Oct 2015 08:35:09 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=X9cuC4C+; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:cc:from:message-id:date :mime-version:in-reply-to:content-type; q=dns; s=default; b=X0Bf tC3GXsiBqRysF9cuURs8a/vjPrVL8sa97TRV0Tzh67pWbKtmAGAN81SdvMCrLHMA S/WVFK6jDwOLa3R2GpV9AFOhj8ucLUoOngbi8d98U4sOupjrZDkobqpm58NcGp2q +ZI4U+2wDMXWHAUAm/ZfHebmvicy8BD47ktznAg= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:to:references:cc:from:message-id:date :mime-version:in-reply-to:content-type; s=default; bh=585yJpQmhV jxAm20pX8j1XzacdY=; b=X9cuC4C+fPtSozjyIadv1DTwvcEY8j6WRYOFYBze+1 OSHU6FXU8vSJV7qVmOIp1Srv3p/TZHpTadBT7N9psoi/xxKAGszWE5s6a+WAH7Gr Vv5MZDp5Pu2P0rO5r1Z/el5Zeqm7HlnEmCSxYm5oRQGtOda2YViM9Ou2pofOorxb g= Received: (qmail 6868 invoked by alias); 23 Oct 2015 21:35:04 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 6853 invoked by uid 89); 23 Oct 2015 21:35:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL, BAYES_40, RP_MATCHES_RCVD, SPF_HELO_PASS, URIBL_BLACK autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Subject: Re: [PATCH] Detect if the C++ toolchain does not support -static To: Roland McGrath References: <562A4EDC.9030203@redhat.com> <20151023181910.407252C3B7A@topped-with-meat.com> <562A7A8D.7020106@redhat.com> <20151023183021.2F8ED2C3B7A@topped-with-meat.com> Cc: GNU C Library From: Florian Weimer Message-ID: <562AA800.6050300@redhat.com> Date: Fri, 23 Oct 2015 23:34:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <20151023183021.2F8ED2C3B7A@topped-with-meat.com> On 10/23/2015 08:30 PM, Roland McGrath wrote: >> On 10/23/2015 08:19 PM, Roland McGrath wrote: >>> Why not just clear CXX and call this a "C++ not available" case? >> >> I have no preference either way. > > Then let's keep it simpler for now. Just change the criteria in the > configure check, and don't add any new degrees of freedom. What about this? It results in the following failures without libstdc++-static: UNSUPPORTED: debug/tst-chk4 UNSUPPORTED: debug/tst-chk5 UNSUPPORTED: debug/tst-chk6 UNSUPPORTED: debug/tst-lfschk4 UNSUPPORTED: debug/tst-lfschk5 UNSUPPORTED: debug/tst-lfschk6 UNSUPPORTED: dlfcn/bug-atexit3 UNSUPPORTED: nptl/tst-cancel24 UNSUPPORTED: nptl/tst-cancel24-static UNSUPPORTED: nptl/tst-once5 UNSUPPORTED: nptl/tst-thread_local1 Florian 2015-10-23 Florian Weimer * configure.ac (CXX): Clear the variable if the C++ toolchain does not support static linking. * configure: Regenerate. diff --git a/configure.ac b/configure.ac index e502aa5..3c7f6c0 100644 --- a/configure.ac +++ b/configure.ac @@ -57,9 +57,26 @@ AC_PROG_CXX # It's useless to us if it can't link programs (e.g. missing -lstdc++). AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl AC_LANG_PUSH([C++]) +# Default, dynamic case. AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [libc_cv_cxx_link_ok=yes], [libc_cv_cxx_link_ok=no]) +# Static case. +old_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS -static" +AC_LINK_IFELSE([AC_LANG_SOURCE([ +#include + +int +main() +{ + std::cout << "Hello, world!"; + return 0; +} +])], + [], + [libc_cv_cxx_link_ok=no]) +LDFLAGS="$old_LDFLAGS" AC_LANG_POP([C++])]) AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])