This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Somewhat less shaky relocatable @INC support. You can install things
[perl5.git] / Configure
index 233ec0a..374eb39 100755 (executable)
--- a/Configure
+++ b/Configure
 # comp.sources.misc and is available on CPAN under authors/id/RAM so
 # you may fetch it yourself from your nearest archive site.)
 #
+#
+# Though this script was generated by metaconfig, it is OK to send
+# patches against it. It's up to the Configure pumpkin to backport
+# the patch to the metaunits if it is accepted.
+# See Porting/pumpkin.pod for more information on metaconfig.
+#
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Sat Oct 30 18:24:58 METDST 2004 [metaconfig 3.0 PL70]
+# Generated on Wed Mar  8 09:08:03 CET 2006 [metaconfig 3.0 PL70]
 # (with additional metaconfig patches by perlbug@perl.org)
 
 cat >c1$$ <<EOF
@@ -339,9 +345,17 @@ d_aintl=''
 d_alarm=''
 asctime_r_proto=''
 d_asctime_r=''
-d_attribut=''
+d_attribute_format=''
+d_attribute_malloc=''
+d_attribute_nonnull=''
+d_attribute_noreturn=''
+d_attribute_pure=''
+d_attribute_unused=''
+d_attribute_warn_unused_result=''
 d_bcmp=''
 d_bcopy=''
+d_builtin_choose_expr=''
+d_builtin_expect=''
 d_bzero=''
 d_casti32=''
 castflags=''
@@ -350,6 +364,7 @@ d_chown=''
 d_chroot=''
 d_chsize=''
 d_class=''
+d_clearenv=''
 d_closedir=''
 d_void_closedir=''
 d_cmsghdr_s=''
@@ -428,6 +443,7 @@ d_fsync=''
 d_ftello=''
 d_ftime=''
 d_gettimeod=''
+d_futimes=''
 d_Gconvert=''
 d_getcwd=''
 d_getespwnam=''
@@ -525,6 +541,7 @@ d_isnanl=''
 d_killpg=''
 d_lchown=''
 d_ldbl_dig=''
+d_libm_lib_version=''
 d_link=''
 d_localtime_r=''
 localtime_r_proto=''
@@ -537,6 +554,8 @@ longlongsize=''
 d_lseekproto=''
 d_lstat=''
 d_madvise=''
+d_malloc_good_size=''
+d_malloc_size=''
 d_mblen=''
 d_mbstowcs=''
 d_mbtowc=''
@@ -663,6 +682,9 @@ d_shmget=''
 d_sigaction=''
 d_sigprocmask=''
 d_sigsetjmp=''
+usesitecustomize=''
+d_snprintf=''
+d_vsnprintf=''
 d_sockatmark=''
 d_sockatmarkproto=''
 d_msg_ctrunc=''
@@ -678,6 +700,7 @@ sockethdr=''
 socketlib=''
 d_socklen_t=''
 d_socks5_init=''
+d_sprintf_returns_strlen=''
 d_sqrtl=''
 d_srand48_r=''
 srand48_r_proto=''
@@ -748,6 +771,7 @@ d_semctl_semid_ds=''
 d_semctl_semun=''
 d_union_semun=''
 d_unordered=''
+d_unsetenv=''
 d_usleep=''
 d_usleepproto=''
 d_ustat=''
@@ -938,9 +962,13 @@ sPRIgldbl=''
 sSCNfldbl=''
 lseeksize=''
 lseektype=''
+mad=''
 make_set_make=''
 d_mymalloc=''
 freetype=''
+madlyh=''
+madlyobj=''
+madlysrc=''
 mallocobj=''
 mallocsrc=''
 malloctype=''
@@ -994,6 +1022,7 @@ perl5=''
 perladmin=''
 perlpath=''
 d_nv_preserves_uv=''
+d_nv_zero_is_allbits_zero=''
 i16size=''
 i16type=''
 i32size=''
@@ -1132,6 +1161,8 @@ nm_so_opt=''
 runnm=''
 usenm=''
 useperlio=''
+initialinstalllocation=''
+userelocatableinc=''
 usesocks=''
 d_oldpthreads=''
 use5005threads=''
@@ -3106,18 +3137,21 @@ EOM
                domainos) osname=apollo
                        osvers="$3"
                        ;;
-               dgux)   osname=dgux 
+               dgux)   osname=dgux
+                       osvers="$3"
+                       ;;
+               dragonfly) osname=dragonfly
                        osvers="$3"
                        ;;
                dynixptx*) osname=dynixptx
                        osvers=`echo "$4"|sed 's/^v//'`
                        ;;
-               freebsd) osname=freebsd 
+               freebsd) osname=freebsd
                        osvers="$3" ;;
                genix)  osname=genix ;;
                gnu)    osname=gnu
                        osvers="$3" ;;
-               hp*)    osname=hpux 
+               hp*)    osname=hpux
                        osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
                        ;;
                irix*)  osname=irix
@@ -3213,7 +3247,7 @@ EOM
                        *freebsd*) ;;
                        svr*)
                                : svr4.x or possibly later
-                               case "svr$3" in 
+                               case "svr$3" in
                                ${osname}*)
                                        osname=svr$3
                                        osvers=$4
@@ -3276,7 +3310,7 @@ EOM
                        osvers="$5"
                fi
        fi
-       
+
         case "$targetarch" in
         '') ;;
         *)  hostarch=$osname
@@ -4743,7 +4777,7 @@ default|recommended)
        ?*)     echo " "
                echo "Checking if your compiler accepts -pipe" 2>&1
                echo 'int main(void) { return 0; }' > gcctest.c
-               if $cc -O2 -pipe -o gcctest gcctest.c; then
+               if $cc -pipe -o gcctest gcctest.c; then
                        echo "Yes, it does." 2>&1
                        case "$ccflags" in
                        *-pipe*)
@@ -4754,6 +4788,20 @@ default|recommended)
                else
                        echo "Nope, it doesn't, but that's ok." 2>&1
                fi
+
+               echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
+               echo 'int main(void) { return 0; }' > gcctest.c
+               if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
+                       echo "Yes, it does." 2>&1
+                       case "$ccflags" in
+                       *-Wdeclaration-after-statement*)
+                               echo "Leaving current flags $ccflags alone." 2>&1
+                               ;;
+                       *) dflt="$dflt -Wdeclaration-after-statement" ;;
+                       esac
+               else
+                       echo "Nope, it doesn't, but that's ok." 2>&1
+               fi
                ;;
        esac
        ;;
@@ -5859,7 +5907,7 @@ if $test -r $rsrc/patchlevel.h;then
        api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
        api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
        api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
-       perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
+       perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
 else
        revision=0
        patchlevel=0
@@ -5870,8 +5918,8 @@ else
        perl_patchlevel=0
        $echo "(You do not have patchlevel.h.  Eek.)"
 fi
