diff --git a/configure b/configure index b449363b69..82c5ab4e72 100755 --- a/configure +++ b/configure @@ -4602,10 +4602,10 @@ fi eval "$wx_cv_use_liblzma" - fi + # Check whether --with-libxpm was given. if test "${with_libxpm+set}" = set; then : withval=$with_libxpm; @@ -17801,6 +17801,118 @@ if test $ac_cv_c_bigendian = yes; then fi +if test "x$SUNCXX" = xyes; then + CXXFLAGS="-features=tmplife $GNU_SOURCE_FLAG $CXXFLAGS" +fi + +if test "x$SUNCC" = xyes; then + CFLAGS="-erroff=E_NO_EXPLICIT_TYPE_GIVEN $CFLAGS" +fi + +if test "x$SGICC" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if cc version is 7.4.4 or greater" >&5 +$as_echo_n "checking if cc version is 7.4.4 or greater... " >&6; } +if ${wx_cv_prog_sgicc744+:} false; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + #if _SGI_COMPILER_VERSION >= 744 + chock me: mipsPro is 7.4.4 or later + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + wx_cv_prog_sgicc744=no +else + wx_cv_prog_sgicc744=yes + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_prog_sgicc744" >&5 +$as_echo "$wx_cv_prog_sgicc744" >&6; } + + if test "x$wx_cv_prog_sgicc744" = "xyes"; then + CFLAGS="-woff 3970 $CFLAGS" + fi +fi +if test "x$SGICXX" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CC version is 7.4.4 or greater" >&5 +$as_echo_n "checking if CC version is 7.4.4 or greater... " >&6; } +if ${wx_cv_prog_sgicxx744+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ac_ext=cpp +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 + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + #if _SGI_COMPILER_VERSION >= 744 + chock me: mipsPro is 7.4.4 or later + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + wx_cv_prog_sgicxx744=no +else + wx_cv_prog_sgicxx744=yes + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_prog_sgicxx744" >&5 +$as_echo "$wx_cv_prog_sgicxx744" >&6; } + + if test "x$wx_cv_prog_sgicxx744" = "xyes"; then + CXXFLAGS="-woff 3970 $CXXFLAGS" + fi +fi + +if test "x$HPCC" = "xyes"; then + CFLAGS="+W 2011,2450 $CFLAGS" +fi +if test "x$HPCXX" = "xyes"; then + CXXFLAGS="+W 2340,4232 $CXXFLAGS" +fi + +if test "x$COMPAQCXX" = "xyes"; then + CXXFLAGS="-w0 -msg_disable basclsnondto,unrimpret,intconlosbit" +fi + +if test "$HAVE_CXX11" != "1" ; then + ac_ext=cpp @@ -17919,116 +18031,6 @@ $as_echo "$wx_cv_explicit" >&6; } fi -if test "x$SUNCXX" = xyes; then - CXXFLAGS="-features=tmplife $GNU_SOURCE_FLAG $CXXFLAGS" -fi - -if test "x$SUNCC" = xyes; then - CFLAGS="-erroff=E_NO_EXPLICIT_TYPE_GIVEN $CFLAGS" -fi - -if test "x$SGICC" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if cc version is 7.4.4 or greater" >&5 -$as_echo_n "checking if cc version is 7.4.4 or greater... " >&6; } -if ${wx_cv_prog_sgicc744+:} false; then : - $as_echo_n "(cached) " >&6 -else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - #if _SGI_COMPILER_VERSION >= 744 - chock me: mipsPro is 7.4.4 or later - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - wx_cv_prog_sgicc744=no -else - wx_cv_prog_sgicc744=yes - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_prog_sgicc744" >&5 -$as_echo "$wx_cv_prog_sgicc744" >&6; } - - if test "x$wx_cv_prog_sgicc744" = "xyes"; then - CFLAGS="-woff 3970 $CFLAGS" - fi -fi -if test "x$SGICXX" = "xyes"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if CC version is 7.4.4 or greater" >&5 -$as_echo_n "checking if CC version is 7.4.4 or greater... " >&6; } -if ${wx_cv_prog_sgicxx744+:} false; then : - $as_echo_n "(cached) " >&6 -else - - ac_ext=cpp -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 - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - #if _SGI_COMPILER_VERSION >= 744 - chock me: mipsPro is 7.4.4 or later - #endif - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - wx_cv_prog_sgicxx744=no -else - wx_cv_prog_sgicxx744=yes - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - 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 -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_prog_sgicxx744" >&5 -$as_echo "$wx_cv_prog_sgicxx744" >&6; } - - if test "x$wx_cv_prog_sgicxx744" = "xyes"; then - CXXFLAGS="-woff 3970 $CXXFLAGS" - fi -fi - -if test "x$HPCC" = "xyes"; then - CFLAGS="+W 2011,2450 $CFLAGS" -fi -if test "x$HPCXX" = "xyes"; then - CXXFLAGS="+W 2340,4232 $CXXFLAGS" -fi - -if test "x$COMPAQCXX" = "xyes"; then - CXXFLAGS="-w0 -msg_disable basclsnondto,unrimpret,intconlosbit" -fi - ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -18436,8 +18438,7 @@ fi fi fi -if test "$HAVE_CXX11" != "1" ; then - for ac_header in type_traits tr1/type_traits +for ac_header in type_traits tr1/type_traits do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_cxx_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default @@ -18451,13 +18452,10 @@ fi done -else - $as_echo "#define HAVE_TYPE_TRAITS 1" >>confdefs.h fi - if test -n "$GCC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __sync_fetch_and_add and __sync_sub_and_fetch builtins" >&5 $as_echo_n "checking for __sync_fetch_and_add and __sync_sub_and_fetch builtins... " >&6; } @@ -18836,6 +18834,8 @@ $as_echo "no" >&6; } fi fi +if test "$HAVE_CXX11" != "1" ; then + ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -18964,6 +18964,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu +fi if test "$wxUSE_REGEX" != "no"; then diff --git a/configure.in b/configure.in index b9a76f0a5b..61f61f471e 100644 --- a/configure.in +++ b/configure.in @@ -1669,12 +1669,6 @@ fi dnl check for bytesex stuff (don't use AC_C_BIGENDIAN to allow cross-compiling) WX_C_BIGENDIAN -dnl check for iostream (as opposed to iostream.h) standard header -WX_CPP_NEW_HEADERS(, AC_DEFINE(wxUSE_IOSTREAMH)) - -dnl check whether C++ compiler supports explicit keyword -WX_CPP_EXPLICIT - dnl With Sun CC, temporaries have block scope by default. This flag is needed dnl to get the expression scope behaviour that conforms to the standard. if test "x$SUNCXX" = xyes; then @@ -1772,6 +1766,16 @@ if test "x$COMPAQCXX" = "xyes"; then CXXFLAGS="-w0 -msg_disable basclsnondto,unrimpret,intconlosbit" fi +dnl The checks below are for ancient compilers and are unnecessary when using +dnl C++11. +if test "$HAVE_CXX11" != "1" ; then + +dnl check for iostream (as opposed to iostream.h) standard header +WX_CPP_NEW_HEADERS(, AC_DEFINE(wxUSE_IOSTREAMH)) + +dnl check whether C++ compiler supports explicit keyword +WX_CPP_EXPLICIT + dnl the next few tests are all for C++ features and so need to be done using dnl C++ compiler AC_LANG_PUSH(C++) @@ -1985,18 +1989,9 @@ if test "$wxUSE_STL" = "yes"; then fi fi -dnl Check for type_traits header if necessary: we know that it's always present -dnl in C++11 mode. Also notice that it's important to pass AC_INCLUDES_DEFAULT() -dnl as the last argument because otherwise autoconf would perform the check -dnl using both the compiler and the preprocessor and the latter could fail if -dnl the preprocessor is not in C++11 mode, resulting in a warning when running -dnl configure, while providing this argument allows to skip the preprocessor -dnl check. -if test "$HAVE_CXX11" != "1" ; then - AC_CHECK_HEADERS([type_traits tr1/type_traits], break, [], [AC_INCLUDES_DEFAULT()]) -else - AC_DEFINE(HAVE_TYPE_TRAITS) -fi +AC_CHECK_HEADERS([type_traits tr1/type_traits], break, [], [AC_INCLUDES_DEFAULT()]) + +fi dnl End of pre-C++11 only checks section dnl check for atomic operations builtins for wx/atomic.h: WX_ATOMIC_BUILTINS @@ -2227,6 +2222,8 @@ else fi fi +if test "$HAVE_CXX11" != "1" ; then + dnl check for C99 string to long long conversion functions, assume that if we dnl have the unsigned variants, then we have the signed ones as well dnl @@ -2240,6 +2237,8 @@ else fi AC_LANG_POP() +fi dnl End of pre-C++11 only checks section + dnl --------------------------------------------------------------------------- dnl Optional libraries dnl diff --git a/include/wx/defs.h b/include/wx/defs.h index de898c312c..493af83a4b 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -340,7 +340,9 @@ typedef short int WXTYPE; #define wxConstCast(obj, className) wx_const_cast(className *, obj) #ifndef HAVE_STD_WSTRING - #if defined(__VISUALC__) + #if __cplusplus >= 201103L + #define HAVE_STD_WSTRING + #elif defined(__VISUALC__) #define HAVE_STD_WSTRING #elif defined(__MINGW32__) #define HAVE_STD_WSTRING @@ -348,7 +350,9 @@ typedef short int WXTYPE; #endif #ifndef HAVE_STD_STRING_COMPARE - #if defined(__VISUALC__) + #if __cplusplus >= 201103L + #define HAVE_STD_STRING_COMPARE + #elif defined(__VISUALC__) #define HAVE_STD_STRING_COMPARE #elif defined(__MINGW32__) || defined(__CYGWIN32__) #define HAVE_STD_STRING_COMPARE diff --git a/include/wx/wxcrtbase.h b/include/wx/wxcrtbase.h index 495e47ec8b..9b84d737bd 100644 --- a/include/wx/wxcrtbase.h +++ b/include/wx/wxcrtbase.h @@ -183,6 +183,16 @@ extern unsigned long android_wcstoul(const wchar_t *nptr, wchar_t **endptr, int #define wxCRT_StrtollW _wcstoi64 #define wxCRT_StrtoullW _wcstoui64 #else + /* Both of these functions are implemented in C++11 compilers */ + #if defined(__cplusplus) && __cplusplus >= 201103L + #ifndef HAVE_STRTOULL + #define HAVE_STRTOULL + #endif + #ifndef HAVE_WCSTOULL + #define HAVE_WCSTOULL + #endif + #endif + #ifdef HAVE_STRTOULL #define wxCRT_StrtollA strtoll #define wxCRT_StrtoullA strtoull