better validation of SysV IPC availability
[p5sagit/p5-mst-13.2.git] / Configure
index d0a3136..197295f 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -56,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 :-]
@@ -364,6 +391,7 @@ d_getservprotos=''
 d_getsbyname=''
 d_getsbyport=''
 d_gnulibc=''
+i_arpainet=''
 d_htonl=''
 d_inetaton=''
 d_isascii=''
@@ -531,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=''
@@ -548,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=''
@@ -697,6 +733,7 @@ mips_type=''
 usrinc=''
 defvoidused=''
 voidflags=''
+ebcdic=''
 CONFIG=''
 
 define='define'
@@ -724,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"
@@ -1442,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=!
                        ;;
@@ -1777,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
@@ -1805,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
@@ -1964,7 +2045,9 @@ EOM
                        *)      osvers="$3" ;;
                        esac
                        ;;
-               netbsd*) osname=netbsd 
+               MiNT) osname=mint
+                       ;;
+               netbsd*) osname=netbsd
                        osvers="$3"
                        ;;
                news-os) osvers="$3"
@@ -2454,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
@@ -3897,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:
@@ -3913,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
@@ -4225,6 +4308,32 @@ 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>
@@ -4395,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
@@ -4461,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:
 
@@ -4479,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
@@ -5894,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";
@@ -5955,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
@@ -5977,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
@@ -6754,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
@@ -7154,7 +7265,6 @@ echo " "
 set d_getprotoprotos getprotoent $i_netdb netdb.h
 eval $hasproto
 
-
 : see if getservbyname exists
 set getservbyname d_getsbyname
 eval $inlibc
@@ -7195,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
@@ -7208,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
@@ -7513,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
@@ -7622,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
 
@@ -7681,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
@@ -7692,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
 
@@ -7971,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
@@ -8317,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
@@ -8628,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
@@ -9848,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>
@@ -9882,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
@@ -9901,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
@@ -10142,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";
@@ -10211,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>
@@ -10246,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 " "
@@ -10466,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
@@ -10526,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
@@ -10553,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\\
@@ -10955,9 +11194,9 @@ for xxx in $known_extensions ; do
                true|$define|y) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
-       IPC/SysV|ipc_sysv)
-               case "$d_sem" in 
-               $define) avail_ext="$avail_ext $xxx" ;;
+       IPC/SysV|ipc/sysv)
+               case "${d_msg}${d_sem}${d_shm}" in 
+               *"${define}"*) avail_ext="$avail_ext $xxx" ;;
                esac
                ;;
        *)      avail_ext="$avail_ext $xxx"
@@ -11253,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'
@@ -11272,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'
@@ -11292,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'
@@ -11345,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'
@@ -11364,6 +11609,7 @@ d_semget='$d_semget'
 d_semop='$d_semop'
 d_setegid='$d_setegid'
 d_seteuid='$d_seteuid'
+d_setgrent='$d_setgrent'
 d_setgrps='$d_setgrps'
 d_sethent='$d_sethent'
 d_setlinebuf='$d_setlinebuf'
@@ -11374,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'
@@ -11446,6 +11693,7 @@ dlsrc='$dlsrc'
 doublesize='$doublesize'
 dynamic_ext='$dynamic_ext'
 eagain='$eagain'
+ebcdic='$ebcdic'
 echo='$echo'
 egrep='$egrep'
 emacs='$emacs'
@@ -11472,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'
@@ -11685,6 +11934,7 @@ timeincl='$timeincl'
 timetype='$timetype'
 touch='$touch'
 tr='$tr'
+trnl='$trnl'
 troff='$troff'
 uidtype='$uidtype'
 uname='$uname'
@@ -11773,6 +12023,59 @@ 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 may 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 y.tab.h
+    yacc -d 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
+    if cmp -s y.tab.h a2p.h
+    then
+        rm -f y.tab.h
+    else
+        echo "a2p.h -> a2p.h" >&4
+        mv -f y.tab.h a2p.h
+        xxx="$xxx a2p.h"
+    fi
+    cd ..
+    case "$xxx" in
+    '') echo "No parser files were regenerated.  That's okay." >&4 ;;
+    esac
+    ;;
+esac
+
 echo " "
 exec 1>&4
 . ./UU/extract