[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 23/25] configure: Honour cross-prefix when finding ObjC compiler
From: |
Paolo Bonzini |
Subject: |
[PULL 23/25] configure: Honour cross-prefix when finding ObjC compiler |
Date: |
Fri, 21 Apr 2023 11:33:14 +0200 |
From: Peter Maydell <peter.maydell@linaro.org>
Currently when configure picks an ObjectiveC compiler it doesn't pay
attention to the cross-prefix. This isn't a big deal in practice,
because we only use ObjC on macos and you can't cross-compile to
macos. But it's a bit inconsistent.
Rearrange the handling of objcc in configure so that we do the
same thing that we do with cc and cxx. This means that the logic
for picking the ObjC compiler goes from:
if --objcc is specified, use that
otherwise if clang is available, use that
otherwise use $cc
to:
if --objcc is specified, use that
otherwise if --cross-prefix is specified, use ${cross_prefix}clang
otherwise if clang is available, use that
otherwise use $cc
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1185
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20230418161554.744834-1-peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/configure b/configure
index 22b8553b8d70..77c03315f820 100755
--- a/configure
+++ b/configure
@@ -316,6 +316,8 @@ for opt do
;;
--cxx=*) CXX="$optarg"
;;
+ --objcc=*) objcc="$optarg"
+ ;;
--cpu=*) cpu="$optarg"
;;
--extra-cflags=*)
@@ -361,6 +363,21 @@ else
cxx="${CXX-${cross_prefix}g++}"
fi
+# Preferred ObjC compiler:
+# $objcc (if set, i.e. via --objcc option)
+# ${cross_prefix}clang (if cross-prefix specified)
+# clang (if available)
+# $cc
+if test -z "${objcc}${cross_prefix}"; then
+ if has clang; then
+ objcc=clang
+ else
+ objcc="$cc"
+ fi
+else
+ objcc="${objcc-${cross_prefix}clang}"
+fi
+
ar="${AR-${cross_prefix}ar}"
as="${AS-${cross_prefix}as}"
ccas="${CCAS-$cc}"
@@ -647,13 +664,6 @@ do
fi
done
-# Default objcc to clang if available, otherwise use CC
-if has clang; then
- objcc=clang
-else
- objcc="$cc"
-fi
-
if test "$mingw32" = "yes" ; then
EXESUF=".exe"
# MinGW needs -mthreads for TLS and macro _MT.
@@ -713,7 +723,7 @@ for opt do
;;
--cxx=*)
;;
- --objcc=*) objcc="$optarg"
+ --objcc=*)
;;
--make=*) make="$optarg"
;;
--
2.40.0
- [PULL 10/25] coverity: update COMPONENTS.md, (continued)
- [PULL 10/25] coverity: update COMPONENTS.md, Paolo Bonzini, 2023/04/21
- [PULL 13/25] io: mark mixed functions that can suspend, Paolo Bonzini, 2023/04/21
- [PULL 12/25] qapi-gen: mark coroutine QMP command functions as coroutine_fn, Paolo Bonzini, 2023/04/21
- [PULL 18/25] postcopy-ram: do not use qatomic_mb_read, Paolo Bonzini, 2023/04/21
- [PULL 14/25] migration: mark mixed functions that can suspend, Paolo Bonzini, 2023/04/21
- [PULL 15/25] monitor: mark mixed functions that can suspend, Paolo Bonzini, 2023/04/21
- [PULL 16/25] target/i386: Change wrong XFRM value in SGX CPUID leaf, Paolo Bonzini, 2023/04/21
- [PULL 17/25] block-backend: remove qatomic_mb_read(), Paolo Bonzini, 2023/04/21
- [PULL 20/25] docs: explain effect of smp_read_barrier_depends() on modern architectures, Paolo Bonzini, 2023/04/21
- [PULL 21/25] nbd: a BlockExport always has a BlockBackend, Paolo Bonzini, 2023/04/21
- [PULL 23/25] configure: Honour cross-prefix when finding ObjC compiler,
Paolo Bonzini <=
- [PULL 19/25] qemu-coroutine: remove qatomic_mb_read(), Paolo Bonzini, 2023/04/21
- [PULL 22/25] coverity: unify Fedora dockerfiles, Paolo Bonzini, 2023/04/21
- [PULL 25/25] tests: lcitool: Switch to OpenSUSE Leap 15.4, Paolo Bonzini, 2023/04/21
- [PULL 24/25] tests: libvirt-ci: Update to commit '2fa24dce8bc', Paolo Bonzini, 2023/04/21
- Re: [PULL 00/25] First batch of misc patches for QEMU 8.1, Richard Henderson, 2023/04/22