Merged 47742 from trunk:
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/branches/WX_2_8_BRANCH@48434 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
199
configure.in
199
configure.in
@@ -904,6 +904,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 compile options
|
||||
dnl ---------------------------------------------------------------------------
|
||||
@@ -938,7 +973,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_ENABLE(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(compat24, [ --enable-compat24 enable wxWidgets 2.4 compatibility], WXWIN_COMPATIBILITY_2_4, enable)
|
||||
WX_ARG_ENABLE(compat26, [ --disable-compat26 disable wxWidgets 2.6 compatibility], WXWIN_COMPATIBILITY_2_6, disable)
|
||||
@@ -1506,6 +1541,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
|
||||
|
||||
@@ -7859,32 +8030,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.
|
||||
|
Reference in New Issue
Block a user