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.6 $$Date: 91/11/11 16:26:51 $
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 socket nsl_s nsl 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
606 pth=`echo :$boPATH:$PATH:$eoPATH: | sed -e 's/:/ /g'`
607 for file in $loclist; do
608 xxx=`./loc $file $file $pth`
613 echo $file is in $xxx.
616 echo "I don't know where $file is. I hope it's in everyone's PATH."
621 echo "Don't worry if any of the following aren't found..."
623 for file in $trylist; do
624 xxx=`./loc $file $file $pth`
629 echo $file is in $xxx.
632 echo "I don't see $file out there, $ans."
639 echo "Substituting grep for egrep."
645 echo "Hopefully test is built into your sh."
648 if sh -c "PATH= test true" >/dev/null 2>&1; then
649 echo "Using the test built into your sh."
659 echo "Hopefully echo is built into your sh."
663 echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
664 $echo $n "hi there$c" >Loc1.txt
665 echo $n "hi there$c" >Loc2.txt
666 if cmp Loc1.txt Loc2.txt >/dev/null 2>&1; then
667 echo "They are compatible. In fact, they may be identical."
670 '-n') n='' c='\c' ans='\c' ;;
671 *) n='-n' c='' ans='-n' ;;
674 They are not compatible! You are probably running ksh on a non-USG system.
675 I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
676 have echo built in and we may have to run some Bourne shell scripts. That
677 means I'll have to use $ans to suppress newlines now. Life is ridiculous.
680 rp="Your cursor should be here-->"
691 : set up shell script to do ~ expansion
697 echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
700 if $test -f /bin/csh; then
701 /bin/csh -f -c "glob \$1"
704 name=\`$expr x\$1 : '..\([^/]*\)'\`
705 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
706 if $test ! -d "\$dir"; then
708 echo "\$me: can't locate home directory for: \$name" >&2
713 echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
729 : get old answers, if there is a config file out there
731 if test -f ../config.sh; then
733 eval "`grep lastuname ../config.sh`"
734 tmp=`(uname -a) 2>&1`
735 if test "X$tmp" = "X$lastuname"; then
741 rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]"
745 n*) echo "OK, I'll ignore it."; mv ../config.sh ../config.sh.old;;
746 *) echo "Fetching default answers from your old config.sh file..."
756 lastuname=`(uname -a) 2>&1`
758 if test -d ../hints && test ! -f ../config.sh; then
760 echo "First time through, eh? I have some defaults handy for the following systems:"
761 (cd ../hints; ls -C *.sh | sed 's/\.sh/ /g')
763 : Half the following guesses are probably wrong...
764 test -f /irix && dflt="$dflt sgi"
765 test -f /xenix && dflt="$dflt sco_xenix"
766 test -f /dynix && dflt="$dflt dynix"
767 test -f /dnix && dflt="$dflt dnix"
768 test -f /bin/mips && /bin/mips && dflt="$dflt mips"
769 test -d /NextApps && test -f /usr/adm/software_version && dflt="$dflt next"
770 if test -f /bin/uname || test -f /usr/bin/uname; then
771 set `uname -a | tr '[A-Z]' '[a-z]'`
773 test -f "../hints/$5.sh" && dflt="$dflt $5"
776 3b2) dflt="$dflt 3b2";;
777 fps*) dflt="$dflt fps";;
778 mips*) dflt="$dflt mips";;
779 [23]100) dflt="$dflt mips";;
780 next*) dflt="$dflt next" ;;
784 aix) dflt="$dflt aix_rs" ;;
786 3.4) dflt="$dflt sunos_3_4" ;;
787 3.5) dflt="$dflt sunos_3_5" ;;
788 4.0.1) dflt="$dflt sunos_4_0_1" ;;
789 4.0.2) dflt="$dflt sunos_4_0_2" ;;
792 dnix) dflt="$dflt dnix" ;;
793 genix) dflt="$dflt genix" ;;
794 hp*ux) dflt="$dflt hpux" ;;
795 next) dflt="$dflt next" ;;
796 irix) dflt="$dflt sgi" ;;
798 3*) dflt="$dflt ultrix_3" ;;
799 4*) dflt="$dflt ultrix_4" ;;
802 uts) dflt="$dflt uts" ;;
803 $2) if test -f /etc/systemid; then
804 set `echo $3 | sed 's/\./ /` $4
805 if test -f ../hints/sco_$1_$2_$3.sh; then
806 dflt="$dflt sco_$1_$2_$3"
807 elif test -f ../hints/sco_$1_$2.sh; then
808 dflt="$dflt sco_$1_$2"
809 elif test -f ../hints/sco_$1.sh; then
816 set X `echo $dflt | tr ' ' '\012' | sort | uniq`
822 echo '(You may give one or more space-separated answers, or "none" if appropriate.'
823 echo 'If your OS version has no hints, do not give a wrong version--say "none".)'
824 rp="Which of these apply, if any? [$dflt]"
828 if test -f ../hints/$file.sh; then
830 cat ../hints/$file.sh >>../config.sh
840 echo "*** WHOA THERE!!! ***"
841 echo " The $hint value for \$$2 on this machine was \"$was\"!"
842 rp=" Keep the $hint value? [y]"
846 y) td=$was; tu=$was;;
850 setvar='td=$define; tu=$undef; set X $1; eval "was=\$$2";
852 defineundef) . whoa; eval "$2=\$td";;
853 undefdefine) . whoa; eval "$2=\$tu";;
857 : determine where manual pages go
860 $package has manual pages available in source form.
864 echo "However, you don't have nroff, so they're probably useless to you."
871 echo "If you don't want the manual sources installed, answer 'none'."
874 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`
880 while $test "$cont" ; do
882 rp="Where do the manual pages (source) go (~name ok)? [$dflt]"
891 mansrc=`./filexp "$ans"`
892 if $test -d "$mansrc"; then
895 if $test "$fastread" = yes; then
900 rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]"
938 : Sigh. Well, at least the box is fast...
941 case "$usrinclude" in
942 '') dflt='/usr/include';;
943 *) dflt=$usrinclude;;
946 if $test -f /bin/mips && /bin/mips; then
947 echo "Looks like a MIPS system..."
948 $cat >usrinclude.c <<'EOCP'
953 if cc -E usrinclude.c > usrinclude.out && $contains / usrinclude.out >/dev/null 2>&1 ; then
954 echo "and you're compiling with the BSD43 compiler and libraries."
955 dflt='/bsd43/usr/include'
958 echo "and you're compiling with the SysV compiler and libraries."
961 echo "Doesn't look like a MIPS system."
968 while $test "$cont" ; do
970 rp="Where are the include files you want to use? [$dflt]"
974 if $test -d $ans; then
977 if $test "$fastread" = yes; then
982 rp="Directory $ans doesn't exist. Use that name anyway? [$dflt]"
992 : make some quick guesses about what we are up against
994 cat $usrinclude/signal.h $usrinclude/sys/signal.h >guess.txt 2>/dev/null
995 if test "$usrinclude" = "/bsd43/usr/include" ; then
996 echo "Looks kind of like a SysV MIPS running BSD, but we'll see..."
1000 elif test `echo abc | tr a-z A-Z` = Abc ; then
1001 echo "Looks kind of like a USG system, but we'll see..."
1005 elif $contains SIGTSTP guess.txt >/dev/null 2>&1 ; then
1006 echo "Looks kind of like a BSD system, but we'll see..."
1011 echo "Looks kind of like a version 7 system, but we'll see..."
1016 case "$eunicefix" in
1019 There is, however, a strange, musty smell in the air that reminds me of
1020 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
1022 echo "exit 0" >eunice
1027 echo "Congratulations. You aren't running Eunice."
1029 echo "exit 1" >eunice
1032 if test -f /xenix; then
1033 echo "Actually, this looks more like a XENIX system..."
1034 echo "exit 0" >xenix
1037 echo "It's not Xenix..."
1038 echo "exit 1" >xenix
1042 if test -f /venix; then
1043 echo "Actually, this looks more like a VENIX system..."
1044 echo "exit 0" >venix
1050 echo "Nor is it Venix..."
1052 echo "exit 1" >venix
1054 chmod +x bsd usg v7 eunice venix
1055 $eunicefix bsd usg v7 eunice venix
1057 : see what memory models we can support
1060 : We may not use Cppsym or we get a circular dependency through cc.
1061 : But this should work regardless of which cc we eventually use.
1062 cat >pdp11.c <<'EOP'
1071 cc -o pdp11 pdp11.c >/dev/null 2>&1
1072 if pdp11 2>/dev/null; then
1073 dflt='unsplit split'
1075 ans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge`
1078 *) if $test -d /lib/small || $test -d /usr/lib/small; then
1083 if $test -d /lib/medium || $test -d /usr/lib/medium; then
1086 if $test -d /lib/large || $test -d /usr/lib/large; then
1089 if $test -d /lib/huge || $test -d /usr/lib/huge; then
1095 *) dflt="$models" ;;
1099 Some systems have different model sizes. On most systems they are called
1100 small, medium, large, and huge. On the PDP11 they are called unsplit and
1101 split. If your system doesn't support different memory models, say "none".
1102 If you wish to force everything to one memory model, say "none" here and
1103 put the appropriate flags later when it asks you for other cc and ld flags.
1104 Venix systems may wish to put "none" and let the compiler figure things out.
1105 (In the following question multiple model names should be space separated.)
1108 rp="Which models are supported? [$dflt]"
1125 if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \
1126 $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then
1134 rp="What flag indicates separate I and D space? [$dflt]"
1143 *large*|*small*|*medium*|*huge*)
1150 rp="What flag indicates large model? [$dflt]"
1166 rp="What flag indicates huge model? [$dflt]"
1182 rp="What flag indicates medium model? [$dflt]"
1190 *) medium="$large";;
1198 rp="What flag indicates small model? [$dflt]"
1210 echo "Unrecognized memory models--you may have to edit Makefile.SH"
1214 : see if we need a special compiler
1228 if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then
1242 On some systems the default C compiler will not resolve multiple global
1243 references that happen to have the same name. On some such systems the
1244 "Mcc" command may be used to force these to be resolved. On other systems
1245 a "cc -M" command is required. (Note that the -M flag on other systems
1246 indicates a memory model to use!) If you have the Gnu C compiler, you
1247 might wish to use that instead. What command will force resolution on
1249 $echo $n "this system? [$dflt] $c"
1250 rp="Command to resolve multiple refs? [$dflt]"
1258 rp="Use which C compiler? [$dflt]"
1264 gcc*) cpp=`./loc gcc-cpp $cpp $pth`
1265 case "$nativegcc" in
1266 '') case "$ccflags" in
1267 *-fpcc-struct-return*) dflt=n;;
1275 rp="Are your system (especially dbm) libraries compiled with gcc? [$dflt]"
1279 n*) nativegcc="$undef"; gccflags='-fpcc-struct-return';;
1280 *) nativegcc="$define"; gccflags='';;
1285 *) gccflags="$gccflags -traditional -Dvolatile=__volatile__" ;;
1290 : determine optimize, if desired, or use for debug flag also
1301 Some C compilers have problems with their optimizers, by default, $package
1302 compiles with the -O flag to use the optimizer. Alternately, you might
1303 want to use the symbolic debugger, which uses the -g flag (on traditional
1304 Unix systems). Either flag can be specified here. To use neither flag,
1305 specify the word "none".
1308 rp="What optimizer/debugger flag should be used? [$dflt]"
1313 'none') optimize=" "
1319 *gcc*) dflt="$gccflags";;
1323 *-fpcc-struct-return*) dflt="$ccflags";;
1325 *gcc*) dflt="$ccflags $gccflags";;
1326 *) dflt="$ccflags";;
1330 for thisincl in $inclwanted; do
1331 if test -d $thisincl; then
1332 if test "x$thisincl" != "x$usrinclude"; then
1335 *) dflt="$dflt -I$thisincl";;
1344 *) dflt="$dflt -DDEBUGGING";;
1348 if $contains 'LANGUAGE_C' $usrinclude/signal.h >/dev/null 2>&1; then
1351 *) dflt="$dflt -DLANGUAGE_C";;
1354 if $contains '_NO_PROTO' $usrinclude/signal.h >/dev/null 2>&1; then
1357 *) dflt="$dflt -D_NO_PROTO";;
1365 Your C compiler may want other flags. For this question you should
1366 include -I/whatever and -DWHATEVER flags and any other flags used by
1367 the C compiler, but you should NOT include libraries or ld flags like
1368 -lwhatever. To use no flags, specify the word "none".
1371 rp="Any additional cc flags? [$dflt]"
1379 : the following weeds options from ccflags that are of no interest to cpp
1382 *gcc*) cppflags="$cppflags -D__GNUC__";;
1390 -D*|-U*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
1394 *-*) echo "(C preprocessor flags: $cppflags)";;
1406 *) dflt="$ldflags";;
1409 rp="Any additional ld flags (NOT including libraries)? [$dflt]"
1418 echo "Checking for optional libraries..."
1423 case "$libswanted" in
1424 '') libswanted='c_s';;
1426 for thislib in $libswanted; do
1430 *) thatlib="${thislib}_s";;
1433 xxx=`./loc lib$thislib.a X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib`
1434 if test -f $xxx; then
1435 echo "Found -l$thislib."
1437 *"-l$thislib "*|*"-l$thatlib "*);;
1438 *) dflt="$dflt -l$thislib ";;
1441 xxx=`./loc lib$thislib.a X $libpth`
1442 if test -f $xxx; then
1446 *) dflt="$dflt $xxx ";;
1449 xxx=`./loc Slib$thislib.a X $xlibpth`
1450 if test -f $xxx; then
1451 echo "Found -l$thislib."
1453 *"-l$thislib "*|*"-l$thatlib "*);;
1454 *) dflt="$dflt -l$thislib ";;
1457 xxx=`./loc lib$thislib.so X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib`
1458 if test -f $xxx; then
1459 echo "Found -l$thislib as a shared object only."
1461 *"-l$thislib "*|*"-l$thatlib "*);;
1462 *) dflt="$dflt -l$thislib ";;
1465 echo "No -l$thislib."
1480 Some versions of Unix support shared libraries, which make
1481 executables smaller but make load time slightly longer.
1483 On some systems, mostly newer Unix System V's, the shared library
1484 is included by putting the option "-lc_s" as the last thing on the
1485 cc command line when linking. Other systems use shared libraries
1486 by default. There may be other libraries needed to compile $package
1487 on your machine as well. If your system needs the "-lc_s" option,
1488 include it here. Include any other special libraries here as well.
1489 Say "none" for none.
1493 rp="Any additional libraries? [$dflt]"
1501 : check for size of random number generator
1503 case "$alignbytes" in
1505 echo "Checking alignment constraints..."
1506 $cat >try.c <<'EOCP'
1513 printf("%d\n", (char*)&try.bar - (char*)&try.foo);
1516 if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
1520 echo "(I can't seem to compile the test program...)"
1527 rp="Doubles must be aligned on a how-many-byte boundary? [$dflt]"
1533 : determine where public executables go
1536 The following questions distinguish the directory in which executables
1537 reside from the directory in which they are installed (and from which they
1538 are presumably copied to the former directory by occult means). This
1539 distinction is often necessary under afs. On most other systems, however,
1540 the two directories are the same.
1545 dflt=`./loc . /usr/local/bin /usr/local/bin /usr/lbin /usr/local /usr/bin /bin`
1551 while $test "$cont" ; do
1552 rp="In which directory will public executables reside (~name ok)? [$dflt]"
1553 $echo "In which directory will public executables reside (~name ok)?"
1554 $echo $n "[$dflt] $c"
1558 if test -d $bin; then
1565 rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]"
1575 case "$installbin" in
1577 dflt=`echo $bin | sed 's#^/afs/#/afs/.#'`
1578 test -d $dflt || dflt="$bin"
1580 *) dflt="$installbin"
1584 while $test "$cont" ; do
1585 rp="In which directory will public executables be installed (~name ok)? [$dflt]"
1586 $echo "In which directory will public executables be installed (~name ok)?"
1587 $echo $n "[$dflt] $c"
1590 installbin=`./filexp $installbin`
1591 if test -d $installbin; then
1598 rp="Directory $installbin doesn't exist. Use that name anyway? [$dflt]"
1608 : check for ordering of bytes in a long
1609 case "$byteorder" in
1613 In the following, larger digits indicate more significance. A big-endian
1614 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
1615 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
1616 machines may have weird orders like 3412. A Cray will report 87654321. If
1617 the test program works the default is probably right.
1618 I'm now running the test program...
1620 $cat >byteorder.c <<'EOCP'
1627 char c[sizeof(long)];
1630 if (sizeof(long) > 4)
1631 u.l = (0x08070605 << 32) | 0x04030201;
1634 for (i=0; i < sizeof(long); i++)
1635 printf("%c",u.c[i]+'0');
1639 if $cc byteorder.c -o byteorder >/dev/null 2>&1 ; then
1642 ????|????????) echo "(The test program ran ok.)";;
1643 *) echo "(The test program didn't run right for some reason.)";;
1647 echo "(I can't seem to compile the test program. Guessing big-endian...)"
1655 rp="What is the order of bytes in a long? [$dflt]"
1660 : check for ability to cast negative floats to unsigned
1662 echo 'Checking to see if your C compiler can cast weird floats to unsigned'
1663 $cat >try.c <<'EOCP'
1666 blech() { exit(3); }
1671 unsigned long along;
1673 unsigned short ashort;
1676 signal(SIGFPE, blech);
1677 along = (unsigned long)f;
1678 aint = (unsigned int)f;
1679 ashort = (unsigned short)f;
1680 if (along != (unsigned long)-123)
1682 if (aint != (unsigned int)-123)
1684 if (ashort != (unsigned short)-123)
1686 f = (double)0x40000000;
1689 along = (unsigned long)f;
1690 if (along != 0x80000000)
1694 along = (unsigned long)f;
1695 if (along != 0x7fffffff)
1699 along = (unsigned long)f;
1700 if (along != 0x80000001)
1705 if $cc -o try $ccflags try.c >/dev/null 2>&1; then
1711 case "$castflags" in
1713 echo "Yup, it does."
1716 echo "Nope, it doesn't."
1723 : see how we invoke the C preprocessor
1725 echo "Now, how can we feed standard input to your C preprocessor..."
1726 cat <<'EOT' >testcpp.c
1733 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
1738 /*cppstdin) cppstdin=cppstdin;;
1743 if test "X$cppstdin" != "X" && \
1744 $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
1745 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1746 echo "You used to use $cppstdin $cppminus so we'll use that again."
1747 elif test "$cc" = gcc && \
1748 (echo "Using gcc, eh? We'll try to force gcc -E using a wrapper..."; \
1749 $wrapper <testcpp.c >testcpp.out 2>&1; \
1750 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then
1754 elif echo 'Maybe "'"$cc"' -E" will work...'; \
1755 $cc -E <testcpp.c >testcpp.out 2>&1; \
1756 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1757 echo "Yup, it does."
1760 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
1761 $cc -E - <testcpp.c >testcpp.out 2>&1; \
1762 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1763 echo "Yup, it does."
1766 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
1767 $cpp <testcpp.c >testcpp.out 2>&1; \
1768 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1772 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
1773 $cpp - <testcpp.c >testcpp.out 2>&1; \
1774 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1775 echo "Hooray, it works! I was beginning to wonder."
1778 elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
1779 $wrapper <testcpp.c >testcpp.out 2>&1; \
1780 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1784 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
1785 $cc -P <testcpp.c >testcpp.out 2>&1; \
1786 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1787 echo "Yipee, that works!"
1790 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
1791 $cc -P - <testcpp.c >testcpp.out 2>&1; \
1792 $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1793 echo "At long last!"
1798 $echo $n "No dice. I can't find a C preprocessor. Name one: $c"
1799 rp='Name a C preprocessor:'
1802 $cppstdin <testcpp.c >testcpp.out 2>&1
1803 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
1804 echo "OK, that will do."
1806 echo "Sorry, I can't get that to work. Go find one and rerun Configure."
1811 : get list of predefined functions in a handy place
1817 '') if test -f /mach_boot; then
1819 elif test -d /usr/ccs/lib; then
1826 : on mips, we DO NOT want /lib, and we want inclPath/usr/lib
1829 libpth='$inclPath/usr/lib /usr/local/lib'
1832 libpth='/usr/ccs/lib /lib /usr/lib /usr/ucblib /usr/local/lib'
1837 *-lc_s*) libc=`./loc libc_s.a $libc $libpth`
1842 *) for thislib in $libs; do
1844 -l*) thislib=`expr X$thislib : 'X-l\(.*\)'`
1845 try=`./loc lib$thislib.a blurfl/dyick $libpth`
1846 if test ! -f $try; then
1847 try=`./loc lib$thislib blurfl/dyick $libpth`
1848 if test ! -f $try; then
1849 try=`./loc $thislib blurfl/dyick $libpth`
1850 if test ! -f $try; then
1851 try=`./loc Slib$thislib.a blurfl/dyick $xlibpth`
1852 if test ! -f $try; then
1858 libnames="$libnames $try"
1860 *) libnames="$libnames $thislib" ;;
1865 set /usr/ccs/lib/libc.so
1866 test -f $1 || set /usr/lib/libc.so
1867 test -f $1 || set /usr/lib/libc.so.[0-9]*
1868 test -f $1 || set /lib/libsys_s.a
1870 if test -f "$1"; then
1871 echo "Your (shared) C library seems to be in $1."
1873 elif test -f "$libc"; then
1874 echo "Your C library seems to be in $libc."
1875 elif test -f /lib/libc.a; then
1876 echo "Your C library seems to be in /lib/libc.a. You're normal."
1879 if ans=`./loc libc.a blurfl/dyick $libpth`; test -f "$ans"; then
1881 elif ans=`./loc libc blurfl/dyick $libpth`; test -f "$ans"; then
1882 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
1883 elif ans=`./loc clib blurfl/dyick $libpth`; test -f "$ans"; then
1885 elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1887 elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1889 elif ans=`./loc Llibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then
1892 if test -f "$ans"; then
1893 echo "Your C library seems to be in $ans, of all places."
1898 I can't seem to find your C library. I've looked in the following places:
1902 None of these seems to contain your C library. What is the full name
1905 $echo $n "of your C library? $c"
1906 rp='C library full name?'
1912 if test $libc = "/lib/libc"; then
1913 libc="$libc /lib/clib"
1917 If the guess above is wrong (which it might be if you're using a strange
1918 compiler, or your machine supports multiple models), you can override it here.
1921 rp="Your C library is where? [$dflt]"
1926 echo $libc $libnames | tr ' ' '\012' | sort | uniq >libnames
1927 $echo "Extracting names from the following files for later perusal:"
1928 sed 's/^/ /' libnames
1929 echo $n "This may take a while...$c"
1930 set X `cat libnames`
1932 nm $nm_opts $* 2>/dev/null >libc.tmp
1933 $sed -n -e 's/^.* [ATDS] *[_.]*//p' -e 's/^.* [ATDS] //p' <libc.tmp >libc.list
1934 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1936 elif $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' \
1937 <libc.tmp >libc.list; \
1938 $contains '^printf$' libc.list >/dev/null 2>&1; then
1940 elif $sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' <libc.tmp >libc.list; \
1941 $contains '^printf$' libc.list >/dev/null 2>&1; then
1943 elif $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list; \
1944 $contains '^printf$' libc.list >/dev/null 2>&1; then
1946 elif $sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' \
1947 <libc.tmp >libc.list; \
1948 $contains '^printf$' libc.list >/dev/null 2>&1; then
1950 elif $grep '|' <libc.tmp | $sed -n -e '/|COMMON/d' -e '/|DATA/d' -e '/ file/d' \
1951 -e 's/^\([^ ]*\).*/\1/p' >libc.list
1952 $contains '^printf$' libc.list >/dev/null 2>&1; then
1954 elif $sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p' \
1955 <libc.tmp >libc.list; \
1956 $contains '^printf$' libc.list >/dev/null 2>&1; then
1959 nm -p $* 2>/dev/null >libc.tmp
1960 $sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list
1961 if $contains '^printf$' libc.list >/dev/null 2>&1; then
1966 echo "nm didn't seem to work right."
1967 echo "Trying ar instead..."
1968 if ar t $libc > libc.tmp; then
1969 for thisname in $libnames; do
1970 ar t $thisname >>libc.tmp
1972 $sed -e 's/\.o$//' < libc.tmp > libc.list
1975 echo "ar didn't seem to work right."
1976 echo "Maybe this is a Cray...trying bld instead..."
1977 if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
1978 for thisname in $libnames; do
1980 $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
1981 ar t $thisname >>libc.tmp
1985 echo "That didn't work either. Giving up."
1991 if test -f /lib/syscalls.exp; then
1992 echo "Also extracting names from /lib/syscalls.exp for good ole AIX..."
1993 sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
1996 inlibc='echo " "; td=$define; tu=$undef;
1997 if $contains "^$1\$" libc.list >/dev/null 2>&1;
1998 then echo "$1() found";
1999 eval "case \"\$$2\" in undef) . whoa; esac"; eval "$2=\$td";
2000 else echo "$1() not found";
2001 eval "case \"\$$2\" in define) . whoa; esac"; eval "$2=\$tu"; fi'
2003 : see if bcmp exists
2007 : see if bcopy exists
2011 : see if bzero exists
2015 : see if sprintf is declared as int or pointer to char
2017 cat >ucbsprf.c <<'EOF'
2023 exit((unsigned long)sprintf(buf,"%s","foo") > 10L);
2026 if $cc $ccflags ucbsprf.c -o ucbsprf >/dev/null 2>&1 && ./ucbsprf; then
2027 echo "Your sprintf() returns (int)."
2030 echo "Your sprintf() returns (char*)."
2036 : see if vprintf exists
2038 if $contains '^vprintf$' libc.list >/dev/null 2>&1; then
2039 echo 'vprintf() found.'
2041 cat >vprintf.c <<'EOF'
2042 #include <varargs.h>
2044 main() { xxx("foo"); }
2053 exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
2056 if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then
2057 echo "Your vsprintf() returns (int)."
2060 echo "Your vsprintf() returns (char*)."
2064 echo 'vprintf() not found.'
2074 : see if chsize exists
2078 : see if crypt exists
2080 if $contains '^crypt$' libc.list >/dev/null 2>&1; then
2081 echo 'crypt() found.'
2085 cryptlib=`./loc Slibcrypt.a "" $xlibpth`
2086 if $test -z "$cryptlib"; then
2087 cryptlib=`./loc Mlibcrypt.a "" $xlibpth`
2091 if $test -z "$cryptlib"; then
2092 cryptlib=`./loc Llibcrypt.a "" $xlibpth`
2096 if $test -z "$cryptlib"; then
2097 cryptlib=`./loc libcrypt.a "" $libpth`
2101 if $test -z "$cryptlib"; then
2102 echo 'crypt() not found.'
2111 : get csh whereabouts
2113 'csh') val="$undef" ;;
2119 : see if readdir exists
2120 set readdir d_readdir
2123 : see if there are directory access routines out there
2125 xxx=`./loc ndir.h x $usrinclude /usr/local/include $inclwanted`
2128 xxx=`./loc sys/ndir.h x $usrinclude /usr/local/include $inclwanted`
2131 D_dirnamlen="$undef"
2140 if $test -r $usrinclude/dirent.h; then
2141 echo "dirent.h found."
2142 if $contains 'd_namlen' $usrinclude/dirent.h >/dev/null 2>&1; then
2143 D_dirnamlen="$define"
2146 elif $test -r $xxx; then
2147 echo "You seem to use <$xxx>,"
2148 if $test "$d_readdir" = "$define"; then
2149 echo "and I can get readdir() from your C library."
2150 elif $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a; then
2151 echo "and I'll get the routines using -lndir ."
2154 ans=`./loc libndir.a x $libpth`
2157 echo "but I can't find the ndir library!"
2160 echo "and I found the directory library in $ans."
2165 if $contains 'd_namlen' $xxx >/dev/null 2>&1; then
2166 D_dirnamlen="$define"
2170 I_sys_ndir="$define"
2177 : The next line used to require this to be a bsd system.
2178 if $contains '^readdir$' libc.list >/dev/null 2>&1 ; then
2179 echo "No ndir library found, but you have readdir() so we'll use that."
2180 if $contains 'd_namlen' $usrinclude/sys/dir.h >/dev/null 2>&1; then
2181 D_dirnamlen="$define"
2185 echo "No ndir library found--using ./$d_ndir.c."
2186 : This will lose since $d_ndir.h is in another directory.
2187 : I doubt we can rely on it being in ../$d_ndir.h .
2188 : At least it will fail in a conservative manner.
2189 if $contains 'd_namlen' $d_ndir.h >/dev/null 2>&1; then
2190 D_dirnamlen="$define"
2197 val=$D_dirnamlen; set d_dirnamlen; eval $setvar
2198 val=$I_dirent; set i_dirent; eval $setvar
2199 val=$I_sys_dir; set i_sys_dir; eval $setvar
2200 val=$I_my_dir; set i_my_dir; eval $setvar
2201 val=$I_ndir; set i_ndir; eval $setvar
2202 val=$I_sys_ndir; set i_sys_ndir; eval $setvar
2204 : now see if they want to do setuid emulation
2212 Some sites have disabled setuid #! scripts because of a bug in the kernel
2213 that prevents them from being secure. If you are on such a system, the
2214 setuid/setgid bits on scripts are currently useless. It is possible for
2215 $package to detect those bits and emulate setuid/setgid in a secure fashion
2216 until a better solution is devised for the kernel problem.
2219 rp="Do you want to do setuid/setgid emulation? [$dflt]"
2226 y*) d_dosuid="$define";;
2227 *) d_dosuid="$undef";;
2230 : see if dup2 exists
2234 : see if fchmod exists
2238 : see if fchown exists
2242 : see if this is an fcntl system
2246 : see if we can have long filenames
2248 rm -f 123456789abcde
2249 if (echo hi >123456789abcdef) 2>/dev/null; then
2251 if test -f 123456789abcde; then
2252 echo 'You cannot have filenames longer than 14 characters. Sigh.'
2255 echo 'You can have filenames longer than 14 characters.'
2259 : version 8 probably
2260 echo "You can't have filenames longer than 14 chars. You can't even think about them!"
2266 : see if flock exists
2270 : see if getgroups exists
2271 set getgroups d_getgrps
2274 : see if gethostent exists
2275 set gethostent d_gethent
2278 : see if getpgrp exists
2279 set getpgrp d_getpgrp
2282 : see if getpgrp2 exists
2283 set getpgrp2 d_getpgrp2
2286 : see if getpriority exists
2287 set getpriority d_getprior
2290 : see if htonl exists
2298 *) if $test -f /unix; then
2305 if $contains '^index$' libc.list >/dev/null 2>&1 ; then
2306 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2307 echo "Your system has both index() and strchr(). Shall I use"
2308 rp="index() rather than strchr()? [$dflt]"
2312 n*) d_index="$define" ;;
2313 *) d_index="$undef" ;;
2317 echo "index() found."
2320 if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
2322 echo "strchr() found."
2324 echo "No index() or strchr() found!"
2329 : see if killpg exists
2333 : see if lstat exists
2337 : see if memcmp exists
2341 : see if memcpy exists
2345 : see if mkdir exists
2349 : see if msgctl exists
2353 : see if msgget exists
2357 : see if msgsnd exists
2361 : see if msgrcv exists
2365 : see how much of the 'msg*(2)' library is present.
2368 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
2369 *undef*) h_msg=false;;
2371 : we could also check for sys/ipc.h ...
2372 if $h_msg && $test -r $usrinclude/sys/msg.h; then
2373 echo "You have the full msg*(2) library."
2376 echo "You don't have the full msg*(2) library."
2382 : determine which malloc to compile in
2384 case "$d_mymalloc" in
2386 case "$usemymalloc" in
2403 rp="Do you wish to attempt to use the malloc that comes with $package? [$dflt]"
2410 y*) mallocsrc='malloc.c'; mallocobj='malloc.o'
2411 libs=`echo $libs | sed 's/-lmalloc//'`
2413 case "$mallocptrtype" in
2415 cat >usemymalloc.c <<'END'
2423 if $cc $ccflags -c usemymalloc.c >/dev/null 2>&1; then
2431 echo "Your system wants malloc to return $mallocptrtype*, it would seem."
2442 : see if ndbm is available
2444 xxx=`./loc ndbm.h x $usrinclude /usr/local/include $inclwanted`
2445 if test -f $xxx; then
2447 echo "ndbm.h found."
2450 echo "ndbm.h not found."
2455 : see if we have the old dbm
2457 xxx=`./loc dbm.h x $usrinclude /usr/local/include $inclwanted`
2458 if test -f $xxx; then
2463 echo "dbm.h not found."
2468 : see whether socket exists
2471 if $contains socket libc.list >/dev/null 2>&1; then
2472 echo "Looks like you have Berkeley networking support."
2474 : now check for advanced features
2475 if $contains setsockopt libc.list >/dev/null 2>&1; then
2478 echo "...but it uses the old 4.1c interface, rather than 4.2"
2482 : hpux, for one, puts all the socket stuff in socklib.o
2483 if $contains socklib libc.list >/dev/null 2>&1; then
2484 echo "Looks like you have Berkeley networking support."
2486 : we will have to assume that it supports the 4.2 BSD interface
2489 echo "Hmmm...you don't have Berkeley networking in libc.a..."
2490 : look for an optional networking library
2491 if test -f /usr/lib/libnet.a; then
2492 (ar t /usr/lib/libnet.a ||
2493 nm -g /usr/lib/libnet.a) 2>/dev/null >> libc.list
2494 if $contains socket libc.list >/dev/null 2>&1; then
2495 echo "but the Wollongong group seems to have hacked it in."
2496 socketlib="-lnet -lnsl_s"
2498 : now check for advanced features
2499 if $contains setsockopt libc.list >/dev/null 2>&1; then
2502 echo "...using the old 4.1c interface, rather than 4.2"
2506 echo "or even in libnet.a, which is peculiar."
2511 echo "or anywhere else I see."
2520 if $contains socketpair libc.list >/dev/null 2>&1; then
2531 : Locate the flags for 'open()'
2533 $cat >open3.c <<'EOCP'
2534 #include <sys/types.h>
2539 #include <sys/file.h>
2552 : check sys/file.h first to get FREAD on Sun
2553 if $test -r $usrinclude/sys/file.h && \
2554 $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
2556 echo "sys/file.h defines the O_* constants..."
2558 echo "and you have the 3 argument form of open()."
2561 echo "but not the 3 argument form of open(). Oh, well."
2564 elif $test -r $usrinclude/fcntl.h && \
2565 $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
2567 echo "fcntl.h defines the O_* constants..."
2569 echo "and you have the 3 argument form of open()."
2572 echo "but not the 3 argument form of open(). Oh, well."
2577 echo "I can't find the O_* constant definitions! You got problems."
2582 : see if how pwd stuff is defined
2584 if $test -r $usrinclude/pwd.h ; then
2587 $cppstdin $cppflags $cppminus <$usrinclude/pwd.h | \
2588 sed -n '/struct[ ][ ]*passwd/,/^};/p' >pwd.txt
2589 if $contains 'pw_quota' pwd.txt >/dev/null 2>&1; then
2594 if $contains 'pw_age' pwd.txt >/dev/null 2>&1; then
2599 if $contains 'pw_change' pwd.txt >/dev/null 2>&1; then
2600 d_pwchange="$define"
2604 if $contains 'pw_class' pwd.txt >/dev/null 2>&1; then
2609 if $contains 'pw_expire' pwd.txt >/dev/null 2>&1; then
2610 d_pwexpire="$define"
2614 if $contains 'pw_comment' pwd.txt >/dev/null 2>&1; then
2615 d_pwcomment="$define"
2617 d_pwcomment="$undef"
2626 d_pwcomment="$undef"
2627 echo "No pwd.h found."
2630 : see if rename exists
2634 : see if rmdir exists
2638 : see if select exists
2642 : see if semctl exists
2646 : see if semget exists
2650 : see if semop exists
2654 : see how much of the 'sem*(2)' library is present.
2657 case "$d_semctl$d_semget$d_semop" in
2658 *undef*) h_sem=false;;
2660 : we could also check for sys/ipc.h ...
2661 if $h_sem && $test -r $usrinclude/sys/sem.h; then
2662 echo "You have the full sem*(2) library."
2665 echo "You don't have the full sem*(2) library."
2671 : see if setegid exists
2672 set setegid d_setegid
2675 : see if seteuid exists
2676 set seteuid d_seteuid
2679 : see if setpgrp exists
2680 set setpgrp d_setpgrp
2683 : see if setpgrp2 exists
2684 set setpgrp2 d_setpgrp2
2687 : see if setpriority exists
2688 set setpriority d_setprior
2691 : see if setregid exists
2692 set setregid d_setregid
2694 set setresgid d_setresgid
2697 : see if setreuid exists
2698 set setreuid d_setreuid
2700 set setresuid d_setresuid
2703 : see if setrgid exists
2704 set setrgid d_setrgid
2707 : see if setruid exists
2708 set setruid d_setruid
2711 : see if shmctl exists
2715 : see if shmget exists
2719 : see if shmat exists
2723 d_voidshmat="$undef"
2726 $cppstdin $cppflags $cppminus < $usrinclude/sys/shm.h >voidshmat.txt 2>/dev/null
2727 if $contains "void.*shmat" voidshmat.txt >/dev/null 2>&1; then
2728 echo "and shmat returns (void*)"
2729 d_voidshmat="$define"
2731 echo "and shmat returns (char*)"
2736 : see if shmdt exists
2740 : see how much of the 'shm*(2)' library is present.
2743 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
2744 *undef*) h_shm=false;;
2746 : we could also check for sys/ipc.h ...
2747 if $h_shm && $test -r $usrinclude/sys/shm.h; then
2748 echo "You have the full shm*(2) library."
2751 echo "You don't have the full shm*(2) library."
2757 : see if stat knows about block sizes
2759 if $contains 'st_blocks;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
2760 if $contains 'st_blksize;' $usrinclude/sys/stat.h >/dev/null 2>&1 ; then
2761 echo "Your stat knows about block sizes."
2764 echo "Your stat doesn't know about block sizes."
2768 echo "Your stat doesn't know about block sizes."
2774 : see if stdio is really std
2776 if $contains 'char.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2777 if $contains '_cnt;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
2778 echo "Your stdio is pretty std."
2781 echo "Your stdio isn't very std."
2785 echo "Your stdio isn't very std."
2791 : check for structure copying
2793 echo "Checking to see if your C compiler can copy structs..."
2794 $cat >strctcpy.c <<'EOCP'
2804 if $cc -c strctcpy.c >/dev/null 2>&1 ; then
2809 echo "Nope, it can't."
2814 : see if strerror exists
2815 set strerror d_strerror
2818 : see if symlink exists
2819 set symlink d_symlink
2822 : see if syscall exists
2823 set syscall d_syscall
2826 : set if package uses struct tm
2829 : set if package uses struct timeval
2831 define) w_s_timevl=1 ;;
2834 : set if package uses localtime function
2837 : see which of time.h, sys/time.h, and sys/select should be included.
2841 Testing to see which of <time.h>, <sys/time.h>, and <sys/select.h>
2842 should be included, because this application wants:
2845 case "$w_s_itimer" in
2847 echo " struct itimerval"
2848 idefs="-DS_ITIMERVAL $idefs"
2851 case "$w_s_timevl" in
2853 echo " struct timeval"
2854 idefs="-DS_TIMEVAL $idefs"
2860 idefs="-DS_TM $idefs"
2863 case "$w_localtim" in
2865 echo " ctime(3) declarations"
2866 idefs="-DD_CTIME $idefs"
2871 echo " (something I don't know about)"
2875 echo "I'm now running the test program..."
2876 $cat >i_time.c <<'EOCP'
2877 #include <sys/types.h>
2882 #ifdef SYSTIMEKERNEL
2885 #include <sys/time.h>
2888 #include <sys/select.h>
2898 struct itimerval baz;
2901 if (foo.tm_sec == foo.tm_sec)
2904 if (bar.tv_sec == bar.tv_sec)
2908 if (baz.it_interval == baz.it_interval)
2912 if (bar.tv_sec == bar.tv_sec)
2916 /* this might not do anything for us... */
2917 tmp = localtime((time_t *)0);
2923 for i_sys_select in '' '-DI_SYS_SELECT'; do
2924 for d_systimekernel in '' '-DSYSTIMEKERNEL'; do
2925 for i_time in '' '-DI_TIME'; do
2926 for i_systime in '-DI_SYS_TIME' ''; do
2928 '') echo Trying $i_time $i_systime $d_systimekernel $i_sys_select
2929 if $cc $ccflags $idefs \
2930 $i_time $i_systime $d_systimekernel $i_sys_select \
2931 i_time.c -o i_time >/dev/null 2>&1 ; then
2932 set X $i_time $i_systime $d_systimekernel $i_sys_select
2935 echo Succeeded with $flags
2944 *SYSTIMEKERNEL*) val="$define";;
2950 *I_TIME*) val="$define";;
2956 *I_SYS_SELECT*) val="$define";;
2962 *I_SYS_TIME*) val="$define";;
2967 case "$flags$i_sys_time$i_time" in
2968 undefundef) i_sys_time="$define"; i_time="$define";
2969 echo "ICK, NOTHING WORKED!!! You may have to diddle the includes.";;
2972 : see if signal is declared as pointer to function returning int or void
2974 $cppstdin $cppflags $cppminus < $usrinclude/signal.h >d_voidsig.txt
2975 if $contains 'int[^A-Za-z]*signal' d_voidsig.txt >/dev/null 2>&1 ; then
2976 echo "You have int (*signal())() instead of void."
2979 echo "You have void (*signal())() instead of int."
2985 define) d_tosignal=void;;
2989 : see if truncate exists
2990 set truncate d_truncate
2993 : see if there is a vfork
2997 : check for volatile keyword
2999 echo 'Checking to see if your C compiler knows about "volatile"...'
3000 $cat >try.c <<'EOCP'
3003 typedef unsigned short foo_t;
3006 volatile foo_t blech;
3010 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
3012 echo "Yup, it does."
3015 echo "Nope, it doesn't."
3021 : see if there is a wait4
3025 : see if there is a waitpid
3026 set waitpid d_waitpid
3029 : see what type gids are declared as in the kernel
3032 if $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
3035 set `grep '_rgid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
3037 unsigned) dflt="$1 $2" ;;
3047 rp="What type are groups ids returned by getgid(), etc.? [$dflt]"
3052 : see what type gids are returned by getgroups
3054 case "$groupstype" in
3056 if $contains 'getgroups.*short' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
3058 elif $contains 'getgroups.*int' /usr/lib/lint/llib-lc >/dev/null 2>&1; then
3060 elif $contains 'getgroups.*short' /usr/include/libc.h >/dev/null 2>&1; then
3062 elif $contains 'getgroups.*int' /usr/include/libc.h >/dev/null 2>&1; then
3064 elif $contains 'getgroups.*short' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
3066 elif $contains 'getgroups.*int' /usr/lib/lint/llib-lbsd >/dev/null 2>&1; then
3068 elif $contains 'int.*gidset' /usr/man/man2/getgroups.2 >/dev/null 2>&1; then
3070 elif $contains 'gid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
3073 set `grep 'groups\[NGROUPS\];' $usrinclude/sys/user.h 2>/dev/null` unsigned short
3075 unsigned) dflt="$1 $2" ;;
3080 *) dflt="$groupstype"
3084 echo "(The following only matters if you have getgroups().)"
3085 rp="What type are the group ids returned by getgroups()? [$dflt]"
3090 : check for length of integer
3094 echo "Checking to see how big your integers are..."
3095 $cat >intsize.c <<'EOCP'
3099 printf("%d\n", sizeof(int));
3102 if $cc intsize.c -o intsize >/dev/null 2>&1 ; then
3106 echo "(I can't seem to compile the test program. Guessing...)"
3113 rp="What is the size of an integer (in bytes)? [$dflt]"
3118 : determine where private executables go
3121 dflt=/usr/lib/$package
3122 test -d /usr/local/lib && dflt=/usr/local/lib/$package
3129 The $package package has some auxiliary files that should be reside in a library
3130 that is accessible by everyone. Where should these "private" but accessible
3132 $echo $n "files reside? (~name ok) [$dflt] $c"
3133 rp="Private files will reside where? [$dflt]"
3135 privlib=`./filexp "$ans"`
3137 case "$installprivlib" in
3139 dflt=`echo $privlib | sed 's#^/afs/#/afs/.#'`
3140 test -d $dflt || dflt="$privlib"
3142 *) dflt="$installprivlib"
3147 On some systems (such as afs) you have to install the library files in a
3148 different directory to get them to go to the right place. Where should the
3150 $echo $n "library files be installed? (~name ok) [$dflt] $c"
3151 rp="Install private files where? [$dflt]"
3153 installprivlib=`./filexp "$ans"`
3155 : check for size of random number generator
3159 echo "Checking to see how many bits your rand function produces..."
3160 $cat >randbits.c <<'EOCP'
3165 register unsigned long tmp;
3166 register unsigned long max = 0L;
3168 for (i=1000; i; i--) {
3169 tmp = (unsigned long)rand();
3170 if (tmp > max) max = tmp;
3177 if $cc randbits.c -o randbits >/dev/null 2>&1 ; then
3181 echo "(I can't seem to compile the test program...)"
3188 rp="How many bits does your rand() function produce? [$dflt]"
3193 : determine where publicly executable scripts go
3194 case "$scriptdir" in
3197 : guess some guesses
3198 test -d /usr/share/scripts && dflt=/usr/share/scripts
3199 test -d /usr/share/bin && dflt=/usr/share/bin
3201 *) dflt="$scriptdir"
3207 Some installations have a separate directory just for executable scripts so
3208 that they can mount it across multiple architectures but keep the scripts in
3209 one spot. You might, for example, have a subdirectory of /usr/share for this.
3210 Or you might just lump your scripts in with all your other executables.
3213 while $test "$cont" ; do
3214 rp="Where will publicly executable scripts reside (~name ok)? [$dflt]"
3218 scriptdir=`./filexp "$scriptdir"`
3219 if test -d $scriptdir; then
3226 rp="Directory $scriptdir doesn't exist. Use that name anyway? [$dflt]"
3236 case "$installscr" in
3238 dflt=`echo $scriptdir | sed 's#^/afs/#/afs/.#'`
3239 test -d $dflt || dflt="$scriptdir"
3241 *) dflt="$scriptdir"
3247 Some installations must install scripts in a different directory than where
3248 they will eventually reside. On most systems they're the same directory.
3250 while $test "$cont" ; do
3251 rp="Where do you install publicly executable scripts (~name ok)? [$dflt]"
3255 installscr=`./filexp "$installscr"`
3256 if test -d $installscr; then
3263 rp="Directory $installscr doesn't exist. Use that name anyway? [$dflt]"
3273 : generate list of signal names
3277 echo "Generating a list of signal names..."
3278 set X `cat $usrinclude/signal.h $usrinclude/sys/signal.h 2>&1 | awk '
3279 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $3 ~ /^[1-9][0-9]*$/ {
3280 sig[$3] = substr($2,4,20)
3281 if (max < $3 && $3 < 60) {
3287 for (i=1; i<=max; i++) {
3300 0) echo 'kill -l' >/tmp/foo$$
3301 set X `$csh -f </tmp/foo$$`
3304 0)set HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM
3312 echo "Signals are: $sig_name"
3314 : see what type of char stdio uses.
3316 if $contains 'unsigned.*char.*\*.*_ptr.*;' $usrinclude/stdio.h >/dev/null 2>&1 ; then
3317 echo "Your stdio uses unsigned chars."
3318 stdchar="unsigned char"
3320 echo "Your stdio uses signed chars."
3324 : see what type uids are declared as in the kernel
3327 if $contains 'uid_t;' $usrinclude/sys/types.h >/dev/null 2>&1 ; then
3330 set `grep '_ruid;' $usrinclude/sys/user.h 2>/dev/null` unsigned short
3332 unsigned) dflt="$1 $2" ;;
3342 rp="What type are user ids returned by getuid(), etc.? [$dflt]"
3347 : check for void type
3350 Checking to see how well your C compiler groks the void type...
3352 Support flag bits are:
3353 1: basic void declarations.
3354 2: arrays of pointers to functions returning void.
3355 4: operations between pointers to and addresses of void functions.
3360 $cat >void.c <<'EOCP'
3366 extern void moo(); /* function returning void */
3367 void (*goo)(); /* ptr to func returning void */
3380 if $cc -c -DTRY=$voidwant void.c >void.out 2>&1 ; then
3382 echo "It appears to support void to the level $package wants ($voidwant)."
3383 if $contains warning void.out >/dev/null 2>&1; then
3384 echo "However, you might get some warnings that look like this:"
3388 echo "Hmm, your compiler has some difficulty with void. Checking further..."
3389 if $cc -c -DTRY=1 void.c >/dev/null 2>&1 ; then
3390 echo "It supports 1..."
3391 if $cc -c -DTRY=3 void.c >/dev/null 2>&1 ; then
3393 echo "And it supports 2 but not 4."
3395 echo "It doesn't support 2..."
3396 if $cc -c -DTRY=5 void.c >/dev/null 2>&1 ; then
3398 echo "But it supports 4."
3401 echo "And it doesn't support 4."
3405 echo "There is no support at all for void."
3411 rp="Your void support flags add up to what? [$dflt]"
3416 : preserve RCS keywords in files with variable substitution, grrr
3424 Revision='$Revision'
3429 : determine compiler compiler
3434 dflt='yacc -Sm25000'
3441 rp="Which compiler compiler (yacc or bison -y) will you use? [$dflt]"
3449 : see if we can include fcntl.h
3453 echo "We'll be including <fcntl.h>."
3456 if $h_sys_file; then
3457 echo "We don't need to <fcntl.h> if we include <sys/file.h>."
3459 echo "We won't be including <fcntl.h>."
3465 : see if gdbm is available
3467 xxx=`./loc gdbm.h x $usrinclude /usr/local/include $inclwanted`
3468 if test -f $xxx; then
3470 echo "gdbm.h found."
3473 echo "gdbm.h not found."
3478 : see if this is an grp system
3480 if $test -r $usrinclude/grp.h ; then
3485 echo "No grp.h found."
3490 : see if this is a netinet/in.h or sys/in.h system
3492 xxx=`./loc netinet/in.h x $usrinclude /usr/local/include $inclwanted`
3493 if test -f $xxx; then
3496 echo "netinet/in.h found."
3499 echo "No netinet/in.h found, ..."
3500 xxx=`./loc sys/in.h x $usrinclude /usr/local/include $inclwanted`
3501 if test -f $xxx; then
3503 echo "but I found sys/in.h instead."
3506 echo "and I didn't find sys/in.h either."
3515 : Do we need to #include <sys/file.h> ?
3517 if $h_sys_file; then
3519 echo "We'll be including <sys/file.h>."
3522 echo "We won't be including <sys/file.h>."
3527 : see if ioctl defs are in sgtty/termio or sys/ioctl
3529 if $test -r $usrinclude/sys/ioctl.h ; then
3531 echo "sys/ioctl.h found."
3534 echo "sys/ioctl.h not found, assuming ioctl args are defined in sgtty.h."
3539 : see if we should include utime.h
3541 if $test -r $usrinclude/utime.h ; then
3543 echo "utime.h found."
3546 echo "No utime.h found, but that's ok."
3551 : see if this is a varargs system
3553 if $test -r $usrinclude/varargs.h ; then
3555 echo "varargs.h found."
3558 echo "No varargs.h found, but that's ok (I hope)."
3563 : see if this is a vfork system
3565 if $test -r $usrinclude/vfork.h ; then
3567 echo "vfork.h found."
3570 echo "No vfork.h found."
3575 : end of configuration questions
3577 echo "End of configuration questions."
3580 : create config.sh file
3582 if test -d ../UU; then
3585 echo "Creating config.sh..."
3586 test -f config.sh && cp config.sh UU/oldconfig.sh
3587 $spitshell <<EOT >config.sh
3590 # This file was produced by running the Configure script.
3591 d_eunice='$d_eunice'
3593 eunicefix='$eunicefix'
3623 sendmail='$sendmail'
3653 lastuname='$lastuname'
3654 alignbytes='$alignbytes'
3656 installbin='$installbin'
3657 byteorder='$byteorder'
3658 contains='$contains'
3659 cppstdin='$cppstdin'
3660 cppminus='$cppminus'
3664 d_castneg='$d_castneg'
3665 castflags='$castflags'
3666 d_charsprf='$d_charsprf'
3667 d_chsize='$d_chsize'
3669 cryptlib='$cryptlib'
3671 d_dosuid='$d_dosuid'
3673 d_fchmod='$d_fchmod'
3674 d_fchown='$d_fchown'
3676 d_flexfnam='$d_flexfnam'
3678 d_getgrps='$d_getgrps'
3679 d_gethent='$d_gethent'
3680 d_getpgrp='$d_getpgrp'
3681 d_getpgrp2='$d_getpgrp2'
3682 d_getprior='$d_getprior'
3685 d_killpg='$d_killpg'
3687 d_memcmp='$d_memcmp'
3688 d_memcpy='$d_memcpy'
3691 d_msgctl='$d_msgctl'
3692 d_msgget='$d_msgget'
3693 d_msgrcv='$d_msgrcv'
3694 d_msgsnd='$d_msgsnd'
3698 d_readdir='$d_readdir'
3699 d_rename='$d_rename'
3701 d_select='$d_select'
3703 d_semctl='$d_semctl'
3704 d_semget='$d_semget'
3706 d_setegid='$d_setegid'
3707 d_seteuid='$d_seteuid'
3708 d_setpgrp='$d_setpgrp'
3709 d_setpgrp2='$d_setpgrp2'
3710 d_setprior='$d_setprior'
3711 d_setregid='$d_setregid'
3712 d_setresgid='$d_setresgid'
3713 d_setreuid='$d_setreuid'
3714 d_setresuid='$d_setresuid'
3715 d_setrgid='$d_setrgid'
3716 d_setruid='$d_setruid'
3719 d_voidshmat='$d_voidshmat'
3720 d_shmctl='$d_shmctl'
3722 d_shmget='$d_shmget'
3723 d_socket='$d_socket'
3724 d_sockpair='$d_sockpair'
3725 d_oldsock='$d_oldsock'
3726 socketlib='$socketlib'
3727 d_statblks='$d_statblks'
3728 d_stdstdio='$d_stdstdio'
3729 d_strctcpy='$d_strctcpy'
3730 d_strerror='$d_strerror'
3731 d_symlink='$d_symlink'
3732 d_syscall='$d_syscall'
3733 d_truncate='$d_truncate'
3735 d_voidsig='$d_voidsig'
3736 d_tosignal='$d_tosignal'
3737 d_volatile='$d_volatile'
3738 d_vprintf='$d_vprintf'
3739 d_charvspr='$d_charvspr'
3741 d_waitpid='$d_waitpid'
3743 groupstype='$groupstype'
3750 d_pwquota='$d_pwquota'
3752 d_pwchange='$d_pwchange'
3753 d_pwclass='$d_pwclass'
3754 d_pwexpire='$d_pwexpire'
3755 d_pwcomment='$d_pwcomment'
3756 i_sys_file='$i_sys_file'
3757 i_sysioctl='$i_sysioctl'
3759 i_sys_time='$i_sys_time'
3760 i_sys_select='$i_sys_select'
3761 d_systimekernel='$d_systimekernel'
3763 i_varargs='$i_varargs'
3769 i_my_dir='$i_my_dir'
3771 i_sys_ndir='$i_sys_ndir'
3772 i_dirent='$i_dirent'
3773 i_sys_dir='$i_sys_dir'
3774 d_dirnamlen='$d_dirnamlen'
3777 mallocsrc='$mallocsrc'
3778 mallocobj='$mallocobj'
3779 d_mymalloc='$d_mymalloc'
3780 mallocptrtype='$mallocptrtype'
3789 optimize='$optimize'
3791 cppflags='$cppflags'
3794 nativegcc='$nativegcc'
3799 randbits='$randbits'
3800 scriptdir='$scriptdir'
3801 installscr='$installscr'
3802 sig_name='$sig_name'
3803 spitshell='$spitshell'
3805 sharpbang='$sharpbang'
3809 usrinclude='$usrinclude'
3810 inclPath='$inclPath'
3812 voidhave='$voidhave'
3813 voidwant='$voidwant'
3814 w_localtim='$w_localtim'
3815 w_s_timevl='$w_s_timevl'
3820 installprivlib='$installprivlib'
3823 test -f patchlevel.h && awk '{printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
3824 echo "CONFIG=true" >>config.sh
3826 if test -f UU/oldconfig.sh; then
3827 sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
3828 sort | uniq -u >UU/oldsyms
3829 set X `cat UU/oldsyms`
3833 *) echo "Hmm...You had some extra variables I don't know about...I'll try to keep 'em..."
3834 for sym in `cat UU/oldsyms`; do
3835 echo " Propagating $hint variable "'$'"$sym..."
3836 eval 'tmp="$'"${sym}"'"'
3838 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
3850 echo "If you didn't make any mistakes, then just type a carriage return here."
3851 rp="If you need to edit config.sh, do it as a shell escape here:"
3856 *) : in case they cannot read
3862 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
3866 Now you need to generate make dependencies by running "make depend".
3867 You might prefer to run it in background: "make depend > makedepend.out &"
3868 It can take a while, so you might not want to run it right now.
3871 rp="Run make depend now? [$dflt]"
3875 y*) make depend && echo "Now you must run a make."
3877 *) echo "You must run 'make depend' then 'make'."
3880 elif test -f [Mm]akefile; then
3882 echo "Now you must run a make."