3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc so you may fetch it yourself from your nearest
18 # archive site. Check with Archie if you don't know where that can be.)
21 # $Id: Head.U,v 3.0.1.3 1993/12/15 08:15:07 ram Exp $
23 # Generated on Wed May 4 14:59:36 EDT 1994 [metaconfig 3.0 PL22]
28 SCO csh still thinks true is false. Write to SCO today and tell them that next
29 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31 (Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
32 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34 [End of diatribe. We now return you to your regularly scheduled programming...]
38 OOPS! You naughty creature! You didn't run Configure with sh!
39 I will attempt to remedy the situation by running sh for you...
42 true || cat /tmp/c1$$ /tmp/c2$$
43 true || exec sh $0 $argv:q
45 (exit $?0) || cat /tmp/c2$$
46 (exit $?0) || exec sh $0 $argv:q
47 rm -f /tmp/c1$$ /tmp/c2$$
50 PATH=".:$PATH:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin"
51 PATH=$PATH:'/usr/5bin:/etc:/usr/gnu/bin:/usr/new:/usr/new/bin:/usr/nbin'
52 PATH=$PATH:'/sys5.3/bin:/sys5.3/usr/bin:/bsd4.3/bin:/bsd4.3/usr/ucb'
53 PATH=$PATH:'/bsd4.3/usr/bin:/usr/bsd:/bsd43/bin:/usr/ccs/bin'
54 PATH=$PATH:'/etc:/usr/lib:/usr/ucblib:/lib:/usr/ccs/lib'
55 PATH=$PATH:'/sbin:/usr/sbin:/usr/libexec'
59 echo "Say 'sh Configure', not 'sh <Configure'"
63 : On HP-UX, large Configure scripts may exercise a bug in /bin/sh
64 if test -f /hp-ux -a -f /bin/ksh; then
65 if (PATH=.; alias -x) >/dev/null 2>&1; then
66 : already under /bin/ksh
69 (Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.)
74 : Warn them if they use ksh on other systems
75 (PATH=.; alias -x) >/dev/null 2>&1 && \
77 (I see you are using the Korn shell. Some ksh's blow up on Configure,
78 especially on exotic machines. If yours does, try the Bourne shell instead.)
82 : Configure runs within the UU subdirectory
83 test -d UU || mkdir UU
427 : script used to extract .SH files with variable substitutions
430 echo "Doing variable substitutions on .SH files..."
431 if test -f MANIFEST; then
432 set x `awk '{print $1}' <MANIFEST | grep '\.SH'`
434 echo "(Looking for .SH files under the current directory.)"
435 set x `find . -name "*.SH" -print`
439 0) set x *.SH; shift;;
441 if test ! -f $1; then
447 dir=`expr X$file : 'X\(.*\)/'`
448 file=`expr X$file : 'X.*/\(.*\)'`
449 (cd $dir && . ./$file)
456 if test -f config_h.SH; then
457 if test ! -f config.h; then
458 : oops, they left it out of MANIFEST, probably, so do it anyway.
464 : produce awk script to parse command line options
465 cat >options.awk <<'EOF'
467 optstr = "deEf:hrsSV"; # getopt-style specification
469 len = length(optstr);
470 for (i = 1; i <= len; i++) {
471 c = substr(optstr, i, 1);
472 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
483 if (substr(str, 1, 1) != "-") {
484 printf("'%s'\n", str);
488 for (i = 2; i <= len; i++) {
489 c = substr(str, i, 1);
491 printf("-%s\n", substr(str, i));
497 printf("'%s'\n", substr(str, i + 1));
510 : process the command line options
511 set X `for arg in "$@"; do echo $arg; done | awk -f options.awk`
516 : set up default values
526 while test $# -gt 0; do
528 -d) shift; fastread=yes;;
529 -e) shift; alldone=cont;;
533 if test -r "$1"; then
536 echo "Configure: cannot read config file $1." >&2
541 -h) shift; error=true;;
542 -r) shift; reuseval=true;;
543 -s) shift; silent=true;;
544 -E) shift; alldone=exit;;
545 -S) shift; extractsh=true;;
546 -V) echo "Configure generated by metaconfig 3.0 PL22." >&2
549 -*) echo "Configure: unknown option $1" >&2; shift; error=true;;
557 Usage: Configure [-dehrESV] [-f config.sh]
558 -d : use defaults for all answers.
559 -e : go on without questioning past the production of config.sh.
560 -f : specify an alternate default configuration file.
561 -h : print this help message and exit (with an error status).
562 -r : reuse C symbols value if possible (skips costly nm extraction).
563 -s : silent mode, only echoes questions and essential information.
564 -E : stop at the end of questions, after having produced config.sh.
565 -S : perform variable substitutions on all .SH files (can mix with -f)
566 -V : print version number and exit (with a zero status).
574 true) exec 1>/dev/null;;
580 '') config_sh='config.sh'; config='./config.sh';;
581 /*) config="$config_sh";;
582 *) config="./$config_sh";;
585 echo "Fetching answers from $config_sh..."
599 : Eunice requires " " instead of "", can you believe it
602 echo "Beginning of configuration questions for $package."
606 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
609 trap 'echo " "; rm -rf $rmlist; exit 1' 1 2 3 15
611 : We must find out about Eunice early
613 if test -f /etc/unixtovms; then
614 eunicefix=/etc/unixtovms
616 if test -f /etc/unixtovms.exe; then
617 eunicefix=/etc/unixtovms.exe
620 : list of known cpp symbols
621 attrlist="__alpha __bsdi__ BSD_NET2 DGUX M_I186 M_I286 M_I386"
622 attrlist="$attrlist M_I8086 M_XENIX UTS __DGUX__"
623 attrlist="$attrlist _AIX __STDC__ __m88k__ ansi bsd4_2 gcos gimpel"
624 attrlist="$attrlist hp9000s300 hp9000s400 hp9000s500 hp9000s700"
625 attrlist="$attrlist hp9000s800 hpux"
626 attrlist="$attrlist i186 i386 i486 i8086 iAPX286 ibm interdata"
627 attrlist="$attrlist m88k mc300 mc500 mc68000 mc68k mc700 mert"
628 attrlist="$attrlist mips NeXT ns16000 ns32000 nsc32000 os"
629 attrlist="$attrlist __osf__ pdp11 posix"
630 attrlist="$attrlist pyr sinix sony sparc sun tower tower32 tower32_600"
631 attrlist="$attrlist tower32_800 tss u3b2 u3b20 u3b200 u3b5 ultrix unix"
632 attrlist="$attrlist __unix__ vax venix xenix z8000"
635 : List of extensions we want:
638 : no include file wanted by default
641 : File to use for dynamic loading
645 : change the next line if compiling for Xenix/286 on Xenix/386
646 xlibpth='/usr/lib/386 /lib/386'
648 : general looking path for locating libraries
649 libpth="/usr/lib/large /lib /usr/lib $xlibpth /lib/large"
650 libpth="$libpth /usr/lib/small /lib/small"
651 libpth="$libpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
653 : Private path used by Configure to find libraries. Its value
654 : is prepend to libpth. This variable takes care of special
655 : machines, like the mips. Usually, it should be empty.
658 libswanted=" net socket inet nsl nm sdbm gdbm ndbm dbm malloc dl dld sun m c_s posix cposix ndir dir ucb bsd BSD PW x "
660 : full support for void wanted by default
664 : Some greps do not return status, grrr.
665 echo "grimblepritz" >grimble
666 if grep blurfldyick grimble >/dev/null 2>&1 ; then
668 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
674 : the following should work in any shell
678 echo "AGH! Grep doesn't return a status. Attempting remedial action."
679 cat >contains <<'EOSS'
680 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
685 : first determine how to suppress newline on echo command
687 echo "Checking echo to see how to suppress newlines..."
688 (echo "hi there\c" ; echo " ") >.echotmp
689 if $contains c .echotmp >/dev/null 2>&1 ; then
700 echo $n "The star should be here-->$c"
704 : Now test for existence of everything in MANIFEST
706 if test -f ../MANIFEST; then
707 echo "First let's make sure your kit is complete. Checking..." >&4
708 awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50
710 for filelist in x??; do
711 (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
713 if test -s missing; then
717 THIS PACKAGE SEEMS TO BE INCOMPLETE.
719 You have the option of continuing the configuration process, despite the
720 distinct possibility that your kit is damaged, by typing 'y'es. If you
721 do, don't blame me if something goes wrong. I advise you to type 'n'o
722 and contact the author (lwall@netlabs.com).
725 echo $n "Continue? [n] $c" >&4
729 echo "Continuing..." >&4
733 echo "ABORTING..." >&4
738 echo "Looks good..." >&4
741 echo "There is no MANIFEST file. I hope your kit is complete !"
745 : compute the number of columns on the terminal for proper question formatting
750 : set up the echo used in my read
751 myecho="case \"\$xxxm\" in
752 '') echo $n \"\$rp $c\" >&4;;
754 '') echo $n \"[\$xxxm] $c\";;
756 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
758 echo $n \"[\$xxxm] $c\" >&4
760 echo $n \"\$rp [\$xxxm] $c\" >&4
766 : now set up to do reads with possible shell escape and default assignment
772 yes) case "\$dflt" in
775 case "\$silent-\$rp" in
780 *) case "\$silent" in
786 while expr "X\$ans" : "X!" >/dev/null; do
790 aok=''; eval "ans=\"\$answ\"" && aok=y
800 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
810 echo "*** Substitution done -- please confirm."
812 ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
817 echo "*** Error -- try again."
824 case "\$ans\$xxxm\$nostick" in
836 : create .config dir to save info across Configure sessions
837 test -d ../.config || mkdir ../.config
838 cat >../.config/README <<EOF
839 This directory created by Configure to save information that should
840 persist across sessions.
842 You may safely delete it if you wish.
845 : general instructions
848 user=`( (logname) 2>/dev/null || whoami) 2>&1`
849 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
852 rp='Would you like to see the instructions?'
863 This installation shell script will examine your system and ask you questions
864 to determine how the perl package should be installed. If you get
865 stuck on a question, you may use a ! shell escape to start a subshell or
866 execute a command. Many of the questions will have default answers in square
867 brackets; typing carriage return will give you the default.
869 On some of the questions which ask for file or directory names you are allowed
870 to use the ~name construct to specify the login directory belonging to "name",
871 even if you don't have a shell which knows about that. Questions where this is
872 allowed will be marked "(~name ok)".
876 dflt='Type carriage return to continue'
880 The prompter used in this script allows you to use shell variables and
881 backticks in your answers. You may use $1, $2, etc... to refer to the words
882 in the default answer, as if the default line was a set of arguments given to a
883 script shell. This means you may also use $* to repeat the whole default line,
884 so you do not have to re-type everything to add something to the default.
886 Everytime there is a substitution, you will have to confirm. If there is an
887 error (e.g. an unmatched backtick), the default answer will remain unchanged
888 and you will be prompted again.
890 If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
891 the questions and use the computed defaults (or the previous answers if there
892 was already a config.sh file). Type 'Configure -h' for a list of options.
898 Much effort has been expended to ensure that this shell script will run on any
899 Unix system. If despite that it blows up on yours, your best bet is to edit
900 Configure and run it again. Also, let me (lwall@netlabs.com)
901 know how I blew it. If you can't run Configure for some reason, you'll have to
902 generate a config.sh file by hand.
904 This installation script affects things in two ways:
906 1) it may do direct variable substitutions on some of the files included
908 2) it builds a config.h file for inclusion in C programs. You may edit
909 any of these files as the need arises after running this script.
911 If you make a mistake on a question, there is no easy way to back up to it
912 currently. The easiest thing to do is to edit config.sh and rerun all the SH
913 files. Configure will offer to let you do this before it runs the SH files.
916 dflt='Type carriage return to continue'
919 true) echo $user >>../.config/instruct;;
923 : see if sh knows # comments
925 echo "Checking your sh to see if it knows about # comments..." >&4
926 if sh -c '#' >/dev/null 2>&1 ; then
927 echo "Your sh handles # comments correctly."
931 echo "Okay, let's see if #! works on this system..."
932 echo "#!/bin/cat" >try
936 if test -s today; then
940 echo "#! /bin/cat" > try
944 if test -s today; then
948 echo "It's just a comment."
953 echo "Your sh doesn't grok # comments--I will strip them later on."
955 echo "exec grep -v '^[ ]*#'" >spitshell
958 spitshell=`pwd`/spitshell
959 echo "I presume that if # doesn't work, #! won't work either!"
964 : figure out how to guarantee sh startup
966 echo "Checking out how to guarantee sh startup..." >&4
968 *bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";;
969 *) startsh=$sharpbang'/bin/sh';;
971 echo "Let's see if '$startsh' works..."
983 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
987 : find out where common programs are
989 echo "Locating common programs..." >&4
1002 if test -d \$dir/\$thing; then
1008 if test -f \$dir/\$thing; then
1011 elif test -f \$dir/\$thing.exe; then
1012 : on Eunice apparently
1056 pth=`echo $PATH | sed -e 's/:/ /g'`
1057 pth="$pth /lib /usr/lib"
1058 for file in $loclist; do
1059 xxx=`./loc $file $file $pth`
1064 echo $file is in $xxx.
1067 echo "I don't know where $file is. I hope it's in everyone's PATH."
1072 echo "Don't worry if any of the following aren't found..."
1074 for file in $trylist; do
1075 xxx=`./loc $file $file $pth`
1080 echo $file is in $xxx.
1083 echo "I don't see $file out there, $say."
1090 echo "Substituting grep for egrep."
1096 echo "Hopefully test is built into your sh."
1099 if sh -c "PATH= test true" >/dev/null 2>&1; then
1100 echo "Using the test built into your sh."
1108 echo "Hopefully echo is built into your sh."
1113 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1114 $echo $n "hi there$c" >foo1
1115 echo $n "hi there$c" >foo2
1116 if cmp foo1 foo2 >/dev/null 2>&1; then
1117 echo "They are compatible. In fact, they may be identical."
1124 They are not compatible! You are probably running ksh on a non-USG system.
1125 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1126 have echo built in and we may have to run some Bourne shell scripts. That
1127 means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1130 $echo $n "The star should be here-->$c"
1137 : Try to determine whether config.sh was made on this system
1138 case "$config_sh" in
1140 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1141 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' | \
1142 tr '[A-Z]' '[a-z]' | tr '\012' ' '`
1144 if test "$fastread" = yes; then
1146 elif test -f ../config.sh; then
1148 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1149 eval "old`grep myuname= ../config.sh`"
1151 if test "X$myuname" = "X$oldmyuname"; then
1156 : Get old answers from old config file if Configure was run on the
1157 : same system, otherwise use the hints.
1160 if test -f config.sh; then
1162 rp="I see a config.sh file. Shall I use it to set the defaults?"
1165 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1166 *) echo "Fetching default answers from your old config.sh file..." >&4
1177 if test ! -f config.sh; then
1180 First time through, eh? I have some defaults handy for the following systems:
1183 cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4
1185 : Half the following guesses are probably wrong... If you have better
1186 : tests or hints, please send them to lwall@netlabs.com
1187 : The metaconfig authors would also appreciate a copy...
1188 $test -f /irix && osname=sgi
1189 $test -f /xenix && osname=sco_xenix
1190 $test -f /dynix && osname=dynix
1191 $test -f /dnix && osname=dnix
1192 $test -f /bin/mips && /bin/mips && osname=mips
1193 $test -d /NextApps && test -f /usr/adm/software_version && osname=next
1194 $test -d /usr/include/minix && osname=minix
1195 if $test -f $uname; then
1199 $test -f $5.sh && dflt="$dflt $5"
1205 umips) osname=umips ;;
1208 [23]100) osname=mips ;;
1209 next*) osname=next ;;
1210 news*) osname=news ;;
1211 i386*) if $test -f /etc/kconfig; then
1213 if $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1215 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
1223 aix) osname=aix_rs ;;
1228 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1231 solaris) osname=solaris
1233 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1236 dnix) osname=dnix ;;
1237 dgux) osname=dgux ;;
1238 genix) osname=genix ;;
1239 hp*ux) osname=hpux ;;
1240 next) osname=next ;;
1242 ultrix) osname=ultrix
1251 alpha) osname=dec_osf
1253 [vt]1\.*) osvers=1 ;;
1254 [vt]2\.*) osvers=2 ;;
1255 [vt]3\.*) osvers=3 ;;
1258 hp*) osname=hp_osf1 ;; # TR
1259 mips) osname=mips_osf1 ;; # TR
1260 # TR = Technology Releases: (un^N)supported
1264 $2) case "$osname" in
1266 *) if test -f /etc/systemid; then
1268 : Does anyone know if these next gyrations are needed
1269 set `echo $3 | $sed 's/\./ /g'` $4
1270 if $test -f sco_$1_$2_$3.sh; then
1272 elif $test -f sco_$1_$2.sh; then
1274 elif $test -f sco_$1.sh; then
1283 if test -f /vmunix -a -f news_os.sh; then
1284 (what /vmunix | tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
1285 if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
1288 $rm -f ../UU/kernel.what
1292 : Now look for a hint file osname_osvers
1293 file=`echo "${osname}_${osvers}" | sed -e 's@\.@_@g' -e 's@_$@@'`
1296 *) case "$osvers" in
1299 *) if $test -f $file.sh ; then
1301 elif $test -f "${osname}.sh" ; then
1313 You may give one or more space-separated answers, or "none" if appropriate.
1314 If your OS version has no hints, DO NOT give a wrong version -- say "none".
1317 rp="Which of these apply, if any?"
1320 for file in $tans; do
1321 if $test -f $file.sh; then
1323 $cat $file.sh >> ../UU/config.sh
1324 elif $test X$tans = X -o X$tans = Xnone ; then
1327 : Give one chance to correct a possible typo.
1328 echo "$file.sh does not exist"
1330 rp="hint to use instead?"
1332 for file in $ans; do
1333 if $test -f "$file.sh"; then
1335 $cat $file.sh >> ../UU/config.sh
1336 elif $test X$ans = X -o X$ans = Xnone ; then
1339 echo "$file.sh does not exist -- ignored."
1346 : Remember our hint file for later.
1347 if $test -f "$file.sh" ; then
1359 echo "Fetching default answers from $config_sh..." >&4
1363 cp $config_sh config.sh 2>/dev/null
1373 : Restore computed paths
1374 for file in $loclist $trylist; do
1375 eval $file="\$_$file"
1379 Configure uses the operating system name and version to set some defaults.
1380 Say "none" to leave it blank.
1387 *) dflt=`echo $hintfile | sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
1390 *) dflt="$osname" ;;
1392 rp="Operating system name?"
1403 *) dflt=`echo $hintfile | sed -e 's/\.sh$//' -e 's/^[^_]*//'`
1404 dflt=`echo $dflt | sed -e 's/^_//' -e 's/_/./g'` ;;
1407 *) dflt="$osvers" ;;
1409 rp="Operating system version?"
1415 : who configured the system
1416 cf_time=`$date 2>&1`
1417 cf_by=`( (logname) 2>/dev/null || whoami) 2>&1`
1419 : determine where manual pages are on this system
1423 syspath='/usr/man/man1 /usr/man/man1 /usr/man/mann'
1424 syspath="$syspath /usr/man/manl /usr/man/local/man1"
1425 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
1426 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
1427 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
1428 syspath="$syspath /usr/man/man.L /local/man/man1"
1429 sysman=`./loc . $syspath`
1432 if $test -d "$sysman"; then
1433 echo "System manual is in $sysman." >&4
1435 echo "Could not find manual pages in source form." >&4
1438 : see what memory models we can support
1441 $cat >pdp11.c <<'EOP'
1450 cc -o pdp11 pdp11.c >/dev/null 2>&1
1451 if ./pdp11 2>/dev/null; then
1452 dflt='unsplit split'
1454 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1457 *) if $test -d /lib/small || $test -d /usr/lib/small; then
1462 if $test -d /lib/medium || $test -d /usr/lib/medium; then
1465 if $test -d /lib/large || $test -d /usr/lib/large; then
1468 if $test -d /lib/huge || $test -d /usr/lib/huge; then
1477 Some systems have different model sizes. On most systems they are called
1478 small, medium, large, and huge. On the PDP11 they are called unsplit and
1479 split. If your system doesn't support different memory models, say "none".
1480 If you wish to force everything to one memory model, say "none" here and
1481 put the appropriate flags later when it asks you for other cc and ld flags.
1482 Venix systems may wish to put "none" and let the compiler figure things out.
1483 (In the following question multiple model names should be space separated.)
1486 rp="Which memory models are supported?"
1501 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
1502 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
1509 rp="What flag indicates separate I and D space?"
1517 *large*|*small*|*medium*|*huge*)
1524 rp="What flag indicates large model?"
1534 *huge*) case "$huge" in
1538 rp="What flag indicates huge model?"
1548 *medium*) case "$medium" in
1552 rp="What flag indicates medium model?"
1559 *) medium="$large";;
1562 *small*) case "$small" in
1566 rp="What flag indicates small model?"
1577 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
1581 : make some quick guesses about what we are up against
1583 $echo $n "Hmm... $c"
1591 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
1592 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
1594 echo "Looks kind of like an OSF/1 system, but we'll see..."
1596 elif test `echo abc | tr a-z A-Z` = Abc ; then
1597 xxx=`./loc addbib blurfl $pth`
1598 if $test -f $xxx; then
1599 echo "Looks kind of like a USG system with BSD features, but we'll see..."
1603 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
1604 echo "Looks kind of like an extended USG system, but we'll see..."
1606 echo "Looks kind of like a USG system, but we'll see..."
1610 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
1611 echo "Looks kind of like a BSD system, but we'll see..."
1614 echo "Looks kind of like a Version 7 system, but we'll see..."
1617 case "$eunicefix" in
1620 There is, however, a strange, musty smell in the air that reminds me of
1621 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
1625 : it so happens the Eunice I know will not run shell scripts in Unix format
1629 echo "Congratulations. You aren't running Eunice."
1633 if test -f /xenix; then
1634 echo "Actually, this looks more like a XENIX system..."
1639 echo "It's not Xenix..."
1644 if test -f /venix; then
1645 echo "Actually, this looks more like a VENIX system..."
1652 echo "Nor is it Venix..."
1655 chmod +x bsd usg v7 osf1 eunice xenix venix
1656 $eunicefix bsd usg v7 osf1 eunice xenix venix
1659 : see if we need a special compiler
1667 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
1668 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
1681 On some systems the default C compiler will not resolve multiple global
1682 references that happen to have the same name. On some such systems the "Mcc"
1683 command may be used to force these to be resolved. On other systems a "cc -M"
1684 command is required. (Note that the -M flag on other systems indicates a
1685 memory model to use!) If you have the Gnu C compiler, you might wish to use
1689 rp="What command will force resolution on this system?"
1697 rp="Use which C compiler?"
1702 gcc*) echo "Checking out which version of gcc"
1703 $cat >gccvers.c <<EOM
1716 case '1': printf("1\n"); break;
1717 case '2': printf("2\n"); break;
1718 case '3': printf("3\n"); break;
1728 if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
1729 gccversion=`./gccvers`
1730 echo "You appear to have version $gccversion."
1732 echo "Doesn't appear to be GNU cc."
1735 if $test "$gccversion" = '1'; then
1736 cpp=`./loc gcc-cpp $cpp $pth`
1740 : decide how portable to be
1741 case "$d_portable" in
1747 I can set things up so that your shell scripts and binaries are more portable,
1748 at what may be a noticable cost in performance. In particular, if you
1749 ask to be portable, the following happens:
1751 1) Shell scripts will rely on the PATH variable rather than using
1752 the paths derived above.
1753 2) ~username interpretations will be done at run time rather than
1757 rp="Do you expect to run these scripts and binaries on multiple machines?"
1760 y*) d_portable="$define"
1761 for file in $loclist $trylist; do
1765 *) d_portable="$undef" ;;
1768 : set up shell script to do ~ expansion
1774 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
1777 if $test -f /bin/csh; then
1778 /bin/csh -f -c "glob \$1"
1783 name=\`$expr x\$1 : '..\([^/]*\)'\`
1784 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
1785 if $test ! -d "\$dir"; then
1787 echo "\$me: can't locate home directory for: \$name" >&2
1792 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
1808 : now set up to get a file name
1809 cat <<'EOSC' >getfile
1823 */*) fullpath=true;;
1832 *e*) exp_file=true;;
1837 *d*) type='Directory';;
1838 *l*) type='Locate'; fn=`expr $fn : '.*:\(.*\)'`;;
1843 Locate) what='File';;
1848 case "$d_portable" in
1856 while test "$type"; do
1861 true) rp="$rp (~name ok)";;
1877 value=`UU/filexp $ans`
1880 if test "$ans" != "$value"; then
1881 echo "(That is $value on this particular system.)"
1895 /*) value="$ansexp" ;;
1900 echo "I shall only accept a full path name, as in /bin/ls." >&4
1901 echo "Use a ! shell escape if you wish to check pathnames." >&4
1904 echo "Please give a full path name, starting with slash." >&4
1907 echo "Note that using ~name is ok provided it expands well." >&4
1920 if test -f "$ansexp"; then
1922 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
1924 echo "($value is not a plain file, but that's ok.)"
1929 if test -d "$ansexp"; then
1934 if test -d "$value"; then
1935 echo "(Looking for $fn in directory $value.)"
1938 if test -f "$value"; then
1951 if test "$fastread" = yes; then
1956 rp="$what $value doesn't exist. Use that name anyway?"
1976 : What should the include directory be ?
1978 $echo $n "Hmm... $c"
1980 '') dflt='/usr/include';;
1985 if $test -f /bin/mips && /bin/mips; then
1986 echo "Looks like a MIPS system..."
1987 $cat >usr.c <<'EOCP'
1988 #ifdef SYSTYPE_BSD43
1992 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
1993 dflt='/bsd43/usr/include'
1997 mips_type='System V'
1999 $rm -f usr.c usr.out
2000 echo "and you're compiling with the $mips_type compiler and libraries."
2002 echo "Doesn't look like a MIPS system."
2009 rp='Where are the include files you want to use?'
2013 : determine optimize, if desired, or use for debug flag also
2017 *) dflt="$optimize";;
2021 Some C compilers have problems with their optimizers, by default, $package
2022 compiles with the -O flag to use the optimizer. Alternately, you might want
2023 to use the symbolic debugger, which uses the -g flag (on traditional Unix
2024 systems). Either flag can be specified here. To use neither flag, specify
2028 rp="What optimizer/debugger flag should be used?"
2032 'none') optimize=" ";;
2038 *gcc*) if $test "$gccversion" = "1"; then
2039 dflt='-fpcc-struct-return'
2043 *-g*) dflt="$dflt -DDEBUGGING";;
2046 *gcc*) if test -d /etc/conf/kconfig.d &&
2047 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
2056 case "$mips_type" in
2059 *) inclwanted="$inclwanted $usrinc/bsd";;
2061 for thisincl in $inclwanted; do
2062 if $test -d $thisincl; then
2063 if $test x$thisincl != x$usrinc; then
2066 *) dflt="$dflt -I$thisincl";;
2072 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
2074 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
2082 *) dflt="$dflt -D$2";;
2087 set signal.h __LANGUAGE_C__; eval $inctest
2089 set signal.h LANGUAGE_C; eval $inctest
2091 set signal.h NO_PROTOTYPE; eval $inctest
2092 set signal.h _NO_PROTO; eval $inctest
2099 *) dflt="$ccflags";;
2103 Your C compiler may want other flags. For this question you should include
2104 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
2105 but you should NOT include libraries or ld flags like -lwhatever. If you
2106 want $package to honor its debug switch, you should include -DDEBUGGING here.
2107 To use no flags, specify the word "none".
2109 Your C compiler might also need additional flags, such as -DJMPCLOBBER,
2110 -DHIDEMYMALLOC or -DCRIPPLED_CC.
2115 rp="Any additional cc flags?"
2122 : the following weeds options from ccflags that are of no interest to cpp
2125 *gcc*) case "$gccversion" in
2126 1) cppflags="$cppflags -D__GNUC__" ;;
2130 case "$mips_type" in
2132 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
2141 -D*|-I*|-traditional|-ansi|-nostdinc|-posix|-Xp) cppflags="$cppflags $flag";;
2145 *-*) echo "(C preprocessor flags: $cppflags)";;
2150 : flags used in final linking phase
2158 *) dflt="$ldflags";;
2161 rp="Any additional ld flags (NOT including libraries)?"
2167 rmlist="$rmlist pdp11"
2169 : Initialize h_fcntl
2172 : Initialize h_sysfile
2175 : Set private lib path
2178 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
2181 libpth="$plibpth $libpth"
2182 : Now check and see which directories actually exist.
2186 if $test -d $yyy; then
2192 Some systems have incompatible or broken versions of libraries. Where
2193 should I look for libraries?
2198 rp="Directories to use for library searches?"
2204 : Looking for optional libraries
2206 echo "Checking for optional libraries..." >&4
2211 case "$libswanted" in
2212 '') libswanted='c_s';;
2214 for thislib in $libswanted; do
2218 *) thatlib=${thislib}_s;;
2220 xxx=`./loc lib$thislib.a X $libpth`
2221 yyy=`./loc lib$thatlib.a X $libpth`
2222 zzz=`./loc lib$thislib.so.[0-9]'*' X $libpth`
2223 if $test -f $xxx; then
2224 echo "Found -l$thislib."
2226 *"-l$thislib "*|*-l$thislib|*"-l$thatlib "*|*-l$thatlib) ;;
2227 *) dflt="$dflt -l$thislib";;
2229 elif $test -f $yyy; then
2230 echo "Found -l$thatlib."
2232 *"-l$thatlib "*|*-l$thatlib) ;;
2233 *) dflt="$dflt -l$thatlib";;
2235 elif $test -f $zzz; then
2236 echo "Found -$thislib."
2238 *"-l$thislib "*|*-l$thislib) ;;
2239 *) dflt="$dflt -l$thislib";;
2242 xxx=`./loc Slib$thislib.a X $xlibpth`
2243 yyy=`./loc Slib$thatlib.a X $xlibpth`
2244 if $test -f $xxx; then
2245 echo "Found -l$thislib."
2247 *"-l$thislib "*|*-l$thislib|*"-l$thatlib "*|*-l$thatlib) ;;
2248 *) dflt="$dflt -l$thislib";;
2250 elif $test -f $yyy; then
2251 echo "Found -l$thatlib."
2253 *"-l$thatlib "*|*-l$thatlib) ;;
2254 *) dflt="$dflt -l$thatlib";;
2257 echo "No -l$thislib."
2269 ' '|'') dflt='none';;
2274 Some versions of Unix support shared libraries, which make executables smaller
2275 but make load time slightly longer.
2277 On some systems, mostly newer Unix System V's, the shared library is included
2278 by putting the option "-lc_s" as the last thing on the cc command line when
2279 linking. Other systems use shared libraries by default. There may be other
2280 libraries needed to compile $package on your machine as well. If your system
2281 needs the "-lc_s" option, include it here. Include any other special libraries
2282 here as well. Say "none" for none.
2286 rp="Any additional libraries?"
2293 : see if nm is to be used to determine whether a symbol is defined or not
2296 dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null`
2297 if $test $dflt -gt 20; then
2312 I can use 'nm' to extract the symbols from your C libraries. This is a time
2313 consuming task which may generate huge output on the disk (up to 3 megabytes)
2314 but that should make the symbols extraction faster. The alternative is to skip
2315 the 'nm' extraction part and to compile a small test program instead to
2316 determine whether each symbol is present. If you have a fast C compiler and/or
2317 if your 'nm' output cannot be parsed, this may be the best solution.
2320 rp='Shall I use nm to extract C symbols from the libraries?'
2332 : nm options which may be necessary
2334 '') if $test -f /mach_boot; then
2336 elif $test -d /usr/ccs/lib; then
2338 elif $test -f /dgux; then
2347 : get list of predefined functions in a handy place
2352 *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
2356 libpth="$plibpth $libpth"
2360 *) for thislib in $libs; do
2363 thislib=`expr X$thislib : 'X-l\(.*\)'`
2364 try=`./loc lib$thislib.a blurfl/dyick $libpth`
2365 if test ! -f $try; then
2366 try=`./loc lib$thislib blurfl/dyick $libpth`
2367 if test ! -f $try; then
2368 try=`./loc lib$thislib.so.'*' blurfl/dyick $libpth`
2369 if test ! -f $try; then
2370 try=`./loc $thislib blurfl/dyick $libpth`
2371 if test ! -f $try; then
2372 try=`./loc Slib$thislib.a blurfl/dyick $xlibpth`
2373 if test ! -f $try; then
2380 libnames="$libnames $try"
2382 *) libnames="$libnames $thislib" ;;
2390 set /usr/ccs/lib/libc.so
2391 $test -r $1 || set /usr/lib/libc.so
2392 $test -r $1 || set /usr/shlib/libc.so
2393 $test -r $1 || set /usr/lib/libc.so.[0-9]*
2394 $test -r $1 || set /lib/libsys_s.a
2401 if $test -r "$1"; then
2402 echo "Your (shared) C library seems to be in $1."
2404 elif $test -r /lib/libc && $test -r /lib/clib; then
2405 echo "Your C library seems to be in both /lib/clib and /lib/libc."
2407 libc='/lib/clib /lib/libc'
2408 if $test -r /lib/syslib; then
2409 echo "(Your math library is in /lib/syslib.)"
2410 libc="$libc /lib/syslib"
2412 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
2413 echo "Your C library seems to be in $libc, as you said before."
2414 elif $test -r $incpath/usr/lib/libc.a; then
2415 libc=$incpath/usr/lib/libc.a;
2416 echo "Your C library seems to be in $libc. That's fine."
2417 elif $test -r /lib/libc.a; then
2419 echo "Your C library seems to be in $libc. You're normal."
2421 if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then
2423 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
2424 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
2425 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
2427 elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
2429 elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
2432 tans=`./loc Llibc.a blurfl/dyick $xlibpth`
2434 if $test -r "$tans"; then
2435 echo "Your C library seems to be in $tans, of all places."
2441 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
2445 If the guess above is wrong (which it might be if you're using a strange
2446 compiler, or your machine supports multiple models), you can override it here.
2451 echo $libpth | tr ' ' '\012' | sort | uniq > libpath
2453 I can't seem to find your C library. I've looked in the following places:
2456 $sed 's/^/ /' libpath
2459 None of these seems to contain your C library. I need to get its name...
2464 rp='Where is your C library?'
2469 echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
2470 set X `cat libnames`
2473 case $# in 1) xxx=file; esac
2474 echo "Extracting names from the following $xxx for later perusal:" >&4
2476 $sed 's/^/ /' libnames >&4
2478 $echo $n "This may take a while...$c" >&4
2480 nm $nm_opt $* 2>/dev/null >libc.tmp
2482 $grep fprintf libc.tmp > libc.ptf
2483 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
2484 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
2485 if com="$sed -n -e 's/^.* [ADTS] *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
2487 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
2489 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
2491 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
2493 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
2495 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
2497 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
2499 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
2501 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
2503 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
2505 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
2507 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
2509 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
2510 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
2512 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
2514 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
2516 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
2518 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
2520 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
2523 nm -p $* 2>/dev/null >libc.tmp
2524 com="$sed -n -e 's/^.* [ADTS] *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
2525 eval "<libc.tmp $com >libc.list"
2526 if $contains '^fprintf$' libc.list >/dev/null 2>&1; then
2531 echo "nm didn't seem to work right. Trying ar instead..." >&4
2533 if ar t $libc > libc.tmp; then
2534 for thisname in $libnames; do
2535 ar t $thisname >>libc.tmp
2537 $sed -e 's/\.o$//' < libc.tmp > libc.list
2540 echo "ar didn't seem to work right." >&4
2541 echo "Maybe this is a Cray...trying bld instead..." >&4
2542 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
2543 for thisname in $libnames; do
2545 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
2546 ar t $thisname >>libc.tmp
2550 echo "That didn't work either. Giving up." >&4
2557 if $test -f /lib/syscalls.exp; then
2559 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
2560 $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
2564 $rm -f libnames libpath
2566 : is a C symbol defined?
2569 -v) tf=libc.tmp; tc=""; tdc="";;
2570 -a) tf=libc.tmp; tc="[0]"; tdc=[];;
2571 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
2574 case "$reuseval-$4" in
2576 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
2582 if $contains $tlook $tf >/dev/null 2>&1;
2587 echo "main() { extern int $1$tdc; printf(\"%d\", $1$tc); }" > t.c;
2588 if $cc $ccflags -o t t.c $ldflags $libs >/dev/null 2>&1;
2596 $define) tval=true;;
2602 : set up the script used to warn in case of inconsistency
2606 echo "*** WHOA THERE!!! ***" >&4
2607 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
2608 rp=" Keep the $hint value?"
2611 y) td=$was; tu=$was;;
2615 : define an is-in-libc? function
2616 inlibc='echo " "; td=$define; tu=$undef;
2617 sym=$1; var=$2; eval "was=\$$2";
2619 case "$reuseval$was" in
2629 echo "$sym() found." >&4;
2630 case "$was" in $undef) . whoa; esac; eval "$var=\$td";;
2632 echo "$sym() NOT found." >&4;
2633 case "$was" in $define) . whoa; esac; eval "$var=\$tu";;
2637 $define) echo "$sym() found." >&4;;
2638 *) echo "$sym() NOT found." >&4;;
2642 : see how we invoke the C preprocessor
2644 echo "Now, how can we feed standard input to your C preprocessor..." >&4
2645 cat <<'EOT' >testcpp.c
2651 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
2653 wrapper=`pwd`/cppstdin
2657 if $test "X$cppstdin" != "X" && \
2658 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
2659 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2661 echo "You used to use $cppstdin $cppminus so we'll use that again."
2663 '') echo "But let's see if we can live without a wrapper..." ;;
2665 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
2666 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2668 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
2671 echo "(However, $cpprun $cpplast does not work, let's see...)"
2679 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
2686 elif echo 'Maybe "'"$cc"' -E" will work...'; \
2687 $cc -E <testcpp.c >testcpp.out 2>&1; \
2688 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2689 echo "Yup, it does."
2692 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
2693 $cc -E - <testcpp.c >testcpp.out 2>&1; \
2694 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2695 echo "Yup, it does."
2698 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
2699 $cc -P <testcpp.c >testcpp.out 2>&1; \
2700 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2701 echo "Yipee, that works!"
2704 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
2705 $cc -P - <testcpp.c >testcpp.out 2>&1; \
2706 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2707 echo "At long last!"
2710 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
2711 $cpp <testcpp.c >testcpp.out 2>&1; \
2712 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2716 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
2717 $cpp - <testcpp.c >testcpp.out 2>&1; \
2718 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2719 echo "Hooray, it works! I was beginning to wonder."
2722 elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
2723 $wrapper <testcpp.c >testcpp.out 2>&1; \
2724 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2730 rp="No dice. I can't find a C preprocessor. Name one:"
2734 $x_cpp <testcpp.c >testcpp.out 2>&1
2735 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2736 echo "OK, that will do." >&4
2738 echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
2753 echo "Perhaps can we force $cc -E using a wrapper..."
2754 if $wrapper <testcpp.c >testcpp.out 2>&1; \
2755 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2761 echo "Nope, we'll have to live without it..."
2776 *) $rm -f $wrapper;;
2778 $rm -f testcpp.c testcpp.out
2780 : determine filename position in cpp output
2782 echo "Computing filename position in cpp output for #include directives..." >&4
2783 echo '#include <stdio.h>' > foo.c
2786 $cppstdin $cppminus $cppflags <foo.c 2>/dev/null | \
2787 $grep '^[ ]*#.*stdio\.h' | \
2788 while read cline; do
2791 while $test \$# -gt 0; do
2792 if $test -r \`echo \$1 | $tr -d '"'\`; then
2797 pos=\`expr \$pos + 1\`
2809 *) pos="${fieldn}th";;
2811 echo "Your cpp writes the filename in the $pos field of the line."
2813 : locate header file
2818 if test -f $usrinc/\$wanted; then
2819 echo "$usrinc/\$wanted"
2822 awkprg='{ print \$$fieldn }'
2823 echo "#include <\$wanted>" > foo\$\$.c
2824 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
2825 $grep "^[ ]*#.*\$wanted" | \
2826 while read cline; do
2827 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
2829 */\$wanted) echo "\$name"; exit 0;;
2840 : access call always available on UNIX
2844 : locate the flags for 'access()'
2848 $cat >access.c <<'EOCP'
2849 #include <sys/types.h>
2854 #include <sys/file.h>
2863 : check sys/file.h first, no particular reason here
2864 if $test `./findhdr sys/file.h` && \
2865 $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then
2867 echo "<sys/file.h> defines the *_OK access constants." >&4
2868 elif $test `./findhdr fcntl.h` && \
2869 $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then
2871 echo "<fcntl.h> defines the *_OK access constants." >&4
2872 elif $test `./findhdr unistd.h` && \
2873 $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then
2874 echo "<unistd.h> defines the *_OK access constants." >&4
2876 echo "I can't find the four *_OK access constants--I'll use mine." >&4
2882 : see if bcmp exists
2886 : see if bcopy exists
2890 : see if bzero exists
2894 : check for length of integer
2898 echo "Checking to see how big your integers are..." >&4
2899 $cat >try.c <<'EOCP'
2903 printf("%d\n", sizeof(int));
2906 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
2910 echo "(I can't seem to compile the test program. Guessing...)"
2917 rp="What is the size of an integer (in bytes)?"
2922 : function used to set $1 to $val
2923 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
2925 $define$undef) . whoa; eval "$var=\$td";;
2926 $undef$define) . whoa; eval "$var=\$tu";;
2927 *) eval "$var=$val";;
2930 : check for ability to cast large floats to 32-bit ints.
2932 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
2933 if $test "$intsize" -eq 4; then
2940 #include <sys/types.h>
2942 blech() { exit(3); }
2948 signal(SIGFPE, blech);
2950 f = (double) 0x7fffffff;
2954 if (i32 != ( $xxx )f)
2959 if $cc -o try $ccflags try.c >/dev/null 2>&1; then
2970 echo "Nope, it can't."
2976 : check for ability to cast negative floats to unsigned
2978 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
2979 $cat >try.c <<'EOCP'
2981 blech() { exit(3); }
2985 unsigned long along;
2987 unsigned short ashort;
2990 signal(SIGFPE, blech);
2991 along = (unsigned long)f;
2992 aint = (unsigned int)f;
2993 ashort = (unsigned short)f;
2994 if (along != (unsigned long)-123)
2996 if (aint != (unsigned int)-123)
2998 if (ashort != (unsigned short)-123)
3000 f = (double)0x40000000;
3003 along = (unsigned long)f;
3004 if (along != 0x80000000)
3008 along = (unsigned long)f;
3009 if (along != 0x7fffffff)
3013 along = (unsigned long)f;
3014 if (along != 0x80000001)
3020 if $cc -o try $ccflags try.c >/dev/null 2>&1; then
3026 case "$castflags" in
3031 echo "Nope, it can't."
3038 : see if sprintf is declared as int or pointer to char
3040 $cat >ucbsprf.c <<'EOF'
3045 exit((unsigned long)sprintf(buf,"%s","foo") > 10L);
3048 if $cc ucbsprf.c -o ucbsprf >/dev/null 2>&1 && ./ucbsprf; then
3049 echo "Your sprintf() returns (int)." >&4
3052 echo "Your sprintf() returns (char*)." >&4
3059 : see if vprintf exists
3061 if set vprintf val -f d_vprintf; eval $csym; $val; then
3062 echo 'vprintf() found.' >&4
3064 $cat >vprintf.c <<'EOF'
3065 #include <varargs.h>
3067 main() { xxx("foo"); }
3076 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
3079 if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
3080 echo "Your vsprintf() returns (int)." >&4
3083 echo "Your vsprintf() returns (char*)." >&4
3087 echo 'vprintf() NOT found.' >&4
3097 : see if chsize exists
3101 : check for const keyword
3103 echo 'Checking to see if your C compiler knows about "const"...' >&4
3104 $cat >const.c <<'EOCP'
3105 typedef struct spug { int drokk; } spug;
3112 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
3114 echo "Yup, it does."
3117 echo "Nope, it doesn't."
3122 : see if crypt exists
3124 if set crypt val -f d_crypt; eval $csym; $val; then
3125 echo 'crypt() found.' >&4
3129 cryptlib=`./loc Slibcrypt.a "" $xlibpth`
3130 if $test -z "$cryptlib"; then
3131 cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
3135 if $test -z "$cryptlib"; then
3136 cryptlib=`./loc Llibcrypt.a "" $xlibpth`
3140 if $test -z "$cryptlib"; then
3141 cryptlib=`./loc libcrypt.a "" $libpth`
3145 if $test -z "$cryptlib"; then
3146 echo 'crypt() NOT found.' >&4
3155 : get csh whereabouts
3157 'csh') val="$undef" ;;
3163 : see if this is a dirent system
3165 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
3167 echo "<dirent.h> found." >&4
3170 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
3171 echo "<sys/dir.h> found." >&4
3174 xinc=`./findhdr sys/ndir.h`
3176 echo "<dirent.h> NOT found." >&4
3181 : see if the directory entry stores field length
3183 if $contains 'd_namlen' $xinc >/dev/null 2>&1; then
3184 echo "Good, your directory entry keeps length information in d_namlen." >&4
3187 echo "Your directory entry does not know about the d_namlen field." >&4
3193 : now see if they want to do setuid emulation
3201 Some sites have disabled setuid #! scripts because of a bug in the kernel
3202 that prevents them from being secure. If you are on such a system, the
3203 setuid/setgid bits on scripts are currently useless. It is possible for
3204 $package to detect those bits and emulate setuid/setgid in a secure fashion
3205 until a better solution is devised for the kernel problem.
3208 rp="Do you want to do setuid/setgid emulation?"
3211 y*) d_dosuid="$define";;
3212 *) d_dosuid="$undef";;
3215 : see if dup2 exists
3219 : see if fchmod exists
3223 : see if fchown exists
3227 : see if this is an fcntl system
3231 : see if we can have long filenames
3233 rmlist="$rmlist /tmp/cf$$"
3234 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
3235 first=123456789abcdef
3236 second=/tmp/cf$$/$first
3237 $rm -f $first $second
3238 if (echo hi >$first) 2>/dev/null; then
3239 if $test -f 123456789abcde; then
3240 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
3243 if (echo hi >$second) 2>/dev/null; then
3244 if $test -f /tmp/cf$$/123456789abcde; then
3246 That's peculiar... You can have filenames longer than 14 characters, but only
3247 on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
3248 I shall consider your system cannot support long filenames at all.
3252 echo 'You can have filenames longer than 14 characters.' >&4
3257 How confusing! Some of your filesystems are sane enough to allow filenames
3258 longer than 14 characters but some others like /tmp can't even think about them.
3259 So, for now on, I shall assume your kernel does not allow them at all.
3266 You can't have filenames longer than 14 chars. You can't even think about them!
3272 $rm -rf /tmp/cf$$ 123456789abcde*
3274 : see if flock exists
3278 : see if gethostent exists
3279 set gethostent d_gethent
3282 : see if getpgrp exists
3283 set getpgrp d_getpgrp
3286 : see if getpgrp2 exists
3287 set getpgrp2 d_getpgrp2
3290 : see if getpriority exists
3291 set getpriority d_getprior
3294 : define an alternate in-header-list? function
3295 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
3296 cont=true; xxf="echo \"<\$1> found.\" >&4";
3297 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
3298 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
3300 case $# in 4) instead=instead;; *) instead="at last";; esac;
3301 while $test "$cont"; do
3303 var=$2; eval "was=\$$2";
3304 if $test "$xxx" && $test -r "$xxx";
3306 eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
3309 eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi;
3310 set $yyy; shift; shift; yyy=$@;
3311 case $# in 0) cont="";;
3312 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
3313 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
3314 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
3315 xxnf="echo \"there is no <\$1>, ...\" >&4";;
3319 do set $yyy; var=$2; eval "was=\$$2";
3320 eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu";
3321 set $yyy; shift; shift; yyy=$@;
3324 : see if this is a netinet/in.h or sys/in.h system
3325 set netinet/in.h i_niin sys/in.h i_sysin
3328 : see if htonl --and friends-- exists
3331 : Maybe they are macros.
3334 *) cat > try.c <<EOM
3336 #include <sys/types.h>
3337 #$i_niin I_NETINET_IN
3340 # include <netinet/in.h>
3343 # include <sys/in.h>
3348 printf("x = ", htonl(7));
3351 if $cc $ccflags -c try.c >/dev/null 2>&1; then
3353 echo "But it seems to be defined as a macro."
3360 $cat >isascii.c <<'EOCP'
3371 if $cc $cppflags -o isascii isascii.c >/dev/null 2>&1 ; then
3372 echo "isascii() found."
3375 echo "isascii() NOT found."
3381 : see if killpg exists
3385 : see if link exists
3389 : see if lstat exists
3393 : see if memcmp exists
3397 : see if memcpy exists
3401 : see if memmove exists
3402 set memmove d_memmove
3405 : see if memset exists
3409 : see if mkdir exists
3413 : see if msgctl exists
3417 : see if msgget exists
3421 : see if msgsnd exists
3425 : see if msgrcv exists
3429 : see how much of the 'msg*(2)' library is present.
3432 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
3433 *"$undef"*) h_msg=false;;
3435 : we could also check for sys/ipc.h ...
3436 if $h_msg && $test `./findhdr sys/msg.h`; then
3437 echo "You have the full msg*(2) library." >&4
3440 echo "You don't have the full msg*(2) library." >&4
3446 : determine which malloc to compile in
3447 : Old versions had dflt='y' only for bsd or v7.
3449 case "$usemymalloc" in
3457 *) dflt="$usemymalloc"
3460 rp="Do you wish to attempt to use the malloc that comes with $package?"
3464 y*) mallocsrc='malloc.c'
3465 mallocobj='malloc.o'
3466 d_mymalloc="$define"
3474 : compute the type returned by malloc
3476 case "$malloctype" in
3478 if $test `./findhdr malloc.h`; then
3479 echo "#include <malloc.h>" > malloc.c
3482 $cat >>malloc.c <<'END'
3485 if $cc $ccflags -c malloc.c >/dev/null 2>&1; then
3493 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
3497 : see whether socket exists
3499 $echo $n "Hmm... $c" >&4
3500 if set socket val -f d_socket; eval $csym; $val; then
3501 echo "Looks like you have Berkeley networking support." >&4
3503 if set setsockopt val -f; eval $csym; $val; then
3506 echo "...but it uses the old 4.1c interface, rather than 4.2" >&4
3510 if $contains socklib libc.list >/dev/null 2>&1; then
3511 echo "Looks like you have Berkeley networking support." >&4
3513 : we will have to assume that it supports the 4.2 BSD interface
3516 echo "You don't have Berkeley networking in libc.a..." >&4
3517 if test -f /usr/lib/libnet.a; then
3518 ( (nm $nm_opt /usr/lib/libnet.a | eval $nm_extract) || \
3519 ar t /usr/lib/libnet.a) 2>/dev/null >> libc.list
3520 if $contains socket libc.list >/dev/null 2>&1; then
3521 echo "...but the Wollongong group seems to have hacked it in." >&4
3523 sockethdr="-I/usr/netinclude"
3525 if $contains setsockopt libc.list >/dev/null 2>&1; then
3528 echo "...using the old 4.1c interface, rather than 4.2" >&4
3532 echo "or even in libnet.a, which is peculiar." >&4
3537 echo "or anywhere else I see." >&4
3544 : see if socketpair exists
3545 set socketpair d_sockpair
3548 : Locate the flags for 'open()'
3550 $cat >open3.c <<'EOCP'
3551 #include <sys/types.h>
3556 #include <sys/file.h>
3567 : check sys/file.h first to get FREAD on Sun
3568 if $test `./findhdr sys/file.h` && \
3569 $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
3571 echo "<sys/file.h> defines the O_* constants..." >&4
3573 echo "and you have the 3 argument form of open()." >&4
3576 echo "but not the 3 argument form of open(). Oh, well." >&4
3579 elif $test `./findhdr fcntl.h` && \
3580 $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
3582 echo "<fcntl.h> defines the O_* constants..." >&4
3584 echo "and you have the 3 argument form of open()." >&4
3587 echo "but not the 3 argument form of open(). Oh, well." >&4
3592 echo "I can't find the O_* constant definitions! You got problems." >&4
3598 : see if this is a pwd system
3600 xxx=`./findhdr pwd.h`
3601 if $test "$xxx"; then
3603 echo "<pwd.h> found." >&4
3604 $cppstdin $cppflags $cppminus < $xxx >$$.h
3605 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
3610 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
3615 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
3616 d_pwchange="$define"
3620 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
3625 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
3626 d_pwexpire="$define"
3630 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
3631 d_pwcomment="$define"
3633 d_pwcomment="$undef"
3643 d_pwcomment="$undef"
3644 echo "<pwd.h> NOT found." >&4
3647 : see if readdir and friends exist
3648 set readdir d_readdir
3650 set seekdir d_seekdir
3652 set telldir d_telldir
3654 set rewinddir d_rewinddir
3657 : see if rename exists
3661 : see if rmdir exists
3665 : can bcopy handle overlapping blocks?
3670 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
3671 $cat >foo.c <<'EOCP'
3674 char buf[128], abc[128];
3679 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
3681 for (align = 7; align >= 0; align--) {
3682 for (len = 36; len; len--) {
3685 for (off = 1; off <= len; off++) {
3686 bcopy(b, b+off, len);
3687 bcopy(b+off, b, len);
3688 if (bcmp(b, abc, len))
3696 if $cc foo.c -o safebcpy $ccflags $libs >/dev/null 2>&1 ; then
3697 if ./safebcpy 2>/dev/null; then
3701 echo "It can't, sorry."
3704 echo "(I can't compile the test program, so we'll assume not...)"
3708 $rm -f foo.* safebcpy core
3712 : can memcpy handle overlapping blocks?
3717 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
3718 $cat >foo.c <<'EOCP'
3721 char buf[128], abc[128];
3727 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
3729 for (align = 7; align >= 0; align--) {
3730 for (len = 36; len; len--) {
3732 memcpy(abc, b, len);
3733 for (off = 1; off <= len; off++) {
3734 memcpy(b, b+off, len);
3735 memcpy(b+off, b, len);
3736 if (memcmp(b, abc, len))
3744 if $cc foo.c -o safemcpy $ccflags $libs >/dev/null 2>&1 ; then
3745 if ./safemcpy 2>/dev/null; then
3749 echo "It can't, sorry."
3752 echo "(I can't compile the test program, so we'll assume not...)"
3756 $rm -f foo.* safemcpy core
3760 : see if select exists
3764 : see if semctl exists
3768 : see if semget exists
3772 : see if semop exists
3776 : see how much of the 'sem*(2)' library is present.
3779 case "$d_semctl$d_semget$d_semop" in
3780 *"$undef"*) h_sem=false;;
3782 : we could also check for sys/ipc.h ...
3783 if $h_sem && $test `./findhdr sys/sem.h`; then
3784 echo "You have the full sem*(2) library." >&4
3787 echo "You don't have the full sem*(2) library." >&4
3793 : see if setegid exists
3794 set setegid d_setegid
3797 : see if seteuid exists
3798 set seteuid d_seteuid
3801 : see if setlocale exists
3802 set setlocale d_setlocale
3804 : see if setpgid exists
3805 set setpgid d_setpgid
3808 : see if setpgrp exists
3809 set setpgrp d_setpgrp
3812 : see if setpgrp2 exists
3813 set setpgrp2 d_setpgrp2
3816 : see if setpriority exists
3817 set setpriority d_setprior
3820 : see if setregid exists
3821 set setregid d_setregid
3823 set setresgid d_setresgid
3826 : see if setreuid exists
3827 set setreuid d_setreuid
3829 set setresuid d_setresuid
3832 : see if setrgid exists
3833 set setrgid d_setrgid
3836 : see if setruid exists
3837 set setruid d_setruid
3840 : see if setsid exists
3844 : see if shmctl exists
3848 : see if shmget exists
3852 : see if shmat exists
3855 : see what shmat returns
3856 d_voidshmat="$undef"
3859 $cppstdin $cppflags $cppminus < $usrinc/sys/shm.h >voidshmat.txt 2>/dev/null
3860 if $contains "void.*shmat" voidshmat.txt >/dev/null 2>&1; then
3861 echo "and shmat returns (void*)"
3862 d_voidshmat="$define"
3864 echo "and shmat returns (char*)"
3868 : see if shmdt exists
3872 : see how much of the 'shm*(2)' library is present.
3875 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
3876 *"$undef"*) h_shm=false;;
3878 : we could also check for sys/ipc.h ...
3879 if $h_shm && $test `./findhdr sys/shm.h`; then
3880 echo "You have the full shm*(2) library." >&4
3883 echo "You don't have the full shm*(2) library." >&4
3889 : see if stat knows about block sizes
3891 xxx=`./findhdr sys/stat.h`
3892 if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then
3893 if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then
3894 echo "Your stat() knows about block sizes." >&4
3897 echo "Your stat() doesn't know about block sizes." >&4
3901 echo "Your stat() doesn't know about block sizes." >&4
3907 : see if stdio is really std
3909 xxx=`./findhdr stdio.h`
3910 if $contains 'char.*_ptr;' "$xxx" >/dev/null 2>&1 ; then
3911 if $contains '_cnt;' "$xxx" >/dev/null 2>&1 ; then
3912 echo "Your stdio is pretty std." >&4
3915 echo "Your stdio isn't very std." >&4
3919 echo "Your stdio isn't very std." >&4
3925 : see which of string.h or strings.h is needed
3927 strings=`./findhdr string.h`
3928 if $test "$strings" && $test -r "$strings"; then
3929 echo "Using <string.h> instead of <strings.h>." >&4
3933 strings=`./findhdr strings.h`
3934 if $test "$strings" && $test -r "$strings"; then
3935 echo "Using <strings.h> instead of <string.h>." >&4
3937 echo "No string header found -- You'll surely have problems." >&4
3943 "$undef") strings=`./findhdr strings.h`;;
3944 *) strings=`./findhdr string.h`;;
3949 if set index val -f; eval $csym; $val; then
3950 if set strchr val -f d_strchr; eval $csym; $val; then
3951 if $contains strchr "$strings" >/dev/null 2>&1 ; then
3954 echo "strchr() found." >&4
3958 echo "index() found." >&4
3963 echo "index() found." >&4
3966 if set strchr val -f d_strchr; eval $csym; $val; then
3969 echo "strchr() found." >&4
3971 echo "No index() or strchr() found!" >&4
3976 set d_strchr; eval $setvar
3978 set d_index; eval $setvar
3980 : check for structure copying
3982 echo "Checking to see if your C compiler can copy structs..." >&4
3983 $cat >try.c <<'EOCP'
3993 if $cc -c try.c >/dev/null 2>&1 ; then
3998 echo "Nope, it can't."
4004 : see if strerror and/or sys_errlist[] exist
4006 if set strerror val -f d_strerror; eval $csym; $val; then
4007 echo 'strerror() found.' >&4
4008 d_strerror="$define"
4010 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
4011 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
4012 d_syserrlst="$define"
4014 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
4015 d_syserrlst="$undef"
4017 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
4018 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
4019 echo 'strerror() found in string header.' >&4
4020 d_strerror="$define"
4022 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
4023 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
4024 d_syserrlst="$define"
4026 echo "(You don't appear to have any sys_errlist[], how can this be?)"
4027 d_syserrlst="$undef"
4029 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
4030 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
4032 d_syserrlst="$define"
4035 echo 'strerror() and sys_errlist[] NOT found.' >&4
4037 d_syserrlst="$undef"
4041 : see if symlink exists
4042 set symlink d_symlink
4045 : see if syscall exists
4046 set syscall d_syscall
4049 : see if system exists
4053 : see if times exists
4055 if set times val -f d_times; eval $csym; $val; then
4056 echo 'times() found.' >&4
4058 case "$clocktype" in
4060 if $contains 'clock_t;' `./findhdr sys/types.h` >/dev/null 2>&1 ; then
4062 elif $contains 'clock_t;' `./findhdr sys/times.h` >/dev/null 2>&1; then
4068 *) dflt="$clocktype"
4072 rp="What type is returned by times() on this sytem?"
4076 echo 'times() not found, hope that will do.' >&4
4081 : see if truncate exists
4082 set truncate d_truncate
4085 : see if we have to deal with yellow pages, now NIS.
4086 if $test -d /usr/etc/yp || $test -d /etc/yp; then
4087 if $test -f /usr/etc/nibindd; then
4089 echo "I'm fairly confident you're on a NeXT."
4091 rp='Do you get the hosts file via NetInfo?'
4100 y*) hostcat='nidump hosts .';;
4101 *) hostcat='cat /etc/hosts';;
4109 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
4117 rp='Are you getting the hosts file via yellow pages?'
4120 y*) hostcat='ypcat hosts';;
4121 *) hostcat='cat /etc/hosts';;
4127 : now get the host name
4129 echo "Figuring out host name..." >&4
4130 case "$myhostname" in
4132 echo 'Maybe "hostname" will work...'
4133 if tans=`sh -c hostname 2>&1` ; then
4141 if $test "$cont"; then
4143 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
4144 if tans=`cat /etc/systemid 2>&1` ; then
4146 phostname='cat /etc/systemid'
4147 echo "Whadyaknow. Xenix always was a bit strange..."
4150 elif $test -r /etc/systemid; then
4151 echo "(What is a non-Xenix system doing with /etc/systemid?)"
4154 if $test "$cont"; then
4155 echo 'No, maybe "uuname -l" will work...'
4156 if tans=`sh -c 'uuname -l' 2>&1` ; then
4158 phostname='uuname -l'
4160 echo 'Strange. Maybe "uname -n" will work...'
4161 if tans=`sh -c 'uname -n' 2>&1` ; then
4163 phostname='uname -n'
4165 echo 'Oh well, maybe I can mine it out of whoami.h...'
4166 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
4167 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
4168 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
4170 case "$myhostname" in
4171 '') echo "Does this machine have an identity crisis or something?"
4174 echo "Well, you said $myhostname before..."
4175 phostname='echo $myhostname';;
4181 : you do not want to know about this
4185 : translate upper to lower if necessary
4186 case "$myhostname" in
4188 myhostname=`echo $myhostname | tr '[A-Z]' '[a-z]'`
4189 echo "(Normalizing case in your host name)"
4194 if $test "$myhostname" ; then
4196 rp='Your host name appears to be "'$myhostname'".'" Right?"
4204 : bad guess or no guess
4205 while $test "X$myhostname" = X ; do
4207 rp="Please type the (one word) name of your host:"
4212 : a little sanity check here
4213 case "$phostname" in
4216 case `$phostname` in
4217 $myhostname$mydomain|$myhostname) ;;
4219 case "$phostname" in
4221 echo "(That doesn't agree with your whoami.h file, by the way.)"
4224 echo "(That doesn't agree with your $phostname command, by the way.)"
4232 : see how we will look up host name
4235 : dummy stub to allow use of elif
4236 elif set uname val -f d_uname; eval $csym; $val; then
4239 uname() was found, but you're running xenix, and older versions of xenix
4240 have a broken uname(). If you don't really know whether your xenix is old
4241 enough to have a broken system call, use the default answer.
4248 rp='Is your uname() broken?'
4251 n*) d_uname="$define"; call=uname;;
4254 echo 'uname() found.' >&4
4259 case "$d_gethname" in
4260 '') d_gethname="$undef";;
4263 '') d_uname="$undef";;
4265 case "$d_phostname" in
4266 '') d_phostname="$undef";;
4269 : see if there is a vfork
4272 : But do we want to use it. vfork is reportedly unreliable in
4273 : perl in Solaris 2.x, and probably elsewhere.
4277 rp="Some systems have problems with vork. Do you want to use it?"
4281 *) echo "Ok, we won't use vfork."
4287 : see if signal is declared as pointer to function returning int or void
4289 xxx=`./findhdr signal.h`
4290 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
4291 if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
4292 echo "You have int (*signal())() instead of void." >&4
4295 elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
4296 echo "You have void (*signal())() instead of int." >&4
4299 elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
4300 echo "You have int (*signal())() instead of void." >&4
4304 case "$d_voidsig" in
4306 echo "I can't determine whether signal handler returns void or int..." >&4
4308 rp="What type does your signal handler returns?"
4311 void) val="$define"; signal_t="void";;
4312 *) val="$undef"; signal_t="int";;
4314 *) echo "As you already told me, signal handler returns $signal_t." >&4;;
4321 : check for volatile keyword
4323 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
4324 $cat >try.c <<'EOCP'
4327 typedef struct _goo_struct goo_struct;
4328 goo_struct * volatile goo = ((goo_struct *)0);
4329 struct _goo_struct {
4334 typedef unsigned short foo_t;
4337 volatile foo_t blech;
4341 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
4343 echo "Yup, it does."
4346 echo "Nope, it doesn't."
4352 : see if there is a wait4
4356 : see if waitpid exists
4357 set waitpid d_waitpid
4360 : preserve RCS keywords in files with variable substitution, grrr
4365 Revision='$Revision'
4369 if test -d /afs; then
4370 echo "AFS may be running... I'll be extra cautious then..." >&4
4373 echo "AFS does not seem to be running..." >&4
4377 : determine where public executables go
4381 dflt=`./loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
4388 rp='Pathname where the public executables will reside?'
4395 Since you are running AFS, I need to distinguish the directory in which
4396 executables reside from the directory in which they are installed (and from
4397 which they are presumably copied to the former directory by occult means).
4400 case "$installbin" in
4401 '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
4402 *) dflt="$installbin";;
4405 rp='Where will public executables be installed?'
4409 installbin="$binexp"
4412 : check for ordering of bytes in a long
4413 case "$byteorder" in
4417 In the following, larger digits indicate more significance. A big-endian
4418 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
4419 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
4420 machines may have weird orders like 3412. A Cray will report 87654321. If
4421 the test program works the default is probably right.
4422 I'm now running the test program...
4424 $cat >try.c <<'EOCP'
4431 char c[sizeof(long)];
4434 if (sizeof(long) > 4)
4435 u.l = (0x08070605L << 32) | 0x04030201L;
4438 for (i = 0; i < sizeof(long); i++)
4439 printf("%c", u.c[i]+'0');
4443 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
4446 ????|????????) echo "(The test program ran ok.)";;
4447 *) echo "(The test program didn't run right for some reason.)";;
4452 (I can't seem to compile the test program. Guessing big-endian...)
4461 rp="What is the order of bytes in a long?"
4466 : see if dlfcn is available
4469 : determine which dynamic loading, if any, to compile in
4472 '') case "$i_dlfcn" in
4476 : Does a dl.c file exist for this operating system
4477 $test -f ../ext/dl/dl_${osname}.c && dflt='y'
4479 define|y|true) dflt='y'
4485 rp="Do you wish to attempt to use dynamic loading?"
4490 if $test -f ../ext/dl/dl_${osname}.c ; then
4491 dflt="ext/dl/dl_${osname}.c"
4495 echo "The following dynamic loading files are available:"
4496 cd ..; ls -C ext/dl/dl*.c; cd UU
4497 rp="Source file to use for dynamic loading"
4500 : emulate basename and dirname
4501 xxx=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@' -e 's@\.c$@@'`
4504 dldir=`echo $ans | $sed 's@\(.*\)/[^/]*$@\1@'`
4509 if $test -f ../$dldir/$dlsrc; then
4512 echo "File $dlsrc does not exist -- ignored"
4518 Some systems may require passing special flags to $cc -c to
4519 compile modules that will be used to create a shared library.
4520 To use no flags, say "none".
4522 case "$cccdlflags" in
4523 ''|' ') case "$osname" in
4525 next) dflt='none' ;;
4526 sunos) dflt='none' ;;
4530 *) dflt="$cccdlflags" ;;
4532 rp="Any special flags to pass to $cc -c to compile shared library modules?"
4535 none) cccdlflags='' ;;
4536 *) cccdlflags="$ans" ;;
4541 Some systems may require passing special flags to ld to
4542 create a shared library. To use no flags, say "none".
4544 case "$lddlflags" in
4545 ''|' ') case "$osname" in
4547 next) dflt='none' ;;
4548 sunos) dflt='none' ;;
4552 *) dflt="$lddlflags" ;;
4554 rp="Any special flags to pass to ld to create a shared library?"
4557 none) lddlflags='' ;;
4558 *) lddlflags="$ans" ;;
4563 Some systems may require passing special flags to $cc to indicate that
4564 dynamic linking will be used. To use no flags, say "none".
4566 case "$ccdlflags" in
4569 hpux) dflt='none' ;;
4570 next) dflt='none' ;;
4571 sunos) dflt='none' ;;
4575 *) dflt="$ccdlflags"
4578 rp="Any special flags to pass to $cc to use dynamic loading?"
4581 none) ccdlflags='' ;;
4582 *) ccdlflags="$ans" ;;
4586 Some systems may require using a special suffix for shared libraries.
4587 To create the shared library for POSIX, for example, you may need to
4588 actually build the file POSIX.so.
4591 case "$shlibsuffix" in
4596 sunos) dflt='.so' ;;
4600 *) dflt="$shlibsuffix"
4603 rp="What is the suffix used for shared libraries?"
4606 none) shlibsuffix='' ;;
4607 *) shlibsuffix="$ans" ;;
4611 : These are currently not used.
4620 : see if we have the old dbm
4624 : see if ndbm.h is available
4628 : see if gdbm.h is available
4632 : see if sdbm.h is wanted
4634 echo "$package includes an implementation of sdbm in ext/dbm/sdbm."
4636 ''|' ') val="$define" ;;
4641 case "$extensions" in
4642 ' '|'') echo "Looking for extensions..."
4646 extensions=`$find ext -type f -name \*.xs -print`
4652 *) extensions='ext/dbm/NDBM_File.xs ext/dbm/ODBM_File.xs ext/dbm/GDBM_File.xs ext/dbm/SDBM_File.xs ext/posix/POSIX.xs'
4656 none) extensions='' ;;
4659 : Now see which are supported on this system.
4661 for xxx in $extensions ; do
4663 *ODBM*) case "$i_dbm" in
4664 define) dflt="$dflt $xxx" ;;
4668 *NDBM*) case "$i_ndbm" in
4669 define) dflt="$dflt $xxx" ;;
4673 *GDBM*) case "$i_gdbm" in
4674 define) dflt="$dflt $xxx" ;;
4678 *SDBM*) case "$i_sdbm" in
4679 define) dflt="$dflt $xxx" ;;
4683 *) dflt="$dflt $xxx"
4688 rp="What extensions do you wish to include?"
4692 : see what type gids are declared as in the kernel
4695 if $contains 'gid_t;' `./findhdr sys/types.h` >/dev/null 2>&1 ; then
4698 xxx=`./findhdr sys/user.h`
4699 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
4701 unsigned) dflt="$1 $2" ;;
4706 *) dflt="$gidtype";;
4709 rp="What is the type for group ids returned by getgid()?"
4714 : see if getgroups exists
4715 set getgroups d_getgrps
4718 case "$d_getgrps" in
4720 case "$groupstype" in
4721 '') dflt="$gidtype" ;;
4722 *) dflt="$groupstype" ;;
4726 What is the type of the second argument to getgroups()? Usually this
4727 is the same as group ids, $gidtype, but not always.
4729 rp="What type is the second arguement to getgroups()?"
4737 : determine where private executables go
4740 dflt=/usr/lib/$package
4741 $test -d /usr/local/lib && dflt=/usr/local/lib/$package
4742 $test -d /local/lib && dflt=/local/lib/$package
4749 There are some auxiliary files for $package that need to be put into a
4750 private library directory that is accessible by everyone.
4754 rp='Pathname where private library files will reside?'
4757 privlibexp="$ansexp"
4761 Since you are running AFS, I need to distinguish the directory in which
4762 private files reside from the directory in which they are installed (and from
4763 which they are presumably copied to the former directory by occult means).
4766 case "$installprivlib" in
4767 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
4768 *) dflt="$installprivlib";;
4771 rp='Where will private files be installed?'
4773 installprivlib="$ans"
4775 installprivlib="$privlibexp"
4778 : determine where public libraries go
4780 '') dflt=`./loc . "." /usr/local/lib /usr/lib /lib`;;
4785 rp='Where do you want to put the public libraries?'
4790 : determine whether symbolic links are supported
4792 if $ln -s blurfl sym > /dev/null 2>&1 ; then
4798 : see what type lseek is declared as in the kernel
4799 case "$lseektype" in
4801 if $contains 'off_t;' `./findhdr sys/types.h` >/dev/null 2>&1 ; then
4807 *) dflt="$lseektype"
4811 rp="What type is lseek's offset on this system declared as?"
4815 : determine where manual pages go
4818 $package has manual pages available in source form.
4822 echo "However, you don't have nroff, so they're probably useless to you."
4827 echo "If you don't want the manual sources installed, answer 'none'."
4830 lookpath='/usr/local/man/man1 /usr/local/man/man1 /usr/man/manl'
4831 lookpath="$lookpath /usr/man/local/man1 /usr/man/l_man/man1"
4832 lookpath="$lookpath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
4833 lookpath="$lookpath /usr/man/man.L"
4834 mansrc=`./loc . $lookpath`
4835 if $test -d "$mansrc"; then
4846 rp='Where do the manual pages (source) go?'
4853 Since you are running AFS, I need to distinguish the directory in which
4854 manual pages reside from the directory in which they are installed (and from
4855 which they are presumably copied to the former directory by occult means).
4858 case "$installmansrc" in
4859 '') dflt=`echo $mansrcexp | sed 's#^/afs/#/afs/.#'`;;
4860 *) dflt="$installmansrc";;
4863 rp='Where will man pages be installed?'
4865 installmansrc="$ans"
4867 installmansrc="$mansrcexp"
4883 : check for alignment requirements
4885 case "$memalignbytes" in
4886 '') echo "Checking alignment constraints..." >&4
4887 $cat >try.c <<'EOCP'
4894 printf("%d\n", (char *)&try.bar - (char *)&try.foo);
4897 if $cc $ccflags try.c -o try >/dev/null 2>&1; then
4901 echo"(I can't seem to compile the test program...)"
4904 *) dflt="$memalignbytes"
4907 rp="Doubles must be aligned on a how-many-byte boundary?"
4909 memalignbytes="$ans"
4912 : Cruising for prototypes
4914 echo "Checking out function prototypes..." >&4
4915 $cat >prototype.c <<'EOCP'
4916 main(int argc, char *argv[]) {
4919 if $cc -c prototype.c >prototype.out 2>&1 ; then
4920 echo "Your C compiler appears to support function prototypes."
4923 echo "Your C compiler doesn't seem to understand function prototypes."
4930 : check for length of pointer
4934 echo "Checking to see how big your pointers are..." >&4
4935 $cat >try.c <<'EOCP'
4939 printf("%d\n", sizeof(char *));
4942 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
4946 echo "(I can't seem to compile the test program. Guessing...)"
4953 rp="What is the size of a pointer (in bytes)?"
4958 : check for size of random number generator
4962 echo "Checking to see how many bits your rand function produces..." >&4
4963 $cat >try.c <<'EOCP'
4968 register unsigned long tmp;
4969 register unsigned long max = 0L;
4971 for (i = 1000; i; i--) {
4972 tmp = (unsigned long)rand();
4973 if (tmp > max) max = tmp;
4975 for (i = 0; max; i++)
4980 if $cc try.c -o try >/dev/null 2>&1 ; then
4984 echo "(I can't seem to compile the test program...)"
4991 rp='How many bits does your rand() function produce?'
4996 : see if ar generates random libraries by itself
4998 echo "Checking how to generate random libraries on your machine..." >&4
5002 cc -c a.c >/dev/null 2>&1
5003 ar rc ran.a a.o >/dev/null 2>&1
5008 if ar ts ran.a >/dev/null 2>&1; then
5009 if $cc -o b b.c lib.a >/dev/null 2>&1; then
5010 echo "ar appears to generate random libraries itself."
5014 echo "a table of contents needs to be added with 'ar ts'."
5019 if $test -f /usr/bin/ranlib; then
5020 ranlib=/usr/bin/ranlib
5021 elif $test -f /bin/ranlib; then
5025 if $test -n "$ranlib"; then
5026 echo "your system has $ranlib; we'll use that."
5029 echo "your system doesn't seem to support random libraries"
5030 echo "so we'll use lorder and tsort to order the libraries."
5035 $rm -f a.* b.c b.o b ran.a lib.a
5037 : determine where public executables go
5038 case "$scriptdir" in
5041 : guess some guesses
5042 $test -d /usr/share/scripts && dflt=/usr/share/scripts
5043 $test -d /usr/share/bin && dflt=/usr/share/bin
5044 $test -d /usr/local/script && dflt=/usr/local/script
5046 *) dflt="$scriptdir"
5051 Some installations have a separate directory just for executable scripts so
5052 that they can mount it across multiple architectures but keep the scripts in
5053 one spot. You might, for example, have a subdirectory of /usr/share for this.
5054 Or you might just lump your scripts in with all your other executables.
5058 rp='Where do you keep publicly executable scripts?'
5061 scriptdirexp="$ansexp"
5065 Since you are running AFS, I need to distinguish the directory in which
5066 scripts reside from the directory in which they are installed (and from
5067 which they are presumably copied to the former directory by occult means).
5070 case "$installscript" in
5071 '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
5072 *) dflt="$installscript";;
5075 rp='Where will public scripts be installed?'
5077 installscript="$ans"
5079 installscript="$scriptdirexp"
5082 : generate list of signal names
5086 echo "Generating a list of signal names..." >&4
5087 xxx=`./findhdr signal.h`" "`./findhdr sys/signal.h`
5088 set X `cat $xxx 2>&1 | $awk '
5089 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
5090 sig[$3] = substr($2,4,20)
5091 if (max < $3 && $3 < 60) {
5097 for (i = 1; i <= max; i++) {
5111 echo 'kill -l' >/tmp/foo$$
5112 set X `csh -f </tmp/foo$$`
5116 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
5124 echo "The following signals are available:"
5126 $awk 'BEGIN { linelen = 0 }
5127 { for (i = 1; i < NF; i++)
5130 linelen = linelen + length(name)
5134 linelen = length(name)
5136 printf "%s", name } }'
5137 : see what type of char stdio uses.
5139 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
5140 echo "Your stdio uses unsigned chars." >&4
5141 stdchar="unsigned char"
5143 echo "Your stdio uses signed chars." >&4
5147 : see if time exists
5149 if set time val -f d_time; eval $csym; $val; then
5150 echo 'time() found.' >&4
5154 if $contains 'time_t;' `./findhdr sys/types.h` >/dev/null 2>&1 ; then
5164 rp="What type is returned by time() on this sytem?"
5168 echo 'time() not found, hope that will do.' >&4
5175 : see what type uids are declared as in the kernel
5178 if $contains 'uid_t;' `./findhdr sys/types.h` >/dev/null 2>&1 ; then
5181 xxx=`./findhdr sys/user.h`
5182 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
5184 unsigned) dflt="$1 $2" ;;
5189 *) dflt="$uidtype";;
5192 rp="What type are user ids on this system declared as?"
5196 : check for void type
5199 Checking to see how well your C compiler groks the void type...
5201 Support flag bits are:
5202 1: basic void declarations.
5203 2: arrays of pointers to functions returning void.
5204 4: operations between pointers to and addresses of void functions.
5205 8: generic void pointers.
5208 case "$voidflags" in
5210 $cat >try.c <<'EOCP'
5216 extern void moo(); /* function returning void */
5217 void (*goo)(); /* ptr to func returning void */
5219 void *hue; /* generic ptr */
5233 if $cc -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
5234 voidflags=$defvoidused
5235 echo "It appears to support void to the level $package wants ($defvoidused)."
5236 if $contains warning .out >/dev/null 2>&1; then
5237 echo "However, you might get some warnings that look like this:"
5241 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
5242 if $cc -c -DTRY=1 try.c >/dev/null 2>&1 ; then
5243 echo "It supports 1..."
5244 if $cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then
5245 echo "It also supports 2..."
5246 if $cc -c -DTRY=7 try.c >/dev/null 2>&1 ; then
5248 echo "And it supports 4 but not 8 definitely."
5250 echo "It doesn't support 4..."
5251 if $cc -c -DTRY=11 try.c >/dev/null 2>&1 ; then
5253 echo "But it supports 8."
5256 echo "Neither does it support 8."
5260 echo "It does not support 2..."
5261 if $cc -c -DTRY=13 try.c >/dev/null 2>&1 ; then
5263 echo "But it supports 4 and 8."
5265 if $cc -c -DTRY=5 try.c >/dev/null 2>&1 ; then
5267 echo "And it supports 4 but has not heard about 8."
5269 echo "However it supports 8 but not 4."
5274 echo "There is no support at all for void."
5280 rp="Your void support flags add up to what?"
5285 : determine compiler compiler
5294 if $test -f "$byacc"; then
5298 if $test -f "$bison"; then
5299 rp="$rp or bison -y"
5302 $package no longer requires a compiler compiler, so the following is optional.
5304 rp="Which compiler compiler ($rp) shall I use?"
5313 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
5319 : see if this is a sys/file.h system
5324 : do we need to #include <sys/file.h> ?
5330 echo "We'll be including <sys/file.h>." >&4
5333 echo "We won't be including <sys/file.h>." >&4
5343 : see if fcntl.h is there
5348 : see if we can include fcntl.h
5354 echo "We'll be including <fcntl.h>." >&4
5358 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
5360 echo "We won't be including <fcntl.h>." >&4
5372 : see if this is an grp system
5376 : see if memory.h is available.
5377 set memory.h i_memory
5379 : See if it conflicts with string.h
5384 *) $cppstdin $cppflags $cppminus < $strings > mem.h
5385 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
5386 echo "We won't be including <memory.h>"
5393 : see if there are directory access routines out there
5395 if $test `./findhdr ndir.h` && \
5396 ( $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a ); then
5397 echo "Ndir library found." >&4
5398 if $test -r /usr/lib/libndir.a; then
5401 ndirlib="/usr/local/lib/libndir.a"
5410 if set readdir val -f; eval $csym; $val; then
5411 echo "No ndir library found, but you have readdir() so we'll use that." >&4
5416 echo "No ndir library found--using ./ndir.c." >&4
5423 : see if net/errno.h is available
5424 set net/errno.h i_neterrno
5426 : Unfortunately, it causes problems on some systems. Arrgh.
5427 case '$i_neterrno' in
5428 'define') echo "<net/errno.h> found."
5432 #include <net/errno.h>
5440 if $cc $ccflags -c try.c >/dev/null 2>&1; then
5441 i_neterrno="$define"
5443 echo "But it causes problems, so we won't include it"
5449 : see if stdarg is available
5450 set stdarg.h i_stdarg
5453 : see if stddef is available
5454 set stddef.h i_stddef
5457 : see if this is an sysdir system
5458 set sys/dir.h i_sysdir
5461 : get C preprocessor symbols handy
5463 echo $attrlist | $tr ' ' '\012' >Cppsym.know
5475 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
5477 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
5480 unknown="\$unknown \$sym"
5490 echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\
5492 exit 0; _ _ _ _\1\\ \1\\
5495 echo "exit 1; _ _ _" >>Cppsym\$\$
5496 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$
5498 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
5504 $rm -f Cppsym\$\$ Cppsym2\$\$
5509 echo "Your C preprocessor defines the following symbols:"
5510 Cppsym -l $attrlist >Cppsym.true
5513 : see if this is a termio system
5517 if $test `./findhdr termios.h`; then
5518 set tcsetattr i_termios
5524 "$define") echo "You have POSIX termios.h... good!" >&4;;
5525 *) if Cppsym pyr; then
5526 case "`/bin/universe`" in
5527 ucb) if $test `./findhdr sgtty.h`; then
5529 echo "<sgtty.h> found." >&4
5531 echo "System is pyramid with BSD universe."
5532 echo "<sgtty.h> not found--you could have problems." >&4
5534 *) if $test `./findhdr termio.h`; then
5536 echo "<termio.h> found." >&4
5538 echo "System is pyramid with USG universe."
5539 echo "<termio.h> not found--you could have problems." >&4
5543 if $test `./findhdr termio.h`; then
5544 echo "<termio.h> found." >&4
5546 elif $test `./findhdr sgtty.h`; then
5547 echo "<sgtty.h> found." >&4
5550 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
5553 if $test `./findhdr sgtty.h`; then
5554 echo "<sgtty.h> found." >&4
5556 elif $test `./findhdr termio.h`; then
5557 echo "<termio.h> found." >&4
5560 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
5564 set i_termio; eval $setvar
5565 val=$val2; set i_sgtty; eval $setvar
5566 val=$val3; set i_termios; eval $setvar
5568 : see if ioctl defs are in sgtty/termio or sys/ioctl
5570 if $test `./findhdr sys/ioctl.h`; then
5572 echo "<sys/ioctl.h> found." >&4
5575 $test $i_termio = "$define" && xxx="termio.h"
5576 $test $i_termios = "$define" && xxx="termios.h"
5577 $test $i_sgtty = "$define" && xxx="sgtty.h"
5578 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
5583 : see if this is an sysndir system
5584 set sys/ndir.h i_sysndir
5587 : see if sys/select.h has to be included
5588 set sys/select.h i_sysselct
5591 : see if we should include time.h, sys/time.h, or both
5593 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
5594 $echo $n "I'm now running the test program...$c"
5595 $cat >try.c <<'EOCP'
5596 #include <sys/types.h>
5601 #ifdef SYSTIMEKERNEL
5604 #include <sys/time.h>
5607 #include <sys/select.h>
5616 struct timezone tzp;
5618 if (foo.tm_sec == foo.tm_sec)
5621 if (bar.tv_sec == bar.tv_sec)
5630 for s_timeval in '-DS_TIMEVAL' ''; do
5631 for i_systimek in '' '-DSYSTIMEKERNEL'; do
5632 for i_time in '' '-DI_TIME'; do
5633 for i_systime in '-DI_SYSTIME' ''; do
5637 $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \
5638 try.c -o try >/dev/null 2>&1 ; then
5639 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
5643 $echo $n "Succeeded with $flags$c"
5654 *SYSTIMEKERNEL*) i_systimek="$define"
5655 timeincl=`./findhdr sys/time.h`
5656 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
5657 *) i_systimek="$undef";;
5660 *I_TIME*) i_time="$define"
5661 timeincl=`./findhdr time.h`" $timeincl"
5662 echo "We'll include <time.h>." >&4;;
5663 *) i_time="$undef";;
5666 *I_SYSTIME*) i_systime="$define"
5667 timeincl=`./findhdr sys/time.h`" $timeincl"
5668 echo "We'll include <sys/time.h>." >&4;;
5669 *) i_systime="$undef";;
5673 : see if this is a unistd.h system
5674 set unistd.h i_unistd
5677 : see if this is an utime system
5681 : see if this is a varargs system
5683 if $test `./findhdr varargs.h`; then
5685 echo "<varargs.h> found." >&4
5688 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
5693 : set up the varargs testing programs
5694 $cat > varargs.c <<EOP
5699 #include <varargs.h>
5717 p = va_arg(ap, char *);
5722 $cat > varargs <<EOP
5723 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
5732 : now check which varargs header should be included
5737 if `./varargs I_STDARG`; then
5740 elif `./varargs I_VARARGS`; then
5741 i_varhdr='varargs.h'
5746 if `./varargs I_VARARGS`; then
5747 i_varhdr='varargs.h'
5753 echo "I could not find the definition for va_dcl... You have problems..." >&4
5755 *) echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
5759 : see if this is a vfork system
5761 define) set vfork.h i_vfork
5764 *) i_vfork="$undef";;
5766 : end of configuration questions
5768 echo "End of configuration questions."
5771 : back to where it started
5772 if test -d ../UU; then
5776 : configuration may be patched via a 'config.over' file
5777 if $test -f config.over; then
5780 rp='I see a config.over file. Do you wish to load it?'
5783 n*) echo "OK, I'll ignore it.";;
5785 echo "Configuration override changes have been loaded."
5790 : create config.sh file
5792 echo "Creating config.sh..." >&4
5793 $spitshell <<EOT >config.sh
5796 # This file was produced by running the Configure script. It holds all the
5797 # definitions figured out by Configure. Should you modify one of these values,
5798 # do not forget to propagate your changes by running "Configure -der". You may
5799 # instead choose to run each of the .SH files by yourself, or "Configure -S".
5802 # Configuration time: $cf_time
5803 # Configured by: $cf_by
5804 # Target system: $myuname
5806 extensions='$extensions'
5807 d_eunice='$d_eunice'
5809 eunicefix='$eunicefix'
5819 compress='$compress'
5856 sendmail='$sendmail'
5886 Revision='$Revision'
5890 memalignbytes='$memalignbytes'
5893 installbin='$installbin'
5894 byteorder='$byteorder'
5896 gccversion='$gccversion'
5898 cppflags='$cppflags'
5901 optimize='$optimize'
5904 contains='$contains'
5906 cppminus='$cppminus'
5908 cppstdin='$cppstdin'
5909 d_access='$d_access'
5913 d_casti32='$d_casti32'
5914 castflags='$castflags'
5915 d_castneg='$d_castneg'
5916 d_charsprf='$d_charsprf'
5917 d_chsize='$d_chsize'
5919 cryptlib='$cryptlib'
5922 d_dosuid='$d_dosuid'
5924 d_fchmod='$d_fchmod'
5925 d_fchown='$d_fchown'
5927 d_flexfnam='$d_flexfnam'
5929 d_getgrps='$d_getgrps'
5930 d_gethent='$d_gethent'
5931 aphostname='$aphostname'
5932 d_gethname='$d_gethname'
5933 d_phostname='$d_phostname'
5935 d_getpgrp2='$d_getpgrp2'
5936 d_getpgrp='$d_getpgrp'
5937 d_getprior='$d_getprior'
5939 d_isascii='$d_isascii'
5940 d_killpg='$d_killpg'
5943 d_memcmp='$d_memcmp'
5944 d_memcpy='$d_memcpy'
5945 d_memmove='$d_memmove'
5946 d_memset='$d_memset'
5949 d_msgctl='$d_msgctl'
5950 d_msgget='$d_msgget'
5951 d_msgrcv='$d_msgrcv'
5952 d_msgsnd='$d_msgsnd'
5954 d_portable='$d_portable'
5955 d_readdir='$d_readdir'
5956 d_rewinddir='$d_rewinddir'
5957 d_seekdir='$d_seekdir'
5958 d_telldir='$d_telldir'
5959 d_rename='$d_rename'
5961 d_safebcpy='$d_safebcpy'
5962 d_safemcpy='$d_safemcpy'
5963 d_select='$d_select'
5965 d_semctl='$d_semctl'
5966 d_semget='$d_semget'
5968 d_setegid='$d_setegid'
5969 d_seteuid='$d_seteuid'
5970 d_setlocale='$d_setlocale'
5971 d_setpgid='$d_setpgid'
5972 d_setpgrp2='$d_setpgrp2'
5973 d_bsdpgrp='$d_bsdpgrp'
5974 d_setpgrp='$d_setpgrp'
5975 d_setprior='$d_setprior'
5976 d_setregid='$d_setregid'
5977 d_setresgid='$d_setresgid'
5978 d_setresuid='$d_setresuid'
5979 d_setreuid='$d_setreuid'
5980 d_setrgid='$d_setrgid'
5981 d_setruid='$d_setruid'
5982 d_setsid='$d_setsid'
5985 d_voidshmat='$d_voidshmat'
5986 d_shmctl='$d_shmctl'
5988 d_shmget='$d_shmget'
5989 d_oldsock='$d_oldsock'
5990 d_socket='$d_socket'
5991 d_sockpair='$d_sockpair'
5992 sockethdr='$sockethdr'
5993 socketlib='$socketlib'
5994 d_statblks='$d_statblks'
5995 d_stdstdio='$d_stdstdio'
5997 d_strchr='$d_strchr'
5998 d_strctcpy='$d_strctcpy'
5999 d_strerrm='$d_strerrm'
6000 d_strerror='$d_strerror'
6001 d_sysernlst='$d_sysernlst'
6002 d_syserrlst='$d_syserrlst'
6003 d_symlink='$d_symlink'
6004 d_syscall='$d_syscall'
6005 d_system='$d_system'
6007 timetype='$timetype'
6008 clocktype='$clocktype'
6010 d_truncate='$d_truncate'
6011 d_usendir='$d_usendir'
6017 d_voidsig='$d_voidsig'
6018 signal_t='$signal_t'
6019 d_volatile='$d_volatile'
6020 d_charvspr='$d_charvspr'
6021 d_vprintf='$d_vprintf'
6023 d_waitpid='$d_waitpid'
6024 cccdlflags='$cccdlflags'
6025 ccdlflags='$ccdlflags'
6029 lddlflags='$lddlflags'
6030 shlibsuffix='$shlibsuffix'
6033 groupstype='$groupstype'
6035 h_sysfile='$h_sysfile'
6037 d_dirnamlen='$d_dirnamlen'
6038 i_dirent='$i_dirent'
6043 i_memory='$i_memory'
6045 i_neterrno='$i_neterrno'
6049 d_pwchange='$d_pwchange'
6050 d_pwclass='$d_pwclass'
6051 d_pwcomment='$d_pwcomment'
6052 d_pwexpire='$d_pwexpire'
6053 d_pwquota='$d_pwquota'
6056 i_stdarg='$i_stdarg'
6057 i_stddef='$i_stddef'
6058 i_string='$i_string'
6060 i_sysdir='$i_sysdir'
6061 i_sysfile='$i_sysfile'
6062 d_voidtty='$d_voidtty'
6063 i_bsdioctl='$i_bsdioctl'
6064 i_sysioctl='$i_sysioctl'
6065 i_syssockio='$i_syssockio'
6066 i_sysndir='$i_sysndir'
6067 i_sysselct='$i_sysselct'
6069 i_termio='$i_termio'
6070 i_termios='$i_termios'
6071 i_systime='$i_systime'
6072 i_systimek='$i_systimek'
6074 timeincl='$timeincl'
6075 i_unistd='$i_unistd'
6077 i_varargs='$i_varargs'
6078 i_varhdr='$i_varhdr'
6089 lseektype='$lseektype'
6090 d_mymalloc='$d_mymalloc'
6091 mallocobj='$mallocobj'
6092 mallocsrc='$mallocsrc'
6093 malloctype='$malloctype'
6094 usemymalloc='$usemymalloc'
6095 installmansrc='$installmansrc'
6098 mansrcexp='$mansrcexp'
6105 mydomain='$mydomain'
6106 myhostname='$myhostname'
6107 phostname='$phostname'
6110 groupcat='$groupcat'
6113 orderlib='$orderlib'
6116 spackage='$spackage'
6117 installprivlib='$installprivlib'
6119 privlibexp='$privlibexp'
6120 prototype='$prototype'
6122 randbits='$randbits'
6123 installscript='$installscript'
6124 scriptdir='$scriptdir'
6125 scriptdirexp='$scriptdirexp'
6126 sig_name='$sig_name'
6127 sharpbang='$sharpbang'
6129 spitshell='$spitshell'
6139 mips_type='$mips_type'
6141 defvoidused='$defvoidused'
6142 voidflags='$voidflags'
6144 yaccflags='$yaccflags'
6147 : add special variables
6148 $test -f patchlevel.h && \
6149 awk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
6150 echo "CONFIG=true" >>config.sh
6152 : propagate old symbols
6153 if $test -f UU/config.sh; then
6154 <UU/config.sh sort | uniq >UU/oldconfig.sh
6155 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
6156 sort | uniq -u >UU/oldsyms
6157 set X `cat UU/oldsyms`
6163 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
6165 echo "# Variables propagated from previous config.sh file." >>config.sh
6166 for sym in `cat UU/oldsyms`; do
6167 echo " Propagating $hint variable "'$'"$sym..."
6168 eval 'tmp="$'"${sym}"'"'
6170 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
6176 : Finish up by extracting the .SH files
6189 echo "If you didn't make any mistakes, then just type a carriage return here."
6190 rp="If you need to edit config.sh, do it as a shell escape here:"
6195 *) : in case they cannot read
6201 : if this fails, just run all the .SH files by hand
6208 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
6215 Now you need to generate make dependencies by running "make depend".
6216 You might prefer to run it in background: "make depend > makedepend.out &"
6217 It can take a while, so you might not want to run it right now.
6222 rp="Run make depend now?"
6226 make depend && echo "Now you must run a make."
6229 echo "You must run 'make depend' then 'make'."
6232 elif test -f [Mm]akefile; then
6234 echo "Now you must run a make."
6239 $rm -f kit*isdone ark*isdone