1
0
mirror of https://github.com/postgres/postgres.git synced 2025-04-21 12:05:57 +03:00

Make configure probe for mbstowcs_l as well as wcstombs_l.

We previously supposed that any given platform would supply both or neither
of these functions, so that one configure test would be sufficient.  It now
appears that at least on AIX this is not the case ... which is likely an
AIX bug, but nonetheless we need to cope with it.  So use separate tests.
Per bug #6758; thanks to Andrew Hastie for doing the followup testing
needed to confirm what was happening.

Backpatch to 9.1, where we began using these functions.
This commit is contained in:
Tom Lane 2012-08-31 14:18:08 -04:00
parent 6707dd48cd
commit 97395185b8
5 changed files with 12 additions and 5 deletions

3
configure vendored
View File

@ -18942,7 +18942,8 @@ fi
for ac_func in cbrt dlopen fcvt fdatasync getifaddrs getpeerucred getrlimit memmove poll pstat readlink scandir setproctitle setsid sigprocmask symlink sysconf towlower utime utimes waitpid wcstombs wcstombs_l
for ac_func in cbrt dlopen fcvt fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll pstat readlink scandir setproctitle setsid sigprocmask symlink sysconf towlower utime utimes waitpid wcstombs wcstombs_l
do do
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5

View File

@ -1193,7 +1193,7 @@ PGAC_VAR_INT_TIMEZONE
AC_FUNC_ACCEPT_ARGTYPES AC_FUNC_ACCEPT_ARGTYPES
PGAC_FUNC_GETTIMEOFDAY_1ARG PGAC_FUNC_GETTIMEOFDAY_1ARG
AC_CHECK_FUNCS([cbrt dlopen fcvt fdatasync getifaddrs getpeerucred getrlimit memmove poll pstat readlink scandir setproctitle setsid sigprocmask symlink sysconf towlower utime utimes waitpid wcstombs wcstombs_l]) AC_CHECK_FUNCS([cbrt dlopen fcvt fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll pstat readlink scandir setproctitle setsid sigprocmask symlink sysconf towlower utime utimes waitpid wcstombs wcstombs_l])
AC_REPLACE_FUNCS(fseeko) AC_REPLACE_FUNCS(fseeko)
case $host_os in case $host_os in

View File

@ -1191,17 +1191,17 @@ char2wchar(wchar_t *to, size_t tolen, const char *from, size_t fromlen,
else else
{ {
#ifdef HAVE_LOCALE_T #ifdef HAVE_LOCALE_T
#ifdef HAVE_WCSTOMBS_L #ifdef HAVE_MBSTOWCS_L
/* Use mbstowcs_l for nondefault locales */ /* Use mbstowcs_l for nondefault locales */
result = mbstowcs_l(to, str, tolen, locale); result = mbstowcs_l(to, str, tolen, locale);
#else /* !HAVE_WCSTOMBS_L */ #else /* !HAVE_MBSTOWCS_L */
/* We have to temporarily set the locale as current ... ugh */ /* We have to temporarily set the locale as current ... ugh */
locale_t save_locale = uselocale(locale); locale_t save_locale = uselocale(locale);
result = mbstowcs(to, str, tolen); result = mbstowcs(to, str, tolen);
uselocale(save_locale); uselocale(save_locale);
#endif /* HAVE_WCSTOMBS_L */ #endif /* HAVE_MBSTOWCS_L */
#else /* !HAVE_LOCALE_T */ #else /* !HAVE_LOCALE_T */
/* Can't have locale != 0 without HAVE_LOCALE_T */ /* Can't have locale != 0 without HAVE_LOCALE_T */
elog(ERROR, "mbstowcs_l is not available"); elog(ERROR, "mbstowcs_l is not available");

View File

@ -339,6 +339,9 @@
/* Define to 1 if `long long int' works and is 64 bits. */ /* Define to 1 if `long long int' works and is 64 bits. */
#undef HAVE_LONG_LONG_INT_64 #undef HAVE_LONG_LONG_INT_64
/* Define to 1 if you have the `mbstowcs_l' function. */
#undef HAVE_MBSTOWCS_L
/* Define to 1 if you have the `memmove' function. */ /* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE #undef HAVE_MEMMOVE

View File

@ -249,6 +249,9 @@
#define HAVE_LONG_LONG_INT_64 #define HAVE_LONG_LONG_INT_64
#endif #endif
/* Define to 1 if you have the `mbstowcs_l' function. */
#define HAVE_MBSTOWCS_L 1
/* Define to 1 if you have the `memmove' function. */ /* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1 #define HAVE_MEMMOVE 1