mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-12 12:26:29 +00:00
Some more changes for MacOS.
Estimated hours taken: 1 Branches: main Some more changes for MacOS. aclocal.m4: Define a macro MERCURY_CHECK_CC_NEEDS_CPP_PRECOMP, to check whether we need to append `-traditional-cpp' to $CC. configure.in: bindist/bindist.configure.in: Use the new macro. README.MacOS: Update the documentation: users don't need to configure using `--with-cc="cc --traditional-cpp"' any more.
This commit is contained in:
@@ -4,16 +4,16 @@ i.e. the "powerpc-apple-darwin" configuration.
|
||||
The version of tar in /usr/bin/tar on MacOS (10.1) doesn't work properly --
|
||||
it truncates long path names. Make sure you use GNU tar, which is available
|
||||
in /sw/bin/gtar, when unpacking the Mercury source or binary distributions.
|
||||
(Also, make sure to use GNU tar if/when *building* such distributions!)
|
||||
|
||||
Apple's version of gcc includes support for precompiled headers.
|
||||
Unfortunately this support seems to be somewhat buggy, causing it
|
||||
to sometimes crash with mysterious errors when building Mercury.
|
||||
Furthermore, for the kinds of C code that the Mercury compiler generates,
|
||||
it results in a very big slow-down, rather than any speedup.
|
||||
So you should use `--traditional-cpp' to disable the use of the
|
||||
new ``smart'' [sic] preprocessor. Configure with
|
||||
|
||||
sh configure --with-cc="cc --traditional-cpp"
|
||||
Fortunately this can be disabled by using the --traditional-cpp option.
|
||||
The Mercury configure script should enable this option automatically
|
||||
if it is needed.
|
||||
|
||||
The configure script will by default choose grade reg.gc.
|
||||
You can get better performance by using the hlc.gc grade.
|
||||
|
||||
28
aclocal.m4
vendored
28
aclocal.m4
vendored
@@ -13,6 +13,34 @@
|
||||
#
|
||||
#-----------------------------------------------------------------------------#
|
||||
#
|
||||
# Turn off MacOS's so-called "smart" C preprocessor, if present,
|
||||
# since it causes lots of spurious warning messages,
|
||||
# and furthermore it takes way too long and uses way too much memory
|
||||
# when preprocessing the C code generated by the Mercury compiler's LLDS
|
||||
# back-end.
|
||||
#
|
||||
AC_DEFUN(MERCURY_CHECK_CC_NEEDS_TRAD_CPP,
|
||||
[
|
||||
AC_REQUIRE([AC_PROG_CC])
|
||||
AC_MSG_CHECKING(whether C compiler need --traditional-cpp)
|
||||
AC_CACHE_VAL(mercury_cv_cpp_precomp, [
|
||||
>conftest.c
|
||||
if test "$GCC" = yes &&
|
||||
$CC -v -c conftest.c 2>&1 | \
|
||||
grep "cpp-precomp.*-smart" > /dev/null
|
||||
then
|
||||
mercury_cv_cpp_precomp=yes
|
||||
else
|
||||
mercury_cv_cpp_precomp=no
|
||||
fi
|
||||
])
|
||||
AC_MSG_RESULT($mercury_cv_cpp_precomp)
|
||||
if test $mercury_cv_cpp_precomp = yes; then
|
||||
CC="$CC --traditional-cpp"
|
||||
fi
|
||||
])
|
||||
#-----------------------------------------------------------------------------#
|
||||
#
|
||||
# Check for readline and related header files and libraries
|
||||
#
|
||||
AC_DEFUN(MERCURY_CHECK_READLINE,
|
||||
|
||||
@@ -204,6 +204,7 @@ AC_MSG_RESULT($mercury_cv_asm_does_full_preprocessing)
|
||||
AC_SUBST(AS)
|
||||
#-----------------------------------------------------------------------------#
|
||||
AC_PROG_CC
|
||||
MERCURY_CHECK_CC_NEEDS_TRAD_CPP
|
||||
AC_SUBST(CC)
|
||||
#-----------------------------------------------------------------------------#
|
||||
# Microsoft.NET configuration (the bindist may be installed on a machine
|
||||
|
||||
@@ -339,6 +339,7 @@ esac
|
||||
AC_DEFINE_UNQUOTED(MR_HOSTNAMECMD, "$HOSTNAMECMD")
|
||||
#-----------------------------------------------------------------------------#
|
||||
AC_PROG_CC
|
||||
MERCURY_CHECK_CC_NEEDS_TRAD_CPP
|
||||
AC_SUBST(CC)
|
||||
|
||||
# AC_PROG_CC sets GCC to yes if $CC is GNU C.
|
||||
|
||||
Reference in New Issue
Block a user