-if $test -r $rsrc/.patch ; then  
-       if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
+if $test -r $rsrc/.patch ; then
+       if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
                perl_patchlevel=`cat $rsrc/.patch`
        fi
 fi
@@ -5921,6 +5969,78 @@ esac
 : confusing anyway.
 installstyle=$dflt
 
+
+: Perform the prefixexp/installprefixexp correction if necessary
+cat <<EOS >installprefix
+$startsh
+EOS
+cat <<'EOSC' >>installprefix
+: Change installation prefix, if necessary.
+if $test X"$prefix" != X"$installprefix"; then
+       eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
+else
+       eval "install${prefixvar}=\"\$${prefixvar}exp\""
+fi
+EOSC
+
+: Set variables such as privlib and privlibexp from the output of ./getfile
+: performing the prefixexp/installprefixexp correction if necessary.
+cat <<EOS >setprefixvar
+$startsh
+EOS
+cat <<'EOSC' >>setprefixvar
+eval "${prefixvar}=\"\$ans\""
+eval "${prefixvar}exp=\"\$ansexp\""
+. ./installprefix
+EOSC
+
+: determine where public executables go
+echo " "
+set dflt bin bin
+eval $prefixit
+fn=d~
+rp='Pathname where the public executables will reside?'
+. ./getfile
+if $test "X$ansexp" != "X$binexp"; then
+       installbin=''
+fi
+prefixvar=bin
+: XXX Bug? -- ignores Configure -Dinstallprefix setting.
+. ./setprefixvar
+
+case "$userelocatableinc" in
+$define|true|[yY]*)    dflt='y';;
+*) dflt='n';;
+esac
+cat <<EOM
+
+Would you like to build Perl so that the installation is relocatable, so that
+library paths in @INC are determined relative to the path of the perl binary?
+This is not advised for system Perl installs, or if you need to run setid
+scripts or scripts under taint mode.
+
+If this doesn't make any sense to you, just accept the default '$dflt'.
+EOM
+rp='Use relocatable @INC?'
+. ./myread
+case "$ans" in
+y|Y)   val="$define" ;;     
+*)      val="$undef" ;;
+esac
+set userelocatableinc
+eval $setvar
+
+: Default prefix is now "up one level from where the binaries are"
+case "$userelocatableinc" in
+$define|true|[yY]*) initialinstalllocation="$binexp"
+                   bin=".../"
+                   binexp=".../"
+                   prefix=".../.."
+                   prefixexp=".../.."
+                   installprefixexp=".../..";;
+esac
+
+
 : determine where private library files go
 : Usual default is /usr/local/lib/perl5/$version.
 : Also allow things like /opt/perl/lib/$version, since 
@@ -5940,14 +6060,8 @@ EOM
 fn=d~+
 rp='Pathname where the private library files will reside?'
 . ./getfile
-privlib="$ans"
-privlibexp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
-else
-       installprivlib="$privlibexp"
-fi
+prefixvar=privlib
+. ./setprefixvar
 
 : set the prefixup variable, to restore leading tilda escape
 prefixup='case "$prefixexp" in
@@ -5980,19 +6094,13 @@ EOM
 fn=d+~
 rp='Where do you want to put the public architecture-dependent libraries?'
 . ./getfile
-archlib="$ans"
-archlibexp="$ansexp"
+prefixvar=archlib
+. ./setprefixvar
 if $test X"$archlib" = X"$privlib"; then
        d_archlib="$undef"
 else
        d_archlib="$define"
 fi
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
-else
-       installarchlib="$archlibexp"
-fi
 
 : see if setuid scripts can be secure
 $cat <<EOM
@@ -6448,15 +6556,9 @@ EOM
 fn=d~+
 rp='Pathname for the site-specific library files?'
 . ./getfile
-sitelib="$ans"
-sitelibexp="$ansexp"
+prefixvar=sitelib
+. ./setprefixvar
 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
-else
-       installsitelib="$sitelibexp"
-fi
 
 : determine where site specific architecture-dependent libraries go.
 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
@@ -6480,14 +6582,8 @@ EOM
 fn=d~+
 rp='Pathname for the site-specific architecture-dependent library files?'
 . ./getfile
-sitearch="$ans"
-sitearchexp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
-else
-       installsitearch="$sitearchexp"
-fi
+prefixvar=sitearch
+. ./setprefixvar
 
 $cat <<EOM
 
@@ -6572,12 +6668,8 @@ case "$vendorprefix" in
        ;;
 esac
 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
-else
-       installvendorlib="$vendorlibexp"
-fi
+prefixvar=vendorlib
+. ./installprefix
 
 case "$vendorprefix" in
 '')    d_vendorarch="$undef"
@@ -6602,12 +6694,8 @@ case "$vendorprefix" in
        vendorarchexp="$ansexp"
        ;;
 esac
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
-else
-       installvendorarch="$vendorarchexp"
-fi
+prefixvar=vendorarch
+. ./installprefix
 
 : Final catch-all directories to search
 $cat <<EOM
@@ -6689,26 +6777,6 @@ EOM
        ;;
 esac
 
-: determine where public executables go
-echo " "
-set dflt bin bin
-eval $prefixit
-fn=d~
-rp='Pathname where the public executables will reside?'
-. ./getfile
-if $test "X$ansexp" != "X$binexp"; then
-       installbin=''
-fi
-bin="$ans"
-binexp="$ansexp"
-: Change installation prefix, if necessary.
-: XXX Bug? -- ignores Configure -Dinstallprefix setting.
-if $test X"$prefix" != X"$installprefix"; then
-       installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
-else
-       installbin="$binexp"
-fi
-
 echo " "
 case "$extras" in
 '') dflt='n';;
@@ -6777,16 +6845,10 @@ esac
 fn=dn+~
 rp="Directory for the main $spackage html pages?"
 . ./getfile
-html1dir="$ans"
-html1direxp="$ansexp"
+prefixvar=html1dir
+. ./setprefixvar
 : Use ' ' for none so value is preserved next time through Configure
 $test X"$html1dir" = "X" && html1dir=' '
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
-else
-       installhtml1dir="$html1direxp"
-fi
 
 : determine where html pages for libraries and modules go
 set html3dir html3dir none
@@ -6806,16 +6868,10 @@ esac
 fn=dn+~
 rp="Directory for the $spackage module html pages?"
 . ./getfile
-html3dir="$ans"
-html3direxp="$ansexp"
+prefixvar=html3dir
+. ./setprefixvar
 : Use ' ' for none so value is preserved next time through Configure
 $test X"$html3dir" = "X" && html3dir=' '
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
-else
-       installhtml3dir="$html3direxp"
-fi
 
 : Find perl5.005 or later.
 echo "Looking for a previously installed perl5.005 or later... "
