Make the stdio test program of 7427 less noisy while being
[p5sagit/p5-mst-13.2.git] / Configure
index 1425389..c07cf35 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 Tue Oct 24 21:00:34 EET DST 2000 [metaconfig 3.0 PL70]
+# Generated on Tue Nov  7 00:26:20 EET 2000 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.org)
 
 cat >/tmp/c1$$ <<EOF
@@ -348,6 +348,7 @@ d_endsent=''
 d_fchmod=''
 d_fchown=''
 d_fcntl=''
+d_fcntl_can_lock=''
 d_fd_macros=''
 d_fd_set=''
 d_fds_bits=''
@@ -2263,7 +2264,10 @@ if test -f config.sh; then
        rp="I see a config.sh file.  Shall I use it to set the defaults?"
        . UU/myread
        case "$ans" in
-       n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
+       n*|N*) echo "OK, I'll ignore it."
+               mv config.sh config.sh.old
+               myuname="$newmyuname"
+               ;;
        *)  echo "Fetching default answers from your old config.sh file..." >&4
                tmp_n="$n"
                tmp_c="$c"
@@ -2428,7 +2432,7 @@ EOM
                        esac
                        ;;
                next*) osname=next ;;
-               NonStop-UX) osname=nonstopux ;;
+               nonstop-ux) osname=nonstopux ;;
                POSIX-BC | posix-bc ) osname=posix-bc
                        osvers="$3"
                        ;;
@@ -2674,7 +2678,6 @@ cd UU
        ;;
 esac
 test "$override" && . ./optdef.sh
-myuname="$newmyuname"
 
 : Restore computed paths
 for file in $loclist $trylist; do
@@ -2908,7 +2911,7 @@ if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
 then
        echo "Looks kind of like an OSF/1 system, but we'll see..."
        echo exit 0 >osf1
-elif test `echo abc | tr a-z A-Z` = Abc ; then
+elif test `echo abc | $tr a-z A-Z` = Abc ; then
        xxx=`./loc addbib blurfl $pth`
        if $test -f $xxx; then
        echo "Looks kind of like a USG system with BSD features, but we'll see..."
@@ -3288,7 +3291,7 @@ esac
 
 case "$fn" in
 *\(*)
-       expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
+       expr $fn : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
        fn=`echo $fn | sed 's/(.*)//'`
        ;;
 esac
