Determine availability of the required xlocale API by compiling

Even if <xlocale.h> 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).
This commit is contained in:
Lauri Nurmi 2017-04-14 17:38:38 +03:00
parent aa5af25870
commit 9507bc430e
2 changed files with 70 additions and 11 deletions

52
configure vendored
View File

@ -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 <xlocale.h>
#include <locale.h>
"
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 <xlocale.h>
#include <locale.h>
#include <stdlib.h>
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

View File

@ -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 <xlocale.h>
#include <locale.h>])
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 <xlocale.h>
#include <locale.h>
#include <stdlib.h>
],
[
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