[sr-dev] git:master: makefile: gcc version detection fix

Andrei Pelinescu-Onciul andrei at iptel.org
Fri May 29 16:53:54 CEST 2009


Module: sip-router
Branch: master
Commit: 0f72c774f7835155cd055c45530022febffeb30c
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0f72c774f7835155cd055c45530022febffeb30c

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Fri May 29 16:52:43 2009 +0200

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

---

 Makefile.defs         |    8 ++++++--
 test/gcc_versions.txt |    6 +++++-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/Makefile.defs b/Makefile.defs
index 623c318..9836790 100644
--- a/Makefile.defs
+++ b/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 
diff --git a/test/gcc_versions.txt b/test/gcc_versions.txt
index 801611a..2b8f23c 100644
--- a/test/gcc_versions.txt
+++ b/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]




More information about the sr-dev mailing list