📄 configure
字号:
eval $compileif test -s conftest; then echo "#define HAVE_rpmatch" >> defines.h echo "You have rpmatch()"else echo "You don't have rpmatch()"firm -f conftest conftest.c## 2. How is [n]curses installed?#test_curses_h=0have_ncurses=1if ! ./testincl "term.h"; then have_ncurses=0elif ./testincl -q "ncurses/curses.h"; then echo "HAVE_NCURSES=yes" >> make_include echo "CURSESFLAGS=-I/usr/include/ncurses -DNCH=0" >> make_include echo "You have ncurses. Using <ncurses/curses.h>."elif ./testincl -q "ncurses.h"; then echo "HAVE_NCURSES=yes" >> make_include echo "CURSESFLAGS=-DNCH=1" >> make_include echo "You have ncurses. Using <ncurses.h>."elif [ -f /usr/local/include/ncurses.h ]; then echo "HAVE_NCURSES=yes" >> make_include echo "CURSESFLAGS=-I/usr/local/include -DNCH=1" >> make_include echo "You have ncurses. Using /usr/local/include/ncurses.h."elif ./testincl -q "curses.h"; then test_curses_h=1else have_ncurses=0fi## If we found a curses.h, test whether it is ncurses# (It should define __NCURSES_H and NCURSES_VERSION and NCURSES_CONST ...)#if [ $test_curses_h = 1 ]; then echo " #include <curses.h> int main(){ char *c = NCURSES_VERSION; exit(0); } " > conftest.c eval $compile if test -s conftest; then echo "HAVE_NCURSES=yes" >> make_include echo "CURSESFLAGS=-DNCH=0" >> make_include echo "You have ncurses. Using <curses.h>." else have_ncurses=0 fi rm -f conftest conftest.cfiif [ $have_ncurses = 0 ]; then echo "HAVE_NCURSES=no" >> make_include echo "You don't have ncurses - I will not make ul and setterm."else echo "LIBCURSES=-lncurses" >> make_include echo "#define HAVE_ncurses" >> defines.hfi## 3. Some systems have /usr/lib/termcap.so -> /usr/lib/termcap.so.2# where however the latter file does not exist. When termcap does# not exist, we can try to compile more with curses instead.#echo '#include <termcap.h>int main(){ exit(0); tgetnum("li"); }' > conftest.cLIBS=-ltermcapeval $compileLIBS=if test -s conftest; then echo "#define HAVE_termcap" >> defines.h echo "HAVE_TERMCAP=yes" >> make_include echo "LIBTERMCAP=-ltermcap" >> make_include echo "You have termcap"else echo "HAVE_TERMCAP=no" >> make_include if [ $have_ncurses = 0 ]; then echo "You don't have termcap - I will not make more." else echo "You don't have termcap" fifirm -f conftest conftest.c## 4. Do we need -lcrypt?#echo '#define _XOPEN_SOURCE#include <unistd.h>int main(){ char *c = crypt("abc","pw"); exit(0); }' > conftest.ceval $compileif test -s conftest; then echo "NEED_LIBCRYPT=no" >> make_include echo "You don't need -lcrypt"else echo "NEED_LIBCRYPT=yes" >> make_include echo "You need -lcrypt"firm -f conftest conftest.c## 5. Does static compilation work?#echo "int main(){ return 0; }" > conftest.ceval $static_compileif test -s conftest; then : OK, nothing specialelse echo "CAN_DO_STATIC=no" >> make_include echo "Strange... Static compilation fails here."firm -f conftest.c conftest## 6. For lib/nls.h: do we have <libintl.h> and gettext() ?#echo '#include <libintl.h>int main(int a, char **v){ if (a == -1) /* false */ gettext("There is no gettext man page\n"); exit(0);}' > conftest.ceval $compileif test -s conftest; then echo '#define HAVE_libintl_h' >> defines.h echo "You have <libintl.h> and gettext()" echo '#define MAY_ENABLE_NLS' >> defines.h MAY_ENABLE_NLS=yeselse echo "You don't have native language support" MAY_ENABLE_NLS=nofirm -f conftest conftest.c## 7. Does xgettext exist and take the option --foreign-user?## We use the bash builtin "type" here.# I don't see an easy way to avoid it.# Many Linux systems do not have "which". Maybe "env" can be used.# Writing /usr/bin/xgettext is no good: one may have xgettext elsewhere.#if (test $MAY_ENABLE_NLS = yes && type xgettext > /dev/null 2>&1); then msg=`xgettext --foreign-user 2>&1 | grep unrecognized` if test -n "$msg"; then echo "FOREIGN = " >> make_include else echo "FOREIGN = --foreign-user" >> make_include fi echo "HAVE_XGETTEXT=yes" >> make_includeelse echo "HAVE_XGETTEXT=no" >> make_includefi## 8. For err.c: do we have __progname?# [make sure gcc -O does not optimize the access away]#echo "#include <stdio.h>extern char *__progname;int main(){ printf(__progname); exit(0); }" > conftest.ceval $compileif test -s conftest; then echo "#define HAVE_progname" >> defines.h echo "You have __progname"else echo "You don't have __progname"firm -f conftest conftest.c## 9. For script.c: do we have <pty.h> and openpty()?#echo "#include <pty.h>int main(){ exit(0); openpty(0, 0, 0, 0, 0); }" > conftest.cLIBS=-lutileval $compileLIBS=if test -s conftest; then echo "HAVE_OPENPTY=yes" >> make_include echo "#define HAVE_openpty" >> defines.h echo "You have <pty.h> and openpty()"else echo "You don't have <pty.h> and openpty()"firm -f conftest conftest.c## 10. For lib/widechar.h: do we have wide character support?# [Do we have the headers <wchar.h>, <wctype.h>, the types wchar_t, wint_t# and the fgetwc, fputwc, WEOF functions/macros?]#echo "#include <wchar.h>#include <wctype.h>#include <stdio.h>int main () { wchar_t wc; wint_t w; w = fgetwc(stdin); if (w == WEOF) exit(1); wc = w; fputwc(wc,stdout); exit(0);}" > conftest.ceval $compileif test -s conftest && ./conftest < conftest.c > /dev/null 2>/dev/null; then echo "#define ENABLE_WIDECHAR" >> defines.h echo "You have wide character support"else echo "You don't have wide character support"firm -f conftest conftest.c## 11. For pivot_root.c: does <sys/syscall.h> define SYS_pivot_root?#echo "#include <sys/syscall.h>#include <unistd.h>int main(void){ return SYS_pivot_root;}" >conftest.ceval $compileif test -s conftest; then echo "HAVE_PIVOT_ROOT=yes" >> make_include echo "You have SYS_pivot_root"else echo "You don't have SYS_pivot_root"firm -f conftest conftest.c## 12. For hwclock.c: does struct tm have a field tm_gmtoff?#echo "#include <time.h>#include <unistd.h>int main(int a, char **v){ struct tm *tm = localtime(0); if (a == -1) /* false */ sleep(tm->tm_gmtoff); exit(0);}" >conftest.ceval $compileif test -s conftest; then echo "#define HAVE_tm_gmtoff" >> defines.h echo "You have a tm_gmtoff field in struct tm"else echo "You don't have a tm_gmtoff field in struct tm"firm -f conftest conftest.c## 13. For nfsmount: does the output of rpcgen compile?## On some systems the output of rpcgen compiles with warnings# Here we conclude "Your rpcgen output does not compile"# and use pregenerated files. If one wishes to use rpcgen anyway,# just add the line "HAVE_GOOD_RPC=yes" to make_include.#rm -f conftest conftestx.c conftestl.c conftest.h conftest.xrm -f conftestx.o conftestl.oecho "#ifdef RPC_CLNT%#include <string.h> /* for memset() */#endif%#include <asm/types.h>typedef opaque fhandle[1];union fhstatus switch (unsigned fhs_status) {case 0: fhandle fhs_fhandle;default: void;};typedef string dirpath<1024>;struct ppathcnf { short pc_mask[2];};program MOUNTPROG { version MOUNTVERS { fhstatus MOUNTPROC_MNT(dirpath) = 1; } = 2;} = 100005;" > conftest.xif rpcgen -h -o conftest.h conftest.x 2> conferrs > /dev/null && \ rpcgen -c -o conftestx.c conftest.x 2>> conferrs > /dev/null && \ rpcgen -l -o conftestl.c conftest.x 2>> conferrs > /dev/null && \ $CC $CFLAGS -c conftestx.c 2>> conferrs > /dev/null && \ $CC $CFLAGS -c conftestl.c 2>> conferrs > /dev/null && \ test ! -s conferrsthen echo "HAVE_GOOD_RPC=yes" >> make_include echo "Your rpcgen seems to work"else echo "Your rpcgen output does not compile - using pregenerated code"firm -f conftest conftestx.c conftestl.c conftest.h conftest.x conferrsrm -f conftestx.o conftestl.o## 14. For fsck.cramfs, mkfs.cramfs: do we have libz?#echo '#include <zlib.h>int main(){ exit(0); crc32(0, 0, 0); }' > conftest.cLIBS=-lzeval $compileLIBS=if test -s conftest; then echo "HAVE_ZLIB=yes" >> make_include echo "You have zlib"else echo "HAVE_ZLIB=no" >> make_include echo "You don't have zlib"firm -f conftest conftest.c## 15. For mount, do we have blkid?# echo '#include <blkid/blkid.h>int main(){ exit(0); blkid_known_fstype("ext2"); }' > conftest.cLIBS="-lblkid -luuid"eval $compileLIBS=if test -s conftest; then echo "HAVE_BLKID=yes" >> make_include echo "You have blkid"else echo "HAVE_BLKID=no" >> make_include echo "You don't have blkid"firm -f conftest conftest.c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -