Bug 1026469 - Skip compiler checks when using MSVC, even when $CC is not literally "cl". r=ted NSPR_4_10_7_BETA1
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 18 Jun 2014 15:07:56 +0900
changeset 4576 e40f25162a68108cea5acdf4709d9f7ca7c5414c
parent 4575 1d7d0bdaf77dff9b245e4783ea85ef69872a8ae6
child 4577 077c7d42c2814bb2d154c7d593916014f98558d0
push id120
push usertmielczarek@mozilla.com
push dateFri, 20 Jun 2014 11:33:28 +0000
reviewersted
bugs1026469
Bug 1026469 - Skip compiler checks when using MSVC, even when $CC is not literally "cl". r=ted
configure
configure.in
--- a/configure
+++ b/configure
@@ -2571,28 +2571,29 @@ else
   { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
 $as_echo "no" >&6; }
 fi
 
 
   test -n "$CC" && break
 done
 
-    if test "$CC" = "cl"; then
-        echo 'main() { return 0; }' > dummy.c
-        ${CC} -o dummy dummy.c >/dev/null 2>&1
-        if test $? = 0; then
-            _WIN32_MSVC=1
-            CXX=$CC
-        else
-            { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $(CC) test failed.  Using normal feature tests" >&5
-$as_echo "$as_me: WARNING: $(CC) test failed.  Using normal feature tests" >&2;}
-        fi
-        rm -f dummy dummy.o dummy.obj dummy.exe dummy.c
-    fi
+    cat > conftest.c <<EOF
+#ifdef _MSC_VER
+COMPILER IS MSVC
+#endif
+EOF
+    read dummy <<EOF
+$($CC -E conftest.c 2>/dev/null | grep COMPILER)
+EOF
+    if test -n "$dummy"; then
+        _WIN32_MSVC=1
+        CXX=$CC
+    fi
+    rm -f conftest.c
     ;;
 *-mks*)
     _WIN32_MSVC=1
     ;;
 esac
 
 if test -n "$_WIN32_MSVC"; then
     SKIP_PATH_CHECKS=1
--- a/configure.in
+++ b/configure.in
@@ -67,27 +67,29 @@ DLLFLAGS="${DLLFLAGS=}"
 HOST_CFLAGS="${HOST_CFLAGS=}"
 HOST_LDFLAGS="${HOST_LDFLAGS=}"
 
 case "$target" in
 *-cygwin*|*-mingw*|*-msys*)
     # Check to see if we are really running in a msvc environemnt
     _WIN32_MSVC=
     AC_CHECK_PROGS(CC, cl)
-    if test "$CC" = "cl"; then
-        echo 'main() { return 0; }' > dummy.c
-        ${CC} -o dummy dummy.c >/dev/null 2>&1
-        if test $? = 0; then
-            _WIN32_MSVC=1
-            CXX=$CC
-        else
-            AC_MSG_WARN([$(CC) test failed.  Using normal feature tests])
-        fi
-        rm -f dummy dummy.o dummy.obj dummy.exe dummy.c
+    cat > conftest.c <<EOF
+#ifdef _MSC_VER
+COMPILER IS MSVC
+#endif
+EOF
+    read dummy <<EOF
+$($CC -E conftest.c 2>/dev/null | grep COMPILER)
+EOF
+    if test -n "$dummy"; then
+        _WIN32_MSVC=1
+        CXX=$CC
     fi
+    rm -f conftest.c
     ;;
 *-mks*)
     _WIN32_MSVC=1
     ;;
 esac
 
 if test -n "$_WIN32_MSVC"; then
     SKIP_PATH_CHECKS=1