[mercury-users] Installation problem on MacOS X

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jan 28 16:06:33 AEDT 2003


On 28-Jan-2003, Roy Ward <roy at videoscript.com> wrote:
> Fergus Henderson wrote:
> 
> >I don't know for sure, but my guess is that this problem is due to a change
> >in behaviour in GCC which has been reverted in more recent versions of GCC.
> >In particular, I think the problem is that GCC 3.1 issues a
> >warning when invoked with `-I/usr/local/include',

Sorry, that wasn't it.

> >Could you please post me the `configure.log' and `config.log' files?
> 
> Included.

Thanks.

> There seems to be a lot of "syntax error at '#' token" in config.log

Right.  Now that you've provided the `config.log' file, I see what the
problem is.  The problem is due to us passing `-traditional-cpp'.

#$^#$^% Apple @#^@#$!

Here's the story:

	Once apon a time, Apple decided to make GCC faster.
	To do this, they implemented a so-called "smart" preprocessor
	which was supposed to make things run faster.
	Unfortunately, they did not do a great job of it.
	Although it did make many things run faster,
	for the kind of C code that the Mercury compiler produces,
	the "smart" preprocessor not only ran much slower, and used way
	too much memory -- it also crashed.
	As a result, the Mercury configuration scripts now contain
	code to detect the use of Apple's so-called "smart"
	preprocessor, and to turn it off.

	Even more unfortunately, when Apple first implemented their
	"smart" preprocessor, rather than create a new option for
	disabling it, they decided to recycle an existing option,
	`-traditional-cpp', giving it a new meaning.
	This was a profoundly dumb idea.

	What is happening now is that Apple must now have realized their
	mistake, and given `-traditional-cpp' back its original meaning
	(specifying a K&R style preprocessor rather than an ANSI/ISO C
	preprocessor), instead using `-no-cpp-precomp' to disable the
	"smart" preprocessor.  This change broke the Mercury configure
	script, which uses `-traditional-cpp' with the meaning of
	disabling Apple's broken "smart" preprocessor.

Anyway, the fix is to replace `-traditional-cpp' with `-no-cpp-precomp'
in `aclocal.m4' (and hence in `configure').  It appears that the
`-no-cpp-precomp' option actually works with older versions of Apple's
C compiler too (e.g. "932.1, based on gcc 2.95.2 19991024") --
it just wasn't documented!

I have committed this change to our CVS repository.

----------

aclocal.m4:
	Use `-no-cpp-precomp' rather than `-traditional-cpp' to disable
	Apple's broken C preprocessor.  This is needed for recent releases
	of Apple's version of GCC, because `-traditional-cpp' has reverted
	to its original meaning (specifying a K&R-style preprocessor).

Workspace: /home/ceres/fjh/mercury
Index: aclocal.m4
===================================================================
RCS file: /home/mercury1/repository/mercury/aclocal.m4,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- aclocal.m4	24 Jan 2003 07:17:05 -0000	1.17
+++ aclocal.m4	28 Jan 2003 05:03:45 -0000	1.18
@@ -64,7 +64,7 @@
 AC_DEFUN(MERCURY_CHECK_CC_NEEDS_TRAD_CPP,
 [
 AC_REQUIRE([AC_PROG_CC])
-AC_MSG_CHECKING(whether C compiler need --traditional-cpp)
+AC_MSG_CHECKING(whether C compiler needs -no-cpp-precomp)
 AC_CACHE_VAL(mercury_cv_cpp_precomp, [
 	>conftest.c
 	if	test "$GCC" = yes &&
@@ -78,7 +78,7 @@
 ])
 AC_MSG_RESULT($mercury_cv_cpp_precomp)
 if test $mercury_cv_cpp_precomp = yes; then
-	CC="$CC --traditional-cpp"
+	CC="$CC -no-cpp-precomp"
 fi
 ])
 #-----------------------------------------------------------------------------#
-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list