This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove the bogus "incorrect case" warning completely.
[perl5.git] / Configure
index dc47dc9..21cf09e 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 Sat Dec 29 20:23:06 EET 2001 [metaconfig 3.0 PL70]
+# Generated on Fri Mar  1 20:03:36 EET 2002 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.org)
 
 cat >c1$$ <<EOF
@@ -1036,8 +1036,19 @@ if test -f /etc/unixtovms.exe; then
        eunicefix=/etc/unixtovms.exe
 fi
 
-if test -f "/system/gnu_library/bin/ar.pm"; then
-     _exe=".pm"
+: Set executable suffix now -- needed before hints available
+if test -f "/libs/version.library"; then
+: Amiga OS
+    _exe=""
+elif test -f "/system/gnu_library/bin/ar.pm"; then
+: Stratus VOS
+    _exe=".pm"
+elif test -n "$DJGPP"; then
+: DOS DJGPP
+    _exe=".exe"
+elif test -d c:/. ; then
+: OS/2 or cygwin
+    _exe=".exe"
 fi
 
 i_whoami=''
@@ -1159,7 +1170,7 @@ if `$sh -c '#' >/dev/null 2>&1`; then
        xcat=/bin/cat
        test -f $xcat$_exe || xcat=/usr/bin/cat
        if test ! -f $xcat$_exe; then
-               for p in $paths; do
+               for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
                        if test -f $p/cat$_exe; then
                                xcat=$p/cat
                                break
@@ -1581,13 +1592,13 @@ if test -f MANIFEST; then
        set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
 else
        echo "(Looking for .SH files under the source directory.)"
-       set x `(cd $src; find . -name "*.SH" -print)`
+       set x `(cd "$src"; find . -name "*.SH" -print)`
 fi
 shift
 case $# in
-0) set x `(cd $src; echo *.SH)`; shift;;
+0) set x `(cd "$src"; echo *.SH)`; shift;;
 esac
-if test ! -f $src/$1; then
+if test ! -f "$src/$1"; then
        shift
 fi
 mkdir_p='
@@ -1613,7 +1624,7 @@ for file in $*; do
                */*)
                        dir=`expr X$file : 'X\(.*\)/'`
                        file=`expr X$file : 'X.*/\(.*\)'`
-                       (cd $dir && . ./$file)
+                       (cd "$dir" && . ./$file)
                        ;;
                *)
                        . ./$file
@@ -1626,19 +1637,19 @@ for file in $*; do
                        dir=`expr X$file : 'X\(.*\)/'`
                        file=`expr X$file : 'X.*/\(.*\)'`
                        (set x $dir; shift; eval $mkdir_p)
-                       sh <$src/$dir/$file
+                       sh <"$src/$dir/$file"
                        ;;
                *)
-                       sh <$src/$file
+                       sh <"$src/$file"
                        ;;
                esac
                ;;
        esac
 done
-if test -f $src/config_h.SH; then
+if test -f "$src/config_h.SH"; then
        if test ! -f config.h; then
        : oops, they left it out of MANIFEST, probably, so do it anyway.
-       . $src/config_h.SH
+       . "$src/config_h.SH"
        fi
 fi
 EOS
@@ -1694,13 +1705,13 @@ rm -f .echotmp
 
 : Now test for existence of everything in MANIFEST
 echo " "
-if test -f $rsrc/MANIFEST; then
+if test -f "$rsrc/MANIFEST"; then
        echo "First let's make sure your kit is complete.  Checking..." >&4
-       awk '$1 !~ /PACK[A-Z]+/ {print $1}' $rsrc/MANIFEST | split -50
+       awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
        rm -f missing
        tmppwd=`pwd`
        for filelist in x??; do
-               (cd $rsrc; ls `cat $tmppwd/$filelist` >/dev/null 2>>$tmppwd/missing)
+               (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
        done
        if test -s missing; then
                cat missing >&4
@@ -2141,7 +2152,7 @@ for file in $trylist; do
        '') xxx=`./loc $file $file $pth`;;
        *) xxx=`./loc $xxx $xxx $pth`;;
        esac
