[m-rev.] diff: fix bug #255: don't confuse Chicken Scheme with MS C#

Julien Fischer juliensf at csse.unimelb.edu.au
Tue Jun 19 22:45:16 AEST 2012


Branches: main, 11.07

Fix the rest of #255: the executable name of the the MS C# compiler clashes
with that of the Chicken Scheme compiler.  This was leading to configure
incorrectly assuming the presence of the former when the latter was present.

The remainder of bug #255 relates to the configure script not building on
Mac OS X 10.4 -- I suspect the version of autoconf shipped with that system
is too ancient; I don't intend to do anything about it.  (This only applies
to generating the configure script.  The script itself, as provided in the
source distribution, should still run.)

m4/mercury.m4:
 	Do not assume that the presence of an executable named csc indicates
 	the presence of the MS C# compiler.  If csc is not the MS C# compiler,
 	then attempt to use one of the others.

 	Quote autoconf macro arguments in the Mercury's .NET configuration
 	tests as recommended by the autoconf mnaual.

Julien.

Index: m4/mercury.m4
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/m4/mercury.m4,v
retrieving revision 1.6
diff -u -r1.6 mercury.m4
--- m4/mercury.m4	27 Mar 2012 05:16:49 -0000	1.6
+++ m4/mercury.m4	19 Jun 2012 12:33:06 -0000
@@ -228,11 +228,11 @@
  #
  AC_DEFUN([MERCURY_CHECK_DOTNET],
  [
-AC_PATH_PROG(ILASM, ilasm)
-AC_PATH_PROG(GACUTIL, gacutil)
+AC_PATH_PROG([ILASM], [ilasm])
+AC_PATH_PROG([GACUTIL], [gacutil])

-AC_MSG_CHECKING(for Microsoft.NET Framework SDK)
-AC_CACHE_VAL(mercury_cv_microsoft_dotnet, [
+AC_MSG_CHECKING([for Microsoft.NET Framework SDK])
+AC_CACHE_VAL([mercury_cv_microsoft_dotnet], [
  if test "$ILASM" != ""; then
  	changequote(<<,>>)
  	MS_DOTNET_SDK_DIR=`expr "$ILASM" : '\(.*\)[/\\]*[bB]in[/\\]*ilasm'`
@@ -243,37 +243,60 @@
  	mercury_cv_microsoft_dotnet="no"
  fi
  ])
-AC_MSG_RESULT($mercury_cv_microsoft_dotnet)
+AC_MSG_RESULT([$mercury_cv_microsoft_dotnet])
  ILASM=`basename "$ILASM"`
  GACUTIL=`basename "$GACUTIL"`

  # Check for the C# (C sharp) compiler.
  # gmcs is the Mono C# compiler targeting the 2.0 runtime (with generics).
  # cscc is the DotGNU C# compiler.
-AC_PATH_PROGS(CSC, csc gmcs cscc)
-CSC=`basename "$CSC"`
+AC_PATH_PROGS([CANDIDATE_CSC], [csc gmcs cscc])
+CANDIDATE_CSC=`basename "$CANDIDATE_CSC"`

-case "$CSC" in
-	csc*)
-		CSHARP_COMPILER_TYPE=microsoft
-	;;
-
-	gmcs*)
-		CSHARP_COMPILER_TYPE=mono
-	;;
-
-	*)
-		CSHARP_COMPILER_TYPE=unknown
-	;;
+# The Microsoft C# compiler and the Chicken Scheme compiler share the same
+# executable name so if we find an executable named csc above check that it is
+# actually the Microsoft C# compiler and if it is not then try to use one of
+# the other instead.
+#
+case "$CANDIDATE_CSC" in
+ 
+     csc*)
+        $CANDIDATE_CSC 2>&1 | grep -q "^Microsoft"
+        if test $? -ne 0
+        then
+            AC_MSG_WARN([$CANDIDATE_CSC is not the Microsoft C sharp compiler])
+            AC_PATH_PROGS([CSC], [gmcs cscc])
+            CSC=`basename "$CSC"`
+        else
+            CSC="$CANDIDATE_CSC"
+        fi
+    ;;
+
+    *)
+       CSC="$CANDIDATE_CSC"
+    ;;
  esac

+case "$CSC" in
+    csc*)
+        CSHARP_COMPILER_TYPE=microsoft
+    ;;
+
+    gmcs*)
+        CSHARP_COMPILER_TYPE=mono
+    ;;
+
+    *)
+        CSHARP_COMPILER_TYPE=unknown
+    ;;
+esac

  # We default to the Beta 2 version of the library
  mercury_cv_microsoft_dotnet_library_version=1.0.2411.0
  if	test $mercury_cv_microsoft_dotnet = "yes" &&
  	test "$CSC" != "";
  then
-	AC_MSG_CHECKING(version of .NET libraries)
+	AC_MSG_CHECKING([version of .NET libraries])
  	cat > conftest.cs << EOF
  	using System;
  	using System.Reflection;
@@ -294,15 +317,15 @@
  			./conftest > conftest.out 2>&1
  	then
  		mercury_cv_microsoft_dotnet_library_version=`cat conftest.out`
-		AC_MSG_RESULT($mercury_cv_microsoft_dotnet_library_version)
+		AC_MSG_RESULT([$mercury_cv_microsoft_dotnet_library_version])
  		rm -f conftest*
  	else
  		rm -f conftest*
  		if test "$enable_dotnet_grades" = "yes"; then
-			AC_MSG_ERROR(unable to determine version)
+			AC_MSG_ERROR([unable to determine version])
  			exit 1
  		else
-			AC_MSG_WARN(unable to determine version)
+			AC_MSG_WARN([unable to determine version])
  		fi
  	fi
  fi
@@ -310,22 +333,22 @@

  # Check for the assembly linker.
  # ilalink is the DotGNU assembly linker.
-AC_PATH_PROGS(MS_AL, al ilalink)
+AC_PATH_PROGS([MS_AL], [al ilalink])
  MS_AL=`basename "$MS_AL"`

  # Check for an implementation of the Common Language Infrastructure.
-AC_PATH_PROGS(CLI_INTERPRETER, mono)
+AC_PATH_PROGS([CLI_INTERPRETER], [mono])
  MONO=`basename "$CLI_INTERPRETER"`

-AC_SUBST(ILASM)
-AC_SUBST(GACUTIL)
-AC_SUBST(CSC)
-AC_SUBST(CSHARP_COMPILER_TYPE)
-AC_SUBST(MS_AL)
-AC_SUBST(MS_DOTNET_SDK_DIR)
-AC_SUBST(MS_DOTNET_LIBRARY_VERSION)
-AC_SUBST(MS_VISUALCPP_DIR)
-AC_SUBST(CLI_INTERPRETER)
+AC_SUBST([ILASM])
+AC_SUBST([GACUTIL])
+AC_SUBST([CSC])
+AC_SUBST([CSHARP_COMPILER_TYPE])
+AC_SUBST([MS_AL])
+AC_SUBST([MS_DOTNET_SDK_DIR])
+AC_SUBST([MS_DOTNET_LIBRARY_VERSION])
+AC_SUBST([MS_VISUALCPP_DIR])
+AC_SUBST([CLI_INTERPRETER])
  ])

  #-----------------------------------------------------------------------------#

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