qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Check for gcc3 only if compiling dyngen targets
@ 2008-08-22 17:45 Hervé Poussineau
  2008-08-22 18:01 ` Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: Hervé Poussineau @ 2008-08-22 17:45 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 298 bytes --]

Hi,

If no configured target needs dyngen, gcc3.x is not required. Currently,
you have to explicitly pass --disable-gcc-check flag to allow compilation.

Attached patch removes gcc check if no selected target needs dyngen.
I had to move gcc4 detection later in the configure script

Hervé

[-- Attachment #2: configure.diff --]
[-- Type: text/plain, Size: 4313 bytes --]

Index: configure
===================================================================
--- configure	(revision 5030)
+++ configure	(working copy)
@@ -468,40 +468,6 @@
     oss="no"
 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" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
-	echo "WARNING: \"$cc\" looks like gcc 4.x"
-	found_compat_cc="no"
-	if test "$gcc3_search" = "yes" ; then
-	    echo "Looking for gcc 3.x"
-	    for compat_cc in $gcc3_list ; do
-		if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
-		    echo "Found \"$compat_cc\""
-		    cc="$cross_prefix$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
-
 #
 # Solaris specific configure tool chain decisions
 #
@@ -1305,6 +1271,7 @@
 bflt="no"
 elfload32="no"
 target_nptl="no"
+requires_gcc3="no"
 interp_prefix1=`echo "$interp_prefix" | sed "s/%M/$target_cpu/g"`
 echo "#define CONFIG_QEMU_PREFIX \"$interp_prefix1\"" >> $config_h
 
@@ -1341,6 +1308,7 @@
     echo "#define TARGET_ARCH \"alpha\"" >> $config_h
     echo "#define TARGET_ALPHA 1" >> $config_h
     echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+    requires_gcc3="yes"
   ;;
   arm|armeb)
     echo "TARGET_ARCH=arm" >> $config_mak
@@ -1385,6 +1353,7 @@
     echo "#define TARGET_ARCH \"ppc\"" >> $config_h
     echo "#define TARGET_PPC 1" >> $config_h
     echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+    requires_gcc3="yes"
   ;;
   ppcemb)
     echo "TARGET_ARCH=ppcemb" >> $config_mak
@@ -1394,6 +1363,7 @@
     echo "#define TARGET_PPC 1" >> $config_h
     echo "#define TARGET_PPCEMB 1" >> $config_h
     echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+    requires_gcc3="yes"
   ;;
   ppc64)
     echo "TARGET_ARCH=ppc64" >> $config_mak
@@ -1403,6 +1373,7 @@
     echo "#define TARGET_PPC 1" >> $config_h
     echo "#define TARGET_PPC64 1" >> $config_h
     echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+    requires_gcc3="yes"
   ;;
   ppc64abi32)
     echo "TARGET_ARCH=ppc64" >> $config_mak
@@ -1414,6 +1385,7 @@
     echo "#define TARGET_PPC64 1" >> $config_h
     echo "#define TARGET_ABI32 1" >> $config_h
     echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
+    requires_gcc3="yes"
   ;;
   sh4|sh4eb)
     echo "TARGET_ARCH=sh4" >> $config_mak
@@ -1422,6 +1394,7 @@
     echo "#define TARGET_SH4 1" >> $config_h
     echo "#define CONFIG_DYNGEN_OP 1" >> $config_h
     bflt="yes"
+    requires_gcc3="yes"
   ;;
   sparc)
     echo "TARGET_ARCH=sparc" >> $config_mak
@@ -1503,6 +1476,44 @@
 
 done # for target in $targets
 
+if test "$requires_gcc3" = "no" ; then
+  check_gcc="no"
+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" $ARCH_CFLAGS -o $TMPE $TMPC 2> /dev/null ; then
+	echo "WARNING: \"$cc\" looks like gcc 4.x"
+	found_compat_cc="no"
+	if test "$gcc3_search" = "yes" ; then
+	    echo "Looking for gcc 3.x"
+	    for compat_cc in $gcc3_list ; do
+		if "$cross_prefix$compat_cc" --version 2> /dev/null | fgrep '(GCC) 3.' > /dev/null 2>&1 ; then
+		    echo "Found \"$compat_cc\""
+		    cc="$cross_prefix$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
+
 # build tree in object directory if source path is different from current one
 if test "$source_path_used" = "yes" ; then
     DIRS="tests tests/cris slirp audio"

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] Check for gcc3 only if compiling dyngen targets
  2008-08-22 17:45 [Qemu-devel] [PATCH] Check for gcc3 only if compiling dyngen targets Hervé Poussineau
@ 2008-08-22 18:01 ` Anthony Liguori
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2008-08-22 18:01 UTC (permalink / raw)
  To: qemu-devel

Hervé Poussineau wrote:
> Hi,
>
> If no configured target needs dyngen, gcc3.x is not required. Currently,
> you have to explicitly pass --disable-gcc-check flag to allow compilation.
>
> Attached patch removes gcc check if no selected target needs dyngen.
> I had to move gcc4 detection later in the configure script
>   

This patch breaks gcc3 autodetection in a subtle way.  You more the 
autodetect down much further after $cc is used to compile a bunch of 
test executables.  gcc3 autodetection may change $cc so all of those 
compile tests are now invalid.

I posted a patch a while ago that did basically the same thing but 
didn't suffer from this problem.  Paul Brook basically Nacked it though 
as it's a lot of ugliness for little short term gain.  Let's wait a bit 
longer and hope that the remaining targets get converted to TCG before 
doing a partial switch to gcc4.

Regards,

Anthony Liguori

> Hervé
>   

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-22 18:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-22 17:45 [Qemu-devel] [PATCH] Check for gcc3 only if compiling dyngen targets Hervé Poussineau
2008-08-22 18:01 ` 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).