📄 configure
字号:
*) ans=''; case "\$silent-\$rp" in true-) ;; *) echo " " >&4;; esac;; esac;;*) case "\$silent" in true) case "\$rp" in '') ans='';; esac;; esac;;esacwhile expr "X\$ans" : "X!" >/dev/null; do read answ set x \$xxxm shift aok=''; eval "ans=\"\$answ\"" && aok=y case "\$answ" in "\$ans") case "\$ans" in "!") sh 1>&4 echo " " $myecho ;; !*) set x \`expr "X\$ans" : "X!\(.*\)\$"\` shift sh 1>&4 -c "\$*" echo " " $myecho ;; esac;; *) case "\$aok" in y) echo "*** Substitution done -- please confirm." xxxm="\$ans" ans=\`echo $n "\$ans$c" | tr '\012' ' '\` xxxm="\$ans" ans=! ;; *) echo "*** Error -- try again." ans=! ;; esac $myecho ;; esacdonecase "\$ans" in'') ans="\$xxxm";;esacEOSC: see if sh knows # commentsecho " "echo "Checking your sh to see if it knows about # comments..." >&4if 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/cat" >try $eunicefix try chmod +x try try > today if test -s today; then echo "It does." sharpbang='#!' else echo "#! /bin/cat" > try $eunicefix try chmod +x try try > today if test -s today; then echo "It does." sharpbang='#! ' else echo "It doesn't." sharpbang=': use ' fi fielse echo "Your sh doesn't grok # comments--I will strip them later on." shsharp=false echo "exec grep -v '^[ ]*#'" >spitshell chmod +x spitshell $eunicefix spitshell spitshell=`pwd`/spitshell echo "I presume that if # doesn't work, #! won't work either!" sharpbang=': use 'firm -f try today: figure out how to guarantee sh startupecho " "echo "Checking out how to guarantee sh startup..." >&4case "$SYSTYPE" in*bsd*|sys5*) startsh=$sharpbang"/$SYSTYPE/bin/sh";;*) startsh=$sharpbang'/bin/sh';;esacecho "Let's see if '$startsh' works..."cat >try <<EOSS$startshset abctest "$?abc" != 1EOSSchmod +x try$eunicefix tryif ./try; then echo "Yup, it does."elseecho "Nope. You may have to fix up the shell scripts to make sure sh runs them."firm -f try: general instructionscat <<EOH This installation shell script will examine your system and ask you questionsto determine how the trn package should be installed. If you get stuckon a question, you may use a ! shell escape to start a subshell or execute acommand. 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 allowedto 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 isallowed will be marked "(~name ok)".EOHrp=''dflt='Type carriage return to continue'. ./myreadcat <<'EOH'The prompter used in this script allows you to use shell variables andbackticks in your answers. You may use $1, $2, etc... to refer to the wordsin the default answer, as if the default line was a set of arguments given to ascript shell. This means you may also use $* to repeat the whole default line,so you do not have to re-type everything to add something to the default.Everytime there is a substitution, you will have to confirm. If there is anerror (e.g. an unmatched backtick), the default answer will remain unchangedand you will be prompted again.If you are in a hurry, you may run 'Configure -d'. This will bypass nearly allthe questions and use the computed defaults (or the previous answers if therewas already a config.sh file).EOH. ./myreadcat <<EOHMuch effort has been expended to ensure that this shell script will run on anyUnix system. If despite that it blows up on yours, your best bet is to editConfigure and run it again. Also, let me (davison@borland.com)know how I blew it. If you can't run Configure for some reason, you'll have togenerate a config.sh file by hand.This installation script affects things in two ways:1) it may do direct variable substitutions on some of the files included in this kit.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.If you make a mistake on a question, there is no easy way to back up to itcurrently. The easiest thing to do is to edit config.sh and rerun all the SHfiles. Configure will offer to let you do this before it runs the SH files.EOHdflt='Type carriage return to continue'. ./myread: find out where common programs areecho " "echo "Locating common programs..." >&4cat <<EOSC >loc$startshcase \$# in0) exit 1;;esacthing=\$1shiftdflt=\$1shiftfor 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 elif test -f \$dir/\$thing.exe; then : on Eunice apparently echo \$dir/\$thing exit 0 fi ;; esacdoneecho \$dfltexit 1EOSCchmod +x loc$eunicefix locloclist="awkcatcpechoexprgrepmkdirmvrmsedsorttailtruniq"trylist="Mccbashcppcshdateegrepinewsispellkshlessmailmorenroffpgrmailsendmailsmailtestunameuunamevi"pth=`echo $PATH | sed -e 's/:/ /g'`pth="$pth /lib /usr/lib"for file in $loclist; do xxx=`./loc $file $file $pth` eval $file=$xxx 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." ;; esacdoneecho " "echo "Don't worry if any of the following aren't found..."ans=offhandfor file in $trylist; do xxx=`./loc $file $file $pth` eval $file=$xxx eval _$file=$xxx case "$xxx" in /*) echo $file is in $xxx. ;; *) echo "I don't see $file out there, $ans." ans=either ;; esacdonecase "$egrep" inegrep) echo "Substituting grep for egrep." egrep=$grep ;;esaccase "$test" intest) echo "Hopefully test is built into your sh." ;;/bin/test) if sh -c "PATH= test true" >/dev/null 2>&1; then echo "Using the test built into your sh." test=test fi ;;*) test=test ;;esaccase "$echo" inecho) echo "Hopefully echo is built into your sh." ;;/bin/echo) echo " "echo "Checking compatibility between /bin/echo and builtin echo (if any)..." >&4 $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 case "$n" in '-n') n='' c='\c';; *) n='-n' c='';; esac cat <<FOOThey are not compatible! You are probably running ksh on a non-USG system.I'll have to use /bin/echo instead of the builtin, since Bourne shell doesn'thave echo built in and we may have to run some Bourne shell scripts. Thatmeans I'll have to use $ans to suppress newlines now. Life is ridiculous.FOO $echo $n "The star should be here-->$c" $echo "*" fi $rm -f foo1 foo2 ;;*) : cross your fingers echo=echo ;;esac: Try to determine whether config.sh was made on this systemxxx=`( ($uname -a) 2>/dev/null || hostname) 2>&1`case "$config_sh" in'')dflt=nif test -f ../config.sh; then eval "`grep myuname= ../config.sh`" if test "X$xxx" = "X$myuname"; then dflt=y fifi: Get old answers, if there is a config file out therehint=defaultif test -f ../config.sh; then echo " " rp="I see a config.sh file. Do you want to use it to set the defaults?" . ./myread case "$ans" in n*|N*) echo "OK, I'll ignore it.";; *) echo "Fetching default answers from your old config.sh file..." >&4 tmp="$n" ans="$c" . ../config.sh cp ../config.sh . n="$tmp" c="$ans" hint=previous ;; esacfi;;*) echo " " echo "Fetching default answers from $config_sh..." >&4 tmp="$n" ans="$c" cd .. cp $config_sh config.sh 2>/dev/null . ./config.sh cd UU cp ../config.sh . n="$tmp" c="$ans" hint=previous ;;esacmyuname=$xxx: Restore computed pathsfor file in $loclist $trylist; do eval $file="\$_$file"done: set up shell script to do ~ expansioncat >filexp <<EOSS$startsh: expand filenamecase "\$1" in ~/*|~) echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|" ;; ~*) if $test -f /bin/csh; then /bin/csh -f -c "glob \$1" failed=$? echo "" exit \$failed else name=\`$expr x\$1 : '..\([^/]*\)'\` dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\` 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 ;;esacEOSSchmod +x filexp$eunicefix filexp: check if NNTP is to be usedcase "$d_nntp" in"$define") dflt="y";;*) dflt="n";;esac$echo " "rp="Do you want to access news via NNTP?". ./myreadcase "$ans" inn*) d_nntp="$undef" d_xdata="$undef";;y*) d_nntp="$define" case "$d_xdata" in define) dflt="y";; *) dflt="n";; esac $cat <<'EOM'Trn allows you to use an after-market data-sending extension to NNTPinstead of a locally-maintained database (XTHREAD and XOVER are bothcurrently supported).EOM rp="Do you want to access a remote database via NNTP?" . ./myread case "$ans" in y*) d_xdata="$define" ;; *) d_xdata="$undef" ;; esac newsspool=/tmp $echo "net.foobar 00001 00001 y" > .falseactive case "$servername" in '') dflt="no default" ;; *) dflt="$servername";; esac $cat <<'EOM'Trn needs to know what machine you wish to use as a news server. Youcan specify a machine name directly, or a filename from which to readthe name (start the name with a slash or a tilde to distinguish it).Note also that the environment variable NNTPSERVER can be used forindividuals to override this default setting.EOM rp="Enter a file name (~name ok) or machine name:" . ./myread ans=`./filexp "$ans"` case "$ans" in /*) if $test ! -f $ans; then $echo "(You'll need to create $ans before trn will work.)" fi;; esac servername="$ans"esac: decide how portable to becase "$d_portable" in"$define") dflt=y;;*) dflt=n;;esac$cat <<'EOH' I can set things up so that your shell scripts and binaries are more portable,at what may be a noticable cost in performance. In particular, if youask to be portable, the following happens: 1) Shell scripts will rely on the PATH variable rather than using the paths derived above. 2) ~username interpretations will be done at run time rather than by Configure. 3) The system name will be determined at run time, if at all possible.EOHrp="Do you expect to run these scripts and binaries on multiple machines?". ./myreadcase "$ans" in y*) d_portable="$define" for file in $loclist; do eval $file=$file done ;; *) d_portable="$undef" ;;esac: now set up to get a file name with possible "~name" substitutionscat <<'EOSC' >getfiletilde=''fullpath=''already=''skip=''none_ok=''orig_rp="$rp"orig_dflt="$dflt"case "$fn" in*~*) tilde=true;;esaccase "$fn" in*/*) fullpath=true;;esaccase "$fn" in*+*) skip=true;;esaccase "$fn" in*n*) none_ok=true;;esaccase "$fn" in*f*) type='File';;*d*) type='Directory';;*l*) type='Locate'; fn=`expr $fn : '.*:\(.*\)'`;;esacwhat="$type"case "$what" inLocate) what='File';;esacwhile test "$type"; do redo='' rp="$orig_rp" dflt="$orig_dflt" case "$tilde" in true) rp="$rp (~name ok)";; esac . ./myread case "$ans" in none) value='' case "$none_ok" in true) type='';; esac ;; *) case "$tilde" in '') value="$ans";; *) value=`./filexp $ans` case $? in 0) if test "$ans" != "$value"; then echo "(That is $value on this particular system.)" fi ;; *) value="$ans";; esac case "$d_portable" in "$define") value="$ans";; esac ;; esac case "$fullpath" in true) case "$value" in /*) ;; *) redo=true case "$already" in true) echo "I shall only accept a full path name, as in /bin/ls." >&4 echo "Use a ! shell escape if you wish to check pathnames." >&4 ;; *) echo "Please give a full path name, starting with slash." >&4 case "$tilde" in true) echo "Note that using ~name is ok provided it expands well." >&4 already=true ;; esac esac ;;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -