home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-11-19 | 33.5 KB | 1,581 lines |
- rp="Shall I ignore $ans() from now on?"
- . myread
- case "$ans" in
- y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
- esac;;
- esac
- case "$phostname" in
- '') aphostname='';;
- *) case "$aphostname" in
- /*) ;;
- *) set X $phostname
- shift
- file=$1
- shift
- file=`loc $file $file $pth`
- aphostname=`echo $file $*`
- ;;
- esac
- ;;
- esac
- case "$d_uname$d_gethname" in
- *define*) ;;
- *)
- case "$phostname" in
- '') ;;
- *)
- $cat <<EOT
-
- There is no gethostname() or uname() on this system. You have two
- possibilities at this point:
-
- 1) You can have your host name ($hostname) compiled into $package, which
- lets $package start up faster, but makes your binaries non-portable, or
- 2) you can have $package use a
-
- popen("$aphostname","r")
-
- which will start slower but be more portable.
-
- If you want option 2 but with a different command, you can edit config.sh at
- the end of this shell script.
-
- EOT
- case "$d_phostname" in
- "$define") dflt=n;;
- "$undef") dflt=y;;
- '')
- case "$d_portable" in
- "$define") dflt=n ;;
- *) dflt=y ;;
- esac;;
- esac
- rp="Do you want your host name compiled in?"
- . myread
- case "$ans" in
- n*)d_phostname="$define" ;;
- *) phostname=''; d_phostname="$undef";;
- esac;;
- esac
- case "$phostname" in
- '')
- echo 'No hostname function--hardwiring "'$hostname'".';;
- esac;;
- esac
-
- : determine where public executables go
- case "$bin" in
- '')
- dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
- ;;
- *) dflt="$bin"
- ;;
- esac
- cont=true
- while $test "$cont" ; do
- echo " "
- rp="Where do you want to put the public executables? (~name ok)"
- . myread
- bin="$ans"
- bin=`filexp $bin`
- if test -d $bin; then
- cont=''
- else
- dflt=n
- rp="Directory $bin doesn't exist. Use that name anyway?"
- . myread
- dflt=''
- case "$ans" in
- y*) cont='';;
- esac
- fi
- done
-
- : determine optimize, if desired, or use for debug flag also
- case "$optimize" in
- ' ') dflt="none";;
- '') dflt="-O";;
- *) dflt="$optimize";;
- esac
- $cat <<EOH
-
- Some C compilers have problems with their optimizers, by default, $package
- compiles with the -O flag to use the optimizer. Alternately, you might want to
- use the symbolic debugger, which uses the -g flag (on traditional Unix systems).
- Either flag can be specified here. To use neither flag, specify the word "none".
-
- EOH
- rp="What optimizer/debugger flag should be used?"
- . myread
- optimize="$ans"
- case "$optimize" in
- 'none') optimize=" ";;
- esac
-
- case "$ccflags" in
- '') case "$cc" in
- *gcc*) dflt='-fpcc-struct-return';;
- *) dflt='';;
- esac
- ;;
- *) dflt="$ccflags"
- case "$cc" in
- *gcc*) case "$dflt" in
- *-fpcc-struct-return*) ;;
- *) dflt="$dflt -fpcc-struct-return";;
- esac;;
- esac;;
- esac
-
- case "$mips_type" in
- *BSD*) ;;
- '') ;;
- *) inclwanted="$inclwanted $usrinc/bsd";;
- esac
- for thisincl in $inclwanted; do
- if $test -d $thisincl; then
- if $test x$thisincl != x$usrinc; then
- case "$dflt" in
- *$thisincl*);;
- *) dflt="$dflt -I$thisincl";;
- esac
- fi
- fi
- done
-
- case "$optimize" in
- -g*)
- case "$dflt" in
- *DEBUG*);;
- *) dflt="$dflt -DDEBUG";;
- esac
- ;;
- esac
- if $contains 'LANGUAGE_C' $usrinc/signal.h >/dev/null 2>&1; then
- case "$dflt" in
- *LANGUAGE_C*);;
- *) dflt="$dflt -DLANGUAGE_C";;
- esac
- elif $contains 'LANGUAGE_C' $usrinc/sys/signal.h >/dev/null 2>&1; then
- case "$dflt" in
- *LANGUAGE_C*);;
- *) dflt="$dflt -DLANGUAGE_C";;
- esac
- fi
- if $contains 'NO_PROTOTYPE' $usrinc/signal.h >/dev/null 2>&1; then
- case "$dflt" in
- *NO_PROTOTYPE*);;
- *) dflt="$dflt -DNO_PROTOTYPE";;
- esac
- elif $contains 'NO_PROTOTYPE' $usrinc/sys/signal.h >/dev/null 2>&1; then
- case "$dflt" in
- *NO_PROTOTYPE*);;
- *) dflt="$dflt -DNO_PROTOTYPE";;
- esac
- fi
- if $contains '_NO_PROTO' $usrinc/signal.h >/dev/null 2>&1; then
- case "$dflt" in
- *_NO_PROTO*);;
- *) dflt="$dflt -D_NO_PROTO";;
- esac
- elif $contains '_NO_PROTO' $usrinc/sys/signal.h >/dev/null 2>&1; then
- case "$dflt" in
- *_NO_PROTO*);;
- *) dflt="$dflt -D_NO_PROTO";;
- esac
- fi
- case "$dflt" in
- '') dflt=none;;
- esac
- $cat <<EOH
-
- Your C compiler may want other flags. For this question you should include
- -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
- but you should NOT include libraries or ld flags like -lwhatever. To use no
- flags, specify the word "none".
-
- EOH
- set X $dflt
- shift
- dflt=${1+"$@"}
- rp="Any additional cc flags?"
- . myread
- case "$ans" in
- none) ans='';
- esac
- ccflags="$ans"
-
- : the following weeds options from ccflags that are of no interest to cpp
- cppflags="$ccflags"
- case "$cc" in
- *gcc*) cppflags="$cppflags -D__GNUC__";;
- esac
- case "$mips_type" in
- '');;
- *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
- esac
- case "$cppflags" in
- '');;
- *) set X $cppflags
- cppflags=''
- for flag
- do
- case $flag in
- -D*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
- esac
- done
- case "$cppflags" in
- *-*) echo "(C preprocessor flags: $cppflags)";;
- esac
- ;;
- esac
-
- : flags used in final linking phase
- case "$ldflags" in
- '') if venix; then
- dflt='-i -z'
- else
- dflt='none'
- fi
- ;;
- *) dflt="$ldflags";;
- esac
- echo " "
- rp="Any additional ld flags (NOT including libraries)?"
- . myread
- case "$ans" in
- none) ans='';
- esac
- ldflags="$ans"
- rmlist="$rmlist pdp11"
-
- : set up the script used to warn in case of inconsistency
- cat <<'EOSC' >whoa
- dflt=y
- echo ' '
- echo "*** WHOA THERE!!! ***"
- echo " The $hint value for \$$var on this machine was \"$was\"!"
- rp=" Keep the $hint value?"
- . myread
- case "$ans" in
- y) td=$was; tu=$was;;
- esac
- EOSC
-
- : define an is-in-libc? function
- inlibc='echo " "; td=$define; tu=$undef;
- var=$2; eval "was=\$$2";
- if $contains "^$1\$" libc.list >/dev/null 2>&1;
- then echo "$1() found.";
- eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
- else echo "$1() not found.";
- eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi'
-
- : see if bcopy exists
- case "$d_bcopy" in
- $define) d_bcopy="$undef";;
- $undef) d_bcopy="$define";;
- esac
- set bcopy d_bcopy
- eval $inlibc
- case "$d_bcopy" in
- $define) d_bcopy="$undef";;
- *) d_bcopy="$define";;
- esac
-
- : function used to set $1 to $val
- setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
- case "$val$was" in
- $define$undef) . whoa; eval "$var=\$td";;
- $undef$define) . whoa; eval "$var=\$tu";;
- *) eval "$var=$val";;
- esac'
-
- : see which of string.h or strings.h is needed
- echo " "
- strings=`loc string.h "" $usrinc $inclwanted`
- val="$undef"
- if $test -r "$strings"; then
- echo "Using <string.h> instead of <strings.h>."
- if bsd; then
- echo "(Actually, this looks more like it were an USG system)"
- fi
- val="$define"
- else
- strings=`loc strings.h "" $usrinc $inclwanted`
- if $test -r "$strings"; then
- echo "Using <strings.h> instead of <string.h>."
- if usg; then
- echo "(Actually, this looks more like it were a BSD system)"
- fi
- else
- echo "No string header found--You'll surely have problems."
- fi
- fi
- set i_string
- eval $setvar
-
- : index or strchr
- echo " "
- case "$d_index" in
- n) dflt=n;;
- *) dflt=y;;
- esac
- if $contains '^index$' libc.list >/dev/null 2>&1 ; then
- if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
- if $contains strchr "$strings" >/dev/null 2>&1 ; then
- if $contains index "$strings" >/dev/null 2>&1 ; then
- echo "Your system has both index() and strchr()."
- rp="Shall I use index() rather than strchr()?"
- . myread
- case "$ans" in
- n*) val="$define" ;;
- *) val="$undef" ;;
- esac
- else
- val="$define"
- echo "strchr() found."
- fi
- else
- val="$undef"
- echo "index() found."
- fi
- else
- val="$undef"
- echo "index() found."
- fi
- else
- if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then
- val="$define"
- echo "strchr() found."
- else
- echo "No index() or strchr() found!"
- val="$undef"
- fi
- fi
- set d_index
- eval $setvar
-
- : see if rename exists
- set rename d_rename
- eval $inlibc
-
- : see if strerror and/or sys_errlist[] exist
- echo " "
- if $contains '^strerror$' libc.list >/dev/null 2>&1; then
- echo 'strerror() found.'
- d_strerror="$define"
- d_strerrm="$undef"
- if $contains 'sys_errlist' libc.tmp >/dev/null 2>&1; then
- echo "You also have sys_errlist[]."
- d_syserrlst="$define"
- else
- echo "But you don't have sys_errlist[]."
- d_syserrlst="$undef"
- fi
- elif $contains '#[ ]*define.*strerror' $usrinc/string*.h >/dev/null 2>&1; then
- echo 'strerror() found in string header.'
- d_strerror="$define"
- d_strerrm="$undef"
- if $contains 'sys_errlist' libc.tmp >/dev/null 2>&1; then
- echo "You also have sys_errlist[]."
- d_syserrlst="$define"
- else
- echo "But you don't have sys_errlist[]."
- d_syserrlst="$undef"
- fi
- elif $contains 'sys_errlist' libc.tmp >/dev/null 2>&1; then
- echo "strerror() not found, but you have sys_errlist[] so we'll use that."
- d_strerror="$undef"
- d_syserrlst="$define"
- d_strerrm="$define"
- else
- echo 'strerror() and sys_errlist[] not found.'
- d_strerror="$undef"
- d_syserrlst="$undef"
- d_strerrm="$undef"
- fi
- if $contains 'sys_errnolist' libc.tmp >/dev/null 2>&1; then
- echo " "
- echo "Symbolic error codes for errno are kept in sys_errnolist[]."
- d_sysernlst="$define"
- else
- d_sysernlst="$undef"
- fi
-
- : see if union wait is available
- echo " "
- if $contains 'int.*w_status;' $usrinc/sys/wait.h >/dev/null 2>&1 ; then
- echo "Looks like we have to use 'union wait' pointer for wait()."
- val="$define"
- else
- echo "Your wait() should be happy with a plain 'int' pointer."
- val="$undef"
- fi
- set d_uwait
- eval $setvar
-
- : see if there is a vfork
- echo " "
- if $contains '^vfork$' libc.list >/dev/null 2>&1 ; then
- echo "vfork() found."
- val="$undef"
- else
- echo "No vfork() found--will use fork() instead."
- val="$define"
- fi
- set d_vfork
- eval $setvar
-
- : now get the host name to advertise as our mailing address
- case "$hiddennet" in
- '') dflt=n;;
- *) dflt=y;;
- esac
- $cat <<EOM
-
- Some sites are on "hidden" networks, in the sense that the network appears
- to the outside world as a single machine. The advertised name of any host
- on this hidden network is the name of one machine on the local network which
- knows how to forward mail to any other host on the hidden network.
-
- Do you wish to advertise a different hostname to the world than the one your
- own host ($hostname$mydomain) has?
-
- EOM
- rp='Use "hidden" network?'
- . myread
- case "$ans" in
- n*) d_hidnet="$undef" hiddennet='';;
- *)
- d_hidnet="$define"
- echo " "
- case "$hiddennet" in
- '') dflt=`echo $mydomain | $sed -e 's/^\.//'`;;
- *) dflt="$hiddennet";;
- esac
- rp="What hostname do you wish to advertise?"
- . myread
- hiddennet="$ans"
- ;;
- esac
-
- : see if this is an fcntl system
- echo " "
- if $test -r $usrinc/fcntl.h ; then
- val="$define"
- echo "<fcntl.h> found."
- else
- val="$undef"
- echo "No <fcntl.h> found, but that's ok."
- fi
- set i_fcntl
- eval $setvar
-
- : define an alternate in-header-list? function
- inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
- cont=true; xxf="echo \"<\$1> found.\"";
- case $# in 2) xxnf="echo \"No <\$1> found.\"";;
- *) xxnf="echo \"No <\$1> found, ...\"";;
- esac;
- case $# in 4) instead=instead;; *) instead="at last";; esac;
- while $test "$cont";
- do xxx=`loc $1 x $usrinc /usr/local/include $inclwanted`;
- var=$2; eval "was=\$$2";
- if $test -f $xxx;
- then eval $xxf;
- eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
- cont="";
- else eval $xxnf;
- eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi;
- set $yyy; shift; shift; yyy=$@;
- case $# in 0) cont="";;
- 2) xxf="echo \"but I found <\$1> $instead.\"";
- xxnf="echo \"and I did not find <\$1> either.\"";;
- *) xxf="echo \"but I found <\$1\> instead.\"";
- xxnf="echo \"there is no <\$1>, ...\"";;
- esac;
- done;
- while $test "$yyy";
- do set $yyy; var=$2; eval "was=\$$2";
- eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu";
- set $yyy; shift; shift; yyy=$@;
- done'
-
- : see if this is a sys/file.h system
- set sys/file.h i_sysfile
- eval $inhdr
-
- : see if we should include time.h, sys/time.h, or both
- echo " "
- echo "Testing to see if we should include <time.h>, <sys/time.h> or both."
- $echo $n "I'm now running the test program...$c"
- $cat >try.c <<'EOCP'
- #include <sys/types.h>
- #ifdef I_TIME
- #include <time.h>
- #endif
- #ifdef I_SYSTIME
- #ifdef SYSTIMEKERNEL
- #define KERNEL
- #endif
- #include <sys/time.h>
- #endif
- #ifdef I_SYSSELECT
- #include <sys/select.h>
- #endif
- main()
- {
- struct tm foo;
- #ifdef S_TIMEVAL
- struct timeval bar;
- #endif
- #ifdef S_TIMEZONE
- struct timezone tzp;
- #endif
- if (foo.tm_sec == foo.tm_sec)
- exit(0);
- #ifdef S_TIMEVAL
- if (bar.tv_sec == bar.tv_sec)
- exit(0);
- #endif
- exit(1);
- }
- EOCP
- flags=''
- for s_timezone in '-DS_TIMEZONE' ''; do
- sysselect=''
- for s_timeval in '-DS_TIMEVAL' ''; do
- for i_systimek in '' '-DSYSTIMEKERNEL'; do
- for i_time in '' '-DI_TIME'; do
- for i_systime in '-DI_SYSTIME' ''; do
- case "$flags" in
- '') $echo $n ".$c"
- if $cc $ccflags \
- $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone \
- try.c -o try >/dev/null 2>&1 ; then
- set X $i_time $i_systime $i_systimek $sysselect $s_timeval
- shift
- flags="$*"
- echo " "
- $echo $n "Succeeded with $flags$c"
- fi
- ;;
- esac
- done
- done
- done
- done
- done
- timeincl=''
- echo " "
- case "$flags" in
- *SYSTIMEKERNEL*) i_systimek="$define"
- timeincl="$usrinc/sys/time.h"
- echo "We'll include <sys/time.h> with KERNEL defined.";;
- *) i_systimek="$undef";;
- esac
- case "$flags" in
- *I_TIME*) i_time="$define"
- timeincl="$usrinc/time.h $timeincl"
- echo "We'll include <time.h>.";;
- *) i_time="$undef";;
- esac
- case "$flags" in
- *I_SYSTIME*) i_systime="$define"
- timeincl="$usrinc/sys/time.h $timeincl"
- echo "We'll include <sys/time.h>.";;
- *) i_systime="$undef";;
- esac
- $rm -f try.c try
-
- : see if this is a syswait system
- set sys/wait.h i_syswait
- eval $inhdr
-
- : check for length of integer
- echo " "
- case "$intsize" in
- '')
- echo "Checking to see how big your integers are..."
- $cat >try.c <<'EOCP'
- #include <stdio.h>
- main()
- {
- printf("%d\n", sizeof(int));
- }
- EOCP
- if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then
- dflt=`./try`
- else
- dflt='4'
- echo "(I can't seem to compile the test program. Guessing...)"
- fi
- ;;
- *)
- dflt="$intsize"
- ;;
- esac
- rp="What is the size of an integer (in bytes)?"
- . myread
- intsize="$ans"
- $rm -f try.c try
-
- : determine where mail is spooled
- case "$maildir" in
- '') dflt=`loc . /usr/spool/mail /usr/spool/mail /usr/mail`;;
- *) dflt="$maildir";;
- esac
- cont=true
- while $test "$cont" ; do
- echo " "
- rp="Where is yet-to-be-read mail spooled?"
- . myread
- maildir=`filexp "$ans"`
- if $test -d "$maildir"; then
- cont=''
- else
- dflt=n
- rp="Directory $maildir doesn't exist. Use that name anyway?"
- . myread
- dflt=''
- case "$ans" in
- y*) cont='';;
- esac
- fi
- done
-
- : determine where mail is spooled
- case "$mailfile" in
- '')
- dflt="$maildir"
- case "$dflt" in
- '') dflt='%~/mailbox';;
- *) dflt="$dflt/%L";;
- esac
- ;;
- *) dflt="$mailfile"
- ;;
- esac
- cat <<'EOM'
-
- In the following question, you may use %~ to represent the user's home
- directory, and %L to represent a users name.
-
- EOM
- rp="In which file is yet-to-be-read mail spooled?"
- . myread
- mailfile=`filexp "$ans"`
-
- : determine where manual pages go
- $cat <<EOM
-
- $package has manual pages available in source form.
- EOM
- case "$nroff" in
- nroff)
- echo "However, you don't have nroff, so they're probably useless to you."
- case "$mansrc" in
- '') mansrc="none";;
- esac;;
- esac
- echo "If you don't want the manual sources installed, answer 'none'."
- case "$mansrc" in
- '')
- dflt="$sysman"
- ;;
- *) dflt="$mansrc"
- ;;
- esac
- cont=true
- while $test "$cont" ; do
- echo " "
- rp="Where do the manual pages (source) go? (~name ok)"
- . myread
- case "$ans" in
- 'none') mansrc=''
- cont='';;
- *)
- mansrc=`filexp "$ans"`
- if test -d "$mansrc"; then
- cont=''
- else
- dflt=n
- rp="Directory $mansrc doesn't exist. Use that name anyway?"
- . myread
- dflt=''
- case "$ans" in
- y*) cont='';;
- esac
- fi;;
- esac
- done
- case "$mansrc" in
- '') manext='0';;
- *l) manext=l;;
- *n) manext=n;;
- *o) manext=l;;
- *p) manext=n;;
- *C) manext=C;;
- *L) manext=L;;
- *) manext=1;;
- esac
-
- : find out how to generate dependencies
- echo " "
- echo "Checking how to generate makefile dependencies on your machine..."
- toplev=`cd ..;pwd`
- $cat >dep.c <<'EOCP'
- #include "dep.h"
- EOCP
- $cat >dep.h <<'EOCP'
-
- EOCP
- takeflags='flags=""
- case "$@" in
- *--*)
- for arg
- do
- shift
- case "$arg" in
- --) break;;
- *) flags="$flags $arg";;
- esac
- done;;
- esac'
- case "$mkdep" in
- '')
- ;;
- *)
- if test -x "$mkdep" &&
- $mkdep dep.c >dep.out 2>/dev/null &&
- $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
- then
- echo "$mkdep works."
- else
- mkdep=
- fi
- esac
-
- case "$mkdep" in
- '')
- $spitshell > ../mkdep <<EOM
- $startsh
- $takeflags
- for srcfile
- do
- $cpp -M -I. $cppflags \$flags \$srcfile 2>/dev/null
- done
- EOM
- mkdep=$toplev/mkdep
- chmod +x $mkdep
- $eunicefix $mkdep
- if $mkdep dep.c >dep.out 2>/dev/null &&
- $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
- then
- echo "Looks like we can use $cpp -M."
- else
- mkdep=
- fi
- ;;
- esac
-
- case "$mkdep" in
- '')
- $spitshell >../mkdep <<EOS
- $startsh
- $takeflags
- for srcfile
- do
- case "\$srcfile" in
- *.c) c='.c';;
- *.y) c='.y';;
- *.l) c='.l';;
- esac
- filebase=\`basename \$srcfile \$c\`
- <\$srcfile $cpp $cppminus $cppflags -I. \$flags 2>/dev/null | \\
- $sed -e '/^# *[0-9]/!d' \\
- -e 's/^.*"\(.*\)".*\$/'\$filebase'.o: \1/' \\
- -e 's|: \./|: |' \\
- -e 's|: *$|: '\$srcfile'|' | \\
- $grep -v '^#' | $sort | $uniq
- done
- EOS
- mkdep=$toplev/mkdep
- chmod +x $mkdep
- $eunicefix $mkdep
- if $mkdep dep.c >dep.out 2>/dev/null &&
- $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
- then
- echo "A shell script using $cpp does the trick."
- else
- echo "$cpp doesn't seem to be any use at all."
- $spitshell >../mkdep <<EOS
- $startsh
- $takeflags
- for srcfile
- do
- case "\$srcfile" in
- *.c) c='.c';;
- *.y) c='.y';;
- *.l) c='.l';;
- esac
- filebase=\`basename \$srcfile \$c\`
- echo \$filebase.o: \$srcfile
- $grep '^#[ ]*include' \$srcfile /dev/null |
- $sed -e 's/#[ ]*include[ ]*//' \\
- -e 's,<\(.*\)>,"$usrinc/\1",' \\
- -e 's/:[^"]*"\([^"]*\)".*/: \1/' \\
- -e 's/\.c:/\.o:/'
- done
- EOS
- mkdep=$toplev/mkdep
- chmod +x $mkdep
- $eunicefix $mkdep
- if $mkdep dep.c >dep.out 2>/dev/null &&
- $contains 'dep\.o:.*dep\.h' dep.out >/dev/null 2>&1
- then
- cat << EOM
-
- I can use a script with grep instead, but it will make some incorrect
- dependencies, since it doesn't understand about conditional compilation.
- Moreover, some dependencies may be missing, because scanning won't be
- a recursive process.
- If you have a program which generates makefile dependencies, you may want
- to use it. If not, you can use the script and edit the Makefile by hand
- if you need to.
- EOM
- else
- mkdep=
- cat << EOM
-
- I can't seem to generate makefile dependencies at all! Perhaps you have a
- program that does? If you don't, you might look at the mkdep script to
- see if you can create one which works.
- EOM
- fi
- fi
- esac
- cont=true
- dflt="$mkdep"
- while $test "$cont" ; do
- echo " "
- rp="Name of program to make makefile dependencies?"
- . myread
- mkdep="$ans"
- mkdep=`filexp $mkdep`
- if test -f "$mkdep"; then
- cont=''
- else
- dflt=n
- rp="$mkdep doesn't exist. Use that name anyway?"
- . myread
- dflt=''
- case "$ans" in
- y*) cont='';;
- esac
- fi
- done
- $rm -f dep.c dep.h dep.o dep.out
-
- : get organization name
- longshots='/usr/src/new /usr/src/local /usr/local/src'
- case "$orgname" in
- '') if xxx=`loc news/src/defs.h x $longshots`; then
- dflt=`$sed -n 's/^.*MYORG[ ]*"\(.*\)".*$/\1/p' $xxx`
- else
- dflt=''
- fi
- ;;
- *) dflt="$orgname";;
- esac
- $cat << 'EOH'
-
- Please type the name of your organization as you want it to appear on the
- Organization line of outgoing articles. (It's nice if this also specifies
- your location. Your city name is probably sufficient if well known.)
- For example:
-
- University of Southern North Dakota, Hoople
-
- You may also put the name of a file, as long as it begins with a slash.
- For example:
-
- /etc/organization
-
- EOH
- orgname=""
- while test "X$orgname" = "X"; do
- rp="Organization:"
- . myread
- orgname="$ans"
- done
-
- : determine perl absolute location
- case "$perlpath" in
- '')
- if test -f /usr/bin/perl; then
- dflt=/usr/bin/perl
- else
- case "$_perl" in
- */*) dflt="$_perl";;
- *) dflt=/usr/bin/perl;;
- esac
- fi
- ;;
- *) dflt="$perlpath"
- ;;
- esac
- cont=true
- while $test "$cont" ; do
- echo " "
- rp="Where is perl located on your system?"
- . myread
- perlpath="$ans"
- case "$ans" in
- /*) if test -f $ans; then
- cont=''
- else
- dflt=n
- rp="File $ans doesn't exist. Use that name anyway?"
- . myread
- dflt=''
- case "$ans" in
- y*) cont='';;
- esac
- fi
- ;;
- *) echo "Please use an absolute path name.";;
- esac
- done
-
- : see what type pids are declared as in the kernel
- case "$pidtype" in
- '')
- if $contains 'pid_t;' $usrinc/sys/types.h >/dev/null 2>&1 ; then
- dflt='pid_t';
- else
- dflt="int"
- fi
- ;;
- *) dflt="$pidtype";;
- esac
- echo " "
- rp="What type are process ids on this system declared as?"
- . myread
- pidtype="$ans"
-
- : determine where private executables go
- case "$privlib" in
- '')
- dflt=/usr/lib/$package
- test -d /usr/local/lib && dflt=/usr/local/lib/$package
- ;;
- *) dflt="$privlib"
- ;;
- esac
- $cat <<EOM
-
- The $package package has some auxiliary files that should be put in a library
- that is accessible by everyone. Where do you want to put these "private" but
- accessible files?
-
- EOM
- rp="Private library path? (~name ok)"
- . myread
- privlib="$ans"
- case "$d_portable" in
- "$undef")
- privlib=`filexp $privlib`
- ;;
- esac
-
- : see how we invoke the C preprocessor
- echo " "
- echo "Now, how can we feed standard input to your C preprocessor..."
- cat <<'EOT' >testcpp.c
- #define ABC abc
- #define XYZ xyz
- ABC.XYZ
- EOT
- cd ..
- echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
- chmod 755 cppstdin
- wrapper=`pwd`/cppstdin
- cd UU
- if test "X$cppstdin" != "X" && \
- $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
- $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
- echo "You used to use $cppstdin $cppminus so we'll use that again."
- elif test "$cc" = gcc && \
- (echo "Using gcc, eh? We'll try to force gcc -E using a wrapper..."; \
- $wrapper <testcpp.c >testcpp.out 2>&1; \
- $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then
- echo "Yup, we can."
- cppstdin="$wrapper"
- cppminus='';
- elif echo 'Maybe "'"$cc"' -E" will work...'; \
- $cc -E <testcpp.c >testcpp.out 2>&1; \
- $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
- echo "Yup, it does."
- cppstdin="$cc -E"
- cppminus='';
- elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
- $cc -E - <testcpp.c >testcpp.out 2>&1; \
- $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
- echo "Yup, it does."
- cppstdin="$cc -E"
- cppminus='-';
- elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
- $wrapper <testcpp.c >testcpp.out 2>&1; \
- $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
- cppstdin="$wrapper"
- cppminus=''
- echo "Eureka!"
- elif echo 'No such luck, maybe "'$cpp'" will work...'; \
- $cpp <testcpp.c >testcpp.out 2>&1; \
- $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
- echo "It works!"
- cppstdin="$cpp"
- cppminus='';
- elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
- $cpp - <testcpp.c >testcpp.out 2>&1; \
- $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
- echo "Hooray, it works! I was beginning to wonder."
- cppstdin="$cpp"
- cppminus='-';
- elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
- $cc -P <testcpp.c >testcpp.out 2>&1; \
- $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
- echo "Yipee, that works!"
- cppstdin="$cc -P"
- cppminus='';
- elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
- $cc -P - <testcpp.c >testcpp.out 2>&1; \
- $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
- echo "At long last!"
- cppstdin="$cc -P"
- cppminus='-';
- else
- dflt=''
- rp="No dice. I can't find a C preprocessor. Name one:"
- . myread
- cppstdin="$ans"
- $cppstdin <testcpp.c >testcpp.out 2>&1
- if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
- echo "OK, that will do."
- else
- echo "Sorry, I can't get that to work. Go find one and rerun Configure."
- exit 1
- fi
- fi
- $rm -f testcpp.c testcpp.out
-
- : get C preprocessor symbols handy
- echo " "
- echo $attrlist | $tr '[ - ]' '[\012-\012]' >Cppsym.know
- $cat <<EOSS >Cppsym
- $startsh
- case "\$1" in
- -l) list=true
- shift
- ;;
- esac
- unknown=''
- case "\$list\$#" in
- 1|2)
- for sym do
- if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then
- exit 0
- elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then
- :
- else
- unknown="\$unknown \$sym"
- fi
- done
- set X \$unknown
- shift
- ;;
- esac
- case \$# in
- 0) exit 1;;
- esac
- echo \$* | $tr '[ - ]' '[\012-\012]' | $sed -e 's/\(.*\)/\\
- #ifdef \1\\
- exit 0; _ _ _ _\1\\ \1\\
- #endif\\
- /' >Cppsym\$\$
- echo exit 1 >>Cppsym\$\$
- $cppstdin $cppminus <Cppsym\$\$ >Cppsym2\$\$
- case "\$list" in
- true) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;
- *)
- sh Cppsym2\$\$
- status=\$?
- ;;
- esac
- $rm -f Cppsym\$\$ Cppsym2\$\$
- exit \$status
- EOSS
- chmod +x Cppsym
- $eunicefix Cppsym
- echo "Your C preprocessor defines the following symbols:"
- Cppsym -l $attrlist >Cppsym.true
- $cat Cppsym.true
- rmlist="$rmlist Cppsym Cppsym.know Cppsym.true"
-
- : see how many register declarations we want to use
- case "$registers" in
- '')
- if Cppsym vax; then
- dflt=6
- elif Cppsym sun mc68000 mips; then
- dflt=10
- elif Cppsym pyr; then
- dflt=14
- elif Cppsym ns32000 ns16000; then
- dflt=5
- elif Cppsym $smallmach; then
- dflt=3
- else
- : if you have any other numbers for me, please send them in
- dflt=6
- fi;;
- *) dflt=$registers ;;
- esac
- cat <<EOM
-
- Different C compilers on different machines pay attention to different numbers
- of register declarations. About how many register declarations in each routine
- does your C compiler pay attention to? (OK to guess)
-
- EOM
- rp="Maximum register declarations?"
- . myread
- registers=$ans
- reg1=''
- $awk "BEGIN { for (i=1; i<=16; i++) printf \"reg%d=''\n\", i}" </dev/null >.foo
- . .foo
- $awk "BEGIN { for (i=1; i<=$registers; i++) printf \"reg%d=register\n\", i}" \
- </dev/null >.foo
- . .foo
- $rm -f .foo
-
- : determine where public executables go
- case "$scriptdir" in
- '')
- dflt="$bin"
- : guess some guesses
- $test -d /usr/share/scripts && dflt=/usr/share/scripts
- $test -d /usr/share/bin && dflt=/usr/share/bin
- ;;
- *) dflt="$scriptdir"
- ;;
- esac
- cont=true
- $cat <<EOM
-
- Some installations have a separate directory just for executable scripts so
- that they can mount it across multiple architectures but keep the scripts in
- one spot. You might, for example, have a subdirectory of /usr/share for this.
- Or you might just lump your scripts in with all your other executables.
-
- EOM
- while $test "$cont" ; do
- rp="Where do you keep publicly executable scripts? (~name ok)"
- . myread
- scriptdir="$ans"
- scriptdir=`./filexp "$scriptdir"`
- if $test -d $scriptdir; then
- cont=''
- else
- case "$fastread" in
- yes) dflt=y;;
- *) dflt=n;;
- esac
- rp="Directory $scriptdir doesn't exist. Use that name anyway?"
- . myread
- dflt=''
- case "$ans" in
- y*) cont='';;
- esac
- fi
- done
-
- : see if signal is declared as pointer to function returning int or void
- echo " "
- $cppstdin $cppminus $cppflags < $usrinc/signal.h >$$.tmp
- if $contains 'int.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
- echo "You have int (*signal())() instead of void."
- val="$undef"
- signal_t="int"
- elif $contains 'void.*\*[ ]*signal' $$.tmp >/dev/null 2>&1 ; then
- echo "You have void (*signal())() instead of int."
- val="$define"
- signal_t="void"
- elif $contains 'extern[ ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
- echo "You have int (*signal())() instead of void."
- val="$undef"
- signal_t="int"
- else
- case "$d_voidsig" in
- '') echo "I can't determine whether signal handler returns void or int..."
- dflt=void
- rp="What type does your signal handler returns?"
- . myread
- case "$ans" in
- void) val="$define"; signal_t="void";;
- *) val="$undef"; signal_t="int";;
- esac;;
- *) echo "As you already told me, signal handler returns $signal_t.";;
- esac
- fi
- set d_voidsig
- eval $setvar
- $rm -f $$.tmp
-
- : see if time exists
- echo " "
- if $contains '^time$' libc.list >/dev/null 2>&1; then
- echo 'time() found.'
- val="$define"
- case "$timetype" in
- '')
- if $contains 'time_t;' $usrinc/sys/types.h >/dev/null 2>&1 ; then
- dflt='time_t';
- else
- dflt='long';
- fi
- ;;
- *) dflt="$timetype"
- ;;
- esac
- cont=true
- echo " "
- rp="What type is returned by time() on this sytem?"
- . myread
- timetype="$ans"
- else
- echo 'time() not found, hope that will do.'
- val="$undef"
- timetype='int';
- fi
- set d_time
- eval $setvar
-
- : see what type uids are declared as in the kernel
- case "$uidtype" in
- '')
- if $contains 'uid_t;' $usrinc/sys/types.h >/dev/null 2>&1 ; then
- dflt='uid_t';
- else
- set `grep '_ruid;' $usrinc/sys/user.h 2>/dev/null` unsigned short
- case $1 in
- unsigned) dflt="$1 $2" ;;
- *) dflt="$1" ;;
- esac
- fi
- ;;
- *) dflt="$uidtype";;
- esac
- echo " "
- rp="What type are user ids on this system declared as?"
- . myread
- uidtype="$ans"
-
- echo " "
- echo "End of configuration questions."
- echo " "
-
- : create config.sh file
- echo " "
- if test -d ../UU; then
- cd ..
- fi
- echo "Creating config.sh..."
- xxx=`$date 2>&1`
- yyy=`( (logname) 2>/dev/null || whoami) 2>&1`
- $spitshell <<EOT >config.sh
- $startsh
- #
- # This file was produced by running the Configure script. It holds all the
- # definitions figured out by Configure. Should you modify one of these values,
- # do not forget to propagate your changes by running "Configure -d". You may
- # instead choose to run each of the .SH files by yourself.
- #
-
- # Configuration time: $xxx
- # Configured by: $yyy
- # Target system: $myuname
-
- d_bsd='$d_bsd'
- d_eunice='$d_eunice'
- d_xenix='$d_xenix'
- eunicefix='$eunicefix'
- Mcc='$Mcc'
- awk='$awk'
- bison='$bison'
- cat='$cat'
- chgrp='$chgrp'
- chmod='$chmod'
- chown='$chown'
- compress='$compress'
- cp='$cp'
- cpio='$cpio'
- cpp='$cpp'
- csh='$csh'
- date='$date'
- echo='$echo'
- egrep='$egrep'
- emacs='$emacs'
- expr='$expr'
- grep='$grep'
- inews='$inews'
- less='$less'
- line='$line'
- lint='$lint'
- ln='$ln'
- lp='$lp'
- lpr='$lpr'
- ls='$ls'
- mail='$mail'
- mailx='$mailx'
- make='$make'
- mkdir='$mkdir'
- more='$more'
- mv='$mv'
- nroff='$nroff'
- perl='$perl'
- pg='$pg'
- pmake='$pmake'
- pr='$pr'
- rm='$rm'
- rmail='$rmail'
- sed='$sed'
- sendmail='$sendmail'
- sleep='$sleep'
- smail='$smail'
- sort='$sort'
- submit='$submit'
- tail='$tail'
- tar='$tar'
- tbl='$tbl'
- test='$test'
- touch='$touch'
- tr='$tr'
- troff='$troff'
- uname='$uname'
- uniq='$uniq'
- uuname='$uuname'
- vi='$vi'
- zcat='$zcat'
- myuname='$myuname'
- Author='$Author'
- Date='$Date'
- Header='$Header'
- Id='$Id'
- Locker='$Locker'
- Log='$Log'
- RCSfile='$RCSfile'
- Revision='$Revision'
- Source='$Source'
- State='$State'
- bin='$bin'
- cc='$cc'
- ccflags='$ccflags'
- cppflags='$cppflags'
- ldflags='$ldflags'
- lkflags='$lkflags'
- optimize='$optimize'
- contains='$contains'
- cppminus='$cppminus'
- cppstdin='$cppstdin'
- d_bcopy='$d_bcopy'
- aphostname='$aphostname'
- d_gethname='$d_gethname'
- d_phostname='$d_phostname'
- d_uname='$d_uname'
- d_hidnet='$d_hidnet'
- hiddennet='$hiddennet'
- d_index='$d_index'
- d_portable='$d_portable'
- d_rename='$d_rename'
- d_strerrm='$d_strerrm'
- d_strerror='$d_strerror'
- d_sysernlst='$d_sysernlst'
- d_syserrlst='$d_syserrlst'
- d_time='$d_time'
- timetype='$timetype'
- d_uwait='$d_uwait'
- d_vfork='$d_vfork'
- d_voidsig='$d_voidsig'
- signal_t='$signal_t'
- hostname='$hostname'
- mydomain='$mydomain'
- phostname='$phostname'
- i_fcntl='$i_fcntl'
- i_string='$i_string'
- strings='$strings'
- i_sysfile='$i_sysfile'
- i_syswait='$i_syswait'
- i_systime='$i_systime'
- i_systimek='$i_systimek'
- i_time='$i_time'
- timeincl='$timeincl'
- timezone='$timezone'
- intsize='$intsize'
- libc='$libc'
- nm_opt='$nm_opt'
- libpth='$libpth'
- plibpth='$plibpth'
- libs='$libs'
- maildir='$maildir'
- mailfile='$mailfile'
- manext='$manext'
- mansrc='$mansrc'
- mkdep='$mkdep'
- huge='$huge'
- large='$large'
- medium='$medium'
- models='$models'
- small='$small'
- split='$split'
- c='$c'
- n='$n'
- orgname='$orgname'
- package='$package'
- perlpath='$perlpath'
- pidtype='$pidtype'
- privlib='$privlib'
- reg10='$reg10'
- reg11='$reg11'
- reg12='$reg12'
- reg13='$reg13'
- reg14='$reg14'
- reg15='$reg15'
- reg16='$reg16'
- reg1='$reg1'
- reg2='$reg2'
- reg3='$reg3'
- reg4='$reg4'
- reg5='$reg5'
- reg6='$reg6'
- reg7='$reg7'
- reg8='$reg8'
- reg9='$reg9'
- registers='$registers'
- scriptdir='$scriptdir'
- sharpbang='$sharpbang'
- shsharp='$shsharp'
- spitshell='$spitshell'
- startsh='$startsh'
- sysman='$sysman'
- uidtype='$uidtype'
- incpath='$incpath'
- mips='$mips'
- mips_type='$mips_type'
- usrinc='$usrinc'
- EOT
-
- : add special variables
- test -f patchlevel.h && \
- awk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
- echo "CONFIG=true" >>config.sh
-
- : propagate old symbols
- if test -f UU/config.sh; then
- <UU/config.sh sort | uniq >UU/oldconfig.sh
- sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
- sort | uniq -u >UU/oldsyms
- set X `cat UU/oldsyms`
- shift
- case $# in
- 0) ;;
- *) echo "Hmm...You had some extra variables I don't know about...I'll try to keep 'em..."
- for sym in `cat UU/oldsyms`; do
- echo " Propagating $hint variable "'$'"$sym..."
- eval 'tmp="$'"${sym}"'"'
- echo "$tmp" | \
- sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
- done
- ;;
- esac
- fi
-
- : Finish up
- CONFIG=true
-
- echo " "
- dflt=''
- echo "If you didn't make any mistakes, then just type a carriage return here."
- rp="If you need to edit config.sh, do it as a shell escape here:"
- . UU/myread
- case "$ans" in
- '') ;;
- *) : in case they cannot read
- eval $ans;;
- esac
- . ./config.sh
-
- echo " "
- echo "Doing variable substitutions on .SH files..."
- if test -f MANIFEST; then
- set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
- else
- set x `find . -name "*.SH" -print`
- fi
- shift
- case $# in
- 0) set x *.SH; shift;;
- esac
- if test ! -f $1; then
- shift
- fi
- for file in $*; do
- case "$file" in
- */*)
- dir=`$expr X$file : 'X\(.*\)/'`
- file=`$expr X$file : 'X.*/\(.*\)'`
- (cd $dir && . $file)
- ;;
- *)
- . $file
- ;;
- esac
- done
- if test -f config.h.SH; then
- if test ! -f config.h; then
- : oops, they left it out of MANIFEST, probably, so do it anyway.
- . config.h.SH
- fi
- fi
-
- if $contains '^depend:' Makefile >/dev/null 2>&1; then
- dflt=n
- $cat <<EOM
-
- Now you need to generate make dependencies by running "make depend".
- You might prefer to run it in background: "make depend > makedepend.out &"
- It can take a while, so you might not want to run it right now.
-
- EOM
- rp="Run make depend now?"
- . UU/myread
- case "$ans" in
- y*) make depend
- echo "Now you must run a make."
- ;;
- *) echo "You must run 'make depend' then 'make'."
- ;;
- esac
- elif test -f [Mm]akefile; then
- echo " "
- echo "Now you must run a make."
- else
- echo "Done."
- fi
-
- $rm -f kit*isdone
- $rm -rf UU
- : end of Configure
-