Allow passing the list of architectures to --enable-universal_binary.

Interpret --enable-universal_binary argument as a comma-separated list of
architectures to use. By default still use all the supported ones.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70705 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-02-27 01:47:32 +00:00
parent f04f570fd2
commit 33f270afac
3 changed files with 105 additions and 124 deletions

60
configure vendored
View File

@@ -1,5 +1,5 @@
#! /bin/sh
# From configure.in Id: configure.in 70353 2012-01-15 14:46:41Z VZ .
# From configure.in Id.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for wxWidgets 2.9.4.
#
@@ -1734,7 +1734,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 create universal binary with Mac PPC and i386 (and x86_64 if using Cocoa) architectures
--enable-universal_binary=archs create universal binary for the specified (or all supported) architectures
--enable-macosx_arch=ARCH build for just the specified architecture
--enable-compat26 enable wxWidgets 2.6 compatibility
--disable-compat28 disable wxWidgets 2.8 compatibility
@@ -19213,47 +19213,23 @@ if test "$wxUSE_MAC" = 1; then
retest_macosx_linking=no
OSX_ARCH_OPTS=""
if test "x$wxUSE_MAC_ARCH" != xno; then
OSX_ARCH_OPTS="-arch $wxUSE_MAC_ARCH"
fi
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 behaviour 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
if test "x$wxUSE_MAC_ARCH" != xno; then
{ echo "$as_me:$LINENO: WARNING: --enable-macosx_arch is ignored when --enable-universal_binary is used." >&5
echo "$as_me: WARNING: --enable-macosx_arch is ignored when --enable-universal_binary is used." >&2;}
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_ARCH_OPTS="-arch ppc -arch i386"
if test "x$wxUSE_UNIVERSAL_BINARY" != xyes; then
OSX_ARCH_OPTS=$wxUSE_UNIVERSAL_BINARY
else OSX_ARCH_OPTS="ppc,i386"
if test "$wxUSE_OSX_COCOA" = 1; then
OSX_ARCH_OPTS="$OSX_ARCH_OPTS -arch x86_64"
OSX_ARCH_OPTS="$OSX_ARCH_OPTS,x86_64"
fi
{ echo "$as_me:$LINENO: checking for universal binary architectures" >&5
echo $ECHO_N "checking for universal binary architectures... $ECHO_C" >&6; }
fi
{ echo "$as_me:$LINENO: checking for architectures to use in universal binary" >&5
echo $ECHO_N "checking for architectures to use in universal binary... $ECHO_C" >&6; }
{ echo "$as_me:$LINENO: result: $OSX_ARCH_OPTS" >&5
echo "${ECHO_T}$OSX_ARCH_OPTS" >&6; }
@@ -19262,13 +19238,21 @@ echo "${ECHO_T}$OSX_ARCH_OPTS" >&6; }
{ 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
else
if test "x$wxUSE_MAC_ARCH" != xno; then
OSX_ARCH_OPTS=$wxUSE_MAC_ARCH
fi
fi
if test "x$OSX_ARCH_OPTS" != "x"; then
OSX_ARCH_OPTS=`echo $OSX_ARCH_OPTS | sed -e 's/^/-arch /' -e 's/,/ -arch /g'`
CXXFLAGS="$OSX_ARCH_OPTS $CXXFLAGS"
CFLAGS="$OSX_ARCH_OPTS $CFLAGS"
OBJCXXFLAGS="$OSX_ARCH_OPTS $OBJCXXFLAGS"
OBJCFLAGS="$OSX_ARCH_OPTS $OBJCFLAGS"
LDFLAGS="$OSX_ARCH_OPTS $LDFLAGS"
fi
if test "x$wxUSE_MACOSX_SDK" = "xno"; then
wxUSE_MACOSX_SDK=

View File

@@ -728,7 +728,7 @@ WX_ARG_ENABLE(permissive, [ --enable-permissive compile code disregardin
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 create universal binary with Mac PPC and i386 (and x86_64 if using Cocoa) architectures ]], wxUSE_UNIVERSAL_BINARY)
WX_ARG_ENABLE_PARAM(universal_binary, [[ --enable-universal_binary=archs create universal binary for the specified (or all supported) architectures]], wxUSE_UNIVERSAL_BINARY)
WX_ARG_ENABLE_PARAM(macosx_arch, [[ --enable-macosx_arch=ARCH build for just the specified architecture]], wxUSE_MAC_ARCH)
WX_ARG_ENABLE(compat26, [ --enable-compat26 enable wxWidgets 2.6 compatibility], WXWIN_COMPATIBILITY_2_6)
@@ -1147,44 +1147,26 @@ if test "$wxUSE_MAC" = 1; then
retest_macosx_linking=no
OSX_ARCH_OPTS=""
dnl Deal with architecture selection. By default, we compile for the current
dnl architecture, whatever it is. With --enable-universal_binary the list of
dnl architectures can be explicitly specified. If it isn't, we compile for all
dnl supported ones.
if test "x$wxUSE_UNIVERSAL_BINARY" != xno ; then
if test "x$wxUSE_MAC_ARCH" != xno; then
OSX_ARCH_OPTS="-arch $wxUSE_MAC_ARCH"
AC_MSG_WARN([--enable-macosx_arch is ignored when --enable-universal_binary is used.])
fi
dnl Support the old --enable-universal_binary in case anyone was using it.
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 behaviour 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_ARCH_OPTS="-arch ppc -arch i386"
if test "x$wxUSE_UNIVERSAL_BINARY" != xyes; then
OSX_ARCH_OPTS=$wxUSE_UNIVERSAL_BINARY
else dnl Use all architectures supported
OSX_ARCH_OPTS="ppc,i386"
if test "$wxUSE_OSX_COCOA" = 1; then
OSX_ARCH_OPTS="$OSX_ARCH_OPTS -arch x86_64"
OSX_ARCH_OPTS="$OSX_ARCH_OPTS,x86_64"
fi
AC_MSG_CHECKING([for universal binary architectures])
fi
AC_MSG_CHECKING([for architectures to use in universal binary])
AC_MSG_RESULT([$OSX_ARCH_OPTS])
dnl NOTE: Only the compiler driver needs arch flags. The link editor
@@ -1208,13 +1190,21 @@ dnl Support the old --enable-universal_binary in case anyone was using it.
dnl Objective-C++ precompiled headers.
AC_MSG_WARN([Disabling precompiled headers due to universal binary build.])
bk_use_pch=no
else
if test "x$wxUSE_MAC_ARCH" != xno; then
OSX_ARCH_OPTS=$wxUSE_MAC_ARCH
fi
fi
if test "x$OSX_ARCH_OPTS" != "x"; then
OSX_ARCH_OPTS=`echo $OSX_ARCH_OPTS | sed -e 's/^/-arch /' -e 's/,/ -arch /g'`
CXXFLAGS="$OSX_ARCH_OPTS $CXXFLAGS"
CFLAGS="$OSX_ARCH_OPTS $CFLAGS"
OBJCXXFLAGS="$OSX_ARCH_OPTS $OBJCXXFLAGS"
OBJCFLAGS="$OSX_ARCH_OPTS $OBJCFLAGS"
LDFLAGS="$OSX_ARCH_OPTS $LDFLAGS"
fi
dnl Set up the Mac OS X SDK. We do this early so configure tests will occur
dnl with the SDK in place.

View File

@@ -116,9 +116,16 @@ The Xcode projects for the wxWidgets library and minimal project are set up
to create universal binaries.
If using the Apple command line tools, pass --enable-universal_binary when
configuring wxWidgets. If you use wx-config --libs to link your application,
he necessary linker flags will be added. When compiling your own files,
you need to add -arch ppc -arch i386 to your CFLAGS.
configuring wxWidgets. This will create the libraries for all the supported
architectures, currently ppc, i386 and x86_64 when using Cocoa (Carbon isn't
available in 64 bit builds). You may explicitly specify the architectures to
use as a comma-separated list, e.g. --enable-universal_binary=i386,x86_64.
Notice that if you use wx-config --libs to link your application, the -arch
flags are not added automatically as it is possible to link e.g. x86_64-only
program to a "fat" library containing other architectures. If you want to
build a universal application, you need to add the necessary "-arch xxx" flags
to your project or makefile separately.
As an alternative to using --enable-universal_binary, you can build for
each architecture separately and then use the lipo tool to glue the