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_DEFINE(SETEUID_BREAKS_SETUID)
135 AC_DEFINE(BROKEN_SETREUID)
136 AC_DEFINE(BROKEN_SETREGID)
137 [AC_MSG_RESULT(assume it is working)])
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_SHADOW)
150 AC_DEFINE(DISABLE_UTMP)
151 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
152 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
153 LIBS="$LIBS -lsec -lsecpw"
154 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
155 disable_ptmx_check=yes
158 if test -z "$GCC"; then
161 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
162 IPADDR_IN_DISPLAY=yes
164 AC_DEFINE(LOGIN_NO_ENDOPT)
165 AC_DEFINE(LOGIN_NEEDS_UTMPX)
166 AC_DEFINE(DISABLE_SHADOW)
167 AC_DEFINE(DISABLE_UTMP)
168 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
169 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
171 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
174 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
175 IPADDR_IN_DISPLAY=yes
176 AC_DEFINE(PAM_SUN_CODEBASE)
178 AC_DEFINE(LOGIN_NO_ENDOPT)
179 AC_DEFINE(LOGIN_NEEDS_UTMPX)
180 AC_DEFINE(DISABLE_SHADOW)
181 AC_DEFINE(DISABLE_UTMP)
182 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
183 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
185 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
188 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
190 PATH="$PATH:/usr/etc"
191 AC_DEFINE(BROKEN_INET_NTOA)
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(WITH_ABBREV_NO_TTY)
205 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
209 check_for_libcrypt_later=1
210 check_for_openpty_ctty_bug=1
211 AC_DEFINE(DONT_TRY_OTHER_AF)
212 AC_DEFINE(PAM_TTY_KLUDGE)
213 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
214 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
215 inet6_default_4in6=yes
218 AC_DEFINE(BROKEN_CMSG_TYPE)
222 mips-sony-bsd|mips-sony-newsos4)
223 AC_DEFINE(HAVE_NEWS4)
227 check_for_libcrypt_before=1
231 check_for_libcrypt_later=1
234 AC_DEFINE(SETEUID_BREAKS_SETUID)
235 AC_DEFINE(BROKEN_SETREUID)
236 AC_DEFINE(BROKEN_SETREGID)
239 conf_lastlog_location="/usr/adm/lastlog"
240 conf_utmp_location=/etc/utmp
241 conf_wtmp_location=/usr/adm/wtmp
244 AC_DEFINE(BROKEN_REALPATH)
246 AC_DEFINE(BROKEN_SAVED_UIDS)
247 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
251 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
252 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
254 AC_DEFINE(PAM_SUN_CODEBASE)
255 AC_DEFINE(LOGIN_NEEDS_UTMPX)
256 AC_DEFINE(LOGIN_NEEDS_TERM)
257 AC_DEFINE(PAM_TTY_KLUDGE)
258 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
259 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
260 AC_DEFINE(SSHD_ACQUIRES_CTTY)
261 external_path_file=/etc/default/login
262 # hardwire lastlog location (can't detect it on some versions)
263 conf_lastlog_location="/var/adm/lastlog"
264 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
265 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
266 if test "$sol2ver" -ge 8; then
268 AC_DEFINE(DISABLE_UTMP)
269 AC_DEFINE(DISABLE_WTMP)
275 CPPFLAGS="$CPPFLAGS -DSUNOS4"
276 AC_CHECK_FUNCS(getpwanam)
277 AC_DEFINE(PAM_SUN_CODEBASE)
278 conf_utmp_location=/etc/utmp
279 conf_wtmp_location=/var/adm/wtmp
280 conf_lastlog_location=/var/adm/lastlog
284 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
285 LDFLAGS="$LDFLAGS -L/usr/local/lib"
288 AC_DEFINE(SSHD_ACQUIRES_CTTY)
291 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
292 # /usr/ucblib MUST NOT be searched on ReliantUNIX
293 LDFLAGS="$LDFLAGS -L/usr/local/lib"
294 IPADDR_IN_DISPLAY=yes
296 AC_DEFINE(IP_TOS_IS_BROKEN)
297 AC_DEFINE(SSHD_ACQUIRES_CTTY)
298 external_path_file=/etc/default/login
299 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
300 # Attention: always take care to bind libsocket and libnsl before libc,
301 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
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"
315 AC_DEFINE(SETEUID_BREAKS_SETUID)
316 AC_DEFINE(BROKEN_SETREUID)
317 AC_DEFINE(BROKEN_SETREGID)
320 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
321 LDFLAGS="$LDFLAGS -L/usr/local/lib"
324 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
325 LDFLAGS="$LDFLAGS -L/usr/local/lib"
326 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
329 AC_DEFINE(BROKEN_SYS_TERMIO_H)
331 AC_DEFINE(HAVE_SECUREWARE)
332 AC_DEFINE(DISABLE_SHADOW)
333 AC_DEFINE(BROKEN_SAVED_UIDS)
334 AC_DEFINE(WITH_ABBREV_NO_TTY)
335 AC_CHECK_FUNCS(getluid setluid)
337 do_sco3_extra_lib_check=yes
340 if test -z "$GCC"; then
341 CFLAGS="$CFLAGS -belf"
343 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
344 LDFLAGS="$LDFLAGS -L/usr/local/lib"
345 LIBS="$LIBS -lprot -lx -ltinfo -lm"
348 AC_DEFINE(HAVE_SECUREWARE)
349 AC_DEFINE(DISABLE_SHADOW)
350 AC_DEFINE(DISABLE_FD_PASSING)
351 AC_DEFINE(SETEUID_BREAKS_SETUID)
352 AC_DEFINE(BROKEN_SETREUID)
353 AC_DEFINE(BROKEN_SETREGID)
354 AC_DEFINE(WITH_ABBREV_NO_TTY)
355 AC_CHECK_FUNCS(getluid setluid)
360 AC_DEFINE(DISABLE_FD_PASSING)
362 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
366 AC_DEFINE(WITH_ABBREV_NO_TTY)
368 AC_DEFINE(DISABLE_FD_PASSING)
370 LIBS="$LIBS -lgen -lacid"
375 AC_DEFINE(DISABLE_FD_PASSING)
376 AC_DEFINE(NO_SSH_LASTLOG)
377 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
378 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
382 AC_MSG_CHECKING(for Digital Unix SIA)
385 [ --with-osfsia Enable Digital Unix SIA],
387 if test "x$withval" = "xno" ; then
388 AC_MSG_RESULT(disabled)
393 if test -z "$no_osfsia" ; then
394 if test -f /etc/sia/matrix.conf; then
396 AC_DEFINE(HAVE_OSF_SIA)
397 AC_DEFINE(DISABLE_LOGIN)
398 AC_DEFINE(DISABLE_FD_PASSING)
399 LIBS="$LIBS -lsecurity -ldb -lm -laud"
404 AC_DEFINE(DISABLE_FD_PASSING)
405 AC_DEFINE(BROKEN_GETADDRINFO)
406 AC_DEFINE(SETEIUD_BREAKS_SETUID)
407 AC_DEFINE(BROKEN_SETREUID)
408 AC_DEFINE(BROKEN_SETREGID)
409 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
414 AC_DEFINE(NO_X11_UNIX_SOCKETS)
415 AC_DEFINE(MISSING_NFDBITS)
416 AC_DEFINE(MISSING_HOWMANY)
417 AC_DEFINE(MISSING_FD_MASK)
421 # Allow user to specify flags
423 [ --with-cflags Specify additional flags to pass to compiler],
425 if test "x$withval" != "xno" ; then
426 CFLAGS="$CFLAGS $withval"
430 AC_ARG_WITH(cppflags,
431 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
433 if test "x$withval" != "xno"; then
434 CPPFLAGS="$CPPFLAGS $withval"
439 [ --with-ldflags Specify additional flags to pass to linker],
441 if test "x$withval" != "xno" ; then
442 LDFLAGS="$LDFLAGS $withval"
447 [ --with-libs Specify additional libraries to link with],
449 if test "x$withval" != "xno" ; then
450 LIBS="$LIBS $withval"
455 AC_MSG_CHECKING(compiler and flags for sanity)
460 [ AC_MSG_RESULT(yes) ],
463 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
467 # Checks for header files.
468 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
469 getopt.h glob.h ia.h lastlog.h limits.h login.h \
470 login_cap.h maillock.h netdb.h netgroup.h \
471 netinet/in_systm.h paths.h pty.h readpassphrase.h \
472 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
473 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
474 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
475 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
476 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
477 util.h utime.h utmp.h utmpx.h)
479 # Checks for libraries.
480 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
481 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
483 dnl SCO OS3 needs this for libwrap
484 if test "x$with_tcp_wrappers" != "xno" ; then
485 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
486 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
490 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
491 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
492 AC_CHECK_LIB(gen, dirname,[
493 AC_CACHE_CHECK([for broken dirname],
494 ac_cv_have_broken_dirname, [
502 int main(int argc, char **argv) {
505 strncpy(buf,"/etc", 32);
507 if (!s || strncmp(s, "/", 32) != 0) {
514 [ ac_cv_have_broken_dirname="no" ],
515 [ ac_cv_have_broken_dirname="yes" ]
519 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
521 AC_DEFINE(HAVE_DIRNAME)
522 AC_CHECK_HEADERS(libgen.h)
527 AC_CHECK_FUNC(getspnam, ,
528 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
529 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
532 [ --without-rpath Disable auto-added -R linker paths],
534 if test "x$withval" = "xno" ; then
537 if test "x$withval" = "xyes" ; then
545 [ --with-zlib=PATH Use zlib in PATH],
547 if test "x$withval" = "xno" ; then
548 AC_MSG_ERROR([*** zlib is required ***])
550 if test -d "$withval/lib"; then
551 if test -n "${need_dash_r}"; then
552 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
554 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
557 if test -n "${need_dash_r}"; then
558 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
560 LDFLAGS="-L${withval} ${LDFLAGS}"
563 if test -d "$withval/include"; then
564 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
566 CPPFLAGS="-I${withval} ${CPPFLAGS}"
571 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
574 AC_CHECK_FUNC(strcasecmp,
575 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
577 AC_CHECK_FUNC(utimes,
578 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
579 LIBS="$LIBS -lc89"]) ]
582 dnl Checks for libutil functions
583 AC_CHECK_HEADERS(libutil.h)
584 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
585 AC_CHECK_FUNCS(logout updwtmp logwtmp)
589 # Check for ALTDIRFUNC glob() extension
590 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
591 AC_EGREP_CPP(FOUNDIT,
594 #ifdef GLOB_ALTDIRFUNC
599 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
607 # Check for g.gl_matchc glob() extension
608 AC_MSG_CHECKING(for gl_matchc field in glob_t)
609 AC_EGREP_CPP(FOUNDIT,
612 int main(void){glob_t g; g.gl_matchc = 1;}
615 AC_DEFINE(GLOB_HAS_GL_MATCHC)
623 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
626 #include <sys/types.h>
628 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
630 [AC_MSG_RESULT(yes)],
633 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
637 # Check whether user wants S/Key support
640 [ --with-skey[[=PATH]] Enable S/Key support
641 (optionally in PATH)],
643 if test "x$withval" != "xno" ; then
645 if test "x$withval" != "xyes" ; then
646 CPPFLAGS="$CPPFLAGS -I${withval}/include"
647 LDFLAGS="$LDFLAGS -L${withval}/lib"
654 AC_MSG_CHECKING([for s/key support])
659 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
661 [AC_MSG_RESULT(yes)],
664 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
670 # Check whether user wants TCP wrappers support
672 AC_ARG_WITH(tcp-wrappers,
673 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
674 (optionally in PATH)],
676 if test "x$withval" != "xno" ; then
678 saved_LDFLAGS="$LDFLAGS"
679 saved_CPPFLAGS="$CPPFLAGS"
680 if test -n "${withval}" -a "${withval}" != "yes"; then
681 if test -d "${withval}/lib"; then
682 if test -n "${need_dash_r}"; then
683 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
685 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
688 if test -n "${need_dash_r}"; then
689 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
691 LDFLAGS="-L${withval} ${LDFLAGS}"
694 if test -d "${withval}/include"; then
695 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
697 CPPFLAGS="-I${withval} ${CPPFLAGS}"
701 LIBS="$LIBWRAP $LIBS"
702 AC_MSG_CHECKING(for libwrap)
706 int deny_severity = 0, allow_severity = 0;
716 AC_MSG_ERROR([*** libwrap missing])
724 dnl Checks for library functions. Please keep in alphabetical order
726 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
727 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
728 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
729 getpeereid _getpty getrlimit getttyent glob inet_aton \
730 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
731 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
732 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
733 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
734 setproctitle setregid setresgid setresuid setreuid setrlimit \
735 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
736 strlcat strlcpy strmode strnvis sysconf tcgetpgrp \
737 truncate utimes vhangup vsnprintf waitpid \
740 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
742 dnl Make sure prototypes are defined for these before using them.
743 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
744 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
746 dnl tcsendbreak might be a macro
747 AC_CHECK_DECL(tcsendbreak,
748 [AC_DEFINE(HAVE_TCSENDBREAK)],
749 [AC_CHECK_FUNCS(tcsendbreak)],
750 [#include <termios.h>]
753 dnl Checks for time functions
754 AC_CHECK_FUNCS(gettimeofday time)
755 dnl Checks for utmp functions
756 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
757 AC_CHECK_FUNCS(utmpname)
758 dnl Checks for utmpx functions
759 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
760 AC_CHECK_FUNCS(setutxent utmpxname)
762 AC_CHECK_FUNC(daemon,
763 [AC_DEFINE(HAVE_DAEMON)],
764 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
767 AC_CHECK_FUNC(getpagesize,
768 [AC_DEFINE(HAVE_GETPAGESIZE)],
769 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
772 # Check for broken snprintf
773 if test "x$ac_cv_func_snprintf" = "xyes" ; then
774 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
778 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
780 [AC_MSG_RESULT(yes)],
783 AC_DEFINE(BROKEN_SNPRINTF)
784 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
789 dnl see whether mkstemp() requires XXXXXX
790 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
791 AC_MSG_CHECKING([for (overly) strict mkstemp])
795 main() { char template[]="conftest.mkstemp-test";
796 if (mkstemp(template) == -1)
798 unlink(template); exit(0);
806 AC_DEFINE(HAVE_STRICT_MKSTEMP)
810 AC_DEFINE(HAVE_STRICT_MKSTEMP)
815 dnl make sure that openpty does not reacquire controlling terminal
816 if test ! -z "$check_for_openpty_ctty_bug"; then
817 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
821 #include <sys/fcntl.h>
822 #include <sys/types.h>
823 #include <sys/wait.h>
829 int fd, ptyfd, ttyfd, status;
832 if (pid < 0) { /* failed */
834 } else if (pid > 0) { /* parent */
835 waitpid(pid, &status, 0);
836 if (WIFEXITED(status))
837 exit(WEXITSTATUS(status));
841 close(0); close(1); close(2);
843 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
844 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
846 exit(3); /* Acquired ctty: broken */
848 exit(0); /* Did not acquire ctty: OK */
857 AC_DEFINE(SSHD_ACQUIRES_CTTY)
867 [ --with-pam Enable PAM support ],
869 if test "x$withval" != "xno" ; then
870 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
871 AC_MSG_ERROR([PAM headers not found])
874 AC_CHECK_LIB(dl, dlopen, , )
875 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
876 AC_CHECK_FUNCS(pam_getenvlist)
877 AC_CHECK_FUNCS(pam_putenv)
883 if test $ac_cv_lib_dl_dlopen = yes; then
893 # Check for older PAM
894 if test "x$PAM_MSG" = "xyes" ; then
895 # Check PAM strerror arguments (old PAM)
896 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
900 #include <security/pam_appl.h>
902 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
905 AC_DEFINE(HAVE_OLD_PAM)
907 PAM_MSG="yes (old library)"
912 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
913 # because the system crypt() is more featureful.
914 if test "x$check_for_libcrypt_before" = "x1"; then
915 AC_CHECK_LIB(crypt, crypt)
919 saved_CPPFLAGS="$CPPFLAGS"
920 saved_LDFLAGS="$LDFLAGS"
922 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
924 if test "x$withval" != "xno" ; then
925 if test -d "$withval/lib"; then
926 if test -n "${need_dash_r}"; then
927 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
929 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
932 if test -n "${need_dash_r}"; then
933 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
935 LDFLAGS="-L${withval} ${LDFLAGS}"
938 if test -d "$withval/include"; then
939 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
941 CPPFLAGS="-I${withval} ${CPPFLAGS}"
946 LIBS="$LIBS -lcrypto"
947 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
949 dnl Check default openssl install dir
950 if test -n "${need_dash_r}"; then
951 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
953 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
955 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
956 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
958 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
964 # Determine OpenSSL header version
965 AC_MSG_CHECKING([OpenSSL header version])
970 #include <openssl/opensslv.h>
971 #define DATA "conftest.sslincver"
976 fd = fopen(DATA,"w");
980 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
987 ssl_header_ver=`cat conftest.sslincver`
988 AC_MSG_RESULT($ssl_header_ver)
991 AC_MSG_RESULT(not found)
992 AC_MSG_ERROR(OpenSSL version header not found.)
996 # Determine OpenSSL library version
997 AC_MSG_CHECKING([OpenSSL library version])
1002 #include <openssl/opensslv.h>
1003 #include <openssl/crypto.h>
1004 #define DATA "conftest.ssllibver"
1009 fd = fopen(DATA,"w");
1013 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1020 ssl_library_ver=`cat conftest.ssllibver`
1021 AC_MSG_RESULT($ssl_library_ver)
1024 AC_MSG_RESULT(not found)
1025 AC_MSG_ERROR(OpenSSL library not found.)
1029 # Sanity check OpenSSL headers
1030 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1034 #include <openssl/opensslv.h>
1035 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1042 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1043 Check config.log for details.
1044 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1048 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1049 # version in OpenSSL. Skip this for PAM
1050 if test "x$check_for_libcrypt_later" = "x1"; then
1051 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1055 ### Configure cryptographic random number support
1057 # Check wheter OpenSSL seeds itself
1058 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1062 #include <openssl/rand.h>
1063 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1066 OPENSSL_SEEDS_ITSELF=yes
1071 # Default to use of the rand helper if OpenSSL doesn't
1078 # Do we want to force the use of the rand helper?
1079 AC_ARG_WITH(rand-helper,
1080 [ --with-rand-helper Use subprocess to gather strong randomness ],
1082 if test "x$withval" = "xno" ; then
1083 # Force use of OpenSSL's internal RNG, even if
1084 # the previous test showed it to be unseeded.
1085 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1086 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1087 OPENSSL_SEEDS_ITSELF=yes
1096 # Which randomness source do we use?
1097 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1099 AC_DEFINE(OPENSSL_PRNG_ONLY)
1100 RAND_MSG="OpenSSL internal ONLY"
1101 INSTALL_SSH_RAND_HELPER=""
1102 elif test ! -z "$USE_RAND_HELPER" ; then
1103 # install rand helper
1104 RAND_MSG="ssh-rand-helper"
1105 INSTALL_SSH_RAND_HELPER="yes"
1107 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1109 ### Configuration of ssh-rand-helper
1112 AC_ARG_WITH(prngd-port,
1113 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1122 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1125 if test ! -z "$withval" ; then
1126 PRNGD_PORT="$withval"
1127 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1132 # PRNGD Unix domain socket
1133 AC_ARG_WITH(prngd-socket,
1134 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1138 withval="/var/run/egd-pool"
1146 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1150 if test ! -z "$withval" ; then
1151 if test ! -z "$PRNGD_PORT" ; then
1152 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1154 if test ! -r "$withval" ; then
1155 AC_MSG_WARN(Entropy socket is not readable)
1157 PRNGD_SOCKET="$withval"
1158 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1162 # Check for existing socket only if we don't have a random device already
1163 if test "$USE_RAND_HELPER" = yes ; then
1164 AC_MSG_CHECKING(for PRNGD/EGD socket)
1165 # Insert other locations here
1166 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1167 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1168 PRNGD_SOCKET="$sock"
1169 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1173 if test ! -z "$PRNGD_SOCKET" ; then
1174 AC_MSG_RESULT($PRNGD_SOCKET)
1176 AC_MSG_RESULT(not found)
1182 # Change default command timeout for hashing entropy source
1184 AC_ARG_WITH(entropy-timeout,
1185 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1187 if test "x$withval" != "xno" ; then
1188 entropy_timeout=$withval
1192 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1194 SSH_PRIVSEP_USER=sshd
1195 AC_ARG_WITH(privsep-user,
1196 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1198 if test -n "$withval"; then
1199 SSH_PRIVSEP_USER=$withval
1203 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1204 AC_SUBST(SSH_PRIVSEP_USER)
1206 # We do this little dance with the search path to insure
1207 # that programs that we select for use by installed programs
1208 # (which may be run by the super-user) come from trusted
1209 # locations before they come from the user's private area.
1210 # This should help avoid accidentally configuring some
1211 # random version of a program in someone's personal bin.
1215 test -h /bin 2> /dev/null && PATH=/usr/bin
1216 test -d /sbin && PATH=$PATH:/sbin
1217 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1218 PATH=$PATH:/etc:$OPATH
1220 # These programs are used by the command hashing source to gather entropy
1221 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1222 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1223 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1224 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1225 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1226 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1227 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1228 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1229 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1230 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1231 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1232 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1233 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1234 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1235 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1236 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1240 # Where does ssh-rand-helper get its randomness from?
1241 INSTALL_SSH_PRNG_CMDS=""
1242 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1243 if test ! -z "$PRNGD_PORT" ; then
1244 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1245 elif test ! -z "$PRNGD_SOCKET" ; then
1246 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1248 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1249 RAND_HELPER_CMDHASH=yes
1250 INSTALL_SSH_PRNG_CMDS="yes"
1253 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1256 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1257 if test ! -z "$SONY" ; then
1258 LIBS="$LIBS -liberty";
1261 # Checks for data types
1262 AC_CHECK_SIZEOF(char, 1)
1263 AC_CHECK_SIZEOF(short int, 2)
1264 AC_CHECK_SIZEOF(int, 4)
1265 AC_CHECK_SIZEOF(long int, 4)
1266 AC_CHECK_SIZEOF(long long int, 8)
1268 # Sanity check long long for some platforms (AIX)
1269 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1270 ac_cv_sizeof_long_long_int=0
1273 # More checks for data types
1274 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1276 [ #include <sys/types.h> ],
1278 [ ac_cv_have_u_int="yes" ],
1279 [ ac_cv_have_u_int="no" ]
1282 if test "x$ac_cv_have_u_int" = "xyes" ; then
1283 AC_DEFINE(HAVE_U_INT)
1287 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1289 [ #include <sys/types.h> ],
1290 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1291 [ ac_cv_have_intxx_t="yes" ],
1292 [ ac_cv_have_intxx_t="no" ]
1295 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1296 AC_DEFINE(HAVE_INTXX_T)
1300 if (test -z "$have_intxx_t" && \
1301 test "x$ac_cv_header_stdint_h" = "xyes")
1303 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1305 [ #include <stdint.h> ],
1306 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1308 AC_DEFINE(HAVE_INTXX_T)
1311 [ AC_MSG_RESULT(no) ]
1315 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1318 #include <sys/types.h>
1319 #ifdef HAVE_STDINT_H
1320 # include <stdint.h>
1322 #include <sys/socket.h>
1323 #ifdef HAVE_SYS_BITYPES_H
1324 # include <sys/bitypes.h>
1327 [ int64_t a; a = 1;],
1328 [ ac_cv_have_int64_t="yes" ],
1329 [ ac_cv_have_int64_t="no" ]
1332 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1333 AC_DEFINE(HAVE_INT64_T)
1336 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1338 [ #include <sys/types.h> ],
1339 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1340 [ ac_cv_have_u_intxx_t="yes" ],
1341 [ ac_cv_have_u_intxx_t="no" ]
1344 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1345 AC_DEFINE(HAVE_U_INTXX_T)
1349 if test -z "$have_u_intxx_t" ; then
1350 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1352 [ #include <sys/socket.h> ],
1353 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1355 AC_DEFINE(HAVE_U_INTXX_T)
1358 [ AC_MSG_RESULT(no) ]
1362 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1364 [ #include <sys/types.h> ],
1365 [ u_int64_t a; a = 1;],
1366 [ ac_cv_have_u_int64_t="yes" ],
1367 [ ac_cv_have_u_int64_t="no" ]
1370 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1371 AC_DEFINE(HAVE_U_INT64_T)
1375 if test -z "$have_u_int64_t" ; then
1376 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1378 [ #include <sys/bitypes.h> ],
1379 [ u_int64_t a; a = 1],
1381 AC_DEFINE(HAVE_U_INT64_T)
1384 [ AC_MSG_RESULT(no) ]
1388 if test -z "$have_u_intxx_t" ; then
1389 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1392 #include <sys/types.h>
1394 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1395 [ ac_cv_have_uintxx_t="yes" ],
1396 [ ac_cv_have_uintxx_t="no" ]
1399 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1400 AC_DEFINE(HAVE_UINTXX_T)
1404 if test -z "$have_uintxx_t" ; then
1405 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1407 [ #include <stdint.h> ],
1408 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1410 AC_DEFINE(HAVE_UINTXX_T)
1413 [ AC_MSG_RESULT(no) ]
1417 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1418 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1420 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1423 #include <sys/bitypes.h>
1426 int8_t a; int16_t b; int32_t c;
1427 u_int8_t e; u_int16_t f; u_int32_t g;
1428 a = b = c = e = f = g = 1;
1431 AC_DEFINE(HAVE_U_INTXX_T)
1432 AC_DEFINE(HAVE_INTXX_T)
1440 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1443 #include <sys/types.h>
1445 [ u_char foo; foo = 125; ],
1446 [ ac_cv_have_u_char="yes" ],
1447 [ ac_cv_have_u_char="no" ]
1450 if test "x$ac_cv_have_u_char" = "xyes" ; then
1451 AC_DEFINE(HAVE_U_CHAR)
1456 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1458 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1461 #include <sys/types.h>
1463 [ size_t foo; foo = 1235; ],
1464 [ ac_cv_have_size_t="yes" ],
1465 [ ac_cv_have_size_t="no" ]
1468 if test "x$ac_cv_have_size_t" = "xyes" ; then
1469 AC_DEFINE(HAVE_SIZE_T)
1472 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1475 #include <sys/types.h>
1477 [ ssize_t foo; foo = 1235; ],
1478 [ ac_cv_have_ssize_t="yes" ],
1479 [ ac_cv_have_ssize_t="no" ]
1482 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1483 AC_DEFINE(HAVE_SSIZE_T)
1486 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1491 [ clock_t foo; foo = 1235; ],
1492 [ ac_cv_have_clock_t="yes" ],
1493 [ ac_cv_have_clock_t="no" ]
1496 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1497 AC_DEFINE(HAVE_CLOCK_T)
1500 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1503 #include <sys/types.h>
1504 #include <sys/socket.h>
1506 [ sa_family_t foo; foo = 1235; ],
1507 [ ac_cv_have_sa_family_t="yes" ],
1510 #include <sys/types.h>
1511 #include <sys/socket.h>
1512 #include <netinet/in.h>
1514 [ sa_family_t foo; foo = 1235; ],
1515 [ ac_cv_have_sa_family_t="yes" ],
1517 [ ac_cv_have_sa_family_t="no" ]
1521 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1522 AC_DEFINE(HAVE_SA_FAMILY_T)
1525 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1528 #include <sys/types.h>
1530 [ pid_t foo; foo = 1235; ],
1531 [ ac_cv_have_pid_t="yes" ],
1532 [ ac_cv_have_pid_t="no" ]
1535 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1536 AC_DEFINE(HAVE_PID_T)
1539 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1542 #include <sys/types.h>
1544 [ mode_t foo; foo = 1235; ],
1545 [ ac_cv_have_mode_t="yes" ],
1546 [ ac_cv_have_mode_t="no" ]
1549 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1550 AC_DEFINE(HAVE_MODE_T)
1554 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1557 #include <sys/types.h>
1558 #include <sys/socket.h>
1560 [ struct sockaddr_storage s; ],
1561 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1562 [ ac_cv_have_struct_sockaddr_storage="no" ]
1565 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1566 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1569 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1572 #include <sys/types.h>
1573 #include <netinet/in.h>
1575 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1576 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1577 [ ac_cv_have_struct_sockaddr_in6="no" ]
1580 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1581 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1584 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1587 #include <sys/types.h>
1588 #include <netinet/in.h>
1590 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1591 [ ac_cv_have_struct_in6_addr="yes" ],
1592 [ ac_cv_have_struct_in6_addr="no" ]
1595 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1596 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1599 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1602 #include <sys/types.h>
1603 #include <sys/socket.h>
1606 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1607 [ ac_cv_have_struct_addrinfo="yes" ],
1608 [ ac_cv_have_struct_addrinfo="no" ]
1611 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1612 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1615 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1617 [ #include <sys/time.h> ],
1618 [ struct timeval tv; tv.tv_sec = 1;],
1619 [ ac_cv_have_struct_timeval="yes" ],
1620 [ ac_cv_have_struct_timeval="no" ]
1623 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1624 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1625 have_struct_timeval=1
1628 AC_CHECK_TYPES(struct timespec)
1630 # We need int64_t or else certian parts of the compile will fail.
1631 if test "x$ac_cv_have_int64_t" = "xno" -a \
1632 "x$ac_cv_sizeof_long_int" != "x8" -a \
1633 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1634 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1635 echo "an alternative compiler (I.E., GCC) before continuing."
1639 dnl test snprintf (broken on SCO w/gcc)
1644 #ifdef HAVE_SNPRINTF
1648 char expected_out[50];
1650 #if (SIZEOF_LONG_INT == 8)
1651 long int num = 0x7fffffffffffffff;
1653 long long num = 0x7fffffffffffffffll;
1655 strcpy(expected_out, "9223372036854775807");
1656 snprintf(buf, mazsize, "%lld", num);
1657 if(strcmp(buf, expected_out) != 0)
1664 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1668 dnl Checks for structure members
1669 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1670 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1671 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1672 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1673 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1674 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1675 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1676 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1677 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1678 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1679 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1680 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1681 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1682 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1683 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1684 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1685 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1687 AC_CHECK_MEMBERS([struct stat.st_blksize])
1689 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1690 ac_cv_have_ss_family_in_struct_ss, [
1693 #include <sys/types.h>
1694 #include <sys/socket.h>
1696 [ struct sockaddr_storage s; s.ss_family = 1; ],
1697 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1698 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1701 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1702 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1705 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1706 ac_cv_have___ss_family_in_struct_ss, [
1709 #include <sys/types.h>
1710 #include <sys/socket.h>
1712 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1713 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1714 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1717 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1718 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1721 AC_CACHE_CHECK([for pw_class field in struct passwd],
1722 ac_cv_have_pw_class_in_struct_passwd, [
1727 [ struct passwd p; p.pw_class = 0; ],
1728 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1729 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1732 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1733 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1736 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1737 ac_cv_have_pw_expire_in_struct_passwd, [
1742 [ struct passwd p; p.pw_expire = 0; ],
1743 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1744 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1747 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1748 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1751 AC_CACHE_CHECK([for pw_change field in struct passwd],
1752 ac_cv_have_pw_change_in_struct_passwd, [
1757 [ struct passwd p; p.pw_change = 0; ],
1758 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1759 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1762 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1763 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1766 dnl make sure we're using the real structure members and not defines
1767 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1768 ac_cv_have_accrights_in_msghdr, [
1771 #include <sys/types.h>
1772 #include <sys/socket.h>
1773 #include <sys/uio.h>
1775 #ifdef msg_accrights
1779 m.msg_accrights = 0;
1783 [ ac_cv_have_accrights_in_msghdr="yes" ],
1784 [ ac_cv_have_accrights_in_msghdr="no" ]
1787 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1788 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1791 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1792 ac_cv_have_control_in_msghdr, [
1795 #include <sys/types.h>
1796 #include <sys/socket.h>
1797 #include <sys/uio.h>
1807 [ ac_cv_have_control_in_msghdr="yes" ],
1808 [ ac_cv_have_control_in_msghdr="no" ]
1811 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1812 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1815 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1817 [ extern char *__progname; printf("%s", __progname); ],
1818 [ ac_cv_libc_defines___progname="yes" ],
1819 [ ac_cv_libc_defines___progname="no" ]
1822 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1823 AC_DEFINE(HAVE___PROGNAME)
1826 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1830 [ printf("%s", __FUNCTION__); ],
1831 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1832 [ ac_cv_cc_implements___FUNCTION__="no" ]
1835 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1836 AC_DEFINE(HAVE___FUNCTION__)
1839 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1843 [ printf("%s", __func__); ],
1844 [ ac_cv_cc_implements___func__="yes" ],
1845 [ ac_cv_cc_implements___func__="no" ]
1848 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1849 AC_DEFINE(HAVE___func__)
1852 AC_CACHE_CHECK([whether getopt has optreset support],
1853 ac_cv_have_getopt_optreset, [
1858 [ extern int optreset; optreset = 0; ],
1859 [ ac_cv_have_getopt_optreset="yes" ],
1860 [ ac_cv_have_getopt_optreset="no" ]
1863 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1864 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1867 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1869 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1870 [ ac_cv_libc_defines_sys_errlist="yes" ],
1871 [ ac_cv_libc_defines_sys_errlist="no" ]
1874 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1875 AC_DEFINE(HAVE_SYS_ERRLIST)
1879 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1881 [ extern int sys_nerr; printf("%i", sys_nerr);],
1882 [ ac_cv_libc_defines_sys_nerr="yes" ],
1883 [ ac_cv_libc_defines_sys_nerr="no" ]
1886 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1887 AC_DEFINE(HAVE_SYS_NERR)
1891 # Check whether user wants sectok support
1893 [ --with-sectok Enable smartcard support using libsectok],
1895 if test "x$withval" != "xno" ; then
1896 if test "x$withval" != "xyes" ; then
1897 CPPFLAGS="$CPPFLAGS -I${withval}"
1898 LDFLAGS="$LDFLAGS -L${withval}"
1899 if test ! -z "$need_dash_r" ; then
1900 LDFLAGS="$LDFLAGS -R${withval}"
1902 if test ! -z "$blibpath" ; then
1903 blibpath="$blibpath:${withval}"
1906 AC_CHECK_HEADERS(sectok.h)
1907 if test "$ac_cv_header_sectok_h" != yes; then
1908 AC_MSG_ERROR(Can't find sectok.h)
1910 AC_CHECK_LIB(sectok, sectok_open)
1911 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1912 AC_MSG_ERROR(Can't find libsectok)
1914 AC_DEFINE(SMARTCARD)
1915 AC_DEFINE(USE_SECTOK)
1916 SCARD_MSG="yes, using sectok"
1921 # Check whether user wants OpenSC support
1923 AC_HELP_STRING([--with-opensc=PFX],
1924 [Enable smartcard support using OpenSC]),
1925 opensc_config_prefix="$withval", opensc_config_prefix="")
1926 if test x$opensc_config_prefix != x ; then
1927 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1928 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1929 if test "$OPENSC_CONFIG" != "no"; then
1930 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1931 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1932 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1933 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1934 AC_DEFINE(SMARTCARD)
1935 AC_DEFINE(USE_OPENSC)
1936 SCARD_MSG="yes, using OpenSC"
1940 # Check whether user wants DNS support
1943 [ --with-dns Support for fetching keys from DNS (experimental)],
1945 if test "x$withval" != "xno" ; then
1948 AC_SEARCH_LIBS(getrrsetbyname, resolv,
1949 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1951 # Needed by our getrrsetbyname()
1952 AC_SEARCH_LIBS(res_query, resolv)
1953 AC_SEARCH_LIBS(dn_expand, resolv)
1954 AC_CHECK_FUNCS(_getshort _getlong)
1955 AC_CHECK_MEMBER(HEADER.ad,
1956 [AC_DEFINE(HAVE_HEADER_AD)],,
1957 [#include <arpa/nameser.h>])
1963 # Check whether user wants Kerberos 5 support
1965 AC_ARG_WITH(kerberos5,
1966 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1968 if test "x$withval" != "xno" ; then
1969 if test "x$withval" = "xyes" ; then
1970 KRB5ROOT="/usr/local"
1974 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1975 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1978 AC_MSG_CHECKING(whether we are using Heimdal)
1979 AC_TRY_COMPILE([ #include <krb5.h> ],
1980 [ char *tmp = heimdal_version; ],
1981 [ AC_MSG_RESULT(yes)
1983 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1986 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1989 if test ! -z "$need_dash_r" ; then
1990 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1992 if test ! -z "$blibpath" ; then
1993 blibpath="$blibpath:${KRB5ROOT}/lib"
1995 AC_SEARCH_LIBS(dn_expand, resolv)
1997 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1999 K5LIBS="-lgssapi $K5LIBS" ],
2000 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2002 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2003 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2008 AC_CHECK_HEADER(gssapi.h, ,
2009 [ unset ac_cv_header_gssapi_h
2010 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2011 AC_CHECK_HEADERS(gssapi.h, ,
2012 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2018 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2019 AC_CHECK_HEADER(gssapi_krb5.h, ,
2020 [ CPPFLAGS="$oldCPP" ])
2026 LIBS="$LIBS $K5LIBS"
2028 # Looking for programs, paths and files
2030 PRIVSEP_PATH=/var/empty
2031 AC_ARG_WITH(privsep-path,
2032 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2034 if test "x$withval" != "$no" ; then
2035 PRIVSEP_PATH=$withval
2039 AC_SUBST(PRIVSEP_PATH)
2042 [ --with-xauth=PATH Specify path to xauth program ],
2044 if test "x$withval" != "xno" ; then
2050 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2051 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2052 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2053 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2054 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2055 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2056 xauth_path="/usr/openwin/bin/xauth"
2062 AC_ARG_ENABLE(strip,
2063 [ --disable-strip Disable calling strip(1) on install],
2065 if test "x$enableval" = "xno" ; then
2072 if test -z "$xauth_path" ; then
2073 XAUTH_PATH="undefined"
2074 AC_SUBST(XAUTH_PATH)
2076 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2077 XAUTH_PATH=$xauth_path
2078 AC_SUBST(XAUTH_PATH)
2081 # Check for mail directory (last resort if we cannot get it from headers)
2082 if test ! -z "$MAIL" ; then
2083 maildir=`dirname $MAIL`
2084 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2087 if test -z "$no_dev_ptmx" ; then
2088 if test "x$disable_ptmx_check" != "xyes" ; then
2089 AC_CHECK_FILE("/dev/ptmx",
2091 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2097 AC_CHECK_FILE("/dev/ptc",
2099 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2104 # Options from here on. Some of these are preset by platform above
2105 AC_ARG_WITH(mantype,
2106 [ --with-mantype=man|cat|doc Set man page type],
2113 AC_MSG_ERROR(invalid man type: $withval)
2118 if test -z "$MANTYPE"; then
2119 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2120 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2121 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2123 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2130 if test "$MANTYPE" = "doc"; then
2137 # Check whether to enable MD5 passwords
2139 AC_ARG_WITH(md5-passwords,
2140 [ --with-md5-passwords Enable use of MD5 passwords],
2142 if test "x$withval" != "xno" ; then
2143 AC_DEFINE(HAVE_MD5_PASSWORDS)
2149 # Whether to disable shadow password support
2151 [ --without-shadow Disable shadow password support],
2153 if test "x$withval" = "xno" ; then
2154 AC_DEFINE(DISABLE_SHADOW)
2160 if test -z "$disable_shadow" ; then
2161 AC_MSG_CHECKING([if the systems has expire shadow information])
2164 #include <sys/types.h>
2167 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2168 [ sp_expire_available=yes ], []
2171 if test "x$sp_expire_available" = "xyes" ; then
2173 AC_DEFINE(HAS_SHADOW_EXPIRE)
2179 # Use ip address instead of hostname in $DISPLAY
2180 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2181 DISPLAY_HACK_MSG="yes"
2182 AC_DEFINE(IPADDR_IN_DISPLAY)
2184 DISPLAY_HACK_MSG="no"
2185 AC_ARG_WITH(ipaddr-display,
2186 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2188 if test "x$withval" != "xno" ; then
2189 AC_DEFINE(IPADDR_IN_DISPLAY)
2190 DISPLAY_HACK_MSG="yes"
2196 # check for /etc/default/login and use it if present.
2197 AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2199 if test "x$external_path_file" = "x/etc/default/login"; then
2200 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2203 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2204 if test $ac_cv_func_login_getcapbool = "yes" -a \
2205 $ac_cv_header_login_cap_h = "yes" ; then
2206 external_path_file=/etc/login.conf
2209 # Whether to mess with the default path
2210 SERVER_PATH_MSG="(default)"
2211 AC_ARG_WITH(default-path,
2212 [ --with-default-path= Specify default \$PATH environment for server],
2214 if test "x$external_path_file" = "x/etc/login.conf" ; then
2216 --with-default-path=PATH has no effect on this system.
2217 Edit /etc/login.conf instead.])
2218 elif test "x$withval" != "xno" ; then
2219 if test ! -z "$external_path_file" ; then
2221 --with-default-path=PATH will only be used if PATH is not defined in
2222 $external_path_file .])
2224 user_path="$withval"
2225 SERVER_PATH_MSG="$withval"
2228 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2229 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2231 if test ! -z "$external_path_file" ; then
2233 If PATH is defined in $external_path_file, ensure the path to scp is included,
2234 otherwise scp will not work.])
2238 /* find out what STDPATH is */
2243 #ifndef _PATH_STDPATH
2244 # ifdef _PATH_USERPATH /* Irix */
2245 # define _PATH_STDPATH _PATH_USERPATH
2247 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2250 #include <sys/types.h>
2251 #include <sys/stat.h>
2253 #define DATA "conftest.stdpath"
2260 fd = fopen(DATA,"w");
2264 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2269 ], [ user_path=`cat conftest.stdpath` ],
2270 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2271 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2273 # make sure $bindir is in USER_PATH so scp will work
2274 t_bindir=`eval echo ${bindir}`
2276 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2279 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2281 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2282 if test $? -ne 0 ; then
2283 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2284 if test $? -ne 0 ; then
2285 user_path=$user_path:$t_bindir
2286 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2291 if test "x$external_path_file" != "x/etc/login.conf" ; then
2292 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2296 # Set superuser path separately to user path
2297 AC_ARG_WITH(superuser-path,
2298 [ --with-superuser-path= Specify different path for super-user],
2300 if test "x$withval" != "xno" ; then
2301 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2302 superuser_path=$withval
2308 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2309 IPV4_IN6_HACK_MSG="no"
2311 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2313 if test "x$withval" != "xno" ; then
2315 AC_DEFINE(IPV4_IN_IPV6)
2316 IPV4_IN6_HACK_MSG="yes"
2321 if test "x$inet6_default_4in6" = "xyes"; then
2322 AC_MSG_RESULT([yes (default)])
2323 AC_DEFINE(IPV4_IN_IPV6)
2324 IPV4_IN6_HACK_MSG="yes"
2326 AC_MSG_RESULT([no (default)])
2331 # Whether to enable BSD auth support
2333 AC_ARG_WITH(bsd-auth,
2334 [ --with-bsd-auth Enable BSD auth support],
2336 if test "x$withval" != "xno" ; then
2343 # Where to place sshd.pid
2345 # make sure the directory exists
2346 if test ! -d $piddir ; then
2347 piddir=`eval echo ${sysconfdir}`
2349 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2353 AC_ARG_WITH(pid-dir,
2354 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2356 if test "x$withval" != "xno" ; then
2358 if test ! -d $piddir ; then
2359 AC_MSG_WARN([** no $piddir directory on this system **])
2365 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2368 dnl allow user to disable some login recording features
2369 AC_ARG_ENABLE(lastlog,
2370 [ --disable-lastlog disable use of lastlog even if detected [no]],
2372 if test "x$enableval" = "xno" ; then
2373 AC_DEFINE(DISABLE_LASTLOG)
2378 [ --disable-utmp disable use of utmp even if detected [no]],
2380 if test "x$enableval" = "xno" ; then
2381 AC_DEFINE(DISABLE_UTMP)
2385 AC_ARG_ENABLE(utmpx,
2386 [ --disable-utmpx disable use of utmpx even if detected [no]],
2388 if test "x$enableval" = "xno" ; then
2389 AC_DEFINE(DISABLE_UTMPX)
2394 [ --disable-wtmp disable use of wtmp even if detected [no]],
2396 if test "x$enableval" = "xno" ; then
2397 AC_DEFINE(DISABLE_WTMP)
2401 AC_ARG_ENABLE(wtmpx,
2402 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2404 if test "x$enableval" = "xno" ; then
2405 AC_DEFINE(DISABLE_WTMPX)
2409 AC_ARG_ENABLE(libutil,
2410 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2412 if test "x$enableval" = "xno" ; then
2413 AC_DEFINE(DISABLE_LOGIN)
2417 AC_ARG_ENABLE(pututline,
2418 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2420 if test "x$enableval" = "xno" ; then
2421 AC_DEFINE(DISABLE_PUTUTLINE)
2425 AC_ARG_ENABLE(pututxline,
2426 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2428 if test "x$enableval" = "xno" ; then
2429 AC_DEFINE(DISABLE_PUTUTXLINE)
2433 AC_ARG_WITH(lastlog,
2434 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2436 if test "x$withval" = "xno" ; then
2437 AC_DEFINE(DISABLE_LASTLOG)
2439 conf_lastlog_location=$withval
2444 dnl lastlog, [uw]tmpx? detection
2445 dnl NOTE: set the paths in the platform section to avoid the
2446 dnl need for command-line parameters
2447 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2449 dnl lastlog detection
2450 dnl NOTE: the code itself will detect if lastlog is a directory
2451 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2453 #include <sys/types.h>
2455 #ifdef HAVE_LASTLOG_H
2456 # include <lastlog.h>
2465 [ char *lastlog = LASTLOG_FILE; ],
2466 [ AC_MSG_RESULT(yes) ],
2469 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2471 #include <sys/types.h>
2473 #ifdef HAVE_LASTLOG_H
2474 # include <lastlog.h>
2480 [ char *lastlog = _PATH_LASTLOG; ],
2481 [ AC_MSG_RESULT(yes) ],
2484 system_lastlog_path=no
2489 if test -z "$conf_lastlog_location"; then
2490 if test x"$system_lastlog_path" = x"no" ; then
2491 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2492 if (test -d "$f" || test -f "$f") ; then
2493 conf_lastlog_location=$f
2496 if test -z "$conf_lastlog_location"; then
2497 AC_MSG_WARN([** Cannot find lastlog **])
2498 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2503 if test -n "$conf_lastlog_location"; then
2504 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2508 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2510 #include <sys/types.h>
2516 [ char *utmp = UTMP_FILE; ],
2517 [ AC_MSG_RESULT(yes) ],
2519 system_utmp_path=no ]
2521 if test -z "$conf_utmp_location"; then
2522 if test x"$system_utmp_path" = x"no" ; then
2523 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2524 if test -f $f ; then
2525 conf_utmp_location=$f
2528 if test -z "$conf_utmp_location"; then
2529 AC_DEFINE(DISABLE_UTMP)
2533 if test -n "$conf_utmp_location"; then
2534 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2538 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2540 #include <sys/types.h>
2546 [ char *wtmp = WTMP_FILE; ],
2547 [ AC_MSG_RESULT(yes) ],
2549 system_wtmp_path=no ]
2551 if test -z "$conf_wtmp_location"; then
2552 if test x"$system_wtmp_path" = x"no" ; then
2553 for f in /usr/adm/wtmp /var/log/wtmp; do
2554 if test -f $f ; then
2555 conf_wtmp_location=$f
2558 if test -z "$conf_wtmp_location"; then
2559 AC_DEFINE(DISABLE_WTMP)
2563 if test -n "$conf_wtmp_location"; then
2564 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2568 dnl utmpx detection - I don't know any system so perverse as to require
2569 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2571 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2573 #include <sys/types.h>
2582 [ char *utmpx = UTMPX_FILE; ],
2583 [ AC_MSG_RESULT(yes) ],
2585 system_utmpx_path=no ]
2587 if test -z "$conf_utmpx_location"; then
2588 if test x"$system_utmpx_path" = x"no" ; then
2589 AC_DEFINE(DISABLE_UTMPX)
2592 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2596 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2598 #include <sys/types.h>
2607 [ char *wtmpx = WTMPX_FILE; ],
2608 [ AC_MSG_RESULT(yes) ],
2610 system_wtmpx_path=no ]
2612 if test -z "$conf_wtmpx_location"; then
2613 if test x"$system_wtmpx_path" = x"no" ; then
2614 AC_DEFINE(DISABLE_WTMPX)
2617 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2621 if test ! -z "$blibpath" ; then
2622 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2623 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2626 dnl remove pam and dl because they are in $LIBPAM
2627 if test "$PAM_MSG" = yes ; then
2628 LIBS=`echo $LIBS | sed 's/-lpam //'`
2630 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2631 LIBS=`echo $LIBS | sed 's/-ldl //'`
2635 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2638 # Print summary of options
2640 # Someone please show me a better way :)
2641 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2642 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2643 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2644 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2645 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2646 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2647 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2648 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2649 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2650 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2653 echo "OpenSSH has been configured with the following options:"
2654 echo " User binaries: $B"
2655 echo " System binaries: $C"
2656 echo " Configuration files: $D"
2657 echo " Askpass program: $E"
2658 echo " Manual pages: $F"
2659 echo " PID file: $G"
2660 echo " Privilege separation chroot path: $H"
2661 if test "x$external_path_file" = "x/etc/login.conf" ; then
2662 echo " At runtime, sshd will use the path defined in $external_path_file"
2663 echo " Make sure the path to scp is present, otherwise scp will not work"
2665 echo " sshd default user PATH: $I"
2666 if test ! -z "$external_path_file"; then
2667 echo " (If PATH is set in $external_path_file it will be used instead. If"
2668 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2671 if test ! -z "$superuser_path" ; then
2672 echo " sshd superuser user PATH: $J"
2674 echo " Manpage format: $MANTYPE"
2675 echo " DNS support: $DNS_MSG"
2676 echo " PAM support: $PAM_MSG"
2677 echo " KerberosV support: $KRB5_MSG"
2678 echo " Smartcard support: $SCARD_MSG"
2679 echo " S/KEY support: $SKEY_MSG"
2680 echo " TCP Wrappers support: $TCPW_MSG"
2681 echo " MD5 password support: $MD5_MSG"
2682 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2683 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2684 echo " BSD Auth support: $BSD_AUTH_MSG"
2685 echo " Random number source: $RAND_MSG"
2686 if test ! -z "$USE_RAND_HELPER" ; then
2687 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2692 echo " Host: ${host}"
2693 echo " Compiler: ${CC}"
2694 echo " Compiler flags: ${CFLAGS}"
2695 echo "Preprocessor flags: ${CPPFLAGS}"
2696 echo " Linker flags: ${LDFLAGS}"
2697 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2701 if test "x$PAM_MSG" = "xyes" ; then
2702 echo "PAM is enabled. You may need to install a PAM control file "
2703 echo "for sshd, otherwise password authentication may fail. "
2704 echo "Example PAM control files can be found in the contrib/ "
2709 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2710 echo "WARNING: you are using the builtin random number collection "
2711 echo "service. Please read WARNING.RNG and request that your OS "
2712 echo "vendor includes kernel-based random number collection in "
2713 echo "future versions of your OS."