@@ -4741,7 +4744,7 @@ unknown)
                                s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
                                G
                                s/\n/ /' | \
-                        sort | $sed -e 's/^.* //'`
+                        $sort | $sed -e 's/^.* //'`
                eval set \$$#
        done
        $test -r $1 || set /usr/ccs/lib/libc.$so
@@ -4801,7 +4804,7 @@ compiler, or your machine supports multiple models), you can override it here.
 EOM
 else
        dflt=''
-       echo $libpth | tr ' ' $trnl | sort | uniq > libpath
+       echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
        cat >&4 <<EOM
 I can't seem to find your C library.  I've looked in the following places:
 
@@ -4819,7 +4822,7 @@ rp='Where is your C library?'
 libc="$ans"
 
 echo " "
-echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
+echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
 set X `cat libnames`
 shift
 xxx=files
@@ -7268,6 +7271,25 @@ rp='Perl administrator e-mail address'
 . ./myread
 perladmin="$ans"
 
+: determine whether to only install version-specific parts.
+echo " "
+$cat <<EOM
+Do you want to install only the version-specific parts of the perl
+distribution?  Usually you do *not* want to do this.
+EOM
+case "$versiononly" in
+"$define"|[Yy]*|true) dflt='y' ;;
+*) dflt='n';
+esac
+rp="Do you want to install only the version-specific parts of perl?"
+. ./myread
+case "$ans" in
+[yY]*) val="$define";;
+*)     val="$undef" ;;
+esac
+set versiononly
+eval $setvar
+
 : figure out how to guarantee perl startup
 case "$startperl" in
 '')
@@ -7282,7 +7304,10 @@ want to share those scripts and perl is not in a standard place
 a shell by starting the script with a single ':' character.
 
 EOH
-               dflt="$binexp/perl"
+               case "$versiononly" in
+               "$define")      dflt="$binexp/perl$version";;  
+               *)              dflt="$binexp/perl";;
+               esac
                rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
                . ./myread
                case "$ans" in
@@ -7447,25 +7472,6 @@ else
        installvendorbin="$vendorbinexp"
 fi
 
-: determine whether to only install version-specific parts.
-echo " "
-$cat <<EOM
-Do you want to install only the version-specific parts of the perl
-distribution?  Usually you do *not* want to do this.
-EOM
-case "$versiononly" in
-"$define"|[Yy]*|true) dflt='y' ;;
-*) dflt='n';
-esac
-rp="Do you want to install only the version-specific parts of perl?"
-. ./myread
-case "$ans" in
-[yY]*) val="$define";;
-*)     val="$undef" ;;
-esac
-set versiononly
-eval $setvar
-
 : see if qgcvt exists
 set qgcvt d_qgcvt
 eval $inlibc
@@ -8845,6 +8851,54 @@ eval $inlibc
 set fcntl d_fcntl
 eval $inlibc
 
+echo " "
+: See if fcntl-based locking works.
+$cat >try.c <<'EOCP'
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+int main() {
+#if defined(F_SETLK) && defined(F_SETLKW)
+     struct flock flock;
+     int retval, fd;
+     fd = open("try.c", O_RDONLY);
+     flock.l_type = F_RDLCK;
+     flock.l_whence = SEEK_SET;
+     flock.l_start = flock.l_len = 0;
+     retval = fcntl(fd, F_SETLK, &flock);
+     close(fd);
+     (retval < 0 ? exit(2) : exit(0));
+#else
+     exit(2);
+#endif
+}
+EOCP
+echo "Checking if fcntl-based file locking works... "
+case "$d_fcntl" in
+"$define")
+       set try
+       if eval $compile_ok; then
+               if ./try; then
+                       echo "Yes, it seems to work."
+                       val="$define"
+               else
+                       echo "Nope, it didn't work."
+                       val="$undef"
+               fi
+       else
+               echo "I'm unable to compile the test program, so I'll assume not."
+               val="$undef"
+       fi
+       ;;
+*) val="$undef";
+       echo "Nope, since you don't even have fcntl()."
+       ;;
+esac
+set d_fcntl_can_lock
+eval $setvar
+$rm -f try*
+
+
 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
 while $test $# -ge 2; do
        case "$1" in
@@ -11492,13 +11546,24 @@ $cat >try.c <<EOP
 #include <stdio.h>
 /* Can we scream? */
 /* Eat dust sed :-) */
-#define FILE_ptr(fp)   $stdio_ptr
-#define FILE_cnt(fp)   $stdio_cnt
+/* In the buffer space, no one can hear you scream. */
+#define FILE_ptr(fp)   ((fp)->_ptr)
+#define FILE_cnt(fp)   ((fp)->_cnt)
+#include <sys/types.h>
 int main() {
        FILE *fp = fopen("try.c", "r");
-       char c = getc(fp);
+       int c;
        char *ptr;
        size_t cnt;
+       if (!fp) {
+           puts("Fail even to read");
+           exit(1);
+       }
+       c = getc(fp); /* Read away the first # */
+       if (c == EOF) {
+           puts("Fail even to read");
+           exit(1);
+       }
        if (!(
                18 <= FILE_cnt(fp) &&
                strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
@@ -11506,12 +11571,12 @@ int main() {
                puts("Fail even to read");
                exit (1);
        }
-       ptr = FILE_ptr(fp);
-       cnt = FILE_cnt(fp);
+       ptr = (char*) FILE_ptr(fp);
+       cnt = (size_t)FILE_cnt(fp);
 
-       FILE_ptr(fp)+= 42;
+       FILE_ptr(fp) += 42;
 
-       if (FILE_ptr(fp) != (ptr + 42)) {
+       if ((char*)FILE_ptr(fp) != (ptr + 42)) {
                printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
                exit (1);
        }
@@ -11540,7 +11605,7 @@ EOP
        if eval $compile; then
                case `./try$exe_ext` in
                Pass_changed)
-                       echo "Increasing ptr in your stdio decreases cnt by the same amount. Good." >&4
+                       echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
                        d_stdio_ptr_lval_sets_cnt="$define" ;;
                Pass_unchanged)
                        echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
@@ -14592,7 +14657,7 @@ EOSH
 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
 $cat Cppsym.know > Cppsym.c
-$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | sort | uniq > Cppsym.know
+$cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
 $rm -f Cppsym.a Cppsym.b Cppsym.c
 cat <<EOSH > Cppsym
 $startsh
@@ -15467,6 +15532,7 @@ d_eunice='$d_eunice'
 d_fchmod='$d_fchmod'
 d_fchown='$d_fchown'
 d_fcntl='$d_fcntl'
+d_fcntl_can_lock='$d_fcntl_can_lock'
 d_fd_macros='$d_fd_macros'
 d_fd_set='$d_fd_set'
 d_fds_bits='$d_fds_bits'
@@ -16137,9 +16203,9 @@ echo "CONFIGDOTSH=true" >>config.sh
 
 : propagate old symbols
 if $test -f UU/config.sh; then
-       <UU/config.sh sort | uniq >UU/oldconfig.sh
+       <UU/config.sh $sort | $uniq >UU/oldconfig.sh
        sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
-       sort | uniq -u >UU/oldsyms
+       $sort | $uniq -u >UU/oldsyms
        set X `cat UU/oldsyms`
        shift
        case $# in