@@ -7104,7 +7160,7 @@ esac
 : for archive libraries.  Thank you, Linux.
 case "$nm_so_opt" in
 '')    case "$myuname" in
-       *linux*)
+       *linux*|gnu*)
                if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
                        nm_so_opt='--dynamic'
                fi
@@ -7626,7 +7682,7 @@ EOM
                              '') dflt="$dflt +vnocompatwarnings" ;;
                              esac
                              ;;        
-                       linux|irix*)    dflt='-shared' ;;
+                       linux|irix*|gnu*)       dflt='-shared' ;;
                        next)  dflt='none' ;;
                        solaris) dflt='-G' ;;
                        sunos) dflt='-assert nodefinitions' ;;
@@ -7673,7 +7729,7 @@ say "none".
 EOM
     case "$ccdlflags" in
     '') case "$osname" in
-           linux|hpux) dflt='-Wl,-E' ;;
+           linux|hpux|gnu*)    dflt='-Wl,-E' ;;
            next|sunos) dflt='none' ;;
            *)          dflt='none' ;;
            esac ;;
@@ -7734,7 +7790,7 @@ any other libraries needed on this system (such as -lm, etc.).  Since
 your system supports dynamic loading, it is probably possible to build
 a shared libperl.$so.  If you will have more than one executable linked
 to libperl.$so, this will significantly reduce the size of each
-executable, but it may have a noticeable affect on performance.  The
+executable, but it may have a noticeable effect on performance.  The
 default is probably sensible for your system.
 $also
 
@@ -7770,7 +7826,7 @@ true)
                        dflt=libperl.5.$so
                        # XXX How handle the --version stuff for MAB?
                        ;;
-               linux*)  # ld won't link with a bare -lperl otherwise.
+               linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
                        dflt=libperl.$so
                        ;;
                cygwin*) # ld links against an importlib
@@ -7854,10 +7910,10 @@ if "$useshrplib"; then
        solaris)
                xxx="-R $shrpdir"
                ;;
-       freebsd|netbsd|openbsd)
+       freebsd|netbsd|openbsd|interix|dragonfly)
                xxx="-Wl,-R$shrpdir"
                ;;
-       bsdos|linux|irix*|dec_osf)
+       bsdos|linux|irix*|dec_osf|gnu*)
                xxx="-Wl,-rpath,$shrpdir"
                ;;
        next)
@@ -7968,20 +8024,14 @@ rp="Where do the main $spackage manual pages (source) go?"
 if $test "X$man1direxp" != "X$ansexp"; then
        installman1dir=''
 fi
-man1dir="$ans"
-man1direxp="$ansexp"
+prefixvar=man1dir
+. ./setprefixvar
+
 case "$man1dir" in
 '')    man1dir=' '
        installman1dir='';;
 esac
 
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
-else
-       installman1dir="$man1direxp"
-fi
-
 : What suffix to use on installed man pages
 
 case "$man1dir" in
@@ -8093,20 +8143,14 @@ echo " "
 fn=dn+~
 rp="Where do the $package library man pages (source) go?"
 . ./getfile
-man3dir="$ans"
-man3direxp="$ansexp"
+prefixvar=man3dir
+. ./setprefixvar
+
 case "$man3dir" in
 '')    man3dir=' '
        installman3dir='';;
 esac
 
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
-else
-       installman3dir="$man3direxp"
-fi
-
 : What suffix to use on installed man pages
 case "$man3dir" in
 ' ')
@@ -8575,14 +8619,11 @@ rp='Where do you keep publicly executable scripts?'
 if $test "X$ansexp" != "X$scriptdirexp"; then
        installscript=''
 fi
-scriptdir="$ans"
-scriptdirexp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
-else
-       installscript="$scriptdirexp"
-fi
+prefixvar=scriptdir
+. ./setprefixvar
+: A little fix up for an irregularly named variable.
+installscript="$installscriptdir"
+
 
 : determine where add-on public executables go
 case "$sitebin" in
@@ -8592,14 +8633,8 @@ esac
 fn=d~
 rp='Pathname where the add-on public executables should be installed?'
 . ./getfile
-sitebin="$ans"
-sitebinexp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
-else
-       installsitebin="$sitebinexp"
-fi
+prefixvar=sitebin
+. ./setprefixvar
 
 : determine where add-on html pages go
 : There is no standard location, so try to copy the previously-selected
@@ -8614,14 +8649,8 @@ esac
 fn=dn+~
 rp='Pathname where the site-specific html pages should be installed?'
 . ./getfile
-sitehtml1dir="$ans"
-sitehtml1direxp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
-else
-       installsitehtml1dir="$sitehtml1direxp"
-fi
+prefixvar=sitehtml1dir
+. ./setprefixvar
 
 : determine where add-on library html pages go
 : There is no standard location, so try to copy the previously-selected
@@ -8636,14 +8665,8 @@ esac
 fn=dn+~
 rp='Pathname where the site-specific library html pages should be installed?'
 . ./getfile
-sitehtml3dir="$ans"
-sitehtml3direxp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
-else
-       installsitehtml3dir="$sitehtml3direxp"
-fi
+prefixvar=sitehtml3dir
+. ./setprefixvar
 
 : determine where add-on manual pages go
 case "$siteman1dir" in
@@ -8656,14 +8679,8 @@ esac
 fn=dn+~
 rp='Pathname where the site-specific manual pages should be installed?'
 . ./getfile
-siteman1dir="$ans"
-siteman1direxp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
-else
-       installsiteman1dir="$siteman1direxp"
-fi
+prefixvar=siteman1dir
+. ./setprefixvar
 
 : determine where add-on library man pages go
 case "$siteman3dir" in
@@ -8676,14 +8693,8 @@ esac
 fn=dn+~
 rp='Pathname where the site-specific library manual pages should be installed?'
 . ./getfile
-siteman3dir="$ans"
-siteman3direxp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
-else
-       installsiteman3dir="$siteman3direxp"
-fi
+prefixvar=siteman3dir
+. ./setprefixvar
 
 : determine where add-on public executable scripts go
 case "$sitescript" in
@@ -8694,14 +8705,8 @@ esac
 fn=d~+
 rp='Pathname where add-on public executable scripts should be installed?'
 . ./getfile
-sitescript="$ans"
-sitescriptexp="$ansexp"
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
-else
-       installsitescript="$sitescriptexp"
-fi
+prefixvar=sitescript
+. ./setprefixvar
 
 case "$usefaststdio" in
 $define|true|[yY]*|'')
@@ -8993,12 +8998,8 @@ case "$vendorprefix" in
        vendorbinexp="$ansexp"
        ;;
 esac
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
-else
-       installvendorbin="$vendorbinexp"
-fi
+prefixvar=vendorbin
+. ./installprefix
 
 case "$vendorprefix" in
 '')    vendorhtml1dir=''
