From patchwork Thu Sep 29 11:42:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 610608 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp915419pvb; Thu, 29 Sep 2022 07:10:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7mjTJr0IMrz/ZofV+Ztf9OfzWWbFM6YAS6/9ABFi+zDM++Z7KyKm6eSWHVSm3GZbE295Rk X-Received: by 2002:ad4:5b84:0:b0:4af:4ad5:cbd7 with SMTP id 4-20020ad45b84000000b004af4ad5cbd7mr2668439qvp.7.1664460634172; Thu, 29 Sep 2022 07:10:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664460634; cv=none; d=google.com; s=arc-20160816; b=re+uuNjD0GZhjHytcOijH5/NlS7pH3d6MXHJJJBfWOVYdafSyB0SJRdwtFap67TdLu mzP37et4AC6sW5XzGhQPr0DD5QjlcyTNstLm/vDGmPgFNfJi99sMeGqU/sgvf4abaf90 U9MWl0V2TBb93XkMJjJsHfg+yAHeRnTSiHysTbxD8xJb2bI9mQ+Rl3FXFkQuYQUlfwEW 9NHsm0Cg88SmEe3rC/F9tkFz4czN+2ewsBgf9e3vD1gC0IoLzyky8HZ9/uhdDTnj3Dfk hpm46IEw8je8zhH5F2FymaRUHuyjiFyheVw9IHB1gg0Pj+rZ92IrYkewUdGtz5DCW+Xe Hs9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Ni3h4Ensb2+EbCS1w58timGRfCJrzPXBUuLWwhQJKIE=; b=ClX5RzZuyCRRv0cyMAIBH9HvW2rtB+AAbAqfhaf+1CJirPVQYFDeg0aPp/MDYxRKjo Hh2eg6tCEtn9qEEHEXwHgOVN/hRauVakRPQnekiOT4/OZRxEmlwrZfz71dtIMAWuH35E YOqObLKgNEP9Lpg5O4NrT4GaAmpRPe/KBPVQyaz1Z182AbQ5ZpC9n1cdcj4+v6knV8qn QkzfDGAkQSHYGkDCLx1ttuPjMw9RJ0hgei88dEmGt/2a7x2UVq6y5AVNvQRDWSqrpW+i YqEvGlsMIS03A+hByy/mLz2d3VZs276ZUVTnGpqGAWarcXMdQS+B8VuE3eyBAbHe9lkP 5V4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="s9/366Aj"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ck13-20020a05622a230d00b0035bb4298516si1231701qtb.95.2022.09.29.07.10.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 29 Sep 2022 07:10:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="s9/366Aj"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oduFD-0004Qv-B4 for patch@linaro.org; Thu, 29 Sep 2022 10:10:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36684) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1odsCx-0007Qb-7n for qemu-devel@nongnu.org; Thu, 29 Sep 2022 08:00:03 -0400 Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:44825) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1odsCr-0004LZ-P7 for qemu-devel@nongnu.org; Thu, 29 Sep 2022 08:00:02 -0400 Received: by mail-wr1-x429.google.com with SMTP id c11so1800017wrp.11 for ; Thu, 29 Sep 2022 04:59:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=Ni3h4Ensb2+EbCS1w58timGRfCJrzPXBUuLWwhQJKIE=; b=s9/366AjJ+S9BIXNEDOXYJ5QKu8bTZDN+WUCJ0wRsNxTWBWxvv939/T8zFEOMKsTIj 3y7AR0VxpEtLbF3kDyGT5aReyB1uGMJUrU1OI9L6W+pd0LrqHTgMaJ4Evq6p6Uj7hsuz upVkZmURETau+TnQi8xZbGJIx/UTedMfPQd0rBJVHsxcPu4YFtJl7EIp1AwxfjN7CkKF 0dILer0xyfrVPBGvYkRbMNzGJjhqcnE633O879FqzubR8faGj0wBy3rp/VJ83kwN9B/p xtn9uZNymFaqromV7alKol1FVNzTGzZjX16dQ7LUg3NIS00Z0pfiTPlXMfaB1ZNGprEP E1YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=Ni3h4Ensb2+EbCS1w58timGRfCJrzPXBUuLWwhQJKIE=; b=tpL4oyqaD0bi5zbT0RidYJ0SSd94tveGn3hXUb9MRgb3fFHcnVlooLxJ5GpGSi+OOx FIJbJK31q25JY5omYWWdYzmeULUIS4OMiVut1IB2dVk5becEy5jDwY8j5NU98o6dS2J9 0rcGQOJVCn5cBA7oK97RNoMHjB3n2W0r11sdZHcbqkWkNRc1cj9mrLgtXM89H92X8VeI z3rneOWlfWgHP17Z70ReHrchFml8l5yj00s6wDXjPcYazrpzPXAAzzbU0fs3gPbPiToe t4oN0QW1wS/7ZCqQedirnDRndbYOmWt7OJqAgOu6R6sAU/XpGqkuTCJH402AT5iMyYW0 LYaw== X-Gm-Message-State: ACrzQf0B99tsqUCrfwFRShZA/eaZR7chFDZX5zC8o53e5f2VcdOj4alm bf4vum4sSFxv8TRs5+OGX/qonA== X-Received: by 2002:adf:d0cd:0:b0:22b:1ade:7980 with SMTP id z13-20020adfd0cd000000b0022b1ade7980mr1905872wrh.265.1664452792167; Thu, 29 Sep 2022 04:59:52 -0700 (PDT) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id r9-20020adfda49000000b002258235bda3sm6731971wrl.61.2022.09.29.04.59.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Sep 2022 04:59:51 -0700 (PDT) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4CC721FFCE; Thu, 29 Sep 2022 12:42:34 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: fam@euphon.net, berrange@redhat.com, f4bug@amsat.org, aurelien@aurel32.net, pbonzini@redhat.com, stefanha@redhat.com, crosa@redhat.com, minyihh@uci.edu, ma.mandourr@gmail.com, Luke.Craig@ll.mit.edu, cota@braap.org, aaron@os.amperecomputing.com, kuhn.chenqun@huawei.com, robhenry@microsoft.com, mahmoudabdalghany@outlook.com, =?utf-8?q?Alex_Benn=C3=A9e?= Subject: [PATCH v1 26/51] configure: unify creation of cross-compilation Makefiles Date: Thu, 29 Sep 2022 12:42:06 +0100 Message-Id: <20220929114231.583801-27-alex.bennee@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220929114231.583801-1-alex.bennee@linaro.org> References: <20220929114231.583801-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::429; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x429.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Paolo Bonzini Let write_target_makefile handle both host and container cross compilers. Signed-off-by: Paolo Bonzini Signed-off-by: Alex Bennée --- configure | 94 +++++++++++++++++++++++++------------------------------ 1 file changed, 43 insertions(+), 51 deletions(-) diff --git a/configure b/configure index cbeac99b2b..8b495d4453 100755 --- a/configure +++ b/configure @@ -2157,51 +2157,49 @@ probe_target_compiler() { write_target_makefile() { echo "EXTRA_CFLAGS=$target_cflags" - if test -n "$target_cc"; then - echo "CC=$target_cc" - echo "CCAS=$target_ccas" - fi - if test -n "$target_ar"; then - echo "AR=$target_ar" - fi - if test -n "$target_as"; then - echo "AS=$target_as" - fi - if test -n "$target_ld"; then - echo "LD=$target_ld" - fi - if test -n "$target_nm"; then - echo "NM=$target_nm" - fi - if test -n "$target_objcopy"; then - echo "OBJCOPY=$target_objcopy" - fi - if test -n "$target_ranlib"; then - echo "RANLIB=$target_ranlib" - fi - if test -n "$target_strip"; then - echo "STRIP=$target_strip" - fi -} - -write_container_target_makefile() { - echo "$1: docker-image-$container_image" >> Makefile.prereqs - echo "EXTRA_CFLAGS=$target_cflags" - if test -n "$container_cross_cc"; then - echo "CC=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --" - echo "CCAS=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --" + if test -z "$target_cc" && test -z "$target_as"; then + test -z "$container_image" && error_exit "Internal error: could not find cross compiler for $1?" + echo "$1: docker-image-$container_image" >> Makefile.prereqs + if test -n "$container_cross_cc"; then + echo "CC=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --" + echo "CCAS=$docker_py cc --cc $container_cross_cc -i qemu/$container_image -s $source_path --" + fi + echo "AR=$docker_py cc --cc $container_cross_ar -i qemu/$container_image -s $source_path --" + echo "AS=$docker_py cc --cc $container_cross_as -i qemu/$container_image -s $source_path --" + echo "LD=$docker_py cc --cc $container_cross_ld -i qemu/$container_image -s $source_path --" + echo "NM=$docker_py cc --cc $container_cross_nm -i qemu/$container_image -s $source_path --" + echo "OBJCOPY=$docker_py cc --cc $container_cross_objcopy -i qemu/$container_image -s $source_path --" + echo "RANLIB=$docker_py cc --cc $container_cross_ranlib -i qemu/$container_image -s $source_path --" + echo "STRIP=$docker_py cc --cc $container_cross_strip -i qemu/$container_image -s $source_path --" + else + if test -n "$target_cc"; then + echo "CC=$target_cc" + echo "CCAS=$target_ccas" + fi + if test -n "$target_ar"; then + echo "AR=$target_ar" + fi + if test -n "$target_as"; then + echo "AS=$target_as" + fi + if test -n "$target_ld"; then + echo "LD=$target_ld" + fi + if test -n "$target_nm"; then + echo "NM=$target_nm" + fi + if test -n "$target_objcopy"; then + echo "OBJCOPY=$target_objcopy" + fi + if test -n "$target_ranlib"; then + echo "RANLIB=$target_ranlib" + fi + if test -n "$target_strip"; then + echo "STRIP=$target_strip" + fi fi - echo "AR=$docker_py cc --cc $container_cross_ar -i qemu/$container_image -s $source_path --" - echo "AS=$docker_py cc --cc $container_cross_as -i qemu/$container_image -s $source_path --" - echo "LD=$docker_py cc --cc $container_cross_ld -i qemu/$container_image -s $source_path --" - echo "NM=$docker_py cc --cc $container_cross_nm -i qemu/$container_image -s $source_path --" - echo "OBJCOPY=$docker_py cc --cc $container_cross_objcopy -i qemu/$container_image -s $source_path --" - echo "RANLIB=$docker_py cc --cc $container_cross_ranlib -i qemu/$container_image -s $source_path --" - echo "STRIP=$docker_py cc --cc $container_cross_strip -i qemu/$container_image -s $source_path --" } - - ########################################## # check for vfio_user_server @@ -2560,15 +2558,9 @@ for target in $target_list; do ;; esac - probe_target_compiler $target - if test $got_cross_cc = yes; then - write_target_makefile >> "$config_target_mak" - elif test -n "$container_image"; then - build_static=y - write_container_target_makefile build-tcg-tests-$target >> "$config_target_mak" - got_cross_cc=yes - fi - if test $got_cross_cc = yes; then + if probe_target_compiler $target || test -n "$container_image"; then + test -n "$container_image" && build_static=y + write_target_makefile "build-tcg-tests-$target >> "$config_target_mak" mkdir -p "tests/tcg/$target" ln -sf "$source_path/tests/tcg/Makefile.target" "tests/tcg/$target/Makefile" ln -sf "../config-$target.mak" "tests/tcg/$target/config-target.mak"