[m-rev.] for review: windows compatibility

Ian MacLarty maclarty at cs.mu.OZ.AU
Wed Sep 7 10:13:49 AEST 2005


On Tue, 6 Sep 2005, Julien Fischer wrote:

>
> On Tue, 6 Sep 2005, Ian MacLarty wrote:
>
> > For review by anyone.
> >
> > These changes make it possible to compile Mercury programs without cygwin
> > (using mingw gcc).  Cygwin is still required to build the compiler of course.
> > mmc also obviously doesn't work since it's a bash script (you have to
> > set all the appropriate environment variables manually and call
> > mercury_compile.exe directly).
> >
> > I was thinking of changing mmc to a C program to make it more portable.  Would
> > there be any objections to this?
> >
> Not from me, although you would (eventually) need to do the same for the
> rest mprof, mdb etc.
>
> > Fact tables will not work on windows since the code relies on some unix
> > commands (like sort).
> >
> > Estimated hours taken: 10
> > Branches: main and 0.12
> >
> > Various changes to make Mercury more compatible with Windows.
> >
> > configure.in:
> > 	Turn off symbolic links when compiling in cygwin.
> > 	Previously the configure script checked for certain compiler
> > 	names or whether the --mno-cygwin option was passed to gcc,
> > 	however this check is not good enough since the user may specify
> > 	the mingw version of gcc using the --with-cc option.
>
> But won't that stop use using symlinks in cygwin normally?
> Could we at least have another option, '--cyginw-use-symlinks'
> that allowed us turn them back on manually?
>

Okay:

diff -u configure.in configure.in
--- configure.in	5 Sep 2005 08:59:21 -0000
+++ configure.in	6 Sep 2005 10:47:17 -0000
@@ -769,9 +769,18 @@
 AC_CHECK_LIB(m, sin, [MATH_LIB=-lm], [MATH_LIB=])

 #-----------------------------------------------------------------------------#
+enable_symlinks_opt=no
+AC_ARG_ENABLE(symlinks,
+[  --enable-symlinks       enable symbolic links.  This is the default on all
+			  systems except Windows.  On Windows you can force
+			  symbolic links to be used by giving this option.
+			  Note that symbolic links will only work on Windows if
+			  you are using the Cygwin version of GCC.],
+[ enable_symlinks_opt=yes ])
+
 # If we're compiling the compiler on Windows,
-# don't use symlinks when installing -- the generated compiler executable
-# will not be able to follow them.
+# don't use symlinks when installing unless the --enable-symlinks option
+# is given.
 #
 # When cross-compiling from Cygwin to Mingw (and perhaps also on
 # native Mingw?), `-lm' exists, but it is not needed and in fact we must
@@ -780,9 +789,11 @@
 LN_S="ln -s"
 case "$host" in
     *cygwin*)
-	MMC_USE_SYMLINKS_OPT=--no-use-symlinks
 	MATH_LIB=
-	LN_S=false
+	if test "$enable_symlinks_opt" != "yes"; then
+		MMC_USE_SYMLINKS_OPT=--no-use-symlinks
+		LN_S=false
+	fi
 	;;
 esac

> > compiler/mercury_compile.m:
> > mdbcomp/trace_counts.m:
> > 	Use rstrip to remove trailing newlines, since on Windows there
> > 	may be more than one character at the end of each line
> > 	(a newline and a carriage return or line feed
> > 	- I can't remember which).
> >
> Is the trace count mechanism still broken on Windows?
>

You can read trace counts on windows, but not write them.  I'll fix the writing in
a separate diff.

> > compiler/passes_aux.m:
> > 	Remove invoke_shell_command since it is not used anywhere and
> > 	according to the comment won't work on Windows.
> >
> > 	If on windows do not use `2>&1' to redirect standard error since this
> > 	doesn't work on windows 98 and 95 (and possibly other versions too).
> >
> I don't think we should worry about supporting older versions of
> Windows (although then Mercury would run on my desktop at home, albeit
> very slowly).
>

Well Mercury does now work on Windows 98 without cygwin, although errors from external
programs like gcc and ln will just go to the screen instead of being piped through
the demangler.  I'd prefer to support it since I have Windows 98 on my Mac.

Ian.

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