On unicode builds detect gcc 3.4 precompiled header bug (bugzilla 13361).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42302 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Michael Wetherell 2006-10-23 21:20:26 +00:00
parent 069a9976c3
commit a81d5bb62c
2 changed files with 102 additions and 11 deletions

55
configure vendored
View File

@ -47084,6 +47084,43 @@ if test "$wxUSE_MAC" = 1 ; then
# The makefile currently uses AR and RANLIB, which libtool apparently supercedes.
fi
if test "$wxUSE_UNICODE" = yes -a "$GCC" = yes -a "$bk_use_pch" != no
then
echo "$as_me:$LINENO: checking for gcc precompiled header bug" >&5
echo $ECHO_N "checking for gcc precompiled header bug... $ECHO_C" >&6
if test "${wx_cv_gcc_pch_bug+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
wx_cv_gcc_pch_bug=no
echo 'const wchar_t test_var[] = L"wide string";' > conftest.h
if $CXX conftest.h >& /dev/null
then
{
echo '#include "conftest.h"'
echo 'const wchar_t *test() { return test_var; }'
} > conftest.cpp
if $CXX -c -o conftest.o conftest.cpp >& /dev/null
then
tr -dc 'a-z' < conftest.o |
grep 'widestring' >& /dev/null ||
wx_cv_gcc_pch_bug=yes
fi
fi
rm -f conftest.h conftest.gch conftest.cpp conftest.o
fi
echo "$as_me:$LINENO: result: $wx_cv_gcc_pch_bug" >&5
echo "${ECHO_T}$wx_cv_gcc_pch_bug" >&6
if test "$wx_cv_gcc_pch_bug" = yes; then
bk_use_pch=no
fi
fi
@ -50018,6 +50055,20 @@ echo "$as_me: error: Versions of Bakefile used to generate makefiles ($BAKEFILE_
fi
if test $GCC_PCH = 1
then
if test "$wx_cv_gcc_pch_bug" = yes; then
{ echo "$as_me:$LINENO: WARNING: *** Precompiled header support is broken on this compiler" >&5
echo "$as_me: WARNING: *** Precompiled header support is broken on this compiler" >&2;}
{ echo "$as_me:$LINENO: WARNING: *** --enable-precomp-headers is not recommended" >&5
echo "$as_me: WARNING: *** --enable-precomp-headers is not recommended" >&2;}
{ echo "$as_me:$LINENO: WARNING: *** see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13361" >&5
echo "$as_me: WARNING: *** see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13361" >&2;}
fi
CPPFLAGS="-DWX_PRECOMP $CPPFLAGS"
fi
if test "$wxUSE_MAC" = 1 ; then
if test "x$wxUSE_UNIVERSAL_BINARY" != "xno" ; then
@ -50055,10 +50106,6 @@ if test "$wxUSE_OMF" = "yes"; then
esac
fi
if test $GCC_PCH = 1 ; then
CPPFLAGS="-DWX_PRECOMP $CPPFLAGS"
fi
WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS $TOOLCHAIN_DEFS"
SAMPLES_SUBDIRS="`echo $SAMPLES_SUBDIRS | tr -s ' ' | tr ' ' '\n' | sort | uniq | tr '\n' ' '| tr -d '\r'`"

View File

@ -7583,8 +7583,59 @@ if test "$wxUSE_MAC" = 1 ; then
# 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],
[[
wx_cv_gcc_pch_bug=no
echo 'const wchar_t test_var[] = L"wide string";' > conftest.h
if $CXX conftest.h >& /dev/null
then
{
echo '#include "conftest.h"'
echo 'const wchar_t *test() { return test_var; }'
} > conftest.cpp
if $CXX -c -o conftest.o conftest.cpp >& /dev/null
then
tr -dc 'a-z' < conftest.o |
grep 'widestring' >& /dev/null ||
wx_cv_gcc_pch_bug=yes
fi
fi
rm -f conftest.h conftest.gch conftest.cpp conftest.o
]])
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
AC_BAKEFILE([m4_include(autoconf_inc.m4)])
dnl find out if the compiler supports PCH
dnl
dnl TODO: this should be in bakefile
if test $GCC_PCH = 1
then
if test "$wx_cv_gcc_pch_bug" = yes; then
AC_MSG_WARN([*** Precompiled header support is broken on this compiler])
AC_MSG_WARN([*** --enable-precomp-headers is not recommended])
AC_MSG_WARN([*** see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13361])
fi
CPPFLAGS="-DWX_PRECOMP $CPPFLAGS"
fi
dnl HACK ALERT!!
dnl For now, we need to alter bk-deps not to generate deps
dnl when we've configured a Universal binary build.
@ -7637,13 +7688,6 @@ if test "$wxUSE_OMF" = "yes"; then
esac
fi
dnl find out if the compiler supports PCH
dnl
dnl TODO: this should be in bakefile
if test $GCC_PCH = 1 ; then
CPPFLAGS="-DWX_PRECOMP $CPPFLAGS"
fi
dnl TOOLCHAIN_DEFS should be used for both wx and client code
WXCONFIG_CPPFLAGS="$WXCONFIG_CPPFLAGS $TOOLCHAIN_DEFS"