-       eval $file=$xxx
+       eval $file=$xxx$_exe
        eval _$file=$xxx
        case "$xxx" in
        /*)
@@ -2236,10 +2247,10 @@ FOO
        ;;
 esac
 
-cat <<EOS >checkcc
+cat <<EOS >trygcc
 $startsh
 EOS
-cat <<'EOSC' >>checkcc
+cat <<'EOSC' >>trygcc
 case "$cc" in
 '') ;;
 *)  $rm -f try try.*
@@ -2281,15 +2292,37 @@ EOM
                 esac
             fi
         fi
+    fi
+    $rm -f try try.*
+    ;;
+esac
+EOSC
+
+cat <<EOS >checkcc
+$startsh
+EOS
+cat <<'EOSC' >>checkcc
+case "$cc" in        
+'') ;;
+*)  $rm -f try try.*              
+    $cat >try.c <<EOM
+int main(int argc, char *argv[]) {
+  return 0;
+}
+EOM
+    if $cc -o try $ccflags $ldflags try.c; then
+       :
+    else
         if $test X"$despair" = Xyes; then
-           $cat >&4 <<EOM
+           echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
+        fi
+        $cat >&4 <<EOM         
 You need to find a working C compiler.
 Either (purchase and) install the C compiler supplied by your OS vendor,
 or for a free C compiler try http://gcc.gnu.org/
 I cannot continue any further, aborting.
 EOM
-            exit 1
-        fi
+        exit 1
     fi
     $rm -f try try.*
     ;;
@@ -2311,7 +2344,7 @@ $rm -f blurfl sym
 : determine whether symbolic links are supported
 echo " "
 case "$lns" in
-*"ln -s")
+*"ln"*" -s")
        echo "Checking how to test for symbolic links..." >&4
        $lns blurfl sym
        if $test "X$issymlink" = X; then
@@ -2374,7 +2407,7 @@ $define|true|[yY]*)
                exit 1
                ;;
        *)      case "$lns:$issymlink" in
-               *"ln -s:"*"test -"?)
+               *"ln"*" -s:"*"test -"?)
                        echo "Creating the symbolic links..." >&4
                        echo "(First creating the subdirectories...)" >&4
                        cd ..
@@ -3532,6 +3565,9 @@ esac
 rp="Use which C compiler?"
 . ./myread
 cc="$ans"
+
+: See if they have not cc but they do have gcc
+. ./trygcc
 : Look for a hint-file generated 'call-back-unit'.  Now that the
 : user has specified the compiler, we may need to set or change some
 : other defaults.
@@ -4247,7 +4283,7 @@ for thislib in $libswanted; do
        for thisdir in $libspath; do
            xxx=''
            if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
-               xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|tail -1`
+               xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
                $test -f "$xxx" && eval $libscheck
                $test -f "$xxx" && libstyle=shared
            fi
@@ -5746,63 +5782,6 @@ esac'
 set sqrtl d_sqrtl
 eval $inlibc
 
-case "$ccflags" in
-*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
-esac
-
-case "$uselongdouble" in
-$define|true|[yY]*)    dflt='y';;
-*) dflt='n';;
-esac
-cat <<EOM
-
-Perl can be built to take advantage of long doubles which
-(if available) may give more accuracy and range for floating point numbers.
-
-If this doesn't make any sense to you, just accept the default '$dflt'.
-EOM
-rp='Try to use long doubles if available?'
-. ./myread
-case "$ans" in
-y|Y)   val="$define"   ;;
-*)      val="$undef"   ;;
-esac
-set uselongdouble
-eval $setvar
-
-case "$uselongdouble" in
-true|[yY]*) uselongdouble="$define" ;;
-esac
-
-case "$uselongdouble" in
-$define)
-: Look for a hint-file generated 'call-back-unit'.  If the
-: user has specified that long doubles should be used,
-: we may need to set or change some other defaults.
-       if $test -f uselongdouble.cbu; then
-               echo "Your platform has some specific hints for long doubles, using them..."
-               . ./uselongdouble.cbu
-       else
-               $cat <<EOM
-(Your platform doesn't have any specific hints for long doubles.)
-EOM
-       fi
-       ;;
-esac
-
-case "$uselongdouble:$d_sqrtl" in
-$define:$undef)
-               $cat <<EOM >&4
-
-*** You requested the use of long doubles but you do not seem to have
-*** the mathematic functions for long doubles.  I'm disabling the use
-*** of long doubles.
-
-EOM
-       uselongdouble=$undef
-       ;;
-esac
-
 : check for length of double
 echo " "
 case "$doublesize" in
@@ -5865,19 +5844,266 @@ EOCP
                longdblsize=`$run ./try`
                echo "Your long doubles are $longdblsize bytes long."
        else
-               dflt='8'
-               echo " "
-               echo "(I can't seem to compile the test program.  Guessing...)" >&4
-               rp="What is the size of a long double (in bytes)?"
-               . ./myread
-               longdblsize="$ans"
+               dflt='8'
+               echo " "
+               echo "(I can't seem to compile the test program.  Guessing...)" >&4
+               rp="What is the size of a long double (in bytes)?"
+               . ./myread
+               longdblsize="$ans"
+       fi
+       if $test "X$doublesize" = "X$longdblsize"; then
+               echo "(That isn't any different from an ordinary double.)"
+       fi      
+       ;;
+esac
+$rm -f try.* try
+
+echo " "
+
+if $test X"$d_longdbl" = X"$define"; then
+
+echo "Checking how to print long doubles..." >&4
+
+if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
+       $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+  double d = 123.456;
+  printf("%.3f\n", d);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`$run ./try`
+               case "$yyy" in
+               123.456)
+                       sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
+                       sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
+                       echo "We will use %f."
+                       ;;
+               esac
+       fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+       $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+  long double d = 123.456;
+  printf("%.3Lf\n", d);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`$run ./try`
+               case "$yyy" in
+               123.456)
+                       sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
+                       sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
+                       echo "We will use %Lf."
+                       ;;
+               esac
+       fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+       $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+  long double d = 123.456;
+  printf("%.3llf\n", d);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`$run ./try`
+               case "$yyy" in
+               123.456)
+                       sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
+                       sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
+                       echo "We will use %llf."
+                       ;;
+               esac
+       fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+       $cat >try.c <<'EOCP'
+#include <sys/types.h>
+#include <stdio.h>
+int main() {
+  long double d = 123.456;
+  printf("%.3lf\n", d);
+}
+EOCP
+       set try
+       if eval $compile; then
+               yyy=`$run ./try`
+               case "$yyy" in
+               123.456)
+                       sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
+                       sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
+                       echo "We will use %lf."
+                       ;;
+               esac
+       fi
+fi
+
+if $test X"$sPRIfldbl" = X; then
+       echo "Cannot figure out how to print long doubles." >&4
+else
+       sSCNfldbl=$sPRIfldbl    # expect consistency
+fi
+
+$rm -f try try.*
+
+fi # d_longdbl
+
+case "$sPRIfldbl" in
+'')    d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
+       d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
+       d_SCNfldbl="$undef";
+       ;;
+*)     d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
+       d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
+       d_SCNfldbl="$define";
+       ;;
+esac
+
+: see if modfl exists
+set modfl d_modfl
+eval $inlibc
+
+d_modfl_pow32_bug="$undef"
+
+case "$d_longdbl$d_modfl" in
+$define$define)
+       $cat <<EOM
+Checking to see whether your modfl() is okay for large values...
+EOM
+$cat >try.c <<EOCP
+#include <math.h> 
+#include <stdio.h>
+int main() {
+    long double nv = 4294967303.15;
+    long double v, w;
+    v = modfl(nv, &w);         
+#ifdef __GLIBC__
+    printf("glibc");
+#endif
+    printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
+    return 0;
+}
+EOCP
+       case "$osname:$gccversion" in
+       aix:)   saveccflags="$ccflags"
+               ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
+       esac
+       set try
+       if eval $compile; then
+               foo=`$run ./try`
+               case "$foo" in
+               *" 4294967303.150000 1.150000 4294967302.000000")
+                       echo >&4 "Your modfl() is broken for large values."
+                       d_modfl_pow32_bug="$define"
+                       case "$foo" in
+                       glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
+                       ;;
+                       esac
+                       ;;
+               *" 4294967303.150000 0.150000 4294967303.000000")
+                       echo >&4 "Your modfl() seems okay for large values."
+                       ;;
+               *)      echo >&4 "I don't understand your modfl() at all."
+                       d_modfl="$undef"
+                       ;;
+               esac
+               $rm -f try.* try core core.try.*
+       else
+               echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
+               d_modfl="$undef"
+       fi
+       case "$osname:$gccversion" in
+       aix:)   ccflags="$saveccflags" ;; # restore
+       esac
+       ;;
+esac
+
+case "$ccflags" in
+*-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
+esac
+
+case "$uselongdouble" in
+$define|true|[yY]*)    dflt='y';;
+*) dflt='n';;
+esac
+cat <<EOM
+
+Perl can be built to take advantage of long doubles which
+(if available) may give more accuracy and range for floating point numbers.
+
+If this doesn't make any sense to you, just accept the default '$dflt'.
+EOM
+rp='Try to use long doubles if available?'
+. ./myread
+case "$ans" in
+y|Y)   val="$define"   ;;
+*)      val="$undef"   ;;
+esac
+set uselongdouble
+eval $setvar
+
+case "$uselongdouble" in
+true|[yY]*) uselongdouble="$define" ;;
+esac
+
+case "$uselongdouble" in
+$define)
+: Look for a hint-file generated 'call-back-unit'.  If the
+: user has specified that long doubles should be used,
+: we may need to set or change some other defaults.
+       if $test -f uselongdouble.cbu; then
+               echo "Your platform has some specific hints for long doubles, using them..."
+               . ./uselongdouble.cbu
+       else
+               $cat <<EOM
+(Your platform doesn't have any specific hints for long doubles.)
+EOM
        fi
-       if $test "X$doublesize" = "X$longdblsize"; then
-               echo "(That isn't any different from an ordinary double.)"
-       fi      
        ;;
 esac
-$rm -f try.* try
+
+message=X
+case "$uselongdouble:$d_sqrtl:$d_modfl" in
+$define:$define:$define)
+       : You have both
+       ;;
+$define:$define:$undef)
+       message="I could not find modfl"
+       ;;
+$define:$undef:$define)
+       message="I could not find sqrtl"
+       ;;
+$define:$undef:$undef)
+       message="I found neither sqrtl nor modfl"
+       ;;
+esac
+
+if $test "$message" != X; then
+       $cat <<EOM >&4
+
+*** You requested the use of long doubles but you do not seem to have
+*** the mathematic functions for long doubles.
+*** ($message)
+*** I'm disabling the use of long doubles.
+
+EOM
+
+       uselongdouble=$undef
+fi
 
 case "$useperlio" in
 $define|true|[yY]*|'') dflt='y';;
@@ -7115,7 +7341,7 @@ y*) usedl="$define"
        esac
     echo "The following dynamic loading files are available:"
        : Can not go over to $dldir because getfile has path hard-coded in.
-       tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir
+       tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
        rp="Source file to use for dynamic loading"
        fn="fne"
        gfpth="$src"
@@ -7365,8 +7591,8 @@ true)
                linux*)  # ld won't link with a bare -lperl otherwise.
                        dflt=libperl.$so
                        ;;
-               cygwin*) # include version
-                       dflt=`echo libperl$version | sed -e 's/\./_/g'`$lib_ext
+               cygwin*) # ld links against an importlib
+                       dflt=libperl$lib_ext
                        ;;
                *)      # Try to guess based on whether libc has major.minor.
                        case "$libc" in
@@ -7449,7 +7675,7 @@ if "$useshrplib"; then
        freebsd|netbsd)
                xxx="-Wl,-R$shrpdir"
                ;;
-       linux|irix*|dec_osf)
+       bsdos|linux|irix*|dec_osf)
                xxx="-Wl,-rpath,$shrpdir"
                ;;
        next)
@@ -7836,6 +8062,9 @@ if $test "$cont"; then
                fi
        fi
 fi
+case "$myhostname" in
+'') myhostname=noname ;;
+esac
 : you do not want to know about this
 set $myhostname
 myhostname=$1
@@ -7936,7 +8165,7 @@ case "$myhostname" in
                esac
                case "$dflt" in
                .) echo "(Lost all hope -- silly guess then)"
-                       dflt='.uucp'
+                       dflt='.nonet'
                        ;;
                esac
                $rm -f hosts
 set qgcvt d_qgcvt
 eval $inlibc
 
-echo " "
-
-if $test X"$d_longdbl" = X"$define"; then
-
-echo "Checking how to print long doubles..." >&4
-
-if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
-       $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
-  double d = 123.456;
-  printf("%.3f\n", d);
-}
-EOCP
-       set try
-       if eval $compile; then
-               yyy=`$run ./try`
-               case "$yyy" in
-               123.456)
-                       sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
-                       sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
-                       echo "We will use %f."
-                       ;;
-               esac
-       fi
-fi
-
-if $test X"$sPRIfldbl" = X; then
-       $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
-  long double d = 123.456;
-  printf("%.3Lf\n", d);
-}
-EOCP
-       set try
-       if eval $compile; then
-               yyy=`$run ./try`
-               case "$yyy" in
-               123.456)
-                       sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
-                       sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
-                       echo "We will use %Lf."
-                       ;;
-               esac
-       fi
-fi
-
-if $test X"$sPRIfldbl" = X; then
-       $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
-  long double d = 123.456;
-  printf("%.3llf\n", d);
-}
-EOCP
-       set try
-       if eval $compile; then
-               yyy=`$run ./try`
-               case "$yyy" in
-               123.456)
-                       sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
-                       sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
-                       echo "We will use %llf."
-                       ;;
-               esac
-       fi
-fi
-
-if $test X"$sPRIfldbl" = X; then
-       $cat >try.c <<'EOCP'
-#include <sys/types.h>
-#include <stdio.h>
-int main() {
-  long double d = 123.456;
-  printf("%.3lf\n", d);
-}
-EOCP
-       set try
-       if eval $compile; then
-               yyy=`$run ./try`
-               case "$yyy" in
-               123.456)
-                       sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
-                       sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
-                       echo "We will use %lf."
-                       ;;
-               esac
-       fi
-fi
-
-if $test X"$sPRIfldbl" = X; then
-       echo "Cannot figure out how to print long doubles." >&4
-else
-       sSCNfldbl=$sPRIfldbl    # expect consistency
-fi
-
-$rm -f try try.*
-
-fi # d_longdbl
+: Check how to convert floats to strings.
 
-case "$sPRIfldbl" in
-'')    d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
-       d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
-       d_SCNfldbl="$undef";
-       ;;
-*)     d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
-       d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
-       d_SCNfldbl="$define";
-       ;;
-esac
+if test "X$d_Gconvert" = X; then
 
-: Check how to convert floats to strings.
 echo " "
 echo "Checking for an efficient way to convert floats to strings."
 echo " " > try.c
@@ -8590,9 +8707,13 @@ char *myname = "qgcvt";
 #define DOUBLETYPE long double
 #endif
 #ifdef TRY_sprintf
-#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE) && defined(HAS_PRIgldbl)
+#if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
+#ifdef HAS_PRIgldbl
 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
 #else
+#define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
+#endif
+#else
 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
 #endif
 char *myname = "sprintf";
@@ -8635,6 +8756,21 @@ int main()
        Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
        checkit("0.1", buf);
 
+       Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
+       checkit("0.01", buf);
+
+       Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
+       checkit("0.001", buf);
+
+       Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
+       checkit("0.0001", buf);
+
+       Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
+       if (strlen(buf) > 5)
+           checkit("9e-005", buf); /* for Microsoft ?? */
+       else
+           checkit("9e-05", buf);
+
        Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
        checkit("1", buf);
 
