# If these # comments don't work, trim them. Don't worry about any other
# shell scripts, Configure will trim # comments from them for you.
# Note: if you are running ksh, be sure to say "sh Configure".
# (If you are trying to port this package to a machine without sh, I would
# suggest you cut out the prototypical config.h from the end of Configure
# and edit it to reflect your system. Some packages may include samples
# of config.h for certain machines, so you might look for one of those.)
# $Header: Configure,v 2.0 86/09/17 15:32:58 lwall Exp $
# Revision 2.0 86/09/17 15:32:58 lwall
# Baseline for netwide release.
# Yes, you may rip this off to use in other distribution packages.
# (Note: this Configure script was generated automatically. Rather than
# working with this copy of Configure, you may wish to get metaconfig.)
echo "Beginning of configuration questions for $package kit."
: Eunice requires
" " instead of
"", can you believe it
PATH
='.:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin:/etc'
export PATH ||
(echo "OOPS, this isn't sh. Desperation time. I will feed myself to sh."; sh
$0; kill $$
)
echo "Say 'sh Configure', not 'sh <Configure'"
: some greps
do not
return status
, grrr.
echo "grimblepritz" >grimble
if grep blurfldyick grimble
>/dev
/null
2>&1 ; then
if grep grimblepritz grimble
>/dev
/null
2>&1 ; then
: the following should work
in any shell
echo "AGH! Grep doesn't return a status. Attempting remedial action."
grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
: first determine how to suppress newline on
echo command
echo "Checking echo to see how to suppress newlines..."
(echo "hi there\c" ; echo " ") >.echotmp
if $contains c .echotmp
>/dev
/null
2>&1 ; then
echo $n "Type carriage return to continue. Your cursor should be here-->$c"
: now
set up to
do reads with possible shell escape
: if this does not work on your machine
, 1,$ s
/. myread
/read ans
/
while expr "X\$ans" : "X!" >/dev/null; do
set \`expr "X\$ans" : "X!\(.*\)\$"\`
This installation shell script will examine your system and ask you questions
to determine how $package and any auxiliary files should be installed. If you
get stuck on a question, you may use a ! shell escape to start a subshell or
execute a command. Many of the questions will have default answers in
square brackets--typing carriage return will give you the default.
On some of the questions which ask for file or directory names you are
allowed to use the ~name construct to specify the login directory belonging
to "name", even if you don't have a shell which knows about that. Questions
where this is allowed will be marked "(~name ok)".
rp
="[Type carriage return to continue]"
Much effort has been expended to ensure that this shell script will run
on any Unix system. If despite that it blows up on you, your best bet is
to edit Configure and run it again. (Trying to install this package
without having run Configure may be well nigh impossible.) Also, let me
(lwall@sdcrdcf.UUCP) know how I blew it.
This installation script affects things in two ways: 1) it may do direct
variable substitutions on some of the files included in this kit, and
2) it builds a config.h file for inclusion in C programs. You may edit
any of these files as the need arises after running this script.
rp
="[Type carriage return to continue]"
: get old answers
, if there is a config
file out there
if test -f config.sh
; then
rp
="I see a config.sh file. Did Configure make it on THIS system? [y]"
n
*) echo "OK, I'll ignore it.";;
*) echo "Fetching default answers from your old config.sh file..."
: get list of predefined functions
in a handy place
if test -f /lib
/libc.a
; then
echo "Your C library is in /lib/libc.a. You're normal."
if test -f /usr
/lib
/libc.a
; then
echo "Your C library is in /usr/lib/libc.a, of all places."
echo "Your C library is in $libc, like you said before."
I can't seem to find your C library. I've looked for /lib/libc.a and
/usr/lib/libc.a, but neither of those are there. What is the full name
echo $n "of your C library? $c"
rp
='C library full name?'
echo $n "Extracting names from $libc for later perusal...$c"
if ar t
$libc > libc.list
; then
echo "The archiver doesn't think $libc is a reasonable library."
: make some quick guesses about what we are up against
if $contains SIGTSTP
/usr
/include
/signal.h
>/dev
/null
2>&1 ; then
echo "Looks kind of like a BSD system, but we'll see..."
if $contains fcntl libc.list
>/dev
/null
2>&1 ; then
echo "Looks kind of like a USG system, but we'll see..."
echo "Looks kind of like a version 7 system, but we'll see..."
if $contains vmssystem libc.list
>/dev
/null
2>&1 ; then
There is, however, a strange, musty smell in the air that reminds me of
something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
: it so happens the Eunice I know will not run shell scripts
in Unix format
echo "Congratulations. You aren't running Eunice."
chmod 755 bsd usg v7 eunice
$eunicefix bsd usg v7 eunice
: see
if sh knows
# comments
echo "Checking your sh to see if it knows about # comments..."
if sh
-c '#' >/dev
/null
2>&1 ; then
echo "Your sh handles # comments correctly."
echo "Okay, let's see if #! works on this system..."
echo "#!/bin/echo hi" > try
echo "#! /bin/echo hi" > try
echo "Your sh doesn't grok # comments--I will strip them later on."
echo "exec grep -v '^#'" >spitshell
spitshell
=`pwd`/spitshell
echo "I presume that if # doesn't work, #! won't work either!"
: figure out how to guarantee sh startup
echo "Checking out how to guarantee sh startup..."
startsh
=$sharpbang'/bin/sh'
echo "Let's see if '$startsh' works..."
echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."
: find out where common programs are
echo "Locating common programs..."
pth
="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib"
if test -d \$dir/\$thing; then
if test -f \$dir/\$thing; then
xxx
=`loc $file $file $pth`
echo "I don't know where $file is. I hope it's in everyone's PATH."
echo "Don't worry if any of the following aren't found..."
xxx
=`loc $file $file $pth`
echo "I don't see $file out there, $ans."
echo "Substituting grep for egrep."
echo "Hopefully test is built into your sh."
echo $n 'Is your "test" built into sh? [n] (OK to guess) '"$c"
rp
='test built into sh? [n]'
echo "Hopefully echo is built into your sh."
echo "Checking compatibility between /bin/echo and builtin echo (if any)..."
$echo $n "hi there$c" >foo1
echo $n "hi there$c" >foo2
if cmp foo1 foo2
>/dev
/null
2>&1; then
echo "They are compatible. In fact, they may be identical."
echo "They are not compatible--the echo builtin will be used."
if $contains index libc.list
>/dev
/null
2>&1 ; then
$echo "Your system appears to use index() and rindex() rather than strchr()"
$echo $n "and strrchr(). Is this correct? [y] $c"
rp
='index() rather than strchr()? [y]'
n
*|f
*) d_index
="$define" ;;
$echo "Your system appears to use strchr() and strrchr() rather than index()"
$echo $n "and rindex(). Is this correct? [y] $c"
rp
='strchr() rather than index()? [y]'
n
*|f
*) d_index
="$undef" ;;
$echo "Checking to see if your C compiler groks the void type..."
if cc
-c try.c
>/dev
/null
2>&1 ; then
$echo "Nope, it doesn't (boo hiss). I will substitute int."
: see how we invoke the C preprocessor
echo "Checking to see how your C preprocessor is invoked..."
echo 'Maybe "cc -E" will work...'
cc
-E testcpp.c
>testcpp.out
2>&1
if $contains 'abc.xyz' testcpp.out
>/dev
/null
2>&1 ; then
echo 'Nope...maybe "cc -P" will work...'
cc
-P testcpp.c
>testcpp.out
2>&1
if $contains 'abc.xyz' testcpp.out
>/dev
/null
2>&1 ; then
echo 'Nixed again...maybe "/lib/cpp" will work...'
/lib
/cpp testcpp.c
>testcpp.out
2>&1
if $contains 'abc.xyz' testcpp.out
>/dev
/null
2>&1 ; then
echo "Hooray, it works! I was beginning to wonder."
echo 'Hmm...maybe you already told me...'
*) $cpp testcpp.c
>testcpp.out
2>&1;;
if $contains 'abc.xyz' testcpp.out
>/dev
/null
2>&1 ; then
echo "Hooray, you did! I was beginning to wonder."
echo $n "Nope. I can't find a C preprocessor. Name one: $c"
rp
='Name a C preprocessor:'
$cpp testcpp.c
>testcpp.out
2>&1
if $contains 'abc.xyz' testcpp.out
>/dev
/null
2>&1 ; then
echo "Sorry, I can't get that to work. Go find one."
rm -f testcpp.c testcpp.out
: get C preprocessor symbols handy
for (argc--,argv++; argc; argc--,argv++) {
if (strcmp(argv[0],sym[i]) == 0)
echo "Your machine appears to have the following attributes:"
$cpp Cppsym.c |
sed -n -e 's/^ "\(.*\)",$/\1/p'
: see how many register declarations we want to use
if Cppsym pdp11 i8086 z8000
; then
if Cppsym sun mc68000
; then
: if you have any other numbers
for me
, send them
in
Different C compilers on different machines pay attention to different
numbers of register declarations. About how many register declarations in
$echo $n "each routine does your C compiler pay attention to? (OK to guess) [$dflt] $c"
rp
="# register declarations used? [$dflt]"
awk "END { for (i=1; i<=16; i++) printf \"reg%d=''\n\", i}" </dev
/null
>.foo
awk "END { for (i=1; i<=$registers; i++) printf \"reg%d=register\n\", i}" \
: preserve RCS keywords
in files with variable substitution
, grrr
: set up shell
script to
do ~ expansion
$echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
if $test -f /bin/csh; then
/bin/csh -f -c "glob \$1"
name=\`$expr x\$1 : '..\([^/]*\)'\`
dir=\`$sed </etc/passwd -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}'\`
if $test ! -d "\$dir"; then
$echo "\$me: can't locate home directory for: \$name" >&2
$echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
: determine where public executables go
dflt
=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin`
while $test ! -d "$bin" ; do
*) $echo "$bin does not appear to exist." ;;
rp
="Where do you want to put the public executables? [$dflt]"
: determine where manual pages go
dflt
=`loc . /usr/man/man1 /usr/man/mann /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1`
while $test ! -d "$mansrc" ; do
*) $echo "$mansrc does not appear to exist." ;;
rp
="Where do the manual pages (source) go? [$dflt]"
: see
if we need a special compiler
if $contains '\-M' $mansrc/cc
.1 >/dev
/null
2>&1 ; then
On some systems the default C compiler will not resolve multiple global
references that happen to have the same name. On some such systems the
"Mcc" command may be used to force these to be resolved. On other systems
a "cc -M" command is required. What command will force resolution on
$echo $n "this system? [$dflt] $c"
rp
="Command to resolve multiple refs? [$dflt]"
$echo "Not a USG system--assuming cc can resolve multiple definitions."
: see
if we should throw a
-i into the Makefile
if Cppsym pdp11 i8086 z8000
; then
if $contains '\-i' $mansrc/cc
.1 >/dev
/null
2>&1 ; then
rp
="Your system appears to have separate I and D space. Is this true? [y]"
$echo "Your system appears to NOT have separate I and D space."
$echo $n "Is this correct? [y] $c"
rp
='No separate I and D. Correct? [y]'
$echo $n "Does your machine have separate I and D space? [n] $c"
$echo "End of configuration questions."
$echo "Creating config.sh..."
$spitshell <<EOT >config.sh
# This file was produced by running the Configure script.
$echo "Creating config.h..."
* This file was produced by running the Configure script.
* Feel free to modify any of this as the need arises.
#$d_eunice EUNICE /* no file linking? */
#$d_eunice VMS /* other assorted ickies? */
#$d_index index strchr /* cultural */
#$d_index rindex strrchr /* differences? */
#$d_void void int /* is void to be avoided? */
/* How many register declarations are paid attention to? */
#define Reg10 $reg10 /**/
#define Reg11 $reg11 /**/
#define Reg12 $reg12 /**/
#define Reg13 $reg13 /**/
#define Reg14 $reg14 /**/
#define Reg15 $reg15 /**/
#define Reg16 $reg16 /**/
if $contains '\.SH' MANIFEST
>/dev
/null
2>&1; then
$echo "Doing variable substitutions on .SH files..."
set `$grep <MANIFEST '\.SH' | awk '{print $1}'`
dir
=`$expr X$file : 'X\(.*\)/'`
file=`$expr X$file : 'X.*/\(.*\)'`
if $contains '^depend:' Makefile
>/dev
/null
2>&1; then
$echo 'Now you need to generate make dependencies by running "make depend".'
$echo 'You might prefer to run it in background: "make depend > makedepend.out &"'
$echo $n "Would you like me to run it for you (it takes quite a while)? [n] $c"
rp
="Run make depend now? [n]"
$rm -f libc.list kit
*isdone bsd usg v7 eunice loc Cppsym
if test -f Makefile
; then
$echo "Now you must run a make."