]> arthur.barton.de Git - ngircd-alex.git/blobdiff - contrib/platformtest.sh
Move "ClientHost" and "ClientUserNick" to end of [Global] section
[ngircd-alex.git] / contrib / platformtest.sh
index 0a518b8a7df0ad70d6eea687822c56cb3c7df2fa..85d3a1d7ebb32e95fa8cf49c8d1139a787f1fb7b 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 #
 # ngIRCd -- The Next Generation IRC Daemon
-# Copyright (c)2001-2009 Alexander Barton <alex@barton.de>
+# Copyright (c)2001-2010 Alexander Barton <alex@barton.de>
 #
 # 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
@@ -51,16 +51,16 @@ if [ $? -ne 0 ]; then
        cd ..
 fi
 
-echo "$NAME: Checking for ./configure script ..."
-if [ ! -e ./configure ]; then
-       echo "$NAME: Not found. Running ./autogen.sh ..."
+echo "$NAME: Checking for \"./autogen.sh\" script ..."
+if [ -r ./autogen.sh ]; then
+       echo "$NAME: Running \"./autogen.sh\" ..."
        [ -n "$VERBOSE" ] && ./autogen.sh || ./autogen.sh >/dev/null
 fi
 
-if [ -e ./configure ]; then
+if [ -r ./configure ]; then
        echo "$NAME: Running \"./configure\" script ..."
        [ -n "$VERBOSE" ] && ./configure || ./configure >/dev/null
-       if [ $? -eq 0 -a -e ./Makefile ]; then
+       if [ $? -eq 0 -a -r ./Makefile ]; then
                CONFIGURE=1
                echo "$NAME: Running \"make\" ..."
                [ -n "$VERBOSE" ] && make || make >/dev/null
@@ -93,22 +93,29 @@ fi
 
 # Get compiler information
 if [ -r "Makefile" ]; then
-       eval $(grep "^CC = " Makefile | sed -e 's/ //g')
+       CC=$(grep "^CC = " Makefile | cut -d' ' -f3)
        $CC --version 2>&1 | grep -i "GCC" >/dev/null
        if [ $? -eq 0 ]; then
-               COMPILER=$($CC --version | head -1 | awk "{ print \$3 }" \
+               COMPILER=$($CC --version | head -1 | awk "{ print \$3 }" \
                 | cut -d'-' -f1)
                COMPILER="gcc $COMPILER"
+       else
+               case "$CC" in
+                 gcc*)
+                       v="`$CC --version 2>/dev/null | head -1`"
+                       [ -n "$v" ] && COMPILER="gcc $v"
+                       ;;
+               esac
        fi
 fi
 
 # Get ngIRCd version information
-if [ -d ".git" ]; then
-       VERSION=`git log --abbrev-commit --pretty=oneline HEAD~1.. \
-        | head -1 | cut -d' ' -f1 | tr -d '.'`
-elif [ -r "Makefile" ]; then
-       eval $(grep "^VERSION = " Makefile | sed -e 's/ //g')
-fi
+eval $(grep "^VERSION = " Makefile | sed -e 's/ //g')
+case "$VERSION" in
+       *-*-*)
+               VERSION=`echo "$VERSION" | cut -d'-' -f3 | cut -b2-`
+               ;;
+esac
 [ -n "$VERSION" ] || VERSION="unknown"
 
 # Get IO interface information
@@ -137,7 +144,13 @@ echo "                                                ./configure works --+ | |
 echo "                                                                    | | | |"
 echo "Platform                    Compiler     ngIRCd     Date     Tester C M T R See"
 echo "--------------------------- ------------ ---------- -------- ------ - - - - ---"
-printf "%-27s %-12s %-10s %s %-6s %s %s %s %s%s" \
- "$PLATFORM" "$COMPILER" "$VERSION" "$DATE" "$USER" \
- "$C" "$M" "$T" "$R" "$COMMENT"
+type printf >/dev/null 2>&1
+if [ $? -eq 0 ]; then
+       printf "%-27s %-12s %-10s %s %-6s %s %s %s %s%s" \
+        "$PLATFORM" "$COMPILER" "$VERSION" "$DATE" "$USER" \
+        "$C" "$M" "$T" "$R" "$COMMENT"
+else
+       echo "$PLATFORM $COMPILER $VERSION $DATE $USER" \
+        "$C" "$M" "$T" "$R" "$COMMENT"
+fi
 echo; echo