From bea8e651c7a7401e9b8b30497b812276fd2552bb Mon Sep 17 00:00:00 2001 From: Mattia Barbon Date: Sun, 2 May 2004 08:11:52 +0000 Subject: [PATCH] Fixed MinGW compilation with GCC 3.x when wxUSE_STL == 1. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27058 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 74 ++++++++++++++++++++++++++++++++++++++++++-- configure.in | 22 ++++++++++++- docs/msw/install.txt | 3 ++ 3 files changed, 95 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 8b657fb07d..15912b31cb 100755 --- a/configure +++ b/configure @@ -18630,6 +18630,12 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + if test "$cross_compiling" = "yes"; then + cat >>confdefs.h <<\_ACEOF +#define wxUSE_IOSTREAMH 1 +_ACEOF + + else ac_ext=cc @@ -18805,6 +18811,7 @@ 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 + fi @@ -21877,7 +21884,7 @@ fi if pkg-config --atleast-pkgconfig-version 0.7 ; then : else - echo "*** pkg-config too old; version 0.7 or better required." + echo *** pkg-config too old; version 0.7 or better required. no_gtk=yes PKG_CONFIG=no fi @@ -41184,6 +41191,64 @@ else CODE_GEN_FLAGS="-DNO_GCC_PRAGMA $CODE_GEN_FLAGS" CPPFLAGS="-DNO_GCC_PRAGMA $CPPFLAGS" ;; + *-*-mingw32* ) + if test "$wxUSE_STL" = "yes"; then + echo "$as_me:$LINENO: checking If this MinGW version needs -DNO_GCC_PRAGMA" >&5 +echo $ECHO_N "checking If this MinGW version needs -DNO_GCC_PRAGMA... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ +#if !(__GNUC__ == 3 && __GNUC_MINOR__ >= 2) + #error "Not GCC 3.2 or greater" + #endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + CODE_GEN_FLAGS="-DNO_GCC_PRAGMA $CODE_GEN_FLAGS" + CPPFLAGS="-DNO_GCC_PRAGMA $CPPFLAGS" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + fi + ;; esac fi @@ -41454,11 +41519,14 @@ echo "${ECHO_T}no" >&6 fi if test "x$no_cppunit" = x ; then - SUBDIRS="$SUBDIRS tests" + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SUBDIRS="$SUBDIRS tests" else CPPUNIT_CFLAGS="" CPPUNIT_LIBS="" - : + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 fi diff --git a/configure.in b/configure.in index 0f65fc66ee..3e2b499be3 100644 --- a/configure.in +++ b/configure.in @@ -5997,6 +5997,24 @@ else CODE_GEN_FLAGS="-DNO_GCC_PRAGMA $CODE_GEN_FLAGS" CPPFLAGS="-DNO_GCC_PRAGMA $CPPFLAGS" ;; + *-*-mingw32* ) + dnl MinGW GCC versions >= 3.2 have problems with + dnl static member of classes derived from templates + dnl in combination with #pragme interface/implementation + dnl (the test case uses 4 files) + if test "$wxUSE_STL" = "yes"; then + AC_MSG_CHECKING([If this MinGW version needs -DNO_GCC_PRAGMA]) + AC_TRY_COMPILE([], + [#if !(__GNUC__ == 3 && __GNUC_MINOR__ >= 2) + #error "Not GCC 3.2 or greater" + #endif + ], + [CODE_GEN_FLAGS="-DNO_GCC_PRAGMA $CODE_GEN_FLAGS" + CPPFLAGS="-DNO_GCC_PRAGMA $CPPFLAGS" + AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no])]) + fi + ;; esac fi @@ -6194,7 +6212,9 @@ else dnl we build wxBase only SUBDIRS="samples utils" fi dnl Add tests to the list of subdirs if cppunit 1.8.0+ is detected -AM_PATH_CPPUNIT(1.8.0, SUBDIRS="$SUBDIRS tests") +AM_PATH_CPPUNIT(1.8.0, [AC_MSG_RESULT([yes]) + SUBDIRS="$SUBDIRS tests"], + [AC_MSG_RESULT([no])]) for subdir in `echo $SUBDIRS`; do if test -d ${srcdir}/${subdir} ; then diff --git a/docs/msw/install.txt b/docs/msw/install.txt index 7c3d96a1ad..4233984c8f 100644 --- a/docs/msw/install.txt +++ b/docs/msw/install.txt @@ -365,6 +365,9 @@ Here are the steps required using the provided makefiles: - If you are using gcc-2.95, edit build\msw\config.gcc and set the GCC_VERSION variable to "2.95". +- If you are compiling with GCC 3.x using makefiles and with wxUSE_STL == 1 + you need to manually add -DNO_GCC_PRAGMA to CXXFLAGS in config.gcc. + - Use the makefile.gcc files for compiling wxWindows and samples, e.g. to compile a debugging version of wxWindows: > cd c:\wx\build\msw