+++ /dev/null
-?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'
-
?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
?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:.
?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
while $test $# -ge 2; do
case "$1" in
$define) echo "#include <$2>";;
+ literal) echo "$2" ;;
esac ;
shift 2;
done > try.c;