@@ -9024,12 +9025,8 @@ case "$vendorprefix" in
 esac
 : Use ' ' for none so value is preserved next time through Configure
 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
-else
-       installvendorhtml1dir="$vendorhtml1direxp"
-fi
+prefixvar=vendorhtml1dir
+. ./installprefix
 
 case "$vendorprefix" in
 '')    vendorhtml3dir=''
@@ -9055,12 +9052,8 @@ case "$vendorprefix" in
 esac
 : Use ' ' for none so value is preserved next time through Configure
 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
-else
-       installvendorhtml3dir="$vendorhtml3direxp"
-fi
+prefixvar=vendorhtml3dir
+. ./installprefix
 
 case "$vendorprefix" in
 '')    vendorman1dir=''
@@ -9083,12 +9076,8 @@ case "$vendorprefix" in
 esac
 : Use ' ' for none so value is preserved next time through Configure
 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
-else
-       installvendorman1dir="$vendorman1direxp"
-fi
+prefixvar=vendorman1dir
+. ./installprefix
 
 case "$vendorprefix" in
 '')    vendorman3dir=''
@@ -9111,12 +9100,8 @@ case "$vendorprefix" in
 esac
 : Use ' ' for none so value is preserved next time through Configure
 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
-else
-       installvendorman3dir="$vendorman3direxp"
-fi
+prefixvar=vendorman3dir
+. ./installprefix
 
 case "$vendorprefix" in
 '')    d_vendorscript="$undef"
@@ -9143,12 +9128,8 @@ EOM
        vendorscriptexp="$ansexp"
        ;;
 esac
-: Change installation prefix, if necessary.
-if $test X"$prefix" != X"$installprefix"; then
-       installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
-else
-       installvendorscript="$vendorscriptexp"
-fi
+prefixvar=vendorscript
+. ./installprefix
 
 : see if qgcvt exists
 set qgcvt d_qgcvt
@@ -9856,26 +9837,199 @@ eval $inlibc
 set atoll d_atoll
 eval $inlibc
 
-: Look for GNU-cc style attribute checking
+: Look for GCC-style attribute format
+case "$d_attribute_format" in
+'')
+echo " "
+echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
+$cat >attrib.c <<'EOCP'
+#include <stdio.h>
+void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
+EOCP
+if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
+       if $contains 'warning' attrib.out >/dev/null 2>&1; then
+               echo "Your C compiler doesn't support __attribute__((format))."
+               val="$undef"
+       else
+               echo "Your C compiler supports __attribute__((format))."
+               val="$define"
+       fi
+else
+       echo "Your C compiler doesn't seem to understand __attribute__ at all."
+       val="$undef"
+fi
+;;
+*) val="$d_attribute_format" ;;
+esac
+set d_attribute_format
+eval $setvar
+$rm -f attrib*
+
+: Look for GCC-style attribute malloc
+case "$d_attribute_malloc" in
+'')
+echo " "
+echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
+$cat >attrib.c <<'EOCP'
+#include <stdio.h>
+char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
+EOCP
+if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
+       if $contains 'warning' attrib.out >/dev/null 2>&1; then
+               echo "Your C compiler doesn't support __attribute__((malloc))."
+               val="$undef"
+       else
+               echo "Your C compiler supports __attribute__((malloc))."
+               val="$define"
+       fi
+else
+       echo "Your C compiler doesn't seem to understand __attribute__ at all."
+       val="$undef"
+fi
+;;
+*) val="$d_attribute_malloc" ;;
+esac
+set d_attribute_malloc
+eval $setvar
+$rm -f attrib*
+
+: Look for GCC-style attribute nonnull
+case "$d_attribute_nonnull" in
+'')
+echo " "
+echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
+$cat >attrib.c <<'EOCP'
+#include <stdio.h>
+void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
+EOCP
+if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
+       if $contains 'warning' attrib.out >/dev/null 2>&1; then
+               echo "Your C compiler doesn't support __attribute__((nonnull))."
+               val="$undef"
+       else
+               echo "Your C compiler supports __attribute__((nonnull))."
+               val="$define"
+       fi
+else
+       echo "Your C compiler doesn't seem to understand __attribute__ at all."
+       val="$undef"
+fi
+;;
+*) val="$d_attribute_nonnull" ;;
+esac
+set d_attribute_nonnull
+eval $setvar
+$rm -f attrib*
+
+: Look for GCC-style attribute noreturn
+case "$d_attribute_noreturn" in
+'')
+echo " "
+echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
+$cat >attrib.c <<'EOCP'
+#include <stdio.h>
+void fall_over_dead( void ) __attribute__((noreturn));
+EOCP
+if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
+       if $contains 'warning' attrib.out >/dev/null 2>&1; then
+               echo "Your C compiler doesn't support __attribute__((noreturn))."
+               val="$undef"
+       else
+               echo "Your C compiler supports __attribute__((noreturn))."
+               val="$define"
+       fi
+else
+       echo "Your C compiler doesn't seem to understand __attribute__ at all."
+       val="$undef"
+fi
+;;
+*) val="$d_attribute_noreturn" ;;
+esac
+set d_attribute_noreturn
+eval $setvar
+$rm -f attrib*
+
+: Look for GCC-style attribute pure
+case "$d_attribute_pure" in
+'')
+echo " "
+echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
+$cat >attrib.c <<'EOCP'
+#include <stdio.h>
+int square( int n ) __attribute__((pure));
+EOCP
+if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
+       if $contains 'warning' attrib.out >/dev/null 2>&1; then
+               echo "Your C compiler doesn't support __attribute__((pure))."
+               val="$undef"
+       else
+               echo "Your C compiler supports __attribute__((pure))."
+               val="$define"
+       fi
+else
+       echo "Your C compiler doesn't seem to understand __attribute__ at all."
+       val="$undef"
+fi
+;;
+*) val="$d_attribute_pure" ;;
+esac
+set d_attribute_pure
+eval $setvar
+$rm -f attrib*
+
+: Look for GCC-style attribute unused
+case "$d_attribute_unused" in
+'')
+echo " "
+echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
+$cat >attrib.c <<'EOCP'
+#include <stdio.h>
+int do_something( int dummy __attribute__((unused)), int n );
+EOCP
+if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
+       if $contains 'warning' attrib.out >/dev/null 2>&1; then
+               echo "Your C compiler doesn't support __attribute__((unused))."
+               val="$undef"
+       else
+               echo "Your C compiler supports __attribute__((unused))."
+               val="$define"
+       fi
+else
+       echo "Your C compiler doesn't seem to understand __attribute__ at all."
+       val="$undef"
+fi
+;;
+*) val="$d_attribute_unused" ;;
+esac
+set d_attribute_unused
+eval $setvar
+$rm -f attrib*
+
+: Look for GCC-style attribute warn_unused_result
+case "$d_attribute_warn_unused_result" in
+'')
 echo " "
