📄 configure
字号:
esac rp="What flag indicates huge model? [$dflt]" $echo $n "$rp $c" . myread case "$ans" in none) ans=''; esac huge="$ans" ;; *) huge="$large";; esac case "$models" in *medium*) case "$medium" in '') dflt='-Mm';; *) dflt="$medium";; esac rp="What flag indicates medium model? [$dflt]" $echo $n "$rp $c" . myread case "$ans" in none) ans=''; esac medium="$ans" ;; *) medium="$large";; esac case "$models" in *small*) case "$small" in '') dflt='none';; *) dflt="$small";; esac rp="What flag indicates small model? [$dflt]" $echo $n "$rp $c" . myread case "$ans" in none) ans=''; esac small="$ans" ;; *) small='';; esac ;;*) echo "Unrecognized memory models--you may have to edit Makefile.SH" ;;esac: see if we need a special compilerecho " "if usg; then case "$cc" in '') case "$Mcc" in /*) dflt='Mcc' ;; *) case "$large" in -M*) dflt='cc' ;; *) if $contains '\-M' $mansrc/cc.1 >/dev/null 2>&1 ; then dflt='cc -M' else dflt='cc' fi ;; esac ;; esac ;; *) dflt="$cc";; esac $cat <<'EOM' On some systems the default C compiler will not resolve multiple globalreferences that happen to have the same name. On some such systems the"Mcc" command may be used to force these to be resolved. On other systemsa "cc -M" command is required. (Note that the -M flag on other systemsindicates a memory model to use!) If you have the Gnu C compiler, youmight wish to use that instead. What command will force resolution onEOM $echo $n "this system? [$dflt] $c" rp="Command to resolve multiple refs? [$dflt]" . myread cc="$ans"else case "$cc" in '') dflt=cc;; *) dflt="$cc";; esac rp="Use which C compiler? [$dflt]" $echo $n "$rp $c" . myread cc="$ans"ficase "$cc" in*gcc*) cpp=`./loc gcc-cpp $cpp $pth` case "$nativegcc" in '') case "$ccflags" in *-fpcc-struct-return*) dflt=n;; *) dflt=y;; esac ;; undef) dflt=n;; *) dflt=y;; esac echo " " rp="Are your system (especially dbm) libraries compiled with gcc? [$dflt]" $echo $n "$rp $c" . myread case "$ans" in n*) nativegcc="$undef"; gccflags='-fpcc-struct-return';; *) nativegcc="$define"; gccflags='';; esac case "$gccflags" in *-ansi*) ;; *-traditional*) ;; *) gccflags="$gccflags -traditional -Dvolatile=__volatile__" ;; esac ;;esac: determine optimize, if desired, or use for debug flag alsocase "$optimize" in' ') dflt="none" ;;'') dflt="-O"; ;;*) dflt="$optimize" ;;esaccat <<EOHSome C compilers have problems with their optimizers, by default, $packagecompiles with the -O flag to use the optimizer. Alternately, you mightwant to use the symbolic debugger, which uses the -g flag (on traditionalUnix systems). Either flag can be specified here. To use neither flag,specify the word "none". EOHrp="What optimizer/debugger flag should be used? [$dflt]"$echo $n "$rp $c". myreadoptimize="$ans"case "$optimize" in'none') optimize=" " ;;esaccase "$ccflags" in'') case "$cc" in *gcc*) dflt="$gccflags";; *) dflt='';; esac ;;*-fpcc-struct-return*) dflt="$ccflags";;*) case "$cc" in *gcc*) dflt="$ccflags $gccflags";; *) dflt="$ccflags";; esac ;;esacfor thisincl in $inclwanted; do if test -d $thisincl; then if test "x$thisincl" != "x$usrinclude"; then case "$dflt" in *$thisincl*);; *) dflt="$dflt -I$thisincl";; esac fi fidonecase "$optimize" in-g*) case "$dflt" in *DEBUGGING*);; *) dflt="$dflt -DDEBUGGING";; esac ;;esacif $contains 'LANGUAGE_C' $usrinclude/signal.h >/dev/null 2>&1; then case "$dflt" in *LANGUAGE_C*);; *) dflt="$dflt -DLANGUAGE_C";; *) if osf1; then dflt="$dflt -D__LANGUAGE_C__" else dflt="$dflt -DLANGUAGE_C" fi ;; esacfiif $contains '_NO_PROTO' $usrinclude/signal.h >/dev/null 2>&1; then case "$dflt" in *_NO_PROTO*);; *) osf1 || dflt="$dflt -D_NO_PROTO";; esacficase "$dflt" in'') dflt=none;;esaccat <<EOHYour C compiler may want other flags. For this question you shouldinclude -I/whatever and -DWHATEVER flags and any other flags used bythe C compiler, but you should NOT include libraries or ld flags like-lwhatever. For instance, this would be a good place to specify-DDEBUGGING. To use no flags, specify the word "none". EOHrp="Any additional cc flags? [$dflt]"$echo $n "$rp $c". myreadcase "$ans" innone) ans='';esacccflags="$ans": the following weeds options from ccflags that are of no interest to cppcppflags="$ccflags"case "$cc" in*gcc*) cppflags="$cppflags -D__GNUC__";;esaccase "$cppflags" in'');;*) set X $cppflags cppflags='' for flag; do case $flag in -D*|-U*|-I*|-traditional|-ansi|-nostdinc) cppflags="$cppflags $flag";; esac done case "$cppflags" in *-*) echo "(C preprocessor flags: $cppflags)";; esac ;;esaccase "$ldflags" in'') if venix; then dflt='-i -z' else dflt='none' fi ;;*) dflt="$ldflags";;esacecho " "rp="Any additional ld flags (NOT including libraries)? [$dflt]"$echo $n "$rp $c". myreadcase "$ans" innone) ans='';esacldflags="$ans"echo " "echo "Checking for optional libraries..."case "$libs" in'') dflt=' ';;*) dflt="$libs ";;esaccase "$libswanted" in'') libswanted='c_s';;esacfor thislib in $libswanted; do case "$thislib" in dbm) thatlib=ndbm;; *_s) thatlib=NONE;; *) thatlib="${thislib}_s";; *) thatlib=NONE;; esac xxx=`./loc lib$thislib.a X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib` if test -f $xxx; then echo "Found -l$thislib." case "$dflt" in *-l$thislib\ *|*-l$thatlib\ *);; *) dflt="$dflt -l$thislib ";; esac else xxx=`./loc lib$thislib.a X $libpth` if test -f $xxx; then echo "Found $xxx." case "$dflt" in *"$xxx "*);; *) dflt="$dflt $xxx ";; esac else xxx=`./loc Slib$thislib.a X $xlibpth` if test -f $xxx; then echo "Found -l$thislib." case "$dflt" in *-l$thislib\ *|*-l$thatlib\ *);; *) dflt="$dflt -l$thislib ";; esac else xxx=`./loc lib$thislib.so X /usr/ccs/lib /usr/lib /usr/ucblib /usr/local/lib /lib` if test -f $xxx; then echo "Found -l$thislib as a shared object only." case "$dflt" in *-l$thislib\ *|*-l$thatlib\ *);; *) dflt="$dflt -l$thislib ";; esac else echo "No -l$thislib." fi fi fi fidoneset X $dfltshiftdflt="$*"case "$dflt" in'') dflt='none';;esac$cat <<EOM Some versions of Unix support shared libraries, which makeexecutables smaller but make load time slightly longer.On some systems, mostly newer Unix System V's, the shared libraryis included by putting the option "-lc_s" as the last thing on thecc command line when linking. Other systems use shared librariesby default. There may be other libraries needed to compile $packageon your machine as well. If your system needs the "-lc_s" option,include it here. Include any other special libraries here as well.Say "none" for none.EOMecho " "rp="Any additional libraries? [$dflt]"$echo $n "$rp $c". myreadcase "$ans" innone) ans='';esaclibs="$ans": check for size of random number generatorecho " "case "$alignbytes" in'') echo "Checking alignment constraints..." $cat >try.c <<'EOCP'struct foobar { char foo; double bar;} try;main(){ printf("%d\n", (char*)&try.bar - (char*)&try.foo);}EOCP if $cc $ccflags try.c -o try >/dev/null 2>&1 ; then dflt=`./try` else dflt='?' echo "(I can't seem to compile the test program...)" fi ;;*) dflt="$alignbytes" ;;esacrp="Doubles must be aligned on a how-many-byte boundary? [$dflt]"$echo $n "$rp $c". myreadalignbytes="$ans"$rm -f try.c try: determine where public executables gocat <<EOF The following questions distinguish the directory in which executablesreside from the directory in which they are installed (and from which theyare presumably copied to the former directory by occult means). Thisdistinction is often necessary under afs. On most other systems, however,the two directories are the same. EOFcase "$bin" in'') dflt=`./loc . /usr/local/bin /usr/local/bin /usr/lbin /usr/local /usr/bin /bin` ;;*) dflt="$bin" ;;esaccont=truewhile $test "$cont" ; do rp="In which directory will public executables reside (~name ok)? [$dflt]" $echo "In which directory will public executables reside (~name ok)?" $echo $n "[$dflt] $c" . myread bin="$ans" bin=`./filexp $bin` if test -d $bin; then cont='' else case "$fastread" in yes) dflt=y;; *) dflt=n;; esac rp="Directory $bin doesn't exist. Use that name anyway? [$dflt]" $echo $n "$rp $c" . myread dflt='' case "$ans" in y*) cont='';; esac fidonecase "$bin" in ?????????????????????????) cat <<EOFNOTE: you have a fairly long path name there. Some systems have troubleexecuting a script if the #! line ends up longer than 32 characters. Ifyou have this trouble you may have to reinstall somewhere else, or makea symbolic link from someplace with a shorter name.EOF ;;esaccase "$installbin" in'') dflt=`echo $bin | sed 's#^/afs/#/afs/.#'` test -d $dflt || dflt="$bin" ;;*) dflt="$installbin" ;;esaccont=truewhile $test "$cont" ; do rp="In which directory will public executables be installed (~name ok)? [$dflt]" $echo "In which directory will public executables be installed (~name ok)?" $echo $n "[$dflt] $c" . myread installbin="$ans" installbin=`./filexp $installbin` if test -d $installbin; then cont='' else case "$fastread" in yes) dflt=y;; *) dflt=n;; esac rp="Directory $installbin doesn't exist. Use that name anyway? [$dflt]" $echo $n "$rp $c" . myread dflt='' case "$ans" in y*) cont='';; esac fidone: check for ordering of bytes in a longcase "$byteorder" in'')cat <<'EOM' In the following, larger digits indicate more significance. A big-endianmachine like a Pyramid or a Motorola 680?0 chip will come out to 4321. Alittle-endian machine like a Vax or an Intel 80?86 chip would be 1234. Othermachines may have weird orders like 3412. A Cray will report 87654321. Ifthe test program works the default is probably right.I'm now running the test program...EOM $cat >byteorder.c <<'EOCP'#include <stdio.h>main(){ int i; union { unsigned long l; char c[sizeof(long)]; } u; if (sizeof(long) > 4) u.l = (0x08070605L << 32) | 0x04030201L; else u.l = 0x04030201L; for (i=0; i < sizeof(long); i++) printf("%c",u.c[i]+'0'); printf("\n");}EOCP if $cc byteorder.c -o byteorder >/dev/null 2>&1 ; then dflt=`./byteorder` case "$dflt" in ????|????????) echo "(The test program ran ok.)";; *) echo "(The test program didn't run right for some reason.)";; esac else dflt='4321' echo "(I can't seem to compile the test program. Guessing big-endian...)" fi ;;*) echo " " dflt="$byteorder" ;;esacrp="What is the order of bytes in a long? [$dflt]"$echo $n "$rp $c". myreadbyteorder="$ans": check for ability to cast negative floats to unsignedecho " "echo 'Checking to see if your C compiler can cast weird floats to unsigned'$cat >try.c <<'EOCP'#include <signal.h>blech() { exit(3); }main(){ double f = -123; unsigned long along; unsigned int aint; unsigned short ashort; int result = 0; signal(SIGFPE, blech); along = (unsigned long)f; aint = (unsigned int)f; ashort = (unsigned short)f; if (along != (unsigned long)-123) result |= 1; if (aint != (unsigned int)-123) result |= 1; if (ashort != (unsigned short)-123) result |= 1; f = (double)0x40000000; f = f + f; along = 0; along = (unsigned long)f; if (along != 0x80000000) result |= 2; f -= 1; along = 0; along = (unsigned long)f; if (along != 0x7fffffff) result |= 1; f += 2; along = 0; along = (unsigned long)f; if (along != 0x80000001) result |= 2; exit(result);}EOCPif $cc -o try $ccflags try.c >/dev/null 2>&1; then ./try castflags=$?else castflags=3ficase "$castflags" in0) val="$define" echo "Yup, it does." ;;*) val="$undef" echo "Nope, it doesn't." ;;esacset d_castnegeval $setvar$rm -f try.*: 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.XYZEOTcd ..echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdinchmod 755 cppstdin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -