Author: mturk
Date: Wed Jul 29 20:11:25 2009
New Revision: 799046

URL: http://svn.apache.org/viewvc?rev=799046&view=rev
Log:
Better VC version detection

Modified:
    commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
    commons/sandbox/runtime/trunk/src/main/native/configure

Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in?rev=799046&r1=799045&r2=799046&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in Wed Jul 29 
20:11:25 2009
@@ -30,9 +30,9 @@
 o...@obj@
 e...@exe@
 a...@as@
-...@ar@
-arfla...@arflags@
-ranl...@ranlib@
+l...@ar@
+libfla...@arflags@
+li...@link@
 pref...@prefix@
 libd...@libdir@
 topd...@topdir@
@@ -124,7 +124,7 @@
 
 $(SHAREDLIB): $(COMMON_OBJS) $(@platf...@_objs) @testobjs@
        $(RC) /l 0x409 /d "NDEBUG" /i "$(SRCDIR)\include" /fo [email protected] 
$(SRCDIR)/os/win32/main.rc
-       $(RANLIB) $(SHFLAGS) $(LDFLAGS) /DLL /SUBSYSTEM:WINDOWS 
/pdb:$(LIBNAME).pdb /out:$@ @<<
+       $(LINK) $(SHFLAGS) $(LDFLAGS) /DLL /SUBSYSTEM:WINDOWS 
/pdb:$(LIBNAME).pdb /out:$@ @<<
        $(COMMON_OBJS) $(WINDOWS_OBJS) @testobjs@ [email protected]
 <<
        IF EXIST [email protected] \
@@ -133,7 +133,7 @@
 
 $(SSLMODLIB): $(SHAREDLIB) $(OPENSSL_OBJS)
        $(RC) /l 0x409 /d "NDEBUG" /d SRC_INTNAME="$(SSLNAME)" /d 
STR_PRODUCT="Apache Commons Runtime SSL Module" /d STR_INTNAME="$(SSLNAME)" /i 
"$(SRCDIR)\include" /fo [email protected] $(SRCDIR)/os/win32/main.rc
-       $(RANLIB) $(SHFLAGS) $(LDFLAGS) $(SSLFLAGS) /DLL /SUBSYSTEM:WINDOWS 
libpath:"." $(LIBNAME).lib /pdb:$(SSLNAME).pdb /out:$@ @<<
+       $(LINK) $(SHFLAGS) $(LDFLAGS) $(SSLFLAGS) /DLL /SUBSYSTEM:WINDOWS 
libpath:"." $(LIBNAME).lib /pdb:$(SSLNAME).pdb /out:$@ @<<
        $(OPENSSL_OBJS) [email protected]
 <<
        IF EXIST $(SSLMODLIB).manifest \

Modified: commons/sandbox/runtime/trunk/src/main/native/configure
URL: 
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/configure?rev=799046&r1=799045&r2=799046&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/configure (original)
+++ commons/sandbox/runtime/trunk/src/main/native/configure Wed Jul 29 20:11:25 
2009
@@ -57,6 +57,7 @@
 cc="${CC:=gcc}"
 cxx="${CXX:=g++}"
 ar="${AR:=ar}"
+link=""
 as="${AS:=gcc}"
 arflags="${ARFLAGS:=ru}"
 ranlib="${RANLIB:=ranlib}"
@@ -99,6 +100,7 @@
 makefiles="Makefile"
 cc_ver_major=0
 cc_ver_minor=0
+test=ctest$$
 
 for o
 do
@@ -450,6 +452,7 @@
         varadds ldflags shell32.lib rpcrt4.lib user32.lib gdi32.lib userenv.lib
         varadds ldflags psapi.lib shlwapi.lib wldap32.lib netapi32.lib 
iphlpapi.lib
         varadds shflags /NOLOGO /OPT:REF
+        arflags=/NOLOGO
         is_unix=false
         so=.dll
         exe=.exe
@@ -457,7 +460,8 @@
         makefiles=Makefile.msc
         cxx="$cc"
         cccinc=windows
-        ranlib="`getmstool link`"
+        link="`getmstool link`"
+        ar="`getmstool lib`"
         test ".$java_pinc" = . && java_pinc=win32
         ;;
     *       )
@@ -476,9 +480,11 @@
         fi
     ;;
     windows-cl )
