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)])
135 AC_DEFINE(SETEUID_BREAKS_SETUID)
136 AC_DEFINE(BROKEN_SETREUID)
137 AC_DEFINE(BROKEN_SETREGID)
140 if test -z "$GCC"; then
143 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
144 IPADDR_IN_DISPLAY=yes
145 AC_DEFINE(HAVE_SECUREWARE)
147 AC_DEFINE(LOGIN_NO_ENDOPT)
148 AC_DEFINE(LOGIN_NEEDS_UTMPX)
149 AC_DEFINE(DISABLE_UTMP)
150 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
151 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
152 LIBS="$LIBS -lsec -lsecpw"
153 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
154 disable_ptmx_check=yes
157 if test -z "$GCC"; then
160 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
161 IPADDR_IN_DISPLAY=yes
163 AC_DEFINE(LOGIN_NO_ENDOPT)
164 AC_DEFINE(LOGIN_NEEDS_UTMPX)
165 AC_DEFINE(DISABLE_UTMP)
166 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
167 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
169 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
172 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
173 IPADDR_IN_DISPLAY=yes
174 AC_DEFINE(PAM_SUN_CODEBASE)
176 AC_DEFINE(LOGIN_NO_ENDOPT)
177 AC_DEFINE(LOGIN_NEEDS_UTMPX)
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(SETEUID_BREAKS_SETUID)
190 AC_DEFINE(BROKEN_SETREUID)
191 AC_DEFINE(BROKEN_SETREGID)
192 AC_DEFINE(WITH_ABBREV_NO_TTY)
193 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
196 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
198 PATH="$PATH:/usr/etc"
199 AC_DEFINE(WITH_IRIX_ARRAY)
200 AC_DEFINE(WITH_IRIX_PROJECT)
201 AC_DEFINE(WITH_IRIX_AUDIT)
202 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
203 AC_DEFINE(BROKEN_INET_NTOA)
204 AC_DEFINE(SETEUID_BREAKS_SETUID)
205 AC_DEFINE(BROKEN_SETREUID)
206 AC_DEFINE(BROKEN_SETREGID)
207 AC_DEFINE(WITH_ABBREV_NO_TTY)
208 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
212 check_for_libcrypt_later=1
213 check_for_openpty_ctty_bug=1
214 AC_DEFINE(DONT_TRY_OTHER_AF)
215 AC_DEFINE(PAM_TTY_KLUDGE)
216 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
217 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
218 inet6_default_4in6=yes
221 AC_DEFINE(BROKEN_CMSG_TYPE)
225 mips-sony-bsd|mips-sony-newsos4)
226 AC_DEFINE(HAVE_NEWS4)
230 check_for_libcrypt_before=1
234 check_for_libcrypt_later=1
237 AC_DEFINE(SETEUID_BREAKS_SETUID)
238 AC_DEFINE(BROKEN_SETREUID)
239 AC_DEFINE(BROKEN_SETREGID)
242 conf_lastlog_location="/usr/adm/lastlog"
243 conf_utmp_location=/etc/utmp
244 conf_wtmp_location=/usr/adm/wtmp
247 AC_DEFINE(BROKEN_REALPATH)
249 AC_DEFINE(BROKEN_SAVED_UIDS)
250 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
254 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
255 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
257 AC_DEFINE(PAM_SUN_CODEBASE)
258 AC_DEFINE(LOGIN_NEEDS_UTMPX)
259 AC_DEFINE(LOGIN_NEEDS_TERM)
260 AC_DEFINE(PAM_TTY_KLUDGE)
261 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
262 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
263 AC_DEFINE(SSHD_ACQUIRES_CTTY)
264 external_path_file=/etc/default/login
265 # hardwire lastlog location (can't detect it on some versions)
266 conf_lastlog_location="/var/adm/lastlog"
267 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
268 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
269 if test "$sol2ver" -ge 8; then
271 AC_DEFINE(DISABLE_UTMP)
272 AC_DEFINE(DISABLE_WTMP)
278 CPPFLAGS="$CPPFLAGS -DSUNOS4"
279 AC_CHECK_FUNCS(getpwanam)
280 AC_DEFINE(PAM_SUN_CODEBASE)
281 conf_utmp_location=/etc/utmp
282 conf_wtmp_location=/var/adm/wtmp
283 conf_lastlog_location=/var/adm/lastlog
287 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
288 LDFLAGS="$LDFLAGS -L/usr/local/lib"
291 AC_DEFINE(SSHD_ACQUIRES_CTTY)
292 AC_DEFINE(SETEUID_BREAKS_SETUID)
293 AC_DEFINE(BROKEN_SETREUID)
294 AC_DEFINE(BROKEN_SETREGID)
297 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
298 # /usr/ucblib MUST NOT be searched on ReliantUNIX
299 LDFLAGS="$LDFLAGS -L/usr/local/lib"
300 AC_CHECK_LIB(dl, dlsym, ,)
301 IPADDR_IN_DISPLAY=yes
303 AC_DEFINE(IP_TOS_IS_BROKEN)
304 AC_DEFINE(SETEUID_BREAKS_SETUID)
305 AC_DEFINE(BROKEN_SETREUID)
306 AC_DEFINE(BROKEN_SETREGID)
307 AC_DEFINE(SSHD_ACQUIRES_CTTY)
308 external_path_file=/etc/default/login
309 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
310 # Attention: always take care to bind libsocket and libnsl before libc,
311 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
314 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
315 LDFLAGS="$LDFLAGS -L/usr/local/lib"
317 AC_DEFINE(SETEUID_BREAKS_SETUID)
318 AC_DEFINE(BROKEN_SETREUID)
319 AC_DEFINE(BROKEN_SETREGID)
322 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
323 LDFLAGS="$LDFLAGS -L/usr/local/lib"
325 AC_DEFINE(SETEUID_BREAKS_SETUID)
326 AC_DEFINE(BROKEN_SETREUID)
327 AC_DEFINE(BROKEN_SETREGID)
330 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
331 LDFLAGS="$LDFLAGS -L/usr/local/lib"
334 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
335 LDFLAGS="$LDFLAGS -L/usr/local/lib"
336 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
339 AC_DEFINE(BROKEN_SYS_TERMIO_H)
341 AC_DEFINE(HAVE_SECUREWARE)
342 AC_DEFINE(DISABLE_SHADOW)
343 AC_DEFINE(BROKEN_SAVED_UIDS)
344 AC_DEFINE(WITH_ABBREV_NO_TTY)
345 AC_CHECK_FUNCS(getluid setluid)
347 do_sco3_extra_lib_check=yes
350 if test -z "$GCC"; then
351 CFLAGS="$CFLAGS -belf"
353 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
354 LDFLAGS="$LDFLAGS -L/usr/local/lib"
355 LIBS="$LIBS -lprot -lx -ltinfo -lm"
358 AC_DEFINE(HAVE_SECUREWARE)
359 AC_DEFINE(DISABLE_SHADOW)
360 AC_DEFINE(DISABLE_FD_PASSING)
361 AC_DEFINE(SETEUID_BREAKS_SETUID)
362 AC_DEFINE(BROKEN_SETREUID)
363 AC_DEFINE(BROKEN_SETREGID)
364 AC_DEFINE(WITH_ABBREV_NO_TTY)
365 AC_CHECK_FUNCS(getluid setluid)
370 AC_DEFINE(DISABLE_FD_PASSING)
372 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
376 AC_DEFINE(WITH_ABBREV_NO_TTY)
378 AC_DEFINE(DISABLE_FD_PASSING)
380 LIBS="$LIBS -lgen -lacid"
385 AC_DEFINE(DISABLE_FD_PASSING)
386 AC_DEFINE(NO_SSH_LASTLOG)
387 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
388 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
392 AC_MSG_CHECKING(for Digital Unix SIA)
395 [ --with-osfsia Enable Digital Unix SIA],
397 if test "x$withval" = "xno" ; then
398 AC_MSG_RESULT(disabled)
403 if test -z "$no_osfsia" ; then
404 if test -f /etc/sia/matrix.conf; then
406 AC_DEFINE(HAVE_OSF_SIA)
407 AC_DEFINE(DISABLE_LOGIN)
408 AC_DEFINE(DISABLE_FD_PASSING)
409 LIBS="$LIBS -lsecurity -ldb -lm -laud"
414 AC_DEFINE(DISABLE_FD_PASSING)
415 AC_DEFINE(BROKEN_GETADDRINFO)
416 AC_DEFINE(SETEUID_BREAKS_SETUID)
417 AC_DEFINE(BROKEN_SETREUID)
418 AC_DEFINE(BROKEN_SETREGID)
419 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
424 AC_DEFINE(NO_X11_UNIX_SOCKETS)
425 AC_DEFINE(MISSING_NFDBITS)
426 AC_DEFINE(MISSING_HOWMANY)
427 AC_DEFINE(MISSING_FD_MASK)
431 # Allow user to specify flags
433 [ --with-cflags Specify additional flags to pass to compiler],
435 if test "x$withval" != "xno" ; then
436 CFLAGS="$CFLAGS $withval"
440 AC_ARG_WITH(cppflags,
441 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
443 if test "x$withval" != "xno"; then
444 CPPFLAGS="$CPPFLAGS $withval"
449 [ --with-ldflags Specify additional flags to pass to linker],
451 if test "x$withval" != "xno" ; then
452 LDFLAGS="$LDFLAGS $withval"
457 [ --with-libs Specify additional libraries to link with],
459 if test "x$withval" != "xno" ; then
460 LIBS="$LIBS $withval"
465 AC_MSG_CHECKING(compiler and flags for sanity)
470 [ AC_MSG_RESULT(yes) ],
473 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
477 # Checks for header files.
478 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
479 getopt.h glob.h ia.h lastlog.h limits.h login.h \
480 login_cap.h maillock.h netdb.h netgroup.h \
481 netinet/in_systm.h paths.h pty.h readpassphrase.h \
482 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
483 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
484 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
485 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
486 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
487 util.h utime.h utmp.h utmpx.h vis.h)
489 # Checks for libraries.
490 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
491 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
493 dnl SCO OS3 needs this for libwrap
494 if test "x$with_tcp_wrappers" != "xno" ; then
495 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
496 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
500 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
501 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
502 AC_CHECK_LIB(gen, dirname,[
503 AC_CACHE_CHECK([for broken dirname],
504 ac_cv_have_broken_dirname, [
512 int main(int argc, char **argv) {
515 strncpy(buf,"/etc", 32);
517 if (!s || strncmp(s, "/", 32) != 0) {
524 [ ac_cv_have_broken_dirname="no" ],
525 [ ac_cv_have_broken_dirname="yes" ]
529 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
531 AC_DEFINE(HAVE_DIRNAME)
532 AC_CHECK_HEADERS(libgen.h)
537 AC_CHECK_FUNC(getspnam, ,
538 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
539 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
542 [ --without-rpath Disable auto-added -R linker paths],
544 if test "x$withval" = "xno" ; then
547 if test "x$withval" = "xyes" ; then
555 [ --with-zlib=PATH Use zlib in PATH],
557 if test "x$withval" = "xno" ; then
558 AC_MSG_ERROR([*** zlib is required ***])
560 if test -d "$withval/lib"; then
561 if test -n "${need_dash_r}"; then
562 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
564 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
567 if test -n "${need_dash_r}"; then
568 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
570 LDFLAGS="-L${withval} ${LDFLAGS}"
573 if test -d "$withval/include"; then
574 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
576 CPPFLAGS="-I${withval} ${CPPFLAGS}"
581 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
584 AC_CHECK_FUNC(strcasecmp,
585 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
587 AC_CHECK_FUNC(utimes,
588 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
589 LIBS="$LIBS -lc89"]) ]
592 dnl Checks for libutil functions
593 AC_CHECK_HEADERS(libutil.h)
594 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
595 AC_CHECK_FUNCS(logout updwtmp logwtmp)
599 # Check for ALTDIRFUNC glob() extension
600 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
601 AC_EGREP_CPP(FOUNDIT,
604 #ifdef GLOB_ALTDIRFUNC
609 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
617 # Check for g.gl_matchc glob() extension
618 AC_MSG_CHECKING(for gl_matchc field in glob_t)
619 AC_EGREP_CPP(FOUNDIT,
622 int main(void){glob_t g; g.gl_matchc = 1;}
625 AC_DEFINE(GLOB_HAS_GL_MATCHC)
633 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
636 #include <sys/types.h>
638 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
640 [AC_MSG_RESULT(yes)],
643 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
647 # Check whether user wants S/Key support
650 [ --with-skey[[=PATH]] Enable S/Key support
651 (optionally in PATH)],
653 if test "x$withval" != "xno" ; then
655 if test "x$withval" != "xyes" ; then
656 CPPFLAGS="$CPPFLAGS -I${withval}/include"
657 LDFLAGS="$LDFLAGS -L${withval}/lib"
664 AC_MSG_CHECKING([for s/key support])
669 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
671 [AC_MSG_RESULT(yes)],
674 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
680 # Check whether user wants TCP wrappers support
682 AC_ARG_WITH(tcp-wrappers,
683 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
684 (optionally in PATH)],
686 if test "x$withval" != "xno" ; then
688 saved_LDFLAGS="$LDFLAGS"
689 saved_CPPFLAGS="$CPPFLAGS"
690 if test -n "${withval}" -a "${withval}" != "yes"; then
691 if test -d "${withval}/lib"; then
692 if test -n "${need_dash_r}"; then
693 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
695 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
698 if test -n "${need_dash_r}"; then
699 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
701 LDFLAGS="-L${withval} ${LDFLAGS}"
704 if test -d "${withval}/include"; then
705 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
707 CPPFLAGS="-I${withval} ${CPPFLAGS}"
711 LIBS="$LIBWRAP $LIBS"
712 AC_MSG_CHECKING(for libwrap)
716 int deny_severity = 0, allow_severity = 0;
726 AC_MSG_ERROR([*** libwrap missing])
734 dnl Checks for library functions. Please keep in alphabetical order
736 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
737 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
738 getaddrinfo getcwd getgrouplist getnameinfo getopt \
739 getpeereid _getpty getrlimit getttyent glob inet_aton \
740 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
741 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
742 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
743 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
744 setproctitle setregid setresgid setresuid setreuid setrlimit \
745 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
746 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
747 truncate utimes vhangup vsnprintf waitpid \
750 # IRIX has a const char return value for gai_strerror()
751 AC_CHECK_FUNCS(gai_strerror,[
752 AC_DEFINE(HAVE_GAI_STRERROR)
754 #include <sys/types.h>
755 #include <sys/socket.h>
758 const char *gai_strerror(int);],[
761 str = gai_strerror(0);],[
762 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
763 [Define if gai_strerror() returns const char *])])])
765 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
767 dnl Make sure prototypes are defined for these before using them.
768 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
769 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
771 dnl tcsendbreak might be a macro
772 AC_CHECK_DECL(tcsendbreak,
773 [AC_DEFINE(HAVE_TCSENDBREAK)],
774 [AC_CHECK_FUNCS(tcsendbreak)],
775 [#include <termios.h>]
778 dnl Checks for time functions
779 AC_CHECK_FUNCS(gettimeofday time)
780 dnl Checks for utmp functions
781 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
782 AC_CHECK_FUNCS(utmpname)
783 dnl Checks for utmpx functions
784 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
785 AC_CHECK_FUNCS(setutxent utmpxname)
787 AC_CHECK_FUNC(daemon,
788 [AC_DEFINE(HAVE_DAEMON)],
789 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
792 AC_CHECK_FUNC(getpagesize,
793 [AC_DEFINE(HAVE_GETPAGESIZE)],
794 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
797 # Check for broken snprintf
798 if test "x$ac_cv_func_snprintf" = "xyes" ; then
799 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
803 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
805 [AC_MSG_RESULT(yes)],
808 AC_DEFINE(BROKEN_SNPRINTF)
809 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
814 dnl see whether mkstemp() requires XXXXXX
815 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
816 AC_MSG_CHECKING([for (overly) strict mkstemp])
820 main() { char template[]="conftest.mkstemp-test";
821 if (mkstemp(template) == -1)
823 unlink(template); exit(0);
831 AC_DEFINE(HAVE_STRICT_MKSTEMP)
835 AC_DEFINE(HAVE_STRICT_MKSTEMP)
840 dnl make sure that openpty does not reacquire controlling terminal
841 if test ! -z "$check_for_openpty_ctty_bug"; then
842 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
846 #include <sys/fcntl.h>
847 #include <sys/types.h>
848 #include <sys/wait.h>
854 int fd, ptyfd, ttyfd, status;
857 if (pid < 0) { /* failed */
859 } else if (pid > 0) { /* parent */
860 waitpid(pid, &status, 0);
861 if (WIFEXITED(status))
862 exit(WEXITSTATUS(status));
866 close(0); close(1); close(2);
868 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
869 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
871 exit(3); /* Acquired ctty: broken */
873 exit(0); /* Did not acquire ctty: OK */
882 AC_DEFINE(SSHD_ACQUIRES_CTTY)
892 [ --with-pam Enable PAM support ],
894 if test "x$withval" != "xno" ; then
895 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
896 AC_MSG_ERROR([PAM headers not found])
899 AC_CHECK_LIB(dl, dlopen, , )
900 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
901 AC_CHECK_FUNCS(pam_getenvlist)
902 AC_CHECK_FUNCS(pam_putenv)
907 if test $ac_cv_lib_dl_dlopen = yes; then
917 # Check for older PAM
918 if test "x$PAM_MSG" = "xyes" ; then
919 # Check PAM strerror arguments (old PAM)
920 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
924 #include <security/pam_appl.h>
926 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
929 AC_DEFINE(HAVE_OLD_PAM)
931 PAM_MSG="yes (old library)"
936 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
937 # because the system crypt() is more featureful.
938 if test "x$check_for_libcrypt_before" = "x1"; then
939 AC_CHECK_LIB(crypt, crypt)
943 saved_CPPFLAGS="$CPPFLAGS"
944 saved_LDFLAGS="$LDFLAGS"
946 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
948 if test "x$withval" != "xno" ; then
949 if test -d "$withval/lib"; then
950 if test -n "${need_dash_r}"; then
951 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
953 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
956 if test -n "${need_dash_r}"; then
957 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
959 LDFLAGS="-L${withval} ${LDFLAGS}"
962 if test -d "$withval/include"; then
963 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
965 CPPFLAGS="-I${withval} ${CPPFLAGS}"
970 LIBS="$LIBS -lcrypto"
971 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
973 dnl Check default openssl install dir
974 if test -n "${need_dash_r}"; then
975 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
977 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
979 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
980 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
982 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
988 # Determine OpenSSL header version
989 AC_MSG_CHECKING([OpenSSL header version])
994 #include <openssl/opensslv.h>
995 #define DATA "conftest.sslincver"
1000 fd = fopen(DATA,"w");
1004 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1011 ssl_header_ver=`cat conftest.sslincver`
1012 AC_MSG_RESULT($ssl_header_ver)
1015 AC_MSG_RESULT(not found)
1016 AC_MSG_ERROR(OpenSSL version header not found.)
1020 # Determine OpenSSL library version
1021 AC_MSG_CHECKING([OpenSSL library version])
1026 #include <openssl/opensslv.h>
1027 #include <openssl/crypto.h>
1028 #define DATA "conftest.ssllibver"
1033 fd = fopen(DATA,"w");
1037 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1044 ssl_library_ver=`cat conftest.ssllibver`
1045 AC_MSG_RESULT($ssl_library_ver)
1048 AC_MSG_RESULT(not found)
1049 AC_MSG_ERROR(OpenSSL library not found.)
1053 # Sanity check OpenSSL headers
1054 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1058 #include <openssl/opensslv.h>
1059 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1066 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1067 Check config.log for details.
1068 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1072 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1073 # version in OpenSSL. Skip this for PAM
1074 if test "x$check_for_libcrypt_later" = "x1"; then
1075 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1079 ### Configure cryptographic random number support
1081 # Check wheter OpenSSL seeds itself
1082 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1086 #include <openssl/rand.h>
1087 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1090 OPENSSL_SEEDS_ITSELF=yes
1095 # Default to use of the rand helper if OpenSSL doesn't
1102 # Do we want to force the use of the rand helper?
1103 AC_ARG_WITH(rand-helper,
1104 [ --with-rand-helper Use subprocess to gather strong randomness ],
1106 if test "x$withval" = "xno" ; then
1107 # Force use of OpenSSL's internal RNG, even if
1108 # the previous test showed it to be unseeded.
1109 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1110 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1111 OPENSSL_SEEDS_ITSELF=yes
1120 # Which randomness source do we use?
1121 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1123 AC_DEFINE(OPENSSL_PRNG_ONLY)
1124 RAND_MSG="OpenSSL internal ONLY"
1125 INSTALL_SSH_RAND_HELPER=""
1126 elif test ! -z "$USE_RAND_HELPER" ; then
1127 # install rand helper
1128 RAND_MSG="ssh-rand-helper"
1129 INSTALL_SSH_RAND_HELPER="yes"
1131 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1133 ### Configuration of ssh-rand-helper
1136 AC_ARG_WITH(prngd-port,
1137 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1146 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1149 if test ! -z "$withval" ; then
1150 PRNGD_PORT="$withval"
1151 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1156 # PRNGD Unix domain socket
1157 AC_ARG_WITH(prngd-socket,
1158 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1162 withval="/var/run/egd-pool"
1170 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1174 if test ! -z "$withval" ; then
1175 if test ! -z "$PRNGD_PORT" ; then
1176 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1178 if test ! -r "$withval" ; then
1179 AC_MSG_WARN(Entropy socket is not readable)
1181 PRNGD_SOCKET="$withval"
1182 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1186 # Check for existing socket only if we don't have a random device already
1187 if test "$USE_RAND_HELPER" = yes ; then
1188 AC_MSG_CHECKING(for PRNGD/EGD socket)
1189 # Insert other locations here
1190 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1191 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1192 PRNGD_SOCKET="$sock"
1193 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1197 if test ! -z "$PRNGD_SOCKET" ; then
1198 AC_MSG_RESULT($PRNGD_SOCKET)
1200 AC_MSG_RESULT(not found)
1206 # Change default command timeout for hashing entropy source
1208 AC_ARG_WITH(entropy-timeout,
1209 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1211 if test "x$withval" != "xno" ; then
1212 entropy_timeout=$withval
1216 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1218 SSH_PRIVSEP_USER=sshd
1219 AC_ARG_WITH(privsep-user,
1220 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1222 if test -n "$withval"; then
1223 SSH_PRIVSEP_USER=$withval
1227 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1228 AC_SUBST(SSH_PRIVSEP_USER)
1230 # We do this little dance with the search path to insure
1231 # that programs that we select for use by installed programs
1232 # (which may be run by the super-user) come from trusted
1233 # locations before they come from the user's private area.
1234 # This should help avoid accidentally configuring some
1235 # random version of a program in someone's personal bin.
1239 test -h /bin 2> /dev/null && PATH=/usr/bin
1240 test -d /sbin && PATH=$PATH:/sbin
1241 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1242 PATH=$PATH:/etc:$OPATH
1244 # These programs are used by the command hashing source to gather entropy
1245 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1246 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1247 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1248 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1249 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1250 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1251 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1252 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1253 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1254 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1255 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1256 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1257 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1258 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1259 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1260 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1264 # Where does ssh-rand-helper get its randomness from?
1265 INSTALL_SSH_PRNG_CMDS=""
1266 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1267 if test ! -z "$PRNGD_PORT" ; then
1268 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1269 elif test ! -z "$PRNGD_SOCKET" ; then
1270 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1272 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1273 RAND_HELPER_CMDHASH=yes
1274 INSTALL_SSH_PRNG_CMDS="yes"
1277 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1280 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1281 if test ! -z "$SONY" ; then
1282 LIBS="$LIBS -liberty";
1285 # Checks for data types
1286 AC_CHECK_SIZEOF(char, 1)
1287 AC_CHECK_SIZEOF(short int, 2)
1288 AC_CHECK_SIZEOF(int, 4)
1289 AC_CHECK_SIZEOF(long int, 4)
1290 AC_CHECK_SIZEOF(long long int, 8)
1292 # Sanity check long long for some platforms (AIX)
1293 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1294 ac_cv_sizeof_long_long_int=0
1297 # More checks for data types
1298 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1300 [ #include <sys/types.h> ],
1302 [ ac_cv_have_u_int="yes" ],
1303 [ ac_cv_have_u_int="no" ]
1306 if test "x$ac_cv_have_u_int" = "xyes" ; then
1307 AC_DEFINE(HAVE_U_INT)
1311 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1313 [ #include <sys/types.h> ],
1314 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1315 [ ac_cv_have_intxx_t="yes" ],
1316 [ ac_cv_have_intxx_t="no" ]
1319 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1320 AC_DEFINE(HAVE_INTXX_T)
1324 if (test -z "$have_intxx_t" && \
1325 test "x$ac_cv_header_stdint_h" = "xyes")
1327 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1329 [ #include <stdint.h> ],
1330 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1332 AC_DEFINE(HAVE_INTXX_T)
1335 [ AC_MSG_RESULT(no) ]
1339 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1342 #include <sys/types.h>
1343 #ifdef HAVE_STDINT_H
1344 # include <stdint.h>
1346 #include <sys/socket.h>
1347 #ifdef HAVE_SYS_BITYPES_H
1348 # include <sys/bitypes.h>
1351 [ int64_t a; a = 1;],
1352 [ ac_cv_have_int64_t="yes" ],
1353 [ ac_cv_have_int64_t="no" ]
1356 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1357 AC_DEFINE(HAVE_INT64_T)
1360 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1362 [ #include <sys/types.h> ],
1363 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1364 [ ac_cv_have_u_intxx_t="yes" ],
1365 [ ac_cv_have_u_intxx_t="no" ]
1368 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1369 AC_DEFINE(HAVE_U_INTXX_T)
1373 if test -z "$have_u_intxx_t" ; then
1374 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1376 [ #include <sys/socket.h> ],
1377 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1379 AC_DEFINE(HAVE_U_INTXX_T)
1382 [ AC_MSG_RESULT(no) ]
1386 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1388 [ #include <sys/types.h> ],
1389 [ u_int64_t a; a = 1;],
1390 [ ac_cv_have_u_int64_t="yes" ],
1391 [ ac_cv_have_u_int64_t="no" ]
1394 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1395 AC_DEFINE(HAVE_U_INT64_T)
1399 if test -z "$have_u_int64_t" ; then
1400 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1402 [ #include <sys/bitypes.h> ],
1403 [ u_int64_t a; a = 1],
1405 AC_DEFINE(HAVE_U_INT64_T)
1408 [ AC_MSG_RESULT(no) ]
1412 if test -z "$have_u_intxx_t" ; then
1413 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1416 #include <sys/types.h>
1418 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1419 [ ac_cv_have_uintxx_t="yes" ],
1420 [ ac_cv_have_uintxx_t="no" ]
1423 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1424 AC_DEFINE(HAVE_UINTXX_T)
1428 if test -z "$have_uintxx_t" ; then
1429 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1431 [ #include <stdint.h> ],
1432 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1434 AC_DEFINE(HAVE_UINTXX_T)
1437 [ AC_MSG_RESULT(no) ]
1441 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1442 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1444 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1447 #include <sys/bitypes.h>
1450 int8_t a; int16_t b; int32_t c;
1451 u_int8_t e; u_int16_t f; u_int32_t g;
1452 a = b = c = e = f = g = 1;
1455 AC_DEFINE(HAVE_U_INTXX_T)
1456 AC_DEFINE(HAVE_INTXX_T)
1464 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1467 #include <sys/types.h>
1469 [ u_char foo; foo = 125; ],
1470 [ ac_cv_have_u_char="yes" ],
1471 [ ac_cv_have_u_char="no" ]
1474 if test "x$ac_cv_have_u_char" = "xyes" ; then
1475 AC_DEFINE(HAVE_U_CHAR)
1480 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1482 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1485 #include <sys/types.h>
1487 [ size_t foo; foo = 1235; ],
1488 [ ac_cv_have_size_t="yes" ],
1489 [ ac_cv_have_size_t="no" ]
1492 if test "x$ac_cv_have_size_t" = "xyes" ; then
1493 AC_DEFINE(HAVE_SIZE_T)
1496 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1499 #include <sys/types.h>
1501 [ ssize_t foo; foo = 1235; ],
1502 [ ac_cv_have_ssize_t="yes" ],
1503 [ ac_cv_have_ssize_t="no" ]
1506 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1507 AC_DEFINE(HAVE_SSIZE_T)
1510 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1515 [ clock_t foo; foo = 1235; ],
1516 [ ac_cv_have_clock_t="yes" ],
1517 [ ac_cv_have_clock_t="no" ]
1520 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1521 AC_DEFINE(HAVE_CLOCK_T)
1524 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1527 #include <sys/types.h>
1528 #include <sys/socket.h>
1530 [ sa_family_t foo; foo = 1235; ],
1531 [ ac_cv_have_sa_family_t="yes" ],
1534 #include <sys/types.h>
1535 #include <sys/socket.h>
1536 #include <netinet/in.h>
1538 [ sa_family_t foo; foo = 1235; ],
1539 [ ac_cv_have_sa_family_t="yes" ],
1541 [ ac_cv_have_sa_family_t="no" ]
1545 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1546 AC_DEFINE(HAVE_SA_FAMILY_T)
1549 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1552 #include <sys/types.h>
1554 [ pid_t foo; foo = 1235; ],
1555 [ ac_cv_have_pid_t="yes" ],
1556 [ ac_cv_have_pid_t="no" ]
1559 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1560 AC_DEFINE(HAVE_PID_T)
1563 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1566 #include <sys/types.h>
1568 [ mode_t foo; foo = 1235; ],
1569 [ ac_cv_have_mode_t="yes" ],
1570 [ ac_cv_have_mode_t="no" ]
1573 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1574 AC_DEFINE(HAVE_MODE_T)
1578 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1581 #include <sys/types.h>
1582 #include <sys/socket.h>
1584 [ struct sockaddr_storage s; ],
1585 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1586 [ ac_cv_have_struct_sockaddr_storage="no" ]
1589 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1590 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1593 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1596 #include <sys/types.h>
1597 #include <netinet/in.h>
1599 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1600 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1601 [ ac_cv_have_struct_sockaddr_in6="no" ]
1604 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1605 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1608 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1611 #include <sys/types.h>
1612 #include <netinet/in.h>
1614 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1615 [ ac_cv_have_struct_in6_addr="yes" ],
1616 [ ac_cv_have_struct_in6_addr="no" ]
1619 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1620 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1623 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1626 #include <sys/types.h>
1627 #include <sys/socket.h>
1630 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1631 [ ac_cv_have_struct_addrinfo="yes" ],
1632 [ ac_cv_have_struct_addrinfo="no" ]
1635 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1636 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1639 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1641 [ #include <sys/time.h> ],
1642 [ struct timeval tv; tv.tv_sec = 1;],
1643 [ ac_cv_have_struct_timeval="yes" ],
1644 [ ac_cv_have_struct_timeval="no" ]
1647 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1648 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1649 have_struct_timeval=1
1652 AC_CHECK_TYPES(struct timespec)
1654 # We need int64_t or else certian parts of the compile will fail.
1655 if test "x$ac_cv_have_int64_t" = "xno" -a \
1656 "x$ac_cv_sizeof_long_int" != "x8" -a \
1657 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1658 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1659 echo "an alternative compiler (I.E., GCC) before continuing."
1663 dnl test snprintf (broken on SCO w/gcc)
1668 #ifdef HAVE_SNPRINTF
1672 char expected_out[50];
1674 #if (SIZEOF_LONG_INT == 8)
1675 long int num = 0x7fffffffffffffff;
1677 long long num = 0x7fffffffffffffffll;
1679 strcpy(expected_out, "9223372036854775807");
1680 snprintf(buf, mazsize, "%lld", num);
1681 if(strcmp(buf, expected_out) != 0)
1688 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1692 dnl Checks for structure members
1693 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1694 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1695 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1696 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1697 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1698 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1699 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1700 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1701 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1702 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1703 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1704 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1705 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1706 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1707 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1708 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1709 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1711 AC_CHECK_MEMBERS([struct stat.st_blksize])
1713 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1714 ac_cv_have_ss_family_in_struct_ss, [
1717 #include <sys/types.h>
1718 #include <sys/socket.h>
1720 [ struct sockaddr_storage s; s.ss_family = 1; ],
1721 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1722 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1725 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1726 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1729 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1730 ac_cv_have___ss_family_in_struct_ss, [
1733 #include <sys/types.h>
1734 #include <sys/socket.h>
1736 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1737 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1738 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1741 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1742 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1745 AC_CACHE_CHECK([for pw_class field in struct passwd],
1746 ac_cv_have_pw_class_in_struct_passwd, [
1751 [ struct passwd p; p.pw_class = 0; ],
1752 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1753 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1756 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1757 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1760 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1761 ac_cv_have_pw_expire_in_struct_passwd, [
1766 [ struct passwd p; p.pw_expire = 0; ],
1767 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1768 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1771 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1772 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1775 AC_CACHE_CHECK([for pw_change field in struct passwd],
1776 ac_cv_have_pw_change_in_struct_passwd, [
1781 [ struct passwd p; p.pw_change = 0; ],
1782 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1783 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1786 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1787 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1790 dnl make sure we're using the real structure members and not defines
1791 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1792 ac_cv_have_accrights_in_msghdr, [
1795 #include <sys/types.h>
1796 #include <sys/socket.h>
1797 #include <sys/uio.h>
1799 #ifdef msg_accrights
1803 m.msg_accrights = 0;
1807 [ ac_cv_have_accrights_in_msghdr="yes" ],
1808 [ ac_cv_have_accrights_in_msghdr="no" ]
1811 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1812 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1815 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1816 ac_cv_have_control_in_msghdr, [
1819 #include <sys/types.h>
1820 #include <sys/socket.h>
1821 #include <sys/uio.h>
1831 [ ac_cv_have_control_in_msghdr="yes" ],
1832 [ ac_cv_have_control_in_msghdr="no" ]
1835 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1836 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1839 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1841 [ extern char *__progname; printf("%s", __progname); ],
1842 [ ac_cv_libc_defines___progname="yes" ],
1843 [ ac_cv_libc_defines___progname="no" ]
1846 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1847 AC_DEFINE(HAVE___PROGNAME)
1850 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1854 [ printf("%s", __FUNCTION__); ],
1855 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1856 [ ac_cv_cc_implements___FUNCTION__="no" ]
1859 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1860 AC_DEFINE(HAVE___FUNCTION__)
1863 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1867 [ printf("%s", __func__); ],
1868 [ ac_cv_cc_implements___func__="yes" ],
1869 [ ac_cv_cc_implements___func__="no" ]
1872 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1873 AC_DEFINE(HAVE___func__)
1876 AC_CACHE_CHECK([whether getopt has optreset support],
1877 ac_cv_have_getopt_optreset, [
1882 [ extern int optreset; optreset = 0; ],
1883 [ ac_cv_have_getopt_optreset="yes" ],
1884 [ ac_cv_have_getopt_optreset="no" ]
1887 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1888 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1891 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1893 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1894 [ ac_cv_libc_defines_sys_errlist="yes" ],
1895 [ ac_cv_libc_defines_sys_errlist="no" ]
1898 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1899 AC_DEFINE(HAVE_SYS_ERRLIST)
1903 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1905 [ extern int sys_nerr; printf("%i", sys_nerr);],
1906 [ ac_cv_libc_defines_sys_nerr="yes" ],
1907 [ ac_cv_libc_defines_sys_nerr="no" ]
1910 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1911 AC_DEFINE(HAVE_SYS_NERR)
1915 # Check whether user wants sectok support
1917 [ --with-sectok Enable smartcard support using libsectok],
1919 if test "x$withval" != "xno" ; then
1920 if test "x$withval" != "xyes" ; then
1921 CPPFLAGS="$CPPFLAGS -I${withval}"
1922 LDFLAGS="$LDFLAGS -L${withval}"
1923 if test ! -z "$need_dash_r" ; then
1924 LDFLAGS="$LDFLAGS -R${withval}"
1926 if test ! -z "$blibpath" ; then
1927 blibpath="$blibpath:${withval}"
1930 AC_CHECK_HEADERS(sectok.h)
1931 if test "$ac_cv_header_sectok_h" != yes; then
1932 AC_MSG_ERROR(Can't find sectok.h)
1934 AC_CHECK_LIB(sectok, sectok_open)
1935 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1936 AC_MSG_ERROR(Can't find libsectok)
1938 AC_DEFINE(SMARTCARD)
1939 AC_DEFINE(USE_SECTOK)
1940 SCARD_MSG="yes, using sectok"
1945 # Check whether user wants OpenSC support
1947 AC_HELP_STRING([--with-opensc=PFX],
1948 [Enable smartcard support using OpenSC]),
1949 opensc_config_prefix="$withval", opensc_config_prefix="")
1950 if test x$opensc_config_prefix != x ; then
1951 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1952 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1953 if test "$OPENSC_CONFIG" != "no"; then
1954 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1955 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1956 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1957 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1958 AC_DEFINE(SMARTCARD)
1959 AC_DEFINE(USE_OPENSC)
1960 SCARD_MSG="yes, using OpenSC"
1964 # Check libraries needed by DNS fingerprint support
1965 AC_SEARCH_LIBS(getrrsetbyname, resolv,
1966 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1968 # Needed by our getrrsetbyname()
1969 AC_SEARCH_LIBS(res_query, resolv)
1970 AC_SEARCH_LIBS(dn_expand, resolv)
1971 AC_CHECK_FUNCS(_getshort _getlong)
1972 AC_CHECK_MEMBER(HEADER.ad,
1973 [AC_DEFINE(HAVE_HEADER_AD)],,
1974 [#include <arpa/nameser.h>])
1977 # Check whether user wants Kerberos 5 support
1979 AC_ARG_WITH(kerberos5,
1980 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1982 if test "x$withval" != "xno" ; then
1983 if test "x$withval" = "xyes" ; then
1984 KRB5ROOT="/usr/local"
1988 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1989 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1992 AC_MSG_CHECKING(whether we are using Heimdal)
1993 AC_TRY_COMPILE([ #include <krb5.h> ],
1994 [ char *tmp = heimdal_version; ],
1995 [ AC_MSG_RESULT(yes)
1997 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2000 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2003 if test ! -z "$need_dash_r" ; then
2004 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2006 if test ! -z "$blibpath" ; then
2007 blibpath="$blibpath:${KRB5ROOT}/lib"
2009 AC_SEARCH_LIBS(dn_expand, resolv)
2011 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2013 K5LIBS="-lgssapi $K5LIBS" ],
2014 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2016 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2017 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2022 AC_CHECK_HEADER(gssapi.h, ,
2023 [ unset ac_cv_header_gssapi_h
2024 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2025 AC_CHECK_HEADERS(gssapi.h, ,
2026 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2032 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2033 AC_CHECK_HEADER(gssapi_krb5.h, ,
2034 [ CPPFLAGS="$oldCPP" ])
2040 LIBS="$LIBS $K5LIBS"
2042 # Looking for programs, paths and files
2044 PRIVSEP_PATH=/var/empty
2045 AC_ARG_WITH(privsep-path,
2046 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2048 if test "x$withval" != "$no" ; then
2049 PRIVSEP_PATH=$withval
2053 AC_SUBST(PRIVSEP_PATH)
2056 [ --with-xauth=PATH Specify path to xauth program ],
2058 if test "x$withval" != "xno" ; then
2064 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2065 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2066 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2067 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2068 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2069 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2070 xauth_path="/usr/openwin/bin/xauth"
2076 AC_ARG_ENABLE(strip,
2077 [ --disable-strip Disable calling strip(1) on install],
2079 if test "x$enableval" = "xno" ; then
2086 if test -z "$xauth_path" ; then
2087 XAUTH_PATH="undefined"
2088 AC_SUBST(XAUTH_PATH)
2090 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2091 XAUTH_PATH=$xauth_path
2092 AC_SUBST(XAUTH_PATH)
2095 # Check for mail directory (last resort if we cannot get it from headers)
2096 if test ! -z "$MAIL" ; then
2097 maildir=`dirname $MAIL`
2098 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2101 if test -z "$no_dev_ptmx" ; then
2102 if test "x$disable_ptmx_check" != "xyes" ; then
2103 AC_CHECK_FILE("/dev/ptmx",
2105 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2111 AC_CHECK_FILE("/dev/ptc",
2113 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2118 # Options from here on. Some of these are preset by platform above
2119 AC_ARG_WITH(mantype,
2120 [ --with-mantype=man|cat|doc Set man page type],
2127 AC_MSG_ERROR(invalid man type: $withval)
2132 if test -z "$MANTYPE"; then
2133 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2134 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2135 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2137 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2144 if test "$MANTYPE" = "doc"; then
2151 # Check whether to enable MD5 passwords
2153 AC_ARG_WITH(md5-passwords,
2154 [ --with-md5-passwords Enable use of MD5 passwords],
2156 if test "x$withval" != "xno" ; then
2157 AC_DEFINE(HAVE_MD5_PASSWORDS)
2163 # Whether to disable shadow password support
2165 [ --without-shadow Disable shadow password support],
2167 if test "x$withval" = "xno" ; then
2168 AC_DEFINE(DISABLE_SHADOW)
2174 if test -z "$disable_shadow" ; then
2175 AC_MSG_CHECKING([if the systems has expire shadow information])
2178 #include <sys/types.h>
2181 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2182 [ sp_expire_available=yes ], []
2185 if test "x$sp_expire_available" = "xyes" ; then
2187 AC_DEFINE(HAS_SHADOW_EXPIRE)
2193 # Use ip address instead of hostname in $DISPLAY
2194 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2195 DISPLAY_HACK_MSG="yes"
2196 AC_DEFINE(IPADDR_IN_DISPLAY)
2198 DISPLAY_HACK_MSG="no"
2199 AC_ARG_WITH(ipaddr-display,
2200 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2202 if test "x$withval" != "xno" ; then
2203 AC_DEFINE(IPADDR_IN_DISPLAY)
2204 DISPLAY_HACK_MSG="yes"
2210 # check for /etc/default/login and use it if present.
2211 AC_ARG_ENABLE(etc-default-login,
2212 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2214 AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2216 if test "x$external_path_file" = "x/etc/default/login"; then
2217 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2221 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2222 if test $ac_cv_func_login_getcapbool = "yes" -a \
2223 $ac_cv_header_login_cap_h = "yes" ; then
2224 external_path_file=/etc/login.conf
2227 # Whether to mess with the default path
2228 SERVER_PATH_MSG="(default)"
2229 AC_ARG_WITH(default-path,
2230 [ --with-default-path= Specify default \$PATH environment for server],
2232 if test "x$external_path_file" = "x/etc/login.conf" ; then
2234 --with-default-path=PATH has no effect on this system.
2235 Edit /etc/login.conf instead.])
2236 elif test "x$withval" != "xno" ; then
2237 if test ! -z "$external_path_file" ; then
2239 --with-default-path=PATH will only be used if PATH is not defined in
2240 $external_path_file .])
2242 user_path="$withval"
2243 SERVER_PATH_MSG="$withval"
2246 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2247 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2249 if test ! -z "$external_path_file" ; then
2251 If PATH is defined in $external_path_file, ensure the path to scp is included,
2252 otherwise scp will not work.])
2256 /* find out what STDPATH is */
2261 #ifndef _PATH_STDPATH
2262 # ifdef _PATH_USERPATH /* Irix */
2263 # define _PATH_STDPATH _PATH_USERPATH
2265 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2268 #include <sys/types.h>
2269 #include <sys/stat.h>
2271 #define DATA "conftest.stdpath"
2278 fd = fopen(DATA,"w");
2282 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2287 ], [ user_path=`cat conftest.stdpath` ],
2288 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2289 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2291 # make sure $bindir is in USER_PATH so scp will work
2292 t_bindir=`eval echo ${bindir}`
2294 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2297 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2299 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2300 if test $? -ne 0 ; then
2301 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2302 if test $? -ne 0 ; then
2303 user_path=$user_path:$t_bindir
2304 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2309 if test "x$external_path_file" != "x/etc/login.conf" ; then
2310 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2314 # Set superuser path separately to user path
2315 AC_ARG_WITH(superuser-path,
2316 [ --with-superuser-path= Specify different path for super-user],
2318 if test "x$withval" != "xno" ; then
2319 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2320 superuser_path=$withval
2326 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2327 IPV4_IN6_HACK_MSG="no"
2329 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2331 if test "x$withval" != "xno" ; then
2333 AC_DEFINE(IPV4_IN_IPV6)
2334 IPV4_IN6_HACK_MSG="yes"
2339 if test "x$inet6_default_4in6" = "xyes"; then
2340 AC_MSG_RESULT([yes (default)])
2341 AC_DEFINE(IPV4_IN_IPV6)
2342 IPV4_IN6_HACK_MSG="yes"
2344 AC_MSG_RESULT([no (default)])
2349 # Whether to enable BSD auth support
2351 AC_ARG_WITH(bsd-auth,
2352 [ --with-bsd-auth Enable BSD auth support],
2354 if test "x$withval" != "xno" ; then
2361 # Where to place sshd.pid
2363 # make sure the directory exists
2364 if test ! -d $piddir ; then
2365 piddir=`eval echo ${sysconfdir}`
2367 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2371 AC_ARG_WITH(pid-dir,
2372 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2374 if test "x$withval" != "xno" ; then
2376 if test ! -d $piddir ; then
2377 AC_MSG_WARN([** no $piddir directory on this system **])
2383 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2386 dnl allow user to disable some login recording features
2387 AC_ARG_ENABLE(lastlog,
2388 [ --disable-lastlog disable use of lastlog even if detected [no]],
2390 if test "x$enableval" = "xno" ; then
2391 AC_DEFINE(DISABLE_LASTLOG)
2396 [ --disable-utmp disable use of utmp even if detected [no]],
2398 if test "x$enableval" = "xno" ; then
2399 AC_DEFINE(DISABLE_UTMP)
2403 AC_ARG_ENABLE(utmpx,
2404 [ --disable-utmpx disable use of utmpx even if detected [no]],
2406 if test "x$enableval" = "xno" ; then
2407 AC_DEFINE(DISABLE_UTMPX)
2412 [ --disable-wtmp disable use of wtmp even if detected [no]],
2414 if test "x$enableval" = "xno" ; then
2415 AC_DEFINE(DISABLE_WTMP)
2419 AC_ARG_ENABLE(wtmpx,
2420 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2422 if test "x$enableval" = "xno" ; then
2423 AC_DEFINE(DISABLE_WTMPX)
2427 AC_ARG_ENABLE(libutil,
2428 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2430 if test "x$enableval" = "xno" ; then
2431 AC_DEFINE(DISABLE_LOGIN)
2435 AC_ARG_ENABLE(pututline,
2436 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2438 if test "x$enableval" = "xno" ; then
2439 AC_DEFINE(DISABLE_PUTUTLINE)
2443 AC_ARG_ENABLE(pututxline,
2444 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2446 if test "x$enableval" = "xno" ; then
2447 AC_DEFINE(DISABLE_PUTUTXLINE)
2451 AC_ARG_WITH(lastlog,
2452 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2454 if test "x$withval" = "xno" ; then
2455 AC_DEFINE(DISABLE_LASTLOG)
2457 conf_lastlog_location=$withval
2462 dnl lastlog, [uw]tmpx? detection
2463 dnl NOTE: set the paths in the platform section to avoid the
2464 dnl need for command-line parameters
2465 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2467 dnl lastlog detection
2468 dnl NOTE: the code itself will detect if lastlog is a directory
2469 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2471 #include <sys/types.h>
2473 #ifdef HAVE_LASTLOG_H
2474 # include <lastlog.h>
2483 [ char *lastlog = LASTLOG_FILE; ],
2484 [ AC_MSG_RESULT(yes) ],
2487 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2489 #include <sys/types.h>
2491 #ifdef HAVE_LASTLOG_H
2492 # include <lastlog.h>
2498 [ char *lastlog = _PATH_LASTLOG; ],
2499 [ AC_MSG_RESULT(yes) ],
2502 system_lastlog_path=no
2507 if test -z "$conf_lastlog_location"; then
2508 if test x"$system_lastlog_path" = x"no" ; then
2509 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2510 if (test -d "$f" || test -f "$f") ; then
2511 conf_lastlog_location=$f
2514 if test -z "$conf_lastlog_location"; then
2515 AC_MSG_WARN([** Cannot find lastlog **])
2516 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2521 if test -n "$conf_lastlog_location"; then
2522 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2526 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2528 #include <sys/types.h>
2534 [ char *utmp = UTMP_FILE; ],
2535 [ AC_MSG_RESULT(yes) ],
2537 system_utmp_path=no ]
2539 if test -z "$conf_utmp_location"; then
2540 if test x"$system_utmp_path" = x"no" ; then
2541 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2542 if test -f $f ; then
2543 conf_utmp_location=$f
2546 if test -z "$conf_utmp_location"; then
2547 AC_DEFINE(DISABLE_UTMP)
2551 if test -n "$conf_utmp_location"; then
2552 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2556 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2558 #include <sys/types.h>
2564 [ char *wtmp = WTMP_FILE; ],
2565 [ AC_MSG_RESULT(yes) ],
2567 system_wtmp_path=no ]
2569 if test -z "$conf_wtmp_location"; then
2570 if test x"$system_wtmp_path" = x"no" ; then
2571 for f in /usr/adm/wtmp /var/log/wtmp; do
2572 if test -f $f ; then
2573 conf_wtmp_location=$f
2576 if test -z "$conf_wtmp_location"; then
2577 AC_DEFINE(DISABLE_WTMP)
2581 if test -n "$conf_wtmp_location"; then
2582 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2586 dnl utmpx detection - I don't know any system so perverse as to require
2587 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2589 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2591 #include <sys/types.h>
2600 [ char *utmpx = UTMPX_FILE; ],
2601 [ AC_MSG_RESULT(yes) ],
2603 system_utmpx_path=no ]
2605 if test -z "$conf_utmpx_location"; then
2606 if test x"$system_utmpx_path" = x"no" ; then
2607 AC_DEFINE(DISABLE_UTMPX)
2610 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2614 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2616 #include <sys/types.h>
2625 [ char *wtmpx = WTMPX_FILE; ],
2626 [ AC_MSG_RESULT(yes) ],
2628 system_wtmpx_path=no ]
2630 if test -z "$conf_wtmpx_location"; then
2631 if test x"$system_wtmpx_path" = x"no" ; then
2632 AC_DEFINE(DISABLE_WTMPX)
2635 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2639 if test ! -z "$blibpath" ; then
2640 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2641 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2644 dnl remove pam and dl because they are in $LIBPAM
2645 if test "$PAM_MSG" = yes ; then
2646 LIBS=`echo $LIBS | sed 's/-lpam //'`
2648 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2649 LIBS=`echo $LIBS | sed 's/-ldl //'`
2653 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2656 # Print summary of options
2658 # Someone please show me a better way :)
2659 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2660 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2661 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2662 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2663 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2664 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2665 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2666 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2667 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2668 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2671 echo "OpenSSH has been configured with the following options:"
2672 echo " User binaries: $B"
2673 echo " System binaries: $C"
2674 echo " Configuration files: $D"
2675 echo " Askpass program: $E"
2676 echo " Manual pages: $F"
2677 echo " PID file: $G"
2678 echo " Privilege separation chroot path: $H"
2679 if test "x$external_path_file" = "x/etc/login.conf" ; then
2680 echo " At runtime, sshd will use the path defined in $external_path_file"
2681 echo " Make sure the path to scp is present, otherwise scp will not work"
2683 echo " sshd default user PATH: $I"
2684 if test ! -z "$external_path_file"; then
2685 echo " (If PATH is set in $external_path_file it will be used instead. If"
2686 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2689 if test ! -z "$superuser_path" ; then
2690 echo " sshd superuser user PATH: $J"
2692 echo " Manpage format: $MANTYPE"
2693 echo " DNS support: $DNS_MSG"
2694 echo " PAM support: $PAM_MSG"
2695 echo " KerberosV support: $KRB5_MSG"
2696 echo " Smartcard support: $SCARD_MSG"
2697 echo " S/KEY support: $SKEY_MSG"
2698 echo " TCP Wrappers support: $TCPW_MSG"
2699 echo " MD5 password support: $MD5_MSG"
2700 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2701 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2702 echo " BSD Auth support: $BSD_AUTH_MSG"
2703 echo " Random number source: $RAND_MSG"
2704 if test ! -z "$USE_RAND_HELPER" ; then
2705 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2710 echo " Host: ${host}"
2711 echo " Compiler: ${CC}"
2712 echo " Compiler flags: ${CFLAGS}"
2713 echo "Preprocessor flags: ${CPPFLAGS}"
2714 echo " Linker flags: ${LDFLAGS}"
2715 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2719 if test "x$PAM_MSG" = "xyes" ; then
2720 echo "PAM is enabled. You may need to install a PAM control file "
2721 echo "for sshd, otherwise password authentication may fail. "
2722 echo "Example PAM control files can be found in the contrib/ "
2727 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2728 echo "WARNING: you are using the builtin random number collection "
2729 echo "service. Please read WARNING.RNG and request that your OS "
2730 echo "vendor includes kernel-based random number collection in "
2731 echo "future versions of your OS."