develooper Front page | perl.perl5.changes | Postings from January 2019

[perl.git] branch blead updated. v5.29.7-35-g04db542212

From:
Andy Dougherty
Date:
January 31, 2019 19:41
Subject:
[perl.git] branch blead updated. v5.29.7-35-g04db542212
Message ID:
E1gpICs-0005fg-8O@git.dc.perl.space
In perl.git, the branch blead has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/04db542212fdad3a62f13afe741c99028f4bf799?hp=bbe6f202f7bf0108cfc3bc44dbab7be65c113ce2>

- Log -----------------------------------------------------------------
commit 04db542212fdad3a62f13afe741c99028f4bf799
Author: Andy Dougherty <doughera@lafayette.edu>
Date:   Thu Jan 31 14:05:41 2019 -0500

    Define _GNU_SOURCE if using the musl libc on linux.
    
    Together with prior commits ba73a4cb8f, f8d82a1010, and 63c1fa6a98,
    this should close [perl #133760].

commit ba73a4cb8f472480a2d630613d1e9e1172d518d3
Author: Andy Dougherty <doughera@lafayette.edu>
Date:   Thu Jan 31 13:04:32 2019 -0500

    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.

-----------------------------------------------------------------------

Summary of changes:
 Configure      | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
 hints/linux.sh | 10 ++++++++++
 2 files changed, 67 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
diff --git a/hints/linux.sh b/hints/linux.sh
index 3f38ea07f1..a985a8ee1b 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -178,6 +178,16 @@ case "$plibpth" in
     ;;
 esac
 
+# For the musl libc, perl should #define _GNU_SOURCE.  Otherwise, some
+# available functions, like memem, won't be used.  See the discussion in
+# [perl #133760].  musl doesn't offer an easy way to identify it, but,
+# at least on alpine linux, the ldd --version output contains the
+# string 'musl.'
+case `ldd --version 2>&1` in
+    musl*)  ccflags="$ccflags -D_GNU_SOURCE" ;;
+        *) ;;
+esac
+
 # libquadmath is sometimes installed as gcc internal library,
 # so contrary to our usual policy of *not* looking at gcc internal
 # directories we now *do* look at them, in case they contain

-- 
Perl5 Master Repository



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About