diff --git a/configure b/configure index 6651812fa0..aa52b951e1 100755 --- a/configure +++ b/configure @@ -21189,8 +21189,7 @@ _ACEOF fi -if test "$wxUSE_UNICODE" = "yes" -a \ - \( "$wxUSE_STD_STRING" = "yes" -o "$wxUSE_STL" = "yes" \); then +if test "$wxUSE_STD_STRING" = "yes" -o "$wxUSE_STL" = "yes"; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -21198,8 +21197,16 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - echo "$as_me:$LINENO: checking for std::wstring in " >&5 -echo $ECHO_N "checking for std::wstring in ... $ECHO_C" >&6 + if test "$wxUSE_UNICODE" = "yes"; then + std_string="std::wstring" + char_type="wchar_t" + else + std_string="std::string" + char_type="char" + fi + + echo "$as_me:$LINENO: checking for $std_string in " >&5 +echo $ECHO_N "checking for $std_string in ... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21210,7 +21217,7 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -std::wstring foo; +$std_string foo; ; return 0; } @@ -21248,8 +21255,8 @@ sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 - echo "$as_me:$LINENO: checking if std::basic_string works" >&5 -echo $ECHO_N "checking if std::basic_string works... $ECHO_C" >&6 + echo "$as_me:$LINENO: checking if std::basic_string<$char_type> works" >&5 +echo $ECHO_N "checking if std::basic_string<$char_type> works... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21272,8 +21279,8 @@ cat >>conftest.$ac_ext <<_ACEOF int main () { -std::basic_string foo; - const wchar_t* dummy = foo.c_str(); +std::basic_string<$char_type> foo; + const $char_type* dummy = foo.c_str(); ; return 0; } @@ -21307,9 +21314,16 @@ sed 's/^/| /' conftest.$ac_ext >&5 echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 - { { echo "$as_me:$LINENO: error: Can't compile without unicode string class" >&5 -echo "$as_me: error: Can't compile without unicode string class" >&2;} + if test "$wxUSE_STL" = "yes"; then + { { echo "$as_me:$LINENO: error: Can't compile with --enable-stl without $std_string or std::basic_string<$char_type>" >&5 +echo "$as_me: error: Can't compile with --enable-stl without $std_string or std::basic_string<$char_type>" >&2;} { (exit 1); exit 1; }; } + else + { echo "$as_me:$LINENO: WARNING: No $std_string or std::basic_string<$char_type>, switching to --disable-std_string" >&5 +echo "$as_me: WARNING: No $std_string or std::basic_string<$char_type>, switching to --disable-std_string" >&2;} + wxUSE_STD_STRING=no + fi + fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext @@ -21325,6 +21339,161 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi +if test "$wxUSE_STD_IOSTREAM" = "yes"; then + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + echo "$as_me:$LINENO: checking for std::istream" >&5 +echo $ECHO_N "checking for std::istream... $ECHO_C" >&6 +if test "${ac_cv_type_std__istream+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +if ((std::istream *) 0) + return 0; +if (sizeof (std::istream)) + return 0; + ; + 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_cxx_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 + ac_cv_type_std__istream=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_std__istream=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_std__istream" >&5 +echo "${ECHO_T}$ac_cv_type_std__istream" >&6 +if test $ac_cv_type_std__istream = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STD__ISTREAM 1 +_ACEOF + + +else + wxUSE_STD_IOSTREAM=no +fi +echo "$as_me:$LINENO: checking for std::ostream" >&5 +echo $ECHO_N "checking for std::ostream... $ECHO_C" >&6 +if test "${ac_cv_type_std__ostream+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +int +main () +{ +if ((std::ostream *) 0) + return 0; +if (sizeof (std::ostream)) + return 0; + ; + 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_cxx_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 + ac_cv_type_std__ostream=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_std__ostream=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_std__ostream" >&5 +echo "${ECHO_T}$ac_cv_type_std__ostream" >&6 +if test $ac_cv_type_std__ostream = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_STD__OSTREAM 1 +_ACEOF + + +else + wxUSE_STD_IOSTREAM=no +fi + + + if test "$wxUSE_STD_IOSTREAM" != "yes"; then + { echo "$as_me:$LINENO: WARNING: No std::iostreams, switching to --disable-std_iostreams" >&5 +echo "$as_me: WARNING: No std::iostreams, switching to --disable-std_iostreams" >&2;} + fi + + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +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 + if test "$wxUSE_STL" = "yes"; then ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' diff --git a/configure.in b/configure.in index 029b1d0d13..053553cc90 100644 --- a/configure.in +++ b/configure.in @@ -1922,19 +1922,26 @@ AC_CXX_STATIC_CAST dnl we don't use HAVE_DYNAMIC_CAST anywhere right now... dnl AC_CXX_DYNAMIC_CAST -dnl check various STL features -if test "$wxUSE_UNICODE" = "yes" -a \ - \( "$wxUSE_STD_STRING" = "yes" -o "$wxUSE_STL" = "yes" \); then +dnl check for std::string or std::wstring +if test "$wxUSE_STD_STRING" = "yes" -o "$wxUSE_STL" = "yes"; then AC_LANG_PUSH(C++) + if test "$wxUSE_UNICODE" = "yes"; then + std_string="std::wstring" + char_type="wchar_t" + else + std_string="std::string" + char_type="char" + fi + dnl check if declares std::wstring - AC_MSG_CHECKING([for std::wstring in ]) + AC_MSG_CHECKING([for $std_string in ]) AC_TRY_COMPILE([#include ], - [std::wstring foo;], + [$std_string foo;], [AC_MSG_RESULT(yes) AC_DEFINE(HAVE_STD_WSTRING)], [AC_MSG_RESULT(no) - AC_MSG_CHECKING([if std::basic_string works]) + AC_MSG_CHECKING([if std::basic_string<$char_type> works]) AC_TRY_COMPILE([ #ifdef HAVE_WCHAR_H # ifdef __CYGWIN__ @@ -1948,17 +1955,37 @@ if test "$wxUSE_UNICODE" = "yes" -a \ #include #include ], - [std::basic_string foo; - const wchar_t* dummy = foo.c_str();], + [std::basic_string<$char_type> foo; + const $char_type* dummy = foo.c_str();], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT([no]) - AC_MSG_ERROR([Can't compile without unicode string class])] + if test "$wxUSE_STL" = "yes"; then + AC_MSG_ERROR([Can't compile with --enable-stl without $std_string or std::basic_string<$char_type>]) + else + AC_MSG_WARN([No $std_string or std::basic_string<$char_type>, switching to --disable-std_string]) + wxUSE_STD_STRING=no + fi + ] ) ]) AC_LANG_POP fi +if test "$wxUSE_STD_IOSTREAM" = "yes"; then + AC_LANG_PUSH(C++) + + AC_CHECK_TYPES([std::istream, std::ostream],, + [wxUSE_STD_IOSTREAM=no], + [#include ]) + + if test "$wxUSE_STD_IOSTREAM" != "yes"; then + AC_MSG_WARN([No std::iostreams, switching to --disable-std_iostreams]) + fi + + AC_LANG_POP +fi + if test "$wxUSE_STL" = "yes"; then AC_LANG_PUSH(C++)