From patchwork Sat Sep 2 12:59:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 1829087 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=XAFCKAwF; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=patchwork.ozlabs.org) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RdFQ9738Hz1yhM for ; Sat, 2 Sep 2023 23:01:05 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qcQEB-0000zb-Ug; Sat, 02 Sep 2023 08:59:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qcQEA-0000wu-L4 for qemu-devel@nongnu.org; Sat, 02 Sep 2023 08:59:50 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qcQE8-0001gR-A2 for qemu-devel@nongnu.org; Sat, 02 Sep 2023 08:59:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1693659587; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eTC08l5E2LHxzBEzXg14rY8tH1ESV2HYzTzj23bXChc=; b=XAFCKAwFuDpQNfQWhUpJCVHDBxY0lOk1p852mQniK9AGDjPBiT+ohjVnkhlMYZ1zO0A5ew aSq25VFBUvrgvjnAgz70woOS4hhUoSqBRy5RAa/jHviHMwbBB9GuSzSLZCqIyNDm1TkuiV feLIhcj/Un+qI5xAFRSpja7Ul6v78L4= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-44-y3euDBcIOGSj9xfxFlzSYg-1; Sat, 02 Sep 2023 08:59:46 -0400 X-MC-Unique: y3euDBcIOGSj9xfxFlzSYg-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-31c7727aa5cso1467937f8f.0 for ; Sat, 02 Sep 2023 05:59:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693659584; x=1694264384; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eTC08l5E2LHxzBEzXg14rY8tH1ESV2HYzTzj23bXChc=; b=Oipv9PWtGS/XvIpErpSUVG/b33sipqAGN5MrUDgFG+g6K6MMbiu60ro9PO5eavsb88 uNqgA/0TWYW2BnhJBcBDEpJztLRiwjJhV7szYn3hQvOBXFGgrsK6x3uu1GfKP2xpPwew 4e9rsG7AuwoooYYN07kAU/UJ/+E2bErxp+qhDrK/X297Omji+5so9tgrY6QHMvhEpuqq rlBmthElN6HZCaHO9OUOcW65cYPEpE5IeF44In52UD6iPyXfFrO/1mpSgKyvLIJzUHVT Jjm4Ho7B4EQiWOLaLsykph0/9vDc7Uotw2+RKh6iX4atbj5+g0I9nxe6XUaGdAmU+exa 12Dw== X-Gm-Message-State: AOJu0YxOGO3JYy0kCdguw+iUkvnFOR+ytfV5mGlVxzftBt+mhP02j/nm 2jLuWv326MVdLEmiL0gAWd0bJzgTWHuqGSnpdvRgFP+kE8LjFBAQN/wti50VTtMIjTj6jW7Pz3G jXhopEW8czlFp0iGjMpJ5sOKTu9zrGBDPSED+Pv8IgN88a7seHwm4w0/iMM2GyGnJOPwRwcCLRP A= X-Received: by 2002:adf:e382:0:b0:319:8430:f80f with SMTP id e2-20020adfe382000000b003198430f80fmr4307031wrm.49.1693659584188; Sat, 02 Sep 2023 05:59:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGaArmF3GMN73lRajHBfWjw0CPtAh74iUSl7zgvJ3YypN0m6VHK9TVjrydWM/S4Fd5/UuP0HQ== X-Received: by 2002:adf:e382:0:b0:319:8430:f80f with SMTP id e2-20020adfe382000000b003198430f80fmr4307024wrm.49.1693659583949; Sat, 02 Sep 2023 05:59:43 -0700 (PDT) Received: from [192.168.10.118] ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id bs11-20020a056000070b00b0031f3780ce60sm1695182wrb.7.2023.09.02.05.59.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 05:59:42 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Daniel_P_=2E?= =?utf-8?q?_Berrang=C3=A9?= Subject: [PATCH 04/15] configure: create native file with contents of $host_cc Date: Sat, 2 Sep 2023 14:59:23 +0200 Message-ID: <20230902125934.113017-5-pbonzini@redhat.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230902125934.113017-1-pbonzini@redhat.com> References: <20230902125934.113017-1-pbonzini@redhat.com> MIME-Version: 1.0 Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The argument of --host-cc is not obeyed when cross compiling. To avoid this issue, place it in a configuration file and pass it to meson with --native-file. While at it, clarify that --host-cc is not obeyed anyway when _not_ cross compiling, because cc="$host_cc" is placed before --host-cc is processed. Reviewed-by: Richard Henderson Reviewed-by: Daniel P. Berrangé Signed-off-by: Paolo Bonzini --- configure | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 7743c18f2fe..378a0de9fb6 100755 --- a/configure +++ b/configure @@ -288,7 +288,7 @@ static="no" # ${cross_prefix}gcc (if cross-prefix specified) # system compiler if test -z "${CC}${cross_prefix}"; then - cc="$host_cc" + cc="cc" else cc="${CC-${cross_prefix}gcc}" fi @@ -927,8 +927,8 @@ Advanced options (experts only): -Dmesonoptname=val passthrough option to meson unmodified --cross-prefix=PREFIX use PREFIX for compile tools, PREFIX can be blank [$cross_prefix] --cc=CC use C compiler CC [$cc] - --host-cc=CC use C compiler CC [$host_cc] for code run at - build time + --host-cc=CC when cross compiling, use C compiler CC for code run + at build time [$host_cc] --cxx=CXX use C++ compiler CXX [$cxx] --objcc=OBJCC use Objective-C compiler OBJCC [$objcc] --extra-cflags=CFLAGS append extra C compiler flags CFLAGS @@ -1892,7 +1892,6 @@ if test "$skip_meson" = no; then echo "windres = [$(meson_quote $windres)]" >> $cross echo "windmc = [$(meson_quote $windmc)]" >> $cross if test "$cross_compile" = "yes"; then - cross_arg="--cross-file config-meson.cross" echo "[host_machine]" >> $cross echo "system = '$targetos'" >> $cross case "$cpu" in @@ -1909,6 +1908,14 @@ if test "$skip_meson" = no; then else echo "endian = 'little'" >> $cross fi + cross_arg="--cross-file config-meson.cross" + + native="config-meson.native.new" + echo "# Automatically generated by configure - do not modify" > $native + echo "[binaries]" >> $native + echo "c = [$(meson_quote $host_cc)]" >> $native + mv $native config-meson.native + cross_arg="$cross_arg --native-file config-meson.native" else cross_arg="--native-file config-meson.cross" fi