diff --git a/Configure b/Configure index 32a02544b79b..17228824683c 100755 --- a/Configure +++ b/Configure @@ -1401,6 +1401,7 @@ installvendorscript='' vendorscript='' vendorscriptexp='' versiononly='' +xlocale_needed='' yacc='' yaccflags='' CONFIG='' @@ -16095,6 +16096,54 @@ eval $inlibc set localeconv_l d_localeconv_l eval $inlibc +: if we have xlocale.h, check whether it is needed +case "$i_xlocale$d_newlocale$xlocale_needed" in +"$define$define") + echo "Checking if xlocale.h is needed..." >&4 + $cat >try.c < +#include +#ifdef TRY_XLOCALE +#include +#endif +#$d_localeconv_l HAVE_LOCALECONV_L + +#ifdef HAVE_LOCALECONV_L +struct lconv *(*lcptr)(locale_t) = localeconv_l; +#endif + +int main(void) { + locale_t lc = newlocale(LC_ALL_MASK, "C", (locale_t)0); + +#ifdef HAVE_LOCALECONV_L + /* FreeBSD hides only localeconv_l() in xlocale.h */ + struct lconv *lcbuf = localeconv_l(lc); + printf("decimal: %s\n", lcbuf->decimal_point); +#endif + + freelocale(lc); + return 0; +} +EOF + set try + if eval $compile && $run ./try > /dev/null 2>&1 ; then + echo "xlocale.h isn't needed" >&4 + xlocale_needed=$undef + else + set try -DTRY_XLOCALE + if eval $compile && $run ./try > /dev/null 2>&1 ; then + xlocale_needed=$define + echo "xlocale.h is needed" >&4 + else + echo "I can't build my test either way" >&4 + xlocale_needed=$undef + fi + fi + $rm_try + ;; +*) xlocale_needed=$undef ;; +esac + : see if localtime_r exists set localtime_r d_localtime_r eval $inlibc @@ -25368,6 +25417,7 @@ version_patchlevel_string='$version_patchlevel_string' versiononly='$versiononly' vi='$vi' xlibpth='$xlibpth' +xlocale_needed='$xlocale_needed' yacc='$yacc' yaccflags='$yaccflags' zcat='$zcat' diff --git a/Cross/config.sh-arm-linux b/Cross/config.sh-arm-linux index 3534d3734f05..dc3e95e59b76 100644 --- a/Cross/config.sh-arm-linux +++ b/Cross/config.sh-arm-linux @@ -1189,6 +1189,7 @@ version_patchlevel_string='version 35 subversion 3' versiononly='undef' vi='' xlibpth='/usr/lib/386 /lib/386' +xlocale_needed='undef' yacc='yacc' yaccflags='' zcat='' diff --git a/Cross/config.sh-arm-linux-n770 b/Cross/config.sh-arm-linux-n770 index d3aad6985a34..37460a985947 100644 --- a/Cross/config.sh-arm-linux-n770 +++ b/Cross/config.sh-arm-linux-n770 @@ -1187,6 +1187,7 @@ version_patchlevel_string='version 35 subversion 3' versiononly='undef' vi='' xlibpth='/usr/lib/386 /lib/386' +xlocale_needed='undef' yacc='yacc' yaccflags='' zcat='' diff --git a/NetWare/config.wc b/NetWare/config.wc index cd2ec7361937..e6f9650a2e21 100644 --- a/NetWare/config.wc +++ b/NetWare/config.wc @@ -1140,6 +1140,7 @@ vendorprefixexp='' version='~VERSION~' vi='' xlibpth='/usr/lib/386 /lib/386' +xlocale_needed='undef' zcat='' zip='zip' PERL_REVISION='~PERL_REVISION~' diff --git a/Porting/config.sh b/Porting/config.sh index 8a6ab5d17f53..89f6bd952d6b 100644 --- a/Porting/config.sh +++ b/Porting/config.sh @@ -1225,6 +1225,7 @@ version_patchlevel_string='version 35 subversion 3' versiononly='define' vi='' xlibpth='/usr/lib/386 /lib/386' +xlocale_needed='undef' yacc='yacc' yaccflags='' zcat='' diff --git a/config_h.SH b/config_h.SH index 40a80e312e0f..834dc9f2ee54 100755 --- a/config_h.SH +++ b/config_h.SH @@ -3142,8 +3142,12 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un * available to return the name of the locale for a category mask. */ /* I_XLOCALE: - * This symbol, if defined, indicates to the C program that it should - * include to get uselocale() and its friends. + * This symbol, if defined, indicates to the C program that the + * xlocale.h header is available. See also NEED_XLOCALE_H. + */ +/* NEED_XLOCALE_H: + * This symbol, if defined, indicates that the C program should + * include to get newlocale() and its friends. */ #$d_newlocale HAS_NEWLOCALE /**/ #$d_freelocale HAS_FREELOCALE /**/ @@ -3151,6 +3155,7 @@ sed <$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un #$d_duplocale HAS_DUPLOCALE /**/ #$d_querylocale HAS_QUERYLOCALE /**/ #$i_xlocale I_XLOCALE /**/ +#$xlocale_needed NEED_XLOCALE_H /**/ /* HAS_NEXTAFTER: * This symbol, if defined, indicates that the nextafter routine is diff --git a/configure.com b/configure.com index 2704cb24595e..126a372e5bcf 100644 --- a/configure.com +++ b/configure.com @@ -6790,6 +6790,7 @@ $ WC "i_vfork='undef'" $ WC "i_wchar='define'" $ WC "i_wctype='define'" $ WC "i_xlocale='undef'" +$ WC "xlocale_needed='undef'" $ WC "inc_version_list='0'" $ WC "inc_version_list_init='0'" $ WC "installarchlib='" + installarchlib + "'" diff --git a/perl.h b/perl.h index 36dd4a9235a8..9d84c6b524cd 100644 --- a/perl.h +++ b/perl.h @@ -926,7 +926,7 @@ Example usage: # include #endif -#ifdef I_XLOCALE +#ifdef NEED_XLOCALE_H # include #endif diff --git a/plan9/config_sh.sample b/plan9/config_sh.sample index 4da1f0f6822a..23c15a3e90d3 100644 --- a/plan9/config_sh.sample +++ b/plan9/config_sh.sample @@ -1150,6 +1150,7 @@ version_patchlevel_string='version 35 subversion 3' versiononly='undef' vi='' xlibpth='' +xlocale_needed='undef' yacc='yacc' yaccflags='' zcat='' diff --git a/uconfig.h b/uconfig.h index 40ca1fd42c14..49f836bc257b 100644 --- a/uconfig.h +++ b/uconfig.h @@ -3107,8 +3107,12 @@ * available to return the name of the locale for a category mask. */ /* I_XLOCALE: - * This symbol, if defined, indicates to the C program that it should - * include to get uselocale() and its friends. + * This symbol, if defined, indicates to the C program that the + * xlocale.h header is available. See also NEED_XLOCALE_H. + */ +/* NEED_XLOCALE_H: + * This symbol, if defined, indicates that the C program should + * include to get newlocale() and its friends. */ /*#define HAS_NEWLOCALE / **/ /*#define HAS_FREELOCALE / **/ @@ -3116,6 +3120,7 @@ /*#define HAS_DUPLOCALE / **/ /*#define HAS_QUERYLOCALE / **/ /*#define I_XLOCALE / **/ +/*#define NEED_XLOCALE_H / **/ /* HAS_NEXTAFTER: * This symbol, if defined, indicates that the nextafter routine is @@ -5313,6 +5318,6 @@ #endif /* Generated from: - * 55a531381747550c11c2c61b9a9da2dacde4df465b874df55a9c923e495deb3a config_h.SH - * 2fece1e405c60ae089fe55acaa42471b6fba78b7ab4cefc6d5e18a94b72fc2c4 uconfig.sh + * c0ae90ad8256740b1a7872cebe079e964a7a9a5c8128038a60de0ab610d9e9fe config_h.SH + * 24570f2ff38b22b436d34127ff85a3f3a075a4dea1359c56f16196bdbe376b1c uconfig.sh * ex: set ro: */ diff --git a/uconfig.sh b/uconfig.sh index 898ff9979fe5..0be83882a007 100644 --- a/uconfig.sh +++ b/uconfig.sh @@ -922,4 +922,5 @@ vendorarchexp='' vendorlib_stem='' vendorlibexp='' versiononly='undef' +xlocale_needed='undef' zip='' diff --git a/uconfig64.sh b/uconfig64.sh index c9a9559af7ad..307e5029469d 100644 --- a/uconfig64.sh +++ b/uconfig64.sh @@ -922,4 +922,5 @@ vendorarchexp='' vendorlib_stem='' vendorlibexp='' versiononly='undef' +xlocale_needed='undef' zip='' diff --git a/win32/config.gc b/win32/config.gc index 55280f61a1ed..bd663c0fe6d6 100644 --- a/win32/config.gc +++ b/win32/config.gc @@ -1184,6 +1184,7 @@ version_patchlevel_string='' versiononly='undef' vi='' xlibpth='/usr/lib/386 /lib/386' +xlocale_needed='undef' yacc='yacc' yaccflags='' zcat='' diff --git a/win32/config.vc b/win32/config.vc index 0f89bc6ee0eb..dbc8967bd68c 100644 --- a/win32/config.vc +++ b/win32/config.vc @@ -1183,6 +1183,7 @@ version_patchlevel_string='' versiononly='undef' vi='' xlibpth='/usr/lib/386 /lib/386' +xlocale_needed='undef' yacc='yacc' yaccflags='' zcat=''