common/autoconf/toolchain.m4
changeset 15786 abd76d7cd807
parent 15581 1dd771c6a1ee
child 15908 970eca7e1e2f
child 15842 a33cf9e2d7d8
--- a/common/autoconf/toolchain.m4	Wed Jul 05 18:41:33 2017 +0200
+++ b/common/autoconf/toolchain.m4	Thu Feb 21 14:16:56 2013 +0100
@@ -876,10 +876,17 @@
 fi
 if test "x$OPENJDK_TARGET_OS" = xmacosx; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMACOSX -D_ALLBSD_SOURCE"
-    # Adding these macros will make it an error to link to mac APIs newer than OS version 10.7
-    MACOSX_REQUIRED_VERSION=1070
-    AC_SUBST(MACOSX_REQUIRED_VERSION)
-    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(MACOSX_REQUIRED_VERSION) -DMAC_OS_X_VERSION_MIN_REQUIRED=\$(MACOSX_REQUIRED_VERSION)" 
+    # Setting these parameters makes it an error to link to macosx APIs that are 
+    # newer than the given OS version and makes the linked binaries compatible even
+    # if built on a newer version of the OS.
+    # The expected format is X.Y.Z
+    MACOSX_VERSION_MIN=10.7.0
+    AC_SUBST(MACOSX_VERSION_MIN)
+    # The macro takes the version with no dots, ex: 1070
+    # Let the flags variables get resolved in make for easier override on make
+    # command line.
+    CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DMAC_OS_X_VERSION_MAX_ALLOWED=\$(subst .,,\$(MACOSX_VERSION_MIN)) -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
+    LDFLAGS_JDK="$LDFLAGS_JDK -mmacosx-version-min=\$(MACOSX_VERSION_MIN)"
 fi
 if test "x$OPENJDK_TARGET_OS" = xbsd; then
     CCXXFLAGS_JDK="$CCXXFLAGS_JDK -DBSD -D_ALLBSD_SOURCE"