?RCS: Baseline for dist 3.0 netwide release.
?RCS:
?MAKE:d_vprintf d_charvspr: Compile Guess cat Csym Setvar run rm_try \
- i_stdlib i_unistd i_stdarg i_varargs
+ i_stdlib i_unistd
?MAKE: -pick add $@ %<
?S:d_vprintf:
?S: This variable conditionally defines the HAS_VPRINTF symbol, which
echo 'vprintf() found.' >&4
val="$define"
$cat >try.c <<EOF
-#$i_stdarg I_STDARG /* Only one of these can be defined by i_varhrd */
-#$i_varargs I_VARARGS
#$i_stdlib I_STDLIB
#$i_unistd I_UNISTD
-#ifdef I_STDARG
-# include <stdarg.h>
-#else /* I_VARARGS */
-# include <varargs.h>
-#endif
+#include <stdarg.h>
#ifdef I_UNISTD
# include <unistd.h>
#include <stdio.h> /* vsprintf prototype */
-#ifdef I_STDARG
void xxx(int n, ...)
{
va_list args;
}
int main() { xxx(1, "foo"); }
-#else /* I_VARARGS */
-
-xxx(va_alist)
-va_dcl
-{
- va_list args;
- char buf[10];
- va_start(args);
- exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
-}
-int main() { xxx("foo"); }
-
-#endif
-
EOF
set try
if eval $compile_ok; then
+++ /dev/null
-?RCS: $Id: i_varhdr.U 1 2006-08-24 12:32:52Z rmanfredi $
-?RCS:
-?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
-?RCS:
-?RCS: You may redistribute only under the terms of the Artistic License,
-?RCS: as specified in the README file that comes with the distribution.
-?RCS: You may reuse parts of this distribution only within the terms of
-?RCS: that same Artistic License; a copy of which may be found at the root
-?RCS: of the source tree for dist 4.0.
-?RCS:
-?RCS: $Log: i_varhdr.U,v $
-?RCS: Revision 3.0.1.3 1997/02/28 15:54:42 ram
-?RCS: patch61: varargs script now starts with leading "startsh"
-?RCS:
-?RCS: Revision 3.0.1.2 1994/10/29 16:21:02 ram
-?RCS: patch36: added ?F: line for metalint file checking
-?RCS:
-?RCS: Revision 3.0.1.1 1994/05/13 15:26:05 ram
-?RCS: patch27: this unit now supersedes old i_stdarg.U and i_varargs.U
-?RCS: patch27: modified to avoid spurious Whoa warnings (ADO)
-?RCS:
-?RCS: Revision 3.0 1993/08/18 12:08:49 ram
-?RCS: Baseline for dist 3.0 netwide release.
-?RCS:
-?MAKE:i_stdarg i_varargs i_varhdr: cat +cc +ccflags rm test Setvar \
- Findhdr startsh _o
-?MAKE: -pick add $@ %<
-?S:i_stdarg:
-?S: This variable conditionally defines the I_STDARG symbol, which
-?S: indicates to the C program that <stdarg.h> exists and should
-?S: be included.
-?S:.
-?S:i_varargs:
-?S: This variable conditionally defines I_VARARGS, which indicates
-?S: to the C program that it should include <varargs.h>.
-?S:.
-?S:i_varhdr:
-?S: Contains the name of the header to be included to get va_dcl definition.
-?S: Typically one of varargs.h or stdarg.h.
-?S:.
-?C:I_STDARG:
-?C: This symbol, if defined, indicates that <stdarg.h> exists and should
-?C: be included.
-?C:.
-?C:I_VARARGS:
-?C: This symbol, if defined, indicates to the C program that it should
-?C: include <varargs.h>.
-?C:.
-?H:#$i_stdarg I_STDARG /**/
-?H:#$i_varargs I_VARARGS /**/
-?H:.
-?W:%<:va_dcl
-?F:!varargs
-?T:valstd
-?LINT:set i_stdarg i_varargs
-?X:
-?X: Don't use setvar because the varargs test below might override these.
-?X: Actually, the messages here are just informative. We don't wish to set
-?X: i_varargs or i_stdarg to their final value before knowing which of the
-?X: two we'll include.
-?X:
-: see if stdarg is available
-echo " "
-if $test `./findhdr stdarg.h`; then
- echo "<stdarg.h> found." >&4
- valstd="$define"
-else
- echo "<stdarg.h> NOT found." >&4
- valstd="$undef"
-fi
-
-: see if varargs is available
-echo " "
-if $test `./findhdr varargs.h`; then
- echo "<varargs.h> found." >&4
-else
- echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
-fi
-
-?X:
-?X: if you have stdarg.h, you need to support prototypes to actually use it;
-?X: but if stdarg.h exists and the compiler doesn't support prototypes (for some
-?X: bizarre reason), we'll fall back to varargs.h anyway so it's not so bad.
-?X:
-: set up the varargs testing programs
-$cat > varargs.c <<EOP
-#ifdef I_STDARG
-#include <stdarg.h>
-#endif
-#ifdef I_VARARGS
-#include <varargs.h>
-#endif
-
-#ifdef I_STDARG
-int f(char *p, ...)
-#else
-int f(va_alist)
-va_dcl
-#endif
-{
- va_list ap;
-#ifndef I_STDARG
- char *p;
-#endif
-#ifdef I_STDARG
- va_start(ap,p);
-#else
- va_start(ap);
- p = va_arg(ap, char *);
-#endif
- va_end(ap);
- return 0;
-}
-EOP
-$cat > varargs <<EOP
-$startsh
-if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
- echo "true"
-else
- echo "false"
-fi
-$rm -f varargs$_o
-EOP
-chmod +x varargs
-
-: now check which varargs header should be included
-echo " "
-i_varhdr=''
-val=''
-case "$valstd" in
-"$define")
- if `./varargs I_STDARG`; then
- val='stdarg.h'
- elif `./varargs I_VARARGS`; then
- val='varargs.h'
- fi
- ;;
-*)
- if `./varargs I_VARARGS`; then
- val='varargs.h'
- fi
- ;;
-esac
-case "$val" in
-'')
- echo " "
- echo "*** WHOA THERE!!! ***" >&4
- echo " Your C compiler \"$cc\" doesn't seem to support stdarg or varargs!" >&4
- case "$knowitall" in
- '')
- echo " I'm giving up; maybe you can try again with a different compiler?" >&4
- exit 1
- ;;
- esac
-echo "I could not find the definition for va_dcl... You have problems..." >&4
- val="$undef"; set i_stdarg; eval $setvar
- val="$undef"; set i_varargs; eval $setvar
- ;;
-*)
- set i_varhdr
- eval $setvar
- case "$i_varhdr" in
- stdarg.h)
- val="$define"; set i_stdarg; eval $setvar
- val="$undef"; set i_varargs; eval $setvar
- ;;
- varargs.h)
- val="$undef"; set i_stdarg; eval $setvar
- val="$define"; set i_varargs; eval $setvar
- ;;
- esac
- echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
-esac
-$rm -f varargs*
-
?RCS: Revision 3.0 1993/08/18 12:09:59 ram
?RCS: Baseline for dist 3.0 netwide release.
?RCS:
-?MAKE:vaproto: prototype i_stdarg Setvar
+?MAKE:vaproto: prototype Setvar
?MAKE: -pick add $@ %<
?S:vaproto:
?S: This variable conditionally defines CAN_VAPROTO on systems supporting
?LINT:set vaproto
: see if prototypes support variable argument declarations
echo " "
-case "$prototype$i_stdarg" in
-$define$define)
+case "$prototype" in
+$define)
echo "It appears we'll be able to prototype varargs functions." >&4
val="$define"
;;
+++ /dev/null
-?RCS: $Id$
-?RCS:
-?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
-?RCS:
-?RCS: You may redistribute only under the terms of the Artistic License,
-?RCS: as specified in the README file that comes with the distribution.
-?RCS: You may reuse parts of this distribution only within the terms of
-?RCS: that same Artistic License; a copy of which may be found at the root
-?RCS: of the source tree for dist 4.0.
-?RCS:
-?RCS: $Log: i_varhdr.U,v $
-?RCS: Revision 3.0.1.3 1997/02/28 15:54:42 ram
-?RCS: patch61: varargs script now starts with leading "startsh"
-?RCS:
-?RCS: Revision 3.0.1.2 1994/10/29 16:21:02 ram
-?RCS: patch36: added ?F: line for metalint file checking
-?RCS:
-?RCS: Revision 3.0.1.1 1994/05/13 15:26:05 ram
-?RCS: patch27: this unit now supersedes old i_stdarg.U and i_varargs.U
-?RCS: patch27: modified to avoid spurious Whoa warnings (ADO)
-?RCS:
-?RCS: Revision 3.0 1993/08/18 12:08:49 ram
-?RCS: Baseline for dist 3.0 netwide release.
-?RCS:
-?MAKE:i_stdarg i_varargs i_varhdr: cat +cc +ccflags rm test Setvar \
- Findhdr Warn startsh _o
-?MAKE: -pick add $@ %<
-?S:i_stdarg:
-?S: This variable conditionally defines the I_STDARG symbol, which
-?S: indicates to the C program that <stdarg.h> exists and should
-?S: be included.
-?S:.
-?S:i_varargs:
-?S: This variable conditionally defines I_VARARGS, which indicates
-?S: to the C program that it should include <varargs.h>.
-?S:.
-?S:i_varhdr:
-?S: Contains the name of the header to be included to get va_dcl definition.
-?S: Typically one of varargs.h or stdarg.h.
-?S:.
-?C:I_STDARG:
-?C: This symbol, if defined, indicates that <stdarg.h> exists and should
-?C: be included.
-?C:.
-?C:I_VARARGS:
-?C: This symbol, if defined, indicates to the C program that it should
-?C: include <varargs.h>.
-?C:.
-?H:#$i_stdarg I_STDARG /**/
-?H:#$i_varargs I_VARARGS /**/
-?H:.
-?W:%<:va_dcl
-?F:!varargs
-?T:valstd
-?LINT:set i_stdarg i_varargs
-?X:
-?X: Don't use setvar because the varags test below might override these.
-?X: Actually, the messages here are just informative. We don't wish to set
-?X: i_varargs or i_stdarg to their final value before knowing which of the
-?X: two we'll include.
-?X:
-: see if stdarg is available
-echo " "
-if $test `./findhdr stdarg.h`; then
- echo "<stdarg.h> found." >&4
- valstd="$define"
-else
- echo "<stdarg.h> NOT found." >&4
- valstd="$undef"
-fi
-
-: see if varags is available
-echo " "
-if $test `./findhdr varargs.h`; then
- echo "<varargs.h> found." >&4
-else
- echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
-fi
-
-?X:
-?X: if you have stdarg.h, you need to support prototypes to actually use it;
-?X: but if stdarg.h exists and the compiler doesn't support prototypes (for some
-?X: bizarre reason), we'll fall back to varargs.h anyway so it's not so bad.
-?X:
-: set up the varargs testing programs
-$cat > varargs.c <<EOP
-#ifdef I_STDARG
-#include <stdarg.h>
-#endif
-#ifdef I_VARARGS
-#include <varargs.h>
-#endif
-
-#ifdef I_STDARG
-int f(char *p, ...)
-#else
-int f(va_alist)
-va_dcl
-#endif
-{
- va_list ap;
-#ifndef I_STDARG
- char *p;
-#endif
-#ifdef I_STDARG
- va_start(ap,p);
-#else
- va_start(ap);
- p = va_arg(ap, char *);
-#endif
- va_end(ap);
-}
-EOP
-$cat > varargs <<EOP
-$startsh
-if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
- echo "true"
-else
- echo "false"
-fi
-$rm -f varargs$_o
-EOP
-chmod +x varargs
-
-: now check which varargs header should be included
-echo " "
-i_varhdr=''
-case "$valstd" in
-"$define")
- if `./varargs I_STDARG`; then
- val='stdarg.h'
- elif `./varargs I_VARARGS`; then
- val='varargs.h'
- fi
- ;;
-*)
- if `./varargs I_VARARGS`; then
- val='varargs.h'
- fi
- ;;
-esac
-case "$val" in
-'')
- ./warn "I could not find the definition for va_dcl... You have problems..."
- val="$undef"; set i_stdarg; eval $setvar
- val="$undef"; set i_varargs; eval $setvar
- ;;
-*)
- set i_varhdr
- eval $setvar
- case "$i_varhdr" in
- stdarg.h)
- val="$define"; set i_stdarg; eval $setvar
- val="$undef"; set i_varargs; eval $setvar
- ;;
- varargs.h)
- val="$undef"; set i_stdarg; eval $setvar
- val="$define"; set i_varargs; eval $setvar
- ;;
- esac
- echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
-esac
-$rm -f varargs*
-