From patchwork Thu Dec 12 11:13:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 102880 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8BBCF3858C98 for ; Thu, 12 Dec 2024 11:14:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8BBCF3858C98 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=N0e6wWcL X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-yw1-x1135.google.com (mail-yw1-x1135.google.com [IPv6:2607:f8b0:4864:20::1135]) by sourceware.org (Postfix) with ESMTPS id EA0F83858C53 for ; Thu, 12 Dec 2024 11:13:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EA0F83858C53 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org EA0F83858C53 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1135 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734002039; cv=none; b=DF5mlcsTHgqP6QjQ+62i2zt1rKIf7L6apOzx2OlDPBeIIbNMIaJ5CO/6ilxANo1pV4lzAB4RLxiXevqcsgiHZZZrAb11ytkL5ukbopY6VoM97cv3Y//tSXZY9NxoJy4y4p5mHHZeZQMJ39t053JY/ymRk4VyCzr8zRb4rRLH6n0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1734002039; c=relaxed/simple; bh=Oy0pTVuC1b7yzIj4F/bh29/JwWKs4pBKBLvw6E7iJ+U=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=mxQNesxg7X6YDfERK+ox0XPFFpotWT/mIrKZSFmJ7ecc71ne6od/XgHwaCJPJoLhc7lulx6jgWcevYN4jSf6Ix/fWDeQWOVLG59aDUFJRr/efOp5pf2f5o59YBJWzt+U5MdIOoNj+A8tHy9ZRexfl7L1mIX1cxAZ3EL6mTUrg5s= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EA0F83858C53 Received: by mail-yw1-x1135.google.com with SMTP id 00721157ae682-6ef7f8d4f30so3769407b3.1 for ; Thu, 12 Dec 2024 03:13:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734002037; x=1734606837; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=0SDP19hRErV0qt14ZvIxFRZMiYSrfZAlX4v4e9M2Lm4=; b=N0e6wWcL7AUDKqA7tyxMwwEQcs84/WRXGdHmofPUrpgqVKL5+pooh5b85Pl6neaKCU dukkU7bgb18Dhg0UnooGymzXm9ORBXdM8K5TuNHYjYHWV9xF0yLVO8YYgL20Zo+zG3u5 IFNGfMD24TlYL5tOafmbDzcGklbg9dX9OFv997cfFKvKMfAjcffxggv3vh2+OqVR1FtO 22jYVvJ4WgI5Gl06epXa4qWBwXy8V09uLtz2zPO8GOdxD3IAMtQ0c+h/eb7x28BRghIO ILnOKTqCbuSFz8gUlit6chjKHC1J4qEwJ3tJhZU+z+iSJEnDQZDXNilUP+hrr3Qx+WtA +y8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734002037; x=1734606837; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=0SDP19hRErV0qt14ZvIxFRZMiYSrfZAlX4v4e9M2Lm4=; b=V1WGE/I+UijGyt2dfJRD1ocfzKAtMkR3gPk91H+n4tIkZoGE2G/BCxo8D52uSh8oGd CjPSSU9a6dYeJdPhSzhtc7q/mUnIm97pOy4S7uQqRVRlZHboQQisORS+UxR1O2x0Abe8 8727bQjSl0Tnf4qUHrg5AB+PcV1w9Hkck/7DMoNiGTOGvjSn6xkqXwb3i1mOgox8vt6s hJaYrrpp9beUsFggd8bjxSBItJsvcHYeVuiIusnz7H3oGXTRGT0mSSlrmrWe7/mFun/c PjLMH7cw/T5BZONhOJJ/YftCuzIXQqqtQQjFAQ4YlYvhO9qpGrd8LaHWExDJ2BUagznd /94A== X-Gm-Message-State: AOJu0Yx+su0DLawMyJ9wVdUN1YrkmZXoiKjRpfqbRMku5iSAAf2k1YGf v8STWPDHYudaeF/e1aMxPdPxDDtjTxy+7r6mbLB5nNxZD4PVc+5br5uz76VbGmZSk0Cq X-Gm-Gg: ASbGncvXGr7CyDar+2YjuOVEoveuOWp/gL06IWA9Hu8StF4tbyhrf5KrEdFw/zHY0ce hKxHAflTuAdXUWZzrLA87pgr8wB9A4TKWcLteCyVcw1POKKTa03W9Xn85S3w3hSU/hBEK6A/rYq QLuWBtAsR3EEC+1kx3uTRBPRew1j39WCjyMiYCZ54a4f/UMt/7PbbzhxdxU7MMXbGF7WOdNNaOS d3kbFYmUrpDMt5ow3qr3wtU4FXhG0JQPgG7x5kRHw//6sJs4+AZQtjfM1xNqV3MTqVGVWdh7zh+ fZI1XHC+nM33mJdyew== X-Google-Smtp-Source: AGHT+IGFqaB2oZJfDa/KP3rvdH/pJHFNs9lIc9Yi0UkIbXcIFPZDZvouGolCIXaQ7xPkwSnSsDO+Gg== X-Received: by 2002:a05:690c:d81:b0:6e9:e097:7191 with SMTP id 00721157ae682-6f275260684mr207767b3.9.1734002037359; Thu, 12 Dec 2024 03:13:57 -0800 (PST) Received: from gnu-tgl-3.localdomain ([172.58.111.227]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f14cebfe1fsm6397077b3.127.2024.12.12.03.13.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 03:13:57 -0800 (PST) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id B2C17C0216; Thu, 12 Dec 2024 19:13:52 +0800 (CST) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: sam@gentoo.org, josmyers@redhat.com Subject: [PATCH v2] Clear CXX and TEST_CXX if C++ link test fails Date: Thu, 12 Dec 2024 19:13:52 +0800 Message-ID: <20241212111352.3887821-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3019.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~patchwork=sourceware.org@sourceware.org Since the C++ compiler is used only for testing, use TEST_CXX as the C++ compiler if available. If C++ link test fails, clear both CXX and TEST_CXX so that the C++ compiler isn't used for glibc build nor test. Tested for m68k-linux-gnu-coldfire build and native build on x86-64. Signed-off-by: H.J. Lu --- configure | 7 +------ configure.ac | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/configure b/configure index fbfe849474..37877d5b97 100755 --- a/configure +++ b/configure @@ -4301,10 +4301,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -z "$TEST_CXX"; then - saved_CXX= TEST_CXX="$CXX" else - saved_CXX="$CXX" CXX="$TEST_CXX" fi # It's useless to us if it can't link programs (e.g. missing -lstdc++). @@ -4382,10 +4380,7 @@ fi printf "%s\n" "$libc_cv_cxx_link_ok" >&6; } if test $libc_cv_cxx_link_ok != yes then : - CXX= -fi -if test -n "$saved_CXX"; then - CXX="$saved_CXX" + CXX=; TEST_CXX= fi if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then diff --git a/configure.ac b/configure.ac index 1b0e07dfab..dca8991fbf 100644 --- a/configure.ac +++ b/configure.ac @@ -78,10 +78,8 @@ AC_PROG_CXX AC_ARG_VAR([TEST_CXX], [C++ compiler for testing]) if test -z "$TEST_CXX"; then - saved_CXX= TEST_CXX="$CXX" else - saved_CXX="$CXX" CXX="$TEST_CXX" fi # It's useless to us if it can't link programs (e.g. missing -lstdc++). @@ -110,10 +108,7 @@ main() LDFLAGS="$old_LDFLAGS" fi AC_LANG_POP([C++])]) -AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=]) -if test -n "$saved_CXX"; then - CXX="$saved_CXX" -fi +AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=; TEST_CXX=]) if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then AC_MSG_ERROR([you must configure in a separate build directory])