@@ -8673,31 +8809,59 @@ int main()
        Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
        checkit("123.456", buf);
 
-        /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
-        Gconvert((DOUBLETYPE)1e30, 8, 0, buf);
-        if (strlen(buf) > 5)
-            checkit("1e+030", buf); /* for Microsoft */
-        else
-            checkit("1e+30", buf);
+       /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
+       Gconvert((DOUBLETYPE)1e30, 8, 0, buf);
+       if (strlen(buf) > 5)
+           checkit("1e+030", buf); /* for Microsoft */
+       else
+           checkit("1e+30", buf);
 
        exit(0);
 }
 EOP
-case "$d_Gconvert" in
-gconvert*) xxx_list='gconvert gcvt sprintf' ;;
-gcvt*) xxx_list='gcvt gconvert sprintf' ;;
-sprintf*) xxx_list='sprintf gconvert gcvt' ;;
-*) xxx_list='gconvert gcvt sprintf' ;;
-esac
-
-case "$d_longdbl$uselongdouble$d_PRIgldbl" in
-"$define$define$define")
-    # for long doubles prefer first qgcvt, then sprintf
-    xxx_list="`echo $xxx_list|sed s/sprintf//`" 
-    xxx_list="sprintf $xxx_list"
-    case "$d_qgcvt" in
-    "$define") xxx_list="qgcvt $xxx_list" ;;
-    esac
+: first add preferred functions to our list
+xxx_list=""
+for xxx_convert in $gconvert_preference; do
+    case $xxx_convert in
+    gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
+    *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
+    esac 
+done
+: then add any others
+for xxx_convert in gconvert gcvt sprintf; do
+    case "$xxx_list" in
+    *$xxx_convert*) ;;
+    *) xxx_list="$xxx_list $xxx_convert" ;;
+    esac 
+done
+
+case "$d_longdbl$uselongdouble" in
+"$define$define")
+    : again, add prefered functions to our list first
+    xxx_ld_list=""
+    for xxx_convert in $gconvert_ld_preference; do
+        case $xxx_convert in
+        qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
+        *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
+        esac
+    done
+    : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
+    for xxx_convert in qgcvt sprintf $xxx_list; do
+        case "$xxx_ld_list" in
+        $xxx_convert*|*" $xxx_convert"*) ;;
+        *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
+        esac
+    done
+    : if sprintf cannot do long doubles, move it to the end
+    if test "$d_PRIgldbl" != "$define"; then
+        xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
+    fi
+    : if no qgcvt, remove it
+    if test "$d_qgcvt" != "$define"; then
+        xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
+    fi
+    : use the ld_list
+    xxx_list="$xxx_ld_list"
     ;;
 esac
 
