4 AC_CONFIG_SRCDIR([ssh.c])
6 AC_CONFIG_HEADER(config.h)
11 # Checks for programs.
17 AC_PATH_PROGS(PERL, perl5 perl)
18 AC_PATH_PROG(SED, sed)
20 AC_PATH_PROG(ENT, ent)
22 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
23 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
24 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
30 if test -z "$AR" ; then
31 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
34 # Use LOGIN_PROGRAM from environment if possible
35 if test ! -z "$LOGIN_PROGRAM" ; then
36 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
39 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
40 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
41 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
45 if test -z "$LD" ; then
51 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
52 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
55 # Check for some target-specific stuff
58 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
59 LDFLAGS="$LDFLAGS -L/usr/local/lib"
60 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
61 if (test -z "$blibpath"); then
62 blibpath="/usr/lib:/lib:/usr/local/lib"
64 saved_LDFLAGS="$LDFLAGS"
65 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
66 if (test -z "$blibflags"); then
67 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
68 AC_TRY_LINK([], [], [blibflags=$tryflags])
71 if (test -z "$blibflags"); then
72 AC_MSG_RESULT(not found)
73 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
75 AC_MSG_RESULT($blibflags)
77 LDFLAGS="$saved_LDFLAGS"
78 dnl Check for authenticate. Might be in libs.a on older AIXes
79 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
80 [AC_CHECK_LIB(s,authenticate,
81 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
85 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
86 AC_CHECK_DECL(loginfailed,
87 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
89 [#include <usersec.h>],
90 [(void)loginfailed("user","host","tty",0);],
92 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
96 [#include <usersec.h>]
98 AC_CHECK_FUNCS(setauthdb)
99 AC_DEFINE(BROKEN_GETADDRINFO)
100 AC_DEFINE(BROKEN_REALPATH)
101 AC_DEFINE(SETEUID_BREAKS_SETUID)
102 AC_DEFINE(BROKEN_SETREUID)
103 AC_DEFINE(BROKEN_SETREGID)
104 dnl AIX handles lastlog as part of its login message
105 AC_DEFINE(DISABLE_LASTLOG)
106 AC_DEFINE(LOGIN_NEEDS_UTMPX)
107 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
110 check_for_libcrypt_later=1
111 LIBS="$LIBS /usr/lib/textmode.o"
112 AC_DEFINE(HAVE_CYGWIN)
114 AC_DEFINE(DISABLE_SHADOW)
115 AC_DEFINE(IP_TOS_IS_BROKEN)
116 AC_DEFINE(NO_X11_UNIX_SOCKETS)
117 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
118 AC_DEFINE(DISABLE_FD_PASSING)
119 AC_DEFINE(SETGROUPS_NOOP)
122 AC_DEFINE(IP_TOS_IS_BROKEN)
125 AC_MSG_CHECKING(if we have working getaddrinfo)
126 AC_TRY_RUN([#include <mach-o/dyld.h>
127 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
131 }], [AC_MSG_RESULT(working)],
132 [AC_MSG_RESULT(buggy)
133 AC_DEFINE(BROKEN_GETADDRINFO)],
134 [AC_MSG_RESULT(assume it is working)])
137 if test -z "$GCC"; then
140 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
141 IPADDR_IN_DISPLAY=yes
142 AC_DEFINE(HAVE_SECUREWARE)
144 AC_DEFINE(LOGIN_NO_ENDOPT)
145 AC_DEFINE(LOGIN_NEEDS_UTMPX)
146 AC_DEFINE(DISABLE_SHADOW)
147 AC_DEFINE(DISABLE_UTMP)
148 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
149 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
150 LIBS="$LIBS -lsec -lsecpw"
151 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
152 disable_ptmx_check=yes
155 if test -z "$GCC"; then
158 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
159 IPADDR_IN_DISPLAY=yes
161 AC_DEFINE(LOGIN_NO_ENDOPT)
162 AC_DEFINE(LOGIN_NEEDS_UTMPX)
163 AC_DEFINE(DISABLE_SHADOW)
164 AC_DEFINE(DISABLE_UTMP)
165 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
166 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
168 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
171 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
172 IPADDR_IN_DISPLAY=yes
173 AC_DEFINE(PAM_SUN_CODEBASE)
175 AC_DEFINE(LOGIN_NO_ENDOPT)
176 AC_DEFINE(LOGIN_NEEDS_UTMPX)
177 AC_DEFINE(DISABLE_SHADOW)
178 AC_DEFINE(DISABLE_UTMP)
179 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
180 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
182 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
185 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
187 PATH="$PATH:/usr/etc"
188 AC_DEFINE(BROKEN_INET_NTOA)
189 AC_DEFINE(WITH_ABBREV_NO_TTY)
190 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
193 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
195 PATH="$PATH:/usr/etc"
196 AC_DEFINE(WITH_IRIX_ARRAY)
197 AC_DEFINE(WITH_IRIX_PROJECT)
198 AC_DEFINE(WITH_IRIX_AUDIT)
199 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
200 AC_DEFINE(BROKEN_INET_NTOA)
201 AC_DEFINE(WITH_ABBREV_NO_TTY)
202 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
206 check_for_libcrypt_later=1
207 check_for_openpty_ctty_bug=1
208 AC_DEFINE(DONT_TRY_OTHER_AF)
209 AC_DEFINE(PAM_TTY_KLUDGE)
210 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
211 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
212 inet6_default_4in6=yes
215 AC_DEFINE(BROKEN_CMSG_TYPE)
219 mips-sony-bsd|mips-sony-newsos4)
220 AC_DEFINE(HAVE_NEWS4)
224 check_for_libcrypt_before=1
228 check_for_libcrypt_later=1
231 conf_lastlog_location="/usr/adm/lastlog"
232 conf_utmp_location=/etc/utmp
233 conf_wtmp_location=/usr/adm/wtmp
236 AC_DEFINE(BROKEN_REALPATH)
238 AC_DEFINE(BROKEN_SAVED_UIDS)
239 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
243 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
244 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
246 AC_DEFINE(PAM_SUN_CODEBASE)
247 AC_DEFINE(LOGIN_NEEDS_UTMPX)
248 AC_DEFINE(LOGIN_NEEDS_TERM)
249 AC_DEFINE(PAM_TTY_KLUDGE)
250 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
251 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
252 AC_DEFINE(SSHD_ACQUIRES_CTTY)
253 # hardwire lastlog location (can't detect it on some versions)
254 conf_lastlog_location="/var/adm/lastlog"
255 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
256 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
257 if test "$sol2ver" -ge 8; then
259 AC_DEFINE(DISABLE_UTMP)
260 AC_DEFINE(DISABLE_WTMP)
266 CPPFLAGS="$CPPFLAGS -DSUNOS4"
267 AC_CHECK_FUNCS(getpwanam)
268 AC_DEFINE(PAM_SUN_CODEBASE)
269 conf_utmp_location=/etc/utmp
270 conf_wtmp_location=/var/adm/wtmp
271 conf_lastlog_location=/var/adm/lastlog
275 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
276 LDFLAGS="$LDFLAGS -L/usr/local/lib"
279 AC_DEFINE(SSHD_ACQUIRES_CTTY)
282 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
283 # /usr/ucblib MUST NOT be searched on ReliantUNIX
284 LDFLAGS="$LDFLAGS -L/usr/local/lib"
285 IPADDR_IN_DISPLAY=yes
287 AC_DEFINE(IP_TOS_IS_BROKEN)
288 AC_DEFINE(SSHD_ACQUIRES_CTTY)
289 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
290 # Attention: always take care to bind libsocket and libnsl before libc,
291 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
294 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
295 LDFLAGS="$LDFLAGS -L/usr/local/lib"
299 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
300 LDFLAGS="$LDFLAGS -L/usr/local/lib"
304 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
305 LDFLAGS="$LDFLAGS -L/usr/local/lib"
308 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
309 LDFLAGS="$LDFLAGS -L/usr/local/lib"
310 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
313 AC_DEFINE(BROKEN_SYS_TERMIO_H)
315 AC_DEFINE(HAVE_SECUREWARE)
316 AC_DEFINE(DISABLE_SHADOW)
317 AC_DEFINE(BROKEN_SAVED_UIDS)
318 AC_CHECK_FUNCS(getluid setluid)
320 do_sco3_extra_lib_check=yes
323 if test -z "$GCC"; then
324 CFLAGS="$CFLAGS -belf"
326 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
327 LDFLAGS="$LDFLAGS -L/usr/local/lib"
328 LIBS="$LIBS -lprot -lx -ltinfo -lm"
331 AC_DEFINE(HAVE_SECUREWARE)
332 AC_DEFINE(DISABLE_SHADOW)
333 AC_DEFINE(DISABLE_FD_PASSING)
334 AC_CHECK_FUNCS(getluid setluid)
339 AC_DEFINE(DISABLE_FD_PASSING)
341 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
346 AC_DEFINE(DISABLE_FD_PASSING)
347 AC_DEFINE(NO_SSH_LASTLOG)
348 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
349 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
353 AC_MSG_CHECKING(for Digital Unix SIA)
356 [ --with-osfsia Enable Digital Unix SIA],
358 if test "x$withval" = "xno" ; then
359 AC_MSG_RESULT(disabled)
364 if test -z "$no_osfsia" ; then
365 if test -f /etc/sia/matrix.conf; then
367 AC_DEFINE(HAVE_OSF_SIA)
368 AC_DEFINE(DISABLE_LOGIN)
369 AC_DEFINE(DISABLE_FD_PASSING)
370 LIBS="$LIBS -lsecurity -ldb -lm -laud"
375 AC_DEFINE(DISABLE_FD_PASSING)
376 AC_DEFINE(BROKEN_GETADDRINFO)
377 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
382 AC_DEFINE(NO_X11_UNIX_SOCKETS)
383 AC_DEFINE(MISSING_NFDBITS)
384 AC_DEFINE(MISSING_HOWMANY)
385 AC_DEFINE(MISSING_FD_MASK)
389 # Allow user to specify flags
391 [ --with-cflags Specify additional flags to pass to compiler],
393 if test "x$withval" != "xno" ; then
394 CFLAGS="$CFLAGS $withval"
398 AC_ARG_WITH(cppflags,
399 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
401 if test "x$withval" != "xno"; then
402 CPPFLAGS="$CPPFLAGS $withval"
407 [ --with-ldflags Specify additional flags to pass to linker],
409 if test "x$withval" != "xno" ; then
410 LDFLAGS="$LDFLAGS $withval"
415 [ --with-libs Specify additional libraries to link with],
417 if test "x$withval" != "xno" ; then
418 LIBS="$LIBS $withval"
423 AC_MSG_CHECKING(compiler and flags for sanity)
428 [ AC_MSG_RESULT(yes) ],
431 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
435 # Checks for header files.
436 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
437 getopt.h glob.h ia.h lastlog.h libgen.h limits.h login.h \
438 login_cap.h maillock.h netdb.h netgroup.h \
439 netinet/in_systm.h paths.h pty.h readpassphrase.h \
440 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
441 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
442 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
443 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
444 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
445 util.h utime.h utmp.h utmpx.h)
447 # Checks for libraries.
448 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
449 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
451 dnl SCO OS3 needs this for libwrap
452 if test "x$with_tcp_wrappers" != "xno" ; then
453 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
454 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
458 AC_CHECK_FUNC(getspnam, ,
459 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
462 [ --without-rpath Disable auto-added -R linker paths],
464 if test "x$withval" = "xno" ; then
467 if test "x$withval" = "xyes" ; then
475 [ --with-zlib=PATH Use zlib in PATH],
477 if test "x$withval" = "xno" ; then
478 AC_MSG_ERROR([*** zlib is required ***])
480 if test -d "$withval/lib"; then
481 if test -n "${need_dash_r}"; then
482 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
484 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
487 if test -n "${need_dash_r}"; then
488 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
490 LDFLAGS="-L${withval} ${LDFLAGS}"
493 if test -d "$withval/include"; then
494 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
496 CPPFLAGS="-I${withval} ${CPPFLAGS}"
501 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
504 AC_CHECK_FUNC(strcasecmp,
505 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
507 AC_CHECK_FUNC(utimes,
508 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
509 LIBS="$LIBS -lc89"]) ]
512 dnl Checks for libutil functions
513 AC_CHECK_HEADERS(libutil.h)
514 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
515 AC_CHECK_FUNCS(logout updwtmp logwtmp)
519 # Check for ALTDIRFUNC glob() extension
520 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
521 AC_EGREP_CPP(FOUNDIT,
524 #ifdef GLOB_ALTDIRFUNC
529 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
537 # Check for g.gl_matchc glob() extension
538 AC_MSG_CHECKING(for gl_matchc field in glob_t)
539 AC_EGREP_CPP(FOUNDIT,
542 int main(void){glob_t g; g.gl_matchc = 1;}
545 AC_DEFINE(GLOB_HAS_GL_MATCHC)
553 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
556 #include <sys/types.h>
558 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
560 [AC_MSG_RESULT(yes)],
563 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
567 # Check whether user wants S/Key support
570 [ --with-skey[[=PATH]] Enable S/Key support
571 (optionally in PATH)],
573 if test "x$withval" != "xno" ; then
575 if test "x$withval" != "xyes" ; then
576 CPPFLAGS="$CPPFLAGS -I${withval}/include"
577 LDFLAGS="$LDFLAGS -L${withval}/lib"
584 AC_MSG_CHECKING([for s/key support])
589 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
591 [AC_MSG_RESULT(yes)],
594 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
600 # Check whether user wants TCP wrappers support
602 AC_ARG_WITH(tcp-wrappers,
603 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
604 (optionally in PATH)],
606 if test "x$withval" != "xno" ; then
608 saved_LDFLAGS="$LDFLAGS"
609 saved_CPPFLAGS="$CPPFLAGS"
610 if test -n "${withval}" -a "${withval}" != "yes"; then
611 if test -d "${withval}/lib"; then
612 if test -n "${need_dash_r}"; then
613 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
615 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
618 if test -n "${need_dash_r}"; then
619 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
621 LDFLAGS="-L${withval} ${LDFLAGS}"
624 if test -d "${withval}/include"; then
625 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
627 CPPFLAGS="-I${withval} ${CPPFLAGS}"
631 LIBS="$LIBWRAP $LIBS"
632 AC_MSG_CHECKING(for libwrap)
636 int deny_severity = 0, allow_severity = 0;
646 AC_MSG_ERROR([*** libwrap missing])
654 dnl Checks for library functions. Please keep in alphabetical order
656 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
657 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
658 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
659 getpeereid _getpty getrlimit getttyent glob inet_aton \
660 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
661 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
662 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
663 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
664 setproctitle setregid setresgid setresuid setreuid setrlimit \
665 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
666 strlcat strlcpy strmode strnvis sysconf tcgetpgrp tcsendbreak \
667 truncate utimes vhangup vsnprintf waitpid \
670 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
671 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
673 dnl Make sure prototypes are defined for these before using them.
674 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
675 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
677 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
678 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
679 AC_CHECK_LIB(gen, dirname,[
680 AC_CACHE_CHECK([for broken dirname],
681 ac_cv_have_broken_dirname, [
689 int main(int argc, char **argv) {
692 strncpy(buf,"/etc", 32);
694 if (!s || strncmp(s, "/", 32) != 0) {
701 [ ac_cv_have_broken_dirname="no" ],
702 [ ac_cv_have_broken_dirname="yes" ]
706 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
708 AC_DEFINE(HAVE_DIRNAME)
709 AC_CHECK_HEADERS(libgen.h)
714 dnl Checks for time functions
715 AC_CHECK_FUNCS(gettimeofday time)
716 dnl Checks for utmp functions
717 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
718 AC_CHECK_FUNCS(utmpname)
719 dnl Checks for utmpx functions
720 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
721 AC_CHECK_FUNCS(setutxent utmpxname)
723 AC_CHECK_FUNC(daemon,
724 [AC_DEFINE(HAVE_DAEMON)],
725 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
728 AC_CHECK_FUNC(getpagesize,
729 [AC_DEFINE(HAVE_GETPAGESIZE)],
730 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
733 # Check for broken snprintf
734 if test "x$ac_cv_func_snprintf" = "xyes" ; then
735 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
739 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
741 [AC_MSG_RESULT(yes)],
744 AC_DEFINE(BROKEN_SNPRINTF)
745 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
750 dnl see whether mkstemp() requires XXXXXX
751 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
752 AC_MSG_CHECKING([for (overly) strict mkstemp])
756 main() { char template[]="conftest.mkstemp-test";
757 if (mkstemp(template) == -1)
759 unlink(template); exit(0);
767 AC_DEFINE(HAVE_STRICT_MKSTEMP)
771 AC_DEFINE(HAVE_STRICT_MKSTEMP)
776 dnl make sure that openpty does not reacquire controlling terminal
777 if test ! -z "$check_for_openpty_ctty_bug"; then
778 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
782 #include <sys/fcntl.h>
783 #include <sys/types.h>
784 #include <sys/wait.h>
790 int fd, ptyfd, ttyfd, status;
793 if (pid < 0) { /* failed */
795 } else if (pid > 0) { /* parent */
796 waitpid(pid, &status, 0);
797 if (WIFEXITED(status))
798 exit(WEXITSTATUS(status));
802 close(0); close(1); close(2);
804 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
805 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
807 exit(3); /* Acquired ctty: broken */
809 exit(0); /* Did not acquire ctty: OK */
818 AC_DEFINE(SSHD_ACQUIRES_CTTY)
828 [ --with-pam Enable PAM support ],
830 if test "x$withval" != "xno" ; then
831 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
832 AC_MSG_ERROR([PAM headers not found])
835 AC_CHECK_LIB(dl, dlopen, , )
836 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
837 AC_CHECK_FUNCS(pam_getenvlist)
838 AC_CHECK_FUNCS(pam_putenv)
844 if test $ac_cv_lib_dl_dlopen = yes; then
854 # Check for older PAM
855 if test "x$PAM_MSG" = "xyes" ; then
856 # Check PAM strerror arguments (old PAM)
857 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
861 #include <security/pam_appl.h>
863 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
866 AC_DEFINE(HAVE_OLD_PAM)
868 PAM_MSG="yes (old library)"
873 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
874 # because the system crypt() is more featureful.
875 if test "x$check_for_libcrypt_before" = "x1"; then
876 AC_CHECK_LIB(crypt, crypt)
880 saved_CPPFLAGS="$CPPFLAGS"
881 saved_LDFLAGS="$LDFLAGS"
883 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
885 if test "x$withval" != "xno" ; then
886 if test -d "$withval/lib"; then
887 if test -n "${need_dash_r}"; then
888 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
890 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
893 if test -n "${need_dash_r}"; then
894 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
896 LDFLAGS="-L${withval} ${LDFLAGS}"
899 if test -d "$withval/include"; then
900 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
902 CPPFLAGS="-I${withval} ${CPPFLAGS}"
907 LIBS="$LIBS -lcrypto"
908 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
910 dnl Check default openssl install dir
911 if test -n "${need_dash_r}"; then
912 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
914 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
916 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
917 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
919 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
925 # Determine OpenSSL header version
926 AC_MSG_CHECKING([OpenSSL header version])
931 #include <openssl/opensslv.h>
932 #define DATA "conftest.sslincver"
937 fd = fopen(DATA,"w");
941 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
948 ssl_header_ver=`cat conftest.sslincver`
949 AC_MSG_RESULT($ssl_header_ver)
952 AC_MSG_RESULT(not found)
953 AC_MSG_ERROR(OpenSSL version header not found.)
957 # Determine OpenSSL library version
958 AC_MSG_CHECKING([OpenSSL library version])
963 #include <openssl/opensslv.h>
964 #include <openssl/crypto.h>
965 #define DATA "conftest.ssllibver"
970 fd = fopen(DATA,"w");
974 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
981 ssl_library_ver=`cat conftest.ssllibver`
982 AC_MSG_RESULT($ssl_library_ver)
985 AC_MSG_RESULT(not found)
986 AC_MSG_ERROR(OpenSSL library not found.)
990 # Sanity check OpenSSL headers
991 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
995 #include <openssl/opensslv.h>
996 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1003 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1004 Check config.log for details.
1005 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1009 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1010 # version in OpenSSL. Skip this for PAM
1011 if test "x$check_for_libcrypt_later" = "x1"; then
1012 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1016 ### Configure cryptographic random number support
1018 # Check wheter OpenSSL seeds itself
1019 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1023 #include <openssl/rand.h>
1024 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1027 OPENSSL_SEEDS_ITSELF=yes
1032 # Default to use of the rand helper if OpenSSL doesn't
1039 # Do we want to force the use of the rand helper?
1040 AC_ARG_WITH(rand-helper,
1041 [ --with-rand-helper Use subprocess to gather strong randomness ],
1043 if test "x$withval" = "xno" ; then
1044 # Force use of OpenSSL's internal RNG, even if
1045 # the previous test showed it to be unseeded.
1046 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1047 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1048 OPENSSL_SEEDS_ITSELF=yes
1057 # Which randomness source do we use?
1058 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1060 AC_DEFINE(OPENSSL_PRNG_ONLY)
1061 RAND_MSG="OpenSSL internal ONLY"
1062 INSTALL_SSH_RAND_HELPER=""
1063 elif test ! -z "$USE_RAND_HELPER" ; then
1064 # install rand helper
1065 RAND_MSG="ssh-rand-helper"
1066 INSTALL_SSH_RAND_HELPER="yes"
1068 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1070 ### Configuration of ssh-rand-helper
1073 AC_ARG_WITH(prngd-port,
1074 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1083 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1086 if test ! -z "$withval" ; then
1087 PRNGD_PORT="$withval"
1088 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1093 # PRNGD Unix domain socket
1094 AC_ARG_WITH(prngd-socket,
1095 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1099 withval="/var/run/egd-pool"
1107 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1111 if test ! -z "$withval" ; then
1112 if test ! -z "$PRNGD_PORT" ; then
1113 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1115 if test ! -r "$withval" ; then
1116 AC_MSG_WARN(Entropy socket is not readable)
1118 PRNGD_SOCKET="$withval"
1119 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1123 # Check for existing socket only if we don't have a random device already
1124 if test "$USE_RAND_HELPER" = yes ; then
1125 AC_MSG_CHECKING(for PRNGD/EGD socket)
1126 # Insert other locations here
1127 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1128 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1129 PRNGD_SOCKET="$sock"
1130 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1134 if test ! -z "$PRNGD_SOCKET" ; then
1135 AC_MSG_RESULT($PRNGD_SOCKET)
1137 AC_MSG_RESULT(not found)
1143 # Change default command timeout for hashing entropy source
1145 AC_ARG_WITH(entropy-timeout,
1146 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1148 if test "x$withval" != "xno" ; then
1149 entropy_timeout=$withval
1153 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1155 SSH_PRIVSEP_USER=sshd
1156 AC_ARG_WITH(privsep-user,
1157 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1159 if test -n "$withval"; then
1160 SSH_PRIVSEP_USER=$withval
1164 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1165 AC_SUBST(SSH_PRIVSEP_USER)
1167 # We do this little dance with the search path to insure
1168 # that programs that we select for use by installed programs
1169 # (which may be run by the super-user) come from trusted
1170 # locations before they come from the user's private area.
1171 # This should help avoid accidentally configuring some
1172 # random version of a program in someone's personal bin.
1176 test -h /bin 2> /dev/null && PATH=/usr/bin
1177 test -d /sbin && PATH=$PATH:/sbin
1178 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1179 PATH=$PATH:/etc:$OPATH
1181 # These programs are used by the command hashing source to gather entropy
1182 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1183 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1184 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1185 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1186 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1187 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1188 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1189 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1190 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1191 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1192 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1193 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1194 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1195 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1196 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1197 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1201 # Where does ssh-rand-helper get its randomness from?
1202 INSTALL_SSH_PRNG_CMDS=""
1203 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1204 if test ! -z "$PRNGD_PORT" ; then
1205 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1206 elif test ! -z "$PRNGD_SOCKET" ; then
1207 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1209 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1210 RAND_HELPER_CMDHASH=yes
1211 INSTALL_SSH_PRNG_CMDS="yes"
1214 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1217 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1218 if test ! -z "$SONY" ; then
1219 LIBS="$LIBS -liberty";
1222 # Checks for data types
1223 AC_CHECK_SIZEOF(char, 1)
1224 AC_CHECK_SIZEOF(short int, 2)
1225 AC_CHECK_SIZEOF(int, 4)
1226 AC_CHECK_SIZEOF(long int, 4)
1227 AC_CHECK_SIZEOF(long long int, 8)
1229 # Sanity check long long for some platforms (AIX)
1230 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1231 ac_cv_sizeof_long_long_int=0
1234 # More checks for data types
1235 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1237 [ #include <sys/types.h> ],
1239 [ ac_cv_have_u_int="yes" ],
1240 [ ac_cv_have_u_int="no" ]
1243 if test "x$ac_cv_have_u_int" = "xyes" ; then
1244 AC_DEFINE(HAVE_U_INT)
1248 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1250 [ #include <sys/types.h> ],
1251 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1252 [ ac_cv_have_intxx_t="yes" ],
1253 [ ac_cv_have_intxx_t="no" ]
1256 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1257 AC_DEFINE(HAVE_INTXX_T)
1261 if (test -z "$have_intxx_t" && \
1262 test "x$ac_cv_header_stdint_h" = "xyes")
1264 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1266 [ #include <stdint.h> ],
1267 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1269 AC_DEFINE(HAVE_INTXX_T)
1272 [ AC_MSG_RESULT(no) ]
1276 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1279 #include <sys/types.h>
1280 #ifdef HAVE_STDINT_H
1281 # include <stdint.h>
1283 #include <sys/socket.h>
1284 #ifdef HAVE_SYS_BITYPES_H
1285 # include <sys/bitypes.h>
1288 [ int64_t a; a = 1;],
1289 [ ac_cv_have_int64_t="yes" ],
1290 [ ac_cv_have_int64_t="no" ]
1293 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1294 AC_DEFINE(HAVE_INT64_T)
1297 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1299 [ #include <sys/types.h> ],
1300 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1301 [ ac_cv_have_u_intxx_t="yes" ],
1302 [ ac_cv_have_u_intxx_t="no" ]
1305 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1306 AC_DEFINE(HAVE_U_INTXX_T)
1310 if test -z "$have_u_intxx_t" ; then
1311 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1313 [ #include <sys/socket.h> ],
1314 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1316 AC_DEFINE(HAVE_U_INTXX_T)
1319 [ AC_MSG_RESULT(no) ]
1323 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1325 [ #include <sys/types.h> ],
1326 [ u_int64_t a; a = 1;],
1327 [ ac_cv_have_u_int64_t="yes" ],
1328 [ ac_cv_have_u_int64_t="no" ]
1331 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1332 AC_DEFINE(HAVE_U_INT64_T)
1336 if test -z "$have_u_int64_t" ; then
1337 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1339 [ #include <sys/bitypes.h> ],
1340 [ u_int64_t a; a = 1],
1342 AC_DEFINE(HAVE_U_INT64_T)
1345 [ AC_MSG_RESULT(no) ]
1349 if test -z "$have_u_intxx_t" ; then
1350 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1353 #include <sys/types.h>
1355 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1356 [ ac_cv_have_uintxx_t="yes" ],
1357 [ ac_cv_have_uintxx_t="no" ]
1360 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1361 AC_DEFINE(HAVE_UINTXX_T)
1365 if test -z "$have_uintxx_t" ; then
1366 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1368 [ #include <stdint.h> ],
1369 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1371 AC_DEFINE(HAVE_UINTXX_T)
1374 [ AC_MSG_RESULT(no) ]
1378 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1379 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1381 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1384 #include <sys/bitypes.h>
1387 int8_t a; int16_t b; int32_t c;
1388 u_int8_t e; u_int16_t f; u_int32_t g;
1389 a = b = c = e = f = g = 1;
1392 AC_DEFINE(HAVE_U_INTXX_T)
1393 AC_DEFINE(HAVE_INTXX_T)
1401 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1404 #include <sys/types.h>
1406 [ u_char foo; foo = 125; ],
1407 [ ac_cv_have_u_char="yes" ],
1408 [ ac_cv_have_u_char="no" ]
1411 if test "x$ac_cv_have_u_char" = "xyes" ; then
1412 AC_DEFINE(HAVE_U_CHAR)
1417 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1419 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1422 #include <sys/types.h>
1424 [ size_t foo; foo = 1235; ],
1425 [ ac_cv_have_size_t="yes" ],
1426 [ ac_cv_have_size_t="no" ]
1429 if test "x$ac_cv_have_size_t" = "xyes" ; then
1430 AC_DEFINE(HAVE_SIZE_T)
1433 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1436 #include <sys/types.h>
1438 [ ssize_t foo; foo = 1235; ],
1439 [ ac_cv_have_ssize_t="yes" ],
1440 [ ac_cv_have_ssize_t="no" ]
1443 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1444 AC_DEFINE(HAVE_SSIZE_T)
1447 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1452 [ clock_t foo; foo = 1235; ],
1453 [ ac_cv_have_clock_t="yes" ],
1454 [ ac_cv_have_clock_t="no" ]
1457 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1458 AC_DEFINE(HAVE_CLOCK_T)
1461 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1464 #include <sys/types.h>
1465 #include <sys/socket.h>
1467 [ sa_family_t foo; foo = 1235; ],
1468 [ ac_cv_have_sa_family_t="yes" ],
1471 #include <sys/types.h>
1472 #include <sys/socket.h>
1473 #include <netinet/in.h>
1475 [ sa_family_t foo; foo = 1235; ],
1476 [ ac_cv_have_sa_family_t="yes" ],
1478 [ ac_cv_have_sa_family_t="no" ]
1482 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1483 AC_DEFINE(HAVE_SA_FAMILY_T)
1486 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1489 #include <sys/types.h>
1491 [ pid_t foo; foo = 1235; ],
1492 [ ac_cv_have_pid_t="yes" ],
1493 [ ac_cv_have_pid_t="no" ]
1496 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1497 AC_DEFINE(HAVE_PID_T)
1500 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1503 #include <sys/types.h>
1505 [ mode_t foo; foo = 1235; ],
1506 [ ac_cv_have_mode_t="yes" ],
1507 [ ac_cv_have_mode_t="no" ]
1510 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1511 AC_DEFINE(HAVE_MODE_T)
1515 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1518 #include <sys/types.h>
1519 #include <sys/socket.h>
1521 [ struct sockaddr_storage s; ],
1522 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1523 [ ac_cv_have_struct_sockaddr_storage="no" ]
1526 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1527 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1530 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1533 #include <sys/types.h>
1534 #include <netinet/in.h>
1536 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1537 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1538 [ ac_cv_have_struct_sockaddr_in6="no" ]
1541 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1542 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1545 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1548 #include <sys/types.h>
1549 #include <netinet/in.h>
1551 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1552 [ ac_cv_have_struct_in6_addr="yes" ],
1553 [ ac_cv_have_struct_in6_addr="no" ]
1556 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1557 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1560 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1563 #include <sys/types.h>
1564 #include <sys/socket.h>
1567 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1568 [ ac_cv_have_struct_addrinfo="yes" ],
1569 [ ac_cv_have_struct_addrinfo="no" ]
1572 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1573 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1576 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1578 [ #include <sys/time.h> ],
1579 [ struct timeval tv; tv.tv_sec = 1;],
1580 [ ac_cv_have_struct_timeval="yes" ],
1581 [ ac_cv_have_struct_timeval="no" ]
1584 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1585 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1586 have_struct_timeval=1
1589 AC_CHECK_TYPES(struct timespec)
1591 # We need int64_t or else certian parts of the compile will fail.
1592 if test "x$ac_cv_have_int64_t" = "xno" -a \
1593 "x$ac_cv_sizeof_long_int" != "x8" -a \
1594 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1595 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1596 echo "an alternative compiler (I.E., GCC) before continuing."
1600 dnl test snprintf (broken on SCO w/gcc)
1605 #ifdef HAVE_SNPRINTF
1609 char expected_out[50];
1611 #if (SIZEOF_LONG_INT == 8)
1612 long int num = 0x7fffffffffffffff;
1614 long long num = 0x7fffffffffffffffll;
1616 strcpy(expected_out, "9223372036854775807");
1617 snprintf(buf, mazsize, "%lld", num);
1618 if(strcmp(buf, expected_out) != 0)
1625 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1629 dnl Checks for structure members
1630 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1631 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1632 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1633 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1634 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1635 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1636 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1637 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1638 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1639 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1640 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1641 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1642 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1643 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1644 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1645 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1646 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1648 AC_CHECK_MEMBERS([struct stat.st_blksize])
1650 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1651 ac_cv_have_ss_family_in_struct_ss, [
1654 #include <sys/types.h>
1655 #include <sys/socket.h>
1657 [ struct sockaddr_storage s; s.ss_family = 1; ],
1658 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1659 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1662 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1663 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1666 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1667 ac_cv_have___ss_family_in_struct_ss, [
1670 #include <sys/types.h>
1671 #include <sys/socket.h>
1673 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1674 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1675 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1678 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1679 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1682 AC_CACHE_CHECK([for pw_class field in struct passwd],
1683 ac_cv_have_pw_class_in_struct_passwd, [
1688 [ struct passwd p; p.pw_class = 0; ],
1689 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1690 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1693 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1694 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1697 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1698 ac_cv_have_pw_expire_in_struct_passwd, [
1703 [ struct passwd p; p.pw_expire = 0; ],
1704 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1705 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1708 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1709 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1712 AC_CACHE_CHECK([for pw_change field in struct passwd],
1713 ac_cv_have_pw_change_in_struct_passwd, [
1718 [ struct passwd p; p.pw_change = 0; ],
1719 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1720 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1723 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1724 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1727 dnl make sure we're using the real structure members and not defines
1728 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1729 ac_cv_have_accrights_in_msghdr, [
1732 #include <sys/types.h>
1733 #include <sys/socket.h>
1734 #include <sys/uio.h>
1736 #ifdef msg_accrights
1740 m.msg_accrights = 0;
1744 [ ac_cv_have_accrights_in_msghdr="yes" ],
1745 [ ac_cv_have_accrights_in_msghdr="no" ]
1748 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1749 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1752 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1753 ac_cv_have_control_in_msghdr, [
1756 #include <sys/types.h>
1757 #include <sys/socket.h>
1758 #include <sys/uio.h>
1768 [ ac_cv_have_control_in_msghdr="yes" ],
1769 [ ac_cv_have_control_in_msghdr="no" ]
1772 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1773 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1776 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1778 [ extern char *__progname; printf("%s", __progname); ],
1779 [ ac_cv_libc_defines___progname="yes" ],
1780 [ ac_cv_libc_defines___progname="no" ]
1783 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1784 AC_DEFINE(HAVE___PROGNAME)
1787 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1791 [ printf("%s", __FUNCTION__); ],
1792 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1793 [ ac_cv_cc_implements___FUNCTION__="no" ]
1796 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1797 AC_DEFINE(HAVE___FUNCTION__)
1800 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1804 [ printf("%s", __func__); ],
1805 [ ac_cv_cc_implements___func__="yes" ],
1806 [ ac_cv_cc_implements___func__="no" ]
1809 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1810 AC_DEFINE(HAVE___func__)
1813 AC_CACHE_CHECK([whether getopt has optreset support],
1814 ac_cv_have_getopt_optreset, [
1819 [ extern int optreset; optreset = 0; ],
1820 [ ac_cv_have_getopt_optreset="yes" ],
1821 [ ac_cv_have_getopt_optreset="no" ]
1824 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1825 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1828 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1830 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1831 [ ac_cv_libc_defines_sys_errlist="yes" ],
1832 [ ac_cv_libc_defines_sys_errlist="no" ]
1835 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1836 AC_DEFINE(HAVE_SYS_ERRLIST)
1840 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1842 [ extern int sys_nerr; printf("%i", sys_nerr);],
1843 [ ac_cv_libc_defines_sys_nerr="yes" ],
1844 [ ac_cv_libc_defines_sys_nerr="no" ]
1847 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1848 AC_DEFINE(HAVE_SYS_NERR)
1852 # Check whether user wants sectok support
1854 [ --with-sectok Enable smartcard support using libsectok],
1856 if test "x$withval" != "xno" ; then
1857 if test "x$withval" != "xyes" ; then
1858 CPPFLAGS="$CPPFLAGS -I${withval}"
1859 LDFLAGS="$LDFLAGS -L${withval}"
1860 if test ! -z "$need_dash_r" ; then
1861 LDFLAGS="$LDFLAGS -R${withval}"
1863 if test ! -z "$blibpath" ; then
1864 blibpath="$blibpath:${withval}"
1867 AC_CHECK_HEADERS(sectok.h)
1868 if test "$ac_cv_header_sectok_h" != yes; then
1869 AC_MSG_ERROR(Can't find sectok.h)
1871 AC_CHECK_LIB(sectok, sectok_open)
1872 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1873 AC_MSG_ERROR(Can't find libsectok)
1875 AC_DEFINE(SMARTCARD)
1876 AC_DEFINE(USE_SECTOK)
1877 SCARD_MSG="yes, using sectok"
1882 # Check whether user wants OpenSC support
1884 AC_HELP_STRING([--with-opensc=PFX],
1885 [Enable smartcard support using OpenSC]),
1886 opensc_config_prefix="$withval", opensc_config_prefix="")
1887 if test x$opensc_config_prefix != x ; then
1888 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1889 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1890 if test "$OPENSC_CONFIG" != "no"; then
1891 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1892 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1893 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1894 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1895 AC_DEFINE(SMARTCARD)
1896 AC_DEFINE(USE_OPENSC)
1897 SCARD_MSG="yes, using OpenSC"
1901 # Check whether user wants DNS support
1904 [ --with-dns Support for fetching keys from DNS (experimental)],
1906 if test "x$withval" != "xno" ; then
1909 AC_SEARCH_LIBS(getrrsetbyname, resolv,
1910 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1912 # Needed by our getrrsetbyname()
1913 AC_SEARCH_LIBS(res_query, resolv)
1914 AC_SEARCH_LIBS(dn_expand, resolv)
1920 # Check whether user wants Kerberos 5 support
1922 AC_ARG_WITH(kerberos5,
1923 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1925 if test "x$withval" != "xno" ; then
1926 if test "x$withval" = "xyes" ; then
1927 KRB5ROOT="/usr/local"
1931 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1932 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1935 AC_MSG_CHECKING(whether we are using Heimdal)
1936 AC_TRY_COMPILE([ #include <krb5.h> ],
1937 [ char *tmp = heimdal_version; ],
1938 [ AC_MSG_RESULT(yes)
1940 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1943 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1946 if test ! -z "$need_dash_r" ; then
1947 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1949 if test ! -z "$blibpath" ; then
1950 blibpath="$blibpath:${KRB5ROOT}/lib"
1952 AC_SEARCH_LIBS(dn_expand, resolv)
1954 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1956 K5LIBS="-lgssapi $K5LIBS" ],
1957 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
1959 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
1960 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
1965 AC_CHECK_HEADER(gssapi.h, ,
1966 [ unset ac_cv_header_gssapi_h
1967 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1968 AC_CHECK_HEADERS(gssapi.h, ,
1969 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
1975 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1976 AC_CHECK_HEADER(gssapi_krb5.h, ,
1977 [ CPPFLAGS="$oldCPP" ])
1983 LIBS="$LIBS $K5LIBS"
1985 # Looking for programs, paths and files
1987 PRIVSEP_PATH=/var/empty
1988 AC_ARG_WITH(privsep-path,
1989 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
1991 if test "x$withval" != "$no" ; then
1992 PRIVSEP_PATH=$withval
1996 AC_SUBST(PRIVSEP_PATH)
1999 [ --with-xauth=PATH Specify path to xauth program ],
2001 if test "x$withval" != "xno" ; then
2007 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2008 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2009 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2010 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2011 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2012 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2013 xauth_path="/usr/openwin/bin/xauth"
2019 AC_ARG_ENABLE(strip,
2020 [ --disable-strip Disable calling strip(1) on install],
2022 if test "x$enableval" = "xno" ; then
2029 if test -z "$xauth_path" ; then
2030 XAUTH_PATH="undefined"
2031 AC_SUBST(XAUTH_PATH)
2033 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2034 XAUTH_PATH=$xauth_path
2035 AC_SUBST(XAUTH_PATH)
2038 # Check for mail directory (last resort if we cannot get it from headers)
2039 if test ! -z "$MAIL" ; then
2040 maildir=`dirname $MAIL`
2041 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2044 if test -z "$no_dev_ptmx" ; then
2045 if test "x$disable_ptmx_check" != "xyes" ; then
2046 AC_CHECK_FILE("/dev/ptmx",
2048 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2054 AC_CHECK_FILE("/dev/ptc",
2056 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2061 # Options from here on. Some of these are preset by platform above
2062 AC_ARG_WITH(mantype,
2063 [ --with-mantype=man|cat|doc Set man page type],
2070 AC_MSG_ERROR(invalid man type: $withval)
2075 if test -z "$MANTYPE"; then
2076 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2077 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2078 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2080 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2087 if test "$MANTYPE" = "doc"; then
2094 # Check whether to enable MD5 passwords
2096 AC_ARG_WITH(md5-passwords,
2097 [ --with-md5-passwords Enable use of MD5 passwords],
2099 if test "x$withval" != "xno" ; then
2100 AC_DEFINE(HAVE_MD5_PASSWORDS)
2106 # Whether to disable shadow password support
2108 [ --without-shadow Disable shadow password support],
2110 if test "x$withval" = "xno" ; then
2111 AC_DEFINE(DISABLE_SHADOW)
2117 if test -z "$disable_shadow" ; then
2118 AC_MSG_CHECKING([if the systems has expire shadow information])
2121 #include <sys/types.h>
2124 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2125 [ sp_expire_available=yes ], []
2128 if test "x$sp_expire_available" = "xyes" ; then
2130 AC_DEFINE(HAS_SHADOW_EXPIRE)
2136 # Use ip address instead of hostname in $DISPLAY
2137 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2138 DISPLAY_HACK_MSG="yes"
2139 AC_DEFINE(IPADDR_IN_DISPLAY)
2141 DISPLAY_HACK_MSG="no"
2142 AC_ARG_WITH(ipaddr-display,
2143 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2145 if test "x$withval" != "xno" ; then
2146 AC_DEFINE(IPADDR_IN_DISPLAY)
2147 DISPLAY_HACK_MSG="yes"
2153 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2154 if test $ac_cv_func_login_getcapbool = "yes" -a \
2155 $ac_cv_header_login_cap_h = "yes" ; then
2158 # Whether to mess with the default path
2159 SERVER_PATH_MSG="(default)"
2160 AC_ARG_WITH(default-path,
2161 [ --with-default-path= Specify default \$PATH environment for server],
2163 if test "$USES_LOGIN_CONF" = "yes" ; then
2165 --with-default-path=PATH has no effect on this system.
2166 Edit /etc/login.conf instead.])
2167 elif test "x$withval" != "xno" ; then
2168 user_path="$withval"
2169 SERVER_PATH_MSG="$withval"
2172 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2173 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2177 /* find out what STDPATH is */
2182 #ifndef _PATH_STDPATH
2183 # ifdef _PATH_USERPATH /* Irix */
2184 # define _PATH_STDPATH _PATH_USERPATH
2186 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2189 #include <sys/types.h>
2190 #include <sys/stat.h>
2192 #define DATA "conftest.stdpath"
2199 fd = fopen(DATA,"w");
2203 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2208 ], [ user_path=`cat conftest.stdpath` ],
2209 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2210 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2212 # make sure $bindir is in USER_PATH so scp will work
2213 t_bindir=`eval echo ${bindir}`
2215 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2218 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2220 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2221 if test $? -ne 0 ; then
2222 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2223 if test $? -ne 0 ; then
2224 user_path=$user_path:$t_bindir
2225 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2230 if test "$USES_LOGIN_CONF" != "yes" ; then
2231 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2235 # Set superuser path separately to user path
2236 AC_ARG_WITH(superuser-path,
2237 [ --with-superuser-path= Specify different path for super-user],
2239 if test "x$withval" != "xno" ; then
2240 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2241 superuser_path=$withval
2247 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2248 IPV4_IN6_HACK_MSG="no"
2250 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2252 if test "x$withval" != "xno" ; then
2254 AC_DEFINE(IPV4_IN_IPV6)
2255 IPV4_IN6_HACK_MSG="yes"
2260 if test "x$inet6_default_4in6" = "xyes"; then
2261 AC_MSG_RESULT([yes (default)])
2262 AC_DEFINE(IPV4_IN_IPV6)
2263 IPV4_IN6_HACK_MSG="yes"
2265 AC_MSG_RESULT([no (default)])
2270 # Whether to enable BSD auth support
2272 AC_ARG_WITH(bsd-auth,
2273 [ --with-bsd-auth Enable BSD auth support],
2275 if test "x$withval" != "xno" ; then
2282 # Where to place sshd.pid
2284 # make sure the directory exists
2285 if test ! -d $piddir ; then
2286 piddir=`eval echo ${sysconfdir}`
2288 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2292 AC_ARG_WITH(pid-dir,
2293 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2295 if test "x$withval" != "xno" ; then
2297 if test ! -d $piddir ; then
2298 AC_MSG_WARN([** no $piddir directory on this system **])
2304 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2307 dnl allow user to disable some login recording features
2308 AC_ARG_ENABLE(lastlog,
2309 [ --disable-lastlog disable use of lastlog even if detected [no]],
2311 if test "x$enableval" = "xno" ; then
2312 AC_DEFINE(DISABLE_LASTLOG)
2317 [ --disable-utmp disable use of utmp even if detected [no]],
2319 if test "x$enableval" = "xno" ; then
2320 AC_DEFINE(DISABLE_UTMP)
2324 AC_ARG_ENABLE(utmpx,
2325 [ --disable-utmpx disable use of utmpx even if detected [no]],
2327 if test "x$enableval" = "xno" ; then
2328 AC_DEFINE(DISABLE_UTMPX)
2333 [ --disable-wtmp disable use of wtmp even if detected [no]],
2335 if test "x$enableval" = "xno" ; then
2336 AC_DEFINE(DISABLE_WTMP)
2340 AC_ARG_ENABLE(wtmpx,
2341 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2343 if test "x$enableval" = "xno" ; then
2344 AC_DEFINE(DISABLE_WTMPX)
2348 AC_ARG_ENABLE(libutil,
2349 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2351 if test "x$enableval" = "xno" ; then
2352 AC_DEFINE(DISABLE_LOGIN)
2356 AC_ARG_ENABLE(pututline,
2357 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2359 if test "x$enableval" = "xno" ; then
2360 AC_DEFINE(DISABLE_PUTUTLINE)
2364 AC_ARG_ENABLE(pututxline,
2365 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2367 if test "x$enableval" = "xno" ; then
2368 AC_DEFINE(DISABLE_PUTUTXLINE)
2372 AC_ARG_WITH(lastlog,
2373 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2375 if test "x$withval" = "xno" ; then
2376 AC_DEFINE(DISABLE_LASTLOG)
2378 conf_lastlog_location=$withval
2383 dnl lastlog, [uw]tmpx? detection
2384 dnl NOTE: set the paths in the platform section to avoid the
2385 dnl need for command-line parameters
2386 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2388 dnl lastlog detection
2389 dnl NOTE: the code itself will detect if lastlog is a directory
2390 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2392 #include <sys/types.h>
2394 #ifdef HAVE_LASTLOG_H
2395 # include <lastlog.h>
2404 [ char *lastlog = LASTLOG_FILE; ],
2405 [ AC_MSG_RESULT(yes) ],
2408 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2410 #include <sys/types.h>
2412 #ifdef HAVE_LASTLOG_H
2413 # include <lastlog.h>
2419 [ char *lastlog = _PATH_LASTLOG; ],
2420 [ AC_MSG_RESULT(yes) ],
2423 system_lastlog_path=no
2428 if test -z "$conf_lastlog_location"; then
2429 if test x"$system_lastlog_path" = x"no" ; then
2430 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2431 if (test -d "$f" || test -f "$f") ; then
2432 conf_lastlog_location=$f
2435 if test -z "$conf_lastlog_location"; then
2436 AC_MSG_WARN([** Cannot find lastlog **])
2437 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2442 if test -n "$conf_lastlog_location"; then
2443 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2447 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2449 #include <sys/types.h>
2455 [ char *utmp = UTMP_FILE; ],
2456 [ AC_MSG_RESULT(yes) ],
2458 system_utmp_path=no ]
2460 if test -z "$conf_utmp_location"; then
2461 if test x"$system_utmp_path" = x"no" ; then
2462 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2463 if test -f $f ; then
2464 conf_utmp_location=$f
2467 if test -z "$conf_utmp_location"; then
2468 AC_DEFINE(DISABLE_UTMP)
2472 if test -n "$conf_utmp_location"; then
2473 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2477 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2479 #include <sys/types.h>
2485 [ char *wtmp = WTMP_FILE; ],
2486 [ AC_MSG_RESULT(yes) ],
2488 system_wtmp_path=no ]
2490 if test -z "$conf_wtmp_location"; then
2491 if test x"$system_wtmp_path" = x"no" ; then
2492 for f in /usr/adm/wtmp /var/log/wtmp; do
2493 if test -f $f ; then
2494 conf_wtmp_location=$f
2497 if test -z "$conf_wtmp_location"; then
2498 AC_DEFINE(DISABLE_WTMP)
2502 if test -n "$conf_wtmp_location"; then
2503 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2507 dnl utmpx detection - I don't know any system so perverse as to require
2508 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2510 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2512 #include <sys/types.h>
2521 [ char *utmpx = UTMPX_FILE; ],
2522 [ AC_MSG_RESULT(yes) ],
2524 system_utmpx_path=no ]
2526 if test -z "$conf_utmpx_location"; then
2527 if test x"$system_utmpx_path" = x"no" ; then
2528 AC_DEFINE(DISABLE_UTMPX)
2531 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2535 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2537 #include <sys/types.h>
2546 [ char *wtmpx = WTMPX_FILE; ],
2547 [ AC_MSG_RESULT(yes) ],
2549 system_wtmpx_path=no ]
2551 if test -z "$conf_wtmpx_location"; then
2552 if test x"$system_wtmpx_path" = x"no" ; then
2553 AC_DEFINE(DISABLE_WTMPX)
2556 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2560 if test ! -z "$blibpath" ; then
2561 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2562 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2565 dnl remove pam and dl because they are in $LIBPAM
2566 if test "$PAM_MSG" = yes ; then
2567 LIBS=`echo $LIBS | sed 's/-lpam //'`
2569 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2570 LIBS=`echo $LIBS | sed 's/-ldl //'`
2574 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2577 # Print summary of options
2579 # Someone please show me a better way :)
2580 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2581 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2582 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2583 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2584 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2585 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2586 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2587 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2588 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2589 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2592 echo "OpenSSH has been configured with the following options:"
2593 echo " User binaries: $B"
2594 echo " System binaries: $C"
2595 echo " Configuration files: $D"
2596 echo " Askpass program: $E"
2597 echo " Manual pages: $F"
2598 echo " PID file: $G"
2599 echo " Privilege separation chroot path: $H"
2600 if test "$USES_LOGIN_CONF" = "yes" ; then
2601 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2603 echo " sshd default user PATH: $I"
2605 if test ! -z "$superuser_path" ; then
2606 echo " sshd superuser user PATH: $J"
2608 echo " Manpage format: $MANTYPE"
2609 echo " DNS support: $DNS_MSG"
2610 echo " PAM support: $PAM_MSG"
2611 echo " KerberosV support: $KRB5_MSG"
2612 echo " Smartcard support: $SCARD_MSG"
2613 echo " S/KEY support: $SKEY_MSG"
2614 echo " TCP Wrappers support: $TCPW_MSG"
2615 echo " MD5 password support: $MD5_MSG"
2616 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2617 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2618 echo " BSD Auth support: $BSD_AUTH_MSG"
2619 echo " Random number source: $RAND_MSG"
2620 if test ! -z "$USE_RAND_HELPER" ; then
2621 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2626 echo " Host: ${host}"
2627 echo " Compiler: ${CC}"
2628 echo " Compiler flags: ${CFLAGS}"
2629 echo "Preprocessor flags: ${CPPFLAGS}"
2630 echo " Linker flags: ${LDFLAGS}"
2631 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2635 if test "x$PAM_MSG" = "xyes" ; then
2636 echo "PAM is enabled. You may need to install a PAM control file "
2637 echo "for sshd, otherwise password authentication may fail. "
2638 echo "Example PAM control files can be found in the contrib/ "
2643 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2644 echo "WARNING: you are using the builtin random number collection "
2645 echo "service. Please read WARNING.RNG and request that your OS "
2646 echo "vendor includes kernel-based random number collection in "
2647 echo "future versions of your OS."