📄 configure
字号:
#!/bin/sh# Configure script for util-linux - aeb, 990205## We need to find out the following things:## Version of gcc## Existence of header files:# H1. For fdisksunlabel.c: is there a <scsi/scsi.h>?# H2. For fdisk.c: is there a <linux/blkpg.h>?# H3. For kbd_rate.c: does <linux/kd.h> exist?# H4. For nls.h: do we have <locale.h>?# H5. For cal.c: do we have <langinfo.h>?# H6. For mkswap.c: do we have <sys/user.h> or <asm/page.h>?# H7. For nfsmount.c: do we have <rpcsvc/nfs_prot.h>?# H8. For nfsmount.h (nfsmount_xdr.c: int32_t): do we have <asm/types.h>?# H9. For raw.c: do we have <linux/raw.h>?# H10. For md5.c: do we have <stdint.h>?# H11. For cmos.c: do we have <sys/io.h>?## Existence of functions:# F1. For nfsmount.c: is inet_aton() available?# F2. For mkswap.c: is fsync() available?# F3. For agetty.c: is getdomainname() available?# F4. For hwclock/kd.c: do we have nanosleep()?# F5. For mkswap.c: do we have personality()?# F6. For agetty.c: is updwtmp() available?# F7. For pg.c: are fseeko() and ftello() available?# F8. For fsck.cramfs.c: is lchown() available?# F9. For cfdisk.c: is rpmatch() available?## 1. Deleted.# 2. For cfdisk, setterm, more, ul: do we have ncurses? How installed?# 3. For more: do we have libtermcap?# 4. For chfn, chsh, login, newgrp, passwd: do we need -lcrypt?# 5. For sln: does static compilation work?# 6. For lib/nls.h: do we have <libintl.h> and gettext()?# 7. For xgettext: does it take the option --foreign-user?# 8. For err.c: do we have __progname?# 9. For script.c: do we have <pty.h> and openpty()?# 10. For lib/widechar.h: do we have wide character support?# 11. For pivot_root.c: does <sys/syscall.h> define SYS_pivot_root?# 12. For hwclock.c: does struct tm have a field tm_gmtoff?# 13. For nfsmount: does the output of rpcgen compile?# 14. For fsck.cramfs, mkfs.cramfs: do we have libz?# 15. For mount, do we have blkid?rm -f make_include defines.hVERSION=`cat VERSION`echoecho configuring util-linux-$VERSIONechoecho "VERSION=$VERSION" > make_includeecho '#define UTIL_LINUX_VERSION "'$VERSION'"' > defines.hecho '#define util_linux_version "util-linux-'$VERSION'"' >> defines.hecho >> defines.hCC=${CC-cc}CFLAGS=${CFLAGS-"-O2"}LDFLAGS=${LDFLAGS-"-s"}echo CC=$CC >> make_includeecho CFLAGS=$CFLAGS >> make_includeecho LDFLAGS=$LDFLAGS >> make_includeDEFS=LIBS=compile='$CC $CFLAGS $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'compile_with_warnings='$CC $CFLAGS $DEFS conftest.c -o conftest $LIBS 2>&1'static_compile='$CC -static $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'eval COMPILE='"'$compile'"'export COMPILErm -f conftest.c conftest## Old gcc wants options like -m486, but gcc 3.0 says# `-m486' is deprecated. Use `-march=i486' or `-mcpu=i486' instead.#echo "int main(){ exit(0); }" > conftest.cgccout=`$CC $CFLAGS -m386 conftest.c -o conftest 2>&1 | grep "march="`if test -z "$gccout"; then echo "HAVE_OLD_GCC=yes" >> make_includefirm -f conftest conftest.c## Find out about the existence of header files### H1. For fdisk/fdisksunlabel.c: is <scsi/scsi.h> available?# Some kernels have <scsi/scsi.h> that uses u_char# But maybe there is already a typedef. Let us use a #define#echo "#define u_char unsigned char#include <scsi/scsi.h>#undef u_charint main(){ exit(0); }" > conftest.ceval $compileif test -s conftest; then echo "#define HAVE_scsi_h" >> defines.h echo "You have <scsi/scsi.h>"else echo "You don't have <scsi/scsi.h>"firm -f conftest conftest.c## H2. For fdisk/fdisk.c: is <linux/blkpg.h> available?#if ./testincl "linux/blkpg.h"; then echo "#define HAVE_blkpg_h" >> defines.hfi## H3. Does <linux/kd.h> exist?#if ./testincl "linux/kd.h"; then echo "#define HAVE_kd_h" >> defines.hfi## H4. For lib/nls.h: do we have <locale.h>?#if ./testincl "locale.h"; then echo "#define HAVE_locale_h" >> defines.hfi## H5. For cal.c: do we have <langinfo.h>?#if ./testincl "langinfo.h"; then echo "#define HAVE_langinfo_h" >> defines.hfi## H6. For mkswap.c: do we have <sys/user.h> or <asm/page.h>?#if ./testincl "sys/user.h"; then echo "#define HAVE_sys_user_h" >> defines.helse if ./testincl "asm/page.h"; then echo "#define HAVE_asm_page_h" >> defines.hfi; fi## H7. For nfsmount.c: do we have <rpcsvc/nfs_prot.h>?#if ./testincl "rpcsvc/nfs_prot.h"; then echo "#define HAVE_rpcsvc_nfs_prot_h" >> defines.hfi## H8. For nfsmount.h: do we have <asm/types.h>?#if ./testincl "asm/types.h"; then echo "#define HAVE_asm_types_h" >> defines.hfi## H9. For raw.c: do we have <linux/raw.h>?#if ./testincl "linux/raw.h"; then echo "HAVE_RAW_H=yes" >> make_includefi## H10. For md5.c: do we have <stdint.h>?if ./testincl "stdint.h"; then echo "#define HAVE_stdint_h" >> defines.hfi## H11. For cmos.c: do we have <sys/io.h>?if ./testincl "sys/io.h"; then echo "#define HAVE_sys_io_h" >> defines.hfi## Find out about the existence of functions### F1. For mount/nfsmount.c: is inet_aton() available?#echo "#include <sys/socket.h>#include <netinet/in.h>#include <arpa/inet.h>int main(int a, char **v){ if (a == -1) /* false */ inet_aton((const char *) 0, (struct in_addr *) 0); exit(0);}" > conftest.ceval $compileif test -s conftest; then echo "#define HAVE_inet_aton" >> defines.h echo "You have inet_aton()"else echo "You don't have inet_aton()"firm -f conftest conftest.c## F2. For mkswap.c: is fsync() available?#echo "#include <unistd.h>int main(int a, char **v){ if (a == -1) /* false */ fsync(0); exit(0);}" > conftest.ceval $compileif test -s conftest; then echo "#define HAVE_fsync" >> defines.h echo "You have fsync()"else echo "You don't have fsync()"firm -f conftest conftest.c## F3. For agetty.c: is getdomainname() available?#echo "#include <unistd.h>int main(int a, char **v){ char buf[1]; if (a == -1) /* false */ getdomainname(buf, sizeof buf); exit(0);}" > conftest.ceval $compileif test -s conftest; then echo "#define HAVE_getdomainname" >> defines.h echo "You have getdomainname()"else echo "You don't have getdomainname()"firm -f conftest conftest.c## F4. For hwclock/kd.c: do we have nanosleep?#echo "#include <time.h>int main () { struct timespec sleep = { 0, 1 }; nanosleep( &sleep, NULL ); exit(0);}" > conftest.ceval $compileif test -s conftest; then echo "#define HAVE_nanosleep" >> defines.h echo "You have nanosleep()"else echo "You don't have nanosleep()"firm -f conftest conftest.c## F5. For mkswap.c: do we have personality()?#echo "int main () { extern int personality(unsigned long); personality(0); exit(0);}" > conftest.ceval $compileif test -s conftest; then echo "#define HAVE_personality" >> defines.h echo "You have personality()"else echo "You don't have personality()"firm -f conftest conftest.c## F6. For agetty.c: is updwtmp() available?#echo '#include <string.h>#include <utmp.h>int main(int a, char **v){ struct utmp ut; memset (&ut, 0, sizeof(ut)); if (a == -1) /* false */ updwtmp("/nowhere/wtmp", &ut); exit(0);}' > conftest.ceval $compileif test -s conftest; then echo "#define HAVE_updwtmp" >> defines.h echo "You have updwtmp()"else echo "You don't have updwtmp()"firm -f conftest conftest.c## F7. For pg.c: are fseeko() and ftello() available?#echo '#include <stdio.h>int main(int a, char **v){ fseeko(stdout, 0, 0); ftello(stdout); exit(0);}' > conftest.ceval $compileif test -s conftest; then echo "#define HAVE_fseeko" >> defines.h echo "You have fseeko()"else echo "You don't have fseeko()"firm -f conftest conftest.c## F8. For fsck.cramfs.c: is lchown() available?#echo '#include <sys/types.h>#include <unistd.h>int main(int a, char **v){ lchown("nowhere",0,0); exit(0);}' > conftest.cgccout=`eval $compile_with_warnings | grep "lchown is not implemented"`if test -s conftest -a -z "$gccout"; then echo "#define HAVE_lchown" >> defines.h echo "You have lchown()"else echo "You don't have lchown()"firm -f conftest conftest.c## F9. For cfdisk.c: is rpmatch() available?#echo '#define _SVID_SOURCE#include <stdlib.h>int main(int a, char **v){ rpmatch("y"); exit(0);}' > conftest.c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -