Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Make configure probe for mbstowcs_l as well as wcstombs_l.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 31 Aug 2012 18:18:02 +0000 (14:18 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 31 Aug 2012 18:18:02 +0000 (14:18 -0400)
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.

configure
configure.in
src/backend/utils/adt/pg_locale.c
src/include/pg_config.h.in
src/include/pg_config.h.win32

index 58c4ac426f3505b05670739e7dc5940365a1fffa..704142ebb50e634878b587acda0478a16c376015 100755 (executable)
--- a/configure
+++ b/configure
@@ -19149,7 +19149,8 @@ fi
 
 
 
-for ac_func in cbrt dlopen fdatasync getifaddrs getpeerucred getrlimit memmove poll pstat readlink setproctitle setsid sigprocmask symlink towlower utime utimes waitpid wcstombs wcstombs_l
+
+for ac_func in cbrt dlopen fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll pstat readlink setproctitle setsid sigprocmask symlink towlower utime utimes waitpid wcstombs wcstombs_l
 do
 as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
 { $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
index c6a0a5ce6b4739ffc781e7f81f2f63affe2cc529..e61e65f4e8b1503c1ecb66b88584dd347c6b7e4d 100644 (file)
@@ -1197,7 +1197,7 @@ PGAC_VAR_INT_TIMEZONE
 AC_FUNC_ACCEPT_ARGTYPES
 PGAC_FUNC_GETTIMEOFDAY_1ARG
 
-AC_CHECK_FUNCS([cbrt dlopen fdatasync getifaddrs getpeerucred getrlimit memmove poll pstat readlink setproctitle setsid sigprocmask symlink towlower utime utimes waitpid wcstombs wcstombs_l])
+AC_CHECK_FUNCS([cbrt dlopen fdatasync getifaddrs getpeerucred getrlimit mbstowcs_l memmove poll pstat readlink setproctitle setsid sigprocmask symlink towlower utime utimes waitpid wcstombs wcstombs_l])
 
 AC_REPLACE_FUNCS(fseeko)
 case $host_os in
index de881bf6344908ab861ac36897c9183313b7437d..495fe4db6ae2e2031660139323e5727d742eda93 100644 (file)
@@ -1205,17 +1205,17 @@ char2wchar(wchar_t *to, size_t tolen, const char *from, size_t fromlen,
        else
        {
 #ifdef HAVE_LOCALE_T
-#ifdef HAVE_WCSTOMBS_L
+#ifdef HAVE_MBSTOWCS_L
            /* Use mbstowcs_l for nondefault locales */
            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 */
            locale_t    save_locale = uselocale(locale);
 
            result = mbstowcs(to, str, tolen);
 
            uselocale(save_locale);
-#endif   /* HAVE_WCSTOMBS_L */
+#endif   /* HAVE_MBSTOWCS_L */
 #else                          /* !HAVE_LOCALE_T */
            /* Can't have locale != 0 without HAVE_LOCALE_T */
            elog(ERROR, "mbstowcs_l is not available");
index 8430608bfc80a51d6a7ea0e0fb1c3baac445d67a..b469d52718ddfec6b4a67beab1e5bd4007cbb4a3 100644 (file)
 /* Define to 1 if `long long int' works and is 64 bits. */
 #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. */
 #undef HAVE_MEMMOVE
 
index 52b13f3217c3f5ac76eedd6583862acf51005923..cf92bda073043542449f3b9fb56596956b859289 100644 (file)
 #define HAVE_LONG_LONG_INT_64
 #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 HAVE_MEMMOVE 1