[m-rev.] for review: port Mercury to MacOS X 10.6

Ian MacLarty maclarty at csse.unimelb.edu.au
Wed Oct 7 21:54:49 AEDT 2009


For review by Julien and Zoltan.

Get Mercury compiling on Mac OS X 10.6 (Darwin 10).

Mmake.common.in:
    Add ENABLE_BOEHM_XOPEN_SOURCE.

README.MacOS:
    Document that Mercury works on Mac OS X 10.5 and 10.6.
    Also document that it hasn't been tested on 10.3 for 
    some time.

configure.in:
    Pass -m32 to gcc on Darwin 10, because our current version of boehm doesn't
    work on 64 bit Darwin.

    Define _XOPEN_SOURCE on Darwin 10 when compiling boehm to
    avoid errors about the functions in ucontext.h being deprecated.

    Don't pass -s to the linker on any intel Darwin system.

boehm_gc/Makefile:
    Include BOEHM_CFLAGS (generated by the Mercury configure script)
    in SPECIALCFLAGS which is used when compiling mach_dep.c so that
    _XOPEN_SOURCE is defined in mach_dep.c.

trace/mercury_event_scanner.l:
    Use yy_size_t instead of int for the return type of 
    mercury_event_get_leng to avoid errors about conflicting types
    between the prototype and its implementation (flex generates a
    function that returns yy_size_t).

Index: Mmake.common.in
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmake.common.in,v
retrieving revision 1.96
diff -u -b -r1.96 Mmake.common.in
--- Mmake.common.in	30 Jul 2009 02:41:51 -0000	1.96
+++ Mmake.common.in	7 Oct 2009 20:44:28 -0000
@@ -144,7 +144,8 @@
 # MCFLAGS	+= --no-infer-all --halt-at-warn --no-warn-inferred-erroneous
 
 # Options to pass to the C compiler when building Boehm-GC.
-BOEHM_CFLAGS = @ENABLE_BOEHM_LARGE_CONFIG@ @ENABLE_BOEHM_USE_MUNMAP@
+BOEHM_CFLAGS = @ENABLE_BOEHM_LARGE_CONFIG@ @ENABLE_BOEHM_USE_MUNMAP@ \
+    @ENABLE_BOEHM_XOPEN_SOURCE@
 
 # Additional options to pass to the C compiler when building Boehm-GC for
 # threads.
Index: README.MacOS
===================================================================
RCS file: /home/mercury1/repository/mercury/README.MacOS,v
retrieving revision 1.11
diff -u -b -r1.11 README.MacOS
--- README.MacOS	11 Jan 2007 02:18:29 -0000	1.11
+++ README.MacOS	7 Oct 2009 20:44:28 -0000
@@ -1,13 +1,15 @@
-This file documents the port of Mercury to PowerPC Macs running Mac OS X,
-i.e. the "powerpc-apple-darwin" configuration. 
+This file documents the port of Mercury to Mac OS X,
+i.e. the "*-apple-darwin" configuration. 
 
 -----------------------------
 Supported version of Mac OS X
 -----------------------------
 
-Mercury has been heavily tested on Mac OS X 10.3 and should build
-"out-of-the-box".  Mercury also works with Mac OS X 10.4 subject to the caveat
-below regarding which version of gcc to use.
+Mercury has been tested on the Intel versions of Mac OS X 10.5 and 10.6
+and should build "out-of-the-box" using Apple's gcc 4.2.
+
+Mercury may also work on Mac OS X 10.3 and 10.4 (Intel or PPC), but it hasn't
+been tested on these platforms for some time.
 
 There may be problems with building Mercury on versions of Mac OS X less than
 10.3.0.  In particular there may be problems with building and using shared
@@ -33,6 +35,9 @@
 Apple gcc 4.0 does not work with Mercury.  Users of Mac OS X 10.4 should
 note that this version of gcc is the default one on their systems.
 
