This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Backport detection improvements for memrchr, strlcat, and strlcpy
authorAaron Crane <arc@cpan.org>
Thu, 25 Apr 2019 10:04:41 +0000 (11:04 +0100)
committerAaron Crane <arc@cpan.org>
Thu, 25 Apr 2019 11:07:16 +0000 (12:07 +0100)
This corresponds to Perl commit ba73a4cb8f472480a2d630613d1e9e1172d518d3

U/perl/d_memrchr.U
U/perl/d_strlcat.U
U/perl/d_strlcpy.U

index 4fea9a6..c20ff59 100644 (file)
@@ -1,7 +1,7 @@
 ?RCS: You may distribute under the terms of either the GNU General Public
 ?RCS: License or the Artistic License, as specified in the README file.
 ?RCS:
-?MAKE:d_memrchr: Inlibc
+?MAKE:d_memrchr: Inlibc Hasproto d_gnulibc
 ?MAKE: -pick add $@ %<
 ?S:d_memrchr:
 ?S:    This variable conditionally defines the HAS_MEMRCHR symbol, which
 ?C:.
 ?H:#$d_memrchr HAS_MEMRCHR             /**/
 ?H:.
+?T:d_memrchr_proto xx1 xx2 xx3 xx4
 ?LINT:set d_memrchr
 : 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
 
index c082be9..94811c9 100644 (file)
@@ -5,7 +5,7 @@
 ?RCS: You may distribute under the terms of either the GNU General Public
 ?RCS: License or the Artistic License, as specified in the README file.
 ?RCS:
-?MAKE:d_strlcat: Inlibc
+?MAKE:d_strlcat: Inlibc Hasproto d_gnulibc
 ?MAKE: -pick add $@ %<
 ?S:d_strlcat:
 ?S:    This variable conditionally defines the HAS_STRLCAT symbol, which
 ?C:.
 ?H:#$d_strlcat HAS_STRLCAT             /**/
 ?H:.
+?T:d_strlcat_proto xx1 xx2 xx3 xx4
 ?LINT:set d_strlcat
 : 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
 
index 02193c3..0db37b9 100644 (file)
@@ -5,7 +5,7 @@
 ?RCS: You may distribute under the terms of either the GNU General Public
 ?RCS: License or the Artistic License, as specified in the README file.
 ?RCS:
-?MAKE:d_strlcpy: Inlibc
+?MAKE:d_strlcpy: Inlibc Hasproto d_gnulibc
 ?MAKE: -pick add $@ %<
 ?S:d_strlcpy:
 ?S:    This variable conditionally defines the HAS_STRLCPY symbol, which
 ?C:.
 ?H:#$d_strlcpy HAS_STRLCPY             /**/
 ?H:.
+?T:d_strlcpy_proto xx1 xx2 xx3 xx4
 ?LINT:set d_strlcpy
 : 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