-echo "Checking whether your compiler can handle __attribute__ ..." >&4
+echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
 $cat >attrib.c <<'EOCP'
 #include <stdio.h>
-void croak (char* pat,...) __attribute__((__format__(__printf__,1,2),noreturn));
+int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
 EOCP
 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
        if $contains 'warning' attrib.out >/dev/null 2>&1; then
-               echo "Your C compiler doesn't fully support __attribute__."
+               echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
                val="$undef"
        else
-               echo "Your C compiler supports __attribute__."
+               echo "Your C compiler supports __attribute__((warn_unused_result))."
                val="$define"
        fi
 else
        echo "Your C compiler doesn't seem to understand __attribute__ at all."
        val="$undef"
 fi
-set d_attribut
+;;
+*) val="$d_attribute_warn_unused_result" ;;
+esac
+set d_attribute_warn_unused_result
 eval $setvar
 $rm -f attrib*
 
@@ -10019,9 +10173,74 @@ EOP
        ;;
 *) val="$undef";;
 esac
-set d_bsdsetpgrp
+set d_bsdsetpgrp
+eval $setvar
+$rm -f try try.*
+: Look for GCC-style __builtin_choose_expr
+case "$d_builtin_choose_expr" in
+'')
+    echo " "
+    echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
+    $cat >try.c <<'EOCP'
+#include <assert.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
+
+int main(void) {
+    assert( SYRINX(1) == 2112 );
+    assert( SYRINX(1) != 5150 );
+    assert( SYRINX(0) == 5150 );
+    assert( SYRINX(0) != 2112 );
+    puts( "All good!" );
+    exit(0);
+}
+
+EOCP
+    set try
+    if eval $compile; then
+       echo "Your C compiler supports __builtin_choose_expr."
+       val="$define"
+    else
+       echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
+       val="$undef"
+    fi
+;;
+*) val="$d_builtin_choose_expr" ;;
+esac
+
+set d_builtin_choose_expr
 eval $setvar
-$rm -f try try.*
+$rm -f try.* try core core.try.*
+
+: Look for GCC-style __builtin_expect
+case "$d_builtin_expect" in
+'')
+    echo " "
+    echo "Checking whether your compiler can handle __builtin_expect ..." >&4
+    $cat >builtin.c <<'EOCP'
+int main(void) {
+    int n = 50;
+    if ( __builtin_expect(n, 0) ) n = 1;
+}
+EOCP
+    set try
+    if eval $compile; then
+       echo "Your C compiler supports __builtin_choose_expr."
+       val="$define"
+    else
+       echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
+       val="$undef"
+    fi
+    ;;
+*) val="$d_builtin_expect" ;;
+esac
+
+set d_builtin_expect
+eval $setvar
+$rm -f try.* try core core.try.*
+
 : see if bzero exists
 set bzero d_bzero
 eval $inlibc
@@ -10293,6 +10512,10 @@ eval $inlibc
 set class d_class
 eval $inlibc
 
+: see if clearenv exists
+set clearenv d_clearenv
+eval $inlibc
+
 hasstruct='varname=$1; struct=$2; shift; shift;
 while $test $# -ge 2; do
        case "$1" in
@@ -10823,6 +11046,7 @@ int main() {
                exit(1);
 }
 EOM
+val=$undef
 set dirfd
 if eval $compile; then
        val="$define"
@@ -12337,6 +12561,41 @@ case "$longsize" in
 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
 esac
 
+d_futimes="$undef"
+: check for a working futimes
+echo " "
+echo "Checking for a working futimes()" >&4
+$cat >try.c <<EOCP
+#include <stdio.h>
+#include <sys/time.h>
+#include <errno.h>
+#include <fcntl.h>
+
+int main ()
+{
+    int fd, rv;
+    fd = open ("try.c", O_RDWR);
+    if (-1 == fd) exit (1);
+    rv = futimes (fd, NULL);
+    exit (rv == -1 ? errno : 0);
+}
+EOCP
+set try
+if eval $compile; then
+    `$run ./try`
+    rc=$?
+    case "$rc" in
+       0)  echo "Yes, it does" >&4
+           d_futimes="$define"
+           ;;
+       *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
+           ;;
+    esac
+else
+    echo "No, it does not (probably harmless)\n" >&4
+fi
+$rm -f try.* try core core.try.*
+
 : see if getcwd exists
 set getcwd d_getcwd
 eval $inlibc
@@ -13936,6 +14195,38 @@ $rm -f ldbl_dig.?
 set d_ldbl_dig
 eval $setvar
 
+: see if this is a math.h system
+set math.h i_math
+eval $inhdr
+
+d_libm_lib_version="$undef"
+case $i_math in
+    $define)
+       : check to see if math.h defines _LIB_VERSION
+       echo " "
+       echo "Checking to see if your libm supports _LIB_VERSION..." >&4
+       $cat >try.c <<EOCP
+#include <unistd.h>
+#include <math.h>
+int main (int argc, char *argv[])
+{
+    printf ("%d\n", _LIB_VERSION);
+    return (0);
+    } /* main */
+EOCP
+       set try
+       if eval $compile; then
+           foo=`$run ./try`
+           echo "Yes, it does ($foo)" >&4
+           d_libm_lib_version="$define"
+       else
+           echo "No, it does not (probably harmless)\n" >&4
+           fi
+       $rm -f try.* try core core.try.*
+       ;;
+
+    esac
+
 : see if link exists
 set link d_link
 eval $inlibc
@@ -14006,6 +14297,14 @@ eval $inlibc
 set madvise d_madvise
 eval $inlibc
 
+: see if malloc_size exists
+set malloc_size d_malloc_size
+eval $inlibc
+
+: see if malloc_size_good exists
+set malloc_good_size d_malloc_good_size
+eval $inlibc
+
 : see if mblen exists
 set mblen d_mblen
 eval $inlibc
@@ -14103,7 +14402,7 @@ eval $inlibc
 
 : see if prototype for modfl is available
 echo " "
-set d_modflproto modfl math.h
+set d_modflproto modfl $i_math math.h
 eval $hasproto
 
 d_modfl_pow32_bug="$undef"
@@ -14600,6 +14899,128 @@ esac
 
 $rm -f try.* try
 
