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)
135 AC_DEFINE(SETEUID_BREAKS_SETUID)
136 AC_DEFINE(BROKEN_SETREUID)
137 AC_DEFINE(BROKEN_SETREGID)
140 AC_MSG_CHECKING(if we have working getaddrinfo)
141 AC_TRY_RUN([#include <mach-o/dyld.h>
142 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
146 }], [AC_MSG_RESULT(working)],
147 [AC_MSG_RESULT(buggy)
148 AC_DEFINE(BROKEN_GETADDRINFO)],
149 [AC_MSG_RESULT(assume it is working)])
150 AC_DEFINE(SETEUID_BREAKS_SETUID)
151 AC_DEFINE(BROKEN_SETREUID)
152 AC_DEFINE(BROKEN_SETREGID)
153 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
156 if test -z "$GCC"; then
159 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
160 IPADDR_IN_DISPLAY=yes
161 AC_DEFINE(HAVE_SECUREWARE)
163 AC_DEFINE(LOGIN_NO_ENDOPT)
164 AC_DEFINE(LOGIN_NEEDS_UTMPX)
165 AC_DEFINE(DISABLE_UTMP)
166 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
167 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
168 LIBS="$LIBS -lsec -lsecpw"
169 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
170 disable_ptmx_check=yes
173 if test -z "$GCC"; then
176 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
177 IPADDR_IN_DISPLAY=yes
179 AC_DEFINE(LOGIN_NO_ENDOPT)
180 AC_DEFINE(LOGIN_NEEDS_UTMPX)
181 AC_DEFINE(DISABLE_UTMP)
182 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
183 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
185 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
188 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
189 IPADDR_IN_DISPLAY=yes
190 AC_DEFINE(PAM_SUN_CODEBASE)
192 AC_DEFINE(LOGIN_NO_ENDOPT)
193 AC_DEFINE(LOGIN_NEEDS_UTMPX)
194 AC_DEFINE(DISABLE_UTMP)
195 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
196 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
198 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
201 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
203 PATH="$PATH:/usr/etc"
204 AC_DEFINE(BROKEN_INET_NTOA)
205 AC_DEFINE(SETEUID_BREAKS_SETUID)
206 AC_DEFINE(BROKEN_SETREUID)
207 AC_DEFINE(BROKEN_SETREGID)
208 AC_DEFINE(WITH_ABBREV_NO_TTY)
209 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
212 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
214 PATH="$PATH:/usr/etc"
215 AC_DEFINE(WITH_IRIX_ARRAY)
216 AC_DEFINE(WITH_IRIX_PROJECT)
217 AC_DEFINE(WITH_IRIX_AUDIT)
218 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
219 AC_DEFINE(BROKEN_INET_NTOA)
220 AC_DEFINE(SETEUID_BREAKS_SETUID)
221 AC_DEFINE(BROKEN_SETREUID)
222 AC_DEFINE(BROKEN_SETREGID)
223 AC_DEFINE(WITH_ABBREV_NO_TTY)
224 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
228 check_for_libcrypt_later=1
229 check_for_openpty_ctty_bug=1
230 AC_DEFINE(DONT_TRY_OTHER_AF)
231 AC_DEFINE(PAM_TTY_KLUDGE)
232 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
233 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
234 inet6_default_4in6=yes
237 AC_DEFINE(BROKEN_CMSG_TYPE)
241 mips-sony-bsd|mips-sony-newsos4)
242 AC_DEFINE(HAVE_NEWS4)
246 check_for_libcrypt_before=1
247 if test "x$withval" != "xno" ; then
252 check_for_libcrypt_later=1
255 AC_DEFINE(SETEUID_BREAKS_SETUID)
256 AC_DEFINE(BROKEN_SETREUID)
257 AC_DEFINE(BROKEN_SETREGID)
260 conf_lastlog_location="/usr/adm/lastlog"
261 conf_utmp_location=/etc/utmp
262 conf_wtmp_location=/usr/adm/wtmp
265 AC_DEFINE(BROKEN_REALPATH)
267 AC_DEFINE(BROKEN_SAVED_UIDS)
268 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
272 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
273 if test "x$withval" = "xno" ; then
274 LDFLAGS="$LDFLAGS -L/usr/local/lib"
276 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
279 AC_DEFINE(PAM_SUN_CODEBASE)
280 AC_DEFINE(LOGIN_NEEDS_UTMPX)
281 AC_DEFINE(LOGIN_NEEDS_TERM)
282 AC_DEFINE(PAM_TTY_KLUDGE)
283 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
284 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
285 AC_DEFINE(SSHD_ACQUIRES_CTTY)
286 external_path_file=/etc/default/login
287 # hardwire lastlog location (can't detect it on some versions)
288 conf_lastlog_location="/var/adm/lastlog"
289 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
290 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
291 if test "$sol2ver" -ge 8; then
293 AC_DEFINE(DISABLE_UTMP)
294 AC_DEFINE(DISABLE_WTMP)
300 CPPFLAGS="$CPPFLAGS -DSUNOS4"
301 AC_CHECK_FUNCS(getpwanam)
302 AC_DEFINE(PAM_SUN_CODEBASE)
303 conf_utmp_location=/etc/utmp
304 conf_wtmp_location=/var/adm/wtmp
305 conf_lastlog_location=/var/adm/lastlog
309 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
310 LDFLAGS="$LDFLAGS -L/usr/local/lib"
313 AC_DEFINE(SSHD_ACQUIRES_CTTY)
314 AC_DEFINE(SETEUID_BREAKS_SETUID)
315 AC_DEFINE(BROKEN_SETREUID)
316 AC_DEFINE(BROKEN_SETREGID)
319 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
320 # /usr/ucblib MUST NOT be searched on ReliantUNIX
321 LDFLAGS="$LDFLAGS -L/usr/local/lib"
322 AC_CHECK_LIB(dl, dlsym, ,)
323 IPADDR_IN_DISPLAY=yes
325 AC_DEFINE(IP_TOS_IS_BROKEN)
326 AC_DEFINE(SETEUID_BREAKS_SETUID)
327 AC_DEFINE(BROKEN_SETREUID)
328 AC_DEFINE(BROKEN_SETREGID)
329 AC_DEFINE(SSHD_ACQUIRES_CTTY)
330 external_path_file=/etc/default/login
331 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
332 # Attention: always take care to bind libsocket and libnsl before libc,
333 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
336 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
337 LDFLAGS="$LDFLAGS -L/usr/local/lib"
339 AC_DEFINE(SETEUID_BREAKS_SETUID)
340 AC_DEFINE(BROKEN_SETREUID)
341 AC_DEFINE(BROKEN_SETREGID)
344 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
345 LDFLAGS="$LDFLAGS -L/usr/local/lib"
347 AC_DEFINE(SETEUID_BREAKS_SETUID)
348 AC_DEFINE(BROKEN_SETREUID)
349 AC_DEFINE(BROKEN_SETREGID)
352 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
353 LDFLAGS="$LDFLAGS -L/usr/local/lib"
356 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
357 LDFLAGS="$LDFLAGS -L/usr/local/lib"
358 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
361 AC_DEFINE(BROKEN_SYS_TERMIO_H)
363 AC_DEFINE(HAVE_SECUREWARE)
364 AC_DEFINE(DISABLE_SHADOW)
365 AC_DEFINE(BROKEN_SAVED_UIDS)
366 AC_DEFINE(WITH_ABBREV_NO_TTY)
367 AC_CHECK_FUNCS(getluid setluid)
369 do_sco3_extra_lib_check=yes
372 if test -z "$GCC"; then
373 CFLAGS="$CFLAGS -belf"
375 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
376 LDFLAGS="$LDFLAGS -L/usr/local/lib"
377 LIBS="$LIBS -lprot -lx -ltinfo -lm"
380 AC_DEFINE(HAVE_SECUREWARE)
381 AC_DEFINE(DISABLE_SHADOW)
382 AC_DEFINE(DISABLE_FD_PASSING)
383 AC_DEFINE(SETEUID_BREAKS_SETUID)
384 AC_DEFINE(BROKEN_SETREUID)
385 AC_DEFINE(BROKEN_SETREGID)
386 AC_DEFINE(WITH_ABBREV_NO_TTY)
387 AC_CHECK_FUNCS(getluid setluid)
392 AC_DEFINE(DISABLE_FD_PASSING)
394 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
398 AC_DEFINE(WITH_ABBREV_NO_TTY)
400 AC_DEFINE(DISABLE_FD_PASSING)
402 LIBS="$LIBS -lgen -lacid"
407 AC_DEFINE(DISABLE_FD_PASSING)
408 AC_DEFINE(NO_SSH_LASTLOG)
409 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
410 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
414 AC_MSG_CHECKING(for Digital Unix SIA)
417 [ --with-osfsia Enable Digital Unix SIA],
419 if test "x$withval" = "xno" ; then
420 AC_MSG_RESULT(disabled)
425 if test -z "$no_osfsia" ; then
426 if test -f /etc/sia/matrix.conf; then
428 AC_DEFINE(HAVE_OSF_SIA)
429 AC_DEFINE(DISABLE_LOGIN)
430 AC_DEFINE(DISABLE_FD_PASSING)
431 LIBS="$LIBS -lsecurity -ldb -lm -laud"
434 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
437 AC_DEFINE(BROKEN_GETADDRINFO)
438 AC_DEFINE(SETEUID_BREAKS_SETUID)
439 AC_DEFINE(BROKEN_SETREUID)
440 AC_DEFINE(BROKEN_SETREGID)
445 AC_DEFINE(NO_X11_UNIX_SOCKETS)
446 AC_DEFINE(MISSING_NFDBITS)
447 AC_DEFINE(MISSING_HOWMANY)
448 AC_DEFINE(MISSING_FD_MASK)
452 # Allow user to specify flags
454 [ --with-cflags Specify additional flags to pass to compiler],
456 if test "x$withval" != "xno" ; then
457 CFLAGS="$CFLAGS $withval"
461 AC_ARG_WITH(cppflags,
462 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
464 if test "x$withval" != "xno"; then
465 CPPFLAGS="$CPPFLAGS $withval"
470 [ --with-ldflags Specify additional flags to pass to linker],
472 if test "x$withval" != "xno" ; then
473 LDFLAGS="$LDFLAGS $withval"
478 [ --with-libs Specify additional libraries to link with],
480 if test "x$withval" != "xno" ; then
481 LIBS="$LIBS $withval"
486 AC_MSG_CHECKING(compiler and flags for sanity)
491 [ AC_MSG_RESULT(yes) ],
494 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
498 # Checks for header files.
499 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
500 getopt.h glob.h ia.h lastlog.h limits.h login.h \
501 login_cap.h maillock.h netdb.h netgroup.h \
502 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
503 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
504 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
505 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
506 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
507 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
508 util.h utime.h utmp.h utmpx.h vis.h)
510 # Checks for libraries.
511 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
512 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
514 dnl SCO OS3 needs this for libwrap
515 if test "x$with_tcp_wrappers" != "xno" ; then
516 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
517 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
521 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
522 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
523 AC_CHECK_LIB(gen, dirname,[
524 AC_CACHE_CHECK([for broken dirname],
525 ac_cv_have_broken_dirname, [
533 int main(int argc, char **argv) {
536 strncpy(buf,"/etc", 32);
538 if (!s || strncmp(s, "/", 32) != 0) {
545 [ ac_cv_have_broken_dirname="no" ],
546 [ ac_cv_have_broken_dirname="yes" ]
550 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
552 AC_DEFINE(HAVE_DIRNAME)
553 AC_CHECK_HEADERS(libgen.h)
558 AC_CHECK_FUNC(getspnam, ,
559 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
560 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
564 [ --with-zlib=PATH Use zlib in PATH],
566 if test "x$withval" = "xno" ; then
567 AC_MSG_ERROR([*** zlib is required ***])
569 if test -d "$withval/lib"; then
570 if test -n "${need_dash_r}"; then
571 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
573 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
576 if test -n "${need_dash_r}"; then
577 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
579 LDFLAGS="-L${withval} ${LDFLAGS}"
582 if test -d "$withval/include"; then
583 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
585 CPPFLAGS="-I${withval} ${CPPFLAGS}"
590 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
593 AC_CHECK_FUNC(strcasecmp,
594 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
596 AC_CHECK_FUNC(utimes,
597 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
598 LIBS="$LIBS -lc89"]) ]
601 dnl Checks for libutil functions
602 AC_CHECK_HEADERS(libutil.h)
603 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
604 AC_CHECK_FUNCS(logout updwtmp logwtmp)
608 # Check for ALTDIRFUNC glob() extension
609 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
610 AC_EGREP_CPP(FOUNDIT,
613 #ifdef GLOB_ALTDIRFUNC
618 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
626 # Check for g.gl_matchc glob() extension
627 AC_MSG_CHECKING(for gl_matchc field in glob_t)
628 AC_EGREP_CPP(FOUNDIT,
631 int main(void){glob_t g; g.gl_matchc = 1;}
634 AC_DEFINE(GLOB_HAS_GL_MATCHC)
642 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
645 #include <sys/types.h>
647 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
649 [AC_MSG_RESULT(yes)],
652 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
656 # Check whether user wants S/Key support
659 [ --with-skey[[=PATH]] Enable S/Key support
660 (optionally in PATH)],
662 if test "x$withval" != "xno" ; then
664 if test "x$withval" != "xyes" ; then
665 CPPFLAGS="$CPPFLAGS -I${withval}/include"
666 LDFLAGS="$LDFLAGS -L${withval}/lib"
673 AC_MSG_CHECKING([for s/key support])
678 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
680 [AC_MSG_RESULT(yes)],
683 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
689 # Check whether user wants TCP wrappers support
691 AC_ARG_WITH(tcp-wrappers,
692 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
693 (optionally in PATH)],
695 if test "x$withval" != "xno" ; then
697 saved_LDFLAGS="$LDFLAGS"
698 saved_CPPFLAGS="$CPPFLAGS"
699 if test -n "${withval}" -a "${withval}" != "yes"; then
700 if test -d "${withval}/lib"; then
701 if test -n "${need_dash_r}"; then
702 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
704 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
707 if test -n "${need_dash_r}"; then
708 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
710 LDFLAGS="-L${withval} ${LDFLAGS}"
713 if test -d "${withval}/include"; then
714 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
716 CPPFLAGS="-I${withval} ${CPPFLAGS}"
720 LIBS="$LIBWRAP $LIBS"
721 AC_MSG_CHECKING(for libwrap)
725 int deny_severity = 0, allow_severity = 0;
735 AC_MSG_ERROR([*** libwrap missing])
743 dnl Checks for library functions. Please keep in alphabetical order
745 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
746 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
747 getaddrinfo getcwd getgrouplist getnameinfo getopt \
748 getpeereid _getpty getrlimit getttyent glob inet_aton \
749 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
750 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
751 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
752 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
753 setproctitle setregid setreuid setrlimit \
754 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
755 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
756 truncate utimes vhangup vsnprintf waitpid \
759 # IRIX has a const char return value for gai_strerror()
760 AC_CHECK_FUNCS(gai_strerror,[
761 AC_DEFINE(HAVE_GAI_STRERROR)
763 #include <sys/types.h>
764 #include <sys/socket.h>
767 const char *gai_strerror(int);],[
770 str = gai_strerror(0);],[
771 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
772 [Define if gai_strerror() returns const char *])])])
774 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
776 dnl Make sure prototypes are defined for these before using them.
777 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
778 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
780 dnl tcsendbreak might be a macro
781 AC_CHECK_DECL(tcsendbreak,
782 [AC_DEFINE(HAVE_TCSENDBREAK)],
783 [AC_CHECK_FUNCS(tcsendbreak)],
784 [#include <termios.h>]
787 AC_CHECK_FUNCS(setresuid, [
788 dnl Some platorms have setresuid that isn't implemented, test for this
789 AC_MSG_CHECKING(if setresuid seems to work)
793 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
795 [AC_MSG_RESULT(yes)],
796 [AC_DEFINE(BROKEN_SETRESUID),
797 AC_MSG_RESULT(not implemented)]
801 AC_CHECK_FUNCS(setresgid, [
802 dnl Some platorms have setresgid that isn't implemented, test for this
803 AC_MSG_CHECKING(if setresgid seems to work)
807 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
809 [AC_MSG_RESULT(yes)],
810 [AC_DEFINE(BROKEN_SETRESGID)
811 AC_MSG_RESULT(not implemented)]
815 dnl Checks for time functions
816 AC_CHECK_FUNCS(gettimeofday time)
817 dnl Checks for utmp functions
818 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
819 AC_CHECK_FUNCS(utmpname)
820 dnl Checks for utmpx functions
821 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
822 AC_CHECK_FUNCS(setutxent utmpxname)
824 AC_CHECK_FUNC(daemon,
825 [AC_DEFINE(HAVE_DAEMON)],
826 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
829 AC_CHECK_FUNC(getpagesize,
830 [AC_DEFINE(HAVE_GETPAGESIZE)],
831 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
834 # Check for broken snprintf
835 if test "x$ac_cv_func_snprintf" = "xyes" ; then
836 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
840 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
842 [AC_MSG_RESULT(yes)],
845 AC_DEFINE(BROKEN_SNPRINTF)
846 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
851 dnl see whether mkstemp() requires XXXXXX
852 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
853 AC_MSG_CHECKING([for (overly) strict mkstemp])
857 main() { char template[]="conftest.mkstemp-test";
858 if (mkstemp(template) == -1)
860 unlink(template); exit(0);
868 AC_DEFINE(HAVE_STRICT_MKSTEMP)
872 AC_DEFINE(HAVE_STRICT_MKSTEMP)
877 dnl make sure that openpty does not reacquire controlling terminal
878 if test ! -z "$check_for_openpty_ctty_bug"; then
879 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
883 #include <sys/fcntl.h>
884 #include <sys/types.h>
885 #include <sys/wait.h>
891 int fd, ptyfd, ttyfd, status;
894 if (pid < 0) { /* failed */
896 } else if (pid > 0) { /* parent */
897 waitpid(pid, &status, 0);
898 if (WIFEXITED(status))
899 exit(WEXITSTATUS(status));
903 close(0); close(1); close(2);
905 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
906 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
908 exit(3); /* Acquired ctty: broken */
910 exit(0); /* Did not acquire ctty: OK */
919 AC_DEFINE(SSHD_ACQUIRES_CTTY)
929 [ --with-pam Enable PAM support ],
931 if test "x$withval" != "xno" ; then
932 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
933 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
934 AC_MSG_ERROR([PAM headers not found])
937 AC_CHECK_LIB(dl, dlopen, , )
938 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
939 AC_CHECK_FUNCS(pam_getenvlist)
940 AC_CHECK_FUNCS(pam_putenv)
945 if test $ac_cv_lib_dl_dlopen = yes; then
955 # Check for older PAM
956 if test "x$PAM_MSG" = "xyes" ; then
957 # Check PAM strerror arguments (old PAM)
958 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
962 #if defined(HAVE_SECURITY_PAM_APPL_H)
963 #include <security/pam_appl.h>
964 #elif defined (HAVE_PAM_PAM_APPL_H)
965 #include <pam/pam_appl.h>
968 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
971 AC_DEFINE(HAVE_OLD_PAM)
973 PAM_MSG="yes (old library)"
978 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
979 # because the system crypt() is more featureful.
980 if test "x$check_for_libcrypt_before" = "x1"; then
981 AC_CHECK_LIB(crypt, crypt)
985 saved_CPPFLAGS="$CPPFLAGS"
986 saved_LDFLAGS="$LDFLAGS"
988 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
990 if test "x$withval" != "xno" ; then
991 if test -d "$withval/lib"; then
992 if test -n "${need_dash_r}"; then
993 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
995 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
998 if test -n "${need_dash_r}"; then
999 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1001 LDFLAGS="-L${withval} ${LDFLAGS}"
1004 if test -d "$withval/include"; then
1005 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1007 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1012 LIBS="$LIBS -lcrypto"
1013 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1015 dnl Check default openssl install dir
1016 if test -n "${need_dash_r}"; then
1017 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1019 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1021 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1022 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1024 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1030 # Determine OpenSSL header version
1031 AC_MSG_CHECKING([OpenSSL header version])
1036 #include <openssl/opensslv.h>
1037 #define DATA "conftest.sslincver"
1042 fd = fopen(DATA,"w");
1046 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1053 ssl_header_ver=`cat conftest.sslincver`
1054 AC_MSG_RESULT($ssl_header_ver)
1057 AC_MSG_RESULT(not found)
1058 AC_MSG_ERROR(OpenSSL version header not found.)
1062 # Determine OpenSSL library version
1063 AC_MSG_CHECKING([OpenSSL library version])
1068 #include <openssl/opensslv.h>
1069 #include <openssl/crypto.h>
1070 #define DATA "conftest.ssllibver"
1075 fd = fopen(DATA,"w");
1079 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1086 ssl_library_ver=`cat conftest.ssllibver`
1087 AC_MSG_RESULT($ssl_library_ver)
1090 AC_MSG_RESULT(not found)
1091 AC_MSG_ERROR(OpenSSL library not found.)
1095 # Sanity check OpenSSL headers
1096 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1100 #include <openssl/opensslv.h>
1101 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1108 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1109 Check config.log for details.
1110 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1114 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1115 # version in OpenSSL. Skip this for PAM
1116 if test "x$check_for_libcrypt_later" = "x1"; then
1117 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1121 ### Configure cryptographic random number support
1123 # Check wheter OpenSSL seeds itself
1124 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1128 #include <openssl/rand.h>
1129 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1132 OPENSSL_SEEDS_ITSELF=yes
1137 # Default to use of the rand helper if OpenSSL doesn't
1144 # Do we want to force the use of the rand helper?
1145 AC_ARG_WITH(rand-helper,
1146 [ --with-rand-helper Use subprocess to gather strong randomness ],
1148 if test "x$withval" = "xno" ; then
1149 # Force use of OpenSSL's internal RNG, even if
1150 # the previous test showed it to be unseeded.
1151 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1152 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1153 OPENSSL_SEEDS_ITSELF=yes
1162 # Which randomness source do we use?
1163 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1165 AC_DEFINE(OPENSSL_PRNG_ONLY)
1166 RAND_MSG="OpenSSL internal ONLY"
1167 INSTALL_SSH_RAND_HELPER=""
1168 elif test ! -z "$USE_RAND_HELPER" ; then
1169 # install rand helper
1170 RAND_MSG="ssh-rand-helper"
1171 INSTALL_SSH_RAND_HELPER="yes"
1173 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1175 ### Configuration of ssh-rand-helper
1178 AC_ARG_WITH(prngd-port,
1179 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1188 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1191 if test ! -z "$withval" ; then
1192 PRNGD_PORT="$withval"
1193 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1198 # PRNGD Unix domain socket
1199 AC_ARG_WITH(prngd-socket,
1200 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1204 withval="/var/run/egd-pool"
1212 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1216 if test ! -z "$withval" ; then
1217 if test ! -z "$PRNGD_PORT" ; then
1218 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1220 if test ! -r "$withval" ; then
1221 AC_MSG_WARN(Entropy socket is not readable)
1223 PRNGD_SOCKET="$withval"
1224 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1228 # Check for existing socket only if we don't have a random device already
1229 if test "$USE_RAND_HELPER" = yes ; then
1230 AC_MSG_CHECKING(for PRNGD/EGD socket)
1231 # Insert other locations here
1232 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1233 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1234 PRNGD_SOCKET="$sock"
1235 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1239 if test ! -z "$PRNGD_SOCKET" ; then
1240 AC_MSG_RESULT($PRNGD_SOCKET)
1242 AC_MSG_RESULT(not found)
1248 # Change default command timeout for hashing entropy source
1250 AC_ARG_WITH(entropy-timeout,
1251 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1253 if test "x$withval" != "xno" ; then
1254 entropy_timeout=$withval
1258 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1260 SSH_PRIVSEP_USER=sshd
1261 AC_ARG_WITH(privsep-user,
1262 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1264 if test -n "$withval"; then
1265 SSH_PRIVSEP_USER=$withval
1269 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1270 AC_SUBST(SSH_PRIVSEP_USER)
1272 # We do this little dance with the search path to insure
1273 # that programs that we select for use by installed programs
1274 # (which may be run by the super-user) come from trusted
1275 # locations before they come from the user's private area.
1276 # This should help avoid accidentally configuring some
1277 # random version of a program in someone's personal bin.
1281 test -h /bin 2> /dev/null && PATH=/usr/bin
1282 test -d /sbin && PATH=$PATH:/sbin
1283 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1284 PATH=$PATH:/etc:$OPATH
1286 # These programs are used by the command hashing source to gather entropy
1287 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1288 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1289 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1290 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1291 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1292 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1293 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1294 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1295 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1296 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1297 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1298 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1299 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1300 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1301 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1302 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1306 # Where does ssh-rand-helper get its randomness from?
1307 INSTALL_SSH_PRNG_CMDS=""
1308 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1309 if test ! -z "$PRNGD_PORT" ; then
1310 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1311 elif test ! -z "$PRNGD_SOCKET" ; then
1312 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1314 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1315 RAND_HELPER_CMDHASH=yes
1316 INSTALL_SSH_PRNG_CMDS="yes"
1319 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1322 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1323 if test ! -z "$SONY" ; then
1324 LIBS="$LIBS -liberty";
1327 # Checks for data types
1328 AC_CHECK_SIZEOF(char, 1)
1329 AC_CHECK_SIZEOF(short int, 2)
1330 AC_CHECK_SIZEOF(int, 4)
1331 AC_CHECK_SIZEOF(long int, 4)
1332 AC_CHECK_SIZEOF(long long int, 8)
1334 # Sanity check long long for some platforms (AIX)
1335 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1336 ac_cv_sizeof_long_long_int=0
1339 # More checks for data types
1340 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1342 [ #include <sys/types.h> ],
1344 [ ac_cv_have_u_int="yes" ],
1345 [ ac_cv_have_u_int="no" ]
1348 if test "x$ac_cv_have_u_int" = "xyes" ; then
1349 AC_DEFINE(HAVE_U_INT)
1353 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1355 [ #include <sys/types.h> ],
1356 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1357 [ ac_cv_have_intxx_t="yes" ],
1358 [ ac_cv_have_intxx_t="no" ]
1361 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1362 AC_DEFINE(HAVE_INTXX_T)
1366 if (test -z "$have_intxx_t" && \
1367 test "x$ac_cv_header_stdint_h" = "xyes")
1369 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1371 [ #include <stdint.h> ],
1372 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1374 AC_DEFINE(HAVE_INTXX_T)
1377 [ AC_MSG_RESULT(no) ]
1381 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1384 #include <sys/types.h>
1385 #ifdef HAVE_STDINT_H
1386 # include <stdint.h>
1388 #include <sys/socket.h>
1389 #ifdef HAVE_SYS_BITYPES_H
1390 # include <sys/bitypes.h>
1393 [ int64_t a; a = 1;],
1394 [ ac_cv_have_int64_t="yes" ],
1395 [ ac_cv_have_int64_t="no" ]
1398 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1399 AC_DEFINE(HAVE_INT64_T)
1402 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1404 [ #include <sys/types.h> ],
1405 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1406 [ ac_cv_have_u_intxx_t="yes" ],
1407 [ ac_cv_have_u_intxx_t="no" ]
1410 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1411 AC_DEFINE(HAVE_U_INTXX_T)
1415 if test -z "$have_u_intxx_t" ; then
1416 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1418 [ #include <sys/socket.h> ],
1419 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1421 AC_DEFINE(HAVE_U_INTXX_T)
1424 [ AC_MSG_RESULT(no) ]
1428 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1430 [ #include <sys/types.h> ],
1431 [ u_int64_t a; a = 1;],
1432 [ ac_cv_have_u_int64_t="yes" ],
1433 [ ac_cv_have_u_int64_t="no" ]
1436 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1437 AC_DEFINE(HAVE_U_INT64_T)
1441 if test -z "$have_u_int64_t" ; then
1442 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1444 [ #include <sys/bitypes.h> ],
1445 [ u_int64_t a; a = 1],
1447 AC_DEFINE(HAVE_U_INT64_T)
1450 [ AC_MSG_RESULT(no) ]
1454 if test -z "$have_u_intxx_t" ; then
1455 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1458 #include <sys/types.h>
1460 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1461 [ ac_cv_have_uintxx_t="yes" ],
1462 [ ac_cv_have_uintxx_t="no" ]
1465 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1466 AC_DEFINE(HAVE_UINTXX_T)
1470 if test -z "$have_uintxx_t" ; then
1471 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1473 [ #include <stdint.h> ],
1474 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1476 AC_DEFINE(HAVE_UINTXX_T)
1479 [ AC_MSG_RESULT(no) ]
1483 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1484 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1486 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1489 #include <sys/bitypes.h>
1492 int8_t a; int16_t b; int32_t c;
1493 u_int8_t e; u_int16_t f; u_int32_t g;
1494 a = b = c = e = f = g = 1;
1497 AC_DEFINE(HAVE_U_INTXX_T)
1498 AC_DEFINE(HAVE_INTXX_T)
1506 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1509 #include <sys/types.h>
1511 [ u_char foo; foo = 125; ],
1512 [ ac_cv_have_u_char="yes" ],
1513 [ ac_cv_have_u_char="no" ]
1516 if test "x$ac_cv_have_u_char" = "xyes" ; then
1517 AC_DEFINE(HAVE_U_CHAR)
1522 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1524 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1527 #include <sys/types.h>
1529 [ size_t foo; foo = 1235; ],
1530 [ ac_cv_have_size_t="yes" ],
1531 [ ac_cv_have_size_t="no" ]
1534 if test "x$ac_cv_have_size_t" = "xyes" ; then
1535 AC_DEFINE(HAVE_SIZE_T)
1538 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1541 #include <sys/types.h>
1543 [ ssize_t foo; foo = 1235; ],
1544 [ ac_cv_have_ssize_t="yes" ],
1545 [ ac_cv_have_ssize_t="no" ]
1548 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1549 AC_DEFINE(HAVE_SSIZE_T)
1552 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1557 [ clock_t foo; foo = 1235; ],
1558 [ ac_cv_have_clock_t="yes" ],
1559 [ ac_cv_have_clock_t="no" ]
1562 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1563 AC_DEFINE(HAVE_CLOCK_T)
1566 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1569 #include <sys/types.h>
1570 #include <sys/socket.h>
1572 [ sa_family_t foo; foo = 1235; ],
1573 [ ac_cv_have_sa_family_t="yes" ],
1576 #include <sys/types.h>
1577 #include <sys/socket.h>
1578 #include <netinet/in.h>
1580 [ sa_family_t foo; foo = 1235; ],
1581 [ ac_cv_have_sa_family_t="yes" ],
1583 [ ac_cv_have_sa_family_t="no" ]
1587 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1588 AC_DEFINE(HAVE_SA_FAMILY_T)
1591 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1594 #include <sys/types.h>
1596 [ pid_t foo; foo = 1235; ],
1597 [ ac_cv_have_pid_t="yes" ],
1598 [ ac_cv_have_pid_t="no" ]
1601 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1602 AC_DEFINE(HAVE_PID_T)
1605 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1608 #include <sys/types.h>
1610 [ mode_t foo; foo = 1235; ],
1611 [ ac_cv_have_mode_t="yes" ],
1612 [ ac_cv_have_mode_t="no" ]
1615 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1616 AC_DEFINE(HAVE_MODE_T)
1620 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1623 #include <sys/types.h>
1624 #include <sys/socket.h>
1626 [ struct sockaddr_storage s; ],
1627 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1628 [ ac_cv_have_struct_sockaddr_storage="no" ]
1631 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1632 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1635 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1638 #include <sys/types.h>
1639 #include <netinet/in.h>
1641 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1642 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1643 [ ac_cv_have_struct_sockaddr_in6="no" ]
1646 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1647 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1650 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1653 #include <sys/types.h>
1654 #include <netinet/in.h>
1656 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1657 [ ac_cv_have_struct_in6_addr="yes" ],
1658 [ ac_cv_have_struct_in6_addr="no" ]
1661 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1662 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1665 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1668 #include <sys/types.h>
1669 #include <sys/socket.h>
1672 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1673 [ ac_cv_have_struct_addrinfo="yes" ],
1674 [ ac_cv_have_struct_addrinfo="no" ]
1677 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1678 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1681 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1683 [ #include <sys/time.h> ],
1684 [ struct timeval tv; tv.tv_sec = 1;],
1685 [ ac_cv_have_struct_timeval="yes" ],
1686 [ ac_cv_have_struct_timeval="no" ]
1689 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1690 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1691 have_struct_timeval=1
1694 AC_CHECK_TYPES(struct timespec)
1696 # We need int64_t or else certian parts of the compile will fail.
1697 if test "x$ac_cv_have_int64_t" = "xno" -a \
1698 "x$ac_cv_sizeof_long_int" != "x8" -a \
1699 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1700 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1701 echo "an alternative compiler (I.E., GCC) before continuing."
1705 dnl test snprintf (broken on SCO w/gcc)
1710 #ifdef HAVE_SNPRINTF
1714 char expected_out[50];
1716 #if (SIZEOF_LONG_INT == 8)
1717 long int num = 0x7fffffffffffffff;
1719 long long num = 0x7fffffffffffffffll;
1721 strcpy(expected_out, "9223372036854775807");
1722 snprintf(buf, mazsize, "%lld", num);
1723 if(strcmp(buf, expected_out) != 0)
1730 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1734 dnl Checks for structure members
1735 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1736 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1737 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1738 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1739 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1740 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1741 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1742 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1743 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1744 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1745 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1746 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1747 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1748 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1749 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1750 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1751 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1753 AC_CHECK_MEMBERS([struct stat.st_blksize])
1755 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1756 ac_cv_have_ss_family_in_struct_ss, [
1759 #include <sys/types.h>
1760 #include <sys/socket.h>
1762 [ struct sockaddr_storage s; s.ss_family = 1; ],
1763 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1764 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1767 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1768 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1771 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1772 ac_cv_have___ss_family_in_struct_ss, [
1775 #include <sys/types.h>
1776 #include <sys/socket.h>
1778 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1779 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1780 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1783 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1784 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1787 AC_CACHE_CHECK([for pw_class field in struct passwd],
1788 ac_cv_have_pw_class_in_struct_passwd, [
1793 [ struct passwd p; p.pw_class = 0; ],
1794 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1795 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1798 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1799 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1802 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1803 ac_cv_have_pw_expire_in_struct_passwd, [
1808 [ struct passwd p; p.pw_expire = 0; ],
1809 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1810 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1813 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1814 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1817 AC_CACHE_CHECK([for pw_change field in struct passwd],
1818 ac_cv_have_pw_change_in_struct_passwd, [
1823 [ struct passwd p; p.pw_change = 0; ],
1824 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1825 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1828 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1829 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1832 dnl make sure we're using the real structure members and not defines
1833 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1834 ac_cv_have_accrights_in_msghdr, [
1837 #include <sys/types.h>
1838 #include <sys/socket.h>
1839 #include <sys/uio.h>
1841 #ifdef msg_accrights
1845 m.msg_accrights = 0;
1849 [ ac_cv_have_accrights_in_msghdr="yes" ],
1850 [ ac_cv_have_accrights_in_msghdr="no" ]
1853 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1854 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1857 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1858 ac_cv_have_control_in_msghdr, [
1861 #include <sys/types.h>
1862 #include <sys/socket.h>
1863 #include <sys/uio.h>
1873 [ ac_cv_have_control_in_msghdr="yes" ],
1874 [ ac_cv_have_control_in_msghdr="no" ]
1877 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1878 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1881 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1883 [ extern char *__progname; printf("%s", __progname); ],
1884 [ ac_cv_libc_defines___progname="yes" ],
1885 [ ac_cv_libc_defines___progname="no" ]
1888 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1889 AC_DEFINE(HAVE___PROGNAME)
1892 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1896 [ printf("%s", __FUNCTION__); ],
1897 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1898 [ ac_cv_cc_implements___FUNCTION__="no" ]
1901 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1902 AC_DEFINE(HAVE___FUNCTION__)
1905 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1909 [ printf("%s", __func__); ],
1910 [ ac_cv_cc_implements___func__="yes" ],
1911 [ ac_cv_cc_implements___func__="no" ]
1914 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1915 AC_DEFINE(HAVE___func__)
1918 AC_CACHE_CHECK([whether getopt has optreset support],
1919 ac_cv_have_getopt_optreset, [
1924 [ extern int optreset; optreset = 0; ],
1925 [ ac_cv_have_getopt_optreset="yes" ],
1926 [ ac_cv_have_getopt_optreset="no" ]
1929 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1930 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1933 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1935 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1936 [ ac_cv_libc_defines_sys_errlist="yes" ],
1937 [ ac_cv_libc_defines_sys_errlist="no" ]
1940 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1941 AC_DEFINE(HAVE_SYS_ERRLIST)
1945 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1947 [ extern int sys_nerr; printf("%i", sys_nerr);],
1948 [ ac_cv_libc_defines_sys_nerr="yes" ],
1949 [ ac_cv_libc_defines_sys_nerr="no" ]
1952 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1953 AC_DEFINE(HAVE_SYS_NERR)
1957 # Check whether user wants sectok support
1959 [ --with-sectok Enable smartcard support using libsectok],
1961 if test "x$withval" != "xno" ; then
1962 if test "x$withval" != "xyes" ; then
1963 CPPFLAGS="$CPPFLAGS -I${withval}"
1964 LDFLAGS="$LDFLAGS -L${withval}"
1965 if test ! -z "$need_dash_r" ; then
1966 LDFLAGS="$LDFLAGS -R${withval}"
1968 if test ! -z "$blibpath" ; then
1969 blibpath="$blibpath:${withval}"
1972 AC_CHECK_HEADERS(sectok.h)
1973 if test "$ac_cv_header_sectok_h" != yes; then
1974 AC_MSG_ERROR(Can't find sectok.h)
1976 AC_CHECK_LIB(sectok, sectok_open)
1977 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1978 AC_MSG_ERROR(Can't find libsectok)
1980 AC_DEFINE(SMARTCARD)
1981 AC_DEFINE(USE_SECTOK)
1982 SCARD_MSG="yes, using sectok"
1987 # Check whether user wants OpenSC support
1989 AC_HELP_STRING([--with-opensc=PFX],
1990 [Enable smartcard support using OpenSC]),
1991 opensc_config_prefix="$withval", opensc_config_prefix="")
1992 if test x$opensc_config_prefix != x ; then
1993 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1994 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1995 if test "$OPENSC_CONFIG" != "no"; then
1996 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1997 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1998 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1999 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2000 AC_DEFINE(SMARTCARD)
2001 AC_DEFINE(USE_OPENSC)
2002 SCARD_MSG="yes, using OpenSC"
2006 # Check libraries needed by DNS fingerprint support
2007 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2008 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
2010 # Needed by our getrrsetbyname()
2011 AC_SEARCH_LIBS(res_query, resolv)
2012 AC_SEARCH_LIBS(dn_expand, resolv)
2013 AC_CHECK_FUNCS(_getshort _getlong)
2014 AC_CHECK_MEMBER(HEADER.ad,
2015 [AC_DEFINE(HAVE_HEADER_AD)],,
2016 [#include <arpa/nameser.h>])
2019 # Check whether user wants Kerberos 5 support
2021 AC_ARG_WITH(kerberos5,
2022 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2024 if test "x$withval" != "xno" ; then
2025 if test "x$withval" = "xyes" ; then
2026 KRB5ROOT="/usr/local"
2030 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2031 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2034 AC_MSG_CHECKING(whether we are using Heimdal)
2035 AC_TRY_COMPILE([ #include <krb5.h> ],
2036 [ char *tmp = heimdal_version; ],
2037 [ AC_MSG_RESULT(yes)
2039 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2042 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2045 if test ! -z "$need_dash_r" ; then
2046 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2048 if test ! -z "$blibpath" ; then
2049 blibpath="$blibpath:${KRB5ROOT}/lib"
2051 AC_SEARCH_LIBS(dn_expand, resolv)
2053 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2055 K5LIBS="-lgssapi $K5LIBS" ],
2056 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2058 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2059 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2064 AC_CHECK_HEADER(gssapi.h, ,
2065 [ unset ac_cv_header_gssapi_h
2066 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2067 AC_CHECK_HEADERS(gssapi.h, ,
2068 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2074 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2075 AC_CHECK_HEADER(gssapi_krb5.h, ,
2076 [ CPPFLAGS="$oldCPP" ])
2082 LIBS="$LIBS $K5LIBS"
2084 # Looking for programs, paths and files
2086 PRIVSEP_PATH=/var/empty
2087 AC_ARG_WITH(privsep-path,
2088 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2090 if test "x$withval" != "$no" ; then
2091 PRIVSEP_PATH=$withval
2095 AC_SUBST(PRIVSEP_PATH)
2098 [ --with-xauth=PATH Specify path to xauth program ],
2100 if test "x$withval" != "xno" ; then
2106 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2107 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2108 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2109 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2110 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2111 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2112 xauth_path="/usr/openwin/bin/xauth"
2118 AC_ARG_ENABLE(strip,
2119 [ --disable-strip Disable calling strip(1) on install],
2121 if test "x$enableval" = "xno" ; then
2128 if test -z "$xauth_path" ; then
2129 XAUTH_PATH="undefined"
2130 AC_SUBST(XAUTH_PATH)
2132 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2133 XAUTH_PATH=$xauth_path
2134 AC_SUBST(XAUTH_PATH)
2137 # Check for mail directory (last resort if we cannot get it from headers)
2138 if test ! -z "$MAIL" ; then
2139 maildir=`dirname $MAIL`
2140 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2143 if test -z "$no_dev_ptmx" ; then
2144 if test "x$disable_ptmx_check" != "xyes" ; then
2145 AC_CHECK_FILE("/dev/ptmx",
2147 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2153 AC_CHECK_FILE("/dev/ptc",
2155 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2160 # Options from here on. Some of these are preset by platform above
2161 AC_ARG_WITH(mantype,
2162 [ --with-mantype=man|cat|doc Set man page type],
2169 AC_MSG_ERROR(invalid man type: $withval)
2174 if test -z "$MANTYPE"; then
2175 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2176 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2177 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2179 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2186 if test "$MANTYPE" = "doc"; then
2193 # Check whether to enable MD5 passwords
2195 AC_ARG_WITH(md5-passwords,
2196 [ --with-md5-passwords Enable use of MD5 passwords],
2198 if test "x$withval" != "xno" ; then
2199 AC_DEFINE(HAVE_MD5_PASSWORDS)
2205 # Whether to disable shadow password support
2207 [ --without-shadow Disable shadow password support],
2209 if test "x$withval" = "xno" ; then
2210 AC_DEFINE(DISABLE_SHADOW)
2216 if test -z "$disable_shadow" ; then
2217 AC_MSG_CHECKING([if the systems has expire shadow information])
2220 #include <sys/types.h>
2223 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2224 [ sp_expire_available=yes ], []
2227 if test "x$sp_expire_available" = "xyes" ; then
2229 AC_DEFINE(HAS_SHADOW_EXPIRE)
2235 # Use ip address instead of hostname in $DISPLAY
2236 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2237 DISPLAY_HACK_MSG="yes"
2238 AC_DEFINE(IPADDR_IN_DISPLAY)
2240 DISPLAY_HACK_MSG="no"
2241 AC_ARG_WITH(ipaddr-display,
2242 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2244 if test "x$withval" != "xno" ; then
2245 AC_DEFINE(IPADDR_IN_DISPLAY)
2246 DISPLAY_HACK_MSG="yes"
2252 # check for /etc/default/login and use it if present.
2253 AC_ARG_ENABLE(etc-default-login,
2254 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2256 AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2258 if test "x$external_path_file" = "x/etc/default/login"; then
2259 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2263 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2264 if test $ac_cv_func_login_getcapbool = "yes" -a \
2265 $ac_cv_header_login_cap_h = "yes" ; then
2266 external_path_file=/etc/login.conf
2269 # Whether to mess with the default path
2270 SERVER_PATH_MSG="(default)"
2271 AC_ARG_WITH(default-path,
2272 [ --with-default-path= Specify default \$PATH environment for server],
2274 if test "x$external_path_file" = "x/etc/login.conf" ; then
2276 --with-default-path=PATH has no effect on this system.
2277 Edit /etc/login.conf instead.])
2278 elif test "x$withval" != "xno" ; then
2279 if test ! -z "$external_path_file" ; then
2281 --with-default-path=PATH will only be used if PATH is not defined in
2282 $external_path_file .])
2284 user_path="$withval"
2285 SERVER_PATH_MSG="$withval"
2288 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2289 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2291 if test ! -z "$external_path_file" ; then
2293 If PATH is defined in $external_path_file, ensure the path to scp is included,
2294 otherwise scp will not work.])
2298 /* find out what STDPATH is */
2303 #ifndef _PATH_STDPATH
2304 # ifdef _PATH_USERPATH /* Irix */
2305 # define _PATH_STDPATH _PATH_USERPATH
2307 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2310 #include <sys/types.h>
2311 #include <sys/stat.h>
2313 #define DATA "conftest.stdpath"
2320 fd = fopen(DATA,"w");
2324 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2329 ], [ user_path=`cat conftest.stdpath` ],
2330 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2331 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2333 # make sure $bindir is in USER_PATH so scp will work
2334 t_bindir=`eval echo ${bindir}`
2336 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2339 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2341 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2342 if test $? -ne 0 ; then
2343 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2344 if test $? -ne 0 ; then
2345 user_path=$user_path:$t_bindir
2346 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2351 if test "x$external_path_file" != "x/etc/login.conf" ; then
2352 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2356 # Set superuser path separately to user path
2357 AC_ARG_WITH(superuser-path,
2358 [ --with-superuser-path= Specify different path for super-user],
2360 if test "x$withval" != "xno" ; then
2361 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2362 superuser_path=$withval
2368 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2369 IPV4_IN6_HACK_MSG="no"
2371 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2373 if test "x$withval" != "xno" ; then
2375 AC_DEFINE(IPV4_IN_IPV6)
2376 IPV4_IN6_HACK_MSG="yes"
2381 if test "x$inet6_default_4in6" = "xyes"; then
2382 AC_MSG_RESULT([yes (default)])
2383 AC_DEFINE(IPV4_IN_IPV6)
2384 IPV4_IN6_HACK_MSG="yes"
2386 AC_MSG_RESULT([no (default)])
2391 # Whether to enable BSD auth support
2393 AC_ARG_WITH(bsd-auth,
2394 [ --with-bsd-auth Enable BSD auth support],
2396 if test "x$withval" != "xno" ; then
2403 # Where to place sshd.pid
2405 # make sure the directory exists
2406 if test ! -d $piddir ; then
2407 piddir=`eval echo ${sysconfdir}`
2409 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2413 AC_ARG_WITH(pid-dir,
2414 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2416 if test "x$withval" != "xno" ; then
2418 if test ! -d $piddir ; then
2419 AC_MSG_WARN([** no $piddir directory on this system **])
2425 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2428 dnl allow user to disable some login recording features
2429 AC_ARG_ENABLE(lastlog,
2430 [ --disable-lastlog disable use of lastlog even if detected [no]],
2432 if test "x$enableval" = "xno" ; then
2433 AC_DEFINE(DISABLE_LASTLOG)
2438 [ --disable-utmp disable use of utmp even if detected [no]],
2440 if test "x$enableval" = "xno" ; then
2441 AC_DEFINE(DISABLE_UTMP)
2445 AC_ARG_ENABLE(utmpx,
2446 [ --disable-utmpx disable use of utmpx even if detected [no]],
2448 if test "x$enableval" = "xno" ; then
2449 AC_DEFINE(DISABLE_UTMPX)
2454 [ --disable-wtmp disable use of wtmp even if detected [no]],
2456 if test "x$enableval" = "xno" ; then
2457 AC_DEFINE(DISABLE_WTMP)
2461 AC_ARG_ENABLE(wtmpx,
2462 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2464 if test "x$enableval" = "xno" ; then
2465 AC_DEFINE(DISABLE_WTMPX)
2469 AC_ARG_ENABLE(libutil,
2470 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2472 if test "x$enableval" = "xno" ; then
2473 AC_DEFINE(DISABLE_LOGIN)
2477 AC_ARG_ENABLE(pututline,
2478 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2480 if test "x$enableval" = "xno" ; then
2481 AC_DEFINE(DISABLE_PUTUTLINE)
2485 AC_ARG_ENABLE(pututxline,
2486 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2488 if test "x$enableval" = "xno" ; then
2489 AC_DEFINE(DISABLE_PUTUTXLINE)
2493 AC_ARG_WITH(lastlog,
2494 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2496 if test "x$withval" = "xno" ; then
2497 AC_DEFINE(DISABLE_LASTLOG)
2499 conf_lastlog_location=$withval
2504 dnl lastlog, [uw]tmpx? detection
2505 dnl NOTE: set the paths in the platform section to avoid the
2506 dnl need for command-line parameters
2507 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2509 dnl lastlog detection
2510 dnl NOTE: the code itself will detect if lastlog is a directory
2511 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2513 #include <sys/types.h>
2515 #ifdef HAVE_LASTLOG_H
2516 # include <lastlog.h>
2525 [ char *lastlog = LASTLOG_FILE; ],
2526 [ AC_MSG_RESULT(yes) ],
2529 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2531 #include <sys/types.h>
2533 #ifdef HAVE_LASTLOG_H
2534 # include <lastlog.h>
2540 [ char *lastlog = _PATH_LASTLOG; ],
2541 [ AC_MSG_RESULT(yes) ],
2544 system_lastlog_path=no
2549 if test -z "$conf_lastlog_location"; then
2550 if test x"$system_lastlog_path" = x"no" ; then
2551 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2552 if (test -d "$f" || test -f "$f") ; then
2553 conf_lastlog_location=$f
2556 if test -z "$conf_lastlog_location"; then
2557 AC_MSG_WARN([** Cannot find lastlog **])
2558 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2563 if test -n "$conf_lastlog_location"; then
2564 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2568 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2570 #include <sys/types.h>
2576 [ char *utmp = UTMP_FILE; ],
2577 [ AC_MSG_RESULT(yes) ],
2579 system_utmp_path=no ]
2581 if test -z "$conf_utmp_location"; then
2582 if test x"$system_utmp_path" = x"no" ; then
2583 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2584 if test -f $f ; then
2585 conf_utmp_location=$f
2588 if test -z "$conf_utmp_location"; then
2589 AC_DEFINE(DISABLE_UTMP)
2593 if test -n "$conf_utmp_location"; then
2594 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2598 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2600 #include <sys/types.h>
2606 [ char *wtmp = WTMP_FILE; ],
2607 [ AC_MSG_RESULT(yes) ],
2609 system_wtmp_path=no ]
2611 if test -z "$conf_wtmp_location"; then
2612 if test x"$system_wtmp_path" = x"no" ; then
2613 for f in /usr/adm/wtmp /var/log/wtmp; do
2614 if test -f $f ; then
2615 conf_wtmp_location=$f
2618 if test -z "$conf_wtmp_location"; then
2619 AC_DEFINE(DISABLE_WTMP)
2623 if test -n "$conf_wtmp_location"; then
2624 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2628 dnl utmpx detection - I don't know any system so perverse as to require
2629 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2631 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2633 #include <sys/types.h>
2642 [ char *utmpx = UTMPX_FILE; ],
2643 [ AC_MSG_RESULT(yes) ],
2645 system_utmpx_path=no ]
2647 if test -z "$conf_utmpx_location"; then
2648 if test x"$system_utmpx_path" = x"no" ; then
2649 AC_DEFINE(DISABLE_UTMPX)
2652 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2656 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2658 #include <sys/types.h>
2667 [ char *wtmpx = WTMPX_FILE; ],
2668 [ AC_MSG_RESULT(yes) ],
2670 system_wtmpx_path=no ]
2672 if test -z "$conf_wtmpx_location"; then
2673 if test x"$system_wtmpx_path" = x"no" ; then
2674 AC_DEFINE(DISABLE_WTMPX)
2677 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2681 if test ! -z "$blibpath" ; then
2682 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2683 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2686 dnl remove pam and dl because they are in $LIBPAM
2687 if test "$PAM_MSG" = yes ; then
2688 LIBS=`echo $LIBS | sed 's/-lpam //'`
2690 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2691 LIBS=`echo $LIBS | sed 's/-ldl //'`
2695 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2698 # Print summary of options
2700 # Someone please show me a better way :)
2701 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2702 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2703 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2704 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2705 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2706 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2707 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2708 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2709 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2710 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2713 echo "OpenSSH has been configured with the following options:"
2714 echo " User binaries: $B"
2715 echo " System binaries: $C"
2716 echo " Configuration files: $D"
2717 echo " Askpass program: $E"
2718 echo " Manual pages: $F"
2719 echo " PID file: $G"
2720 echo " Privilege separation chroot path: $H"
2721 if test "x$external_path_file" = "x/etc/login.conf" ; then
2722 echo " At runtime, sshd will use the path defined in $external_path_file"
2723 echo " Make sure the path to scp is present, otherwise scp will not work"
2725 echo " sshd default user PATH: $I"
2726 if test ! -z "$external_path_file"; then
2727 echo " (If PATH is set in $external_path_file it will be used instead. If"
2728 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2731 if test ! -z "$superuser_path" ; then
2732 echo " sshd superuser user PATH: $J"
2734 echo " Manpage format: $MANTYPE"
2735 echo " PAM support: $PAM_MSG"
2736 echo " KerberosV support: $KRB5_MSG"
2737 echo " Smartcard support: $SCARD_MSG"
2738 echo " S/KEY support: $SKEY_MSG"
2739 echo " TCP Wrappers support: $TCPW_MSG"
2740 echo " MD5 password support: $MD5_MSG"
2741 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2742 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2743 echo " BSD Auth support: $BSD_AUTH_MSG"
2744 echo " Random number source: $RAND_MSG"
2745 if test ! -z "$USE_RAND_HELPER" ; then
2746 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2751 echo " Host: ${host}"
2752 echo " Compiler: ${CC}"
2753 echo " Compiler flags: ${CFLAGS}"
2754 echo "Preprocessor flags: ${CPPFLAGS}"
2755 echo " Linker flags: ${LDFLAGS}"
2756 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2760 if test "x$PAM_MSG" = "xyes" ; then
2761 echo "PAM is enabled. You may need to install a PAM control file "
2762 echo "for sshd, otherwise password authentication may fail. "
2763 echo "Example PAM control files can be found in the contrib/ "
2768 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2769 echo "WARNING: you are using the builtin random number collection "
2770 echo "service. Please read WARNING.RNG and request that your OS "
2771 echo "vendor includes kernel-based random number collection in "
2772 echo "future versions of your OS."