From: Marc Fiuczynski <mef@cs.princeton.edu>
Date: Tue, 11 Apr 2006 14:28:15 +0000 (+0000)
Subject: switch to gcc 3.x based compiler on systems using gcc 4.x by default
X-Git-Tag: before-fedora-2_6_18-1_2239_FC5-vs2_0_2_2-rc6-merge~56
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=587b0afbebca5096506c7fc6798b771ace956ad1;p=linux-2.6.git

switch to gcc 3.x based compiler on systems using gcc 4.x by default
---

diff --git a/scripts/kernel-2.6-planetlab.spec b/scripts/kernel-2.6-planetlab.spec
index 8970050ba..8e0f9af37 100644
--- a/scripts/kernel-2.6-planetlab.spec
+++ b/scripts/kernel-2.6-planetlab.spec
@@ -326,6 +326,25 @@ BuildKernel() {
 
     # and now to start the build process
 
+    gccversion=$(gcc -v 2>&1 | grep "gcc version" | awk '{print $3'} | awk -F . '{print $1}')
+    if [ "$gccversion" == "4" ] ; then
+	echo "Currently not compiling kernel with gcc 4.x"
+	echo "Trying to find a recent gcc 3.x based compiler"
+	CC=
+	gcc3=$(gcc32 -v 2>&1)
+	[ $? -eq 0 ] && CC=gcc32
+	gcc3=$(gcc33 -v 2>&1)
+	[ $? -eq 0 ] && CC=gcc33
+	gcc3=$(gcc34 -v 2>&1)
+	[ $? -eq 0 ] && CC=gcc34
+	if [ -z "$CC" ]; then
+	    echo "Could not find a gcc 3.x based compiler!"
+	    echo "Aborting kernel compilation!"
+	    exit -1
+	fi
+	HOSTCC=${CC}
+    fi
+
     make -s ARCH=$Arch mrproper
     cp configs/$Config .config