* [Qemu-devel] [PATCH] Improve gcc 3 checking
@ 2006-12-19 2:25 Anthony Liguori
2006-12-19 2:31 ` Paul Brook
0 siblings, 1 reply; 5+ messages in thread
From: Anthony Liguori @ 2006-12-19 2:25 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 713 bytes --]
In Xen, we use a single top level Makefile to build everything. This
means we automatically kick off the configure script. It would be nice
if QEMU's configure did a better job of finding existing GCC 3.x
installs so that the user didn't have to manually specific the location.
The attached patch adds a white list to configure to check for various
versions of GCC 3.x. The white list so far covers the various versions
of GCC in recent versions of OpenSUSE, Fedora, RHEL, and Ubuntu
(presumably also Debian).
I don't think this patch will impact any of the other platforms but
getting some testing first on weird platforms (Solaris and Win32
especially) would be helpful.
Regards,
Anthony Liguori
[-- Attachment #2: qemu-gcc-3x.diff --]
[-- Type: text/x-patch, Size: 2029 bytes --]
diff -r ca36b7b88df2 configure
--- a/configure Mon Dec 18 18:57:19 2006 -0600
+++ b/configure Mon Dec 18 20:18:01 2006 -0600
@@ -22,6 +22,7 @@ static="no"
static="no"
cross_prefix=""
cc="gcc"
+gcc3_list="gcc32 gcc33 gcc34 gcc-3.2 gcc-3.3 gcc-3.4"
host_cc="gcc"
ar="ar"
make="make"
@@ -311,6 +312,41 @@ if test "$mingw32" = "yes" ; then
oss="no"
if [ "$cpu" = "i386" ] ; then
kqemu="yes"
+ fi
+fi
+
+# Check for gcc4, error if pre-gcc4
+if test "$check_gcc" = "yes" ; then
+ cat > $TMPC <<EOF
+#if __GNUC__ < 4
+#error gcc3
+#endif
+int main(){return 0;}
+EOF
+ check_cc() {
+ which "$1" >&/dev/null
+ return $?
+ }
+
+ if check_cc "$cc" ; then
+ echo "WARNING: \"$cc\" looks like gcc 4.x"
+ echo "Looking for gcc 3.x"
+ found_compat_cc="no"
+ for compat_cc in $gcc3_list ; do
+ if check_cc "$compat_cc" ; then
+ echo "Found \"$compat_cc\""
+ cc="$compat_cc"
+ found_compat_cc="yes"
+ break
+ fi
+ done
+ if test "$found_compat_cc" = "no" ; then
+ echo "gcc 3.x not found!"
+ echo "QEMU is known to have problems when compiled with gcc 4.x"
+ echo "It is recommended that you use gcc 3.x to build QEMU"
+ echo "To use this compiler anyway, configure with --disable-gcc-check"
+ exit 1;
+ fi
fi
fi
@@ -414,23 +450,6 @@ have_gcc3_options="no"
have_gcc3_options="no"
if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
have_gcc3_options="yes"
-fi
-
-# Check for gcc4, error if pre-gcc4
-if test "$check_gcc" = "yes" ; then
- cat > $TMPC <<EOF
-#if __GNUC__ < 4
-#error gcc3
-#endif
-int main(){return 0;}
-EOF
- if $cc -o $TMPO $TMPC 2>/dev/null ; then
- echo "ERROR: \"$cc\" looks like gcc 4.x"
- echo "QEMU is known to have problems when compiled with gcc 4.x"
- echo "It is recommended that you use gcc 3.x to build QEMU"
- echo "To use this compiler anyway, configure with --disable-gcc-check"
- exit 1;
- fi
fi
##########################################
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] Improve gcc 3 checking
2006-12-19 2:25 [Qemu-devel] [PATCH] Improve gcc 3 checking Anthony Liguori
@ 2006-12-19 2:31 ` Paul Brook
2006-12-19 2:58 ` Anthony Liguori
0 siblings, 1 reply; 5+ messages in thread
From: Paul Brook @ 2006-12-19 2:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Anthony Liguori
On Tuesday 19 December 2006 02:25, Anthony Liguori wrote:
> +gcc3_list="gcc32 gcc33 gcc34 gcc-3.2 gcc-3.3 gcc-3.4"
Shouldn't we be preferring newer compilers?
> + echo "Looking for gcc 3.x"
We shouldn't do this if if the user explicitly specified a compiler.
Replacing explicit user setting with guesses is bad.
Paul
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] Improve gcc 3 checking
2006-12-19 2:31 ` Paul Brook
@ 2006-12-19 2:58 ` Anthony Liguori
2006-12-19 3:09 ` Paul Brook
0 siblings, 1 reply; 5+ messages in thread
From: Anthony Liguori @ 2006-12-19 2:58 UTC (permalink / raw)
To: qemu-devel, Paul Brook
[-- Attachment #1: Type: text/plain, Size: 1034 bytes --]
Paul Brook wrote:
> On Tuesday 19 December 2006 02:25, Anthony Liguori wrote:
>
>> +gcc3_list="gcc32 gcc33 gcc34 gcc-3.2 gcc-3.3 gcc-3.4"
>>
>
> Shouldn't we be preferring newer compilers?
>
Attached patch changes order plus improves the initial GCC 4 check a bit.
>> + echo "Looking for gcc 3.x"
>>
>
> We shouldn't do this if if the user explicitly specified a compiler.
> Replacing explicit user setting with guesses is bad.
>
This stuff kicks in only if the user doesn't specific
--disable-gcc-check and CC is not GCC 4.
So if the user specific a valid --cc=, then this check won't get triggered.
If they explicitly specific an invalid --cc=, the checks will get
triggered (but in the past, we would have bailed).
So, if the user wants to explicitly specify a compiler, they can happily
do that.
Regards,
Anthony Liguori
> Paul
>
>
> _______________________________________________
> Qemu-devel mailing list
> Qemu-devel@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/qemu-devel
>
[-- Attachment #2: qemu-gcc-3x.diff --]
[-- Type: text/x-patch, Size: 2047 bytes --]
diff -r f928121a13c1 configure
--- a/configure Mon Dec 18 20:29:34 2006 -0600
+++ b/configure Mon Dec 18 20:54:20 2006 -0600
@@ -22,6 +22,7 @@ static="no"
static="no"
cross_prefix=""
cc="gcc"
+gcc3_list="gcc-3.4 gcc34 gcc-3.3 gcc33 gcc-3.2 gcc32"
host_cc="gcc"
ar="ar"
make="make"
@@ -311,6 +312,41 @@ if test "$mingw32" = "yes" ; then
oss="no"
if [ "$cpu" = "i386" ] ; then
kqemu="yes"
+ fi
+fi
+
+# Check for gcc4, error if pre-gcc4
+if test "$check_gcc" = "yes" ; then
+ cat > $TMPC <<EOF
+#if __GNUC__ < 4
+#error gcc3
+#endif
+int main(){return 0;}
+EOF
+ check_cc() {
+ which "$1" >&/dev/null
+ return $?
+ }
+
+ if "$cc" -o $TMPE $TMPC 2>/dev/null ; then
+ echo "WARNING: \"$cc\" looks like gcc 4.x"
+ echo "Looking for gcc 3.x"
+ found_compat_cc="no"
+ for compat_cc in $gcc3_list ; do
+ if check_cc "$compat_cc" ; then
+ echo "Found \"$compat_cc\""
+ cc="$compat_cc"
+ found_compat_cc="yes"
+ break
+ fi
+ done
+ if test "$found_compat_cc" = "no" ; then
+ echo "gcc 3.x not found!"
+ echo "QEMU is known to have problems when compiled with gcc 4.x"
+ echo "It is recommended that you use gcc 3.x to build QEMU"
+ echo "To use this compiler anyway, configure with --disable-gcc-check"
+ exit 1;
+ fi
fi
fi
@@ -414,23 +450,6 @@ have_gcc3_options="no"
have_gcc3_options="no"
if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
have_gcc3_options="yes"
-fi
-
-# Check for gcc4, error if pre-gcc4
-if test "$check_gcc" = "yes" ; then
- cat > $TMPC <<EOF
-#if __GNUC__ < 4
-#error gcc3
-#endif
-int main(){return 0;}
-EOF
- if $cc -o $TMPO $TMPC 2>/dev/null ; then
- echo "ERROR: \"$cc\" looks like gcc 4.x"
- echo "QEMU is known to have problems when compiled with gcc 4.x"
- echo "It is recommended that you use gcc 3.x to build QEMU"
- echo "To use this compiler anyway, configure with --disable-gcc-check"
- exit 1;
- fi
fi
##########################################
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] Improve gcc 3 checking
2006-12-19 2:58 ` Anthony Liguori
@ 2006-12-19 3:09 ` Paul Brook
2006-12-19 3:23 ` Anthony Liguori
0 siblings, 1 reply; 5+ messages in thread
From: Paul Brook @ 2006-12-19 3:09 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-devel
> If they explicitly specific an invalid --cc=, the checks will get
> triggered (but in the past, we would have bailed).
That's what I'm objecting to. If I do:
./configure --cc=gcc4
I expect configure to either use gcc4 or fail with an error. Preferably the
latter, but I'm open to persuasion.
I don't want configure to decide it knows better and use gcc3 anyway.
Paul
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Qemu-devel] [PATCH] Improve gcc 3 checking
2006-12-19 3:09 ` Paul Brook
@ 2006-12-19 3:23 ` Anthony Liguori
0 siblings, 0 replies; 5+ messages in thread
From: Anthony Liguori @ 2006-12-19 3:23 UTC (permalink / raw)
To: Paul Brook; +Cc: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 517 bytes --]
Paul Brook wrote:
>> If they explicitly specific an invalid --cc=, the checks will get
>> triggered (but in the past, we would have bailed).
>>
>
> That's what I'm objecting to. If I do:
>
> ./configure --cc=gcc4
>
> I expect configure to either use gcc4 or fail with an error. Preferably the
> latter, but I'm open to persuasion.
>
> I don't want configure to decide it knows better and use gcc3 anyway.
>
Okay, it now will throw an error if you specify --cc=gcc4.
Regards,
Anthony Liguori
> Paul
>
[-- Attachment #2: qemu-gcc-3x.diff --]
[-- Type: text/x-patch, Size: 2354 bytes --]
diff -r f928121a13c1 configure
--- a/configure Mon Dec 18 20:29:34 2006 -0600
+++ b/configure Mon Dec 18 21:20:36 2006 -0600
@@ -22,6 +22,8 @@ static="no"
static="no"
cross_prefix=""
cc="gcc"
+gcc3_check="yes"
+gcc3_list="gcc-3.4 gcc34 gcc-3.3 gcc33 gcc-3.2 gcc32"
host_cc="gcc"
ar="ar"
make="make"
@@ -178,6 +180,7 @@ for opt do
--cross-prefix=*) cross_prefix="$optarg"
;;
--cc=*) cc="$optarg"
+ gcc3_check="no"
;;
--host-cc=*) host_cc="$optarg"
;;
@@ -311,6 +314,45 @@ if test "$mingw32" = "yes" ; then
oss="no"
if [ "$cpu" = "i386" ] ; then
kqemu="yes"
+ fi
+fi
+
+# Check for gcc4, error if pre-gcc4
+if test "$check_gcc" = "yes" ; then
+ cat > $TMPC <<EOF
+#if __GNUC__ < 4
+#error gcc3
+#endif
+int main(){return 0;}
+EOF
+ check_cc() {
+ which "$1" >&/dev/null
+ return $?
+ }
+
+ if "$cc" -o $TMPE $TMPC 2>/dev/null ; then
+ echo "WARNING: \"$cc\" looks like gcc 4.x"
+ found_compat_cc="no"
+ if test "$gcc3_check" = "yes" ; then
+ echo "Looking for gcc 3.x"
+ for compat_cc in $gcc3_list ; do
+ if check_cc "$compat_cc" ; then
+ echo "Found \"$compat_cc\""
+ cc="$compat_cc"
+ found_compat_cc="yes"
+ break
+ fi
+ done
+ if test "$found_compat_cc" = "no" ; then
+ echo "gcc 3.x not found!"
+ fi
+ fi
+ if test "$found_compat_cc" = "no" ; then
+ echo "QEMU is known to have problems when compiled with gcc 4.x"
+ echo "It is recommended that you use gcc 3.x to build QEMU"
+ echo "To use this compiler anyway, configure with --disable-gcc-check"
+ exit 1;
+ fi
fi
fi
@@ -414,23 +456,6 @@ have_gcc3_options="no"
have_gcc3_options="no"
if $cc -fno-reorder-blocks -fno-optimize-sibling-calls -o $TMPO $TMPC 2> /dev/null ; then
have_gcc3_options="yes"
-fi
-
-# Check for gcc4, error if pre-gcc4
-if test "$check_gcc" = "yes" ; then
- cat > $TMPC <<EOF
-#if __GNUC__ < 4
-#error gcc3
-#endif
-int main(){return 0;}
-EOF
- if $cc -o $TMPO $TMPC 2>/dev/null ; then
- echo "ERROR: \"$cc\" looks like gcc 4.x"
- echo "QEMU is known to have problems when compiled with gcc 4.x"
- echo "It is recommended that you use gcc 3.x to build QEMU"
- echo "To use this compiler anyway, configure with --disable-gcc-check"
- exit 1;
- fi
fi
##########################################
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-12-19 3:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-19 2:25 [Qemu-devel] [PATCH] Improve gcc 3 checking Anthony Liguori
2006-12-19 2:31 ` Paul Brook
2006-12-19 2:58 ` Anthony Liguori
2006-12-19 3:09 ` Paul Brook
2006-12-19 3:23 ` Anthony Liguori
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).