Add HAS_MEMCHR and make memchr into a cpp macro if it already isn't.
[p5sagit/p5-mst-13.2.git] / Configure
index 3aa2aaa..890bfd4 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 Mon Apr 19 22:21:08 EET DST 1999 [metaconfig 3.0 PL70]
+# Generated on Thu May 13 16:42:40 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=''
@@ -572,6 +573,8 @@ lddlflags=''
 usedl=''
 doublesize=''
 ebcdic=''
+fflushNULL=''
+fflushall=''
 fpostype=''
 gidtype=''
 groupstype=''
@@ -605,6 +608,7 @@ i_mntent=''
 i_ndbm=''
 i_netdb=''
 i_neterrno=''
+i_netinettcp=''
 i_niin=''
 i_sysin=''
 i_poll=''
@@ -795,6 +799,7 @@ d_fsetpos64=''
 d_ftell64=''
 d_ftello64=''
 d_tmpfile64=''
+stdio_stream_array=''
 sysman=''
 trnl=''
 uidtype=''
@@ -4343,10 +4348,13 @@ $cat >findhdr <<EOF
 $startsh
 wanted=\$1
 name=''
-if test -f $usrinc/\$wanted; then
-       echo "$usrinc/\$wanted"
-       exit 0
-fi
+for usrincdir in $usrinc
+do
+       if test -f \$usrincdir/\$wanted; then
+               echo "\$usrincdir/\$wanted"
+               exit 0
+       fi
+done
 awkprg='{ print \$$fieldn }'
 echo "#include <\$wanted>" > foo\$\$.c
 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
@@ -4354,7 +4362,7 @@ $grep "^[         ]*#.*\$wanted" | \
 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;
@@ -8006,6 +8014,7 @@ else
                eval $setvar
        done
 fi
+
 : see if flock exists
 set flock d_flock
 eval $inlibc
@@ -8672,6 +8681,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
@@ -10912,6 +10925,196 @@ $rm -f tebcdic.c tebcdic
 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
+
+$cat >&4 <<EOM
+Checking how to flush all pending stdio output...
+EOM
+$cat >try.c <<EOCP
+#include <stdio.h>
+#$i_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);
+#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
+: 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_ok; 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_ok; 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
+               ./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=define
+               ;;
+       '')     cat >&4 <<EOM
+Your fflush(NULL) isn't working (contrary to ANSI C).
+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
+       ;;
+$define|true|[yY]*)
+       fflushNULL=define
+       ;;
+*)
+       fflushNULL=undef
+       ;;
+esac
+: check for fflush all behaviour
+case "$fflushall" in
+'')    set try -DTRY_FFLUSH_ALL $output
+       $rm -f try.out
+       if eval $compile_ok; 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 stream explicitly works or not.
+I'm assuming it doesn't.
+EOM
+               fflushall=undef
+               ;;
+       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()?"
 set fpos_t fpostype long stdio.h sys/types.h
@@ -11955,6 +12158,10 @@ esac
 set i_neterrno
 eval $setvar
 
+: see if netinet/tcp.h is available
+set netinet/tcp.h i_netinettcp
+eval $inhdr
+
 : see if this is a poll.h system
 set poll.h i_poll
 eval $inhdr
@@ -12819,6 +13026,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'
@@ -12995,6 +13203,8 @@ eunicefix='$eunicefix'
 exe_ext='$exe_ext'
 expr='$expr'
 extensions='$extensions'
+fflushNULL='$fflushNULL'
+fflushall='$fflushall'
 find='$find'
 firstmakefile='$firstmakefile'
 flex='$flex'
@@ -13037,6 +13247,7 @@ i_mntent='$i_mntent'
 i_ndbm='$i_ndbm'
 i_netdb='$i_netdb'
 i_neterrno='$i_neterrno'
+i_netinettcp='$i_netinettcp'
 i_niin='$i_niin'
 i_poll='$i_poll'
 i_pthread='$i_pthread'
@@ -13240,6 +13451,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'