+Apple gcc 4.2 works on Mac OS X 10.5 and 10.6 (although the asm_fast
+and reg grades are not available).
+
 If you are using an Apple build of gcc then you must use the gcc_select
 command to set the system's default gcc to that version of gcc.  It is not
 sufficient to just point Mercury to a version of gcc using the configure
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.547
diff -u -b -r1.547 configure.in
--- configure.in	1 Oct 2009 07:05:37 -0000	1.547
+++ configure.in	7 Oct 2009 20:44:30 -0000
@@ -720,6 +720,17 @@
 #-----------------------------------------------------------------------------#
 AC_PROG_CC
 MERCURY_CHECK_CC_NEEDS_TRAD_CPP
+
+# Mercury doesn't currently work on 64 bit Darwin, so we need to pass
+# -m32 to gcc.
+case "$host" in
+    *apple*darwin*10*)
+        if test "$GCC" = "yes"; then
+            CC="$CC -m32"
+        fi
+        ;;
+esac
+
 AC_SUBST(CC)
 
 # AC_PROG_CC sets GCC to yes if $CC is GNU C.
@@ -741,6 +752,19 @@
 # test for memalign() doesn't use `-g', since `ml' doesn't use `-g'.
 CFLAGS="-O"
 
+# We need to define _XOPEN_SOURCE when building boehm on Darwin 10
+# so that we don't get errors about the functions in ucontext.h being
+# deprecated.
+case "$host" in
+    *apple*darwin*10*)
+        ENABLE_BOEHM_XOPEN_SOURCE="-D_XOPEN_SOURCE"
+        ;;
+    *)
+        ENABLE_BOEHM_XOPEN_SOURCE=
+        ;;
+esac
+AC_SUBST(ENABLE_BOEHM_XOPEN_SOURCE)
+
 # We also need to add the appropriate `-I' options so that the test programs
 # can #include various Mercury runtime headers.
 case "$MERCURY_CONF_RECONFIGURE" in
@@ -924,11 +948,11 @@
 
     LD_STRIP_FLAG="-s"
 
-    # Suppress a warning from the linker on Darwin 9.  `-s' is deprecated on it
-    # and has no effect other than causing the linker to emit a warning.
+    # Suppress a warning from the linker on Darwin 9+.  `-s' is deprecated on
+    # it and has no effect other than causing the linker to emit a warning.
     #
     case "$host" in
-        *apple*darwin*9*)
+        i686*apple*darwin*)
             LD_STRIP_FLAG=""
             ;;
     esac
Index: boehm_gc/Makefile
===================================================================
RCS file: /home/mercury1/repository/mercury/boehm_gc/Makefile,v
retrieving revision 1.65
diff -u -b -r1.65 Makefile
--- boehm_gc/Makefile	29 Nov 2006 04:50:45 -0000	1.65
+++ boehm_gc/Makefile	7 Oct 2009 20:44:31 -0000
@@ -456,7 +456,7 @@
 SHELL= /bin/sh
 
 SPECIALCFLAGS = -I$(srcdir)/include -I$(AO_INSTALL_DIR)/include \
-		$(CFLAGS_FOR_PIC)
+		$(CFLAGS_FOR_PIC) $(BOEHM_CFLAGS)
 # Alternative flags to the C compiler for mach_dep.c.
 # Mach_dep.c often doesn't like optimization, and it's
 # not time-critical anyway.
Index: trace/mercury_event_scanner.l
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/mercury_event_scanner.l,v
retrieving revision 1.5
diff -u -b -r1.5 mercury_event_scanner.l
--- trace/mercury_event_scanner.l	16 Sep 2008 07:26:32 -0000	1.5
+++ trace/mercury_event_scanner.l	7 Oct 2009 20:44:33 -0000
@@ -72,7 +72,7 @@
 int     mercury_event_get_lineno(void);
 FILE    *mercury_event_get_in(void);
 FILE    *mercury_event_get_out(void);
-int     mercury_event_get_leng(void);
+yy_size_t   mercury_event_get_leng(void);
 char    *mercury_event_get_text(void);
 void    mercury_event_set_lineno(int line_number);
 void    mercury_event_set_in(FILE *in_str);
--------------------------------------------------------------------------
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