[m-rev.] for review: improve handling of deployment target setting on Mac OS X
Julien Fischer
jfischer at opturion.com
Wed Jan 15 13:27:47 AEDT 2014
Branches: 14.01, master
Improve handling of the deployment target setting on Mac OS X.
Due to matching against hardcoded versions of Darwin in the configure script
the deployment target for recent versions (10.7 and later) of Mac OS X was being
incorrectly set to 10.3. This diff makes several changes to the handling of the
deployment target setting on Mac OS X:
- The default deployment target is now set to the same version as the host
system. (This is more consistent with the default XCode behaviour.)
- Matching against hardcoded versions of Darwin in the configure script
for this purpose has been removed.
- There is a new option for the configure script,
`--with-macosx-deployment-target', that allows the user to control
what the deployment target for use with Mercury is.
configure.ac:
Don't determine the deployment target by matching against hardcoded
versions of Darwin -- we had failed to update this for several
versions.
By default set the deployment target to be the same version as
the host system.
Add a new option for overriding the default setting of the
deployment target.
s/doesn't/does not/ in a spot in order to prevent syntax
highlighting in vim from going stupid.
README.MacOS:
Add a paragraph describing how the deployment target is set
for Mercury and pointing the user towards Apple's documentation
if they require further information.
NEWS:
Announce the change to the default value of the deployment
target setting.
Julien.
diff --git a/NEWS b/NEWS
index 348805a..c0b402a 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,14 @@ Changes to the Mercury standard library:
* We have added the following predicates to the int module: fold_up3/9 and
fold_down3/9.
+Changes to the Mercury compiler:
+
+* On Mac OS X systems the compiler is now configured use the version of the
+ host system as the default value for the deployment target.
+
+ A new configuration option, `--with-macosx-deployment-target', allows
+ an alternative value to be selected at configuration time.
+
Changes to the extras distribution:
* We've added a library that provides support for accessing the function
diff --git a/README.MacOS b/README.MacOS
index ca3b70e..13cbd5f 100644
--- a/README.MacOS
+++ b/README.MacOS
@@ -121,6 +121,22 @@ the `--traditional-cpp' option. The Mercury configure script should enable
this option automatically if it is needed.
+--------------------------
+Deployment Target Settings
+--------------------------
+
+By default, the Mercury compiler is configured so that the Mac OS X deployment
+target (i.e. the value of the MACOSX_DEPLOYMENT_TARGET environment variable)
+for code generated by the Mercury compiler is set to the same version as that
+of the host system.
+
+You can specify a different deployment target at configuration time using
+the configure script's `--with-macosx-deployment-target' option.
+
+(See the ``SDK Compatibility Guide'' in the Apple developer documentation
+for further information about the deployment target setting.)
+
+
------------------------
PowerPC Linking Problems
------------------------
diff --git a/configure.ac b/configure.ac
index cf5ba88..fdf2039 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4097,7 +4097,7 @@ int main() {
#if __GNUC__ >= 3
/* gcc 3.1 seems to have problems with structure assignment
and global registers, but which this simple test case
- doesn't trigger. So just force the test to fail for gcc 3.x. */
+ does not trigger. So just force the test to fail for gcc 3.x. */
exit(1);
#else
exit(0);
@@ -4114,6 +4114,55 @@ fi
#-----------------------------------------------------------------------------#
+# Allow the user to override the default value of MACOSX_DEPLOYMENT_TARGET.
+# We use the version of the host system for the default value.
+# XXX if we ever support Mac OS X as a cross-compiling target we should
+# force the user to set a value using --with-macosx-deployment-target.
+
+AC_ARG_WITH([macosx-deployment-target],
+ AC_HELP_STRING([--with-macosx-deployment-target=<target>],
+ [Specify the deployment target on Mac OS X.]),
+ [mercury_cv_macosx_deployment_target="$withval"],
+ [mercury_cv_macosx_deployment_target="auto"]
+)
+
+case "$mercury_cv_macosx_deployment_target" in
+ yes)
+ AC_MSG_ERROR([missing argument to --with-macosx-deployment-target=... option])
+ exit 1
+ ;;
+ no)
+ AC_MSG_ERROR([invalid option --without-macosx-deployment-target])
+ exit 1
+ ;;
+esac
+
+DEPLOYMENT_TARGET="no"
+
+case "$host" in
+ *apple*darwin*)
+ case "$mercury_cv_macosx_deployment_target" in
+ # NOTE: the sw_vers utility tells us which version of Mac OS X we are
+ # using as opposed to which version of Darwin we are using. uname
+ # only reports the latter.
+ auto)
+ DEPLOYMENT_TARGET=`sw_vers -productVersion | cut -d \. -f 1 -f 2`
+ ;;
+
+ *)
+ DEPLOYMENT_TARGET="$mercury_cv_macosx_deployment_target"
+ ;;
+ esac
+
+ if test "$DEPLOYMENT_TARGET" = "no"
+ then
+ AC_MSG_ERROR([cannot determine deployment target for this system])
+ fi
+ ;;
+esac
+
+#-----------------------------------------------------------------------------#
+
AC_MSG_CHECKING([whether Mercury supports shared libraries on this system])
# We ought to use $target here rather than $host - but we don't
# support cross-compilation at the moment anyhow.
@@ -4413,19 +4462,6 @@ case "$host" in
ERROR_UNDEFINED="-undefined error"
# The MACOSX_DEPLOYMENT_TARGET environment variable needs to be
# set so we can use the `-undefined dynamic_lookup' option.
- #
- # On 10.6, the deployment target needs to be at least 10.4.
- # For earlier versions of Mac OS X we use 10.3.
- case "$host" in
- *apple*darwin*10*)
- DEPLOYMENT_TARGET="10.4"
- ;;
-
- *)
- DEPLOYMENT_TARGET="10.3"
- ;;
- esac
-
SET_MACOSX_DEPLOYMENT_TARGET="\
MACOSX_DEPLOYMENT_TARGET=$DEPLOYMENT_TARGET; \
export MACOSX_DEPLOYMENT_TARGET"
More information about the reviews
mailing list