Configure updates for intsize and ssizetype
[p5sagit/p5-mst-13.2.git] / Configure
index a6a4b28..c5fbe4e 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -20,7 +20,7 @@
 
 # $Id: Head.U,v 3.0.1.8 1995/07/25 13:40:02 ram Exp $
 #
-# Generated on Tue Dec 17 14:33:33 EST 1996 [metaconfig 3.0 PL60]
+# Generated on Sat Feb  1 00:26:40 EST 1997 [metaconfig 3.0 PL60]
 
 cat >/tmp/c1$$ <<EOF
 ARGGGHHHH!!!!!
@@ -390,7 +390,6 @@ d_stdstdio=''
 stdio_base=''
 stdio_bufsiz=''
 stdio_cnt=''
-stdio_filbuf=''
 stdio_ptr=''
 d_index=''
 d_strchr=''
@@ -506,6 +505,8 @@ i_varargs=''
 i_varhdr=''
 i_vfork=''
 intsize=''
+longsize=''
+shortsize=''
 libc=''
 libperl=''
 shrpenv=''
@@ -958,7 +959,11 @@ silent=''
 extractsh=''
 override=''
 knowitall=''
+
 rm -f optdef.sh
+cat >optdef.sh <<EOS
+$startsh
+EOS
 
 : option parsing
 while test $# -gt 0; do
@@ -1192,6 +1197,7 @@ esac"
 
 : now set up to do reads with possible shell escape and default assignment
 cat <<EOSC >myread
+$startsh
 xxxm=\$dflt
 $myecho
 ans='!'
@@ -1702,6 +1708,9 @@ EOM
                        *) osvers=$tmp;;
                        esac
                        ;;
+               *dc.osx) osname=dcosx
+                       osvers="$3"
+                       ;;
                dnix) osname=dnix
                        osvers="$3"
                        ;;
@@ -1770,7 +1779,7 @@ EOM
                ultrix) osname=ultrix
                        osvers="$3"
                        ;;
-               osf1)   case "$5" in
+               osf1|mls+)      case "$5" in
                                alpha)
                                        osname=dec_osf
                                        osvers=`echo "$3" | sed 's/^[vt]//'`
@@ -2117,7 +2126,10 @@ chmod +x filexp
 $eunicefix filexp
 
 : now set up to get a file name
-cat <<'EOSC' >getfile
+cat <<EOS >getfile
+$startsh
+EOS
+cat <<'EOSC' >>getfile
 tilde=''
 fullpath=''
 already=''
@@ -2426,7 +2438,7 @@ else
 fi
 
 : set the base revision
-baserev=5
+baserev=5.0
 
 : get the patchlevel
 echo " "
@@ -2458,23 +2470,27 @@ set archlib archlib
 eval $prefixit
 case "$archlib" in
 '')
-       case "$privlib" in
-       '')     dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib`
-               set dflt
-               eval $prefixup
-               ;;
-       *)      if test 0 -eq "$subversion"; then
-                       version=`echo $baserev $patchlevel | \
-                                $awk '{ printf "%d.%03d\n",$1,$2 }'`
-               else
-                       version=`echo $baserev $patchlevel $subversion | \
-                                $awk '{ printf "%d.%03d%02d\n",$1,$2,$3 }'`
-               fi
-               dflt="$privlib/$archname/$version"
-               ;;
-       esac
+    case "$privlib" in
+    '')        dflt=`./loc . "." $prefixexp/lib /usr/local/lib /usr/lib /lib`
+       set dflt
+       eval $prefixup
        ;;
-*) dflt="$archlib";;
+    *) if test 0 -eq "$subversion"; then
+           version=`LC_ALL=C; export LC_ALL; \
+                    echo $baserev $patchlevel | \
+                    $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
+       else
+           version=`LC_ALL=C; export LC_ALL; \
+                    echo $baserev $patchlevel $subversion | \
+                    $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'`
+       fi
+       dflt="$privlib/$archname/$version"
+       ;;
+    esac
+    ;;
+*)
+    dflt="$archlib"
+    ;;
 esac
 cat <<EOM
 
@@ -2516,7 +2532,10 @@ else
 fi
 
 : set up the script used to warn in case of inconsistency
-cat <<'EOSC' >whoa
+cat <<EOS >whoa
+$startsh
+EOS
+cat <<'EOSC' >>whoa
 dflt=y
 echo " "
 echo "*** WHOA THERE!!! ***" >&4
@@ -3600,7 +3619,6 @@ if ./osf1; then
 else
        set signal.h LANGUAGE_C; eval $inctest
 fi
-set signal.h _NO_PROTO; eval $inctest
 
 case "$hint" in
 none|recommended) dflt="$ccflags $dflt" ;;
@@ -4094,6 +4112,10 @@ elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
        eval $xscan;\
        $contains '^fprintf$' libc.list >/dev/null 2>&1; then
                eval $xrun
+elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
+       eval $xscan;\
+       $contains '^fprintf$' libc.list >/dev/null 2>&1; then
+               eval $xrun
 else
        nm -p $* 2>/dev/null >libc.tmp
        $grep fprintf libc.tmp > libc.ptf
@@ -4680,7 +4702,7 @@ if "$useshrplib"; then
                xxx="-R $shrpdir"
                ;;
        freebsd)
-               xxx="-Wl,-R,$shrpdir"
+               xxx="-Wl,-R$shrpdir"
                ;;
        linux|irix*)
                xxx="-Wl,-rpath,$shrpdir"
@@ -5137,13 +5159,13 @@ case "$myhostname" in
                                : Why was there an Egrep here, when Sed works?
                                : Look for either a search or a domain directive.
                                dflt=.`$sed -n -e 's/   / /g' \
-                                 -e 's/^search.* \([^ ]*\) *$/\1/p' $tans \
+                                 -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
                                  | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
                                case "$dflt" in
                                .) dflt=.`$sed -n -e 's/        / /g' \
-                                    -e 's/^domain.* \([^ ]*\) *$/\1/p' $tans \
+                                    -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
                                     | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
-                                       ;;
+                                       ;;
                                esac
                        fi
                        ;;
@@ -5705,32 +5727,57 @@ $rm -f set set.c
 set bzero d_bzero
 eval $inlibc
 
-: check for length of integer
+: check for lengths of integral types
 echo " "
 case "$intsize" in
 '')
        echo "Checking to see how big your integers are..." >&4
-       $cat >try.c <<'EOCP'
+       $cat >intsize.c <<'EOCP'
 #include <stdio.h>
 main()
 {
-       printf("%d\n", sizeof(int));
+       printf("intsize=%d;\n", sizeof(int));
+       printf("longsize=%d;\n", sizeof(long));
+       printf("shortsize=%d;\n", sizeof(short));
+       fflush(stdout);
        exit(0);
 }
 EOCP
-       if $cc $ccflags try.c -o try >/dev/null 2>&1 && ./try > /dev/null; then
-               intsize=`./try`
+#      If $libs contains -lsfio, and sfio is mis-configured, then it
+#      sometimes (apparently) runs and exits with a 0 status, but with no
+#      output!.  Thus we check with test -s whether we actually got any 
+#      output.  I think it has to do with sfio's use of _exit vs. exit,
+#      but I don't know for sure.  --Andy Dougherty  1/27/97.
+       if $cc $optimize $ccflags $ldflags -o intsize intsize.c $libs >/dev/null 2>&1 && 
+       ./intsize > intsize.out 2>/dev/null && test -s intsize.out ; then
+               eval `$cat intsize.out`
                echo "Your integers are $intsize bytes long."
+               echo "Your long integers are $longsize bytes long."
+               echo "Your short integers are $shortsize bytes long."
        else
-               dflt='4'
-               echo "(I can't seem to compile the test program.  Guessing...)"
+               $cat >&4 <<EOM
+
+Help! I can't compile and run the intsize test program: please enlighten me!
+(This is probably a misconfiguration in your system or libraries, and
+you really ought to fix it.  Still, I'll try anyway.)
+
+EOM
+               dflt=4
                rp="What is the size of an integer (in bytes)?"
                . ./myread
                intsize="$ans"
+               dflt=$intsize
+               rp="What is the size of a long integer (in bytes)?"
+               . ./myread
+               longsize="$ans"
+               dflt=2
+               rp="What is the size of a short integer (in bytes)?"
+               . ./myread
+               shortsize="$ans"
        fi
        ;;
 esac
-$rm -f try.c try
+$rm -f intsize intsize.[co] intsize.out
 
 : see if signal is declared as pointer to function returning int or void
 echo " "
@@ -7031,7 +7078,8 @@ for (align = 7; align >= 0; align--) {
 exit(0);
 }
 EOCP
-       if $cc $ccflags $ldflags foo.c -o safebcpy $libs >/dev/null 2>&1; then
+       if $cc $optimize $ccflags $ldflags foo.c \
+                   -o safebcpy $libs >/dev/null 2>&1; then
                if ./safebcpy 2>/dev/null; then
                        echo "Yes, it can."
                        val="$define"
@@ -7109,7 +7157,8 @@ for (align = 7; align >= 0; align--) {
 exit(0);
 }
 EOCP
-       if $cc $ccflags $ldflags foo.c -o safemcpy $libs >/dev/null 2>&1; then
+       if $cc $optimize $ccflags $ldflags foo.c \
+                   -o safemcpy $libs >/dev/null 2>&1; then
                if ./safemcpy 2>/dev/null; then
                        echo "Yes, it can."
                        val="$define"
@@ -7169,7 +7218,8 @@ if ((a < b) && memcmp(&a, &b, 1) < 0)
 exit(0);
 }
 EOCP
