allow building for older platforms
authorJohann <johannkoenig@google.com>
Fri, 14 Oct 2011 19:03:32 +0000 (12:03 -0700)
committerJohann <johannkoenig@google.com>
Fri, 14 Oct 2011 19:03:32 +0000 (12:03 -0700)
Change-Id: Ibbd05e981debee12c16ebcd274150cd75a94a69d

build/make/configure.sh

index ab087f1..009a6c4 100755 (executable)
@@ -603,24 +603,35 @@ process_common_toolchain() {
     # PIC is probably what we want when building shared libs
     enabled shared && soft_enable pic
 
-    # Handle darwin variants
+    # Handle darwin variants. Newer SDKs allow targeting older
+    # platforms, so find the newest SDK available.
+    if [ -d "/Developer/SDKs/MacOSX10.4u.sdk" ]; then
+        osx_sdk_dir="/Developer/SDKs/MacOSX10.4u.sdk"
+    fi
+    if [ -d "/Developer/SDKs/MacOSX10.5.sdk" ]; then
+        osx_sdk_dir="/Developer/SDKs/MacOSX10.5.sdk"
+    fi
+    if [ -d "/Developer/SDKs/MacOSX10.6.sdk" ]; then
+        osx_sdk_dir="/Developer/SDKs/MacOSX10.6.sdk"
+    fi
+
     case ${toolchain} in
         *-darwin8-*)
-            add_cflags  "-isysroot /Developer/SDKs/MacOSX10.4u.sdk"
+            add_cflags  "-isysroot ${osx_sdk_dir}"
             add_cflags  "-mmacosx-version-min=10.4"
-            add_ldflags "-isysroot /Developer/SDKs/MacOSX10.4u.sdk"
+            add_ldflags "-isysroot ${osx_sdk_dir}"
             add_ldflags "-mmacosx-version-min=10.4"
             ;;
         *-darwin9-*)
-            add_cflags  "-isysroot /Developer/SDKs/MacOSX10.5.sdk"
+            add_cflags  "-isysroot ${osx_sdk_dir}"
             add_cflags  "-mmacosx-version-min=10.5"
-            add_ldflags "-isysroot /Developer/SDKs/MacOSX10.5.sdk"
+            add_ldflags "-isysroot ${osx_sdk_dir}"
             add_ldflags "-mmacosx-version-min=10.5"
             ;;
         *-darwin10-*)
-            add_cflags  "-isysroot /Developer/SDKs/MacOSX10.6.sdk"
+            add_cflags  "-isysroot ${osx_sdk_dir}"
             add_cflags  "-mmacosx-version-min=10.6"
-            add_ldflags "-isysroot /Developer/SDKs/MacOSX10.6.sdk"
+            add_ldflags "-isysroot ${osx_sdk_dir}"
             add_ldflags "-mmacosx-version-min=10.6"
             ;;
     esac