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 Checks for time functions
784 AC_CHECK_FUNCS(gettimeofday time)
785 dnl Checks for utmp functions
786 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
787 AC_CHECK_FUNCS(utmpname)
788 dnl Checks for utmpx functions
789 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
790 AC_CHECK_FUNCS(setutxent utmpxname)
792 AC_CHECK_FUNC(daemon,
793 [AC_DEFINE(HAVE_DAEMON)],
794 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
797 AC_CHECK_FUNC(getpagesize,
798 [AC_DEFINE(HAVE_GETPAGESIZE)],
799 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
802 # Check for broken snprintf
803 if test "x$ac_cv_func_snprintf" = "xyes" ; then
804 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
808 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
810 [AC_MSG_RESULT(yes)],
813 AC_DEFINE(BROKEN_SNPRINTF)
814 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
819 dnl see whether mkstemp() requires XXXXXX
820 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
821 AC_MSG_CHECKING([for (overly) strict mkstemp])
825 main() { char template[]="conftest.mkstemp-test";
826 if (mkstemp(template) == -1)
828 unlink(template); exit(0);
836 AC_DEFINE(HAVE_STRICT_MKSTEMP)
840 AC_DEFINE(HAVE_STRICT_MKSTEMP)
845 dnl make sure that openpty does not reacquire controlling terminal
846 if test ! -z "$check_for_openpty_ctty_bug"; then
847 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
851 #include <sys/fcntl.h>
852 #include <sys/types.h>
853 #include <sys/wait.h>
859 int fd, ptyfd, ttyfd, status;
862 if (pid < 0) { /* failed */
864 } else if (pid > 0) { /* parent */
865 waitpid(pid, &status, 0);
866 if (WIFEXITED(status))
867 exit(WEXITSTATUS(status));
871 close(0); close(1); close(2);
873 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
874 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
876 exit(3); /* Acquired ctty: broken */
878 exit(0); /* Did not acquire ctty: OK */
887 AC_DEFINE(SSHD_ACQUIRES_CTTY)
897 [ --with-pam Enable PAM support ],
899 if test "x$withval" != "xno" ; then
900 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
901 AC_MSG_ERROR([PAM headers not found])
904 AC_CHECK_LIB(dl, dlopen, , )
905 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
906 AC_CHECK_FUNCS(pam_getenvlist)
907 AC_CHECK_FUNCS(pam_putenv)
912 if test $ac_cv_lib_dl_dlopen = yes; then
922 # Check for older PAM
923 if test "x$PAM_MSG" = "xyes" ; then
924 # Check PAM strerror arguments (old PAM)
925 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
929 #include <security/pam_appl.h>
931 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
934 AC_DEFINE(HAVE_OLD_PAM)
936 PAM_MSG="yes (old library)"
941 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
942 # because the system crypt() is more featureful.
943 if test "x$check_for_libcrypt_before" = "x1"; then
944 AC_CHECK_LIB(crypt, crypt)
948 saved_CPPFLAGS="$CPPFLAGS"
949 saved_LDFLAGS="$LDFLAGS"
951 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
953 if test "x$withval" != "xno" ; then
954 if test -d "$withval/lib"; then
955 if test -n "${need_dash_r}"; then
956 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
958 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
961 if test -n "${need_dash_r}"; then
962 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
964 LDFLAGS="-L${withval} ${LDFLAGS}"
967 if test -d "$withval/include"; then
968 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
970 CPPFLAGS="-I${withval} ${CPPFLAGS}"
975 LIBS="$LIBS -lcrypto"
976 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
978 dnl Check default openssl install dir
979 if test -n "${need_dash_r}"; then
980 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
982 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
984 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
985 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
987 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
993 # Determine OpenSSL header version
994 AC_MSG_CHECKING([OpenSSL header version])
999 #include <openssl/opensslv.h>
1000 #define DATA "conftest.sslincver"
1005 fd = fopen(DATA,"w");
1009 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1016 ssl_header_ver=`cat conftest.sslincver`
1017 AC_MSG_RESULT($ssl_header_ver)
1020 AC_MSG_RESULT(not found)
1021 AC_MSG_ERROR(OpenSSL version header not found.)
1025 # Determine OpenSSL library version
1026 AC_MSG_CHECKING([OpenSSL library version])
1031 #include <openssl/opensslv.h>
1032 #include <openssl/crypto.h>
1033 #define DATA "conftest.ssllibver"
1038 fd = fopen(DATA,"w");
1042 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1049 ssl_library_ver=`cat conftest.ssllibver`
1050 AC_MSG_RESULT($ssl_library_ver)
1053 AC_MSG_RESULT(not found)
1054 AC_MSG_ERROR(OpenSSL library not found.)
1058 # Sanity check OpenSSL headers
1059 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1063 #include <openssl/opensslv.h>
1064 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1071 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1072 Check config.log for details.
1073 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1077 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1078 # version in OpenSSL. Skip this for PAM
1079 if test "x$check_for_libcrypt_later" = "x1"; then
1080 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1084 ### Configure cryptographic random number support
1086 # Check wheter OpenSSL seeds itself
1087 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1091 #include <openssl/rand.h>
1092 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1095 OPENSSL_SEEDS_ITSELF=yes
1100 # Default to use of the rand helper if OpenSSL doesn't
1107 # Do we want to force the use of the rand helper?
1108 AC_ARG_WITH(rand-helper,
1109 [ --with-rand-helper Use subprocess to gather strong randomness ],
1111 if test "x$withval" = "xno" ; then
1112 # Force use of OpenSSL's internal RNG, even if
1113 # the previous test showed it to be unseeded.
1114 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1115 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1116 OPENSSL_SEEDS_ITSELF=yes
1125 # Which randomness source do we use?
1126 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1128 AC_DEFINE(OPENSSL_PRNG_ONLY)
1129 RAND_MSG="OpenSSL internal ONLY"
1130 INSTALL_SSH_RAND_HELPER=""
1131 elif test ! -z "$USE_RAND_HELPER" ; then
1132 # install rand helper
1133 RAND_MSG="ssh-rand-helper"
1134 INSTALL_SSH_RAND_HELPER="yes"
1136 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1138 ### Configuration of ssh-rand-helper
1141 AC_ARG_WITH(prngd-port,
1142 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1151 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1154 if test ! -z "$withval" ; then
1155 PRNGD_PORT="$withval"
1156 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1161 # PRNGD Unix domain socket
1162 AC_ARG_WITH(prngd-socket,
1163 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1167 withval="/var/run/egd-pool"
1175 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1179 if test ! -z "$withval" ; then
1180 if test ! -z "$PRNGD_PORT" ; then
1181 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1183 if test ! -r "$withval" ; then
1184 AC_MSG_WARN(Entropy socket is not readable)
1186 PRNGD_SOCKET="$withval"
1187 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1191 # Check for existing socket only if we don't have a random device already
1192 if test "$USE_RAND_HELPER" = yes ; then
1193 AC_MSG_CHECKING(for PRNGD/EGD socket)
1194 # Insert other locations here
1195 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1196 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1197 PRNGD_SOCKET="$sock"
1198 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1202 if test ! -z "$PRNGD_SOCKET" ; then
1203 AC_MSG_RESULT($PRNGD_SOCKET)
1205 AC_MSG_RESULT(not found)
1211 # Change default command timeout for hashing entropy source
1213 AC_ARG_WITH(entropy-timeout,
1214 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1216 if test "x$withval" != "xno" ; then
1217 entropy_timeout=$withval
1221 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1223 SSH_PRIVSEP_USER=sshd
1224 AC_ARG_WITH(privsep-user,
1225 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1227 if test -n "$withval"; then
1228 SSH_PRIVSEP_USER=$withval
1232 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1233 AC_SUBST(SSH_PRIVSEP_USER)
1235 # We do this little dance with the search path to insure
1236 # that programs that we select for use by installed programs
1237 # (which may be run by the super-user) come from trusted
1238 # locations before they come from the user's private area.
1239 # This should help avoid accidentally configuring some
1240 # random version of a program in someone's personal bin.
1244 test -h /bin 2> /dev/null && PATH=/usr/bin
1245 test -d /sbin && PATH=$PATH:/sbin
1246 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1247 PATH=$PATH:/etc:$OPATH
1249 # These programs are used by the command hashing source to gather entropy
1250 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1251 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1252 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1253 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1254 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1255 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1256 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1257 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1258 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1259 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1260 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1261 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1262 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1263 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1264 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1265 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1269 # Where does ssh-rand-helper get its randomness from?
1270 INSTALL_SSH_PRNG_CMDS=""
1271 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1272 if test ! -z "$PRNGD_PORT" ; then
1273 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1274 elif test ! -z "$PRNGD_SOCKET" ; then
1275 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1277 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1278 RAND_HELPER_CMDHASH=yes
1279 INSTALL_SSH_PRNG_CMDS="yes"
1282 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1285 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1286 if test ! -z "$SONY" ; then
1287 LIBS="$LIBS -liberty";
1290 # Checks for data types
1291 AC_CHECK_SIZEOF(char, 1)
1292 AC_CHECK_SIZEOF(short int, 2)
1293 AC_CHECK_SIZEOF(int, 4)
1294 AC_CHECK_SIZEOF(long int, 4)
1295 AC_CHECK_SIZEOF(long long int, 8)
1297 # Sanity check long long for some platforms (AIX)
1298 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1299 ac_cv_sizeof_long_long_int=0
1302 # More checks for data types
1303 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1305 [ #include <sys/types.h> ],
1307 [ ac_cv_have_u_int="yes" ],
1308 [ ac_cv_have_u_int="no" ]
1311 if test "x$ac_cv_have_u_int" = "xyes" ; then
1312 AC_DEFINE(HAVE_U_INT)
1316 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1318 [ #include <sys/types.h> ],
1319 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1320 [ ac_cv_have_intxx_t="yes" ],
1321 [ ac_cv_have_intxx_t="no" ]
1324 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1325 AC_DEFINE(HAVE_INTXX_T)
1329 if (test -z "$have_intxx_t" && \
1330 test "x$ac_cv_header_stdint_h" = "xyes")
1332 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1334 [ #include <stdint.h> ],
1335 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1337 AC_DEFINE(HAVE_INTXX_T)
1340 [ AC_MSG_RESULT(no) ]
1344 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1347 #include <sys/types.h>
1348 #ifdef HAVE_STDINT_H
1349 # include <stdint.h>
1351 #include <sys/socket.h>
1352 #ifdef HAVE_SYS_BITYPES_H
1353 # include <sys/bitypes.h>
1356 [ int64_t a; a = 1;],
1357 [ ac_cv_have_int64_t="yes" ],
1358 [ ac_cv_have_int64_t="no" ]
1361 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1362 AC_DEFINE(HAVE_INT64_T)
1365 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1367 [ #include <sys/types.h> ],
1368 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1369 [ ac_cv_have_u_intxx_t="yes" ],
1370 [ ac_cv_have_u_intxx_t="no" ]
1373 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1374 AC_DEFINE(HAVE_U_INTXX_T)
1378 if test -z "$have_u_intxx_t" ; then
1379 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1381 [ #include <sys/socket.h> ],
1382 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1384 AC_DEFINE(HAVE_U_INTXX_T)
1387 [ AC_MSG_RESULT(no) ]
1391 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1393 [ #include <sys/types.h> ],
1394 [ u_int64_t a; a = 1;],
1395 [ ac_cv_have_u_int64_t="yes" ],
1396 [ ac_cv_have_u_int64_t="no" ]
1399 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1400 AC_DEFINE(HAVE_U_INT64_T)
1404 if test -z "$have_u_int64_t" ; then
1405 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1407 [ #include <sys/bitypes.h> ],
1408 [ u_int64_t a; a = 1],
1410 AC_DEFINE(HAVE_U_INT64_T)
1413 [ AC_MSG_RESULT(no) ]
1417 if test -z "$have_u_intxx_t" ; then
1418 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1421 #include <sys/types.h>
1423 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1424 [ ac_cv_have_uintxx_t="yes" ],
1425 [ ac_cv_have_uintxx_t="no" ]
1428 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1429 AC_DEFINE(HAVE_UINTXX_T)
1433 if test -z "$have_uintxx_t" ; then
1434 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1436 [ #include <stdint.h> ],
1437 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1439 AC_DEFINE(HAVE_UINTXX_T)
1442 [ AC_MSG_RESULT(no) ]
1446 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1447 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1449 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1452 #include <sys/bitypes.h>
1455 int8_t a; int16_t b; int32_t c;
1456 u_int8_t e; u_int16_t f; u_int32_t g;
1457 a = b = c = e = f = g = 1;
1460 AC_DEFINE(HAVE_U_INTXX_T)
1461 AC_DEFINE(HAVE_INTXX_T)
1469 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1472 #include <sys/types.h>
1474 [ u_char foo; foo = 125; ],
1475 [ ac_cv_have_u_char="yes" ],
1476 [ ac_cv_have_u_char="no" ]
1479 if test "x$ac_cv_have_u_char" = "xyes" ; then
1480 AC_DEFINE(HAVE_U_CHAR)
1485 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1487 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1490 #include <sys/types.h>
1492 [ size_t foo; foo = 1235; ],
1493 [ ac_cv_have_size_t="yes" ],
1494 [ ac_cv_have_size_t="no" ]
1497 if test "x$ac_cv_have_size_t" = "xyes" ; then
1498 AC_DEFINE(HAVE_SIZE_T)
1501 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1504 #include <sys/types.h>
1506 [ ssize_t foo; foo = 1235; ],
1507 [ ac_cv_have_ssize_t="yes" ],
1508 [ ac_cv_have_ssize_t="no" ]
1511 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1512 AC_DEFINE(HAVE_SSIZE_T)
1515 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1520 [ clock_t foo; foo = 1235; ],
1521 [ ac_cv_have_clock_t="yes" ],
1522 [ ac_cv_have_clock_t="no" ]
1525 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1526 AC_DEFINE(HAVE_CLOCK_T)
1529 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1532 #include <sys/types.h>
1533 #include <sys/socket.h>
1535 [ sa_family_t foo; foo = 1235; ],
1536 [ ac_cv_have_sa_family_t="yes" ],
1539 #include <sys/types.h>
1540 #include <sys/socket.h>
1541 #include <netinet/in.h>
1543 [ sa_family_t foo; foo = 1235; ],
1544 [ ac_cv_have_sa_family_t="yes" ],
1546 [ ac_cv_have_sa_family_t="no" ]
1550 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1551 AC_DEFINE(HAVE_SA_FAMILY_T)
1554 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1557 #include <sys/types.h>
1559 [ pid_t foo; foo = 1235; ],
1560 [ ac_cv_have_pid_t="yes" ],
1561 [ ac_cv_have_pid_t="no" ]
1564 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1565 AC_DEFINE(HAVE_PID_T)
1568 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1571 #include <sys/types.h>
1573 [ mode_t foo; foo = 1235; ],
1574 [ ac_cv_have_mode_t="yes" ],
1575 [ ac_cv_have_mode_t="no" ]
1578 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1579 AC_DEFINE(HAVE_MODE_T)
1583 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1586 #include <sys/types.h>
1587 #include <sys/socket.h>
1589 [ struct sockaddr_storage s; ],
1590 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1591 [ ac_cv_have_struct_sockaddr_storage="no" ]
1594 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1595 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1598 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1601 #include <sys/types.h>
1602 #include <netinet/in.h>
1604 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1605 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1606 [ ac_cv_have_struct_sockaddr_in6="no" ]
1609 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1610 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1613 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1616 #include <sys/types.h>
1617 #include <netinet/in.h>
1619 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1620 [ ac_cv_have_struct_in6_addr="yes" ],
1621 [ ac_cv_have_struct_in6_addr="no" ]
1624 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1625 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1628 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1631 #include <sys/types.h>
1632 #include <sys/socket.h>
1635 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1636 [ ac_cv_have_struct_addrinfo="yes" ],
1637 [ ac_cv_have_struct_addrinfo="no" ]
1640 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1641 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1644 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1646 [ #include <sys/time.h> ],
1647 [ struct timeval tv; tv.tv_sec = 1;],
1648 [ ac_cv_have_struct_timeval="yes" ],
1649 [ ac_cv_have_struct_timeval="no" ]
1652 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1653 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1654 have_struct_timeval=1
1657 AC_CHECK_TYPES(struct timespec)
1659 # We need int64_t or else certian parts of the compile will fail.
1660 if test "x$ac_cv_have_int64_t" = "xno" -a \
1661 "x$ac_cv_sizeof_long_int" != "x8" -a \
1662 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1663 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1664 echo "an alternative compiler (I.E., GCC) before continuing."
1668 dnl test snprintf (broken on SCO w/gcc)
1673 #ifdef HAVE_SNPRINTF
1677 char expected_out[50];
1679 #if (SIZEOF_LONG_INT == 8)
1680 long int num = 0x7fffffffffffffff;
1682 long long num = 0x7fffffffffffffffll;
1684 strcpy(expected_out, "9223372036854775807");
1685 snprintf(buf, mazsize, "%lld", num);
1686 if(strcmp(buf, expected_out) != 0)
1693 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1697 dnl Checks for structure members
1698 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1699 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1700 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1701 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1702 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1703 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1704 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1705 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1706 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1707 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1708 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1709 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1710 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1711 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1712 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1713 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1714 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1716 AC_CHECK_MEMBERS([struct stat.st_blksize])
1718 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1719 ac_cv_have_ss_family_in_struct_ss, [
1722 #include <sys/types.h>
1723 #include <sys/socket.h>
1725 [ struct sockaddr_storage s; s.ss_family = 1; ],
1726 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1727 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1730 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1731 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1734 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1735 ac_cv_have___ss_family_in_struct_ss, [
1738 #include <sys/types.h>
1739 #include <sys/socket.h>
1741 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1742 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1743 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1746 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1747 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1750 AC_CACHE_CHECK([for pw_class field in struct passwd],
1751 ac_cv_have_pw_class_in_struct_passwd, [
1756 [ struct passwd p; p.pw_class = 0; ],
1757 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1758 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1761 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1762 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1765 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1766 ac_cv_have_pw_expire_in_struct_passwd, [
1771 [ struct passwd p; p.pw_expire = 0; ],
1772 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1773 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1776 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1777 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1780 AC_CACHE_CHECK([for pw_change field in struct passwd],
1781 ac_cv_have_pw_change_in_struct_passwd, [
1786 [ struct passwd p; p.pw_change = 0; ],
1787 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1788 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1791 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1792 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1795 dnl make sure we're using the real structure members and not defines
1796 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1797 ac_cv_have_accrights_in_msghdr, [
1800 #include <sys/types.h>
1801 #include <sys/socket.h>
1802 #include <sys/uio.h>
1804 #ifdef msg_accrights
1808 m.msg_accrights = 0;
1812 [ ac_cv_have_accrights_in_msghdr="yes" ],
1813 [ ac_cv_have_accrights_in_msghdr="no" ]
1816 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1817 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1820 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1821 ac_cv_have_control_in_msghdr, [
1824 #include <sys/types.h>
1825 #include <sys/socket.h>
1826 #include <sys/uio.h>
1836 [ ac_cv_have_control_in_msghdr="yes" ],
1837 [ ac_cv_have_control_in_msghdr="no" ]
1840 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1841 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1844 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1846 [ extern char *__progname; printf("%s", __progname); ],
1847 [ ac_cv_libc_defines___progname="yes" ],
1848 [ ac_cv_libc_defines___progname="no" ]
1851 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1852 AC_DEFINE(HAVE___PROGNAME)
1855 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1859 [ printf("%s", __FUNCTION__); ],
1860 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1861 [ ac_cv_cc_implements___FUNCTION__="no" ]
1864 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1865 AC_DEFINE(HAVE___FUNCTION__)
1868 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1872 [ printf("%s", __func__); ],
1873 [ ac_cv_cc_implements___func__="yes" ],
1874 [ ac_cv_cc_implements___func__="no" ]
1877 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1878 AC_DEFINE(HAVE___func__)
1881 AC_CACHE_CHECK([whether getopt has optreset support],
1882 ac_cv_have_getopt_optreset, [
1887 [ extern int optreset; optreset = 0; ],
1888 [ ac_cv_have_getopt_optreset="yes" ],
1889 [ ac_cv_have_getopt_optreset="no" ]
1892 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1893 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1896 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1898 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1899 [ ac_cv_libc_defines_sys_errlist="yes" ],
1900 [ ac_cv_libc_defines_sys_errlist="no" ]
1903 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1904 AC_DEFINE(HAVE_SYS_ERRLIST)
1908 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1910 [ extern int sys_nerr; printf("%i", sys_nerr);],
1911 [ ac_cv_libc_defines_sys_nerr="yes" ],
1912 [ ac_cv_libc_defines_sys_nerr="no" ]
1915 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1916 AC_DEFINE(HAVE_SYS_NERR)
1920 # Check whether user wants sectok support
1922 [ --with-sectok Enable smartcard support using libsectok],
1924 if test "x$withval" != "xno" ; then
1925 if test "x$withval" != "xyes" ; then
1926 CPPFLAGS="$CPPFLAGS -I${withval}"
1927 LDFLAGS="$LDFLAGS -L${withval}"
1928 if test ! -z "$need_dash_r" ; then
1929 LDFLAGS="$LDFLAGS -R${withval}"
1931 if test ! -z "$blibpath" ; then
1932 blibpath="$blibpath:${withval}"
1935 AC_CHECK_HEADERS(sectok.h)
1936 if test "$ac_cv_header_sectok_h" != yes; then
1937 AC_MSG_ERROR(Can't find sectok.h)
1939 AC_CHECK_LIB(sectok, sectok_open)
1940 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1941 AC_MSG_ERROR(Can't find libsectok)
1943 AC_DEFINE(SMARTCARD)
1944 AC_DEFINE(USE_SECTOK)
1945 SCARD_MSG="yes, using sectok"
1950 # Check whether user wants OpenSC support
1952 AC_HELP_STRING([--with-opensc=PFX],
1953 [Enable smartcard support using OpenSC]),
1954 opensc_config_prefix="$withval", opensc_config_prefix="")
1955 if test x$opensc_config_prefix != x ; then
1956 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1957 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1958 if test "$OPENSC_CONFIG" != "no"; then
1959 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1960 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1961 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1962 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1963 AC_DEFINE(SMARTCARD)
1964 AC_DEFINE(USE_OPENSC)
1965 SCARD_MSG="yes, using OpenSC"
1969 # Check libraries needed by DNS fingerprint support
1970 AC_SEARCH_LIBS(getrrsetbyname, resolv,
1971 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1973 # Needed by our getrrsetbyname()
1974 AC_SEARCH_LIBS(res_query, resolv)
1975 AC_SEARCH_LIBS(dn_expand, resolv)
1976 AC_CHECK_FUNCS(_getshort _getlong)
1977 AC_CHECK_MEMBER(HEADER.ad,
1978 [AC_DEFINE(HAVE_HEADER_AD)],,
1979 [#include <arpa/nameser.h>])
1982 # Check whether user wants Kerberos 5 support
1984 AC_ARG_WITH(kerberos5,
1985 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1987 if test "x$withval" != "xno" ; then
1988 if test "x$withval" = "xyes" ; then
1989 KRB5ROOT="/usr/local"
1993 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1994 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1997 AC_MSG_CHECKING(whether we are using Heimdal)
1998 AC_TRY_COMPILE([ #include <krb5.h> ],
1999 [ char *tmp = heimdal_version; ],
2000 [ AC_MSG_RESULT(yes)
2002 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2005 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2008 if test ! -z "$need_dash_r" ; then
2009 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2011 if test ! -z "$blibpath" ; then
2012 blibpath="$blibpath:${KRB5ROOT}/lib"
2014 AC_SEARCH_LIBS(dn_expand, resolv)
2016 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2018 K5LIBS="-lgssapi $K5LIBS" ],
2019 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2021 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2022 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2027 AC_CHECK_HEADER(gssapi.h, ,
2028 [ unset ac_cv_header_gssapi_h
2029 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2030 AC_CHECK_HEADERS(gssapi.h, ,
2031 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2037 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2038 AC_CHECK_HEADER(gssapi_krb5.h, ,
2039 [ CPPFLAGS="$oldCPP" ])
2045 LIBS="$LIBS $K5LIBS"
2047 # Looking for programs, paths and files
2049 PRIVSEP_PATH=/var/empty
2050 AC_ARG_WITH(privsep-path,
2051 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2053 if test "x$withval" != "$no" ; then
2054 PRIVSEP_PATH=$withval
2058 AC_SUBST(PRIVSEP_PATH)
2061 [ --with-xauth=PATH Specify path to xauth program ],
2063 if test "x$withval" != "xno" ; then
2069 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2070 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2071 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2072 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2073 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2074 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2075 xauth_path="/usr/openwin/bin/xauth"
2081 AC_ARG_ENABLE(strip,
2082 [ --disable-strip Disable calling strip(1) on install],
2084 if test "x$enableval" = "xno" ; then
2091 if test -z "$xauth_path" ; then
2092 XAUTH_PATH="undefined"
2093 AC_SUBST(XAUTH_PATH)
2095 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2096 XAUTH_PATH=$xauth_path
2097 AC_SUBST(XAUTH_PATH)
2100 # Check for mail directory (last resort if we cannot get it from headers)
2101 if test ! -z "$MAIL" ; then
2102 maildir=`dirname $MAIL`
2103 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2106 if test -z "$no_dev_ptmx" ; then
2107 if test "x$disable_ptmx_check" != "xyes" ; then
2108 AC_CHECK_FILE("/dev/ptmx",
2110 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2116 AC_CHECK_FILE("/dev/ptc",
2118 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2123 # Options from here on. Some of these are preset by platform above
2124 AC_ARG_WITH(mantype,
2125 [ --with-mantype=man|cat|doc Set man page type],
2132 AC_MSG_ERROR(invalid man type: $withval)
2137 if test -z "$MANTYPE"; then
2138 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2139 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2140 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2142 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2149 if test "$MANTYPE" = "doc"; then
2156 # Check whether to enable MD5 passwords
2158 AC_ARG_WITH(md5-passwords,
2159 [ --with-md5-passwords Enable use of MD5 passwords],
2161 if test "x$withval" != "xno" ; then
2162 AC_DEFINE(HAVE_MD5_PASSWORDS)
2168 # Whether to disable shadow password support
2170 [ --without-shadow Disable shadow password support],
2172 if test "x$withval" = "xno" ; then
2173 AC_DEFINE(DISABLE_SHADOW)
2179 if test -z "$disable_shadow" ; then
2180 AC_MSG_CHECKING([if the systems has expire shadow information])
2183 #include <sys/types.h>
2186 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2187 [ sp_expire_available=yes ], []
2190 if test "x$sp_expire_available" = "xyes" ; then
2192 AC_DEFINE(HAS_SHADOW_EXPIRE)
2198 # Use ip address instead of hostname in $DISPLAY
2199 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2200 DISPLAY_HACK_MSG="yes"
2201 AC_DEFINE(IPADDR_IN_DISPLAY)
2203 DISPLAY_HACK_MSG="no"
2204 AC_ARG_WITH(ipaddr-display,
2205 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2207 if test "x$withval" != "xno" ; then
2208 AC_DEFINE(IPADDR_IN_DISPLAY)
2209 DISPLAY_HACK_MSG="yes"
2215 # check for /etc/default/login and use it if present.
2216 AC_ARG_ENABLE(etc-default-login,
2217 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2219 AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2221 if test "x$external_path_file" = "x/etc/default/login"; then
2222 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2226 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2227 if test $ac_cv_func_login_getcapbool = "yes" -a \
2228 $ac_cv_header_login_cap_h = "yes" ; then
2229 external_path_file=/etc/login.conf
2232 # Whether to mess with the default path
2233 SERVER_PATH_MSG="(default)"
2234 AC_ARG_WITH(default-path,
2235 [ --with-default-path= Specify default \$PATH environment for server],
2237 if test "x$external_path_file" = "x/etc/login.conf" ; then
2239 --with-default-path=PATH has no effect on this system.
2240 Edit /etc/login.conf instead.])
2241 elif test "x$withval" != "xno" ; then
2242 if test ! -z "$external_path_file" ; then
2244 --with-default-path=PATH will only be used if PATH is not defined in
2245 $external_path_file .])
2247 user_path="$withval"
2248 SERVER_PATH_MSG="$withval"
2251 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2252 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2254 if test ! -z "$external_path_file" ; then
2256 If PATH is defined in $external_path_file, ensure the path to scp is included,
2257 otherwise scp will not work.])
2261 /* find out what STDPATH is */
2266 #ifndef _PATH_STDPATH
2267 # ifdef _PATH_USERPATH /* Irix */
2268 # define _PATH_STDPATH _PATH_USERPATH
2270 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2273 #include <sys/types.h>
2274 #include <sys/stat.h>
2276 #define DATA "conftest.stdpath"
2283 fd = fopen(DATA,"w");
2287 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2292 ], [ user_path=`cat conftest.stdpath` ],
2293 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2294 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2296 # make sure $bindir is in USER_PATH so scp will work
2297 t_bindir=`eval echo ${bindir}`
2299 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2302 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2304 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2305 if test $? -ne 0 ; then
2306 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2307 if test $? -ne 0 ; then
2308 user_path=$user_path:$t_bindir
2309 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2314 if test "x$external_path_file" != "x/etc/login.conf" ; then
2315 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2319 # Set superuser path separately to user path
2320 AC_ARG_WITH(superuser-path,
2321 [ --with-superuser-path= Specify different path for super-user],
2323 if test "x$withval" != "xno" ; then
2324 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2325 superuser_path=$withval
2331 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2332 IPV4_IN6_HACK_MSG="no"
2334 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2336 if test "x$withval" != "xno" ; then
2338 AC_DEFINE(IPV4_IN_IPV6)
2339 IPV4_IN6_HACK_MSG="yes"
2344 if test "x$inet6_default_4in6" = "xyes"; then
2345 AC_MSG_RESULT([yes (default)])
2346 AC_DEFINE(IPV4_IN_IPV6)
2347 IPV4_IN6_HACK_MSG="yes"
2349 AC_MSG_RESULT([no (default)])
2354 # Whether to enable BSD auth support
2356 AC_ARG_WITH(bsd-auth,
2357 [ --with-bsd-auth Enable BSD auth support],
2359 if test "x$withval" != "xno" ; then
2366 # Where to place sshd.pid
2368 # make sure the directory exists
2369 if test ! -d $piddir ; then
2370 piddir=`eval echo ${sysconfdir}`
2372 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2376 AC_ARG_WITH(pid-dir,
2377 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2379 if test "x$withval" != "xno" ; then
2381 if test ! -d $piddir ; then
2382 AC_MSG_WARN([** no $piddir directory on this system **])
2388 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2391 dnl allow user to disable some login recording features
2392 AC_ARG_ENABLE(lastlog,
2393 [ --disable-lastlog disable use of lastlog even if detected [no]],
2395 if test "x$enableval" = "xno" ; then
2396 AC_DEFINE(DISABLE_LASTLOG)
2401 [ --disable-utmp disable use of utmp even if detected [no]],
2403 if test "x$enableval" = "xno" ; then
2404 AC_DEFINE(DISABLE_UTMP)
2408 AC_ARG_ENABLE(utmpx,
2409 [ --disable-utmpx disable use of utmpx even if detected [no]],
2411 if test "x$enableval" = "xno" ; then
2412 AC_DEFINE(DISABLE_UTMPX)
2417 [ --disable-wtmp disable use of wtmp even if detected [no]],
2419 if test "x$enableval" = "xno" ; then
2420 AC_DEFINE(DISABLE_WTMP)
2424 AC_ARG_ENABLE(wtmpx,
2425 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2427 if test "x$enableval" = "xno" ; then
2428 AC_DEFINE(DISABLE_WTMPX)
2432 AC_ARG_ENABLE(libutil,
2433 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2435 if test "x$enableval" = "xno" ; then
2436 AC_DEFINE(DISABLE_LOGIN)
2440 AC_ARG_ENABLE(pututline,
2441 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2443 if test "x$enableval" = "xno" ; then
2444 AC_DEFINE(DISABLE_PUTUTLINE)
2448 AC_ARG_ENABLE(pututxline,
2449 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2451 if test "x$enableval" = "xno" ; then
2452 AC_DEFINE(DISABLE_PUTUTXLINE)
2456 AC_ARG_WITH(lastlog,
2457 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2459 if test "x$withval" = "xno" ; then
2460 AC_DEFINE(DISABLE_LASTLOG)
2462 conf_lastlog_location=$withval
2467 dnl lastlog, [uw]tmpx? detection
2468 dnl NOTE: set the paths in the platform section to avoid the
2469 dnl need for command-line parameters
2470 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2472 dnl lastlog detection
2473 dnl NOTE: the code itself will detect if lastlog is a directory
2474 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2476 #include <sys/types.h>
2478 #ifdef HAVE_LASTLOG_H
2479 # include <lastlog.h>
2488 [ char *lastlog = LASTLOG_FILE; ],
2489 [ AC_MSG_RESULT(yes) ],
2492 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2494 #include <sys/types.h>
2496 #ifdef HAVE_LASTLOG_H
2497 # include <lastlog.h>
2503 [ char *lastlog = _PATH_LASTLOG; ],
2504 [ AC_MSG_RESULT(yes) ],
2507 system_lastlog_path=no
2512 if test -z "$conf_lastlog_location"; then
2513 if test x"$system_lastlog_path" = x"no" ; then
2514 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2515 if (test -d "$f" || test -f "$f") ; then
2516 conf_lastlog_location=$f
2519 if test -z "$conf_lastlog_location"; then
2520 AC_MSG_WARN([** Cannot find lastlog **])
2521 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2526 if test -n "$conf_lastlog_location"; then
2527 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2531 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2533 #include <sys/types.h>
2539 [ char *utmp = UTMP_FILE; ],
2540 [ AC_MSG_RESULT(yes) ],
2542 system_utmp_path=no ]
2544 if test -z "$conf_utmp_location"; then
2545 if test x"$system_utmp_path" = x"no" ; then
2546 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2547 if test -f $f ; then
2548 conf_utmp_location=$f
2551 if test -z "$conf_utmp_location"; then
2552 AC_DEFINE(DISABLE_UTMP)
2556 if test -n "$conf_utmp_location"; then
2557 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2561 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2563 #include <sys/types.h>
2569 [ char *wtmp = WTMP_FILE; ],
2570 [ AC_MSG_RESULT(yes) ],
2572 system_wtmp_path=no ]
2574 if test -z "$conf_wtmp_location"; then
2575 if test x"$system_wtmp_path" = x"no" ; then
2576 for f in /usr/adm/wtmp /var/log/wtmp; do
2577 if test -f $f ; then
2578 conf_wtmp_location=$f
2581 if test -z "$conf_wtmp_location"; then
2582 AC_DEFINE(DISABLE_WTMP)
2586 if test -n "$conf_wtmp_location"; then
2587 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2591 dnl utmpx detection - I don't know any system so perverse as to require
2592 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2594 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2596 #include <sys/types.h>
2605 [ char *utmpx = UTMPX_FILE; ],
2606 [ AC_MSG_RESULT(yes) ],
2608 system_utmpx_path=no ]
2610 if test -z "$conf_utmpx_location"; then
2611 if test x"$system_utmpx_path" = x"no" ; then
2612 AC_DEFINE(DISABLE_UTMPX)
2615 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2619 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2621 #include <sys/types.h>
2630 [ char *wtmpx = WTMPX_FILE; ],
2631 [ AC_MSG_RESULT(yes) ],
2633 system_wtmpx_path=no ]
2635 if test -z "$conf_wtmpx_location"; then
2636 if test x"$system_wtmpx_path" = x"no" ; then
2637 AC_DEFINE(DISABLE_WTMPX)
2640 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2644 if test ! -z "$blibpath" ; then
2645 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2646 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2649 dnl remove pam and dl because they are in $LIBPAM
2650 if test "$PAM_MSG" = yes ; then
2651 LIBS=`echo $LIBS | sed 's/-lpam //'`
2653 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2654 LIBS=`echo $LIBS | sed 's/-ldl //'`
2658 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2661 # Print summary of options
2663 # Someone please show me a better way :)
2664 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2665 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2666 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2667 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2668 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2669 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2670 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2671 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2672 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2673 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2676 echo "OpenSSH has been configured with the following options:"
2677 echo " User binaries: $B"
2678 echo " System binaries: $C"
2679 echo " Configuration files: $D"
2680 echo " Askpass program: $E"
2681 echo " Manual pages: $F"
2682 echo " PID file: $G"
2683 echo " Privilege separation chroot path: $H"
2684 if test "x$external_path_file" = "x/etc/login.conf" ; then
2685 echo " At runtime, sshd will use the path defined in $external_path_file"
2686 echo " Make sure the path to scp is present, otherwise scp will not work"
2688 echo " sshd default user PATH: $I"
2689 if test ! -z "$external_path_file"; then
2690 echo " (If PATH is set in $external_path_file it will be used instead. If"
2691 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2694 if test ! -z "$superuser_path" ; then
2695 echo " sshd superuser user PATH: $J"
2697 echo " Manpage format: $MANTYPE"
2698 echo " DNS support: $DNS_MSG"
2699 echo " PAM support: $PAM_MSG"
2700 echo " KerberosV support: $KRB5_MSG"
2701 echo " Smartcard support: $SCARD_MSG"
2702 echo " S/KEY support: $SKEY_MSG"
2703 echo " TCP Wrappers support: $TCPW_MSG"
2704 echo " MD5 password support: $MD5_MSG"
2705 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2706 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2707 echo " BSD Auth support: $BSD_AUTH_MSG"
2708 echo " Random number source: $RAND_MSG"
2709 if test ! -z "$USE_RAND_HELPER" ; then
2710 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2715 echo " Host: ${host}"
2716 echo " Compiler: ${CC}"
2717 echo " Compiler flags: ${CFLAGS}"
2718 echo "Preprocessor flags: ${CPPFLAGS}"
2719 echo " Linker flags: ${LDFLAGS}"
2720 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2724 if test "x$PAM_MSG" = "xyes" ; then
2725 echo "PAM is enabled. You may need to install a PAM control file "
2726 echo "for sshd, otherwise password authentication may fail. "
2727 echo "Example PAM control files can be found in the contrib/ "
2732 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2733 echo "WARNING: you are using the builtin random number collection "
2734 echo "service. Please read WARNING.RNG and request that your OS "
2735 echo "vendor includes kernel-based random number collection in "
2736 echo "future versions of your OS."