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"
56 [ --without-rpath Disable auto-added -R linker paths],
58 if test "x$withval" = "xno" ; then
61 if test "x$withval" = "xyes" ; then
67 # Check for some target-specific stuff
70 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
71 LDFLAGS="$LDFLAGS -L/usr/local/lib"
72 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
73 if (test -z "$blibpath"); then
74 blibpath="/usr/lib:/lib:/usr/local/lib"
76 saved_LDFLAGS="$LDFLAGS"
77 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
78 if (test -z "$blibflags"); then
79 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
80 AC_TRY_LINK([], [], [blibflags=$tryflags])
83 if (test -z "$blibflags"); then
84 AC_MSG_RESULT(not found)
85 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
87 AC_MSG_RESULT($blibflags)
89 LDFLAGS="$saved_LDFLAGS"
90 dnl Check for authenticate. Might be in libs.a on older AIXes
91 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
92 [AC_CHECK_LIB(s,authenticate,
93 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
97 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
98 AC_CHECK_DECL(loginfailed,
99 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
101 [#include <usersec.h>],
102 [(void)loginfailed("user","host","tty",0);],
104 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
108 [#include <usersec.h>]
110 AC_CHECK_FUNCS(setauthdb)
111 AC_DEFINE(BROKEN_GETADDRINFO)
112 AC_DEFINE(BROKEN_REALPATH)
113 AC_DEFINE(SETEUID_BREAKS_SETUID)
114 AC_DEFINE(BROKEN_SETREUID)
115 AC_DEFINE(BROKEN_SETREGID)
116 dnl AIX handles lastlog as part of its login message
117 AC_DEFINE(DISABLE_LASTLOG)
118 AC_DEFINE(LOGIN_NEEDS_UTMPX)
119 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
122 check_for_libcrypt_later=1
123 LIBS="$LIBS /usr/lib/textmode.o"
124 AC_DEFINE(HAVE_CYGWIN)
126 AC_DEFINE(DISABLE_SHADOW)
127 AC_DEFINE(IP_TOS_IS_BROKEN)
128 AC_DEFINE(NO_X11_UNIX_SOCKETS)
129 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
130 AC_DEFINE(DISABLE_FD_PASSING)
131 AC_DEFINE(SETGROUPS_NOOP)
134 AC_DEFINE(IP_TOS_IS_BROKEN)
137 AC_MSG_CHECKING(if we have working getaddrinfo)
138 AC_TRY_RUN([#include <mach-o/dyld.h>
139 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
143 }], [AC_MSG_RESULT(working)],
144 [AC_MSG_RESULT(buggy)
145 AC_DEFINE(BROKEN_GETADDRINFO)],
146 [AC_MSG_RESULT(assume it is working)])
147 AC_DEFINE(SETEUID_BREAKS_SETUID)
148 AC_DEFINE(BROKEN_SETREUID)
149 AC_DEFINE(BROKEN_SETREGID)
152 if test -z "$GCC"; then
155 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
156 IPADDR_IN_DISPLAY=yes
157 AC_DEFINE(HAVE_SECUREWARE)
159 AC_DEFINE(LOGIN_NO_ENDOPT)
160 AC_DEFINE(LOGIN_NEEDS_UTMPX)
161 AC_DEFINE(DISABLE_UTMP)
162 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
163 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
164 LIBS="$LIBS -lsec -lsecpw"
165 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
166 disable_ptmx_check=yes
169 if test -z "$GCC"; then
172 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
173 IPADDR_IN_DISPLAY=yes
175 AC_DEFINE(LOGIN_NO_ENDOPT)
176 AC_DEFINE(LOGIN_NEEDS_UTMPX)
177 AC_DEFINE(DISABLE_UTMP)
178 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
179 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
181 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
184 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
185 IPADDR_IN_DISPLAY=yes
186 AC_DEFINE(PAM_SUN_CODEBASE)
188 AC_DEFINE(LOGIN_NO_ENDOPT)
189 AC_DEFINE(LOGIN_NEEDS_UTMPX)
190 AC_DEFINE(DISABLE_UTMP)
191 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
192 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
194 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
197 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
199 PATH="$PATH:/usr/etc"
200 AC_DEFINE(BROKEN_INET_NTOA)
201 AC_DEFINE(SETEUID_BREAKS_SETUID)
202 AC_DEFINE(BROKEN_SETREUID)
203 AC_DEFINE(BROKEN_SETREGID)
204 AC_DEFINE(WITH_ABBREV_NO_TTY)
205 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
208 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
210 PATH="$PATH:/usr/etc"
211 AC_DEFINE(WITH_IRIX_ARRAY)
212 AC_DEFINE(WITH_IRIX_PROJECT)
213 AC_DEFINE(WITH_IRIX_AUDIT)
214 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
215 AC_DEFINE(BROKEN_INET_NTOA)
216 AC_DEFINE(SETEUID_BREAKS_SETUID)
217 AC_DEFINE(BROKEN_SETREUID)
218 AC_DEFINE(BROKEN_SETREGID)
219 AC_DEFINE(WITH_ABBREV_NO_TTY)
220 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
224 check_for_libcrypt_later=1
225 check_for_openpty_ctty_bug=1
226 AC_DEFINE(DONT_TRY_OTHER_AF)
227 AC_DEFINE(PAM_TTY_KLUDGE)
228 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
229 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
230 inet6_default_4in6=yes
233 AC_DEFINE(BROKEN_CMSG_TYPE)
237 mips-sony-bsd|mips-sony-newsos4)
238 AC_DEFINE(HAVE_NEWS4)
242 check_for_libcrypt_before=1
243 if test "x$withval" != "xno" ; then
248 check_for_libcrypt_later=1
251 AC_DEFINE(SETEUID_BREAKS_SETUID)
252 AC_DEFINE(BROKEN_SETREUID)
253 AC_DEFINE(BROKEN_SETREGID)
256 conf_lastlog_location="/usr/adm/lastlog"
257 conf_utmp_location=/etc/utmp
258 conf_wtmp_location=/usr/adm/wtmp
261 AC_DEFINE(BROKEN_REALPATH)
263 AC_DEFINE(BROKEN_SAVED_UIDS)
264 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
268 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
269 if test "x$withval" = "xno" ; then
270 LDFLAGS="$LDFLAGS -L/usr/local/lib"
272 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
275 AC_DEFINE(PAM_SUN_CODEBASE)
276 AC_DEFINE(LOGIN_NEEDS_UTMPX)
277 AC_DEFINE(LOGIN_NEEDS_TERM)
278 AC_DEFINE(PAM_TTY_KLUDGE)
279 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
280 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
281 AC_DEFINE(SSHD_ACQUIRES_CTTY)
282 external_path_file=/etc/default/login
283 # hardwire lastlog location (can't detect it on some versions)
284 conf_lastlog_location="/var/adm/lastlog"
285 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
286 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
287 if test "$sol2ver" -ge 8; then
289 AC_DEFINE(DISABLE_UTMP)
290 AC_DEFINE(DISABLE_WTMP)
296 CPPFLAGS="$CPPFLAGS -DSUNOS4"
297 AC_CHECK_FUNCS(getpwanam)
298 AC_DEFINE(PAM_SUN_CODEBASE)
299 conf_utmp_location=/etc/utmp
300 conf_wtmp_location=/var/adm/wtmp
301 conf_lastlog_location=/var/adm/lastlog
305 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
306 LDFLAGS="$LDFLAGS -L/usr/local/lib"
309 AC_DEFINE(SSHD_ACQUIRES_CTTY)
310 AC_DEFINE(SETEUID_BREAKS_SETUID)
311 AC_DEFINE(BROKEN_SETREUID)
312 AC_DEFINE(BROKEN_SETREGID)
315 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
316 # /usr/ucblib MUST NOT be searched on ReliantUNIX
317 LDFLAGS="$LDFLAGS -L/usr/local/lib"
318 AC_CHECK_LIB(dl, dlsym, ,)
319 IPADDR_IN_DISPLAY=yes
321 AC_DEFINE(IP_TOS_IS_BROKEN)
322 AC_DEFINE(SETEUID_BREAKS_SETUID)
323 AC_DEFINE(BROKEN_SETREUID)
324 AC_DEFINE(BROKEN_SETREGID)
325 AC_DEFINE(SSHD_ACQUIRES_CTTY)
326 external_path_file=/etc/default/login
327 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
328 # Attention: always take care to bind libsocket and libnsl before libc,
329 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
332 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
333 LDFLAGS="$LDFLAGS -L/usr/local/lib"
335 AC_DEFINE(SETEUID_BREAKS_SETUID)
336 AC_DEFINE(BROKEN_SETREUID)
337 AC_DEFINE(BROKEN_SETREGID)
340 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
341 LDFLAGS="$LDFLAGS -L/usr/local/lib"
343 AC_DEFINE(SETEUID_BREAKS_SETUID)
344 AC_DEFINE(BROKEN_SETREUID)
345 AC_DEFINE(BROKEN_SETREGID)
348 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
349 LDFLAGS="$LDFLAGS -L/usr/local/lib"
352 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
353 LDFLAGS="$LDFLAGS -L/usr/local/lib"
354 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
357 AC_DEFINE(BROKEN_SYS_TERMIO_H)
359 AC_DEFINE(HAVE_SECUREWARE)
360 AC_DEFINE(DISABLE_SHADOW)
361 AC_DEFINE(BROKEN_SAVED_UIDS)
362 AC_DEFINE(WITH_ABBREV_NO_TTY)
363 AC_CHECK_FUNCS(getluid setluid)
365 do_sco3_extra_lib_check=yes
368 if test -z "$GCC"; then
369 CFLAGS="$CFLAGS -belf"
371 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
372 LDFLAGS="$LDFLAGS -L/usr/local/lib"
373 LIBS="$LIBS -lprot -lx -ltinfo -lm"
376 AC_DEFINE(HAVE_SECUREWARE)
377 AC_DEFINE(DISABLE_SHADOW)
378 AC_DEFINE(DISABLE_FD_PASSING)
379 AC_DEFINE(SETEUID_BREAKS_SETUID)
380 AC_DEFINE(BROKEN_SETREUID)
381 AC_DEFINE(BROKEN_SETREGID)
382 AC_DEFINE(WITH_ABBREV_NO_TTY)
383 AC_CHECK_FUNCS(getluid setluid)
388 AC_DEFINE(DISABLE_FD_PASSING)
390 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
394 AC_DEFINE(WITH_ABBREV_NO_TTY)
396 AC_DEFINE(DISABLE_FD_PASSING)
398 LIBS="$LIBS -lgen -lacid"
403 AC_DEFINE(DISABLE_FD_PASSING)
404 AC_DEFINE(NO_SSH_LASTLOG)
405 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
406 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
410 AC_MSG_CHECKING(for Digital Unix SIA)
413 [ --with-osfsia Enable Digital Unix SIA],
415 if test "x$withval" = "xno" ; then
416 AC_MSG_RESULT(disabled)
421 if test -z "$no_osfsia" ; then
422 if test -f /etc/sia/matrix.conf; then
424 AC_DEFINE(HAVE_OSF_SIA)
425 AC_DEFINE(DISABLE_LOGIN)
426 AC_DEFINE(DISABLE_FD_PASSING)
427 LIBS="$LIBS -lsecurity -ldb -lm -laud"
430 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
433 AC_DEFINE(BROKEN_GETADDRINFO)
434 AC_DEFINE(SETEUID_BREAKS_SETUID)
435 AC_DEFINE(BROKEN_SETREUID)
436 AC_DEFINE(BROKEN_SETREGID)
441 AC_DEFINE(NO_X11_UNIX_SOCKETS)
442 AC_DEFINE(MISSING_NFDBITS)
443 AC_DEFINE(MISSING_HOWMANY)
444 AC_DEFINE(MISSING_FD_MASK)
448 # Allow user to specify flags
450 [ --with-cflags Specify additional flags to pass to compiler],
452 if test "x$withval" != "xno" ; then
453 CFLAGS="$CFLAGS $withval"
457 AC_ARG_WITH(cppflags,
458 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
460 if test "x$withval" != "xno"; then
461 CPPFLAGS="$CPPFLAGS $withval"
466 [ --with-ldflags Specify additional flags to pass to linker],
468 if test "x$withval" != "xno" ; then
469 LDFLAGS="$LDFLAGS $withval"
474 [ --with-libs Specify additional libraries to link with],
476 if test "x$withval" != "xno" ; then
477 LIBS="$LIBS $withval"
482 AC_MSG_CHECKING(compiler and flags for sanity)
487 [ AC_MSG_RESULT(yes) ],
490 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
494 # Checks for header files.
495 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
496 getopt.h glob.h ia.h lastlog.h limits.h login.h \
497 login_cap.h maillock.h netdb.h netgroup.h \
498 netinet/in_systm.h paths.h pty.h readpassphrase.h \
499 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
500 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
501 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
502 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
503 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
504 util.h utime.h utmp.h utmpx.h vis.h)
506 # Checks for libraries.
507 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
508 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
510 dnl SCO OS3 needs this for libwrap
511 if test "x$with_tcp_wrappers" != "xno" ; then
512 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
513 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
517 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
518 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
519 AC_CHECK_LIB(gen, dirname,[
520 AC_CACHE_CHECK([for broken dirname],
521 ac_cv_have_broken_dirname, [
529 int main(int argc, char **argv) {
532 strncpy(buf,"/etc", 32);
534 if (!s || strncmp(s, "/", 32) != 0) {
541 [ ac_cv_have_broken_dirname="no" ],
542 [ ac_cv_have_broken_dirname="yes" ]
546 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
548 AC_DEFINE(HAVE_DIRNAME)
549 AC_CHECK_HEADERS(libgen.h)
554 AC_CHECK_FUNC(getspnam, ,
555 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
556 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
560 [ --with-zlib=PATH Use zlib in PATH],
562 if test "x$withval" = "xno" ; then
563 AC_MSG_ERROR([*** zlib is required ***])
565 if test -d "$withval/lib"; then
566 if test -n "${need_dash_r}"; then
567 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
569 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
572 if test -n "${need_dash_r}"; then
573 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
575 LDFLAGS="-L${withval} ${LDFLAGS}"
578 if test -d "$withval/include"; then
579 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
581 CPPFLAGS="-I${withval} ${CPPFLAGS}"
586 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
589 AC_CHECK_FUNC(strcasecmp,
590 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
592 AC_CHECK_FUNC(utimes,
593 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
594 LIBS="$LIBS -lc89"]) ]
597 dnl Checks for libutil functions
598 AC_CHECK_HEADERS(libutil.h)
599 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
600 AC_CHECK_FUNCS(logout updwtmp logwtmp)
604 # Check for ALTDIRFUNC glob() extension
605 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
606 AC_EGREP_CPP(FOUNDIT,
609 #ifdef GLOB_ALTDIRFUNC
614 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
622 # Check for g.gl_matchc glob() extension
623 AC_MSG_CHECKING(for gl_matchc field in glob_t)
624 AC_EGREP_CPP(FOUNDIT,
627 int main(void){glob_t g; g.gl_matchc = 1;}
630 AC_DEFINE(GLOB_HAS_GL_MATCHC)
638 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
641 #include <sys/types.h>
643 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
645 [AC_MSG_RESULT(yes)],
648 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
652 # Check whether user wants S/Key support
655 [ --with-skey[[=PATH]] Enable S/Key support
656 (optionally in PATH)],
658 if test "x$withval" != "xno" ; then
660 if test "x$withval" != "xyes" ; then
661 CPPFLAGS="$CPPFLAGS -I${withval}/include"
662 LDFLAGS="$LDFLAGS -L${withval}/lib"
669 AC_MSG_CHECKING([for s/key support])
674 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
676 [AC_MSG_RESULT(yes)],
679 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
685 # Check whether user wants TCP wrappers support
687 AC_ARG_WITH(tcp-wrappers,
688 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
689 (optionally in PATH)],
691 if test "x$withval" != "xno" ; then
693 saved_LDFLAGS="$LDFLAGS"
694 saved_CPPFLAGS="$CPPFLAGS"
695 if test -n "${withval}" -a "${withval}" != "yes"; then
696 if test -d "${withval}/lib"; then
697 if test -n "${need_dash_r}"; then
698 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
700 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
703 if test -n "${need_dash_r}"; then
704 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
706 LDFLAGS="-L${withval} ${LDFLAGS}"
709 if test -d "${withval}/include"; then
710 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
712 CPPFLAGS="-I${withval} ${CPPFLAGS}"
716 LIBS="$LIBWRAP $LIBS"
717 AC_MSG_CHECKING(for libwrap)
721 int deny_severity = 0, allow_severity = 0;
731 AC_MSG_ERROR([*** libwrap missing])
739 dnl Checks for library functions. Please keep in alphabetical order
741 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
742 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
743 getaddrinfo getcwd getgrouplist getnameinfo getopt \
744 getpeereid _getpty getrlimit getttyent glob inet_aton \
745 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
746 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
747 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
748 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
749 setproctitle setregid setresgid setresuid setreuid setrlimit \
750 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
751 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
752 truncate utimes vhangup vsnprintf waitpid \
755 # IRIX has a const char return value for gai_strerror()
756 AC_CHECK_FUNCS(gai_strerror,[
757 AC_DEFINE(HAVE_GAI_STRERROR)
759 #include <sys/types.h>
760 #include <sys/socket.h>
763 const char *gai_strerror(int);],[
766 str = gai_strerror(0);],[
767 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
768 [Define if gai_strerror() returns const char *])])])
770 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
772 dnl Make sure prototypes are defined for these before using them.
773 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
774 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
776 dnl tcsendbreak might be a macro
777 AC_CHECK_DECL(tcsendbreak,
778 [AC_DEFINE(HAVE_TCSENDBREAK)],
779 [AC_CHECK_FUNCS(tcsendbreak)],
780 [#include <termios.h>]
783 dnl Some platorms have setresuid that isn't implemented
784 AC_MSG_CHECKING(if setresuid seems to work)
788 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
790 [AC_MSG_RESULT(yes)],
791 [AC_DEFINE(BROKEN_SETRESUID),
792 AC_MSG_RESULT(not implemented)]
795 dnl Some platorms have setresgid that isn't implemented
796 AC_MSG_CHECKING(if setresgid seems to work)
800 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
802 [AC_MSG_RESULT(yes)],
803 [AC_DEFINE(BROKEN_SETRESGID)
804 AC_MSG_RESULT(not implemented)]
807 dnl Checks for time functions
808 AC_CHECK_FUNCS(gettimeofday time)
809 dnl Checks for utmp functions
810 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
811 AC_CHECK_FUNCS(utmpname)
812 dnl Checks for utmpx functions
813 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
814 AC_CHECK_FUNCS(setutxent utmpxname)
816 AC_CHECK_FUNC(daemon,
817 [AC_DEFINE(HAVE_DAEMON)],
818 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
821 AC_CHECK_FUNC(getpagesize,
822 [AC_DEFINE(HAVE_GETPAGESIZE)],
823 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
826 # Check for broken snprintf
827 if test "x$ac_cv_func_snprintf" = "xyes" ; then
828 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
832 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
834 [AC_MSG_RESULT(yes)],
837 AC_DEFINE(BROKEN_SNPRINTF)
838 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
843 dnl see whether mkstemp() requires XXXXXX
844 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
845 AC_MSG_CHECKING([for (overly) strict mkstemp])
849 main() { char template[]="conftest.mkstemp-test";
850 if (mkstemp(template) == -1)
852 unlink(template); exit(0);
860 AC_DEFINE(HAVE_STRICT_MKSTEMP)
864 AC_DEFINE(HAVE_STRICT_MKSTEMP)
869 dnl make sure that openpty does not reacquire controlling terminal
870 if test ! -z "$check_for_openpty_ctty_bug"; then
871 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
875 #include <sys/fcntl.h>
876 #include <sys/types.h>
877 #include <sys/wait.h>
883 int fd, ptyfd, ttyfd, status;
886 if (pid < 0) { /* failed */
888 } else if (pid > 0) { /* parent */
889 waitpid(pid, &status, 0);
890 if (WIFEXITED(status))
891 exit(WEXITSTATUS(status));
895 close(0); close(1); close(2);
897 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
898 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
900 exit(3); /* Acquired ctty: broken */
902 exit(0); /* Did not acquire ctty: OK */
911 AC_DEFINE(SSHD_ACQUIRES_CTTY)
921 [ --with-pam Enable PAM support ],
923 if test "x$withval" != "xno" ; then
924 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
925 AC_MSG_ERROR([PAM headers not found])
928 AC_CHECK_LIB(dl, dlopen, , )
929 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
930 AC_CHECK_FUNCS(pam_getenvlist)
931 AC_CHECK_FUNCS(pam_putenv)
936 if test $ac_cv_lib_dl_dlopen = yes; then
946 # Check for older PAM
947 if test "x$PAM_MSG" = "xyes" ; then
948 # Check PAM strerror arguments (old PAM)
949 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
953 #include <security/pam_appl.h>
955 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
958 AC_DEFINE(HAVE_OLD_PAM)
960 PAM_MSG="yes (old library)"
965 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
966 # because the system crypt() is more featureful.
967 if test "x$check_for_libcrypt_before" = "x1"; then
968 AC_CHECK_LIB(crypt, crypt)
972 saved_CPPFLAGS="$CPPFLAGS"
973 saved_LDFLAGS="$LDFLAGS"
975 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
977 if test "x$withval" != "xno" ; then
978 if test -d "$withval/lib"; then
979 if test -n "${need_dash_r}"; then
980 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
982 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
985 if test -n "${need_dash_r}"; then
986 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
988 LDFLAGS="-L${withval} ${LDFLAGS}"
991 if test -d "$withval/include"; then
992 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
994 CPPFLAGS="-I${withval} ${CPPFLAGS}"
999 LIBS="$LIBS -lcrypto"
1000 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1002 dnl Check default openssl install dir
1003 if test -n "${need_dash_r}"; then
1004 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1006 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1008 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1009 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1011 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1017 # Determine OpenSSL header version
1018 AC_MSG_CHECKING([OpenSSL header version])
1023 #include <openssl/opensslv.h>
1024 #define DATA "conftest.sslincver"
1029 fd = fopen(DATA,"w");
1033 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1040 ssl_header_ver=`cat conftest.sslincver`
1041 AC_MSG_RESULT($ssl_header_ver)
1044 AC_MSG_RESULT(not found)
1045 AC_MSG_ERROR(OpenSSL version header not found.)
1049 # Determine OpenSSL library version
1050 AC_MSG_CHECKING([OpenSSL library version])
1055 #include <openssl/opensslv.h>
1056 #include <openssl/crypto.h>
1057 #define DATA "conftest.ssllibver"
1062 fd = fopen(DATA,"w");
1066 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1073 ssl_library_ver=`cat conftest.ssllibver`
1074 AC_MSG_RESULT($ssl_library_ver)
1077 AC_MSG_RESULT(not found)
1078 AC_MSG_ERROR(OpenSSL library not found.)
1082 # Sanity check OpenSSL headers
1083 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1087 #include <openssl/opensslv.h>
1088 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1095 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1096 Check config.log for details.
1097 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1101 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1102 # version in OpenSSL. Skip this for PAM
1103 if test "x$check_for_libcrypt_later" = "x1"; then
1104 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1108 ### Configure cryptographic random number support
1110 # Check wheter OpenSSL seeds itself
1111 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1115 #include <openssl/rand.h>
1116 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1119 OPENSSL_SEEDS_ITSELF=yes
1124 # Default to use of the rand helper if OpenSSL doesn't
1131 # Do we want to force the use of the rand helper?
1132 AC_ARG_WITH(rand-helper,
1133 [ --with-rand-helper Use subprocess to gather strong randomness ],
1135 if test "x$withval" = "xno" ; then
1136 # Force use of OpenSSL's internal RNG, even if
1137 # the previous test showed it to be unseeded.
1138 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1139 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1140 OPENSSL_SEEDS_ITSELF=yes
1149 # Which randomness source do we use?
1150 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1152 AC_DEFINE(OPENSSL_PRNG_ONLY)
1153 RAND_MSG="OpenSSL internal ONLY"
1154 INSTALL_SSH_RAND_HELPER=""
1155 elif test ! -z "$USE_RAND_HELPER" ; then
1156 # install rand helper
1157 RAND_MSG="ssh-rand-helper"
1158 INSTALL_SSH_RAND_HELPER="yes"
1160 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1162 ### Configuration of ssh-rand-helper
1165 AC_ARG_WITH(prngd-port,
1166 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1175 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1178 if test ! -z "$withval" ; then
1179 PRNGD_PORT="$withval"
1180 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1185 # PRNGD Unix domain socket
1186 AC_ARG_WITH(prngd-socket,
1187 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1191 withval="/var/run/egd-pool"
1199 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1203 if test ! -z "$withval" ; then
1204 if test ! -z "$PRNGD_PORT" ; then
1205 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1207 if test ! -r "$withval" ; then
1208 AC_MSG_WARN(Entropy socket is not readable)
1210 PRNGD_SOCKET="$withval"
1211 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1215 # Check for existing socket only if we don't have a random device already
1216 if test "$USE_RAND_HELPER" = yes ; then
1217 AC_MSG_CHECKING(for PRNGD/EGD socket)
1218 # Insert other locations here
1219 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1220 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1221 PRNGD_SOCKET="$sock"
1222 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1226 if test ! -z "$PRNGD_SOCKET" ; then
1227 AC_MSG_RESULT($PRNGD_SOCKET)
1229 AC_MSG_RESULT(not found)
1235 # Change default command timeout for hashing entropy source
1237 AC_ARG_WITH(entropy-timeout,
1238 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1240 if test "x$withval" != "xno" ; then
1241 entropy_timeout=$withval
1245 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1247 SSH_PRIVSEP_USER=sshd
1248 AC_ARG_WITH(privsep-user,
1249 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1251 if test -n "$withval"; then
1252 SSH_PRIVSEP_USER=$withval
1256 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1257 AC_SUBST(SSH_PRIVSEP_USER)
1259 # We do this little dance with the search path to insure
1260 # that programs that we select for use by installed programs
1261 # (which may be run by the super-user) come from trusted
1262 # locations before they come from the user's private area.
1263 # This should help avoid accidentally configuring some
1264 # random version of a program in someone's personal bin.
1268 test -h /bin 2> /dev/null && PATH=/usr/bin
1269 test -d /sbin && PATH=$PATH:/sbin
1270 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1271 PATH=$PATH:/etc:$OPATH
1273 # These programs are used by the command hashing source to gather entropy
1274 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1275 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1276 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1277 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1278 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1279 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1280 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1281 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1282 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1283 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1284 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1285 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1286 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1287 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1288 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1289 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1293 # Where does ssh-rand-helper get its randomness from?
1294 INSTALL_SSH_PRNG_CMDS=""
1295 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1296 if test ! -z "$PRNGD_PORT" ; then
1297 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1298 elif test ! -z "$PRNGD_SOCKET" ; then
1299 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1301 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1302 RAND_HELPER_CMDHASH=yes
1303 INSTALL_SSH_PRNG_CMDS="yes"
1306 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1309 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1310 if test ! -z "$SONY" ; then
1311 LIBS="$LIBS -liberty";
1314 # Checks for data types
1315 AC_CHECK_SIZEOF(char, 1)
1316 AC_CHECK_SIZEOF(short int, 2)
1317 AC_CHECK_SIZEOF(int, 4)
1318 AC_CHECK_SIZEOF(long int, 4)
1319 AC_CHECK_SIZEOF(long long int, 8)
1321 # Sanity check long long for some platforms (AIX)
1322 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1323 ac_cv_sizeof_long_long_int=0
1326 # More checks for data types
1327 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1329 [ #include <sys/types.h> ],
1331 [ ac_cv_have_u_int="yes" ],
1332 [ ac_cv_have_u_int="no" ]
1335 if test "x$ac_cv_have_u_int" = "xyes" ; then
1336 AC_DEFINE(HAVE_U_INT)
1340 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1342 [ #include <sys/types.h> ],
1343 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1344 [ ac_cv_have_intxx_t="yes" ],
1345 [ ac_cv_have_intxx_t="no" ]
1348 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1349 AC_DEFINE(HAVE_INTXX_T)
1353 if (test -z "$have_intxx_t" && \
1354 test "x$ac_cv_header_stdint_h" = "xyes")
1356 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1358 [ #include <stdint.h> ],
1359 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1361 AC_DEFINE(HAVE_INTXX_T)
1364 [ AC_MSG_RESULT(no) ]
1368 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1371 #include <sys/types.h>
1372 #ifdef HAVE_STDINT_H
1373 # include <stdint.h>
1375 #include <sys/socket.h>
1376 #ifdef HAVE_SYS_BITYPES_H
1377 # include <sys/bitypes.h>
1380 [ int64_t a; a = 1;],
1381 [ ac_cv_have_int64_t="yes" ],
1382 [ ac_cv_have_int64_t="no" ]
1385 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1386 AC_DEFINE(HAVE_INT64_T)
1389 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1391 [ #include <sys/types.h> ],
1392 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1393 [ ac_cv_have_u_intxx_t="yes" ],
1394 [ ac_cv_have_u_intxx_t="no" ]
1397 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1398 AC_DEFINE(HAVE_U_INTXX_T)
1402 if test -z "$have_u_intxx_t" ; then
1403 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1405 [ #include <sys/socket.h> ],
1406 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1408 AC_DEFINE(HAVE_U_INTXX_T)
1411 [ AC_MSG_RESULT(no) ]
1415 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1417 [ #include <sys/types.h> ],
1418 [ u_int64_t a; a = 1;],
1419 [ ac_cv_have_u_int64_t="yes" ],
1420 [ ac_cv_have_u_int64_t="no" ]
1423 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1424 AC_DEFINE(HAVE_U_INT64_T)
1428 if test -z "$have_u_int64_t" ; then
1429 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1431 [ #include <sys/bitypes.h> ],
1432 [ u_int64_t a; a = 1],
1434 AC_DEFINE(HAVE_U_INT64_T)
1437 [ AC_MSG_RESULT(no) ]
1441 if test -z "$have_u_intxx_t" ; then
1442 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1445 #include <sys/types.h>
1447 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1448 [ ac_cv_have_uintxx_t="yes" ],
1449 [ ac_cv_have_uintxx_t="no" ]
1452 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1453 AC_DEFINE(HAVE_UINTXX_T)
1457 if test -z "$have_uintxx_t" ; then
1458 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1460 [ #include <stdint.h> ],
1461 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1463 AC_DEFINE(HAVE_UINTXX_T)
1466 [ AC_MSG_RESULT(no) ]
1470 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1471 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1473 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1476 #include <sys/bitypes.h>
1479 int8_t a; int16_t b; int32_t c;
1480 u_int8_t e; u_int16_t f; u_int32_t g;
1481 a = b = c = e = f = g = 1;
1484 AC_DEFINE(HAVE_U_INTXX_T)
1485 AC_DEFINE(HAVE_INTXX_T)
1493 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1496 #include <sys/types.h>
1498 [ u_char foo; foo = 125; ],
1499 [ ac_cv_have_u_char="yes" ],
1500 [ ac_cv_have_u_char="no" ]
1503 if test "x$ac_cv_have_u_char" = "xyes" ; then
1504 AC_DEFINE(HAVE_U_CHAR)
1509 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1511 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1514 #include <sys/types.h>
1516 [ size_t foo; foo = 1235; ],
1517 [ ac_cv_have_size_t="yes" ],
1518 [ ac_cv_have_size_t="no" ]
1521 if test "x$ac_cv_have_size_t" = "xyes" ; then
1522 AC_DEFINE(HAVE_SIZE_T)
1525 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1528 #include <sys/types.h>
1530 [ ssize_t foo; foo = 1235; ],
1531 [ ac_cv_have_ssize_t="yes" ],
1532 [ ac_cv_have_ssize_t="no" ]
1535 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1536 AC_DEFINE(HAVE_SSIZE_T)
1539 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1544 [ clock_t foo; foo = 1235; ],
1545 [ ac_cv_have_clock_t="yes" ],
1546 [ ac_cv_have_clock_t="no" ]
1549 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1550 AC_DEFINE(HAVE_CLOCK_T)
1553 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1556 #include <sys/types.h>
1557 #include <sys/socket.h>
1559 [ sa_family_t foo; foo = 1235; ],
1560 [ ac_cv_have_sa_family_t="yes" ],
1563 #include <sys/types.h>
1564 #include <sys/socket.h>
1565 #include <netinet/in.h>
1567 [ sa_family_t foo; foo = 1235; ],
1568 [ ac_cv_have_sa_family_t="yes" ],
1570 [ ac_cv_have_sa_family_t="no" ]
1574 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1575 AC_DEFINE(HAVE_SA_FAMILY_T)
1578 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1581 #include <sys/types.h>
1583 [ pid_t foo; foo = 1235; ],
1584 [ ac_cv_have_pid_t="yes" ],
1585 [ ac_cv_have_pid_t="no" ]
1588 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1589 AC_DEFINE(HAVE_PID_T)
1592 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1595 #include <sys/types.h>
1597 [ mode_t foo; foo = 1235; ],
1598 [ ac_cv_have_mode_t="yes" ],
1599 [ ac_cv_have_mode_t="no" ]
1602 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1603 AC_DEFINE(HAVE_MODE_T)
1607 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1610 #include <sys/types.h>
1611 #include <sys/socket.h>
1613 [ struct sockaddr_storage s; ],
1614 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1615 [ ac_cv_have_struct_sockaddr_storage="no" ]
1618 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1619 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1622 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1625 #include <sys/types.h>
1626 #include <netinet/in.h>
1628 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1629 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1630 [ ac_cv_have_struct_sockaddr_in6="no" ]
1633 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1634 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1637 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1640 #include <sys/types.h>
1641 #include <netinet/in.h>
1643 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1644 [ ac_cv_have_struct_in6_addr="yes" ],
1645 [ ac_cv_have_struct_in6_addr="no" ]
1648 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1649 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1652 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1655 #include <sys/types.h>
1656 #include <sys/socket.h>
1659 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1660 [ ac_cv_have_struct_addrinfo="yes" ],
1661 [ ac_cv_have_struct_addrinfo="no" ]
1664 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1665 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1668 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1670 [ #include <sys/time.h> ],
1671 [ struct timeval tv; tv.tv_sec = 1;],
1672 [ ac_cv_have_struct_timeval="yes" ],
1673 [ ac_cv_have_struct_timeval="no" ]
1676 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1677 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1678 have_struct_timeval=1
1681 AC_CHECK_TYPES(struct timespec)
1683 # We need int64_t or else certian parts of the compile will fail.
1684 if test "x$ac_cv_have_int64_t" = "xno" -a \
1685 "x$ac_cv_sizeof_long_int" != "x8" -a \
1686 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1687 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1688 echo "an alternative compiler (I.E., GCC) before continuing."
1692 dnl test snprintf (broken on SCO w/gcc)
1697 #ifdef HAVE_SNPRINTF
1701 char expected_out[50];
1703 #if (SIZEOF_LONG_INT == 8)
1704 long int num = 0x7fffffffffffffff;
1706 long long num = 0x7fffffffffffffffll;
1708 strcpy(expected_out, "9223372036854775807");
1709 snprintf(buf, mazsize, "%lld", num);
1710 if(strcmp(buf, expected_out) != 0)
1717 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1721 dnl Checks for structure members
1722 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1723 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1724 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1725 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1726 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1727 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1728 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1729 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1730 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1731 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1732 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1733 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1734 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1735 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1736 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1737 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1738 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1740 AC_CHECK_MEMBERS([struct stat.st_blksize])
1742 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1743 ac_cv_have_ss_family_in_struct_ss, [
1746 #include <sys/types.h>
1747 #include <sys/socket.h>
1749 [ struct sockaddr_storage s; s.ss_family = 1; ],
1750 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1751 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1754 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1755 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1758 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1759 ac_cv_have___ss_family_in_struct_ss, [
1762 #include <sys/types.h>
1763 #include <sys/socket.h>
1765 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1766 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1767 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1770 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1771 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1774 AC_CACHE_CHECK([for pw_class field in struct passwd],
1775 ac_cv_have_pw_class_in_struct_passwd, [
1780 [ struct passwd p; p.pw_class = 0; ],
1781 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1782 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1785 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1786 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1789 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1790 ac_cv_have_pw_expire_in_struct_passwd, [
1795 [ struct passwd p; p.pw_expire = 0; ],
1796 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1797 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1800 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1801 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1804 AC_CACHE_CHECK([for pw_change field in struct passwd],
1805 ac_cv_have_pw_change_in_struct_passwd, [
1810 [ struct passwd p; p.pw_change = 0; ],
1811 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1812 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1815 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1816 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1819 dnl make sure we're using the real structure members and not defines
1820 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1821 ac_cv_have_accrights_in_msghdr, [
1824 #include <sys/types.h>
1825 #include <sys/socket.h>
1826 #include <sys/uio.h>
1828 #ifdef msg_accrights
1832 m.msg_accrights = 0;
1836 [ ac_cv_have_accrights_in_msghdr="yes" ],
1837 [ ac_cv_have_accrights_in_msghdr="no" ]
1840 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1841 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1844 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1845 ac_cv_have_control_in_msghdr, [
1848 #include <sys/types.h>
1849 #include <sys/socket.h>
1850 #include <sys/uio.h>
1860 [ ac_cv_have_control_in_msghdr="yes" ],
1861 [ ac_cv_have_control_in_msghdr="no" ]
1864 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1865 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1868 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1870 [ extern char *__progname; printf("%s", __progname); ],
1871 [ ac_cv_libc_defines___progname="yes" ],
1872 [ ac_cv_libc_defines___progname="no" ]
1875 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1876 AC_DEFINE(HAVE___PROGNAME)
1879 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1883 [ printf("%s", __FUNCTION__); ],
1884 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1885 [ ac_cv_cc_implements___FUNCTION__="no" ]
1888 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1889 AC_DEFINE(HAVE___FUNCTION__)
1892 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1896 [ printf("%s", __func__); ],
1897 [ ac_cv_cc_implements___func__="yes" ],
1898 [ ac_cv_cc_implements___func__="no" ]
1901 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1902 AC_DEFINE(HAVE___func__)
1905 AC_CACHE_CHECK([whether getopt has optreset support],
1906 ac_cv_have_getopt_optreset, [
1911 [ extern int optreset; optreset = 0; ],
1912 [ ac_cv_have_getopt_optreset="yes" ],
1913 [ ac_cv_have_getopt_optreset="no" ]
1916 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1917 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1920 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1922 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1923 [ ac_cv_libc_defines_sys_errlist="yes" ],
1924 [ ac_cv_libc_defines_sys_errlist="no" ]
1927 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1928 AC_DEFINE(HAVE_SYS_ERRLIST)
1932 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1934 [ extern int sys_nerr; printf("%i", sys_nerr);],
1935 [ ac_cv_libc_defines_sys_nerr="yes" ],
1936 [ ac_cv_libc_defines_sys_nerr="no" ]
1939 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1940 AC_DEFINE(HAVE_SYS_NERR)
1944 # Check whether user wants sectok support
1946 [ --with-sectok Enable smartcard support using libsectok],
1948 if test "x$withval" != "xno" ; then
1949 if test "x$withval" != "xyes" ; then
1950 CPPFLAGS="$CPPFLAGS -I${withval}"
1951 LDFLAGS="$LDFLAGS -L${withval}"
1952 if test ! -z "$need_dash_r" ; then
1953 LDFLAGS="$LDFLAGS -R${withval}"
1955 if test ! -z "$blibpath" ; then
1956 blibpath="$blibpath:${withval}"
1959 AC_CHECK_HEADERS(sectok.h)
1960 if test "$ac_cv_header_sectok_h" != yes; then
1961 AC_MSG_ERROR(Can't find sectok.h)
1963 AC_CHECK_LIB(sectok, sectok_open)
1964 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1965 AC_MSG_ERROR(Can't find libsectok)
1967 AC_DEFINE(SMARTCARD)
1968 AC_DEFINE(USE_SECTOK)
1969 SCARD_MSG="yes, using sectok"
1974 # Check whether user wants OpenSC support
1976 AC_HELP_STRING([--with-opensc=PFX],
1977 [Enable smartcard support using OpenSC]),
1978 opensc_config_prefix="$withval", opensc_config_prefix="")
1979 if test x$opensc_config_prefix != x ; then
1980 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1981 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1982 if test "$OPENSC_CONFIG" != "no"; then
1983 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1984 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1985 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1986 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1987 AC_DEFINE(SMARTCARD)
1988 AC_DEFINE(USE_OPENSC)
1989 SCARD_MSG="yes, using OpenSC"
1993 # Check libraries needed by DNS fingerprint support
1994 AC_SEARCH_LIBS(getrrsetbyname, resolv,
1995 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1997 # Needed by our getrrsetbyname()
1998 AC_SEARCH_LIBS(res_query, resolv)
1999 AC_SEARCH_LIBS(dn_expand, resolv)
2000 AC_CHECK_FUNCS(_getshort _getlong)
2001 AC_CHECK_MEMBER(HEADER.ad,
2002 [AC_DEFINE(HAVE_HEADER_AD)],,
2003 [#include <arpa/nameser.h>])
2006 # Check whether user wants Kerberos 5 support
2008 AC_ARG_WITH(kerberos5,
2009 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2011 if test "x$withval" != "xno" ; then
2012 if test "x$withval" = "xyes" ; then
2013 KRB5ROOT="/usr/local"
2017 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2018 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2021 AC_MSG_CHECKING(whether we are using Heimdal)
2022 AC_TRY_COMPILE([ #include <krb5.h> ],
2023 [ char *tmp = heimdal_version; ],
2024 [ AC_MSG_RESULT(yes)
2026 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2029 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2032 if test ! -z "$need_dash_r" ; then
2033 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2035 if test ! -z "$blibpath" ; then
2036 blibpath="$blibpath:${KRB5ROOT}/lib"
2038 AC_SEARCH_LIBS(dn_expand, resolv)
2040 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2042 K5LIBS="-lgssapi $K5LIBS" ],
2043 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2045 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2046 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2051 AC_CHECK_HEADER(gssapi.h, ,
2052 [ unset ac_cv_header_gssapi_h
2053 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2054 AC_CHECK_HEADERS(gssapi.h, ,
2055 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2061 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2062 AC_CHECK_HEADER(gssapi_krb5.h, ,
2063 [ CPPFLAGS="$oldCPP" ])
2069 LIBS="$LIBS $K5LIBS"
2071 # Looking for programs, paths and files
2073 PRIVSEP_PATH=/var/empty
2074 AC_ARG_WITH(privsep-path,
2075 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2077 if test "x$withval" != "$no" ; then
2078 PRIVSEP_PATH=$withval
2082 AC_SUBST(PRIVSEP_PATH)
2085 [ --with-xauth=PATH Specify path to xauth program ],
2087 if test "x$withval" != "xno" ; then
2093 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2094 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2095 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2096 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2097 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2098 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2099 xauth_path="/usr/openwin/bin/xauth"
2105 AC_ARG_ENABLE(strip,
2106 [ --disable-strip Disable calling strip(1) on install],
2108 if test "x$enableval" = "xno" ; then
2115 if test -z "$xauth_path" ; then
2116 XAUTH_PATH="undefined"
2117 AC_SUBST(XAUTH_PATH)
2119 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2120 XAUTH_PATH=$xauth_path
2121 AC_SUBST(XAUTH_PATH)
2124 # Check for mail directory (last resort if we cannot get it from headers)
2125 if test ! -z "$MAIL" ; then
2126 maildir=`dirname $MAIL`
2127 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2130 if test -z "$no_dev_ptmx" ; then
2131 if test "x$disable_ptmx_check" != "xyes" ; then
2132 AC_CHECK_FILE("/dev/ptmx",
2134 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2140 AC_CHECK_FILE("/dev/ptc",
2142 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2147 # Options from here on. Some of these are preset by platform above
2148 AC_ARG_WITH(mantype,
2149 [ --with-mantype=man|cat|doc Set man page type],
2156 AC_MSG_ERROR(invalid man type: $withval)
2161 if test -z "$MANTYPE"; then
2162 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2163 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2164 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2166 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2173 if test "$MANTYPE" = "doc"; then
2180 # Check whether to enable MD5 passwords
2182 AC_ARG_WITH(md5-passwords,
2183 [ --with-md5-passwords Enable use of MD5 passwords],
2185 if test "x$withval" != "xno" ; then
2186 AC_DEFINE(HAVE_MD5_PASSWORDS)
2192 # Whether to disable shadow password support
2194 [ --without-shadow Disable shadow password support],
2196 if test "x$withval" = "xno" ; then
2197 AC_DEFINE(DISABLE_SHADOW)
2203 if test -z "$disable_shadow" ; then
2204 AC_MSG_CHECKING([if the systems has expire shadow information])
2207 #include <sys/types.h>
2210 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2211 [ sp_expire_available=yes ], []
2214 if test "x$sp_expire_available" = "xyes" ; then
2216 AC_DEFINE(HAS_SHADOW_EXPIRE)
2222 # Use ip address instead of hostname in $DISPLAY
2223 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2224 DISPLAY_HACK_MSG="yes"
2225 AC_DEFINE(IPADDR_IN_DISPLAY)
2227 DISPLAY_HACK_MSG="no"
2228 AC_ARG_WITH(ipaddr-display,
2229 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2231 if test "x$withval" != "xno" ; then
2232 AC_DEFINE(IPADDR_IN_DISPLAY)
2233 DISPLAY_HACK_MSG="yes"
2239 # check for /etc/default/login and use it if present.
2240 AC_ARG_ENABLE(etc-default-login,
2241 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2243 AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2245 if test "x$external_path_file" = "x/etc/default/login"; then
2246 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2250 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2251 if test $ac_cv_func_login_getcapbool = "yes" -a \
2252 $ac_cv_header_login_cap_h = "yes" ; then
2253 external_path_file=/etc/login.conf
2256 # Whether to mess with the default path
2257 SERVER_PATH_MSG="(default)"
2258 AC_ARG_WITH(default-path,
2259 [ --with-default-path= Specify default \$PATH environment for server],
2261 if test "x$external_path_file" = "x/etc/login.conf" ; then
2263 --with-default-path=PATH has no effect on this system.
2264 Edit /etc/login.conf instead.])
2265 elif test "x$withval" != "xno" ; then
2266 if test ! -z "$external_path_file" ; then
2268 --with-default-path=PATH will only be used if PATH is not defined in
2269 $external_path_file .])
2271 user_path="$withval"
2272 SERVER_PATH_MSG="$withval"
2275 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2276 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2278 if test ! -z "$external_path_file" ; then
2280 If PATH is defined in $external_path_file, ensure the path to scp is included,
2281 otherwise scp will not work.])
2285 /* find out what STDPATH is */
2290 #ifndef _PATH_STDPATH
2291 # ifdef _PATH_USERPATH /* Irix */
2292 # define _PATH_STDPATH _PATH_USERPATH
2294 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2297 #include <sys/types.h>
2298 #include <sys/stat.h>
2300 #define DATA "conftest.stdpath"
2307 fd = fopen(DATA,"w");
2311 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2316 ], [ user_path=`cat conftest.stdpath` ],
2317 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2318 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2320 # make sure $bindir is in USER_PATH so scp will work
2321 t_bindir=`eval echo ${bindir}`
2323 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2326 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2328 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2329 if test $? -ne 0 ; then
2330 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2331 if test $? -ne 0 ; then
2332 user_path=$user_path:$t_bindir
2333 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2338 if test "x$external_path_file" != "x/etc/login.conf" ; then
2339 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2343 # Set superuser path separately to user path
2344 AC_ARG_WITH(superuser-path,
2345 [ --with-superuser-path= Specify different path for super-user],
2347 if test "x$withval" != "xno" ; then
2348 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2349 superuser_path=$withval
2355 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2356 IPV4_IN6_HACK_MSG="no"
2358 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2360 if test "x$withval" != "xno" ; then
2362 AC_DEFINE(IPV4_IN_IPV6)
2363 IPV4_IN6_HACK_MSG="yes"
2368 if test "x$inet6_default_4in6" = "xyes"; then
2369 AC_MSG_RESULT([yes (default)])
2370 AC_DEFINE(IPV4_IN_IPV6)
2371 IPV4_IN6_HACK_MSG="yes"
2373 AC_MSG_RESULT([no (default)])
2378 # Whether to enable BSD auth support
2380 AC_ARG_WITH(bsd-auth,
2381 [ --with-bsd-auth Enable BSD auth support],
2383 if test "x$withval" != "xno" ; then
2390 # Where to place sshd.pid
2392 # make sure the directory exists
2393 if test ! -d $piddir ; then
2394 piddir=`eval echo ${sysconfdir}`
2396 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2400 AC_ARG_WITH(pid-dir,
2401 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2403 if test "x$withval" != "xno" ; then
2405 if test ! -d $piddir ; then
2406 AC_MSG_WARN([** no $piddir directory on this system **])
2412 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2415 dnl allow user to disable some login recording features
2416 AC_ARG_ENABLE(lastlog,
2417 [ --disable-lastlog disable use of lastlog even if detected [no]],
2419 if test "x$enableval" = "xno" ; then
2420 AC_DEFINE(DISABLE_LASTLOG)
2425 [ --disable-utmp disable use of utmp even if detected [no]],
2427 if test "x$enableval" = "xno" ; then
2428 AC_DEFINE(DISABLE_UTMP)
2432 AC_ARG_ENABLE(utmpx,
2433 [ --disable-utmpx disable use of utmpx even if detected [no]],
2435 if test "x$enableval" = "xno" ; then
2436 AC_DEFINE(DISABLE_UTMPX)
2441 [ --disable-wtmp disable use of wtmp even if detected [no]],
2443 if test "x$enableval" = "xno" ; then
2444 AC_DEFINE(DISABLE_WTMP)
2448 AC_ARG_ENABLE(wtmpx,
2449 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2451 if test "x$enableval" = "xno" ; then
2452 AC_DEFINE(DISABLE_WTMPX)
2456 AC_ARG_ENABLE(libutil,
2457 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2459 if test "x$enableval" = "xno" ; then
2460 AC_DEFINE(DISABLE_LOGIN)
2464 AC_ARG_ENABLE(pututline,
2465 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2467 if test "x$enableval" = "xno" ; then
2468 AC_DEFINE(DISABLE_PUTUTLINE)
2472 AC_ARG_ENABLE(pututxline,
2473 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2475 if test "x$enableval" = "xno" ; then
2476 AC_DEFINE(DISABLE_PUTUTXLINE)
2480 AC_ARG_WITH(lastlog,
2481 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2483 if test "x$withval" = "xno" ; then
2484 AC_DEFINE(DISABLE_LASTLOG)
2486 conf_lastlog_location=$withval
2491 dnl lastlog, [uw]tmpx? detection
2492 dnl NOTE: set the paths in the platform section to avoid the
2493 dnl need for command-line parameters
2494 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2496 dnl lastlog detection
2497 dnl NOTE: the code itself will detect if lastlog is a directory
2498 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2500 #include <sys/types.h>
2502 #ifdef HAVE_LASTLOG_H
2503 # include <lastlog.h>
2512 [ char *lastlog = LASTLOG_FILE; ],
2513 [ AC_MSG_RESULT(yes) ],
2516 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2518 #include <sys/types.h>
2520 #ifdef HAVE_LASTLOG_H
2521 # include <lastlog.h>
2527 [ char *lastlog = _PATH_LASTLOG; ],
2528 [ AC_MSG_RESULT(yes) ],
2531 system_lastlog_path=no
2536 if test -z "$conf_lastlog_location"; then
2537 if test x"$system_lastlog_path" = x"no" ; then
2538 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2539 if (test -d "$f" || test -f "$f") ; then
2540 conf_lastlog_location=$f
2543 if test -z "$conf_lastlog_location"; then
2544 AC_MSG_WARN([** Cannot find lastlog **])
2545 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2550 if test -n "$conf_lastlog_location"; then
2551 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2555 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2557 #include <sys/types.h>
2563 [ char *utmp = UTMP_FILE; ],
2564 [ AC_MSG_RESULT(yes) ],
2566 system_utmp_path=no ]
2568 if test -z "$conf_utmp_location"; then
2569 if test x"$system_utmp_path" = x"no" ; then
2570 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2571 if test -f $f ; then
2572 conf_utmp_location=$f
2575 if test -z "$conf_utmp_location"; then
2576 AC_DEFINE(DISABLE_UTMP)
2580 if test -n "$conf_utmp_location"; then
2581 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2585 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2587 #include <sys/types.h>
2593 [ char *wtmp = WTMP_FILE; ],
2594 [ AC_MSG_RESULT(yes) ],
2596 system_wtmp_path=no ]
2598 if test -z "$conf_wtmp_location"; then
2599 if test x"$system_wtmp_path" = x"no" ; then
2600 for f in /usr/adm/wtmp /var/log/wtmp; do
2601 if test -f $f ; then
2602 conf_wtmp_location=$f
2605 if test -z "$conf_wtmp_location"; then
2606 AC_DEFINE(DISABLE_WTMP)
2610 if test -n "$conf_wtmp_location"; then
2611 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2615 dnl utmpx detection - I don't know any system so perverse as to require
2616 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2618 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2620 #include <sys/types.h>
2629 [ char *utmpx = UTMPX_FILE; ],
2630 [ AC_MSG_RESULT(yes) ],
2632 system_utmpx_path=no ]
2634 if test -z "$conf_utmpx_location"; then
2635 if test x"$system_utmpx_path" = x"no" ; then
2636 AC_DEFINE(DISABLE_UTMPX)
2639 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2643 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2645 #include <sys/types.h>
2654 [ char *wtmpx = WTMPX_FILE; ],
2655 [ AC_MSG_RESULT(yes) ],
2657 system_wtmpx_path=no ]
2659 if test -z "$conf_wtmpx_location"; then
2660 if test x"$system_wtmpx_path" = x"no" ; then
2661 AC_DEFINE(DISABLE_WTMPX)
2664 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2668 if test ! -z "$blibpath" ; then
2669 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2670 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2673 dnl remove pam and dl because they are in $LIBPAM
2674 if test "$PAM_MSG" = yes ; then
2675 LIBS=`echo $LIBS | sed 's/-lpam //'`
2677 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2678 LIBS=`echo $LIBS | sed 's/-ldl //'`
2682 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2685 # Print summary of options
2687 # Someone please show me a better way :)
2688 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2689 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2690 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2691 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2692 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2693 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2694 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2695 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2696 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2697 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2700 echo "OpenSSH has been configured with the following options:"
2701 echo " User binaries: $B"
2702 echo " System binaries: $C"
2703 echo " Configuration files: $D"
2704 echo " Askpass program: $E"
2705 echo " Manual pages: $F"
2706 echo " PID file: $G"
2707 echo " Privilege separation chroot path: $H"
2708 if test "x$external_path_file" = "x/etc/login.conf" ; then
2709 echo " At runtime, sshd will use the path defined in $external_path_file"
2710 echo " Make sure the path to scp is present, otherwise scp will not work"
2712 echo " sshd default user PATH: $I"
2713 if test ! -z "$external_path_file"; then
2714 echo " (If PATH is set in $external_path_file it will be used instead. If"
2715 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2718 if test ! -z "$superuser_path" ; then
2719 echo " sshd superuser user PATH: $J"
2721 echo " Manpage format: $MANTYPE"
2722 echo " DNS support: $DNS_MSG"
2723 echo " PAM support: $PAM_MSG"
2724 echo " KerberosV support: $KRB5_MSG"
2725 echo " Smartcard support: $SCARD_MSG"
2726 echo " S/KEY support: $SKEY_MSG"
2727 echo " TCP Wrappers support: $TCPW_MSG"
2728 echo " MD5 password support: $MD5_MSG"
2729 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2730 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2731 echo " BSD Auth support: $BSD_AUTH_MSG"
2732 echo " Random number source: $RAND_MSG"
2733 if test ! -z "$USE_RAND_HELPER" ; then
2734 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2739 echo " Host: ${host}"
2740 echo " Compiler: ${CC}"
2741 echo " Compiler flags: ${CFLAGS}"
2742 echo "Preprocessor flags: ${CPPFLAGS}"
2743 echo " Linker flags: ${LDFLAGS}"
2744 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2748 if test "x$PAM_MSG" = "xyes" ; then
2749 echo "PAM is enabled. You may need to install a PAM control file "
2750 echo "for sshd, otherwise password authentication may fail. "
2751 echo "Example PAM control files can be found in the contrib/ "
2756 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2757 echo "WARNING: you are using the builtin random number collection "
2758 echo "service. Please read WARNING.RNG and request that your OS "
2759 echo "vendor includes kernel-based random number collection in "
2760 echo "future versions of your OS."