From 166988aa358198f2cfaa506d8f653eb8006d0106 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 15 Jul 2013 01:31:51 +0000 Subject: [PATCH] Don't test for wide character functions in configure under OS X. The tests for these functions may succeed on the system we're running under but the functions may not be actually available on the system the application is going to run under (if it's < 10.7). So use our own replacements for these functions unless 10.7 was explicitly chosen as the minimal possible version. An alternative solution could have been to use weak linking but this is more difficult and there is no real gain (performance would need to be measured first). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74523 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- configure | 16 +++++++++++++++- configure.in | 11 ++++++++++- include/wx/osx/config_xcode.h | 11 +++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 04e98042bb..62c43ba92b 100755 --- a/configure +++ b/configure @@ -29860,7 +29860,20 @@ if test "$WCSLEN_FOUND" = 1; then fi -for ac_func in wcsdup wcsftime strnlen wcsnlen wcscasecmp wcsncasecmp +for ac_func in strnlen +do : + ac_fn_c_check_func "$LINENO" "strnlen" "ac_cv_func_strnlen" +if test "x$ac_cv_func_strnlen" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_STRNLEN 1 +_ACEOF + +fi +done + + +if test "$wxUSE_MAC" != 1; then + for ac_func in wcsdup wcsftime wcsnlen wcscasecmp wcsncasecmp do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -29872,6 +29885,7 @@ _ACEOF fi done +fi if test "$USE_HPUX" = 1 -a "$GCC" != "yes"; then CPPFLAGS="-D_INCLUDE__STDC_A1_SOURCE $CPPFLAGS" diff --git a/configure.in b/configure.in index d2193e4992..e420dd5be5 100644 --- a/configure.in +++ b/configure.in @@ -4095,7 +4095,16 @@ if test "$WCSLEN_FOUND" = 1; then AC_DEFINE(HAVE_WCSLEN) fi -AC_CHECK_FUNCS([wcsdup wcsftime strnlen wcsnlen wcscasecmp wcsncasecmp]) +AC_CHECK_FUNCS(strnlen) + +dnl OS X provides the wide character functions starting from 10.7 so our tests +dnl would succeed if we're configuring under 10.7 or later, yet the compiled +dnl programs would fail if ran under 10.6 or earlier. To avoid this problem we +dnl define the corresponding HAVE_XXX in wx/osx/config_xcode.h instead of +dnl testing for them here. +if test "$wxUSE_MAC" != 1; then + AC_CHECK_FUNCS([wcsdup wcsftime wcsnlen wcscasecmp wcsncasecmp]) +fi dnl On HP-UX aCC need this define to find mbstrtowcs() &c dnl Can't be used for g++ since the mbstate_t in wchar.h can conflict diff --git a/include/wx/osx/config_xcode.h b/include/wx/osx/config_xcode.h index 0174f32707..006fef025b 100644 --- a/include/wx/osx/config_xcode.h +++ b/include/wx/osx/config_xcode.h @@ -74,6 +74,17 @@ #define HAVE_VSSCANF_DECL 1 #define HAVE_USLEEP 1 #define HAVE_WCSLEN 1 + +/* Many wchar functions are only available since 10.7 so don't use them if we + want to build the applications that would run under 10.6 and earlier. */ +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_7 +#define HAVE_WCSDUP 1 +#define HAVE_WCSFTIME 1 +#define HAVE_WCSNLEN 1 +#define HAVE_WCSCASECMP 1 +#define HAVE_WCSNCASECMP 1 +#endif + #define SIZEOF_WCHAR_T 4 #define SIZEOF_SHORT 2 #define SIZEOF_INT 4 -- 2.45.2