📄 configure
字号:
echo "Looks kind of like a BSD system, but we'll see..." echo exit 0 >bsd echo exit 1 >usg echo exit 1 >v7elif $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 >v7else echo "Looks kind of like a version 7 system, but we'll see..." echo exit 1 >bsd echo exit 1 >usg echo exit 0 >v7fiif $contains '^vmssystem$' libc.list >/dev/null 2>&1 ; then 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 eunicefix=unixtovms d_eunice="$define": it so happens the Eunice I know will not run shell scripts in Unix formatelse echo " " echo "Congratulations. You aren't running Eunice." eunicefix=':' d_eunice="$undef" echo "exit 1" >eunicefiif test -f /xenix; then echo "Actually, this looks more like a XENIX system..." echo "exit 0" >xenixelse echo " " echo "It's not Xenix..." echo "exit 1" >xenixfichmod +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..." fi echo "exit 1" >venixfichmod +x bsd usg v7 eunice venix$eunicefix bsd usg v7 eunice venixrmlist="$rmlist bsd usg v7 eunice venix xenix": see if sh knows # commentsecho " "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 +x try try > today if $contains hi today >/dev/null 2>&1; then echo "It does." sharpbang='#!' else echo "#! /bin/echo hi" > 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 'fi: figure out how to guarantee sh startupecho " "echo "Checking out how to guarantee sh startup..."startsh=$sharpbang'/bin/sh'echo "Let's see if '$startsh' works..."cat >try <<EOSS$startshset abctest "$?abc" != 1EOSSchmod +x try$eunicefix tryif try; then echo "Yup, it does."else echo "Nope. You may have to fix up the shell scripts to make sure sh runs them."firm -f try today#: see if sprintf is declared as int or pointer to char#echo " "#cat >.ucbsprf.c <<'EOF'#main() { char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L); }#EOF#if cc .ucbsprf.c -o .ucbsprf >/dev/null 2>&1 && .ucbsprf; then# echo "Your sprintf() returns (int)."# d_charsprf="$undef"#else# echo "Your sprintf() returns (char*)."# d_charsprf="$define"#fi#/bin/rm -f .ucbsprf.c .ucbsprf: see if we can have long filenamesecho " "rm -f 123456789abcdeif (echo hi >123456789abcdef) 2>/dev/null; then : not version 8 if test -f 123456789abcde; then echo 'You cannot have filenames longer than 14 characters. Sigh.' d_flexfnam="$undef" else echo 'You can have filenames longer than 14 characters.' d_flexfnam="$define" fielse : version 8 probably echo "You can't have filenames longer than 14 chars. V8 can't even think about them!" d_flexfnam="$undef"fi : index or strcpyecho " "case "$d_index" inn) dflt=n;;*) dflt=y;;esacif $contains '^index$' libc.list >/dev/null 2>&1 ; then if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then echo "Your system has both index() and strchr(). Shall I use" rp="index() rather than strchr()? [$dflt]" $echo $n "$rp $c" . myread case "$ans" in n*) d_index="$define" ;; *) d_index="$undef" ;; esac else d_index="$undef" echo "index() found." fielse if $contains '^strchr$' libc.list >/dev/null 2>&1 ; then d_index="$define" echo "strchr() found." else echo "No index() or strchr() found!" d_index="$undef" fifi: see if signal is declared as pointer to function returning int or voidecho " "if $contains 'void.*signal' /usr/include/signal.h >/dev/null 2>&1 ||$contains 'void.*signal' /usr/include/sys/signal.h >/dev/null 2>&1 ; then echo "You have void (*signal())() instead of int." d_voidsig="$define"else echo "You have int (*signal())() instead of void." d_voidsig="$undef"fi: check for directory libraryecho " "if test -f /usr/include/dirent.h; then echo "You have dirent.h." d_dirheader="#define DIRENT"elif test -f /usr/include/ndir.h; then echo "You have ndir.h." d_dirheader="#define USG"elif test -f /usr/include/sys/ndir.h; then echo "You have sys/ndir.h." d_dirheader="#define SYSNDIR#define USG"elif test -f /usr/include/sys/dir.h; then echo "You have sys/dir.h; I hope that's the BSD version." d_dirheader="#define SYSDIR"else echo "I can't find a directory library header file.That means you won't have numbered backups available." d_dirheader="#define NODIR"fi: check for unistd.hecho " "if test -f /usr/include/unistd.h; then echo "You have unistd.h." d_unistd="$define"else echo "I don't see unistd.h, but that's OK." d_unistd="$undef"fi: check for void typeecho " "$cat <<EOMChecking to see how well your C compiler groks the void type... Support flag bits are: 1: basic void declarations. 2: arrays of pointers to functions returning void. 4: operations between pointers to and addresses of void functions.EOMcase "$voidflags" in'') $cat >try.c <<'EOCP'#if TRY & 1void main() {#elsemain() {#endif extern void *moo(); void *(*goo)();#if TRY & 2 void (*foo[10])();#endif#if TRY & 4 if(*goo == moo) { exit(0); }#endif exit(0);}EOCP : Argh -- AIX 3.2 does not have cc -S! if cc -c -DTRY=7 try.c >.out 2>&1 ; then voidflags=7 echo "It appears to support void fully." if $contains warning .out >/dev/null 2>&1; then echo "However, you might get some warnings that look like this:" $cat .out fi else echo "Hmm, you compiler has some difficulty with void. Checking further..." if cc -c -DTRY=1 try.c >/dev/null 2>&1 ; then echo "It supports 1..." if cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then voidflags=3 echo "And it supports 2 but not 4." else echo "It doesn't support 2..." if cc -c -DTRY=3 try.c >/dev/null 2>&1 ; then voidflags=5 echo "But it supports 4." else voidflags=1 echo "And it doesn't support 4." fi fi else echo "There is no support at all for void." voidflags=0 fi fiesacdflt="$voidflags";rp="Your void support flags add up to what? [$dflt]"$echo $n "$rp $c". myreadvoidflags="$ans"$rm -f try.* .out: see how we invoke the C preprocessorecho " "echo "Now, how can we feed standard input to your C preprocessor..."cat <<'EOT' >testcpp.c#define ABC abc#define XYZ xyzABC.XYZEOTecho 'Maybe "'$cpp'" will work...'$cpp <testcpp.c >testcpp.out 2>&1if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, it does." cppstdin="$cpp" cppminus='';else echo 'Nope, maybe "'$cpp' -" will work...' $cpp - <testcpp.c >testcpp.out 2>&1 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Yup, it does." cppstdin="$cpp" cppminus='-'; else echo 'No such luck...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 "It works!" cppstdin='cc -E' cppminus=''; else echo 'Nixed again...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 "Hooray, it works! I was beginning to wonder." cppstdin='cc -E' cppminus='-'; 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." cppstdin='cc -P' cppminus=''; 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." cppstdin='cc -P' cppminus='-'; else echo 'Hmm...perhaps you already told me...' case "$cppstdin" in '') ;; *) $cppstdin $cppminus <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 'Uh-uh. Time to get fancy...' echo 'Trying (cat >/tmp/$$.c; cc -E /tmp/$$.c; rm /tmp/$$.c)' cppstdin='(cat >/tmp/$$.c; cc -E /tmp/$$.c; rm /tmp/$$.c)' cppminus=''; $cppstdin <testcpp.c >testcpp.out 2>&1 if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then echo "Eureka!." else dflt=blurfl $echo $n "No dice. I can't find a C preprocessor. Name one: $c" rp='Name a C preprocessor:' . 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." else echo "Sorry, I can't get that to work. Go find one." exit 1 fi fi fi fi fi fi fi fifirm -f testcpp.c testcpp.out: get C preprocessor symbols handyecho " ": AIX 3.2 rejects tr '[ - ]' because the range endpoints are the same.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\\/' >/tmp/Cppsym\$\$echo exit 1 >>/tmp/Cppsym\$\$$cppstdin $cppminus </tmp/Cppsym\$\$ >/tmp/Cppsym2\$\$case "\$list" intrue) awk 'NF > 5 {print substr(\$6,2,100)}' </tmp/Cppsym2\$\$ ;;*) sh /tmp/Cppsym2\$\$ status=\$? ;;esac$rm -f /tmp/Cppsym\$\$ /tmp/Cppsym2\$\$exit \$statusEOSSchmod +x Cppsym$eunicefix Cppsymecho "Your C preprocessor defines the following symbols:"Cppsym -l $attrlist >Cppsym.truecat Cppsym.truermlist="$rmlist Cppsym Cppsym.know Cppsym.true": see how many register declarations we want to usecase "$registers" in'') if Cppsym vax; then dflt=6 elif Cppsym sun mc68000 mc68k m68k; then dflt=10 elif Cppsym pyr; then dflt=14 elif Cppsym ns32000 ns16000; then dflt=5 elif Cppsym $smallmach; then dflt=3 else : if you have any other numbers for me, send them in dflt=6 fi ;;*) dflt=$registers ;;esaccat <<EOM Different C compilers on different machines pay attention to differentnumbers of register declarations. About how many register declarations inEOM$echo $n "each routine does your C compiler pay attention to? (OK to guess) [$dflt] $c"rp="# register declarations used? [$dflt]". myreadregisters=$ansreg1=''awk "BEGIN { for (i=1; i<=16; i++) printf \"reg%d=''\n\", i}" </dev/null >.foo. .fooawk "BEGIN { for (i=1; i<=$registers; i++) printf \"reg%d=register\n\", i}" \ </dev/null >.foo. .foorm -f .foo: preserve RCS keywords in files with variable substitution, grrrLog='$Log'Header='$Header': 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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -