+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.
+if test "$wxUSE_UNICODE" = yes -a "$GCC" = yes -a "$bk_use_pch" != no
+then
+ AC_CACHE_CHECK(
+ [for gcc precompiled header bug],
+ [wx_cv_gcc_pch_bug],
+ [[
+ echo '#include <stdio.h>
+ const wchar_t test_var[] = L"awidetest";' > conftest.h
+
+ echo '#include "conftest.h"
+ int main()
+ {
+ printf("%ls", test_var);
+ return 0;
+ }' > conftest.cpp
+
+ wx_cv_gcc_pch_bug="pch not supported"
+
+ if $CXX conftest.h >/dev/null 2>&1
+ then
+ wx_cv_gcc_pch_bug=
+
+ if $CXX -o conftest$PROGRAM_EXT conftest.cpp >/dev/null 2>&1
+ then
+ if tr -dc '[a-z]' < conftest$PROGRAM_EXT |
+ grep awidetest >/dev/null
+ then
+ wx_cv_gcc_pch_bug=no
+ else
+ wx_cv_gcc_pch_bug=yes
+ fi
+ fi
+ fi
+
+ rm -f conftest.h conftest.gch conftest.cpp conftest$PROGRAM_EXT
+ ]])
+
+ if test "$wx_cv_gcc_pch_bug" = yes; then
+ dnl make the default for pch 'no'
+ dnl further below check whether the user overrode and warn them
+ bk_use_pch=no
+ fi
+fi
+