Forráskód Böngészése

makefile: gcc version detection fix

The gcc version detection got confused by spaces within (),
resulting in a compilation error on SUSE gcc 4.3.2.

Reported-by: Edson 4lists at gmail dot com
Andrei Pelinescu-Onciul 16 éve
szülő
commit
0f72c774f7
2 módosított fájl, 11 hozzáadás és 3 törlés
  1. 6 2
      Makefile.defs
  2. 5 1
      test/gcc_versions.txt

+ 6 - 2
Makefile.defs

@@ -284,9 +284,13 @@ MKTAGS=ctags -R .
 
 ifneq (,$(findstring gcc, $(CC_LONGVER)))
 	CC_NAME=gcc
-	CC_VER:=$(word 1,$(CC)) $(shell $(CC) - --version|head -n 1|cut -d" " -f 3\
-				|sed -e 's/^.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'\
+	CC_VER:=$(word 1,$(CC)) $(shell $(CC) - --version|head -n 1|\
+				|sed -e 's/([^)]*)//g' \
+					 -e 's/^.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'\
 				 	 -e 's/^[^0-9].*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/')
+#	CC_VER:=$(word 1,$(CC)) $(shell $(CC) - --version|head -n 1|cut -d" " -f 3\
+#				|sed -e 's/^.*\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/'\
+#				 	 -e 's/^[^0-9].*\([0-9][0-9]*\.[0-9][0-9]*\).*/\1/')
 	# sed with POSIX.1 regex doesn't support |, + or ? 
         # (darwin, solaris ...) => this complicated expression
 	MKDEP=$(CC) -MM 

+ 5 - 1
test/gcc_versions.txt

@@ -17,5 +17,9 @@ gcc-3.4 (GCC) 3.4.4 20041218 (prerelease) (Debian 3.4.3-7)
 powerpc-apple-darwin8-gcc-3.5.0 (GCC) 3.5.0 20041026 (Apple Computer, Inc. build 4059)
 powerpc-apple-darwin8-gcc-4.0.0 (GCC) 4.0.0 20041026 (Apple Computer, Inc. build 4061)
 gcc-4.0 (GCC) 4.0.2 20050821 (prerelease) (Debian 4.0.1-6)
+gcc-4.0 (GCC) 4.0.4 20060904 (prerelease) (Debian 4.0.3-7)
 gcc-4.0.1 (GCC) 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)
-
+gcc-4.1 (GCC) 4.1.3 20080704 (prerelease) (Debian 4.1.2-25)
+gcc-4.2 (GCC) 4.2.4 (Debian 4.2.4-6)
+gcc-4.3 (Debian 4.3.3-8) 4.3.3
+gcc (SUSE Linux) 4.3.2 [gcc-4_3-branch revision 141291]