📄 configure
字号:
loclist="catcpechoexprgrepmkdirmvrmsedsorttruniq"trylist="Mccbisoncppcshegreplinenroffperltestunameyacc"pth=`echo :$boPATH:$PATH:$eoPATH: | sed -e 's/:/ /g'`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)..." $echo $n "hi there$c" >Loc1.txt echo $n "hi there$c" >Loc2.txt if cmp Loc1.txt Loc2.txt >/dev/null 2>&1; then echo "They are compatible. In fact, they may be identical." else case "$n" in '-n') n='' c='\c' ans='\c' ;; *) n='-n' c='' ans='-n' ;; 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 rp="Your cursor should be here-->" $echo $n "$rp$c" . myread fi ;;*) : cross your fingers echo=echo ;;esac: 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" echo "" 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: get old answers, if there is a config file out therehint=defaultif test -f ../config.sh; then echo " " eval "`grep lastuname ../config.sh`" tmp=`(uname -a) 2>&1` if test "X$tmp" = "X$lastuname"; then dflt=y else dflt=n fi lastuname="$tmp" rp="I see a config.sh file. Did Configure make it on THIS system? [$dflt]" echo $n "$rp $c" . myread case "$ans" in n*) echo "OK, I'll ignore it."; mv ../config.sh ../config.sh.old;; *) echo "Fetching default answers from your old config.sh file..." tmp="$n" ans="$c" . ../config.sh n="$tmp" c="$ans" hint=previous ;; esacelse lastuname=`(uname -a) 2>&1`fiif test -d ../hints && test ! -f ../config.sh; then echo ' ' echo "First time through, eh? I have some defaults handy for the following systems:" (cd ../hints; ls -C *.sh | sed 's/\.sh/ /g') dflt='' : Half the following guesses are probably wrong... test -f /irix && dflt="$dflt sgi" test -f /xenix && dflt="$dflt sco_xenix" test -f /dynix && dflt="$dflt dynix" test -f /dnix && dflt="$dflt dnix" test -f /bin/mips && /bin/mips && dflt="$dflt mips" test -d /NextApps && test -f /usr/adm/software_version && dflt="$dflt next" if test -f /bin/uname || test -f /usr/bin/uname; then set `uname -a | tr '[A-Z]' '[a-z]'` test -f "../hints/$5.sh" && dflt="$dflt $5" case "$5" in 3b2) dflt="$dflt 3b2";; fps*) dflt="$dflt fps";; mips*) dflt="$dflt mips";; [23]100) dflt="$dflt mips";; next*) dflt="$dflt next" ;; 6000) dflt="$dflt mc6000";; esac test -f "../hints/$1.sh" && dflt="$dflt $1" case "$1" in aix) dflt="$dflt aix_rs" ;; sunos) case "$3" in 3.4) dflt="$dflt sunos_3_4" ;; 3.5) dflt="$dflt sunos_3_5" ;; 4.0.1) dflt="$dflt sunos_4_0_1" ;; 4.0.2) dflt="$dflt sunos_4_0_2" ;; esac ;; hp*ux) dflt="$dflt hpux" extra_hints="hp"`echo $5 | sed -e s#/#_#g -e s/..$/00/` if test -f ../hints/$extra_hints.sh; then dflt="$dflt $extra_hints" fi;; irix) dflt="$dflt sgi" ;; ultrix) case "$3" in 1*) dflt="$dflt ultrix_1" ;; 3*) dflt="$dflt ultrix_3" ;; 4*) dflt="$dflt ultrix_4" ;; esac ;; uts) dflt="$dflt uts" ;; $2) if test -f /etc/systemid; then set `echo $3 | sed 's/\./ /'` $4 if test -f ../hints/sco_$1_$2_$3.sh; then dflt="$dflt sco_$1_$2_$3" elif test -f ../hints/sco_$1_$2.sh; then dflt="$dflt sco_$1_$2" elif test -f ../hints/sco_$1.sh; then dflt="$dflt sco_$1" fi fi ;; esac fi set X `echo $dflt | tr ' ' '\012' | sort | uniq` shift dflt=${1+"$@"} case "$dflt" in '') dflt=none;; esac echo '(You may give one or more space-separated answers, or "none" if appropriate.' echo 'If your OS version has no hints, do not give a wrong version--say "none".)' rp="Which of these apply, if any? [$dflt]" echo $n "$rp $c" . myread for file in $ans; do if test -f ../hints/$file.sh; then . ../hints/$file.sh cat ../hints/$file.sh >>../config.sh hint=recommended fi doneficat >whoa <<'EOF'eval "was=\$$2"dflt=yecho ' 'echo "*** WHOA THERE!!! ***"echo " The $hint value for \$$2 on this machine was \"$was\"!"rp=" Keep the $hint value? [y]"echo $n "$rp $c". myreadcase "$ans" iny) td=$was; tu=$was;;esacEOFsetvar='td=$define; tu=$undef; set X $1; eval "was=\$$2";case "$val$was" indefineundef) . whoa; eval "$2=\$td";;undefdefine) . whoa; eval "$2=\$tu";;*) eval "$2=$val";;esac': determine where manual pages go$cat <<EOM $package has manual pages available in source form.EOMcase "$nroff" in'nroff') echo "However, you don't have nroff, so they're probably useless to you." case "$mansrc" in '') mansrc="none" ;; esacesacecho "If you don't want the manual sources installed, answer 'none'."case "$mansrc" in'') dflt=`./loc . none /usr/man/local/man1 /usr/man/man.L /usr/man/manl /usr/man/mann /usr/man/u_man/man1 /usr/man/man1 /usr/local/man/man1` ;;*) dflt="$mansrc" ;;esaccont=truewhile $test "$cont" ; do echo " " rp="Where do the manual pages (source) go (~name ok)? [$dflt]" $echo $n "$rp $c" . myread case "$ans" in 'none') mansrc='' cont='' ;; *) mansrc=`./filexp "$ans"` if $test -d "$mansrc"; then cont='' else if $test "$fastread" = yes; then dflt=y else dflt=n fi rp="Directory $mansrc doesn't exist. Use that name anyway? [$dflt]" $echo $n "$rp $c" . myread dflt='' case "$ans" in y*) cont='';; esac fi ;; esacdonecase "$mansrc" in'') manext='' ;;*l) manext=l ;;*n) manext=n ;;*o) manext=l ;;*p) manext=n ;;*C) manext=C ;;*L) manext=L ;;*) manext=1 ;;esac: Sigh. Well, at least the box is fast...echo " "$echo $n "Hmm... $c"case "$usrinclude" in'') dflt='/usr/include';;*) dflt=$usrinclude;;esacinclPath=''if $test -f /bin/mips && /bin/mips; then echo "Looks like a MIPS system..." $cat >usrinclude.c <<'EOCP'#ifdef SYSTYPE_BSD43/bsd43#endifEOCP if cc -E usrinclude.c > usrinclude.out && $contains / usrinclude.out >/dev/null 2>&1 ; then echo "and you're compiling with the BSD43 compiler and libraries." dflt='/bsd43/usr/include' inclPath='/bsd43' else echo "and you're compiling with the SysV compiler and libraries." fielse echo "Doesn't look like a MIPS system." echo "exit 1" >mips chmod +x mips $eunicefix mipsficont=truewhile $test "$cont" ; do echo " " rp="Where are the include files you want to use? [$dflt]" $echo $n "$rp $c" . myread usrinclude="$ans" if $test -d $ans; then cont='' else if $test "$fastread" = yes; then dflt=y else dflt=n fi rp="Directory $ans doesn't exist. Use that name anyway? [$dflt]" $echo $n "$rp $c" . myread dflt='' case "$ans" in y*) cont='';; esac fidone: make some quick guesses about what we are up againstecho " "echo exit 1 >bsdecho exit 1 >usgecho exit 1 >v7echo exit 1 >osf1echo exit 1 >euniceecho exit 1 >xenixecho exit 1 >venixcat $usrinclude/signal.h $usrinclude/sys/signal.h >guess.txt 2>/dev/nullif test "$usrinclude" = "/bsd43/usr/include" ; then echo "Looks kind of like a SysV MIPS running BSD, but we'll see..." echo exit 0 >bsdelif test -f /osf_boot || $contains "OSF/1" /usr/include/ctype.h; then echo "Looks like an OSF/1 system, but we'll see..." echo exit 0 >osf1elif test `echo abc | tr a-z A-Z` = Abc ; then echo "Looks kind of like a USG system, but we'll see..." echo exit 0 >usgelif $contains SIGTSTP guess.txt >/dev/null 2>&1 ; then echo "Looks kind of like a BSD system, but we'll see..." echo exit 0 >bsdelse echo "Looks kind of like a version 7 system, but we'll see..." echo exit 0 >v7ficase "$eunicefix" in*unixtovms*) cat <<'EOI'There is, however, a strange, musty smell in the air that reminds me ofsomething...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.EOI echo "exit 0" >eunice d_eunice="$define" ;;*) echo " " echo "Congratulations. You aren't running Eunice." d_eunice="$undef" ;;esacif test -f /xenix; then echo "Actually, this looks more like a XENIX system..." echo "exit 0" >xenixelse echo " " echo "It's not Xenix..."fichmod +x xenix$eunicefix xenixif test -f /venix; then echo "Actually, this looks more like a VENIX system..." echo "exit 0" >venixelse echo " " if xenix; then : null else echo "Nor is it Venix..." fifichmod +x bsd usg v7 osf1 eunice venix$eunicefix bsd usg v7 eunice venix: see what memory models we can supportcase "$models" in'') : We may not use Cppsym or we get a circular dependency through cc. : But this should work regardless of which cc we eventually use. cat >pdp11.c <<'EOP'main() {#ifdef pdp11 exit(0);#else exit(1);#endif}EOP cc -o pdp11 pdp11.c >/dev/null 2>&1 if pdp11 2>/dev/null; then dflt='unsplit split' else ans=`./loc . X /lib/small /lib/large /usr/lib/small /usr/lib/large /lib/medium /usr/lib/medium /lib/huge` case "$ans" in X) dflt='none';; *) if $test -d /lib/small || $test -d /usr/lib/small; then dflt='small' else dflt='' fi if $test -d /lib/medium || $test -d /usr/lib/medium; then dflt="$dflt medium" fi if $test -d /lib/large || $test -d /usr/lib/large; then dflt="$dflt large" fi if $test -d /lib/huge || $test -d /usr/lib/huge; then dflt="$dflt huge" fi esac fi ;;*) dflt="$models" ;;esac$cat <<EOM Some systems have different model sizes. On most systems they are calledsmall, medium, large, and huge. On the PDP11 they are called unsplit andsplit. If your system doesn't support different memory models, say "none".If you wish to force everything to one memory model, say "none" here andput the appropriate flags later when it asks you for other cc and ld flags.Venix systems may wish to put "none" and let the compiler figure things out.(In the following question multiple model names should be space separated.)EOMrp="Which models are supported? [$dflt]"$echo $n "$rp $c". myreadmodels="$ans"case "$models" innone) small='' medium='' large='' huge='' unsplit='' split='' ;;*split) case "$split" in '') if $contains '\-i' $mansrc/man1/ld.1 >/dev/null 2>&1 || \ $contains '\-i' $mansrc/man1/cc.1 >/dev/null 2>&1; then dflt='-i' else dflt='none' fi ;; *) dflt="$split";; esac rp="What flag indicates separate I and D space? [$dflt]" $echo $n "$rp $c" . myread case "$ans" in none) ans='';; esac split="$ans" unsplit='' ;;*large*|*small*|*medium*|*huge*) case "$models" in *large*) case "$large" in '') dflt='-Ml';; *) dflt="$large";; esac rp="What flag indicates large model? [$dflt]" $echo $n "$rp $c" . myread case "$ans" in none) ans=''; esac large="$ans" ;; *) large='';; esac case "$models" in *huge*) case "$huge" in '') dflt='-Mh';; *) dflt="$huge";;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -