perlport 1.30
[p5sagit/p5-mst-13.2.git] / Configure
index 04ab73c..3977b87 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -20,7 +20,8 @@
 
 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
 #
-# Generated on Thu May 14 12:19:05 EDT 1998 [metaconfig 3.0 PL70]
+# Generated on Tue Jul  7 10:10:21 EDT 1998 [metaconfig 3.0 PL70]
+# (with additional metaconfig patches by doughera@lafayette.edu)
 
 cat >/tmp/c1$$ <<EOF
 ARGGGHHHH!!!!!
@@ -55,6 +56,33 @@ case "$0" in
        ;;
 esac
 
+: the newline for tr
+if test X"$trnl" = X; then
+       case "`echo foo|tr '\n' x 2>/dev/null`" in
+       foox)
+               trnl='\n'
+               ;;
+       esac
+fi
+if test X"$trnl" = X; then
+       case "`echo foo|tr '\012' x 2>/dev/null`" in
+       foox)
+               trnl='\012'
+               ;;
+       esac
+fi
+if test -n "$DJGPP"; then
+       trnl='\012'
+fi
+if test X"$trnl" = X; then
+       cat <<EOM >&2
+
+$me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
+
+EOM
+       exit 1
+fi
+
 : Proper separator for the PATH environment variable
 p_=:
 : On OS/2 this directory should exist if this is not floppy only system :-]
@@ -138,14 +166,24 @@ true)
        ;;
 esac
 
+: if needed set CDPATH to a harmless value that is not chatty
+: avoid bash 2.02 problems with empty CDPATH.
+case "$CDPATH" in
+'')    ;;
+*)     case "$SHELL" in
+       *bash*) CDPATH='.' ;;
+       *)              CDPATH='' ;;
+       esac
+       ;;
+esac
 : Configure runs within the UU subdirectory
 test -d UU || mkdir UU
