|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: C T
Length: 21237 (0x52f5) Types: TextFile Names: »Configure«
└─⟦060c9c824⟧ Bits:30007080 DKUUG TeX 2/12/89 └─⟦this⟧ »./tex82/TeXpatches/patch/Configure«
#! /bin/sh # # 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 $ # # $Log: Configure,v $ # 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.) define='define' undef='/*undef' d_eunice='' eunicefix='' loclist='' expr='' sed='' echo='' cat='' rm='' mv='' cp='' tail='' tr='' mkdir='' sort='' uniq='' grep='' trylist='' test='' inews='' egrep='' more='' pg='' Mcc='' vi='' mailx='' Log='' Header='' bin='' cc='' contains='' cpp='' d_index='' d_void='' iandd='' libc='' mansrc='' manext='' n='' c='' package='' registers='' reg1='' reg2='' reg3='' reg4='' reg5='' reg6='' reg7='' reg8='' reg9='' reg10='' reg11='' reg12='' reg13='' reg14='' reg15='' reg16='' spitshell='' shsharp='' sharpbang='' startsh='' CONFIG='' package=patch echo "Beginning of configuration questions for $package kit." : Eunice requires " " instead of "", can you believe it echo " " : sanity checks 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 $$) if test ! -t 0; then echo "Say 'sh Configure', not 'sh <Configure'" exit 1 fi : some greps do not return status, grrr. echo "grimblepritz" >grimble if grep blurfldyick grimble >/dev/null 2>&1 ; then contains=contains else if grep grimblepritz grimble >/dev/null 2>&1 ; then contains=grep else contains=contains fi fi rm -f grimble : the following should work in any shell case "$contains" in contains*) echo " " echo "AGH! Grep doesn't return a status. Attempting remedial action." cat >contains <<'EOSS' grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp EOSS chmod 755 contains esac : 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 "...using -n." n='-n' c='' else echo "...using \\\c" echo "c." n='' c='\c' fi echo $n "Type carriage return to continue. Your cursor should be here-->$c" read ans rm -f .echotmp : now set up to do reads with possible shell escape : if this does not work on your machine, 1,$ s/. myread/read ans/ cat <<EOSC >myread ans='!' while expr "X\$ans" : "X!" >/dev/null; do read ans case "\$ans" in !) sh echo " " echo $n "\$rp $c" ;; !*) set \`expr "X\$ans" : "X!\(.*\)\$"\` sh -c "\$*" echo " " echo $n "\$rp $c" ;; esac done rp='Your answer:' EOSC : general instructions cat <<EOH 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)". EOH rp="[Type carriage return to continue]" echo $n "$rp $c" . myread cat <<EOH 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. EOH rp="[Type carriage return to continue]" echo $n "$rp $c" . myread : get old answers, if there is a config file out there if test -f config.sh; then echo " " rp="I see a config.sh file. Did Configure make it on THIS system? [y]" echo $n "$rp $c" . myread case "$ans" in n*) echo "OK, I'll ignore it.";; *) echo "Fetching default answers from your old config.sh file..." . config.sh ;; esac fi : get list of predefined functions in a handy place echo " " if test -f /lib/libc.a; then echo "Your C library is in /lib/libc.a. You're normal." libc=/lib/libc.a else if test -f /usr/lib/libc.a; then echo "Your C library is in /usr/lib/libc.a, of all places." libc=/usr/lib/libc.a else if test -f "$libc"; then echo "Your C library is in $libc, like you said before." else cat <<'EOM' 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 EOM echo $n "of your C library? $c" rp='C library full name?' . myread libc="$ans" fi fi fi echo " " echo $n "Extracting names from $libc for later perusal...$c" if ar t $libc > libc.list; then echo "done" else echo " " echo "The archiver doesn't think $libc is a reasonable library." exit 1 fi : make some quick guesses about what we are up against echo " " echo $n "Hmm... $c" if $contains SIGTSTP /usr/include/signal.h >/dev/null 2>&1 ; then echo "Looks kind of like a BSD system, but we'll see..." echo exit 0 >bsd echo exit 1 >usg echo exit 1 >v7 else if $contains fcntl libc.list >/dev/null 2>&1 ; then echo "Looks kind of like a USG system, but we'll see..." echo exit 1 >bsd echo exit 0 >usg echo exit 1 >v7 else echo "Looks kind of like a version 7 system, but we'll see..." echo exit 1 >bsd echo exit 1 >usg echo exit 0 >v7 fi fi if $contains vmssystem libc.list >/dev/null 2>&1 ; then cat <<'EOI' 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. EOI echo "exit 0" >eunice eunicefix=unixtovms d_eunice="$define" : it so happens the Eunice I know will not run shell scripts in Unix format else echo " " echo "Congratulations. You aren't running Eunice." eunicefix=':' d_eunice="$undef" echo "exit 1" >eunice fi chmod 755 bsd usg v7 eunice $eunicefix bsd usg v7 eunice : see if sh knows # comments echo " " 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." shsharp=true spitshell=cat echo " " echo "Okay, let's see if #! works on this system..." echo "#!/bin/echo hi" > try $eunicefix try chmod 755 try try > today if test -s today; then echo "It does." sharpbang='#!' else echo "#! /bin/echo hi" > try $eunicefix try chmod 755 try try > today if test -s today; then echo "It does." sharpbang='#! ' else echo "It doesn't." sharpbang=': use ' fi fi else echo "Your sh doesn't grok # comments--I will strip them later on." shsharp=false echo "exec grep -v '^#'" >spitshell chmod 755 spitshell $eunicefix spitshell spitshell=`pwd`/spitshell echo "I presume that if # doesn't work, #! won't work either!" sharpbang=': use ' fi : figure out how to guarantee sh startup echo " " echo "Checking out how to guarantee sh startup..." startsh=$sharpbang'/bin/sh' echo "Let's see if '$startsh' works..." cat >try <<EOSS $startsh set abc test "$?abc" != 1 EOSS chmod 755 try $eunicefix try if try; then echo "Yup, it does." else echo "Nope. You may have to fix up the shell scripts to make sure sh runs them." fi rm -f try today : find out where common programs are echo " " echo "Locating common programs..." pth="/usr/ucb /bin /usr/bin /usr/local /usr/local/bin /usr/lbin /etc /usr/lib" cat <<EOSC >loc $startsh thing=\$1 shift dflt=\$1 shift for dir in \$*; do case "\$thing" in .) if test -d \$dir/\$thing; then echo \$dir exit 0 fi ;; *) if test -f \$dir/\$thing; then echo \$dir/\$thing exit 0 fi ;; esac done echo \$dflt exit 1 EOSC chmod 755 loc $eunicefix loc loclist=" expr sed echo cat rm grep " trylist=" test Mcc " for file in $loclist; do xxx=`loc $file $file $pth` eval $file=$xxx case "$xxx" in /*) echo $file is in $xxx. ;; *) echo "I don't know where $file is. I hope it's in everyone's PATH." ;; esac done echo " " echo "Don't worry if any of the following aren't found..." ans=offhand for file in $trylist; do xxx=`loc $file $file $pth` eval $file=$xxx case "$xxx" in /*) echo $file is in $xxx. ;; *) echo "I don't see $file out there, $ans." ans=either ;; esac done case "$egrep" in egrep) echo "Substituting grep for egrep." egrep=$grep ;; esac case "$test" in test) echo "Hopefully test is built into your sh." ;; /bin/test) echo " " echo $n 'Is your "test" built into sh? [n] (OK to guess) '"$c" rp='test built into sh? [n]' . myread case "$ans" in y*) test=test ;; esac ;; *) test=test ;; esac case "$echo" in echo) echo "Hopefully echo is built into your sh." ;; /bin/echo) echo " " 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." else echo "They are not compatible--the echo builtin will be used." echo=echo fi $rm -f foo1 foo2 ;; *) echo=echo ;; esac : index or strcpy $echo " " 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]' . myread case "$ans" in n*|f*) d_index="$define" ;; *) d_index="$undef" ;; esac else $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]' . myread case "$ans" in n*|f*) d_index="$undef" ;; *) d_index="$define" ;; esac fi : check for void type $echo " " $echo "Checking to see if your C compiler groks the void type..." $cat >try.c <<'EOCP' void main(); EOCP if cc -c try.c >/dev/null 2>&1 ; then d_void="$undef" $echo "Yup, it does." else d_void="$define" $echo "Nope, it doesn't (boo hiss). I will substitute int." fi $rm -f try.* : see how we invoke the C preprocessor echo " " echo "Checking to see how your C preprocessor is invoked..." cat <<'EOT' >testcpp.c #define ABC abc #define XYZ xyz ABC.XYZ EOT 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 "Yup, it does." cpp='cc -E' else 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 "Yup, that does." cpp='cc -P' else 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." cpp='/lib/cpp' else echo 'Hmm...maybe you already told me...' case "$cpp" in '') ;; *) $cpp testcpp.c >testcpp.out 2>&1;; esac if $contains 'abc.xyz' testcpp.out >/dev/null 2>&1 ; then echo "Hooray, you did! I was beginning to wonder." else echo $n "Nope. I can't find a C preprocessor. Name one: $c" rp='Name a C preprocessor:' . myread cpp="$ans" $cpp 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." exit 1 fi fi fi fi fi rm -f testcpp.c testcpp.out : get C preprocessor symbols handy echo " " cat <<'EOT' >Cppsym.c char *sym[] = { #ifdef mc68000 "mc68000", #endif #ifdef sun "sun", #endif #ifdef gcos "gcos", #endif #ifdef unix "unix", #endif #ifdef ibm "ibm", #endif #ifdef gimpel "gimpel", #endif #ifdef interdata "interdata", #endif #ifdef tss "tss", #endif #ifdef os "os", #endif #ifdef mert "mert", #endif #ifdef pyr "pyr", #endif #ifdef vax "vax", #endif #ifdef pdp11 "pdp11", #endif #ifdef i8086 "i8086", #endif #ifdef z8000 "z8000", #endif #ifdef 3b2 "3b2", #endif #ifdef 3b5 "3b5", #endif #ifdef 3b20 "3b20", #endif #ifdef 3b200 "3b200", #endif 0}; main(argc,argv) int argc; char **argv; { int i; for (argc--,argv++; argc; argc--,argv++) { for (i=0; sym[i]; i++) { if (strcmp(argv[0],sym[i]) == 0) exit(0); } } exit(1); } EOT echo "Your machine appears to have the following attributes:" $cpp Cppsym.c | sed -n -e 's/^ "\(.*\)",$/\1/p' cc Cppsym.c -o Cppsym rm -f Cppsym.c : see how many register declarations we want to use case "$registers" in '') if Cppsym pdp11 i8086 z8000; then dflt=3 else if Cppsym sun mc68000; then dflt=10 else : if you have any other numbers for me, send them in dflt=6 fi 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 EOM $echo $n "each routine does your C compiler pay attention to? (OK to guess) [$dflt] $c" rp="# register declarations used? [$dflt]" . myread case "$ans" in '') ans=$dflt;; esac registers=$ans reg1='' awk "END { for (i=1; i<=16; i++) printf \"reg%d=''\n\", i}" </dev/null >.foo . .foo awk "END { for (i=1; i<=$registers; i++) printf \"reg%d=register\n\", i}" \ </dev/null >.foo . .foo rm -f .foo : preserve RCS keywords in files with variable substitution, grrr Log='$Log' Header='$Header' : set up shell script to do ~ expansion cat >filexp <<EOSS $startsh : expand filename case "\$1" in ~/*|~) $echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|" ;; ~*) if $test -f /bin/csh; then /bin/csh -f -c "glob \$1" $echo "" else name=\`$expr x\$1 : '..\([^/]*\)'\` dir=\`$sed </etc/passwd -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}'\` if $test ! -d "\$dir"; then me=\`basename \$0\` $echo "\$me: can't locate home directory for: \$name" >&2 exit 1 fi case "\$1" in */*) $echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\` ;; *) $echo \$dir ;; esac fi ;; *) $echo \$1 ;; esac EOSS chmod 755 filexp $eunicefix filexp : determine where public executables go case "$bin" in '') dflt=`loc . /bin /usr/local/bin /usr/lbin /usr/local /usr/bin` ;; *) dflt="$bin" ;; esac bin='blurfl/dyick' while $test ! -d "$bin" ; do case "$bin" in blurfl*) ;; *) $echo "$bin does not appear to exist." ;; esac $echo " " rp="Where do you want to put the public executables? [$dflt]" $echo $n "$rp $c" . myread bin="$ans" bin=`filexp $bin` case "$bin" in '') bin=$dflt ;; esac done : determine where manual pages go case "$mansrc" in '') dflt=`loc . /usr/man/man1 /usr/man/mann /usr/man/local/man1 /usr/man/u_man/man1 /usr/man/man1` ;; *) dflt="$mansrc" ;; esac mansrc='blurfl/dyick' while $test ! -d "$mansrc" ; do case "$mansrc" in blurfl*) ;; *) $echo "$mansrc does not appear to exist." ;; esac $echo " " rp="Where do the manual pages (source) go? [$dflt]" $echo $n "$rp $c" . myread mansrc=`filexp "$ans"` case "$mansrc" in '') mansrc=$dflt ;; esac done case "$mansrc" in *l) manext=l ;; *n) manext=n ;; *) manext=1 ;; esac : see if we need a special compiler $echo " " if usg; then case "$cc" in '') case "$Mcc" in /*) dflt='Mcc' ;; *) if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then dflt='cc -M' else dflt='cc' fi ;; esac ;; *) dflt="$cc";; esac $cat <<'EOM' 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 EOM $echo $n "this system? [$dflt] $c" rp="Command to resolve multiple refs? [$dflt]" . myread cc="$ans" case "$cc" in '') cc="$dflt" ;; esac else $echo "Not a USG system--assuming cc can resolve multiple definitions." cc=cc fi : see if we should throw a -i into the Makefile $echo " " 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 $n "$rp $c" . myread case "$ans" in n*|f*) iandd='' ;; *) iandd='-i' ;; esac else $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]' . myread case "$ans" in n*|f*) iandd='-i' ;; *) iandd='' ;; esac fi else $echo $n "Does your machine have separate I and D space? [n] $c" . myread case "$ans" in y*) iandd='-i' ;; *) iandd='' ;; esac fi $echo " " $echo "End of configuration questions." $echo " " : create config.sh file $echo " " $echo "Creating config.sh..." $spitshell <<EOT >config.sh $startsh # config.sh # This file was produced by running the Configure script. d_eunice='$d_eunice' eunicefix='$eunicefix' loclist='$loclist' expr='$expr' sed='$sed' echo='$echo' cat='$cat' rm='$rm' mv='$mv' cp='$cp' tail='$tail' tr='$tr' mkdir='$mkdir' sort='$sort' uniq='$uniq' grep='$grep' trylist='$trylist' test='$test' inews='$inews' egrep='$egrep' more='$more' pg='$pg' Mcc='$Mcc' vi='$vi' mailx='$mailx' Log='$Log' Header='$Header' bin='$bin' cc='$cc' contains='$contains' cpp='$cpp' d_index='$d_index' d_void='$d_void' iandd='$iandd' libc='$libc' mansrc='$mansrc' manext='$manext' n='$n' c='$c' package='$package' registers='$registers' reg1='$reg1' reg2='$reg2' reg3='$reg3' reg4='$reg4' reg5='$reg5' reg6='$reg6' reg7='$reg7' reg8='$reg8' reg9='$reg9' reg10='$reg10' reg11='$reg11' reg12='$reg12' reg13='$reg13' reg14='$reg14' reg15='$reg15' reg16='$reg16' spitshell='$spitshell' shsharp='$shsharp' sharpbang='$sharpbang' startsh='$startsh' CONFIG=true EOT : create config.h file $echo " " $echo "Creating config.h..." $cat <<EOT >config.h /* 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 Reg1 $reg1 /**/ #define Reg2 $reg2 /**/ #define Reg3 $reg3 /**/ #define Reg4 $reg4 /**/ #define Reg5 $reg5 /**/ #define Reg6 $reg6 /**/ #define Reg7 $reg7 /**/ #define Reg8 $reg8 /**/ #define Reg9 $reg9 /**/ #define Reg10 $reg10 /**/ #define Reg11 $reg11 /**/ #define Reg12 $reg12 /**/ #define Reg13 $reg13 /**/ #define Reg14 $reg14 /**/ #define Reg15 $reg15 /**/ #define Reg16 $reg16 /**/ EOT CONFIG=true if $contains '\.SH' MANIFEST >/dev/null 2>&1; then $echo " " $echo "Doing variable substitutions on .SH files..." set `$grep <MANIFEST '\.SH' | awk '{print $1}'` for file in $*; do case "$file" in */*) dir=`$expr X$file : 'X\(.*\)/'` file=`$expr X$file : 'X.*/\(.*\)'` (cd $dir && . $file) ;; *) . $file ;; esac done fi if $contains '^depend:' Makefile >/dev/null 2>&1; then $echo " " $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]" . myread case "$ans" in y*) make depend;; esac fi $rm -f libc.list kit*isdone bsd usg v7 eunice loc Cppsym if test -f Makefile; then $echo " " $echo "Now you must run a make." else $echo "Done." fi : end of Configure