From aa5af2587088691cb55bf4b2792ac8d113ca45af Mon Sep 17 00:00:00 2001 From: Lauri Nurmi Date: Thu, 6 Apr 2017 14:07:43 +0300 Subject: [PATCH 1/3] Compile the check for ICONV_CONST as C++ On OpenIndiana (SunOS) the result is different when compiled as C, and the C++ result is what matters to wxWidgets. Fixes compilation of src/common/strconv.cpp on OpenIndiana. --- configure | 18 +++++++++++++++--- configure.in | 2 ++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/configure b/configure index 9619a0d3fc22..93962b37aeaf 100755 --- a/configure +++ b/configure @@ -28118,6 +28118,12 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$TOOLKIT" != "MSW"; then if test "$wxUSE_LIBICONV" != "no" ; then + 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 + @@ -28154,7 +28160,7 @@ iconv_t cd = iconv_open("",""); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext \ @@ -28176,7 +28182,7 @@ iconv_t cd = iconv_open("",""); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +if ac_fn_cxx_try_link "$LINENO"; then : am_cv_lib_iconv=yes am_cv_func_iconv=yes fi @@ -28220,7 +28226,7 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +if ac_fn_cxx_try_compile "$LINENO"; then : wx_cv_func_iconv_const="no" else wx_cv_func_iconv_const="yes" @@ -28249,6 +28255,12 @@ _ACEOF 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 + LIBS="$LIBICONV $LIBS" fi diff --git a/configure.in b/configure.in index eb41af1590b8..3c88c2908cd4 100644 --- a/configure.in +++ b/configure.in @@ -4117,7 +4117,9 @@ if test "$TOOLKIT" != "MSW"; then dnl check for available version of iconv() if test "$wxUSE_LIBICONV" != "no" ; then + AC_LANG_PUSH(C++) AM_ICONV + AC_LANG_POP() LIBS="$LIBICONV $LIBS" fi From 9507bc430e2faf16b589958be91a462ca8e69813 Mon Sep 17 00:00:00 2001 From: Lauri Nurmi Date: Fri, 14 Apr 2017 17:38:38 +0300 Subject: [PATCH 2/3] Determine availability of the required xlocale API by compiling Even if exists, the whole API that wx requires (specifically strtod_l() and similar) may not be available. This is the case on e.g. OpenIndiana (SunOS). --- configure | 52 +++++++++++++++++++++++++++++++++++++++++++++------- configure.in | 29 +++++++++++++++++++++++++---- 2 files changed, 70 insertions(+), 11 deletions(-) diff --git a/configure b/configure index 93962b37aeaf..349726d3ee9b 100755 --- a/configure +++ b/configure @@ -32621,20 +32621,58 @@ $as_echo "$as_me: WARNING: I18n code requires wxFile... disabled" >&2;} fi if test "$wxUSE_XLOCALE" = "yes" ; then - $as_echo "#define wxUSE_XLOCALE 1" >>confdefs.h + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for complete xlocale" >&5 +$as_echo_n "checking for complete xlocale... " >&6; } +if ${wx_cv_use_xlocale_local+:} false; then : + $as_echo_n "(cached) " >&6 +else - ac_fn_c_check_type "$LINENO" "locale_t" "ac_cv_type_locale_t" "#include - #include -" -if test "x$ac_cv_type_locale_t" = xyes; then : + 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 -#define HAVE_LOCALE_T 1 + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + #include + +int +main () +{ + + locale_t t; + strtod_l(NULL, NULL, t); + + ; + return 0; +} _ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + wx_cv_use_xlocale_local=yes +else + wx_cv_use_xlocale_local=no + +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_use_xlocale_local" >&5 +$as_echo "$wx_cv_use_xlocale_local" >&6; } + if test "$wx_cv_use_xlocale_local" = "yes" ; then + $as_echo "#define wxUSE_XLOCALE 1" >>confdefs.h + + fi fi if test "$wxUSE_LOG" = "yes"; then diff --git a/configure.in b/configure.in index 3c88c2908cd4..7fa4c95084b2 100644 --- a/configure.in +++ b/configure.in @@ -5709,10 +5709,31 @@ if test "$wxUSE_INTL" = "yes" ; then fi if test "$wxUSE_XLOCALE" = "yes" ; then - AC_DEFINE(wxUSE_XLOCALE) - AC_CHECK_TYPES(locale_t,,, - [#include - #include ]) + dnl even if xlocale.h exists, it may not contain all that + dnl wx needs. check if strtod_l() really is available. + AC_CACHE_CHECK([for complete xlocale], + wx_cv_use_xlocale_local, + [ + AC_LANG_PUSH(C++) + AC_TRY_COMPILE( + [ + #include + #include + #include + ], + [ + locale_t t; + strtod_l(NULL, NULL, t); + ], + wx_cv_use_xlocale_local=yes, + wx_cv_use_xlocale_local=no + ) + AC_LANG_POP() + ]) + + if test "$wx_cv_use_xlocale_local" = "yes" ; then + AC_DEFINE(wxUSE_XLOCALE) + fi fi if test "$wxUSE_LOG" = "yes"; then From 259b55a17c05fa084af8dcac4554ff0df0fd31f9 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 20 Apr 2017 15:55:33 +0200 Subject: [PATCH 3/3] Rename wx_cv_use_xlocale_local to wx_cv_func_strtod_l No real changes, just use more standard naming convention for a variable containing the cached value in configure. --- configure | 12 ++++++------ configure.in | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/configure b/configure index 349726d3ee9b..0a0a43435376 100755 --- a/configure +++ b/configure @@ -32623,7 +32623,7 @@ fi if test "$wxUSE_XLOCALE" = "yes" ; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for complete xlocale" >&5 $as_echo_n "checking for complete xlocale... " >&6; } -if ${wx_cv_use_xlocale_local+:} false; then : +if ${wx_cv_func_strtod_l+:} false; then : $as_echo_n "(cached) " >&6 else @@ -32652,9 +32652,9 @@ main () } _ACEOF if ac_fn_cxx_try_compile "$LINENO"; then : - wx_cv_use_xlocale_local=yes + wx_cv_func_strtod_l=yes else - wx_cv_use_xlocale_local=no + wx_cv_func_strtod_l=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext @@ -32666,10 +32666,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_use_xlocale_local" >&5 -$as_echo "$wx_cv_use_xlocale_local" >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_func_strtod_l" >&5 +$as_echo "$wx_cv_func_strtod_l" >&6; } - if test "$wx_cv_use_xlocale_local" = "yes" ; then + if test "$wx_cv_func_strtod_l" = "yes" ; then $as_echo "#define wxUSE_XLOCALE 1" >>confdefs.h fi diff --git a/configure.in b/configure.in index 7fa4c95084b2..f7cd77ea7abc 100644 --- a/configure.in +++ b/configure.in @@ -5712,7 +5712,7 @@ if test "$wxUSE_XLOCALE" = "yes" ; then dnl even if xlocale.h exists, it may not contain all that dnl wx needs. check if strtod_l() really is available. AC_CACHE_CHECK([for complete xlocale], - wx_cv_use_xlocale_local, + wx_cv_func_strtod_l, [ AC_LANG_PUSH(C++) AC_TRY_COMPILE( @@ -5725,13 +5725,13 @@ if test "$wxUSE_XLOCALE" = "yes" ; then locale_t t; strtod_l(NULL, NULL, t); ], - wx_cv_use_xlocale_local=yes, - wx_cv_use_xlocale_local=no + wx_cv_func_strtod_l=yes, + wx_cv_func_strtod_l=no ) AC_LANG_POP() ]) - if test "$wx_cv_use_xlocale_local" = "yes" ; then + if test "$wx_cv_func_strtod_l" = "yes" ; then AC_DEFINE(wxUSE_XLOCALE) fi fi