-CDPATH=''
 cd UU && rm -f ./*
 
 dynamic_ext=''
 extensions=''
 known_extensions=''
+nonxs_ext=''
 static_ext=''
 useopcode=''
 useposix=''
@@ -353,6 +391,7 @@ d_getservprotos=''
 d_getsbyname=''
 d_getsbyport=''
 d_gnulibc=''
+i_arpainet=''
 d_htonl=''
 d_inetaton=''
 d_isascii=''
@@ -375,7 +414,6 @@ d_memmove=''
 d_memset=''
 d_mkdir=''
 d_mkfifo=''
-d_mkstemp=''
 d_mktime=''
 d_msg=''
 d_msgctl=''
@@ -408,9 +446,6 @@ d_sem=''
 d_semctl=''
 d_semget=''
 d_semop=''
-d_union_semun=''
-d_semctl_semun=''
-d_semctl_semid_ds=''
 d_setegid=''
 d_seteuid=''
 d_setgrps=''
@@ -484,6 +519,9 @@ d_times=''
 d_truncate=''
 d_tzname=''
 d_umask=''
+d_semctl_semid_ds=''
+d_semctl_semun=''
+d_union_semun=''
 d_vfork=''
 usevfork=''
 d_voidsig=''
@@ -521,6 +559,10 @@ i_dlfcn=''
 i_fcntl=''
 i_float=''
 i_gdbm=''
+d_grpasswd=''
+d_setgrent=''
+d_getgrent=''
+d_endgrent=''
 i_grp=''
 i_limits=''
 i_locale=''
@@ -538,7 +580,11 @@ d_pwclass=''
 d_pwcomment=''
 d_pwexpire=''
 d_pwgecos=''
+d_pwpasswd=''
 d_pwquota=''
+d_setpwent=''
+d_getpwent=''
+d_endpwent=''
 i_pwd=''
 i_sfio=''
 i_stddef=''
@@ -633,8 +679,10 @@ ranlib=''
 package=''
 spackage=''
 pager=''
+apiversion=''
 patchlevel=''
 subversion=''
+version=''
 perladmin=''
 perlpath=''
 pidtype=''
@@ -685,6 +733,7 @@ mips_type=''
 usrinc=''
 defvoidused=''
 voidflags=''
+ebcdic=''
 CONFIG=''
 
 define='define'
@@ -712,7 +761,7 @@ al="$al PWB R3000 RES RISC6000 RT Sun386i SVR3 SVR4"
 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV Tek4132 Tek4300"
 al="$al UMAXV USGr4 USGr4_2 UTEK UTS UTek UnicomPBB UnicomPBD Utek"
 al="$al VMS Xenix286"
-al="$al _AIX _AIX32 _AIX370 _AM29000 _COFF _CRAY _CX_UX _EPI"
+al="$al _AIX _AIX32 _AIX370 _AIX41 _AM29000 _COFF _CRAY _CX_UX _EPI _POWER"
 al="$al _IBMESA _IBMR2 _M88K _M88KBCS_TARGET"
 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _NLS _PGC_ _R3000"
@@ -787,9 +836,6 @@ plibpth=''
 
 : default library list
 libswanted=''
-: full support for void wanted by default
-defvoidused=15
-
 : Possible local include directories to search.
 : Set locincpth to "" in a hint file to defeat local include searches.
 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
@@ -803,6 +849,9 @@ _exe=''
 : Extra object files, if any, needed on this platform.
 archobjs=''
 groupstype=''
+: full support for void wanted by default
+defvoidused=15
+
 : set useposix=false in your hint file to disable the POSIX extension.
 useposix=true
 : set useopcode=false in your hint file to disable the Opcode extension.
@@ -855,7 +904,7 @@ case "$sh" in
 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
 
 Usually it's in /bin/sh.  How did you even get this far?
-Please contact me (Andy Dougherty) at doughera@lafcol.lafayette.edu and 
+Please contact me (Andy Dougherty) at doughera@lafayette.edu and 
 we'll try to straighten this all out.
 EOM
        exit 1
@@ -921,6 +970,23 @@ else
 fi
 rm -f try
 
+
+: Save command line options in file UU/cmdline.opt for later use in
+: generating config.sh.
+cat > cmdline.opt <<EOSH
+# Configure command line arguments.
+config_arg0='$0'
+config_args='$*'
+config_argc=$#
+EOSH
+argn=1
+for arg in "$@"; do
+       cat >>cmdline.opt <<EOSH
+config_arg$argn='$arg'
+EOSH
+       argn=`expr $argn + 1`
+done
+
 : produce awk script to parse command line options
 cat >options.awk <<'EOF'
 BEGIN {
@@ -1307,7 +1373,7 @@ THIS PACKAGE SEEMS TO BE INCOMPLETE.
 You have the option of continuing the configuration process, despite the
 distinct possibility that your kit is damaged, by typing 'y'es.  If you
 do, don't blame me if something goes wrong.  I advise you to type 'n'o
-and contact the author (doughera@lafcol.lafayette.edu).
+and contact the author (doughera@lafayette.edu).
 
 EOM
                echo $n "Continue? [n] $c" >&4
@@ -1413,7 +1479,7 @@ while expr "X\$ans" : "X!" >/dev/null; do
                y)
                        echo "*** Substitution done -- please confirm."
                        xxxm="\$ans"
-                       ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
+                       ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
                        xxxm="\$ans"
                        ans=!
                        ;;
@@ -1508,7 +1574,7 @@ Much effort has been expended to ensure that this shell script will run on any
 Unix system.  If despite that it blows up on yours, your best bet is to edit
 Configure and run it again.  If you can't run Configure for some reason,
 you'll have to generate a config.sh file by hand.  Whatever problems you
-have, let me (doughera@lafcol.lafayette.edu) know how I blew it.
+have, let me (doughera@lafayette.edu) know how I blew it.
 
 This installation script affects things in two ways:
 
@@ -1748,17 +1814,59 @@ $rm -f blurfl sym
 
 : see whether [:lower:] and [:upper:] are supported character classes
 echo " "
-up='[A-Z]'
-low='[a-z]'
 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
 ABYZ)
        echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
        up='[:upper:]'
        low='[:lower:]'
        ;;
+*)     # There is a discontinuity in EBCDIC between 'I' and 'J'
+        # (0xc9 and 0xd1), therefore that is a nice testing point.
+        if test "X$up" = X -o "X$low" = X; then
+           case "`echo IJ | tr '[I-J]' '[i-j]' 2>/dev/null`" in
+           ij) up='[A-Z]'
+               low='[a-z]'
+               ;;
+           esac
+        fi
+       if test "X$up" = X -o "X$low" = X; then
+           case "`echo IJ | tr I-J i-j 2>/dev/null`" in
+           ij) up='A-Z'
+               low='a-z'
+               ;;
+           esac
+        fi
+       if test "X$up" = X -o "X$low" = X; then
+           case "`echo IJ | od -x 2>/dev/null`" in
+           *C9D1*|*c9d1*)
+               echo "Hey, this might be EBCDIC." >&4
+               if test "X$up" = X -o "X$low" = X; then
+                   case "`echo IJ | tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
+                   ij) up='[A-IJ-RS-Z]'
+                       low='[a-ij-rs-z]'
+                       ;;
+                   esac
+               fi
+               if test "X$up" = X -o "X$low" = X; then
+                   case "`echo IJ | tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
+                   ij) up='A-IJ-RS-Z'
+                       low='a-ij-rs-z'
+                       ;;
+                   esac
+               fi
+               ;;
+           esac
+       fi
+esac
+case "`echo IJ | tr \"$up\" \"$low\" 2>/dev/null`" in
+ij)
+    echo "Using $up and $low to convert case." >&4
+    ;;
 *)
-       echo "Your tr only supports [a-z] and [A-Z] to convert case." >&4
-       ;;
+    echo "I don't know how to translate letters from upper to lower case." >&4
+    echo "Your tr is not acting any way I know of." >&4
+    exit 1
+    ;;
 esac
 : set up the translation script tr, must be called with ./tr of course
 cat >tr <<EOSC
@@ -1776,8 +1884,10 @@ $eunicefix tr
 case "$config_sh" in
 '')
 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
+# tr '[A-Z]' '[a-z]' would not work in EBCDIC
+# because the A-Z/a-z are not consecutive.
 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
-       ./tr '[A-Z]' '[a-z]' | tr '\012' ' '`
+       ./tr '[A-Z]' '[a-z]' | tr $trnl ' '`
 newmyuname="$myuname"
 dflt=n
 case "$knowitall" in
@@ -1831,7 +1941,7 @@ EOM
        (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
        dflt=''
        : Half the following guesses are probably wrong... If you have better
-       : tests or hints, please send them to doughera@lafcol.lafayette.edu
+       : tests or hints, please send them to doughera@lafayette.edu
        : The metaconfig authors would also appreciate a copy...
        $test -f /irix && osname=irix
        $test -f /xenix && osname=sco_xenix
@@ -1921,14 +2031,7 @@ EOM
                        osvers="$3" ;;
                genix) osname=genix ;;
                hp*) osname=hpux 
-                       case "$3" in
-                       *.08.*) osvers=9 ;;
-                       *.09.*) osvers=9 ;;
-                       *.10.*) osvers=10 ;;
-                       *.11.*) osvers=11 ;;
-                       *.12.*) osvers=12 ;;
-                       *)      osvers="$3" ;;
-                       esac
+                       osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
                        ;;
                irix*) osname=irix
                        case "$3" in
@@ -1942,7 +2045,9 @@ EOM
                        *)      osvers="$3" ;;
                        esac
                        ;;
-               netbsd*) osname=netbsd 
+               MiNT) osname=mint
+                       ;;
+               netbsd*) osname=netbsd
                        osvers="$3"
                        ;;
                news-os) osvers="$3"
@@ -2432,7 +2537,7 @@ orig_dflt="$dflt"
 
 case "$fn" in
 *\(*)
-       expr $fn : '.*(\(.*\)).*' | tr ',' '\012' >getfile.ok
+       expr $fn : '.*(\(.*\)).*' | tr ',' $trnl >getfile.ok
        fn=`echo $fn | sed 's/(.*)//'`
        ;;
 esac
@@ -2685,12 +2790,53 @@ prefixit='case "$3" in
        esac;;
 esac'
 
+: set the base revision
+baserev=5.0
+
+: get the patchlevel
+echo " "
+echo "Getting the current patchlevel..." >&4
+if $test -r $rsrc/patchlevel.h;then
+       patchlevel=`awk '/define[       ]+PATCHLEVEL/ {print $3}' $rsrc/patchlevel.h`
+       subversion=`awk '/define[       ]+SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
+else
+       patchlevel=0
+       subversion=0
+fi
+$echo $n "(You have $package" $c
+case "$package" in
+"*$baserev")   ;;
+*)             $echo $n " $baserev" $c ;;
+esac
+$echo $n " patchlevel $patchlevel" $c
+test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
+echo ".)"
+
+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
+: Figure out perl API version.  Perhaps this should be in patchlevel.h
+if test "$subversion" -lt 50; then
+       apiversion=`LC_ALL=C; export LC_ALL; \
+                echo $baserev $patchlevel | \
+                $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'`
+else
+       apiversion="$version"
+fi
+
 : determine where private library files go
-: Usual default is /usr/local/lib/perl5.  Also allow things like 
-: /opt/perl/lib, since /opt/perl/lib/perl5 would be redundant.
+: Usual default is /usr/local/lib/perl5/$version.
+: Also allow things like /opt/perl/lib/$version, since 
+: /opt/perl/lib/perl5... would be redundant.
 case "$prefix" in
-*perl*) set dflt privlib lib ;;
-*)      set dflt privlib lib/$package ;;
+*perl*) set dflt privlib lib/$version ;;
+*)      set dflt privlib lib/$package/$version ;;
 esac
 eval $prefixit
 $cat <<EOM
@@ -2727,28 +2873,6 @@ else
        installprivlib="$privlibexp"
 fi
 
-: set the base revision
-baserev=5.0
-
-: get the patchlevel
-echo " "
-echo "Getting the current patchlevel..." >&4
-if $test -r $rsrc/patchlevel.h;then
-       patchlevel=`awk '/define[       ]+PATCHLEVEL/ {print $3}' $rsrc/patchlevel.h`
-       subversion=`awk '/define[       ]+SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
-else
-       patchlevel=0
-       subversion=0
-fi
-$echo $n "(You have $package" $c
-case "$package" in
-"*$baserev")   ;;
-*)             $echo $n " $baserev" $c ;;
-esac
-$echo $n " patchlevel $patchlevel" $c
-test 0 -eq "$subversion" || $echo $n " subversion $subversion" $c
-echo ".)"
-
 : set the prefixup variable, to restore leading tilda escape
 prefixup='case "$prefixexp" in
 "$prefix") ;;
@@ -2758,28 +2882,15 @@ esac'
 : determine where public architecture dependent libraries go
 set archlib archlib
 eval $prefixit
+: privlib default is /usr/local/lib/$package/$version
+: archlib default is /usr/local/lib/$package/$version/$archname
+: privlib may have an optional trailing /share.
+tdflt=`echo $privlib | $sed 's,/share$,,'`
+tdflt=$tdflt/$archname
 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=`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"
+'')    dflt=$tdflt
        ;;
-    esac
-    ;;
-*)
-    dflt="$archlib"
+*)     dflt="$archlib"
     ;;
 esac
 cat <<EOM
@@ -3869,7 +3980,7 @@ rmlist="$rmlist pdp11"
 : coherency check
 echo " "
 echo "Checking your choice of C compiler and flags for coherency..." >&4
-set X $cc $optimize $ccflags $ldflags -o try try.c $libs
+set X $cc $optimize $ccflags -o try $ldflags try.c $libs
 shift
 $cat >try.msg <<EOM
 I've tried to compile and run a simple program with:
@@ -3885,7 +3996,7 @@ $cat > try.c <<'EOF'
 main() { printf("Ok\n"); exit(0); }
 EOF
 dflt=y
-if sh -c "$cc $optimize $ccflags $ldflags -o try try.c $libs" >>try.msg 2>&1; then
+if sh -c "$cc $optimize $ccflags -o try $ldflags try.c $libs" >>try.msg 2>&1; then
        if sh -c './try' >>try.msg 2>&1; then
                xxx=`./try`
                case "$xxx" in
@@ -3937,6 +4048,181 @@ n) echo "OK, that should do.";;
 esac
 $rm -f try try.* core
 
+: determine filename position in cpp output
+echo " "
+echo "Computing filename position in cpp output for #include directives..." >&4
+echo '#include <stdio.h>' > foo.c
+$cat >fieldn <<EOF
+$startsh
+$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
+$grep '^[      ]*#.*stdio\.h' | \
+while read cline; do
+       pos=1
+       set \$cline
+       while $test \$# -gt 0; do
+               if $test -r \`echo \$1 | $tr -d '"'\`; then
+                       echo "\$pos"
+                       exit 0
+               fi
+               shift
+               pos=\`expr \$pos + 1\`
+       done
+done
+EOF
+chmod +x fieldn
+fieldn=`./fieldn`
+$rm -f foo.c fieldn
+case $fieldn in
+'') pos='???';;
+1) pos=first;;
+2) pos=second;;
+3) pos=third;;
+*) pos="${fieldn}th";;
+esac
+echo "Your cpp writes the filename in the $pos field of the line."
+
+: locate header file
+$cat >findhdr <<EOF
+$startsh
+wanted=\$1
+name=''
+if test -f $usrinc/\$wanted; then
+       echo "$usrinc/\$wanted"
+       exit 0
+fi
+awkprg='{ print \$$fieldn }'
+echo "#include <\$wanted>" > foo\$\$.c
+$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
+$grep "^[      ]*#.*\$wanted" | \
+while read cline; do
+       name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
+       case "\$name" in
+       */\$wanted) echo "\$name"; exit 0;;
+       *) name='';;
+       esac;
+done;
+$rm -f foo\$\$.c;
+case "\$name" in
+'') exit 1;;
+esac
+EOF
+chmod +x findhdr
+
+: define an alternate in-header-list? function
+inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
+cont=true; xxf="echo \"<\$1> found.\" >&4";
+case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
+*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
+esac;
+case $# in 4) instead=instead;; *) instead="at last";; esac;
+while $test "$cont"; do
+       xxx=`./findhdr $1`
+       var=$2; eval "was=\$$2";
+       if $test "$xxx" && $test -r "$xxx";
+       then eval $xxf;
+       eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
+               cont="";
+       else eval $xxnf;
+       eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
+       set $yyy; shift; shift; yyy=$@;
+       case $# in 0) cont="";;
+       2) xxf="echo \"but I found <\$1> $instead.\" >&4";
+               xxnf="echo \"and I did not find <\$1> either.\" >&4";;
+       *) xxf="echo \"but I found <\$1\> instead.\" >&4";
+               xxnf="echo \"there is no <\$1>, ...\" >&4";;
+       esac;
+done;
+while $test "$yyy";
+do set $yyy; var=$2; eval "was=\$$2";
+       eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
+       set $yyy; shift; shift; yyy=$@;
+done'
+
+: see if this is a malloc.h system
+set malloc.h i_malloc
+eval $inhdr
+
+: see if stdlib is available
+set stdlib.h i_stdlib
+eval $inhdr
+
+: determine which malloc to compile in
+echo " "
+case "$usemymalloc" in
+''|y*|true)    dflt='y' ;;
+n*|false)      dflt='n' ;;
+*)     dflt="$usemymalloc" ;;
+esac
+rp="Do you wish to attempt to use the malloc that comes with $package?"
+. ./myread
+usemymalloc="$ans"
+case "$ans" in
+y*|true)
+       usemymalloc='y'
+       mallocsrc='malloc.c'
+       mallocobj="malloc$_o"
+       d_mymalloc="$define"
+       case "$libs" in
+       *-lmalloc*)
+               : Remove malloc from list of libraries to use
+               echo "Removing unneeded -lmalloc from library list" >&4
+               set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
+               shift
+               libs="$*"
+               echo "libs = $libs" >&4
+               ;;
+       esac
+       ;;
+*)
+       usemymalloc='n'
+       mallocsrc=''
+       mallocobj=''
+       d_mymalloc="$undef"
+       ;;
+esac
+
+: compute the return types of malloc and free
+echo " "
+$cat >malloc.c <<END
+#$i_malloc I_MALLOC
+#$i_stdlib I_STDLIB
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef I_MALLOC
+#include <malloc.h>
+#endif
+#ifdef I_STDLIB
+#include <stdlib.h>
+#endif
+#ifdef TRY_MALLOC
+void *malloc();
+#endif
+#ifdef TRY_FREE
+void free();
+#endif
+END
+case "$malloctype" in
+'')
+       if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
+               malloctype='void *'
+       else
+               malloctype='char *'
+       fi
+       ;;
+esac
+echo "Your system wants malloc to return '$malloctype', it would seem." >&4
+
+case "$freetype" in
+'')
+       if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
+               freetype='void'
+       else
+               freetype='int'
+       fi
+       ;;
+esac
+echo "Your system uses $freetype free(), it would seem." >&4
+$rm -f malloc.[co]
 : Cruising for prototypes
 echo " "
 echo "Checking out function prototypes..." >&4
