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, I would
7 # suggest you cut out the prototypical config.h from the end of Configure
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 # $RCSfile: Configure,v $$Revision: 4.0.1.5 $$Date: 91/11/05 23:11:32 $
13 # Yes, you may rip this off to use in other distribution packages.
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.)
20 Your csh still thinks true is false. Write to your vendor today and tell
21 them that next year Configure ought to "rm /bin/csh" unless they fix their
24 [End of diatribe. We now return you to your regularly scheduled
29 OOPS! You naughty creature! You didn't run Configure with sh!
30 I will attempt to remedy the situation by running sh for you...
34 true || cat /tmp/c1$$ /tmp/c2$$
37 export PATH || cat /tmp/c2$$
38 export PATH || exec sh $0
39 rm -f /tmp/c1$$ /tmp/c2$$
41 PATH=".:$PATH:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc:/usr/new:/usr/new/bin:/usr/nbin"
44 echo "Say 'sh Configure', not 'sh <Configure'"
48 (alias) >/dev/null 2>&1 && \
49 echo "(I see you are using the Korn shell. Some ksh's blow up on Configure," && \
50 echo "especially on exotic machines. If yours does, try the Bourne shell instead.)"
52 if test ! -d ../UU; then
60 -d) shift; fastread='yes';;
294 : get the name of the package
298 echo "Beginning of configuration questions for $package kit."
299 : Eunice requires " " instead of "", can you believe it
304 : change the next line if compiling for Xenix/286 on Xenix/386
305 xlibpth='/usr/lib/386 /lib/386'
307 : the hints files may add more components to libpth
308 test -d /usr/cs/lib && libpth="$libpth /usr/cs/lib"
309 test -d /usr/ccs/lib && libpth="$libpth /usr/ccs/lib"
310 test -d /usr/lib && libpth="$libpth /usr/lib"
311 test -d /usr/ucblib && libpth="$libpth /usr/ucblib"
312 test -d /usr/local/lib && libpth="$libpth /usr/local/lib"
313 test -d /usr/lib/large && libpth="$libpth /usr/lib/large"
314 test -d /lib && libpth="$libpth /lib"
315 libpth="$libpth $xlibpth"
316 test -d /lib/large && libpth="$libpth /lib/large"
317 test -d /usr/lib/small && libpth="$libpth /usr/lib/small"
318 test -d /lib/small && libpth="$libpth /lib/small"
319 test -d /usr/lib/cmplrs/cc && libpth="$libpth /usr/lib/cmplrs/cc"
321 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
322 trap 'echo " "; exit 1' 1 2 3
324 : We must find out about Eunice early
326 if test -f /etc/unixtovms; then
327 eunicefix=/etc/unixtovms
329 if test -f /etc/unixtovms.exe; then
330 eunicefix=/etc/unixtovms.exe
333 attrlist="DGUX M_I186 M_I286 M_I386 M_I8086 M_XENIX UTS __DGUX__"
334 attrlist="$attrlist __STDC__ __m88k__ ansi bsd4_2 gcos gimpel"
335 attrlist="$attrlist hp9000s300 hp9000s500 hp9000s800 hpux"
336 attrlist="$attrlist i186 i386 i8086 iAPX286 ibm interdata"
337 attrlist="$attrlist m68k m88k mc300 mc500 mc68000 mc68k mc700 mert"
338 attrlist="$attrlist ns16000 ns32000 nsc32000 os pdp11 posix pyr sinix"
339 attrlist="$attrlist sparc sun tower tower32 tower32_600 tower32_800 tss"
340 attrlist="$attrlist u3b2 u3b20 u3b200 u3b5 ultrix unix vax venix xenix"
341 attrlist="$attrlist z8000"
343 eoPATH="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /usr/plx /usr/5bin /vol/local/bin /etc /usr/lib /lib /usr/local/lib /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/bin /bsd4.3/usr/ucb /bsd43/usr/bin"
344 d_newshome="/usr/NeWS"
357 libswanted="c_s net_s net nsl_s nsl socket nm ndir ndbm dbm PW malloc sun m bsd BSD x posix ucb"
358 inclwanted='/usr/include /usr/netinclude /usr/include/sun /usr/include/bsd /usr/include/lan /usr/ucbinclude'
360 : Now test for existence of everything in MANIFEST
362 echo "First let's make sure your kit is complete. Checking..."
363 awk '$1 !~ /PACKINGLIST/ {print $1}' ../MANIFEST | split -200
365 for filelist in x??; do
366 (cd ..; ls `cat UU/$filelist` >/dev/null 2>>UU/missing)
368 if test -s missing; then
374 : some greps do not return status, grrr.
375 echo "grimblepritz" >contains.txt
376 if grep blurfldyick contains.txt >/dev/null 2>&1 ; then
378 elif grep grimblepritz contains.txt >/dev/null 2>&1 ; then
383 : the following should work in any shell
387 echo "AGH! Grep doesn't return a status. Attempting remedial action."
388 cat >contains <<'EOSS'
389 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
394 : see if sh knows # comments
396 echo "Checking your sh to see if it knows about # comments..."
397 if sh -c '#' >/dev/null 2>&1 ; then
398 echo "Your sh handles # comments correctly."
402 echo "Okay, let's see if #! works on this system..."
403 if test -f /bsd43/bin/echo; then
404 echo "#!/bsd43/bin/echo hi" > spit.sh
406 echo "#!/bin/echo hi" > spit.sh
411 if $contains hi today >/dev/null 2>&1; then
415 echo "#! /bin/echo hi" > spit.sh
419 if test -s today; then
428 echo "Your sh doesn't grok # comments--I will strip them later on."
430 echo "exec grep -v '^#'" >spitshell
433 spitshell=`pwd`/spitshell
434 echo "I presume that if # doesn't work, #! won't work either!"
438 : figure out how to guarantee sh startup
440 echo "Checking out how to guarantee sh startup..."
441 startsh=$sharpbang'/bin/sh'
442 echo "Let's see if '$startsh' works..."
454 echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
457 : first determine how to suppress newline on echo command
458 echo "Checking echo to see how to suppress newlines..."
459 (echo "hi there\c" ; echo " ") >echotmp
460 if $contains c echotmp >/dev/null 2>&1 ; then
471 echo $n "Type carriage return to continue. Your cursor should be here-->$c"
474 : now set up to do reads with possible shell escape and default assignment
477 yes) ans=''; echo " " ;;
480 while expr "X\$ans" : "X!" >/dev/null; do
489 set \`expr "X\$ans" : "X!\(.*\)\$"\`
502 : general instructions
505 This installation shell script will examine your system and ask you questions
506 to determine how the $package package should be installed. If you get stuck
507 on a question, you may use a ! shell escape to start a subshell or execute
508 a command. Many of the questions will have default answers in square
509 brackets--typing carriage return will give you the default.
511 On some of the questions which ask for file or directory names you are
512 allowed to use the ~name construct to specify the login directory belonging
513 to "name", even if you don't have a shell which knows about that. Questions
514 where this is allowed will be marked "(~name ok)".
517 rp="[Type carriage return to continue]"
522 Much effort has been expended to ensure that this shell script will run on any
523 Unix system. If despite that it blows up on you, your best bet is to edit
524 Configure and run it again. Also, let me (lwall@netlabs.com)
525 know how I blew it. If you can't run Configure for some reason, you'll have
526 to generate a config.sh file by hand.
528 This installation script affects things in two ways: 1) it may do direct
529 variable substitutions on some of the files included in this kit, and
530 2) it builds a config.h file for inclusion in C programs. You may edit
531 any of these files as the need arises after running this script.
533 If you make a mistake on a question, there is no easy way to back up to it
534 currently. The easiest thing to do is to edit config.sh and rerun all the
535 SH files. Configure will offer to let you do this before it runs the SH files.
538 rp="[Type carriage return to continue]"
542 : find out where common programs are
544 echo "Locating common programs..."
557 if test -d \$dir/\$thing; then
563 if test -f \$dir/\$thing; then
566 elif test -f \$dir/\$thing.exe; then
567 : on Eunice apparently
604 pth=`echo :$boPATH:$PATH:$eoPATH: | sed -e 's/:/ /g'`
605 for file in $loclist; do
606 xxx=`./loc $file $file $pth`
611 echo $file is in $xxx.
614 echo "I don't know where $file is. I hope it's in everyone's PATH."
619 echo "Don't worry if any of the following aren't found..."
621 for file in $trylist; do
622 xxx=`./loc $file $file $pth`
627 echo $file is in $xxx.
630 echo "I don't see $file out there, $ans."
637 echo "Substituting grep for egrep."
643 echo "Hopefully test is built into your sh."
646 if sh -c "PATH= test true" >/dev/null 2>&1; then
647 echo "Using the test built into your sh."
657 echo "Hopefully echo is built into your sh."
661 echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
662 $echo $n "hi there$c" >Loc1.txt
663 echo $n "hi there$c" >Loc2.txt
664 if cmp Loc1.txt Loc2.txt >/dev/null 2>&1; then
665 echo "They are compatible. In fact, they may be identical."
668 '-n') n='' c='\c' ans='\c' ;;
669 *) n='-n' c='' ans='-n' ;;
672 They are not compatible! You are probably running ksh on a non-USG system.
673 I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
674 have echo built in and we may have to run some Bourne shell scripts. That
675 means I'll have to use $ans to suppress newlines now. Life is ridiculous.
678 rp="Your cursor should be here-->"
689 : set up shell script to do ~ expansion
695 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
698 if $test -f /bin/csh; then
699 /bin/csh -f -c "glob \$1"
702 name=\`$expr x\$1 : '..\([^/]*\)'\`
703 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
704 if $test ! -d "\$dir"; then
706 echo "\$me: can't locate home directory for: \$name" >&2
711 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
727 : get old answers, if there is a config file out there
729 if test -f ../config.sh; then
731 eval "`grep lastuname ../config.sh`"
732 tmp=`(uname -a) 2>&1`
733 if test "X$tmp" = "X$lastuname"; then
739 rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
743 n*) echo "OK, I'll ignore it."; mv ../config.sh ../config.sh.old;;
744 *) echo "Fetching default answers from your old config.sh file..."
754 lastuname=`(uname -a) 2>&1`
756 if test -d ../hints && test ! -f ../config.sh; then
758 echo "First time through, eh? I have some defaults handy for the following systems:"
759 (cd ../hints; ls -C *.sh | sed 's/\.sh/ /g')
761 : Half the following guesses are probably wrong...
762 test -f /irix && dflt="$dflt sgi"
763 test -f /xenix && dflt="$dflt sco_xenix"
764 test -f /dynix && dflt="$dflt dynix"
765 test -f /dnix && dflt="$dflt dnix"
766 test -f /bin/mips && /bin/mips && dflt="$dflt mips"
767 test -d /NextApps && test -f /usr/adm/software_version && dflt="$dflt next"
768 if test -f /bin/uname || test -f /usr/bin/uname; then
769 set `uname -a | tr '[A-Z]' '[a-z]'`
771 test -f "../hints/$5.sh" && dflt="$dflt $5"
774 3b2) dflt="$dflt 3b2";;
775 fps*) dflt="$dflt fps";;
776 mips*) dflt="$dflt mips";;
777 [23]100) dflt="$dflt mips";;
778 next*) dflt="$dflt next" ;;
782 aix) dflt="$dflt aix_rs" ;;
784 3.4) dflt="$dflt sunos_3_4" ;;
785 3.5) dflt="$dflt sunos_3_5" ;;
786 4.0.1) dflt="$dflt sunos_4_0_1" ;;
787 4.0.2) dflt="$dflt sunos_4_0_2" ;;
790 dnix) dflt="$dflt dnix" ;;
791 genix) dflt="$dflt genix" ;;
792 hp*ux) dflt="$dflt hpux" ;;
793 next) dflt="$dflt next" ;;
794 irix) dflt="$dflt sgi" ;;
796 3*) dflt="$dflt ultrix_3" ;;
797 4*) dflt="$dflt ultrix_4" ;;
800 uts) dflt="$dflt uts" ;;
801 $2) if test -f /etc/systemid; then
802 set `echo $3 | sed 's/\./ /` $4
803 if test -f ../hints/sco_$1_$2_$3.sh; then
804 dflt="$dflt sco_$1_$2_$3"
805 elif test -f ../hints/sco_$1_$2.sh; then
806 dflt="$dflt sco_$1_$2"
807 elif test -f ../hints/sco_$1.sh; then
814 set X `echo $dflt | tr ' ' '\012' | sort | uniq`
820 echo '(You may give one or more space-separated answers, or "none" if appropriate.'
821 echo 'If your OS version has no hints, do not give a wrong version--say "none".)'
822 rp="Which of these apply, if any? [$dflt]"
826 if test -f ../hints/$file.sh; then
828 cat ../hints/$file.sh >>../config.sh
838 echo "*** WHOA THERE!!! ***"
839 echo " The $hint value for \$$2 on this machine was \"$was\"!"
840 rp=" Keep the $hint value? [y]"
844 y) td=$was; tu=$was;;
848 setvar='td=$define; tu=$undef; set X $1; eval "was=\$$2";
850 defineundef) . whoa; eval "$2=\$td";;
851 undefdefine) . whoa; eval "$2=\$tu";;
855 : determine where manual pages go
858 $package has manual pages available in source form.
862 echo "However, you don't have nroff, so they're probably useless to you."
869 echo "If you don't want the manual sources installed, answer 'none'."
872 dflt=`./loc . none /usr/man/local/man1 /usr/man/man.L /usr/man/manl /usr/man/mann /usr/man/u_man/man1 /usr/man/man1`
878 while $test "$cont" ; do
880 rp="Where do the manual pages (source) go (~name ok)? [$dflt]"
889 mansrc=`./filexp "$ans"`
890 if $test -d "$mansrc"; then
893 if $test "$fastread" = yes; then
898 rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]"
936 : Sigh. Well, at least the box is fast...
939 case "$usrinclude" in
940 '') dflt='/usr/include';;
941 *) dflt=$usrinclude;;
944 if $test -f /bin/mips && /bin/mips; then
945 echo "Looks like a MIPS system..."
946 $cat >usrinclude.c <<'EOCP'
951 if cc -E usrinclude.c > usrinclude.out && $contains / usrinclude.out >/dev/null 2>&1 ; then
952 echo "and you're compiling with the BSD43 compiler and libraries."
953 dflt='/bsd43/usr/include'
956 echo "and you're compiling with the SysV compiler and libraries."
959 echo "Doesn't look like a MIPS system."
966 while $test "$cont" ; do
968 rp="Where are the include files you want to use? [$dflt]"
972 if $test -d $ans; then
975 if $test "$fastread" = yes; then
980 rp="Directory $ans doesn't exist. Use that name anyway? [$dflt]"
990 : make some quick guesses about what we are up against
992 cat $usrinclude/signal.h $usrinclude/sys/signal.h >guess.txt 2>/dev/null
993 if test "$usrinclude" = "/bsd43/usr/include" ; then
994 echo "Looks kind of like a SysV MIPS running BSD, but we'll see..."
998 elif test `echo abc | tr a-z A-Z` = Abc ; then
999 echo "Looks kind of like a USG system, but we'll see..."
1003 elif $contains SIGTSTP guess.txt >/dev/null 2>&1 ; then
1004 echo "Looks kind of like a BSD system, but we'll see..."
1009 echo "Looks kind of like a version 7 system, but we'll see..."
1014 case "$eunicefix" in
1017 There is, however, a strange, musty smell in the air that reminds me of
1018 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
1020 echo "exit 0" >eunice
1025 echo "Congratulations. You aren't running Eunice."
1027 echo "exit 1" >eunice
1030 if test -f /xenix; then
1031 echo "Actually, this looks more like a XENIX system..."
1032 echo "exit 0" >xenix
1035 echo "It's not Xenix..."
1036 echo "exit 1" >xenix
1040 if test -f /venix; then
1041 echo "Actually, this looks more like a VENIX system..."
1042 echo "exit 0" >venix
1048 echo "Nor is it Venix..."
1050 echo "exit 1" >venix
1052 chmod +x bsd usg v7 eunice venix
1053 $eunicefix bsd usg v7 eunice venix
1055 : see what memory models we can support
1058 : We may not use Cppsym or we get a circular dependency through cc.
1059 : But this should work regardless of which cc we eventually use.
1060 cat >pdp11.c <<'EOP'
1069 cc -o pdp11 pdp11.c >/dev/null 2>&1
1070 if pdp11 2>/dev/null; then
1071 dflt='unsplit split'
1073 ans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1076 *) if $test -d /lib/small || $test -d /usr/lib/small; then
1081 if $test -d /lib/medium || $test -d /usr/lib/medium; then
1084 if $test -d /lib/large || $test -d /usr/lib/large; then
1087 if $test -d /lib/huge || $test -d /usr/lib/huge; then
1093 *) dflt="$models" ;;
1097 Some systems have different model sizes. On most systems they are called
1098 small, medium, large, and huge. On the PDP11 they are called unsplit and
1099 split. If your system doesn't support different memory models, say "none".
1100 If you wish to force everything to one memory model, say "none" here and
1101 put the appropriate flags later when it asks you for other cc and ld flags.
1102 Venix systems may wish to put "none" and let the compiler figure things out.
1103 (In the following question multiple model names should be space separated.)
1106 rp="Which models are supported? [$dflt]"
1123 if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
1124 $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
1132 rp="What flag indicates separate I and D space? [$dflt]"
1141 *large*|*small*|*medium*|*huge*)
1148 rp="What flag indicates large model? [$dflt]"
1164 rp="What flag indicates huge model? [$dflt]"
1180 rp="What flag indicates medium model? [$dflt]"
1188 *) medium="$large";;
1196 rp="What flag indicates small model? [$dflt]"
1208 echo "Unrecognized memory models--you may have to edit Makefile.SH"
1212 : see if we need a special compiler
1226 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
1240 On some systems the default C compiler will not resolve multiple global
1241 references that happen to have the same name. On some such systems the
1242 "Mcc" command may be used to force these to be resolved. On other systems
1243 a "cc -M" command is required. (Note that the -M flag on other systems
1244 indicates a memory model to use!) If you have the Gnu C compiler, you
1245 might wish to use that instead. What command will force resolution on
1247 $echo $n "this system? [$dflt] $c"
1248 rp="Command to resolve multiple refs? [$dflt]"
1256 rp="Use which C compiler? [$dflt]"
1262 gcc*) cpp=`./loc gcc-cpp $cpp $pth`
1263 case "$nativegcc" in
1264 '') case "$ccflags" in
1265 *-fpcc-struct-return*) dflt=n;;
1273 rp="Are your system (especially dbm) libraries compiled with gcc? [$dflt]"
1277 n*) nativegcc="$undef"; gccflags='-fpcc-struct-return';;
1278 *) nativegcc="$define"; gccflags='';;
1283 *) gccflags="$gccflags -traditional -Dvolatile=__volatile__" ;;
1288 : determine optimize, if desired, or use for debug flag also
1299 Some C compilers have problems with their optimizers, by default, $package
1300 compiles with the -O flag to use the optimizer. Alternately, you might
1301 want to use the symbolic debugger, which uses the -g flag (on traditional
1302 Unix systems). Either flag can be specified here. To use neither flag,
1303 specify the word "none".
1306 rp="What optimizer/debugger flag should be used? [$dflt]"
1311 'none') optimize=" "
1317 *gcc*) dflt="$gccflags";;
1321 *-fpcc-struct-return*) dflt="$ccflags";;
1323 *gcc*) dflt="$ccflags $gccflags";;
1324 *) dflt="$ccflags";;
1328 for thisincl in $inclwanted; do
1329 if test -d $thisincl; then
1330 if test "x$thisincl" != "x$usrinclude"; then
1333 *) dflt="$dflt -I$thisincl";;
1342 *) dflt="$dflt -DDEBUGGING";;
1346 if $contains 'LANGUAGE_C' $usrinclude/signal.h >/dev/null 2>&1; then
1349 *) dflt="$dflt -DLANGUAGE_C";;
1352 if $contains '_NO_PROTO' $usrinclude/signal.h >/dev/null 2>&1; then
1355 *) dflt="$dflt -D_NO_PROTO";;
1363 Your C compiler may want other flags. For this question you should
1364 include -I/whatever and -DWHATEVER flags and any other flags used by
1365 the C compiler, but you should NOT include libraries or ld flags like
1366 -lwhatever. To use no flags, specify the word "none".
1369 rp="Any additional cc flags? [$dflt]"
1377 : the following weeds options from ccflags that are of no interest to cpp
1380 *gcc*) cppflags="$cppflags -D__GNUC__";;
1388 -D*|-U*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
1392 *-*) echo "(C preprocessor flags: $cppflags)";;
1404 *) dflt="$ldflags";;
1407 rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1416 echo "Checking for optional libraries..."
1421 case "$libswanted" in
1422 '') libswanted='c_s';;
1424 for thislib in $libswanted; do
1428 *) thatlib="${thislib}_s";;
1431 xxx=`./loc lib$thislib.a X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib`
1432 if test -f $xxx; then
1433 echo "Found -l$thislib."
1435 *"-l$thislib "*|*"-l$thatlib "*);;
1436 *) dflt="$dflt -l$thislib ";;
1439 xxx=`./loc lib$thislib.a X $libpth`
1440 if test -f $xxx; then
1444 *) dflt="$dflt $xxx ";;
1447 xxx=`./loc Slib$thislib.a X $xlibpth`
1448 if test -f $xxx; then
1449 echo "Found -l$thislib."
1451 *"-l$thislib "*|*"-l$thatlib "*);;
1452 *) dflt="$dflt -l$thislib ";;
1455 xxx=`./loc lib$thislib.so X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib`
1456 if test -f $xxx; then
1457 echo "Found -l$thislib as a shared object only."
1459 *"-l$thislib "*|*"-l$thatlib "*);;
1460 *) dflt="$dflt -l$thislib ";;
1463 echo "No -l$thislib."
1478 Some versions of Unix support shared libraries, which make
1479 executables smaller but make load time slightly longer.
1481 On some systems, mostly newer Unix System V's, the shared library
1482 is included by putting the option "-lc_s" as the last thing on the
1483 cc command line when linking. Other systems use shared libraries
1484 by default. There may be other libraries needed to compile $package
1485 on your machine as well. If your system needs the "-lc_s" option,
1486 include it here. Include any other special libraries here as well.
1487 Say "none" for none.
1491 rp="Any additional libraries? [$dflt]"
1499 : check for size of random number generator
1501 case "$alignbytes" in
1503 echo "Checking alignment constraints..."
1504 $cat >try.c <<'EOCP'
1511 printf("%d\n", (char*)&try.bar - (char*)&try.foo);
1514 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
1518 echo "(I can't seem to compile the test program...)"
1525 rp="Doubles must be aligned on a how-many-byte boundary? [$dflt]"
1531 : determine where public executables go
1534 The following questions distinguish the directory in which executables
1535 reside from the directory in which they are installed (and from which they
1536 are presumably copied to the former directory by occult means). This
1537 distinction is often necessary under afs. On most other systems, however,
1538 the two directories are the same.
1543 dflt=`./loc . /usr/local/bin /usr/local/bin /usr/lbin /usr/local /usr/bin /bin`
1549 while $test "$cont" ; do
1550 rp="In which directory will public executables reside (~name ok)? [$dflt]"
1551 $echo "In which directory will public executables reside (~name ok)?"
1552 $echo $n "[$dflt] $c"
1556 if test -d $bin; then
1563 rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]"
1573 case "$installbin" in
1575 dflt=`echo $bin | sed 's#^/afs/#/afs/.#'`
1576 test -d $dflt || dflt="$bin"
1578 *) dflt="$installbin"
1582 while $test "$cont" ; do
1583 rp="In which directory will public executables be installed (~name ok)? [$dflt]"
1584 $echo "In which directory will public executables be installed (~name ok)?"
1585 $echo $n "[$dflt] $c"
1588 installbin=`./filexp $installbin`
1589 if test -d $installbin; then
1596 rp="Directory $installbin doesn't exist. Use that name anyway? [$dflt]"
1606 : check for ordering of bytes in a long
1607 case "$byteorder" in
1611 In the following, larger digits indicate more significance. A big-endian
1612 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
1613 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
1614 machines may have weird orders like 3412. A Cray will report 87654321. If
1615 the test program works the default is probably right.
1616 I'm now running the test program...
1618 $cat >byteorder.c <<'EOCP'
1625 char c[sizeof(long)];
1628 if (sizeof(long) > 4)
1629 u.l = (0x08070605 << 32) | 0x04030201;
1632 for (i=0; i < sizeof(long); i++)
1633 printf("%c",u.c[i]+'0');
1637 if $cc byteorder.c -o byteorder >/dev/null 2>&1 ; then
1640 ????|????????) echo "(The test program ran ok.)";;
1641 *) echo "(The test program didn't run right for some reason.)";;
1645 echo "(I can't seem to compile the test program. Guessing big-endian...)"
1653 rp="What is the order of bytes in a long? [$dflt]"
1658 : check for ability to cast negative floats to unsigned
1660 echo 'Checking to see if your C compiler can cast weird floats to unsigned'
1661 $cat >try.c <<'EOCP'
1664 blech() { exit(3); }
1669 unsigned long along;
1671 unsigned short ashort;
1674 signal(SIGFPE, blech);
1675 along = (unsigned long)f;
1676 aint = (unsigned int)f;
1677 ashort = (unsigned short)f;
1678 if (along != (unsigned long)-123)
1680 if (aint != (unsigned int)-123)
1682 if (ashort != (unsigned short)-123)
1684 f = (double)0x40000000;
1687 along = (unsigned long)f;
1688 if (along != 0x80000000)
1692 along = (unsigned long)f;
1693 if (along != 0x7fffffff)
1697 along = (unsigned long)f;
1698 if (along != 0x80000001)
1703 if $cc -o try $ccflags try.c >/dev/null 2>&1; then
1709 case "$castflags" in
1711 echo "Yup, it does."
1714 echo "Nope, it doesn't."
1721 : see how we invoke the C preprocessor
1723 echo "Now, how can we feed standard input to your C preprocessor..."
1724 cat <<'EOT' >testcpp.c
1731 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
1736 /*cppstdin) cppstdin=cppstdin;;
1741 if test "X$cppstdin" != "X" && \
1742 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
1743 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1744 echo "You used to use $cppstdin $cppminus so we'll use that again."
1745 elif test "$cc" = gcc && \
1746 (echo "Using gcc, eh? We'll try to force gcc -E using a wrapper..."; \
1747 $wrapper <testcpp.c >testcpp.out 2>&1; \
1748 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then
1752 elif echo 'Maybe "'"$cc"' -E" will work...'; \
1753 $cc -E <testcpp.c >testcpp.out 2>&1; \
1754 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1755 echo "Yup, it does."
1758 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
1759 $cc -E - <testcpp.c >testcpp.out 2>&1; \
1760 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1761 echo "Yup, it does."
1764 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
1765 $cpp <testcpp.c >testcpp.out 2>&1; \
1766 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1770 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
1771 $cpp - <testcpp.c >testcpp.out 2>&1; \
1772 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1773 echo "Hooray, it works! I was beginning to wonder."
1776 elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
1777 $wrapper <testcpp.c >testcpp.out 2>&1; \
1778 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1782 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
1783 $cc -P <testcpp.c >testcpp.out 2>&1; \
1784 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1785 echo "Yipee, that works!"
1788 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
1789 $cc -P - <testcpp.c >testcpp.out 2>&1; \
1790 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1791 echo "At long last!"
1796 $echo $n "No dice. I can't find a C preprocessor. Name one: $c"
1797 rp='Name a C preprocessor:'
1800 $cppstdin <testcpp.c >testcpp.out 2>&1
1801 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1802 echo "OK, that will do."
1804 echo "Sorry, I can't get that to work. Go find one and rerun Configure."
1809 : get list of predefined functions in a handy place
1815 '') if test -f /mach_boot; then
1817 elif test -d /usr/ccs/lib; then
1824 : on mips, we DO NOT want /lib, and we want inclPath/usr/lib
1827 libpth='$inclPath/usr/lib /usr/local/lib'
1830 libpth='/usr/ccs/lib /lib /usr/lib /usr/ucblib /usr/local/lib'
1835 *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
1840 *) for thislib in $libs; do
1842 -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
1843 try=`./loc lib$thislib.a blurfl/dyick $libpth`
1844 if test ! -f $try; then
1845 try=`./loc lib$thislib blurfl/dyick $libpth`
1846 if test ! -f $try; then
1847 try=`./loc $thislib blurfl/dyick $libpth`
1848 if test ! -f $try; then
1849 try=`./loc Slib$thislib.a blurfl/dyick $xlibpth`
1850 if test ! -f $try; then
1856 libnames="$libnames $try"
1858 *) libnames="$libnames $thislib" ;;
1863 set /usr/ccs/lib/libc.so
1864 test -f $1 || set /usr/lib/libc.so
1865 test -f $1 || set /usr/lib/libc.so.[0-9]*
1866 test -f $1 || set /lib/libsys_s.a
1868 if test -f "$1"; then
1869 echo "Your (shared) C library seems to be in $1."
1871 elif test -f "$libc"; then
1872 echo "Your C library seems to be in $libc."
1873 elif test -f /lib/libc.a; then
1874 echo "Your C library seems to be in /lib/libc.a. You're normal."
1877 if ans=`./loc libc.a blurfl/dyick $libpth`; test -f "$ans"; then
1879 elif ans=`./loc libc blurfl/dyick $libpth`; test -f "$ans"; then
1880 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
1881 elif ans=`./loc clib blurfl/dyick $libpth`; test -f "$ans"; then
1883 elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1885 elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1887 elif ans=`./loc Llibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1890 if test -f "$ans"; then
1891 echo "Your C library seems to be in $ans, of all places."
1896 I can't seem to find your C library. I've looked in the following places:
1900 None of these seems to contain your C library. What is the full name
1903 $echo $n "of your C library? $c"
1904 rp='C library full name?'
1910 if test $libc = "/lib/libc"; then
1911 libc="$libc /lib/clib"
1915 If the guess above is wrong (which it might be if you're using a strange
1916 compiler, or your machine supports multiple models), you can override it here.
1919 rp="Your C library is where? [$dflt]"
1924 echo $libc $libnames | tr ' ' '\012' | sort | uniq >libnames
1925 $echo "Extracting names from the following files for later perusal:"
1926 sed 's/^/ /' libnames
1927 echo $n "This may take a while...$c"
1928 set X `cat libnames`
1930 nm $nm_opts $* 2>/dev/null >libc.tmp
1931 $sed -n -e 's/^.* [ATDS] *[_.]*//p' -e 's/^.* [ATDS] //p' <libc.tmp >libc.list
1932 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1934 elif $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' \
1935 <libc.tmp >libc.list; \
1936 $contains '^printf$' libc.list >/dev/null 2>&1; then
1938 elif $sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' <libc.tmp >libc.list; \
1939 $contains '^printf$' libc.list >/dev/null 2>&1; then
1941 elif $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list; \
1942 $contains '^printf$' libc.list >/dev/null 2>&1; then
1944 elif $sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' \
1945 <libc.tmp >libc.list; \
1946 $contains '^printf$' libc.list >/dev/null 2>&1; then
1948 elif $grep '|' <libc.tmp | $sed -n -e '/|COMMON/d' -e '/|DATA/d' -e '/ file/d' \
1949 -e 's/^\([^ ]*\).*/\1/p' >libc.list
1950 $contains '^printf$' libc.list >/dev/null 2>&1; then
1952 elif $sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p' \
1953 <libc.tmp >libc.list; \
1954 $contains '^printf$' libc.list >/dev/null 2>&1; then
1957 nm -p $* 2>/dev/null >libc.tmp
1958 $sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
1959 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1964 echo "nm didn't seem to work right."
1965 echo "Trying ar instead..."
1966 if ar t $libc > libc.tmp; then
1967 for thisname in $libnames; do
1968 ar t $thisname >>libc.tmp
1970 $sed -e 's/\.o$//' < libc.tmp > libc.list
1973 echo "ar didn't seem to work right."
1974 echo "Maybe this is a Cray...trying bld instead..."
1975 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
1976 for thisname in $libnames; do
1978 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
1979 ar t $thisname >>libc.tmp
1983 echo "That didn't work either. Giving up."
1989 if test -f /lib/syscalls.exp; then
1990 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..."
1991 sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
1994 inlibc='echo " "; td=$define; tu=$undef;
1995 if $contains "^$1\$" libc.list >/dev/null 2>&1;
1996 then echo "$1() found";
1997 eval "case \"\$$2\" in undef) . whoa; esac"; eval "$2=\$td";
1998 else echo "$1() not found";
1999 eval "case \"\$$2\" in define) . whoa; esac"; eval "$2=\$tu"; fi'
2001 : see if bcmp exists
2005 : see if bcopy exists
2009 : see if bzero exists
2013 : see if sprintf is declared as int or pointer to char
2015 cat >ucbsprf.c <<'EOF'
2021 exit((unsigned long)sprintf(buf,"%s","foo") > 10L);
2024 if $cc $ccflags ucbsprf.c -o ucbsprf >/dev/null 2>&1 && ./ucbsprf; then
2025 echo "Your sprintf() returns (int)."
2028 echo "Your sprintf() returns (char*)."
2034 : see if vprintf exists
2036 if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
2037 echo 'vprintf() found.'
2039 cat >vprintf.c <<'EOF'
2040 #include <varargs.h>
2042 main() { xxx("foo"); }
2051 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
2054 if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
2055 echo "Your vsprintf() returns (int)."
2058 echo "Your vsprintf() returns (char*)."
2062 echo 'vprintf() not found.'
2072 : see if chsize exists
2076 : see if crypt exists
2078 if $contains '^crypt$' libc.list >/dev/null 2>&1; then
2079 echo 'crypt() found.'
2083 cryptlib=`./loc Slibcrypt.a "" $xlibpth`
2084 if $test -z "$cryptlib"; then
2085 cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
2089 if $test -z "$cryptlib"; then
2090 cryptlib=`./loc Llibcrypt.a "" $xlibpth`
2094 if $test -z "$cryptlib"; then
2095 cryptlib=`./loc libcrypt.a "" $libpth`
2099 if $test -z "$cryptlib"; then
2100 echo 'crypt() not found.'
2109 : get csh whereabouts
2111 'csh') val="$undef" ;;
2117 : see if readdir exists
2118 set readdir d_readdir
2121 : see if there are directory access routines out there
2123 xxx=`./loc ndir.h x $usrinclude /usr/local/include $inclwanted`
2126 xxx=`./loc sys/ndir.h x $usrinclude /usr/local/include $inclwanted`
2129 D_dirnamlen="$undef"
2138 if $test -r $usrinclude/dirent.h; then
2139 echo "dirent.h found."
2140 if $contains 'd_namlen' $usrinclude/dirent.h >/dev/null 2>&1; then
2141 D_dirnamlen="$define"
2144 elif $test -r $xxx; then
2145 echo "You seem to use <$xxx>,"
2146 if $test "$d_readdir" = "$define"; then
2147 echo "and I can get readdir() from your C library."
2148 elif $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a; then
2149 echo "and I'll get the routines using -lndir ."
2152 ans=`./loc libndir.a x $libpth`
2155 echo "but I can't find the ndir library!"
2158 echo "and I found the directory library in $ans."
2163 if $contains 'd_namlen' $xxx >/dev/null 2>&1; then
2164 D_dirnamlen="$define"
2168 I_sys_ndir="$define"
2175 : The next line used to require this to be a bsd system.
2176 if $contains '^readdir$' libc.list >/dev/null 2>&1 ; then
2177 echo "No ndir library found, but you have readdir() so we'll use that."
2178 if $contains 'd_namlen' $usrinclude/sys/dir.h >/dev/null 2>&1; then
2179 D_dirnamlen="$define"
2183 echo "No ndir library found--using ./$d_ndir.c."
2184 : This will lose since $d_ndir.h is in another directory.
2185 : I doubt we can rely on it being in ../$d_ndir.h .
2186 : At least it will fail in a conservative manner.
2187 if $contains 'd_namlen' $d_ndir.h >/dev/null 2>&1; then
2188 D_dirnamlen="$define"
2195 val=$D_dirnamlen; set d_dirnamlen; eval $setvar
2196 val=$I_dirent; set i_dirent; eval $setvar
2197 val=$I_sys_dir; set i_sys_dir; eval $setvar
2198 val=$I_my_dir; set i_my_dir; eval $setvar
2199 val=$I_ndir; set i_ndir; eval $setvar
2200 val=$I_sys_ndir; set i_sys_ndir; eval $setvar
2202 : now see if they want to do setuid emulation
2210 Some sites have disabled setuid #! scripts because of a bug in the kernel
2211 that prevents them from being secure. If you are on such a system, the
2212 setuid/setgid bits on scripts are currently useless. It is possible for
2213 $package to detect those bits and emulate setuid/setgid in a secure fashion
2214 until a better solution is devised for the kernel problem.
2217 rp="Do you want to do setuid/setgid emulation? [$dflt]"
2224 y*) d_dosuid="$define";;
2225 *) d_dosuid="$undef";;
2228 : see if dup2 exists
2232 : see if fchmod exists
2236 : see if fchown exists
2240 : see if this is an fcntl system
2244 : see if we can have long filenames
2246 rm -f 123456789abcde
2247 if (echo hi >123456789abcdef) 2>/dev/null; then
2249 if test -f 123456789abcde; then
2250 echo 'You cannot have filenames longer than 14 characters. Sigh.'
2253 echo 'You can have filenames longer than 14 characters.'
2257 : version 8 probably
2258 echo "You can't have filenames longer than 14 chars. You can't even think about them!"
2264 : see if flock exists
2268 : see if getgroups exists
2269 set getgroups d_getgrps
2272 : see if gethostent exists
2273 set gethostent d_gethent
2276 : see if getpgrp exists
2277 set getpgrp d_getpgrp
2280 : see if getpgrp2 exists
2281 set getpgrp2 d_getpgrp2
2284 : see if getpriority exists
2285 set getpriority d_getprior
2288 : see if htonl exists
2296 *) if $test -f /unix; then
2303 if $contains '^index$' libc.list >/dev/null 2>&1 ; then
2304 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2305 echo "Your system has both index() and strchr(). Shall I use"
2306 rp="index() rather than strchr()? [$dflt]"
2310 n*) d_index="$define" ;;
2311 *) d_index="$undef" ;;
2315 echo "index() found."
2318 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2320 echo "strchr() found."
2322 echo "No index() or strchr() found!"
2327 : see if killpg exists
2331 : see if lstat exists
2335 : see if memcmp exists
2339 : see if memcpy exists
2343 : see if mkdir exists
2347 : see if msgctl exists
2351 : see if msgget exists
2355 : see if msgsnd exists
2359 : see if msgrcv exists
2363 : see how much of the 'msg*(2)' library is present.
2366 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
2367 *undef*) h_msg=false;;
2369 : we could also check for sys/ipc.h ...
2370 if $h_msg && $test -r $usrinclude/sys/msg.h; then
2371 echo "You have the full msg*(2) library."
2374 echo "You don't have the full msg*(2) library."
2380 : see if ndbm is available
2382 xxx=`./loc ndbm.h x $usrinclude /usr/local/include $inclwanted`
2383 if test -f $xxx; then
2385 echo "ndbm.h found."
2388 echo "ndbm.h not found."
2393 : see if we have the old dbm
2395 xxx=`./loc dbm.h x $usrinclude /usr/local/include $inclwanted`
2396 if test -f $xxx; then
2401 echo "dbm.h not found."
2406 : see whether socket exists
2409 if $contains socket libc.list >/dev/null 2>&1; then
2410 echo "Looks like you have Berkeley networking support."
2412 : now check for advanced features
2413 if $contains setsockopt libc.list >/dev/null 2>&1; then
2416 echo "...but it uses the old 4.1c interface, rather than 4.2"
2420 : hpux, for one, puts all the socket stuff in socklib.o
2421 if $contains socklib libc.list >/dev/null 2>&1; then
2422 echo "Looks like you have Berkeley networking support."
2424 : we will have to assume that it supports the 4.2 BSD interface
2427 echo "Hmmm...you don't have Berkeley networking in libc.a..."
2428 : look for an optional networking library
2429 if test -f /usr/lib/libnet.a; then
2430 (ar t /usr/lib/libnet.a ||
2431 nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
2432 if $contains socket libc.list >/dev/null 2>&1; then
2433 echo "but the Wollongong group seems to have hacked it in."
2434 socketlib="-lnet -lnsl_s"
2436 : now check for advanced features
2437 if $contains setsockopt libc.list >/dev/null 2>&1; then
2440 echo "...using the old 4.1c interface, rather than 4.2"
2444 echo "or even in libnet.a, which is peculiar."
2449 echo "or anywhere else I see."
2458 if $contains socketpair libc.list >/dev/null 2>&1; then
2469 : Locate the flags for 'open()'
2471 $cat >open3.c <<'EOCP'
2472 #include <sys/types.h>
2477 #include <sys/file.h>
2490 : check sys/file.h first to get FREAD on Sun
2491 if $test -r $usrinclude/sys/file.h && \
2492 $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
2494 echo "sys/file.h defines the O_* constants..."
2496 echo "and you have the 3 argument form of open()."
2499 echo "but not the 3 argument form of open(). Oh, well."
2502 elif $test -r $usrinclude/fcntl.h && \
2503 $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
2505 echo "fcntl.h defines the O_* constants..."
2507 echo "and you have the 3 argument form of open()."
2510 echo "but not the 3 argument form of open(). Oh, well."
2515 echo "I can't find the O_* constant definitions! You got problems."
2520 : see if how pwd stuff is defined
2522 if $test -r $usrinclude/pwd.h ; then
2525 $cppstdin $cppflags $cppminus <$usrinclude/pwd.h | \
2526 sed -n '/struct[ ][ ]*passwd/,/^};/p' >pwd.txt
2527 if $contains 'pw_quota' pwd.txt >/dev/null 2>&1; then
2532 if $contains 'pw_age' pwd.txt >/dev/null 2>&1; then
2537 if $contains 'pw_change' pwd.txt >/dev/null 2>&1; then
2538 d_pwchange="$define"
2542 if $contains 'pw_class' pwd.txt >/dev/null 2>&1; then
2547 if $contains 'pw_expire' pwd.txt >/dev/null 2>&1; then
2548 d_pwexpire="$define"
2552 if $contains 'pw_comment' pwd.txt >/dev/null 2>&1; then
2553 d_pwcomment="$define"
2555 d_pwcomment="$undef"
2564 d_pwcomment="$undef"
2565 echo "No pwd.h found."
2568 : see if rename exists
2572 : see if rmdir exists
2576 : see if select exists
2580 : see if semctl exists
2584 : see if semget exists
2588 : see if semop exists
2592 : see how much of the 'sem*(2)' library is present.
2595 case "$d_semctl$d_semget$d_semop" in
2596 *undef*) h_sem=false;;
2598 : we could also check for sys/ipc.h ...
2599 if $h_sem && $test -r $usrinclude/sys/sem.h; then
2600 echo "You have the full sem*(2) library."
2603 echo "You don't have the full sem*(2) library."
2609 : see if setegid exists
2610 set setegid d_setegid
2613 : see if seteuid exists
2614 set seteuid d_seteuid
2617 : see if setpgrp exists
2618 set setpgrp d_setpgrp
2621 : see if setpgrp2 exists
2622 set setpgrp2 d_setpgrp2
2625 : see if setpriority exists
2626 set setpriority d_setprior
2629 : see if setregid exists
2630 set setregid d_setregid
2632 set setresgid d_setresgid
2635 : see if setreuid exists
2636 set setreuid d_setreuid
2638 set setresuid d_setresuid
2641 : see if setrgid exists
2642 set setrgid d_setrgid
2645 : see if setruid exists
2646 set setruid d_setruid
2649 : see if shmctl exists
2653 : see if shmget exists
2657 : see if shmat exists
2661 d_voidshmat="$undef"
2664 $cppstdin $cppflags $cppminus < $usrinclude/sys/shm.h >voidshmat.txt 2>/dev/null
2665 if $contains "void.*shmat" voidshmat.txt >/dev/null 2>&1; then
2666 echo "and shmat returns (void*)"
2667 d_voidshmat="$define"
2669 echo "and shmat returns (char*)"
2674 : see if shmdt exists
2678 : see how much of the 'shm*(2)' library is present.
2681 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
2682 *undef*) h_shm=false;;
2684 : we could also check for sys/ipc.h ...
2685 if $h_shm && $test -r $usrinclude/sys/shm.h; then
2686 echo "You have the full shm*(2) library."
2689 echo "You don't have the full shm*(2) library."
2695 : see if stat knows about block sizes
2697 if $contains 'st_blocks;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
2698 if $contains 'st_blksize;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
2699 echo "Your stat knows about block sizes."
2702 echo "Your stat doesn't know about block sizes."
2706 echo "Your stat doesn't know about block sizes."
2712 : see if stdio is really std
2714 if $contains 'char.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2715 if $contains '_cnt;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2716 echo "Your stdio is pretty std."
2719 echo "Your stdio isn't very std."
2723 echo "Your stdio isn't very std."
2729 : check for structure copying
2731 echo "Checking to see if your C compiler can copy structs..."
2732 $cat >strctcpy.c <<'EOCP'
2742 if $cc -c strctcpy.c >/dev/null 2>&1 ; then
2747 echo "Nope, it can't."
2752 : see if strerror exists
2753 set strerror d_strerror
2756 : see if symlink exists
2757 set symlink d_symlink
2760 : see if syscall exists
2761 set syscall d_syscall
2764 : set if package uses struct tm
2767 : set if package uses struct timeval
2769 define) w_s_timevl=1 ;;
2772 : set if package uses localtime function
2775 : see which of time.h, sys/time.h, and sys/select should be included.
2779 Testing to see which of <time.h>, <sys/time.h>, and <sys/select.h>
2780 should be included, because this application wants:
2783 case "$w_s_itimer" in
2785 echo " struct itimerval"
2786 idefs="-DS_ITIMERVAL $idefs"
2789 case "$w_s_timevl" in
2791 echo " struct timeval"
2792 idefs="-DS_TIMEVAL $idefs"
2798 idefs="-DS_TM $idefs"
2801 case "$w_localtim" in
2803 echo " ctime(3) declarations"
2804 idefs="-DD_CTIME $idefs"
2809 echo " (something I don't know about)"
2813 echo "I'm now running the test program..."
2814 $cat >i_time.c <<'EOCP'
2815 #include <sys/types.h>
2820 #ifdef SYSTIMEKERNEL
2823 #include <sys/time.h>
2826 #include <sys/select.h>
2836 struct itimerval baz;
2839 if (foo.tm_sec == foo.tm_sec)
2842 if (bar.tv_sec == bar.tv_sec)
2846 if (baz.it_interval == baz.it_interval)
2850 if (bar.tv_sec == bar.tv_sec)
2854 /* this might not do anything for us... */
2855 tmp = localtime((time_t *)0);
2861 for i_sys_select in '' '-DI_SYS_SELECT'; do
2862 for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
2863 for i_time in '' '-DI_TIME'; do
2864 for i_systime in '-DI_SYS_TIME' ''; do
2866 '') echo Trying $i_time $i_systime $d_systimekernel $i_sys_select
2867 if $cc $ccflags $idefs \
2868 $i_time $i_systime $d_systimekernel $i_sys_select \
2869 i_time.c -o i_time >/dev/null 2>&1 ; then
2870 set X $i_time $i_systime $d_systimekernel $i_sys_select
2873 echo Succeeded with $flags
2882 *SYSTIMEKERNEL*) val="$define";;
2888 *I_TIME*) val="$define";;
2894 *I_SYS_SELECT*) val="$define";;
2900 *I_SYS_TIME*) val="$define";;
2905 case "$flags$i_sys_time$i_time" in
2906 undefundef) i_sys_time="$define"; i_time="$define";
2907 echo "ICK, NOTHING WORKED!!! You may have to diddle the includes.";;
2910 : see if signal is declared as pointer to function returning int or void
2912 $cppstdin $cppflags $cppminus < $usrinclude/signal.h >d_voidsig.txt
2913 if $contains 'int[^A-Za-z]*signal' d_voidsig.txt >/dev/null 2>&1 ; then
2914 echo "You have int (*signal())() instead of void."
2917 echo "You have void (*signal())() instead of int."
2923 define) d_tosignal=void;;
2927 : see if truncate exists
2928 set truncate d_truncate
2931 : see if there is a vfork
2935 : check for volatile keyword
2937 echo 'Checking to see if your C compiler knows about "volatile"...'
2938 $cat >try.c <<'EOCP'
2941 typedef unsigned short foo_t;
2944 volatile foo_t blech;
2948 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
2950 echo "Yup, it does."
2953 echo "Nope, it doesn't."
2959 : see if there is a wait4
2963 : see if there is a waitpid
2964 set waitpid d_waitpid
2967 : see what type gids are declared as in the kernel
2970 if $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
2973 set `grep '_rgid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
2975 unsigned) dflt="$1 $2" ;;
2985 rp="What type are groups ids returned by getgid(), etc.? [$dflt]"
2990 : see what type gids are returned by getgroups
2992 case "$groupstype" in
2994 if $contains 'getgroups.*short' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
2996 elif $contains 'getgroups.*int' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
2998 elif $contains 'getgroups.*short' /usr/include/libc.h >/dev/null 2>&1; then
3000 elif $contains 'getgroups.*int' /usr/include/libc.h >/dev/null 2>&1; then
3002 elif $contains 'getgroups.*short' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
3004 elif $contains 'getgroups.*int' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
3006 elif $contains 'int.*gidset' /usr/man/man2/getgroups.2 >/dev/null 2>&1; then
3008 elif $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
3011 set `grep 'groups\[NGROUPS\];' $usrinclude/sys/user.h 2>/dev/null` unsigned short
3013 unsigned) dflt="$1 $2" ;;
3018 *) dflt="$groupstype"
3022 echo "(The following only matters if you have getgroups().)"
3023 rp="What type are the group ids returned by getgroups()? [$dflt]"
3028 : check for length of integer
3032 echo "Checking to see how big your integers are..."
3033 $cat >intsize.c <<'EOCP'
3037 printf("%d\n", sizeof(int));
3040 if $cc intsize.c -o intsize >/dev/null 2>&1 ; then
3044 echo "(I can't seem to compile the test program. Guessing...)"
3051 rp="What is the size of an integer (in bytes)? [$dflt]"
3056 : determine which malloc to compile in
3058 case "$d_mymalloc" in
3060 case "$usemymalloc" in
3077 rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
3084 y*) mallocsrc='malloc.c'; mallocobj='malloc.o'
3085 libs=`echo $libs | sed 's/-lmalloc//'`
3087 case "$mallocptrtype" in
3089 cat >usemymalloc.c <<'END'
3097 if $cc $ccflags -c usemymalloc.c >/dev/null 2>&1; then
3105 echo "Your system wants malloc to return $mallocptrtype*, it would seem."
3116 : determine where private executables go
3119 dflt=/usr/lib/$package
3120 test -d /usr/local/lib && dflt=/usr/local/lib/$package
3127 The $package package has some auxiliary files that should be reside in a library
3128 that is accessible by everyone. Where should these "private" but accessible
3130 $echo $n "files reside? (~name ok) [$dflt] $c"
3131 rp="Private files will reside where? [$dflt]"
3133 privlib=`./filexp "$ans"`
3135 case "$installprivlib" in
3137 dflt=`echo $privlib | sed 's#^/afs/#/afs/.#'`
3138 test -d $dflt || dflt="$privlib"
3140 *) dflt="$installprivlib"
3145 On some systems (such as afs) you have to install the library files in a
3146 different directory to get them to go to the right place. Where should the
3148 $echo $n "library files be installed? (~name ok) [$dflt] $c"
3149 rp="Install private files where? [$dflt]"
3151 installprivlib=`./filexp "$ans"`
3153 : check for size of random number generator
3157 echo "Checking to see how many bits your rand function produces..."
3158 $cat >randbits.c <<'EOCP'
3163 register unsigned long tmp;
3164 register unsigned long max = 0L;
3166 for (i=1000; i; i--) {
3167 tmp = (unsigned long)rand();
3168 if (tmp > max) max = tmp;
3175 if $cc randbits.c -o randbits >/dev/null 2>&1 ; then
3179 echo "(I can't seem to compile the test program...)"
3186 rp="How many bits does your rand() function produce? [$dflt]"
3191 : determine where publicly executable scripts go
3192 case "$scriptdir" in
3195 : guess some guesses
3196 test -d /usr/share/scripts && dflt=/usr/share/scripts
3197 test -d /usr/share/bin && dflt=/usr/share/bin
3199 *) dflt="$scriptdir"
3205 Some installations have a separate directory just for executable scripts so
3206 that they can mount it across multiple architectures but keep the scripts in
3207 one spot. You might, for example, have a subdirectory of /usr/share for this.
3208 Or you might just lump your scripts in with all your other executables.
3211 while $test "$cont" ; do
3212 rp="Where will publicly executable scripts reside (~name ok)? [$dflt]"
3216 scriptdir=`./filexp "$scriptdir"`
3217 if test -d $scriptdir; then
3224 rp="Directory $scriptdir doesn't exist. Use that name anyway? [$dflt]"
3234 case "$installscr" in
3236 dflt=`echo $scriptdir | sed 's#^/afs/#/afs/.#'`
3237 test -d $dflt || dflt="$scriptdir"
3239 *) dflt="$scriptdir"
3245 Some installations must install scripts in a different directory than where
3246 they will eventually reside. On most systems they're the same directory.
3248 while $test "$cont" ; do
3249 rp="Where do you install publicly executable scripts (~name ok)? [$dflt]"
3253 installscr=`./filexp "$installscr"`
3254 if test -d $installscr; then
3261 rp="Directory $installscr doesn't exist. Use that name anyway? [$dflt]"
3271 : generate list of signal names
3275 echo "Generating a list of signal names..."
3276 set X `cat $usrinclude/signal.h $usrinclude/sys/signal.h 2>&1 | awk '
3277 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
3278 sig[$3] = substr($2,4,20)
3279 if (max < $3 && $3 < 60) {
3285 for (i=1; i<=max; i++) {
3298 0) echo 'kill -l' >/tmp/foo$$
3299 set X `$csh -f </tmp/foo$$`
3302 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
3310 echo "Signals are: $sig_name"
3312 : see what type of char stdio uses.
3314 if $contains 'unsigned.*char.*\*.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
3315 echo "Your stdio uses unsigned chars."
3316 stdchar="unsigned char"
3318 echo "Your stdio uses signed chars."
3322 : see what type uids are declared as in the kernel
3325 if $contains 'uid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
3328 set `grep '_ruid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
3330 unsigned) dflt="$1 $2" ;;
3340 rp="What type are user ids returned by getuid(), etc.? [$dflt]"
3345 : check for void type
3348 Checking to see how well your C compiler groks the void type...
3350 Support flag bits are:
3351 1: basic void declarations.
3352 2: arrays of pointers to functions returning void.
3353 4: operations between pointers to and addresses of void functions.
3358 $cat >void.c <<'EOCP'
3364 extern void moo(); /* function returning void */
3365 void (*goo)(); /* ptr to func returning void */
3378 if $cc -c -DTRY=$voidwant void.c >void.out 2>&1 ; then
3380 echo "It appears to support void to the level $package wants ($voidwant)."
3381 if $contains warning void.out >/dev/null 2>&1; then
3382 echo "However, you might get some warnings that look like this:"
3386 echo "Hmm, your compiler has some difficulty with void. Checking further..."
3387 if $cc -c -DTRY=1 void.c >/dev/null 2>&1 ; then
3388 echo "It supports 1..."
3389 if $cc -c -DTRY=3 void.c >/dev/null 2>&1 ; then
3391 echo "And it supports 2 but not 4."
3393 echo "It doesn't support 2..."
3394 if $cc -c -DTRY=5 void.c >/dev/null 2>&1 ; then
3396 echo "But it supports 4."
3399 echo "And it doesn't support 4."
3403 echo "There is no support at all for void."
3409 rp="Your void support flags add up to what? [$dflt]"
3414 : preserve RCS keywords in files with variable substitution, grrr
3422 Revision='$Revision'
3427 : determine compiler compiler
3432 dflt='yacc -Sm25000'
3439 rp="Which compiler compiler (yacc or bison -y) will you use? [$dflt]"
3447 : see if we can include fcntl.h
3451 echo "We'll be including <fcntl.h>."
3454 if $h_sys_file; then
3455 echo "We don't need to <fcntl.h> if we include <sys/file.h>."
3457 echo "We won't be including <fcntl.h>."
3463 : see if gdbm is available
3465 xxx=`./loc gdbm.h x $usrinclude /usr/local/include $inclwanted`
3466 if test -f $xxx; then
3468 echo "gdbm.h found."
3471 echo "gdbm.h not found."
3476 : see if this is an grp system
3478 if $test -r $usrinclude/grp.h ; then
3483 echo "No grp.h found."
3488 : see if this is a netinet/in.h or sys/in.h system
3490 xxx=`./loc netinet/in.h x $usrinclude /usr/local/include $inclwanted`
3491 if test -f $xxx; then
3494 echo "netinet/in.h found."
3497 echo "No netinet/in.h found, ..."
3498 xxx=`./loc sys/in.h x $usrinclude /usr/local/include $inclwanted`
3499 if test -f $xxx; then
3501 echo "but I found sys/in.h instead."
3504 echo "and I didn't find sys/in.h either."
3513 : Do we need to #include <sys/file.h> ?
3515 if $h_sys_file; then
3517 echo "We'll be including <sys/file.h>."
3520 echo "We won't be including <sys/file.h>."
3525 : see if ioctl defs are in sgtty/termio or sys/ioctl
3527 if $test -r $usrinclude/sys/ioctl.h ; then
3529 echo "sys/ioctl.h found."
3532 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
3537 : see if we should include utime.h
3539 if $test -r $usrinclude/utime.h ; then
3541 echo "utime.h found."
3544 echo "No utime.h found, but that's ok."
3549 : see if this is a varargs system
3551 if $test -r $usrinclude/varargs.h ; then
3553 echo "varargs.h found."
3556 echo "No varargs.h found, but that's ok (I hope)."
3561 : see if this is a vfork system
3563 if $test -r $usrinclude/vfork.h ; then
3565 echo "vfork.h found."
3568 echo "No vfork.h found."
3573 : end of configuration questions
3575 echo "End of configuration questions."
3578 : create config.sh file
3580 if test -d ../UU; then
3583 echo "Creating config.sh..."
3584 test -f config.sh && cp config.sh UU/oldconfig.sh
3585 $spitshell <<EOT >config.sh
3588 # This file was produced by running the Configure script.
3589 d_eunice='$d_eunice'
3591 eunicefix='$eunicefix'
3621 sendmail='$sendmail'
3651 lastuname='$lastuname'
3652 alignbytes='$alignbytes'
3654 installbin='$installbin'
3655 byteorder='$byteorder'
3656 contains='$contains'
3657 cppstdin='$cppstdin'
3658 cppminus='$cppminus'
3662 d_castneg='$d_castneg'
3663 castflags='$castflags'
3664 d_charsprf='$d_charsprf'
3665 d_chsize='$d_chsize'
3667 cryptlib='$cryptlib'
3669 d_dosuid='$d_dosuid'
3671 d_fchmod='$d_fchmod'
3672 d_fchown='$d_fchown'
3674 d_flexfnam='$d_flexfnam'
3676 d_getgrps='$d_getgrps'
3677 d_gethent='$d_gethent'
3678 d_getpgrp='$d_getpgrp'
3679 d_getpgrp2='$d_getpgrp2'
3680 d_getprior='$d_getprior'
3683 d_killpg='$d_killpg'
3685 d_memcmp='$d_memcmp'
3686 d_memcpy='$d_memcpy'
3689 d_msgctl='$d_msgctl'
3690 d_msgget='$d_msgget'
3691 d_msgrcv='$d_msgrcv'
3692 d_msgsnd='$d_msgsnd'
3696 d_readdir='$d_readdir'
3697 d_rename='$d_rename'
3699 d_select='$d_select'
3701 d_semctl='$d_semctl'
3702 d_semget='$d_semget'
3704 d_setegid='$d_setegid'
3705 d_seteuid='$d_seteuid'
3706 d_setpgrp='$d_setpgrp'
3707 d_setpgrp2='$d_setpgrp2'
3708 d_setprior='$d_setprior'
3709 d_setregid='$d_setregid'
3710 d_setresgid='$d_setresgid'
3711 d_setreuid='$d_setreuid'
3712 d_setresuid='$d_setresuid'
3713 d_setrgid='$d_setrgid'
3714 d_setruid='$d_setruid'
3717 d_voidshmat='$d_voidshmat'
3718 d_shmctl='$d_shmctl'
3720 d_shmget='$d_shmget'
3721 d_socket='$d_socket'
3722 d_sockpair='$d_sockpair'
3723 d_oldsock='$d_oldsock'
3724 socketlib='$socketlib'
3725 d_statblks='$d_statblks'
3726 d_stdstdio='$d_stdstdio'
3727 d_strctcpy='$d_strctcpy'
3728 d_strerror='$d_strerror'
3729 d_symlink='$d_symlink'
3730 d_syscall='$d_syscall'
3731 d_truncate='$d_truncate'
3733 d_voidsig='$d_voidsig'
3734 d_tosignal='$d_tosignal'
3735 d_volatile='$d_volatile'
3736 d_vprintf='$d_vprintf'
3737 d_charvspr='$d_charvspr'
3739 d_waitpid='$d_waitpid'
3741 groupstype='$groupstype'
3748 d_pwquota='$d_pwquota'
3750 d_pwchange='$d_pwchange'
3751 d_pwclass='$d_pwclass'
3752 d_pwexpire='$d_pwexpire'
3753 d_pwcomment='$d_pwcomment'
3754 i_sys_file='$i_sys_file'
3755 i_sysioctl='$i_sysioctl'
3757 i_sys_time='$i_sys_time'
3758 i_sys_select='$i_sys_select'
3759 d_systimekernel='$d_systimekernel'
3761 i_varargs='$i_varargs'
3767 i_my_dir='$i_my_dir'
3769 i_sys_ndir='$i_sys_ndir'
3770 i_dirent='$i_dirent'
3771 i_sys_dir='$i_sys_dir'
3772 d_dirnamlen='$d_dirnamlen'
3775 mallocsrc='$mallocsrc'
3776 mallocobj='$mallocobj'
3777 d_mymalloc='$d_mymalloc'
3778 mallocptrtype='$mallocptrtype'
3787 optimize='$optimize'
3789 cppflags='$cppflags'
3792 nativegcc='$nativegcc'
3797 randbits='$randbits'
3798 scriptdir='$scriptdir'
3799 installscr='$installscr'
3800 sig_name='$sig_name'
3801 spitshell='$spitshell'
3803 sharpbang='$sharpbang'
3807 usrinclude='$usrinclude'
3808 inclPath='$inclPath'
3810 voidhave='$voidhave'
3811 voidwant='$voidwant'
3812 w_localtim='$w_localtim'
3813 w_s_timevl='$w_s_timevl'
3818 installprivlib='$installprivlib'
3821 test -f patchlevel.h && awk '{printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
3822 echo "CONFIG=true" >>config.sh
3824 if test -f UU/oldconfig.sh; then
3825 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
3826 sort | uniq -u >UU/oldsyms
3827 set X `cat UU/oldsyms`
3831 *) echo "Hmm...You had some extra variables I don't know about...I'll try to keep 'em..."
3832 for sym in `cat UU/oldsyms`; do
3833 echo " Propagating $hint variable "'$'"$sym..."
3834 eval 'tmp="$'"${sym}"'"'
3836 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
3848 echo "If you didn't make any mistakes, then just type a carriage return here."
3849 rp="If you need to edit config.sh, do it as a shell escape here:"
3854 *) : in case they cannot read
3860 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
3864 Now you need to generate make dependencies by running "make depend".
3865 You might prefer to run it in background: "make depend > makedepend.out &"
3866 It can take a while, so you might not want to run it right now.
3869 rp="Run make depend now? [$dflt]"
3873 y*) make depend && echo "Now you must run a make."
3875 *) echo "You must run 'make depend' then 'make'."
3878 elif test -f [Mm]akefile; then
3880 echo "Now you must run a make."