📄 configure
字号:
wrapper=cppstdincase "$cppstdin" in/*cppstdin) cppstdin=cppstdin;;esaccp cppstdin UUcd 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 '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 '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 '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=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 and rerun Configure." exit 1 fifi: get list of predefined functions in a handy placeecho " "case "$libc" in'') libc=unknown;;esaccase "$nm_opts" in'') if test -f /mach_boot; then nm_opts='' elif test -d /usr/ccs/lib; then nm_opts='-p' else nm_opts='' fi ;;esac: on mips, we DO NOT want /lib, and we want inclPath/usr/libcase "$libpth" in'') if mips; then libpth='$inclPath/usr/lib /usr/local/lib' nm_opts="-B" else libpth='/usr/ccs/lib /lib /usr/lib /usr/ucblib /usr/local/lib' fi ;;esaccase "$libs" in*-lc_s*) libc=`./loc libc_s.a $libc $libpth`esaclibnames='';case "$libs" in'') ;;*) for thislib in $libs; do case "$thislib" in -l*) thislib=`expr X$thislib : 'X-l\(.*\)'` try=`./loc lib$thislib.a blurfl/dyick $libpth` if test ! -f $try; then try=`./loc lib$thislib blurfl/dyick $libpth` if test ! -f $try; then try=`./loc $thislib blurfl/dyick $libpth` if test ! -f $try; then try=`./loc Slib$thislib.a blurfl/dyick $xlibpth` if test ! -f $try; then try='' fi fi fi fi libnames="$libnames $try" ;; *) libnames="$libnames $thislib" ;; esac done ;;esacset /usr/ccs/lib/libc.sotest -f $1 || set /usr/lib/libc.sotest -f $1 || set /usr/shlib/libc.sotest -f $1 || set /usr/lib/libc.so.[0-9]*test -f $1 || set /lib/libsys_s.aeval set \$$#if test -f "$1"; then echo "Your (shared) C library seems to be in $1." libc="$1"elif test -f "$libc"; then echo "Your C library seems to be in $libc."elif test -f /lib/libc.a; then echo "Your C library seems to be in /lib/libc.a. You're normal." libc=/lib/libc.aelse if ans=`./loc libc.a blurfl/dyick $libpth`; test -f "$ans"; then : elif ans=`./loc libc blurfl/dyick $libpth`; test -f "$ans"; then libnames="$libnames "`./loc clib blurfl/dyick $libpth` elif ans=`./loc clib blurfl/dyick $libpth`; test -f "$ans"; then : elif ans=`./loc Slibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then : elif ans=`./loc Mlibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then : elif ans=`./loc Llibc.a blurfl/dyick $xlibpth`; test -f "$ans"; then : fi if test -f "$ans"; then echo "Your C library seems to be in $ans, of all places." libc=$ans else cat <<EOM I can't seem to find your C library. I've looked in the following places: $libpthNone of these seems to contain your C library. What is the full nameEOM dflt=None $echo $n "of your C library? $c" rp='C library full name?' . myread libc="$ans" fifiecho " "if test $libc = "/lib/libc"; then libc="$libc /lib/clib"ficat <<END If the guess above is wrong (which it might be if you're using a strangecompiler, or your machine supports multiple models), you can override it here.ENDdflt="$libc";rp="Your C library is where? [$dflt]"$echo $n "$rp $c". myreadlibc="$ans"echo " "echo $libc $libnames | tr ' ' '\012' | sort | uniq >libnames$echo "Extracting names from the following files for later perusal:"sed 's/^/ /' libnamesecho $n "This may take a while...$c"set X `cat libnames`shiftnm $nm_opts $* 2>/dev/null >libc.tmp$sed -n -e 's/^.* [ATDS] *[_.]*//p' -e 's/^.* [ATDS] //p' <libc.tmp >libc.listif $contains '^printf$' libc.list >/dev/null 2>&1; then echo doneelif $sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p' \ <libc.tmp >libc.list; \ $contains '^printf$' libc.list >/dev/null 2>&1; then echo doneelif $sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p' <libc.tmp >libc.list; \ $contains '^printf$' libc.list >/dev/null 2>&1; then echo doneelif $sed -n -e 's/^.* D __*//p' -e 's/^.* D //p' <libc.tmp >libc.list; \ $contains '^printf$' libc.list >/dev/null 2>&1; then echo doneelif $sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p' \ <libc.tmp >libc.list; \ $contains '^printf$' libc.list >/dev/null 2>&1; then echo doneelif $grep '|' <libc.tmp | $sed -n -e '/|COMMON/d' -e '/|DATA/d' -e '/ file/d' \ -e 's/^\([^ ]*\).*/\1/p' >libc.list $contains '^printf$' libc.list >/dev/null 2>&1; then echo doneelif $sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p' \ <libc.tmp >libc.list; \ $contains '^printf$' libc.list >/dev/null 2>&1; then echo doneelif $sed -n -e 's/^[ ]*[0-9][0-9a-f]*[ ]*Def. Text[ ]*//p' \ < libc.tmp | $sed -e 's/\[.*\]//' > libc.list; \ $contains '^printf$' libc.list >/dev/null 2>&1; then echo doneelse nm -p $* 2>/dev/null >libc.tmp $sed -n -e 's/^.* [AT] *_[_.]*//p' -e 's/^.* [AT] //p' <libc.tmp >libc.list if $contains '^printf$' libc.list >/dev/null 2>&1; then nm_opts='-p' echo "done" else echo " " echo "nm didn't seem to work right." echo "Trying ar instead..." if ar t $libc > libc.tmp; then for thisname in $libnames; do ar t $thisname >>libc.tmp done $sed -e 's/\.o$//' < libc.tmp > libc.list echo "Ok." else echo "ar didn't seem to work right." echo "Maybe this is a Cray...trying bld instead..." if bld t $libc | $sed -e 's/.*\///' -e 's/\.o:.*$//' > libc.list; then for thisname in $libnames; do bld t $libnames | \ $sed -e 's/.*\///' -e 's/\.o:.*$//' >>libc.list ar t $thisname >>libc.tmp done echo "Ok." else echo "That didn't work either. Giving up." exit 1 fi fi fifiif test -f /lib/syscalls.exp; then echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." sed -n 's/^\([^ ]*\)[ ]*syscall$/\1/p' /lib/syscalls.exp >>libc.listfiinlibc='echo " "; td=$define; tu=$undef;if $contains "^$1\$" libc.list >/dev/null 2>&1;then echo "$1() found"; eval "case \"\$$2\" in undef) . whoa; esac"; eval "$2=\$td";else echo "$1() NOT found"; eval "case \"\$$2\" in define) . whoa; esac"; eval "$2=\$tu"; fi': see if bcmp existsset bcmp d_bcmpeval $inlibc: see if bcopy existsset bcopy d_bcopyeval $inlibccase "$d_safebcpy" in'') : assume the worst d_safebcpy=undef case "$d_bcopy" in define) echo "Checking to see if your bcopy() can do overlapping copies..." $cat >safebcpy.c <<'EOCP'main(){ char buf[128]; register char *b; register int len; register int off; register int align; for (align = 7; align >= 0; align--) { for (len = 36; len; len--) { b = buf+align; bcopy("abcdefghijklmnopqrstuvwxyz0123456789", b, len); for (off = 1; off <= len; off++) { bcopy(b, b+off, len); bcopy(b+off, b, len); if (bcmp(b, "abcdefghijklmnopqrstuvwxyz0123456789", len)) exit(1); } } } exit(0);}EOCP if $cc safebcpy.c -o safebcpy $ccflags $libs >/dev/null 2>&1 ; then if ./safebcpy; then echo "It can." d_safebcpy=define else echo "It can't." fi else echo "(I can't compile the test program, so we'll assume not...)" fi ;; esac ;;esac: see if bzero existsset bzero d_bzeroeval $inlibc: see if sprintf is declared as int or pointer to charecho " "cat >ucbsprf.c <<'EOF'#include <stdio.h>main(){ int sprintf(); char buf[10]; exit((unsigned long)sprintf(buf,"%s","foo") > 10L);}EOFif $cc $ccflags ucbsprf.c -o ucbsprf >/dev/null 2>&1 && ./ucbsprf; then echo "Your sprintf() returns (int)." val="$undef"else echo "Your sprintf() returns (char*)." val="$define"fiset d_charsprfeval $setvar: see if vprintf existsecho " "if $contains '^vprintf$' libc.list >/dev/null 2>&1; then echo 'vprintf() found.' val="$define" cat >vprintf.c <<'EOF'#include <varargs.h>main() { xxx("foo"); }xxx(va_alist)va_dcl{ va_list args; char buf[10]; va_start(args); exit((unsigned long)vsprintf(buf,"%s",args) > 10L);}EOF if $cc $ccflags vprintf.c -o vprintf >/dev/null 2>&1 && ./vprintf; then echo "Your vsprintf() returns (int)." val2="$undef" else echo "Your vsprintf() returns (char*)." val2="$define" fielse echo 'vprintf() NOT found.' val="$undef" val2="$undef"fiset d_vprintfeval $setvarval=$val2set d_charvspreval $setvar: see if chsize existsset chsize d_chsizeeval $inlibc: see if crypt existsecho " "if $contains '^crypt$' libc.list >/dev/null 2>&1; then echo 'crypt() found.' val="$define" cryptlib=''else cryptlib=`./loc Slibcrypt.a "" $xlibpth` if $test -z "$cryptlib"; then cryptlib=`./loc Mlibcrypt.a "" $xlibpth` else cryptlib=-lcrypt fi if $test -z "$cryptlib"; then cryptlib=`./loc Llibcrypt.a "" $xlibpth` else cryptlib=-lcrypt fi if $test -z "$cryptlib"; then cryptlib=`./loc libcrypt.a "" $libpth` else cryptlib=-lcrypt fi if $test -z "$cryptlib"; then echo 'crypt() NOT found.' val="$undef" else val="$define" fifiset d_crypteval $setvar: get csh whereaboutscase "$csh" in'csh') val="$undef" ;;*) val="$define" ;;esacset d_csheval $setvar: see if readdir existsset readdir d_readdireval $inlibc: see if there are directory access routines out thereecho " "xxx=`./loc ndir.h x $usrinclude /usr/local/include $inclwanted`case "$xxx" inx) xxx=`./loc sys/ndir.h x $usrinclude /usr/local/include $inclwanted` ;;esacD_dirnamlen="$undef"I_dirent="$undef"I_sys_dir="$undef"I_my_dir="$undef"I_ndir="$undef"I_sys_ndir="$undef"libndir=''ndirc=''ndiro=''if $test -r $usrinclude/dirent.h; then echo "dirent.h found." if $contains 'd_namlen' $usrinclude/dirent.h >/dev/null 2>&1; then D_dirnamlen="$define" fi I_dirent="$define"elif $test -r $xxx; then echo "You seem to use <$xxx>," if $test "$d_readdir" = "$define"; then echo "and I can get readdir() from your C library." elif $test -r /usr/lib/libndir.a || $test -r /usr/local/lib/libndir.a; then echo "and I'll get the routines using -lndir ." libndir='-lndir' else ans=`./loc libndir.a x $libpth` case "$ans" in x) echo "but I can't find the ndir library!" ;; *) echo "and I found the directory library in $ans." libndir="$ans" ;; esac fi if $contains 'd_namlen' $xxx >/dev/null 2>&1; then D_dirnamlen="$define" fi case "$xxx" in sys/) I_sys_ndir="$define" ;; *) I_ndir="$define" ;; esacelse : The next line used to require this to be a bsd system. if $contains '^readdir$' libc.list >/dev/null 2>&1 ; then echo "No ndir library found, but you have readdir() so we'll use that." if $contains 'd_namlen' $usrinclude/sys/dir.h >/dev/null 2>&1; then D_dirnamlen="$define" fi I_sys_dir="$define" else echo "No ndir library found--using ./$d_ndir.c.": This will lose since $d_ndir.h is in another directory.: I doubt we can rely on it being in ../$d_ndir.h . : At least it will fail in a conservative manner. if $contains 'd_namlen' $d_ndir.h >/dev/null 2>&1; then D_dirnamlen="$define" fi I_my_dir="$define" ndirc="$d_ndir.c" ndiro="$d_ndir.o" fifival=$D_dirnamlen; set d_dirnamlen; eval $setvarval=$I_dirent; set i_dirent; eval $setvarval=$I_sys_dir; set i_sys_dir; eval $setvarval=$I_my_dir; set i_my_dir; eval $setvarval=$I_ndir; set i_ndir; eval $setvarval=$I_sys_ndir; set i_sys_ndir; eval $setvar: now see if they want to do setuid emulationcase "$d_dosuid" in'') dflt=n;;*undef*) dflt=n;;*) dflt=y;;esaccat <<EOM Some sites have disabled setuid #! scripts because of a bug in the kernelthat prevents them from being secure. If you are on such a system, thesetuid/setgid bits on scripts are currently useless. It is possible for$package to detect those bits and emulate setuid/setgid in a secure fashionuntil a better solution is devised for the kernel problem.EOMrp="Do you want to do setuid/setgid emulation? [$dflt]"$echo $n "$rp $c". myreadcase "$ans" in'') $ans="$dflt";;esaccase "$ans" iny*) d_dosuid="$define";;*) d_dosuid="$undef";;esac: see if dup2 existsset dup2 d_dup2eval $inlibc: see if fchmod existsset fchmod d_fchmodeval $inlibc: see if fchown existsset fchown d_fchowneval $inlibc: see if this is an fcntl systemset fcntl d_fcntleval $inlibc: 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.' val="$undef" else echo 'You can have filenames longer than 14 characters.' val="$define" fielse : version 8 probably echo "You can't have filenames longer than 14 chars. You can't even think about them!" val="$undef"fi set d_flexfnameval $setvar: see if flock existsset flock d_flockeval $inlibc: see if getgroups existsset getgroups d_getgrpseval $inlibc
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -