[m-dev.] Porting Mercury 0.9.1 to Darwin

Fergus Henderson fjh at cs.mu.OZ.AU
Thu Aug 3 15:28:51 AEST 2000


On 03-Aug-2000, Roy Ward <roy at albatross.co.nz> wrote:
> 1) get recent versions of config.sub and config.guess
> 
> cp /usr/libexec/config.* .
> 
> This is so that the configure command knows what platform we are on
> 
> 2) The garbage collector needs to be told separately which platform we are
> on. Rrecent versions of the boehm gc know about this, but the version that
> Mercury uses doesn't, so a hack for this is to add the line
> 
> #define macosx
> 
> somewhere near the top of boehm_gc/gcconfig.h

OK, both of these are easy for us to fix, just by upgrading the
versions of the respective files.

> 3) Darwin doesn't have the normal libm.a that most Unixes have (the math
> stuff is linked in automatically), so -lm is an error. It is supposed to be
> possible to create a dummy libm.a to work around this (Mercury isn't the
> only port to suffer from this - even some of Darwins makefiles have to be
> changed), but I couldn't get it to go.
> 
> Rremove the -lm from:
> the end of the definition MLLIBS (about line 50) of compiler/Mmakefile,
> the end of the definition MLLIBS (about line 50) of profiler/Mmakefile,
> the definition SHARED_LIBS (about line 34) of scripts/ml,
> the definition of STDLIBS (about line 987) of scripts/ml,
> anywhere else it causes trouble.

We can probably use an autoconf test to fix this one.

> 4) There is no gcc in Darwin - it's called cc (but is still actually gcc,
> just with a different name).
> 
> Change gcc to cc in the definition SHARED_LIBS (about line 34) of scripts/ml.

SHARED_LIBS is originally defined by configure.in.
We could fix that one by changing `gcc' in configure.in to `$CC'.
However, IIRC that might cause problems for the lcc port,
where CC=lcc but where IIRC we still need to link in libgcc.a
for some reason.  More investigation needed here...

> 5) I'm not sure how Darwin handles library stripping, but it didn't like
> the -s on about line 950 of scripts/ml, so remove it. (Actually, it would
> be better to set the $strips variable correctly, but I said that this was a
> hack).

We had a similar problem with the Cygwin port: `gcc -s' seems to be
broken for some ports of gcc.  It's probably best to use the same
approach for Darwin that we took for Cygwin: at around line 60,
where it has

	case $FULLARCH in
		*-win95|*-winnt|*-win32|*-cygwin32|*-cygwin)
			# `gcc -s' is broken in gnu-win32
			strip=false
			;;
		*)
			strip=true
			;;
	esac

we should add a case for Darwin.

> 6) After I compiled and installed Mercury, I found that I had to ranlib a
> few libraries. I was prompted for this.

Hmm... what was the result of the autoconf check for `ranlib'?

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list