X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1ff6a165a39066837a69473d30cda37a8f82fcba..38a4ddd52d0b7282c0b50464bd64d91070677f08:/configure.in diff --git a/configure.in b/configure.in index cf6571d195..b96b715a3c 100644 --- a/configure.in +++ b/configure.in @@ -2115,6 +2115,41 @@ dnl also put 64 bit versions for Linux on AMD, they must come before the usual dnl locations or 64 bit compilation failed SEARCH_LIB="/usr/lib /usr/lib32 /usr/lib64 /usr/X11R6/lib64 `echo "$SEARCH_INCLUDE" | sed s/include/lib/g`" +dnl Cross compiling with gcc? +if test "$build" != "$host" -a "$GCC" = yes; then + dnl for gcc cross-compilers "$CC -print-prog-name=ld" prints the path to + dnl the linker. Stripping off the trailing '/bin/ld' gives us a candiate + dnl for a 'root' below which libraries and headers for the target system + dnl might be installed. + if cross_root=`$CC -print-prog-name=ld 2>/dev/null`; then + cross_root=`dirname $cross_root` + cross_root=`dirname $cross_root` + + dnl substitute this candiate root for '^/usr' in the search lists, + dnl strip out any that don't start '^/usr'. + SEARCH_LIB=`for x in $SEARCH_LIB; do echo $x; done | sed -ne "s|^/usr|$cross_root|p"` + SEARCH_INCLUDE=`for x in $SEARCH_INCLUDE; do echo $x; done | sed -ne "s|^/usr|$cross_root|p"` + + dnl also have pkg-config search for *.pc files under this 'root' + if test -z "$PKG_CONFIG_PATH"; then + PKG_CONFIG_PATH="$cross_root/local/lib/pkgconfig:$cross_root/lib/pkgconfig" + export PKG_CONFIG_PATH + fi + + dnl AC_PATH_XTRA doesn't work currently unless -x-includes and + dnl -x-libraries are given on the command line. So if they are not + dnl set then set them here to plausible defaults. + if test -z "$x_includes" -o "$x_includes" = NONE; then + WX_PATH_FIND_INCLUDES($SEARCH_INCLUDE, X11/Intrinsic.h) + x_includes=$ac_find_includes + fi + if test -z "$x_libraries" -o "$x_libraries" = NONE; then + WX_PATH_FIND_LIBRARIES($SEARCH_LIB, Xt) + x_libraries=$ac_find_libraries + fi + fi +fi + dnl ------------------------------------------------------------------------ dnl Check for libraries dnl ------------------------------------------------------------------------ @@ -6693,13 +6728,76 @@ if test "$wxUSE_OMF" = "yes"; then esac fi +dnl According to Vaclav, if NO_GCC_PRAGMA is used for any reason it needs to +dnl be in wx-config output. Not doing so could result in link problems. +GCC_PRAGMA_FLAGS="" +PCH_FLAGS="" + +dnl Find out if we have to define WX_PRECOMP (and thus NO_GCC_PRAGMA) if test $GCC_PCH = 1 ; then - CPPFLAGS="-DWX_PRECOMP $CPPFLAGS" + PCH_FLAGS="-DWX_PRECOMP" + GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA" +else + dnl Find out if we have to define NO_GCC_PRAGMA + if test "$GCC" = yes; then + AC_MSG_CHECKING([if this GCC version is >= 4.0 and needs -DNO_GCC_PRAGMA]) + AC_TRY_COMPILE([], + [#if (__GNUC__ < 4) + #error "Not GCC 4.0 or greater" + #endif + ], + [GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA" + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + case "${host}" in + powerpc-*-darwin* ) + dnl Some Apple's GCC version are broken and can't handle the + dnl pragmas: + GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA" + ;; + *-*-mingw32* ) + dnl MinGW GCC versions > 3.2 have problems with + dnl static member of classes derived from templates + dnl in combination with #pragma interface/implementation + dnl (the test case uses 4 files) + dnl ... and with exceptions handling (undefined symbols needed + dnl to correctly calls dtors when unwinding) as well + if test "$wxUSE_STL" = "yes" -o \ + "$wxUSE_NO_EXCEPTIONS" != "yes" -o \ + "$wxUSE_NO_RTTI" != "yes"; then + AC_MSG_CHECKING([if this MinGW version needs -DNO_GCC_PRAGMA]) + AC_TRY_COMPILE([], + [#if !(__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)) + #error "Not GCC 3.2 or greater" + #endif + ], + [GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA" + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + fi + ;; + *-pc-os2_emx | *-pc-os2-emx ) + dnl GCC versions ported to OS/2 have similar problems with + dnl static member of classes in combination with STL and + dnl pragma interface/implementation + if test "$wxUSE_STL" = "yes"; then + AC_MSG_CHECKING([if this gcc version needs -DNO_GCC_PRAGMA]) + AC_TRY_COMPILE([], + [#if !(__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)) + #error "Not GCC 3.2 or greater" + #endif + ], + [GCC_PRAGMA_FLAGS="-DNO_GCC_PRAGMA" + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + fi + ;; + esac +dnl closing bracket of if GCC < 4.0 + ] ) + fi fi - -dnl FIXME: This is a temporary measure until the need for it is also -dnl removed from the headers. -CPPFLAGS="-DNO_GCC_PRAGMA $CPPFLAGS" +CPPFLAGS="$PCH_FLAGS $GCC_PRAGMA_FLAGS $CPPFLAGS" dnl for convenience, sort the samples in alphabetical order @@ -6750,6 +6848,7 @@ AC_SUBST(WXCONFIG_INCLUDE) AC_SUBST(WXCONFIG_RPATH) AC_SUBST(WXCONFIG_LDFLAGS_GUI) AC_SUBST(WX_LARGEFILE_FLAGS) +AC_SUBST(GCC_PRAGMA_FLAGS) AC_SUBST(CODE_GEN_FLAGS) AC_SUBST(CODE_GEN_FLAGS_CXX) AC_SUBST(EXE_LINKER)