+$echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
+: volatile so that the compiler has to store it out to memory.
+if test X"$d_volatile" = X"$define"; then
+       volatile=volatile
+fi
+$cat <<EOP >try.c
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#$i_string I_STRING
+#ifdef I_STRING
+#  include <string.h>
+#else
+#  include <strings.h>
+#endif
+#include <sys/types.h>
+#include <signal.h>
+#ifdef SIGFPE
+$volatile int bletched = 0;
+$signal_t blech(s) int s; { bletched = 1; }
+#endif
+
+int checkit($nvtype d, char *where) {
+    unsigned char *p = (char *)&d;
+    unsigned char *end = p + sizeof(d);
+    int fail = 0;
+
+    while (p < end)
+       fail += *p++;
+
+    if (!fail)
+       return 0;
+
+    p = (char *)&d;
+    printf("No - %s: 0x", where);
+    while (p < end)
+       printf ("%02X", *p++);
+    printf("\n");
+    return 1;
+}
+
+int main(int argc, char **argv) {
+    $nvtype d = 0.0;
+    int fail = 0;
+    fail += checkit(d, "0.0");
+
+    /* The compiler shouldn't be assuming that bletched is 0  */
+    d = bletched;
+
+    fail += checkit(d, "bleched");
+
+#ifdef SIGFPE
+    signal(SIGFPE, blech);
+#endif
+
+    /* Paranoia - the compiler should have no way of knowing that ANSI says
+       that argv[argc] will always be NULL.  Actually, if it did assume this it
+       would be buggy, as this is C and main() can be called from elsewhere in
+       the program.  */
+    d = argv[argc] ? 1 : 0;
+
+    if (d) {
+       printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
+    }
+
+    fail += checkit(d, "ternary");
+
+    memset(&d, sizeof(d), argv[argc] ? 1 : 0);
+
+    if (d != 0.0) {
+       printf("No - memset doesn't give 0.0\n");
+       /* This might just blow up:  */
+       printf("(gives %g)\n", d);
+       return 1;
+    }
+    
+#ifdef SIGFPE
+    if (bletched) {
+       printf("No - something bleched\n");
+       return 1;
+    }
+#endif
+    if (fail) {
+      printf("No - %d fail(s)\n", fail);
+      return 1;
+    }
+    printf("Yes\n");
+    return 0;
+}
+EOP
+set try
+
+d_nv_zero_is_allbits_zero="$undef"
+if eval $compile; then
+    xxx="`$run ./try`"
+    case "$?" in
+       0)
+           case "$xxx" in
+               Yes)  cat >&4 <<EOM
+0.0 is represented as all bits zero in memory
+EOM
+                   d_nv_zero_is_allbits_zero="$define"
+                   ;;
+               *)  cat >&4 <<EOM
+0.0 is not represented as all bits zero in memory
+EOM
+                   d_nv_zero_is_allbits_zero="$undef"
+                   ;;
+           esac
+           ;;
+       *)  cat >&4 <<EOM
+0.0 is not represented as all bits zero in memory
+EOM
+           d_nv_zero_is_allbits_zero="$undef"
+           ;;
+    esac
+fi
+
+$rm -f try.* try
+
 
 : check for off64_t
 echo " "
@@ -15326,9 +15747,9 @@ $define)
 #endif
 END
     : see whether semctl IPC_STAT can use union semun
-    val="$undef"
     case "$d_semctl_semun" in
     '')
+      val="$undef"
       $cat > try.c <<END
 #include <sys/types.h>
 #include <sys/ipc.h>
@@ -15367,7 +15788,7 @@ int main() {
            printf("semctl IPC_STAT failed: errno = %d\n", errno);
 #      ifdef IPC_RMID
        if (semctl(sem, 0, IPC_RMID, arg) != 0)
-#      endif /* IPC_RMID */
+#      endif /* IPC_RMID */
            printf("semctl IPC_RMID failed: errno = %d\n", errno);
     } else
 #endif /* IPC_PRIVATE && ... */
@@ -15383,10 +15804,10 @@ END
           esac
       fi
       $rm -f try try.c
+      set d_semctl_semun
+      eval $setvar
       ;;
     esac
-    set d_semctl_semun
-    eval $setvar
     case "$d_semctl_semun" in
     $define)
         echo "You can use union semun for semctl IPC_STAT." >&4
@@ -15398,9 +15819,9 @@ END
     esac
 
     : see whether semctl IPC_STAT can use struct semid_ds pointer
-    val="$undef"
     case "$d_semctl_semid_ds" in
     '')
+      val="$undef"
       $cat > try.c <<'END'
 #include <sys/types.h>
 #include <sys/ipc.h>
@@ -15445,10 +15866,10 @@ END
           esac
       fi
       $rm -f try try.c
+      set d_semctl_semid_ds
+      eval $setvar
       ;;
     esac
-    set d_semctl_semid_ds
-    eval $setvar
     case "$d_semctl_semid_ds" in
     $define)
         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
@@ -16120,6 +16541,71 @@ set d_sigsetjmp
 eval $setvar
 $rm -f try.c try
 
+: see if snprintf exists
+set snprintf d_snprintf
+eval $inlibc
+
+: see if vsnprintf exists
+set vsnprintf d_vsnprintf
+eval $inlibc
+
+case "$d_snprintf-$d_vsnprintf" in
+"$define-$define")
+    $cat <<EOM
+Checking whether your snprintf() and vsnprintf() work okay...
+EOM
+    $cat >try.c <<'EOCP'
+/* v?snprintf testing logic courtesy of Russ Allbery.
+ * According to C99:
+ * - if the buffer is too short it still must be \0-terminated
+ * - if the buffer is too short the potentially required length
+ *   must be returned and not -1
+ * - if the buffer is NULL the potentially required length
+ *   must be returned and not -1 or core dump
+ */
+#include <stdio.h>
+#include <stdarg.h>
+
+char buf[2];
+
+int test (char *format, ...)
+{
+    va_list args;
+    int count;
+
+    va_start (args, format);
+    count = vsnprintf (buf, sizeof buf, format, args);
+    va_end (args);
+    return count;
+}
+
+int main ()
+{
+    return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
+             && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
+}
+EOCP
+    set try
+    if eval $compile; then
+       `$run ./try`
+       case "$?" in
+       0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
+       *) cat <<EOM >&4
+Your snprintf() and snprintf() don't seem to be working okay.
+EOM
+          d_snprintf="$undef"
+          d_vsnprintf="$undef"
+          ;;
+       esac
+    else
+       echo "(I can't seem to compile the test program--assuming they don't)"
+       d_snprintf="$undef"
+       d_vsnprintf="$undef"
+    fi
+    $rm -f try.* try core core.try.*
+    ;;
+esac
+
 : see if sockatmark exists
 set sockatmark d_sockatmark
 eval $inlibc
@@ -16133,6 +16619,68 @@ eval $hasproto
 set socks5_init d_socks5_init
 eval $inlibc
 
