Fixes from Andy Dougherty (via private email).
[p5sagit/p5-mst-13.2.git] / Configure
index ec15a53..2735828 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -20,7 +20,7 @@
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Wed May 12 12:24:25 EET DST 1999 [metaconfig 3.0 PL70]
+# Generated on Fri May 14 00:11:18 EET DST 1999 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.com)
 
 cat >/tmp/c1$$ <<EOF
@@ -404,6 +404,7 @@ d_madvise=''
 d_mblen=''
 d_mbstowcs=''
 d_mbtowc=''
+d_memchr=''
 d_memcmp=''
 d_memcpy=''
 d_memmove=''
@@ -573,6 +574,7 @@ usedl=''
 doublesize=''
 ebcdic=''
 fflushNULL=''
+fflushall=''
 fpostype=''
 gidtype=''
 groupstype=''
@@ -797,6 +799,7 @@ d_fsetpos64=''
 d_ftell64=''
 d_ftello64=''
 d_tmpfile64=''
+stdio_stream_array=''
 sysman=''
 trnl=''
 uidtype=''
@@ -4360,6 +4363,7 @@ while read cline; do
        name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
        case "\$name" in
        *[/\\\\]\$wanted) echo "\$name"; exit 0;;
+       *[\\\\/]\$wanted) echo "\$name"; exit 0;;
        *) name='';;
        esac;
 done;
@@ -8678,6 +8682,10 @@ eval $inlibc
 set mbtowc d_mbtowc
 eval $inlibc
 
+: see if memchr exists
+set memchr d_memchr
+eval $inlibc
+
 : see if memcmp exists
 set memcmp d_memcmp
 eval $inlibc
@@ -10918,44 +10926,148 @@ $rm -f tebcdic.c tebcdic
 set ebcdic
 eval $setvar
 
-: check for fflush NULL behaviour
-case "$fflushNULL" in
-'') $cat <<EOM
+$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
 
-Checking to see whether fflush(NULL) flushes all pending stdio output...
+# 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
+$cat >try.c <<EOCP
 #include <stdio.h>
+#$t_unistd I_UNISTD
+#ifdef I_UNISTD
+#include <unistd.h>
+#endif
+#$d_sysconf HAS_SYSCONF
 int main() {
   FILE* p = fopen("try.out", "w");
+#ifdef TRY_FPUTC
   fputc('x', p);
+#else
+# ifdef TRY_FPRINTF
+  fprintf(p, "x");
+# endif
+#endif
+#ifdef TRY_FFLUSH_NULL
   fflush(NULL);
-  _exit(0);
+#endif
+#ifdef TRY_FFLUSH_ALL
+  {
+    long open_max = -1;
+# if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
+    open_max = sysconf(_SC_OPEN_MAX);
+# else
+#  ifdef FOPEN_MAX
+#   open_max = FOPEN_MAX;
+#  else
+#   ifdef OPEN_MAX
+#   open_max = OPEN_MAX;
+#   else
+#    ifdef _NFILE
+#   open_max = _NFILE;
+#    endif
+#   endif
+#  endif
+# endif
+    if (open_max > 0) {
+      long i;
+      for (i = 0; i < open_max; i++)
+         fflush(&$stdio_stream_array[i]);
+    }  
+  }
+#endif
+  _exit(42);
 }
 EOCP
-       set try
+: first we have to find out how _not_ to flush
+if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
+    output=''
+    set try -DTRY_FPUTC
+    $rm -f try.out
+    if eval $compile; then
+           ./try$exe_ext 2>/dev/null
+           if $test ! -s try.out -a "X$?" = X42; then
+               output=-DTRY_FPUTC
+           fi
+    fi
+    case "$output" in
+    '')
+           set try -DTRY_FPRINTF
+           $rm -f try.out
+           if eval $compile; then
+                   ./try$exe_ext 2>/dev/null
+                   if $test ! -s try.out -a "X$?" = X42; then
+                       output=-DTRY_FPRINTF
+                   fi
+           fi
+       ;;
+    esac
+fi
+: check for fflush NULL behaviour
+case "$fflushNULL" in
+'')    set try -DTRY_FFLUSH_NULL $output
        $rm -f try.out
-       if eval $compile_ok; then
-               case "`$cat try.out`" in
-               x)      cat >&4 <<EOM
+       if eval $compile; then
+               ./try$exe_ext 2>/dev/null
+               if $test -s try.out -a "X$?" = X42; then
+                       fflushNULL="`$cat try.out`"
+               fi
+       fi
+       $rm -f core try.core core.try.*
+       case "$fflushNULL" in
+       x)      $cat >&4 <<EOM
 Your fflush(NULL) works okay.
 EOM
-                       fflushNULL=undef
-                       ;;
-               '')     cat >&4 <<EOM
+               fflushNULL=define
+               ;;
+       '')     $cat >&4 <<EOM
 Your fflush(NULL) isn't working (contrary to ANSI C).
 EOM
-                       fflushNULL=undef
-                       ;;
-               *)      cat >&4 <<EOM
+               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
-                       ;;
-               esac
-       fi
-       $rm -f try.* try
+               fflushNULL=undef
+               ;;
+       esac
        ;;
 $define|true|[yY]*)
        fflushNULL=define
@@ -10964,6 +11076,58 @@ $define|true|[yY]*)
        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.*
+       case "$fflushall" in
+       x)      $cat >&4 <<EOM
+Flushing explicitly all the stdio streams works.
+EOM
+               fflushall=define
+               ;;
+       '')     $cat >&4 <<EOM
+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
+               ;;
+       esac
+       case "$fflushall$fflushNULL" in
+       undefdefine)
+                $cat >&4 <<EOM
+(That's ok.  I'll use fflush(NULL) instead.)
+EOM
+               ;;
+       esac
+       ;;
+$define|true|[yY]*)
+       fflushall=define
+       ;;
+*)
+       fflushall=undef
+       ;;
+esac
+case "$fflushNULL$fflushall" in
+undefundef)
+       $cat <<EOM
+I cannot figure out how to flush pending stdio output.
+EOM
+       ;;
+esac
+$rm -f try.* try$exe_ext
 
 : see what type file positions are declared as in the library
 rp="What is the type for file position used by fsetpos()?"
@@ -12876,6 +13040,7 @@ d_madvise='$d_madvise'
 d_mblen='$d_mblen'
 d_mbstowcs='$d_mbstowcs'
 d_mbtowc='$d_mbtowc'
+d_memchr='$d_memchr'
 d_memcmp='$d_memcmp'
 d_memcpy='$d_memcpy'
 d_memmove='$d_memmove'
@@ -13053,6 +13218,7 @@ exe_ext='$exe_ext'
 expr='$expr'
 extensions='$extensions'
 fflushNULL='$fflushNULL'
+fflushall='$fflushall'
 find='$find'
 firstmakefile='$firstmakefile'
 flex='$flex'
@@ -13299,6 +13465,7 @@ stdio_bufsiz='$stdio_bufsiz'
 stdio_cnt='$stdio_cnt'
 stdio_filbuf='$stdio_filbuf'
 stdio_ptr='$stdio_ptr'
+stdio_stream_array='$stdio_stream_array'
 strings='$strings'
 submit='$submit'
 subversion='$subversion'