summaryrefslogtreecommitdiff
path: root/Configure
diff options
context:
space:
mode:
authorAndy Dougherty <doughera@lafayette.edu>2019-01-31 13:04:32 -0500
committerAndy Dougherty <doughera@lafayette.edu>2019-01-31 13:04:32 -0500
commitba73a4cb8f472480a2d630613d1e9e1172d518d3 (patch)
tree49357f70d89d6c699684b398caff75bf463eadbc /Configure
parentbbe6f202f7bf0108cfc3bc44dbab7be65c113ce2 (diff)
downloadperl-ba73a4cb8f472480a2d630613d1e9e1172d518d3.tar.gz
Improve detection of memrchr, strlcat, and strlcpy.
This is continuation of commit f8d82a1010 addressing [perl #133760]. Linux systems using the musl C library have memmem, memrchr, strlcat, and strlcpy, but the prototypes are only visible if _GNU_SOURCE is defined. This patch makes Configure test both whether the prototype is visible and whether the C symbol is visible. Still to be done is automatically adding _GNU_SOURCE if the musl library is being used -- probably in hints/linux.sh.
Diffstat (limited to 'Configure')
-rwxr-xr-xConfigure63
1 files changed, 57 insertions, 6 deletions
diff --git a/Configure b/Configure
index ad17948a2c..b91d1565b1 100755
--- a/Configure
+++ b/Configure
@@ -16177,8 +16177,25 @@ case "$d_memmem_proto" in
esac
: see if memrchr exists
-set memrchr d_memrchr
-eval $inlibc
+: We need both a prototype in string.h and the symbol in libc.
+echo " "
+d_memrchr_proto=''
+xx1="#$d_gnulibc HAS_GNULIBC"
+xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
+xx3='# define _GNU_SOURCE'
+xx4='#endif'
+set d_memrchr_proto memrchr literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
+eval $hasproto
+case "$d_memrchr_proto" in
+ define) # see if memrchr exists
+ set memrchr d_memrchr
+ eval $inlibc
+ ;;
+ *) val=$undef
+ set d_memrchr
+ eval $setvar
+ ;;
+esac
: see if mkdir exists
set mkdir d_mkdir
@@ -18787,12 +18804,46 @@ set strftime d_strftime
eval $inlibc
: see if strlcat exists
-set strlcat d_strlcat
-eval $inlibc
+: We need both a prototype in string.h and the symbol in libc.
+echo " "
+d_strlcat_proto=''
+xx1="#$d_gnulibc HAS_GNULIBC"
+xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
+xx3='# define _GNU_SOURCE'
+xx4='#endif'
+set d_strlcat_proto strlcat literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
+eval $hasproto
+case "$d_strlcat_proto" in
+ define) # see if strlcat exists
+ set strlcat d_strlcat
+ eval $inlibc
+ ;;
+ *) val=$undef
+ set d_strlcat
+ eval $setvar
+ ;;
+esac
: see if strlcpy exists
-set strlcpy d_strlcpy
-eval $inlibc
+: We need both a prototype in string.h and the symbol in libc.
+echo " "
+d_strlcpy_proto=''
+xx1="#$d_gnulibc HAS_GNULIBC"
+xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
+xx3='# define _GNU_SOURCE'
+xx4='#endif'
+set d_strlcpy_proto strlcpy literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
+eval $hasproto
+case "$d_strlcpy_proto" in
+ define) # see if strlcpy exists
+ set strlcpy d_strlcpy
+ eval $inlibc
+ ;;
+ *) val=$undef
+ set d_strlcpy
+ eval $setvar
+ ;;
+esac
: see if strnlen exists
set strnlen d_strnlen