-        v=`cl /? 2>&1 | head -1 | sed 's/.*Version \([0-9]*.[0-9]*\).*/\1/'`
-        cc_ver_major=`echo $v | sed 's/^\([0-9]*\).*/\1/'`
-        cc_ver_minor=`echo $v | sed 's/^[0-9]*.\([0-9]*\).*/\1/'`
+        echo _MSC_VER > $test.h
+        v=`cl -nologo -EP $test.h 2>/dev/null | tail -1`
+        rm $test.h
+        cc_ver_major=`echo $v | sed 's/[0-9]0-9]$//'`
+        cc_ver_minor=`echo $v | sed 's/^[0-9]0-9]//'`
         if [ ".$has_maintainer_mode" != .yes ]; then
             if [ ${cc_ver_major}0 -gt 130 ]; then
                 # Visual Studio 2005 and later
@@ -496,6 +502,7 @@
     windows-cl   )
         varadds ccflags -D_X86_=1
         varadds shflags /MACHINE:X86
+        varadds arflags /MACHINE:X86
         as=ml.exe
         ;;
     windows64-cl )
@@ -503,9 +510,11 @@
         if [ ".$mach" = .ia64 ]; then
             varadds ccflags -D_IA64_=1
             varadds shflags /MACHINE:IA64
+            varadds arflags /MACHINE:IA64
         else
             varadds ccflags -D_AMD64_=1
             varadds shflags /MACHINE:AMD64
+            varadds arflags /MACHINE:AMD64
         fi
         as=ml64.exe
         ;;
@@ -547,8 +556,6 @@
     fi
 fi
 
-test=ctest$$
-
 if [ ".$has_dso_test" = .yes ]; then
     cat > $test.c << EOF
 extern int getchar();
@@ -692,7 +699,7 @@
     echo $rc
 }
 
-test_csizeof()
+check_sizeof()
 {
     printf "Checking for sizeof %-25s" "$1" 1>&2
     cat > $test.c << EOF
@@ -712,13 +719,13 @@
     echo $rc
 }
 
-sizeof_int=`test_csizeof int`
+sizeof_int=`check_sizeof int`
 if [ ".$sizeof_int" = .0 ]; then
     echo "[ERROR] Cannot determine the size of int." 1>&2
     exit 1
 fi
 
-sizeof_wchar=`test_csizeof wchar_t`
+sizeof_wchar=`check_sizeof wchar_t`
 if [ ".$sizeof_wchar" = .0 ]; then
     echo "[ERROR] Cannot determine the size of wchar_t." 1>&2
     exit 1
@@ -726,10 +733,10 @@
 
 have_long_long=1
 have_long_double=1
-sizeof_long_long=`test_csizeof 'long long'`
+sizeof_long_long=`check_sizeof 'long long'`
 test ".$sizeof_long_long" = .0 && have_long_long=0
 
-sizeof_long_double=`test_csizeof 'long double'`
+sizeof_long_double=`check_sizeof 'long double'`
 test ".$sizeof_long_double" = .0 && have_long_double=0
 
 if [ ".$host" = .windows ]; then
@@ -744,7 +751,7 @@
     have_fileextd=0
     have_ktmw32=0
     have_off64t=1
-    sizeof_off64t=`test_csizeof off64_t`
+    sizeof_off64t=`check_sizeof off64_t`
     test ".$sizeof_off64t" = .0 && have_off64t=0
     have_aio=`have_include aio`
     have_libaio=`have_include libaio`
@@ -877,11 +884,11 @@
 
 #define CC_SIZEOF_INT         $sizeof_int
 #define CC_SIZEOF_WCHAR_T     $sizeof_wchar
-#define CC_SIZEOF_LONG        `test_csizeof long`
+#define CC_SIZEOF_LONG        `check_sizeof long`
 #define CC_SIZEOF_LONG_LONG   $sizeof_long_long
 #define CC_SIZEOF_LONG_DOUBLE $sizeof_long_double
-#define CC_SIZEOF_VOIDP       `test_csizeof 'void *'`
-#define CC_SIZEOF_SIZE_T      `test_csizeof size_t`
+#define CC_SIZEOF_VOIDP       `check_sizeof 'void *'`
+#define CC_SIZEOF_SIZE_T      `check_sizeof size_t`
 #define CC_SIZEOF_OFF64_T     $sizeof_off64t
 #define CC_IS_BIG_ENDIAN      $bige
 
@@ -918,6 +925,7 @@
     -e 's|@obj@|'"$obj"'|g' \
     -e 's|@exe@|'"$exe"'|g' \
     -e 's|@ar@|'"$ar"'|g' \
+    -e 's|@link@|'"$link"'|g' \
     -e 's|@host@|'"$host"'|g' \
     -e 's|@mach@|'"$mach"'|g' \
     -e 's|@bits@|'"$bits"'|g' \


Reply via email to