# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
#
-# Generated on Thu May 20 10:07:46 EET DST 1999 [metaconfig 3.0 PL70]
+# Generated on Fri May 28 10:41:29 EET DST 1999 [metaconfig 3.0 PL70]
# (with additional metaconfig patches by perlbug@perl.com)
cat >/tmp/c1$$ <<EOF
osvers=$tmp
elif $test -f /etc/kconfig; then
osname=isc
- if test "$lns" = "ln -s"; then
+ if test "$lns" = "$ln -s"; then
osvers=4
elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
osvers=3
: see if _ptr and _cnt from stdio act std
echo " "
-if $contains '_IO_fpos_t' `./findhdr stdio.h` >/dev/null 2>&1 ; then
+if $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
echo "(Looks like you have stdio.h from Linux.)"
case "$stdio_ptr" in
'') stdio_ptr='((fp)->_IO_read_ptr)'
set ebcdic
eval $setvar
-# SunOS has a <unistd.h> which we generally avoid, but need for this test.
-# For everyone else, we'll trust i_unistd.
-t_unistd=$i_unistd
-case "$osname" in
-sunos) $test -f /usr/include/unistd.h && t_unistd=$define ;;
-esac
$cat >&4 <<EOM
Checking how to flush all pending stdio output...
EOM
-$cat >try.c <<EOCP
+# I only know how to find the first 32 possibly open files on SunOS.
+# See also hints/sunos_4_1.sh and util.c --AD
+case "$osname" in
+sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
+esac
+$cat >>try.c <<EOCP
#include <stdio.h>
-#$t_unistd I_UNISTD
+#$i_unistd I_UNISTD
#ifdef I_UNISTD
-#include <unistd.h>
+# include <unistd.h>
#endif
#$d_sysconf HAS_SYSCONF
#$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
#ifdef TRY_FFLUSH_ALL
{
long open_max = -1;
-# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
- open_max = sysconf(_SC_OPEN_MAX);
+# ifdef PERL_FFLUSH_ALL_FOPEN_MAX
+ open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
# else
-# ifdef FOPEN_MAX
-# open_max = FOPEN_MAX;
+# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
+ open_max = sysconf(_SC_OPEN_MAX);
# else
-# ifdef OPEN_MAX
-# open_max = OPEN_MAX;
+# ifdef FOPEN_MAX
+ open_max = FOPEN_MAX;
# else
-# ifdef _NFILE
-# open_max = _NFILE;
+# ifdef OPEN_MAX
+ open_max = OPEN_MAX;
+# else
+# ifdef _NFILE
+ open_max = _NFILE;
+# endif
# endif
# endif
# endif
-# endif
# ifdef HAS_STDIO_STREAM_ARRAY
if (open_max > 0) {
long i;
for (i = 0; i < open_max; i++)
- fflush(&$stdio_stream_array[i]);
+ if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
+ STDIO_STREAM_ARRAY[i]._file < open_max &&
+ STDIO_STREAM_ARRAY[i]._flag)
+ fflush(&STDIO_STREAM_ARRAY[i]);
}
}
# endif
'') set try -DTRY_FFLUSH_NULL $output
$rm -f try.out
if eval $compile; then
- $cat >&4 <<EOM
-(This test may fail, saying "Core dumped" or something equally evil.)
-EOM
./try$exe_ext 2>/dev/null
- if $test -s try.out -a "X$?" = X42; then
+ code="$?"
+ if $test -s try.out -a "X$code" = X42; then
fflushNULL="`$cat try.out`"
+ else
+ if $test "X$code" != X42; then
+ $cat >&4 <<EOM
+(If this test failed, don't worry, we'll try another method shortly.)
+EOM
+ fi
fi
fi
$rm -f core try.core core.try.*
fflushNULL="$undef"
;;
esac
-: check for fflush all behaviour
-case "$fflushall" in
-'') set try -DTRY_FFLUSH_ALL $output
- $rm -f try.out
- if eval $compile; then
+: check explicit looping only if NULL did not work
+case "$fflushNULL" in
+"$undef")
+ : check for fflush all behaviour
+ case "$fflushall" in
+ '') set try -DTRY_FFLUSH_ALL $output
+ $rm -f try.out
+ if eval $compile; then
$cat >&4 <<EOM
-(Also this test may fail.)
+(Now testing the other method--but note that also this may fail.)
EOM
- ./try$exe_ext 2>/dev/null
- if $test -s try.out -a "X$?" = X42; then
- fflushall="`$cat try.out`"
+ ./try$exe_ext 2>/dev/null
+ if $test -s try.out -a "X$?" = X42; then
+ fflushall="`$cat try.out`"
+ fi
fi
- fi
- $rm -f core try.core core.try.*
- case "$fflushall" in
- x) $cat >&4 <<EOM
-Flushing explicitly all the stdio streams works.
+ $rm -f core try.core core.try.*
+ case "$fflushall" in
+ x) $cat >&4 <<EOM
+Whew. Flushing explicitly all the stdio streams works.
EOM
- fflushall="$define"
- ;;
- '') $cat >&4 <<EOM
-Flushing explicitly all the stdio streams doesn't work.
+ fflushall="$define"
+ ;;
+ '') $cat >&4 <<EOM
+Sigh. Flushing explicitly all the stdio streams doesn't work.
EOM
- fflushall="$undef"
- ;;
- *) $cat >&4 <<EOM
+ fflushall="$undef"
+ ;;
+ *) $cat >&4 <<EOM
Cannot figure out whether flushing stdio streams explicitly works or not.
I'm assuming it doesn't.
EOM
- fflushall="$undef"
+ fflushall="$undef"
+ ;;
+ esac
;;
- esac
- case "$fflushall$fflushNULL" in
- undefdefine)
- $cat >&4 <<EOM
-(That's ok. I'll use fflush(NULL) instead.)
-EOM
+ "$define"|true|[yY]*)
+ fflushall="$define"
+ ;;
+ *)
+ fflushall="$undef"
;;
esac
;;
-$define|true|[yY]*)
- fflushall="$define"
- ;;
-*)
- fflushall="$undef"
+*) fflushall="$undef"
;;
esac
case "$fflushNULL$fflushall" in
#ifdef I_SYS_SELECT
#include <sys/select.h>
#endif
+#$d_socket HAS_SOCKET
+#ifdef HAS_SOCKET
+# include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
+#endif
#include <stdio.h>
$selecttype b;
#define S sizeof(*(b))