📄 configure
字号:
EOT case "$d_phostcmd" in "$define") dflt=n;; "$undef") dflt=y;; '') case "$d_portable" in "$define") dflt=n ;; *) dflt=y ;; esac;; esac rp="Do you want your host name compiled in?" . ./myread case "$ans" in n*) ;; *) aphostcmd='';; esac;; esac;;esaccase "$aphostcmd" in'') d_phostcmd="$undef";;*) d_phostcmd="$define";;esac: see if there is a getpwentecho " "if set getpwent val -f d_getpwent; eval $csym; $val; then echo "getpwent() found." >&4 val="$define"else echo "No getpwent() found -- will use getpw() instead." >&4 val="$undef"fiset d_getpwenteval $setvar: where do we get termlib routines fromecho " "ans=`./loc libcurses.a x $libpth`case "$ans" in/*) ar t $ans >grimble if $contains tputs.o grimble >/dev/null 2>&1; then termlib='-lcurses' d_havetlib="$define" echo "Terminfo library found." >&4 else ans=x fi rm -f grimble ;;esaccase "$ans" inx) ans=`loc libtermlib.a x $libpth` case "$ans" in /usr/lib*|/lib*) termlib='-ltermlib' d_havetlib="$define" echo "Termlib library found." >&4 ;; /*) termlib="$ans" d_havetlib="$define" echo "Termlib library found." >&4 ;; *) ans=`loc libtermcap.a x $libpth` case "$ans" in /usr/lib*|/lib*) termlib='-ltermcap' d_havetlib="$define" echo "Termcap library found." >&4 ;; /*) termlib="$ans" d_havetlib="$define" echo "Termcap library found." >&4 ;; *) case "$termlib" in '') dflt=yrp="Your system appears to NOT have termlib-style routines. Is this true?" . ./myread case "$ans" in n*|f*) d_havetlib="$define" $cat <<'EOM'Then where are the termlib-style routines kept? Specify either -llibnameor a full pathname (~name ok).EOM dflt='' rp='Specify termlib path:' . ./myread termlib=`filexp $ans` ;; *) d_havetlib="$undef" termlib='' echo "You will have to play around with term.c then." >&4 ;; esac echo " ";; *) echo "You said termlib was $termlib before." >&4;; esac;; esac;; esac;;esac: Decide whether to ignore the ORGANIZATION environment variablecase "$d_ignoreorg" in"$define") dflt=y ;;*) dflt=n ;;esaccat <<'EOM'Trn normally looks in the environment variables NEWSORG and ORGANIZATIONfor an overriding organization name. However, if your operating systemreserves the environment variable ORGANIZATION for other purposes, youwill want to ignore it and only have trn check for NEWSORG.EOMrp='Should trn ignore ORGANIZATION?'. ./myreadcase "$ans" iny*) d_ignoreorg="$define" ;;*) d_ignoreorg="$undef" ;;esac: determine the name of a reasonable mailercase "$mailer" in'') if $test -f "$sendmail"; then dflt="$sendmail" elif $test -f "$smail"; then dflt="$smail" elif $test -f "$rmail"; then dflt="$rmail" elif $test -f /bin/mail; then dflt=/bin/mail else dflt=$mail fi ;;*) dflt="$mailer";;esac$cat <<EOMI need the full pathname of the program used to deliver mail on your system.A typical answer would be /usr/lib/sendmail or /bin/rmail, but you may chooseany other program, as long as $package can feed its standard input and itwill honour any user-supplied headers.EOMfn=frp='Mail transport agent to be used?'. ./getfilemailer="$ans": check for internet mailercase "$d_internet" in"$undef") dflt=n;;*) dflt=y;;esaccat <<EOM Most mailers can deliver mail to addresses of the INTERNET persuasion,such as user@host.edu. Some older mailers, however, require the completepath to the destination to be specified in the address.EOMrp="Does your mailer understand INTERNET addresses?". ./myreadcase "$ans" iny*) val="$define";;*) val="$undef";;esacset d_interneteval $setvar: see how we invoke the C preprocessorecho " "echo "Now, how can we feed standard input to your C preprocessor..." >&4cat <<'EOT' >testcpp.c#define ABC abc#define XYZ xyzABC.XYZEOTcd ..echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdinchmod 755 cppstdinwrapper=`pwd`/cppstdincd UUif $test "X$cppstdin" != "X" && \ $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "You used to use $cppstdin $cppminus so we'll use that again."elif $test "$cc" = gcc && \ (echo "Using gcc, eh? We'll try to force gcc -E using a wrapper..."; \ $wrapper <testcpp.c >testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1) ; then echo "Yup, we can." cppstdin="$wrapper" cppminus='';elif echo 'Maybe "'"$cc"' -E" will work...'; \ $cc -E <testcpp.c >testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, it does." cppstdin="$cc -E" cppminus='';elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \ $cc -E - <testcpp.c >testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, it does." cppstdin="$cc -E" cppminus='-';elif echo 'Uh-uh. Time to get fancy. Trying a wrapper...'; \ $wrapper <testcpp.c >testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then cppstdin="$wrapper" cppminus='' echo "Eureka!"elif echo 'No such luck, maybe "'$cpp'" will work...'; \ $cpp <testcpp.c >testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "It works!" cppstdin="$cpp" cppminus='';elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \ $cpp - <testcpp.c >testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Hooray, it works! I was beginning to wonder." cppstdin="$cpp" cppminus='-';elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \ $cc -P <testcpp.c >testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yipee, that works!" cppstdin="$cc -P" cppminus='';elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \ $cc -P - <testcpp.c >testcpp.out 2>&1; \ $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "At long last!" cppstdin="$cc -P" cppminus='-';else dflt='' rp="No dice. I can't find a C preprocessor. Name one:" . ./myread cppstdin="$ans" $cppstdin <testcpp.c >testcpp.out 2>&1 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "OK, that will do." >&4 elseecho "Sorry, I can't get that to work. Go find one and rerun Configure." >&4 exit 1 fifi$rm -f testcpp.c testcpp.out: determine filename position in cpp outputecho " "echo "Computing filename position in cpp output for #include directives..." >&4echo '#include <stdio.h>' > foo.c$cat >fieldn <<EOF$startsh$cppstdin $cppminus $cppflags <foo.c 2>/dev/null | \$grep '^[ ]*#.*stdio\.h' | \while read cline; do pos=1 set \$cline while $test \$# -gt 0; do if $test -r \`echo \$1 | $tr -d '"'\`; then echo "\$pos" exit 0 fi shift pos=\`expr \$pos + 1\` donedoneEOFchmod +x fieldnfieldn=`./fieldn`$rm -f foo.c fieldncase $fieldn in'') pos='???';;1) pos=first;;2) pos=second;;3) pos=third;;*) pos="${fieldn}th";;esacecho "Your cpp writes the filename in the $pos field of the line.": locate header file$cat >findhdr <<EOF$startshwanted=\$1name=''if test -f $usrinc/\$wanted; then echo "$usrinc/\$wanted" exit 0fiawkprg='{ print \$$fieldn }'echo "#include <\$wanted>" > foo\$\$.c$cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \$grep "^[ ]*#.*\$wanted" | \while read cline; do name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\` case "\$name" in */\$wanted) echo "\$name"; exit 0;; *) name='';; esac;done;$rm -f foo\$\$.c;case "\$name" in'') exit 1;;esacEOFchmod +x findhdr: see if there are directory access routines out thereecho " "if $test `./findhdr ndir.h` && \ ( $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a ); then echo "Ndir library found." >&4 if $test -r /usr/lib/libndir.a; then libndir='-lndir' else libndir="/usr/local/lib/libndir.a" fi d_libndir="$define" d_usendir="$undef" ndirc='' ndiro=''else libndir='' d_libndir="$undef" if set readdir val -f; eval $csym; $val; then echo "No ndir library found, but you have readdir() so we'll use that." >&4 d_usendir="$undef" ndirc='' ndiro='' else echo "No ndir library found--using ./ndir.c." >&4 d_usendir="$define" ndirc='ndir.c' ndiro='ndir.o' fifi: get news administrator namecase "$newsadmin" in'') if $contains "^news:" /etc/passwd >/dev/null 2>&1 ; then dflt=news elif $contains "^usenet:" /etc/passwd >/dev/null 2>&1 ; then dflt=usenet elif eunice; then dflt=system else dflt=root fi ;;*) dflt="$newsadmin" ;;esac$cat <<'EOM' Many systems keep their news in a private directory, or have a non-superuserin charge of administering news. (If you don't have such a user, take thedefault answer.) I need the login name (not directory) which is used fornews administration.EOMrp="News admin login?". ./myreadnewsadmin="$ans"case "$newsadmin" inroot) val="$undef" ;;*) val="$define" ;;esacset d_newsadmeval $setvar: check for buffering of stdoutecho " "case "$d_nolnbuf" in'') $cat <<'EOT' >blurfl.c#include <stdio.h>main(){ int i; for (i = 0; i < 5; i++) { putchar(i+'a'); sleep(1); } putchar('\n');}EOT $cc blurfl.c -o blurfl >/dev/null 2>&1; $rm -f blurfl.c $cat >&4 <<'EOM'Checking for buffering of stdout to terminal.Observe the following characters as they are printed out, to see whether theyprint out all at once, or with a 1 second pause between each of them. If theyprint out one by one, you don't have buffering. If they print together (afterabout a 5 second pause), you do have buffering.EOM dflt='' rp="Type return to start printing the test characters:" . ./myread ans=y while $test "$ans" = 'y'; do blurfl 1>&4 dflt=n rp='Would you like to see that again?' . ./myread done dflt=y rp="Do you have buffering (printed all at once)?" . ./myread case "$ans" in n*) val="$define";; *) val="$undef";; esac ;;*) case "$d_nolnbuf" in "$define") dflt=n;; *) dflt=y;; esac rp="Do you have buffering on stdout to terminals?" . ./myread case "$ans" in n*) val="$define";; *) val="$undef";; esac ;;esacset d_nolnbufeval $setvar: see if we need -ljobs and if we have sigset, etc.echo " "if $test -r /usr/lib/libjobs.a || $test -r /usr/local/lib/libjobs.a ; then echo "Jobs library found." >&4 val="$undef" jobslib='-ljobs'else if bsd; then echo "No jobs library found. (I suppose this is at least 4.2...)" >&4 else echo "No jobs library found. (That's okay, we all have our faults.)" >&4 fi val="$define" jobslib=''fiset d_normsigeval $setvar: get C preprocessor symbols handyecho " "echo $attrlist | $tr ' ' '\012' >Cppsym.know$cat <<EOSS >Cppsym$startshcase "\$1" in-l) list=true shift ;;esacunknown=''case "\$list\$#" in1|2) for sym do if $contains "^\$1$" Cppsym.true >/dev/null 2>&1; then exit 0 elif $contains "^\$1$" Cppsym.know >/dev/null 2>&1; then : else unknown="\$unknown \$sym" fi done set X \$unknown shift ;;esaccase \$# in0) exit 1;;esacecho \$* | $tr ' ' '\012' | $sed -e 's/\(.*\)/\\#ifdef \1\\exit 0; _ _ _ _\1\\ \1\\#endif\\/' >Cppsym\$\$echo "exit 1; _ _ _" >>Cppsym\$\$$cppstdin $cppminus <Cppsym\$\$ | $grep '^exit [01]; _ _' >Cppsym2\$\$case "\$list" intrue) $awk 'NF > 5 {print substr(\$6,2,100)}' <Cppsym2\$\$ ;;*) sh Cppsym2\$\$ status=\$? ;;esac$rm -f Cppsym\$\$ Cppsym2\$\$exit \$statusEOSSchmod +x Cppsym$eunicefix Cppsymecho "Your C preprocessor defines the following symbols:"Cppsym -l $attrlist >Cppsym.true$cat Cppsym.true: see if there is a vfork$echo " "if set vfork val -f d_hvfork; eval $csym; $val; then $echo "vfork() found." >&4 if Cppsym sgi; then $echo "However, IRIX vfork() is buggy. We'll use fork() instead." >&4 val="$define" else val="$undef" fielse $echo "No vfork() found--will use fork() instead." >&4 val="$define"fiset d_novforkeval $setvarcase "$d_novfork" in"$define") d_hvfork="$undef";;*) d_hvfork="$define";;esac: check for void typeecho " "$echo "Checking to see how well your C compiler groks the void type..."$cat >void.c <<'EOCP'void main();EOCPif $cc -c void.c >/dev/null 2>&1 ; then d_novoid="$undef" $echo "Yup, it does."else d_novoid="$define" $echo "Nope, it doesn't (boo hiss). I will substitute int."fi$rm void.*: see if rdchk existsset rdchk d_rdchkeval $inlibc: see if rename existsset rename d_renameeval $inlibc: see if sigblock existsif set sigblock val -f d_sigblock; eval $csym; $val; then $echo "sigblock() found." >&4 if Cppsym sgi; then $echo "We'll ignore it on this Silicon Graphics box, though." val="$undef" else val="$define" fielse val="$undef"fiset d_sigblockeval $setvar: see if sighold existsset sighold d_sigholdeval $inlibc: see if we need to define size_tif $contains 'size_t' /usr/include/string*.h >/dev/null 2>&1 ; then d_sizet="$undef"else d_sizet="$define"fi: index or strchr$echo " "if set index val -f; eval $csym; $val; then val="$undef" $echo "index() found." >&4elif set strchr val -f d_strchr; eval $csym; $val; then val="$define" $echo "strchr() found." >&4else $echo "No index() or strchr() found!" >&4 val="$undef"fiset d_strchreval $setvar: see if
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -