switch to gcc 3.x based compiler on systems using gcc 4.x by default
authorMarc Fiuczynski <mef@cs.princeton.edu>
Tue, 11 Apr 2006 14:28:15 +0000 (14:28 +0000)
committerMarc Fiuczynski <mef@cs.princeton.edu>
Tue, 11 Apr 2006 14:28:15 +0000 (14:28 +0000)
scripts/kernel-2.6-planetlab.spec

index 8970050..8e0f9af 100644 (file)
@@ -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