mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-18 23:35:25 +00:00
Fix linking error for hlc.par.gc grade on Darwin.
Estimated hours taken: 3 Branches: main Fix linking error for hlc.par.gc grade on Darwin. The problem was that the "-undefined suppress" option is not allowed with two level namespaces. The solution is to use "-undefined dynamic_lookup" instead. However this means the MACOSX_DEPLOYMENT_TARGET environment variable must be set to 10.3 since this feature will not work on Mac OS < 10.3. To allow hlc.gc.par to be built on Mac 10.3, but targetted for Mac OS 10.0 - 10.2 add a configuration option to force the use of flat namespaces (the "-undefined suppress" option may be used with flat namespaces). configure.in Add --enable-darwin-flat-namespace option. This is the default for Mac OS < 10.3. For Mac OS 10.3 two level namespaces are used unless this option is given. Set a variable to cause the MACOSX_DEPLOYMENT_TARGET environment variable to be set if two level namespaces are being used. scripts/mmake.in scripts/ml.in scripts/mmc.in Set the MACOSX_DEPLOYMENT_TARGET environment variable wherever the linker may be called.
This commit is contained in:
51
configure.in
51
configure.in
@@ -2591,8 +2591,7 @@ AC_ARG_ENABLE(libgrades,
|
|||||||
[ --enable-libgrades=...
|
[ --enable-libgrades=...
|
||||||
install exactly the given versions of the library.
|
install exactly the given versions of the library.
|
||||||
The versions are specified using a comma-separated
|
The versions are specified using a comma-separated
|
||||||
list.
|
list.],
|
||||||
],
|
|
||||||
enable_libgrades_given=yes;enable_libgrades="$enableval",enable_libgrades_given=no)
|
enable_libgrades_given=yes;enable_libgrades="$enableval",enable_libgrades_given=no)
|
||||||
|
|
||||||
if test "$enable_most_grades" = no; then
|
if test "$enable_most_grades" = no; then
|
||||||
@@ -3227,16 +3226,56 @@ case "$host" in
|
|||||||
# If the compiler is gcc then use darwin style dynamic linking.
|
# If the compiler is gcc then use darwin style dynamic linking.
|
||||||
# Otherwise use static linking.
|
# Otherwise use static linking.
|
||||||
if test "$GCC_PROG" != ""; then
|
if test "$GCC_PROG" != ""; then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
# Check if the user has explicitly requested that flat
|
||||||
|
# namespaces be used.
|
||||||
|
darwin_flat_namespaces=no
|
||||||
|
AC_ARG_ENABLE(darwin-flat-namespace,
|
||||||
|
[ --enable-darwin-flat-namespace
|
||||||
|
enable flat namespaces on Darwin. This is the
|
||||||
|
default for Darwin versions less than 7 (Mac OS
|
||||||
|
10.3). On versions greater than or equal to 7
|
||||||
|
two-level namespaces are used by default. This
|
||||||
|
option therefore only affects Darwin versions
|
||||||
|
greater than or equal to 7.],
|
||||||
|
[ darwin_flat_namespaces=yes ])
|
||||||
SHLIB_USE_INSTALL_NAME="--shlib-linker-use-install-name"
|
SHLIB_USE_INSTALL_NAME="--shlib-linker-use-install-name"
|
||||||
SHLIB_INSTALL_NAME_FLAG="-install_name "
|
SHLIB_INSTALL_NAME_FLAG="-install_name "
|
||||||
LINK_SHARED_OBJ="$GCC_PROG -dynamiclib -single_module"
|
|
||||||
LINK_SHARED_OBJ_SH="$GCC_PROG -dynamiclib -single_module"
|
|
||||||
EXT_FOR_SHARED_LIB=dylib
|
EXT_FOR_SHARED_LIB=dylib
|
||||||
EXT_FOR_LINK_WITH_PIC_OBJECTS=o
|
EXT_FOR_LINK_WITH_PIC_OBJECTS=o
|
||||||
CFLAGS_FOR_PIC="-fPIC -DMR_PIC"
|
CFLAGS_FOR_PIC="-fPIC -DMR_PIC"
|
||||||
ERROR_UNDEFINED="-undefined error"
|
ERROR_UNDEFINED="-undefined error"
|
||||||
ALLOW_UNDEFINED="-undefined suppress"
|
# Test if the Darwin version is >= 7. If it is
|
||||||
AC_MSG_RESULT(yes)
|
# then we can use the -undefined dynamic_lookup option
|
||||||
|
# and two-level namespaces. If it isn't then we use
|
||||||
|
# flat namespaces.
|
||||||
|
AC_MSG_CHECKING(whether to use two-level namespaces)
|
||||||
|
if uname -r | sed "s/^\(@<:@0-9@:>@*\)\..*$/\1/" | \
|
||||||
|
xargs test "$darwin_flat_namespaces" != "yes" \
|
||||||
|
-a 7 -le;
|
||||||
|
then
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
# The MACOSX_DEPLOYMENT_TARGET environment variable
|
||||||
|
# needs to be set when linking with two level
|
||||||
|
# namespaces so we can use the
|
||||||
|
# `-undefined dynamic_lookup' option.
|
||||||
|
SET_MACOSX_DEPLOYMENT_TARGET="\
|
||||||
|
MACOSX_DEPLOYMENT_TARGET=10.3; \
|
||||||
|
export MACOSX_DEPLOYMENT_TARGET"
|
||||||
|
AC_SUBST(SET_MACOSX_DEPLOYMENT_TARGET)
|
||||||
|
LINK_SHARED_OBJ="$GCC_PROG -multiply_defined suppress \
|
||||||
|
-dynamiclib -single_module"
|
||||||
|
LINK_SHARED_OBJ_SH="$GCC_PROG -multiply_defined \
|
||||||
|
suppress -dynamiclib -single_module"
|
||||||
|
ALLOW_UNDEFINED="-undefined dynamic_lookup"
|
||||||
|
else
|
||||||
|
AC_MSG_RESULT(no)
|
||||||
|
LINK_SHARED_OBJ="$GCC_PROG -flat_namespace \
|
||||||
|
-dynamiclib -single_module"
|
||||||
|
LINK_SHARED_OBJ_SH="$GCC_PROG -flat_namespace \
|
||||||
|
-dynamiclib -single_module"
|
||||||
|
ALLOW_UNDEFINED="-undefined error"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
CFLAGS_FOR_PIC=
|
CFLAGS_FOR_PIC=
|
||||||
EXT_FOR_PIC_OBJECTS=o
|
EXT_FOR_PIC_OBJECTS=o
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ MATH_LIB=${MERCURY_MATH_LIB="@MATH_LIB@"}
|
|||||||
# since @SHARED_LIBS_SH@ may refer to $MATH_LIB.
|
# since @SHARED_LIBS_SH@ may refer to $MATH_LIB.
|
||||||
SHARED_LIBS=${MERCURY_SHARED_LIBS="@SHARED_LIBS_SH@"}
|
SHARED_LIBS=${MERCURY_SHARED_LIBS="@SHARED_LIBS_SH@"}
|
||||||
|
|
||||||
|
# Set the MACOSX_DEPLOYMENT_TARGET environment variable if needed.
|
||||||
|
@SET_MACOSX_DEPLOYMENT_TARGET@
|
||||||
|
|
||||||
# When compiling in the hlc.gc grade using the Microsoft Visual C
|
# When compiling in the hlc.gc grade using the Microsoft Visual C
|
||||||
# compiler, the default maximum stack size of 4Mb is too low for a
|
# compiler, the default maximum stack size of 4Mb is too low for a
|
||||||
# recursive language.
|
# recursive language.
|
||||||
|
|||||||
@@ -80,6 +80,9 @@ MERCURY_DEFAULT_GRADE=${MERCURY_DEFAULT_GRADE=@DEFAULT_GRADE@}
|
|||||||
MKTEMP=@MKTEMP@
|
MKTEMP=@MKTEMP@
|
||||||
TMPDIR=${TMPDIR=/tmp}
|
TMPDIR=${TMPDIR=/tmp}
|
||||||
|
|
||||||
|
# Set the MACOSX_DEPLOYMENT_TARGET environment variable if needed.
|
||||||
|
@SET_MACOSX_DEPLOYMENT_TARGET@
|
||||||
|
|
||||||
MMAKE=$0
|
MMAKE=$0
|
||||||
include_makefile=
|
include_makefile=
|
||||||
verbose=false
|
verbose=false
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
#---------------------------------------------------------------------------#
|
#---------------------------------------------------------------------------#
|
||||||
# Copyright (C) 1994-1998, 2000-2003 The University of Melbourne.
|
# Copyright (C) 1994-1998, 2000-2004 The University of Melbourne.
|
||||||
# This file may only be copied under the terms of the GNU General
|
# This file may only be copied under the terms of the GNU General
|
||||||
# Public License - see the file COPYING in the Mercury distribution.
|
# Public License - see the file COPYING in the Mercury distribution.
|
||||||
#---------------------------------------------------------------------------#
|
#---------------------------------------------------------------------------#
|
||||||
@@ -18,6 +18,9 @@ MERCURY_COMPILER=${MERCURY_COMPILER-'@LIBDIR@/bin/@FULLARCH@/mercury_compile'}
|
|||||||
MERCURY_CONFIG_DIR=${MERCURY_CONFIG_DIR-${MERCURY_STDLIB_DIR-'@CONFIG_LIBDIR@'}}
|
MERCURY_CONFIG_DIR=${MERCURY_CONFIG_DIR-${MERCURY_STDLIB_DIR-'@CONFIG_LIBDIR@'}}
|
||||||
export MERCURY_COMPILER MERCURY_CONFIG_DIR
|
export MERCURY_COMPILER MERCURY_CONFIG_DIR
|
||||||
|
|
||||||
|
# Set the MACOSX_DEPLOYMENT_TARGET environment variable if needed.
|
||||||
|
@SET_MACOSX_DEPLOYMENT_TARGET@
|
||||||
|
|
||||||
case $# in
|
case $# in
|
||||||
0) exec $MERCURY_COMPILER ;;
|
0) exec $MERCURY_COMPILER ;;
|
||||||
*) exec $MERCURY_COMPILER "$@" ;;
|
*) exec $MERCURY_COMPILER "$@" ;;
|
||||||
|
|||||||
Reference in New Issue
Block a user