From b4e05bddd758d4097d7faae44d3327f4457f4418 Mon Sep 17 00:00:00 2001 From: David Elliott Date: Fri, 27 Jul 2007 03:38:33 +0000 Subject: [PATCH] Implement --with-macosx-sdk[=SDK] and --with-macosx-version-min[=VER]. Deprecate --enable-universal_binary but support it by adding the -arch flags as before and automatically setting the SDK using the new --with-macosx-sdk. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47742 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 309 +++++++++++++++++++++++++++++++++++++++++++++++---- configure.in | 199 ++++++++++++++++++++++++++++----- 2 files changed, 462 insertions(+), 46 deletions(-) diff --git a/configure b/configure index 74940456e4..9403903cb3 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in 47631 2007-07-21 23:22:56Z VZ . +# From configure.in Id: configure.in 47734 2007-07-26 16:27:29Z VZ . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for wxWidgets 2.9.0. # @@ -1666,7 +1666,7 @@ Optional Features: --enable-permissive compile code disregarding strict ANSI --enable-no_deps create code without dependency information --disable-vararg_macros don't use vararg macros, even if they are supported - --enable-universal_binary[=SDK] create Mac PowerPC and Intel Universal binary (not yet working) + --enable-universal_binary create Mac PowerPC and Intel Universal binary (not yet working) --enable-compat26 enable wxWidgets 2.6 compatibility --disable-compat28 disable wxWidgets 2.8 compatibility --disable-rpath disable use of rpath for uninstalled builds @@ -1895,6 +1895,8 @@ Optional Packages: --with-zlib use zlib for LZW compression --with-odbc use the IODBC and wxODBC classes --with-expat enable XML support using expat parser + --with-macosx-sdk=PATH use an OS X SDK at PATH + --with-macosx-version-min=VER build binaries which require at least this OS X version --with-gtk-prefix=PFX Prefix where GTK is installed (optional) --with-gtk-exec-prefix=PFX Exec prefix where GTK is installed (optional) --with-x use the X Window System @@ -4402,6 +4404,59 @@ echo "$as_me: error: Invalid value for --with-expat: should be yes, no, sys, or fi +{ echo "$as_me:$LINENO: checking for --with-macosx-sdk" >&5 +echo $ECHO_N "checking for --with-macosx-sdk... $ECHO_C" >&6; } + +# Check whether --with-macosx-sdk was given. +if test "${with_macosx_sdk+set}" = set; then + withval=$with_macosx_sdk; + wxUSE_MACOSX_SDK=$withval + wx_cv_use_macosx_sdk="wxUSE_MACOSX_SDK=$withval" + echo "wxUSE_MACOSX_SDK=$wxUSE_MACOSX_SDK" >> ${wx_arg_cache_file}.tmp + +else + + # NOTE: Empty string on purpose so that --without-macosx-sdk (thus no) + # will override --enable-universal_binary's automatic SDK usage. + wxUSE_MACOSX_SDK= + LINE=`grep "^wxUSE_MACOSX_SDK=" ${wx_arg_cache_file}` + if test "x$LINE" != x ; then + eval "$LINE" + echo "$LINE" >> ${wx_arg_cache_file}.tmp + fi + +fi + +{ echo "$as_me:$LINENO: result: $wxUSE_MACOSX_SDK" >&5 +echo "${ECHO_T}$wxUSE_MACOSX_SDK" >&6; } + +{ echo "$as_me:$LINENO: checking for --with-macosx-version-min" >&5 +echo $ECHO_N "checking for --with-macosx-version-min... $ECHO_C" >&6; } + +# Check whether --with-macosx-version-min was given. +if test "${with_macosx_version_min+set}" = set; then + withval=$with_macosx_version_min; + wxUSE_MACOSX_VERSION_MIN=$withval + wx_cv_use_macosx_version_min="wxUSE_MACOSX_VERSION_MIN=$withval" + echo "wxUSE_MACOSX_VERSION_MIN=$wxUSE_MACOSX_VERSION_MIN" >> ${wx_arg_cache_file}.tmp + +else + + # default "yes" because when not using an SDK it means the same as no + # but when using an SDK it means to use the SDK version + wxUSE_MACOSX_VERSION_MIN=yes + # See if there is a value in the cache + LINE=`grep "^wxUSE_MACOSX_VERSION_MIN=" ${wx_arg_cache_file}` + if test "x$LINE" != x ; then + eval "$LINE" + echo "$LINE" >> ${wx_arg_cache_file}.tmp + fi + +fi + +{ echo "$as_me:$LINENO: result: $wxUSE_MACOSX_VERSION_MIN" >&5 +echo "${ECHO_T}$wxUSE_MACOSX_VERSION_MIN" >&6; } + enablestring=disable @@ -19903,6 +19958,239 @@ case ${INSTALL} in INSTALL=`pwd`/${INSTALL} ;; esac +retest_macosx_linking=no + +#if test "$wxUSE_MAC" = 1; then + if test "x$wxUSE_UNIVERSAL_BINARY" != xno ; then + if test "x$wxUSE_UNIVERSAL_BINARY" == xyes; then + # Implicitly turn on the new --with-macosx-sdk using the default + # SDK which provides the behavior this option has always had. + if test "x$wxUSE_MACOSX_SDK" = "x"; then + { echo "$as_me:$LINENO: WARNING: Enabling default SDK due to --enable-universal_binary." >&5 +echo "$as_me: WARNING: Enabling default SDK due to --enable-universal_binary." >&2;} + { echo "$as_me:$LINENO: WARNING: If you don't want this, specify --without-macosx-sdk" >&5 +echo "$as_me: WARNING: If you don't want this, specify --without-macosx-sdk" >&2;} + wxUSE_MACOSX_SDK=yes + fi + else + # Complain to user if he specified an argument to --enable-universal_binary + # and also 1) specified --with-macosx-sdk using the default (yes) or + # 2) specified --with-macosx-sdk using a path or 3) specified + # --without-macosx-sdk (no). + if test "x$wxUSE_MACOSX_SDK" != "x" ; then + { { echo "$as_me:$LINENO: error: Please specify the new --with-macosx-sdk=PATH and do not specify an arg to --enable-universal_binary +See \`config.log' for more details." >&5 +echo "$as_me: error: Please specify the new --with-macosx-sdk=PATH and do not specify an arg to --enable-universal_binary +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + else + # Put the SDK path into the wxUSE_MACOSX_SDK. We don't have to + # special-case the empty string because the below test simply + # converts "no" to the empty string anyway. + wxUSE_MACOSX_SDK="$wxUSE_UNIVERSAL_BINARY" + { echo "$as_me:$LINENO: WARNING: Please use --with-macosx-sdk=PATH and --enable-universal_binary without an argument" >&5 +echo "$as_me: WARNING: Please use --with-macosx-sdk=PATH and --enable-universal_binary without an argument" >&2;} + fi + fi + OSX_UNIV_OPTS="-arch ppc -arch i386" + CXXFLAGS="$OSX_UNIV_OPTS $CXXFLAGS" + CFLAGS="$OSX_UNIV_OPTS $CFLAGS" + LDFLAGS="$OSX_UNIV_OPTS $LDFLAGS" + retest_macosx_linking=yes + + { echo "$as_me:$LINENO: WARNING: Disabling precompiled headers due to universal binary build." >&5 +echo "$as_me: WARNING: Disabling precompiled headers due to universal binary build." >&2;} + bk_use_pch=no + fi +#fi + +if test "x$wxUSE_MACOSX_SDK" = "xno"; then + wxUSE_MACOSX_SDK= +elif test "x$wxUSE_MACOSX_SDK" = "xyes"; then + # TODO: Search for most recent SDK and use it. + wxUSE_MACOSX_SDK="/Developer/SDKs/MacOSX10.4u.sdk" +fi + + +if test "x$wxUSE_MACOSX_SDK" != "x"; then + { echo "$as_me:$LINENO: checking for SDK directory $wxUSE_MACOSX_SDK" >&5 +echo $ECHO_N "checking for SDK directory $wxUSE_MACOSX_SDK... $ECHO_C" >&6; } + if ! test -d "$wxUSE_MACOSX_SDK"; then + { { echo "$as_me:$LINENO: error: not found +See \`config.log' for more details." >&5 +echo "$as_me: error: not found +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: result: exists" >&5 +echo "${ECHO_T}exists" >&6; } + fi + MACOSX_SDK_OPTS="-isysroot $wxUSE_MACOSX_SDK" + eval "CC=\"$CC $MACOSX_SDK_OPTS\"" + eval "CXX=\"$CXX $MACOSX_SDK_OPTS\"" + eval "LD=\"$LD $MACOSX_SDK_OPTS\"" + retest_macosx_linking=yes + fi + +if test "x$wxUSE_MACOSX_VERSION_MIN" = "xno"; then + wxUSE_MACOSX_VERSION_MIN= +elif test "x$wxUSE_MACOSX_VERSION_MIN" = "xyes"; then + if test "x$wxUSE_MACOSX_SDK" != "x"; then + { echo "$as_me:$LINENO: checking SDK deployment version" >&5 +echo $ECHO_N "checking SDK deployment version... $ECHO_C" >&6; } + + MACOSX_SDK_PLIST_VERSION_MIN=`defaults read "$wxUSE_MACOSX_SDK/SDKSettings" buildSettings | grep '^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}[^"]*"\{0,1\}; *$' | sed 's/^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}\([^"]*\)"\{0,1\} *; *$/\1/'` + + if test "x$MACOSX_SDK_PLIST_VERSION_MIN" != "x"; then + wxUSE_MACOSX_VERSION_MIN=$MACOSX_SDK_PLIST_VERSION_MIN + { echo "$as_me:$LINENO: result: $wxUSE_MACOSX_VERSION_MIN" >&5 +echo "${ECHO_T}$wxUSE_MACOSX_VERSION_MIN" >&6; } + else + { echo "$as_me:$LINENO: WARNING: Could not determine deployment target from SDKSettings.plist" >&5 +echo "$as_me: WARNING: Could not determine deployment target from SDKSettings.plist" >&2;} + wxUSE_MACOSX_VERSION_MIN= + fi + else + wxUSE_MACOSX_VERSION_MIN= + fi +fi + +if test "x$wxUSE_MACOSX_VERSION_MIN" != "x"; then + MACOSX_VERSION_MIN_OPTS="-mmacosx-version-min=$wxUSE_MACOSX_VERSION_MIN" + eval "CC=\"$CC $MACOSX_VERSION_MIN_OPTS\"" + eval "CXX=\"$CXX $MACOSX_VERSION_MIN_OPTS\"" + eval "LD=\"$LD $MACOSX_VERSION_MIN_OPTS\"" + retest_macosx_linking=yes +fi + +if test "x$retest_macosx_linking" = "xyes"; then + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + { echo "$as_me:$LINENO: checking if C compiler works with SDK/version options" >&5 +echo $ECHO_N "checking if C compiler works with SDK/version options... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { { echo "$as_me:$LINENO: error: no. Try a different SDK +See \`config.log' for more details." >&5 +echo "$as_me: error: no. Try a different SDK +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; exit 1 +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + { echo "$as_me:$LINENO: checking if C++ compiler works with SDK/version options" >&5 +echo $ECHO_N "checking if C++ compiler works with SDK/version options... $ECHO_C" >&6; } + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_cxx_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { { echo "$as_me:$LINENO: error: no. Try a different SDK +See \`config.log' for more details." >&5 +echo "$as_me: error: no. Try a different SDK +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; exit 1 +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi + case "${host}" in @@ -49729,23 +50017,6 @@ if test "$wxUSE_WINE" = "yes"; then BAKEFILE_FORCE_PLATFORM=win32 fi -if test "$wxUSE_MAC" = 1 ; then - if test "x$wxUSE_UNIVERSAL_BINARY" != xno ; then - if test "x$wxUSE_UNIVERSAL_BINARY" == xyes; then - OSX_UNIV_OPTS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk" - else - OSX_UNIV_OPTS=${wxUSE_UNIVERSAL_BINARY:+"-isysroot '$wxUSE_UNIVERSAL_BINARY'"} - fi - OSX_UNIV_OPTS="$OSX_UNIV_OPTS -arch ppc -arch i386" - CXXFLAGS="$OSX_UNIV_OPTS $CXXFLAGS" - CFLAGS="$OSX_UNIV_OPTS $CFLAGS" - LDFLAGS="$OSX_UNIV_OPTS $LDFLAGS" - bk_use_pch=no - fi - # TODO: where do we add "-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk" for libtool (static builds only)? - # The makefile currently uses AR and RANLIB, which libtool apparently supercedes. -fi - if test "$wxUSE_UNICODE" = yes -a "$GCC" = yes -a "$bk_use_pch" != no then { echo "$as_me:$LINENO: checking for gcc precompiled header bug" >&5 diff --git a/configure.in b/configure.in index 4372b556b4..cb74a99908 100644 --- a/configure.in +++ b/configure.in @@ -510,6 +510,41 @@ WX_ARG_SYS_WITH(zlib, [ --with-zlib use zlib for LZW compressi WX_ARG_SYS_WITH(odbc, [ --with-odbc use the IODBC and wxODBC classes], wxUSE_ODBC) WX_ARG_SYS_WITH(expat, [ --with-expat enable XML support using expat parser], wxUSE_EXPAT) +AC_MSG_CHECKING([for --with-macosx-sdk]) +AC_ARG_WITH(macosx-sdk, [ --with-macosx-sdk=PATH use an OS X SDK at PATH], [ + wxUSE_MACOSX_SDK=$withval + wx_cv_use_macosx_sdk="wxUSE_MACOSX_SDK=$withval" + echo "wxUSE_MACOSX_SDK=$wxUSE_MACOSX_SDK" >> ${wx_arg_cache_file}.tmp + ], [ + # NOTE: Empty string on purpose so that --without-macosx-sdk (thus no) + # will override --enable-universal_binary's automatic SDK usage. + wxUSE_MACOSX_SDK= + LINE=`grep "^wxUSE_MACOSX_SDK=" ${wx_arg_cache_file}` + if test "x$LINE" != x ; then + eval "$LINE" + echo "$LINE" >> ${wx_arg_cache_file}.tmp + fi + ]) +AC_MSG_RESULT([$wxUSE_MACOSX_SDK]) + +AC_MSG_CHECKING([for --with-macosx-version-min]) +AC_ARG_WITH(macosx-version-min, [ --with-macosx-version-min=VER build binaries which require at least this OS X version], [ + wxUSE_MACOSX_VERSION_MIN=$withval + wx_cv_use_macosx_version_min="wxUSE_MACOSX_VERSION_MIN=$withval" + echo "wxUSE_MACOSX_VERSION_MIN=$wxUSE_MACOSX_VERSION_MIN" >> ${wx_arg_cache_file}.tmp + ], [ + # default "yes" because when not using an SDK it means the same as no + # but when using an SDK it means to use the SDK version + wxUSE_MACOSX_VERSION_MIN=yes + # See if there is a value in the cache + LINE=`grep "^wxUSE_MACOSX_VERSION_MIN=" ${wx_arg_cache_file}` + if test "x$LINE" != x ; then + eval "$LINE" + echo "$LINE" >> ${wx_arg_cache_file}.tmp + fi + ]) +AC_MSG_RESULT([$wxUSE_MACOSX_VERSION_MIN]) + dnl --------------------------------------------------------------------------- dnl global compile options dnl --------------------------------------------------------------------------- @@ -551,7 +586,7 @@ WX_ARG_ENABLE(no_exceptions, [ --enable-no_exceptions create code without C++ WX_ARG_ENABLE(permissive, [ --enable-permissive compile code disregarding strict ANSI], wxUSE_PERMISSIVE) WX_ARG_ENABLE(no_deps, [ --enable-no_deps create code without dependency information], wxUSE_NO_DEPS) WX_ARG_DISABLE(vararg_macros,[ --disable-vararg_macros don't use vararg macros, even if they are supported], wxUSE_VARARG_MACROS) -WX_ARG_ENABLE_PARAM(universal_binary, [[ --enable-universal_binary[=SDK] create Mac PowerPC and Intel Universal binary (not yet working)]], wxUSE_UNIVERSAL_BINARY) +WX_ARG_ENABLE_PARAM(universal_binary, [[ --enable-universal_binary create Mac PowerPC and Intel Universal binary (not yet working)]], wxUSE_UNIVERSAL_BINARY) WX_ARG_ENABLE(compat26, [ --enable-compat26 enable wxWidgets 2.6 compatibility], WXWIN_COMPATIBILITY_2_6) WX_ARG_DISABLE(compat28, [ --disable-compat28 disable wxWidgets 2.8 compatibility], WXWIN_COMPATIBILITY_2_8) @@ -1092,6 +1127,142 @@ case ${INSTALL} in INSTALL=`pwd`/${INSTALL} ;; esac +retest_macosx_linking=no + +dnl Support the old --enable-universal_binary in case anyone was using it. +#if test "$wxUSE_MAC" = 1; then + if test "x$wxUSE_UNIVERSAL_BINARY" != xno ; then + dnl --enable-universal_binary uses a default SDK (currently 10.4u) + dnl --enable-universal_binary=SDK names a path to an SDK + if test "x$wxUSE_UNIVERSAL_BINARY" == xyes; then + # Implicitly turn on the new --with-macosx-sdk using the default + # SDK which provides the behavior this option has always had. + if test "x$wxUSE_MACOSX_SDK" = "x"; then + AC_MSG_WARN([Enabling default SDK due to --enable-universal_binary.]) + AC_MSG_WARN([If you don't want this, specify --without-macosx-sdk]) + wxUSE_MACOSX_SDK=yes + fi + else + # Complain to user if he specified an argument to --enable-universal_binary + # and also 1) specified --with-macosx-sdk using the default (yes) or + # 2) specified --with-macosx-sdk using a path or 3) specified + # --without-macosx-sdk (no). + if test "x$wxUSE_MACOSX_SDK" != "x" ; then + AC_MSG_FAILURE([Please specify the new --with-macosx-sdk=PATH and do not specify an arg to --enable-universal_binary]) + else + # Put the SDK path into the wxUSE_MACOSX_SDK. We don't have to + # special-case the empty string because the below test simply + # converts "no" to the empty string anyway. + wxUSE_MACOSX_SDK="$wxUSE_UNIVERSAL_BINARY" + dnl Warn about deprecated usage. + AC_MSG_WARN([Please use --with-macosx-sdk=PATH and --enable-universal_binary without an argument]) + fi + fi + dnl FIXME: I think it would be better to put this into CC, CXX, and LD rather than the flags. + OSX_UNIV_OPTS="-arch ppc -arch i386" + CXXFLAGS="$OSX_UNIV_OPTS $CXXFLAGS" + CFLAGS="$OSX_UNIV_OPTS $CFLAGS" + LDFLAGS="$OSX_UNIV_OPTS $LDFLAGS" + dnl NOTE: Only the compiler driver needs arch flags. The link editor + dnl is incapable of using them but the compiler driver (which we use + dnl as LD when building dynamic libraries) uses them to invoke the + dnl real ld multiple times. If we moved to libtool -dynamic we would + dnl need no arch flags because libtool automatically invokes ld for + dnl every architecture found in the fat input files. + dnl + dnl For static library builds, AR/RANLIB automatically create proper + dnl fat archives although AR is unable to update them once RANLIB has + dnl made them into proper fat archives. Fortunately, our link process + dnl simply removes the .a file before using ar to create a new one. + dnl If we did move to libtool -static we still wouldn't need arch flags + dnl because libtool automatically figures it out based on input. + retest_macosx_linking=yes + + dnl HACK: PCH could be made to work by precompiling for each architecture into separate directories + dnl and including all architecture directories with each compiler invocation. + dnl That would require a major rework of Bakefile and at the same time it would be nice to have + dnl Objective-C++ precompiled headers. + AC_MSG_WARN([Disabling precompiled headers due to universal binary build.]) + bk_use_pch=no + fi +#fi + +dnl Set up the Mac OS X SDK. We do this early so configure tests will occur +dnl with the SDK in place. +dnl NOTE: We clobber wxUSE_MACOSX_SDK with the SDK path +if test "x$wxUSE_MACOSX_SDK" = "xno"; then + wxUSE_MACOSX_SDK= +elif test "x$wxUSE_MACOSX_SDK" = "xyes"; then + # TODO: Search for most recent SDK and use it. + wxUSE_MACOSX_SDK="/Developer/SDKs/MacOSX10.4u.sdk" +fi + + +if test "x$wxUSE_MACOSX_SDK" != "x"; then + AC_MSG_CHECKING([for SDK directory $wxUSE_MACOSX_SDK]) + if ! test -d "$wxUSE_MACOSX_SDK"; then + AC_MSG_FAILURE([not found]) + else + AC_MSG_RESULT([exists]) + fi + MACOSX_SDK_OPTS="-isysroot $wxUSE_MACOSX_SDK" + eval "CC=\"$CC $MACOSX_SDK_OPTS\"" + eval "CXX=\"$CXX $MACOSX_SDK_OPTS\"" + eval "LD=\"$LD $MACOSX_SDK_OPTS\"" + retest_macosx_linking=yes + dnl NOTE: When libtool is used in lieu of AR/RANLIB (i.e. in static mode) + dnl the syslibroot makes no difference. We aren't using libtool now but + dnl if we ever did, be aware that you don't need to worry about it. +fi + +dnl Set up the deployment target +dnl No : Don't specify a min version even if using an SDK +dnl Yes : Use the version from the SDK if used, otherwise same as no +dnl Param: Use the specified version +if test "x$wxUSE_MACOSX_VERSION_MIN" = "xno"; then + wxUSE_MACOSX_VERSION_MIN= +elif test "x$wxUSE_MACOSX_VERSION_MIN" = "xyes"; then + if test "x$wxUSE_MACOSX_SDK" != "x"; then + AC_MSG_CHECKING([SDK deployment version]) +dnl We need to quote the next line where we don't need macros and do need [] in the regex +[ + MACOSX_SDK_PLIST_VERSION_MIN=`defaults read "$wxUSE_MACOSX_SDK/SDKSettings" buildSettings | grep '^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}[^"]*"\{0,1\}; *$' | sed 's/^ *"\{0,1\}MACOSX_DEPLOYMENT_TARGET"\{0,1\} *= *"\{0,1\}\([^"]*\)"\{0,1\} *; *$/\1/'` +] + if test "x$MACOSX_SDK_PLIST_VERSION_MIN" != "x"; then + wxUSE_MACOSX_VERSION_MIN=$MACOSX_SDK_PLIST_VERSION_MIN + AC_MSG_RESULT([$wxUSE_MACOSX_VERSION_MIN]) + else + AC_MSG_WARN([Could not determine deployment target from SDKSettings.plist]) + wxUSE_MACOSX_VERSION_MIN= + fi + else + wxUSE_MACOSX_VERSION_MIN= + fi +fi + +if test "x$wxUSE_MACOSX_VERSION_MIN" != "x"; then + MACOSX_VERSION_MIN_OPTS="-mmacosx-version-min=$wxUSE_MACOSX_VERSION_MIN" + eval "CC=\"$CC $MACOSX_VERSION_MIN_OPTS\"" + eval "CXX=\"$CXX $MACOSX_VERSION_MIN_OPTS\"" + eval "LD=\"$LD $MACOSX_VERSION_MIN_OPTS\"" + retest_macosx_linking=yes +fi + +dnl If either an SDK or a version option was added, make sure that we can +dnl still compile and link both C and C++. If we didn't do this, then most +dnl of the remaining tests would fail. +if test "x$retest_macosx_linking" = "xyes"; then + AC_LANG_PUSH(C) + AC_MSG_CHECKING([if C compiler works with SDK/version options]) + AC_TRY_LINK([],[],[AC_MSG_RESULT([yes])],[AC_MSG_FAILURE([no. Try a different SDK]); exit 1]) + AC_LANG_POP() + + AC_LANG_PUSH(C++) + AC_MSG_CHECKING([if C++ compiler works with SDK/version options]) + AC_TRY_LINK([],[],[AC_MSG_RESULT([yes])],[AC_MSG_FAILURE([no. Try a different SDK]); exit 1]) + AC_LANG_POP() +fi + case "${host}" in @@ -7561,32 +7732,6 @@ if test "$wxUSE_WINE" = "yes"; then BAKEFILE_FORCE_PLATFORM=win32 fi -dnl --------------------------------------------------------------------------- -dnl Add Universal binary support -dnl Note we don't do this earlier because adding these cpp/ld flags could -dnl cause configure tests to fail. -dnl --------------------------------------------------------------------------- -if test "$wxUSE_MAC" = 1 ; then - if test "x$wxUSE_UNIVERSAL_BINARY" != xno ; then - dnl --enable-universal_binary uses a default SDK (currently 10.4u) - dnl --enable-universal_binary=SDK names a path to an SDK - if test "x$wxUSE_UNIVERSAL_BINARY" == xyes; then - OSX_UNIV_OPTS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk" - else - dnl '' would mean universal with no SDK, which may be the case if - dnl the compiler uses a sysroot by default - OSX_UNIV_OPTS=${wxUSE_UNIVERSAL_BINARY:+"-isysroot '$wxUSE_UNIVERSAL_BINARY'"} - fi - OSX_UNIV_OPTS="$OSX_UNIV_OPTS -arch ppc -arch i386" - CXXFLAGS="$OSX_UNIV_OPTS $CXXFLAGS" - CFLAGS="$OSX_UNIV_OPTS $CFLAGS" - LDFLAGS="$OSX_UNIV_OPTS $LDFLAGS" - bk_use_pch=no - fi - # TODO: where do we add "-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk" for libtool (static builds only)? - # The makefile currently uses AR and RANLIB, which libtool apparently supercedes. -fi - dnl gcc 3.4 has a pch bug which truncates wide character constants in headers. dnl Hopefully for a non-unicode build there aren't any wide constants in dnl headers, but for a unicode build it's best to disable pch. -- 2.45.2