# $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
#
-# Generated on Fri May 14 00:11:18 EET DST 1999 [metaconfig 3.0 PL70]
+# Generated on Sat May 22 00:54:37 EET DST 1999 [metaconfig 3.0 PL70]
# (with additional metaconfig patches by perlbug@perl.com)
cat >/tmp/c1$$ <<EOF
d_ftell64=''
d_ftello64=''
d_tmpfile64=''
+d_stdio_stream_array=''
stdio_stream_array=''
sysman=''
trnl=''
set d_stdiobase
eval $setvar
+$cat >&4 <<EOM
+Checking how to access stdio streams by file descriptor number...
+EOM
+case "$stdio_stream_array" in
+'') $cat >try.c <<EOCP
+#include <stdio.h>
+int main() {
+ if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
+ printf("yes\n");
+}
+EOCP
+ for s in _iob __iob __sF
+ do
+ set try -DSTDIO_STREAM_ARRAY=$s
+ if eval $compile; then
+ case "`./try$exe_ext`" in
+ yes) stdio_stream_array=$s; break ;;
+ esac
+ fi
+ done
+ $rm -f try.* try$exe_ext
+esac
+case "$stdio_stream_array" in
+'') $cat >&4 <<EOM
+I can't figure out how to access stdio streams by file descriptor number.
+EOM
+ d_stdio_stream_array="$undef"
+ ;;
+*) $cat >&4 <<EOM
+You can access stdio streams by file descriptor number by the $stdio_stream_array array.
+EOM
+ d_stdio_stream_array="$define"
+ ;;
+esac
+
: see if strcoll exists
set strcoll d_strcoll
eval $inlibc
set ebcdic
eval $setvar
-$cat >&4 <<EOM
-Checking how to access stdio streams by file descriptor number...
-EOM
-case "$stdio_stream_array" in
-'') $cat >try.c <<EOCP
-#include <stdio.h>
-int main() {
- if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
- printf("yes\n");
-}
-EOCP
- for s in _iob __iob __sF
- do
- set try -DSTDIO_STREAM_ARRAY=$s
- if eval $compile_ok; then
- case "`./try$exe_ext`" in
- yes) stdio_stream_array=$s; break ;;
- esac
- fi
- done
- $rm -f try.* try$exe_ext
-esac
-case "$stdio_stream_array" in
-'') $cat >&4 <<EOM
-I can't figure out how to access stdio streams by file descriptor number.
-EOM
- ;;
-*) $cat >&4 <<EOM
-You can access stdio streams by file descriptor number by using $stdio_stream_array.
-EOM
- ;;
-esac
-
# 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
#include <stdio.h>
#$t_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 HAS_STDIO_STREAM_ARRAY
+# define STDIO_STREAM_ARRAY $stdio_stream_array
+#endif
int main() {
FILE* p = fopen("try.out", "w");
#ifdef TRY_FPUTC
# 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]);
}
}
+# endif
#endif
_exit(42);
}
$rm -f try.out
if eval $compile; then
./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.*
x) $cat >&4 <<EOM
Your fflush(NULL) works okay.
EOM
- fflushNULL=define
+ fflushNULL="$define"
;;
'') $cat >&4 <<EOM
Your fflush(NULL) isn't working (contrary to ANSI C).
EOM
- fflushNULL=undef
+ fflushNULL="$undef"
;;
*) $cat >&4 <<EOM
Cannot figure out whether your fflush(NULL) works or not.
I'm assuming it doesn't (contrary to ANSI C).
EOM
- fflushNULL=undef
+ fflushNULL="$undef"
;;
esac
;;
$define|true|[yY]*)
- fflushNULL=define
+ fflushNULL="$define"
;;
*)
- fflushNULL=undef
+ 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
- ./try$exe_ext 2>/dev/null
- if $test -s try.out -a "X$?" = X42; then
- fflushall="`$cat try.out`"
- fi
- fi
- $rm -f core try.core core.try.*
+: check explicit looping only if NULL did not work
+case "$fflushNULL" in
+"$undef")
+ : check for fflush all behaviour
case "$fflushall" in
- x) $cat >&4 <<EOM
-Flushing explicitly all the stdio streams works.
+ '') set try -DTRY_FFLUSH_ALL $output
+ $rm -f try.out
+ if eval $compile; then
+ $cat >&4 <<EOM
+(Now testing the other method--but note that also this may fail.)
EOM
- fflushall=define
- ;;
- '') $cat >&4 <<EOM
-Flushing explicitly all the stdio streams doesn't work.
+ ./try$exe_ext 2>/dev/null
+ if $test -s try.out -a "X$?" = X42; then
+ fflushall="`$cat try.out`"
+ fi
+ fi
+ $rm -f core try.core core.try.*
+ case "$fflushall" in
+ x) $cat >&4 <<EOM
+Whew. Flushing explicitly all the stdio streams works.
EOM
- fflushall=undef
- ;;
- *) $cat >&4 <<EOM
+ fflushall="$define"
+ ;;
+ '') $cat >&4 <<EOM
+Sigh. Flushing explicitly all the stdio streams doesn't work.
+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
d_statvfs='$d_statvfs'
d_stdio_cnt_lval='$d_stdio_cnt_lval'
d_stdio_ptr_lval='$d_stdio_ptr_lval'
+d_stdio_stream_array='$d_stdio_stream_array'
d_stdiobase='$d_stdiobase'
d_stdstdio='$d_stdstdio'
d_store64='$d_store64'