+: see if sprintf returns the length of the string in the buffer as per ANSI
+$echo "Checking whether sprintf returns the length of the string..." >&4
+$cat <<EOP >try.c
+#include <stdio.h>
+#$i_stdlib I_STDLIB
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#$i_string I_STRING
+#ifdef I_STRING
+#  include <string.h>
+#else
+#  include <strings.h>
+#endif
+#$i_math I_MATH
+#ifdef I_MATH
+#include <math.h>
+#endif
+
+char buffer[256];
+
+int check (size_t expect, int test) {
+  size_t got = strlen(buffer);
+  if (expect == got)
+    return 0;
+
+  printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
+       test, buffer);
+  exit (test);
+}
+
+int main(int argc, char **argv) {
+  int test = 0;
+
+  check(sprintf(buffer, ""), ++test);
+  check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
+  check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
+
+  return 0;
+}
+EOP
+set try
+
+d_sprintf_returns_strlen="$undef"
+if eval $compile; then
+    xxx="`$run ./try`"
+    case "$?" in
+       0) cat >&4 <<EOM
+sprintf returns the length of the string (as ANSI says it should)
+EOM
+       d_sprintf_returns_strlen="$define"
+       ;;
+       *) cat >&4 <<EOM
+sprintf does not return the length of the string (how old is this system?)
+EOM
+       d_sprintf_returns_strlen="$undef"
+        ;;
+    esac
+fi
+
+$rm -f try.* try
+
 : see if srand48_r exists
 set srand48_r d_srand48_r
 eval $inlibc
@@ -17087,6 +17635,10 @@ eval $inlibc
 set unordered d_unordered
 eval $inlibc
 
+: see if unsetenv exists
+set unsetenv d_unsetenv
+eval $inlibc
+
 : see if usleep exists
 set usleep d_usleep
 eval $inlibc
@@ -18342,6 +18894,34 @@ EOM
 *)  groupstype="$gidtype";;
 esac
 
+
+case "$mad" in
+$define|true|[yY]*)    dflt='y' ;;
+*)                     dflt='n' ;;
+esac
+cat <<EOM
+
+Would you like to build with Misc Attribute Decoration? This is development
+work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
+overhead on the interpreter.
+
+If this doesn't make any sense to you, just accept the default '$dflt'.
+EOM
+rp='Build Perl with MAD?'
+. ./myread
+case "$ans" in
+y|Y)   val="$define"
+       madlyh='madly.h madly.act madly.tab'
+       madlysrc='madly.c'
+       madlyobj="madly$_o" ;;
+*)     val="$undef"
+       madlyh=''
+       madlysrc=''
+       madlyobj='' ;;
+esac
+set mad
+eval $setvar
+
 echo " "
 echo "Checking if your $make program sets \$(MAKE)..." >&4
 case "$make_set_make" in
@@ -18719,7 +19299,15 @@ if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
        $run ./foobar >/dev/null 2>&1; then
        echo "$ar appears to generate random libraries itself."
        orderlib=false
-       ranlib=":"
+       if [ "X$ranlib" = "X" ]; then
+           ranlib=":"
+       fi
+elif $ar s bar$_a >/dev/null 2>&1 &&
+       $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
+       $run ./foobar >/dev/null 2>&1; then
+               echo "a table of contents needs to be added with '$ar s'."
+               orderlib=false
+               ranlib="$ar s"
 elif $ar ts bar$_a >/dev/null 2>&1 &&
        $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
        $run ./foobar >/dev/null 2>&1; then
@@ -18744,7 +19332,7 @@ else
                ranlib=":"
        fi
 fi
-$rm -f foo* bar* 
+$rm -f foo* bar*
 
 : check for type of arguments to select. 
 case "$selecttype" in
@@ -18974,6 +19562,12 @@ int main() {
 #endif
 
 #ifndef NSIG
+#  ifdef _SIG_MAX
+#    define NSIG (_SIG_MAX+1)
+#  endif
+#endif
+
+#ifndef NSIG
 #  ifdef MAXSIG
 #    define NSIG (MAXSIG+1)
 #  endif
@@ -18987,7 +19581,7 @@ int main() {
 
 #ifndef NSIG
 #  ifdef SIGARRAYSIZE
-#    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
+#    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
 #  endif
 #endif
 
@@ -19326,7 +19920,8 @@ $rm -f try try.*
 
 : see what type of char stdio uses.
 echo " "
-echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
+echo '#include <stdio.h>' > stdio.c
+$cppstdin $cppminus < stdio.c > stdioh
 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
        echo "Your stdio uses unsigned chars." >&4
        stdchar="unsigned char"
@@ -19334,9 +19929,7 @@ else
        echo "Your stdio uses signed chars." >&4
        stdchar="char"
 fi
-$rm -f stdioh
-
-
+$rm -f stdio.* stdioh
 
 : see what type uids are declared as in the kernel
 echo " "
@@ -19472,6 +20065,16 @@ case "$uidsign" in
        ;;
 esac
 
+
+case "$usesitecustomize" in
+    $define|true|[Yy]*)
+       usesitecustomize="$define"
+       ;;
+    *)
+       usesitecustomize="$undef"
+       ;;
+    esac
+
 : determine compiler compiler
 case "$yacc" in
 '')
 
 
 
-: see if this is a math.h system
-set math.h i_math
-eval $inhdr
-
 : see if this is a mntent.h system
 set mntent.h i_mntent
 eval $inhdr
@@ -19616,17 +20215,17 @@ set prot.h i_prot
 eval $inhdr
 
 echo " "
-$echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
+$echo "Guessing which symbols your C compiler and preprocessor define..." >&4
 $cat <<'EOSH' > Cppsym.know
 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
-alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
+alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
 bull c cadmus clipper CMU COFF COMPILER_VERSION
 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
-CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
+CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
 GLIBC GLIBC_MINOR
@@ -19678,7 +20277,7 @@ USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
 USGr4 USGr4_2
-Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
+Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
 z8000
@@ -19713,16 +20312,26 @@ cat <<EOSH > Cppsym.try
 $startsh
 cat <<'EOCP' > try.c
 #include <stdio.h>
+#if cpp_stuff == 1
+#define STRINGIFY(a)    "a"
+#endif
+#if cpp_stuff == 42
+#define StGiFy(a)  #a
+#define STRINGIFY(a)    StGiFy(a)
+#endif
+#if $cpp_stuff != 1 && $cpp_stuff != 42
+#   include "Bletch: How does this C preprocessor stringify macros?"
+#endif
 int main() {
 EOCP
 $awk \\
 EOSH
 cat <<'EOSH' >> Cppsym.try
 'length($1) > 0 {
-    printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
-    printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
-    printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
-    printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
+    printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
+    printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
+    printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
+    printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
 }'      >> try.c
 echo 'return 0;}' >> try.c
 EOSH
@@ -19732,11 +20341,26 @@ case "$osname-$gccversion" in
 irix-) ccflags="\$ccflags -woff 1178" ;;
 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
 esac
-$cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
+$cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
 EOSH
 chmod +x Cppsym.try
 $eunicefix Cppsym.try
 ./Cppsym < Cppsym.know > Cppsym.true
