From patchwork Fri Oct 23 15:14:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 535037 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 B61E7141312 for ; Sat, 24 Oct 2015 02:14:47 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b=L2x3MolN; 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:to:from:subject:message-id:date:mime-version :content-type; q=dns; s=default; b=oHy8KEmfnti3Cbhcqy/TT22ld/wjR Z0fTvV9Umq70LPi5ior5Zj7EvZAcKx+ihHluC/eCvVJHwsbadwv/QgbPbWNQzNv0 PQZs77wbTUM7HpD+Kc/W/NkTn1XjKumhEqMwnjaFvt47+yAcgmhlmOuhPjls967N vC/U469htTt1vQ= 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:to:from:subject:message-id:date:mime-version :content-type; s=default; bh=ulZZsuBhkDLuckx6Df/3JxUyomE=; b=L2x 3MolNJnx2d/3k/WzPdYiMshj2Sbw0Kwaw4C6wdGafccSGgk6+wkgbWstMQNRGisN PZ5lhq9MYjyPwUmXmGT3eU8u98IZYMd9dpMnvoisf7JDZYKToS6hPwPfqSwFc2aY 6TSLnvHrEasMHmFkZIJbZzAC1gkInwK0FgLgOY0o= Received: (qmail 53661 invoked by alias); 23 Oct 2015 15:14:41 -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 53651 invoked by uid 89); 23 Oct 2015 15:14:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, URIBL_BLACK autolearn=no version=3.3.2 X-HELO: mx1.redhat.com To: GNU C Library From: Florian Weimer Subject: [PATCH] Detect if the C++ toolchain does not support -static Message-ID: <562A4EDC.9030203@redhat.com> Date: Fri, 23 Oct 2015 17:14:36 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Previously, this caused a failure of “make check” before reporting the result totals. Checked with and without libstdc++-static installed. The test case is marked UNSUPPORTED as expected, and still runs if it can be compiled and linked. Florian 2015-10-23 Florian Weimer * configure.ac (libc_cv_cxx_static): New test for checking the C++ compiler supports static linking. * configure: Regenerated. * config.make.in (have-cxx-static): New variable. * nptl/Makefile [!CXX] (tests-unsupported): Remove tst-cancel24-static. [!have-cxx-static] (tests-unsupported): Add tst-cancel24-static. diff --git a/config.make.in b/config.make.in index a791922..e8f2d65 100644 --- a/config.make.in +++ b/config.make.in @@ -66,6 +66,7 @@ bind-now = @bindnow@ have-hash-style = @libc_cv_hashstyle@ use-default-link = @use_default_link@ output-format = @libc_cv_output_format@ +have-cxx-static = @libc_cv_cxx_static@ have-cxx-thread_local = @libc_cv_cxx_thread_local@ multi-arch = @multi_arch@ diff --git a/configure.ac b/configure.ac index e502aa5..8e1a754 100644 --- a/configure.ac +++ b/configure.ac @@ -1815,6 +1815,27 @@ fi dnl C++ feature tests. AC_LANG_PUSH([C++]) +AC_CACHE_CHECK([whether the C++ can create static programs], + libc_cv_cxx_static, [ + +old_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS -static" +AC_LINK_IFELSE([AC_LANG_SOURCE([ +#include + +int +main() +{ + std::cout << "Hello, world!"; + return 0; +} +])], + [libc_cv_cxx_static=yes], + [libc_cv_cxx_static=no]) +]) +AC_SUBST(libc_cv_cxx_static) +LDFLAGS="$old_LDFLAGS" + AC_CACHE_CHECK([whether the C++ compiler supports thread_local], libc_cv_cxx_thread_local, [ old_CXXFLAGS="$CXXFLAGS" diff --git a/nptl/Makefile b/nptl/Makefile index 311b1a7..962bd74 100644 --- a/nptl/Makefile +++ b/nptl/Makefile @@ -405,8 +405,14 @@ endif ifeq (,$(CXX)) # These tests require a C++ compiler and runtime. -tests-unsupported += tst-cancel24 tst-cancel24-static tst-once5 +tests-unsupported += tst-cancel24 tst-once5 endif + +ifneq ($(have-cxx-static),yes) +# These tests require C++ support with static liking. +tests-unsupported += tst-cancel24-static +endif + # These tests require a C++ compiler and runtime with thread_local support. ifneq ($(have-cxx-thread_local),yes) tests-unsupported += tst-thread_local1 -- 2.4.3