[m-rev.] diff: avoid extra output from MSVC in configure

Julien Fischer juliensf at csse.unimelb.edu.au
Mon Oct 31 16:05:15 AEDT 2011


Branches: 11.07, main

acinclude.m4:
 	Avoid extraneous output from MSVC in the MERCURY_CC_TYPE macro.

Julien.

Index: acinclude.m4
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/acinclude.m4,v
retrieving revision 1.1
diff -u -r1.1 acinclude.m4
--- acinclude.m4	13 Oct 2011 02:42:19 -0000	1.1
+++ acinclude.m4	31 Oct 2011 05:01:57 -0000
@@ -533,6 +533,19 @@
  AC_REQUIRE([AC_PROG_CC])
  AC_MSG_CHECKING([what the C compiler type really is])

+# MSVC uses different command line options to most other C compilers.
+# Try to determine whether CC is MSVC based on the usage message.
+#
+$CC 2>&1 | grep -q "^Microsoft"
+if test $? -eq 0
+then
+    cc_out_opt="-Fe"
+    nologo_opt="-nologo"
+else
+    cc_out_opt="-o "
+    nologo_opt=
+fi
+
  cat > conftest.c << EOF

  #include <stdio.h>
@@ -553,9 +566,11 @@
  }
  EOF

-echo "$CC -o conftest conftest.c" >&AC_FD_CC 2>&1
+echo "$CC $nologo_opt ${cc_out_opt}conftest conftest.c" >&AC_FD_CC 2>&1
  if
-    $CC -o conftest conftest.c
+    # We direct the output to /dev/null because it's appears to be the
+    # only way to shut some C compilers up.
+    $CC $nologo_opt ${cc_out_opt}conftest conftest.c 2>&1 > /dev/null
  then
      mercury_cv_cc_type=`./conftest`
  else

--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list