@@ -4022,17 +4308,47 @@ shift;
 $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs;'
 
 echo " "
+echo "Determining whether or not we are on an EBCDIC system..." >&4
+cat >tebcdic.c <<EOM
+int main()
+{
+  if ('M'==0xd4) return 0;
+  return 1;
+}
+EOM
+val=$undef
+set tebcdic
+if eval $compile_ok; then
+       if ./tebcdic; then
+               echo "You have EBCDIC." >&4
+               val="$define"
+       else
+               echo "Nope, no EBCDIC.  Assuming ASCII or some ISO Latin." >&4
+       fi
+else
+       echo "I'm unable to compile the test program." >&4
+       echo "I'll asuume ASCII or some ISO Latin." >&4
+fi
+$rm -f tebcdic.c tebcdic
+set ebcdic
+eval $setvar
+
+echo " "
 echo "Checking for GNU C Library..." >&4
 cat >gnulibc.c <<EOM
+#include <stdio.h>
 int
 main()
 {
-       return __libc_main();
+#ifdef __GLIBC__
+    exit(0);
+#else
+    exit(1);
+#endif
 }
 EOM
 set gnulibc
-if eval $compile && \
-  ./gnulibc | $contains '^GNU C Library'; then
+if eval $compile_ok && ./gnulibc; then
        val="$define"
        echo "You are using the GNU C Library"
 else
@@ -4188,7 +4504,7 @@ unknown)
                : The messy sed command sorts on library version numbers.
                $test -r $1 || \
                        set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
-                       tr ' ' '\012' | egrep -v '\.[A-Za-z]*$' | $sed -e '
+                       tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
                                h
                                s/[0-9][0-9]*/0000&/g
                                s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
@@ -4254,7 +4570,7 @@ compiler, or your machine supports multiple models), you can override it here.
 EOM
 else
        dflt=''
-       echo $libpth | tr ' ' '\012' | sort | uniq > libpath
+       echo $libpth | tr ' ' $trnl | sort | uniq > libpath
        cat >&4 <<EOM
 I can't seem to find your C library.  I've looked in the following places:
 
@@ -4272,7 +4588,7 @@ rp='Where is your C library?'
 libc="$ans"
 
 echo " "
-echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
+echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames
 set X `cat libnames`
 shift
 xxx=files
@@ -4409,96 +4725,6 @@ fi
 esac
 $rm -f libnames libpath
 