@@ -8712,12 +8876,19 @@ for xxx_convert in $xxx_list; do
                        break;
                else
                        echo "...But $xxx_convert didn't work as I expected."
+                       xxx_convert=''
                fi
        else
                echo "$xxx_convert NOT found." >&4
        fi
 done
-       
+
+if test X$xxx_convert = X; then
+    echo "*** WHOA THERE!!! ***" >&4
+    echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
+    xxx_convert=sprintf
+fi
+
 case "$xxx_convert" in
 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
@@ -8725,11 +8896,15 @@ qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
    "$define$define$define")
       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
+   "$define$define$undef")
+      d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
    esac
    ;;  
 esac
 
+fi
+
 : see if _fwalk exists
 set fwalk d__fwalk
 eval $inlibc
@@ -11070,65 +11245,6 @@ esac
 
 
 
-: see if modfl exists
-set modfl d_modfl
-eval $inlibc
-
-d_modfl_pow32_bug="$undef"
-
-case "$d_longdbl$d_modfl" in
-$define$define)
-       $cat <<EOM
-Checking to see whether your modfl() is okay for large values...
-EOM
-$cat >try.c <<EOCP
-#include <math.h> 
-#include <stdio.h>
-int main() {
-    long double nv = 4294967303.15;
-    long double v, w;
-    v = modfl(nv, &w);         
-#ifdef __GLIBC__
-    printf("glibc");
-#endif
-    printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
-    return 0;
-}
-EOCP
-       case "$osname:$gccversion" in
-       aix:)   saveccflags="$ccflags"
-               ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
-       esac
-       set try
-       if eval $compile; then
-               foo=`$run ./try`
-               case "$foo" in
-               *" 4294967303.150000 1.150000 4294967302.000000")
-                       echo >&4 "Your modfl() is broken for large values."
-                       d_modfl_pow32_bug="$define"
-                       case "$foo" in
-                       glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
-                       ;;
-                       esac
-                       ;;
-               *" 4294967303.150000 0.150000 4294967303.000000")
-                       echo >&4 "Your modfl() seems okay for large values."
-                       ;;
-               *)      echo >&4 "I don't understand your modfl() at all."
-                       d_modfl="$undef"
-                       ;;
-               esac
-               $rm -f try.* try core core.try.*
-       else
-               echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
-               d_modfl="$undef"
-       fi
-       case "$osname:$gccversion" in
-       aix:)   ccflags="$saveccflags" ;; # restore
-       esac
-       ;;
-esac
-
 : see if mprotect exists
 set mprotect d_mprotect
 eval $inlibc
