This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Backport perl5 core changes by Andy, correcting Aaron's merge 5.30.0
authorH.Merijn Brand - Tux <h.m.brand@xs4all.nl>
Thu, 25 Apr 2019 14:06:57 +0000 (16:06 +0200)
committerH.Merijn Brand - Tux <h.m.brand@xs4all.nl>
Thu, 25 Apr 2019 14:06:57 +0000 (16:06 +0200)
U/perl/Hasproto.U [deleted file]
U/perl/d_memmem.U
U/protos/Hasproto.U

diff --git a/U/perl/Hasproto.U b/U/perl/Hasproto.U
deleted file mode 100644 (file)
index 04e91a5..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-?RCS: $Id: Hasproto.U $
-?RCS:
-?RCS: Copyright (c) 1998 Andy Dougherty
-?RCS:
-?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:
-?X:    This unit generates a $hasproto string that is used internally
-?X:    by Configure to check if this system has a prototype for a
-?X:    particular function
-?X:
-?X:    To use it, say something like:
-?X:            set d_getnetent_proto getnetent $i_netdb netdb.h
-?X:            eval $hasproto
-?X:    Or, for more complicated sets of headers, do something like
-?X:    hdrs="$define sys/types.h
-?X:            $i_systime sys/time.h
-?X:            $i_sysselct sys/select.h
-?X:            $i_netdb netdb.h"
-?X:    set d_getnetent_proto getnetent $hdrs
-?X:    eval $hasproto
-?X:
-?MAKE:Hasproto: Setvar cppstdin cppflags cppminus contains rm_try test
-?MAKE: -pick add $@ %<
-?T:func varname
-?F:!try.c
-?V:hasproto
-: Define hasproto macro for Configure internal use
-hasproto='varname=$1; func=$2; shift; shift;
-while $test $# -ge 2; do
-       case "$1" in
-       $define) echo "#include <$2>";;
-       literal) echo "$2" ;;
-       esac ;
-    shift 2;
-done > try.c;
-$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
-if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
-       echo "$func() prototype found.";
-       val="$define";
-else
-       echo "$func() prototype NOT found.";
-       val="$undef";
-fi;
-set $varname;
-eval $setvar;
-$rm_try tryout.c'
-
index 3df4c82..fa5dee1 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_memmem: Inlibc d_gnulibc Hasproto
+?MAKE:d_memmem: Hasproto Inlibc Setvar d_gnulibc
 ?MAKE: -pick add $@ %<
 ?S:d_memmem:
 ?S:    This variable conditionally defines the HAS_MEMMEM symbol, which
@@ -13,6 +13,9 @@
 ?C:    This symbol, if defined, indicates that the memmem routine is
 ?C:    available to return a pointer to the start of the first occurance
 ?C:    of a substring in a memory area (or NULL if not found).
+?C:    In glibc, memmem is a GNU extension.  The function is visible in
+?C:    libc, but the prototype is only visible if _GNU_SOURCE is #defined.
+?C:    Thus we only define this if both the prototype and symbol are found.
 ?C:.
 ?H:#$d_memmem HAS_MEMMEM               /**/
 ?H:.
index ce1d624..47218b5 100644 (file)
 ?X:    set d_getnetent_proto getnetent $hdrs
 ?X:    eval $hasproto
 ?X:
+?X:    There is also an 'escape' hatch built in.  If you have a pair
+?X:    of args   'literal 'stuff' then 'stuff' gets included literally
+?X:    into the test program.  See Protochk.U for more details.
+?X:
 ?MAKE:Hasproto: Setvar cppstdin cppflags cppminus contains rm_try test
 ?MAKE: -pick add $@ %<
 ?T:func varname
@@ -30,6 +34,7 @@ hasproto='varname=$1; func=$2; shift; shift;
 while $test $# -ge 2; do
        case "$1" in
        $define) echo "#include <$2>";;
+       literal) echo "$2" ;;
        esac ;
     shift 2;
 done > try.c;