qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Improve gcc 3 checking


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH] Improve gcc 3 checking
Date: Mon, 18 Dec 2006 20:58:32 -0600
User-agent: Thunderbird 1.5.0.8 (X11/20061115)

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
address@hidden
http://lists.nongnu.org/mailman/listinfo/qemu-devel

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
 
 ##########################################

reply via email to

[Prev in Thread] Current Thread [Next in Thread]