4 AC_CONFIG_SRCDIR([ssh.c])
6 AC_CONFIG_HEADER(config.h)
11 # Checks for programs.
17 AC_PATH_PROGS(PERL, perl5 perl)
18 AC_PATH_PROG(SED, sed)
20 AC_PATH_PROG(ENT, ent)
22 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
23 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
24 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
30 if test -z "$AR" ; then
31 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
34 # Use LOGIN_PROGRAM from environment if possible
35 if test ! -z "$LOGIN_PROGRAM" ; then
36 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
39 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
40 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
41 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
45 if test -z "$LD" ; then
51 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
52 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
55 # Check for some target-specific stuff
58 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
59 LDFLAGS="$LDFLAGS -L/usr/local/lib"
60 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
61 if (test -z "$blibpath"); then
62 blibpath="/usr/lib:/lib:/usr/local/lib"
64 saved_LDFLAGS="$LDFLAGS"
65 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
66 if (test -z "$blibflags"); then
67 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
68 AC_TRY_LINK([], [], [blibflags=$tryflags])
71 if (test -z "$blibflags"); then
72 AC_MSG_RESULT(not found)
73 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
75 AC_MSG_RESULT($blibflags)
77 LDFLAGS="$saved_LDFLAGS"
78 dnl Check for authenticate. Might be in libs.a on older AIXes
79 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
80 [AC_CHECK_LIB(s,authenticate,
81 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
85 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
86 AC_CHECK_DECL(loginfailed,
87 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
89 [#include <usersec.h>],
90 [(void)loginfailed("user","host","tty",0);],
92 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
96 [#include <usersec.h>]
98 AC_CHECK_FUNCS(setauthdb)
99 AC_DEFINE(BROKEN_GETADDRINFO)
100 AC_DEFINE(BROKEN_REALPATH)
101 AC_DEFINE(SETEUID_BREAKS_SETUID)
102 AC_DEFINE(BROKEN_SETREUID)
103 AC_DEFINE(BROKEN_SETREGID)
104 dnl AIX handles lastlog as part of its login message
105 AC_DEFINE(DISABLE_LASTLOG)
106 AC_DEFINE(LOGIN_NEEDS_UTMPX)
107 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
110 check_for_libcrypt_later=1
111 LIBS="$LIBS /usr/lib/textmode.o"
112 AC_DEFINE(HAVE_CYGWIN)
114 AC_DEFINE(DISABLE_SHADOW)
115 AC_DEFINE(IP_TOS_IS_BROKEN)
116 AC_DEFINE(NO_X11_UNIX_SOCKETS)
117 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
118 AC_DEFINE(DISABLE_FD_PASSING)
119 AC_DEFINE(SETGROUPS_NOOP)
122 AC_DEFINE(IP_TOS_IS_BROKEN)
125 AC_MSG_CHECKING(if we have working getaddrinfo)
126 AC_TRY_RUN([#include <mach-o/dyld.h>
127 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
131 }], [AC_MSG_RESULT(working)],
132 [AC_MSG_RESULT(buggy)
133 AC_DEFINE(BROKEN_GETADDRINFO)],
134 [AC_MSG_RESULT(assume it is working)])
137 if test -z "$GCC"; then
140 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
141 IPADDR_IN_DISPLAY=yes
142 AC_DEFINE(HAVE_SECUREWARE)
144 AC_DEFINE(LOGIN_NO_ENDOPT)
145 AC_DEFINE(LOGIN_NEEDS_UTMPX)
146 AC_DEFINE(DISABLE_SHADOW)
147 AC_DEFINE(DISABLE_UTMP)
148 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
149 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
150 LIBS="$LIBS -lsec -lsecpw"
151 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
152 disable_ptmx_check=yes
155 if test -z "$GCC"; then
158 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
159 IPADDR_IN_DISPLAY=yes
161 AC_DEFINE(LOGIN_NO_ENDOPT)
162 AC_DEFINE(LOGIN_NEEDS_UTMPX)
163 AC_DEFINE(DISABLE_SHADOW)
164 AC_DEFINE(DISABLE_UTMP)
165 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
166 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
168 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
171 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
172 IPADDR_IN_DISPLAY=yes
173 AC_DEFINE(PAM_SUN_CODEBASE)
175 AC_DEFINE(LOGIN_NO_ENDOPT)
176 AC_DEFINE(LOGIN_NEEDS_UTMPX)
177 AC_DEFINE(DISABLE_SHADOW)
178 AC_DEFINE(DISABLE_UTMP)
179 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
180 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
182 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
185 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
187 PATH="$PATH:/usr/etc"
188 AC_DEFINE(BROKEN_INET_NTOA)
189 AC_DEFINE(WITH_ABBREV_NO_TTY)
190 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
193 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
195 PATH="$PATH:/usr/etc"
196 AC_DEFINE(WITH_IRIX_ARRAY)
197 AC_DEFINE(WITH_IRIX_PROJECT)
198 AC_DEFINE(WITH_IRIX_AUDIT)
199 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
200 AC_DEFINE(BROKEN_INET_NTOA)
201 AC_DEFINE(WITH_ABBREV_NO_TTY)
202 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
206 check_for_libcrypt_later=1
207 check_for_openpty_ctty_bug=1
208 AC_DEFINE(DONT_TRY_OTHER_AF)
209 AC_DEFINE(PAM_TTY_KLUDGE)
210 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
211 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
212 inet6_default_4in6=yes
215 AC_DEFINE(BROKEN_CMSG_TYPE)
219 mips-sony-bsd|mips-sony-newsos4)
220 AC_DEFINE(HAVE_NEWS4)
224 check_for_libcrypt_before=1
228 check_for_libcrypt_later=1
231 conf_lastlog_location="/usr/adm/lastlog"
232 conf_utmp_location=/etc/utmp
233 conf_wtmp_location=/usr/adm/wtmp
236 AC_DEFINE(BROKEN_REALPATH)
238 AC_DEFINE(BROKEN_SAVED_UIDS)
239 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
243 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
244 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
246 AC_DEFINE(PAM_SUN_CODEBASE)
247 AC_DEFINE(LOGIN_NEEDS_UTMPX)
248 AC_DEFINE(LOGIN_NEEDS_TERM)
249 AC_DEFINE(PAM_TTY_KLUDGE)
250 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
251 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
252 AC_DEFINE(SSHD_ACQUIRES_CTTY)
253 external_path_file=/etc/default/login
254 # hardwire lastlog location (can't detect it on some versions)
255 conf_lastlog_location="/var/adm/lastlog"
256 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
257 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
258 if test "$sol2ver" -ge 8; then
260 AC_DEFINE(DISABLE_UTMP)
261 AC_DEFINE(DISABLE_WTMP)
267 CPPFLAGS="$CPPFLAGS -DSUNOS4"
268 AC_CHECK_FUNCS(getpwanam)
269 AC_DEFINE(PAM_SUN_CODEBASE)
270 conf_utmp_location=/etc/utmp
271 conf_wtmp_location=/var/adm/wtmp
272 conf_lastlog_location=/var/adm/lastlog
276 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
277 LDFLAGS="$LDFLAGS -L/usr/local/lib"
280 AC_DEFINE(SSHD_ACQUIRES_CTTY)
283 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
284 # /usr/ucblib MUST NOT be searched on ReliantUNIX
285 LDFLAGS="$LDFLAGS -L/usr/local/lib"
286 IPADDR_IN_DISPLAY=yes
288 AC_DEFINE(IP_TOS_IS_BROKEN)
289 AC_DEFINE(SSHD_ACQUIRES_CTTY)
290 external_path_file=/etc/default/login
291 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
292 # Attention: always take care to bind libsocket and libnsl before libc,
293 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
296 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
297 LDFLAGS="$LDFLAGS -L/usr/local/lib"
299 AC_DEFINE(SETEUID_BREAKS_SETUID)
300 AC_DEFINE(BROKEN_SETREUID)
301 AC_DEFINE(BROKEN_SETREGID)
304 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
305 LDFLAGS="$LDFLAGS -L/usr/local/lib"
307 AC_DEFINE(SETEUID_BREAKS_SETUID)
308 AC_DEFINE(BROKEN_SETREUID)
309 AC_DEFINE(BROKEN_SETREGID)
312 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
313 LDFLAGS="$LDFLAGS -L/usr/local/lib"
316 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
317 LDFLAGS="$LDFLAGS -L/usr/local/lib"
318 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
321 AC_DEFINE(BROKEN_SYS_TERMIO_H)
323 AC_DEFINE(HAVE_SECUREWARE)
324 AC_DEFINE(DISABLE_SHADOW)
325 AC_DEFINE(BROKEN_SAVED_UIDS)
326 AC_DEFINE(WITH_ABBREV_NO_TTY)
327 AC_CHECK_FUNCS(getluid setluid)
329 do_sco3_extra_lib_check=yes
332 if test -z "$GCC"; then
333 CFLAGS="$CFLAGS -belf"
335 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
336 LDFLAGS="$LDFLAGS -L/usr/local/lib"
337 LIBS="$LIBS -lprot -lx -ltinfo -lm"
340 AC_DEFINE(HAVE_SECUREWARE)
341 AC_DEFINE(DISABLE_SHADOW)
342 AC_DEFINE(DISABLE_FD_PASSING)
343 AC_DEFINE(SETEUID_BREAKS_SETUID)
344 AC_DEFINE(BROKEN_SETREUID)
345 AC_DEFINE(BROKEN_SETREGID)
346 AC_DEFINE(WITH_ABBREV_NO_TTY)
347 AC_CHECK_FUNCS(getluid setluid)
352 AC_DEFINE(DISABLE_FD_PASSING)
354 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
358 AC_DEFINE(WITH_ABBREV_NO_TTY)
360 AC_DEFINE(DISABLE_FD_PASSING)
362 LIBS="$LIBS -lgen -lacid"
367 AC_DEFINE(DISABLE_FD_PASSING)
368 AC_DEFINE(NO_SSH_LASTLOG)
369 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
370 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
374 AC_MSG_CHECKING(for Digital Unix SIA)
377 [ --with-osfsia Enable Digital Unix SIA],
379 if test "x$withval" = "xno" ; then
380 AC_MSG_RESULT(disabled)
385 if test -z "$no_osfsia" ; then
386 if test -f /etc/sia/matrix.conf; then
388 AC_DEFINE(HAVE_OSF_SIA)
389 AC_DEFINE(DISABLE_LOGIN)
390 AC_DEFINE(DISABLE_FD_PASSING)
391 LIBS="$LIBS -lsecurity -ldb -lm -laud"
396 AC_DEFINE(DISABLE_FD_PASSING)
397 AC_DEFINE(BROKEN_GETADDRINFO)
398 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
403 AC_DEFINE(NO_X11_UNIX_SOCKETS)
404 AC_DEFINE(MISSING_NFDBITS)
405 AC_DEFINE(MISSING_HOWMANY)
406 AC_DEFINE(MISSING_FD_MASK)
410 # Allow user to specify flags
412 [ --with-cflags Specify additional flags to pass to compiler],
414 if test "x$withval" != "xno" ; then
415 CFLAGS="$CFLAGS $withval"
419 AC_ARG_WITH(cppflags,
420 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
422 if test "x$withval" != "xno"; then
423 CPPFLAGS="$CPPFLAGS $withval"
428 [ --with-ldflags Specify additional flags to pass to linker],
430 if test "x$withval" != "xno" ; then
431 LDFLAGS="$LDFLAGS $withval"
436 [ --with-libs Specify additional libraries to link with],
438 if test "x$withval" != "xno" ; then
439 LIBS="$LIBS $withval"
444 AC_MSG_CHECKING(compiler and flags for sanity)
449 [ AC_MSG_RESULT(yes) ],
452 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
456 # Checks for header files.
457 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
458 getopt.h glob.h ia.h lastlog.h limits.h login.h \
459 login_cap.h maillock.h netdb.h netgroup.h \
460 netinet/in_systm.h paths.h pty.h readpassphrase.h \
461 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
462 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
463 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
464 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
465 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
466 util.h utime.h utmp.h utmpx.h)
468 # Checks for libraries.
469 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
470 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
472 dnl SCO OS3 needs this for libwrap
473 if test "x$with_tcp_wrappers" != "xno" ; then
474 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
475 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
479 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
480 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
481 AC_CHECK_LIB(gen, dirname,[
482 AC_CACHE_CHECK([for broken dirname],
483 ac_cv_have_broken_dirname, [
491 int main(int argc, char **argv) {
494 strncpy(buf,"/etc", 32);
496 if (!s || strncmp(s, "/", 32) != 0) {
503 [ ac_cv_have_broken_dirname="no" ],
504 [ ac_cv_have_broken_dirname="yes" ]
508 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
510 AC_DEFINE(HAVE_DIRNAME)
511 AC_CHECK_HEADERS(libgen.h)
516 AC_CHECK_FUNC(getspnam, ,
517 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
518 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
521 [ --without-rpath Disable auto-added -R linker paths],
523 if test "x$withval" = "xno" ; then
526 if test "x$withval" = "xyes" ; then
534 [ --with-zlib=PATH Use zlib in PATH],
536 if test "x$withval" = "xno" ; then
537 AC_MSG_ERROR([*** zlib is required ***])
539 if test -d "$withval/lib"; then
540 if test -n "${need_dash_r}"; then
541 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
543 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
546 if test -n "${need_dash_r}"; then
547 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
549 LDFLAGS="-L${withval} ${LDFLAGS}"
552 if test -d "$withval/include"; then
553 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
555 CPPFLAGS="-I${withval} ${CPPFLAGS}"
560 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
563 AC_CHECK_FUNC(strcasecmp,
564 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
566 AC_CHECK_FUNC(utimes,
567 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
568 LIBS="$LIBS -lc89"]) ]
571 dnl Checks for libutil functions
572 AC_CHECK_HEADERS(libutil.h)
573 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
574 AC_CHECK_FUNCS(logout updwtmp logwtmp)
578 # Check for ALTDIRFUNC glob() extension
579 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
580 AC_EGREP_CPP(FOUNDIT,
583 #ifdef GLOB_ALTDIRFUNC
588 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
596 # Check for g.gl_matchc glob() extension
597 AC_MSG_CHECKING(for gl_matchc field in glob_t)
598 AC_EGREP_CPP(FOUNDIT,
601 int main(void){glob_t g; g.gl_matchc = 1;}
604 AC_DEFINE(GLOB_HAS_GL_MATCHC)
612 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
615 #include <sys/types.h>
617 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
619 [AC_MSG_RESULT(yes)],
622 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
626 # Check whether user wants S/Key support
629 [ --with-skey[[=PATH]] Enable S/Key support
630 (optionally in PATH)],
632 if test "x$withval" != "xno" ; then
634 if test "x$withval" != "xyes" ; then
635 CPPFLAGS="$CPPFLAGS -I${withval}/include"
636 LDFLAGS="$LDFLAGS -L${withval}/lib"
643 AC_MSG_CHECKING([for s/key support])
648 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
650 [AC_MSG_RESULT(yes)],
653 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
659 # Check whether user wants TCP wrappers support
661 AC_ARG_WITH(tcp-wrappers,
662 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
663 (optionally in PATH)],
665 if test "x$withval" != "xno" ; then
667 saved_LDFLAGS="$LDFLAGS"
668 saved_CPPFLAGS="$CPPFLAGS"
669 if test -n "${withval}" -a "${withval}" != "yes"; then
670 if test -d "${withval}/lib"; then
671 if test -n "${need_dash_r}"; then
672 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
674 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
677 if test -n "${need_dash_r}"; then
678 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
680 LDFLAGS="-L${withval} ${LDFLAGS}"
683 if test -d "${withval}/include"; then
684 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
686 CPPFLAGS="-I${withval} ${CPPFLAGS}"
690 LIBS="$LIBWRAP $LIBS"
691 AC_MSG_CHECKING(for libwrap)
695 int deny_severity = 0, allow_severity = 0;
705 AC_MSG_ERROR([*** libwrap missing])
713 dnl Checks for library functions. Please keep in alphabetical order
715 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
716 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
717 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
718 getpeereid _getpty getrlimit getttyent glob inet_aton \
719 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
720 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
721 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
722 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
723 setproctitle setregid setresgid setresuid setreuid setrlimit \
724 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
725 strlcat strlcpy strmode strnvis sysconf tcgetpgrp \
726 truncate utimes vhangup vsnprintf waitpid \
729 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
731 dnl Make sure prototypes are defined for these before using them.
732 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
733 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
735 dnl tcsendbreak might be a macro
736 AC_CHECK_DECL(tcsendbreak,
737 [AC_DEFINE(HAVE_TCSENDBREAK)],
738 [AC_CHECK_FUNCS(tcsendbreak)],
739 [#include <termios.h>]
742 dnl Checks for time functions
743 AC_CHECK_FUNCS(gettimeofday time)
744 dnl Checks for utmp functions
745 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
746 AC_CHECK_FUNCS(utmpname)
747 dnl Checks for utmpx functions
748 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
749 AC_CHECK_FUNCS(setutxent utmpxname)
751 AC_CHECK_FUNC(daemon,
752 [AC_DEFINE(HAVE_DAEMON)],
753 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
756 AC_CHECK_FUNC(getpagesize,
757 [AC_DEFINE(HAVE_GETPAGESIZE)],
758 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
761 # Check for broken snprintf
762 if test "x$ac_cv_func_snprintf" = "xyes" ; then
763 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
767 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
769 [AC_MSG_RESULT(yes)],
772 AC_DEFINE(BROKEN_SNPRINTF)
773 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
778 dnl see whether mkstemp() requires XXXXXX
779 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
780 AC_MSG_CHECKING([for (overly) strict mkstemp])
784 main() { char template[]="conftest.mkstemp-test";
785 if (mkstemp(template) == -1)
787 unlink(template); exit(0);
795 AC_DEFINE(HAVE_STRICT_MKSTEMP)
799 AC_DEFINE(HAVE_STRICT_MKSTEMP)
804 dnl make sure that openpty does not reacquire controlling terminal
805 if test ! -z "$check_for_openpty_ctty_bug"; then
806 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
810 #include <sys/fcntl.h>
811 #include <sys/types.h>
812 #include <sys/wait.h>
818 int fd, ptyfd, ttyfd, status;
821 if (pid < 0) { /* failed */
823 } else if (pid > 0) { /* parent */
824 waitpid(pid, &status, 0);
825 if (WIFEXITED(status))
826 exit(WEXITSTATUS(status));
830 close(0); close(1); close(2);
832 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
833 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
835 exit(3); /* Acquired ctty: broken */
837 exit(0); /* Did not acquire ctty: OK */
846 AC_DEFINE(SSHD_ACQUIRES_CTTY)
856 [ --with-pam Enable PAM support ],
858 if test "x$withval" != "xno" ; then
859 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
860 AC_MSG_ERROR([PAM headers not found])
863 AC_CHECK_LIB(dl, dlopen, , )
864 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
865 AC_CHECK_FUNCS(pam_getenvlist)
866 AC_CHECK_FUNCS(pam_putenv)
872 if test $ac_cv_lib_dl_dlopen = yes; then
882 # Check for older PAM
883 if test "x$PAM_MSG" = "xyes" ; then
884 # Check PAM strerror arguments (old PAM)
885 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
889 #include <security/pam_appl.h>
891 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
894 AC_DEFINE(HAVE_OLD_PAM)
896 PAM_MSG="yes (old library)"
901 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
902 # because the system crypt() is more featureful.
903 if test "x$check_for_libcrypt_before" = "x1"; then
904 AC_CHECK_LIB(crypt, crypt)
908 saved_CPPFLAGS="$CPPFLAGS"
909 saved_LDFLAGS="$LDFLAGS"
911 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
913 if test "x$withval" != "xno" ; then
914 if test -d "$withval/lib"; then
915 if test -n "${need_dash_r}"; then
916 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
918 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
921 if test -n "${need_dash_r}"; then
922 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
924 LDFLAGS="-L${withval} ${LDFLAGS}"
927 if test -d "$withval/include"; then
928 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
930 CPPFLAGS="-I${withval} ${CPPFLAGS}"
935 LIBS="$LIBS -lcrypto"
936 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
938 dnl Check default openssl install dir
939 if test -n "${need_dash_r}"; then
940 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
942 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
944 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
945 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
947 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
953 # Determine OpenSSL header version
954 AC_MSG_CHECKING([OpenSSL header version])
959 #include <openssl/opensslv.h>
960 #define DATA "conftest.sslincver"
965 fd = fopen(DATA,"w");
969 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
976 ssl_header_ver=`cat conftest.sslincver`
977 AC_MSG_RESULT($ssl_header_ver)
980 AC_MSG_RESULT(not found)
981 AC_MSG_ERROR(OpenSSL version header not found.)
985 # Determine OpenSSL library version
986 AC_MSG_CHECKING([OpenSSL library version])
991 #include <openssl/opensslv.h>
992 #include <openssl/crypto.h>
993 #define DATA "conftest.ssllibver"
998 fd = fopen(DATA,"w");
1002 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1009 ssl_library_ver=`cat conftest.ssllibver`
1010 AC_MSG_RESULT($ssl_library_ver)
1013 AC_MSG_RESULT(not found)
1014 AC_MSG_ERROR(OpenSSL library not found.)
1018 # Sanity check OpenSSL headers
1019 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1023 #include <openssl/opensslv.h>
1024 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1031 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1032 Check config.log for details.
1033 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1037 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1038 # version in OpenSSL. Skip this for PAM
1039 if test "x$check_for_libcrypt_later" = "x1"; then
1040 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1044 ### Configure cryptographic random number support
1046 # Check wheter OpenSSL seeds itself
1047 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1051 #include <openssl/rand.h>
1052 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1055 OPENSSL_SEEDS_ITSELF=yes
1060 # Default to use of the rand helper if OpenSSL doesn't
1067 # Do we want to force the use of the rand helper?
1068 AC_ARG_WITH(rand-helper,
1069 [ --with-rand-helper Use subprocess to gather strong randomness ],
1071 if test "x$withval" = "xno" ; then
1072 # Force use of OpenSSL's internal RNG, even if
1073 # the previous test showed it to be unseeded.
1074 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1075 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1076 OPENSSL_SEEDS_ITSELF=yes
1085 # Which randomness source do we use?
1086 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1088 AC_DEFINE(OPENSSL_PRNG_ONLY)
1089 RAND_MSG="OpenSSL internal ONLY"
1090 INSTALL_SSH_RAND_HELPER=""
1091 elif test ! -z "$USE_RAND_HELPER" ; then
1092 # install rand helper
1093 RAND_MSG="ssh-rand-helper"
1094 INSTALL_SSH_RAND_HELPER="yes"
1096 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1098 ### Configuration of ssh-rand-helper
1101 AC_ARG_WITH(prngd-port,
1102 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1111 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1114 if test ! -z "$withval" ; then
1115 PRNGD_PORT="$withval"
1116 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1121 # PRNGD Unix domain socket
1122 AC_ARG_WITH(prngd-socket,
1123 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1127 withval="/var/run/egd-pool"
1135 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1139 if test ! -z "$withval" ; then
1140 if test ! -z "$PRNGD_PORT" ; then
1141 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1143 if test ! -r "$withval" ; then
1144 AC_MSG_WARN(Entropy socket is not readable)
1146 PRNGD_SOCKET="$withval"
1147 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1151 # Check for existing socket only if we don't have a random device already
1152 if test "$USE_RAND_HELPER" = yes ; then
1153 AC_MSG_CHECKING(for PRNGD/EGD socket)
1154 # Insert other locations here
1155 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1156 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1157 PRNGD_SOCKET="$sock"
1158 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1162 if test ! -z "$PRNGD_SOCKET" ; then
1163 AC_MSG_RESULT($PRNGD_SOCKET)
1165 AC_MSG_RESULT(not found)
1171 # Change default command timeout for hashing entropy source
1173 AC_ARG_WITH(entropy-timeout,
1174 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1176 if test "x$withval" != "xno" ; then
1177 entropy_timeout=$withval
1181 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1183 SSH_PRIVSEP_USER=sshd
1184 AC_ARG_WITH(privsep-user,
1185 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1187 if test -n "$withval"; then
1188 SSH_PRIVSEP_USER=$withval
1192 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1193 AC_SUBST(SSH_PRIVSEP_USER)
1195 # We do this little dance with the search path to insure
1196 # that programs that we select for use by installed programs
1197 # (which may be run by the super-user) come from trusted
1198 # locations before they come from the user's private area.
1199 # This should help avoid accidentally configuring some
1200 # random version of a program in someone's personal bin.
1204 test -h /bin 2> /dev/null && PATH=/usr/bin
1205 test -d /sbin && PATH=$PATH:/sbin
1206 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1207 PATH=$PATH:/etc:$OPATH
1209 # These programs are used by the command hashing source to gather entropy
1210 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1211 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1212 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1213 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1214 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1215 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1216 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1217 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1218 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1219 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1220 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1221 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1222 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1223 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1224 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1225 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1229 # Where does ssh-rand-helper get its randomness from?
1230 INSTALL_SSH_PRNG_CMDS=""
1231 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1232 if test ! -z "$PRNGD_PORT" ; then
1233 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1234 elif test ! -z "$PRNGD_SOCKET" ; then
1235 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1237 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1238 RAND_HELPER_CMDHASH=yes
1239 INSTALL_SSH_PRNG_CMDS="yes"
1242 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1245 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1246 if test ! -z "$SONY" ; then
1247 LIBS="$LIBS -liberty";
1250 # Checks for data types
1251 AC_CHECK_SIZEOF(char, 1)
1252 AC_CHECK_SIZEOF(short int, 2)
1253 AC_CHECK_SIZEOF(int, 4)
1254 AC_CHECK_SIZEOF(long int, 4)
1255 AC_CHECK_SIZEOF(long long int, 8)
1257 # Sanity check long long for some platforms (AIX)
1258 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1259 ac_cv_sizeof_long_long_int=0
1262 # More checks for data types
1263 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1265 [ #include <sys/types.h> ],
1267 [ ac_cv_have_u_int="yes" ],
1268 [ ac_cv_have_u_int="no" ]
1271 if test "x$ac_cv_have_u_int" = "xyes" ; then
1272 AC_DEFINE(HAVE_U_INT)
1276 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1278 [ #include <sys/types.h> ],
1279 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1280 [ ac_cv_have_intxx_t="yes" ],
1281 [ ac_cv_have_intxx_t="no" ]
1284 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1285 AC_DEFINE(HAVE_INTXX_T)
1289 if (test -z "$have_intxx_t" && \
1290 test "x$ac_cv_header_stdint_h" = "xyes")
1292 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1294 [ #include <stdint.h> ],
1295 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1297 AC_DEFINE(HAVE_INTXX_T)
1300 [ AC_MSG_RESULT(no) ]
1304 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1307 #include <sys/types.h>
1308 #ifdef HAVE_STDINT_H
1309 # include <stdint.h>
1311 #include <sys/socket.h>
1312 #ifdef HAVE_SYS_BITYPES_H
1313 # include <sys/bitypes.h>
1316 [ int64_t a; a = 1;],
1317 [ ac_cv_have_int64_t="yes" ],
1318 [ ac_cv_have_int64_t="no" ]
1321 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1322 AC_DEFINE(HAVE_INT64_T)
1325 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1327 [ #include <sys/types.h> ],
1328 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1329 [ ac_cv_have_u_intxx_t="yes" ],
1330 [ ac_cv_have_u_intxx_t="no" ]
1333 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1334 AC_DEFINE(HAVE_U_INTXX_T)
1338 if test -z "$have_u_intxx_t" ; then
1339 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1341 [ #include <sys/socket.h> ],
1342 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1344 AC_DEFINE(HAVE_U_INTXX_T)
1347 [ AC_MSG_RESULT(no) ]
1351 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1353 [ #include <sys/types.h> ],
1354 [ u_int64_t a; a = 1;],
1355 [ ac_cv_have_u_int64_t="yes" ],
1356 [ ac_cv_have_u_int64_t="no" ]
1359 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1360 AC_DEFINE(HAVE_U_INT64_T)
1364 if test -z "$have_u_int64_t" ; then
1365 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1367 [ #include <sys/bitypes.h> ],
1368 [ u_int64_t a; a = 1],
1370 AC_DEFINE(HAVE_U_INT64_T)
1373 [ AC_MSG_RESULT(no) ]
1377 if test -z "$have_u_intxx_t" ; then
1378 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1381 #include <sys/types.h>
1383 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1384 [ ac_cv_have_uintxx_t="yes" ],
1385 [ ac_cv_have_uintxx_t="no" ]
1388 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1389 AC_DEFINE(HAVE_UINTXX_T)
1393 if test -z "$have_uintxx_t" ; then
1394 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1396 [ #include <stdint.h> ],
1397 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1399 AC_DEFINE(HAVE_UINTXX_T)
1402 [ AC_MSG_RESULT(no) ]
1406 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1407 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1409 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1412 #include <sys/bitypes.h>
1415 int8_t a; int16_t b; int32_t c;
1416 u_int8_t e; u_int16_t f; u_int32_t g;
1417 a = b = c = e = f = g = 1;
1420 AC_DEFINE(HAVE_U_INTXX_T)
1421 AC_DEFINE(HAVE_INTXX_T)
1429 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1432 #include <sys/types.h>
1434 [ u_char foo; foo = 125; ],
1435 [ ac_cv_have_u_char="yes" ],
1436 [ ac_cv_have_u_char="no" ]
1439 if test "x$ac_cv_have_u_char" = "xyes" ; then
1440 AC_DEFINE(HAVE_U_CHAR)
1445 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1447 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1450 #include <sys/types.h>
1452 [ size_t foo; foo = 1235; ],
1453 [ ac_cv_have_size_t="yes" ],
1454 [ ac_cv_have_size_t="no" ]
1457 if test "x$ac_cv_have_size_t" = "xyes" ; then
1458 AC_DEFINE(HAVE_SIZE_T)
1461 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1464 #include <sys/types.h>
1466 [ ssize_t foo; foo = 1235; ],
1467 [ ac_cv_have_ssize_t="yes" ],
1468 [ ac_cv_have_ssize_t="no" ]
1471 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1472 AC_DEFINE(HAVE_SSIZE_T)
1475 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1480 [ clock_t foo; foo = 1235; ],
1481 [ ac_cv_have_clock_t="yes" ],
1482 [ ac_cv_have_clock_t="no" ]
1485 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1486 AC_DEFINE(HAVE_CLOCK_T)
1489 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1492 #include <sys/types.h>
1493 #include <sys/socket.h>
1495 [ sa_family_t foo; foo = 1235; ],
1496 [ ac_cv_have_sa_family_t="yes" ],
1499 #include <sys/types.h>
1500 #include <sys/socket.h>
1501 #include <netinet/in.h>
1503 [ sa_family_t foo; foo = 1235; ],
1504 [ ac_cv_have_sa_family_t="yes" ],
1506 [ ac_cv_have_sa_family_t="no" ]
1510 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1511 AC_DEFINE(HAVE_SA_FAMILY_T)
1514 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1517 #include <sys/types.h>
1519 [ pid_t foo; foo = 1235; ],
1520 [ ac_cv_have_pid_t="yes" ],
1521 [ ac_cv_have_pid_t="no" ]
1524 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1525 AC_DEFINE(HAVE_PID_T)
1528 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1531 #include <sys/types.h>
1533 [ mode_t foo; foo = 1235; ],
1534 [ ac_cv_have_mode_t="yes" ],
1535 [ ac_cv_have_mode_t="no" ]
1538 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1539 AC_DEFINE(HAVE_MODE_T)
1543 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1546 #include <sys/types.h>
1547 #include <sys/socket.h>
1549 [ struct sockaddr_storage s; ],
1550 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1551 [ ac_cv_have_struct_sockaddr_storage="no" ]
1554 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1555 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1558 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1561 #include <sys/types.h>
1562 #include <netinet/in.h>
1564 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1565 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1566 [ ac_cv_have_struct_sockaddr_in6="no" ]
1569 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1570 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1573 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1576 #include <sys/types.h>
1577 #include <netinet/in.h>
1579 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1580 [ ac_cv_have_struct_in6_addr="yes" ],
1581 [ ac_cv_have_struct_in6_addr="no" ]
1584 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1585 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1588 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1591 #include <sys/types.h>
1592 #include <sys/socket.h>
1595 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1596 [ ac_cv_have_struct_addrinfo="yes" ],
1597 [ ac_cv_have_struct_addrinfo="no" ]
1600 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1601 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1604 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1606 [ #include <sys/time.h> ],
1607 [ struct timeval tv; tv.tv_sec = 1;],
1608 [ ac_cv_have_struct_timeval="yes" ],
1609 [ ac_cv_have_struct_timeval="no" ]
1612 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1613 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1614 have_struct_timeval=1
1617 AC_CHECK_TYPES(struct timespec)
1619 # We need int64_t or else certian parts of the compile will fail.
1620 if test "x$ac_cv_have_int64_t" = "xno" -a \
1621 "x$ac_cv_sizeof_long_int" != "x8" -a \
1622 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1623 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1624 echo "an alternative compiler (I.E., GCC) before continuing."
1628 dnl test snprintf (broken on SCO w/gcc)
1633 #ifdef HAVE_SNPRINTF
1637 char expected_out[50];
1639 #if (SIZEOF_LONG_INT == 8)
1640 long int num = 0x7fffffffffffffff;
1642 long long num = 0x7fffffffffffffffll;
1644 strcpy(expected_out, "9223372036854775807");
1645 snprintf(buf, mazsize, "%lld", num);
1646 if(strcmp(buf, expected_out) != 0)
1653 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1657 dnl Checks for structure members
1658 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1659 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1660 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1661 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1662 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1663 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1664 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1665 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1666 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1667 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1668 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1669 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1670 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1671 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1672 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1673 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1674 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1676 AC_CHECK_MEMBERS([struct stat.st_blksize])
1678 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1679 ac_cv_have_ss_family_in_struct_ss, [
1682 #include <sys/types.h>
1683 #include <sys/socket.h>
1685 [ struct sockaddr_storage s; s.ss_family = 1; ],
1686 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1687 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1690 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1691 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1694 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1695 ac_cv_have___ss_family_in_struct_ss, [
1698 #include <sys/types.h>
1699 #include <sys/socket.h>
1701 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1702 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1703 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1706 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1707 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1710 AC_CACHE_CHECK([for pw_class field in struct passwd],
1711 ac_cv_have_pw_class_in_struct_passwd, [
1716 [ struct passwd p; p.pw_class = 0; ],
1717 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1718 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1721 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1722 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1725 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1726 ac_cv_have_pw_expire_in_struct_passwd, [
1731 [ struct passwd p; p.pw_expire = 0; ],
1732 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1733 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1736 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1737 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1740 AC_CACHE_CHECK([for pw_change field in struct passwd],
1741 ac_cv_have_pw_change_in_struct_passwd, [
1746 [ struct passwd p; p.pw_change = 0; ],
1747 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1748 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1751 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1752 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1755 dnl make sure we're using the real structure members and not defines
1756 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1757 ac_cv_have_accrights_in_msghdr, [
1760 #include <sys/types.h>
1761 #include <sys/socket.h>
1762 #include <sys/uio.h>
1764 #ifdef msg_accrights
1768 m.msg_accrights = 0;
1772 [ ac_cv_have_accrights_in_msghdr="yes" ],
1773 [ ac_cv_have_accrights_in_msghdr="no" ]
1776 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1777 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1780 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1781 ac_cv_have_control_in_msghdr, [
1784 #include <sys/types.h>
1785 #include <sys/socket.h>
1786 #include <sys/uio.h>
1796 [ ac_cv_have_control_in_msghdr="yes" ],
1797 [ ac_cv_have_control_in_msghdr="no" ]
1800 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1801 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1804 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1806 [ extern char *__progname; printf("%s", __progname); ],
1807 [ ac_cv_libc_defines___progname="yes" ],
1808 [ ac_cv_libc_defines___progname="no" ]
1811 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1812 AC_DEFINE(HAVE___PROGNAME)
1815 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1819 [ printf("%s", __FUNCTION__); ],
1820 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1821 [ ac_cv_cc_implements___FUNCTION__="no" ]
1824 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1825 AC_DEFINE(HAVE___FUNCTION__)
1828 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1832 [ printf("%s", __func__); ],
1833 [ ac_cv_cc_implements___func__="yes" ],
1834 [ ac_cv_cc_implements___func__="no" ]
1837 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1838 AC_DEFINE(HAVE___func__)
1841 AC_CACHE_CHECK([whether getopt has optreset support],
1842 ac_cv_have_getopt_optreset, [
1847 [ extern int optreset; optreset = 0; ],
1848 [ ac_cv_have_getopt_optreset="yes" ],
1849 [ ac_cv_have_getopt_optreset="no" ]
1852 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1853 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1856 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1858 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1859 [ ac_cv_libc_defines_sys_errlist="yes" ],
1860 [ ac_cv_libc_defines_sys_errlist="no" ]
1863 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1864 AC_DEFINE(HAVE_SYS_ERRLIST)
1868 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1870 [ extern int sys_nerr; printf("%i", sys_nerr);],
1871 [ ac_cv_libc_defines_sys_nerr="yes" ],
1872 [ ac_cv_libc_defines_sys_nerr="no" ]
1875 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1876 AC_DEFINE(HAVE_SYS_NERR)
1880 # Check whether user wants sectok support
1882 [ --with-sectok Enable smartcard support using libsectok],
1884 if test "x$withval" != "xno" ; then
1885 if test "x$withval" != "xyes" ; then
1886 CPPFLAGS="$CPPFLAGS -I${withval}"
1887 LDFLAGS="$LDFLAGS -L${withval}"
1888 if test ! -z "$need_dash_r" ; then
1889 LDFLAGS="$LDFLAGS -R${withval}"
1891 if test ! -z "$blibpath" ; then
1892 blibpath="$blibpath:${withval}"
1895 AC_CHECK_HEADERS(sectok.h)
1896 if test "$ac_cv_header_sectok_h" != yes; then
1897 AC_MSG_ERROR(Can't find sectok.h)
1899 AC_CHECK_LIB(sectok, sectok_open)
1900 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1901 AC_MSG_ERROR(Can't find libsectok)
1903 AC_DEFINE(SMARTCARD)
1904 AC_DEFINE(USE_SECTOK)
1905 SCARD_MSG="yes, using sectok"
1910 # Check whether user wants OpenSC support
1912 AC_HELP_STRING([--with-opensc=PFX],
1913 [Enable smartcard support using OpenSC]),
1914 opensc_config_prefix="$withval", opensc_config_prefix="")
1915 if test x$opensc_config_prefix != x ; then
1916 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1917 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1918 if test "$OPENSC_CONFIG" != "no"; then
1919 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1920 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1921 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1922 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1923 AC_DEFINE(SMARTCARD)
1924 AC_DEFINE(USE_OPENSC)
1925 SCARD_MSG="yes, using OpenSC"
1929 # Check whether user wants DNS support
1932 [ --with-dns Support for fetching keys from DNS (experimental)],
1934 if test "x$withval" != "xno" ; then
1937 AC_SEARCH_LIBS(getrrsetbyname, resolv,
1938 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1940 # Needed by our getrrsetbyname()
1941 AC_SEARCH_LIBS(res_query, resolv)
1942 AC_SEARCH_LIBS(dn_expand, resolv)
1943 AC_CHECK_FUNCS(_getshort _getlong)
1944 AC_CHECK_MEMBER(HEADER.ad,
1945 [AC_DEFINE(HAVE_HEADER_AD)],,
1946 [#include <arpa/nameser.h>])
1952 # Check whether user wants Kerberos 5 support
1954 AC_ARG_WITH(kerberos5,
1955 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1957 if test "x$withval" != "xno" ; then
1958 if test "x$withval" = "xyes" ; then
1959 KRB5ROOT="/usr/local"
1963 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1964 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1967 AC_MSG_CHECKING(whether we are using Heimdal)
1968 AC_TRY_COMPILE([ #include <krb5.h> ],
1969 [ char *tmp = heimdal_version; ],
1970 [ AC_MSG_RESULT(yes)
1972 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1975 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1978 if test ! -z "$need_dash_r" ; then
1979 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1981 if test ! -z "$blibpath" ; then
1982 blibpath="$blibpath:${KRB5ROOT}/lib"
1984 AC_SEARCH_LIBS(dn_expand, resolv)
1986 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1988 K5LIBS="-lgssapi $K5LIBS" ],
1989 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
1991 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
1992 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
1997 AC_CHECK_HEADER(gssapi.h, ,
1998 [ unset ac_cv_header_gssapi_h
1999 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2000 AC_CHECK_HEADERS(gssapi.h, ,
2001 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2007 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2008 AC_CHECK_HEADER(gssapi_krb5.h, ,
2009 [ CPPFLAGS="$oldCPP" ])
2015 LIBS="$LIBS $K5LIBS"
2017 # Looking for programs, paths and files
2019 PRIVSEP_PATH=/var/empty
2020 AC_ARG_WITH(privsep-path,
2021 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2023 if test "x$withval" != "$no" ; then
2024 PRIVSEP_PATH=$withval
2028 AC_SUBST(PRIVSEP_PATH)
2031 [ --with-xauth=PATH Specify path to xauth program ],
2033 if test "x$withval" != "xno" ; then
2039 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2040 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2041 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2042 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2043 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2044 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2045 xauth_path="/usr/openwin/bin/xauth"
2051 AC_ARG_ENABLE(strip,
2052 [ --disable-strip Disable calling strip(1) on install],
2054 if test "x$enableval" = "xno" ; then
2061 if test -z "$xauth_path" ; then
2062 XAUTH_PATH="undefined"
2063 AC_SUBST(XAUTH_PATH)
2065 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2066 XAUTH_PATH=$xauth_path
2067 AC_SUBST(XAUTH_PATH)
2070 # Check for mail directory (last resort if we cannot get it from headers)
2071 if test ! -z "$MAIL" ; then
2072 maildir=`dirname $MAIL`
2073 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2076 if test -z "$no_dev_ptmx" ; then
2077 if test "x$disable_ptmx_check" != "xyes" ; then
2078 AC_CHECK_FILE("/dev/ptmx",
2080 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2086 AC_CHECK_FILE("/dev/ptc",
2088 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2093 # Options from here on. Some of these are preset by platform above
2094 AC_ARG_WITH(mantype,
2095 [ --with-mantype=man|cat|doc Set man page type],
2102 AC_MSG_ERROR(invalid man type: $withval)
2107 if test -z "$MANTYPE"; then
2108 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2109 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2110 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2112 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2119 if test "$MANTYPE" = "doc"; then
2126 # Check whether to enable MD5 passwords
2128 AC_ARG_WITH(md5-passwords,
2129 [ --with-md5-passwords Enable use of MD5 passwords],
2131 if test "x$withval" != "xno" ; then
2132 AC_DEFINE(HAVE_MD5_PASSWORDS)
2138 # Whether to disable shadow password support
2140 [ --without-shadow Disable shadow password support],
2142 if test "x$withval" = "xno" ; then
2143 AC_DEFINE(DISABLE_SHADOW)
2149 if test -z "$disable_shadow" ; then
2150 AC_MSG_CHECKING([if the systems has expire shadow information])
2153 #include <sys/types.h>
2156 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2157 [ sp_expire_available=yes ], []
2160 if test "x$sp_expire_available" = "xyes" ; then
2162 AC_DEFINE(HAS_SHADOW_EXPIRE)
2168 # Use ip address instead of hostname in $DISPLAY
2169 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2170 DISPLAY_HACK_MSG="yes"
2171 AC_DEFINE(IPADDR_IN_DISPLAY)
2173 DISPLAY_HACK_MSG="no"
2174 AC_ARG_WITH(ipaddr-display,
2175 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2177 if test "x$withval" != "xno" ; then
2178 AC_DEFINE(IPADDR_IN_DISPLAY)
2179 DISPLAY_HACK_MSG="yes"
2185 # check for /etc/default/login and use it if present.
2186 AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2188 if test "x$external_path_file" = "x/etc/default/login"; then
2189 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2192 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2193 if test $ac_cv_func_login_getcapbool = "yes" -a \
2194 $ac_cv_header_login_cap_h = "yes" ; then
2195 external_path_file=/etc/login.conf
2198 # Whether to mess with the default path
2199 SERVER_PATH_MSG="(default)"
2200 AC_ARG_WITH(default-path,
2201 [ --with-default-path= Specify default \$PATH environment for server],
2203 if test "x$external_path_file" = "x/etc/login.conf" ; then
2205 --with-default-path=PATH has no effect on this system.
2206 Edit /etc/login.conf instead.])
2207 elif test "x$withval" != "xno" ; then
2208 if ! test -z "$external_path_file" ; then
2210 --with-default-path=PATH will only be used if PATH is not defined in
2211 $external_path_file .])
2213 user_path="$withval"
2214 SERVER_PATH_MSG="$withval"
2217 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2218 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2220 if ! test -z "$external_path_file" ; then
2222 If PATH is defined in $external_path_file, ensure the path to scp is included,
2223 otherwise scp will not work.])
2227 /* find out what STDPATH is */
2232 #ifndef _PATH_STDPATH
2233 # ifdef _PATH_USERPATH /* Irix */
2234 # define _PATH_STDPATH _PATH_USERPATH
2236 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2239 #include <sys/types.h>
2240 #include <sys/stat.h>
2242 #define DATA "conftest.stdpath"
2249 fd = fopen(DATA,"w");
2253 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2258 ], [ user_path=`cat conftest.stdpath` ],
2259 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2260 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2262 # make sure $bindir is in USER_PATH so scp will work
2263 t_bindir=`eval echo ${bindir}`
2265 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2268 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2270 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2271 if test $? -ne 0 ; then
2272 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2273 if test $? -ne 0 ; then
2274 user_path=$user_path:$t_bindir
2275 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2280 if test "x$external_path_file" != "x/etc/login.conf" ; then
2281 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2285 # Set superuser path separately to user path
2286 AC_ARG_WITH(superuser-path,
2287 [ --with-superuser-path= Specify different path for super-user],
2289 if test "x$withval" != "xno" ; then
2290 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2291 superuser_path=$withval
2297 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2298 IPV4_IN6_HACK_MSG="no"
2300 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2302 if test "x$withval" != "xno" ; then
2304 AC_DEFINE(IPV4_IN_IPV6)
2305 IPV4_IN6_HACK_MSG="yes"
2310 if test "x$inet6_default_4in6" = "xyes"; then
2311 AC_MSG_RESULT([yes (default)])
2312 AC_DEFINE(IPV4_IN_IPV6)
2313 IPV4_IN6_HACK_MSG="yes"
2315 AC_MSG_RESULT([no (default)])
2320 # Whether to enable BSD auth support
2322 AC_ARG_WITH(bsd-auth,
2323 [ --with-bsd-auth Enable BSD auth support],
2325 if test "x$withval" != "xno" ; then
2332 # Where to place sshd.pid
2334 # make sure the directory exists
2335 if test ! -d $piddir ; then
2336 piddir=`eval echo ${sysconfdir}`
2338 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2342 AC_ARG_WITH(pid-dir,
2343 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2345 if test "x$withval" != "xno" ; then
2347 if test ! -d $piddir ; then
2348 AC_MSG_WARN([** no $piddir directory on this system **])
2354 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2357 dnl allow user to disable some login recording features
2358 AC_ARG_ENABLE(lastlog,
2359 [ --disable-lastlog disable use of lastlog even if detected [no]],
2361 if test "x$enableval" = "xno" ; then
2362 AC_DEFINE(DISABLE_LASTLOG)
2367 [ --disable-utmp disable use of utmp even if detected [no]],
2369 if test "x$enableval" = "xno" ; then
2370 AC_DEFINE(DISABLE_UTMP)
2374 AC_ARG_ENABLE(utmpx,
2375 [ --disable-utmpx disable use of utmpx even if detected [no]],
2377 if test "x$enableval" = "xno" ; then
2378 AC_DEFINE(DISABLE_UTMPX)
2383 [ --disable-wtmp disable use of wtmp even if detected [no]],
2385 if test "x$enableval" = "xno" ; then
2386 AC_DEFINE(DISABLE_WTMP)
2390 AC_ARG_ENABLE(wtmpx,
2391 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2393 if test "x$enableval" = "xno" ; then
2394 AC_DEFINE(DISABLE_WTMPX)
2398 AC_ARG_ENABLE(libutil,
2399 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2401 if test "x$enableval" = "xno" ; then
2402 AC_DEFINE(DISABLE_LOGIN)
2406 AC_ARG_ENABLE(pututline,
2407 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2409 if test "x$enableval" = "xno" ; then
2410 AC_DEFINE(DISABLE_PUTUTLINE)
2414 AC_ARG_ENABLE(pututxline,
2415 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2417 if test "x$enableval" = "xno" ; then
2418 AC_DEFINE(DISABLE_PUTUTXLINE)
2422 AC_ARG_WITH(lastlog,
2423 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2425 if test "x$withval" = "xno" ; then
2426 AC_DEFINE(DISABLE_LASTLOG)
2428 conf_lastlog_location=$withval
2433 dnl lastlog, [uw]tmpx? detection
2434 dnl NOTE: set the paths in the platform section to avoid the
2435 dnl need for command-line parameters
2436 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2438 dnl lastlog detection
2439 dnl NOTE: the code itself will detect if lastlog is a directory
2440 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2442 #include <sys/types.h>
2444 #ifdef HAVE_LASTLOG_H
2445 # include <lastlog.h>
2454 [ char *lastlog = LASTLOG_FILE; ],
2455 [ AC_MSG_RESULT(yes) ],
2458 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2460 #include <sys/types.h>
2462 #ifdef HAVE_LASTLOG_H
2463 # include <lastlog.h>
2469 [ char *lastlog = _PATH_LASTLOG; ],
2470 [ AC_MSG_RESULT(yes) ],
2473 system_lastlog_path=no
2478 if test -z "$conf_lastlog_location"; then
2479 if test x"$system_lastlog_path" = x"no" ; then
2480 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2481 if (test -d "$f" || test -f "$f") ; then
2482 conf_lastlog_location=$f
2485 if test -z "$conf_lastlog_location"; then
2486 AC_MSG_WARN([** Cannot find lastlog **])
2487 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2492 if test -n "$conf_lastlog_location"; then
2493 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2497 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2499 #include <sys/types.h>
2505 [ char *utmp = UTMP_FILE; ],
2506 [ AC_MSG_RESULT(yes) ],
2508 system_utmp_path=no ]
2510 if test -z "$conf_utmp_location"; then
2511 if test x"$system_utmp_path" = x"no" ; then
2512 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2513 if test -f $f ; then
2514 conf_utmp_location=$f
2517 if test -z "$conf_utmp_location"; then
2518 AC_DEFINE(DISABLE_UTMP)
2522 if test -n "$conf_utmp_location"; then
2523 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2527 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2529 #include <sys/types.h>
2535 [ char *wtmp = WTMP_FILE; ],
2536 [ AC_MSG_RESULT(yes) ],
2538 system_wtmp_path=no ]
2540 if test -z "$conf_wtmp_location"; then
2541 if test x"$system_wtmp_path" = x"no" ; then
2542 for f in /usr/adm/wtmp /var/log/wtmp; do
2543 if test -f $f ; then
2544 conf_wtmp_location=$f
2547 if test -z "$conf_wtmp_location"; then
2548 AC_DEFINE(DISABLE_WTMP)
2552 if test -n "$conf_wtmp_location"; then
2553 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2557 dnl utmpx detection - I don't know any system so perverse as to require
2558 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2560 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2562 #include <sys/types.h>
2571 [ char *utmpx = UTMPX_FILE; ],
2572 [ AC_MSG_RESULT(yes) ],
2574 system_utmpx_path=no ]
2576 if test -z "$conf_utmpx_location"; then
2577 if test x"$system_utmpx_path" = x"no" ; then
2578 AC_DEFINE(DISABLE_UTMPX)
2581 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2585 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2587 #include <sys/types.h>
2596 [ char *wtmpx = WTMPX_FILE; ],
2597 [ AC_MSG_RESULT(yes) ],
2599 system_wtmpx_path=no ]
2601 if test -z "$conf_wtmpx_location"; then
2602 if test x"$system_wtmpx_path" = x"no" ; then
2603 AC_DEFINE(DISABLE_WTMPX)
2606 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2610 if test ! -z "$blibpath" ; then
2611 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2612 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2615 dnl remove pam and dl because they are in $LIBPAM
2616 if test "$PAM_MSG" = yes ; then
2617 LIBS=`echo $LIBS | sed 's/-lpam //'`
2619 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2620 LIBS=`echo $LIBS | sed 's/-ldl //'`
2624 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2627 # Print summary of options
2629 # Someone please show me a better way :)
2630 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2631 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2632 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2633 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2634 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2635 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2636 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2637 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2638 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2639 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2642 echo "OpenSSH has been configured with the following options:"
2643 echo " User binaries: $B"
2644 echo " System binaries: $C"
2645 echo " Configuration files: $D"
2646 echo " Askpass program: $E"
2647 echo " Manual pages: $F"
2648 echo " PID file: $G"
2649 echo " Privilege separation chroot path: $H"
2650 if test "x$external_path_file" = "x/etc/login.conf" ; then
2651 echo " At runtime, sshd will use the path defined in $external_path_file"
2652 echo " Make sure the path to scp is present, otherwise scp will not work"
2654 echo " sshd default user PATH: $I"
2655 if ! test -z "$external_path_file"; then
2656 echo " (If PATH is set in $external_path_file it will be used instead. If"
2657 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2660 if test ! -z "$superuser_path" ; then
2661 echo " sshd superuser user PATH: $J"
2663 echo " Manpage format: $MANTYPE"
2664 echo " DNS support: $DNS_MSG"
2665 echo " PAM support: $PAM_MSG"
2666 echo " KerberosV support: $KRB5_MSG"
2667 echo " Smartcard support: $SCARD_MSG"
2668 echo " S/KEY support: $SKEY_MSG"
2669 echo " TCP Wrappers support: $TCPW_MSG"
2670 echo " MD5 password support: $MD5_MSG"
2671 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2672 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2673 echo " BSD Auth support: $BSD_AUTH_MSG"
2674 echo " Random number source: $RAND_MSG"
2675 if test ! -z "$USE_RAND_HELPER" ; then
2676 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2681 echo " Host: ${host}"
2682 echo " Compiler: ${CC}"
2683 echo " Compiler flags: ${CFLAGS}"
2684 echo "Preprocessor flags: ${CPPFLAGS}"
2685 echo " Linker flags: ${LDFLAGS}"
2686 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2690 if test "x$PAM_MSG" = "xyes" ; then
2691 echo "PAM is enabled. You may need to install a PAM control file "
2692 echo "for sshd, otherwise password authentication may fail. "
2693 echo "Example PAM control files can be found in the contrib/ "
2698 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2699 echo "WARNING: you are using the builtin random number collection "
2700 echo "service. Please read WARNING.RNG and request that your OS "
2701 echo "vendor includes kernel-based random number collection in "
2702 echo "future versions of your OS."