-       if $cc $ccflags $ldflags foo.c -o sanemcmp $libs >/dev/null 2>&1; then
+       if $cc $optimize $ccflags $ldflags foo.c \
+                   -o sanemcmp $libs >/dev/null 2>&1; then
                if ./sanemcmp 2>/dev/null; then
                        echo "Yes, it can."
                        val="$define"
@@ -7618,47 +7668,6 @@ esac
 set d_stdio_cnt_lval
 eval $setvar
 
-: How to access the stdio _filbuf or __filbuf function.
-: If this fails, check how the getc macro in stdio.h works.
-case "${d_stdio_ptr_lval}${d_stdio_cnt_lval}" in
-${define}${define})
-       : Try $hint value, if any, then _filbuf, __filbuf, _fill, then punt.
-       : _fill is for os/2.
-       xxx='notok'
-       for filbuf in $stdio_filbuf '_filbuf(fp)' '__filbuf(fp) ' '_fill(fp)' ; do
-               $cat >try.c <<EOP
-#include <stdio.h>
-#define FILE_ptr(fp)   $stdio_ptr
-#define FILE_cnt(fp)   $stdio_cnt
-#define FILE_filbuf(fp)        $filbuf
-main() {
-       FILE *fp = fopen("try.c", "r");
-       int c;
-       c = getc(fp);
-       c = FILE_filbuf(fp);  /* Just looking for linker errors.*/
-       exit(0);
-}
-EOP
-               if $cc $ccflags $ldflags -o try try.c $libs >/dev/null 2>&1 && ./try; then
-                       echo "Your stdio appears to use $filbuf"
-                       stdio_filbuf="$filbuf"
-                       xxx='ok'
-                       break
-               else
-                       echo "Hmm.  $filbuf doesn't seem to work."
-               fi
-               $rm -f try.c try
-       done
-       case "$xxx" in
-       notok)  echo "I can't figure out how to access _filbuf"
-                       echo "I'll just have to work around it."
-                       d_stdio_ptr_lval="$undef"
-                       d_stdio_cnt_lval="$undef"
-                       ;;
-       esac
-       ;;
-esac
-
 
 : see if _base is also standard
 val="$undef"
@@ -9049,23 +9058,31 @@ main()
 }
 EOM
 echo " "
-if $cc $ccflags $ldflags -o ssize ssize.c $libs > /dev/null 2>&1  &&
-               ./ssize > /dev/null 2>&1 ; then
-       ssizetype=`./ssize`
+#      If $libs contains -lsfio, and sfio is mis-configured, then it
+#      sometimes (apparently) runs and exits with a 0 status, but with no
+#      output!.  Thus we check with test -s whether we actually got any 
+#      output.  I think it has to do with sfio's use of _exit vs. exit,
+#      but I don't know for sure.  --Andy Dougherty  1/27/97.
+if $cc $optimize $ccflags $ldflags -o ssize ssize.c $libs > /dev/null 2>&1  &&
+               ./ssize > ssize.out 2>/dev/null && test -s ssize.out ; then
+       ssizetype=`$cat ssize.out`
        echo "I'll be using $ssizetype for functions returning a byte count." >&4
 else
-       echo "(I can't compile and run the test program--please enlighten me!)"
-       $cat <<EOM
+       $cat >&4 <<EOM
+
+Help! I can't compile and run the ssize_t test program: please enlighten me!
+(This is probably a misconfiguration in your system or libraries, and
+you really ought to fix it.  Still, I'll try anyway.)
 
 I need a type that is the same size as $sizetype, but is guaranteed to
-be signed.  Common values are int and long.
+be signed.  Common values are ssize_t, int and long.
 
 EOM
        rp="What signed type is the same size as $sizetype?"
        . ./myread
        ssizetype="$ans"
 fi
-$rm -f ssize ssize.[co]
+$rm -f ssize ssize.[co] ssize.out
 
 : see what type of char stdio uses.
 echo " "
@@ -10179,6 +10196,7 @@ ln='$ln'
 lns='$lns'
 locincpth='$locincpth'
 loclibpth='$loclibpth'
+longsize='$longsize'
 lp='$lp'
 lpr='$lpr'
 ls='$ls'
@@ -10253,6 +10271,7 @@ sh='$sh'
 shar='$shar'
 sharpbang='$sharpbang'
 shmattype='$shmattype'
+shortsize='$shortsize'
 shrpenv='$shrpenv'
 shsharp='$shsharp'
 sig_name='$sig_name'
@@ -10281,7 +10300,6 @@ stdchar='$stdchar'
 stdio_base='$stdio_base'
 stdio_bufsiz='$stdio_bufsiz'
 stdio_cnt='$stdio_cnt'
-stdio_filbuf='$stdio_filbuf'
 stdio_ptr='$stdio_ptr'
 strings='$strings'
 submit='$submit'