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.5 1994/08/29 16:03:44 ram Exp $
23 # Generated on Tue Oct 11 22:49:31 EDT 1994 [metaconfig 3.0 PL35]
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$$
49 : compute my invocation name
53 me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
60 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
61 paths=$paths:'/usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin'
62 paths=$paths:'/sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb'
63 paths=$paths:'/bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin'
64 paths=$paths:'/etc /usr/lib /usr/ucblib /lib /usr/ccs/lib'
65 paths=$paths:'/sbin /usr/sbin /usr/libexec'
71 *) test -d $p && PATH=$PATH:$p ;;
80 echo "Say 'sh $me', not 'sh <$me'"
84 : On HP-UX, large Configure scripts may exercise a bug in /bin/sh
85 if test -f /hp-ux -a -f /bin/ksh; then
86 if (PATH=.; alias -x) >/dev/null 2>&1; then
87 : already under /bin/ksh
90 (Feeding myself to ksh to avoid nasty sh bug in "here document" expansion.)
95 : Warn them if they use ksh on other systems
96 (PATH=.; alias -x) >/dev/null 2>&1 && \
98 (I see you are using the Korn shell. Some ksh's blow up on $me,
99 especially on exotic machines. If yours does, try the Bourne shell instead.)
103 : Configure runs within the UU subdirectory
104 test -d UU || mkdir UU
519 : script used to extract .SH files with variable substitutions
522 echo "Doing variable substitutions on .SH files..."
523 if test -f MANIFEST; then
524 shlist=`awk '{print $1}' <MANIFEST | grep '\.SH'`
525 : Pick up possible extension manifests.
526 for dir in ext/* ; do
527 if test -f $dir/MANIFEST; then
528 xxx=`awk '{print $1}' < $dir/MANIFEST |
529 sed -n "/\.SH$/ s@^@$dir/@p"`
530 shlist="$shlist $xxx"
535 echo "(Looking for .SH files under the current directory.)"
536 set x `find . -name "*.SH" -print`
540 0) set x *.SH; shift;;
542 if test ! -f $1; then
548 dir=`expr X$file : 'X\(.*\)/'`
549 file=`expr X$file : 'X.*/\(.*\)'`
550 (cd $dir && . ./$file)
557 if test -f config_h.SH; then
558 if test ! -f config.h; then
559 : oops, they left it out of MANIFEST, probably, so do it anyway.
565 : produce awk script to parse command line options
566 cat >options.awk <<'EOF'
568 optstr = "deEf:hrsSD:U:V"; # getopt-style specification
570 len = length(optstr);
571 for (i = 1; i <= len; i++) {
572 c = substr(optstr, i, 1);
573 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
584 if (substr(str, 1, 1) != "-") {
585 printf("'%s'\n", str);
589 for (i = 2; i <= len; i++) {
590 c = substr(str, i, 1);
592 printf("-%s\n", substr(str, i));
598 printf("'%s'\n", substr(str, i + 1));
611 : process the command line options
612 set X `for arg in "$@"; do echo $arg; done | awk -f options.awk`
617 : set up default values
628 while test $# -gt 0; do
630 -d) shift; fastread=yes;;
631 -e) shift; alldone=cont;;
635 if test -r "$1"; then
638 echo "$me: cannot read config file $1." >&2
643 -h) shift; error=true;;
644 -r) shift; reuseval=true;;
645 -s) shift; silent=true;;
646 -E) shift; alldone=exit;;
647 -S) shift; extractsh=true;;
652 echo "$me: use '-U symbol=', not '-D symbol='." >&2
653 echo "$me: ignoring -D $1" >&2
655 *=*) echo "$1" >> $optdef;;
656 *) echo "$1='define'" >> $optdef;;
663 *=) echo "$1" >> $optdef;;
665 echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
666 echo "$me: ignoring -U $1" >&2
668 *) echo "$1='undef'" >> $optdef;;
672 -V) echo "$me generated by metaconfig 3.0 PL35." >&2
675 -*) echo "$me: unknown option $1" >&2; shift; error=true;;
683 Usage: $me [-dehrESV] [-f config.sh] [-D symbol] [-D symbol=value]
684 [-U symbol] [-U symbol=]
685 -d : use defaults for all answers.
686 -e : go on without questioning past the production of config.sh.
687 -f : specify an alternate default configuration file.
688 -h : print this help message and exit (with an error status).
689 -r : reuse C symbols value if possible (skips costly nm extraction).
690 -s : silent mode, only echoes questions and essential information.
691 -D : define symbol to have some value:
692 -D symbol symbol gets the value 'define'
693 -D symbol=value symbol gets the value 'value'
694 -E : stop at the end of questions, after having produced config.sh.
695 -S : perform variable substitutions on all .SH files (can mix with -f)
696 -U : undefine symbol:
697 -U symbol symbol gets the value 'undef'
698 -U symbol= symbol gets completely empty
699 -V : print version number and exit (with a zero status).
707 true) exec 1>/dev/null;;
710 : run the defines and the undefines, if any
718 '') config_sh='config.sh'; config='./config.sh';;
719 /*) config="$config_sh";;
720 *) config="./$config_sh";;
723 echo "Fetching answers from $config_sh..."
737 : Eunice requires " " instead of "", can you believe it
740 echo "Beginning of configuration questions for $package."
744 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
747 trap 'echo " "; rm -rf $rmlist; exit 1' 1 2 3 15
749 : We must find out about Eunice early
751 if test -f /etc/unixtovms; then
752 eunicefix=/etc/unixtovms
754 if test -f /etc/unixtovms.exe; then
755 eunicefix=/etc/unixtovms.exe
758 : list of known cpp symbols
759 al="AMIX BIT_MSF BSD BSD4_3 BSD_NET2 CRAY DGUX DOLPHIN DPX2"
760 al="$al GO32 HP700 I386 I80960 I960 Lynx M68000 M68K MACH"
761 al="$al MIPSEB MIPSEL MSDOS MTXINU MVS"
762 al="$al M_COFF M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM"
763 al="$al M_SYS3 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX"
764 al="$al NeXT OCS88 OSF1 PARISC PC532 PORTAR POSIX"
765 al="$al PWB R3000 SVR3 SVR4"
766 al="$al SYSTYPE_BSD SYSTYPE_SVR4 SYSTYPE_SYSV"
767 al="$al UTEK UTS UTek UnicomPBB UnicomPBD Utek VMS"
768 al="$al _AIX _AIX32 _AM29000 _COFF _CRAY _EPI _IBMR2"
769 al="$al _MIPSEB _MIPSEL _M_COFF _M_I86 _M_I86SM _M_SYS3"
770 al="$al _M_SYS5 _M_SYSIII _M_SYSV _M_UNIX _M_XENIX _R3000"
771 al="$al _SYSTYPE_BSD _SYSTYPE_BSD43 _SYSTYPE_SVR4"
772 al="$al _SYSTYPE_SYSV _SYSV3 _UNICOS"
773 al="$al __386BSD__ __BIG_ENDIAN __BIG_ENDIAN__ __BSD_4_4__"
774 al="$al __DGUX__ __DPX2__ __H3050R __H3050RX"
775 al="$al __LITTLE_ENDIAN __LITTLE_ENDIAN__ __MACH__"
776 al="$al __MIPSEB __MIPSEB__ __MIPSEL __MIPSEL__"
777 al="$al __Next__ __OSF1__ __PARAGON__ __PWB __STDC__"
778 al="$al ____386BSD____ __alpha __alpha__ __amiga"
779 al="$al __bsd4_2 __bsd4_2__ __bsdi__ __convex__"
780 al="$al __host_mips__"
781 al="$al __hp9000s200 __hp9000s300 __hp9000s400 __hp9000s500"
782 al="$al __hp9000s500 __hp9000s700 __hp9000s800"
783 al="$al __hppa __hpux __i286 __i286__ __i386 __i386__"
784 al="$al __i486 __i486__ __i860 __i860__"
785 al="$al __m68k __m68k__ __m88100__ __m88k __m88k__"
786 al="$al __mc68000 __mc68000__ __mc68020 __mc68020__"
787 al="$al __mc68030 __mc68030__ __mc68040 __mc68040__"
788 al="$al __mc88100 __mc88100__ __mips __mips__"
789 al="$al __motorola__ __osf__ __pa_risc __sparc__ __stdc__"
790 al="$al __sun __sun__ __svr3__ __svr4__ __ultrix __ultrix__"
791 al="$al __unix __unix__ __vax __vax__"
792 al="$al _host_mips _mips _unix"
793 al="$al a29k aegis alliant am29000 amiga ansi"
794 al="$al bsd bsd43 bsd4_2 bsd4_3 bsd4_4 bull"
795 al="$al convex cray ctix encore gcos gimpel"
796 al="$al hcx host_mips hp200 hp300 hp700 hp800"
797 al="$al hp9000 hp9000s300 hp9000s400 hp9000s500"
798 al="$al hp9000s700 hp9000s800 hp9k8 hpux"
799 al="$al i186 i286 i386 i486 i8086"
800 al="$al i80960 i860 iAPX286 ibm interdata is68k"
801 al="$al linux luna luna88k m68k m88100 m88k"
802 al="$al mc300 mc500 mc68000 mc68010 mc68020 mc68030"
803 al="$al mc68040 mc68060 mc68k mc68k32 mc700"
804 al="$al mc88000 mc88100 merlin mert mips mvs n16"
805 al="$al ncl_el ncl_mr"
806 al="$al news1500 news1700 news1800 news1900 news3700"
807 al="$al news700 news800 news900 ns16000 ns32000"
808 al="$al ns32016 ns32332 ns32k nsc32000 os osf"
809 al="$al parisc pc532 pdp11 plexus posix pyr"
810 al="$al riscix riscos sequent sgi sinix sony sony_news"
811 al="$al sonyrisc sparc sparclite spectrum stratos"
812 al="$al sun sun3 sun386 svr4 sysV68 sysV88"
813 al="$al tower tower32 tower32_200 tower32_600 tower32_700"
814 al="$al tower32_800 tower32_850 tss u3b u3b2 u3b20 u3b200"
815 al="$al u3b5 ultrix unix unixpc unos vax venix vms"
819 : change the next line if compiling for Xenix/286 on Xenix/386
820 xlibpth='/usr/lib/386 /lib/386'
822 : general looking path for locating libraries
823 glibpth="/lib/pa1.1 /usr/lib/large /lib /usr/lib $xlibpth"
824 glibpth="$glibpth /lib/large /usr/lib/small /lib/small"
825 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib /usr/shlib"
827 : Private path used by Configure to find libraries. Its value
828 : is prepended to libpth. This variable takes care of special
829 : machines, like the mips. Usually, it should be empty.
832 : full support for void wanted by default
835 : set useposix=false in your hint file to disable the POSIX extension.
838 : no include file wanted by default
842 : default library list
844 : List of libraries we want.
845 libswanted='net socket inet nsl nm ndbm gdbm dbm db malloc dl'
846 libswanted="$libswanted dld ld sun m c cposix posix ndir dir crypt"
847 libswanted="$libswanted ucb bsd BSD PW x"
848 : We want to search /usr/shlib before most other libraries.
849 : This is only used by ext/util/extliblist
850 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
851 glibpth="/usr/shlib $glibpth"
852 : Do not use vfork unless overridden by a hint file.
854 : We can look for titanos too.
855 al="$al ardent titan"
857 : Some greps do not return status, grrr.
858 echo "grimblepritz" >grimble
859 if grep blurfldyick grimble >/dev/null 2>&1 ; then
861 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
867 : the following should work in any shell
871 echo "AGH! Grep doesn't return a status. Attempting remedial action."
872 cat >contains <<'EOSS'
873 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
878 : first determine how to suppress newline on echo command
880 echo "Checking echo to see how to suppress newlines..."
881 (echo "hi there\c" ; echo " ") >.echotmp
882 if $contains c .echotmp >/dev/null 2>&1 ; then
893 echo $n "The star should be here-->$c"
897 : Now test for existence of everything in MANIFEST
899 if test -f ../MANIFEST; then
900 echo "First let's make sure your kit is complete. Checking..." >&4
901 awk '$1 !~ /PACK[A-Z]+/ {print $1}' ../MANIFEST | split -50
903 for filelist in x??; do
904 (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
906 if test -s missing; then
910 THIS PACKAGE SEEMS TO BE INCOMPLETE.
912 You have the option of continuing the configuration process, despite the
913 distinct possibility that your kit is damaged, by typing 'y'es. If you
914 do, don't blame me if something goes wrong. I advise you to type 'n'o
915 and contact the author (lwall@netlabs.com).
918 echo $n "Continue? [n] $c" >&4
922 echo "Continuing..." >&4
926 echo "ABORTING..." >&4
931 echo "Looks good..." >&4
934 echo "There is no MANIFEST file. I hope your kit is complete !"
938 : compute the number of columns on the terminal for proper question formatting
943 : set up the echo used in my read
944 myecho="case \"\$xxxm\" in
945 '') echo $n \"\$rp $c\" >&4;;
947 '') echo $n \"[\$xxxm] $c\";;
949 if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
951 echo $n \"[\$xxxm] $c\" >&4
953 echo $n \"\$rp [\$xxxm] $c\" >&4
959 : now set up to do reads with possible shell escape and default assignment
965 yes) case "\$dflt" in
968 case "\$silent-\$rp" in
973 *) case "\$silent" in
979 while expr "X\$ans" : "X!" >/dev/null; do
983 aok=''; eval "ans=\"\$answ\"" && aok=y
993 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1003 echo "*** Substitution done -- please confirm."
1005 ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
1010 echo "*** Error -- try again."
1017 case "\$ans\$xxxm\$nostick" in
1029 : create .config dir to save info across Configure sessions
1030 test -d ../.config || mkdir ../.config
1031 cat >../.config/README <<EOF
1032 This directory created by Configure to save information that should
1033 persist across sessions.
1035 You may safely delete it if you wish.
1038 : general instructions
1041 user=`( (logname) 2>/dev/null || whoami) 2>&1`
1042 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
1045 rp='Would you like to see the instructions?'
1056 This installation shell script will examine your system and ask you questions
1057 to determine how the perl5 package should be installed. If you get
1058 stuck on a question, you may use a ! shell escape to start a subshell or
1059 execute a command. Many of the questions will have default answers in square
1060 brackets; typing carriage return will give you the default.
1062 On some of the questions which ask for file or directory names you are allowed
1063 to use the ~name construct to specify the login directory belonging to "name",
1064 even if you don't have a shell which knows about that. Questions where this is
1065 allowed will be marked "(~name ok)".
1069 dflt='Type carriage return to continue'
1073 The prompter used in this script allows you to use shell variables and
1074 backticks in your answers. You may use $1, $2, etc... to refer to the words
1075 in the default answer, as if the default line was a set of arguments given to a
1076 script shell. This means you may also use $* to repeat the whole default line,
1077 so you do not have to re-type everything to add something to the default.
1079 Everytime there is a substitution, you will have to confirm. If there is an
1080 error (e.g. an unmatched backtick), the default answer will remain unchanged
1081 and you will be prompted again.
1083 If you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
1084 the questions and use the computed defaults (or the previous answers if there
1085 was already a config.sh file). Type 'Configure -h' for a list of options.
1091 Much effort has been expended to ensure that this shell script will run on any
1092 Unix system. If despite that it blows up on yours, your best bet is to edit
1093 Configure and run it again. Also, let me (lwall@netlabs.com)
1094 know how I blew it. If you can't run Configure for some reason, you'll have to
1095 generate a config.sh file by hand.
1097 This installation script affects things in two ways:
1099 1) it may do direct variable substitutions on some of the files included
1101 2) it builds a config.h file for inclusion in C programs. You may edit
1102 any of these files as the need arises after running this script.
1104 If you make a mistake on a question, there is no easy way to back up to it
1105 currently. The easiest thing to do is to edit config.sh and rerun all the SH
1106 files. Configure will offer to let you do this before it runs the SH files.
1109 dflt='Type carriage return to continue'
1111 case "$firsttime" in
1112 true) echo $user >>../.config/instruct;;
1116 : see if sh knows # comments
1118 echo "Checking your sh to see if it knows about # comments..." >&4
1119 if sh -c '#' >/dev/null 2>&1 ; then
1120 echo "Your sh handles # comments correctly."
1124 echo "Okay, let's see if #! works on this system..."
1126 test -r $xcat || xcat=/usr/bin/cat
1131 if test -s today; then
1135 echo "#! $xcat" > try
1139 if test -s today; then
1143 echo "It's just a comment."
1148 echo "Your sh doesn't grok # comments--I will strip them later on."
1151 echo "exec grep -v '^[ ]*#'" >spitshell
1153 $eunicefix spitshell
1154 spitshell=`pwd`/spitshell
1156 echo "I presume that if # doesn't work, #! won't work either!"
1161 : figure out how to guarantee sh startup
1163 echo "Checking out how to guarantee sh startup..." >&4
1165 *bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";;
1166 *) startsh=$sharpbang'/bin/sh';;
1168 echo "Let's see if '$startsh' works..."
1178 echo "Yup, it does."
1180 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
1184 : find out where common programs are
1186 echo "Locating common programs..." >&4
1199 if test -d \$dir/\$thing; then
1205 for thisthing in \$dir/\$thing; do
1206 : Just loop through to pick last element
1208 if test -f \$thisthing; then
1211 elif test -f \$dir/\$thing.exe; then
1212 : on Eunice apparently
1256 pth=`echo $PATH | sed -e 's/:/ /g'`
1257 pth="$pth /lib /usr/lib"
1258 for file in $loclist; do
1259 xxx=`./loc $file $file $pth`
1264 echo $file is in $xxx.
1267 echo "I don't know where $file is. I hope it's in everyone's PATH."
1272 echo "Don't worry if any of the following aren't found..."
1274 for file in $trylist; do
1275 xxx=`./loc $file $file $pth`
1280 echo $file is in $xxx.
1283 echo "I don't see $file out there, $say."
1290 echo "Substituting grep for egrep."
1296 echo "Hopefully test is built into your sh."
1299 if sh -c "PATH= test true" >/dev/null 2>&1; then
1300 echo "Using the test built into your sh."
1308 echo "Hopefully echo is built into your sh."
1313 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
1314 $echo $n "hi there$c" >foo1
1315 echo $n "hi there$c" >foo2
1316 if cmp foo1 foo2 >/dev/null 2>&1; then
1317 echo "They are compatible. In fact, they may be identical."
1324 They are not compatible! You are probably running ksh on a non-USG system.
1325 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
1326 have echo built in and we may have to run some Bourne shell scripts. That
1327 means I'll have to use '$n$c' to suppress newlines now. Life is ridiculous.
1330 $echo $n "The star should be here-->$c"
1337 : determine whether symbolic links are supported
1340 if $ln -s blurfl sym > /dev/null 2>&1 ; then
1341 echo "Symbolic links are supported." >&4
1344 echo "Symbolic links are NOT supported." >&4
1349 : Try to determine whether config.sh was made on this system
1350 case "$config_sh" in
1352 myuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
1353 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
1354 tr '[A-Z]' '[a-z]' | tr '\012' ' '`
1356 if test -f ../config.sh; then
1358 if $contains myuname= ../config.sh >/dev/null 2>&1; then
1359 eval "old`grep myuname= ../config.sh`"
1361 if test "X$myuname" = "X$oldmyuname"; then
1366 : Get old answers from old config file if Configure was run on the
1367 : same system, otherwise use the hints.
1370 if test -f config.sh; then
1372 rp="I see a config.sh file. Shall I use it to set the defaults?"
1375 n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
1376 *) echo "Fetching default answers from your old config.sh file..." >&4
1387 if test ! -f config.sh; then
1390 First time through, eh? I have some defaults handy for the following systems:
1393 cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&4
1395 : Half the following guesses are probably wrong... If you have better
1396 : tests or hints, please send them to lwall@netlabs.com
1397 : The metaconfig authors would also appreciate a copy...
1398 $test -f /irix && osname=irix
1399 $test -f /xenix && osname=sco_xenix
1400 $test -f /dynix && osname=dynix
1401 $test -f /dnix && osname=dnix
1402 $test -f /unicos && osname=unicos && osvers=`$uname -r`
1403 $test -f /bin/mips && /bin/mips && osname=mips
1404 $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
1405 $test -d /usr/apollo/bin && osname=apollo
1406 $test -f /etc/saf/_sactab && osname=svr4
1407 $test -d /usr/include/minix && osname=minix
1408 if $test -f $uname; then
1416 umips) osname=umips ;;
1419 [23]100) osname=mips ;;
1420 next*) osname=next ;;
1421 news*) osname=news ;;
1422 i386*) if $test -f /etc/kconfig; then
1424 if test "$lns" = "ln -s"; then
1426 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
1428 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
1437 tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
1439 'not found') osvers=3.2.0 ;;
1440 '<3240'|'<>3240') osvers=3.2.0 ;;
1441 '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
1442 '=3250'|'>3250') osvers=3.2.5 ;;
1449 domainos) osname=apollo
1455 freebsd) osname=freebsd
1457 genix) osname=genix ;;
1462 *.10.*) osvers=10 ;;
1477 netbsd*) osname=netbsd
1480 bsd386) osname=bsd386
1483 next*) osname=next ;;
1484 solaris) osname=solaris
1486 5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1492 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
1496 titanos) osname=titanos
1504 ultrix) osname=ultrix
1513 alpha) osname=dec_osf
1515 [vt]1\.*) osvers=1 ;;
1516 [vt]2\.*) osvers=2 ;;
1517 [vt]3\.*) osvers=3 ;;
1520 hp*) osname=hp_osf1 ;; # TR
1521 mips) osname=mips_osf1 ;; # TR
1522 # TR = Technology Releases: unsupported
1528 $2) case "$osname" in
1532 : svr4.x or possibly later
1542 if test -f /stand/boot ; then
1543 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
1544 if test -n $INITPROG -a -f $INITPROG; then
1545 isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
1546 if test -n $isesix; then
1554 *) if test -f /etc/systemid; then
1556 set `echo $3 | $sed 's/\./ /g'` $4
1557 if $test -f sco_$1_$2_$3.sh; then
1559 elif $test -f sco_$1_$2.sh; then
1561 elif $test -f sco_$1.sh; then
1566 '') : Still unknown. Probably a generic Sys V.
1575 *) case "$osname" in
1576 '') : Still unknown. Probably a generic BSD.
1584 if test -f /vmunix -a -f news_os.sh; then
1585 (what /vmunix | tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
1586 if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
1589 $rm -f ../UU/kernel.what
1593 : Now look for a hint file osname_osvers, unless one has been
1594 : specified already.
1597 file=`echo "${osname}_${osvers}" | sed -e 's@\.@_@g' -e 's@_$@@'`
1598 : Also try without trailing minor version numbers.
1599 xfile=`echo $file | sed -e 's@_[^_]*$@@'`
1600 xxfile=`echo $xfile | sed -e 's@_[^_]*$@@'`
1601 xxxfile=`echo $xxfile | sed -e 's@_[^_]*$@@'`
1602 xxxxfile=`echo $xxxfile | sed -e 's@_[^_]*$@@'`
1605 *) case "$osvers" in
1608 *) if $test -f $file.sh ; then
1610 elif $test -f $xfile.sh ; then
1612 elif $test -f $xxfile.sh ; then
1614 elif $test -f $xxxfile.sh ; then
1616 elif $test -f $xxxxfile.sh ; then
1618 elif $test -f "${osname}.sh" ; then
1629 dflt=`echo $hintfile | sed 's/\.sh$//'`
1635 You may give one or more space-separated answers, or "none" if appropriate.
1636 If your OS version has no hints, DO NOT give a wrong version -- say "none".
1639 rp="Which of these apply, if any?"
1642 for file in $tans; do
1643 if $test -f $file.sh; then
1645 $cat $file.sh >> ../UU/config.sh
1646 elif $test X$tans = X -o X$tans = Xnone ; then
1649 : Give one chance to correct a possible typo.
1650 echo "$file.sh does not exist"
1652 rp="hint to use instead?"
1654 for file in $ans; do
1655 if $test -f "$file.sh"; then
1657 $cat $file.sh >> ../UU/config.sh
1658 elif $test X$ans = X -o X$ans = Xnone ; then
1661 echo "$file.sh does not exist -- ignored."
1668 : Remember our hint file for later.
1669 if $test -f "$file.sh" ; then
1681 echo "Fetching default answers from $config_sh..." >&4
1685 cp $config_sh config.sh 2>/dev/null
1695 : Restore computed paths
1696 for file in $loclist $trylist; do
1697 eval $file="\$_$file"
1702 Configure uses the operating system name and version to set some defaults.
1703 Say "none" to leave it blank.
1710 ''|' '|none) dflt=none ;;
1711 *) dflt=`echo $hintfile | sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
1714 *) dflt="$osname" ;;
1716 rp="Operating system name?"
1722 : who configured the system
1723 cf_time=`$date 2>&1`
1724 (logname > .temp) >/dev/null 2>&1
1725 $test -s .temp || (whoami > .temp) >/dev/null 2>&1
1726 $test -s .temp || echo unknown > .temp
1730 : determine where manual pages are on this system
1734 syspath='/usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1'
1735 syspath="$syspath /usr/man/u_man/man1 /usr/share/man/man1"
1736 syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
1737 syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
1738 syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
1739 sysman=`./loc . /usr/man/man1 $syspath`
1742 if $test -d "$sysman"; then
1743 echo "System manual is in $sysman." >&4
1745 echo "Could not find manual pages in source form." >&4
1748 : see what memory models we can support
1751 $cat >pdp11.c <<'EOP'
1760 cc -o pdp11 pdp11.c >/dev/null 2>&1
1761 if ./pdp11 2>/dev/null; then
1762 dflt='unsplit split'
1764 tans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1767 *) if $test -d /lib/small || $test -d /usr/lib/small; then
1772 if $test -d /lib/medium || $test -d /usr/lib/medium; then
1775 if $test -d /lib/large || $test -d /usr/lib/large; then
1778 if $test -d /lib/huge || $test -d /usr/lib/huge; then
1787 Some systems have different model sizes. On most systems they are called
1788 small, medium, large, and huge. On the PDP11 they are called unsplit and
1789 split. If your system doesn't support different memory models, say "none".
1790 If you wish to force everything to one memory model, say "none" here and
1791 put the appropriate flags later when it asks you for other cc and ld flags.
1792 Venix systems may wish to put "none" and let the compiler figure things out.
1793 (In the following question multiple model names should be space separated.)
1796 rp="Which memory models are supported?"
1811 '') if $contains '\-i' $sysman/ld.1 >/dev/null 2>&1 || \
1812 $contains '\-i' $sysman/cc.1 >/dev/null 2>&1; then
1819 rp="What flag indicates separate I and D space?"
1827 *large*|*small*|*medium*|*huge*)
1834 rp="What flag indicates large model?"
1844 *huge*) case "$huge" in
1848 rp="What flag indicates huge model?"
1858 *medium*) case "$medium" in
1862 rp="What flag indicates medium model?"
1869 *) medium="$large";;
1872 *small*) case "$small" in
1876 rp="What flag indicates small model?"
1887 echo "Unrecognized memory models--you may have to edit Makefile.SH" >&4
1891 : make some quick guesses about what we are up against
1893 $echo $n "Hmm... $c"
1901 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
1902 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
1904 echo "Looks kind of like an OSF/1 system, but we'll see..."
1906 elif test `echo abc | tr a-z A-Z` = Abc ; then
1907 xxx=`./loc addbib blurfl $pth`
1908 if $test -f $xxx; then
1909 echo "Looks kind of like a USG system with BSD features, but we'll see..."
1913 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
1914 echo "Looks kind of like an extended USG system, but we'll see..."
1916 echo "Looks kind of like a USG system, but we'll see..."
1920 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
1921 echo "Looks kind of like a BSD system, but we'll see..."
1924 echo "Looks kind of like a Version 7 system, but we'll see..."
1927 case "$eunicefix" in
1930 There is, however, a strange, musty smell in the air that reminds me of
1931 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
1935 : it so happens the Eunice I know will not run shell scripts in Unix format
1939 echo "Congratulations. You aren't running Eunice."
1943 if test -f /xenix; then
1944 echo "Actually, this looks more like a XENIX system..."
1949 echo "It's not Xenix..."
1954 if test -f /venix; then
1955 echo "Actually, this looks more like a VENIX system..."
1962 echo "Nor is it Venix..."
1965 chmod +x bsd usg v7 osf1 eunice xenix venix
1966 $eunicefix bsd usg v7 osf1 eunice xenix venix
1969 : see if we need a special compiler
1977 *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
1978 if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
1991 On some systems the default C compiler will not resolve multiple global
1992 references that happen to have the same name. On some such systems the "Mcc"
1993 command may be used to force these to be resolved. On other systems a "cc -M"
1994 command is required. (Note that the -M flag on other systems indicates a
1995 memory model to use!) If you have the Gnu C compiler, you might wish to use
1999 rp="What command will force resolution on this system?"
2007 rp="Use which C compiler?"
2011 echo "Checking if you are using GNU cc ..." >&4
2012 $cat >gccvers.c <<EOM
2017 printf("%s\n", __VERSION__);
2019 printf("%s\n", "1");
2025 if $cc -o gccvers gccvers.c >/dev/null 2>&1; then
2026 gccversion=`./gccvers`
2027 case "$gccversion" in
2028 '') echo "You are not using GNU cc." ;;
2029 *) echo "You are using GNU cc $gccversion." ;;
2032 echo "I can't compile the test program. I'll assume it's not GNU cc."
2035 case "$gccversion" in
2036 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
2039 : decide how portable to be
2040 case "$d_portable" in
2046 I can set things up so that your shell scripts and binaries are more portable,
2047 at what may be a noticable cost in performance. In particular, if you
2048 ask to be portable, the following happens:
2050 1) Shell scripts will rely on the PATH variable rather than using
2051 the paths derived above.
2052 2) ~username interpretations will be done at run time rather than
2056 rp="Do you expect to run these scripts and binaries on multiple machines?"
2059 y*) d_portable="$define"
2060 for file in $loclist $trylist; do
2064 *) d_portable="$undef" ;;
2067 : set up shell script to do ~ expansion
2073 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
2076 if $test -f /bin/csh; then
2077 /bin/csh -f -c "glob \$1"
2082 name=\`$expr x\$1 : '..\([^/]*\)'\`
2083 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
2084 if $test ! -d "\$dir"; then
2086 echo "\$me: can't locate home directory for: \$name" >&2
2091 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
2107 : now set up to get a file name
2108 cat <<'EOSC' >getfile
2121 loc_file=`expr $fn : '.*:\(.*\)'`
2122 fn=`expr $fn : '\(.*\):.*'`
2130 */*) fullpath=true;;
2139 *e*) exp_file=true;;
2142 *p*) nopath_ok=true;;
2147 *d*) type='Directory';;
2148 *l*) type='Locate';;
2153 Locate) what='File';;
2158 case "$d_portable" in
2166 while test "$type"; do
2171 true) rp="$rp (~name ok)";;
2187 value=`UU/filexp $ans`
2190 if test "$ans" != "$value"; then
2191 echo "(That is $value on this particular system.)"
2205 /*) value="$ansexp" ;;
2210 echo "I shall only accept a full path name, as in /bin/ls." >&4
2211 echo "Use a ! shell escape if you wish to check pathnames." >&4
2214 echo "Please give a full path name, starting with slash." >&4
2217 echo "Note that using ~name is ok provided it expands well." >&4
2230 if test -f "$ansexp"; then
2232 elif test -r "$ansexp" || (test -h "$ansexp") >/dev/null 2>&1
2234 echo "($value is not a plain file, but that's ok.)"
2239 if test -d "$ansexp"; then
2244 if test -d "$value"; then
2245 echo "(Looking for $loc_file in directory $value.)"
2246 value="$value/$loc_file"
2248 if test -f "$value"; then
2251 case "$nopath_ok" in
2252 true) case "$value" in
2254 *) echo "Assuming $value will be in people's path."
2270 if test "$fastread" = yes; then
2275 rp="$what $value doesn't exist. Use that name anyway?"
2295 : What should the include directory be ?
2297 $echo $n "Hmm... $c"
2301 if $test -f /bin/mips && /bin/mips; then
2302 echo "Looks like a MIPS system..."
2303 $cat >usr.c <<'EOCP'
2304 #ifdef SYSTYPE_BSD43
2308 if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
2309 dflt='/bsd43/usr/include'
2313 mips_type='System V'
2315 $rm -f usr.c usr.out
2316 echo "and you're compiling with the $mips_type compiler and libraries."
2318 echo "Doesn't look like a MIPS system."
2329 rp='Where are the include files you want to use?'
2333 : see how we invoke the C preprocessor
2335 echo "Now, how can we feed standard input to your C preprocessor..." >&4
2336 cat <<'EOT' >testcpp.c
2342 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
2344 wrapper=`pwd`/cppstdin
2348 if $test "X$cppstdin" != "X" && \
2349 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
2350 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2352 echo "You used to use $cppstdin $cppminus so we'll use that again."
2354 '') echo "But let's see if we can live without a wrapper..." ;;
2356 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
2357 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2359 echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
2362 echo "(However, $cpprun $cpplast does not work, let's see...)"
2370 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
2377 elif echo 'Maybe "'"$cc"' -E" will work...'; \
2378 $cc -E <testcpp.c >testcpp.out 2>&1; \
2379 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2380 echo "Yup, it does."
2383 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
2384 $cc -E - <testcpp.c >testcpp.out 2>&1; \
2385 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2386 echo "Yup, it does."
2389 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
2390 $cc -P <testcpp.c >testcpp.out 2>&1; \
2391 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2392 echo "Yipee, that works!"
2395 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
2396 $cc -P - <testcpp.c >testcpp.out 2>&1; \
2397 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2398 echo "At long last!"
2401 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
2402 $cpp <testcpp.c >testcpp.out 2>&1; \
2403 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2407 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
2408 $cpp - <testcpp.c >testcpp.out 2>&1; \
2409 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2410 echo "Hooray, it works! I was beginning to wonder."
2413 elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
2414 $wrapper <testcpp.c >testcpp.out 2>&1; \
2415 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2421 rp="No dice. I can't find a C preprocessor. Name one:"
2425 $x_cpp <testcpp.c >testcpp.out 2>&1
2426 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
2427 echo "OK, that will do." >&4
2429 echo "Sorry, I can't get that to work. Go find one and rerun Configure." >&4
2444 echo "Perhaps can we force $cc -E using a wrapper..."
2445 if $wrapper <testcpp.c >testcpp.out 2>&1; \
2446 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
2452 echo "Nope, we'll have to live without it..."
2467 *) $rm -f $wrapper;;
2469 $rm -f testcpp.c testcpp.out
2471 : determine optimize, if desired, or use for debug flag also
2475 *) dflt="$optimize";;
2479 Some C compilers have problems with their optimizers, by default, $package
2480 compiles with the -O flag to use the optimizer. Alternately, you might want
2481 to use the symbolic debugger, which uses the -g flag (on traditional Unix
2482 systems). Either flag can be specified here. To use neither flag, specify
2486 rp="What optimizer/debugger flag should be used?"
2490 'none') optimize=" ";;
2496 case "$gccversion" in
2497 1*) dflt='-fpcc-struct-return' ;;
2500 *-g*) dflt="$dflt -DDEBUGGING";;
2502 case "$gccversion" in
2503 2*) if test -d /etc/conf/kconfig.d &&
2504 $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
2513 case "$mips_type" in
2516 *) inclwanted="$inclwanted $usrinc/bsd";;
2518 for thisincl in $inclwanted; do
2519 if $test -d $thisincl; then
2520 if $test x$thisincl != x$usrinc; then
2523 *) dflt="$dflt -I$thisincl";;
2529 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
2531 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
2539 *) dflt="$dflt -D$2";;
2544 set signal.h __LANGUAGE_C__; eval $inctest
2546 set signal.h LANGUAGE_C; eval $inctest
2548 set signal.h NO_PROTOTYPE; eval $inctest
2549 set signal.h _NO_PROTO; eval $inctest
2556 *) dflt="$ccflags";;
2560 Your C compiler may want other flags. For this question you should include
2561 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
2562 but you should NOT include libraries or ld flags like -lwhatever. If you
2563 want $package to honor its debug switch, you should include -DDEBUGGING here.
2564 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE,
2565 -DHIDEMYMALLOC or -DCRIPPLED_CC.
2567 To use no flags, specify the word "none".
2573 rp="Any additional cc flags?"
2580 : the following weeds options from ccflags that are of no interest to cpp
2582 case "$gccversion" in
2583 1*) cppflags="$cppflags -D__GNUC__"
2585 case "$mips_type" in
2587 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
2593 echo "Let me guess what the preprocessor flags are..." >&4
2607 *) ftry="$previous $flag";;
2609 if $cppstdin -DLFRULB=bar $ftry $cppminus <cpp.c \
2610 >cpp1.out 2>/dev/null && \
2611 $cpprun -DLFRULB=bar $ftry $cpplast <cpp.c \
2612 >cpp2.out 2>/dev/null && \
2613 $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
2614 $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
2616 cppflags="$cppflags $ftry"
2626 *-*) echo "They appear to be: $cppflags";;
2628 $rm -f cpp.c cpp?.out
2632 : flags used in final linking phase
2640 *-posix*) dflt="$dflt -posix" ;;
2646 *) dflt="$ldflags";;
2649 rp="Any additional ld flags (NOT including libraries)?"
2655 rmlist="$rmlist pdp11"
2657 : Set private lib path
2660 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
2665 '') dlist="$plibpth $glibpth";;
2666 *) dlist="$libpth";;
2669 : Now check and see which directories actually exist, avoiding duplicates
2673 if $test -d $xxx; then
2676 *) libpth="$libpth $xxx";;
2682 Some systems have incompatible or broken versions of libraries. Among
2683 the directories listed in the question below, please remove any you
2684 know not to be holding relevant libraries, and add any that are needed.
2685 Say "none" for none.
2696 rp="Directories to use for library searches?"
2703 : compute shared library extension
2706 if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
2716 On some systems, shared libraries may be available. Answer 'none' if
2717 you want to suppress searching of shared libraries.
2719 rp='What is the file extension used for shared libraries?'
2723 : Looking for optional libraries
2725 echo "Checking for optional libraries..." >&4
2730 case "$libswanted" in
2731 '') libswanted='c_s';;
2733 for thislib in $libswanted; do
2735 if xxx=`./loc lib$thislib.$so.[0-9]'*' X $libpth`; $test -f "$xxx"; then
2736 echo "Found -l$thislib (shared)."
2739 *) dflt="$dflt -l$thislib";;
2741 elif xxx=`./loc lib$thislib.$so X $libpth` ; $test -f "$xxx"; then
2742 echo "Found -l$thislib (shared)."
2745 *) dflt="$dflt -l$thislib";;
2747 elif xxx=`./loc lib$thislib.a X $libpth`; $test -f "$xxx"; then
2748 echo "Found -l$thislib."
2751 *) dflt="$dflt -l$thislib";;
2753 elif xxx=`./loc lib${thislib}_s.a X $libpth`; $test -f "$xxx"; then
2754 echo "Found -l${thislib}_s."
2757 *) dflt="$dflt -l${thislib}_s";;
2759 elif xxx=`./loc Slib$thislib.a X $xlibpth`; $test -f "$xxx"; then
2760 echo "Found -l$thislib."
2763 *) dflt="$dflt -l$thislib";;
2766 echo "No -l$thislib."
2777 ' '|'') dflt='none';;
2782 Some versions of Unix support shared libraries, which make executables smaller
2783 but make load time slightly longer.
2785 On some systems, mostly newer Unix System V's, the shared library is included
2786 by putting the option "-lc_s" as the last thing on the cc command line when
2787 linking. Other systems use shared libraries by default. There may be other
2788 libraries needed to compile $package on your machine as well. If your system
2789 needs the "-lc_s" option, include it here. Include any other special libraries
2790 here as well. Say "none" for none.
2794 rp="Any additional libraries?"
2801 : see if nm is to be used to determine whether a symbol is defined or not
2804 dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null`
2805 if $test $dflt -gt 20; then
2820 I can use 'nm' to extract the symbols from your C libraries. This is a time
2821 consuming task which may generate huge output on the disk (up to 3 megabytes)
2822 but that should make the symbols extraction faster. The alternative is to skip
2823 the 'nm' extraction part and to compile a small test program instead to
2824 determine whether each symbol is present. If you have a fast C compiler and/or
2825 if your 'nm' output cannot be parsed, this may be the best solution.
2828 rp='Shall I use nm to extract C symbols from the libraries?'
2840 : nm options which may be necessary
2842 '') if $test -f /mach_boot; then
2844 elif $test -d /usr/ccs/lib; then
2846 elif $test -f /dgux; then
2855 : get list of predefined functions in a handy place
2860 *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
2867 *) for thislib in $libs; do
2870 : Handle C library specially below.
2873 thislib=`echo X$thislib | $sed -e 's/^X//' -e 's/^-l//'`
2874 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
2876 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
2878 elif try=`./loc lib$thislib.a X $libpth`; $test -f "$try"; then
2880 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
2882 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
2884 elif try=`./loc Slib$thislib.a X $xlibpth`; $test -f "$try"; then
2889 libnames="$libnames $try"
2891 *) libnames="$libnames $thislib" ;;
2899 set /usr/ccs/lib/libc.$so
2900 $test -r $1 || set /usr/lib/libc.$so
2901 $test -r $1 || set /usr/shlib/libc.$so
2902 $test -r $1 || set /usr/lib/libc.$so.[0-9]*
2903 $test -r $1 || set /lib/libc.$so
2904 $test -r $1 || set /lib/libsys_s.a
2911 if $test -r "$1"; then
2912 echo "Your (shared) C library seems to be in $1."
2914 elif $test -r /lib/libc && $test -r /lib/clib; then
2915 echo "Your C library seems to be in both /lib/clib and /lib/libc."
2917 libc='/lib/clib /lib/libc'
2918 if $test -r /lib/syslib; then
2919 echo "(Your math library is in /lib/syslib.)"
2920 libc="$libc /lib/syslib"
2922 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
2923 echo "Your C library seems to be in $libc, as you said before."
2924 elif $test -r $incpath/usr/lib/libc.a; then
2925 libc=$incpath/usr/lib/libc.a;
2926 echo "Your C library seems to be in $libc. That's fine."
2927 elif $test -r /lib/libc.a; then
2929 echo "Your C library seems to be in $libc. You're normal."
2931 if tans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$tans"; then
2933 elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
2934 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
2935 elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
2937 elif tans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
2939 elif tans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$tans"; then
2942 tans=`./loc Llibc.a blurfl/dyick $xlibpth`
2944 if $test -r "$tans"; then
2945 echo "Your C library seems to be in $tans, of all places."
2951 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
2955 If the guess above is wrong (which it might be if you're using a strange
2956 compiler, or your machine supports multiple models), you can override it here.
2961 echo $libpth | tr ' ' '\012' | sort | uniq > libpath
2963 I can't seem to find your C library. I've looked in the following places:
2966 $sed 's/^/ /' libpath
2969 None of these seems to contain your C library. I need to get its name...
2974 rp='Where is your C library?'
2979 echo $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
2980 set X `cat libnames`
2983 case $# in 1) xxx=file; esac
2984 echo "Extracting names from the following $xxx for later perusal:" >&4
2986 $sed 's/^/ /' libnames >&4
2988 $echo $n "This may take a while...$c" >&4
2989 nm $nm_opt $* 2>/dev/null >libc.tmp
2991 $grep fprintf libc.tmp > libc.ptf
2992 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
2993 xrun='eval "<libc.tmp $com >libc.list"; echo "done" >&4'
2994 if com="$sed -n -e 's/^.* [ADTSI] *_[_.]*//p' -e 's/^.* [ADTSI] //p'";\
2996 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
2998 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
3000 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3002 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
3004 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3006 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
3008 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3010 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
3012 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3014 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
3016 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3018 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
3019 -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
3021 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3023 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
3025 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3027 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
3029 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3031 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
3033 $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3036 nm -p $* 2>/dev/null >libc.tmp
3037 com="$sed -n -e 's/^.* [ADTS] *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
3038 eval "<libc.tmp $com >libc.list"
3039 if $contains '^fprintf$' libc.list >/dev/null 2>&1; then
3044 echo "nm didn't seem to work right. Trying ar instead..." >&4
3046 if ar t $libc > libc.tmp; then
3047 for thisname in $libnames; do
3048 ar t $thisname >>libc.tmp
3050 $sed -e 's/\.o$//' < libc.tmp > libc.list
3053 echo "ar didn't seem to work right." >&4
3054 echo "Maybe this is a Cray...trying bld instead..." >&4
3055 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
3056 for thisname in $libnames; do
3058 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
3059 ar t $thisname >>libc.tmp
3063 echo "That didn't work either. Giving up." >&4
3070 if $test -f /lib/syscalls.exp; then
3072 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
3073 $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
3077 $rm -f libnames libpath
3079 : is a C symbol defined?
3082 -v) tf=libc.tmp; tc=""; tdc="";;
3083 -a) tf=libc.tmp; tc="[0]"; tdc=[];;
3084 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
3087 case "$reuseval-$4" in
3089 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
3095 if $contains $tlook $tf >/dev/null 2>&1;
3100 echo "main() { extern int $1$tdc; printf(\"%d\", $1$tc); }" > t.c;
3101 if $cc $ccflags -o t t.c $ldflags $libs >/dev/null 2>&1;
3109 $define) tval=true;;
3115 : set up the script used to warn in case of inconsistency
3119 echo "*** WHOA THERE!!! ***" >&4
3120 echo " The $hint value for \$$var on this machine was \"$was\"!" >&4
3121 rp=" Keep the $hint value?"
3124 y) td=$was; tu=$was;;
3128 : define an is-in-libc? function
3129 inlibc='echo " "; td=$define; tu=$undef;
3130 sym=$1; var=$2; eval "was=\$$2";
3132 case "$reuseval$was" in
3142 echo "$sym() found." >&4;
3143 case "$was" in $undef) . whoa; esac; eval "$var=\$td";;
3145 echo "$sym() NOT found." >&4;
3146 case "$was" in $define) . whoa; esac; eval "$var=\$tu";;
3150 $define) echo "$sym() found." >&4;;
3151 *) echo "$sym() NOT found." >&4;;
3155 : see if gconvert exists
3156 set gconvert d_gconvert
3159 case "$d_gconvert" in
3161 d_Gconvert="gconvert((x),(n),(t),(b))"
3164 : Maybe we can emulate it with gcvt.
3170 : Test whether gcvt drops a trailing decimal point
3175 if (buf[0] != '1' || buf[1] != '\0')
3178 if (buf[0] != '0' || buf[1] != '\0')
3181 if (buf[0] != '-' || buf[1] != '1' || buf[2] != '\0')
3186 if $cc $ccflags $ldflags -o try try.c $libs > /dev/null 2>&1; then
3188 echo "Good, your gcvt() drops a trailing decimal point."
3189 d_Gconvert="gcvt((x),(n),(b))"
3191 echo "But your gcvt() keeps a trailing decimal point".
3195 echo "Hmm. I can't compile the gcvt test program."
3201 case "$d_Gconvert" in
3203 echo "I'll use sprintf instead." >&4
3204 d_Gconvert='sprintf((b),"%.*g",(n),(x))'
3209 : Initialize h_fcntl
3212 : Initialize h_sysfile
3215 : determine filename position in cpp output
3217 echo "Computing filename position in cpp output for #include directives..." >&4
3218 echo '#include <stdio.h>' > foo.c
3221 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
3222 $grep '^[ ]*#.*stdio\.h' | \
3223 while read cline; do
3226 while $test \$# -gt 0; do
3227 if $test -r \`echo \$1 | $tr -d '"'\`; then
3232 pos=\`expr \$pos + 1\`
3244 *) pos="${fieldn}th";;
3246 echo "Your cpp writes the filename in the $pos field of the line."
3248 : locate header file
3253 if test -f $usrinc/\$wanted; then
3254 echo "$usrinc/\$wanted"
3257 awkprg='{ print \$$fieldn }'
3258 echo "#include <\$wanted>" > foo\$\$.c
3259 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
3260 $grep "^[ ]*#.*\$wanted" | \
3261 while read cline; do
3262 name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
3264 */\$wanted) echo "\$name"; exit 0;;
3275 : access call always available on UNIX
3279 : locate the flags for 'access()'
3283 $cat >access.c <<'EOCP'
3284 #include <sys/types.h>
3289 #include <sys/file.h>
3298 : check sys/file.h first, no particular reason here
3299 if $test `./findhdr sys/file.h` && \
3300 $cc $cppflags -DI_SYS_FILE access.c -o access >/dev/null 2>&1 ; then
3302 echo "<sys/file.h> defines the *_OK access constants." >&4
3303 elif $test `./findhdr fcntl.h` && \
3304 $cc $cppflags -DI_FCNTL access.c -o access >/dev/null 2>&1 ; then
3306 echo "<fcntl.h> defines the *_OK access constants." >&4
3307 elif $test `./findhdr unistd.h` && \
3308 $cc $cppflags -DI_UNISTD access.c -o access >/dev/null 2>&1 ; then
3309 echo "<unistd.h> defines the *_OK access constants." >&4
3311 echo "I can't find the four *_OK access constants--I'll use mine." >&4
3317 : see if alarm exists
3323 if test -d /afs; then
3324 echo "AFS may be running... I'll be extra cautious then..." >&4
3327 echo "AFS does not seem to be running..." >&4
3331 : determine root of directory hierarchy where package will be installed.
3334 dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3342 By default, $package will be installed in $dflt/bin, manual
3343 pages under $dflt/man, etc..., i.e. with $dflt as prefix for
3344 all installation directories. Typically set to /usr/local, but you
3345 may choose /usr if you wish to install $package among your system
3346 binaries. If you wish to have binaries under /bin but manual pages
3347 under /usr/local/man, that's ok: you will be prompted separately
3348 for each of the installation directories, the prefix being only used
3353 rp='Installation prefix to use?'
3357 : determine where private executables go
3360 dflt=$prefix/lib/$package
3367 There are some auxiliary files for $package that need to be put into a
3368 private library directory that is accessible by everyone.
3372 rp='Pathname where private library files will reside?'
3375 privlibexp="$ansexp"
3379 Since you are running AFS, I need to distinguish the directory in which
3380 private files reside from the directory in which they are installed (and from
3381 which they are presumably copied to the former directory by occult means).
3384 case "$installprivlib" in
3385 '') dflt=`echo $privlibexp | sed 's#^/afs/#/afs/.#'`;;
3386 *) dflt="$installprivlib";;
3389 rp='Where will private files be installed?'
3391 installprivlib="$ans"
3393 installprivlib="$privlibexp"
3396 : determine where public architecture dependent libraries go
3398 '') tpath=`echo $PATH | sed -e 's/:/ /g'`
3399 xxx=`./loc arch blurfl $tpath`
3400 if test -f "$xxx"; then
3402 archname="${tarchname}-${osname}"
3409 '') dflt=`./loc . "." $prefix/lib /usr/local/lib /usr/lib /lib`;;
3410 *) dflt="$privlib/$archname";;
3415 $package contains architecture-dependent library files. If you are
3416 sharing libraries in a heterogeneous environment, you might store
3417 these files in a separate location. Otherwise, you can just include
3418 them with the rest of the public library files.
3421 rp='Where do you want to put the public architecture-dependent libraries?'
3424 archlibexp="$ansexp"
3429 Since you are running AFS, I need to distinguish the directory in which
3430 private files reside from the directory in which they are installed (and from
3431 which they are presumably copied to the former directory by occult means).
3434 case "$installarchlib" in
3435 '') dflt=`echo $archlibexp | sed 's#^/afs/#/afs/.#'`;;
3436 *) dflt="$installarchlib";;
3439 rp='Where will architecture-dependent library files be installed?'
3441 installarchlib="$ans"
3443 installarchlib="$archlibexp"
3445 if $test X"$archlib" = X"$privlib"; then
3452 : function used to set $1 to $val
3453 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3455 $define$undef) . whoa; eval "$var=\$td";;
3456 $undef$define) . whoa; eval "$var=\$tu";;
3457 *) eval "$var=$val";;
3460 : Look for GNUC style attribute checking
3462 echo "Checking whether your compiler can handle __attribute__ ..." >&4
3463 $cat >attrib.c <<'EOCP'
3464 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
3466 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
3467 if $contains 'warning' attrib.out >/dev/null 2>&1; then
3468 echo "Your C compiler doesn't fully support __attribute__. ."
3471 echo "Your C compiler supports __attribute__. ."
3475 echo "Your C compiler doesn't seem to understand __attribute__. ."
3482 : see if bcmp exists
3486 : see if bcopy exists
3490 : see if setpgrp exists
3491 set setpgrp d_setpgrp
3494 : see which flavor of setpgrp is in use
3495 case "$d_setpgrp" in
3501 if (getuid() == 0) {
3502 printf("(I see you are running Configure as super-user...)\n");
3505 if (-1 == setpgrp(1, 1))
3510 if $cc $ccflags -o set $ldflags set.c $libs >/dev/null 2>&1; then
3513 0) echo "You have to use setpgrp() instead of setpgrp(pid, pgrp)." >&4
3515 *) echo "You have to use setpgrp(pid, pgrp) instead of setpgrp()." >&4
3520 xxx="USG one, i.e. you use setpgrp()."
3523 xxx="BSD one, i.e. you use setpgrp(pid, pgrp)."
3526 echo "Assuming your setpgrp is a $xxx" >&4
3535 : see if bzero exists
3539 : check for length of integer
3543 echo "Checking to see how big your integers are..." >&4
3544 $cat >try.c <<'EOCP'
3548 printf("%d\n", sizeof(int));
3551 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
3555 echo "(I can't seem to compile the test program. Guessing...)"
3562 rp="What is the size of an integer (in bytes)?"
3567 : check for ability to cast large floats to 32-bit ints.
3569 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
3570 if $test "$intsize" -eq 4; then
3576 #include <sys/types.h>
3578 blech() { exit(3); }
3584 signal(SIGFPE, blech);
3586 f = (double) 0x7fffffff;
3590 if (i32 != ($xxx) f)
3595 if $cc -o try $ccflags try.c >/dev/null 2>&1; then
3599 echo "(I can't seem to compile the test program--assuming it can't)"
3607 echo "Nope, it can't."
3614 : check for ability to cast negative floats to unsigned
3616 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
3617 $cat >try.c <<'EOCP'
3619 blech() { exit(3); }
3623 unsigned long along;
3625 unsigned short ashort;
3628 signal(SIGFPE, blech);
3629 along = (unsigned long)f;
3630 aint = (unsigned int)f;
3631 ashort = (unsigned short)f;
3632 if (along != (unsigned long)-123)
3634 if (aint != (unsigned int)-123)
3636 if (ashort != (unsigned short)-123)
3638 f = (double)0x40000000;
3641 along = (unsigned long)f;
3642 if (along != 0x80000000)
3646 along = (unsigned long)f;
3647 if (along != 0x7fffffff)
3651 along = (unsigned long)f;
3652 if (along != 0x80000001)
3658 if $cc -o try $ccflags try.c >/dev/null 2>&1; then
3664 case "$castflags" in
3669 echo "Nope, it can't."
3676 : see if sprintf is declared as int or pointer to char
3678 $cat >ucbsprf.c <<'EOF'
3683 exit((unsigned long)sprintf(buf,"%s","foo") > 10L);
3686 if $cc ucbsprf.c -o ucbsprf >/dev/null 2>&1 && ./ucbsprf; then
3687 echo "Your sprintf() returns (int)." >&4
3690 echo "Your sprintf() returns (char*)." >&4
3697 : see if vprintf exists
3699 if set vprintf val -f d_vprintf; eval $csym; $val; then
3700 echo 'vprintf() found.' >&4
3702 $cat >vprintf.c <<'EOF'
3703 #include <varargs.h>
3705 main() { xxx("foo"); }
3714 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
3717 if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
3718 echo "Your vsprintf() returns (int)." >&4
3721 echo "Your vsprintf() returns (char*)." >&4
3725 echo 'vprintf() NOT found.' >&4
3735 : see if chown exists
3739 : see if chroot exists
3743 : see if chsize exists
3747 : check for const keyword
3749 echo 'Checking to see if your C compiler knows about "const"...' >&4
3750 $cat >const.c <<'EOCP'
3751 typedef struct spug { int drokk; } spug;
3758 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
3760 echo "Yup, it does."
3763 echo "Nope, it doesn't."
3768 : see if crypt exists
3770 if set crypt val -f d_crypt; eval $csym; $val; then
3771 echo 'crypt() found.' >&4
3775 cryptlib=`./loc Slibcrypt.a "" $xlibpth`
3776 if $test -z "$cryptlib"; then
3777 cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
3781 if $test -z "$cryptlib"; then
3782 cryptlib=`./loc Llibcrypt.a "" $xlibpth`
3786 if $test -z "$cryptlib"; then
3787 cryptlib=`./loc libcrypt.a "" $libpth`
3791 if $test -z "$cryptlib"; then
3792 echo 'crypt() NOT found.' >&4
3801 : get csh whereabouts
3803 'csh') val="$undef" ;;
3809 : see if cuserid exists
3810 set cuserid d_cuserid
3813 : define an alternate in-header-list? function
3814 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
3815 cont=true; xxf="echo \"<\$1> found.\" >&4";
3816 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
3817 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
3819 case $# in 4) instead=instead;; *) instead="at last";; esac;
3820 while $test "$cont"; do
3822 var=$2; eval "was=\$$2";
3823 if $test "$xxx" && $test -r "$xxx";
3825 eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
3828 eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi;
3829 set $yyy; shift; shift; yyy=$@;
3830 case $# in 0) cont="";;
3831 2) xxf="echo \"but I found <\$1> $instead.\" >&4";
3832 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
3833 *) xxf="echo \"but I found <\$1\> instead.\" >&4";
3834 xxnf="echo \"there is no <\$1>, ...\" >&4";;
3838 do set $yyy; var=$2; eval "was=\$$2";
3839 eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu";
3840 set $yyy; shift; shift; yyy=$@;
3843 : see if this is a limits.h system
3844 set limits.h i_limits
3847 : see if this is a float.h system
3851 : See if number of significant digits in a double precision number is known
3853 $cat >dbl_dig.c <<EOM
3863 printf("Contains DBL_DIG");
3866 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
3867 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
3868 echo "DBL_DIG found." >&4
3871 echo "DBL_DIG NOT found." >&4
3878 : see if difftime exists
3879 set difftime d_difftime
3882 : see if this is a dirent system
3884 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
3886 echo "<dirent.h> found." >&4
3889 if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
3890 echo "<sys/dir.h> found." >&4
3893 xinc=`./findhdr sys/ndir.h`
3895 echo "<dirent.h> NOT found." >&4
3900 : Look for type of directory structure.
3902 $cppstdin $cppflags $cppminus < "$xinc" > try.c
3904 case "$direntrytype" in
3907 $define) guess1='struct dirent' ;;
3908 *) guess1='struct direct' ;;
3911 *) guess1="$direntrytype"
3916 'struct dirent') guess2='struct direct' ;;
3917 *) guess2='struct dirent' ;;
3920 if $contains "$guess1" try.c >/dev/null 2>&1; then
3921 direntrytype="$guess1"
3922 echo "Your directory entries are $direntrytype." >&4
3923 elif $contains "$guess2" try.c >/dev/null 2>&1; then
3924 direntrytype="$guess2"
3925 echo "Your directory entries seem to be $direntrytype." >&4
3927 echo "I don't recognize your system's directory entries." >&4
3928 rp="What type is used for directory entries on this system?"
3936 : see if the directory entry stores field length
3938 if $contains 'd_namlen' $xinc >/dev/null 2>&1; then
3939 echo "Good, your directory entry keeps length information in d_namlen." >&4
3942 echo "Your directory entry does not know about the d_namlen field." >&4
3948 : see if dlerror exists
3949 set dlerror d_dlerror
3952 : see if dld is available
3956 : see if dlopen exists
3960 : determine which dynamic loading, if any, to compile in
3962 dldir="ext/DynaLoader"
3980 : Does a dl_xxx.xs file exist for this operating system
3981 $test -f ../$dldir/dl_${osname}.xs && dflt='y'
3984 rp="Do you wish to use dynamic loading?"
3991 if $test -f ../$dldir/dl_${osname}.xs ; then
3992 dflt="$dldir/dl_${osname}.xs"
3993 elif $test "$d_dlopen" = "$define" ; then
3994 dflt="$dldir/dl_dlopen.xs"
3995 elif $test "$i_dld" = "$define" ; then
3996 dflt="$dldir/dl_dld.xs"
4001 *) dflt="$dldir/$dlsrc"
4004 echo "The following dynamic loading files are available:"
4005 : Can not go over to $dldir because getfile has path hard-coded in.
4006 cd ..; ls -C $dldir/dl*.xs; cd UU
4007 rp="Source file to use for dynamic loading"
4012 dlsrc=`echo $ans | $sed -e 's@.*/\([^/]*\)$@\1@'`
4015 Some systems may require passing special flags to $cc -c to
4016 compile modules that will be used to create a shared library.
4017 To use no flags, say "none".
4020 case "$cccdlflags" in
4021 ''|' ') case "$osname" in
4023 next) dflt='none' ;;
4026 *gcc*) dflt='-fpic' ;;
4032 *gcc*) dflt='-fpic' ;;
4039 *) dflt="$cccdlflags" ;;
4041 rp="Any special flags to pass to $cc -c to compile shared library modules?"
4044 none) cccdlflags='' ;;
4045 *) cccdlflags="$ans" ;;
4050 Some systems may require passing special flags to ld to create a shared
4051 library. If your ld flags include -L/local/path options to locate libraries
4052 outside your loader's normal search path, you may need to specify those
4053 -L options here as well.
4054 To use no flags, say "none".
4057 case "$lddlflags" in
4058 ''|' ') case "$osname" in
4060 next) dflt='none' ;;
4061 solaris) dflt='-G' ;;
4062 sunos) dflt='none' ;;
4066 *) dflt="$lddlflags" ;;
4068 rp="Any special flags to pass to ld to create a shared library?"
4071 none) lddlflags='' ;;
4072 *) lddlflags="$ans" ;;
4077 Some systems may require passing special flags to $cc to indicate that
4078 the resulting executable will use dynamic linking. To use no flags,
4082 case "$ccdlflags" in
4085 hpux) dflt='none' ;;
4086 next) dflt='none' ;;
4087 sunos) dflt='none' ;;
4091 *) dflt="$ccdlflags"
4094 rp="Any special flags to pass to $cc to use dynamic loading?"
4097 none) ccdlflags='' ;;
4098 *) ccdlflags="$ans" ;;
4108 : see if dlfcn is available
4116 On a few systems, the dynamically loaded modules that perl generates and uses
4117 will need a different extension then shared libs. The default will probably
4125 rp='What is the extension of dynamically loaded modules'
4134 : Check if dlsym need a leading underscore
4140 echo "Checking whether your dlsym() needs a leading underscore ..." >&4
4141 $cat >dyna.c <<'EOM'
4150 #include <dlfcn.h> /* the dynamic linker include file for Sunos/Solaris */
4152 #include <sys/types.h>
4166 int mode = RTLD_LAZY ;
4168 handle = dlopen("./dyna.$dlext", mode) ;
4169 if (handle == NULL) {
4173 symbol = dlsym(handle, "fred") ;
4174 if (symbol == NULL) {
4175 /* try putting a leading underscore */
4176 symbol = dlsym(handle, "_fred") ;
4177 if (symbol == NULL) {
4188 if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 &&
4189 ld $lddlflags -o dyna.$dlext dyna.o > /dev/null 2>&1 &&
4190 $cc $ccflags $ldflags $cccdlflags $ccdlflags fred.c -o fred $libs > /dev/null 2>&1; then
4193 1) echo "Test program failed using dlopen." >&4
4194 echo "Perhaps you should not use dynamic loading." >&4;;
4195 2) echo "Test program failed using dlsym." >&4
4196 echo "Perhaps you should not use dynamic loading." >&4;;
4197 3) echo "dlsym needs a leading underscore" >&4
4199 4) echo "dlsym doesn't need a leading underscore." >&4;;
4202 echo "I can't compile and run the test program." >&4
4207 $rm -f fred fred.? dyna.$dlext dyna.?
4212 : see if setuid scripts can be secure
4215 Some kernels have a bug that prevents setuid #! scripts from being
4216 secure. Some sites have disabled setuid #! scripts because of this.
4218 First let's decide if your kernel supports secure setuid #! scripts.
4219 (If setuid #! scripts would be secure but have been disabled anyway,
4220 don't say that they are secure if asked.)
4225 if $test -d /dev/fd; then
4226 echo "#!$ls" >reflect
4227 chmod +x,u+s reflect
4228 ./reflect >flect 2>&1
4229 if $contains "/dev/fd" flect >/dev/null; then
4230 echo "Congratulations, your kernel has secure setuid scripts!" >&4
4234 If you are not sure if they are secure, I can check but I'll need a
4235 username and password different from the one you are using right now.
4236 If you don't have such a username or don't want me to test, simply
4240 rp='Other username to test security of setuid scripts with?'
4245 case "$d_suidsafe" in
4246 '') echo "I'll assume setuid scripts are *not* secure." >&4
4249 echo "Well, the $hint value is *not* secure." >&4
4251 *) echo "Well, the $hint value *is* secure." >&4
4255 *) $rm -f reflect flect
4256 echo "#!$ls" >reflect
4257 chmod +x,u+s reflect
4260 echo '"su" will (probably) prompt you for '"$ans's password."
4261 su $ans -c './reflect >flect'
4262 if $contains "/dev/fd" flect >/dev/null; then
4263 echo "Okay, it looks like setuid scripts are secure." >&4
4266 echo "I don't think setuid scripts are secure." >&4
4271 rp='Does your kernel have *secure* setuid scripts?'
4274 [yY]*) val="$define";;
4279 echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
4285 $rm -f reflect flect
4287 : now see if they want to do setuid emulation
4290 Some systems have disabled setuid scripts, especially systems where
4291 setuid scripts cannot be secure. On systems where setuid scripts have
4292 been disabled, the setuid/setgid bits on scripts are currently
4293 useless. It is possible for $package to detect those bits and emulate
4294 setuid/setgid in a secure fashion. This emulation will only work if
4295 setuid scripts have been disabled in your kernel.
4299 case "$d_suidsafe" in
4302 echo "No need to emulate SUID scripts since they are secure here." >& 4
4306 "$define") dflt=y ;;
4309 rp="Do you want to do setuid/setgid emulation?"
4312 [yY]*) val="$define";;
4320 : see if drem exists
4324 : see if dup2 exists
4328 : see if fchmod exists
4332 : see if fchown exists
4336 : see if this is an fcntl system
4340 : see if fgetpos exists
4341 set fgetpos d_fgetpos
4344 : see if we can have long filenames
4346 rmlist="$rmlist /tmp/cf$$"
4347 $test -d /tmp/cf$$ || mkdir /tmp/cf$$
4348 first=123456789abcdef
4349 second=/tmp/cf$$/$first
4350 $rm -f $first $second
4351 if (echo hi >$first) 2>/dev/null; then
4352 if $test -f 123456789abcde; then
4353 echo 'You cannot have filenames longer than 14 characters. Sigh.' >&4
4356 if (echo hi >$second) 2>/dev/null; then
4357 if $test -f /tmp/cf$$/123456789abcde; then
4359 That's peculiar... You can have filenames longer than 14 characters, but only
4360 on some of the filesystems. Maybe you are using NFS. Anyway, to avoid problems
4361 I shall consider your system cannot support long filenames at all.
4365 echo 'You can have filenames longer than 14 characters.' >&4
4370 How confusing! Some of your filesystems are sane enough to allow filenames
4371 longer than 14 characters but some others like /tmp can't even think about them.
4372 So, for now on, I shall assume your kernel does not allow them at all.
4379 You can't have filenames longer than 14 chars. You can't even think about them!
4385 $rm -rf /tmp/cf$$ 123456789abcde*
4387 : see if flock exists
4391 : see if fmod exists
4395 : see if fork exists
4399 : see if pathconf exists
4400 set pathconf d_pathconf
4403 : see if fpathconf exists
4404 set fpathconf d_fpathconf
4407 : see if fsetpos exists
4408 set fsetpos d_fsetpos
4411 : see if gethostent exists
4412 set gethostent d_gethent
4415 : see if getlogin exists
4416 set getlogin d_getlogin
4419 : see if getpgrp exists
4420 set getpgrp d_getpgrp
4423 : see if getpgrp2 exists
4424 set getpgrp2 d_getpgrp2
4427 : see if getppid exists
4428 set getppid d_getppid
4431 : see if getpriority exists
4432 set getpriority d_getprior
4435 : see if group exists
4439 : see if this is a netinet/in.h or sys/in.h system
4440 set netinet/in.h i_niin sys/in.h i_sysin
4443 : see if htonl --and friends-- exists
4448 : Maybe they are macros.
4453 #include <sys/types.h>
4454 #$i_niin I_NETINET_IN
4457 #include <netinet/in.h>
4463 printf("Defined as a macro.");
4466 $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
4467 if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
4469 echo "But it seems to be defined as a macro." >&4
4477 : see which of string.h or strings.h is needed
4479 strings=`./findhdr string.h`
4480 if $test "$strings" && $test -r "$strings"; then
4481 echo "Using <string.h> instead of <strings.h>." >&4
4485 strings=`./findhdr strings.h`
4486 if $test "$strings" && $test -r "$strings"; then
4487 echo "Using <strings.h> instead of <string.h>." >&4
4489 echo "No string header found -- You'll surely have problems." >&4
4495 "$undef") strings=`./findhdr strings.h`;;
4496 *) strings=`./findhdr string.h`;;
4501 if set index val -f; eval $csym; $val; then
4502 if set strchr val -f d_strchr; eval $csym; $val; then
4503 if $contains strchr "$strings" >/dev/null 2>&1 ; then
4506 echo "strchr() found." >&4
4510 echo "index() found." >&4
4515 echo "index() found." >&4
4518 if set strchr val -f d_strchr; eval $csym; $val; then
4521 echo "strchr() found." >&4
4523 echo "No index() or strchr() found!" >&4
4528 set d_strchr; eval $setvar
4530 set d_index; eval $setvar
4534 $cat >isascii.c <<'EOCP'
4545 if $cc $ccflags $ldflags -o isascii isascii.c $libs >/dev/null 2>&1 ; then
4546 echo "isascii() found." >&4
4549 echo "isascii() NOT found." >&4
4556 : see if killpg exists
4560 : see if link exists
4564 : see if stdio is really std
4566 xxx=`./findhdr stdio.h`
4567 if $contains 'char.*_ptr;' "$xxx" >/dev/null 2>&1 ; then
4568 if $contains '_cnt;' "$xxx" >/dev/null 2>&1 ; then
4569 echo "Your stdio is pretty std." >&4
4572 echo "Your stdio isn't very std." >&4
4576 echo "Your stdio isn't very std." >&4
4582 : see if stdio is like that in linux
4583 case "$d_stdstdio" in
4586 xxx=`./findhdr stdio.h`
4587 $cppstdin $cppflags $cppminus < "$xxx" > stdio.E
4588 if $contains 'char.*_IO_read_base' stdio.E >/dev/null 2>&1 && \
4589 $contains '_IO_read_ptr' stdio.E >/dev/null 2>&1 && \
4590 $contains '_IO_read_end' stdio.E >/dev/null 2>&1 ; then
4591 echo "Your stdio looks like linux." >&4
4594 echo "You don't have linux stdio, either." >&4
4605 : see if localeconv exists
4606 set localeconv d_locconv
4609 : see if lockf exists
4613 : see if lstat exists
4617 : see if mblen exists
4621 : see if mbstowcs exists
4622 set mbstowcs d_mbstowcs
4625 : see if mbtowc exists
4629 : see if memcmp exists
4633 : see if memcpy exists
4637 : see if memmove exists
4638 set memmove d_memmove
4641 : see if memset exists
4645 : see if mkdir exists
4649 : see if mkfifo exists
4653 : see if mktime exists
4657 : see if msgctl exists
4661 : see if msgget exists
4665 : see if msgsnd exists
4669 : see if msgrcv exists
4673 : see how much of the 'msg*(2)' library is present.
4676 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
4677 *"$undef"*) h_msg=false;;
4679 : we could also check for sys/ipc.h ...
4680 if $h_msg && $test `./findhdr sys/msg.h`; then
4681 echo "You have the full msg*(2) library." >&4
4684 echo "You don't have the full msg*(2) library." >&4
4690 : see if this is a malloc.h system
4691 set malloc.h i_malloc
4694 : determine which malloc to compile in
4696 case "$usemymalloc" in
4697 ''|y*|true) dflt='y' ;;
4698 n*|false) dflt='n' ;;
4699 *) dflt="$usemymalloc" ;;
4701 rp="Do you wish to attempt to use the malloc that comes with $package?"
4707 mallocsrc='malloc.c'
4708 mallocobj='malloc.o'
4709 d_mymalloc="$define"
4712 : Remove malloc from list of libraries to use
4713 echo "Removing unneeded -lmalloc from library list" >&4
4714 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
4717 echo "libs = $libs" >&4
4729 : compute the type returned by malloc
4731 case "$malloctype" in
4733 $cat >malloc.c <<END
4736 #include <sys/types.h>
4742 if $cc $ccflags -c malloc.c >/dev/null 2>&1; then
4750 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
4752 : see if nice exists
4756 : Locate the flags for 'open()'
4758 $cat >open3.c <<'EOCP'
4759 #include <sys/types.h>
4764 #include <sys/file.h>
4775 : check sys/file.h first to get FREAD on Sun
4776 if $test `./findhdr sys/file.h` && \
4777 $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
4779 echo "<sys/file.h> defines the O_* constants..." >&4
4781 echo "and you have the 3 argument form of open()." >&4
4784 echo "but not the 3 argument form of open(). Oh, well." >&4
4787 elif $test `./findhdr fcntl.h` && \
4788 $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
4790 echo "<fcntl.h> defines the O_* constants..." >&4
4792 echo "and you have the 3 argument form of open()." >&4
4795 echo "but not the 3 argument form of open(). Oh, well." >&4
4800 echo "I can't find the O_* constant definitions! You got problems." >&4
4806 : see if passwd exists
4810 : see if pause exists
4814 : see if pipe exists
4818 : see if this is a pwd system
4820 xxx=`./findhdr pwd.h`
4821 if $test "$xxx"; then
4823 echo "<pwd.h> found." >&4
4824 $cppstdin $cppflags $cppminus < $xxx >$$.h
4825 if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
4830 if $contains 'pw_age' $$.h >/dev/null 2>&1; then
4835 if $contains 'pw_change' $$.h >/dev/null 2>&1; then
4836 d_pwchange="$define"
4840 if $contains 'pw_class' $$.h >/dev/null 2>&1; then
4845 if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
4846 d_pwexpire="$define"
4850 if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
4851 d_pwcomment="$define"
4853 d_pwcomment="$undef"
4863 d_pwcomment="$undef"
4864 echo "<pwd.h> NOT found." >&4
4867 : see if readdir and friends exist
4868 set readdir d_readdir
4870 set seekdir d_seekdir
4872 set telldir d_telldir
4874 set rewinddir d_rewinddir
4877 : see if readlink exists
4878 set readlink d_readlink
4881 : see if rename exists
4885 : see if rmdir exists
4889 : can bcopy handle overlapping blocks?
4894 echo "Checking to see if your bcopy() can do overlapping copies..." >&4
4895 $cat >foo.c <<'EOCP'
4898 char buf[128], abc[128];
4904 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
4906 for (align = 7; align >= 0; align--) {
4907 for (len = 36; len; len--) {
4910 for (off = 1; off <= len; off++) {
4911 bcopy(b, b+off, len);
4912 bcopy(b+off, b, len);
4913 if (bcmp(b, abc, len))
4921 if $cc foo.c -o safebcpy $ccflags $ldflags $libs >/dev/null 2>&1 ; then
4922 if ./safebcpy 2>/dev/null; then
4926 echo "It can't, sorry."
4929 echo "(I can't compile the test program, so we'll assume not...)"
4933 $rm -f foo.* safebcpy core
4937 : can memcpy handle overlapping blocks?
4942 echo "Checking to see if your memcpy() can do overlapping copies..." >&4
4943 $cat >foo.c <<'EOCP'
4946 char buf[128], abc[128];
4952 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
4954 for (align = 7; align >= 0; align--) {
4955 for (len = 36; len; len--) {
4957 memcpy(abc, b, len);
4958 for (off = 1; off <= len; off++) {
4959 memcpy(b, b+off, len);
4960 memcpy(b+off, b, len);
4961 if (memcmp(b, abc, len))
4969 if $cc foo.c -o safemcpy $ccflags $ldflags $libs >/dev/null 2>&1 ; then
4970 if ./safemcpy 2>/dev/null; then
4974 echo "It can't, sorry."
4977 echo "(I can't compile the test program, so we'll assume not...)"
4981 $rm -f foo.* safemcpy core
4985 : see if select exists
4989 : see if semctl exists
4993 : see if semget exists
4997 : see if semop exists
5001 : see how much of the 'sem*(2)' library is present.
5004 case "$d_semctl$d_semget$d_semop" in
5005 *"$undef"*) h_sem=false;;
5007 : we could also check for sys/ipc.h ...
5008 if $h_sem && $test `./findhdr sys/sem.h`; then
5009 echo "You have the full sem*(2) library." >&4
5012 echo "You don't have the full sem*(2) library." >&4
5018 : see if setegid exists
5019 set setegid d_setegid
5022 : see if seteuid exists
5023 set seteuid d_seteuid
5026 : see if setlinebuf exists
5027 set setlinebuf d_setlinebuf
5030 : see if setlocale exists
5031 set setlocale d_setlocale
5034 : see if setpgid exists
5035 set setpgid d_setpgid
5038 : see if setpgrp2 exists
5039 set setpgrp2 d_setpgrp2
5042 : see if setpriority exists
5043 set setpriority d_setprior
5046 : see if setregid exists
5047 set setregid d_setregid
5049 set setresgid d_setresgid
5052 : see if setreuid exists
5053 set setreuid d_setreuid
5055 set setresuid d_setresuid
5058 : see if setrgid exists
5059 set setrgid d_setrgid
5062 : see if setruid exists
5063 set setruid d_setruid
5066 : see if setsid exists
5070 : see if shmctl exists
5074 : see if shmget exists
5078 : see if shmat exists
5081 : see what shmat returns
5084 $cat >shmat.c <<'END'
5085 #include <sys/shm.h>
5088 if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
5093 echo "and it returns ($shmattype)." >&4
5094 : see if a prototype for shmat is available
5095 $cppstdin $cppflags $cppminus < $usrinc/sys/shm.h > shmat.c 2>/dev/null
5096 if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
5107 set d_shmatprototype
5110 : see if shmdt exists
5114 : see how much of the 'shm*(2)' library is present.
5117 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
5118 *"$undef"*) h_shm=false;;
5120 : we could also check for sys/ipc.h ...
5121 if $h_shm && $test `./findhdr sys/shm.h`; then
5122 echo "You have the full shm*(2) library." >&4
5125 echo "You don't have the full shm*(2) library." >&4
5133 : see whether socket exists
5135 $echo $n "Hmm... $c" >&4
5136 if set socket val -f d_socket; eval $csym; $val; then
5137 echo "Looks like you have Berkeley networking support." >&4
5139 if set setsockopt val -f; eval $csym; $val; then
5142 echo "...but it uses the old 4.1c interface, rather than 4.2" >&4
5146 if $contains socklib libc.list >/dev/null 2>&1; then
5147 echo "Looks like you have Berkeley networking support." >&4
5149 : we will have to assume that it supports the 4.2 BSD interface
5152 echo "You don't have Berkeley networking in libc.a..." >&4
5153 if test -f /usr/lib/libnet.a; then
5154 ( (nm $nm_opt /usr/lib/libnet.a | eval $nm_extract) || \
5155 ar t /usr/lib/libnet.a) 2>/dev/null >> libc.list
5156 if $contains socket libc.list >/dev/null 2>&1; then
5157 echo "...but the Wollongong group seems to have hacked it in." >&4
5159 sockethdr="-I/usr/netinclude"
5161 if $contains setsockopt libc.list >/dev/null 2>&1; then
5164 echo "...using the old 4.1c interface, rather than 4.2" >&4
5168 echo "or even in libnet.a, which is peculiar." >&4
5173 echo "or anywhere else I see." >&4
5180 : see if socketpair exists
5181 set socketpair d_sockpair
5184 : see if stat knows about block sizes
5186 xxx=`./findhdr sys/stat.h`
5187 if $contains 'st_blocks;' "$xxx" >/dev/null 2>&1 ; then
5188 if $contains 'st_blksize;' "$xxx" >/dev/null 2>&1 ; then
5189 echo "Your stat() knows about block sizes." >&4
5192 echo "Your stat() doesn't know about block sizes." >&4
5196 echo "Your stat() doesn't know about block sizes." >&4
5202 : see if strcoll exists
5203 set strcoll d_strcoll
5206 : check for structure copying
5208 echo "Checking to see if your C compiler can copy structs..." >&4
5209 $cat >try.c <<'EOCP'
5219 if $cc -c try.c >/dev/null 2>&1 ; then
5224 echo "Nope, it can't."
5230 : see if strerror and/or sys_errlist[] exist
5232 if set strerror val -f d_strerror; eval $csym; $val; then
5233 echo 'strerror() found.' >&4
5234 d_strerror="$define"
5235 d_strerrm='strerror(e)'
5236 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5237 echo "(You also have sys_errlist[], so we could roll our own strerror.)"
5238 d_syserrlst="$define"
5240 echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
5241 d_syserrlst="$undef"
5243 elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
5244 $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
5245 echo 'strerror() found in string header.' >&4
5246 d_strerror="$define"
5247 d_strerrm='strerror(e)'
5248 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5249 echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
5250 d_syserrlst="$define"
5252 echo "(You don't appear to have any sys_errlist[], how can this be?)"
5253 d_syserrlst="$undef"
5255 elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
5256 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
5258 d_syserrlst="$define"
5259 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
5261 echo 'strerror() and sys_errlist[] NOT found.' >&4
5263 d_syserrlst="$undef"
5264 d_strerrm='"unknown"'
5267 : see if strxfrm exists
5268 set strxfrm d_strxfrm
5271 : see if symlink exists
5272 set symlink d_symlink
5275 : see if syscall exists
5276 set syscall d_syscall
5279 : see if sysconf exists
5280 set sysconf d_sysconf
5283 : see if system exists
5287 : see if tcgetpgrp exists
5288 set tcgetpgrp d_tcgetpgrp
5291 : see if tcsetpgrp exists
5292 set tcsetpgrp d_tcsetpgrp
5295 : define an is-a-typedef? function
5296 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
5298 "") inclist="sys/types.h";;
5304 for inc in $inclist; do
5305 echo "#include <$inc>" >>temp.c;
5307 $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
5308 if $contains $type temp.E >/dev/null 2>&1; then
5314 *) eval "$var=$val";;
5317 : see if this is a sys/times.h system
5318 set sys/times.h i_systimes
5321 : see if times exists
5323 if set times val -f d_times; eval $csym; $val; then
5324 echo 'times() found.' >&4
5327 case "$i_systimes" in
5328 "$define") inc='sys/times.h';;
5330 set clock_t clocktype long stdio.h sys/types.h $inc
5334 rp="What type is returned by times() on this sytem?"
5338 echo 'times() NOT found, hope that will do.' >&4
5343 : see if truncate exists
5344 set truncate d_truncate
5347 : see if tzname[] exists
5349 if set tzname val -a d_tzname; eval $csym; $val; then
5351 echo 'tzname[] found.' >&4
5354 echo 'tzname[] NOT found.' >&4
5359 : see if umask exists
5363 : see if we have to deal with yellow pages, now NIS.
5364 if $test -d /usr/etc/yp || $test -d /etc/yp; then
5365 if $test -f /usr/etc/nibindd; then
5367 echo "I'm fairly confident you're on a NeXT."
5369 rp='Do you get the hosts file via NetInfo?'
5378 y*) hostcat='nidump hosts .';;
5379 *) hostcat='cat /etc/hosts';;
5387 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
5395 rp='Are you getting the hosts file via yellow pages?'
5398 y*) hostcat='ypcat hosts';;
5399 *) hostcat='cat /etc/hosts';;
5405 : now get the host name
5407 echo "Figuring out host name..." >&4
5408 case "$myhostname" in
5410 echo 'Maybe "hostname" will work...'
5411 if tans=`sh -c hostname 2>&1` ; then
5419 if $test "$cont"; then
5421 echo 'Oh, dear. Maybe "/etc/systemid" is the key...'
5422 if tans=`cat /etc/systemid 2>&1` ; then
5424 phostname='cat /etc/systemid'
5425 echo "Whadyaknow. Xenix always was a bit strange..."
5428 elif $test -r /etc/systemid; then
5429 echo "(What is a non-Xenix system doing with /etc/systemid?)"
5432 if $test "$cont"; then
5433 echo 'No, maybe "uuname -l" will work...'
5434 if tans=`sh -c 'uuname -l' 2>&1` ; then
5436 phostname='uuname -l'
5438 echo 'Strange. Maybe "uname -n" will work...'
5439 if tans=`sh -c 'uname -n' 2>&1` ; then
5441 phostname='uname -n'
5443 echo 'Oh well, maybe I can mine it out of whoami.h...'
5444 if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
5445 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
5446 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
5448 case "$myhostname" in
5449 '') echo "Does this machine have an identity crisis or something?"
5452 echo "Well, you said $myhostname before..."
5453 phostname='echo $myhostname';;
5459 : you do not want to know about this
5463 : translate upper to lower if necessary
5464 case "$myhostname" in
5466 echo "(Normalizing case in your host name)"
5467 myhostname=`echo $myhostname | tr '[A-Z]' '[a-z]'`
5472 if $test "$myhostname" ; then
5474 rp='Your host name appears to be "'$myhostname'".'" Right?"
5482 : bad guess or no guess
5483 while $test "X$myhostname" = X ; do
5485 rp="Please type the (one word) name of your host:"
5490 : a little sanity check here
5491 case "$phostname" in
5494 case `$phostname | tr '[A-Z]' '[a-z]'` in
5495 $myhostname$mydomain|$myhostname) ;;
5497 case "$phostname" in
5499 echo "(That doesn't agree with your whoami.h file, by the way.)"
5502 echo "(That doesn't agree with your $phostname command, by the way.)"
5510 : see how we will look up host name
5513 : dummy stub to allow use of elif
5514 elif set uname val -f d_uname; eval $csym; $val; then
5517 uname() was found, but you're running xenix, and older versions of xenix
5518 have a broken uname(). If you don't really know whether your xenix is old
5519 enough to have a broken system call, use the default answer.
5526 rp='Is your uname() broken?'
5529 n*) d_uname="$define"; call=uname;;
5532 echo 'uname() found.' >&4
5537 case "$d_gethname" in
5538 '') d_gethname="$undef";;
5541 '') d_uname="$undef";;
5543 case "$d_phostname" in
5544 '') d_phostname="$undef";;
5547 : backward compatibility for d_hvfork
5548 if test X$d_hvfork != X; then
5552 : see if there is a vfork
5557 : Ok, but do we want to use it. vfork is reportedly unreliable in
5558 : perl on Solaris 2.x, and probably elsewhere.
5566 rp="Some systems have problems with vfork(). Do you want to use it?"
5571 echo "Ok, we won't use vfork()."
5580 $define) usevfork='true';;
5581 *) usevfork='false';;
5584 : see if this is an sysdir system
5585 set sys/dir.h i_sysdir
5588 : see if this is an sysndir system
5589 set sys/ndir.h i_sysndir
5592 : see if closedir exists
5593 set closedir d_closedir
5596 case "$d_closedir" in
5599 echo "Checking whether closedir() returns a status..." >&4
5600 cat > closedir.c <<EOM
5601 #$i_dirent I_DIRENT /**/
5602 #$i_sysdir I_SYS_DIR /**/
5603 #$i_sysndir I_SYS_NDIR /**/
5605 #if defined(I_DIRENT)
5607 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
5608 #include <sys/dir.h>
5612 #include <sys/ndir.h>
5616 #include <ndir.h> /* may be wrong in the future */
5618 #include <sys/dir.h>
5623 int main() { return closedir(opendir(".")); }
5625 if $cc $ccflags $ldflags -o closedir closedir.c $libs > /dev/null 2>&1; then
5626 if ./closedir > /dev/null 2>&1 ; then
5627 echo "Yes, it does."
5630 echo "No, it doesn't."
5634 echo "(I can't seem to compile the test program--assuming it doesn't)"
5645 : see if signal is declared as pointer to function returning int or void
5647 xxx=`./findhdr signal.h`
5648 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
5649 if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
5650 echo "You have int (*signal())() instead of void." >&4
5652 elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
5653 echo "You have void (*signal())() instead of int." >&4
5655 elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
5656 echo "You have int (*signal())() instead of void." >&4
5659 case "$d_voidsig" in
5661 echo "I can't determine whether signal handler returns void or int..." >&4
5663 rp="What type does your signal handler return?"
5670 echo "As you already told me, signal handler returns void." >&4;;
5672 echo "As you already told me, signal handler returns int." >&4;;
5677 case "$d_voidsig" in
5678 "$define") signal_t="void";;
5683 : check for volatile keyword
5685 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
5686 $cat >try.c <<'EOCP'
5689 typedef struct _goo_struct goo_struct;
5690 goo_struct * volatile goo = ((goo_struct *)0);
5691 struct _goo_struct {
5696 typedef unsigned short foo_t;
5699 volatile foo_t blech;
5703 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
5705 echo "Yup, it does."
5708 echo "Nope, it doesn't."
5714 : see if there is a wait4
5718 : see if waitpid exists
5719 set waitpid d_waitpid
5722 : see if wcstombs exists
5723 set wcstombs d_wcstombs
5726 : see if wctomb exists
5730 : preserve RCS keywords in files with variable substitution, grrr
5735 Revision='$Revision'
5737 : check for alignment requirements
5739 case "$alignbytes" in
5740 '') echo "Checking alignment constraints..." >&4
5741 $cat >try.c <<'EOCP'
5748 printf("%d\n", (char *)&try.bar - (char *)&try.foo);
5751 if $cc $ccflags try.c -o try >/dev/null 2>&1; then
5755 echo"(I can't seem to compile the test program...)"
5758 *) dflt="$alignbytes"
5761 rp="Doubles must be aligned on a how-many-byte boundary?"
5766 : determine where public executables go
5777 rp='Pathname where the public executables will reside?'
5784 Since you are running AFS, I need to distinguish the directory in which
5785 executables reside from the directory in which they are installed (and from
5786 which they are presumably copied to the former directory by occult means).
5789 case "$installbin" in
5790 '') dflt=`echo $binexp | sed 's#^/afs/#/afs/.#'`;;
5791 *) dflt="$installbin";;
5794 rp='Where will public executables be installed?'
5798 installbin="$binexp"
5801 : check for ordering of bytes in a long
5802 case "$byteorder" in
5806 In the following, larger digits indicate more significance. A big-endian
5807 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
5808 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
5809 machines may have weird orders like 3412. A Cray will report 87654321. If
5810 the test program works the default is probably right.
5811 I'm now running the test program...
5813 $cat >try.c <<'EOCP'
5820 char c[sizeof(long)];
5823 if (sizeof(long) > 4)
5824 u.l = (0x08070605L << 32) | 0x04030201L;
5827 for (i = 0; i < sizeof(long); i++)
5828 printf("%c", u.c[i]+'0');
5832 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
5835 ????|????????) echo "(The test program ran ok.)";;
5836 *) echo "(The test program didn't run right for some reason.)";;
5841 (I can't seem to compile the test program. Guessing big-endian...)
5850 rp="What is the order of bytes in a long?"
5855 : how do we catenate cpp tokens here?
5857 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
5858 $cat >cpp_stuff.c <<'EOCP'
5859 #define RCAT(a,b)a/**/b
5860 #define ACAT(a,b)a ## b
5864 $cppstdin $cppflags $cppminus < cpp_stuff.c >cpp_stuff.out 2>&1
5865 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
5866 echo "Oh! Smells like ANSI's been here."
5867 echo "We can catify or stringify, separately or together!"
5869 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
5870 echo "Ah, yes! The good old days!"
5871 echo "However, in the good old days we don't know how to stringify and"
5872 echo "catify at the same time."
5876 Hmm, I don't seem to be able to catenate tokens with your cpp. You're going
5877 to have to edit the values of CAT[2-5] in config.h...
5879 cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
5882 : check for void type
5885 Checking to see how well your C compiler groks the void type...
5887 Support flag bits are:
5888 1: basic void declarations.
5889 2: arrays of pointers to functions returning void.
5890 4: operations between pointers to and addresses of void functions.
5891 8: generic void pointers.
5894 case "$voidflags" in
5896 $cat >try.c <<'EOCP'
5902 extern void moo(); /* function returning void */
5903 void (*goo)(); /* ptr to func returning void */
5905 void *hue; /* generic ptr */
5919 if $cc -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
5920 voidflags=$defvoidused
5921 echo "It appears to support void to the level $package wants ($defvoidused)."
5922 if $contains warning .out >/dev/null 2>&1; then
5923 echo "However, you might get some warnings that look like this:"
5927 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
5928 if $cc -c -DTRY=1 try.c >/dev/null 2>&1 ; then
5929 echo "It supports 1..."
5930 if $cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then
5931 echo "It also supports 2..."
5932 if $cc -c -DTRY=7 try.c >/dev/null 2>&1 ; then
5934 echo "And it supports 4 but not 8 definitely."
5936 echo "It doesn't support 4..."
5937 if $cc -c -DTRY=11 try.c >/dev/null 2>&1 ; then
5939 echo "But it supports 8."
5942 echo "Neither does it support 8."
5946 echo "It does not support 2..."
5947 if $cc -c -DTRY=13 try.c >/dev/null 2>&1 ; then
5949 echo "But it supports 4 and 8."
5951 if $cc -c -DTRY=5 try.c >/dev/null 2>&1 ; then
5953 echo "And it supports 4 but has not heard about 8."
5955 echo "However it supports 8 but not 4."
5960 echo "There is no support at all for void."
5966 rp="Your void support flags add up to what?"
5971 : see if this is a db.h system
5975 : see if we have the old dbm
5979 : see if ndbm.h is available
5983 : see if gdbm.h is available
5988 echo "Looking for extensions..." >&4
5992 if $test -f $xxx/$xxx.xs; then
5993 known_extensions="$known_extensions $xxx"
5996 set X $known_extensions
5998 known_extensions="$*"
6001 : Now see which are supported on this system.
6003 for xxx in $known_extensions ; do
6005 DB_File) case "$i_db" in
6006 $define) avail_ext="$avail_ext $xxx" ;;
6009 GDBM_File) case "$i_gdbm" in
6010 $define) avail_ext="$avail_ext $xxx" ;;
6013 NDBM_File) case "$i_ndbm" in
6014 $define) avail_ext="$avail_ext $xxx" ;;
6017 ODBM_File) case "$i_dbm" in
6018 $define) avail_ext="$avail_ext $xxx" ;;
6021 POSIX) case "$useposix" in
6022 true|define|y) avail_ext="$avail_ext $xxx" ;;
6025 Socket) case "$d_socket" in
6026 $define) avail_ext="$avail_ext $xxx" ;;
6029 *) avail_ext="$avail_ext $xxx"
6041 A number of extensions are supplied with $package. You may choose to
6042 compile these extensions for dynamic loading (the default), compile
6043 them into the $package executable (static loading), or not include
6044 them at all. Answer "none" to include no extensions.
6047 case "$dynamic_ext" in
6048 ''|' ') dflt="$avail_ext" ;;
6049 *) dflt="$dynamic_ext" ;;
6054 rp="What extensions do you wish to load dynamically?"
6057 none) dynamic_ext='' ;;
6058 *) dynamic_ext="$ans" ;;
6061 case "$static_ext" in
6063 : Exclude those already listed in dynamic linking
6065 for xxx in $avail_ext; do
6066 case " $dynamic_ext " in
6068 *) dflt="$dflt $xxx" ;;
6075 *) dflt="$static_ext"
6082 rp="What extensions do you wish to load statically?"
6085 none) static_ext='' ;;
6086 *) static_ext="$ans" ;;
6091 A number of extensions are supplied with $package. Answer "none"
6092 to include no extensions.
6095 case "$static_ext" in
6096 ''|' ') dflt="$avail_ext" ;;
6097 *) dflt="$static_ext" ;;
6103 rp="What extensions do you wish to include?"
6106 none) static_ext='' ;;
6107 *) static_ext="$ans" ;;
6112 set X $dynamic_ext $static_ext
6116 : see what type file positions are declared as in the library
6117 set fpos_t fpostype long stdio.h sys/types.h
6121 rp="What is the type for file position used by fsetpos()?"
6125 : see what type gids are declared as in the kernel
6126 set gid_t gidtype xxx stdio.h sys/types.h
6130 xxx=`./findhdr sys/user.h`
6131 set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
6133 unsigned) dflt="$1 $2" ;;
6137 *) dflt="$gidtype";;
6140 rp="What is the type for group ids returned by getgid()?"
6144 : see if getgroups exists
6145 set getgroups d_getgrps
6148 : Find type of 2nd arg to getgroups
6150 case "$d_getgrps" in
6152 case "$groupstype" in
6153 '') dflt="$gidtype" ;;
6154 *) dflt="$groupstype" ;;
6157 What is the type of the second argument to getgroups()? Usually this
6158 is the same as group ids, $gidtype, but not always.
6161 rp='What type is the second argument to getgroups()?'
6165 *) groupstype="$gidtype";;
6168 : see what type lseek is declared as in the kernel
6169 set off_t lseektype long stdio.h sys/types.h
6173 rp="What type is lseek's offset on this system declared as?"
6177 : determine where manual pages go
6180 $package has manual pages available in source form.
6184 echo "However, you don't have nroff, so they're probably useless to you."
6189 echo "If you don't want the manual sources installed, answer 'none'."
6192 lookpath="$prefix/man/man1 $prefix/man/u_man/man1 $prefix/man/l_man/man1"
6193 lookpath="$lookpath /usr/local/man/man1 /usr/local/man/man1 /usr/man/manl"
6194 lookpath="$lookpath /usr/man/local/man1 /usr/man/l_man/man1"
6195 lookpath="$lookpath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
6196 lookpath="$lookpath /usr/man/man.L"
6197 mansrc=`./loc . $prefix/man/man1 $lookpath`
6198 if $test -d "$mansrc"; then
6209 rp='Where do the manual pages (source) go?'
6216 Since you are running AFS, I need to distinguish the directory in which
6217 manual pages reside from the directory in which they are installed (and from
6218 which they are presumably copied to the former directory by occult means).
6221 case "$installmansrc" in
6222 '') dflt=`echo $mansrcexp | sed 's#^/afs/#/afs/.#'`;;
6223 *) dflt="$installmansrc";;
6226 rp='Where will man pages be installed?'
6228 installmansrc="$ans"
6230 installmansrc="$mansrcexp"
6246 : see what type is used for mode_t
6247 set mode_t modetype int stdio.h sys/types.h
6251 rp="What type is used for file modes?"
6255 : Cruising for prototypes
6257 echo "Checking out function prototypes..." >&4
6258 $cat >prototype.c <<'EOCP'
6259 main(int argc, char *argv[]) {
6262 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6263 echo "Your C compiler appears to support function prototypes."
6266 echo "Your C compiler doesn't seem to understand function prototypes."
6273 : check for size of random number generator
6277 echo "Checking to see how many bits your rand function produces..." >&4
6278 $cat >try.c <<'EOCP'
6283 register unsigned long tmp;
6284 register unsigned long max = 0L;
6286 for (i = 1000; i; i--) {
6287 tmp = (unsigned long)rand();
6288 if (tmp > max) max = tmp;
6290 for (i = 0; max; i++)
6295 if $cc try.c -o try >/dev/null 2>&1 ; then
6299 echo "(I can't seem to compile the test program...)"
6306 rp='How many bits does your rand() function produce?'
6311 : see if ar generates random libraries by itself
6313 echo "Checking how to generate random libraries on your machine..." >&4
6314 echo 'int bar1() { return bar2(); }' > bar1.c
6315 echo 'int bar2() { return 2; }' > bar2.c
6316 $cat > foo.c <<'EOP'
6317 main() { printf("%d\n", bar1()); exit(0); }
6319 $cc $ccflags -c bar1.c >/dev/null 2>&1
6320 $cc $ccflags -c bar2.c >/dev/null 2>&1
6321 $cc $ccflags -c foo.c >/dev/null 2>&1
6322 ar rc bar.a bar2.o bar1.o >/dev/null 2>&1
6323 if test -n "$ranlib" ; then
6325 elif $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 &&
6326 ./foobar >/dev/null 2>&1; then
6327 echo "ar appears to generate random libraries itself."
6330 elif ar ts bar.a >/dev/null 2>&1 &&
6331 $cc $ccflags $ldflags -o foobar foo.o bar.a $libs > /dev/null 2>&1 &&
6332 ./foobar >/dev/null 2>&1; then
6333 echo "a table of contents needs to be added with 'ar ts'."
6337 if $test -f /usr/bin/ranlib; then
6338 ranlib=/usr/bin/ranlib
6339 elif $test -f /bin/ranlib; then
6341 elif $test -f /usr/local/bin/ranlib; then
6342 ranlib=/usr/local/bin/ranlib
6345 if $test -n "$ranlib"; then
6346 echo "your system has $ranlib; we'll use that."
6349 echo "your system doesn't seem to support random libraries"
6350 echo "so we'll use lorder and tsort to order the libraries."
6357 : determine where public executable scripts go
6358 case "$scriptdir" in
6361 : guess some guesses
6362 $test -d /usr/share/scripts && dflt=/usr/share/scripts
6363 $test -d /usr/share/bin && dflt=/usr/share/bin
6364 $test -d /usr/local/script && dflt=/usr/local/script
6365 $test -d $prefix/script && dflt=$prefix/script
6367 *) dflt="$scriptdir"
6372 Some installations have a separate directory just for executable scripts so
6373 that they can mount it across multiple architectures but keep the scripts in
6374 one spot. You might, for example, have a subdirectory of /usr/share for this.
6375 Or you might just lump your scripts in with all your other executables.
6379 rp='Where do you keep publicly executable scripts?'
6382 scriptdirexp="$ansexp"
6386 Since you are running AFS, I need to distinguish the directory in which
6387 scripts reside from the directory in which they are installed (and from
6388 which they are presumably copied to the former directory by occult means).
6391 case "$installscript" in
6392 '') dflt=`echo $scriptdirexp | sed 's#^/afs/#/afs/.#'`;;
6393 *) dflt="$installscript";;
6396 rp='Where will public scripts be installed?'
6398 installscript="$ans"
6400 installscript="$scriptdirexp"
6403 : see if sys/select.h has to be included
6404 set sys/select.h i_sysselct
6407 : see if we should include time.h, sys/time.h, or both
6409 echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
6410 $echo $n "I'm now running the test program...$c"
6411 $cat >try.c <<'EOCP'
6412 #include <sys/types.h>
6417 #ifdef SYSTIMEKERNEL
6420 #include <sys/time.h>
6423 #include <sys/select.h>
6432 struct timezone tzp;
6434 if (foo.tm_sec == foo.tm_sec)
6437 if (bar.tv_sec == bar.tv_sec)
6446 for s_timeval in '-DS_TIMEVAL' ''; do
6447 for i_systimek in '' '-DSYSTIMEKERNEL'; do
6448 for i_time in '' '-DI_TIME'; do
6449 for i_systime in '-DI_SYSTIME' ''; do
6453 $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \
6454 try.c -o try >/dev/null 2>&1 ; then
6455 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
6459 $echo $n "Succeeded with $flags$c"
6470 *SYSTIMEKERNEL*) i_systimek="$define"
6471 timeincl=`./findhdr sys/time.h`
6472 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
6473 *) i_systimek="$undef";;
6476 *I_TIME*) i_time="$define"
6477 timeincl=`./findhdr time.h`" $timeincl"
6478 echo "We'll include <time.h>." >&4;;
6479 *) i_time="$undef";;
6482 *I_SYSTIME*) i_systime="$define"
6483 timeincl=`./findhdr sys/time.h`" $timeincl"
6484 echo "We'll include <sys/time.h>." >&4;;
6485 *) i_systime="$undef";;
6489 : check for fd_set items
6492 Checking to see how well your C compiler handles fd_set and friends ...
6494 $cat >fd_set.c <<EOCP
6495 #$i_systime I_SYS_TIME
6496 #$i_sysselct I_SYS_SELECT
6497 #$d_socket HAS_SOCKET
6498 #include <sys/types.h>
6500 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
6503 #include <sys/time.h>
6506 #include <sys/select.h>
6516 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
6523 if $cc $ccflags -DTRYBITS fd_set.c -o fd_set >fd_set.out 2>&1 ; then
6524 d_fds_bits="$define"
6526 echo "Well, your system knows about the normal fd_set typedef..." >&4
6528 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
6529 d_fd_macros="$define"
6532 but not the normal fd_set macros! Gaaack! I'll have to cover for you.
6534 d_fd_macros="$undef"
6538 Hmm, your compiler has some difficulty with fd_set. Checking further...
6540 if $cc $ccflags fd_set.c -o fd_set >fd_set.out 2>&1 ; then
6543 echo "Well, your system has some sort of fd_set available..." >&4
6545 echo "and you have the normal fd_set macros." >&4
6546 d_fd_macros="$define"
6549 but not the normal fd_set macros! Gross! More work for me...
6551 d_fd_macros="$undef"
6554 echo "Well, you got zip. That's OK, I can roll my own fd_set stuff." >&4
6557 d_fd_macros="$undef"
6563 : check for type of arguments to select. This will only really
6564 : work if the system supports prototypes and provides one for
6568 : Make initial guess
6569 case "$selecttype" in
6572 $define) xxx='fd_set *' ;;
6576 *) xxx="$selecttype"
6581 'fd_set *') yyy='int *' ;;
6582 'int *') yyy='fd_set *' ;;
6587 Checking to see what type of arguments are expected by select().
6590 #$i_systime I_SYS_TIME
6591 #$i_sysselct I_SYS_SELECT
6592 #$d_socket HAS_SOCKET
6593 #include <sys/types.h>
6595 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
6598 #include <sys/time.h>
6601 #include <sys/select.h>
6607 Select_fd_set_t readfds;
6608 Select_fd_set_t writefds;
6609 Select_fd_set_t exceptfds;
6610 struct timeval timeout;
6611 select(width, readfds, writefds, exceptfds, &timeout);
6615 if $cc $ccflags -c -DSelect_fd_set_t="$xxx" try.c >/dev/null 2>&1 ; then
6617 echo "Your system uses $xxx for the arguments to select." >&4
6618 elif $cc $ccflags -c -DSelect_fd_set_t="$yyy" try.c >/dev/null 2>&1 ; then
6620 echo "Your system uses $yyy for the arguments to select." >&4
6622 rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
6629 *) selecttype = 'int *'
6633 : generate list of signal names
6637 echo "Generating a list of signal names..." >&4
6638 xxx=`./findhdr signal.h`" "`./findhdr sys/signal.h`
6639 set X `cat $xxx 2>&1 | $awk '
6640 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
6641 sig[$3] = substr($2,4,20)
6642 if (max < $3 && $3 < 60) {
6648 for (i = 1; i <= max; i++) {
6662 echo 'kill -l' >/tmp/foo$$
6663 set X `csh -f </tmp/foo$$`
6667 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
6675 echo "The following signals are available:"
6677 echo $sig_name | $awk \
6678 'BEGIN { linelen = 0 }
6680 for (i = 1; i < NF; i++) {
6682 linelen = linelen + length(name)
6685 linelen = length(name)
6692 : see what type is used for size_t
6693 set size_t sizetype 'unsigned int' stdio.h sys/types.h
6697 rp="What type is used for the length parameter for string functions?"
6701 : see what type is used for signed size_t
6702 set ssize_t ssizetype int stdio.h sys/types.h
6705 $cat > ssize.c <<EOM
6707 #include <sys/types.h>
6708 #define Size_t $sizetype
6709 #define SSize_t $dflt
6712 if (sizeof(Size_t) == sizeof(SSize_t))
6714 else if (sizeof(Size_t) == sizeof(int))
6721 if $cc $ccflags $ldflags -o ssize ssize.c $libs > /dev/null 2>&1 ; then
6723 echo "I'll be using $ssizetype for functions returning a byte count." >&4
6725 echo "(I can't compile the test program--please enlighten me!)"
6728 I need a type that is the same size as $sizetype, but is guaranteed to
6729 be signed. Common values are int and long.
6732 rp="What signed type is the same size as $sizetype?"
6736 $rm -f ssize ssize.[co]
6738 : see what type of char stdio uses.
6740 if $contains 'unsigned.*char.*_ptr;' `./findhdr stdio.h` >/dev/null 2>&1 ; then
6741 echo "Your stdio uses unsigned chars." >&4
6742 stdchar="unsigned char"
6744 echo "Your stdio uses signed chars." >&4
6748 : see if time exists
6750 if set time tval -f d_time; eval $csym; $tval; then
6751 echo 'time() found.' >&4
6753 set time_t timetype long stdio.h sys/types.h
6757 rp="What type is returned by time() on this sytem?"
6761 echo 'time() not found, hope that will do.' >&4
6769 : see what type uids are declared as in the kernel
6770 set uid_t uidtype xxx stdio.h sys/types.h
6774 xxx=`./findhdr sys/user.h`
6775 set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
6777 unsigned) dflt="$1 $2" ;;
6781 *) dflt="$uidtype";;
6784 rp="What is the type for user ids returned by getuid()?"
6788 : determine compiler compiler
6797 if $test -f "$byacc"; then
6799 comp="byacc or $comp"
6801 if $test -f "$bison"; then
6802 comp="$comp or bison -y"
6804 rp="Which compiler compiler ($comp) shall I use?"
6813 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
6819 : see if this is a sys/file.h system
6824 : do we need to #include <sys/file.h> ?
6830 echo "We'll be including <sys/file.h>." >&4
6833 echo "We won't be including <sys/file.h>." >&4
6843 : see if fcntl.h is there
6848 : see if we can include fcntl.h
6854 echo "We'll be including <fcntl.h>." >&4
6858 echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
6860 echo "We won't be including <fcntl.h>." >&4
6872 : see if this is an grp system
6876 : see if this is a math.h system
6880 : see if memory.h is available.
6885 : See if it conflicts with string.h
6891 $cppstdin $cppflags $cppminus < $strings > mem.h
6892 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
6894 echo "We won't be including <memory.h>."
6904 : see if net/errno.h is available
6909 : Unfortunately, it causes problems on some systems. Arrgh.
6915 #include <net/errno.h>
6921 if $cc $ccflags -c try.c >/dev/null 2>&1; then
6922 echo "We'll be including <net/errno.h>." >&4
6924 echo "We won't be including <net/errno.h>." >&4
6933 : get C preprocessor symbols handy
6935 echo $al | $tr ' ' '\012' >Cppsym.know
6947 if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
6949 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
6952 unknown="\$unknown \$sym"
6962 echo \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\
6964 exit 0; _ _ _ _\1\\ \1\\
6967 echo "exit 1; _ _ _" >>Cppsym\$\$
6968 $cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$
6970 true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
6976 $rm -f Cppsym\$\$ Cppsym2\$\$
6981 echo "Your C preprocessor defines the following symbols:"
6982 Cppsym -l $al >Cppsym.true
6985 : see if this is a termio system
6989 if $test `./findhdr termios.h`; then
6990 set tcsetattr i_termios
6996 "$define") echo "You have POSIX termios.h... good!" >&4;;
6997 *) if Cppsym pyr; then
6998 case "`/bin/universe`" in
6999 ucb) if $test `./findhdr sgtty.h`; then
7001 echo "<sgtty.h> found." >&4
7003 echo "System is pyramid with BSD universe."
7004 echo "<sgtty.h> not found--you could have problems." >&4
7006 *) if $test `./findhdr termio.h`; then
7008 echo "<termio.h> found." >&4
7010 echo "System is pyramid with USG universe."
7011 echo "<termio.h> not found--you could have problems." >&4
7015 if $test `./findhdr termio.h`; then
7016 echo "<termio.h> found." >&4
7018 elif $test `./findhdr sgtty.h`; then
7019 echo "<sgtty.h> found." >&4
7022 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
7025 if $test `./findhdr sgtty.h`; then
7026 echo "<sgtty.h> found." >&4
7028 elif $test `./findhdr termio.h`; then
7029 echo "<termio.h> found." >&4
7032 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
7036 set i_termio; eval $setvar
7037 val=$val2; set i_sgtty; eval $setvar
7038 val=$val3; set i_termios; eval $setvar
7040 : see if stdarg is available
7042 if $test `./findhdr stdarg.h`; then
7043 echo "<stdarg.h> found." >&4
7046 echo "<stdarg.h> NOT found." >&4
7050 : see if varags is available
7052 if $test `./findhdr varargs.h`; then
7053 echo "<varargs.h> found." >&4
7055 echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
7058 : set up the varargs testing programs
7059 $cat > varargs.c <<EOP
7064 #include <varargs.h>
7082 p = va_arg(ap, char *);
7087 $cat > varargs <<EOP
7088 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
7097 : now check which varargs header should be included
7102 if `./varargs I_STDARG`; then
7104 elif `./varargs I_VARARGS`; then
7109 if `./varargs I_VARARGS`; then
7116 echo "I could not find the definition for va_dcl... You have problems..." >&4
7117 val="$undef"; set i_stdarg; eval $setvar
7118 val="$undef"; set i_varargs; eval $setvar
7125 val="$define"; set i_stdarg; eval $setvar
7126 val="$undef"; set i_varargs; eval $setvar
7129 val="$undef"; set i_stdarg; eval $setvar
7130 val="$define"; set i_varargs; eval $setvar
7133 echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
7137 : see if stddef is available
7138 set stddef.h i_stddef
7141 : see if stdlib is available
7142 set stdlib.h i_stdlib
7145 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
7146 set sys/filio.h i_sysfilio
7149 if $test `./findhdr sys/ioctl.h`; then
7151 echo '<sys/ioctl.h> found.' >&4
7154 if $test $i_sysfilio = "$define"; then
7155 echo '<sys/ioctl.h> NOT found.' >&4
7157 $test $i_sgtty = "$define" && xxx="sgtty.h"
7158 $test $i_termio = "$define" && xxx="termio.h"
7159 $test $i_termios = "$define" && xxx="termios.h"
7160 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
7166 : see if this is a sys/param system
7167 set sys/param.h i_sysparam
7170 : see if this is a unistd.h system
7171 set unistd.h i_unistd
7174 : see if this is an utime system
7178 : see if this is a vfork system
7189 : end of configuration questions
7191 echo "End of configuration questions."
7194 : back to where it started
7195 if test -d ../UU; then
7199 : configuration may be patched via a 'config.over' file
7200 if $test -f config.over; then
7203 rp='I see a config.over file. Do you wish to load it?'
7206 n*) echo "OK, I'll ignore it.";;
7208 echo "Configuration override changes have been loaded."
7213 : create config.sh file
7215 echo "Creating config.sh..." >&4
7216 $spitshell <<EOT >config.sh
7219 # This file was produced by running the Configure script. It holds all the
7220 # definitions figured out by Configure. Should you modify one of these values,
7221 # do not forget to propagate your changes by running "Configure -der". You may
7222 # instead choose to run each of the .SH files by yourself, or "Configure -S".
7225 # Configuration time: $cf_time
7226 # Configured by: $cf_by
7227 # Target system: $myuname
7229 dynamic_ext='$dynamic_ext'
7230 extensions='$extensions'
7231 known_extensions='$known_extensions'
7232 static_ext='$static_ext'
7233 useposix='$useposix'
7234 d_eunice='$d_eunice'
7236 eunicefix='$eunicefix'
7246 compress='$compress'
7283 sendmail='$sendmail'
7302 libswanted='$libswanted'
7314 Revision='$Revision'
7318 alignbytes='$alignbytes'
7320 archlibexp='$archlibexp'
7321 archname='$archname'
7322 d_archlib='$d_archlib'
7323 installarchlib='$installarchlib'
7326 installbin='$installbin'
7327 byteorder='$byteorder'
7329 gccversion='$gccversion'
7331 cppflags='$cppflags'
7334 optimize='$optimize'
7337 contains='$contains'
7338 cpp_stuff='$cpp_stuff'
7340 cppminus='$cppminus'
7342 cppstdin='$cppstdin'
7343 d_access='$d_access'
7345 d_attrib='$d_attrib'
7349 d_casti32='$d_casti32'
7350 castflags='$castflags'
7351 d_castneg='$d_castneg'
7352 d_charsprf='$d_charsprf'
7354 d_chroot='$d_chroot'
7355 d_chsize='$d_chsize'
7356 d_closedir='$d_closedir'
7357 d_void_closedir='$d_void_closedir'
7359 cryptlib='$cryptlib'
7362 d_cuserid='$d_cuserid'
7363 d_dbl_dig='$d_dbl_dig'
7364 d_difftime='$d_difftime'
7365 d_dlerror='$d_dlerror'
7366 d_dlopen='$d_dlopen'
7367 d_dlsymun='$d_dlsymun'
7368 d_dosuid='$d_dosuid'
7369 d_suidsafe='$d_suidsafe'
7372 d_fchmod='$d_fchmod'
7373 d_fchown='$d_fchown'
7375 d_fd_macros='$d_fd_macros'
7376 d_fd_set='$d_fd_set'
7377 d_fds_bits='$d_fds_bits'
7378 d_fgetpos='$d_fgetpos'
7379 d_flexfnam='$d_flexfnam'
7383 d_fsetpos='$d_fsetpos'
7384 d_Gconvert='$d_Gconvert'
7385 d_getgrps='$d_getgrps'
7386 d_gethent='$d_gethent'
7387 aphostname='$aphostname'
7388 d_gethname='$d_gethname'
7389 d_phostname='$d_phostname'
7391 d_getlogin='$d_getlogin'
7392 d_getpgrp2='$d_getpgrp2'
7393 d_getpgrp='$d_getpgrp'
7394 d_getppid='$d_getppid'
7395 d_getprior='$d_getprior'
7398 d_isascii='$d_isascii'
7399 d_killpg='$d_killpg'
7401 d_linuxstd='$d_linuxstd'
7402 d_locconv='$d_locconv'
7406 d_mbstowcs='$d_mbstowcs'
7407 d_mbtowc='$d_mbtowc'
7408 d_memcmp='$d_memcmp'
7409 d_memcpy='$d_memcpy'
7410 d_memmove='$d_memmove'
7411 d_memset='$d_memset'
7413 d_mkfifo='$d_mkfifo'
7414 d_mktime='$d_mktime'
7416 d_msgctl='$d_msgctl'
7417 d_msgget='$d_msgget'
7418 d_msgrcv='$d_msgrcv'
7419 d_msgsnd='$d_msgsnd'
7422 d_passwd='$d_passwd'
7423 d_fpathconf='$d_fpathconf'
7424 d_pathconf='$d_pathconf'
7427 d_portable='$d_portable'
7428 d_readdir='$d_readdir'
7429 d_rewinddir='$d_rewinddir'
7430 d_seekdir='$d_seekdir'
7431 d_telldir='$d_telldir'
7432 d_readlink='$d_readlink'
7433 d_rename='$d_rename'
7435 d_safebcpy='$d_safebcpy'
7436 d_safemcpy='$d_safemcpy'
7437 d_select='$d_select'
7439 d_semctl='$d_semctl'
7440 d_semget='$d_semget'
7442 d_setegid='$d_setegid'
7443 d_seteuid='$d_seteuid'
7444 d_setlinebuf='$d_setlinebuf'
7445 d_setlocale='$d_setlocale'
7446 d_setpgid='$d_setpgid'
7447 d_setpgrp2='$d_setpgrp2'
7448 d_bsdpgrp='$d_bsdpgrp'
7449 d_setpgrp='$d_setpgrp'
7450 d_setprior='$d_setprior'
7451 d_setregid='$d_setregid'
7452 d_setresgid='$d_setresgid'
7453 d_setresuid='$d_setresuid'
7454 d_setreuid='$d_setreuid'
7455 d_setrgid='$d_setrgid'
7456 d_setruid='$d_setruid'
7457 d_setsid='$d_setsid'
7460 d_shmatprototype='$d_shmatprototype'
7461 shmattype='$shmattype'
7462 d_shmctl='$d_shmctl'
7464 d_shmget='$d_shmget'
7465 d_oldsock='$d_oldsock'
7466 d_socket='$d_socket'
7467 d_sockpair='$d_sockpair'
7468 sockethdr='$sockethdr'
7469 socketlib='$socketlib'
7470 d_statblks='$d_statblks'
7471 d_stdstdio='$d_stdstdio'
7473 d_strchr='$d_strchr'
7474 d_strcoll='$d_strcoll'
7475 d_strctcpy='$d_strctcpy'
7476 d_strerrm='$d_strerrm'
7477 d_strerror='$d_strerror'
7478 d_sysernlst='$d_sysernlst'
7479 d_syserrlst='$d_syserrlst'
7480 d_strxfrm='$d_strxfrm'
7481 d_symlink='$d_symlink'
7482 d_syscall='$d_syscall'
7483 d_sysconf='$d_sysconf'
7484 d_system='$d_system'
7485 d_tcgetpgrp='$d_tcgetpgrp'
7486 d_tcsetpgrp='$d_tcsetpgrp'
7488 timetype='$timetype'
7489 clocktype='$clocktype'
7491 d_truncate='$d_truncate'
7492 d_tzname='$d_tzname'
7495 usevfork='$usevfork'
7496 d_voidsig='$d_voidsig'
7497 signal_t='$signal_t'
7498 d_volatile='$d_volatile'
7499 d_charvspr='$d_charvspr'
7500 d_vprintf='$d_vprintf'
7502 d_waitpid='$d_waitpid'
7503 d_wcstombs='$d_wcstombs'
7504 d_wctomb='$d_wctomb'
7506 cccdlflags='$cccdlflags'
7507 ccdlflags='$ccdlflags'
7509 lddlflags='$lddlflags'
7511 fpostype='$fpostype'
7513 groupstype='$groupstype'
7515 h_sysfile='$h_sysfile'
7518 d_dirnamlen='$d_dirnamlen'
7519 direntrytype='$direntrytype'
7520 i_dirent='$i_dirent'
7527 i_limits='$i_limits'
7528 i_malloc='$i_malloc'
7530 i_memory='$i_memory'
7532 i_neterrno='$i_neterrno'
7536 d_pwchange='$d_pwchange'
7537 d_pwclass='$d_pwclass'
7538 d_pwcomment='$d_pwcomment'
7539 d_pwexpire='$d_pwexpire'
7540 d_pwquota='$d_pwquota'
7542 i_stddef='$i_stddef'
7543 i_stdlib='$i_stdlib'
7544 i_string='$i_string'
7546 i_sysdir='$i_sysdir'
7547 i_sysfile='$i_sysfile'
7548 d_voidtty='$d_voidtty'
7549 i_bsdioctl='$i_bsdioctl'
7550 i_sysfilio='$i_sysfilio'
7551 i_sysioctl='$i_sysioctl'
7552 i_syssockio='$i_syssockio'
7553 i_sysndir='$i_sysndir'
7554 i_sysparam='$i_sysparam'
7555 i_sysselct='$i_sysselct'
7556 i_systimes='$i_systimes'
7558 i_termio='$i_termio'
7559 i_termios='$i_termios'
7560 i_systime='$i_systime'
7561 i_systimek='$i_systimek'
7563 timeincl='$timeincl'
7564 i_unistd='$i_unistd'
7566 i_stdarg='$i_stdarg'
7567 i_varargs='$i_varargs'
7568 i_varhdr='$i_varhdr'
7578 lseektype='$lseektype'
7579 d_mymalloc='$d_mymalloc'
7580 mallocobj='$mallocobj'
7581 mallocsrc='$mallocsrc'
7582 malloctype='$malloctype'
7583 usemymalloc='$usemymalloc'
7584 installmansrc='$installmansrc'
7587 mansrcexp='$mansrcexp'
7594 modetype='$modetype'
7595 mydomain='$mydomain'
7596 myhostname='$myhostname'
7597 phostname='$phostname'
7600 groupcat='$groupcat'
7603 orderlib='$orderlib'
7606 spackage='$spackage'
7608 installprivlib='$installprivlib'
7610 privlibexp='$privlibexp'
7611 prototype='$prototype'
7612 randbits='$randbits'
7613 installscript='$installscript'
7614 scriptdir='$scriptdir'
7615 scriptdirexp='$scriptdirexp'
7616 selecttype='$selecttype'
7617 sig_name='$sig_name'
7618 sizetype='$sizetype'
7620 sharpbang='$sharpbang'
7622 spitshell='$spitshell'
7623 ssizetype='$ssizetype'
7633 mips_type='$mips_type'
7635 defvoidused='$defvoidused'
7636 voidflags='$voidflags'
7638 yaccflags='$yaccflags'
7641 : add special variables
7642 $test -f patchlevel.h && \
7643 awk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
7644 echo "CONFIG=true" >>config.sh
7646 : propagate old symbols
7647 if $test -f UU/config.sh; then
7648 <UU/config.sh sort | uniq >UU/oldconfig.sh
7649 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
7650 sort | uniq -u >UU/oldsyms
7651 set X `cat UU/oldsyms`
7657 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
7659 echo "# Variables propagated from previous config.sh file." >>config.sh
7660 for sym in `cat UU/oldsyms`; do
7661 echo " Propagating $hint variable "'$'"$sym..."
7662 eval 'tmp="$'"${sym}"'"'
7664 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
7670 : Finish up by extracting the .SH files
7683 echo "If you didn't make any mistakes, then just type a carriage return here."
7684 rp="If you need to edit config.sh, do it as a shell escape here:"
7689 *) : in case they cannot read
7695 : if this fails, just run all the .SH files by hand
7702 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
7709 Now you need to generate make dependencies by running "make depend".
7710 You might prefer to run it in background: "make depend > makedepend.out &"
7711 It can take a while, so you might not want to run it right now.
7716 rp="Run make depend now?"
7720 make depend && echo "Now you must run a make."
7723 echo "You must run 'make depend' then 'make'."
7726 elif test -f [Mm]akefile; then
7728 echo "Now you must run a make."
7733 $rm -f kit*isdone ark*isdone