+: Add in any linux cpp "predefined macros":
+case "$osname::$gccversion" in
+  *linux*::*.*)
+    tHdrH=_tmpHdr
+    rm -f $tHdrH'.h' $tHdrH
+    touch $tHdrH'.h'
+    if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
+       sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
+       if [ -s $tHdrH'_cppsym.real' ]; then
+         cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
+       fi
+    fi
+    rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
+  ;;
+esac
 : now check the C compiler for additional symbols
 postprocess_cc_v=''
 case "$osname" in
 
 $awk '/\=/ { print $0; next }
        { print $0"=1" }' ccsym.raw >ccsym.list
-$awk '/\=/ { print $0; next }
-       { print $0"=1" }' Cppsym.true >ccsym.true
-$comm -13 ccsym.true ccsym.list >ccsym.own
-$comm -12 ccsym.true ccsym.list >ccsym.com
-$comm -23 ccsym.true ccsym.list >ccsym.cpp
+$comm -13 Cppsym.true ccsym.list >ccsym.own
+$comm -12 Cppsym.true ccsym.list >ccsym.com
+$comm -23 Cppsym.true ccsym.list >ccsym.cpp
 also=''
 if $test -z ccsym.raw; then
        echo "Your C compiler doesn't seem to define any symbols!" >&4
@@ -20566,12 +21188,20 @@ d_archlib='$d_archlib'
 d_asctime_r='$d_asctime_r'
 d_atolf='$d_atolf'
 d_atoll='$d_atoll'
-d_attribut='$d_attribut'
+d_attribute_format='$d_attribute_format'
+d_attribute_malloc='$d_attribute_malloc'
+d_attribute_nonnull='$d_attribute_nonnull'
+d_attribute_noreturn='$d_attribute_noreturn'
+d_attribute_pure='$d_attribute_pure'
+d_attribute_unused='$d_attribute_unused'
+d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
 d_bcmp='$d_bcmp'
 d_bcopy='$d_bcopy'
 d_bsd='$d_bsd'
 d_bsdgetpgrp='$d_bsdgetpgrp'
 d_bsdsetpgrp='$d_bsdsetpgrp'
+d_builtin_choose_expr='$d_builtin_choose_expr'
+d_builtin_expect='$d_builtin_expect'
 d_bzero='$d_bzero'
 d_casti32='$d_casti32'
 d_castneg='$d_castneg'
@@ -20580,6 +21210,7 @@ d_chown='$d_chown'
 d_chroot='$d_chroot'
 d_chsize='$d_chsize'
 d_class='$d_class'
+d_clearenv='$d_clearenv'
 d_closedir='$d_closedir'
 d_cmsghdr_s='$d_cmsghdr_s'
 d_const='$d_const'
@@ -20648,6 +21279,7 @@ d_fstatvfs='$d_fstatvfs'
 d_fsync='$d_fsync'
 d_ftello='$d_ftello'
 d_ftime='$d_ftime'
+d_futimes='$d_futimes'
 d_getcwd='$d_getcwd'
 d_getespwnam='$d_getespwnam'
 d_getfsstat='$d_getfsstat'
@@ -20721,6 +21353,7 @@ d_isnanl='$d_isnanl'
 d_killpg='$d_killpg'
 d_lchown='$d_lchown'
 d_ldbl_dig='$d_ldbl_dig'
+d_libm_lib_version='$d_libm_lib_version'
 d_link='$d_link'
 d_localtime_r='$d_localtime_r'
 d_locconv='$d_locconv'
@@ -20730,6 +21363,8 @@ d_longlong='$d_longlong'
 d_lseekproto='$d_lseekproto'
 d_lstat='$d_lstat'
 d_madvise='$d_madvise'
+d_malloc_good_size='$d_malloc_good_size'
+d_malloc_size='$d_malloc_size'
 d_mblen='$d_mblen'
 d_mbstowcs='$d_mbstowcs'
 d_mbtowc='$d_mbtowc'
@@ -20766,6 +21401,7 @@ d_mymalloc='$d_mymalloc'
 d_nice='$d_nice'
 d_nl_langinfo='$d_nl_langinfo'
 d_nv_preserves_uv='$d_nv_preserves_uv'
+d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
 d_off64_t='$d_off64_t'
 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
 d_oldpthreads='$d_oldpthreads'
@@ -20860,12 +21496,14 @@ d_shmget='$d_shmget'
 d_sigaction='$d_sigaction'
 d_sigprocmask='$d_sigprocmask'
 d_sigsetjmp='$d_sigsetjmp'
+d_snprintf='$d_snprintf'
 d_sockatmark='$d_sockatmark'
 d_sockatmarkproto='$d_sockatmarkproto'
 d_socket='$d_socket'
 d_socklen_t='$d_socklen_t'
 d_sockpair='$d_sockpair'
 d_socks5_init='$d_socks5_init'
+d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
 d_sqrtl='$d_sqrtl'
 d_srand48_r='$d_srand48_r'
 d_srandom_r='$d_srandom_r'
@@ -20926,6 +21564,7 @@ d_umask='$d_umask'
 d_uname='$d_uname'
 d_union_semun='$d_union_semun'
 d_unordered='$d_unordered'
+d_unsetenv='$d_unsetenv'
 d_usleep='$d_usleep'
 d_usleepproto='$d_usleepproto'
 d_ustat='$d_ustat'
@@ -20939,6 +21578,7 @@ d_voidsig='$d_voidsig'
 d_voidtty='$d_voidtty'
 d_volatile='$d_volatile'
 d_vprintf='$d_vprintf'
+d_vsnprintf='$d_vsnprintf'
 d_wait4='$d_wait4'
 d_waitpid='$d_waitpid'
 d_wcstombs='$d_wcstombs'
@@ -21193,12 +21833,16 @@ lpr='$lpr'
 ls='$ls'
 lseeksize='$lseeksize'
 lseektype='$lseektype'
+mad='$mad'
 mail='$mail'
 mailx='$mailx'
 make='$make'
 make_set_make='$make_set_make'
 mallocobj='$mallocobj'
 mallocsrc='$mallocsrc'
+madlyh='$madlyh'
+madlyobj='$madlyobj'
+madlysrc='$madlysrc'
 malloctype='$malloctype'
 man1dir='$man1dir'
 man1direxp='$man1direxp'
@@ -21424,8 +22068,11 @@ useopcode='$useopcode'
 useperlio='$useperlio'
 useposix='$useposix'
 usereentrant='$usereentrant'
+initialinstalllocation="$initialinstalllocation"
+userelocatableinc='$userelocatableinc'
 usesfio='$usesfio'
 useshrplib='$useshrplib'
+usesitecustomize='$usesitecustomize'
 usesocks='$usesocks'
 usethreads='$usethreads'
 usevendorprefix='$usevendorprefix'