⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configure.in

📁 ftp服务器源程序
💻 IN
字号:
AC_INIT(cmds.c)AC_PREFIX_PROGRAM(ftpd)AC_CONFIG_HEADER(config.h)AC_PROG_CCdnldnl Set of libraries to usednlLIBS=""AC_SUBST(LIBS)AC_C_CONSTAC_FUNC_MMAPAC_TYPE_SIGNALAC_CHECK_FUNCS(snprintf vsnprintf)dnldnl Check if we need -lsocket -- taken from wu-ftpddnlAC_CHECK_LIB(socket,socket,result=yes,result=no)if test "$result" = "yes"; then  LIBS="$LIBS -lsocket"else  AC_CHECK_LIB(socket,connect,result=yes,result=no)  if test "$result" = "yes"; then    LIBS="$LIBS -lsocket"  fifidnldnl Check if we need -lcryptdnlAC_CHECK_LIB(crypt,crypt,result=yes,result=no)if test "$result" = "yes"; then  LIBS="$LIBS -lcrypt"fidnldnl The following weirdness is to support --disable as well as --enablednl (but long live m4!)dnl define(ARG_ENABLE_BETAFTPD,[AC_MSG_CHECKING(whether to enable $1)AC_ARG_ENABLE($1,[$2],result=yes,result=no)if test "$result" = "no"; then	enableval=nofiif test "$enableval" = "yes"; then	$3fiAC_MSG_RESULT($enableval)])dnldnl Check for optionsdnlARG_ENABLE_BETAFTPD(xferlog,[  --enable-xferlog        Enable transfer log support],AC_DEFINE(WANT_XFERLOG))ARG_ENABLE_BETAFTPD(ascii,[  --enable-ascii          Enable ASCII mode support],AC_DEFINE(WANT_ASCII))ARG_ENABLE_BETAFTPD(fullscreen,[  --enable-fullscreen     Run in fullscreen mode (implies --disable-fork)],AC_DEFINE(WANT_FULLSCREEN))if test "$enableval" = "no"; then	ARG_ENABLE_BETAFTPD(fork,[  --enable-fork           Make the server fork into the background],AC_DEFINE(WANT_FORK))fiARG_ENABLE_BETAFTPD(upload,[  --enable-upload         Enable upload support],AC_DEFINE(WANT_UPLOAD))ARG_ENABLE_BETAFTPD(stat,[  --enable-stat           Enable STAT command (see README first)],AC_DEFINE(WANT_STAT))ARG_ENABLE_BETAFTPD(dcache,[  --enable-dcache         Enable directory listing cache],AC_DEFINE(WANT_DCACHE))ARG_ENABLE_BETAFTPD(message,[  --enable-message        Enable .message files etc.],AC_DEFINE(WANT_MESSAGE))dnldnl The following line _must_ be last...dnlARG_ENABLE_BETAFTPD(shadow,[  --enable-shadow         Enable shadow password support],AC_DEFINE(WANT_SHADOW))nonroot_support=yesif test "$enableval" = "yes"; then	AC_CHECK_HEADERS(shadow.h)	nonroot_support=noelse	dnl Causes unknown trouble on SunOS, so it's disabled	dnl if test -e "/etc/shadow"; then	dnl	AC_MSG_WARN()	dnl	AC_MSG_WARN([It looks like you're using shadow passwords, consider])	dnl	AC_MSG_WARN([giving the --enable-shadow flag to configure. Proceeding])	dnl	AC_MSG_WARN([_without_ support for shadow passwords -- you might not])	dnl	AC_MSG_WARN([be able to log in!])	dnl	AC_MSG_WARN()	dnl fi	echofiif test "$nonroot_support" = "yes"; then	ARG_ENABLE_BETAFTPD(nonroot,[  --enable-nonroot        Do not need root access (EXPERIMENTAL)],AC_DEFINE(WANT_NONROOT))else	enableval=nofiif test "$enableval" = "yes"; then	AC_MSG_WARN()        AC_MSG_WARN([Please read the README.nonroot file before using --enable-nonroot])	AC_MSG_WARN()elsednldnl Try to find our effective userid (use our own C program?)dnl	AC_MSG_CHECKING(how to get effective uid)	if test -n "$EUID"; then		B_UID=$EUID		AC_MSG_RESULT([\$EUID ($EUID)])	elif test -n "$euid"; then		B_UID=$euid		AC_MSG_RESULT([\$euid ($euid)])	elif test -n "$UID"; then		B_UID=$UID		AC_MSG_RESULT([\$UID ($UID)])	elif test -n "$uid"; then		B_UID=$uid		AC_MSG_RESULT([\$uid ($uid)])	elif test "`whoami 2>/dev/null`" = "root"; then		B_UID=0		AC_MSG_RESULT([whoami (root)])	else		# assume we're not root		B_UID=1		AC_MSG_RESULT(not found, assuming not root)	fi	if test "$B_UID" -ne 0; then		AC_MSG_WARN()		AC_MSG_WARN([You do not seem to have root privilegies. If you])		AC_MSG_WARN([want to run BetaFTPD without being root, please])		AC_MSG_WARN([consider giving the --enable-nonroot flag to])		AC_MSG_WARN([configure, and read the README.nonroot file.])		AC_MSG_WARN()	fifiAC_CHECK_TYPE(uid_t,int)AC_CHECK_TYPE(gid_t,int)AC_CHECK_HEADERS(crypt.h unistd.h time.h sys/time.h errno.h netinet/in.h)AC_CHECK_HEADERS(netinet/ip.h stropts.h sys/conf.h arpa/inet.h sys/filio.h)AC_CHECK_HEADERS(netinet/tcp.h sys/types.h netdb.h glob.h stdio.h)AC_CHECK_HEADERS(stdlib.h stdarg.h stdlib.h string.h strings.h fcntl.h)AC_CHECK_HEADERS(sys/ioctl.h sys/socket.h sys/stat.h sys/param.h signal.h)AC_CHECK_HEADERS(sys/signal.h dirent.h pwd.h grp.h netinet/in_systm.h)AC_CHECK_HEADERS(assert.h)AC_CHECK_HEADER(netinet/tcp.h,result=yes,result=no)dnldnl linux/socket.h can create some problems on Debian GNU/Linux systemsdnlif test "$result" = "yes"; then     AC_MSG_CHECKING(if netinet/tcp.h is enough)     AC_EGREP_CPP(yes,     [#include <netinet/tcp.h>#ifndef TCP_NODELAY      yes#endif     ], result=no, result=yes)     AC_MSG_RESULT($result)fiif test "$result" = "no"; then	AC_CHECK_HEADERS(linux/socket.h linux/tcp.h)fiAC_CHECK_HEADERS(sys/poll.h)AC_MSG_CHECKING([for poll()])AC_TRY_COMPILE([#if HAVE_SYS_POLL_H#include <sys/poll.h>#endif],[	struct pollfd fds[1];	fds[0].fd = 0;	fds[0].events = POLLIN | POLLOUT | POLLERR | POLLHUP | POLLNVAL;	poll(fds, 1, 1000);],enableval=yes,enableval=no)AC_MSG_RESULT($enableval)if test "$enableval" = "yes"; then	AC_DEFINE(HAVE_POLL, 1, [Define if you have poll().])fidnldnl sendfile() is not standard -- we'll have to check the differentdnl versions one by one :-)dnldnl Unfortunately, we'll have to run the program too -- this is adnl problem with newer libc's and not-so-new kernels :-)dnlAC_CHECK_HEADERS(sys/sendfile.h,result=yes,result=no)if test "$result" = "yes"; then	AC_MSG_CHECKING([for Linux sendfile()])	AC_TRY_COMPILE([#if HAVE_SYS_SOCKET_H#include <sys/socket.h>#endif#if HAVE_SYS_LIMITS_H#include <sys/limits.h>#endif#if HAVE_UNISTD_H#include <unistd.h>#endif#if HAVE_SYS_SENDFILE_H#include <sys/sendfile.h>#endif#if HAVE_SYS_TYPES_H#include <sys/types.h>#endif#if HAVE_ERRNO_H#include <errno.h>#endif#if HAVE_SYS_UIO_H#include <sys/uio.h>#endif],[	int out_fd = 1, in_fd = 0;	off_t offset = 0;	size_t size = 1024;	sendfile(out_fd, in_fd, &offset, size);],enableval=yes,enableval=no)	AC_MSG_RESULT($enableval)	if test "$enableval" = "yes"; then		dnl		dnl If the compile fails now, we assume sendfile() exists (since this		dnl is by far the most common case)		dnl		AC_MSG_CHECKING([that sendfile() really is implemented])		AC_TRY_RUN([#if HAVE_SYS_SOCKET_H#include <sys/socket.h>#endif#if HAVE_SYS_LIMITS_H#include <sys/limits.h>#endif#if HAVE_UNISTD_H#include <unistd.h>#endif#if HAVE_SYS_SENDFILE_H#include <sys/sendfile.h>#endif#if HAVE_SYS_TYPES_H#include <sys/types.h>#endif#if HAVE_ERRNO_H#include <errno.h>#endif#if HAVE_SYS_UIO_H#include <sys/uio.h>#endifint main() {        int out_fd = 1, in_fd = 0;        off_t offset = 0;        size_t size = 1024;	errno = 0;	sendfile(out_fd, in_fd, &offset, size);	if (errno == ENOSYS)		return 0;	else		return 1;}],		enableval=no,enableval=yes,[enableval="cross-compiling, not checked"])	        AC_MSG_RESULT($enableval)		has_sendfile=$enableval		dnl		dnl Force sendfile() `state' if the user tells us to		dnl		AC_ARG_WITH(linux-sendfile,[  --with-linux-sendfile   Force sendfile() support],has_sendfile=$withval)		if test $has_sendfile != "no"; then			AC_DEFINE(HAVE_LINUX_SENDFILE, 1, [Define if you have sendfile() with the Linux semantics.])			has_sendfile=enabled		else			has_sendfile=disabled		fi		AC_MSG_CHECKING([final status of Linux sendfile() support])		AC_MSG_RESULT($has_sendfile)	fifiAC_CHECK_HEADER(sys/uio.h,result=yes,result=no)if test "$result" = "yes"; then	AC_MSG_CHECKING([for BSD sendfile()])	AC_TRY_COMPILE([#if HAVE_SYS_LIMITS_H#include <sys/limits.h>#endif#if HAVE_UNISTD_H#include <unistd.h>#endif#if HAVE_SYS_SENDFILE_H#include <sys/sendfile.h>#endif#if HAVE_SYS_TYPES_H#include <sys/types.h>#endif#if HAVE_SYS_SOCKET_H#include <sys/socket.h>#endif#if HAVE_SYS_UIO_H#include <sys/uio.h>#endif],[        int in_fd = 0, out_sock = 3;        off_t offset;        size_t size = 1024;	struct sf_hdtr hdtr;	hdtr.hdr_cnt = 0;	hdtr.trl_cnt = 0;        sendfile(in_fd, out_sock, offset, size, &hdtr, &offset, 0);],enableval=yes,enableval=no)	AC_MSG_RESULT($enableval)	if test "$enableval" = "yes"; then	       	AC_DEFINE(HAVE_BSD_SENDFILE, 1, [Define if you have sendfile() with the BSD semantics.])	fifiAC_OUTPUT(Makefile)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -