summaryrefslogtreecommitdiff
path: root/Configure
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2021-06-24 14:49:55 +1000
committerTony Cook <tony@develop-help.com>2021-08-11 14:40:22 +1000
commit68f1b6d700b9662cfdec43ceddbd086d4b59c87e (patch)
tree63621a829b468f50b903296b5259e9ebfa80ce02 /Configure
parent7e12ee61fac08d210b4f192160a1de75771f27c9 (diff)
downloadperl-68f1b6d700b9662cfdec43ceddbd086d4b59c87e.tar.gz
only #include <xlocale.h> when it is actually needed
This header was originally only needed for builds on darwin and FreeBSD, but was being included whenever it was detected. This has caused problems when what was an internal header was removed (from glibc) and in general wasn't needed anyway. On FreeBSD only localeconv_l() requires xlocale.h, so we test specifically for that.
Diffstat (limited to 'Configure')
-rwxr-xr-xConfigure50
1 files changed, 50 insertions, 0 deletions
diff --git a/Configure b/Configure
index 32a02544b7..1722882468 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 <<EOF
+#include <locale.h>
+#include <stdio.h>
+#ifdef TRY_XLOCALE
+#include <xlocale.h>
+#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'