stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject svn commit: r518779 - /incubator/stdcxx/trunk/etc/config/xlC_version.sh
Date Thu, 15 Mar 2007 22:18:23 GMT
Author: sebor
Date: Thu Mar 15 15:18:21 2007
New Revision: 518779

URL: http://svn.apache.org/viewvc?view=rev&rev=518779
Log:
2007-03-15  Martin Sebor  <sebor@roguewave.com>

	STDCXX-97
	* xlC_version.sh: Corrected output for XLC/C++ 6.0, 7.0 (including
	patches), and 8.0.

Modified:
    incubator/stdcxx/trunk/etc/config/xlC_version.sh

Modified: incubator/stdcxx/trunk/etc/config/xlC_version.sh
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/xlC_version.sh?view=diff&rev=518779&r1=518778&r2=518779
==============================================================================
--- incubator/stdcxx/trunk/etc/config/xlC_version.sh (original)
+++ incubator/stdcxx/trunk/etc/config/xlC_version.sh Thu Mar 15 15:18:21 2007
@@ -10,26 +10,56 @@
     CXX=xlC
 fi
 
-tmpsrc=/tmp/$CXX_version.$$.cpp
-tmpobj=/tmp/$CXX_version.$$.o
 
-echo "#pragma comment(compiler)" > $tmpsrc
-echo "int main() { }" >> $tmpsrc
+xlcout=/tmp/$CXX_version.$$.out
 
-$CXX -c $tmpsrc -o $tmpobj
-status=$?
+$CXX -qversion >$xlcout 2>&1
 
-if [ $status -eq 0 ]; then
-    version=`strings $tmpobj \
-             | sed -n 's/.*Version \([^ ]*\) *.*/\1/p' \
-             | tail -1`
+if [ $? -eq 0 ]; then
+    # VisualAge 7.0, 2005/8/31 or later
+    version=`grep "Version:" $xlcout \
+             | awk '{ if ($1 == "Version:") print $2; \
+                      else if ($4 == "Version") print $5; \
+                      else print $7; }'`
+    rm $xlcout
+
+    # collapse consecutive leading zeros
+    echo $version | awk 'BEGIN { FS="." }{ print (0 + $1) "." (0 + $2) "." (0 + $3) "." (0
+ $4) }'
+    exit
 fi
 
-rm -f $tmpsrc $tmpobj 2>/dev/null
+grep "V7" $xlcout > /dev/null 2>&1
 
-if [ "$version" = "" ]; then
-    version=`$CXX -qversion \
-             | awk '{ if ($4 == "Version") print $5; else print $7; }'`
+if [ $? -eq 0 ]; then
+
+    # VisualAge 7.0 (unpatched)
+    tmpsrc=/tmp/$CXX_version.$$.cpp
+    tmpobj=/tmp/$CXX_version.$$.o
+
+    echo "#pragma comment(compiler)" > $tmpsrc
+    echo "int main() { }" >> $tmpsrc
+
+    $CXX -c $tmpsrc -o $tmpobj
+    status=$?
+
+    if [ $status -eq 0 ]; then
+        version=`strings $tmpobj \
+                 | sed -n 's/.*Version \([^ ]*\) *.*/\1/p' \
+                 | tail -1`
+    fi
+
+    rm -f $tmpsrc $tmpobj $xlcout 2>/dev/null
+
+    if [ "$version" = "" ]; then
+        version=`$CXX -qversion \
+                 | awk '{ if ($4 == "Version") print $5; else print $7; }'`
+    fi
+
+    echo $version | sed "s/[^0-9]*\([0-9].*\)/\1/"
+    exit
 fi
 
-echo $version | sed "s/[^0-9]*\([0-9].*\)/\1/"
+# VisualAge 6.0 (and prior?)
+echo >> $xlcout
+sed "s/.*version \(.*\)/\1/" $xlcout
+rm $xlcout



Mime
View raw message