]> arthur.barton.de Git - ngircd-alex.git/blobdiff - contrib/platformtest.sh
platformtest.sh: Detect tcc compiler
[ngircd-alex.git] / contrib / platformtest.sh
index cfa1eccc81ea1a6387f936739d614543bdf379c4..6b154bbb826c3b71206c41a471814fadf552109b 100755 (executable)
@@ -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
@@ -54,6 +54,16 @@ if [ $? -ne 0 ]; then
        cd ..
 fi
 
+echo "$NAME: Checking for GIT tree ..."
+if [ -d .git ]; then
+       echo "$NAME: Checking for \"git\" command ..."
+       git version >/dev/null 2>&1
+       if [ $? -eq 0 ]; then
+               echo "$NAME: Running \"git clean\" ..."
+               [ -n "$VERBOSE" ] && git clean -dxf || git clean -dxf >/dev/null
+       fi
+fi
+
 echo "$NAME: Checking for \"./configure\" script ..."
 if [ ! -e ./configure ]; then
        echo "$NAME: Running \"./autogen.sh\" ..."
@@ -99,6 +109,7 @@ if [ -r "Makefile" ]; then
        CC=$(grep "^CC = " Makefile | cut -d' ' -f3)
        $CC --version 2>&1 | grep -i "GCC" >/dev/null
        if [ $? -eq 0 ]; then
+               # GCC, or compiler that mimics GCC
                $CC --version 2>&1 | grep -i "Open64" >/dev/null
                if [ $? -eq 0 ]; then
                        COMPILER="Open64"
@@ -108,12 +119,23 @@ if [ -r "Makefile" ]; then
                        COMPILER="gcc $COMPILER"
                fi
        else
-               case "$CC" in
-                 gcc*)
+               # Non-GCC compiler
+               $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
+               $CC -version 2>&1 | grep -i "tcc" >/dev/null
+               if [ $? -eq 0 ]; then
+                       COMPILER=$($CC -version 2>/dev/null | head -1 \
+                         | cut -d'(' -f1 | sed -e 's/version //g')
+               fi
+               if [ "$COMPILER" = "unknown" ]; then
                        v="`$CC --version 2>/dev/null | head -1`"
-                       [ -n "$v" ] && COMPILER="gcc $v"
-                       ;;
-               esac
+                       [ -z "$v" ] && v="`$CC -version 2>/dev/null | head -1`"
+                       [ -n "$v" ] && COMPILER="$v"
+               fi
        fi
 fi