Support using clang as a C compiler with Mercury -- currently only

Branches: main, 11.07

Support using clang as a C compiler with Mercury -- currently only
tested on Mac OS X.

Clean up the handling of C compilers in the configure script.

configure.in:
	Improve this script's ability to distinguish between different
	types of C compiler.  In particular, ensure that a clear
	distinction is maintained between clang and gcc.

	Fix an old XXX: don't rely on pattern matching on the value
	of $CC to determine the C compiler type.  This is particularly
	error prone now since one compiler is named "clang" and another
	"cl".

	Set optimization and warning flags for clang.
	(XXX this is currently very conservative; we need to go through
	them and work out what good defaults might be.)

	Don't link against libgcc if we are using clang.
	(XXX I don't think this is really necessary for gcc either in
	the great majority of cases.)

	Mark spots that still need updating with "XXX CLANG"; I will
	look into these separately.

aclocal.m4:
	Add a new macro that determines the C compiler type based
	on what builtin macros are defined -- unlike AC_PROG_CC
	this macro correctly distinguishes between gcc and clang.

	Add two new macros that determine version information for
	clang and for Visual C.

scripts/mgnuc.in:
scripts/ml.in:
	Handle clang

README.MacOS:
	Mention that clang can be used with Mercury on Mac OS X.
This commit is contained in:
Julien Fischer
2011-08-25 14:16:53 +00:00
parent 92343457e4
commit 96c68d4157
5 changed files with 228 additions and 76 deletions

View File

@@ -7,7 +7,7 @@ Mercury on Mac OS X 10.5 and 10.6
Mercury should build and install "out-of-the-box" on Mac OS X 10.5 or 10.6
using Apple's gcc version 4.2. This version of gcc is included with the
Developer Tools.
Developer Tools. On Mac OS X 10.6 you may also use clang.
The 'asm_fast*' and 'reg*' grades are not currently available on Mac OS X 10.5
or 10.6. The only low-level C grades available are the 'none*' grades. The
@@ -23,8 +23,8 @@ for compiling applications.
By default, 64-bit versions of the executables and libraries in the Mercury
system will be installed on x86-64 machines running Mac OS X 10.6. To build a
32-bit installation on such a machine, you need to arrange to have the option
"-m32" passed to gcc. This can be done by invoking Mercury's configure script
with the option:
"-m32" passed to gcc or clang. This can be done by invoking Mercury's
configure script with the option:
--with-cc="gcc -m32"
@@ -47,8 +47,7 @@ Mmake.params at the top-level of the source tree:
MCFLAGS = --cross-compiling
Mercury can currently only be compiled by gcc on Mac OS X. It cannot currently
be compiled with llvm-gcc or clang.
Mercury cannot currently be compiled with llvm-gcc on Mac OS X.
If, after installing Mercury, you encounter errors about missing .mih files,
and you have fink installed, then try removing the fink components from your