4 AC_CONFIG_SRCDIR([ssh.c])
6 AC_CONFIG_HEADER(config.h)
11 # Checks for programs.
16 AC_PATH_PROGS(PERL, perl5 perl)
17 AC_PATH_PROG(SED, sed)
19 AC_PATH_PROG(ENT, ent)
21 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
22 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
23 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
29 if test -z "$AR" ; then
30 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
33 # Use LOGIN_PROGRAM from environment if possible
34 if test ! -z "$LOGIN_PROGRAM" ; then
35 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
38 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
39 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
40 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
44 if test -z "$LD" ; then
50 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
51 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
54 # Check for some target-specific stuff
57 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
58 LDFLAGS="$LDFLAGS -L/usr/local/lib"
59 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
60 if (test -z "$blibpath"); then
61 blibpath="/usr/lib:/lib:/usr/local/lib"
63 saved_LDFLAGS="$LDFLAGS"
64 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
65 if (test -z "$blibflags"); then
66 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
67 AC_TRY_LINK([], [], [blibflags=$tryflags])
70 if (test -z "$blibflags"); then
71 AC_MSG_RESULT(not found)
72 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
74 AC_MSG_RESULT($blibflags)
76 LDFLAGS="$saved_LDFLAGS"
77 dnl Check for authenticate. Might be in libs.a on older AIXes
78 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
79 [AC_CHECK_LIB(s,authenticate,
80 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
84 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
85 AC_CHECK_DECL(loginfailed,
86 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
88 [#include <usersec.h>],
89 [(void)loginfailed("user","host","tty",0);],
91 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
95 [#include <usersec.h>]
97 AC_CHECK_FUNCS(setauthdb)
98 AC_DEFINE(BROKEN_GETADDRINFO)
99 AC_DEFINE(BROKEN_REALPATH)
100 AC_DEFINE(SETEUID_BREAKS_SETUID)
101 AC_DEFINE(BROKEN_SETREUID)
102 AC_DEFINE(BROKEN_SETREGID)
103 dnl AIX handles lastlog as part of its login message
104 AC_DEFINE(DISABLE_LASTLOG)
105 AC_DEFINE(LOGIN_NEEDS_UTMPX)
106 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
109 check_for_libcrypt_later=1
110 LIBS="$LIBS /usr/lib/textmode.o"
111 AC_DEFINE(HAVE_CYGWIN)
113 AC_DEFINE(DISABLE_SHADOW)
114 AC_DEFINE(IP_TOS_IS_BROKEN)
115 AC_DEFINE(NO_X11_UNIX_SOCKETS)
116 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
117 AC_DEFINE(DISABLE_FD_PASSING)
118 AC_DEFINE(SETGROUPS_NOOP)
121 AC_DEFINE(IP_TOS_IS_BROKEN)
124 AC_MSG_CHECKING(if we have working getaddrinfo)
125 AC_TRY_RUN([#include <mach-o/dyld.h>
126 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
130 }], [AC_MSG_RESULT(working)],
131 [AC_MSG_RESULT(buggy)
132 AC_DEFINE(BROKEN_GETADDRINFO)],
133 [AC_MSG_RESULT(assume it is working)])
136 if test -z "$GCC"; then
139 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
140 IPADDR_IN_DISPLAY=yes
141 AC_DEFINE(HAVE_SECUREWARE)
143 AC_DEFINE(LOGIN_NO_ENDOPT)
144 AC_DEFINE(LOGIN_NEEDS_UTMPX)
145 AC_DEFINE(DISABLE_SHADOW)
146 AC_DEFINE(DISABLE_UTMP)
147 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
148 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
149 LIBS="$LIBS -lsec -lsecpw"
150 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
151 disable_ptmx_check=yes
154 if test -z "$GCC"; then
157 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
158 IPADDR_IN_DISPLAY=yes
160 AC_DEFINE(LOGIN_NO_ENDOPT)
161 AC_DEFINE(LOGIN_NEEDS_UTMPX)
162 AC_DEFINE(DISABLE_SHADOW)
163 AC_DEFINE(DISABLE_UTMP)
164 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
165 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
167 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
170 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
171 IPADDR_IN_DISPLAY=yes
172 AC_DEFINE(PAM_SUN_CODEBASE)
174 AC_DEFINE(LOGIN_NO_ENDOPT)
175 AC_DEFINE(LOGIN_NEEDS_UTMPX)
176 AC_DEFINE(DISABLE_SHADOW)
177 AC_DEFINE(DISABLE_UTMP)
178 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
179 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
181 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
184 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
186 PATH="$PATH:/usr/etc"
187 AC_DEFINE(BROKEN_INET_NTOA)
188 AC_DEFINE(WITH_ABBREV_NO_TTY)
189 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
192 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
194 PATH="$PATH:/usr/etc"
195 AC_DEFINE(WITH_IRIX_ARRAY)
196 AC_DEFINE(WITH_IRIX_PROJECT)
197 AC_DEFINE(WITH_IRIX_AUDIT)
198 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
199 AC_DEFINE(BROKEN_INET_NTOA)
200 AC_DEFINE(WITH_ABBREV_NO_TTY)
201 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
205 check_for_libcrypt_later=1
206 check_for_openpty_ctty_bug=1
207 AC_DEFINE(DONT_TRY_OTHER_AF)
208 AC_DEFINE(PAM_TTY_KLUDGE)
209 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
210 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
211 inet6_default_4in6=yes
214 AC_DEFINE(BROKEN_CMSG_TYPE)
218 mips-sony-bsd|mips-sony-newsos4)
219 AC_DEFINE(HAVE_NEWS4)
223 check_for_libcrypt_before=1
227 check_for_libcrypt_later=1
230 conf_lastlog_location="/usr/adm/lastlog"
231 conf_utmp_location=/etc/utmp
232 conf_wtmp_location=/usr/adm/wtmp
235 AC_DEFINE(BROKEN_REALPATH)
237 AC_DEFINE(BROKEN_SAVED_UIDS)
238 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
242 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
243 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
245 AC_DEFINE(PAM_SUN_CODEBASE)
246 AC_DEFINE(LOGIN_NEEDS_UTMPX)
247 AC_DEFINE(LOGIN_NEEDS_TERM)
248 AC_DEFINE(PAM_TTY_KLUDGE)
249 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
250 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
251 AC_DEFINE(SSHD_ACQUIRES_CTTY)
252 # hardwire lastlog location (can't detect it on some versions)
253 conf_lastlog_location="/var/adm/lastlog"
254 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
255 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
256 if test "$sol2ver" -ge 8; then
258 AC_DEFINE(DISABLE_UTMP)
259 AC_DEFINE(DISABLE_WTMP)
265 CPPFLAGS="$CPPFLAGS -DSUNOS4"
266 AC_CHECK_FUNCS(getpwanam)
267 AC_DEFINE(PAM_SUN_CODEBASE)
268 conf_utmp_location=/etc/utmp
269 conf_wtmp_location=/var/adm/wtmp
270 conf_lastlog_location=/var/adm/lastlog
274 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
275 LDFLAGS="$LDFLAGS -L/usr/local/lib"
278 AC_DEFINE(SSHD_ACQUIRES_CTTY)
281 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
282 # /usr/ucblib MUST NOT be searched on ReliantUNIX
283 LDFLAGS="$LDFLAGS -L/usr/local/lib"
284 IPADDR_IN_DISPLAY=yes
286 AC_DEFINE(IP_TOS_IS_BROKEN)
287 AC_DEFINE(SSHD_ACQUIRES_CTTY)
288 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
289 # Attention: always take care to bind libsocket and libnsl before libc,
290 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
293 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
294 LDFLAGS="$LDFLAGS -L/usr/local/lib"
298 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
299 LDFLAGS="$LDFLAGS -L/usr/local/lib"
303 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
304 LDFLAGS="$LDFLAGS -L/usr/local/lib"
307 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
308 LDFLAGS="$LDFLAGS -L/usr/local/lib"
309 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
312 AC_DEFINE(BROKEN_SYS_TERMIO_H)
314 AC_DEFINE(HAVE_SECUREWARE)
315 AC_DEFINE(DISABLE_SHADOW)
316 AC_DEFINE(BROKEN_SAVED_UIDS)
317 AC_CHECK_FUNCS(getluid setluid)
319 do_sco3_extra_lib_check=yes
322 if test -z "$GCC"; then
323 CFLAGS="$CFLAGS -belf"
325 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
326 LDFLAGS="$LDFLAGS -L/usr/local/lib"
327 LIBS="$LIBS -lprot -lx -ltinfo -lm"
330 AC_DEFINE(HAVE_SECUREWARE)
331 AC_DEFINE(DISABLE_SHADOW)
332 AC_DEFINE(DISABLE_FD_PASSING)
333 AC_CHECK_FUNCS(getluid setluid)
338 AC_DEFINE(DISABLE_FD_PASSING)
340 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
345 AC_DEFINE(DISABLE_FD_PASSING)
346 AC_DEFINE(NO_SSH_LASTLOG)
347 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
348 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
352 AC_MSG_CHECKING(for Digital Unix SIA)
355 [ --with-osfsia Enable Digital Unix SIA],
357 if test "x$withval" = "xno" ; then
358 AC_MSG_RESULT(disabled)
363 if test -z "$no_osfsia" ; then
364 if test -f /etc/sia/matrix.conf; then
366 AC_DEFINE(HAVE_OSF_SIA)
367 AC_DEFINE(DISABLE_LOGIN)
368 AC_DEFINE(DISABLE_FD_PASSING)
369 LIBS="$LIBS -lsecurity -ldb -lm -laud"
374 AC_DEFINE(DISABLE_FD_PASSING)
375 AC_DEFINE(BROKEN_GETADDRINFO)
376 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
381 AC_DEFINE(NO_X11_UNIX_SOCKETS)
382 AC_DEFINE(MISSING_NFDBITS)
383 AC_DEFINE(MISSING_HOWMANY)
384 AC_DEFINE(MISSING_FD_MASK)
388 # Allow user to specify flags
390 [ --with-cflags Specify additional flags to pass to compiler],
392 if test "x$withval" != "xno" ; then
393 CFLAGS="$CFLAGS $withval"
397 AC_ARG_WITH(cppflags,
398 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
400 if test "x$withval" != "xno"; then
401 CPPFLAGS="$CPPFLAGS $withval"
406 [ --with-ldflags Specify additional flags to pass to linker],
408 if test "x$withval" != "xno" ; then
409 LDFLAGS="$LDFLAGS $withval"
414 [ --with-libs Specify additional libraries to link with],
416 if test "x$withval" != "xno" ; then
417 LIBS="$LIBS $withval"
422 AC_MSG_CHECKING(compiler and flags for sanity)
427 [ AC_MSG_RESULT(yes) ],
430 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
434 # Checks for header files.
435 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
436 getopt.h glob.h ia.h lastlog.h libgen.h limits.h login.h \
437 login_cap.h maillock.h netdb.h netgroup.h \
438 netinet/in_systm.h paths.h pty.h readpassphrase.h \
439 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
440 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
441 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
442 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
443 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
444 util.h utime.h utmp.h utmpx.h)
446 # Checks for libraries.
447 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
448 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
450 dnl SCO OS3 needs this for libwrap
451 if test "x$with_tcp_wrappers" != "xno" ; then
452 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
453 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
457 AC_CHECK_FUNC(getspnam, ,
458 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
461 [ --without-rpath Disable auto-added -R linker paths],
463 if test "x$withval" = "xno" ; then
466 if test "x$withval" = "xyes" ; then
474 [ --with-zlib=PATH Use zlib in PATH],
476 if test "x$withval" = "xno" ; then
477 AC_MSG_ERROR([*** zlib is required ***])
479 if test -d "$withval/lib"; then
480 if test -n "${need_dash_r}"; then
481 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
483 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
486 if test -n "${need_dash_r}"; then
487 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
489 LDFLAGS="-L${withval} ${LDFLAGS}"
492 if test -d "$withval/include"; then
493 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
495 CPPFLAGS="-I${withval} ${CPPFLAGS}"
500 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
503 AC_CHECK_FUNC(strcasecmp,
504 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
506 AC_CHECK_FUNC(utimes,
507 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
508 LIBS="$LIBS -lc89"]) ]
511 dnl Checks for libutil functions
512 AC_CHECK_HEADERS(libutil.h)
513 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
514 AC_CHECK_FUNCS(logout updwtmp logwtmp)
518 # Check for ALTDIRFUNC glob() extension
519 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
520 AC_EGREP_CPP(FOUNDIT,
523 #ifdef GLOB_ALTDIRFUNC
528 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
536 # Check for g.gl_matchc glob() extension
537 AC_MSG_CHECKING(for gl_matchc field in glob_t)
538 AC_EGREP_CPP(FOUNDIT,
541 int main(void){glob_t g; g.gl_matchc = 1;}
544 AC_DEFINE(GLOB_HAS_GL_MATCHC)
552 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
555 #include <sys/types.h>
557 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
559 [AC_MSG_RESULT(yes)],
562 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
566 # Check whether user wants S/Key support
569 [ --with-skey[[=PATH]] Enable S/Key support
570 (optionally in PATH)],
572 if test "x$withval" != "xno" ; then
574 if test "x$withval" != "xyes" ; then
575 CPPFLAGS="$CPPFLAGS -I${withval}/include"
576 LDFLAGS="$LDFLAGS -L${withval}/lib"
583 AC_MSG_CHECKING([for s/key support])
588 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
590 [AC_MSG_RESULT(yes)],
593 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
599 # Check whether user wants TCP wrappers support
601 AC_ARG_WITH(tcp-wrappers,
602 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
603 (optionally in PATH)],
605 if test "x$withval" != "xno" ; then
607 saved_LDFLAGS="$LDFLAGS"
608 saved_CPPFLAGS="$CPPFLAGS"
609 if test -n "${withval}" -a "${withval}" != "yes"; then
610 if test -d "${withval}/lib"; then
611 if test -n "${need_dash_r}"; then
612 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
614 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
617 if test -n "${need_dash_r}"; then
618 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
620 LDFLAGS="-L${withval} ${LDFLAGS}"
623 if test -d "${withval}/include"; then
624 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
626 CPPFLAGS="-I${withval} ${CPPFLAGS}"
630 LIBS="$LIBWRAP $LIBS"
631 AC_MSG_CHECKING(for libwrap)
635 int deny_severity = 0, allow_severity = 0;
645 AC_MSG_ERROR([*** libwrap missing])
653 dnl Checks for library functions. Please keep in alphabetical order
655 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
656 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
657 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
658 getpeereid _getpty getrlimit getttyent glob inet_aton \
659 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
660 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
661 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
662 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
663 setproctitle setregid setresgid setresuid setreuid setrlimit \
664 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
665 strlcat strlcpy strmode strnvis sysconf tcgetpgrp tcsendbreak \
666 truncate utimes vhangup vsnprintf waitpid \
669 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
670 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
672 dnl Make sure prototypes are defined for these before using them.
673 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
674 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
676 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
677 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
678 AC_CHECK_LIB(gen, dirname,[
679 AC_CACHE_CHECK([for broken dirname],
680 ac_cv_have_broken_dirname, [
688 int main(int argc, char **argv) {
691 strncpy(buf,"/etc", 32);
693 if (!s || strncmp(s, "/", 32) != 0) {
700 [ ac_cv_have_broken_dirname="no" ],
701 [ ac_cv_have_broken_dirname="yes" ]
705 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
707 AC_DEFINE(HAVE_DIRNAME)
708 AC_CHECK_HEADERS(libgen.h)
713 dnl Checks for time functions
714 AC_CHECK_FUNCS(gettimeofday time)
715 dnl Checks for utmp functions
716 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
717 AC_CHECK_FUNCS(utmpname)
718 dnl Checks for utmpx functions
719 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
720 AC_CHECK_FUNCS(setutxent utmpxname)
722 AC_CHECK_FUNC(daemon,
723 [AC_DEFINE(HAVE_DAEMON)],
724 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
727 AC_CHECK_FUNC(getpagesize,
728 [AC_DEFINE(HAVE_GETPAGESIZE)],
729 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
732 # Check for broken snprintf
733 if test "x$ac_cv_func_snprintf" = "xyes" ; then
734 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
738 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
740 [AC_MSG_RESULT(yes)],
743 AC_DEFINE(BROKEN_SNPRINTF)
744 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
749 dnl see whether mkstemp() requires XXXXXX
750 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
751 AC_MSG_CHECKING([for (overly) strict mkstemp])
755 main() { char template[]="conftest.mkstemp-test";
756 if (mkstemp(template) == -1)
758 unlink(template); exit(0);
766 AC_DEFINE(HAVE_STRICT_MKSTEMP)
770 AC_DEFINE(HAVE_STRICT_MKSTEMP)
775 dnl make sure that openpty does not reacquire controlling terminal
776 if test ! -z "$check_for_openpty_ctty_bug"; then
777 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
781 #include <sys/fcntl.h>
782 #include <sys/types.h>
783 #include <sys/wait.h>
789 int fd, ptyfd, ttyfd, status;
792 if (pid < 0) { /* failed */
794 } else if (pid > 0) { /* parent */
795 waitpid(pid, &status, 0);
796 if (WIFEXITED(status))
797 exit(WEXITSTATUS(status));
801 close(0); close(1); close(2);
803 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
804 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
806 exit(3); /* Acquired ctty: broken */
808 exit(0); /* Did not acquire ctty: OK */
817 AC_DEFINE(SSHD_ACQUIRES_CTTY)
827 [ --with-pam Enable PAM support ],
829 if test "x$withval" != "xno" ; then
830 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
831 AC_MSG_ERROR([PAM headers not found])
834 AC_CHECK_LIB(dl, dlopen, , )
835 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
836 AC_CHECK_FUNCS(pam_getenvlist)
837 AC_CHECK_FUNCS(pam_putenv)
843 if test $ac_cv_lib_dl_dlopen = yes; then
853 # Check for older PAM
854 if test "x$PAM_MSG" = "xyes" ; then
855 # Check PAM strerror arguments (old PAM)
856 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
860 #include <security/pam_appl.h>
862 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
865 AC_DEFINE(HAVE_OLD_PAM)
867 PAM_MSG="yes (old library)"
872 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
873 # because the system crypt() is more featureful.
874 if test "x$check_for_libcrypt_before" = "x1"; then
875 AC_CHECK_LIB(crypt, crypt)
879 saved_CPPFLAGS="$CPPFLAGS"
880 saved_LDFLAGS="$LDFLAGS"
882 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
884 if test "x$withval" != "xno" ; then
885 if test -d "$withval/lib"; then
886 if test -n "${need_dash_r}"; then
887 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
889 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
892 if test -n "${need_dash_r}"; then
893 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
895 LDFLAGS="-L${withval} ${LDFLAGS}"
898 if test -d "$withval/include"; then
899 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
901 CPPFLAGS="-I${withval} ${CPPFLAGS}"
906 LIBS="$LIBS -lcrypto"
907 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
909 dnl Check default openssl install dir
910 if test -n "${need_dash_r}"; then
911 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
913 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
915 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
916 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
918 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
924 # Determine OpenSSL header version
925 AC_MSG_CHECKING([OpenSSL header version])
930 #include <openssl/opensslv.h>
931 #define DATA "conftest.sslincver"
936 fd = fopen(DATA,"w");
940 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
947 ssl_header_ver=`cat conftest.sslincver`
948 AC_MSG_RESULT($ssl_header_ver)
951 AC_MSG_RESULT(not found)
952 AC_MSG_ERROR(OpenSSL version header not found.)
956 # Determine OpenSSL library version
957 AC_MSG_CHECKING([OpenSSL library version])
962 #include <openssl/opensslv.h>
963 #include <openssl/crypto.h>
964 #define DATA "conftest.ssllibver"
969 fd = fopen(DATA,"w");
973 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
980 ssl_library_ver=`cat conftest.ssllibver`
981 AC_MSG_RESULT($ssl_library_ver)
984 AC_MSG_RESULT(not found)
985 AC_MSG_ERROR(OpenSSL library not found.)
989 # Sanity check OpenSSL headers
990 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
994 #include <openssl/opensslv.h>
995 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1002 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1003 Check config.log for details.
1004 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1008 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1009 # version in OpenSSL. Skip this for PAM
1010 if test "x$check_for_libcrypt_later" = "x1"; then
1011 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1015 ### Configure cryptographic random number support
1017 # Check wheter OpenSSL seeds itself
1018 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1022 #include <openssl/rand.h>
1023 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1026 OPENSSL_SEEDS_ITSELF=yes
1031 # Default to use of the rand helper if OpenSSL doesn't
1038 # Do we want to force the use of the rand helper?
1039 AC_ARG_WITH(rand-helper,
1040 [ --with-rand-helper Use subprocess to gather strong randomness ],
1042 if test "x$withval" = "xno" ; then
1043 # Force use of OpenSSL's internal RNG, even if
1044 # the previous test showed it to be unseeded.
1045 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1046 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1047 OPENSSL_SEEDS_ITSELF=yes
1056 # Which randomness source do we use?
1057 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1059 AC_DEFINE(OPENSSL_PRNG_ONLY)
1060 RAND_MSG="OpenSSL internal ONLY"
1061 INSTALL_SSH_RAND_HELPER=""
1062 elif test ! -z "$USE_RAND_HELPER" ; then
1063 # install rand helper
1064 RAND_MSG="ssh-rand-helper"
1065 INSTALL_SSH_RAND_HELPER="yes"
1067 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1069 ### Configuration of ssh-rand-helper
1072 AC_ARG_WITH(prngd-port,
1073 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1082 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1085 if test ! -z "$withval" ; then
1086 PRNGD_PORT="$withval"
1087 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1092 # PRNGD Unix domain socket
1093 AC_ARG_WITH(prngd-socket,
1094 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1098 withval="/var/run/egd-pool"
1106 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1110 if test ! -z "$withval" ; then
1111 if test ! -z "$PRNGD_PORT" ; then
1112 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1114 if test ! -r "$withval" ; then
1115 AC_MSG_WARN(Entropy socket is not readable)
1117 PRNGD_SOCKET="$withval"
1118 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1122 # Check for existing socket only if we don't have a random device already
1123 if test "$USE_RAND_HELPER" = yes ; then
1124 AC_MSG_CHECKING(for PRNGD/EGD socket)
1125 # Insert other locations here
1126 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1127 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1128 PRNGD_SOCKET="$sock"
1129 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1133 if test ! -z "$PRNGD_SOCKET" ; then
1134 AC_MSG_RESULT($PRNGD_SOCKET)
1136 AC_MSG_RESULT(not found)
1142 # Change default command timeout for hashing entropy source
1144 AC_ARG_WITH(entropy-timeout,
1145 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1147 if test "x$withval" != "xno" ; then
1148 entropy_timeout=$withval
1152 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1154 SSH_PRIVSEP_USER=sshd
1155 AC_ARG_WITH(privsep-user,
1156 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1158 if test -n "$withval"; then
1159 SSH_PRIVSEP_USER=$withval
1163 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1164 AC_SUBST(SSH_PRIVSEP_USER)
1166 # We do this little dance with the search path to insure
1167 # that programs that we select for use by installed programs
1168 # (which may be run by the super-user) come from trusted
1169 # locations before they come from the user's private area.
1170 # This should help avoid accidentally configuring some
1171 # random version of a program in someone's personal bin.
1175 test -h /bin 2> /dev/null && PATH=/usr/bin
1176 test -d /sbin && PATH=$PATH:/sbin
1177 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1178 PATH=$PATH:/etc:$OPATH
1180 # These programs are used by the command hashing source to gather entropy
1181 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1182 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1183 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1184 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1185 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1186 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1187 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1188 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1189 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1190 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1191 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1192 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1193 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1194 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1195 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1196 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1200 # Where does ssh-rand-helper get its randomness from?
1201 INSTALL_SSH_PRNG_CMDS=""
1202 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1203 if test ! -z "$PRNGD_PORT" ; then
1204 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1205 elif test ! -z "$PRNGD_SOCKET" ; then
1206 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1208 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1209 RAND_HELPER_CMDHASH=yes
1210 INSTALL_SSH_PRNG_CMDS="yes"
1213 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1216 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1217 if test ! -z "$SONY" ; then
1218 LIBS="$LIBS -liberty";
1221 # Checks for data types
1222 AC_CHECK_SIZEOF(char, 1)
1223 AC_CHECK_SIZEOF(short int, 2)
1224 AC_CHECK_SIZEOF(int, 4)
1225 AC_CHECK_SIZEOF(long int, 4)
1226 AC_CHECK_SIZEOF(long long int, 8)
1228 # Sanity check long long for some platforms (AIX)
1229 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1230 ac_cv_sizeof_long_long_int=0
1233 # More checks for data types
1234 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1236 [ #include <sys/types.h> ],
1238 [ ac_cv_have_u_int="yes" ],
1239 [ ac_cv_have_u_int="no" ]
1242 if test "x$ac_cv_have_u_int" = "xyes" ; then
1243 AC_DEFINE(HAVE_U_INT)
1247 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1249 [ #include <sys/types.h> ],
1250 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1251 [ ac_cv_have_intxx_t="yes" ],
1252 [ ac_cv_have_intxx_t="no" ]
1255 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1256 AC_DEFINE(HAVE_INTXX_T)
1260 if (test -z "$have_intxx_t" && \
1261 test "x$ac_cv_header_stdint_h" = "xyes")
1263 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1265 [ #include <stdint.h> ],
1266 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1268 AC_DEFINE(HAVE_INTXX_T)
1271 [ AC_MSG_RESULT(no) ]
1275 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1278 #include <sys/types.h>
1279 #ifdef HAVE_STDINT_H
1280 # include <stdint.h>
1282 #include <sys/socket.h>
1283 #ifdef HAVE_SYS_BITYPES_H
1284 # include <sys/bitypes.h>
1287 [ int64_t a; a = 1;],
1288 [ ac_cv_have_int64_t="yes" ],
1289 [ ac_cv_have_int64_t="no" ]
1292 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1293 AC_DEFINE(HAVE_INT64_T)
1296 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1298 [ #include <sys/types.h> ],
1299 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1300 [ ac_cv_have_u_intxx_t="yes" ],
1301 [ ac_cv_have_u_intxx_t="no" ]
1304 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1305 AC_DEFINE(HAVE_U_INTXX_T)
1309 if test -z "$have_u_intxx_t" ; then
1310 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1312 [ #include <sys/socket.h> ],
1313 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1315 AC_DEFINE(HAVE_U_INTXX_T)
1318 [ AC_MSG_RESULT(no) ]
1322 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1324 [ #include <sys/types.h> ],
1325 [ u_int64_t a; a = 1;],
1326 [ ac_cv_have_u_int64_t="yes" ],
1327 [ ac_cv_have_u_int64_t="no" ]
1330 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1331 AC_DEFINE(HAVE_U_INT64_T)
1335 if test -z "$have_u_int64_t" ; then
1336 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1338 [ #include <sys/bitypes.h> ],
1339 [ u_int64_t a; a = 1],
1341 AC_DEFINE(HAVE_U_INT64_T)
1344 [ AC_MSG_RESULT(no) ]
1348 if test -z "$have_u_intxx_t" ; then
1349 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1352 #include <sys/types.h>
1354 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1355 [ ac_cv_have_uintxx_t="yes" ],
1356 [ ac_cv_have_uintxx_t="no" ]
1359 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1360 AC_DEFINE(HAVE_UINTXX_T)
1364 if test -z "$have_uintxx_t" ; then
1365 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1367 [ #include <stdint.h> ],
1368 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1370 AC_DEFINE(HAVE_UINTXX_T)
1373 [ AC_MSG_RESULT(no) ]
1377 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1378 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1380 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1383 #include <sys/bitypes.h>
1386 int8_t a; int16_t b; int32_t c;
1387 u_int8_t e; u_int16_t f; u_int32_t g;
1388 a = b = c = e = f = g = 1;
1391 AC_DEFINE(HAVE_U_INTXX_T)
1392 AC_DEFINE(HAVE_INTXX_T)
1400 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1403 #include <sys/types.h>
1405 [ u_char foo; foo = 125; ],
1406 [ ac_cv_have_u_char="yes" ],
1407 [ ac_cv_have_u_char="no" ]
1410 if test "x$ac_cv_have_u_char" = "xyes" ; then
1411 AC_DEFINE(HAVE_U_CHAR)
1416 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1418 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1421 #include <sys/types.h>
1423 [ size_t foo; foo = 1235; ],
1424 [ ac_cv_have_size_t="yes" ],
1425 [ ac_cv_have_size_t="no" ]
1428 if test "x$ac_cv_have_size_t" = "xyes" ; then
1429 AC_DEFINE(HAVE_SIZE_T)
1432 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1435 #include <sys/types.h>
1437 [ ssize_t foo; foo = 1235; ],
1438 [ ac_cv_have_ssize_t="yes" ],
1439 [ ac_cv_have_ssize_t="no" ]
1442 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1443 AC_DEFINE(HAVE_SSIZE_T)
1446 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1451 [ clock_t foo; foo = 1235; ],
1452 [ ac_cv_have_clock_t="yes" ],
1453 [ ac_cv_have_clock_t="no" ]
1456 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1457 AC_DEFINE(HAVE_CLOCK_T)
1460 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1463 #include <sys/types.h>
1464 #include <sys/socket.h>
1466 [ sa_family_t foo; foo = 1235; ],
1467 [ ac_cv_have_sa_family_t="yes" ],
1470 #include <sys/types.h>
1471 #include <sys/socket.h>
1472 #include <netinet/in.h>
1474 [ sa_family_t foo; foo = 1235; ],
1475 [ ac_cv_have_sa_family_t="yes" ],
1477 [ ac_cv_have_sa_family_t="no" ]
1481 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1482 AC_DEFINE(HAVE_SA_FAMILY_T)
1485 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1488 #include <sys/types.h>
1490 [ pid_t foo; foo = 1235; ],
1491 [ ac_cv_have_pid_t="yes" ],
1492 [ ac_cv_have_pid_t="no" ]
1495 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1496 AC_DEFINE(HAVE_PID_T)
1499 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1502 #include <sys/types.h>
1504 [ mode_t foo; foo = 1235; ],
1505 [ ac_cv_have_mode_t="yes" ],
1506 [ ac_cv_have_mode_t="no" ]
1509 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1510 AC_DEFINE(HAVE_MODE_T)
1514 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1517 #include <sys/types.h>
1518 #include <sys/socket.h>
1520 [ struct sockaddr_storage s; ],
1521 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1522 [ ac_cv_have_struct_sockaddr_storage="no" ]
1525 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1526 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1529 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1532 #include <sys/types.h>
1533 #include <netinet/in.h>
1535 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1536 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1537 [ ac_cv_have_struct_sockaddr_in6="no" ]
1540 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1541 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1544 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1547 #include <sys/types.h>
1548 #include <netinet/in.h>
1550 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1551 [ ac_cv_have_struct_in6_addr="yes" ],
1552 [ ac_cv_have_struct_in6_addr="no" ]
1555 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1556 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1559 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1562 #include <sys/types.h>
1563 #include <sys/socket.h>
1566 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1567 [ ac_cv_have_struct_addrinfo="yes" ],
1568 [ ac_cv_have_struct_addrinfo="no" ]
1571 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1572 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1575 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1577 [ #include <sys/time.h> ],
1578 [ struct timeval tv; tv.tv_sec = 1;],
1579 [ ac_cv_have_struct_timeval="yes" ],
1580 [ ac_cv_have_struct_timeval="no" ]
1583 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1584 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1585 have_struct_timeval=1
1588 AC_CHECK_TYPES(struct timespec)
1590 # We need int64_t or else certian parts of the compile will fail.
1591 if test "x$ac_cv_have_int64_t" = "xno" -a \
1592 "x$ac_cv_sizeof_long_int" != "x8" -a \
1593 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1594 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1595 echo "an alternative compiler (I.E., GCC) before continuing."
1599 dnl test snprintf (broken on SCO w/gcc)
1604 #ifdef HAVE_SNPRINTF
1608 char expected_out[50];
1610 #if (SIZEOF_LONG_INT == 8)
1611 long int num = 0x7fffffffffffffff;
1613 long long num = 0x7fffffffffffffffll;
1615 strcpy(expected_out, "9223372036854775807");
1616 snprintf(buf, mazsize, "%lld", num);
1617 if(strcmp(buf, expected_out) != 0)
1624 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1628 dnl Checks for structure members
1629 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1630 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1631 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1632 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1633 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1634 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1635 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1636 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1637 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1638 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1639 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1640 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1641 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1642 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1643 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1644 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1645 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1647 AC_CHECK_MEMBERS([struct stat.st_blksize])
1649 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1650 ac_cv_have_ss_family_in_struct_ss, [
1653 #include <sys/types.h>
1654 #include <sys/socket.h>
1656 [ struct sockaddr_storage s; s.ss_family = 1; ],
1657 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1658 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1661 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1662 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1665 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1666 ac_cv_have___ss_family_in_struct_ss, [
1669 #include <sys/types.h>
1670 #include <sys/socket.h>
1672 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1673 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1674 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1677 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1678 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1681 AC_CACHE_CHECK([for pw_class field in struct passwd],
1682 ac_cv_have_pw_class_in_struct_passwd, [
1687 [ struct passwd p; p.pw_class = 0; ],
1688 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1689 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1692 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1693 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1696 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1697 ac_cv_have_pw_expire_in_struct_passwd, [
1702 [ struct passwd p; p.pw_expire = 0; ],
1703 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1704 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1707 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1708 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1711 AC_CACHE_CHECK([for pw_change field in struct passwd],
1712 ac_cv_have_pw_change_in_struct_passwd, [
1717 [ struct passwd p; p.pw_change = 0; ],
1718 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1719 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1722 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1723 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1726 dnl make sure we're using the real structure members and not defines
1727 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1728 ac_cv_have_accrights_in_msghdr, [
1731 #include <sys/types.h>
1732 #include <sys/socket.h>
1733 #include <sys/uio.h>
1735 #ifdef msg_accrights
1739 m.msg_accrights = 0;
1743 [ ac_cv_have_accrights_in_msghdr="yes" ],
1744 [ ac_cv_have_accrights_in_msghdr="no" ]
1747 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1748 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1751 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1752 ac_cv_have_control_in_msghdr, [
1755 #include <sys/types.h>
1756 #include <sys/socket.h>
1757 #include <sys/uio.h>
1767 [ ac_cv_have_control_in_msghdr="yes" ],
1768 [ ac_cv_have_control_in_msghdr="no" ]
1771 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1772 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1775 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1777 [ extern char *__progname; printf("%s", __progname); ],
1778 [ ac_cv_libc_defines___progname="yes" ],
1779 [ ac_cv_libc_defines___progname="no" ]
1782 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1783 AC_DEFINE(HAVE___PROGNAME)
1786 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1790 [ printf("%s", __FUNCTION__); ],
1791 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1792 [ ac_cv_cc_implements___FUNCTION__="no" ]
1795 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1796 AC_DEFINE(HAVE___FUNCTION__)
1799 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1803 [ printf("%s", __func__); ],
1804 [ ac_cv_cc_implements___func__="yes" ],
1805 [ ac_cv_cc_implements___func__="no" ]
1808 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1809 AC_DEFINE(HAVE___func__)
1812 AC_CACHE_CHECK([whether getopt has optreset support],
1813 ac_cv_have_getopt_optreset, [
1818 [ extern int optreset; optreset = 0; ],
1819 [ ac_cv_have_getopt_optreset="yes" ],
1820 [ ac_cv_have_getopt_optreset="no" ]
1823 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1824 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1827 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1829 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1830 [ ac_cv_libc_defines_sys_errlist="yes" ],
1831 [ ac_cv_libc_defines_sys_errlist="no" ]
1834 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1835 AC_DEFINE(HAVE_SYS_ERRLIST)
1839 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1841 [ extern int sys_nerr; printf("%i", sys_nerr);],
1842 [ ac_cv_libc_defines_sys_nerr="yes" ],
1843 [ ac_cv_libc_defines_sys_nerr="no" ]
1846 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1847 AC_DEFINE(HAVE_SYS_NERR)
1851 # Check whether user wants sectok support
1853 [ --with-sectok Enable smartcard support using libsectok],
1855 if test "x$withval" != "xno" ; then
1856 if test "x$withval" != "xyes" ; then
1857 CPPFLAGS="$CPPFLAGS -I${withval}"
1858 LDFLAGS="$LDFLAGS -L${withval}"
1859 if test ! -z "$need_dash_r" ; then
1860 LDFLAGS="$LDFLAGS -R${withval}"
1862 if test ! -z "$blibpath" ; then
1863 blibpath="$blibpath:${withval}"
1866 AC_CHECK_HEADERS(sectok.h)
1867 if test "$ac_cv_header_sectok_h" != yes; then
1868 AC_MSG_ERROR(Can't find sectok.h)
1870 AC_CHECK_LIB(sectok, sectok_open)
1871 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1872 AC_MSG_ERROR(Can't find libsectok)
1874 AC_DEFINE(SMARTCARD)
1875 AC_DEFINE(USE_SECTOK)
1876 SCARD_MSG="yes, using sectok"
1881 # Check whether user wants OpenSC support
1883 AC_HELP_STRING([--with-opensc=PFX],
1884 [Enable smartcard support using OpenSC]),
1885 opensc_config_prefix="$withval", opensc_config_prefix="")
1886 if test x$opensc_config_prefix != x ; then
1887 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1888 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1889 if test "$OPENSC_CONFIG" != "no"; then
1890 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1891 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1892 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1893 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1894 AC_DEFINE(SMARTCARD)
1895 AC_DEFINE(USE_OPENSC)
1896 SCARD_MSG="yes, using OpenSC"
1900 # Check whether user wants DNS support
1903 [ --with-dns Support for fetching keys from DNS (experimental)],
1905 if test "x$withval" != "xno" ; then
1908 AC_SEARCH_LIBS(getrrsetbyname, resolv,
1909 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1911 # Needed by our getrrsetbyname()
1912 AC_SEARCH_LIBS(res_query, resolv)
1913 AC_SEARCH_LIBS(dn_expand, resolv)
1919 # Check whether user wants Kerberos 5 support
1921 AC_ARG_WITH(kerberos5,
1922 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1924 if test "x$withval" != "xno" ; then
1925 if test "x$withval" = "xyes" ; then
1926 KRB5ROOT="/usr/local"
1930 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1931 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1934 AC_MSG_CHECKING(whether we are using Heimdal)
1935 AC_TRY_COMPILE([ #include <krb5.h> ],
1936 [ char *tmp = heimdal_version; ],
1937 [ AC_MSG_RESULT(yes)
1939 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1942 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1945 if test ! -z "$need_dash_r" ; then
1946 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1948 if test ! -z "$blibpath" ; then
1949 blibpath="$blibpath:${KRB5ROOT}/lib"
1951 AC_SEARCH_LIBS(dn_expand, resolv)
1953 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1955 K5LIBS="-lgssapi $K5LIBS" ],
1956 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
1958 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
1959 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
1964 AC_CHECK_HEADER(gssapi.h, ,
1965 [ unset ac_cv_header_gssapi_h
1966 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1967 AC_CHECK_HEADERS(gssapi.h, ,
1968 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
1974 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1975 AC_CHECK_HEADER(gssapi_krb5.h, ,
1976 [ CPPFLAGS="$oldCPP" ])
1982 LIBS="$LIBS $K5LIBS"
1984 # Looking for programs, paths and files
1986 PRIVSEP_PATH=/var/empty
1987 AC_ARG_WITH(privsep-path,
1988 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
1990 if test "x$withval" != "$no" ; then
1991 PRIVSEP_PATH=$withval
1995 AC_SUBST(PRIVSEP_PATH)
1998 [ --with-xauth=PATH Specify path to xauth program ],
2000 if test "x$withval" != "xno" ; then
2006 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2007 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2008 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2009 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2010 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2011 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2012 xauth_path="/usr/openwin/bin/xauth"
2018 AC_ARG_ENABLE(strip,
2019 [ --disable-strip Disable calling strip(1) on install],
2021 if test "x$enableval" = "xno" ; then
2028 if test -z "$xauth_path" ; then
2029 XAUTH_PATH="undefined"
2030 AC_SUBST(XAUTH_PATH)
2032 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2033 XAUTH_PATH=$xauth_path
2034 AC_SUBST(XAUTH_PATH)
2037 # Check for mail directory (last resort if we cannot get it from headers)
2038 if test ! -z "$MAIL" ; then
2039 maildir=`dirname $MAIL`
2040 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2043 if test -z "$no_dev_ptmx" ; then
2044 if test "x$disable_ptmx_check" != "xyes" ; then
2045 AC_CHECK_FILE("/dev/ptmx",
2047 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2053 AC_CHECK_FILE("/dev/ptc",
2055 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2060 # Options from here on. Some of these are preset by platform above
2061 AC_ARG_WITH(mantype,
2062 [ --with-mantype=man|cat|doc Set man page type],
2069 AC_MSG_ERROR(invalid man type: $withval)
2074 if test -z "$MANTYPE"; then
2075 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2076 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2077 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2079 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2086 if test "$MANTYPE" = "doc"; then
2093 # Check whether to enable MD5 passwords
2095 AC_ARG_WITH(md5-passwords,
2096 [ --with-md5-passwords Enable use of MD5 passwords],
2098 if test "x$withval" != "xno" ; then
2099 AC_DEFINE(HAVE_MD5_PASSWORDS)
2105 # Whether to disable shadow password support
2107 [ --without-shadow Disable shadow password support],
2109 if test "x$withval" = "xno" ; then
2110 AC_DEFINE(DISABLE_SHADOW)
2116 if test -z "$disable_shadow" ; then
2117 AC_MSG_CHECKING([if the systems has expire shadow information])
2120 #include <sys/types.h>
2123 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2124 [ sp_expire_available=yes ], []
2127 if test "x$sp_expire_available" = "xyes" ; then
2129 AC_DEFINE(HAS_SHADOW_EXPIRE)
2135 # Use ip address instead of hostname in $DISPLAY
2136 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2137 DISPLAY_HACK_MSG="yes"
2138 AC_DEFINE(IPADDR_IN_DISPLAY)
2140 DISPLAY_HACK_MSG="no"
2141 AC_ARG_WITH(ipaddr-display,
2142 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2144 if test "x$withval" != "xno" ; then
2145 AC_DEFINE(IPADDR_IN_DISPLAY)
2146 DISPLAY_HACK_MSG="yes"
2152 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2153 if test $ac_cv_func_login_getcapbool = "yes" -a \
2154 $ac_cv_header_login_cap_h = "yes" ; then
2157 # Whether to mess with the default path
2158 SERVER_PATH_MSG="(default)"
2159 AC_ARG_WITH(default-path,
2160 [ --with-default-path= Specify default \$PATH environment for server],
2162 if test "$USES_LOGIN_CONF" = "yes" ; then
2164 --with-default-path=PATH has no effect on this system.
2165 Edit /etc/login.conf instead.])
2166 elif test "x$withval" != "xno" ; then
2167 user_path="$withval"
2168 SERVER_PATH_MSG="$withval"
2171 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2172 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2176 /* find out what STDPATH is */
2181 #ifndef _PATH_STDPATH
2182 # ifdef _PATH_USERPATH /* Irix */
2183 # define _PATH_STDPATH _PATH_USERPATH
2185 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2188 #include <sys/types.h>
2189 #include <sys/stat.h>
2191 #define DATA "conftest.stdpath"
2198 fd = fopen(DATA,"w");
2202 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2207 ], [ user_path=`cat conftest.stdpath` ],
2208 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2209 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2211 # make sure $bindir is in USER_PATH so scp will work
2212 t_bindir=`eval echo ${bindir}`
2214 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2217 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2219 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2220 if test $? -ne 0 ; then
2221 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2222 if test $? -ne 0 ; then
2223 user_path=$user_path:$t_bindir
2224 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2229 if test "$USES_LOGIN_CONF" != "yes" ; then
2230 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2234 # Set superuser path separately to user path
2235 AC_ARG_WITH(superuser-path,
2236 [ --with-superuser-path= Specify different path for super-user],
2238 if test "x$withval" != "xno" ; then
2239 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2240 superuser_path=$withval
2246 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2247 IPV4_IN6_HACK_MSG="no"
2249 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2251 if test "x$withval" != "xno" ; then
2253 AC_DEFINE(IPV4_IN_IPV6)
2254 IPV4_IN6_HACK_MSG="yes"
2259 if test "x$inet6_default_4in6" = "xyes"; then
2260 AC_MSG_RESULT([yes (default)])
2261 AC_DEFINE(IPV4_IN_IPV6)
2262 IPV4_IN6_HACK_MSG="yes"
2264 AC_MSG_RESULT([no (default)])
2269 # Whether to enable BSD auth support
2271 AC_ARG_WITH(bsd-auth,
2272 [ --with-bsd-auth Enable BSD auth support],
2274 if test "x$withval" != "xno" ; then
2281 # Where to place sshd.pid
2283 # make sure the directory exists
2284 if test ! -d $piddir ; then
2285 piddir=`eval echo ${sysconfdir}`
2287 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2291 AC_ARG_WITH(pid-dir,
2292 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2294 if test "x$withval" != "xno" ; then
2296 if test ! -d $piddir ; then
2297 AC_MSG_WARN([** no $piddir directory on this system **])
2303 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2306 dnl allow user to disable some login recording features
2307 AC_ARG_ENABLE(lastlog,
2308 [ --disable-lastlog disable use of lastlog even if detected [no]],
2310 if test "x$enableval" = "xno" ; then
2311 AC_DEFINE(DISABLE_LASTLOG)
2316 [ --disable-utmp disable use of utmp even if detected [no]],
2318 if test "x$enableval" = "xno" ; then
2319 AC_DEFINE(DISABLE_UTMP)
2323 AC_ARG_ENABLE(utmpx,
2324 [ --disable-utmpx disable use of utmpx even if detected [no]],
2326 if test "x$enableval" = "xno" ; then
2327 AC_DEFINE(DISABLE_UTMPX)
2332 [ --disable-wtmp disable use of wtmp even if detected [no]],
2334 if test "x$enableval" = "xno" ; then
2335 AC_DEFINE(DISABLE_WTMP)
2339 AC_ARG_ENABLE(wtmpx,
2340 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2342 if test "x$enableval" = "xno" ; then
2343 AC_DEFINE(DISABLE_WTMPX)
2347 AC_ARG_ENABLE(libutil,
2348 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2350 if test "x$enableval" = "xno" ; then
2351 AC_DEFINE(DISABLE_LOGIN)
2355 AC_ARG_ENABLE(pututline,
2356 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2358 if test "x$enableval" = "xno" ; then
2359 AC_DEFINE(DISABLE_PUTUTLINE)
2363 AC_ARG_ENABLE(pututxline,
2364 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2366 if test "x$enableval" = "xno" ; then
2367 AC_DEFINE(DISABLE_PUTUTXLINE)
2371 AC_ARG_WITH(lastlog,
2372 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2374 if test "x$withval" = "xno" ; then
2375 AC_DEFINE(DISABLE_LASTLOG)
2377 conf_lastlog_location=$withval
2382 dnl lastlog, [uw]tmpx? detection
2383 dnl NOTE: set the paths in the platform section to avoid the
2384 dnl need for command-line parameters
2385 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2387 dnl lastlog detection
2388 dnl NOTE: the code itself will detect if lastlog is a directory
2389 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2391 #include <sys/types.h>
2393 #ifdef HAVE_LASTLOG_H
2394 # include <lastlog.h>
2403 [ char *lastlog = LASTLOG_FILE; ],
2404 [ AC_MSG_RESULT(yes) ],
2407 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2409 #include <sys/types.h>
2411 #ifdef HAVE_LASTLOG_H
2412 # include <lastlog.h>
2418 [ char *lastlog = _PATH_LASTLOG; ],
2419 [ AC_MSG_RESULT(yes) ],
2422 system_lastlog_path=no
2427 if test -z "$conf_lastlog_location"; then
2428 if test x"$system_lastlog_path" = x"no" ; then
2429 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2430 if (test -d "$f" || test -f "$f") ; then
2431 conf_lastlog_location=$f
2434 if test -z "$conf_lastlog_location"; then
2435 AC_MSG_WARN([** Cannot find lastlog **])
2436 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2441 if test -n "$conf_lastlog_location"; then
2442 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2446 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2448 #include <sys/types.h>
2454 [ char *utmp = UTMP_FILE; ],
2455 [ AC_MSG_RESULT(yes) ],
2457 system_utmp_path=no ]
2459 if test -z "$conf_utmp_location"; then
2460 if test x"$system_utmp_path" = x"no" ; then
2461 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2462 if test -f $f ; then
2463 conf_utmp_location=$f
2466 if test -z "$conf_utmp_location"; then
2467 AC_DEFINE(DISABLE_UTMP)
2471 if test -n "$conf_utmp_location"; then
2472 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2476 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2478 #include <sys/types.h>
2484 [ char *wtmp = WTMP_FILE; ],
2485 [ AC_MSG_RESULT(yes) ],
2487 system_wtmp_path=no ]
2489 if test -z "$conf_wtmp_location"; then
2490 if test x"$system_wtmp_path" = x"no" ; then
2491 for f in /usr/adm/wtmp /var/log/wtmp; do
2492 if test -f $f ; then
2493 conf_wtmp_location=$f
2496 if test -z "$conf_wtmp_location"; then
2497 AC_DEFINE(DISABLE_WTMP)
2501 if test -n "$conf_wtmp_location"; then
2502 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2506 dnl utmpx detection - I don't know any system so perverse as to require
2507 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2509 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2511 #include <sys/types.h>
2520 [ char *utmpx = UTMPX_FILE; ],
2521 [ AC_MSG_RESULT(yes) ],
2523 system_utmpx_path=no ]
2525 if test -z "$conf_utmpx_location"; then
2526 if test x"$system_utmpx_path" = x"no" ; then
2527 AC_DEFINE(DISABLE_UTMPX)
2530 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2534 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2536 #include <sys/types.h>
2545 [ char *wtmpx = WTMPX_FILE; ],
2546 [ AC_MSG_RESULT(yes) ],
2548 system_wtmpx_path=no ]
2550 if test -z "$conf_wtmpx_location"; then
2551 if test x"$system_wtmpx_path" = x"no" ; then
2552 AC_DEFINE(DISABLE_WTMPX)
2555 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2559 if test ! -z "$blibpath" ; then
2560 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2561 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2564 dnl remove pam and dl because they are in $LIBPAM
2565 if test "$PAM_MSG" = yes ; then
2566 LIBS=`echo $LIBS | sed 's/-lpam //'`
2568 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2569 LIBS=`echo $LIBS | sed 's/-ldl //'`
2573 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2576 # Print summary of options
2578 # Someone please show me a better way :)
2579 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2580 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2581 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2582 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2583 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2584 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2585 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2586 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2587 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2588 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2591 echo "OpenSSH has been configured with the following options:"
2592 echo " User binaries: $B"
2593 echo " System binaries: $C"
2594 echo " Configuration files: $D"
2595 echo " Askpass program: $E"
2596 echo " Manual pages: $F"
2597 echo " PID file: $G"
2598 echo " Privilege separation chroot path: $H"
2599 if test "$USES_LOGIN_CONF" = "yes" ; then
2600 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2602 echo " sshd default user PATH: $I"
2604 if test ! -z "$superuser_path" ; then
2605 echo " sshd superuser user PATH: $J"
2607 echo " Manpage format: $MANTYPE"
2608 echo " DNS support: $DNS_MSG"
2609 echo " PAM support: $PAM_MSG"
2610 echo " KerberosV support: $KRB5_MSG"
2611 echo " Smartcard support: $SCARD_MSG"
2612 echo " S/KEY support: $SKEY_MSG"
2613 echo " TCP Wrappers support: $TCPW_MSG"
2614 echo " MD5 password support: $MD5_MSG"
2615 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2616 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2617 echo " BSD Auth support: $BSD_AUTH_MSG"
2618 echo " Random number source: $RAND_MSG"
2619 if test ! -z "$USE_RAND_HELPER" ; then
2620 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2625 echo " Host: ${host}"
2626 echo " Compiler: ${CC}"
2627 echo " Compiler flags: ${CFLAGS}"
2628 echo "Preprocessor flags: ${CPPFLAGS}"
2629 echo " Linker flags: ${LDFLAGS}"
2630 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2634 if test "x$PAM_MSG" = "xyes" ; then
2635 echo "PAM is enabled. You may need to install a PAM control file "
2636 echo "for sshd, otherwise password authentication may fail. "
2637 echo "Example PAM control files can be found in the contrib/ "
2642 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2643 echo "WARNING: you are using the builtin random number collection "
2644 echo "service. Please read WARNING.RNG and request that your OS "
2645 echo "vendor includes kernel-based random number collection in "
2646 echo "future versions of your OS."