[m-rev.] diff: futher MSVC related stuff

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Sep 21 16:10:48 AEST 2011


Branches: main, 11.07

More Visual C related stuff.

compiler/globals.m:
 	Allow the C compiler type string for Visual C to have the form
 	"msvc_<VERSION>" as well as "cl_<VERSION>".  Support for the
 	latter form will eventually be dropped.

configure.in:
 	Avoid pattern matching on the value of CC; it isn't a reliable
 	way of telling what the C compiler is.

 	Use the "-" form of options for MSVC in more places.

scripts/ml.in:
 	Use the "-" form of options for MSVC.

Julien.

Index: configure.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/configure.in,v
retrieving revision 1.591
diff -u -r1.591 configure.in
--- configure.in	15 Sep 2011 16:14:33 -0000	1.591
+++ configure.in	21 Sep 2011 05:55:18 -0000
@@ -3024,12 +3024,11 @@

      *cygwin*)
          THREAD_LIBS=""
-        case "$CC" in
-            *cl* | *CL*)
-                # cl is the Microsoft C compiler
-                CFLAGS_FOR_THREADS="-DMR_THREAD_SAFE -DGC_WIN32_THREADS /MD"
-                LDFLAGS_FOR_THREADS="/MD"
-                LD_LIBFLAGS_FOR_THREADS="/MD"
+        case "$mercury_cv_cc_type" in
+            msvc)
+                CFLAGS_FOR_THREADS="-DMR_THREAD_SAFE -DGC_WIN32_THREADS -MD"
+                LDFLAGS_FOR_THREADS="-MD"
+                LD_LIBFLAGS_FOR_THREADS="-MD"
                  ;;
              *)
                  CFLAGS_FOR_THREADS="$WIN32_GC_THREADLIB -DMR_THREAD_SAFE" ;;
@@ -3038,12 +3037,11 @@

      *mingw*)
          THREAD_LIBS=""
-        case "$CC" in
-            *cl* | *CL*)
-                # cl is the Microsoft C compiler
-                CFLAGS_FOR_THREADS="-DMR_THREAD_SAFE -DGC_WIN32_THREADS /MD"
-                LDFLAGS_FOR_THREADS="/MD"
-                LD_LIBFLAGS_FOR_THREADS="/MD"
+        case "$mercury_cv_cc_type" in
+            msvc)
+                CFLAGS_FOR_THREADS="-DMR_THREAD_SAFE -DGC_WIN32_THREADS -MD"
+                LDFLAGS_FOR_THREADS="-MD"
+                LD_LIBFLAGS_FOR_THREADS="-MD"
                  ;;
              *)
                  # By default the MinGW port of GCC targets the i386
Index: compiler/globals.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/globals.m,v
retrieving revision 1.103
diff -u -r1.103 globals.m
--- compiler/globals.m	13 Jul 2011 06:49:21 -0000	1.103
+++ compiler/globals.m	21 Sep 2011 05:55:18 -0000
@@ -386,6 +386,10 @@
          convert_c_compiler_type_with_version(CC_Str, C_CompilerType)
      ).

+% NOTE: we currently accept strings of the form cl_<version> or 
+% msvc_<version> for Visual C; support for the former is deprecated and
+% will be dropped once the configure script begins generated the latter.
+
  :- pred convert_c_compiler_type_simple(string::in, c_compiler_type::out)
      is semidet.

@@ -393,6 +397,7 @@
  convert_c_compiler_type_simple("clang",    cc_clang(no)).
  convert_c_compiler_type_simple("lcc",      cc_lcc).
  convert_c_compiler_type_simple("cl",       cc_cl(no)).
+convert_c_compiler_type_simple("msvc",     cc_cl(no)).
  convert_c_compiler_type_simple("unknown",  cc_unknown).

  :- pred convert_c_compiler_type_with_version(string::in, c_compiler_type::out)
@@ -407,8 +412,10 @@
          convert_clang_version(Major, Minor, Patch, C_CompilerType)
      ; Tokens = ["cl", Version] ->
          convert_msvc_version(Version, C_CompilerType)
+    ; Tokens = ["msvc", Version] ->
+        convert_msvc_version(Version, C_CompilerType)
      ;
-         false
+        false
      ).

      % Create the value of C compiler type when we have (some) version
Index: scripts/ml.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/ml.in,v
retrieving revision 1.125
diff -u -r1.125 ml.in
--- scripts/ml.in	9 Sep 2011 19:29:44 -0000	1.125
+++ scripts/ml.in	21 Sep 2011 05:55:20 -0000
@@ -375,8 +375,8 @@
  use_msvcrt=@USE_MSVCRT@
  if test $use_msvcrt = "yes"
  then
-	MSVCRT_OPTS="/MD" 			# Enable linking with the MS Visual C runtime.
-	NODEFAULTLIB_FLAG="/nodefaultlib:libc"
+	MSVCRT_OPTS="-MD" 			# Enable linking with the MS Visual C runtime.
+	NODEFAULTLIB_FLAG="-nodefaultlib:libc"
  else
  	MSVCRT_OPTS=""
  	NODEFAULTLIB_FLAG=""
@@ -492,7 +492,7 @@
  esac

  RPATH_OPT_LIST=
-# only set RPATH_OPT_LIST if the system supports shared libraries
+# Only set RPATH_OPT_LIST if the system supports shared libraries.
  case $EXT_FOR_SHARED_LIB in
  	so)
  		prev=""

--------------------------------------------------------------------------
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