* [Qemu-devel] [PATCH v2] configure: Default to 'cc', not 'gcc'
@ 2012-12-07 15:39 Peter Maydell
2012-12-08 20:03 ` Blue Swirl
0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2012-12-07 15:39 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Anthony Liguori, Andreas Färber, patches
Default to 'cc' as our compiler, rather than 'gcc'. We used to have
to insist on gcc when we still kept the CPU env in a fixed global
register, but this is no longer necessary and we will now compile OK
on clang as well as gcc. Using 'cc' should generally result in us
using the most standard and maintained system compiler for the
platform. (For instance on newer MacOS X 'gcc' exists but is an
elderly compiler provided mostly for legacy reasons, and 'cc'
(which is clang) is definitely the better choice.) On Linux there
will generally be no user-visible change since cc will be gcc.
This changeover necessitates a slight reworking of how we set the
'cc' variable, because GNU cross toolchains generally provide a
'${cross_prefix}gcc' but not a '${cross_prefix}cc'.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
MacOS X is the main aim here but BSDs would probably also prefer
to default to 'cc'. Previous macos-specific version of this patch:
http://patchwork.ozlabs.org/patch/199685/
configure | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 994f731..88c8f15 100755
--- a/configure
+++ b/configure
@@ -116,7 +116,7 @@ audio_drv_list=""
audio_card_list="ac97 es1370 sb16 hda"
audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
block_drv_whitelist=""
-host_cc="gcc"
+host_cc="cc"
libs_softmmu=""
libs_tools=""
audio_pt_int=""
@@ -250,7 +250,16 @@ done
# Using uname is really, really broken. Once we have the right set of checks
# we can eliminate its usage altogether.
-cc="${CC-${cross_prefix}gcc}"
+# Preferred compiler:
+# ${CC} (if set)
+# ${cross_prefix}gcc (if cross-prefix specified)
+# system compiler
+if test -z "${CC}${cross_prefix}"; then
+ cc="$host_cc"
+else
+ cc="${CC-${cross_prefix}gcc}"
+fi
+
ar="${AR-${cross_prefix}ar}"
objcopy="${OBJCOPY-${cross_prefix}objcopy}"
ld="${LD-${cross_prefix}ld}"
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH v2] configure: Default to 'cc', not 'gcc'
2012-12-07 15:39 [Qemu-devel] [PATCH v2] configure: Default to 'cc', not 'gcc' Peter Maydell
@ 2012-12-08 20:03 ` Blue Swirl
0 siblings, 0 replies; 2+ messages in thread
From: Blue Swirl @ 2012-12-08 20:03 UTC (permalink / raw)
To: Peter Maydell
Cc: Paolo Bonzini, Anthony Liguori, patches, qemu-devel,
Andreas Färber
Thanks, applied.
On Fri, Dec 7, 2012 at 3:39 PM, Peter Maydell <peter.maydell@linaro.org> wrote:
> Default to 'cc' as our compiler, rather than 'gcc'. We used to have
> to insist on gcc when we still kept the CPU env in a fixed global
> register, but this is no longer necessary and we will now compile OK
> on clang as well as gcc. Using 'cc' should generally result in us
> using the most standard and maintained system compiler for the
> platform. (For instance on newer MacOS X 'gcc' exists but is an
> elderly compiler provided mostly for legacy reasons, and 'cc'
> (which is clang) is definitely the better choice.) On Linux there
> will generally be no user-visible change since cc will be gcc.
>
> This changeover necessitates a slight reworking of how we set the
> 'cc' variable, because GNU cross toolchains generally provide a
> '${cross_prefix}gcc' but not a '${cross_prefix}cc'.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> MacOS X is the main aim here but BSDs would probably also prefer
> to default to 'cc'. Previous macos-specific version of this patch:
> http://patchwork.ozlabs.org/patch/199685/
>
> configure | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index 994f731..88c8f15 100755
> --- a/configure
> +++ b/configure
> @@ -116,7 +116,7 @@ audio_drv_list=""
> audio_card_list="ac97 es1370 sb16 hda"
> audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
> block_drv_whitelist=""
> -host_cc="gcc"
> +host_cc="cc"
> libs_softmmu=""
> libs_tools=""
> audio_pt_int=""
> @@ -250,7 +250,16 @@ done
> # Using uname is really, really broken. Once we have the right set of checks
> # we can eliminate its usage altogether.
>
> -cc="${CC-${cross_prefix}gcc}"
> +# Preferred compiler:
> +# ${CC} (if set)
> +# ${cross_prefix}gcc (if cross-prefix specified)
> +# system compiler
> +if test -z "${CC}${cross_prefix}"; then
> + cc="$host_cc"
> +else
> + cc="${CC-${cross_prefix}gcc}"
> +fi
> +
> ar="${AR-${cross_prefix}ar}"
> objcopy="${OBJCOPY-${cross_prefix}objcopy}"
> ld="${LD-${cross_prefix}ld}"
> --
> 1.7.9.5
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-08 20:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-07 15:39 [Qemu-devel] [PATCH v2] configure: Default to 'cc', not 'gcc' Peter Maydell
2012-12-08 20:03 ` Blue Swirl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).