diff --git a/configure b/configure index 9698d321ea..2580e5dfba 100755 --- a/configure +++ b/configure @@ -18656,6 +18656,8 @@ fi fi +export_compiler_flags=no + if test "$USE_DARWIN" = 1; then retest_macosx_linking=no @@ -18708,6 +18710,8 @@ $as_echo "$as_me: WARNING: Disabling precompiled headers due to universal binary OBJCXXFLAGS="$OSX_ARCH_OPTS $OBJCXXFLAGS" OBJCFLAGS="$OSX_ARCH_OPTS $OBJCFLAGS" LDFLAGS="$OSX_ARCH_OPTS $LDFLAGS" + + export_compiler_flags=yes fi if test "$wxUSE_MAC" = 1; then @@ -18893,6 +18897,8 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu + + export_compiler_flags=yes fi fi @@ -19095,7 +19101,15 @@ if test "$USE_UNIX" = 1 ; then fi -export CC CFLAGS CPP CPPFLAGS CXX CXXFLAGS LDD LDFLAGS OBJCFLAGS OBJCXXFLAGS +if test "$export_compiler_flags" = "yes"; then + export CC CFLAGS CPP CPPFLAGS CXX CXXFLAGS LDD LDFLAGS OBJCFLAGS OBJCXXFLAGS + + if test "$cache_file" != "/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Disabling caching due to a change in compiler options." >&5 +$as_echo "$as_me: WARNING: Disabling caching due to a change in compiler options." >&2;} + cache_file="/dev/null" + fi +fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 diff --git a/configure.in b/configure.in index 91cc451dbd..69284c308e 100644 --- a/configure.in +++ b/configure.in @@ -1177,6 +1177,11 @@ dnl --------------------------------------------------------------------------- dnl Mac-specific SDK/architectures checks dnl --------------------------------------------------------------------------- +dnl If we modify compiler or compiler flags variables in non-trivial way (e.g. +dnl by specifying the non-default architecture to use), we need to export them +dnl after doing it, so that sub-configure scripts use the same values too. +export_compiler_flags=no + dnl Note that some checks here are OS-specific, and need to be done for any dnl port, while others are wxOSX-specific and are performed only for it inside dnl another test below. @@ -1250,6 +1255,8 @@ if test "x$OSX_ARCH_OPTS" != "x"; then OBJCXXFLAGS="$OSX_ARCH_OPTS $OBJCXXFLAGS" OBJCFLAGS="$OSX_ARCH_OPTS $OBJCFLAGS" LDFLAGS="$OSX_ARCH_OPTS $LDFLAGS" + + export_compiler_flags=yes fi if test "$wxUSE_MAC" = 1; then @@ -1384,6 +1391,12 @@ version or omitting it entirely." [AC_MSG_FAILURE([$error_message])] ) AC_LANG_POP() + + dnl If we are here, we must have set retest_macosx_linking to yes above, + dnl i.e. we must have modified compiler/linker variables to set + dnl SDK/availability options, and so we must export them to build any + dnl bundled third party libraries with them too. + export_compiler_flags=yes fi fi dnl USE_DARWIN @@ -1541,8 +1554,20 @@ if test "$USE_UNIX" = 1 ; then fi dnl Values of these variables shouldn't change any longer from now on, we -dnl export them to ensure they're picked up by sub-configure scripts. -export CC CFLAGS CPP CPPFLAGS CXX CXXFLAGS LDD LDFLAGS OBJCFLAGS OBJCXXFLAGS +dnl export them to ensure they're picked up by sub-configure scripts if they +dnl were modified above. +if test "$export_compiler_flags" = "yes"; then + export CC CFLAGS CPP CPPFLAGS CXX CXXFLAGS LDD LDFLAGS OBJCFLAGS OBJCXXFLAGS + + if test "$cache_file" != "/dev/null"; then + dnl We must do this to avoid fatal errors due to inconsistent build + dnl environment from sub-configure scripts. We could do it just before + dnl actually running them, but doing it here is simpler and more robust + dnl (e.g. in case we add other sub-configure scripts later). + AC_MSG_WARN([Disabling caching due to a change in compiler options.]) + cache_file="/dev/null" + fi +fi dnl ------------------------------------------------------------------------ dnl Check for headers