Try to fix macOS build using cmake after xlocale changes
Commit bc13119494
removed the inclusion of
xlocale.h because it is not (and never was) needed under Linux with
glibc, but it is still needed under macOS, so this (silently) disabled
wxXLocale support under Mac when using configure and broke the build
when using cmake.
Fix both problems by using xlocale.h only if it's available, both in
configure and in cmake.
This commit is contained in:
@@ -649,6 +649,7 @@ if(wxUSE_FSWATCHER)
|
||||
endif()
|
||||
|
||||
if(wxUSE_XLOCALE)
|
||||
check_include_file(xlocale.h HAVE_XLOCALE_H)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES xlocale.h locale.h)
|
||||
check_type_size(locale_t LOCALE_T)
|
||||
set(CMAKE_EXTRA_INCLUDE_FILES)
|
||||
|
@@ -1257,6 +1257,9 @@
|
||||
/* Define if setpriority() is available. */
|
||||
#cmakedefine HAVE_SETPRIORITY 1
|
||||
|
||||
/* Define if xlocale.h header file exists. */
|
||||
#cmakedefine HAVE_XLOCALE_H 1
|
||||
|
||||
/* Define if locale_t is available */
|
||||
#cmakedefine HAVE_LOCALE_T 1
|
||||
|
||||
|
107
configure
vendored
107
configure
vendored
@@ -3217,6 +3217,97 @@ fi
|
||||
as_fn_set_status $ac_retval
|
||||
|
||||
} # ac_fn_cxx_try_run
|
||||
|
||||
# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
|
||||
# -------------------------------------------------------
|
||||
# Tests whether HEADER exists, giving a warning if it cannot be compiled using
|
||||
# the include files in INCLUDES and setting the cache variable VAR
|
||||
# accordingly.
|
||||
ac_fn_c_check_header_mongrel ()
|
||||
{
|
||||
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
|
||||
if eval \${$3+:} false; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
|
||||
$as_echo_n "checking for $2... " >&6; }
|
||||
if eval \${$3+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
fi
|
||||
eval ac_res=\$$3
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
else
|
||||
# Is the header compilable?
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
|
||||
$as_echo_n "checking $2 usability... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
$4
|
||||
#include <$2>
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
ac_header_compiler=yes
|
||||
else
|
||||
ac_header_compiler=no
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
|
||||
$as_echo "$ac_header_compiler" >&6; }
|
||||
|
||||
# Is the header present?
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
|
||||
$as_echo_n "checking $2 presence... " >&6; }
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <$2>
|
||||
_ACEOF
|
||||
if ac_fn_c_try_cpp "$LINENO"; then :
|
||||
ac_header_preproc=yes
|
||||
else
|
||||
ac_header_preproc=no
|
||||
fi
|
||||
rm -f conftest.err conftest.i conftest.$ac_ext
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
|
||||
$as_echo "$ac_header_preproc" >&6; }
|
||||
|
||||
# So? What about this header?
|
||||
case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
|
||||
yes:no: )
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
|
||||
$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
|
||||
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
|
||||
;;
|
||||
no:yes:* )
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
|
||||
$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
|
||||
$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
|
||||
$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
|
||||
$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
|
||||
$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
|
||||
( $as_echo "## -------------------------------------- ##
|
||||
## Report this to wx-dev@googlegroups.com ##
|
||||
## -------------------------------------- ##"
|
||||
) | sed "s/^/$as_me: WARNING: /" >&2
|
||||
;;
|
||||
esac
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
|
||||
$as_echo_n "checking for $2... " >&6; }
|
||||
if eval \${$3+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
eval "$3=\$ac_header_compiler"
|
||||
fi
|
||||
eval ac_res=\$$3
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
fi
|
||||
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
||||
|
||||
} # ac_fn_c_check_header_mongrel
|
||||
cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
@@ -32907,6 +32998,19 @@ $as_echo "$as_me: WARNING: I18n code requires wxFile... disabled" >&2;}
|
||||
fi
|
||||
|
||||
if test "$wxUSE_XLOCALE" = "yes" ; then
|
||||
for ac_header in xlocale.h
|
||||
do :
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "xlocale.h" "ac_cv_header_xlocale_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_xlocale_h" = xyes; then :
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_XLOCALE_H 1
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for locale_t" >&5
|
||||
$as_echo_n "checking for locale_t... " >&6; }
|
||||
if ${wx_cv_type_locale_t+:} false; then :
|
||||
@@ -32922,6 +33026,9 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
|
||||
#ifdef HAVE_XLOCALE_H
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
#include <locale.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
@@ -5757,11 +5757,18 @@ if test "$wxUSE_INTL" = "yes" ; then
|
||||
fi
|
||||
|
||||
if test "$wxUSE_XLOCALE" = "yes" ; then
|
||||
dnl Some platforms (e.g. macOS) require an extra header, others (Linux)
|
||||
dnl don't, but it's simpler to just check for it under all of them.
|
||||
AC_CHECK_HEADERS([xlocale.h])
|
||||
|
||||
AC_CACHE_CHECK([for locale_t], wx_cv_type_locale_t,
|
||||
[
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_TRY_COMPILE(
|
||||
[
|
||||
#ifdef HAVE_XLOCALE_H
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
#include <locale.h>
|
||||
#include <stdlib.h>
|
||||
],
|
||||
|
@@ -40,6 +40,11 @@
|
||||
typedef _locale_t wxXLocale_t;
|
||||
#define wxXLOCALE_IDENT(name) _ ## name
|
||||
#elif defined(HAVE_LOCALE_T)
|
||||
// Some systems (notably macOS) require including a separate header for
|
||||
// locale_t and related functions.
|
||||
#ifdef HAVE_XLOCALE_H
|
||||
#include <xlocale.h>
|
||||
#endif
|
||||
#include <locale.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
@@ -1267,6 +1267,9 @@
|
||||
/* Define if setpriority() is available. */
|
||||
#undef HAVE_SETPRIORITY
|
||||
|
||||
/* Define if xlocale.h header file exists. */
|
||||
#undef HAVE_XLOCALE_H
|
||||
|
||||
/* Define if locale_t is available */
|
||||
#undef HAVE_LOCALE_T
|
||||
|
||||
|
Reference in New Issue
Block a user