1 ?RCS: $Id: i_varhdr.U,v 3.0.1.3 1997/02/28 15:54:42 ram Exp $
3 ?RCS: Copyright (c) 1991-1993, Raphael Manfredi
5 ?RCS: You may redistribute only under the terms of the Artistic Licence,
6 ?RCS: as specified in the README file that comes with the distribution.
7 ?RCS: You may reuse parts of this distribution only within the terms of
8 ?RCS: that same Artistic Licence; a copy of which may be found at the root
9 ?RCS: of the source tree for dist 3.0.
11 ?RCS: $Log: i_varhdr.U,v $
12 ?RCS: Revision 3.0.1.3 1997/02/28 15:54:42 ram
13 ?RCS: patch61: varargs script now starts with leading "startsh"
15 ?RCS: Revision 3.0.1.2 1994/10/29 16:21:02 ram
16 ?RCS: patch36: added ?F: line for metalint file checking
18 ?RCS: Revision 3.0.1.1 1994/05/13 15:26:05 ram
19 ?RCS: patch27: this unit now supersedes old i_stdarg.U and i_varargs.U
20 ?RCS: patch27: modified to avoid spurious Whoa warnings (ADO)
22 ?RCS: Revision 3.0 1993/08/18 12:08:49 ram
23 ?RCS: Baseline for dist 3.0 netwide release.
25 ?MAKE:i_stdarg i_varargs i_varhdr: cat +cc +ccflags rm test Setvar \
27 ?MAKE: -pick add $@ %<
29 ?S: This variable conditionally defines the I_STDARG symbol, which
30 ?S: indicates to the C program that <stdarg.h> exists and should
34 ?S: This variable conditionally defines I_VARARGS, which indicates
35 ?S: to the C program that it should include <varargs.h>.
38 ?S: Contains the name of the header to be included to get va_dcl definition.
39 ?S: Typically one of varargs.h or stdarg.h.
42 ?C: This symbol, if defined, indicates that <stdarg.h> exists and should
46 ?C: This symbol, if defined, indicates to the C program that it should
47 ?C: include <varargs.h>.
49 ?H:#$i_stdarg I_STDARG /**/
50 ?H:#$i_varargs I_VARARGS /**/
55 ?LINT:set i_stdarg i_varargs
57 ?X: Don't use setvar because the varags test below might override these.
58 ?X: Actually, the messages here are just informative. We don't wish to set
59 ?X: i_varargs or i_stdarg to their final value before knowing which of the
60 ?X: two we'll include.
62 : see if stdarg is available
64 if $test `./findhdr stdarg.h`; then
65 echo "<stdarg.h> found." >&4
68 echo "<stdarg.h> NOT found." >&4
72 : see if varags is available
74 if $test `./findhdr varargs.h`; then
75 echo "<varargs.h> found." >&4
77 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
81 ?X: if you have stdarg.h, you need to support prototypes to actually use it;
82 ?X: but if stdarg.h exists and the compiler doesn't support prototypes (for some
83 ?X: bizarre reason), we'll fall back to varargs.h anyway so it's not so bad.
85 : set up the varargs testing programs
86 $cat > varargs.c <<EOP
109 p = va_arg(ap, char *);
116 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
125 : now check which varargs header should be included
130 if `./varargs I_STDARG`; then
132 elif `./varargs I_VARARGS`; then
137 if `./varargs I_VARARGS`; then
144 echo "I could not find the definition for va_dcl... You have problems..." >&4
145 val="$undef"; set i_stdarg; eval $setvar
146 val="$undef"; set i_varargs; eval $setvar
153 val="$define"; set i_stdarg; eval $setvar
154 val="$undef"; set i_varargs; eval $setvar
157 val="$undef"; set i_stdarg; eval $setvar
158 val="$define"; set i_varargs; eval $setvar
161 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;