-: determine filename position in cpp output
-echo " "
-echo "Computing filename position in cpp output for #include directives..." >&4
-echo '#include <stdio.h>' > foo.c
-$cat >fieldn <<EOF
-$startsh
-$cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
-$grep '^[      ]*#.*stdio\.h' | \
-while read cline; do
-       pos=1
-       set \$cline
-       while $test \$# -gt 0; do
-               if $test -r \`echo \$1 | $tr -d '"'\`; then
-                       echo "\$pos"
-                       exit 0
-               fi
-               shift
-               pos=\`expr \$pos + 1\`
-       done
-done
-EOF
-chmod +x fieldn
-fieldn=`./fieldn`
-$rm -f foo.c fieldn
-case $fieldn in
-'') pos='???';;
-1) pos=first;;
-2) pos=second;;
-3) pos=third;;
-*) pos="${fieldn}th";;
-esac
-echo "Your cpp writes the filename in the $pos field of the line."
-
-: locate header file
-$cat >findhdr <<EOF
-$startsh
-wanted=\$1
-name=''
-if test -f $usrinc/\$wanted; then
-       echo "$usrinc/\$wanted"
-       exit 0
-fi
-awkprg='{ print \$$fieldn }'
-echo "#include <\$wanted>" > foo\$\$.c
-$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
-$grep "^[      ]*#.*\$wanted" | \
-while read cline; do
-       name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
-       case "\$name" in
-       */\$wanted) echo "\$name"; exit 0;;
-       *) name='';;
-       esac;
-done;
-$rm -f foo\$\$.c;
-case "\$name" in
-'') exit 1;;
-esac
-EOF
-chmod +x findhdr
-
-: define an alternate in-header-list? function
-inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
-cont=true; xxf="echo \"<\$1> found.\" >&4";
-case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
-*) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
-esac;
-case $# in 4) instead=instead;; *) instead="at last";; esac;
-while $test "$cont"; do
-       xxx=`./findhdr $1`
-       var=$2; eval "was=\$$2";
-       if $test "$xxx" && $test -r "$xxx";
-       then eval $xxf;
-       eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
-               cont="";
-       else eval $xxnf;
-       eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
-       set $yyy; shift; shift; yyy=$@;
-       case $# in 0) cont="";;
-       2) xxf="echo \"but I found <\$1> $instead.\" >&4";
-               xxnf="echo \"and I did not find <\$1> either.\" >&4";;
-       *) xxf="echo \"but I found <\$1\> instead.\" >&4";
-               xxnf="echo \"there is no <\$1>, ...\" >&4";;
-       esac;
-done;
-while $test "$yyy";
-do set $yyy; var=$2; eval "was=\$$2";
-       eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
-       set $yyy; shift; shift; yyy=$@;
-done'
-
 : see if dld is available
 set dld.h i_dld
 eval $inhdr
@@ -4642,26 +4868,17 @@ EOM
                        hpux)   dflt='+z' ;;
                        next)   dflt='none' ;;
                        irix*)  dflt='-KPIC' ;;
-                       svr4*|esix*|solaris)
-                               case "$ccflags" in
-                                       *-DDEBUGGING*)  dflt='-KPIC' ;;
-                                       *)      dflt='-Kpic' ;;
-                               esac 
-                               ;;
+                       svr4*|esix*|solaris) dflt='-KPIC' ;;
                        sunos)  dflt='-pic' ;;
                        *)      dflt='none' ;;
                    esac
                        ;;
                *)  case "$osname" in
-                       svr4*|esix*|solaris)
-                               case "$ccflags" in
-                                       *-DDEBUGGING*)  dflt='-fPIC' ;;
-                                       *)      dflt='-fpic' ;;
-                               esac 
-                               ;;
+                       svr4*|esix*|solaris) dflt='-fPIC' ;;
                        *)      dflt='-fpic' ;;
                    esac ;;
            esac ;;
+       ' ') dflt='none' ;;
     *) dflt="$cccdlflags" ;;
     esac
     rp="Any special flags to pass to $cc -c to compile shared library modules?"
@@ -4735,21 +4952,21 @@ EOM
     *) dflt="$lddlflags" ;;
     esac
 
-: Try to guess additional flags to pick up local libraries.
-for thisflag in $ldflags; do
-       case "$thisflag" in
-       -L*)
-               case " $dflt " in
-               *" $thisflag "*) ;;
-               *) dflt="$dflt $thisflag" ;;
+       : Try to guess additional flags to pick up local libraries.
+       for thisflag in $ldflags; do
+               case "$thisflag" in
+               -L*)
+                       case " $dflt " in
+                       *" $thisflag "*) ;;
+                       *) dflt="$dflt $thisflag" ;;
+                       esac
+                       ;;
                esac
-               ;;
-       esac
-done
+       done
 
-case "$dflt" in
-'') dflt='none' ;;
-esac
+       case "$dflt" in
+       ''|' ') dflt='none' ;;
+       esac
 
     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
     . ./myread
@@ -4773,6 +4990,7 @@ EOM
                sunos)  dflt='none' ;;
                *)      dflt='none' ;;
            esac ;;
+    ' ')  dflt='none' ;;
     *)  dflt="$ccdlflags" ;;
     esac
     rp="Any special flags to pass to $cc to use dynamic loading?"
@@ -4929,7 +5147,7 @@ case "$shrpdir" in
 *)     $cat >&4 <<EOM
 WARNING:  Use of the shrpdir variable for the installation location of
 the shared $libperl is not supported.  It was never documented and
-will not work in this version.  Let me (doughera@lafcol.lafayette.edu)
+will not work in this version.  Let me (doughera@lafayette.edu)
 know of any problems this may cause.
 
 EOM
@@ -5663,14 +5881,13 @@ else
 fi
 
 : determine where site specific libraries go.
-set sitelib sitelib
-eval $prefixit
-case "$sitelib" in
-'')
-       prog=`echo $package | $sed 's/-*[0-9.]*$//'`
-       dflt="$privlib/site_$prog" ;;
-*)     dflt="$sitelib" ;;
+: Usual default is /usr/local/lib/perl5/site_perl/$apiversion
+prog=`echo $package | $sed 's/-*[0-9.]*$//'`
+case "$prefix" in
+*perl*) set dflt sitelib lib/site_$prog/$apiversion ;;
+*)      set dflt sitelib lib/$package/site_$prog/$apiversion ;;
 esac
+eval $prefixit
 $cat <<EOM
 
 The installation process will also create a directory for
@@ -5709,12 +5926,15 @@ else
 fi
 
 : determine where site specific architecture-dependent libraries go.
-xxx=`echo $sitelib/$archname | sed 's!^$prefix!!'`
-: xxx is usuually lib/site_perl/archname.
+: sitelib  default is /usr/local/lib/perl5/site_perl/$apiversion
+: sitearch default is /usr/local/lib/perl5/site_perl/$apiversion/$archname
+: sitelib may have an optional trailing /share.
+tdflt=`echo $sitelib | $sed 's,/share$,,'`
+tdflt="$tdflt/$archname"
 set sitearch sitearch none
 eval $prefixit
 case "$sitearch" in
-'')    dflt="$sitelib/$archname" ;;
+'')    dflt="$tdflt" ;;
 *)     dflt="$sitearch" ;;
 esac
 $cat <<EOM
@@ -5783,9 +6003,10 @@ set useperlio
 eval $setvar 
 
 : Check how to convert floats to strings.
-echo " "
-echo "Checking for an efficient way to convert floats to strings."
-$cat >try.c <<'EOP'
+if test "X$d_Gconvert" = X; then
+    echo " "
+    echo "Checking for an efficient way to convert floats to strings."
+    $cat >try.c <<'EOP'
 #ifdef TRY_gconvert
 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
 char *myname = "gconvert";
@@ -5844,14 +6065,14 @@ main()
        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_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
 
-for xxx_convert in $xxx_list; do
+    for xxx_convert in $xxx_list; do
        echo "Trying $xxx_convert"
        $rm -f try try$_o
        set try -DTRY_$xxx_convert
@@ -5866,13 +6087,14 @@ for xxx_convert in $xxx_list; do
        else
                echo "$xxx_convert NOT found." >&4
        fi
-done
+    done
                
-case "$xxx_convert" in
-gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
-gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
-*) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
-esac
+    case "$xxx_convert" in
+    gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
+    gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
+    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
+    esac
+fi
 
 : Initialize h_fcntl
 h_fcntl=false
@@ -6196,10 +6418,14 @@ main()
        $xxx i32;
        double f, g;
        int result = 0;
+       char str[16];
        signal(SIGFPE, blech);
 
-       /* Don't let compiler optimize the test away */
-       sscanf("2147483647", "%lf", &f); /* f = (double) 0x7fffffff; */
+       /* Don't let compiler optimize the test away.  Store the number 
+          in a writable string for gcc to pass to sscanf under HP/UX.
+       */
+       sprintf(str, "2147483647");
+       sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
        g = 10 * f;
        i32  = ($xxx) g;
 
@@ -6252,11 +6478,17 @@ main()
        unsigned int aint;
        unsigned short ashort;
        int result = 0;
+       char str[16];
+       
        /* Frustrate gcc-2.7.2's optimizer which failed this test with
           a direct f = -123. assignment.  gcc-2.8.0 reportedly
           optimized the whole file away
        */
-       sscanf("-123.", "%lf", &f);  /* f = -123.; */
+       /* Store the number in a writable string for gcc to pass to 
+          sscanf under HP/UX.
+       */
+       sprintf(str, "-123");
+       sscanf(str, "%lf", &f);  /* f = -123.; */
 
        signal(SIGFPE, blech);
        along = (unsigned long)f;
@@ -6268,7 +6500,8 @@ main()
                result |= 1;
        if (ashort != (unsigned short)-123)
                result |= 1;
-       sscanf("1073741824.", "%lf", &f); /* f = (double)0x40000000; */
+       sprintf(str, "1073741824.");
+       sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
        f = f + f;
        along = 0;
        along = (unsigned long)f;
@@ -6287,7 +6520,8 @@ main()
        if (result)
                exit(result);
        signal(SIGFPE, blech_in_list);
-       sscanf("123.", "%lf", &f);  /* f = 123.; */
+       sprintf(str, "123.");
+       sscanf(str, "%lf", &f);  /* f = 123.; */
        along = dummy_long((unsigned long)f);
        aint = dummy_int((unsigned int)f);
        ashort = dummy_short((unsigned short)f);
@@ -6631,7 +6865,7 @@ EOM
        if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
                mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
                $ld $lddlflags -o dyna.$dlext tmp-dyna${_o} > /dev/null 2>&1 && 
-               $cc $ccflags $ldflags $cccdlflags $ccdlflags fred.c -o fred $libs > /dev/null 2>&1; then
+               $cc $ccflags -o fred $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1; then
                xxx=`./fred`
                case $xxx in
                1)      echo "Test program failed using dlopen." >&4
@@ -7031,7 +7265,6 @@ echo " "
 set d_getprotoprotos getprotoent $i_netdb netdb.h
 eval $hasproto
 
-
 : see if getservbyname exists
 set getservbyname d_getsbyname
 eval $inlibc
@@ -7072,6 +7305,10 @@ esac
 set netinet/in.h i_niin sys/in.h i_sysin
 eval $inhdr
 
+: see if this is an arpa/inet.h
+set arpa/inet.h i_arpainet
+eval $inhdr
+
 : see if htonl --and friends-- exists
 val=''
 set htonl val
@@ -7085,12 +7322,16 @@ $undef)
 #include <sys/types.h>
 #$i_niin I_NETINET_IN
 #$i_sysin I_SYS_IN
+#$i_arpainet I_ARPA_INET
 #ifdef I_NETINET_IN
 #include <netinet/in.h>
 #endif
 #ifdef I_SYS_IN
 #include <sys/in.h>
 #endif
+#ifdef I_ARPA_INET
+#include <arpa/inet.h>
+#endif
 #ifdef htonl
 printf("Defined as a macro.");
 #endif
@@ -7364,10 +7605,6 @@ eval $inlibc
 set mkfifo d_mkfifo
 eval $inlibc
 
-: see if mkstemp exists
-set mkstemp d_mkstemp
-eval $inlibc
-
 : see if mktime exists
 set mktime d_mktime
 eval $inlibc
@@ -7394,6 +7631,25 @@ echo " "
 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
 *"$undef"*) h_msg=false;;
 esac
+case "$osname" in
+freebsd)
+    case "`ipcs 2>&1`" in
+    "SVID messages"*"not configured"*)
+       echo "But your FreeBSD kernel does not have the msg*(2) configured." >&4
+        h_msg=false
+       val="$undef"
+       set msgctl d_msgctl
+       eval $setvar
+       set msgget d_msgget
+       eval $setvar
+       set msgsnd d_msgsnd
+       eval $setvar
+       set msgrcv d_msgrcv
+       eval $setvar
+       ;;
+    esac
+    ;;
+esac
 : we could also check for sys/ipc.h ...
 if $h_msg && $test `./findhdr sys/msg.h`; then
        echo "You have the full msg*(2) library." >&4
@@ -7405,91 +7661,6 @@ fi
 set d_msg
 eval $setvar
 
-: see if this is a malloc.h system
-set malloc.h i_malloc
-eval $inhdr
-
-: see if stdlib is available
-set stdlib.h i_stdlib
-eval $inhdr
-
-: determine which malloc to compile in
-echo " "
-case "$usemymalloc" in
-''|y*|true)    dflt='y' ;;
-n*|false)      dflt='n' ;;
-*)     dflt="$usemymalloc" ;;
-esac
-rp="Do you wish to attempt to use the malloc that comes with $package?"
-. ./myread
-usemymalloc="$ans"
-case "$ans" in
-y*|true)
-       usemymalloc='y'
-       mallocsrc='malloc.c'
-       mallocobj="malloc$_o"
-       d_mymalloc="$define"
-       case "$libs" in
-       *-lmalloc*)
-               : Remove malloc from list of libraries to use
-               echo "Removing unneeded -lmalloc from library list" >&4
-               set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
-               shift
-               libs="$*"
-               echo "libs = $libs" >&4
-               ;;
-       esac
-       ;;
-*)
-       usemymalloc='n'
-       mallocsrc=''
-       mallocobj=''
-       d_mymalloc="$undef"
-       ;;
-esac
-
-: compute the return types of malloc and free
-echo " "
-$cat >malloc.c <<END
-#$i_malloc I_MALLOC
-#$i_stdlib I_STDLIB
-#include <stdio.h>
-#include <sys/types.h>
-#ifdef I_MALLOC
-#include <malloc.h>
-#endif
-#ifdef I_STDLIB
-#include <stdlib.h>
-#endif
-#ifdef TRY_MALLOC
-void *malloc();
-#endif
-#ifdef TRY_FREE
-void free();
-#endif
-END
-case "$malloctype" in
-'')
-       if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
-               malloctype='void *'
-       else
-               malloctype='char *'
-       fi
-       ;;
-esac
-echo "Your system wants malloc to return '$malloctype', it would seem." >&4
-
-case "$freetype" in
-'')
-       if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
-               freetype='void'
-       else
-               freetype='int'
-       fi
-       ;;
-esac
-echo "Your system uses $freetype free(), it would seem." >&4
-$rm -f malloc.[co]
 : see if nice exists
 set nice d_nice
 eval $inlibc
@@ -7588,6 +7759,18 @@ eval $inhdr
 
 case "$i_pwd" in
 $define)
+       : see if setpwent exists
+       set setpwent d_setpwent
+       eval $inlibc
+
+       : see if getpwent exists
+       set getpwent d_getpwent
+       eval $inlibc
+
+       : see if endpwent exists
+       set endpwent d_endpwent
+       eval $inlibc
+
        xxx=`./findhdr pwd.h`
        $cppstdin $cppflags $cppminus < $xxx >$$.h
 
@@ -7647,10 +7830,21 @@ $define)
        set d_pwgecos
        eval $setvar
 
+       if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
+               val="$define"
+       else
+               val="$undef"
+       fi
+       set d_pwpasswd
+       eval $setvar
+
        $rm -f $$.h
        ;;
-*)
+*)     # Assume all is lost as far as the d_*pw* go.
        val="$undef"; 
+       set d_setpwent; eval $setvar
+       set d_getpwent; eval $setvar
+       set d_endpwent; eval $setvar
        set d_pwquota; eval $setvar
        set d_pwage; eval $setvar
        set d_pwchange; eval $setvar
@@ -7658,6 +7852,7 @@ $define)
        set d_pwexpire; eval $setvar
        set d_pwcomment; eval $setvar
        set d_pwgecos; eval $setvar
+       set d_pwpasswd; eval $setvar
        ;;
 esac
 
@@ -7937,6 +8132,23 @@ echo " "
 case "$d_semctl$d_semget$d_semop" in
 *"$undef"*) h_sem=false;;
 esac
+case "$osname" in
+freebsd)
+    case "`ipcs 2>&1`" in
+    "SVID messages"*"not configured"*)
+       echo "But your FreeBSD kernel does not have the sem*(2) configured." >&4
+        h_sem=false
+       val="$undef"
+       set semctl d_semctl
+       eval $setvar
+       set semget d_semget
+       eval $setvar
+       set semop d_semop
+       eval $setvar
+       ;;
+    esac
+    ;;
+esac
 : we could also check for sys/ipc.h ...
 if $h_sem && $test `./findhdr sys/sem.h`; then
        echo "You have the full sem*(2) library." >&4
@@ -7948,28 +8160,31 @@ fi
 set d_sem
 eval $setvar
 
-: see how to do semctl IPC_STAT
-case "$h_sem$d_sem$d_semctl" in
-true$define$define)
-    : see whether sys/sem.h defines union semun
-    $cat > try.c <<'END'
+: see whether sys/sem.h defines union semun
+echo " "
+$cat > try.c <<'END'
 #include <sys/types.h>
 #include <sys/ipc.h>
 #include <sys/sem.h>
 int main () { union semun semun; semun.buf = 0; }
 END
-    if $cc $ccflags -o try try.c > /dev/null 2>&1; then
-       echo "You have union semun in <sys/sem.h>." >&4
-       val="$define"
-    else
-        echo "You do not have union semun in <sys/sem.h>." >&4
-        val="$undef"
-    fi
-    $rm -f try try.c
-    set d_union_semun
-    eval $setvar
+set try
+if eval $compile; then
+    echo "You have union semun in <sys/sem.h>." >&4
+    val="$define"
+else
+    echo "You do not have union semun in <sys/sem.h>." >&4
+    val="$undef"
+fi
+$rm -f try try.c
+set d_union_semun
+eval $setvar
 
+: see how to do semctl IPC_STAT
+case "$d_sem" in
+$define)
     : see whether semctl IPC_STAT can use union semun
+    echo " "
     $cat > try.c <<END
 #include <sys/types.h>
 #include <sys/ipc.h>
@@ -7982,45 +8197,44 @@ extern int errno;
 #endif
 #$d_union_semun HAS_UNION_SEMUN
 int main() {
-  union semun
+    union semun
 #ifndef HAS_UNION_SEMUN
-  {
-    int val;
-    struct semid_ds *buf;
-    unsigned short *array;
-  }
+    {
+       int val;
+       struct semid_ds *buf;
+       unsigned short *array;
+    }
 #endif
     arg;
-  int sem, st;
-
-#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && \
-    defined(S_IRWXO) && defined(IPC_CREAT)
-  sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
-  if (sem > -1) {
-    struct semid_ds argbuf;
-    arg.buf = &argbuf;
-#   ifdef IPC_STAT
-    st = semctl(sem, 0, IPC_STAT, arg);
-    if (st == 0)
-      printf("semun\n");
-    else
-#   endif /* IPC_STAT */
-      printf("semctl IPC_STAT failed: errno = %d\n", errno);
-#   ifdef IPC_RMID
-    if (semctl(sem, 0, IPC_RMID, arg) != 0)
-#   endif /* IPC_RMID */
-      printf("semctl IPC_RMID failed: errno = %d\n", errno);
-  } else
+    int sem, st;
+
+#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
+    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
+    if (sem > -1) {
+       struct semid_ds argbuf;
+       arg.buf = &argbuf;
+#      ifdef IPC_STAT
+       st = semctl(sem, 0, IPC_STAT, arg);
+       if (st == 0)
+           printf("semun\n");
+       else
+#      endif /* IPC_STAT */
+           printf("semctl IPC_STAT failed: errno = %d\n", errno);
+#      ifdef IPC_RMID
+       if (semctl(sem, 0, IPC_RMID, arg) != 0)
+#      endif /* IPC_RMID */
+           printf("semctl IPC_RMID failed: errno = %d\n", errno);
+    } else
 #endif /* IPC_PRIVATE && ... */
-    printf("semget failed: errno = %d\n", errno);
-
+       printf("semget failed: errno = %d\n", errno);
   return 0;
 }
 END
     val="$undef"
-    if $cc $ccflags -o try try.c > /dev/null 2>&1; then
-        d_semctl_semun=`./try`
-        case "$d_semctl_semun" in
+    set try
+    if eval $compile; then
+       xxx=`./try`
+        case "$xxx" in
         semun) val="$define" ;;
         esac
     fi
@@ -8028,15 +8242,16 @@ END
     set d_semctl_semun
     eval $setvar
     case "$d_semctl_semun" in
-    $define|true)
+    $define)
         echo "You can use union semun for semctl IPC_STAT." >&4
+       also='also'
         ;;
     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
+       also=''
         ;;
     esac
 
     : see whether semctl IPC_STAT can use struct semid_ds pointer
-
     $cat > try.c <<'END'
 #include <sys/types.h>
 #include <sys/ipc.h>
@@ -8048,35 +8263,35 @@ END
 extern int errno;
 #endif
 int main() {
-  struct semid_ds arg;
-  int sem, st;
-
-#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && \
-    defined(S_IRWXO) && defined(IPC_CREAT)
-  sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
-  if (sem > -1) {
-#   ifdef IPC_STAT
-    st = semctl(sem, 0, IPC_STAT, &arg);
-    if (st == 0)
-      printf("semid_ds\n");
-    else
-#   endif /* IPC_STAT */
-      printf("semctl IPC_STAT failed: errno = %d\n", errno);
-#   ifdef IPC_RMID
-    if (semctl(sem, 0, IPC_RMID, &arg) != 0)
-#   endif /* IPC_RMID */
-      printf("semctl IPC_RMID failed: errno = %d\n", errno);
-  } else
+    struct semid_ds arg;
+    int sem, st;
+
+#if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
+    sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
+    if (sem > -1) {
+#      ifdef IPC_STAT
+       st = semctl(sem, 0, IPC_STAT, &arg);
+       if (st == 0)
+           printf("semid_ds\n");
+       else
+#      endif /* IPC_STAT */
+           printf("semctl IPC_STAT failed: errno = %d\n", errno);
+#      ifdef IPC_RMID
+       if (semctl(sem, 0, IPC_RMID, &arg) != 0)
+#      endif /* IPC_RMID */
+           printf("semctl IPC_RMID failed: errno = %d\n", errno);
+    } else
 #endif /* IPC_PRIVATE && ... */
-      printf("semget failed: errno = %d\n", errno);
+       printf("semget failed: errno = %d\n", errno);
 
-  return 0;
+    return 0;
 }
 END
     val="$undef"
-    if $cc $ccflags -o try try.c > /dev/null 2>&1; then
-        d_semctl_semid_ds=`./try`
-        case "$d_semctl_semid_ds" in
+    set try
+    if eval $compile; then
+        xxx=`./try`
+        case "$xxx" in
         semid_ds) val="$define" ;;
         esac
     fi
@@ -8084,8 +8299,8 @@ END
     set d_semctl_semid_ds
     eval $setvar
     case "$d_semctl_semid_ds" in
-    $define|true)
-        echo "You can use struct semid_ds * for semctl IPC_STAT." >&4
+    $define)
+        echo "You can $also use struct semid_ds * for semctl IPC_STAT." >&4
         ;;
     *)  echo "You cannot use struct semid_ds * for semctl IPC_STAT." >&4
         ;;
@@ -8093,8 +8308,8 @@ END
     ;;
 *)  val="$undef"
 
-    set d_union_semun
-    eval $setvar
+    # We do not have the full sem*(2) library, so assume we can not
+    # use either.
 
     set d_semctl_semun
     eval $setvar
@@ -8280,6 +8495,25 @@ echo " "
 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
 *"$undef"*) h_shm=false;;
 esac
+case "$osname" in
+freebsd)
+    case "`ipcs 2>&1`" in
+    "SVID shared memory"*"not configured"*)
+       echo "But your FreeBSD kernel does not have the shm*(2) configured." >&4
+        h_shm=false
+       val="$undef"
+       set shmctl d_shmctl
+       evat $setvar
+       set shmget d_shmget
+       evat $setvar
+       set shmat d_shmat
+       evat $setvar
+       set shmdt d_shmdt
+       evat $setvar
+       ;;
+    esac
+    ;;
+esac
 : we could also check for sys/ipc.h ...
 if $h_shm && $test `./findhdr sys/shm.h`; then
        echo "You have the full shm*(2) library." >&4
@@ -8591,39 +8825,41 @@ $rm -f try.*
 
 : see if strerror and/or sys_errlist[] exist
 echo " "
-if set strerror val -f d_strerror; eval $csym; $val; then
+if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
+    if set strerror val -f d_strerror; eval $csym; $val; then
        echo 'strerror() found.' >&4
        d_strerror="$define"
        d_strerrm='strerror(e)'
        if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
-               echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
-               d_syserrlst="$define"
+           echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
+           d_syserrlst="$define"
        else
-       echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
-               d_syserrlst="$undef"
+           echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
+           d_syserrlst="$undef"
        fi
-elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
+    elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
        $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
        echo 'strerror() found in string header.' >&4
        d_strerror="$define"
        d_strerrm='strerror(e)'
        if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
-               echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
-               d_syserrlst="$define"
+       echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
+           d_syserrlst="$define"
        else
-               echo "(You don't appear to have any sys_errlist[], how can this be?)"
-               d_syserrlst="$undef"
+           echo "(You don't appear to have any sys_errlist[], how can this be?)"
+       d_syserrlst="$undef"
        fi
-elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
+    elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
        d_strerror="$undef"
        d_syserrlst="$define"
        d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
-else
+    else
        echo 'strerror() and sys_errlist[] NOT found.' >&4
        d_strerror="$undef"
        d_syserrlst="$undef"
        d_strerrm='"unknown"'
+    fi
 fi
 
 : see if strtod exists
@@ -8846,6 +9082,10 @@ eval $inhdr
 set sys/ndir.h i_sysndir
 eval $inhdr
 
+: see if sys/types.h has to be included
+set sys/types.h i_systypes
+eval $inhdr
+
 : see if closedir exists
 set closedir d_closedir
 eval $inlibc
@@ -8858,7 +9098,11 @@ case "$d_closedir" in
 #$i_dirent I_DIRENT            /**/
 #$i_sysdir I_SYS_DIR           /**/
 #$i_sysndir I_SYS_NDIR         /**/
+#$i_systypes I_SYS_TYPES       /**/
 
+#if defined(I_SYS_TYPES)
+#include <sys/types.h>
+#endif
 #if defined(I_DIRENT)
 #include <dirent.h>
 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
@@ -9250,15 +9494,6 @@ esac
 : check for void type
 echo " "
 echo "Checking to see how well your C compiler groks the void type..." >&4
-echo " "
-$cat >&4 <<EOM
-  Support flag bits are:
-    1: basic void declarations.
-    2: arrays of pointers to functions returning void.
-    4: operations between pointers to and addresses of void functions.
-    8: generic void pointers.
-EOM
-echo " "
 case "$voidflags" in
 '')
        $cat >try.c <<'EOCP'
@@ -9287,7 +9522,7 @@ main() { sub(); }
 EOCP
        if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
                voidflags=$defvoidused
-       echo "It appears to support void to the level $package wants ($defvoidused)."
+       echo "Good.  It appears to support void to the level $package wants.">&4
                if $contains warning .out >/dev/null 2>&1; then
                        echo "However, you might get some warnings that look like this:"
                        $cat .out
@@ -9333,7 +9568,13 @@ echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
 esac
 case "$voidflags" in
 "$defvoidused") ;;
-*)
+*)     $cat >&4 <<'EOM'
+  Support flag bits are:
+    1: basic void declarations.
+    2: arrays of pointers to functions returning void.
+    4: operations between pointers to and addresses of void functions.
+    8: generic void pointers.
+EOM
        dflt="$voidflags";
        rp="Your void support flags add up to what?"
        . ./myread
@@ -9806,9 +10047,10 @@ eval $inhdr
 
 : see if we should include time.h, sys/time.h, or both
 echo " "
-echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
-$echo $n "I'm now running the test program...$c"
-$cat >try.c <<'EOCP'
+if test "X$timeincl" = X; then
+    echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
+    $echo $n "I'm now running the test program...$c"
+    $cat >try.c <<'EOCP'
 #include <sys/types.h>
 #ifdef I_TIME
 #include <time.h>
@@ -9840,13 +10082,13 @@ main()
        exit(1);
 }
 EOCP
-flags=''
-for s_timezone in '-DS_TIMEZONE' ''; do
-sysselect=''
-for s_timeval in '-DS_TIMEVAL' ''; do
-for i_systimek in '' '-DSYSTIMEKERNEL'; do
-for i_time in '' '-DI_TIME'; do
-for i_systime in '-DI_SYSTIME' ''; do
+    flags=''
+    for s_timezone in '-DS_TIMEZONE' ''; do
+    sysselect=''
+    for s_timeval in '-DS_TIMEVAL' ''; do
+    for i_systimek in '' '-DSYSTIMEKERNEL'; do
+    for i_time in '' '-DI_TIME'; do
+    for i_systime in '-DI_SYSTIME' ''; do
        case "$flags" in
        '') $echo $n ".$c"
                set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
@@ -9859,32 +10101,33 @@ for i_systime in '-DI_SYSTIME' ''; do
                fi
                ;;
        esac
-done
-done
-done
-done
-done
-timeincl=''
-echo " "
-case "$flags" in
-*SYSTIMEKERNEL*) i_systimek="$define"
+    done
+    done
+    done
+    done
+    done
+    timeincl=''
+    echo " "
+    case "$flags" in
+    *SYSTIMEKERNEL*) i_systimek="$define"
        timeincl=`./findhdr sys/time.h`
        echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
-*) i_systimek="$undef";;
-esac
-case "$flags" in
-*I_TIME*) i_time="$define"
+    *) i_systimek="$undef";;
+    esac
+    case "$flags" in
+    *I_TIME*) i_time="$define"
        timeincl=`./findhdr time.h`" $timeincl"
        echo "We'll include <time.h>." >&4;;
-*) i_time="$undef";;
-esac
-case "$flags" in
-*I_SYSTIME*) i_systime="$define"
+    *) i_time="$undef";;
+    esac
+    case "$flags" in
+    *I_SYSTIME*) i_systime="$define"
        timeincl=`./findhdr sys/time.h`" $timeincl"
        echo "We'll include <sys/time.h>." >&4;;
-*) i_systime="$undef";;
-esac
-$rm -f try.c try
+    *) i_systime="$undef";;
+    esac
+    $rm -f try.c try
+fi
 
 : check for fd_set items
 $cat <<EOM
@@ -10100,7 +10343,7 @@ printf("NSIG %d\n", NSIG);
 
 EOCP
 
-echo $xxx | $tr ' ' '\012' | $sort | $uniq | $awk '
+echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
 {
        printf "#ifdef SIG"; printf $1; printf "\n"
        printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
@@ -10169,7 +10412,7 @@ else
                echo 'NSIG 50' > signal.nsg
        fi
        : Now look at all the signal names, one at a time.
-       for xx in `echo $xxx | $tr ' ' '\012' | $sort | $uniq`; do
+       for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
                $cat > signal.c <<EOCP
 #include <sys/types.h>
 #include <signal.h>
@@ -10204,7 +10447,7 @@ else
        case $# in
        0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
        esac
-       echo $@ | $tr ' ' '\012' | \
+       echo $@ | $tr ' ' $trnl | \
                $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst
 fi
 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
 
 : see if time exists
 echo " "
-if set time val -f d_time; eval $csym; $val; then
+if test "X$d_time" = X -o X"$timetype" = X; then
+    if set time val -f d_time; eval $csym; $val; then
        echo 'time() found.' >&4
        val="$define"
        rp="What is the type returned by time() on this system?"
        set time_t timetype long stdio.h sys/types.h
        eval $typedef_ask
-else
+    else
        echo 'time() not found, hope that will do.' >&4
        val="$undef"
        timetype='int';
+    fi
+    set d_time
+    eval $setvar
 fi
-set d_time
-eval $setvar
 
 : see what type uids are declared as in the kernel
 echo " "
@@ -10424,6 +10669,42 @@ eval $setvar
 set grp.h i_grp
 eval $inhdr
 
+case "$i_grp" in
+$define)
+       : see if setgrent exists
+       set setgrent d_setgrent
+       eval $inlibc
+
+       : see if getgrent exists
+       set getgrent d_getgrent
+       eval $inlibc
+
+       : see if endgrent exists
+       set endgrent d_endgrent
+       eval $inlibc
+
+       xxx=`./findhdr grp.h`
+       $cppstdin $cppflags $cppminus < $xxx >$$.h
+
+       if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
+               val="$define"
+       else
+               val="$undef"
+       fi
+       set d_grpasswd
+       eval $setvar
+
+       $rm -f $$.h
+       ;;
+*)     # Assume all is lost as far as the d_*gr* go.
+       val="$undef"; 
+       set d_setgrent; eval $setvar
+       set d_getgrent; eval $setvar
+       set d_endgrent; eval $setvar
+       set d_grpasswd; eval $setvar
+       ;;
+esac
+
 : see if locale.h is available
 set locale.h i_locale
 eval $inhdr
@@ -10484,7 +10765,7 @@ eval $setvar
 : get C preprocessor symbols handy
 echo " "
 $echo $n "Hmm... $c"
-echo $al | $tr ' ' '\012' >Cppsym.know
+echo $al | $tr ' ' $trnl >Cppsym.know
 $cat <<EOSS >Cppsym
 $startsh
 case "\$1" in
@@ -10511,7 +10792,7 @@ esac
 case \$# in
 0) exit 1;;
 esac
-echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\
+echo \$* | $tr ' ' '$trnl' | $sed -e 's/\(.*\)/\\
 #ifdef \1\\
 exit 0; _ _ _ _\1\\     \1\\
 #endif\\
@@ -10778,10 +11059,6 @@ eval $inhdr
 set sys/stat.h i_sysstat
 eval $inhdr
 
-: see if sys/types.h has to be included
-set sys/types.h i_systypes
-eval $inhdr
-
 : see if this is a sys/un.h system
 set sys/un.h i_sysun
 eval $inhdr
@@ -10836,21 +11113,27 @@ cd $rsrc/ext
 : If we are using the old config.sh, known_extensions may contain
 : old or inaccurate or duplicate values.
 known_extensions=''
+nonxs_extensions=''
 : We do not use find because it might not be available.
 : We do not just use MANIFEST because the user may have dropped
 : some additional extensions into the source tree and expect them
 : to be built.
 for xxx in * ; do
        case "$xxx" in
-       DynaLoader) ;;
+       DynaLoader|dynaload) ;;
        *)      if $test -f $xxx/$xxx.xs; then
                        known_extensions="$known_extensions $xxx"
+               elif $test -f $xxx/Makefile.PL; then
+                       nonxs_extensions="$nonxs_extensions $xxx"
                else
                        if $test -d $xxx; then
+                               # Look for nested extensions, eg. Devel/Dprof.
                                cd $xxx
                                for yyy in * ; do
                                if $test -f $yyy/$yyy.xs; then
                                        known_extensions="$known_extensions $xxx/$yyy"
+                               elif $test -f $yyy/Makefile.PL; then
+                                       nonxs_extensions="$nonxs_extensions $xxx/$yyy"
                                fi
                                done
                                cd ..
@@ -10859,6 +11142,9 @@ for xxx in * ; do
                ;;
        esac
 done
+set X $nonxs_extensions
+shift
+nonxs_extensions="$*"
 set X $known_extensions
 shift
 known_extensions="$*"
@@ -10908,6 +11194,11 @@ for xxx in $known_extensions ; do
                true|$define|y) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
+       IPC/SysV|ipc/sysv)
+               case "${d_msg}${d_sem}${d_shm}" in 
+               *"${define}"*) avail_ext="$avail_ext $xxx" ;;
+               esac
+               ;;
        *)      avail_ext="$avail_ext $xxx"
                ;;
        esac
@@ -10917,6 +11208,20 @@ set X $avail_ext
 shift
 avail_ext="$*"
 
+: Now see which nonxs extensions are supported on this system.
+: For now assume all are.
+nonxs_ext=''
+for xxx in $nonxs_extensions ; do
+       case "$xxx" in
+       *)      nonxs_ext="$nonxs_ext $xxx"
+               ;;
+       esac
+done
+
+set X $nonxs_ext
+shift
+nonxs_ext="$*"
+
 case $usedl in
 $define)
        $cat <<EOM
@@ -11012,6 +11317,7 @@ EOM
                esac
                ;;
        esac
+       : Exclude those that are not xs extensions
        case "$dflt" in
        '')     dflt=none;;
        esac
@@ -11024,7 +11330,7 @@ EOM
        ;;
 esac
 
-set X $dynamic_ext $static_ext
+set X $dynamic_ext $static_ext $nonxs_ext
 shift
 extensions="$*"
 
@@ -11114,6 +11420,7 @@ afs='$afs'
 alignbytes='$alignbytes'
 ansi2knr='$ansi2knr'
 aphostname='$aphostname'
+apiversion='$apiversion'
 ar='$ar'
 archlib='$archlib'
 archlibexp='$archlibexp'
@@ -11185,9 +11492,11 @@ d_dlopen='$d_dlopen'
 d_dlsymun='$d_dlsymun'
 d_dosuid='$d_dosuid'
 d_dup2='$d_dup2'
+d_endgrent='$d_endgrent'
 d_endhent='$d_endhent'
 d_endnent='$d_endnent'
 d_endpent='$d_endpent'
+d_endpwent='$d_endpwent'
 d_endsent='$d_endsent'
 d_eofnblk='$d_eofnblk'
 d_eunice='$d_eunice'
@@ -11204,6 +11513,7 @@ d_fork='$d_fork'
 d_fpathconf='$d_fpathconf'
 d_fsetpos='$d_fsetpos'
 d_ftime='$d_ftime'
+d_getgrent='$d_getgrent'
 d_getgrps='$d_getgrps'
 d_gethbyaddr='$d_gethbyaddr'
 d_gethbyname='$d_gethbyname'
@@ -11224,12 +11534,14 @@ d_getpgrp='$d_getpgrp'
 d_getppid='$d_getppid'
 d_getprior='$d_getprior'
 d_getprotoprotos='$d_getprotoprotos'
+d_getpwent='$d_getpwent'
 d_getsbyname='$d_getsbyname'
 d_getsbyport='$d_getsbyport'
 d_getsent='$d_getsent'
 d_getservprotos='$d_getservprotos'
 d_gettimeod='$d_gettimeod'
 d_gnulibc='$d_gnulibc'
+d_grpasswd='$d_grpasswd'
 d_htonl='$d_htonl'
 d_index='$d_index'
 d_inetaton='$d_inetaton'
@@ -11251,7 +11563,6 @@ d_memmove='$d_memmove'
 d_memset='$d_memset'
 d_mkdir='$d_mkdir'
 d_mkfifo='$d_mkfifo'
-d_mkstemp='$d_mkstemp'
 d_mktime='$d_mktime'
 d_msg='$d_msg'
 d_msgctl='$d_msgctl'
@@ -11278,6 +11589,7 @@ d_pwcomment='$d_pwcomment'
 d_pwexpire='$d_pwexpire'
 d_pwgecos='$d_pwgecos'
 d_pwquota='$d_pwquota'
+d_pwpasswd='$d_pwpasswd'
 d_readdir='$d_readdir'
 d_readlink='$d_readlink'
 d_rename='$d_rename'
@@ -11291,13 +11603,13 @@ d_seekdir='$d_seekdir'
 d_select='$d_select'
 d_sem='$d_sem'
 d_semctl='$d_semctl'
+d_semctl_semid_ds='$d_semctl_semid_ds'
+d_semctl_semun='$d_semctl_semun'
 d_semget='$d_semget'
 d_semop='$d_semop'
-d_union_semun='$d_union_semun'
-d_semctl_semun='$d_semctl_semun'
-d_semctl_semid_ds='$d_semctl_semid_ds'
 d_setegid='$d_setegid'
 d_seteuid='$d_seteuid'
+d_setgrent='$d_setgrent'
 d_setgrps='$d_setgrps'
 d_sethent='$d_sethent'
 d_setlinebuf='$d_setlinebuf'
@@ -11308,6 +11620,7 @@ d_setpgid='$d_setpgid'
 d_setpgrp2='$d_setpgrp2'
 d_setpgrp='$d_setpgrp'
 d_setprior='$d_setprior'
+d_setpwent='$d_setpwent'
 d_setregid='$d_setregid'
 d_setresgid='$d_setresgid'
 d_setresuid='$d_setresuid'
@@ -11358,6 +11671,7 @@ d_truncate='$d_truncate'
 d_tzname='$d_tzname'
 d_umask='$d_umask'
 d_uname='$d_uname'
+d_union_semun='$d_union_semun'
 d_vfork='$d_vfork'
 d_void_closedir='$d_void_closedir'
 d_voidsig='$d_voidsig'
@@ -11379,6 +11693,7 @@ dlsrc='$dlsrc'
 doublesize='$doublesize'
 dynamic_ext='$dynamic_ext'
 eagain='$eagain'
+ebcdic='$ebcdic'
 echo='$echo'
 egrep='$egrep'
 emacs='$emacs'
@@ -11405,6 +11720,7 @@ h_sysfile='$h_sysfile'
 hint='$hint'
 hostcat='$hostcat'
 huge='$huge'
+i_arpainet='$i_arpainet'
 i_bsdioctl='$i_bsdioctl'
 i_db='$i_db'
 i_dbm='$i_dbm'
@@ -11529,6 +11845,7 @@ netdb_net_type='$netdb_net_type'
 nm='$nm'
 nm_opt='$nm_opt'
 nm_so_opt='$nm_so_opt'
+nonxs_ext='$nonxs_ext'
 nroff='$nroff'
 o_nonblock='$o_nonblock'
 obj_ext='$obj_ext'
@@ -11617,6 +11934,7 @@ timeincl='$timeincl'
 timetype='$timetype'
 touch='$touch'
 tr='$tr'
+trnl='$trnl'
 troff='$troff'
 uidtype='$uidtype'
 uname='$uname'
@@ -11633,6 +11951,7 @@ usethreads='$usethreads'
 usevfork='$usevfork'
 usrinc='$usrinc'
 uuname='$uuname'
+version='$version'
 vi='$vi'
 voidflags='$voidflags'
 xlibpth='$xlibpth'
@@ -11640,6 +11959,9 @@ zcat='$zcat'
 zip='$zip'
 EOT
 
+: Add in command line options if available
+$test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
+
 : add special variables
 $test -f $src/patchlevel.h && \
 awk '/^#define/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
@@ -11701,6 +12023,51 @@ esac
 : if this fails, just run all the .SH files by hand
 . ./config.sh
 
+case "$ebcdic" in
+$define)
+    xxx=''
+    echo "This is an EBCDIC system, checking if any parser files need regenerating." >&4
+    rm -f y.tab.c y.tab.h
+    yacc -d perly.y >/dev/null 2>&1
+    if cmp -s y.tab.c perly.c; then
+        rm -f y.tab.c
+    else
+        echo "perly.y -> perly.c" >&4
+        mv -f y.tab.c perly.c
+        chmod u+w perly.c
+        sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
+            -e 's/y\.tab/perly/g' perly.c >perly.tmp && mv perly.tmp perly.c
+        xxx="$xxx perly.c"
+    fi
+    if cmp -s y.tab.h perly.h; then
+        rm -f y.tab.h
+    else
+        echo "perly.y -> perly.h" >&4
+        mv -f y.tab.h perly.h
+        xxx="$xxx perly.h"
+    fi
+    echo "x2p/a2p.y" >&4
+    cd x2p
+    rm -f y.tab.c
+    yacc a2p.y >/dev/null 2>&1
+    if cmp -s y.tab.c a2p.c
+    then
+        rm -f y.tab.c
+    else
+        echo "a2p.y -> a2p.c" >&4
+        mv -f y.tab.c a2p.c
+        chmod u+w a2p.c
+        sed -e 's/fprintf *( *stderr *,/PerlIO_printf(Perl_debug_log,/g' \
+            -e 's/y\.tab/a2p/g' a2p.c >a2p.tmp && mv a2p.tmp a2p.c
+        xxx="$xxx a2p.c"
+    fi
+    cd ..
+    case "$xxx" in
+    '') echo "No parser files were regenerated.  That's okay." >&4 ;;
+    esac
+    ;;
+esac
+
 echo " "
 exec 1>&4
 . ./UU/extract