# HG changeset patch # Parent 35cd087487f0d3c2c0dd4c2983181252ada15876 Codechange: [OSX] Deprecate PPC support and redefine universal builds to i386 and x86_64 diff --git a/config.lib b/config.lib --- a/config.lib +++ b/config.lib @@ -57,7 +57,7 @@ enable_unicode="1" enable_assert="1" enable_strip="0" - enable_universal="1" + enable_universal="i386 ppc" enable_osx_g5="0" enable_cocoa_quartz="1" enable_cocoa_quickdraw="1" @@ -296,8 +296,8 @@ --disable-strip) enable_strip="0";; --enable-strip) enable_strip="2";; --enable-strip=*) enable_strip="$optarg";; - --disable-universal) enable_universal="0";; - --enable-universal) enable_universal="2";; + --disable-universal) enable_universal="";; + --enable-universal) enable_universal="i386 ppc x86_64 ppc64";; --enable-universal=*) enable_universal="$optarg";; --disable-osx-g5) enable_osx_g5="0";; --enable-osx-g5) enable_osx_g5="2";; @@ -528,23 +528,15 @@ check_build check_host -# We might enable universal builds always on OSX targets.. but currently we don't -# if [ "$enable_universal" = "1" ] && [ "$os" != "OSX" ]; then - if [ "$enable_universal" = "1" ]; then - enable_universal="0" - fi - if [ "$enable_universal" = "2" ] && [ "$os" != "OSX" ]; then - log 1 "configure: error: --enable-universal only works on OSX" - exit 1 - fi - if [ "$enable_universal" = "0" ]; then +# Check for universal builds; they only make sense for OSX, so fail, if enabled for other OS + if [ "$enable_universal" = "" ]; then log 1 "checking universal build... no" else - if [ "$enable_universal" = "64" ]; then - log 1 "checking universal build... yes (including 64 bits)" - else - log 1 "checking universal build... yes (without 64 bits)" + if [ "$os" != "OSX" ]; then + log 1 "configure: error: --enable-universal only works on OSX" + exit 1 fi + log 1 "checking universal build... yes, for: $enable_universal" fi # Already detected by check_build @@ -653,7 +645,7 @@ fi if [ "$with_osx_sysroot" != "0" ]; then - if [ "$enable_universal" = "0" ] && [ "$with_osx_sysroot" != "1" ] && [ "$with_osx_sysroot" != "2" ]; then + if [ "$enable_universal" != "" ] && [ "$with_osx_sysroot" != "1" ] && [ "$with_osx_sysroot" != "2" ]; then # Sysroot manually specified? Check for usability log 1 "checking OSX sysroot... $with_osx_sysroot" if ! check_osx_sdk "$with_osx_sysroot"; then @@ -662,7 +654,7 @@ fi else # If autodetect and no universal, use system default - if [ "$with_osx_sysroot" = "1" ] && [ "$enable_universal" = "0" ]; then + if [ "$with_osx_sysroot" = "1" ] && [ "$enable_universal" = "" ]; then log 1 "checking OSX sysroot... no (use system default)" else log 1 "checking OSX sysroot... automatically" @@ -671,7 +663,7 @@ fi if [ -n "$osx_sdk_path" ]; then - if [ "$enable_universal" != "0" ]; then + if [ "$enable_universal" != "" ]; then if [ -z "$osx_sdk_104_path" ]; then log 1 "WARNING: Could not find a usable 10.4u SDK, the resulting" log 1 "WARNING: binary will only run on OSX 10.5 or later" @@ -942,10 +934,10 @@ fi if [ "$os" = "OSX" ]; then - # Test on G5 + # Test on ppc970 (G5) - we can optimize there if [ "$enable_osx_g5" != "0" ]; then - log 1 "detecting G5... yes (forced)" + log 1 "detecting ppc970 (G5)... yes (forced)" else # First, are we a real OSX system, else we can't detect it native=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | grep darwin` @@ -958,22 +950,22 @@ # This is G5, add flags for it enable_osx_g5="2" - log 1 "detecting G5... yes" + log 1 "detecting ppc970 (G5)... yes" else enable_osx_g5="0" - log 1 "detecting G5... no" + log 1 "detecting ppc970 (G5)... no" fi else enable_osx_g5="0" - log 1 "detecting G5... no (cross-compiling)" + log 1 "detecting ppc970 (G5)... no (cross-compiling)" fi fi else if [ "$enable_osx_g5" != "0" ]; then - log 1 "configure: error: OSX G5 selected, but not compiling for OSX" - log 1 "configure: error: either select OSX as OS, or deselect OSX G5" + log 1 "configure: error: ppc970 (OSX G5) selected, but not compiling for OSX" + log 1 "configure: error: either select OSX as OS, or deselect ppc970" exit 1 fi @@ -1379,19 +1371,19 @@ # Add macports include dir which is not always set a default system dir. This avoids zillions of bogus warnings. CFLAGS="$CFLAGS -isystem/opt/local/include" - if [ "$enable_dedicated" = "0" ] && ([ "$cpu_type" = "32" ] || [ "$enable_universal" != "0" ]); then + if [ "$enable_dedicated" = "0" ] && ([ "$cpu_type" = "32" ] || [ "$enable_universal" != "" ]); then LIBS="$LIBS -framework QuickTime" else CFLAGS="$CFLAGS -DNO_QUICKTIME" fi - if [ "$enable_universal" = "0" ]; then + if [ "$enable_universal" = "" ]; then # Universal builds set this elsewhere CFLAGS="$OSX_SYSROOT $CFLAGS" LDFLAGS="$OSX_LD_SYSROOT $LDFLAGS" fi - if [ "$enable_universal" = "0" ] && [ $cc_version -ge 40 ]; then + if [ "$enable_universal" = "" ] && [ $cc_version -ge 40 ]; then # Only set the min version when not doing an universal build. # Universal builds set the version elsewhere. if [ "$cpu_type" = "64" ]; then @@ -1491,7 +1483,7 @@ fi # 64bit machines need -D_SQ64 - if [ "$cpu_type" = "64" ] && [ "$enable_universal" = "0" ]; then + if [ "$cpu_type" = "64" ] && [ "$enable_universal" = "" ]; then CFLAGS="$CFLAGS -D_SQ64" fi if [ "$enable_ai" != "0" ]; then @@ -1873,7 +1865,7 @@ } check_lipo() { - if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then + if [ "$os" = "OSX" ] && [ "$enable_universal" != "" ]; then echo "int main(int argc, char *argv[]) { }" > lipo.test.c $cxx_host lipo.test.c -o lipo.test check_compiler "host lipo" "lipo" "$host" "$lipo" "$LIPO" "lipo" "lipo" "4" "-info lipo.test" @@ -2230,7 +2222,7 @@ # Check for the 10.5 SDK, but try 10.6 if that fails check_osx_sdk "10.5" || check_osx_sdk "10.6" || osx_sdk_path="" - if [ -z "$osx_sdk_path" ] || [ "$enable_universal" != "0" ]; then + if [ -z "$osx_sdk_path" ] || [ "$enable_universal" != "" ]; then # No better SDK or universal build enabled? Check 10.4u SDK as well local old_sdk="$osx_sdk_path" if check_osx_sdk "10.4u"; then @@ -2309,7 +2301,7 @@ fi # Assume QuickDraw is available when doing an universal build - if [ "$enable_universal" != "0" ]; then + if [ "$enable_universal" != "" ]; then log 1 "checking Quickdraw window subdriver... found" return 0 fi @@ -3176,45 +3168,53 @@ LDFLAGS="-Wl,-syslibroot,$osx_sdk_104_path $LDFLAGS_orig" fi - BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc" - cc_host="$cc_host_orig -arch ppc -mmacosx-version-min=10.3" - cxx_host="$cxx_host_orig -arch ppc -mmacosx-version-min=10.3" - generate_src_normal "[PowerPC]" "objs/ppc" - - BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc970" - cc_host="$cc_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt" - cxx_host="$cxx_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt" - generate_src_normal "[PowerPC G5]" "objs/ppc970" - - BASE_SRC_OBJS_DIR="$OBJS_DIR/intel" - cc_host="$cc_host_orig -arch i386 -mmacosx-version-min=10.4" - cxx_host="$cxx_host_orig -arch i386 -mmacosx-version-min=10.4" - generate_src_normal "[Intel]" "objs/intel" - - if [ "$enable_universal" = "64" ]; then - # 64 bits is always 10.5 or higher. Furthermore it has a broken ICONV - # and they also removed support for QuickTime/QuickDraw - if [ -n "$osx_sdk_path" ]; then - CFLAGS="-isysroot $osx_sdk_path $CFLAGS_orig" - LDFLAGS="-Wl,-syslibroot,$osx_sdk_path $LDFLAGS_orig" + for type in $enable_universal; do + + # We don't want to duplicate the x86_64 stuff for each target, so do it once here + if [ "$type" = "ppc64" ] || [ "$type" = "x86_64" ]; then + # 64 bits is always 10.5 or higher. Furthermore it has a broken ICONV + # and they also removed support for QuickTime/QuickDraw + if [ -n "$osx_sdk_path" ]; then + CFLAGS="-isysroot $osx_sdk_path $CFLAGS_orig" + LDFLAGS="-Wl,-syslibroot,$osx_sdk_path $LDFLAGS_orig" + fi + CFLAGS="$CFLAGS -D_SQ64 -DHAVE_BROKEN_ICONV -DNO_QUICKTIME -UENABLE_COCOA_QUICKDRAW" + LIBS="`echo $LIBS | sed 's/-framework QuickTime//'`" fi - CFLAGS="$CFLAGS -D_SQ64 -DHAVE_BROKEN_ICONV -DNO_QUICKTIME -UENABLE_COCOA_QUICKDRAW" - LIBS="`echo $LIBS | sed 's/-framework QuickTime//'`" - - BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc64" - cc_host="$cc_host_orig -arch ppc64 -mmacosx-version-min=10.5" - cxx_host="$cxx_host_orig -arch ppc64 -mmacosx-version-min=10.5" - generate_src_normal "[PowerPC 64 bits]" "objs/ppc64" - - BASE_SRC_OBJS_DIR="$OBJS_DIR/intel64" - cc_host="$cc_host_orig -arch x86_64 -mmacosx-version-min=10.5" - cxx_host="$cxx_host_orig -arch x86_64 -mmacosx-version-min=10.5" - generate_src_normal "[Intel 64 bits]" "objs/intel64" - fi + + case $type in + ppc) + BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc" + cc_host="$cc_host_orig -arch ppc -mmacosx-version-min=10.3" + cxx_host="$cxx_host_orig -arch ppc -mmacosx-version-min=10.3" + generate_src_normal "[ppc]" "objs/ppc";; + ppc970) + BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc970" + cc_host="$cc_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt" + cxx_host="$cxx_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt" + generate_src_normal "[ppc970]" "objs/ppc970";; + i386) + BASE_SRC_OBJS_DIR="$OBJS_DIR/i386" + cc_host="$cc_host_orig -arch i386 -mmacosx-version-min=10.4" + cxx_host="$cxx_host_orig -arch i386 -mmacosx-version-min=10.4" + generate_src_normal "[i386]" "objs/i386";; + ppc64) + BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc64" + cc_host="$cc_host_orig -arch ppc64 -mmacosx-version-min=10.5" + cxx_host="$cxx_host_orig -arch ppc64 -mmacosx-version-min=10.5" + generate_src_normal "[ppc64]" "objs/ppc64";; + x86_64) + BASE_SRC_OBJS_DIR="$OBJS_DIR/x86_64" + cc_host="$cc_host_orig -arch x86_64 -mmacosx-version-min=10.5" + cxx_host="$cxx_host_orig -arch x86_64 -mmacosx-version-min=10.5" + generate_src_normal "[x86_64]" "objs/x86_64";; + *) log 1 "Unknown architecture requested for universal build: $type";; + esac + done } generate_src() { - if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then + if [ "$os" = "OSX" ] && [ "$enable_universal" != "" ]; then generate_src_osx else generate_src_normal "[SRC]" "objs" @@ -3291,8 +3291,9 @@ echo " --enable-static enable static compile (doesn't work for" echo " all HOSTs)" echo " --enable-translator enable extra output for translators" - echo " --enable-universal enable universal builds (OSX ONLY)" - echo " --enable-osx-g5 enables optimizations for G5 (OSX ONLY)" + echo " --enable-universal[=TYPES] enable universal builds (OSX ONLY). Allowed is any combination" + echo " of TYPES (default="i386 ppc"): i386 ppc ppc970 ppc64 x86_64" + echo " --enable-osx-g5 enables optimizations for ppc970 (G5) (OSX ONLY)" echo " --disable-cocoa-quartz disable the quartz window mode driver for Cocoa (OSX ONLY)" echo " --disable-cocoa-quickdraw disable the quickdraw window mode driver for Cocoa (OSX ONLY)" echo " --disable-unicode disable unicode support to build win9x"