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 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
71 if (test -z "$blibpath"); then
72 blibpath="/usr/lib:/lib"
74 saved_LDFLAGS="$LDFLAGS"
75 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
76 if (test -z "$blibflags"); then
77 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
78 AC_TRY_LINK([], [], [blibflags=$tryflags])
81 if (test -z "$blibflags"); then
82 AC_MSG_RESULT(not found)
83 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
85 AC_MSG_RESULT($blibflags)
87 LDFLAGS="$saved_LDFLAGS"
88 dnl Check for authenticate. Might be in libs.a on older AIXes
89 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
90 [AC_CHECK_LIB(s,authenticate,
91 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
95 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
96 AC_CHECK_DECL(loginfailed,
97 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
99 [#include <usersec.h>],
100 [(void)loginfailed("user","host","tty",0);],
102 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
106 [#include <usersec.h>]
108 AC_CHECK_FUNCS(setauthdb)
109 AC_DEFINE(BROKEN_GETADDRINFO)
110 AC_DEFINE(BROKEN_REALPATH)
111 AC_DEFINE(SETEUID_BREAKS_SETUID)
112 AC_DEFINE(BROKEN_SETREUID)
113 AC_DEFINE(BROKEN_SETREGID)
114 dnl AIX handles lastlog as part of its login message
115 AC_DEFINE(DISABLE_LASTLOG)
116 AC_DEFINE(LOGIN_NEEDS_UTMPX)
117 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
120 check_for_libcrypt_later=1
121 LIBS="$LIBS /usr/lib/textmode.o"
122 AC_DEFINE(HAVE_CYGWIN)
124 AC_DEFINE(DISABLE_SHADOW)
125 AC_DEFINE(IP_TOS_IS_BROKEN)
126 AC_DEFINE(NO_X11_UNIX_SOCKETS)
127 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
128 AC_DEFINE(DISABLE_FD_PASSING)
129 AC_DEFINE(SETGROUPS_NOOP)
132 AC_DEFINE(IP_TOS_IS_BROKEN)
133 AC_DEFINE(SETEUID_BREAKS_SETUID)
134 AC_DEFINE(BROKEN_SETREUID)
135 AC_DEFINE(BROKEN_SETREGID)
138 AC_MSG_CHECKING(if we have working getaddrinfo)
139 AC_TRY_RUN([#include <mach-o/dyld.h>
140 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
144 }], [AC_MSG_RESULT(working)],
145 [AC_MSG_RESULT(buggy)
146 AC_DEFINE(BROKEN_GETADDRINFO)],
147 [AC_MSG_RESULT(assume it is working)])
148 AC_DEFINE(SETEUID_BREAKS_SETUID)
149 AC_DEFINE(BROKEN_SETREUID)
150 AC_DEFINE(BROKEN_SETREGID)
151 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
154 if test -z "$GCC"; then
157 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
158 IPADDR_IN_DISPLAY=yes
159 AC_DEFINE(HAVE_SECUREWARE)
161 AC_DEFINE(LOGIN_NO_ENDOPT)
162 AC_DEFINE(LOGIN_NEEDS_UTMPX)
163 AC_DEFINE(DISABLE_UTMP)
164 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
165 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
166 LIBS="$LIBS -lsec -lsecpw"
167 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
168 disable_ptmx_check=yes
171 if test -z "$GCC"; then
174 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
175 IPADDR_IN_DISPLAY=yes
177 AC_DEFINE(LOGIN_NO_ENDOPT)
178 AC_DEFINE(LOGIN_NEEDS_UTMPX)
179 AC_DEFINE(DISABLE_UTMP)
180 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
181 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
183 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
186 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
187 IPADDR_IN_DISPLAY=yes
188 AC_DEFINE(PAM_SUN_CODEBASE)
190 AC_DEFINE(LOGIN_NO_ENDOPT)
191 AC_DEFINE(LOGIN_NEEDS_UTMPX)
192 AC_DEFINE(DISABLE_UTMP)
193 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
194 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
197 AC_DEFINE(BROKEN_GETADDRINFO);;
200 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
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 PATH="$PATH:/usr/etc"
213 AC_DEFINE(WITH_IRIX_ARRAY)
214 AC_DEFINE(WITH_IRIX_PROJECT)
215 AC_DEFINE(WITH_IRIX_AUDIT)
216 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
217 AC_DEFINE(BROKEN_INET_NTOA)
218 AC_DEFINE(SETEUID_BREAKS_SETUID)
219 AC_DEFINE(BROKEN_SETREUID)
220 AC_DEFINE(BROKEN_SETREGID)
221 AC_DEFINE(WITH_ABBREV_NO_TTY)
222 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
226 check_for_libcrypt_later=1
227 check_for_openpty_ctty_bug=1
228 AC_DEFINE(DONT_TRY_OTHER_AF)
229 AC_DEFINE(PAM_TTY_KLUDGE)
230 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
231 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
232 inet6_default_4in6=yes
235 AC_DEFINE(BROKEN_CMSG_TYPE)
239 mips-sony-bsd|mips-sony-newsos4)
240 AC_DEFINE(HAVE_NEWS4)
244 check_for_libcrypt_before=1
245 if test "x$withval" != "xno" ; then
250 check_for_libcrypt_later=1
253 AC_DEFINE(SETEUID_BREAKS_SETUID)
254 AC_DEFINE(BROKEN_SETREUID)
255 AC_DEFINE(BROKEN_SETREGID)
258 conf_lastlog_location="/usr/adm/lastlog"
259 conf_utmp_location=/etc/utmp
260 conf_wtmp_location=/usr/adm/wtmp
263 AC_DEFINE(BROKEN_REALPATH)
265 AC_DEFINE(BROKEN_SAVED_UIDS)
268 AC_DEFINE(PAM_SUN_CODEBASE)
269 AC_DEFINE(LOGIN_NEEDS_UTMPX)
270 AC_DEFINE(LOGIN_NEEDS_TERM)
271 AC_DEFINE(PAM_TTY_KLUDGE)
272 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
273 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
274 AC_DEFINE(SSHD_ACQUIRES_CTTY)
275 external_path_file=/etc/default/login
276 # hardwire lastlog location (can't detect it on some versions)
277 conf_lastlog_location="/var/adm/lastlog"
278 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
279 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
280 if test "$sol2ver" -ge 8; then
282 AC_DEFINE(DISABLE_UTMP)
283 AC_DEFINE(DISABLE_WTMP)
289 CPPFLAGS="$CPPFLAGS -DSUNOS4"
290 AC_CHECK_FUNCS(getpwanam)
291 AC_DEFINE(PAM_SUN_CODEBASE)
292 conf_utmp_location=/etc/utmp
293 conf_wtmp_location=/var/adm/wtmp
294 conf_lastlog_location=/var/adm/lastlog
300 AC_DEFINE(SSHD_ACQUIRES_CTTY)
301 AC_DEFINE(SETEUID_BREAKS_SETUID)
302 AC_DEFINE(BROKEN_SETREUID)
303 AC_DEFINE(BROKEN_SETREGID)
306 # /usr/ucblib MUST NOT be searched on ReliantUNIX
307 AC_CHECK_LIB(dl, dlsym, ,)
308 IPADDR_IN_DISPLAY=yes
310 AC_DEFINE(IP_TOS_IS_BROKEN)
311 AC_DEFINE(SETEUID_BREAKS_SETUID)
312 AC_DEFINE(BROKEN_SETREUID)
313 AC_DEFINE(BROKEN_SETREGID)
314 AC_DEFINE(SSHD_ACQUIRES_CTTY)
315 external_path_file=/etc/default/login
316 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
317 # Attention: always take care to bind libsocket and libnsl before libc,
318 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
322 AC_DEFINE(SETEUID_BREAKS_SETUID)
323 AC_DEFINE(BROKEN_SETREUID)
324 AC_DEFINE(BROKEN_SETREGID)
328 AC_DEFINE(SETEUID_BREAKS_SETUID)
329 AC_DEFINE(BROKEN_SETREUID)
330 AC_DEFINE(BROKEN_SETREGID)
335 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize"
336 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
339 AC_DEFINE(BROKEN_SYS_TERMIO_H)
341 AC_DEFINE(HAVE_SECUREWARE)
342 AC_DEFINE(DISABLE_SHADOW)
343 AC_DEFINE(BROKEN_SAVED_UIDS)
344 AC_DEFINE(WITH_ABBREV_NO_TTY)
345 AC_CHECK_FUNCS(getluid setluid)
347 do_sco3_extra_lib_check=yes
350 if test -z "$GCC"; then
351 CFLAGS="$CFLAGS -belf"
353 LIBS="$LIBS -lprot -lx -ltinfo -lm"
356 AC_DEFINE(HAVE_SECUREWARE)
357 AC_DEFINE(DISABLE_SHADOW)
358 AC_DEFINE(DISABLE_FD_PASSING)
359 AC_DEFINE(SETEUID_BREAKS_SETUID)
360 AC_DEFINE(BROKEN_SETREUID)
361 AC_DEFINE(BROKEN_SETREGID)
362 AC_DEFINE(WITH_ABBREV_NO_TTY)
363 AC_CHECK_FUNCS(getluid setluid)
367 AC_DEFINE(NO_SSH_LASTLOG)
368 AC_DEFINE(SETEUID_BREAKS_SETUID)
369 AC_DEFINE(BROKEN_SETREUID)
370 AC_DEFINE(BROKEN_SETREGID)
372 AC_DEFINE(DISABLE_FD_PASSING)
374 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
378 AC_DEFINE(SETEUID_BREAKS_SETUID)
379 AC_DEFINE(BROKEN_SETREUID)
380 AC_DEFINE(BROKEN_SETREGID)
381 AC_DEFINE(WITH_ABBREV_NO_TTY)
383 AC_DEFINE(DISABLE_FD_PASSING)
385 LIBS="$LIBS -lgen -lacid -ldb"
389 AC_DEFINE(SETEUID_BREAKS_SETUID)
390 AC_DEFINE(BROKEN_SETREUID)
391 AC_DEFINE(BROKEN_SETREGID)
393 AC_DEFINE(DISABLE_FD_PASSING)
394 AC_DEFINE(NO_SSH_LASTLOG)
395 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
396 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
400 AC_MSG_CHECKING(for Digital Unix SIA)
403 [ --with-osfsia Enable Digital Unix SIA],
405 if test "x$withval" = "xno" ; then
406 AC_MSG_RESULT(disabled)
411 if test -z "$no_osfsia" ; then
412 if test -f /etc/sia/matrix.conf; then
414 AC_DEFINE(HAVE_OSF_SIA)
415 AC_DEFINE(DISABLE_LOGIN)
416 AC_DEFINE(DISABLE_FD_PASSING)
417 LIBS="$LIBS -lsecurity -ldb -lm -laud"
420 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
423 AC_DEFINE(BROKEN_GETADDRINFO)
424 AC_DEFINE(SETEUID_BREAKS_SETUID)
425 AC_DEFINE(BROKEN_SETREUID)
426 AC_DEFINE(BROKEN_SETREGID)
431 AC_DEFINE(NO_X11_UNIX_SOCKETS)
432 AC_DEFINE(MISSING_NFDBITS)
433 AC_DEFINE(MISSING_HOWMANY)
434 AC_DEFINE(MISSING_FD_MASK)
438 # Allow user to specify flags
440 [ --with-cflags Specify additional flags to pass to compiler],
442 if test "x$withval" != "xno" ; then
443 CFLAGS="$CFLAGS $withval"
447 AC_ARG_WITH(cppflags,
448 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
450 if test "x$withval" != "xno"; then
451 CPPFLAGS="$CPPFLAGS $withval"
456 [ --with-ldflags Specify additional flags to pass to linker],
458 if test "x$withval" != "xno" ; then
459 LDFLAGS="$LDFLAGS $withval"
464 [ --with-libs Specify additional libraries to link with],
466 if test "x$withval" != "xno" ; then
467 LIBS="$LIBS $withval"
472 AC_MSG_CHECKING(compiler and flags for sanity)
477 [ AC_MSG_RESULT(yes) ],
480 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
484 # Checks for header files.
485 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
486 getopt.h glob.h ia.h lastlog.h limits.h login.h \
487 login_cap.h maillock.h netdb.h netgroup.h \
488 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
489 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
490 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
491 sys/cdefs.h sys/mman.h sys/pstat.h sys/ptms.h sys/select.h sys/stat.h \
492 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
493 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
494 util.h utime.h utmp.h utmpx.h vis.h)
496 # Checks for libraries.
497 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
498 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
500 dnl SCO OS3 needs this for libwrap
501 if test "x$with_tcp_wrappers" != "xno" ; then
502 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
503 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
507 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
508 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
509 AC_CHECK_LIB(gen, dirname,[
510 AC_CACHE_CHECK([for broken dirname],
511 ac_cv_have_broken_dirname, [
519 int main(int argc, char **argv) {
522 strncpy(buf,"/etc", 32);
524 if (!s || strncmp(s, "/", 32) != 0) {
531 [ ac_cv_have_broken_dirname="no" ],
532 [ ac_cv_have_broken_dirname="yes" ]
536 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
538 AC_DEFINE(HAVE_DIRNAME)
539 AC_CHECK_HEADERS(libgen.h)
544 AC_CHECK_FUNC(getspnam, ,
545 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
546 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
550 [ --with-zlib=PATH Use zlib in PATH],
552 if test "x$withval" = "xno" ; then
553 AC_MSG_ERROR([*** zlib is required ***])
555 if test -d "$withval/lib"; then
556 if test -n "${need_dash_r}"; then
557 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
559 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
562 if test -n "${need_dash_r}"; then
563 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
565 LDFLAGS="-L${withval} ${LDFLAGS}"
568 if test -d "$withval/include"; then
569 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
571 CPPFLAGS="-I${withval} ${CPPFLAGS}"
576 AC_CHECK_LIB(z, deflate, ,
578 saved_CPPFLAGS="$CPPFLAGS"
579 saved_LDFLAGS="$LDFLAGS"
581 dnl Check default zlib install dir
582 if test -n "${need_dash_r}"; then
583 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
585 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
587 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
589 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
591 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
596 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
598 AC_ARG_WITH(zlib-version-check,
599 [ --without-zlib-version-check Disable zlib version check],
600 [ if test "x$withval" = "xno" ; then
601 zlib_check_nonfatal=1
606 AC_MSG_CHECKING(for zlib 1.1.4 or greater)
612 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
614 v = a*1000000 + b*1000 + c;
622 if test -z "$zlib_check_nonfatal" ; then
623 AC_MSG_ERROR([*** zlib too old - check config.log ***
624 Your reported zlib version has known security problems. It's possible your
625 vendor has fixed these problems without changing the version number. If you
626 are sure this is the case, you can disable the check by running
627 "./configure --without-zlib-version-check".
628 If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
630 AC_MSG_WARN([zlib version may have security problems])
636 AC_CHECK_FUNC(strcasecmp,
637 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
639 AC_CHECK_FUNC(utimes,
640 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
641 LIBS="$LIBS -lc89"]) ]
644 dnl Checks for libutil functions
645 AC_CHECK_HEADERS(libutil.h)
646 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
647 AC_CHECK_FUNCS(logout updwtmp logwtmp)
651 # Check for ALTDIRFUNC glob() extension
652 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
653 AC_EGREP_CPP(FOUNDIT,
656 #ifdef GLOB_ALTDIRFUNC
661 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
669 # Check for g.gl_matchc glob() extension
670 AC_MSG_CHECKING(for gl_matchc field in glob_t)
671 AC_EGREP_CPP(FOUNDIT,
674 int main(void){glob_t g; g.gl_matchc = 1;}
677 AC_DEFINE(GLOB_HAS_GL_MATCHC)
685 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
688 #include <sys/types.h>
690 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
692 [AC_MSG_RESULT(yes)],
695 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
699 # Check whether user wants S/Key support
702 [ --with-skey[[=PATH]] Enable S/Key support
703 (optionally in PATH)],
705 if test "x$withval" != "xno" ; then
707 if test "x$withval" != "xyes" ; then
708 CPPFLAGS="$CPPFLAGS -I${withval}/include"
709 LDFLAGS="$LDFLAGS -L${withval}/lib"
716 AC_MSG_CHECKING([for s/key support])
721 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
723 [AC_MSG_RESULT(yes)],
726 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
732 # Check whether user wants TCP wrappers support
734 AC_ARG_WITH(tcp-wrappers,
735 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
736 (optionally in PATH)],
738 if test "x$withval" != "xno" ; then
740 saved_LDFLAGS="$LDFLAGS"
741 saved_CPPFLAGS="$CPPFLAGS"
742 if test -n "${withval}" -a "${withval}" != "yes"; then
743 if test -d "${withval}/lib"; then
744 if test -n "${need_dash_r}"; then
745 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
747 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
750 if test -n "${need_dash_r}"; then
751 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
753 LDFLAGS="-L${withval} ${LDFLAGS}"
756 if test -d "${withval}/include"; then
757 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
759 CPPFLAGS="-I${withval} ${CPPFLAGS}"
763 LIBS="$LIBWRAP $LIBS"
764 AC_MSG_CHECKING(for libwrap)
768 int deny_severity = 0, allow_severity = 0;
778 AC_MSG_ERROR([*** libwrap missing])
786 dnl Checks for library functions. Please keep in alphabetical order
788 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
789 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
790 getaddrinfo getcwd getgrouplist getnameinfo getopt \
791 getpeereid _getpty getrlimit getttyent glob inet_aton \
792 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
793 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
794 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
795 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
796 setproctitle setregid setreuid setrlimit \
797 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
798 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
799 truncate utimes vhangup vsnprintf waitpid \
802 # IRIX has a const char return value for gai_strerror()
803 AC_CHECK_FUNCS(gai_strerror,[
804 AC_DEFINE(HAVE_GAI_STRERROR)
806 #include <sys/types.h>
807 #include <sys/socket.h>
810 const char *gai_strerror(int);],[
813 str = gai_strerror(0);],[
814 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
815 [Define if gai_strerror() returns const char *])])])
817 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
819 dnl Make sure prototypes are defined for these before using them.
820 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
821 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
823 dnl tcsendbreak might be a macro
824 AC_CHECK_DECL(tcsendbreak,
825 [AC_DEFINE(HAVE_TCSENDBREAK)],
826 [AC_CHECK_FUNCS(tcsendbreak)],
827 [#include <termios.h>]
830 AC_CHECK_FUNCS(setresuid, [
831 dnl Some platorms have setresuid that isn't implemented, test for this
832 AC_MSG_CHECKING(if setresuid seems to work)
836 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
838 [AC_MSG_RESULT(yes)],
839 [AC_DEFINE(BROKEN_SETRESUID)
840 AC_MSG_RESULT(not implemented)]
844 AC_CHECK_FUNCS(setresgid, [
845 dnl Some platorms have setresgid that isn't implemented, test for this
846 AC_MSG_CHECKING(if setresgid seems to work)
850 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
852 [AC_MSG_RESULT(yes)],
853 [AC_DEFINE(BROKEN_SETRESGID)
854 AC_MSG_RESULT(not implemented)]
858 dnl Checks for time functions
859 AC_CHECK_FUNCS(gettimeofday time)
860 dnl Checks for utmp functions
861 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
862 AC_CHECK_FUNCS(utmpname)
863 dnl Checks for utmpx functions
864 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
865 AC_CHECK_FUNCS(setutxent utmpxname)
867 AC_CHECK_FUNC(daemon,
868 [AC_DEFINE(HAVE_DAEMON)],
869 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
872 AC_CHECK_FUNC(getpagesize,
873 [AC_DEFINE(HAVE_GETPAGESIZE)],
874 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
877 # Check for broken snprintf
878 if test "x$ac_cv_func_snprintf" = "xyes" ; then
879 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
883 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
885 [AC_MSG_RESULT(yes)],
888 AC_DEFINE(BROKEN_SNPRINTF)
889 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
894 dnl see whether mkstemp() requires XXXXXX
895 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
896 AC_MSG_CHECKING([for (overly) strict mkstemp])
900 main() { char template[]="conftest.mkstemp-test";
901 if (mkstemp(template) == -1)
903 unlink(template); exit(0);
911 AC_DEFINE(HAVE_STRICT_MKSTEMP)
915 AC_DEFINE(HAVE_STRICT_MKSTEMP)
920 dnl make sure that openpty does not reacquire controlling terminal
921 if test ! -z "$check_for_openpty_ctty_bug"; then
922 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
926 #include <sys/fcntl.h>
927 #include <sys/types.h>
928 #include <sys/wait.h>
934 int fd, ptyfd, ttyfd, status;
937 if (pid < 0) { /* failed */
939 } else if (pid > 0) { /* parent */
940 waitpid(pid, &status, 0);
941 if (WIFEXITED(status))
942 exit(WEXITSTATUS(status));
946 close(0); close(1); close(2);
948 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
949 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
951 exit(3); /* Acquired ctty: broken */
953 exit(0); /* Did not acquire ctty: OK */
962 AC_DEFINE(SSHD_ACQUIRES_CTTY)
972 [ --with-pam Enable PAM support ],
974 if test "x$withval" != "xno" ; then
975 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
976 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
977 AC_MSG_ERROR([PAM headers not found])
980 AC_CHECK_LIB(dl, dlopen, , )
981 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
982 AC_CHECK_FUNCS(pam_getenvlist)
983 AC_CHECK_FUNCS(pam_putenv)
988 if test $ac_cv_lib_dl_dlopen = yes; then
998 # Check for older PAM
999 if test "x$PAM_MSG" = "xyes" ; then
1000 # Check PAM strerror arguments (old PAM)
1001 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1005 #if defined(HAVE_SECURITY_PAM_APPL_H)
1006 #include <security/pam_appl.h>
1007 #elif defined (HAVE_PAM_PAM_APPL_H)
1008 #include <pam/pam_appl.h>
1011 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1012 [AC_MSG_RESULT(no)],
1014 AC_DEFINE(HAVE_OLD_PAM)
1016 PAM_MSG="yes (old library)"
1021 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1022 # because the system crypt() is more featureful.
1023 if test "x$check_for_libcrypt_before" = "x1"; then
1024 AC_CHECK_LIB(crypt, crypt)
1027 # Search for OpenSSL
1028 saved_CPPFLAGS="$CPPFLAGS"
1029 saved_LDFLAGS="$LDFLAGS"
1030 AC_ARG_WITH(ssl-dir,
1031 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1033 if test "x$withval" != "xno" ; then
1034 if test -d "$withval/lib"; then
1035 if test -n "${need_dash_r}"; then
1036 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1038 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1041 if test -n "${need_dash_r}"; then
1042 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1044 LDFLAGS="-L${withval} ${LDFLAGS}"
1047 if test -d "$withval/include"; then
1048 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1050 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1055 LIBS="$LIBS -lcrypto"
1056 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1058 dnl Check default openssl install dir
1059 if test -n "${need_dash_r}"; then
1060 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1062 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1064 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1065 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1067 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1073 # Determine OpenSSL header version
1074 AC_MSG_CHECKING([OpenSSL header version])
1079 #include <openssl/opensslv.h>
1080 #define DATA "conftest.sslincver"
1085 fd = fopen(DATA,"w");
1089 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1096 ssl_header_ver=`cat conftest.sslincver`
1097 AC_MSG_RESULT($ssl_header_ver)
1100 AC_MSG_RESULT(not found)
1101 AC_MSG_ERROR(OpenSSL version header not found.)
1105 # Determine OpenSSL library version
1106 AC_MSG_CHECKING([OpenSSL library version])
1111 #include <openssl/opensslv.h>
1112 #include <openssl/crypto.h>
1113 #define DATA "conftest.ssllibver"
1118 fd = fopen(DATA,"w");
1122 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1129 ssl_library_ver=`cat conftest.ssllibver`
1130 AC_MSG_RESULT($ssl_library_ver)
1133 AC_MSG_RESULT(not found)
1134 AC_MSG_ERROR(OpenSSL library not found.)
1138 # Sanity check OpenSSL headers
1139 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1143 #include <openssl/opensslv.h>
1144 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1151 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1152 Check config.log for details.
1153 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1157 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1158 # version in OpenSSL. Skip this for PAM
1159 if test "x$check_for_libcrypt_later" = "x1"; then
1160 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1164 ### Configure cryptographic random number support
1166 # Check wheter OpenSSL seeds itself
1167 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1171 #include <openssl/rand.h>
1172 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1175 OPENSSL_SEEDS_ITSELF=yes
1180 # Default to use of the rand helper if OpenSSL doesn't
1187 # Do we want to force the use of the rand helper?
1188 AC_ARG_WITH(rand-helper,
1189 [ --with-rand-helper Use subprocess to gather strong randomness ],
1191 if test "x$withval" = "xno" ; then
1192 # Force use of OpenSSL's internal RNG, even if
1193 # the previous test showed it to be unseeded.
1194 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1195 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1196 OPENSSL_SEEDS_ITSELF=yes
1205 # Which randomness source do we use?
1206 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1208 AC_DEFINE(OPENSSL_PRNG_ONLY)
1209 RAND_MSG="OpenSSL internal ONLY"
1210 INSTALL_SSH_RAND_HELPER=""
1211 elif test ! -z "$USE_RAND_HELPER" ; then
1212 # install rand helper
1213 RAND_MSG="ssh-rand-helper"
1214 INSTALL_SSH_RAND_HELPER="yes"
1216 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1218 ### Configuration of ssh-rand-helper
1221 AC_ARG_WITH(prngd-port,
1222 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1231 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1234 if test ! -z "$withval" ; then
1235 PRNGD_PORT="$withval"
1236 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1241 # PRNGD Unix domain socket
1242 AC_ARG_WITH(prngd-socket,
1243 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1247 withval="/var/run/egd-pool"
1255 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1259 if test ! -z "$withval" ; then
1260 if test ! -z "$PRNGD_PORT" ; then
1261 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1263 if test ! -r "$withval" ; then
1264 AC_MSG_WARN(Entropy socket is not readable)
1266 PRNGD_SOCKET="$withval"
1267 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1271 # Check for existing socket only if we don't have a random device already
1272 if test "$USE_RAND_HELPER" = yes ; then
1273 AC_MSG_CHECKING(for PRNGD/EGD socket)
1274 # Insert other locations here
1275 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1276 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1277 PRNGD_SOCKET="$sock"
1278 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1282 if test ! -z "$PRNGD_SOCKET" ; then
1283 AC_MSG_RESULT($PRNGD_SOCKET)
1285 AC_MSG_RESULT(not found)
1291 # Change default command timeout for hashing entropy source
1293 AC_ARG_WITH(entropy-timeout,
1294 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1296 if test "x$withval" != "xno" ; then
1297 entropy_timeout=$withval
1301 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1303 SSH_PRIVSEP_USER=sshd
1304 AC_ARG_WITH(privsep-user,
1305 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1307 if test -n "$withval"; then
1308 SSH_PRIVSEP_USER=$withval
1312 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1313 AC_SUBST(SSH_PRIVSEP_USER)
1315 # We do this little dance with the search path to insure
1316 # that programs that we select for use by installed programs
1317 # (which may be run by the super-user) come from trusted
1318 # locations before they come from the user's private area.
1319 # This should help avoid accidentally configuring some
1320 # random version of a program in someone's personal bin.
1324 test -h /bin 2> /dev/null && PATH=/usr/bin
1325 test -d /sbin && PATH=$PATH:/sbin
1326 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1327 PATH=$PATH:/etc:$OPATH
1329 # These programs are used by the command hashing source to gather entropy
1330 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1331 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1332 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1333 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1334 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1335 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1336 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1337 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1338 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1339 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1340 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1341 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1342 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1343 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1344 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1345 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1349 # Where does ssh-rand-helper get its randomness from?
1350 INSTALL_SSH_PRNG_CMDS=""
1351 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1352 if test ! -z "$PRNGD_PORT" ; then
1353 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1354 elif test ! -z "$PRNGD_SOCKET" ; then
1355 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1357 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1358 RAND_HELPER_CMDHASH=yes
1359 INSTALL_SSH_PRNG_CMDS="yes"
1362 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1365 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1366 if test ! -z "$SONY" ; then
1367 LIBS="$LIBS -liberty";
1370 # Checks for data types
1371 AC_CHECK_SIZEOF(char, 1)
1372 AC_CHECK_SIZEOF(short int, 2)
1373 AC_CHECK_SIZEOF(int, 4)
1374 AC_CHECK_SIZEOF(long int, 4)
1375 AC_CHECK_SIZEOF(long long int, 8)
1377 # Sanity check long long for some platforms (AIX)
1378 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1379 ac_cv_sizeof_long_long_int=0
1382 # More checks for data types
1383 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1385 [ #include <sys/types.h> ],
1387 [ ac_cv_have_u_int="yes" ],
1388 [ ac_cv_have_u_int="no" ]
1391 if test "x$ac_cv_have_u_int" = "xyes" ; then
1392 AC_DEFINE(HAVE_U_INT)
1396 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1398 [ #include <sys/types.h> ],
1399 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1400 [ ac_cv_have_intxx_t="yes" ],
1401 [ ac_cv_have_intxx_t="no" ]
1404 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1405 AC_DEFINE(HAVE_INTXX_T)
1409 if (test -z "$have_intxx_t" && \
1410 test "x$ac_cv_header_stdint_h" = "xyes")
1412 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1414 [ #include <stdint.h> ],
1415 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1417 AC_DEFINE(HAVE_INTXX_T)
1420 [ AC_MSG_RESULT(no) ]
1424 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1427 #include <sys/types.h>
1428 #ifdef HAVE_STDINT_H
1429 # include <stdint.h>
1431 #include <sys/socket.h>
1432 #ifdef HAVE_SYS_BITYPES_H
1433 # include <sys/bitypes.h>
1436 [ int64_t a; a = 1;],
1437 [ ac_cv_have_int64_t="yes" ],
1438 [ ac_cv_have_int64_t="no" ]
1441 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1442 AC_DEFINE(HAVE_INT64_T)
1445 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1447 [ #include <sys/types.h> ],
1448 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1449 [ ac_cv_have_u_intxx_t="yes" ],
1450 [ ac_cv_have_u_intxx_t="no" ]
1453 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1454 AC_DEFINE(HAVE_U_INTXX_T)
1458 if test -z "$have_u_intxx_t" ; then
1459 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1461 [ #include <sys/socket.h> ],
1462 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1464 AC_DEFINE(HAVE_U_INTXX_T)
1467 [ AC_MSG_RESULT(no) ]
1471 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1473 [ #include <sys/types.h> ],
1474 [ u_int64_t a; a = 1;],
1475 [ ac_cv_have_u_int64_t="yes" ],
1476 [ ac_cv_have_u_int64_t="no" ]
1479 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1480 AC_DEFINE(HAVE_U_INT64_T)
1484 if test -z "$have_u_int64_t" ; then
1485 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1487 [ #include <sys/bitypes.h> ],
1488 [ u_int64_t a; a = 1],
1490 AC_DEFINE(HAVE_U_INT64_T)
1493 [ AC_MSG_RESULT(no) ]
1497 if test -z "$have_u_intxx_t" ; then
1498 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1501 #include <sys/types.h>
1503 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1504 [ ac_cv_have_uintxx_t="yes" ],
1505 [ ac_cv_have_uintxx_t="no" ]
1508 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1509 AC_DEFINE(HAVE_UINTXX_T)
1513 if test -z "$have_uintxx_t" ; then
1514 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1516 [ #include <stdint.h> ],
1517 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1519 AC_DEFINE(HAVE_UINTXX_T)
1522 [ AC_MSG_RESULT(no) ]
1526 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1527 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1529 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1532 #include <sys/bitypes.h>
1535 int8_t a; int16_t b; int32_t c;
1536 u_int8_t e; u_int16_t f; u_int32_t g;
1537 a = b = c = e = f = g = 1;
1540 AC_DEFINE(HAVE_U_INTXX_T)
1541 AC_DEFINE(HAVE_INTXX_T)
1549 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1552 #include <sys/types.h>
1554 [ u_char foo; foo = 125; ],
1555 [ ac_cv_have_u_char="yes" ],
1556 [ ac_cv_have_u_char="no" ]
1559 if test "x$ac_cv_have_u_char" = "xyes" ; then
1560 AC_DEFINE(HAVE_U_CHAR)
1565 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1567 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1570 #include <sys/types.h>
1572 [ size_t foo; foo = 1235; ],
1573 [ ac_cv_have_size_t="yes" ],
1574 [ ac_cv_have_size_t="no" ]
1577 if test "x$ac_cv_have_size_t" = "xyes" ; then
1578 AC_DEFINE(HAVE_SIZE_T)
1581 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1584 #include <sys/types.h>
1586 [ ssize_t foo; foo = 1235; ],
1587 [ ac_cv_have_ssize_t="yes" ],
1588 [ ac_cv_have_ssize_t="no" ]
1591 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1592 AC_DEFINE(HAVE_SSIZE_T)
1595 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1600 [ clock_t foo; foo = 1235; ],
1601 [ ac_cv_have_clock_t="yes" ],
1602 [ ac_cv_have_clock_t="no" ]
1605 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1606 AC_DEFINE(HAVE_CLOCK_T)
1609 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1612 #include <sys/types.h>
1613 #include <sys/socket.h>
1615 [ sa_family_t foo; foo = 1235; ],
1616 [ ac_cv_have_sa_family_t="yes" ],
1619 #include <sys/types.h>
1620 #include <sys/socket.h>
1621 #include <netinet/in.h>
1623 [ sa_family_t foo; foo = 1235; ],
1624 [ ac_cv_have_sa_family_t="yes" ],
1626 [ ac_cv_have_sa_family_t="no" ]
1630 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1631 AC_DEFINE(HAVE_SA_FAMILY_T)
1634 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1637 #include <sys/types.h>
1639 [ pid_t foo; foo = 1235; ],
1640 [ ac_cv_have_pid_t="yes" ],
1641 [ ac_cv_have_pid_t="no" ]
1644 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1645 AC_DEFINE(HAVE_PID_T)
1648 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1651 #include <sys/types.h>
1653 [ mode_t foo; foo = 1235; ],
1654 [ ac_cv_have_mode_t="yes" ],
1655 [ ac_cv_have_mode_t="no" ]
1658 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1659 AC_DEFINE(HAVE_MODE_T)
1663 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1666 #include <sys/types.h>
1667 #include <sys/socket.h>
1669 [ struct sockaddr_storage s; ],
1670 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1671 [ ac_cv_have_struct_sockaddr_storage="no" ]
1674 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1675 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1678 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1681 #include <sys/types.h>
1682 #include <netinet/in.h>
1684 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1685 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1686 [ ac_cv_have_struct_sockaddr_in6="no" ]
1689 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1690 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1693 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1696 #include <sys/types.h>
1697 #include <netinet/in.h>
1699 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1700 [ ac_cv_have_struct_in6_addr="yes" ],
1701 [ ac_cv_have_struct_in6_addr="no" ]
1704 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1705 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1708 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1711 #include <sys/types.h>
1712 #include <sys/socket.h>
1715 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1716 [ ac_cv_have_struct_addrinfo="yes" ],
1717 [ ac_cv_have_struct_addrinfo="no" ]
1720 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1721 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1724 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1726 [ #include <sys/time.h> ],
1727 [ struct timeval tv; tv.tv_sec = 1;],
1728 [ ac_cv_have_struct_timeval="yes" ],
1729 [ ac_cv_have_struct_timeval="no" ]
1732 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1733 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1734 have_struct_timeval=1
1737 AC_CHECK_TYPES(struct timespec)
1739 # We need int64_t or else certian parts of the compile will fail.
1740 if test "x$ac_cv_have_int64_t" = "xno" -a \
1741 "x$ac_cv_sizeof_long_int" != "x8" -a \
1742 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1743 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1744 echo "an alternative compiler (I.E., GCC) before continuing."
1748 dnl test snprintf (broken on SCO w/gcc)
1753 #ifdef HAVE_SNPRINTF
1757 char expected_out[50];
1759 #if (SIZEOF_LONG_INT == 8)
1760 long int num = 0x7fffffffffffffff;
1762 long long num = 0x7fffffffffffffffll;
1764 strcpy(expected_out, "9223372036854775807");
1765 snprintf(buf, mazsize, "%lld", num);
1766 if(strcmp(buf, expected_out) != 0)
1773 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1777 dnl Checks for structure members
1778 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1779 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1780 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1781 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1782 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1783 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1784 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1785 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1786 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1787 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1788 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1789 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1790 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1791 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1792 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1793 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1794 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1796 AC_CHECK_MEMBERS([struct stat.st_blksize])
1798 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1799 ac_cv_have_ss_family_in_struct_ss, [
1802 #include <sys/types.h>
1803 #include <sys/socket.h>
1805 [ struct sockaddr_storage s; s.ss_family = 1; ],
1806 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1807 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1810 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1811 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1814 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1815 ac_cv_have___ss_family_in_struct_ss, [
1818 #include <sys/types.h>
1819 #include <sys/socket.h>
1821 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1822 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1823 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1826 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1827 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1830 AC_CACHE_CHECK([for pw_class field in struct passwd],
1831 ac_cv_have_pw_class_in_struct_passwd, [
1836 [ struct passwd p; p.pw_class = 0; ],
1837 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1838 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1841 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1842 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1845 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1846 ac_cv_have_pw_expire_in_struct_passwd, [
1851 [ struct passwd p; p.pw_expire = 0; ],
1852 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1853 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1856 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1857 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1860 AC_CACHE_CHECK([for pw_change field in struct passwd],
1861 ac_cv_have_pw_change_in_struct_passwd, [
1866 [ struct passwd p; p.pw_change = 0; ],
1867 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1868 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1871 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1872 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1875 dnl make sure we're using the real structure members and not defines
1876 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1877 ac_cv_have_accrights_in_msghdr, [
1880 #include <sys/types.h>
1881 #include <sys/socket.h>
1882 #include <sys/uio.h>
1884 #ifdef msg_accrights
1888 m.msg_accrights = 0;
1892 [ ac_cv_have_accrights_in_msghdr="yes" ],
1893 [ ac_cv_have_accrights_in_msghdr="no" ]
1896 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1897 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1900 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1901 ac_cv_have_control_in_msghdr, [
1904 #include <sys/types.h>
1905 #include <sys/socket.h>
1906 #include <sys/uio.h>
1916 [ ac_cv_have_control_in_msghdr="yes" ],
1917 [ ac_cv_have_control_in_msghdr="no" ]
1920 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1921 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1924 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1926 [ extern char *__progname; printf("%s", __progname); ],
1927 [ ac_cv_libc_defines___progname="yes" ],
1928 [ ac_cv_libc_defines___progname="no" ]
1931 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1932 AC_DEFINE(HAVE___PROGNAME)
1935 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1939 [ printf("%s", __FUNCTION__); ],
1940 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1941 [ ac_cv_cc_implements___FUNCTION__="no" ]
1944 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1945 AC_DEFINE(HAVE___FUNCTION__)
1948 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1952 [ printf("%s", __func__); ],
1953 [ ac_cv_cc_implements___func__="yes" ],
1954 [ ac_cv_cc_implements___func__="no" ]
1957 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1958 AC_DEFINE(HAVE___func__)
1961 AC_CACHE_CHECK([whether getopt has optreset support],
1962 ac_cv_have_getopt_optreset, [
1967 [ extern int optreset; optreset = 0; ],
1968 [ ac_cv_have_getopt_optreset="yes" ],
1969 [ ac_cv_have_getopt_optreset="no" ]
1972 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1973 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1976 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1978 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1979 [ ac_cv_libc_defines_sys_errlist="yes" ],
1980 [ ac_cv_libc_defines_sys_errlist="no" ]
1983 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1984 AC_DEFINE(HAVE_SYS_ERRLIST)
1988 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1990 [ extern int sys_nerr; printf("%i", sys_nerr);],
1991 [ ac_cv_libc_defines_sys_nerr="yes" ],
1992 [ ac_cv_libc_defines_sys_nerr="no" ]
1995 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1996 AC_DEFINE(HAVE_SYS_NERR)
2000 # Check whether user wants sectok support
2002 [ --with-sectok Enable smartcard support using libsectok],
2004 if test "x$withval" != "xno" ; then
2005 if test "x$withval" != "xyes" ; then
2006 CPPFLAGS="$CPPFLAGS -I${withval}"
2007 LDFLAGS="$LDFLAGS -L${withval}"
2008 if test ! -z "$need_dash_r" ; then
2009 LDFLAGS="$LDFLAGS -R${withval}"
2011 if test ! -z "$blibpath" ; then
2012 blibpath="$blibpath:${withval}"
2015 AC_CHECK_HEADERS(sectok.h)
2016 if test "$ac_cv_header_sectok_h" != yes; then
2017 AC_MSG_ERROR(Can't find sectok.h)
2019 AC_CHECK_LIB(sectok, sectok_open)
2020 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2021 AC_MSG_ERROR(Can't find libsectok)
2023 AC_DEFINE(SMARTCARD)
2024 AC_DEFINE(USE_SECTOK)
2025 SCARD_MSG="yes, using sectok"
2030 # Check whether user wants OpenSC support
2032 AC_HELP_STRING([--with-opensc=PFX],
2033 [Enable smartcard support using OpenSC]),
2034 opensc_config_prefix="$withval", opensc_config_prefix="")
2035 if test x$opensc_config_prefix != x ; then
2036 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2037 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2038 if test "$OPENSC_CONFIG" != "no"; then
2039 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2040 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2041 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2042 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2043 AC_DEFINE(SMARTCARD)
2044 AC_DEFINE(USE_OPENSC)
2045 SCARD_MSG="yes, using OpenSC"
2049 # Check libraries needed by DNS fingerprint support
2050 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2051 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
2053 # Needed by our getrrsetbyname()
2054 AC_SEARCH_LIBS(res_query, resolv)
2055 AC_SEARCH_LIBS(dn_expand, resolv)
2056 AC_CHECK_FUNCS(_getshort _getlong)
2057 AC_CHECK_MEMBER(HEADER.ad,
2058 [AC_DEFINE(HAVE_HEADER_AD)],,
2059 [#include <arpa/nameser.h>])
2062 # Check whether user wants Kerberos 5 support
2064 AC_ARG_WITH(kerberos5,
2065 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2066 [ if test "x$withval" != "xno" ; then
2067 if test "x$withval" = "xyes" ; then
2068 KRB5ROOT="/usr/local"
2076 AC_MSG_CHECKING(for krb5-config)
2077 if test -x $KRB5ROOT/bin/krb5-config ; then
2078 KRB5CONF=$KRB5ROOT/bin/krb5-config
2079 AC_MSG_RESULT($KRB5CONF)
2081 AC_MSG_CHECKING(for gssapi support)
2082 if $KRB5CONF | grep gssapi >/dev/null ; then
2084 K5CFLAGS="`$KRB5CONF --cflags gssapi`"
2085 dnl m4 quadragraphs: "sed 's/-l[^- ]*//g'"
2086 K5LDFLAGS="`$KRB5CONF --libs gssapi | sed 's/-l@<:@^- @:>@*//g'`"
2087 K5LIBS="`$KRB5CONF --libs gssapi | sed 's/-L@<:@^- @:>@*//g'`"
2090 K5CFLAGS="`$KRB5CONF --cflags`"
2091 K5LDFLAGS="`$KRB5CONF --libs | sed 's/-l@<:@^- @:>@*//g'`"
2092 K5LIBS="`$KRB5CONF --libs | sed 's/-L@<:@^- @:>@*//g'`"
2094 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2095 LDFLAGS="$LDFLAGS $K5LDFLAGS"
2096 AC_MSG_CHECKING(whether we are using Heimdal)
2097 AC_TRY_COMPILE([ #include <krb5.h> ],
2098 [ char *tmp = heimdal_version; ],
2099 [ AC_MSG_RESULT(yes)
2100 AC_DEFINE(HEIMDAL) ],
2105 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2106 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2107 AC_MSG_CHECKING(whether we are using Heimdal)
2108 AC_TRY_COMPILE([ #include <krb5.h> ],
2109 [ char *tmp = heimdal_version; ],
2110 [ AC_MSG_RESULT(yes)
2112 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2115 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2118 AC_SEARCH_LIBS(dn_expand, resolv)
2120 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2122 K5LIBS="-lgssapi $K5LIBS" ],
2123 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2125 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2126 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2131 AC_CHECK_HEADER(gssapi.h, ,
2132 [ unset ac_cv_header_gssapi_h
2133 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2134 AC_CHECK_HEADERS(gssapi.h, ,
2135 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2141 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2142 AC_CHECK_HEADER(gssapi_krb5.h, ,
2143 [ CPPFLAGS="$oldCPP" ])
2146 if test ! -z "$need_dash_r" ; then
2147 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2149 if test ! -z "$blibpath" ; then
2150 blibpath="$blibpath:${KRB5ROOT}/lib"
2153 AC_SEARCH_LIBS(k_hasafs, kafs,
2154 [ AC_DEFINE(USE_AFS)
2155 K5LIBS="-lkafs $K5LIBS"
2159 LIBS="$LIBS $K5LIBS"
2161 # Looking for programs, paths and files
2163 PRIVSEP_PATH=/var/empty
2164 AC_ARG_WITH(privsep-path,
2165 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2167 if test "x$withval" != "$no" ; then
2168 PRIVSEP_PATH=$withval
2172 AC_SUBST(PRIVSEP_PATH)
2175 [ --with-xauth=PATH Specify path to xauth program ],
2177 if test "x$withval" != "xno" ; then
2183 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2184 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2185 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2186 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2187 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2188 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2189 xauth_path="/usr/openwin/bin/xauth"
2195 AC_ARG_ENABLE(strip,
2196 [ --disable-strip Disable calling strip(1) on install],
2198 if test "x$enableval" = "xno" ; then
2205 if test -z "$xauth_path" ; then
2206 XAUTH_PATH="undefined"
2207 AC_SUBST(XAUTH_PATH)
2209 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2210 XAUTH_PATH=$xauth_path
2211 AC_SUBST(XAUTH_PATH)
2214 # Check for mail directory (last resort if we cannot get it from headers)
2215 if test ! -z "$MAIL" ; then
2216 maildir=`dirname $MAIL`
2217 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2220 if test -z "$no_dev_ptmx" ; then
2221 if test "x$disable_ptmx_check" != "xyes" ; then
2222 AC_CHECK_FILE("/dev/ptmx",
2224 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2230 AC_CHECK_FILE("/dev/ptc",
2232 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2237 # Options from here on. Some of these are preset by platform above
2238 AC_ARG_WITH(mantype,
2239 [ --with-mantype=man|cat|doc Set man page type],
2246 AC_MSG_ERROR(invalid man type: $withval)
2251 if test -z "$MANTYPE"; then
2252 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2253 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2254 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2256 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2263 if test "$MANTYPE" = "doc"; then
2270 # Check whether to enable MD5 passwords
2272 AC_ARG_WITH(md5-passwords,
2273 [ --with-md5-passwords Enable use of MD5 passwords],
2275 if test "x$withval" != "xno" ; then
2276 AC_DEFINE(HAVE_MD5_PASSWORDS)
2282 # Whether to disable shadow password support
2284 [ --without-shadow Disable shadow password support],
2286 if test "x$withval" = "xno" ; then
2287 AC_DEFINE(DISABLE_SHADOW)
2293 if test -z "$disable_shadow" ; then
2294 AC_MSG_CHECKING([if the systems has expire shadow information])
2297 #include <sys/types.h>
2300 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2301 [ sp_expire_available=yes ], []
2304 if test "x$sp_expire_available" = "xyes" ; then
2306 AC_DEFINE(HAS_SHADOW_EXPIRE)
2312 # Use ip address instead of hostname in $DISPLAY
2313 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2314 DISPLAY_HACK_MSG="yes"
2315 AC_DEFINE(IPADDR_IN_DISPLAY)
2317 DISPLAY_HACK_MSG="no"
2318 AC_ARG_WITH(ipaddr-display,
2319 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2321 if test "x$withval" != "xno" ; then
2322 AC_DEFINE(IPADDR_IN_DISPLAY)
2323 DISPLAY_HACK_MSG="yes"
2329 # check for /etc/default/login and use it if present.
2330 AC_ARG_ENABLE(etc-default-login,
2331 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2333 AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2335 if test "x$external_path_file" = "x/etc/default/login"; then
2336 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2340 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2341 if test $ac_cv_func_login_getcapbool = "yes" -a \
2342 $ac_cv_header_login_cap_h = "yes" ; then
2343 external_path_file=/etc/login.conf
2346 # Whether to mess with the default path
2347 SERVER_PATH_MSG="(default)"
2348 AC_ARG_WITH(default-path,
2349 [ --with-default-path= Specify default \$PATH environment for server],
2351 if test "x$external_path_file" = "x/etc/login.conf" ; then
2353 --with-default-path=PATH has no effect on this system.
2354 Edit /etc/login.conf instead.])
2355 elif test "x$withval" != "xno" ; then
2356 if test ! -z "$external_path_file" ; then
2358 --with-default-path=PATH will only be used if PATH is not defined in
2359 $external_path_file .])
2361 user_path="$withval"
2362 SERVER_PATH_MSG="$withval"
2365 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2366 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2368 if test ! -z "$external_path_file" ; then
2370 If PATH is defined in $external_path_file, ensure the path to scp is included,
2371 otherwise scp will not work.])
2375 /* find out what STDPATH is */
2380 #ifndef _PATH_STDPATH
2381 # ifdef _PATH_USERPATH /* Irix */
2382 # define _PATH_STDPATH _PATH_USERPATH
2384 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2387 #include <sys/types.h>
2388 #include <sys/stat.h>
2390 #define DATA "conftest.stdpath"
2397 fd = fopen(DATA,"w");
2401 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2406 ], [ user_path=`cat conftest.stdpath` ],
2407 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2408 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2410 # make sure $bindir is in USER_PATH so scp will work
2411 t_bindir=`eval echo ${bindir}`
2413 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2416 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2418 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2419 if test $? -ne 0 ; then
2420 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2421 if test $? -ne 0 ; then
2422 user_path=$user_path:$t_bindir
2423 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2428 if test "x$external_path_file" != "x/etc/login.conf" ; then
2429 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2433 # Set superuser path separately to user path
2434 AC_ARG_WITH(superuser-path,
2435 [ --with-superuser-path= Specify different path for super-user],
2437 if test "x$withval" != "xno" ; then
2438 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2439 superuser_path=$withval
2445 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2446 IPV4_IN6_HACK_MSG="no"
2448 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2450 if test "x$withval" != "xno" ; then
2452 AC_DEFINE(IPV4_IN_IPV6)
2453 IPV4_IN6_HACK_MSG="yes"
2458 if test "x$inet6_default_4in6" = "xyes"; then
2459 AC_MSG_RESULT([yes (default)])
2460 AC_DEFINE(IPV4_IN_IPV6)
2461 IPV4_IN6_HACK_MSG="yes"
2463 AC_MSG_RESULT([no (default)])
2468 # Whether to enable BSD auth support
2470 AC_ARG_WITH(bsd-auth,
2471 [ --with-bsd-auth Enable BSD auth support],
2473 if test "x$withval" != "xno" ; then
2480 # Where to place sshd.pid
2482 # make sure the directory exists
2483 if test ! -d $piddir ; then
2484 piddir=`eval echo ${sysconfdir}`
2486 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2490 AC_ARG_WITH(pid-dir,
2491 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2493 if test "x$withval" != "xno" ; then
2495 if test ! -d $piddir ; then
2496 AC_MSG_WARN([** no $piddir directory on this system **])
2502 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2505 dnl allow user to disable some login recording features
2506 AC_ARG_ENABLE(lastlog,
2507 [ --disable-lastlog disable use of lastlog even if detected [no]],
2509 if test "x$enableval" = "xno" ; then
2510 AC_DEFINE(DISABLE_LASTLOG)
2515 [ --disable-utmp disable use of utmp even if detected [no]],
2517 if test "x$enableval" = "xno" ; then
2518 AC_DEFINE(DISABLE_UTMP)
2522 AC_ARG_ENABLE(utmpx,
2523 [ --disable-utmpx disable use of utmpx even if detected [no]],
2525 if test "x$enableval" = "xno" ; then
2526 AC_DEFINE(DISABLE_UTMPX)
2531 [ --disable-wtmp disable use of wtmp even if detected [no]],
2533 if test "x$enableval" = "xno" ; then
2534 AC_DEFINE(DISABLE_WTMP)
2538 AC_ARG_ENABLE(wtmpx,
2539 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2541 if test "x$enableval" = "xno" ; then
2542 AC_DEFINE(DISABLE_WTMPX)
2546 AC_ARG_ENABLE(libutil,
2547 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2549 if test "x$enableval" = "xno" ; then
2550 AC_DEFINE(DISABLE_LOGIN)
2554 AC_ARG_ENABLE(pututline,
2555 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2557 if test "x$enableval" = "xno" ; then
2558 AC_DEFINE(DISABLE_PUTUTLINE)
2562 AC_ARG_ENABLE(pututxline,
2563 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2565 if test "x$enableval" = "xno" ; then
2566 AC_DEFINE(DISABLE_PUTUTXLINE)
2570 AC_ARG_WITH(lastlog,
2571 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2573 if test "x$withval" = "xno" ; then
2574 AC_DEFINE(DISABLE_LASTLOG)
2576 conf_lastlog_location=$withval
2581 dnl lastlog, [uw]tmpx? detection
2582 dnl NOTE: set the paths in the platform section to avoid the
2583 dnl need for command-line parameters
2584 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2586 dnl lastlog detection
2587 dnl NOTE: the code itself will detect if lastlog is a directory
2588 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2590 #include <sys/types.h>
2592 #ifdef HAVE_LASTLOG_H
2593 # include <lastlog.h>
2602 [ char *lastlog = LASTLOG_FILE; ],
2603 [ AC_MSG_RESULT(yes) ],
2606 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2608 #include <sys/types.h>
2610 #ifdef HAVE_LASTLOG_H
2611 # include <lastlog.h>
2617 [ char *lastlog = _PATH_LASTLOG; ],
2618 [ AC_MSG_RESULT(yes) ],
2621 system_lastlog_path=no
2626 if test -z "$conf_lastlog_location"; then
2627 if test x"$system_lastlog_path" = x"no" ; then
2628 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2629 if (test -d "$f" || test -f "$f") ; then
2630 conf_lastlog_location=$f
2633 if test -z "$conf_lastlog_location"; then
2634 AC_MSG_WARN([** Cannot find lastlog **])
2635 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2640 if test -n "$conf_lastlog_location"; then
2641 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2645 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2647 #include <sys/types.h>
2653 [ char *utmp = UTMP_FILE; ],
2654 [ AC_MSG_RESULT(yes) ],
2656 system_utmp_path=no ]
2658 if test -z "$conf_utmp_location"; then
2659 if test x"$system_utmp_path" = x"no" ; then
2660 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2661 if test -f $f ; then
2662 conf_utmp_location=$f
2665 if test -z "$conf_utmp_location"; then
2666 AC_DEFINE(DISABLE_UTMP)
2670 if test -n "$conf_utmp_location"; then
2671 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2675 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2677 #include <sys/types.h>
2683 [ char *wtmp = WTMP_FILE; ],
2684 [ AC_MSG_RESULT(yes) ],
2686 system_wtmp_path=no ]
2688 if test -z "$conf_wtmp_location"; then
2689 if test x"$system_wtmp_path" = x"no" ; then
2690 for f in /usr/adm/wtmp /var/log/wtmp; do
2691 if test -f $f ; then
2692 conf_wtmp_location=$f
2695 if test -z "$conf_wtmp_location"; then
2696 AC_DEFINE(DISABLE_WTMP)
2700 if test -n "$conf_wtmp_location"; then
2701 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2705 dnl utmpx detection - I don't know any system so perverse as to require
2706 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2708 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2710 #include <sys/types.h>
2719 [ char *utmpx = UTMPX_FILE; ],
2720 [ AC_MSG_RESULT(yes) ],
2722 system_utmpx_path=no ]
2724 if test -z "$conf_utmpx_location"; then
2725 if test x"$system_utmpx_path" = x"no" ; then
2726 AC_DEFINE(DISABLE_UTMPX)
2729 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2733 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2735 #include <sys/types.h>
2744 [ char *wtmpx = WTMPX_FILE; ],
2745 [ AC_MSG_RESULT(yes) ],
2747 system_wtmpx_path=no ]
2749 if test -z "$conf_wtmpx_location"; then
2750 if test x"$system_wtmpx_path" = x"no" ; then
2751 AC_DEFINE(DISABLE_WTMPX)
2754 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2758 if test ! -z "$blibpath" ; then
2759 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2760 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2763 dnl remove pam and dl because they are in $LIBPAM
2764 if test "$PAM_MSG" = yes ; then
2765 LIBS=`echo $LIBS | sed 's/-lpam //'`
2767 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2768 LIBS=`echo $LIBS | sed 's/-ldl //'`
2772 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2775 # Print summary of options
2777 # Someone please show me a better way :)
2778 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2779 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2780 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2781 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2782 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2783 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2784 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2785 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2786 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2787 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2790 echo "OpenSSH has been configured with the following options:"
2791 echo " User binaries: $B"
2792 echo " System binaries: $C"
2793 echo " Configuration files: $D"
2794 echo " Askpass program: $E"
2795 echo " Manual pages: $F"
2796 echo " PID file: $G"
2797 echo " Privilege separation chroot path: $H"
2798 if test "x$external_path_file" = "x/etc/login.conf" ; then
2799 echo " At runtime, sshd will use the path defined in $external_path_file"
2800 echo " Make sure the path to scp is present, otherwise scp will not work"
2802 echo " sshd default user PATH: $I"
2803 if test ! -z "$external_path_file"; then
2804 echo " (If PATH is set in $external_path_file it will be used instead. If"
2805 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2808 if test ! -z "$superuser_path" ; then
2809 echo " sshd superuser user PATH: $J"
2811 echo " Manpage format: $MANTYPE"
2812 echo " PAM support: $PAM_MSG"
2813 echo " KerberosV support: $KRB5_MSG"
2814 echo " Smartcard support: $SCARD_MSG"
2815 echo " S/KEY support: $SKEY_MSG"
2816 echo " TCP Wrappers support: $TCPW_MSG"
2817 echo " MD5 password support: $MD5_MSG"
2818 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2819 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2820 echo " BSD Auth support: $BSD_AUTH_MSG"
2821 echo " Random number source: $RAND_MSG"
2822 if test ! -z "$USE_RAND_HELPER" ; then
2823 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2828 echo " Host: ${host}"
2829 echo " Compiler: ${CC}"
2830 echo " Compiler flags: ${CFLAGS}"
2831 echo "Preprocessor flags: ${CPPFLAGS}"
2832 echo " Linker flags: ${LDFLAGS}"
2833 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2837 if test "x$PAM_MSG" = "xyes" ; then
2838 echo "PAM is enabled. You may need to install a PAM control file "
2839 echo "for sshd, otherwise password authentication may fail. "
2840 echo "Example PAM control files can be found in the contrib/ "
2845 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2846 echo "WARNING: you are using the builtin random number collection "
2847 echo "service. Please read WARNING.RNG and request that your OS "
2848 echo "vendor includes kernel-based random number collection in "
2849 echo "future versions of your OS."