: 'Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1984, 1985.'
echo "Configuration questions for the B system."
: 'Determine if echo -n works'
if grep n .bleep >/dev/null 2>&1
echo $n "Figuring out what machine you have "
echo "This machine appears to be a VAX."
n*|N*|f*|F*) machine="other"
echo "This machine appears to be a PDP."
n*|N*|f*|F*) machine="other"
echo "Your machine does not appear to be a VAX or PDP."
echo $n "Is this a small machine (less than 190K code space)? "
echo "Since your machine may not be a VAX or PDP, you might have to edit"
echo "the configuration file for the B interpreter '$bint'."
echo "Check the remarks in b0con.h and README in ./src/$bint."
echo "Since you have a small system, we can only use the old"
echo "version of the B interpreter, named $bint."
echo "See the file ./src/bsmall/README for details."
echo "The B editor is too big in its full glory."
echo "Therefore all kinds of features will be turned off in an"
echo "attempt to make it fit."
echo "See ./src/bed/feat.h for details."
echo $n "Finding out about your brand of unix "
printf("unknown\n"); /* Version 7 we hope ... */
echo "You appear to be running Berkeley's BSD unix, version 4.2 (or later)."
n*|N*|f*|F*) unix="unknown";;
echo "You appear to be running Berkeley's BSD unix."
n*|N*|f*|F*) unix="unknown";;
echo "You appear to be running ATT's System III or System V unix."
n*|N*|f*|F*) unix="unknown";;
echo $n "Are you running PWB Unix? "
echo "We cannot find out what type of unix you are running."
echo "See ./src/bed/unix.h, ./src/bed/feat.h, /src/$bint/README"
echo "and ./src/$bint/b0con.h in case of problems."
: 'Floating point arithmetic ok?'
double dadd(a, b) double a, b; {
cc -O float.c -o float >/dev/null 2>&1
echo "Your floating point seems to be alright."
echo "Your C compiler seems to need a special flag for"
echo "loading (probably software) floating point routines."
echo $n "What flag is needed (default -f) "
cc -O $fflag float.c -o float >/dev/null 2>&1
until sh 2>/dev/null <<EOF
echo "This flag doesn't seem to work."
echo "Try again (default -f) "
cc -O $fflag float.c -o float >/dev/null 2>&1
if test -r /usr/include/termio.h
if test ! -r /usr/include/sgtty.h
echo "Neither termio.h nor sgtty.h found."
echo "See ./src/bed/unix.h in case of problems."
: 'termcap library for B editor'
echo $n "Searching for your termcap-like library routines "
if test -r /lib/libtermcap.a -o -r /usr/lib/libtermcap.a
echo "termcap library found."
elif test -r /usr/local/lib/libtermcap.a
termlib="/usr/local/lib/libtermcap.a"
echo "local termcap library found."
elif test -r /lib/libtermlib.a -o -r /usr/lib/libtermlib.a
echo "termlib library found."
elif test -r /usr/local/lib/libtermlib.a
termlib="/usr/local/lib/libtermlib.a"
echo "local termlib library found."
elif test -r /lib/libcurses.a -o -r /usr/lib/libcurses.a
echo "terminfo library found."
elif test -r /usr/local/lib/libcurses.a
termlib="/usr/local/lib/libcurses.a"
echo "local terminfo library found."
: 'changed for 4.3 BSD release'
while test "$termlib" = "ask_it" -o "$termlib" = "try_again"; do
echo "Please specify where the termcap-like routines are kept"
echo $n " (either full pathname or -lxxx option) "
echo $n "Please try again (full pathname or -lyyy option) "
echo "Hope $termlib will do the job."
echo "Ok, we will try that one."
echo "$termlib does not appear to exist."
echo "$termlib is not a valid library specification."
: 'termcap database, commented out for 4.3 BSD'
# echo "Termcap database found."
# echo "No termcap database found; we will install our own, to be used"
# echo "when your TERMCAP environment variable is not set."
: 'Shall we make B public?'
echo $n "Will you want to make B publically available? "
while test ! -d "$bdir" ; do
echo "Please type the full pathname of a directory"
echo "in which you have write permission,"
echo "and where you want the 'b' command file installed"
echo $n " (default $bdef) "
*) echo "$bdir does not appear to exist."
echo $n "Are you sure you typed the right name? "
y*|Y*) echo "Don't forget to make $bdir before 'make install'."
echo $n "Please try again (default $bdef) "
while test ! -d "$libdir" ; do
echo "Please type the full pathname of the directory"
echo "where you want to install the auxiliary binaries"
echo "and datafiles needed by the B system"
echo $n " (default $libdef) "
*) echo "$libdir does not appear to exist."
echo $n "Are you sure you typed the right name? "
*|Y*) echo "Don't forget to make $libdir before 'make install'."
echo $n "Please try again (default $libdef) "
while test ! -d "$man1dir" ; do
echo "Please type the full pathname of the directory"
echo "where you want to install the 'b.1' manual page"
echo $n " (default $man1def) "
*) echo "$man1dir does not appear to exist."
echo $n "Are you sure you typed the right name? "
y*|Y*) echo "Don't forget to make $man1dir before 'make install'."
echo $n "Please try again (default $man1def) "
while test ! -d "$man5dir" ; do
echo "Please type the full pathname of the directory"
echo "where you want to install the 'bterminal.5' manual page"
echo $n " (default $man5def) "
*) echo "$man5dir does not appear to exist."
echo $n "Are you sure you typed the right name? "
y*|Y*) echo "Don't forget to make $man5dir before 'make install'."
echo $n "Please try again (default $man5def) "
echo $n "Please try again "
echo "End of configuration questions for the B system."
: 'Getting generic copies of makefiles and shellfiles.'
: 'Since some tar_s leave the owner of the tape as the owner of the files'
: 'this will make sure the edit scripts will not fail.'
makefiles="./Makefile src/b/Makefile src/bed/Makefile src/bint/Makefile src/bsmall/Makefile"
shellfiles="src/b/b.sh src/b/b_p.sh"
# This file was generated and edited by the Setup command.
# To make lasting changes edit the file Makefile.gen and run Setup again.
echo $n "Editing Appropriate files ... "
/^LDFLAGS=/s?LDFLAGS=.*?LDFLAGS= -i?
/^LDFLAGS=/s?LDFLAGS=.*?LDFLAGS= -i?
: 'Not all CFLAGS are used by all sources.'
: 'But for convenience and future use, we put them into all source Makefiles.'
cflags="-O $fflag -DNDEBUG"
for f in Makefile src/b/b.sh src/bed/Makefile
/^BINT=/s?BINT=.*?BINT=$bint?
/examples$/s?make .*examples?make smallexamples?
cflags="$cflags -DSMALLSYS"
cflags="$cflags -Dindex=strchr -Drindex=strrchr"
cflags="$cflags -DTERMIO"
for f in src/b/Makefile src/bed/Makefile src/$bint/Makefile
/^CFLAGS=/s?CFLAGS=.*?CFLAGS= $cflags?
/^TERMLIB=/s?.*?TERMLIB= $termlib?
/^OWNTLIB=/s?.*?OWNTLIB=?
/^TERMLIB=/s?.*?TERMLIB=?
/^OWNTLIB=/s?.*?OWNTLIB= libtermcap.a?
# /^install:/s?.*?install: all ldest termcap?
/^BDIR=/s?BDIR=.*?BDIR=$bdir?
/^MAN1DIR=/s?MAN1DIR=.*?MAN1DIR=$man1dir?
/^MAN5DIR=/s?MAN5DIR=.*?MAN5DIR=$man5dir?
/^LIBDIR=/s?LIBDIR=.*?LIBDIR=$libdir?
echo "This completes the setup of the B system."
echo "You can now try 'make all'."