Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CF-1.1 library. Part02/03

0 views
Skip to first unread message

Jan-Piet Mens

unread,
Jan 18, 1993, 10:20:39 AM1/18/93
to
#! /bin/sh
#
# This is CF version 1.1 at patchlevel 1.
# Make a new directory for the CF sources, cd to it, and run kits 1 up
# to 3 through sh. When all 3 kits have been run, read README.
#
echo " "
echo "This is CF 1.1 at patchlevel 1, kit 2 (of 3):"
echo " End of kit 2 (of 3)"
echo "will echo at the end if this kit is complete."
export PATH || (echo "Please use sh to unpack this archive." ; kill $$)
mkdir 2>/dev/null
echo Extracting Configure
sed >Configure <<'!STUFFY!FUNK!' -e 's/X//'
X#! /bin/sh
X#
X# If these # comments don't work, trim them. Don't worry about any
X# other shell scripts, Configure will trim # comments from them for you.
X#
X# (If you are trying to port this package to a machine without sh,
X# I would suggest you have a look at the prototypical config_h.SH file
X# and edit it to reflect your system. Some packages may include samples
X# of config.h for certain machines, so you might look for one of those.)
X#
X# Yes, you may rip this off to use in other distribution packages. This
X# script belongs to the public domain and cannot be copyrighted.
X#
X# (Note: this Configure script was generated automatically. Rather than
X# working with this copy of Configure, you may wish to get metaconfig.
X# Write to either:
X#
X# har...@mumps.pfcs.com (Harlan Stenn)
X# r...@eiffel.com (Raphael Manfredi)
X#
X# and we will send you -or point you to- the latest revision of the dist
X# package, which includes metaconfig.)
X#
X
X# $Id: Configure,v 1.1 1993/01/18 14:48:06 jpm Exp $
X#
X# Generated on Mon Jan 18 14:39:19 MET 1993 [metaconfig 2.9dev PL8]
X
Xcat >/tmp/c1$$ <<EOF
XARGGGHHHH!!!!!
X
XSCO csh still thinks true is false. Write to SCO today and tell them that next
Xyear Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
X
X(Actually, Configure ought to just patch csh in place. Hmm. Hmmmmm. All
Xwe'd have to do is go in and swap the && and || tokens, wherever they are.)
X
X[End of diatribe. We now return you to your regularly scheduled programming...]
XEOF
Xcat >/tmp/c2$$ <<EOF
XOOPS! You naughty creature! You didn't run Configure with sh!
XI will attempt to remedy the situation by running sh for you...
X
XEOF
X
Xtrue || cat /tmp/c1$$ /tmp/c2$$
Xtrue || exec sh $0 $*
X
Xexport PATH || cat /tmp/c2$$
Xexport PATH || exec sh $0 $*
Xrm -f /tmp/c1$$ /tmp/c2$$
X
X: Sanity checks
XPATH=".:$PATH:/bin:/usr/bin:/usr/local/bin:/usr/ucb:/usr/local:/usr/lbin"
XPATH=$PATH:'/usr/5bin:/etc:/usr/gnu/bin:/usr/new:/usr/new/bin:/usr/nbin'
XPATH=$PATH:'/sys5.3/bin:/sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb'
XPATH=$PATH:'/bsd4.3/usr/bin:/usr/bsd:/bsd43/bin:/usr/ccs/bin'
XPATH=$PATH:'/etc:/usr/lib:/lib:/usr/ccs/lib'
Xexport PATH
X
Xif test ! -t 0; then
X echo "Say 'sh Configure', not 'sh <Configure'"
X exit 1
Xfi
X
X: Warn them if they use ksh
X(alias) >/dev/null 2>&1 && \
X cat <<'EOM'
X(I see you are using the Korn shell. Some ksh's blow up on Configure,
Xespecially on exotic machines. If yours does, try the Bourne shell instead.)
XEOM
X
X: Configure runs within the UU subdirectory
Xtest -d UU || mkdir UU
Xcd UU && rm -f *
X
Xcf_by=''
Xcf_time=''
Xd_bsd=''
Xd_eunice=''
Xd_xenix=''
Xeunicefix=''
XMcc=''
Xawk=''
Xbison=''
Xcat=''
Xchgrp=''
Xchmod=''
Xchown=''
Xcompress=''
Xcp=''
Xcpio=''
Xcpp=''
Xcsh=''
Xdate=''
Xecho=''
Xegrep=''
Xemacs=''
Xexpr=''
Xflex=''
Xgcc=''
Xgrep=''
Xinews=''
Xless=''
Xline=''
Xlint=''
Xln=''
Xlp=''
Xlpr=''
Xls=''
Xmail=''
Xmailx=''
Xmake=''
Xmkdir=''
Xmore=''
Xmv=''
Xnroff=''
Xperl=''
Xpg=''
Xpmake=''
Xpr=''
Xrm=''
Xrmail=''
Xsed=''
Xsendmail=''
Xshar=''
Xsleep=''
Xsmail=''
Xsort=''
Xsubmit=''
Xtail=''
Xtar=''
Xtbl=''
Xtest=''
Xtouch=''
Xtr=''
Xtroff=''
Xuname=''
Xuniq=''
Xuuname=''
Xvi=''
Xzcat=''
Xhint=''
Xmyuname=''
XAuthor=''
XDate=''
XHeader=''
XId=''
XLocker=''
XLog=''
XRCSfile=''
XRevision=''
XSource=''
XState=''
Xcc=''
Xccflags=''
Xcppflags=''
Xldflags=''
Xlkflags=''
Xoptimize=''
Xcf_default=''
Xcontains=''
Xcppminus=''
Xcppstdin=''
Xd_catgets=''
Xd_catopen=''
Xd_index=''
Xd_open3=''
Xd_portable=''
Xd_strerrm=''
Xd_strerror=''
Xd_sysernlst=''
Xd_syserrlst=''
Xgencat=''
Xh_fcntl=''
Xh_sysfile=''
Xi_fcntl=''
Xi_limits=''
Xi_stdarg=''
Xi_string=''
Xstrings=''
Xi_varargs=''
Xi_varhdr=''
Xinc=''
Xlib=''
Xlintlib=''
Xlibc=''
Xlibpth=''
Xplibpth=''
Xxlibpath=''
Xlibs=''
Xmallocobj=''
Xmallocsrc=''
Xmalloctype=''
Xusemymalloc=''
Xmanext=''
Xmansrc=''
Xc=''
Xn=''
Xorderlib=''
Xranlib=''
Xpackage=''
Xpidtype=''
Xprototype=''
Xsharpbang=''
Xshsharp=''
Xspitshell=''
Xstartsh=''
Xsysman=''
Xnm_opt=''
Xrunnm=''
Xusenm=''
Xincpath=''
Xmips=''
Xmips_type=''
Xusrinc=''
Xcppflags=''
Xd_whoami=''
Xi_sysfile=''
Xi_sysselct=''
Xlarge=''
XCONFIG=''
X
X: script used to extract .SH files with variable substitutions
Xcat >extract <<'EOS'
XCONFIG=true
Xecho "Doing variable substitutions on .SH files..."
Xif test -f MANIFEST; then
X set x `awk '{print $1}' <MANIFEST | $grep '\.SH'`
Xelse
X echo "(Looking for .SH files under the current directory.)"
X set x `find . -name "*.SH" -print`
Xfi
Xshift
Xcase $# in
X0) set x *.SH; shift;;
Xesac
Xif test ! -f $1; then
X shift
Xfi
Xfor file in $*; do
X case "$file" in
X */*)
X dir=`$expr X$file : 'X\(.*\)/'`
X file=`$expr X$file : 'X.*/\(.*\)'`
X (cd $dir && . $file)
X ;;
X *)
X . $file
X ;;
X esac
Xdone
Xif test -f config_h.SH; then
X if test ! -f config.h; then
X : oops, they left it out of MANIFEST, probably, so do it anyway.
X . config_h.SH
X fi
Xfi
XEOS
X
X: process the command line options
Xset X `for arg in "$@"; do echo $arg; done | awk '
XBEGIN {
X optstr = "deEf:hrsSV"; # getopt-style specification
X
X len = length(optstr);
X for (i = 1; i <= len; i++) {
X c = substr(optstr, i, 1);
X if (i < len) a = substr(optstr, i + 1, 1); else a = "";
X if (a == ":") {
X arg[c] = 1;
X i++;
X }
X opt[c] = 1;
X }
X}
X{
X expect = 0;
X str = $0;
X if (substr(str, 1, 1) != "-") {
X printf("'"'%s'"'\n", str);
X next;
X }
X len = length($0);
X for (i = 2; i <= len; i++) {
X c = substr(str, i, 1);
X if (!opt[c]) {
X printf("-%s\n", substr(str, i));
X next;
X }
X printf("-%s\n", c);
X if (arg[c]) {
X if (i < len)
X printf("'"'%s'"'\n", substr(str, i + 1));
X else
X expect = 1;
X next;
X }
X }
X}
XEND {
X if (expect)
X print "?";
X}
X'`
Xeval "set $*"
Xshift
X
X: set up default values
Xreuseval=false
Xconfig_sh=''
Xalldone=''
Xerror=''
Xsilent=''
Xextractsh=''
X
X: option parsing
Xwhile test $# -gt 0; do
X case "$1" in
X -d) shift; fastread=yes;;
X -e) shift; alldone=cont;;
X -f)
X shift
X cd ..
X if test -r "$1"; then
X config_sh="$1"
X else
X echo "Configure: cannot read config file $1." >&2
X error=true
X fi
X cd UU
X shift;;
X -h) shift; error=true;;
X -r) shift; reuseval=true;;
X -s) shift; silent=true;;
X -E) shift; alldone=exit;;
X -S) shift; extractsh=true;;
X -V) echo "Configure generated by metaconfig 2.9dev PL8." >&2
X exit 0;;
X --) break;;
X -*) echo "Configure: unknown option $1" >&2; shift; error=true;;
X *) break;;
X esac
Xdone
X
Xcase "$error" in
Xtrue)
X cat >&2 <<EOM
XUsage: Configure [-dehrESV] [-f config.sh]
X -d : use defaults for all answers.
X -e : go on without questioning past the production of config.sh.
X -f : specify an alternate default configuration file.
X -h : print this help message and exit (with an error status).
X -r : reuse C symbols value if possible (skips costly nm extraction).
X -s : silent mode, only echoes questions and essential information.
X -E : stop at the end of questions, after having produced config.sh.
X -S : perform variable substitutions on all .SH files (can mix with -f)
X -V : print version number and exit (with a zero status).
XEOM
X exit 1
X ;;
Xesac
X
Xexec 3>&1
Xcase "$silent" in
Xtrue) exec 1>/dev/null;;
Xesac
X
Xcase "$extractsh" in
Xtrue)
X case "$config_sh" in
X '') config_sh='config.sh'; config='./config.sh';;
X /*) config="$config_sh";;
X *) config="./$config_sh";;
X esac
X echo " "
X echo "Fetching answers from $config_sh..."
X cd ..
X . $config
X echo " "
X . ./UU/extract
X rm -rf UU
X echo "Done."
X exit 0
X ;;
Xesac
X
X: set package name
Xpackage=CF
X
X: Eunice requires " " instead of "", can you believe it
Xecho " "
X: Here we go...
Xecho "Beginning of configuration questions for $package kit."
X
Xdefine='define'
Xundef='undef'
Xsmallmach='pdp11 i8086 z8000 i80286 iAPX286'
Xrmlist=''
X
Xtrap 'echo " "; rm -rf $rmlist; exit 1' 1 2 3 15
X
X: We must find out about Eunice early
Xeunicefix=':'
Xif test -f /etc/unixtovms; then
X eunicefix=/etc/unixtovms
Xfi
Xif test -f /etc/unixtovms.exe; then
X eunicefix=/etc/unixtovms.exe
Xfi
X
X: no include file wanted by default
Xinclwanted=''
X
X: change the next line if compiling for Xenix/286 on Xenix/386
Xxlibpath='/usr/lib/386 /lib/386'
X
X: general looking path for locating libraries
Xlibpth='/usr/lib/large /lib '$xlibpth' /lib/large'
Xlibpth=$libpth' /usr/lib/small /lib/small'
X
X
X: Some greps do not return status, grrr.
Xecho "grimblepritz" >grimble
Xif grep blurfldyick grimble >/dev/null 2>&1 ; then
X contains=contains
Xelif grep grimblepritz grimble >/dev/null 2>&1 ; then
X contains=grep
Xelse
X contains=contains
Xfi
Xrm -f grimble
X: the following should work in any shell
Xcase "$contains" in
Xcontains*)
X echo " "
X echo "AGH! Grep doesn't return a status. Attempting remedial action."
X cat >contains <<'EOSS'
Xgrep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
XEOSS
Xchmod +x contains
Xesac
X
X: first determine how to suppress newline on echo command
Xecho " "
Xecho "Checking echo to see how to suppress newlines..."
X(echo "hi there\c" ; echo " ") >.echotmp
Xif $contains c .echotmp >/dev/null 2>&1 ; then
X echo "...using -n."
X n='-n'
X c=''
Xelse
X cat <<'EOM'
X...using \c
XEOM
X n=''
X c='\c'
Xfi
Xecho $n "The star should be here-->$c"
Xecho '*'
Xrm -f .echotmp
X
X: compute the number of columns on the terminal for proper question formatting
Xcase "$COLUMNS" in
X'') COLUMNS='80';;
Xesac
X
X: set up the echo used in my read
Xmyecho="case \"\$xxxm\" in
X'') echo $n \"\$rp $c\" >&3;;
X*) case \"\$rp\" in
X '') echo $n \"[\$xxxm] $c\";;
X *)
X if test \`echo \"\$rp [\$xxxm] \" | wc -c\` -ge $COLUMNS; then
X echo \"\$rp\" >&3
X echo $n \"[\$xxxm] $c\" >&3
X else
X echo $n \"\$rp [\$xxxm] $c\" >&3
X fi
X ;;
X esac;;
Xesac"
X
X: now set up to do reads with possible shell escape and default assignment
Xcat <<EOSC >myread
Xxxxm=\$dflt
X$myecho
Xans='!'
Xcase "\$fastread" in
Xyes) case "\$dflt" in
X '') ;;
X *) ans='';
X case "\$silent-\$rp" in
X true-) ;;
X *) echo " " >&3;;
X esac;;
X esac;;
X*) case "\$silent" in
X true) case "\$rp" in
X '') ans='';;
X esac;;
X esac;;
Xesac
Xwhile expr "X\$ans" : "X!" >/dev/null; do
X read answ
X set x \$xxxm
X shift
X aok=''; eval "ans=\"\$answ\"" && aok=y
X case "\$answ" in
X "\$ans")
X case "\$ans" in
X !)
X sh
X echo " "
X $myecho
X ;;
X !*)
X set x \`expr "X\$ans" : "X!\(.*\)\$"\`
X shift
X sh -c "\$*"
X echo " "
X $myecho
X ;;
X esac;;
X *)
X case "\$aok" in
X y)
X echo "*** Substitution done -- please confirm."
X xxxm="\$ans"
X ans=\`echo $n "\$ans$c" | tr '\012' ' '\`
X xxxm="\$ans"
X ans=!
X ;;
X *)
X echo "*** Error -- try again."
X ans=!
X ;;
X esac
X $myecho
X ;;
X esac
Xdone
Xcase "\$ans" in
X'') ans="\$xxxm";;
Xesac
XEOSC
X
X: general instructions
Xcat <<EOH
X
XThis installation shell script will examine your system and ask you questions
Xto determine how the CF package should be installed. If you get stuck
Xon a question, you may use a ! shell escape to start a subshell or execute a
Xcommand. Many of the questions will have default answers in square brackets;
Xtyping carriage return will give you the default.
X
XOn some of the questions which ask for file or directory names you are allowed
Xto use the ~name construct to specify the login directory belonging to "name",
Xeven if you don't have a shell which knows about that. Questions where this is
Xallowed will be marked "(~name ok)".
X
XEOH
Xrp=''
Xdflt='Type carriage return to continue'
X. myread
Xcat <<'EOH'
X
XThe prompter used in this script allows you to use shell variables and
Xbackticks in your answers. You may use $1, $2, etc... to refer to the words
Xin the default answer, as if the default line was a set of arguments given to a
Xscript shell. This means you may also use $* to repeat the whole default line,
Xso you do not have to re-type everything to add something to the default.
X
XEverytime there is a substitution, you will have to confirm. If there is an
Xerror (e.g. an unmatched backtick), the default answer will remain unchanged
Xand you will be prompted again.
X
XIf you are in a hurry, you may run 'Configure -d'. This will bypass nearly all
Xthe questions and use the computed defaults (or the previous answers if there
Xwas already a config.sh file).
X
XEOH
X. myread
Xcat <<EOH
X
XMuch effort has been expended to ensure that this shell script will run on any
XUnix system. If despite that it blows up on yours, your best bet is to edit
XConfigure and run it again. Also, let me (j...@Logix.DE)
Xknow how I blew it. If you can't run Configure for some reason, you'll have to
Xgenerate a config.sh file by hand.
X
XThis installation script affects things in two ways:
X
X1) it may do direct variable substitutions on some of the files included
X in this kit.
X2) it builds a config.h file for inclusion in C programs. You may edit
X any of these files as the need arises after running this script.
X
XIf you make a mistake on a question, there is no easy way to back up to it
Xcurrently. The easiest thing to do is to edit config.sh and rerun all the SH
Xfiles. Configure will offer to let you do this before it runs the SH files.
X
XEOH
Xdflt='Type carriage return to continue'
X. myread
X
X: see if sh knows # comments
Xecho " "
Xecho "Checking your sh to see if it knows about # comments..." >&3
Xif sh -c '#' >/dev/null 2>&1 ; then
X echo "Your sh handles # comments correctly."
X shsharp=true
X spitshell=cat
X echo " "
X echo "Okay, let's see if #! works on this system..."
X echo "#!/bin/cat" >try
X $eunicefix try
X chmod +x try
X try > today
X if test -s today; then
X echo "It does."
X sharpbang='#!'
X else
X echo "#! /bin/cat" > try
X $eunicefix try
X chmod +x try
X try > today
X if test -s today; then
X echo "It does."
X sharpbang='#! '
X else
X echo "It doesn't."
X sharpbang=': use '
X fi
X fi
Xelse
X echo "Your sh doesn't grok # comments--I will strip them later on."
X shsharp=false
X echo "exec grep -v '^[ ]*#'" >spitshell
X chmod +x spitshell
X $eunicefix spitshell
X spitshell=`pwd`/spitshell
X echo "I presume that if # doesn't work, #! won't work either!"
X sharpbang=': use '
Xfi
Xrm -f try today
X
X: figure out how to guarantee sh startup
Xecho " "
Xecho "Checking out how to guarantee sh startup..." >&3
Xstartsh=$sharpbang'/bin/sh'
Xecho "Let's see if '$startsh' works..."
Xcat >try <<EOSS
X$startsh
Xset abc
Xtest "$?abc" != 1
XEOSS
X
Xchmod +x try
X$eunicefix try
Xif try; then
X echo "Yup, it does."
Xelse
Xecho "Nope. You may have to fix up the shell scripts to make sure sh runs them."
Xfi
Xrm -f try
X
X: find out where common programs are
Xecho " "
Xecho "Locating common programs..." >&3
Xcat <<EOSC >loc
X$startsh
Xcase \$# in
X0) exit 1;;
Xesac
Xthing=\$1
Xshift
Xdflt=\$1
Xshift
Xfor dir in \$*; do
X case "\$thing" in
X .)
X if test -d \$dir/\$thing; then
X echo \$dir
X exit 0
X fi
X ;;
X *)
X if test -f \$dir/\$thing; then
X echo \$dir/\$thing
X exit 0
X elif test -f \$dir/\$thing.exe; then
X : on Eunice apparently
X echo \$dir/\$thing
X exit 0
X fi
X ;;
X esac
Xdone
Xecho \$dflt
Xexit 1
XEOSC
Xchmod +x loc
X$eunicefix loc
Xloclist="
Xawk
Xcat
Xecho
Xexpr
Xgrep
Xrm
Xsed
Xtr
X"
Xtrylist="
XMcc
Xcpp
Xdate
Xnroff
Xtest
Xuname
X"
Xpth=`echo $PATH | sed -e 's/:/ /g'`
Xpth="$pth /lib /usr/lib"
Xfor file in $loclist; do
X xxx=`./loc $file $file $pth`
X eval $file=$xxx
X eval _$file=$xxx
X case "$xxx" in
X /*)
X echo $file is in $xxx.
X ;;
X *)
X echo "I don't know where $file is. I hope it's in everyone's PATH."
X ;;
X esac
Xdone
Xecho " "
Xecho "Don't worry if any of the following aren't found..."
Xans=offhand
Xfor file in $trylist; do
X xxx=`./loc $file $file $pth`
X eval $file=$xxx
X eval _$file=$xxx
X case "$xxx" in
X /*)
X echo $file is in $xxx.
X ;;
X *)
X echo "I don't see $file out there, $ans."
X ans=either
X ;;
X esac
Xdone
Xcase "$egrep" in
Xegrep)
X echo "Substituting grep for egrep."
X egrep=$grep
X ;;
Xesac
Xcase "$test" in
Xtest)
X echo "Hopefully test is built into your sh."
X ;;
X/bin/test)
X if sh -c "PATH= test true" >/dev/null 2>&1; then
X echo "Using the test built into your sh."
X test=test
X fi
X ;;
X*)
X test=test
X ;;
Xesac
Xcase "$echo" in
Xecho)
X echo "Hopefully echo is built into your sh."
X ;;
X/bin/echo)
X echo " "
Xecho "Checking compatibility between /bin/echo and builtin echo (if any)..." >&3
X $echo $n "hi there$c" >foo1
X echo $n "hi there$c" >foo2
X if cmp foo1 foo2 >/dev/null 2>&1; then
X echo "They are compatible. In fact, they may be identical."
X else
X case "$n" in
X '-n') n='' c='\c';;
X *) n='-n' c='';;
X esac
X cat <<FOO
XThey are not compatible! You are probably running ksh on a non-USG system.
XI'll have to use /bin/echo instead of the builtin, since Bourne shell doesn't
Xhave echo built in and we may have to run some Bourne shell scripts. That
Xmeans I'll have to use $ans to suppress newlines now. Life is ridiculous.
X
XFOO
X $echo $n "The star should be here-->$c"
X $echo "*"
X fi
X $rm -f foo1 foo2
X ;;
X*)
X : cross your fingers
X echo=echo
X ;;
Xesac
X
X: Try to determine whether config.sh was made on this system
Xcase "$config_sh" in
X'')
X: indentation wrong on purpose--RAM
Xmyuname=`( ($uname -a) 2>/dev/null || hostname) 2>&1`
Xdflt=n
Xif test -f ../config.sh; then
X xxx=$myuname
X eval "`grep myuname= ../config.sh`"
X if test "X$xxx" = "X$myuname"; then
X dflt=y
X fi
Xfi
X
X: Get old answers from old config file if Configure was run on the
X: same system, otherwise use the hints.
Xhint=default
Xcd ..
Xif test -f config.sh; then
X echo " "
X rp="I see a config.sh file. Did Configure make it on THIS system?"
X . UU/myread
X case "$ans" in
X n*|N*) echo "OK, I'll ignore it."; mv config.sh config.sh.old;;
X *) echo "Fetching default answers from your old config.sh file..." >&3
X tmp="$n"
X ans="$c"
X . ./config.sh
X cp config.sh UU
X n="$tmp"
X c="$ans"
X hint=previous
X ;;
X esac
Xfi
Xif test ! -f config.sh; then
X $cat <<EOM
X
XFirst time through, eh? I have some defaults handy for the following systems:
X
XEOM
X cd hints; ls -C *.sh | $sed 's/\.sh/ /g' >&3
X dflt=''
X : Half the following guesses are probably wrong... If you have better
X : tests or hints, please send them to j...@Logix.DE
X : The metaconfig authors would also appreciate a copy...
X $test -f /irix && dflt="$dflt sgi"
X $test -f /xenix && dflt="$dflt sco_xenix"
X $test -f /dynix && dflt="$dflt dynix"
X $test -f /dnix && dflt="$dflt dnix"
X $test -f /bin/mips && /bin/mips && dflt="$dflt mips"
X $test -d /NextApps && test -f /usr/adm/software_version && dflt="$dflt next"
X if $test -f $uname; then
X set `$uname -a | tr '[A-Z]' '[a-z]'`
X
X $test -f $5.sh && dflt="$dflt $5"
X
X case "$5" in
X fps*) dflt="$dflt fps";;
X mips*) dflt="$dflt mips";;
X [23]100) dflt="$dflt mips";;
X next*) dflt="$dflt next" ;;
X news*) dflt="$dflt news" ;;
X esac
X
X case "$1" in
X aix) dflt="$dflt aix_rs" ;;
X sunos) case "$3" in
X 3.4) dflt="$dflt sunos_3_4" ;;
X 3.5) dflt="$dflt sunos_3_5" ;;
X 4.0.1) dflt="$dflt sunos_4_0_1" ;;
X 4.0.2) dflt="$dflt sunos_4_0_2" ;;
X esac
X ;;
X dnix) dflt="$dflt dnix" ;;
X dgux) dflt="$dflt dgux" ;;
X genix) dflt="$dflt genix" ;;
X hp*ux) dflt="$dflt hpux" ;;
X next) dflt="$dflt next" ;;
X irix) dflt="$dflt sgi" ;;
X ultrix) case "$3" in
X 3*) dflt="$dflt ultrix_3" ;;
X 4*) dflt="$dflt ultrix_4" ;;
X esac
X ;;
X uts) dflt="$dflt uts" ;;
X $2) if test -f /etc/systemid; then
X set `echo $3 | sed 's/\./ /'` $4
X if $test -f sco_$1_$2_$3.sh; then
X dflt="$dflt sco_$1_$2_$3"
X elif $test -f sco_$1_$2.sh; then
X dflt="$dflt sco_$1_$2"
X elif $test -f sco_$1.sh; then
X dflt="$dflt sco_$1"
X fi
X fi
X ;;
X esac
X else
X if test -f /vmunix; then
X (what /vmunix | tr '[A-Z]' '[a-z]') > ../UU/kernel.what 2>&1
X if $contains news-os ../UU/kernel.what >/dev/null 2>&1; then
X dflt="$dflt news_os"
X fi
X $rm -f ../UU/kernel.what
X fi
X fi
X set X `echo $dflt | tr ' ' '\012' | sort | uniq`
X shift
X dflt=''
X for file in $*; do
X if $test -f "$file.sh"; then
X dflt="$dflt $file"
X fi
X done
X set X $dflt
X shift
X dflt=${1+"$@"}
X case "$dflt" in
X '') dflt=none;;
X esac
X $cat <<EOM
X
XYou may give one or more space-separated answers, or "none" if appropriate.
XIf your OS version has no hints, DO NOT give a wrong version -- say "none".
X
XEOM
X rp="Which of these apply, if any?"
X . ../UU/myread
X for file in $ans; do
X if $test -f $file.sh; then
X . ./$file.sh
X $cat $file.sh >> ../UU/config.sh
X fi
X done
X hint=recommended
X cd ..
Xfi
Xcd UU
X: remember, indentation is wrong--RAM
X;;
X*)
X echo " "
X echo "Fetching default answers from $config_sh..." >&3
X tmp="$n"
X ans="$c"
X cd ..
X cp $config_sh config.sh 2>/dev/null
X . ./config.sh
X cd UU
X cp ../config.sh .
X n="$tmp"
X c="$ans"
X hint=previous
X ;;
Xesac
X
X: Restore computed paths
Xfor file in $loclist $trylist; do
X eval $file="\$_$file"
Xdone
X
X: decide how portable to be
Xcase "$d_portable" in
X"$define") dflt=y;;
X*) dflt=n;;
Xesac
X$cat <<'EOH'
X
XI can set things up so that your shell scripts and binaries are more portable,
Xat what may be a noticable cost in performance. In particular, if you
Xask to be portable, the following happens:
X
X 1) Shell scripts will rely on the PATH variable rather than using
X the paths derived above.
X 2) ~username interpretations will be done at run time rather than
X by Configure.
X
XEOH
Xrp="Do you expect to run these scripts and binaries on multiple machines?"
X. myread
Xcase "$ans" in
X y*) d_portable="$define"
X for file in $loclist; do
X eval $file=$file
X done
X ;;
X *) d_portable="$undef" ;;
Xesac
X
X: set up shell script to do ~ expansion
Xcat >filexp <<EOSS
X$startsh
X: expand filename
Xcase "\$1" in
X ~/*|~)
X echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
X ;;
X ~*)
X if $test -f /bin/csh; then
X /bin/csh -f -c "glob \$1"
X failed=$?
X echo ""
X exit \$failed
X else
X name=\`$expr x\$1 : '..\([^/]*\)'\`
X dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
X if $test ! -d "\$dir"; then
X me=\`basename \$0\`
X echo "\$me: can't locate home directory for: \$name" >&2
X exit 1
X fi
X case "\$1" in
X */*)
X echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
X ;;
X *)
X echo \$dir
X ;;
X esac
X fi
X ;;
X*)
X echo \$1
X ;;
Xesac
XEOSS
Xchmod +x filexp
X$eunicefix filexp
X
X: now set up to get a file name with possible "~name" substitutions
Xcat <<'EOSC' >getfile
Xtilde=''
Xfullpath=''
Xalready=''
Xskip=''
Xnone_ok=''
Xorig_rp="$rp"
Xorig_dflt="$dflt"
X
Xcase "$fn" in
X*~*) tilde=true;;
Xesac
Xcase "$fn" in
X*/*) fullpath=true;;
Xesac
Xcase "$fn" in
X*+*) skip=true;;
Xesac
Xcase "$fn" in
X*n*) none_ok=true;;
Xesac
X
Xcase "$fn" in
X*f*) type='File';;
X*d*) type='Directory';;
X*l*) type='Locate'; fn=`expr $fn : '.*:\(.*\)'`;;
Xesac
X
Xwhat="$type"
Xcase "$what" in
XLocate) what='File';;
Xesac
X
Xwhile test "$type"; do
X redo=''
X rp="$orig_rp"
X dflt="$orig_dflt"
X case "$tilde" in
X true) rp="$rp (~name ok)";;
X esac
X . myread
X case "$ans" in
X none)
X value=''
X case "$none_ok" in
X true) type='';;
X esac
X ;;
X *)
X case "$tilde" in
X '') value="$ans";;
X *)
X value=`./filexp $ans`
X case $? in
X 0)
X if test "$ans" != "$value"; then
X echo "(That is $value on this particular system.)"
X fi
X ;;
X *) value="$ans";;
X esac
X case "$d_portable" in
X "$define") value="$ans";;
X esac
X ;;
X esac
X case "$fullpath" in
X true)
X case "$value" in
X /*) ;;
X *)
X redo=true
X case "$already" in
X true)
X echo "I shall only accept a full path name, as in /bin/ls." >&3
X echo "Use a ! shell escape if you wish to check pathnames." >&3
X ;;
X *)
X echo "Please give a full path name, starting with slash." >&3
X case "$tilde" in
X true)
X echo "Note that using ~name is ok provided it expands well." >&3
X already=true
X ;;
X esac
X esac
X ;;
X esac
X ;;
X esac
X case "$redo" in
X '')
X case "$type" in
X File)
X if test -f "$value"; then
X type=''
X elif test -r "$value" || /bin/test -h "$value" >/dev/null 2>&1
X then
X echo "($value is not a plain file, but that's ok.)"
X type=''
X fi
X ;;
X Directory)
X if test -d "$value"; then
X type=''
X fi
X ;;
X Locate)
X if test -d "$value"; then
X echo "(Looking for $fn in directory $value.)"
X value="$value/$fn"
X fi
X if test -f "$value"; then
X type=''
X fi
X ;;
X esac
X
X case "$skip" in
X true) type='';
X esac
X
X case "$type" in
X '') ;;
X *)
X if test "$fastread" = yes; then
X dflt=y
X else
X dflt=n
X fi
X rp="$what $value doesn't exist. Use that name anyway?"
X . myread
X dflt=''
X case "$ans" in
X y*) type='';;
X *) echo " ";;
X esac
X ;;
X esac
X ;;
X esac
X ;;
X esac
Xdone
Xans="$value"
Xrp="$orig_rp"
Xdflt="$orig_dflt"
XEOSC
X
X: determine where manual pages are on this system
Xecho " "
Xcase "$sysman" in
X'') sysman=`loc . /usr/man/man1 /usr/man/man1 /usr/man/mann /usr/man/manl /usr/man/local/man1 /usr/man/u_man/man1 /usr/share/man/man1 /usr/catman/u_man/man1 /usr/man/l_man/man1 /usr/local/man/u_man/man1 /usr/local/man/l_man/man1 /usr/man/man.L`
X ;;
Xesac
Xif test -d "$sysman"; then
X echo "System manual is in $sysman." >&3
Xelse
X echo "Could not find manual pages in source form." >&3
Xfi
X
X: make some quick guesses about what we are up against
Xecho " "
X$echo $n "Hmm... $c" >&3
X$cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
Xif test `echo abc | tr a-z A-Z` = Abc ; then
X xxx=`./loc addbib blurfl $pth`
X if $test -f $xxx; then
Xecho "Looks kind of like a USG system with BSD features, but we'll see..." >&3
X echo exit 0 >bsd
X echo exit 0 >usg
X echo exit 1 >v7
X else
X if $contains SIGTSTP foo >/dev/null 2>&1 ; then
X echo "Looks kind of like an extended USG system, but we'll see..." >&3
X else
X echo "Looks kind of like a USG system, but we'll see..." >&3
X fi
X echo exit 1 >bsd
X echo exit 0 >usg
X echo exit 1 >v7
X fi
X d_bsd="$undef"
Xelif $contains SIGTSTP foo >/dev/null 2>&1 ; then
X echo "Looks kind of like a BSD system, but we'll see..." >&3
X d_bsd="$define"
X echo exit 0 >bsd
X echo exit 1 >usg
X echo exit 1 >v7
Xelse
X echo "Looks kind of like a Version 7 system, but we'll see..." >&3
X d_bsd="$undef"
X echo exit 1 >bsd
X echo exit 1 >usg
X echo exit 0 >v7
Xfi
Xcase "$eunicefix" in
X*unixtovms*)
X cat <<'EOI'
XThere is, however, a strange, musty smell in the air that reminds me of
Xsomething...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
XEOI
X echo "exit 0" >eunice
X d_eunice="$define"
X: it so happens the Eunice I know will not run shell scripts in Unix format
X ;;
X*)
X echo " "
X echo "Congratulations. You aren't running Eunice."
X d_eunice="$undef"
X echo "exit 1" >eunice
X ;;
Xesac
Xif test -f /xenix; then
X echo "Actually, this looks more like a XENIX system..."
X echo "exit 0" >xenix
X d_xenix="$define"
Xelse
X echo " "
X echo "It's not Xenix..."
X echo "exit 1" >xenix
X d_xenix="$undef"
Xfi
Xchmod +x xenix
X$eunicefix xenix
Xif test -f /venix; then
X echo "Actually, this looks more like a VENIX system..."
X echo "exit 0" >venix
Xelse
X echo " "
X if xenix; then
X : null
X else
X echo "Nor is it Venix..."
X fi
X echo "exit 1" >venix
Xfi
Xchmod +x bsd usg v7 eunice venix
X$eunicefix bsd usg v7 eunice venix
X$rm -f foo
X
X: see if we need a special compiler
Xecho " "
Xif usg; then
X case "$cc" in
X '') case "$Mcc" in
X /*) dflt='Mcc';;
X *) case "$large" in
X -M*) dflt='cc';;
X *) if $contains '\-M' $sysman/cc.1 >/dev/null 2>&1 ; then
X if $contains '\-M' $sysman/cpp.1 >/dev/null 2>&1; then
X dflt='cc'
X else
X dflt='cc -M'
X fi
X else
X dflt='cc'
X fi;;
X esac;;
X esac;;
X *) dflt="$cc";;
X esac
X $cat <<'EOM'
XOn some systems the default C compiler will not resolve multiple global
Xreferences that happen to have the same name. On some such systems the "Mcc"
Xcommand may be used to force these to be resolved. On other systems a "cc -M"
Xcommand is required. (Note that the -M flag on other systems indicates a
Xmemory model to use!) If you have the Gnu C compiler, you might wish to use
Xthat instead.
X
XEOM
X rp="What command will force resolution on this system?"
X . myread
X cc="$ans"
Xelse
X case "$cc" in
X '') dflt=cc;;
X *) dflt="$cc";;
X esac
X rp="Use which C compiler?"
X . myread
X cc="$ans"
Xfi
Xcase "$cc" in
Xgcc*) cpp=`loc gcc-cpp $cpp $pth`;;
Xesac
X
X: What should the include directory be ?
Xecho " "
X$echo $n "Hmm... $c"
Xcase "$usrinc" in
X'') dflt='/usr/include';;
X*) dflt=$usrinc;;
Xesac
Xincpath=''
Xmips_type=''
Xif $test -f /bin/mips && /bin/mips; then
X echo "Looks like a MIPS system..."
X $cat >usr.c <<'EOCP'
X#ifdef SYSTYPE_BSD43
X/bsd43
X#endif
XEOCP
X if $cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
X dflt='/bsd43/usr/include'
X incpath='/bsd43'
X mips_type='BSD 4.3'
X else
X mips_type='System V'
X fi
X $rm -f usr.c usr.out
X echo "and you're compiling with the $mips_type compiler and libraries."
Xelse
X echo "Doesn't look like a MIPS system."
X echo "exit 1" >mips
X chmod +x mips
X $eunicefix mips
Xfi
Xecho " "
Xfn=d/
Xrp='Where are the include files you want to use?'
X. getfile
Xusrinc="$ans"
X
X: Set private lib path
Xcase "$plibpth" in
X'') if mips; then
X plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
X else
X plibpth="/usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib"
X fi;;
Xesac
Xlibpth="$plibpth $libpth"
X
X: Looking for optional libraries
Xecho " "
Xecho "Checking for optional libraries..." >&3
Xcase "$libs" in
X'') dflt='';;
X*) dflt="$libs";;
Xesac
Xcase "$libswanted" in
X'') libswanted='c_s';;
Xesac
Xfor thislib in $libswanted; do
X case "$thislib" in
X dbm) thatlib=ndbm;;
X *_s) thatlib=NONE;;
X *) thatlib="${thislib}_s";;
X *) thatlib=NONE;;
X esac
X yyy="$incpath/usr/ccs/lib $incpath/usr/lib $incpath/usr/ucblib"
X yyy="$yyy $incpath/usr/local/lib $incpath/lib"
X xxx=`loc lib$thislib.a X $yyy`
X if $test -f $xxx; then
X echo "Found -l$thislib."
X case "$dflt" in
X *-l$thislib*|*-l$thatlib*);;
X *) dflt="$dflt -l$thislib";;
X esac
X else
X xxx=`loc lib$thislib.a X $libpth`
X if $test -f $xxx; then
X echo "Found $xxx."
X case "$dflt" in
X *$xxx*);;
X *) dflt="$dflt $xxx";;
X esac
X else
X xxx=`loc Slib$thislib.a X $xlibpth`
X if $test -f $xxx; then
X echo "Found -l$thislib."
X case "$dflt" in
X *-l$thislib*|*-l$thatlib*);;
X *) dflt="$dflt -l$thislib";;
X esac
X else
X echo "No -l$thislib."
X fi
X fi
X fi
Xdone
Xset X $dflt
Xshift
Xdflt="$*"
Xcase "$libs" in
X'') dflt="$dflt";;
X*) dflt="$libs";;
Xesac
Xcase "$dflt" in
X'') dflt='none';;
Xesac
X
X$cat <<EOM
X
XSome versions of Unix support shared libraries, which make executables smaller
Xbut make load time slightly longer.
X
XOn some systems, mostly newer Unix System V's, the shared library is included
Xby putting the option "-lc_s" as the last thing on the cc command line when
Xlinking. Other systems use shared libraries by default. There may be other
Xlibraries needed to compile $package on your machine as well. If your system
Xneeds the "-lc_s" option, include it here. Include any other special libraries
Xhere as well. Say "none" for none.
XEOM
X
Xecho " "
Xrp="Any additional libraries?"
X. myread
Xcase "$ans" in
Xnone) ans='';
Xesac
Xlibs="$ans"
X
X: see if nm is to be used to determine whether a symbol is defined or not
Xcase "$usenm" in
X'')
X dflt=`egrep 'inlibc|csym' ../Configure | wc -l 2>/dev/null`
X if $test $dflt -gt 20; then
X dflt=y
X else
X dflt=n
X fi
X ;;
X*)
X case "$usenm" in
X true) dflt=y;;
X *) dflt=n;;
X esac
X ;;
Xesac
X$cat <<EOM
X
XI can use 'nm' to extract the symbols from your C libraries. This is a time
Xconsuming task which may generate huge output on the disk (up to 3 megabytes)
Xbut that should make the symbols extraction faster. The alternative is to skip
Xthe 'nm' extraction part and to compile a small test program instead to
Xdetermine whether each symbol is present. If you have a fast C compiler and/or
Xif your 'nm' output cannot be parsed, this may be the best solution.
X
XEOM
Xrp='Shall I use nm to extract C symbols from the libraries?'
X. myread
Xcase "$ans" in
Xn|N) usenm=false;;
X*) usenm=true;;
Xesac
X
Xrunnm=$usenm
Xcase "$reuseval" in
Xtrue) runnm=false;
Xesac
X
X: nm options which may be necessary
Xcase "$nm_opt" in
X'') if $test -f /mach_boot; then
X nm_opt=''
X elif $test -d /usr/ccs/lib; then
X nm_opt='-p'
X elif $test -f /dgux; then
X nm_opt='-p'
X else
X nm_opt=''
X fi;;
Xesac
X
Xcase "$runnm" in
Xtrue)
X: indentation is wrong on purpose--RAM
X: get list of predefined functions in a handy place
Xecho " "
Xcase "$libc" in
X'') libc=unknown
X case "$libs" in
X *-lc_s*) libc=`loc libc_s.a $libc $libpth`
X esac
X ;;
Xesac
Xlibpth="$plibpth $libpth"
Xlibnames='';
Xcase "$libs" in
X'') ;;
X*) for thislib in $libs; do
X case "$thislib" in
X -l*)
X thislib=`expr X$thislib : 'X-l\(.*\)'`
X try=`loc lib$thislib.a blurfl/dyick $libpth`
X if test ! -f $try; then
X try=`loc lib$thislib blurfl/dyick $libpth`
X if test ! -f $try; then
X try=`loc $thislib blurfl/dyick $libpth`
X if test ! -f $try; then
X try=`loc Slib$thislib.a blurfl/dyick $xlibpth`
X if test ! -f $try; then
X try=''
X fi
X fi
X fi
X fi
X libnames="$libnames $try"
X ;;
X *) libnames="$libnames $thislib" ;;
X esac
X done
X ;;
Xesac
Xcase "$libc" in
Xunknown)
X set /usr/ccs/lib/libc.so
X $test -r $1 || set /usr/lib/libc.so
X $test -r $1 || set /usr/lib/libc.so.[0-9]*
X $test -r $1 || set /lib/libsys_s.a
X eval set \$$#
X ;;
X*)
X set blurfl
X ;;
Xesac
Xif $test -r "$1"; then
X echo "Your (shared) C library seems to be in $1."
X libc="$1"
Xelif $test -r /lib/libc && $test -r /lib/clib; then
X echo "Your C library seems to be in both /lib/clib and /lib/libc."
X libc='/lib/clib /lib/libc'
X if $test -r /lib/syslib; then
X echo "(Your math library is in /lib/syslib.)"
X libc="$libc /lib/syslib"
X fi
Xelif $test -r "$libc" || /bin/test -h "$libc" >/dev/null 2>&1; then
X echo "Your C library seems to be in $libc, as you said before."
Xelif $test -r $incpath/usr/lib/libc.a; then
X libc=$incpath/usr/lib/libc.a;
X echo "Your C library seems to be in $libc. That's fine."
Xelif $test -r /lib/libc.a; then
X libc=/lib/libc.a;
X echo "Your C library seems to be in $libc. You're normal."
Xelse
X if ans=`./loc libc.a blurfl/dyick $libpth`; $test -r "$ans"; then
X :
X elif ans=`./loc libc blurfl/dyick $libpth`; $test -r "$ans"; then
X libnames="$libnames "`./loc clib blurfl/dyick $libpth`
X elif ans=`./loc clib blurfl/dyick $libpth`; $test -r "$ans"; then
X :
X elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; $test -r "$ans"; then
X :
X elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; $test -r "$ans"; then
X :
X else
X ans=`./loc Llibc.a blurfl/dyick $xlibpth`
X fi
X if $test -r "$ans"; then
X echo "Your C library seems to be in $ans, of all places."
X libc=$ans
X else
X libc='blurfl'
X fi
Xfi
Xif $test -r "$libc" || /bin/test -h "$libc" >/dev/null 2>&1; then
X dflt="$libc"
X cat <<EOM
X
XIf the guess above is wrong (which it might be if you're using a strange
Xcompiler, or your machine supports multiple models), you can override it here.
X
XEOM
Xelse
X dflt=''
X echo $libpth | tr ' ' '\012' | sort | uniq > libpath
X cat >&3 <<EOM
XI can't seem to find your C library. I've looked in the following places:
X
XEOM
X $sed 's/^/ /' libpath
X cat <<EOM
X
XNone of these seems to contain your C library. I need to get its name...
X
XEOM
Xfi
Xfn=f
Xrp='Where is your C library?'
X. getfile
Xlibc="$ans"
X
Xecho " "
Xecho $libc $libnames | tr ' ' '\012' | sort | uniq > libnames
Xset X `cat libnames`
Xshift
Xxxx=files
Xcase $# in 1) xxx=file; esac
Xecho "Extracting names from the following $xxx for later perusal:" >&3
Xecho " "
X$sed 's/^/ /' libnames >&3
Xecho " "
X$echo $n "This may take a while...$c" >&3
X
Xnm $nm_opt $* 2>/dev/null >libc.tmp
X$echo $n ".$c"
X$grep fprintf libc.tmp > libc.ptf
Xxscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&3'
Xxrun='eval "<libc.tmp $com >libc.list"; echo "done" >&3'
Xif com="$sed -n -e 's/^.* [ADTS] *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
X eval $xscan;\
X $contains '^fprintf$' libc.list >/dev/null 2>&1; then
X eval $xrun
Xelif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
X eval $xscan;\
X $contains '^fprintf$' libc.list >/dev/null 2>&1; then
X eval $xrun
Xelif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
X eval $xscan;\
X $contains '^fprintf$' libc.list >/dev/null 2>&1; then
X eval $xrun
Xelif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
X eval $xscan;\
X $contains '^fprintf$' libc.list >/dev/null 2>&1; then
X eval $xrun
Xelif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
X eval $xscan;\
X $contains '^fprintf$' libc.list >/dev/null 2>&1; then
X eval $xrun
Xelif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
X eval $xscan;\
X $contains '^fprintf$' libc.list >/dev/null 2>&1; then
X eval $xrun
Xelif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
X -e '/ file/d' -e 's/^\([^ ]*\).*/\1/p'";\
X eval $xscan;\
X $contains '^fprintf$' libc.list >/dev/null 2>&1; then
X eval $xrun
Xelif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
X eval $xscan;\
X $contains '^fprintf$' libc.list >/dev/null 2>&1; then
X eval $xrun
Xelif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
X eval $xscan;\
X $contains '^fprintf$' libc.list >/dev/null 2>&1; then
X eval $xrun
Xelse
X nm -p $* 2>/dev/null >libc.tmp
X com="$sed -n -e 's/^.* [ADTS] *_[_.]*//p' -e 's/^.* [ADTS] //p'";\
X eval "<libc.tmp $com >libc.list"
X if $contains '^fprintf$' libc.list >/dev/null 2>&1; then
X nm_opt='-p'
X echo "done" >&3
X else
X echo " "
X echo "nm didn't seem to work right. Trying ar instead..." >&3
X com=''
X if ar t $libc > libc.tmp; then
X for thisname in $libnames; do
X ar t $thisname >>libc.tmp
X done
X $sed -e 's/\.o$//' < libc.tmp > libc.list
X echo "Ok." >&3
X else
X echo "ar didn't seem to work right." >&3
X echo "Maybe this is a Cray...trying bld instead..." >&3
X if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then
X for thisname in $libnames; do
X bld t $libnames | \
X $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list
X ar t $thisname >>libc.tmp
X done
X echo "Ok." >&3
X else
X echo "That didn't work either. Giving up." >&3
X exit 1
X fi
X fi
X fi
Xfi
Xnm_extract="$com"
Xif $test -f /lib/syscalls.exp; then
X echo " "
X echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&3
X $sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.list
Xfi
X: remember, indentation is wrong on purpose--RAM
X;;
Xesac
X$rm -f libnames libpath
X
X: determine optimize, if desired, or use for debug flag also
Xcase "$optimize" in
X' ') dflt="none";;
X'') dflt="-O";;
X*) dflt="$optimize";;
Xesac
X$cat <<EOH
X
XSome C compilers have problems with their optimizers, by default, $package
Xcompiles with the -O flag to use the optimizer. Alternately, you might want to
Xuse the symbolic debugger, which uses the -g flag (on traditional Unix systems).
XEither flag can be specified here. To use neither flag, specify the word "none".
X
XEOH
Xrp="What optimizer/debugger flag should be used?"
X. myread
Xoptimize="$ans"
Xcase "$optimize" in
X'none') optimize=" ";;
Xesac
X
Xcase "$ccflags" in
X'') case "$cc" in
X *gcc*) dflt='-fpcc-struct-return';;
X *) dflt='';;
X esac
X ;;
X*) dflt="$ccflags"
X case "$cc" in
X *gcc*) case "$dflt" in
X *-fpcc-struct-return*) ;;
X *) dflt="$dflt -fpcc-struct-return";;
X esac;;
X esac;;
Xesac
X
Xcase "$mips_type" in
X*BSD*) ;;
X'') ;;
X*) inclwanted="$inclwanted $usrinc/bsd";;
Xesac
Xfor thisincl in $inclwanted; do
X if $test -d $thisincl; then
X if $test x$thisincl != x$usrinc; then
X case "$dflt" in
X *$thisincl*);;
X *) dflt="$dflt -I$thisincl";;
X esac
X fi
X fi
Xdone
X
Xcase "$optimize" in
X-g*)
X case "$dflt" in
X *DEBUG*);;
X *) dflt="$dflt -DDEBUG";;
X esac
X ;;
Xesac
X
Xinctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
X xxx=true;
Xelif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
X xxx=true;
Xelse
X xxx=false;
Xfi;
Xif $xxx; then
X case "$dflt" in
X *$2*);;
X *) dflt="$dflt -D$2";;
X esac;
Xfi'
X
Xset signal.h LANGUAGE_C; eval $inctest
Xset signal.h NO_PROTOTYPE; eval $inctest
Xset signal.h _NO_PROTO; eval $inctest
X
Xcase "$dflt" in
X'') dflt=none;;
Xesac
X$cat <<EOH
X
XYour C compiler may want other flags. For this question you should include
X-I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
Xbut you should NOT include libraries or ld flags like -lwhatever. To use no
Xflags, specify the word "none".
X
XEOH
Xset X $dflt
Xshift
Xdflt=${1+"$@"}
Xrp="Any additional cc flags?"
X. myread
Xcase "$ans" in
Xnone) ans='';
Xesac
Xccflags="$ans"
X
X: the following weeds options from ccflags that are of no interest to cpp
Xcppflags="$ccflags"
Xcase "$cc" in
X*gcc*) cppflags="$cppflags -D__GNUC__";;
Xesac
Xcase "$mips_type" in
X'');;
X*BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
Xesac
Xcase "$cppflags" in
X'');;
X*) set X $cppflags
X cppflags=''
X for flag
X do
X case $flag in
X -D*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";;
X esac
X done
X case "$cppflags" in
X *-*) echo "(C preprocessor flags: $cppflags)";;
X esac
X ;;
Xesac
X
X: flags used in final linking phase
Xcase "$ldflags" in
X'') if venix; then
X dflt='-i -z'
X else
X dflt='none'
X fi
X ;;
X*) dflt="$ldflags";;
Xesac
Xecho " "
Xrp="Any additional ld flags (NOT including libraries)?"
X. myread
Xcase "$ans" in
Xnone) ans='';
Xesac
Xldflags="$ans"
Xrmlist="$rmlist pdp11"
X
X: is a C symbol defined?
Xcsym='tlook=$1;
Xcase "$3" in
X-v) tf=libc.tmp; tc=""; tdc="";;
X-a) tf=libc.tmp; tc="[0]"; tdc=[];;
X*) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
Xesac;
Xtx=yes;
Xcase "$reuseval-$4" in
Xtrue-) ;;
Xtrue-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
Xesac;
Xcase "$tx" in
Xyes)
X case "$runnm" in
X true)
X if $contains $tlook $tf >/dev/null 2>&1;
X then tval=true;
X else tval=false;
X fi;;
X *)
X echo "main() { extern int $1$tdc; printf(\"%d\", $1$tc); }" > t.c;
X if $cc $ccflags -o t t.c $libs >/dev/null 2>&1;
X then tval=true;
X else tval=false;
X fi;
X $rm -f t t.c;;
X esac;;
X*)
X case "$tval" in
X $define) tval=true;;
X *) tval=false;;
X esac;;
Xesac;
Xeval "$2=$tval'
X
X: set up the script used to warn in case of inconsistency
Xcat <<'EOSC' >whoa
Xdflt=y
Xecho " "
Xecho "*** WHOA THERE!!! ***" >&3
Xecho " The $hint value for \$$var on this machine was \"$was\"!" >&3
Xrp=" Keep the $hint value?"
X. myread
Xcase "$ans" in
Xy) td=$was; tu=$was;;
Xesac
XEOSC
X
X: define an is-in-libc? function
Xinlibc='echo " "; td=$define; tu=$undef;
Xsym=$1; var=$2; eval "was=\$$2";
Xtx=yes;
Xcase "$reuseval$was" in
Xtrue) ;;
Xtrue*) tx=no;;
Xesac;
Xcase "$tx" in
Xyes)
X set $sym tres -f;
X eval $csym;
X case "$tres" in
X true)
X echo "$sym() found." >&3;
X case "$was" in $undef) . whoa; esac; eval "$var=\$td";;
X *)
X echo "$sym() NOT found." >&3;
X case "$was" in $define) . whoa; esac; eval "$var=\$tu";;
X esac;;
X*)
X case "$was" in
X $define) echo "$sym() found." >&3;;
X *) echo "$sym() NOT found." >&3;;
X esac;;
Xesac'
X
X: see if catgets exists
Xset catgets d_catgets
Xeval $inlibc
X: see if catopen exists
Xset catopen d_catopen
Xeval $inlibc
X: function used to set $1 to $val
Xsetvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
Xcase "$val$was" in
X$define$undef) . whoa; eval "$var=\$td";;
X$undef$define) . whoa; eval "$var=\$tu";;
X*) eval "$var=$val";;
Xesac'
X
X: see how we invoke the C preprocessor
Xecho " "
Xecho "Now, how can we feed standard input to your C preprocessor..." >&3
Xcat <<'EOT' >testcpp.c
X#define ABC abc
X#define XYZ xyz
XABC.XYZ
XEOT
Xcd ..
Xecho 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
Xchmod 755 cppstdin
Xwrapper=`pwd`/cppstdin
Xcd UU
Xif $test "X$cppstdin" != "X" && \
X $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
X $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X echo "You used to use $cppstdin $cppminus so we'll use that again."
Xelif $test "$cc" = gcc && \
X (echo "Using gcc, eh? We'll try to force gcc -E using a wrapper..."; \
X $wrapper <testcpp.c >testcpp.out 2>&1; \
X $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then
X echo "Yup, we can."
X cppstdin="$wrapper"
X cppminus='';
Xelif echo 'Maybe "'"$cc"' -E" will work...'; \
X $cc -E <testcpp.c >testcpp.out 2>&1; \
X $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X echo "Yup, it does."
X cppstdin="$cc -E"
X cppminus='';
Xelif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
X $cc -E - <testcpp.c >testcpp.out 2>&1; \
X $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X echo "Yup, it does."
X cppstdin="$cc -E"
X cppminus='-';
Xelif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \
X $wrapper <testcpp.c >testcpp.out 2>&1; \
X $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X cppstdin="$wrapper"
X cppminus=''
X echo "Eureka!"
Xelif echo 'No such luck, maybe "'$cpp'" will work...'; \
X $cpp <testcpp.c >testcpp.out 2>&1; \
X $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X echo "It works!"
X cppstdin="$cpp"
X cppminus='';
Xelif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
X $cpp - <testcpp.c >testcpp.out 2>&1; \
X $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X echo "Hooray, it works! I was beginning to wonder."
X cppstdin="$cpp"
X cppminus='-';
Xelif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
X $cc -P <testcpp.c >testcpp.out 2>&1; \
X $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X echo "Yipee, that works!"
X cppstdin="$cc -P"
X cppminus='';
Xelif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
X $cc -P - <testcpp.c >testcpp.out 2>&1; \
X $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X echo "At long last!"
X cppstdin="$cc -P"
X cppminus='-';
Xelse
X dflt=''
X rp="No dice. I can't find a C preprocessor. Name one:"
X . myread
X cppstdin="$ans"
X $cppstdin <testcpp.c >testcpp.out 2>&1
X if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
X echo "OK, that will do." >&3
X else
Xecho "Sorry, I can't get that to work. Go find one and rerun Configure." >&3
X exit 1
X fi
Xfi
X$rm -f testcpp.c testcpp.out
X
X: determine filename position in cpp output
Xecho " "
Xecho "Computing filename position in cpp output for #include directives..." >&3
Xecho '#include <stdio.h>' > foo.c
X$cat >fieldn <<EOF
X$startsh
X$cppstdin $cppminus $cppflags <foo.c 2>/dev/null | \
X$grep '^[ ]*#.*stdio\.h' | \
Xwhile read cline; do
X pos=1
X set \$cline
X while $test \$# -gt 0; do
X if $test -r \`echo \$1 | $tr -d '"'\`; then
X echo "\$pos"
X exit 0
X fi
X shift
X pos=\`expr \$pos + 1\`
X done
Xdone
XEOF
Xchmod +x fieldn
Xfieldn=`./fieldn`
X$rm -f foo.c fieldn
Xcase $fieldn in
X'') pos='???';;
X1) pos=first;;
X2) pos=second;;
X3) pos=third;;
X*) pos="${fieldn}th";;
Xesac
Xecho "Your cpp writes the filename in the $pos field of the line."
X
X: locate header file
X$cat >findhdr <<EOF
X$startsh
Xwanted=\$1
Xname=''
Xif test -f $usrinc/\$wanted; then
X echo "$usrinc/\$wanted"
X exit 0
Xfi
Xawkprg='{ print \$$fieldn }'
Xecho "#include <\$wanted>" > foo\$\$.c
X$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
X$grep "^[ ]*#.*\$wanted" | \
Xwhile read cline; do
X name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
X case "\$name" in
X */\$wanted) echo "\$name"; exit 0;;
X *) name='';;
X esac;
Xdone;
X$rm -f foo\$\$.c;
Xcase "\$name" in
X'') exit 1;;
Xesac
XEOF
Xchmod +x findhdr
X
X: see which of string.h or strings.h is needed
Xecho " "
Xstrings=`./findhdr string.h`
Xval="$undef"
Xif $test "$strings" && $test -r "$strings"; then
X echo "Using <string.h> instead of <strings.h>." >&3
X if bsd; then
X echo "(Actually, this looks more like it were an USG system)"
X fi
X val="$define"
Xelse
X strings=`./findhdr strings.h`
X if $test "$strings" && $test -r "$strings"; then
X echo "Using <strings.h> instead of <string.h>." >&3
X if usg; then
X echo "(Actually, this looks more like it were a BSD system)"
X fi
X else
X echo "No string header found--You'll surely have problems." >&3
X fi
Xfi
Xset i_string
Xeval $setvar
X
X: index or strchr
Xecho " "
Xcase "$d_index" in
X$define) dflt=n;;
X*) dflt=y;;
Xesac
Xif set index val -f; eval $csym; $val; then
X if set strchr val -f d_index; eval $csym; $val; then
X if $contains strchr "$strings" >/dev/null 2>&1 ; then
X if $contains index "$strings" >/dev/null 2>&1 ; then
X echo "Your system has both index() and strchr()." >&3
X rp="Shall I use index() rather than strchr()?"
X . myread
X case "$ans" in
X n*) val="$define" ;;
X *) val="$undef" ;;
X esac
X else
X val="$define"
X echo "strchr() found." >&3
X fi
X else
X val="$undef"
X echo "index() found." >&3
X fi
X else
X val="$undef"
X echo "index() found." >&3
X fi
Xelse
X if set strchr val -f d_index; eval $csym; $val; then
X val="$define"
X echo "strchr() found." >&3
X else
X echo "No index() or strchr() found!" >&3
X val="$undef"
X fi
Xfi
Xset d_index
Xeval $setvar
X
X: Initialize h_fcntl
Xh_fcntl=false
X
X: Initialize h_sysfile
Xh_sysfile=false
X
X: Locate the flags for 'open()'
Xecho " "
X$cat >open3.c <<'EOCP'
X#include <sys/types.h>
X#ifdef I_FCNTL
X#include <fcntl.h>
X#endif
X#ifdef I_SYS_FILE
X#include <sys/file.h>
X#endif
Xmain() {
X if(O_RDONLY);
X#ifdef O_TRUNC
X exit(0);
X#else
X exit(1);
X#endif
X}
XEOCP
X: check sys/file.h first to get FREAD on Sun
Xif $test `./findhdr sys/file.h` && \
X $cc $cppflags "-DI_SYS_FILE" open3.c -o open3 >/dev/null 2>&1 ; then
X h_sysfile=true;
X echo "<sys/file.h> defines the O_* constants..." >&3
X if ./open3; then
X echo "and you have the 3 argument form of open()." >&3
X val="$define"
X else
X echo "but not the 3 argument form of open(). Oh, well." >&3
X val="$undef"
X fi
Xelif $test `./findhdr fcntl.h` && \
X $cc "-DI_FCNTL" open3.c -o open3 >/dev/null 2>&1 ; then
X h_fcntl=true;
X echo "<fcntl.h> defines the O_* constants..." >&3
X if ./open3; then
X echo "and you have the 3 argument form of open()." >&3
X val="$define"
X else
X echo "but not the 3 argument form of open(). Oh, well." >&3
X val="$undef"
X fi
Xelse
X val="$undef"
X echo "I can't find the O_* constant definitions! You got problems." >&3
Xfi
Xset d_open3
Xeval $setvar
X$rm -f open3*
X
X: see if strerror and/or sys_errlist[] exist
Xecho " "
Xif set strerror val -f d_strerror; eval $csym; $val; then
X echo 'strerror() found.' >&3
X d_strerror="$define"
X d_strerrm="$undef"
X if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
X echo "(You also have sys_errlist[], so we could roll our own strerror.)"
X d_syserrlst="$define"
X else
X echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
X d_syserrlst="$undef"
X fi
Xelif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
X $contains '#[ ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
X echo 'strerror() found in string header.' >&3
X d_strerror="$define"
X d_strerrm="$undef"
X if set sys_errlist val -a d_syserrlst; eval $csym; $val; then
X echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
X d_syserrlst="$define"
X else
X echo "(You don't appear to have any sys_errlist[], how can this be?)"
X d_syserrlst="$undef"
X fi
Xelif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
Xecho "strerror() not found, but you have sys_errlist[] so we'll use that." >&3
X d_strerror="$undef"
X d_syserrlst="$define"
X d_strerrm="$define"
Xelse
X echo 'strerror() and sys_errlist[] NOT found.' >&3
X d_strerror="$undef"
X d_syserrlst="$undef"
X d_strerrm="$undef"
Xfi
Xif set sys_errnolist val -a d_sysernlst; eval $csym; $val; then
X echo "(Symbolic error codes can be fetched via the sys_errnolist[] array.)"
X d_sysernlst="$define"
Xelse
X echo "(However, I can't extract the symbolic error code out of errno.)"
X d_sysernlst="$undef"
Xfi
X
X: determine default path for configuration profiles
Xcase "$cf_default" in
X'')
X dflt=".:/etc:/usr/local/lib"
X ;;
X*) dflt="$cf_default"
X ;;
Xesac
X $cat <<'EOM'
X
XThe CF library needs to know what the default search path for configuration
Xprofiles should be. This path will be searched if the environment variable
X$CF_PATH is not set. The path should be a colon-separated list of directories
Xwhich will be searched from left to right. It will only be used if the
Xreferenced configuration profile does not contain a full pathname. It should
Xalso contain your current directory (.:).
X
XAn example would be
X
X .:/home/my/config:/usr/local/lib
X
XEOM
X
Xfn=d~
Xrp='What should be the default path for configuration profiles ?'
X. myread
Xcf_default="$ans"
X: determine the name of a gencat-like program
Xcase "$gencat" in
X'')
X if $test -f /bin/gencat; then
X dflt=/bin/gencat
X elif $test -f /usr/bin/gencat; then
X dflt=/usr/bin/gencat
X else
X dflt="/bin/true"
X fi
X ;;
X*) dflt="$gencat";;
Xesac
X$cat <<EOM
X
XI need the full pathname of the program used to generate NLS message catalogues
Xon your system. A typical answer would be /usr/bin/gencat, but you may choose
Xany other program, as long as $package can read its catalogues using catopen()
Xand catgets().
X
XEOM
Xfn=f
Xrp='Catalogue generator to be used?'
X. getfile
Xgencat="$ans"
X
X: determine where public header files go
Xcase "$inc" in
X'')
X dflt=`loc . "." /usr/local/include /usr/include/local $usrinc`
X ;;
X*) dflt="$inc"
X ;;
Xesac
Xfn=d~
Xrp='Where do you want to put the public header files?'
X. getfile
Xinc="$ans"
X
X: determine where public libraries go
Xcase "$lib" in
X'') dflt=`loc . "." /usr/local/lib /usr/lib /lib`;;
X*) dflt="$lib";;
Xesac
Xfn=d~
Xrp='Where do you want to put the public libraries?'
X. getfile
Xlib="$ans"
X
X: compute the type returned by malloc
Xecho " "
Xcase "$malloctype" in
X'')
X if $test `./findhdr malloc.h`; then
X echo "#include <malloc.h>" > malloc.c
X fi
X#include <malloc.h>
X $cat >>malloc.c <<'END'
Xvoid *malloc();
XEND
X if $cc $ccflags -c malloc.c >/dev/null 2>&1; then
X malloctype='void *'
X else
X malloctype='char *'
X fi
X $rm -f malloc.[co]
X ;;
Xesac
Xecho "Your system wants malloc to return '$malloctype', it would seem." >&3
X
X: determine where manual pages go
X$cat <<EOM
X
X$package has manual pages available in source form.
XEOM
Xcase "$nroff" in
Xnroff)
X echo "However, you don't have nroff, so they're probably useless to you."
X case "$mansrc" in
X '') mansrc="none";;
X esac;;
Xesac
Xecho "If you don't want the manual sources installed, answer 'none'."
Xcase "$mansrc" in
X'')
X dflt="$sysman"
X ;;
X*) dflt="$mansrc"
X ;;
Xesac
Xecho " "
Xfn=dn~
Xrp='Where do the manual pages (source) go?'
X. getfile
Xmansrc="$ans"
Xcase "$mansrc" in
X'') manext='0';;
X*l) manext=l;;
X*n) manext=n;;
X*o) manext=l;;
X*p) manext=n;;
X*C) manext=C;;
X*L) manext=L;;
X*) manext=1;;
Xesac
X
X: see what type pids are declared as in the kernel
Xcase "$pidtype" in
X'')
X if $contains 'pid_t;' `./findhdr sys/types.h` >/dev/null 2>&1 ; then
X dflt='pid_t';
X else
X dflt="int"
X fi
X ;;
X*) dflt="$pidtype";;
Xesac
Xecho " "
Xrp="What type are process ids on this system declared as?"
X. myread
Xpidtype="$ans"
X
X: Cruising for prototypes
Xecho " "
Xecho "Checking out function prototypes..." >&3
X$cat >prototype.c <<'EOCP'
Xmain(int argc, char *argv[]) {
X exit(0);}
XEOCP
Xif $cc -c prototype.c >prototype.out 2>&1 ; then
X echo "Your C compiler appears to support function prototypes."
X val=define
Xelse
X echo "Your C compiler doesn't seem to understand function prototypes."
X val=undef
Xfi
Xset prototype
Xeval $setvar
X$rm -f prototype*
X
X: see if ar generates random libraries by itself
Xecho " "
Xecho "Checking how to generate random libraries on your machine..." >&3
X$cat >a.c <<EOP
Xf() { exit(0); }
XEOP
Xcc -c a.c >/dev/null 2>&1
Xar rc ran.a a.o >/dev/null 2>&1
X$cat >b.c <<EOP
Xmain() { f(); }
XEOP
Xcp ran.a lib.a
Xif ar ts ran.a >/dev/null 2>&1; then
X if $cc -o b b.c lib.a >/dev/null 2>&1; then
X echo "ar appears to generate random libraries itself."
X orderlib=false
X ranlib=":"
X else
X echo "a table of contents needs to be added with 'ar ts'."
X orderlib=false
X ranlib="ar ts"
X fi
Xelse
X if $test -f /usr/bin/ranlib; then
X ranlib=/usr/bin/ranlib
X elif $test -f /bin/ranlib; then
X ranlib=/bin/ranlib
X fi
X
X if $test -n "$ranlib"; then
X echo "your system has $ranlib; we'll use that."
X orderlib=false
X else
X echo "your system doesn't seem to support random libraries"
X echo "so we'll use lorder and tsort to order the libraries."
X orderlib=true
X ranlib=":"
X fi
Xfi
X$rm -f a.* b.c b.o b ran.a lib.a
X
X: define an alternate in-header-list? function
Xinhdr='echo " "; td=$define; tu=$undef; yyy=$@;
Xcont=true; xxf="echo \"<\$1> found.\" >&3";
Xcase $# in 2) xxnf="echo \"<\$1> NOT found.\" >&3";;
X*) xxnf="echo \"<\$1> NOT found, ...\" >&3";;
Xesac;
Xcase $# in 4) instead=instead;; *) instead="at last";; esac;
Xwhile $test "$cont"; do
X xxx=`./findhdr $1`
X var=$2; eval "was=\$$2";
X if $test "$xxx" && $test -r "$xxx";
X then eval $xxf;
X eval "case \"\$$var\" in $undef) . whoa; esac"; eval "$var=\$td";
X cont="";
X else eval $xxnf;
X eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu"; fi;
X set $yyy; shift; shift; yyy=$@;
X case $# in 0) cont="";;
X 2) xxf="echo \"but I found <\$1> $instead.\" >&3";
X xxnf="echo \"and I did not find <\$1> either.\" >&3";;
X *) xxf="echo \"but I found <\$1\> instead.\" >&3";
X xxnf="echo \"there is no <\$1>, ...\" >&3";;
X esac;
Xdone;
Xwhile $test "$yyy";
Xdo set $yyy; var=$2; eval "was=\$$2";
X eval "case \"\$$var\" in $define) . whoa; esac"; eval "$var=\$tu";
X set $yyy; shift; shift; yyy=$@;
Xdone'
X
X: see if fcntl.h is there
Xval=''
Xset fcntl.h val
Xeval $inhdr
X
X: see if we can include fcntl.h
Xcase "$val" in
X"$define")
X echo " "
X if $h_fcntl; then
X val="$define"
X echo "We'll be including <fcntl.h>." >&3
X else
X val="$undef"
X if $h_sysfile; then
X echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&3
X else
X echo "We won't be including <fcntl.h>." >&3
X fi
X fi
X ;;
X*)
X h_fcntl=false
X val="$undef"
X ;;
Xesac
Xset i_fcntl
Xeval $setvar
X
X: see if this is a limits.h system
Xset limits.h i_limits
Xeval $inhdr
X
X: see if stdarg is available
Xset stdarg.h i_stdarg
Xeval $inhdr
X
X: see if this is a varargs system
Xecho " "
Xif $test `./findhdr varargs.h`; then
X val="$define"
X echo "<varargs.h> found." >&3
Xelse
X val="$undef"
X echo "<varargs.h> NOT found, but that's ok (I hope)." >&3
Xfi
Xset i_varargs
Xeval $setvar
X
X: set up the varargs testing programs
X$cat > varargs.c <<EOP
X#ifdef I_STDARG
X#include <stdarg.h>
X#endif
X#ifdef I_VARARGS
X#include <varargs.h>
X#endif
X
Xint f(va_alist)
Xva_dcl
X{
X va_list ap;
X char *p;
X va_start(ap);
X p = va_arg(ap, char *);
X va_end(ap);
X}
XEOP
X$cat > varargs <<EOP
Xif $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
X echo "true"
Xelse
X echo "false"
Xfi
X$rm -f varargs.o
XEOP
Xchmod +x varargs
X
X: now check which varargs header should be included
Xecho " "
Xi_varhdr=''
Xcase "$i_varargs" in
X"$define")
X if `./varargs I_VARARGS`; then
X i_varhdr='varargs.h'
X i_stdarg="$undef"
X elif `./varargs I_STDARG`; then
X i_varhdr='stdarg.h'
X i_varargs="$undef"
X fi
X ;;
X*)
X if `./varargs I_STDARG`; then
X i_varhdr='stdarg.h'
X fi
X ;;
Xesac
Xcase "$i_varhdr" in
X'')
Xecho "I could not find the definition for va_dcl... You have problems..." >&3
X ;;
X*) echo "We'll include <$i_varhdr> to get va_dcl definition." >&3;;
Xesac
X$rm -f varargs*
X
X: end of configuration questions
Xecho " "
Xecho "End of configuration questions."
Xecho " "
X
X: create config.sh file
Xecho " "
Xif test -d ../UU; then
X cd ..
Xfi
Xecho "Creating config.sh..." >&3
Xcf_time=`$date 2>&1`
Xcf_by=`( (logname) 2>/dev/null || whoami) 2>&1`
X$spitshell <<EOT >config.sh
X$startsh
X#
X# This file was produced by running the Configure script. It holds all the
X# definitions figured out by Configure. Should you modify one of these values,
X# do not forget to propagate your changes by running "Configure -der". You may
X# instead choose to run each of the .SH files by yourself, or "Configure -S".
X#
X
X# Configuration time: $cf_time
X# Configured by: $cf_by
X# Target system: $myuname
X
Xcf_by='$cf_by'
Xcf_time='$cf_time'
Xd_bsd='$d_bsd'
Xd_eunice='$d_eunice'
Xd_xenix='$d_xenix'
Xeunicefix='$eunicefix'
XMcc='$Mcc'
Xawk='$awk'
Xbison='$bison'
Xcat='$cat'
Xchgrp='$chgrp'
Xchmod='$chmod'
Xchown='$chown'
Xcompress='$compress'
Xcp='$cp'
Xcpio='$cpio'
Xcpp='$cpp'
Xcsh='$csh'
Xdate='$date'
Xecho='$echo'
Xegrep='$egrep'
Xemacs='$emacs'
Xexpr='$expr'
Xflex='$flex'
Xgcc='$gcc'
Xgrep='$grep'
Xinews='$inews'
Xless='$less'
Xline='$line'
Xlint='$lint'
Xln='$ln'
Xlp='$lp'
Xlpr='$lpr'
Xls='$ls'
Xmail='$mail'
Xmailx='$mailx'
Xmake='$make'
Xmkdir='$mkdir'
Xmore='$more'
Xmv='$mv'
Xnroff='$nroff'
Xperl='$perl'
Xpg='$pg'
Xpmake='$pmake'
Xpr='$pr'
Xrm='$rm'
Xrmail='$rmail'
Xsed='$sed'
Xsendmail='$sendmail'
Xshar='$shar'
Xsleep='$sleep'
Xsmail='$smail'
Xsort='$sort'
Xsubmit='$submit'
Xtail='$tail'
Xtar='$tar'
Xtbl='$tbl'
Xtest='$test'
Xtouch='$touch'
Xtr='$tr'
Xtroff='$troff'
Xuname='$uname'
Xuniq='$uniq'
Xuuname='$uuname'
Xvi='$vi'
Xzcat='$zcat'
Xhint='$hint'
Xmyuname='$myuname'
XAuthor='$Author'
XDate='$Date'
XHeader='$Header'
XId='$Id'
XLocker='$Locker'
XLog='$Log'
XRCSfile='$RCSfile'
XRevision='$Revision'
XSource='$Source'
XState='$State'
Xcc='$cc'
Xccflags='$ccflags'
Xcppflags='$cppflags'
Xldflags='$ldflags'
Xlkflags='$lkflags'
Xoptimize='$optimize'
Xcf_default='$cf_default'
Xcontains='$contains'
Xcppminus='$cppminus'
Xcppstdin='$cppstdin'
Xd_catgets='$d_catgets'
Xd_catopen='$d_catopen'
Xd_index='$d_index'
Xd_open3='$d_open3'
Xd_portable='$d_portable'
Xd_strerrm='$d_strerrm'
Xd_strerror='$d_strerror'
Xd_sysernlst='$d_sysernlst'
Xd_syserrlst='$d_syserrlst'
Xgencat='$gencat'
Xh_fcntl='$h_fcntl'
Xh_sysfile='$h_sysfile'
Xi_fcntl='$i_fcntl'
Xi_limits='$i_limits'
Xi_stdarg='$i_stdarg'
Xi_string='$i_string'
Xstrings='$strings'
Xi_varargs='$i_varargs'
Xi_varhdr='$i_varhdr'
Xinc='$inc'
Xlib='$lib'
Xlintlib='$lintlib'
Xlibc='$libc'
Xlibpth='$libpth'
Xplibpth='$plibpth'
Xxlibpath='$xlibpath'
Xlibs='$libs'
Xmallocobj='$mallocobj'
Xmallocsrc='$mallocsrc'
Xmalloctype='$malloctype'
Xusemymalloc='$usemymalloc'
Xmanext='$manext'
Xmansrc='$mansrc'
Xc='$c'
Xn='$n'
Xorderlib='$orderlib'
Xranlib='$ranlib'
Xpackage='$package'
Xpidtype='$pidtype'
Xprototype='$prototype'
Xsharpbang='$sharpbang'
Xshsharp='$shsharp'
Xspitshell='$spitshell'
Xstartsh='$startsh'
Xsysman='$sysman'
Xnm_opt='$nm_opt'
Xrunnm='$runnm'
Xusenm='$usenm'
Xincpath='$incpath'
Xmips='$mips'
Xmips_type='$mips_type'
Xusrinc='$usrinc'
XEOT
X
X: add special variables
Xcase "$lastuname" in
X'') lastuname="$myuname";;
Xesac
Xecho "lastuname='$lastuname'" >>config.sh
X$test -f patchlevel.h && \
Xawk '/^#define/ {printf "%s=%s\n",$2,$3}' patchlevel.h >>config.sh
Xecho "CONFIG=true" >>config.sh
X
X: propagate old symbols
Xif $test -f UU/config.sh; then
X <UU/config.sh sort | uniq >UU/oldconfig.sh
X sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
X sort | uniq -u >UU/oldsyms
X set X `cat UU/oldsyms`
X shift
X case $# in
X 0) ;;
X *) echo "Hmm...You had some extra variables I don't know about...I'll try to keep 'em..."
X for sym in `cat UU/oldsyms`; do
X echo " Propagating $hint variable "'$'"$sym..."
X eval 'tmp="$'"${sym}"'"'
X echo "$tmp" | \
X sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
X done
X ;;
X esac
Xfi
X
X: preserve RCS keywords in files with variable substitution, grrr
XId='$Id'
X
X: Finish up by extracting the .SH files
Xcase "$alldone" in
Xexit)
X $rm -rf UU
X echo "Done."
X exit 0
X ;;
Xcont)
X ;;
X'')
X echo " "
X dflt=''
Xecho "If you didn't make any mistakes, then just type a carriage return here."
X rp="If you need to edit config.sh, do it as a shell escape here:"
X . ./UU/myread
X case "$ans" in
X '') ;;
X *) : in case they cannot read
X eval $ans;;
X esac
X ;;
Xesac
X
X: if this fails, just run all the .SH files by hand
X. ./config.sh
X
Xecho " "
Xexec 1>&3
X. ./UU/extract
X
Xif $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
X dflt=n
X case "$silent" in
X true) ;;
X *)
X $cat <<EOM
X
XNow you need to generate make dependencies by running "make depend".
XYou might prefer to run it in background: "make depend > makedepend.out &"
XIt can take a while, so you might not want to run it right now.
X
XEOM
X ;;
X esac
X rp="Run make depend now?"
X . UU/myread
X case "$ans" in
X y*)
X make depend && echo "Now you must run a make."
X ;;
X *)
X echo "You must run 'make depend' then 'make'."
X ;;
X esac
Xelif test -f [Mm]akefile; then
X echo " "
X echo "Now you must run a make."
Xelse
X echo "Done."
Xfi
X
X$rm -f kit*isdone ark*isdone
X$rm -rf UU
X: End of Configure
!STUFFY!FUNK!
chmod +x Configure
echo "End of kit 2 (of 3)"
echo " "
cat /dev/null >kit2isdone
run=''
config=''
for iskit in 1 2 3; do
if test -f kit${iskit}isdone; then
run="$run $iskit"
else
todo="$todo $iskit"
fi
done
case $todo in
'')
echo "You have run all your kits. Please read README and then type Configure."
chmod 755 Configure
rm -f kit*isdone
;;
*) echo "You have run$run."
echo "You still need to run$todo."
;;
esac
: Someone might mail this, so exit before signature...
exit 0
--
__ _____ __ __
| || _ \ | \/ | Logix GmbH +49-611-309797
__| || ___/ | | Moritzstrasse 50 j...@Logix.DE
|_____||__| |__||__| D-6200 Wiesbaden ...!uunet!mcsun!unido!logixwi!jpm
0 new messages