X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=Configure;h=bc5c59d5f1c381145880ee59257072187c84c708;hb=0a47030adea6675ff2e866534b32d11b2531fe9e;hp=af22c1b77f8e08dabb8b7c104c3c4ce456a8c8a4;hpb=9b8c873da9b477cf6707f85a51d6be52310c30b4;p=p5sagit%2Fp5-mst-13.2.git diff --git a/Configure b/Configure index af22c1b..bc5c59d 100755 --- 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 Mon Mar 9 14:02:25 EST 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$$ </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 <&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 :-] @@ -63,7 +91,7 @@ if test -d c:/. ; then p_=\; PATH=`cmd /c "echo %PATH%" | tr '\\\\' / ` OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'` - elif test -n "$DJDIR"; then + elif test -n "$DJGPP"; then p_=\; fi fi @@ -109,7 +137,7 @@ if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then fi case "$inksh/$needksh" in /[a-z]*) - unset ENV + ENV='' changesh=true reason="$needksh" ;; @@ -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 -unset CDPATH cd UU && rm -f ./* dynamic_ext='' extensions='' known_extensions='' +nonxs_ext='' static_ext='' useopcode='' useposix='' @@ -176,7 +214,6 @@ emacs='' expr='' find='' flex='' -gcc='' grep='' gzip='' inews='' @@ -250,6 +287,7 @@ obj_ext='' path_sep='' afs='' alignbytes='' +ansi2knr='' archlib='' archlibexp='' d_archlib='' @@ -332,10 +370,12 @@ aphostname='' d_gethname='' d_phostname='' d_uname='' +d_gethostprotos='' d_getlogin='' d_getnbyaddr='' d_getnbyname='' d_getnent='' +d_getnetprotos='' d_getpent='' d_getpgid='' d_getpgrp2='' @@ -345,19 +385,25 @@ d_getppid='' d_getprior='' d_getpbyname='' d_getpbynumber='' +d_getprotoprotos='' d_getsent='' +d_getservprotos='' d_getsbyname='' d_getsbyport='' d_gnulibc='' +i_arpainet='' d_htonl='' d_inetaton='' d_isascii='' d_killpg='' +d_lchown='' d_link='' d_locconv='' d_lockf='' d_longdbl='' longdblsize='' +d_longlong='' +longlongsize='' d_lstat='' d_mblen='' d_mbstowcs='' @@ -368,7 +414,6 @@ d_memmove='' d_memset='' d_mkdir='' d_mkfifo='' -d_mkstemp='' d_mktime='' d_msg='' d_msgctl='' @@ -474,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='' @@ -511,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='' @@ -527,7 +579,12 @@ d_pwchange='' d_pwclass='' d_pwcomment='' d_pwexpire='' +d_pwgecos='' +d_pwpasswd='' d_pwquota='' +d_setpwent='' +d_getpwent='' +d_endpwent='' i_pwd='' i_sfio='' i_stddef='' @@ -622,8 +679,10 @@ ranlib='' package='' spackage='' pager='' +apiversion='' patchlevel='' subversion='' +version='' perladmin='' perlpath='' pidtype='' @@ -674,6 +733,7 @@ mips_type='' usrinc='' defvoidused='' voidflags='' +ebcdic='' CONFIG='' define='define' @@ -701,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" @@ -776,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" @@ -792,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. @@ -844,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 @@ -910,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 <>cmdline.opt <options.awk <<'EOF' BEGIN { @@ -1296,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 @@ -1402,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=! ;; @@ -1497,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: @@ -1546,8 +1623,12 @@ for dir in \$*; do echo \$thisthing exit 0 elif test -f \$dir/\$thing.exe; then - : on Eunice apparently - echo \$dir/\$thing + if test -n "$DJGPP"; then + echo \$dir/\$thing.exe + else + : on Eunice apparently + echo \$dir/\$thing + fi exit 0 fi ;; @@ -1733,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 </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 @@ -1816,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 @@ -1831,7 +1956,7 @@ EOM $test -d /usr/apollo/bin && osname=apollo $test -f /etc/saf/_sactab && osname=svr4 $test -d /usr/include/minix && osname=minix - if $test -d /MachTen; then + if $test -d /MachTen -o -d /MachTen_Folder; then osname=machten if $test -x /sbin/version; then osvers=`/sbin/version | $awk '{print $2}' | @@ -1868,6 +1993,12 @@ EOM fi fi ;; + pc*) + if test -n "$DJGPP"; then + osname=dos + osvers=djgpp + fi + ;; esac case "$1" in @@ -1900,12 +2031,7 @@ EOM osvers="$3" ;; genix) osname=genix ;; hp*) osname=hpux - case "$3" in - *.08.*) osvers=9 ;; - *.09.*) osvers=9 ;; - *.10.*) osvers=10 ;; - *) osvers="$3" ;; - esac + osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'` ;; irix*) osname=irix case "$3" in @@ -1919,7 +2045,9 @@ EOM *) osvers="$3" ;; esac ;; - netbsd*) osname=netbsd + MiNT) osname=mint + ;; + netbsd*) osname=netbsd osvers="$3" ;; news-os) osvers="$3" @@ -2005,11 +2133,11 @@ EOM *) if test -f /etc/systemid; then osname=sco set `echo $3 | $sed 's/\./ /g'` $4 - if $test -f sco_$1_$2_$3.sh; then + if $test -f $src/hints/sco_$1_$2_$3.sh; then osvers=$1.$2.$3 - elif $test -f sco_$1_$2.sh; then + elif $test -f $src/hints/sco_$1_$2.sh; then osvers=$1.$2 - elif $test -f sco_$1.sh; then + elif $test -f $src/hints/sco_$1.sh; then osvers=$1 fi else @@ -2042,10 +2170,6 @@ EOM set X $myuname osname=os2 osvers="$5" - if test -n "$DJDIR"; then - osname=dos - osvers=djgpp - fi fi fi @@ -2277,8 +2401,8 @@ esac set usethreads eval $setvar : Look for a hint-file generated 'call-back-unit'. Now that the -: user has specified the compiler, we may need to set or change some -: other defaults. +: user has specified if a threading perl is to be built, we may need +: to set or change some other defaults. if $test -f usethreads.cbu; then . ./usethreads.cbu fi @@ -2413,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 @@ -2666,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 <&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") ;; @@ -2739,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 +'') dflt=$tdflt ;; - *) if test 0 -eq "$subversion"; then - version=`LC_ALL=C; export LC_ALL; \ - echo $baserev $patchlevel | \ - $awk '{ printf "%.3f\n", $1 + $2/1000.0 }'` - else - version=`LC_ALL=C; export LC_ALL; \ - echo $baserev $patchlevel $subversion | \ - $awk '{ printf "%.5f\n", $1 + $2/1000.0 + $3/100000.0 }'` - fi - dflt="$privlib/$archname/$version" - ;; - esac - ;; -*) - dflt="$archlib" +*) dflt="$archlib" ;; esac cat <&4 fi -: determine where manual pages go -set man1dir man1dir none -eval $prefixit -$cat <pdp11.c <<'EOP' +main() { +#ifdef pdp11 + exit(0); +#else + exit(1); +#endif +} +EOP + ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1 + if $test -f pdp11 && ./pdp11 2>/dev/null; then + dflt='unsplit split' + else + tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` + case "$tans" in + X) dflt='none';; + *) if $test -d /lib/small || $test -d /usr/lib/small; then + dflt='small' + else + dflt='' + fi + if $test -d /lib/medium || $test -d /usr/lib/medium; then + dflt="$dflt medium" + fi + if $test -d /lib/large || $test -d /usr/lib/large; then + dflt="$dflt large" + fi + if $test -d /lib/huge || $test -d /usr/lib/huge; then + dflt="$dflt huge" + fi + esac + fi;; +*) dflt="$models";; esac -if $afs; then - $cat <$first) 2>/dev/null; then - if $test -f 123456789abcde; then - echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4 - val="$undef" - else - if (echo hi >$second) 2>/dev/null; then - if $test -f /tmp/cf$$/123456789abcde; then - $cat <<'EOM' -That's peculiar... You can have filenames longer than 14 characters, but only -on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems -I shall consider your system cannot support long filenames at all. -EOM - val="$undef" - else - echo 'You can have filenames longer than 14 characters.' >&4 - val="$define" - fi - else - $cat <<'EOM' -How confusing! Some of your filesystems are sane enough to allow filenames -longer than 14 characters but some others like /tmp can't even think about them. -So, for now on, I shall assume your kernel does not allow them at all. -EOM - val="$undef" - fi - fi -else - $cat <<'EOM' -You can't have filenames longer than 14 chars. You can't even think about them! -EOM - val="$undef" -fi -set d_flexfnam -eval $setvar -$rm -rf /tmp/cf$$ 123456789abcde* - -: determine where library module manual pages go -set man3dir man3dir none -eval $prefixit -$cat <pdp11.c <<'EOP' -main() { -#ifdef pdp11 - exit(0); -#else - exit(1); -#endif -} -EOP - ( cc -o pdp11 pdp11.c ) >/dev/null 2>&1 - if $test -f pdp11 && ./pdp11 2>/dev/null; then - dflt='unsplit split' - else - tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` - case "$tans" in - X) dflt='none';; - *) if $test -d /lib/small || $test -d /usr/lib/small; then - dflt='small' - else - dflt='' - fi - if $test -d /lib/medium || $test -d /usr/lib/medium; then - dflt="$dflt medium" - fi - if $test -d /lib/large || $test -d /usr/lib/large; then - dflt="$dflt large" - fi - if $test -d /lib/huge || $test -d /usr/lib/huge; then - dflt="$dflt huge" - fi - esac - fi;; -*) dflt="$models";; -esac -$cat <usr.c <<'EOCP' +#ifdef SYSTYPE_BSD43 +/bsd43 +#endif +EOCP + if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then + dflt='/bsd43/usr/include' + incpath='/bsd43' + mips_type='BSD 4.3' + else + mips_type='System V' + fi + $rm -f usr.c usr.out + echo "and you're compiling with the $mips_type compiler and libraries." + xxx_prompt=y + echo "exit 0" >mips +else + echo "Doesn't look like a MIPS system." + xxx_prompt=n + echo "exit 1" >mips +fi +chmod +x mips +$eunicefix mips +case "$usrinc" in +'') ;; +*) dflt="$usrinc";; +esac +case "$xxx_prompt" in +y) fn=d/ + echo " " + rp='Where are the include files you want to use?' + . ./getfile + usrinc="$ans" + ;; +*) usrinc="$dflt" + ;; +esac + +: see how we invoke the C preprocessor +echo " " +echo "Now, how can we feed standard input to your C preprocessor..." >&4 +cat <<'EOT' >testcpp.c +#define ABC abc +#define XYZ xyz +ABC.XYZ +EOT +cd .. +echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin +chmod 755 cppstdin +wrapper=`pwd`/cppstdin +ok='false' +cd UU + +if $test "X$cppstdin" != "X" && \ + $cppstdin $cppminus testcpp.out 2>&1 && \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 +then + echo "You used to use $cppstdin $cppminus so we'll use that again." + case "$cpprun" in + '') echo "But let's see if we can live without a wrapper..." ;; + *) + if $cpprun $cpplast testcpp.out 2>&1 && \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 + then + echo "(And we'll use $cpprun $cpplast to preprocess directly.)" + ok='true' + else + echo "(However, $cpprun $cpplast does not work, let's see...)" + fi + ;; + esac +else + case "$cppstdin" in + '') ;; + *) + echo "Good old $cppstdin $cppminus does not seem to be of any help..." + ;; + esac +fi + +if $ok; then + : nothing +elif echo 'Maybe "'"$cc"' -E" will work...'; \ + $cc -E testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + echo "Yup, it does." + x_cpp="$cc -E" + x_minus=''; +elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \ + $cc -E - testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + echo "Yup, it does." + x_cpp="$cc -E" + x_minus='-'; +elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \ + $cc -P testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + echo "Yipee, that works!" + x_cpp="$cc -P" + x_minus=''; +elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \ + $cc -P - testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + echo "At long last!" + x_cpp="$cc -P" + x_minus='-'; +elif echo 'No such luck, maybe "'$cpp'" will work...'; \ + $cpp testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + echo "It works!" + x_cpp="$cpp" + x_minus=''; +elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \ + $cpp - testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + echo "Hooray, it works! I was beginning to wonder." + x_cpp="$cpp" + x_minus='-'; +elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \ + $wrapper testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + x_cpp="$wrapper" + x_minus='' + echo "Eureka!" +else + dflt='' + rp="No dice. I can't find a C preprocessor. Name one:" + . ./myread + x_cpp="$ans" + x_minus='' + $x_cpp testcpp.out 2>&1 + if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then + echo "OK, that will do." >&4 + else +echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4 + exit 1 + fi +fi + +case "$ok" in +false) + cppstdin="$x_cpp" + cppminus="$x_minus" + cpprun="$x_cpp" + cpplast="$x_minus" + set X $x_cpp + shift + case "$1" in + "$cpp") + echo "Perhaps can we force $cc -E using a wrapper..." + if $wrapper testcpp.out 2>&1; \ + $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 + then + echo "Yup, we can." + cppstdin="$wrapper" + cppminus=''; + else + echo "Nope, we'll have to live without it..." + fi + ;; + esac + case "$cpprun" in + "$wrapper") + cpprun='' + cpplast='' + ;; + esac + ;; esac -: What should the include directory be ? -echo " " -$echo $n "Hmm... $c" -dflt='/usr/include' -incpath='' -mips_type='' -if $test -f /bin/mips && /bin/mips; then - echo "Looks like a MIPS system..." - $cat >usr.c <<'EOCP' -#ifdef SYSTYPE_BSD43 -/bsd43 -#endif -EOCP - if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then - dflt='/bsd43/usr/include' - incpath='/bsd43' - mips_type='BSD 4.3' - else - mips_type='System V' - fi - $rm -f usr.c usr.out - echo "and you're compiling with the $mips_type compiler and libraries." - xxx_prompt=y - echo "exit 0" >mips -else - echo "Doesn't look like a MIPS system." - xxx_prompt=n - echo "exit 1" >mips -fi -chmod +x mips -$eunicefix mips -case "$usrinc" in -'') ;; -*) dflt="$usrinc";; -esac -case "$xxx_prompt" in -y) fn=d/ - echo " " - rp='Where are the include files you want to use?' - . ./getfile - usrinc="$ans" - ;; -*) usrinc="$dflt" - ;; +case "$cppstdin" in +"$wrapper") ;; +*) $rm -f $wrapper;; esac +$rm -f testcpp.c testcpp.out : Set private lib path case "$plibpth" in @@ -3881,178 +3730,40 @@ for thislib in $libswanted; do *) dflt="$dflt -l$thislib";; esac else - echo "No -l$thislib." - fi -done -set X $dflt -shift -dflt="$*" -case "$libs" in -'') dflt="$dflt";; -*) dflt="$libs";; -esac -case "$dflt" in -' '|'') dflt='none';; -esac - -$cat <&4 -cat <<'EOT' >testcpp.c -#define ABC abc -#define XYZ xyz -ABC.XYZ -EOT -cd .. -echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin -chmod 755 cppstdin -wrapper=`pwd`/cppstdin -ok='false' -cd UU - -if $test "X$cppstdin" != "X" && \ - $cppstdin $cppminus testcpp.out 2>&1 && \ - $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 -then - echo "You used to use $cppstdin $cppminus so we'll use that again." - case "$cpprun" in - '') echo "But let's see if we can live without a wrapper..." ;; - *) - if $cpprun $cpplast testcpp.out 2>&1 && \ - $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 - then - echo "(And we'll use $cpprun $cpplast to preprocess directly.)" - ok='true' - else - echo "(However, $cpprun $cpplast does not work, let's see...)" - fi - ;; - esac -else - case "$cppstdin" in - '') ;; - *) - echo "Good old $cppstdin $cppminus does not seem to be of any help..." - ;; - esac -fi - -if $ok; then - : nothing -elif echo 'Maybe "'"$cc"' -E" will work...'; \ - $cc -E testcpp.out 2>&1; \ - $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Yup, it does." - x_cpp="$cc -E" - x_minus=''; -elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \ - $cc -E - testcpp.out 2>&1; \ - $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Yup, it does." - x_cpp="$cc -E" - x_minus='-'; -elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \ - $cc -P testcpp.out 2>&1; \ - $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Yipee, that works!" - x_cpp="$cc -P" - x_minus=''; -elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \ - $cc -P - testcpp.out 2>&1; \ - $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "At long last!" - x_cpp="$cc -P" - x_minus='-'; -elif echo 'No such luck, maybe "'$cpp'" will work...'; \ - $cpp testcpp.out 2>&1; \ - $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "It works!" - x_cpp="$cpp" - x_minus=''; -elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \ - $cpp - testcpp.out 2>&1; \ - $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "Hooray, it works! I was beginning to wonder." - x_cpp="$cpp" - x_minus='-'; -elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \ - $wrapper testcpp.out 2>&1; \ - $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - x_cpp="$wrapper" - x_minus='' - echo "Eureka!" -else - dflt='' - rp="No dice. I can't find a C preprocessor. Name one:" - . ./myread - x_cpp="$ans" - x_minus='' - $x_cpp testcpp.out 2>&1 - if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then - echo "OK, that will do." >&4 - else -echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4 - exit 1 - fi -fi - -case "$ok" in -false) - cppstdin="$x_cpp" - cppminus="$x_minus" - cpprun="$x_cpp" - cpplast="$x_minus" - set X $x_cpp - shift - case "$1" in - "$cpp") - echo "Perhaps can we force $cc -E using a wrapper..." - if $wrapper testcpp.out 2>&1; \ - $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 - then - echo "Yup, we can." - cppstdin="$wrapper" - cppminus=''; - else - echo "Nope, we'll have to live without it..." - fi - ;; - esac - case "$cpprun" in - "$wrapper") - cpprun='' - cpplast='' - ;; - esac - ;; + echo "No -l$thislib." + fi +done +set X $dflt +shift +dflt="$*" +case "$libs" in +'') dflt="$dflt";; +*) dflt="$libs";; +esac +case "$dflt" in +' '|'') dflt='none';; esac -case "$cppstdin" in -"$wrapper") ;; -*) $rm -f $wrapper;; +$cat <&4 + set X $cppflags + shift + cppflags='' + $cat >cpp.c <<'EOM' +#define BLURFL foo + +BLURFL xx LFRULB +EOM + previous='' + for flag in $* + do + case "$flag" in + -*) ftry="$flag";; + *) ftry="$previous $flag";; + esac + if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus cpp1.out 2>/dev/null && \ + $cpprun -DLFRULB=bar $cppflags $ftry $cpplast cpp2.out 2>/dev/null && \ + $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \ + $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1 + then + cppflags="$cppflags $ftry" + previous='' + else + previous="$flag" + fi + done + set X $cppflags + shift + cppflags=${1+"$@"} + case "$cppflags" in + *-*) echo "They appear to be: $cppflags";; + esac + $rm -f cpp.c cpp?.out + ;; +esac + +: flags used in final linking phase +case "$ldflags" in +'') if ./venix; then + dflt='-i -z' + else + dflt='' + fi + case "$ccflags" in + *-posix*) dflt="$dflt -posix" ;; + esac + ;; +*) dflt="$ldflags";; +esac + +: Try to guess additional flags to pick up local libraries. +for thislibdir in $libpth; do + case " $loclibpth " in + *" $thislibdir "*) + case "$dflt " in + *"-L$thislibdir "*) ;; + *) dflt="$dflt -L$thislibdir" ;; + esac + ;; + esac +done + +case "$dflt" in +'') dflt='none' ;; +esac + +$cat <&4 +set X $cc $optimize $ccflags -o try $ldflags try.c $libs +shift +$cat >try.msg < try.c <<'EOF' +#include +main() { printf("Ok\n"); exit(0); } +EOF +dflt=y +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 + "Ok") dflt=n ;; + *) echo 'The program compiled OK, but produced no output.' >> try.msg + case " $libs " in + *" -lsfio "*) + cat >> try.msg <<'EOQS' +If $libs contains -lsfio, and sfio is mis-configured, then it +sometimes (apparently) runs and exits with a 0 status, but with no +output! It may have to do with sfio's use of _exit vs. exit. + +EOQS + rp="You have a big problem. Shall I abort Configure" + dflt=y + ;; + esac + ;; + esac + else + echo "The program compiled OK, but exited with status $?." >>try.msg + rp="You have a problem. Shall I abort Configure" + dflt=y + fi +else + echo "I can't compile the test program." >>try.msg + rp="You have a BIG problem. Shall I abort Configure" + dflt=y +fi +case "$dflt" in +y) + $cat try.msg >&4 + case "$knowitall" in + '') + echo "(The supplied flags might be incorrect with this C compiler.)" + ;; + *) dflt=n;; + esac + echo " " + . ./myread + case "$ans" in + n*|N*) ;; + *) echo "Ok. Stopping Configure." >&4 + exit 1 + ;; + esac + ;; +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 ' > foo.c +$cat >fieldn </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 <" > 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 -case "$dflt" in -''|' ') dflt=none;; -esac -$cat <&4 - set X $cppflags - shift - cppflags='' - $cat >cpp.c <<'EOM' -#define BLURFL foo - -BLURFL xx LFRULB -EOM - previous='' - for flag in $* - do - case "$flag" in - -*) ftry="$flag";; - *) ftry="$previous $flag";; - esac - if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus cpp1.out 2>/dev/null && \ - $cpprun -DLFRULB=bar $cppflags $ftry $cpplast cpp2.out 2>/dev/null && \ - $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \ - $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1 - then - cppflags="$cppflags $ftry" - previous='' - else - previous="$flag" - fi - done - set X $cppflags - shift - cppflags=${1+"$@"} - case "$cppflags" in - *-*) echo "They appear to be: $cppflags";; +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 - $rm -f cpp.c cpp?.out + ;; +*) + usemymalloc='n' + mallocsrc='' + mallocobj='' + d_mymalloc="$undef" ;; esac -: flags used in final linking phase -case "$ldflags" in -'') if ./venix; then - dflt='-i -z' +: compute the return types of malloc and free +echo " " +$cat >malloc.c < +#include +#ifdef I_MALLOC +#include +#endif +#ifdef I_STDLIB +#include +#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 - dflt='' + malloctype='char *' fi - case "$ccflags" in - *-posix*) dflt="$dflt -posix" ;; - esac ;; -*) dflt="$ldflags";; esac +echo "Your system wants malloc to return '$malloctype', it would seem." >&4 -: Try to guess additional flags to pick up local libraries. -for thislibdir in $libpth; do - case " $loclibpth " in - *" $thislibdir "*) - case "$dflt " in - *"-L$thislibdir "*) ;; - *) dflt="$dflt -L$thislibdir" ;; - esac - ;; - esac -done - -case "$dflt" in -'') dflt='none' ;; +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 +$cat >prototype.c <<'EOCP' +main(int argc, char *argv[]) { + exit(0);} +EOCP +if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then + echo "Your C compiler appears to support function prototypes." + val="$define" +else + echo "Your C compiler doesn't seem to understand function prototypes." + val="$undef" +fi +set prototype +eval $setvar +$rm -f prototype* -$cat <&4 -Your C linker may need flags. For this question you should -include -L/whatever and any other flags used by the C linker, but you -should NOT include libraries like -lwhatever. +$me: FATAL ERROR: +This version of $package can only be compiled by a compiler that +understands function prototypes. Unfortunately, your C compiler + $cc $ccflags +doesn't seem to understand them. Sorry about that. -Make sure you include the appropriate -L/path flags if your C linker -does not normally search all of the directories you specified above, -namely - $libpth -To use no flags, specify the word "none". +If GNU cc is avaiable for your system, perhaps you could try that instead. -EOH +Eventually, we hope to support building Perl with pre-ANSI compilers. +If you would like to help in that effort, please contact . -rp="Any additional ld flags (NOT including libraries)?" -. ./myread -case "$ans" in -none) ldflags='';; -*) ldflags="$ans";; +Aborting Configure now. +EOM + exit 2 + ;; esac -rmlist="$rmlist pdp11" -: coherency check +: determine where public executables go echo " " -echo "Checking your choice of C compiler and flags for coherency..." >&4 -set X $cc $optimize $ccflags $ldflags -o try try.c $libs -shift -$cat >try.msg < try.c <<'EOF' -#include -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 './try' >>try.msg 2>&1; then - xxx=`./try` - case "$xxx" in - "Ok") dflt=n ;; - *) echo 'The program compiled OK, but produced no output.' >> try.msg - case " $libs " in - *" -lsfio "*) - cat >> try.msg <<'EOQS' -If $libs contains -lsfio, and sfio is mis-configured, then it -sometimes (apparently) runs and exits with a 0 status, but with no -output! It may have to do with sfio's use of _exit vs. exit. - -EOQS - rp="You have a big problem. Shall I abort Configure" - dflt=y - ;; - esac - ;; - esac - else - echo "The program compiled OK, but exited with status $?." >>try.msg - rp="You have a problem. Shall I abort Configure" - dflt=y - fi + case "$installbin" in + '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;; + *) dflt="$installbin";; + esac + fn=de~ + rp='Where will public executables be installed?' + . ./getfile + installbin="$ans" else - echo "I can't compile the test program." >>try.msg - rp="You have a BIG problem. Shall I abort Configure" - dflt=y + installbin="$binexp" fi -case "$dflt" in -y) - $cat try.msg >&4 - case "$knowitall" in - '') - echo "(The supplied flags might be incorrect with this C compiler.)" - ;; - *) dflt=n;; - esac - echo " " - . ./myread - case "$ans" in - n*|N*) ;; - *) echo "Ok. Stopping Configure." >&4 - exit 1 - ;; - esac - ;; -n) echo "OK, that should do.";; -esac -$rm -f try try.* core : define a shorthand compile call compile=' mc_file=$1; shift; $cc $optimize $ccflags $ldflags -o ${mc_file} $* ${mc_file}.c $libs > /dev/null 2>&1;' +: define a shorthand compile call for compilations that should be ok. +compile_ok=' +mc_file=$1; +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 <&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 < int main() { - return __libc_main(); +#ifdef __GLIBC__ + exit(0); +#else + exit(1); +#endif } EOM set gnulibc -if eval $compile && \ - ./gnulibc | $contains '^GNU C Library' >/dev/null 2>&1; then +if eval $compile_ok && ./gnulibc; then val="$define" echo "You are using the GNU C Library" else @@ -4368,12 +4362,26 @@ eval $setvar : see if nm is to be used to determine whether a symbol is defined or not case "$usenm" in '') + dflt='' case "$d_gnulibc" in - $define) + "$define") + echo " " + echo "nm probably won't work on the GNU C Library." >&4 dflt=n ;; - *) - dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null` + esac + case "$dflt" in + '') + if $test "$osname" = aix -a ! -f /lib/syscalls.exp; then + echo " " + echo "Whoops! This is an AIX system without /lib/syscalls.exp!" >&4 + echo "'nm' won't be sufficient on this sytem." >&4 + dflt=n + fi + ;; + esac + case "$dflt" in + '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null` if $test $dflt -gt 20; then dflt=y else @@ -4384,26 +4392,28 @@ case "$usenm" in ;; *) case "$usenm" in - true) dflt=y;; + true|$define) dflt=y;; *) dflt=n;; esac ;; esac $cat < libpath + echo $libpth | tr ' ' $trnl | sort | uniq > libpath cat >&4 < libnames +echo $libc $libnames | tr ' ' $trnl | sort | uniq > libnames set X `cat libnames` shift xxx=files @@ -4666,129 +4676,54 @@ else echo " " echo "$nm didn't seem to work right. Trying $ar instead..." >&4 com='' - if $ar t $libc > libc.tmp; then - for thisname in $libnames; do + if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then + for thisname in $libnames $libc; do $ar t $thisname >>libc.tmp done $sed -e "s/\\$_o\$//" < libc.tmp > libc.list echo "Ok." >&4 + elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then + # Repeat libc to extract forwarders to DLL entries too + for thisname in $libnames $libc; do + $ar tv $thisname >>libc.tmp + # Revision 50 of EMX has bug in $ar. + # it will not extract forwarders to DLL entries + # Use emximp which will extract exactly them. + emximp -o tmp.imp $thisname \ + 2>/dev/null && \ + $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \ + < tmp.imp >>libc.tmp + $rm tmp.imp + done + $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list + echo "Ok." >&4 else echo "$ar didn't seem to work right." >&4 echo "Maybe this is a Cray...trying bld instead..." >&4 if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list - then - for thisname in $libnames; do - bld t $libnames | \ - $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list - $ar t $thisname >>libc.tmp - done - echo "Ok." >&4 - else - echo "That didn't work either. Giving up." >&4 - exit 1 - fi - fi - fi -fi -nm_extract="$com" -if $test -f /lib/syscalls.exp; then - echo " " - echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4 - $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list -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 ' > foo.c -$cat >fieldn </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 <" > 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' + then + for thisname in $libnames; do + bld t $libnames | \ + $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list + $ar t $thisname >>libc.tmp + done + echo "Ok." >&4 + else + echo "That didn't work either. Giving up." >&4 + exit 1 + fi + fi + fi +fi +nm_extract="$com" +if $test -f /lib/syscalls.exp; then + echo " " + echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4 + $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list +fi +;; +esac +$rm -f libnames libpath : see if dld is available set dld.h i_dld @@ -4885,7 +4820,7 @@ $undef|n|false) $define) dflt='y' ;; esac : Does a dl_xxx.xs file exist for this operating system - $test -f ../$dldir/dl_${osname}.xs && dflt='y' + $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y' ;; esac rp="Do you wish to use dynamic loading?" @@ -4895,7 +4830,7 @@ case "$ans" in y*) usedl="$define" case "$dlsrc" in '') - if $test -f ../$dldir/dl_${osname}.xs ; then + if $test -f $rsrc/$dldir/dl_${osname}.xs ; then dflt="$dldir/dl_${osname}.xs" elif $test "$d_dlopen" = "$define" ; then dflt="$dldir/dl_dlopen.xs" @@ -4910,15 +4845,17 @@ y*) usedl="$define" esac echo "The following dynamic loading files are available:" : Can not go over to $dldir because getfile has path hard-coded in. - cd ..; ls -C $dldir/dl*.xs; cd UU - rp="Source file to use for dynamic loading" - fn="fne" - . ./getfile + tdir=`pwd`; cd $rsrc; $ls -C $dldir/dl*.xs; cd $tdir + rp="Source file to use for dynamic loading" + fn="fne" + # XXX This getfile call will fail the existence check if you try + # building away from $src (this is not supported yet). + . ./getfile usedl="$define" : emulate basename dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'` - $cat << EOM + $cat << EOM Some systems may require passing special flags to $cc -c to compile modules that will be used to create a shared library. @@ -4931,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?" @@ -5024,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 @@ -5062,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?" @@ -5100,10 +5029,6 @@ $undef) ;; esac ;; - sunos) - dflt=n - also='Building a shared libperl will definitely not work on SunOS 4.' - ;; *) dflt=n ;; esac @@ -5135,11 +5060,11 @@ EOM # Why does next4 have to be so different? case "${osname}${osvers}" in next4*) xxx='DYLD_LIBRARY_PATH' ;; + os2*) xxx='' ;; # Nothing special needed. *) xxx='LD_LIBRARY_PATH' ;; esac - case "$osname" in - os2) ;; - *) $cat <&4 + if test X"$xxx" != "X"; then + $cat <&4 To build perl, you must add the current working directory to your $xxx environment variable before running make. You can do @@ -5150,7 +5075,7 @@ for Bourne-style shells, or for Csh-style shells. You *MUST* do this before running make. EOM - esac + fi ;; *) useshrplib='false' ;; esac @@ -5222,78 +5147,322 @@ case "$shrpdir" in *) $cat >&4 <&4 <&4 <&4 <&4 + +Adding $xxx to the flags +passed to $ld so that the perl executable will find the +installed shared $libperl. + +EOM + ;; + esac + ;; + esac +fi +# Respect a hint or command-line value. +case "$shrpenv" in +'') shrpenv="$tmp_shrpenv" ;; +esac + +: determine where manual pages go +set man1dir man1dir none +eval $prefixit +$cat <$first) 2>/dev/null; then + if $test -f 123456789abcde; then + echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4 + val="$undef" + else + if (echo hi >$second) 2>/dev/null; then + if $test -f /tmp/cf$$/123456789abcde; then + $cat <<'EOM' +That's peculiar... You can have filenames longer than 14 characters, but only +on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems +I shall consider your system cannot support long filenames at all. +EOM + val="$undef" + else + echo 'You can have filenames longer than 14 characters.' >&4 + val="$define" + fi + else + $cat <<'EOM' +How confusing! Some of your filesystems are sane enough to allow filenames +longer than 14 characters but some others like /tmp can't even think about them. +So, for now on, I shall assume your kernel does not allow them at all. +EOM + val="$undef" + fi + fi +else + $cat <<'EOM' +You can't have filenames longer than 14 chars. You can't even think about them! +EOM + val="$undef" +fi +set d_flexfnam +eval $setvar +$rm -rf /tmp/cf$$ 123456789abcde* + +: determine where library module manual pages go +set man3dir man3dir none +eval $prefixit +$cat <&4 <&4 +fn=dn+~ +rp="Where do the $package library man pages (source) go?" +. ./getfile +if test "X$man3direxp" != "X$ansexp"; then + installman3dir='' +fi -Adding $xxx to the flags -passed to $ld so that the perl executable will find the -installed shared $libperl. +man3dir="$ans" +man3direxp="$ansexp" +case "$man3dir" in +'') man3dir=' ' + installman3dir='';; +esac +if $afs; then + $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"; @@ -5750,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 @@ -5772,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 @@ -6010,7 +6326,7 @@ main() } EOCP set intsize - if eval $compile && ./intsize > /dev/null; then + if eval $compile_ok && ./intsize > /dev/null; then eval `./intsize` echo "Your integers are $intsize bytes long." echo "Your long integers are $longsize bytes long." @@ -6096,16 +6412,20 @@ $cat >try.c < #include #include -$signal_t blech() { exit(3); } +$signal_t blech(s) int s; { exit(3); } 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; @@ -6120,7 +6440,7 @@ main() } EOCP set try -if eval $compile; then +if eval $compile_ok; then ./try yyy=$? else @@ -6146,8 +6466,8 @@ $cat >try.c < #include #include -$signal_t blech() { exit(7); } -$signal_t blech_in_list() { exit(4); } +$signal_t blech(s) int s; { exit(7); } +$signal_t blech_in_list(s) int s; { exit(4); } unsigned long dummy_long(p) unsigned long p; { return p; } unsigned int dummy_int(p) unsigned int p; { return p; } unsigned short dummy_short(p) unsigned short p; { return p; } @@ -6158,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; @@ -6174,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; @@ -6193,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); @@ -6208,7 +6536,7 @@ main() } EOCP set try -if eval $compile; then +if eval $compile_ok; then ./try castflags=$? else @@ -6459,7 +6787,7 @@ $define|y|true) $cat << EOM On a few systems, the dynamically loaded modules that perl generates and uses -will need a different extension then shared libs. The default will probably +will need a different extension than shared libs. The default will probably be appropriate. EOM @@ -6537,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 @@ -6662,7 +6990,7 @@ main() { } EOCP set try - if eval $compile; then + if eval $compile_ok; then o_nonblock=`./try` case "$o_nonblock" in '') echo "I can't figure it out, assuming O_NONBLOCK will do.";; @@ -6686,7 +7014,9 @@ case "$eagain" in #include #include #define MY_O_NONBLOCK $o_nonblock +#ifndef errno /* XXX need better Configure test */ extern int errno; +#endif $signal_t blech(x) int x; { exit(3); } EOCP $cat >> try.c <<'EOCP' @@ -6741,7 +7071,7 @@ main() } EOCP set try - if eval $compile; then + if eval $compile_ok; then echo "$startsh" >mtry echo "./try >try.out 2>try.ret 3>try.err || exit 4" >>mtry chmod +x mtry @@ -6852,6 +7182,34 @@ eval $inlibc set gethostent d_gethent eval $inlibc +hasproto='varname=$1; func=$2; shift; shift; +while $test $# -ge 2; do + case "$1" in + $define) echo "#include <$2>";; + esac ; + shift 2; +done > try.c; +$cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null; +if $contains "$func.*(" tryout.c >/dev/null 2>&1; then + echo "$func() prototype found."; + val="$define"; +else + echo "$func() prototype NOT found."; + val="$undef"; +fi; +set $varname; +eval $setvar; +$rm -f try.c tryout.c' + +: see if this is a netdb.h system +set netdb.h i_netdb +eval $inhdr + +: see if prototypes for various gethostxxx netdb.h functions are available +echo " " +set d_gethostprotos gethostent $i_netdb netdb.h +eval $hasproto + : see if getlogin exists set getlogin d_getlogin eval $inlibc @@ -6868,6 +7226,11 @@ eval $inlibc set getnetent d_getnent eval $inlibc +: see if prototypes for various getnetxxx netdb.h functions are available +echo " " +set d_getnetprotos getnetent $i_netdb netdb.h +eval $hasproto + : see if getprotobyname exists set getprotobyname d_getpbyname @@ -6897,6 +7260,10 @@ eval $inlibc set getpriority d_getprior eval $inlibc +: see if prototypes for various getprotoxxx netdb.h functions are available +echo " " +set d_getprotoprotos getprotoent $i_netdb netdb.h +eval $hasproto : see if getservbyname exists set getservbyname d_getsbyname @@ -6910,6 +7277,11 @@ eval $inlibc set getservent d_getsent eval $inlibc +: see if prototypes for various getservxxx netdb.h functions are available +echo " " +set d_getservprotos getservent $i_netdb netdb.h +eval $hasproto + : see if gettimeofday or ftime exists set gettimeofday d_gettimeod eval $inlibc @@ -6933,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 @@ -6946,12 +7322,16 @@ $undef) #include #$i_niin I_NETINET_IN #$i_sysin I_SYS_IN +#$i_arpainet I_ARPA_INET #ifdef I_NETINET_IN #include #endif #ifdef I_SYS_IN #include #endif +#ifdef I_ARPA_INET +#include +#endif #ifdef htonl printf("Defined as a macro."); #endif @@ -7055,6 +7435,38 @@ $rm -f isascii* set killpg d_killpg eval $inlibc +: see if lchown exists +echo " " +$cat > try.c <<'EOCP' +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char lchown(); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char lchown(); +int main() { + /* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_lchown) || defined (__stub___lchown) +choke me +#else +lchown(); +#endif +; return 0; } +EOCP +set try +if eval $compile; then + $echo "lchown() found." >&4 + val="$define" +else + $echo "lchown() NOT found." >&4 + val="$undef" +fi +set d_lchown +eval $setvar + : see if link exists set link d_link eval $inlibc @@ -7071,7 +7483,7 @@ eval $inlibc echo " " echo $n "Checking to see if your system supports long doubles...$c" >&4 echo 'long double foo() { long double x; x = 7.0; return x; }' > try.c -if $cc $optimize $ccflags -c try.c; then +if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then val="$define" echo " Yup, it does." >&4 else @@ -7083,10 +7495,9 @@ set d_longdbl eval $setvar : check for length of long double -echo " " - case "${d_longdbl}${longdblsize}" in $define) + echo " " $echo $n "Checking to see how big your long doubles are...$c" >&4 $cat >try.c <<'EOCP' #include @@ -7098,14 +7509,58 @@ EOCP set try if eval $compile; then longdblsize=`./try` + $echo " $longdblsize bytes." >&4 else dflt='8' - echo "(I can't seem to compile the test program. Guessing...)" + echo " " + echo "(I can't seem to compile the test program. Guessing...)" >&4 rp="What is the size of a long double (in bytes)?" . ./myread longdblsize="$ans" fi - $echo " $longdblsize bytes." + ;; +esac +$rm -f try.c try + +: check for long long +echo " " +echo $n "Checking to see if your system supports long long...$c" >&4 +echo 'long long foo() { long long x; x = 7; return x; }' > try.c +if $cc $optimize $ccflags -c try.c >/dev/null 2>&1; then + val="$define" + echo " Yup, it does." >&4 +else + val="$undef" + echo " Nope, it doesn't." >&4 +fi +$rm try.* +set d_longlong +eval $setvar + +: check for length of long long +case "${d_longlong}${longlongsize}" in +$define) + echo " " + $echo $n "Checking to see how big your long longs are...$c" >&4 + $cat >try.c <<'EOCP' +#include +main() +{ + printf("%d\n", sizeof(long long)); +} +EOCP + set try + if eval $compile_ok; then + longlongsize=`./try` + $echo " $longlongsize bytes." >&4 + else + dflt='8' + echo " " + echo "(I can't seem to compile the test program. Guessing...)" + rp="What is the size of a long long (in bytes)?" + . ./myread + longlongsize="$ans" + fi ;; esac $rm -f try.c try @@ -7150,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 @@ -7170,112 +7621,46 @@ eval $inlibc set msgsnd d_msgsnd eval $inlibc -: see if msgrcv exists -set msgrcv d_msgrcv -eval $inlibc - -: see how much of the 'msg*(2)' library is present. -h_msg=true -echo " " -case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in -*"$undef"*) h_msg=false;; -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 - val="$define" -else - echo "You don't have the full msg*(2) library." >&4 - val="$undef" -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 < -#include -#ifdef I_MALLOC -#include -#endif -#ifdef I_STDLIB -#include -#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 +: see if msgrcv exists +set msgrcv d_msgrcv +eval $inlibc + +: see how much of the 'msg*(2)' library is present. +h_msg=true +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 -echo "Your system uses $freetype free(), it would seem." >&4 -$rm -f malloc.[co] +: 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 + val="$define" +else + echo "You don't have the full msg*(2) library." >&4 + val="$undef" +fi +set d_msg +eval $setvar + : see if nice exists set nice d_nice eval $inlibc @@ -7374,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 @@ -7425,16 +7822,37 @@ $define) set d_pwcomment eval $setvar + if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then + val="$define" + else + val="$undef" + fi + 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 set d_pwclass; eval $setvar set d_pwexpire; eval $setvar set d_pwcomment; eval $setvar + set d_pwgecos; eval $setvar + set d_pwpasswd; eval $setvar ;; esac @@ -7538,7 +7956,7 @@ exit(0); } EOCP set try - if eval $compile; then + if eval $compile_ok; then if ./try 2>/dev/null; then echo "Yes, it can." val="$define" @@ -7616,7 +8034,7 @@ exit(0); } EOCP set try - if eval $compile; then + if eval $compile_ok; then if ./try 2>/dev/null; then echo "Yes, it can." val="$define" @@ -7676,7 +8094,7 @@ exit(0); } EOCP set try - if eval $compile; then + if eval $compile_ok; then if ./try 2>/dev/null; then echo "Yes, it can." val="$define" @@ -7714,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 @@ -7725,6 +8160,165 @@ fi set d_sem eval $setvar +: see whether sys/sem.h defines union semun +echo " " +$cat > try.c <<'END' +#include +#include +#include +int main () { union semun semun; semun.buf = 0; } +END +set try +if eval $compile; then + echo "You have union semun in ." >&4 + val="$define" +else + echo "You do not have union semun in ." >&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 < +#include +#include +#include +#include +#include +#ifndef errno +extern int errno; +#endif +#$d_union_semun HAS_UNION_SEMUN +int main() { + union semun +#ifndef HAS_UNION_SEMUN + { + 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 +#endif /* IPC_PRIVATE && ... */ + printf("semget failed: errno = %d\n", errno); + return 0; +} +END + val="$undef" + set try + if eval $compile; then + xxx=`./try` + case "$xxx" in + semun) val="$define" ;; + esac + fi + $rm -f try try.c + set d_semctl_semun + eval $setvar + case "$d_semctl_semun" in + $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 +#include +#include +#include +#include +#include +#ifndef errno +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 +#endif /* IPC_PRIVATE && ... */ + printf("semget failed: errno = %d\n", errno); + + return 0; +} +END + val="$undef" + set try + if eval $compile; then + xxx=`./try` + case "$xxx" in + semid_ds) val="$define" ;; + esac + fi + $rm -f try try.c + 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 + ;; + *) echo "You cannot use struct semid_ds * for semctl IPC_STAT." >&4 + ;; + esac + ;; +*) val="$undef" + + # We do not have the full sem*(2) library, so assume we can not + # use either. + + set d_semctl_semun + eval $setvar + + set d_semctl_semid_ds + eval $setvar + ;; +esac + : see if setegid exists set setegid d_setegid eval $inlibc @@ -7901,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 @@ -7916,12 +8529,7 @@ echo " " : see if we have sigaction if set sigaction val -f d_sigaction; eval $csym; $val; then echo 'sigaction() found.' >&4 - val="$define" -else - echo 'sigaction NOT found.' >&4 - val="$undef" -fi -$cat > try.c <<'EOP' + $cat > try.c <<'EOP' #include #include #include @@ -7930,11 +8538,15 @@ main() struct sigaction act, oact; } EOP -set try -if eval $compile; then - : + set try + if eval $compile_ok; then + val="$define" + else + echo "But you don't seem to have a useable struct sigaction." >&4 + val="$undef" + fi else - echo "But you don't seem to have a useable struct sigaction." >&4 + echo 'sigaction NOT found.' >&4 val="$undef" fi set d_sigaction; eval $setvar @@ -8008,7 +8620,7 @@ else else echo "You don't have Berkeley networking in libc$_a..." >&4 if test -f /usr/lib/libnet$_a; then - ( (nm $nm_opt /usr/lib/libnet$_a | eval $nm_extract) || \ + ( ($nm $nm_opt /usr/lib/libnet$_a | eval $nm_extract) || \ $ar t /usr/lib/libnet$_a) 2>/dev/null >> libc.list if $contains socket libc.list >/dev/null 2>&1; then echo "...but the Wollongong group seems to have hacked it in." >&4 @@ -8213,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 @@ -8300,6 +8914,9 @@ case "$varval" in for inc in $inclist; do echo "#include <$inc>" >>temp.c; done; + echo "#ifdef $type" >> temp.c; + echo "printf(\"We have $type\");" >> temp.c; + echo "#endif" >> temp.c; $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null; if $contains $type temp.E >/dev/null 2>&1; then eval "$var=\$type"; @@ -8310,6 +8927,37 @@ case "$varval" in *) eval "$var=\$varval";; esac' +: define an is-a-typedef? function that prompts if the type is not available. +typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@; +case "$inclist" in +"") inclist="sys/types.h";; +esac; +eval "varval=\$$var"; +case "$varval" in +"") + $rm -f temp.c; + for inc in $inclist; do + echo "#include <$inc>" >>temp.c; + done; + echo "#ifdef $type" >> temp.c; + echo "printf(\"We have $type\");" >> temp.c; + echo "#endif" >> temp.c; + $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null; + echo " " ; + echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./"; + if $contains $type temp.E >/dev/null 2>&1; then + echo "$type found." >&4; + eval "$var=\$type"; + else + echo "$type NOT found." >&4; + dflt="$def"; + . ./myread ; + eval "$var=\$ans"; + fi; + $rm -f temp.?;; +*) eval "$var=\$varval";; +esac' + : see if this is a sys/times.h system set sys/times.h i_systimes eval $inhdr @@ -8323,13 +8971,9 @@ if set times val -f d_times; eval $csym; $val; then case "$i_systimes" in "$define") inc='sys/times.h';; esac + rp="What is the type returned by times() on this system?" set clock_t clocktype long stdio.h sys/types.h $inc - eval $typedef - dflt="$clocktype" - echo " " - rp="What type is returned by times() on this system?" - . ./myread - clocktype="$ans" + eval $typedef_ask else echo 'times() NOT found, hope that will do.' >&4 d_times="$undef" @@ -8438,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 @@ -8450,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 +#endif #if defined(I_DIRENT) #include #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */ @@ -8472,7 +9124,7 @@ case "$d_closedir" in int main() { return closedir(opendir(".")); } EOM set closedir - if eval $compile; then + if eval $compile_ok; then if ./closedir > /dev/null 2>&1 ; then echo "Yes, it does." val="$undef" @@ -8561,7 +9213,7 @@ main() } EOCP set try - if eval $compile; then + if eval $compile_ok; then dflt=`./try` else dflt='8' @@ -8627,95 +9279,50 @@ EOCP (I can't seem to compile the test program. Guessing big-endian...) EOM fi - case "$xxx_prompt" in - y) - rp="What is the order of bytes in a long?" - . ./myread - byteorder="$ans" - ;; - *) byteorder=$dflt - ;; - esac - ;; -esac -$rm -f try.c try - -: how do we catenate cpp tokens here? -echo " " -echo "Checking to see how your cpp does stuff like catenate tokens..." >&4 -$cat >cpp_stuff.c <<'EOCP' -#define RCAT(a,b)a/**/b -#define ACAT(a,b)a ## b -RCAT(Rei,ser) -ACAT(Cir,cus) -EOCP -$cppstdin $cppflags $cppminus cpp_stuff.out 2>&1 -if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then - echo "Oh! Smells like ANSI's been here." >&4 - echo "We can catify or stringify, separately or together!" - cpp_stuff=42 -elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then - echo "Ah, yes! The good old days!" >&4 - echo "However, in the good old days we don't know how to stringify and" - echo "catify at the same time." - cpp_stuff=1 -else - $cat >&4 <&4 - $cat >try.c < -#include - -#ifndef DB_VERSION_MAJOR -u_int32_t hash_cb (ptr, size) -const void *ptr; -size_t size; -{ -} -HASHINFO info; -main() -{ - info.hash = hash_cb; -} -#endif -EOCP - if $cc $ccflags -c try.c >try.out 2>&1 ; then - if $contains warning try.out >>/dev/null 2>&1 ; then - db_hashtype='int' - else - db_hashtype='u_int32_t' - fi - else - : XXX Maybe we should just give up here. - db_hashtype=u_int32_t - echo "Help: I can't seem to compile the db test program." >&4 - echo "Something's wrong, but I'll assume you use $db_hashtype." >&4 - fi - $rm -f try.* - echo "Your version of Berkeley DB uses $db_hashtype for hash." - ;; -*) db_hashtype=u_int32_t + case "$xxx_prompt" in + y) + rp="What is the order of bytes in a long?" + . ./myread + byteorder="$ans" + ;; + *) byteorder=$dflt + ;; + esac ;; esac +$rm -f try.c try + +: how do we catenate cpp tokens here? +echo " " +echo "Checking to see how your cpp does stuff like catenate tokens..." >&4 +$cat >cpp_stuff.c <<'EOCP' +#define RCAT(a,b)a/**/b +#define ACAT(a,b)a ## b +RCAT(Rei,ser) +ACAT(Cir,cus) +EOCP +$cppstdin $cppflags $cppminus cpp_stuff.out 2>&1 +if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then + echo "Oh! Smells like ANSI's been here." >&4 + echo "We can catify or stringify, separately or together!" + cpp_stuff=42 +elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then + echo "Ah, yes! The good old days!" >&4 + echo "However, in the good old days we don't know how to stringify and" + echo "catify at the same time." + cpp_stuff=1 +else + $cat >&4 <&4 + $cat >try.c < +#include + +#ifndef DB_VERSION_MAJOR +u_int32_t hash_cb (ptr, size) +const void *ptr; +size_t size; +{ +} +HASHINFO info; +main() +{ + info.hash = hash_cb; +} +#endif +EOCP + if $cc $ccflags -c try.c >try.out 2>&1 ; then + if $contains warning try.out >>/dev/null 2>&1 ; then + db_hashtype='int' + else + db_hashtype='u_int32_t' + fi + else + : XXX Maybe we should just give up here. + db_hashtype=u_int32_t + $cat try.out >&4 + echo "Help: I can't seem to compile the db test program." >&4 + echo "Something's wrong, but I'll assume you use $db_hashtype." >&4 + fi + $rm -f try.* + echo "Your version of Berkeley DB uses $db_hashtype for hash." + ;; +*) db_hashtype=u_int32_t + ;; +esac +case "$i_db" in +define) : Check the return type needed for prefix echo " " echo "Checking return type needed for prefix for Berkeley DB ..." >&4 @@ -8828,6 +9480,7 @@ EOCP else db_prefixtype='size_t' : XXX Maybe we should just give up here. + $cat try.out >&4 echo "Help: I can't seem to compile the db test program." >&4 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4 fi @@ -8841,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 <try.c <<'EOCP' @@ -8878,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 @@ -8924,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 @@ -8946,9 +9596,9 @@ main() } EOCP set try - if eval $compile; then + if eval $compile_ok; then doublesize=`./try` - $echo $doublesize >&4 + $echo " $doublesize bytes." >&4 else dflt='8' echo "(I can't seem to compile the test program. Guessing...)" @@ -8961,13 +9611,9 @@ esac $rm -f try.c try : see what type file positions are declared as in the library -set fpos_t fpostype long stdio.h sys/types.h -eval $typedef -echo " " -dflt="$fpostype" rp="What is the type for file position used by fsetpos()?" -. ./myread -fpostype="$ans" +set fpos_t fpostype long stdio.h sys/types.h +eval $typedef_ask : get csh whereabouts case "$csh" in @@ -8985,6 +9631,8 @@ esac full_sed=$sed : see what type gids are declared as in the kernel +echo " " +echo "Looking for the type for group ids returned by getgid()." set gid_t gidtype xxx stdio.h sys/types.h eval $typedef case "$gidtype" in @@ -8998,10 +9646,13 @@ xxx) ;; *) dflt="$gidtype";; esac -echo " " -rp="What is the type for group ids returned by getgid()?" -. ./myread -gidtype="$ans" +case "$gidtype" in +gid_t) echo "gid_t found." ;; +*) rp="What is the type for group ids returned by getgid()?" + . ./myread + gidtype="$ans" + ;; +esac : see if getgroups exists set getgroups d_getgrps @@ -9021,11 +9672,11 @@ case "$d_getgrps$d_setgrps" in *) dflt="$groupstype" ;; esac $cat <&4 @@ -9062,31 +9709,9 @@ case "$make_set_make" in esac : see what type is used for mode_t +rp="What is the type used for file modes for system calls (e.g. fchmod())?" set mode_t modetype int stdio.h sys/types.h -eval $typedef -dflt="$modetype" -echo " " -rp="What type is used for file modes?" -. ./myread -modetype="$ans" - -: Cruising for prototypes -echo " " -echo "Checking out function prototypes..." >&4 -$cat >prototype.c <<'EOCP' -main(int argc, char *argv[]) { - exit(0);} -EOCP -if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then - echo "Your C compiler appears to support function prototypes." - val="$define" -else - echo "Your C compiler doesn't seem to understand function prototypes." - val="$undef" -fi -set prototype -eval $setvar -$rm -f prototype* +eval $typedef_ask : define a fucntion to check prototypes $cat > protochk <&4 + $echo $n "Checking to see how big your pointers are...$c" >&4 if test "$voidflags" -gt 7; then echo '#define VOID_PTR char *' > try.c else @@ -9322,8 +9935,9 @@ main() } EOCP set try - if eval $compile; then + if eval $compile_ok; then ptrsize=`./try` + $echo " $ptrsize bytes." >&4 else dflt='4' echo "(I can't seem to compile the test program. Guessing...)" >&4 @@ -9368,7 +9982,7 @@ main() } EOCP set try - if eval $compile; then + if eval $compile_ok; then dflt=`./try$_exe` else dflt='?' @@ -9433,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 , 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 , or both." >&4 + $echo $n "I'm now running the test program...$c" + $cat >try.c <<'EOCP' #include #ifdef I_TIME #include @@ -9467,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 @@ -9486,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 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 ." >&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 ." >&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 < signal.c <<'EOP' +$cat > signal.c <<'EOCP' #include #include +#include int main() { /* Strange style to avoid deeply-nested #if/#else/#endif */ @@ -9722,8 +10339,11 @@ int main() { printf("NSIG %d\n", NSIG); -EOP -echo $xxx | $tr ' ' '\012' | $sort | $uniq | $awk ' +#ifndef JUST_NSIG + +EOCP + +echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk ' { printf "#ifdef SIG"; printf $1; printf "\n" printf "printf(\""; printf $1; printf " %%d\\n\",SIG"; @@ -9731,6 +10351,7 @@ echo $xxx | $tr ' ' '\012' | $sort | $uniq | $awk ' printf "#endif\n" } END { + printf "#endif /* JUST_NSIG */\n"; printf "}\n"; } ' >>signal.c @@ -9767,22 +10388,69 @@ END { EOP $cat >signal_cmd </dev/null 2>&1; then +if $test -s signal.lst; then + echo "Using your existing signal.lst file" + exit 0 +fi +xxx="$xxx" +EOS +$cat >>signal_cmd <<'EOS' + +set signal +if eval $compile_ok; then ./signal$_exe | $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst else - echo "(I can't seem be able to compile the test program -- Guessing)" + echo "(I can't seem be able to compile the whole test program)" >&4 + echo "(I'll try it in little pieces.)" >&4 + set signal -DJUST_NSIG + if eval $compile_ok; then + ./signal$_exe > signal.nsg + $cat signal.nsg + else + echo "I can't seem to figure out how many signals you have." >&4 + echo "Guessing 50." >&4 + echo 'NSIG 50' > signal.nsg + fi + : Now look at all the signal names, one at a time. + for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do + $cat > signal.c < +#include +#include +int main() { +printf("$xx %d\n", SIG${xx}); +return 0; +} +EOCP + set signal + if eval $compile; then + echo "SIG${xx} found." + ./signal$_exe >> signal.ls1 + else + echo "SIG${xx} NOT found." + fi + done + if $test -s signal.ls1; then + $cat signal.nsg signal.ls1 | + $sort -n +1 | $uniq | $awk -f signal.awk >signal.lst + fi + +fi +if $test -s signal.lst; then + : +else + echo "(AAK! I can't compile the test programs -- Guessing)" >&4 echo 'kill -l' >signal - set X \`csh -f signal.lst + echo $@ | $tr ' ' $trnl | \ + $awk '{ printf $1; printf " %d\n", ++s; }' >signal.lst fi -$rm -f signal.c signal signal$_o +$rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1 EOS chmod a+x signal_cmd $eunicefix signal_cmd @@ -9792,7 +10460,7 @@ echo " " case "$sig_name_init" in '') echo "Generating a list of signal names and numbers..." >&4 - ./signal_cmd + . ./signal_cmd sig_name=`$awk '{printf "%s ", $1}' signal.lst` sig_name="ZERO $sig_name" sig_name_init=`$awk 'BEGIN { printf "\"ZERO\", " } @@ -9843,7 +10511,7 @@ main() EOM echo " " set ssize -if eval $compile && ./ssize > /dev/null; then +if eval $compile_ok && ./ssize > /dev/null; then ssizetype=`./ssize` echo "I'll be using $ssizetype for functions returning a byte count." >&4 else @@ -9874,25 +10542,25 @@ fi : 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 - dflt="$timetype" - echo " " - rp="What type is returned by time() on this system?" - . ./myread - timetype="$ans" -else + eval $typedef_ask + 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 " " +echo "Looking for the type for user ids returned by getuid()." set uid_t uidtype xxx stdio.h sys/types.h eval $typedef case "$uidtype" in @@ -9906,10 +10574,13 @@ xxx) ;; *) dflt="$uidtype";; esac -echo " " -rp="What is the type for user ids returned by getuid()?" -. ./myread -uidtype="$ans" +case "$uidtype" in +uid_t) echo "uid_t found." ;; +*) rp="What is the type for user ids returned by getuid()?" + . ./myread + uidtype="$ans" + ;; +esac : see if dbm.h is available : see if dbmclose exists @@ -9998,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 @@ -10058,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 <Cppsym $startsh case "\$1" in @@ -10085,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\\ @@ -10352,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 @@ -10405,37 +11108,47 @@ eval $setvar echo " " echo "Looking for extensions..." >&4 -cd ../ext +tdir=`pwd` +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 .. + cd .. fi fi ;; esac done +set X $nonxs_extensions +shift +nonxs_extensions="$*" set X $known_extensions shift known_extensions="$*" -cd ../UU +cd $tdir : Now see which are supported on this system. avail_ext='' @@ -10481,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 @@ -10490,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 <&4 for file in $loclist $trylist; do - eval $file="\$file" + if test X$file != Xln -a X$file != Xar -o X$osname != Xos2; then + eval $file="\$file" + fi done ;; esac @@ -10683,7 +11418,9 @@ _exe='$_exe' _o='$_o' afs='$afs' alignbytes='$alignbytes' +ansi2knr='$ansi2knr' aphostname='$aphostname' +apiversion='$apiversion' ar='$ar' archlib='$archlib' archlibexp='$archlibexp' @@ -10755,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' @@ -10774,15 +11513,18 @@ 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' d_gethent='$d_gethent' d_gethname='$d_gethname' +d_gethostprotos='$d_gethostprotos' d_getlogin='$d_getlogin' d_getnbyaddr='$d_getnbyaddr' d_getnbyname='$d_getnbyname' d_getnent='$d_getnent' +d_getnetprotos='$d_getnetprotos' d_getpbyname='$d_getpbyname' d_getpbynumber='$d_getpbynumber' d_getpent='$d_getpent' @@ -10791,20 +11533,26 @@ d_getpgrp2='$d_getpgrp2' 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' d_isascii='$d_isascii' d_killpg='$d_killpg' +d_lchown='$d_lchown' d_link='$d_link' d_locconv='$d_locconv' d_lockf='$d_lockf' d_longdbl='$d_longdbl' +d_longlong='$d_longlong' d_lstat='$d_lstat' d_mblen='$d_mblen' d_mbstowcs='$d_mbstowcs' @@ -10815,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' @@ -10840,7 +11587,9 @@ d_pwchange='$d_pwchange' d_pwclass='$d_pwclass' 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' @@ -10854,10 +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_setegid='$d_setegid' d_seteuid='$d_seteuid' +d_setgrent='$d_setgrent' d_setgrps='$d_setgrps' d_sethent='$d_sethent' d_setlinebuf='$d_setlinebuf' @@ -10868,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' @@ -10918,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' @@ -10939,6 +11693,7 @@ dlsrc='$dlsrc' doublesize='$doublesize' dynamic_ext='$dynamic_ext' eagain='$eagain' +ebcdic='$ebcdic' echo='$echo' egrep='$egrep' emacs='$emacs' @@ -10953,7 +11708,6 @@ fpostype='$fpostype' freetype='$freetype' full_csh='$full_csh' full_sed='$full_sed' -gcc='$gcc' gccversion='$gccversion' gidtype='$gidtype' glibpth='$glibpth' @@ -10966,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' @@ -11051,6 +11806,7 @@ lns='$lns' locincpth='$locincpth' loclibpth='$loclibpth' longdblsize='$longdblsize' +longlongsize='$longlongsize' longsize='$longsize' lp='$lp' lpr='$lpr' @@ -11089,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' @@ -11177,6 +11934,7 @@ timeincl='$timeincl' timetype='$timetype' touch='$touch' tr='$tr' +trnl='$trnl' troff='$troff' uidtype='$uidtype' uname='$uname' @@ -11193,6 +11951,7 @@ usethreads='$usethreads' usevfork='$usevfork' usrinc='$usrinc' uuname='$uuname' +version='$version' vi='$vi' voidflags='$voidflags' xlibpth='$xlibpth' @@ -11200,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 @@ -11261,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