📄 configure.ac
字号:
floatingpoint.h getopt.h glob.h ia.h lastlog.h limits.h login.h \ login_cap.h maillock.h ndir.h netdb.h netgroup.h \ netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \ rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \ strings.h sys/dir.h sys/strtio.h sys/audit.h sys/bitypes.h \ sys/bsdtty.h sys/cdefs.h sys/mman.h sys/ndir.h sys/prctl.h \ sys/pstat.h sys/select.h sys/stat.h sys/stream.h \ sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h sys/un.h \ time.h tmpdir.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)# sys/ptms.h requires sys/stream.h to be included first on SolarisAC_CHECK_HEADERS(sys/ptms.h, [], [], [#ifdef HAVE_SYS_STREAM_H# include <sys/stream.h>#endif])# Checks for libraries.AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))dnl IRIX and Solaris 2.5.1 have dirname() in libgenAC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[ AC_CHECK_LIB(gen, dirname,[ AC_CACHE_CHECK([for broken dirname], ac_cv_have_broken_dirname, [ save_LIBS="$LIBS" LIBS="$LIBS -lgen" AC_TRY_RUN( [#include <libgen.h>#include <string.h>int main(int argc, char **argv) { char *s, buf[32]; strncpy(buf,"/etc", 32); s = dirname(buf); if (!s || strncmp(s, "/", 32) != 0) { exit(1); } else { exit(0); }} ], [ ac_cv_have_broken_dirname="no" ], [ ac_cv_have_broken_dirname="yes" ] ) LIBS="$save_LIBS" ]) if test "x$ac_cv_have_broken_dirname" = "xno" ; then LIBS="$LIBS -lgen" AC_DEFINE(HAVE_DIRNAME) AC_CHECK_HEADERS(libgen.h) fi ])])AC_CHECK_FUNC(getspnam, , AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))dnl zlib is requiredAC_ARG_WITH(zlib, [ --with-zlib=PATH Use zlib in PATH], [ if test "x$withval" = "xno" ; then AC_MSG_ERROR([*** zlib is required ***]) fi if test -d "$withval/lib"; then if test -n "${need_dash_r}"; then LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}" else LDFLAGS="-L${withval}/lib ${LDFLAGS}" fi else if test -n "${need_dash_r}"; then LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}" else LDFLAGS="-L${withval} ${LDFLAGS}" fi fi if test -d "$withval/include"; then CPPFLAGS="-I${withval}/include ${CPPFLAGS}" else CPPFLAGS="-I${withval} ${CPPFLAGS}" fi ])AC_CHECK_LIB(z, deflate, , [ saved_CPPFLAGS="$CPPFLAGS" saved_LDFLAGS="$LDFLAGS" save_LIBS="$LIBS" dnl Check default zlib install dir if test -n "${need_dash_r}"; then LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}" else LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}" fi CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}" LIBS="$LIBS -lz" AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ), [ AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]) ] ) ])AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))AC_ARG_WITH(zlib-version-check, [ --without-zlib-version-check Disable zlib version check], [ if test "x$withval" = "xno" ; then zlib_check_nonfatal=1 fi ])AC_MSG_CHECKING(for zlib 1.1.4 or greater)AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <zlib.h>int main(){ int a, b, c, v; if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3) exit(1); v = a*1000000 + b*1000 + c; if (v >= 1001004) exit(0); exit(2);} ]])], AC_MSG_RESULT(yes), [ AC_MSG_RESULT(no) if test -z "$zlib_check_nonfatal" ; then AC_MSG_ERROR([*** zlib too old - check config.log ***Your reported zlib version has known security problems. It's possible yourvendor has fixed these problems without changing the version number. If youare sure this is the case, you can disable the check by running"./configure --without-zlib-version-check".If you are in doubt, upgrade zlib to version 1.1.4 or greater.]) else AC_MSG_WARN([zlib version may have security problems]) fi ], [ AC_MSG_WARN([cross compiling: not checking zlib version]) ])dnl UnixWare 2.xAC_CHECK_FUNC(strcasecmp, [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ])AC_CHECK_FUNC(utimes, [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES) LIBS="$LIBS -lc89"]) ])dnl Checks for libutil functionsAC_CHECK_HEADERS(libutil.h)AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])AC_CHECK_FUNCS(logout updwtmp logwtmp)AC_FUNC_STRFTIME# Check for ALTDIRFUNC glob() extensionAC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)AC_EGREP_CPP(FOUNDIT, [ #include <glob.h> #ifdef GLOB_ALTDIRFUNC FOUNDIT #endif ], [ AC_DEFINE(GLOB_HAS_ALTDIRFUNC) AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no) ])# Check for g.gl_matchc glob() extensionAC_MSG_CHECKING(for gl_matchc field in glob_t)AC_EGREP_CPP(FOUNDIT, [ #include <glob.h> int main(void){glob_t g; g.gl_matchc = 1;} ], [ AC_DEFINE(GLOB_HAS_GL_MATCHC) AC_MSG_RESULT(yes) ], [ AC_MSG_RESULT(no) ])AC_MSG_CHECKING([whether struct dirent allocates space for d_name])AC_RUN_IFELSE( [AC_LANG_SOURCE([[#include <sys/types.h>#include <dirent.h>int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));} ]])], [AC_MSG_RESULT(yes)], [ AC_MSG_RESULT(no) AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME) ], [ AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME]) AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME) ])AC_MSG_CHECKING([for /proc/pid/fd directory])if test -d "/proc/$$/fd" ; then AC_DEFINE(HAVE_PROC_PID) AC_MSG_RESULT(yes)else AC_MSG_RESULT(no)fi# Check whether user wants S/Key supportSKEY_MSG="no"AC_ARG_WITH(skey, [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)], [ if test "x$withval" != "xno" ; then if test "x$withval" != "xyes" ; then CPPFLAGS="$CPPFLAGS -I${withval}/include" LDFLAGS="$LDFLAGS -L${withval}/lib" fi AC_DEFINE(SKEY) LIBS="-lskey $LIBS" SKEY_MSG="yes" AC_MSG_CHECKING([for s/key support]) AC_TRY_RUN( [#include <stdio.h>#include <skey.h>int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); } ], [AC_MSG_RESULT(yes)], [ AC_MSG_RESULT(no) AC_MSG_ERROR([** Incomplete or missing s/key libraries.]) ]) AC_MSG_CHECKING(if skeychallenge takes 4 arguments) AC_TRY_COMPILE( [#include <stdio.h> #include <skey.h>], [(void)skeychallenge(NULL,"name","",0);], [AC_MSG_RESULT(yes) AC_DEFINE(SKEYCHALLENGE_4ARG)], [AC_MSG_RESULT(no)] ) fi ])# Check whether user wants TCP wrappers supportTCPW_MSG="no"AC_ARG_WITH(tcp-wrappers, [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)], [ if test "x$withval" != "xno" ; then saved_LIBS="$LIBS" saved_LDFLAGS="$LDFLAGS" saved_CPPFLAGS="$CPPFLAGS" if test -n "${withval}" -a "${withval}" != "yes"; then if test -d "${withval}/lib"; then if test -n "${need_dash_r}"; then LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}" else LDFLAGS="-L${withval}/lib ${LDFLAGS}" fi else if test -n "${need_dash_r}"; then LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}" else LDFLAGS="-L${withval} ${LDFLAGS}" fi fi if test -d "${withval}/include"; then CPPFLAGS="-I${withval}/include ${CPPFLAGS}" else CPPFLAGS="-I${withval} ${CPPFLAGS}" fi fi LIBWRAP="-lwrap" LIBS="$LIBWRAP $LIBS" AC_MSG_CHECKING(for libwrap) AC_TRY_LINK( [#include <sys/types.h>#include <sys/socket.h>#include <netinet/in.h>#include <tcpd.h> int deny_severity = 0, allow_severity = 0; ], [hosts_access(0);], [ AC_MSG_RESULT(yes) AC_DEFINE(LIBWRAP) AC_SUBST(LIBWRAP) TCPW_MSG="yes" ], [ AC_MSG_ERROR([*** libwrap missing]) ] ) LIBS="$saved_LIBS" fi ])# Check whether user wants libedit supportLIBEDIT_MSG="no"AC_ARG_WITH(libedit, [ --with-libedit[[=PATH]] Enable libedit support for sftp], [ if test "x$withval" != "xno" ; then AC_CHECK_LIB(edit, el_init, [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp]) LIBEDIT="-ledit -lcurses" LIBEDIT_MSG="yes" AC_SUBST(LIBEDIT) ], [], [-lcurses] ) fi ])AUDIT_MODULE=noneAC_ARG_WITH(audit, [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)], [ AC_MSG_CHECKING(for supported audit module) case "$withval" in bsm) AC_MSG_RESULT(bsm) AUDIT_MODULE=bsm dnl Checks for headers, libs and functions AC_CHECK_HEADERS(bsm/audit.h, [], [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)]) AC_CHECK_LIB(bsm, getaudit, [], [AC_MSG_ERROR(BSM enabled and required library not found)]) AC_CHECK_FUNCS(getaudit, [], [AC_MSG_ERROR(BSM enabled and required function not found)]) # These are optional AC_CHECK_FUNCS(getaudit_addr) AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module]) ;; debug) AUDIT_MODULE=debug AC_MSG_RESULT(debug) AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module) ;; *) AC_MSG_ERROR([Unknown audit module $withval]) ;; esac ])dnl Checks for library functions. Please keep in alphabetical orderAC_CHECK_FUNCS(\ arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \ bindresvport_sa clock closefrom dirfd fchdir fchmod fchown \ freeaddrinfo futimes getaddrinfo getcwd getgrouplist getnameinfo \ getopt getpeereid _getpty getrlimit getttyent glob inet_aton \ inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \ mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \ pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \ setdtablesize setegid setenv seteuid setgroups setlogin setpcred \ setproctitle setregid setreuid setrlimit \ setsid setvbuf sigaction sigvec snprintf socketpair strerror \ strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \ truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \)# IRIX has a const char return value for gai_strerror()AC_CHECK_FUNCS(gai_strerror,[ AC_DEFINE(HAVE_GAI_STRERROR) AC_TRY_COMPILE([#include <sys/types.h>#include <sys/socket.h>#include <netdb.h>const char *gai_strerror(int);],[char *str;str = gai_strerror(0);],[ AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1, [Define if gai_strerror() returns const char *])])])AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))dnl Make sure prototypes are defined for these before using them.AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])dnl tcsendbreak might be a macroAC_CHECK_DECL(tcsendbreak, [AC_DEFINE(HAVE_TCSENDBREAK)], [AC_CHECK_FUNCS(tcsendbreak)], [#include <termios.h>])AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])AC_CHECK_FUNCS(setresuid, [ dnl Some platorms have setresuid that isn't implemented, test for this AC_MSG_CHECKING(if setresuid seems to work) AC_RUN_IFELSE( [AC_LANG_SOURCE([[#include <stdlib.h>#include <errno.h>int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);} ]])], [AC_MSG_RESULT(yes)], [AC_DEFINE(BROKEN_SETRESUID) AC_MSG_RESULT(not implemented)], [AC_MSG_WARN([cross compiling: not checking setresuid])] )])AC_CHECK_FUNCS(setresgid, [ dnl Some platorms have setresgid that isn't implemented, test for this AC_MSG_CHECKING(if setresgid seems to work) AC_RUN_IFELSE( [AC_LANG_SOURCE([[#include <stdlib.h>#include <errno.h>int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);} ]])], [AC_MSG_RESULT(yes)], [AC_DEFINE(BROKEN_SETRESGID) AC_MSG_RESULT(not implemented)], [AC_MSG_WARN([cross compiling: not checking setresuid])] )])dnl Checks for time functionsAC_CHECK_FUNCS(gettimeofday time)dnl Checks for utmp functionsAC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)AC_CHECK_FUNCS(utmpname)dnl Checks for utmpx functionsAC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )AC_CHECK_FUNCS(setutxent utmpxname)AC_CHECK_FUNC(daemon, [AC_DEFINE(HAVE_DAEMON)], [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])])AC_CHECK_FUNC(getpagesize, [AC_DEFINE(HAVE_GETPAGESIZE)], [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])])# Check for broken snprintfif test "x$ac_cv_func_snprintf" = "xyes" ; then AC_MSG_CHECKING([whether snprintf correctly terminates long strings]) AC_RUN_IFELSE( [AC_LANG_SOURCE([[#include <stdio.h>int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');} ]])], [AC_MSG_RESULT(yes)], [ AC_MSG_RESULT(no) AC_DEFINE(BROKEN_SNPRINTF) AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor]) ], [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ] )fi# Check for missing getpeereid (or equiv) supportNO_PEERCHECK=""if test "x$ac_cv_func_getpeereid" != "xyes" ; then AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt]) AC_TRY_COMPILE( [#include <sys/types.h> #include <sys/socket.h>], [int i = SO_PEERCRED;], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no) NO_PEERCHECK=1] )fidnl see whether mkstemp() requires XXXXXXif test "x$ac_cv_func_mkdtemp" = "xyes" ; thenAC_MSG_CHECKING([for (overly) strict mkstemp])AC_TRY_RUN( [#include <stdlib.h>main() { char template[]="conftest.mkstemp-test";if (mkstemp(template) == -1) exit(1);unlink(template); exit(0);} ], [ AC_MSG_RESULT(no) ], [ AC_MSG_RESULT(yes) AC_DEFINE(HAVE_STRICT_MKSTEMP) ], [ AC_MSG_RESULT(yes)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -