[m-rev.] for review: enable default use of MS Visual C runtime

Peter Ross pro at missioncriticalit.com
Wed Mar 24 02:40:43 AEDT 2004


Hi,


===================================================================


Estimated hours taken: 2
Branches: main

Allow at configure time to build the compiler so that it uses the MS
Visual C runtime by default.

This is needed here at MC to build some components which require
linking against the MS Visual C runtime versus the standard C runtime.

configure.in:
	Add the option --enable-msvcrt so that the 

scripts/mgnuc.in:
	If we wish to use the MS Visual C runtime, then we need to
	define GC_NOT_DLL when we are not in a parallel grade, as
	otherwise the header files for boehm_gc decide the collector
	must've been built as a DLL, which isn't true.

scripts/ml.in:
	Pass /MD to the linker so that it links against the MS Visual C
	runtime, if required.

Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.388
diff -u -r1.388 configure.in
--- configure.in	23 Mar 2004 07:18:07 -0000	1.388
+++ configure.in	23 Mar 2004 15:29:40 -0000
@@ -3614,6 +3614,28 @@
 fi
 
 #-----------------------------------------------------------------------------#
+
+AC_ARG_ENABLE(msvcrt,
+[  --enable-msvcrt
+                          use the MS Visual C runtime if using MS C compiler.],
+ac_msvcrt=yes,ac_msvcrt=no)
+
+AC_MSG_CHECKING(whether to use the MS Visual C Runtime)
+if test "$ac_msvcrt" = "yes"; then
+	if test "$ac_microsoft" = "yes"; then
+		AC_MSG_RESULT(yes)
+		USE_MSVCRT=yes
+	else
+		AC_MSG_RESULT(no as not using the MS C compiler)
+		USE_MSVCRT=no
+	fi
+else
+	AC_MSG_RESULT(no)
+	USE_MSVCRT=no
+fi
+AC_SUBST(USE_MSVCRT)
+
+#-----------------------------------------------------------------------------#
 MERCURY_CHECK_READLINE
 #-----------------------------------------------------------------------------#
 
Index: scripts/mgnuc.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/mgnuc.in,v
retrieving revision 1.99
diff -u -r1.99 mgnuc.in
--- scripts/mgnuc.in	20 Oct 2003 07:29:36 -0000	1.99
+++ scripts/mgnuc.in	23 Mar 2004 15:29:41 -0000
@@ -328,6 +328,17 @@
 	false)		THREAD_OPTS="" ;;
 esac
 
+# Set the correct flags if we're to use the MS Visual C runtime.
+use_msvcrt=@USE_MSVCRT@
+if test $use_msvcrt = "yes"; then
+	case $thread_safe in
+		true)	MSVCRT_OPTS="" ;;
+		false)	MSVCRT_OPTS="/DGC_NOT_DLL" ;;
+	esac
+else
+	MSVCRT_OPTS=""
+fi
+
 case $gc_method in
 	accurate)	GC_OPTS="-DMR_NATIVE_GC" ;;
 	boehm)		GC_OPTS="-DMR_CONSERVATIVE_GC -DMR_BOEHM_GC" ;;
@@ -567,7 +578,7 @@
 
 
 ALL_CC_OPTS="$MERC_ALL_C_INCL_DIRS $ANSI_OPTS $CHECK_OPTS $OPT_OPTS \
-		$HLC_OPTS $HLD_OPTS $GCC_OPTS $GC_OPTS $DEFINE_OPTS \
+		$HLC_OPTS $HLD_OPTS $GCC_OPTS $MSVCRT_OPTS $GC_OPTS $DEFINE_OPTS \
 		$STACK_TRACE_OPTS $TRACE_OPTS $DECL_DEBUG_OPTS \
 		$LLDEBUG_OPTS $C_DEBUG_OPTS \
 		$PROF_TIME_OPTS $PROF_CALLS_OPTS $PROF_MEMORY_OPTS \
Index: scripts/ml.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/ml.in,v
retrieving revision 1.107
diff -u -r1.107 ml.in
--- scripts/ml.in	2 Nov 2003 13:38:30 -0000	1.107
+++ scripts/ml.in	23 Mar 2004 15:29:41 -0000
@@ -256,6 +256,14 @@
 	false.*)	THREAD_LIBS="" ;;
 esac
 
+# Set the correct flags if we're to use the MS Visual C runtime.
+use_msvcrt=@USE_MSVCRT@
+if test $use_msvcrt = "yes"; then
+	MSVCRT_OPTS="/MD"
+else
+	MSVCRT_OPTS=""
+fi
+
 case $make_shared_lib in
     true)
 	LINKER="$LINK_SHARED_OBJ"
@@ -365,7 +373,7 @@
     none) demangle=false ;;
 esac
 
-LINKER_PRE_FLAGS="$UNDEF_OPT $STRIP_OPTS $MAYBE_STATIC_OPT $ARCH_OPTS"
+LINKER_PRE_FLAGS="$MSVCRT_OPTS $UNDEF_OPT $STRIP_OPTS $MAYBE_STATIC_OPT $ARCH_OPTS"
 LINKER_POST_FLAGS="@LINK_OPT_SEP@ $DEBUG_FLAG $LIBDIR_OPTS $RPATH_OPT_LIST $LIBS"
 
 case $verbose in


-- 
Peter Ross		
Software Engineer                                (Work)   +32 2 757 10 15
Mission Critical                                 (Mobile) +32 485 482 559
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list