@@ -13474,7 +13590,8 @@ $cat <<EOM
 
 Checking to see whether you can access character data unalignedly...
 EOM
-$cat >try.c <<EOCP
+case "$d_u32align" in
+'')   $cat >try.c <<EOCP
 #include <stdio.h>
 #define U32 $u32type
 #define BYTEORDER 0x$byteorder
@@ -13485,7 +13602,7 @@ $signal_t bletch(s) int s; { exit(4); }
 #endif
 int main() {
 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
-    U8 buf[] = "\0\0\0\1\0\0\0\0";
+    U8 buf[8];
     U32 *up;
     int i;
 
@@ -13500,6 +13617,15 @@ int main() {
     signal(SIGBUS, bletch);
 #endif
 
+    buf[0] = 0;
+    buf[1] = 0;
+    buf[2] = 0;
+    buf[3] = 1;
+    buf[5] = 0;
+    buf[6] = 0;
+    buf[7] = 0;
+    buf[8] = 1;
+
     for (i = 0; i < 4; i++) {
        up = (U32*)(buf + i);
        if (! ((*up == 1 << (8*i)) ||   /* big-endian */
@@ -13556,6 +13682,8 @@ else
        esac
 fi
 $rm -f core core.try.* try.core
+;;
+esac
 
 : see if ualarm exists
 set ualarm d_ualarm
@@ -15565,7 +15693,7 @@ $cat >>signal_cmd <<'EOS'
 
 set signal
 if eval $compile_ok; then
-       $run ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
+       $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
 else
        echo "(I can't seem be able to compile the whole test program)" >&4
        echo "(I'll try it in little pieces.)" >&4
@@ -15599,7 +15727,7 @@ EOCP
        done
        if $test -s signal.ls1; then
                $cat signal.nsg signal.ls1 |
-                       $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst
+                       $sort -n | $uniq | $awk -f signal.awk >signal.lst
        fi
 
 fi
@@ -16051,6 +16179,20 @@ eval $inhdr
 : see if ndbm.h is available
 set ndbm.h t_ndbm
 eval $inhdr
+
+case "$t_ndbm" in
+$undef)
+    # Some Linux distributions such as RedHat 7.1 put the
+    # ndbm.h header in /usr/include/gdbm/ndbm.h.
+    if $test -f /usr/include/gdbm/ndbm.h; then
+       echo '<gdbm/ndbm.h> found.'
+        ccflags="$ccflags -I/usr/include/gdbm"
+        cppflags="$cppflags -I/usr/include/gdbm"
+        t_ndbm=$define
+    fi
+    ;;
+esac
+
 case "$t_ndbm" in
 $define)
        : see if dbm_open exists
@@ -16522,7 +16664,7 @@ find_extensions='
            else
                if $test -d $xxx -a $# -lt 10; then
                    set $1$xxx/ $*;
-                   cd $xxx;
+                   cd "$xxx";
                    eval $find_extensions;
                    cd ..;
                    shift;
@@ -16532,21 +16674,23 @@ find_extensions='
        esac;
     done'
 tdir=`pwd`
-cd $rsrc/ext
+cd "$rsrc/ext"
 set X
 shift
 eval $find_extensions
 # Special case:  Add in threads/shared since it is not picked up by the
 # recursive find above (and adding in general recursive finding breaks
 # SDBM_File/sdbm).  A.D.  10/25/2001.
-known_extensions="$known_extensions threads/shared"
+# Encode::JP needs an explicit mention for the same reason
+# --jhi 2002-02-23
+known_extensions="$known_extensions threads/shared Encode/JP"
 set X $nonxs_extensions
 shift
 nonxs_extensions="$*"
 set X $known_extensions
 shift
 known_extensions="$*"
-cd $tdir
+cd "$tdir"
 
 : Now see which are supported on this system.
 avail_ext=''
@@ -17795,7 +17939,7 @@ echo " "
 exec 1>&4
 pwd=`pwd`
 . ./UU/extract
-cd $pwd
+cd "$pwd"
 
 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
        dflt=y