about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2013-10-14 23:45:59 +0200
committerAlexander Barton <alex@barton.de>2013-10-14 23:45:59 +0200
commit0bd3fb88b2c2a433a68c82c3eaba2fd13b8fcd0b (patch)
tree659298b0ee7c16d67d54aa5385035284bcfc8a7a
parentc34b91d8ddd23c0f04da949b4f3b592ed081c729 (diff)
downloadngircd-0bd3fb88b2c2a433a68c82c3eaba2fd13b8fcd0b.tar.gz
ngircd-0bd3fb88b2c2a433a68c82c3eaba2fd13b8fcd0b.zip
platformtest.sh: Detect Apple LLVM (clang) compiler
-rwxr-xr-xcontrib/platformtest.sh16
1 files changed, 10 insertions, 6 deletions
diff --git a/contrib/platformtest.sh b/contrib/platformtest.sh
index cfa1eccc..765fb396 100755
--- a/contrib/platformtest.sh
+++ b/contrib/platformtest.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors
+# Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -108,12 +108,16 @@ if [ -r "Makefile" ]; then
 			COMPILER="gcc $COMPILER"
 		fi
 	else
-		case "$CC" in
-		  gcc*)
+		$CC --version 2>&1 | grep -i "LLVM" >/dev/null
+		if [ $? -eq 0 ]; then
+			COMPILER=$($CC --version 2>/dev/null | head -1 \
+			  | cut -d'(' -f1 | sed -e 's/version //g' \
+			  | sed -e 's/Apple /A-/g')
+		fi
+		if [ "$COMPILER" = "unknown" ]; then
 			v="`$CC --version 2>/dev/null | head -1`"
-			[ -n "$v" ] && COMPILER="gcc $v"
-			;;
-		esac
+			[ -n "$v" ] && COMPILER="$v"
+		fi
 	fi
 fi