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

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Oct 8 14:48:00 AEDT 2009


On Wed, 7 Oct 2009, Ian MacLarty wrote:

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

Technically, the above is still true for the current stable release.

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

Intel for 10.3?  Not officially.

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

You should explain why it needs to be *darwin*10*.  Actually, I think it
should be harmless to pass -m32 on 10.5 as well.   I will try it after
you commit and adjust this for 10.5 as well.

> +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=""

Why is this change here?  Won't it break the Mac OS X PPC port? i.e.
don't you want to match against *apple*darwin*9*?  (Is the warning
present with Darwin 10?)

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