summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Dougherty <doughera@lafayette.edu>2019-01-31 13:04:32 -0500
committerSteve Hay <steve.m.hay@googlemail.com>2019-04-02 12:23:59 +0100
commitd1527667bc3799b51cc18df51b90099d5293f8ad (patch)
tree14d4c644aa48c7c2e66ae16266379797a16f7290
parent85defe5657e2c0da227947b371b7139a47236462 (diff)
downloadperl-d1527667bc3799b51cc18df51b90099d5293f8ad.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. (cherry picked from commit ba73a4cb8f472480a2d630613d1e9e1172d518d3)
-rwxr-xr-xConfigure63
1 files changed, 57 insertions, 6 deletions
diff --git a/Configure b/Configure
index 0cb7179d55..f99377e9dd 100755
--- a/Configure
+++ b/Configure
@@ -16196,8 +16196,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
@@ -18806,12 +18823,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