]> granicus.if.org Git - nethack/commitdiff
detect the compiler available
authornhmall <nhmall@nethack.org>
Tue, 11 Aug 2020 01:27:05 +0000 (21:27 -0400)
committernhmall <nhmall@nethack.org>
Tue, 11 Aug 2020 01:27:05 +0000 (21:27 -0400)
test if CC invokes clang. If not, then assume it is gcc.

sys/unix/hints/linux.2020

index 99240fd51c8fd8f7db010d00f4bfdbde63f488e8..d13cd9b580b087cad04246b02fdec6f3b4f0f403 100755 (executable)
@@ -76,21 +76,6 @@ endif
 GAMEUID  = $(USER)
 GAMEGRP  = games
 
-# 3. miscellaneous:  compiler selection; Qt5 requires C++11
-ifdef WANT_WIN_QT
-CC=clang
-CXX=clang++ -std=gnu++11
-#CC=gcc
-#CXX=g++ -std=gnu++11
-LINK= $(CXX)
-else
-# compiling C code only; CC and CXX defaults can be used
-#CC=
-#CXX=
-LINK = $(CC)
-endif
-#MOC = moc
-
 #
 # You shouldn't need to change anything below here (in the hints file; if
 # you're reading this in Makefile augmented by hints, that may not be true).
@@ -131,9 +116,27 @@ endif
 endif
 endif
 
-CFLAGS=-g -O -I../include -DNOTPARMDECL
+# compiler detection
 CCISCLANG := $(shell echo `$(CC) --version` | grep clang)
 ifeq "$(CCISCLANG)" ""
+CC=gcc
+CXX=g++ -std=gnu++11
+else
+CC=clang
+CXX=clang++ -std=gnu++11
+endif
+
+ifdef WANT_WIN_QT
+# Qt5 requires C++11
+LINK = $(CXX)
+#MOC = moc
+else
+LINK = $(CC)
+endif
+
+CFLAGS=-g -O -I../include -DNOTPARMDECL
+ifeq "$(CCISCLANG)" ""
+# get the version of gcc
 GCCGTEQ9 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 9)
 ifeq "$(GCCGTEQ9)" "1"
 CFLAGS+=-Wno-format-overflow