?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: Hasproto Inlibc Setvar d_gnulibc
?MAKE:	-pick add $@ %<
?S:d_memmem:
?S:	This variable conditionally defines the HAS_MEMMEM symbol, which
?S:	indicates to the C program that the memmem() routine is available
?S:	to return a pointer to the start of the first occurrence of a
?S:	substring in a memory area (or NULL if not found).
?S:.
?C:HAS_MEMMEM:
?C:	This symbol, if defined, indicates that the memmem routine is
?C:	available to return a pointer to the start of the first occurrence
?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:.
?T:d_memmem_proto xx1 xx2 xx3 xx4
?LINT:set d_memmem 
: see if memmem exists
: We need both a prototype in string.h and the symbol in libc.
echo " "
d_memmem_proto=''
xx1="#$d_gnulibc HAS_GNULIBC"
xx2='#if defined(HAS_GNULIBC) && !defined(_GNU_SOURCE)'
xx3='#   define _GNU_SOURCE'
xx4='#endif'
set d_memmem_proto memmem literal "$xx1" literal "$xx2" literal "$xx3" literal "$xx4" define string.h
eval $hasproto
case "$d_memmem_proto" in
    define) # see if memmem exists
	set memmem d_memmem
	eval $inlibc
	;;
    *)  val=$undef
	set d_memmem
	eval $setvar
	;;
esac

