From 80367c29a9334496a8dce35a9b4fd1f903e41f8e Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 23 Sep 2010 20:54:54 +0000 Subject: [PATCH] Add flag to enable specifying an architecture to build on Mac. Also add x86_64 architecture to universal build when buildng wxOSX-Cocoa git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65620 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 80 +++++++++++++++++++++++++++++++++++++++++++----------------- configure.in | 29 ++++++++++++++++------ 2 files changed, 79 insertions(+), 30 deletions(-) diff --git a/configure b/configure index 0762d7d..edbaf08 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id. +# From configure.in Id: configure.in 65489 2010-09-09 20:59:10Z VZ . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for wxWidgets 2.9.2. # @@ -1705,7 +1705,8 @@ 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 Mac PowerPC and Intel Universal binary + --enable-universal_binary create universal binary with Mac PPC and i386 (and x86_64 if using Cocoa) 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 --disable-rpath disable use of rpath for uninstalled builds @@ -2989,6 +2990,7 @@ DEFAULT_wxUSE_COMPILER_TLS=auto DEFAULT_wxUSE_UNICODE_UTF8_LOCALE=no DEFAULT_wxUSE_UNIVERSAL_BINARY=no +DEFAULT_wxUSE_MAC_ARCH=no DEFAULT_wxUSE_OFFICIAL_BUILD=no @@ -5410,6 +5412,7 @@ fi echo "${ECHO_T}$result" >&6; } + enablestring= { echo "$as_me:$LINENO: checking for --${enablestring:-enable}-universal_binary" >&5 echo $ECHO_N "checking for --${enablestring:-enable}-universal_binary... $ECHO_C" >&6; } @@ -5431,6 +5434,27 @@ fi echo "${ECHO_T}$wxUSE_UNIVERSAL_BINARY" >&6; } + enablestring= + { echo "$as_me:$LINENO: checking for --${enablestring:-enable}-macosx_arch" >&5 +echo $ECHO_N "checking for --${enablestring:-enable}-macosx_arch... $ECHO_C" >&6; } + # Check whether --enable-macosx_arch was given. +if test "${enable_macosx_arch+set}" = set; then + enableval=$enable_macosx_arch; + wx_cv_use_macosx_arch="wxUSE_MAC_ARCH='$enableval'" + +else + + wx_cv_use_macosx_arch='wxUSE_MAC_ARCH='$DEFAULT_wxUSE_MAC_ARCH + +fi + + + eval "$wx_cv_use_macosx_arch" + + { echo "$as_me:$LINENO: result: $wxUSE_MAC_ARCH" >&5 +echo "${ECHO_T}$wxUSE_MAC_ARCH" >&6; } + + enablestring= defaultval= @@ -16934,7 +16958,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | else ac_cv_prog_gcc_traditional=no fi -rm -f conftest* +rm -f -r conftest* if test $ac_cv_prog_gcc_traditional = no; then @@ -16951,7 +16975,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes fi -rm -f conftest* +rm -f -r conftest* fi fi @@ -18548,6 +18572,11 @@ 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 @@ -18579,12 +18608,15 @@ See \`config.log' for more details." >&2;} 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" - OBJCXXFLAGS="$OSX_UNIV_OPTS $OBJCXXFLAGS" - OBJCFLAGS="$OSX_UNIV_OPTS $OBJCFLAGS" - LDFLAGS="$OSX_UNIV_OPTS $LDFLAGS" + OSX_ARCH_OPTS="-arch ppc -arch i386" + if test "$wxUSE_OSX_COCOA" = 1; then + OSX_ARCH_OPTS="$OSX_ARCH_OPTS -arch x86_64" + fi + { echo "$as_me:$LINENO: checking for universal binary architectures" >&5 +echo $ECHO_N "checking for universal binary architectures... $ECHO_C" >&6; } + { echo "$as_me:$LINENO: result: $OSX_ARCH_OPTS" >&5 +echo "${ECHO_T}$OSX_ARCH_OPTS" >&6; } + retest_macosx_linking=yes { echo "$as_me:$LINENO: WARNING: Disabling precompiled headers due to universal binary build." >&5 @@ -18592,6 +18624,12 @@ echo "$as_me: WARNING: Disabling precompiled headers due to universal binary bui bk_use_pch=no fi +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" + if test "x$wxUSE_MACOSX_SDK" = "xno"; then wxUSE_MACOSX_SDK= elif test "x$wxUSE_MACOSX_SDK" = "xyes"; then @@ -19560,7 +19598,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | else ac_cv_header_stdc=no fi -rm -f conftest* +rm -f -r conftest* fi @@ -19581,7 +19619,7 @@ if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | else ac_cv_header_stdc=no fi -rm -f conftest* +rm -f -r conftest* fi @@ -24382,13 +24420,11 @@ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include /* for off_t */ - #include +#include int main () { -int (*fp) (FILE *, off_t, int) = fseeko; - return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); +return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); ; return 0; } @@ -24428,13 +24464,11 @@ cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _LARGEFILE_SOURCE 1 -#include /* for off_t */ - #include +#include int main () { -int (*fp) (FILE *, off_t, int) = fseeko; - return fseeko (stdin, 0, 0) && fp (stdin, 0, 0); +return fseeko (stdin, 0, 0) && (fseeko) (stdin, 0, 0); ; return 0; } @@ -24481,7 +24515,7 @@ cat >>confdefs.h <<_ACEOF _ACEOF ;; esac -rm -f conftest* +rm -f -r conftest* # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug # in glibc 2.1.3, but that breaks too many other things. @@ -31191,7 +31225,7 @@ _ACEOF eval "ac_im_$ac_var=\`\${MAKE-make} $ac_var 2>/dev/null | sed -n 's/^$ac_var=//p'\`" done # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. - for ac_extension in a so sl; do + for ac_extension in a so sl dylib la dll; do if test ! -f "$ac_im_usrlibdir/libX11.$ac_extension" && test -f "$ac_im_libdir/libX11.$ac_extension"; then ac_im_usrlibdir=$ac_im_libdir; break @@ -31344,7 +31378,7 @@ sed 's/^/| /' conftest.$ac_ext >&5 for ac_dir in `echo "$ac_x_includes $ac_x_header_dirs" | sed s/include/lib/g` do # Don't even attempt the hair of trying to link an X program! - for ac_extension in a so sl; do + for ac_extension in a so sl dylib la dll; do if test -r "$ac_dir/libX11.$ac_extension"; then ac_x_libraries=$ac_dir break 2 diff --git a/configure.in b/configure.in index 0a188f2..1eae0be 100644 --- a/configure.in +++ b/configure.in @@ -398,6 +398,7 @@ DEFAULT_wxUSE_UNICODE_UTF8_LOCALE=no dnl Mac/Cocoa users need to enable building universal binaries explicitly DEFAULT_wxUSE_UNIVERSAL_BINARY=no +DEFAULT_wxUSE_MAC_ARCH=no DEFAULT_wxUSE_OFFICIAL_BUILD=no @@ -717,7 +718,9 @@ 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 create Mac PowerPC and Intel Universal binary]], wxUSE_UNIVERSAL_BINARY) + +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(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) WX_ARG_DISABLE(compat28, [ --disable-compat28 disable wxWidgets 2.8 compatibility], WXWIN_COMPATIBILITY_2_8) @@ -1116,6 +1119,11 @@ 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 + 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) @@ -1145,12 +1153,13 @@ dnl Support the old --enable-universal_binary in case anyone was using it. 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" - OBJCXXFLAGS="$OSX_UNIV_OPTS $OBJCXXFLAGS" - OBJCFLAGS="$OSX_UNIV_OPTS $OBJCFLAGS" - LDFLAGS="$OSX_UNIV_OPTS $LDFLAGS" + OSX_ARCH_OPTS="-arch ppc -arch i386" + if test "$wxUSE_OSX_COCOA" = 1; then + OSX_ARCH_OPTS="$OSX_ARCH_OPTS -arch x86_64" + fi + AC_MSG_CHECKING([for universal binary architectures]) + AC_MSG_RESULT([$OSX_ARCH_OPTS]) + 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 @@ -1174,6 +1183,12 @@ dnl Support the old --enable-universal_binary in case anyone was using it. bk_use_pch=no fi +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" + 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 -- 2.7.4