3 # Copyright (c) 1999-2004 Damien Miller
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
18 AC_CONFIG_SRCDIR([ssh.c])
20 AC_CONFIG_HEADER(config.h)
25 # Checks for programs.
31 AC_PATH_PROG(CAT, cat)
32 AC_PATH_PROG(KILL, kill)
33 AC_PATH_PROGS(PERL, perl5 perl)
34 AC_PATH_PROG(SED, sed)
36 AC_PATH_PROG(ENT, ent)
38 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
42 AC_SUBST(TEST_SHELL,sh)
45 AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47 AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49 AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
54 if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
58 # Use LOGIN_PROGRAM from environment if possible
59 if test ! -z "$LOGIN_PROGRAM" ; then
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
61 [If your header files don't define LOGIN_PROGRAM,
62 then use this (detected) from environment and PATH])
65 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
66 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
67 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
71 AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
72 if test ! -z "$PATH_PASSWD_PROG" ; then
73 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
74 [Full path of your "passwd" program])
77 if test -z "$LD" ; then
84 AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
86 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
87 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
88 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
91 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
93 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
94 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
98 if test -z "$have_llong_max"; then
99 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
100 unset ac_cv_have_decl_LLONG_MAX
101 saved_CFLAGS="$CFLAGS"
102 CFLAGS="$CFLAGS -std=gnu99"
103 AC_CHECK_DECL(LLONG_MAX,
105 [CFLAGS="$saved_CFLAGS"],
106 [#include <limits.h>]
112 [ --without-rpath Disable auto-added -R linker paths],
114 if test "x$withval" = "xno" ; then
117 if test "x$withval" = "xyes" ; then
123 # Check for some target-specific stuff
126 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
127 if (test -z "$blibpath"); then
128 blibpath="/usr/lib:/lib"
130 saved_LDFLAGS="$LDFLAGS"
131 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
132 if (test -z "$blibflags"); then
133 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
134 AC_TRY_LINK([], [], [blibflags=$tryflags])
137 if (test -z "$blibflags"); then
138 AC_MSG_RESULT(not found)
139 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
141 AC_MSG_RESULT($blibflags)
143 LDFLAGS="$saved_LDFLAGS"
144 dnl Check for authenticate. Might be in libs.a on older AIXes
145 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
146 [Define if you want to enable AIX4's authenticate function])],
147 [AC_CHECK_LIB(s,authenticate,
148 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
152 dnl Check for various auth function declarations in headers.
153 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
154 passwdexpired, setauthdb], , , [#include <usersec.h>])
155 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
156 AC_CHECK_DECLS(loginfailed,
157 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
159 [#include <usersec.h>],
160 [(void)loginfailed("user","host","tty",0);],
162 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
163 [Define if your AIX loginfailed() function
164 takes 4 arguments (AIX >= 5.2)])],
168 [#include <usersec.h>]
170 AC_CHECK_FUNCS(setauthdb)
171 check_for_aix_broken_getaddrinfo=1
172 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
173 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
174 [Define if your platform breaks doing a seteuid before a setuid])
175 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
176 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
177 dnl AIX handles lastlog as part of its login message
178 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
179 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
180 [Some systems need a utmpx entry for /bin/login to work])
181 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
182 [Define to a Set Process Title type if your system is
183 supported by bsd-setproctitle.c])
184 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
185 [AIX 5.2 and 5.3 (and presumably newer) require this])
188 check_for_libcrypt_later=1
189 LIBS="$LIBS /usr/lib/textmode.o"
190 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
191 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
192 AC_DEFINE(DISABLE_SHADOW, 1,
193 [Define if you want to disable shadow passwords])
194 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
195 [Define if your system choked on IP TOS setting])
196 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
197 [Define if X11 doesn't support AF_UNIX sockets on that system])
198 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
199 [Define if the concept of ports only accessible to
200 superusers isn't known])
201 AC_DEFINE(DISABLE_FD_PASSING, 1,
202 [Define if your platform needs to skip post auth
203 file descriptor passing])
206 AC_DEFINE(IP_TOS_IS_BROKEN)
207 AC_DEFINE(SETEUID_BREAKS_SETUID)
208 AC_DEFINE(BROKEN_SETREUID)
209 AC_DEFINE(BROKEN_SETREGID)
212 AC_MSG_CHECKING(if we have working getaddrinfo)
213 AC_TRY_RUN([#include <mach-o/dyld.h>
214 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
218 }], [AC_MSG_RESULT(working)],
219 [AC_MSG_RESULT(buggy)
220 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
221 [AC_MSG_RESULT(assume it is working)])
222 AC_DEFINE(SETEUID_BREAKS_SETUID)
223 AC_DEFINE(BROKEN_SETREUID)
224 AC_DEFINE(BROKEN_SETREGID)
225 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
226 [Define if your resolver libs need this for getrrsetbyname])
229 # first we define all of the options common to all HP-UX releases
230 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
231 IPADDR_IN_DISPLAY=yes
233 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
234 [Define if your login program cannot handle end of options ("--")])
235 AC_DEFINE(LOGIN_NEEDS_UTMPX)
236 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
237 [String used in /etc/passwd to denote locked account])
238 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
239 MAIL="/var/mail/username"
241 AC_CHECK_LIB(xnet, t_error, ,
242 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
244 # next, we define all of the options specific to major releases
247 if test -z "$GCC"; then
252 AC_DEFINE(PAM_SUN_CODEBASE, 1,
253 [Define if you are using Solaris-derived PAM which
254 passes pam_messages to the conversation function
255 with an extra level of indirection])
256 AC_DEFINE(DISABLE_UTMP, 1,
257 [Define if you don't want to use utmp])
258 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
259 check_for_hpux_broken_getaddrinfo=1
260 check_for_conflicting_getspnam=1
264 # lastly, we define options specific to minor releases
267 AC_DEFINE(HAVE_SECUREWARE, 1,
268 [Define if you have SecureWare-based
269 protected password database])
270 disable_ptmx_check=yes
276 PATH="$PATH:/usr/etc"
277 AC_DEFINE(BROKEN_INET_NTOA, 1,
278 [Define if you system's inet_ntoa is busted
279 (e.g. Irix gcc issue)])
280 AC_DEFINE(SETEUID_BREAKS_SETUID)
281 AC_DEFINE(BROKEN_SETREUID)
282 AC_DEFINE(BROKEN_SETREGID)
283 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
284 [Define if you shouldn't strip 'tty' from your
286 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
289 PATH="$PATH:/usr/etc"
290 AC_DEFINE(WITH_IRIX_ARRAY, 1,
291 [Define if you have/want arrays
292 (cluster-wide session managment, not C arrays)])
293 AC_DEFINE(WITH_IRIX_PROJECT, 1,
294 [Define if you want IRIX project management])
295 AC_DEFINE(WITH_IRIX_AUDIT, 1,
296 [Define if you want IRIX audit trails])
297 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
298 [Define if you want IRIX kernel jobs])])
299 AC_DEFINE(BROKEN_INET_NTOA)
300 AC_DEFINE(SETEUID_BREAKS_SETUID)
301 AC_DEFINE(BROKEN_SETREUID)
302 AC_DEFINE(BROKEN_SETREGID)
303 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
304 AC_DEFINE(WITH_ABBREV_NO_TTY)
305 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
309 check_for_libcrypt_later=1
310 check_for_openpty_ctty_bug=1
311 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
312 AC_DEFINE(PAM_TTY_KLUDGE, 1,
313 [Work around problematic Linux PAM modules handling of PAM_TTY])
314 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
315 [String used in /etc/passwd to denote locked account])
316 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
317 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
318 [Define to whatever link() returns for "not supported"
319 if it doesn't return EOPNOTSUPP.])
320 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
322 inet6_default_4in6=yes
325 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
326 [Define if cmsg_type is not passed correctly])
330 mips-sony-bsd|mips-sony-newsos4)
331 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
335 check_for_libcrypt_before=1
336 if test "x$withval" != "xno" ; then
341 check_for_libcrypt_later=1
342 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
345 AC_DEFINE(SETEUID_BREAKS_SETUID)
346 AC_DEFINE(BROKEN_SETREUID)
347 AC_DEFINE(BROKEN_SETREGID)
350 conf_lastlog_location="/usr/adm/lastlog"
351 conf_utmp_location=/etc/utmp
352 conf_wtmp_location=/usr/adm/wtmp
354 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
355 AC_DEFINE(BROKEN_REALPATH)
357 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
360 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
361 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
364 if test "x$withval" != "xno" ; then
367 AC_DEFINE(PAM_SUN_CODEBASE)
368 AC_DEFINE(LOGIN_NEEDS_UTMPX)
369 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
370 [Some versions of /bin/login need the TERM supplied
372 AC_DEFINE(PAM_TTY_KLUDGE)
373 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
374 [Define if pam_chauthtok wants real uid set
375 to the unpriv'ed user])
376 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
377 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
378 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
379 [Define if sshd somehow reacquires a controlling TTY
381 external_path_file=/etc/default/login
382 # hardwire lastlog location (can't detect it on some versions)
383 conf_lastlog_location="/var/adm/lastlog"
384 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
385 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
386 if test "$sol2ver" -ge 8; then
388 AC_DEFINE(DISABLE_UTMP)
389 AC_DEFINE(DISABLE_WTMP, 1,
390 [Define if you don't want to use wtmp])
396 CPPFLAGS="$CPPFLAGS -DSUNOS4"
397 AC_CHECK_FUNCS(getpwanam)
398 AC_DEFINE(PAM_SUN_CODEBASE)
399 conf_utmp_location=/etc/utmp
400 conf_wtmp_location=/var/adm/wtmp
401 conf_lastlog_location=/var/adm/lastlog
407 AC_DEFINE(SSHD_ACQUIRES_CTTY)
408 AC_DEFINE(SETEUID_BREAKS_SETUID)
409 AC_DEFINE(BROKEN_SETREUID)
410 AC_DEFINE(BROKEN_SETREGID)
413 # /usr/ucblib MUST NOT be searched on ReliantUNIX
414 AC_CHECK_LIB(dl, dlsym, ,)
415 # -lresolv needs to be at the end of LIBS or DNS lookups break
416 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
417 IPADDR_IN_DISPLAY=yes
419 AC_DEFINE(IP_TOS_IS_BROKEN)
420 AC_DEFINE(SETEUID_BREAKS_SETUID)
421 AC_DEFINE(BROKEN_SETREUID)
422 AC_DEFINE(BROKEN_SETREGID)
423 AC_DEFINE(SSHD_ACQUIRES_CTTY)
424 external_path_file=/etc/default/login
425 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
426 # Attention: always take care to bind libsocket and libnsl before libc,
427 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
429 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
431 CFLAGS="$CFLAGS -Dva_list=_VA_LIST"
433 AC_DEFINE(SETEUID_BREAKS_SETUID)
434 AC_DEFINE(BROKEN_SETREUID)
435 AC_DEFINE(BROKEN_SETREGID)
436 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
438 # UnixWare 7.x, OpenUNIX 8
440 check_for_libcrypt_later=1
441 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
443 AC_DEFINE(SETEUID_BREAKS_SETUID)
444 AC_DEFINE(BROKEN_SETREUID)
445 AC_DEFINE(BROKEN_SETREGID)
446 AC_DEFINE(PASSWD_NEEDS_USERNAME)
448 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
449 TEST_SHELL=/u95/bin/sh
450 AC_DEFINE(BROKEN_LIBIAF, 1,
451 [ia_uinfo routines not supported by OS yet])
457 # SCO UNIX and OEM versions of SCO UNIX
459 AC_MSG_ERROR("This Platform is no longer supported.")
463 if test -z "$GCC"; then
464 CFLAGS="$CFLAGS -belf"
466 LIBS="$LIBS -lprot -lx -ltinfo -lm"
469 AC_DEFINE(HAVE_SECUREWARE)
470 AC_DEFINE(DISABLE_SHADOW)
471 AC_DEFINE(DISABLE_FD_PASSING)
472 AC_DEFINE(SETEUID_BREAKS_SETUID)
473 AC_DEFINE(BROKEN_SETREUID)
474 AC_DEFINE(BROKEN_SETREGID)
475 AC_DEFINE(WITH_ABBREV_NO_TTY)
476 AC_DEFINE(BROKEN_UPDWTMPX)
477 AC_DEFINE(PASSWD_NEEDS_USERNAME)
478 AC_CHECK_FUNCS(getluid setluid)
483 AC_DEFINE(NO_SSH_LASTLOG, 1,
484 [Define if you don't want to use lastlog in session.c])
485 AC_DEFINE(SETEUID_BREAKS_SETUID)
486 AC_DEFINE(BROKEN_SETREUID)
487 AC_DEFINE(BROKEN_SETREGID)
489 AC_DEFINE(DISABLE_FD_PASSING)
491 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
495 AC_DEFINE(SETEUID_BREAKS_SETUID)
496 AC_DEFINE(BROKEN_SETREUID)
497 AC_DEFINE(BROKEN_SETREGID)
498 AC_DEFINE(WITH_ABBREV_NO_TTY)
500 AC_DEFINE(DISABLE_FD_PASSING)
502 LIBS="$LIBS -lgen -lacid -ldb"
506 AC_DEFINE(SETEUID_BREAKS_SETUID)
507 AC_DEFINE(BROKEN_SETREUID)
508 AC_DEFINE(BROKEN_SETREGID)
510 AC_DEFINE(DISABLE_FD_PASSING)
511 AC_DEFINE(NO_SSH_LASTLOG)
512 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
513 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
517 AC_MSG_CHECKING(for Digital Unix SIA)
520 [ --with-osfsia Enable Digital Unix SIA],
522 if test "x$withval" = "xno" ; then
523 AC_MSG_RESULT(disabled)
528 if test -z "$no_osfsia" ; then
529 if test -f /etc/sia/matrix.conf; then
531 AC_DEFINE(HAVE_OSF_SIA, 1,
532 [Define if you have Digital Unix Security
533 Integration Architecture])
534 AC_DEFINE(DISABLE_LOGIN, 1,
535 [Define if you don't want to use your
536 system's login() call])
537 AC_DEFINE(DISABLE_FD_PASSING)
538 LIBS="$LIBS -lsecurity -ldb -lm -laud"
541 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
542 [String used in /etc/passwd to denote locked account])
545 AC_DEFINE(BROKEN_GETADDRINFO)
546 AC_DEFINE(SETEUID_BREAKS_SETUID)
547 AC_DEFINE(BROKEN_SETREUID)
548 AC_DEFINE(BROKEN_SETREGID)
553 AC_DEFINE(NO_X11_UNIX_SOCKETS)
554 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
555 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
556 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
560 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
561 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
562 AC_DEFINE(NEED_SETPRGP)
563 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
567 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
568 AC_DEFINE(MISSING_HOWMANY)
569 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
573 # Allow user to specify flags
575 [ --with-cflags Specify additional flags to pass to compiler],
577 if test -n "$withval" && test "x$withval" != "xno" && \
578 test "x${withval}" != "xyes"; then
579 CFLAGS="$CFLAGS $withval"
583 AC_ARG_WITH(cppflags,
584 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
586 if test -n "$withval" && test "x$withval" != "xno" && \
587 test "x${withval}" != "xyes"; then
588 CPPFLAGS="$CPPFLAGS $withval"
593 [ --with-ldflags Specify additional flags to pass to linker],
595 if test -n "$withval" && test "x$withval" != "xno" && \
596 test "x${withval}" != "xyes"; then
597 LDFLAGS="$LDFLAGS $withval"
602 [ --with-libs Specify additional libraries to link with],
604 if test -n "$withval" && test "x$withval" != "xno" && \
605 test "x${withval}" != "xyes"; then
606 LIBS="$LIBS $withval"
611 [ --with-Werror Build main code with -Werror],
613 if test -n "$withval" && test "x$withval" != "xno"; then
614 werror_flags="-Werror"
615 if test "x${withval}" != "xyes"; then
616 werror_flags="$withval"
622 AC_MSG_CHECKING(compiler and flags for sanity)
628 [ AC_MSG_RESULT(yes) ],
631 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
633 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
636 dnl Checks for header files.
662 security/pam_appl.h \
698 # sys/ptms.h requires sys/stream.h to be included first on Solaris
699 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
700 #ifdef HAVE_SYS_STREAM_H
701 # include <sys/stream.h>
705 # Checks for libraries.
706 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
707 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
709 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
710 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
711 AC_CHECK_LIB(gen, dirname,[
712 AC_CACHE_CHECK([for broken dirname],
713 ac_cv_have_broken_dirname, [
721 int main(int argc, char **argv) {
724 strncpy(buf,"/etc", 32);
726 if (!s || strncmp(s, "/", 32) != 0) {
733 [ ac_cv_have_broken_dirname="no" ],
734 [ ac_cv_have_broken_dirname="yes" ],
735 [ ac_cv_have_broken_dirname="no" ],
739 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
741 AC_DEFINE(HAVE_DIRNAME)
742 AC_CHECK_HEADERS(libgen.h)
747 AC_CHECK_FUNC(getspnam, ,
748 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
749 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
750 [Define if you have the basename function.]))
754 [ --with-zlib=PATH Use zlib in PATH],
755 [ if test "x$withval" = "xno" ; then
756 AC_MSG_ERROR([*** zlib is required ***])
757 elif test "x$withval" != "xyes"; then
758 if test -d "$withval/lib"; then
759 if test -n "${need_dash_r}"; then
760 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
762 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
765 if test -n "${need_dash_r}"; then
766 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
768 LDFLAGS="-L${withval} ${LDFLAGS}"
771 if test -d "$withval/include"; then
772 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
774 CPPFLAGS="-I${withval} ${CPPFLAGS}"
779 AC_CHECK_LIB(z, deflate, ,
781 saved_CPPFLAGS="$CPPFLAGS"
782 saved_LDFLAGS="$LDFLAGS"
784 dnl Check default zlib install dir
785 if test -n "${need_dash_r}"; then
786 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
788 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
790 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
792 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
794 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
799 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
801 AC_ARG_WITH(zlib-version-check,
802 [ --without-zlib-version-check Disable zlib version check],
803 [ if test "x$withval" = "xno" ; then
804 zlib_check_nonfatal=1
809 AC_MSG_CHECKING(for possibly buggy zlib)
810 AC_RUN_IFELSE([AC_LANG_SOURCE([[
815 int a=0, b=0, c=0, d=0, n, v;
816 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
817 if (n != 3 && n != 4)
819 v = a*1000000 + b*10000 + c*100 + d;
820 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
823 if (a == 1 && b == 1 && c >= 4)
826 /* 1.2.3 and up are OK */
835 if test -z "$zlib_check_nonfatal" ; then
836 AC_MSG_ERROR([*** zlib too old - check config.log ***
837 Your reported zlib version has known security problems. It's possible your
838 vendor has fixed these problems without changing the version number. If you
839 are sure this is the case, you can disable the check by running
840 "./configure --without-zlib-version-check".
841 If you are in doubt, upgrade zlib to version 1.2.3 or greater.
842 See http://www.gzip.org/zlib/ for details.])
844 AC_MSG_WARN([zlib version may have security problems])
847 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
851 AC_CHECK_FUNC(strcasecmp,
852 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
854 AC_CHECK_FUNCS(utimes,
855 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
856 LIBS="$LIBS -lc89"]) ]
859 dnl Checks for libutil functions
860 AC_CHECK_HEADERS(libutil.h)
861 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
862 [Define if your libraries define login()])])
863 AC_CHECK_FUNCS(logout updwtmp logwtmp)
867 # Check for ALTDIRFUNC glob() extension
868 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
869 AC_EGREP_CPP(FOUNDIT,
872 #ifdef GLOB_ALTDIRFUNC
877 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
878 [Define if your system glob() function has
879 the GLOB_ALTDIRFUNC extension])
887 # Check for g.gl_matchc glob() extension
888 AC_MSG_CHECKING(for gl_matchc field in glob_t)
889 AC_EGREP_CPP(FOUNDIT,
892 int main(void){glob_t g; g.gl_matchc = 1;}
895 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
896 [Define if your system glob() function has
897 gl_matchc options in glob_t])
905 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
908 #include <sys/types.h>
910 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
912 [AC_MSG_RESULT(yes)],
915 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
916 [Define if your struct dirent expects you to
917 allocate extra space for d_name])
920 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
921 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
925 AC_MSG_CHECKING([for /proc/pid/fd directory])
926 if test -d "/proc/$$/fd" ; then
927 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
933 # Check whether user wants S/Key support
936 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
938 if test "x$withval" != "xno" ; then
940 if test "x$withval" != "xyes" ; then
941 CPPFLAGS="$CPPFLAGS -I${withval}/include"
942 LDFLAGS="$LDFLAGS -L${withval}/lib"
945 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
949 AC_MSG_CHECKING([for s/key support])
954 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
956 [AC_MSG_RESULT(yes)],
959 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
961 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
965 [(void)skeychallenge(NULL,"name","",0);],
967 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
968 [Define if your skeychallenge()
969 function takes 4 arguments (NetBSD)])],
976 # Check whether user wants TCP wrappers support
978 AC_ARG_WITH(tcp-wrappers,
979 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
981 if test "x$withval" != "xno" ; then
983 saved_LDFLAGS="$LDFLAGS"
984 saved_CPPFLAGS="$CPPFLAGS"
985 if test -n "${withval}" && \
986 test "x${withval}" != "xyes"; then
987 if test -d "${withval}/lib"; then
988 if test -n "${need_dash_r}"; then
989 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
991 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
994 if test -n "${need_dash_r}"; then
995 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
997 LDFLAGS="-L${withval} ${LDFLAGS}"
1000 if test -d "${withval}/include"; then
1001 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1003 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1007 LIBS="$LIBWRAP $LIBS"
1008 AC_MSG_CHECKING(for libwrap)
1011 #include <sys/types.h>
1012 #include <sys/socket.h>
1013 #include <netinet/in.h>
1015 int deny_severity = 0, allow_severity = 0;
1020 AC_DEFINE(LIBWRAP, 1,
1022 TCP Wrappers support])
1027 AC_MSG_ERROR([*** libwrap missing])
1035 # Check whether user wants libedit support
1037 AC_ARG_WITH(libedit,
1038 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1039 [ if test "x$withval" != "xno" ; then
1040 if test "x$withval" != "xyes"; then
1041 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1042 if test -n "${need_dash_r}"; then
1043 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1045 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1048 AC_CHECK_LIB(edit, el_init,
1049 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
1050 LIBEDIT="-ledit -lcurses"
1054 [ AC_MSG_ERROR(libedit not found) ],
1057 AC_MSG_CHECKING(if libedit version is compatible)
1060 #include <histedit.h>
1064 el_init("", NULL, NULL, NULL);
1068 [ AC_MSG_RESULT(yes) ],
1070 AC_MSG_ERROR(libedit version is not compatible) ]
1077 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1079 AC_MSG_CHECKING(for supported audit module)
1084 dnl Checks for headers, libs and functions
1085 AC_CHECK_HEADERS(bsm/audit.h, [],
1086 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1087 AC_CHECK_LIB(bsm, getaudit, [],
1088 [AC_MSG_ERROR(BSM enabled and required library not found)])
1089 AC_CHECK_FUNCS(getaudit, [],
1090 [AC_MSG_ERROR(BSM enabled and required function not found)])
1091 # These are optional
1092 AC_CHECK_FUNCS(getaudit_addr)
1093 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
1097 AC_MSG_RESULT(debug)
1098 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
1104 AC_MSG_ERROR([Unknown audit module $withval])
1109 dnl Checks for library functions. Please keep in alphabetical order
1194 # IRIX has a const char return value for gai_strerror()
1195 AC_CHECK_FUNCS(gai_strerror,[
1196 AC_DEFINE(HAVE_GAI_STRERROR)
1198 #include <sys/types.h>
1199 #include <sys/socket.h>
1202 const char *gai_strerror(int);],[
1205 str = gai_strerror(0);],[
1206 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1207 [Define if gai_strerror() returns const char *])])])
1209 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1210 [Some systems put nanosleep outside of libc]))
1212 dnl Make sure prototypes are defined for these before using them.
1213 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1214 AC_CHECK_DECL(strsep,
1215 [AC_CHECK_FUNCS(strsep)],
1218 #ifdef HAVE_STRING_H
1219 # include <string.h>
1223 dnl tcsendbreak might be a macro
1224 AC_CHECK_DECL(tcsendbreak,
1225 [AC_DEFINE(HAVE_TCSENDBREAK)],
1226 [AC_CHECK_FUNCS(tcsendbreak)],
1227 [#include <termios.h>]
1230 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1232 AC_CHECK_FUNCS(setresuid, [
1233 dnl Some platorms have setresuid that isn't implemented, test for this
1234 AC_MSG_CHECKING(if setresuid seems to work)
1239 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1241 [AC_MSG_RESULT(yes)],
1242 [AC_DEFINE(BROKEN_SETRESUID, 1,
1243 [Define if your setresuid() is broken])
1244 AC_MSG_RESULT(not implemented)],
1245 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1249 AC_CHECK_FUNCS(setresgid, [
1250 dnl Some platorms have setresgid that isn't implemented, test for this
1251 AC_MSG_CHECKING(if setresgid seems to work)
1256 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1258 [AC_MSG_RESULT(yes)],
1259 [AC_DEFINE(BROKEN_SETRESGID, 1,
1260 [Define if your setresgid() is broken])
1261 AC_MSG_RESULT(not implemented)],
1262 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1266 dnl Checks for time functions
1267 AC_CHECK_FUNCS(gettimeofday time)
1268 dnl Checks for utmp functions
1269 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1270 AC_CHECK_FUNCS(utmpname)
1271 dnl Checks for utmpx functions
1272 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1273 AC_CHECK_FUNCS(setutxent utmpxname)
1275 AC_CHECK_FUNC(daemon,
1276 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1277 [AC_CHECK_LIB(bsd, daemon,
1278 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1281 AC_CHECK_FUNC(getpagesize,
1282 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1283 [Define if your libraries define getpagesize()])],
1284 [AC_CHECK_LIB(ucb, getpagesize,
1285 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1288 # Check for broken snprintf
1289 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1290 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1294 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1296 [AC_MSG_RESULT(yes)],
1299 AC_DEFINE(BROKEN_SNPRINTF, 1,
1300 [Define if your snprintf is busted])
1301 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1303 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1307 # If we don't have a working asprintf, then we strongly depend on vsnprintf
1308 # returning the right thing on overflow: the number of characters it tried to
1309 # create (as per SUSv3)
1310 if test "x$ac_cv_func_asprintf" != "xyes" && \
1311 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1312 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1315 #include <sys/types.h>
1319 int x_snprintf(char *str,size_t count,const char *fmt,...)
1321 size_t ret; va_list ap;
1322 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1328 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1330 [AC_MSG_RESULT(yes)],
1333 AC_DEFINE(BROKEN_SNPRINTF, 1,
1334 [Define if your snprintf is busted])
1335 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1337 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1341 # Check for missing getpeereid (or equiv) support
1343 if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1344 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1346 [#include <sys/types.h>
1347 #include <sys/socket.h>],
1348 [int i = SO_PEERCRED;],
1349 [ AC_MSG_RESULT(yes)
1350 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
1357 dnl see whether mkstemp() requires XXXXXX
1358 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1359 AC_MSG_CHECKING([for (overly) strict mkstemp])
1363 main() { char template[]="conftest.mkstemp-test";
1364 if (mkstemp(template) == -1)
1366 unlink(template); exit(0);
1374 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
1378 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1383 dnl make sure that openpty does not reacquire controlling terminal
1384 if test ! -z "$check_for_openpty_ctty_bug"; then
1385 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1389 #include <sys/fcntl.h>
1390 #include <sys/types.h>
1391 #include <sys/wait.h>
1397 int fd, ptyfd, ttyfd, status;
1400 if (pid < 0) { /* failed */
1402 } else if (pid > 0) { /* parent */
1403 waitpid(pid, &status, 0);
1404 if (WIFEXITED(status))
1405 exit(WEXITSTATUS(status));
1408 } else { /* child */
1409 close(0); close(1); close(2);
1411 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1412 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1414 exit(3); /* Acquired ctty: broken */
1416 exit(0); /* Did not acquire ctty: OK */
1425 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1428 AC_MSG_RESULT(cross-compiling, assuming yes)
1433 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1434 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1435 AC_MSG_CHECKING(if getaddrinfo seems to work)
1439 #include <sys/socket.h>
1442 #include <netinet/in.h>
1444 #define TEST_PORT "2222"
1450 struct addrinfo *gai_ai, *ai, hints;
1451 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1453 memset(&hints, 0, sizeof(hints));
1454 hints.ai_family = PF_UNSPEC;
1455 hints.ai_socktype = SOCK_STREAM;
1456 hints.ai_flags = AI_PASSIVE;
1458 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1460 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1464 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1465 if (ai->ai_family != AF_INET6)
1468 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1469 sizeof(ntop), strport, sizeof(strport),
1470 NI_NUMERICHOST|NI_NUMERICSERV);
1473 if (err == EAI_SYSTEM)
1474 perror("getnameinfo EAI_SYSTEM");
1476 fprintf(stderr, "getnameinfo failed: %s\n",
1481 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1484 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1497 AC_DEFINE(BROKEN_GETADDRINFO)
1500 AC_MSG_RESULT(cross-compiling, assuming yes)
1505 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1506 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1507 AC_MSG_CHECKING(if getaddrinfo seems to work)
1511 #include <sys/socket.h>
1514 #include <netinet/in.h>
1516 #define TEST_PORT "2222"
1522 struct addrinfo *gai_ai, *ai, hints;
1523 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1525 memset(&hints, 0, sizeof(hints));
1526 hints.ai_family = PF_UNSPEC;
1527 hints.ai_socktype = SOCK_STREAM;
1528 hints.ai_flags = AI_PASSIVE;
1530 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1532 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1536 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1537 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1540 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1541 sizeof(ntop), strport, sizeof(strport),
1542 NI_NUMERICHOST|NI_NUMERICSERV);
1544 if (ai->ai_family == AF_INET && err != 0) {
1545 perror("getnameinfo");
1554 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1555 [Define if you have a getaddrinfo that fails
1556 for the all-zeros IPv6 address])
1560 AC_DEFINE(BROKEN_GETADDRINFO)
1562 AC_MSG_RESULT(cross-compiling, assuming no)
1567 if test "x$check_for_conflicting_getspnam" = "x1"; then
1568 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1572 int main(void) {exit(0);}
1579 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1580 [Conflicting defs for getspnam])
1587 # Check for PAM libs
1590 [ --with-pam Enable PAM support ],
1592 if test "x$withval" != "xno" ; then
1593 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1594 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1595 AC_MSG_ERROR([PAM headers not found])
1598 AC_CHECK_LIB(dl, dlopen, , )
1599 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1600 AC_CHECK_FUNCS(pam_getenvlist)
1601 AC_CHECK_FUNCS(pam_putenv)
1605 AC_DEFINE(USE_PAM, 1,
1606 [Define if you want to enable PAM support])
1607 if test $ac_cv_lib_dl_dlopen = yes; then
1617 # Check for older PAM
1618 if test "x$PAM_MSG" = "xyes" ; then
1619 # Check PAM strerror arguments (old PAM)
1620 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1624 #if defined(HAVE_SECURITY_PAM_APPL_H)
1625 #include <security/pam_appl.h>
1626 #elif defined (HAVE_PAM_PAM_APPL_H)
1627 #include <pam/pam_appl.h>
1630 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1631 [AC_MSG_RESULT(no)],
1633 AC_DEFINE(HAVE_OLD_PAM, 1,
1634 [Define if you have an old version of PAM
1635 which takes only one argument to pam_strerror])
1637 PAM_MSG="yes (old library)"
1642 # Search for OpenSSL
1643 saved_CPPFLAGS="$CPPFLAGS"
1644 saved_LDFLAGS="$LDFLAGS"
1645 AC_ARG_WITH(ssl-dir,
1646 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1648 if test "x$withval" != "xno" ; then
1651 ./*|../*) withval="`pwd`/$withval"
1653 if test -d "$withval/lib"; then
1654 if test -n "${need_dash_r}"; then
1655 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1657 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1660 if test -n "${need_dash_r}"; then
1661 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1663 LDFLAGS="-L${withval} ${LDFLAGS}"
1666 if test -d "$withval/include"; then
1667 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1669 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1674 LIBS="-lcrypto $LIBS"
1675 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1676 [Define if your ssl headers are included
1677 with #include <openssl/header.h>]),
1679 dnl Check default openssl install dir
1680 if test -n "${need_dash_r}"; then
1681 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1683 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1685 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1686 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1688 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1694 # Determine OpenSSL header version
1695 AC_MSG_CHECKING([OpenSSL header version])
1700 #include <openssl/opensslv.h>
1701 #define DATA "conftest.sslincver"
1706 fd = fopen(DATA,"w");
1710 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1717 ssl_header_ver=`cat conftest.sslincver`
1718 AC_MSG_RESULT($ssl_header_ver)
1721 AC_MSG_RESULT(not found)
1722 AC_MSG_ERROR(OpenSSL version header not found.)
1725 AC_MSG_WARN([cross compiling: not checking])
1729 # Determine OpenSSL library version
1730 AC_MSG_CHECKING([OpenSSL library version])
1735 #include <openssl/opensslv.h>
1736 #include <openssl/crypto.h>
1737 #define DATA "conftest.ssllibver"
1742 fd = fopen(DATA,"w");
1746 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1753 ssl_library_ver=`cat conftest.ssllibver`
1754 AC_MSG_RESULT($ssl_library_ver)
1757 AC_MSG_RESULT(not found)
1758 AC_MSG_ERROR(OpenSSL library not found.)
1761 AC_MSG_WARN([cross compiling: not checking])
1765 # Sanity check OpenSSL headers
1766 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1770 #include <openssl/opensslv.h>
1771 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1778 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1779 Check config.log for details.
1780 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1783 AC_MSG_WARN([cross compiling: not checking])
1787 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1788 # because the system crypt() is more featureful.
1789 if test "x$check_for_libcrypt_before" = "x1"; then
1790 AC_CHECK_LIB(crypt, crypt)
1793 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1794 # version in OpenSSL.
1795 if test "x$check_for_libcrypt_later" = "x1"; then
1796 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1799 AC_CHECK_LIB(iaf, ia_openinfo)
1801 ### Configure cryptographic random number support
1803 # Check wheter OpenSSL seeds itself
1804 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1808 #include <openssl/rand.h>
1809 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1812 OPENSSL_SEEDS_ITSELF=yes
1817 # Default to use of the rand helper if OpenSSL doesn't
1822 AC_MSG_WARN([cross compiling: assuming yes])
1823 # This is safe, since all recent OpenSSL versions will
1824 # complain at runtime if not seeded correctly.
1825 OPENSSL_SEEDS_ITSELF=yes
1830 # Do we want to force the use of the rand helper?
1831 AC_ARG_WITH(rand-helper,
1832 [ --with-rand-helper Use subprocess to gather strong randomness ],
1834 if test "x$withval" = "xno" ; then
1835 # Force use of OpenSSL's internal RNG, even if
1836 # the previous test showed it to be unseeded.
1837 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1838 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1839 OPENSSL_SEEDS_ITSELF=yes
1848 # Which randomness source do we use?
1849 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
1851 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1852 [Define if you want OpenSSL's internally seeded PRNG only])
1853 RAND_MSG="OpenSSL internal ONLY"
1854 INSTALL_SSH_RAND_HELPER=""
1855 elif test ! -z "$USE_RAND_HELPER" ; then
1856 # install rand helper
1857 RAND_MSG="ssh-rand-helper"
1858 INSTALL_SSH_RAND_HELPER="yes"
1860 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1862 ### Configuration of ssh-rand-helper
1865 AC_ARG_WITH(prngd-port,
1866 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1875 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1878 if test ! -z "$withval" ; then
1879 PRNGD_PORT="$withval"
1880 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1881 [Port number of PRNGD/EGD random number socket])
1886 # PRNGD Unix domain socket
1887 AC_ARG_WITH(prngd-socket,
1888 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1892 withval="/var/run/egd-pool"
1900 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1904 if test ! -z "$withval" ; then
1905 if test ! -z "$PRNGD_PORT" ; then
1906 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1908 if test ! -r "$withval" ; then
1909 AC_MSG_WARN(Entropy socket is not readable)
1911 PRNGD_SOCKET="$withval"
1912 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1913 [Location of PRNGD/EGD random number socket])
1917 # Check for existing socket only if we don't have a random device already
1918 if test "$USE_RAND_HELPER" = yes ; then
1919 AC_MSG_CHECKING(for PRNGD/EGD socket)
1920 # Insert other locations here
1921 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1922 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1923 PRNGD_SOCKET="$sock"
1924 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1928 if test ! -z "$PRNGD_SOCKET" ; then
1929 AC_MSG_RESULT($PRNGD_SOCKET)
1931 AC_MSG_RESULT(not found)
1937 # Change default command timeout for hashing entropy source
1939 AC_ARG_WITH(entropy-timeout,
1940 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1942 if test -n "$withval" && test "x$withval" != "xno" && \
1943 test "x${withval}" != "xyes"; then
1944 entropy_timeout=$withval
1948 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
1949 [Builtin PRNG command timeout])
1951 SSH_PRIVSEP_USER=sshd
1952 AC_ARG_WITH(privsep-user,
1953 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1955 if test -n "$withval" && test "x$withval" != "xno" && \
1956 test "x${withval}" != "xyes"; then
1957 SSH_PRIVSEP_USER=$withval
1961 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
1962 [non-privileged user for privilege separation])
1963 AC_SUBST(SSH_PRIVSEP_USER)
1965 # We do this little dance with the search path to insure
1966 # that programs that we select for use by installed programs
1967 # (which may be run by the super-user) come from trusted
1968 # locations before they come from the user's private area.
1969 # This should help avoid accidentally configuring some
1970 # random version of a program in someone's personal bin.
1974 test -h /bin 2> /dev/null && PATH=/usr/bin
1975 test -d /sbin && PATH=$PATH:/sbin
1976 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1977 PATH=$PATH:/etc:$OPATH
1979 # These programs are used by the command hashing source to gather entropy
1980 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1981 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1982 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1983 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1984 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1985 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1986 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1987 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1988 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1989 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1990 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1991 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1992 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1993 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1994 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1995 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1999 # Where does ssh-rand-helper get its randomness from?
2000 INSTALL_SSH_PRNG_CMDS=""
2001 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2002 if test ! -z "$PRNGD_PORT" ; then
2003 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2004 elif test ! -z "$PRNGD_SOCKET" ; then
2005 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2007 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2008 RAND_HELPER_CMDHASH=yes
2009 INSTALL_SSH_PRNG_CMDS="yes"
2012 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2015 # Cheap hack to ensure NEWS-OS libraries are arranged right.
2016 if test ! -z "$SONY" ; then
2017 LIBS="$LIBS -liberty";
2020 # Check for long long datatypes
2021 AC_CHECK_TYPES([long long, unsigned long long, long double])
2023 # Check datatype sizes
2024 AC_CHECK_SIZEOF(char, 1)
2025 AC_CHECK_SIZEOF(short int, 2)
2026 AC_CHECK_SIZEOF(int, 4)
2027 AC_CHECK_SIZEOF(long int, 4)
2028 AC_CHECK_SIZEOF(long long int, 8)
2030 # Sanity check long long for some platforms (AIX)
2031 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2032 ac_cv_sizeof_long_long_int=0
2035 # compute LLONG_MIN and LLONG_MAX if we don't know them.
2036 if test -z "$have_llong_max"; then
2037 AC_MSG_CHECKING([for max value of long long])
2041 /* Why is this so damn hard? */
2045 #define __USE_ISOC99
2047 #define DATA "conftest.llminmax"
2050 long long i, llmin, llmax = 0;
2052 if((f = fopen(DATA,"w")) == NULL)
2055 #if defined(LLONG_MIN) && defined(LLONG_MAX)
2056 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2060 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2061 /* This will work on one's complement and two's complement */
2062 for (i = 1; i > llmax; i <<= 1, i++)
2064 llmin = llmax + 1LL; /* wrap */
2068 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2069 || llmax - 1 > llmax) {
2070 fprintf(f, "unknown unknown\n");
2074 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
2081 llong_min=`$AWK '{print $1}' conftest.llminmax`
2082 llong_max=`$AWK '{print $2}' conftest.llminmax`
2084 # snprintf on some Tru64s doesn't understand "%lld"
2087 if test "x$ac_cv_sizeof_long_long_int" = "x8" &&
2088 test "x$llong_max" = "xld"; then
2089 llong_min="-9223372036854775808"
2090 llong_max="9223372036854775807"
2095 AC_MSG_RESULT($llong_max)
2096 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2097 [max value of long long calculated by configure])
2098 AC_MSG_CHECKING([for min value of long long])
2099 AC_MSG_RESULT($llong_min)
2100 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2101 [min value of long long calculated by configure])
2104 AC_MSG_RESULT(not found)
2107 AC_MSG_WARN([cross compiling: not checking])
2113 # More checks for data types
2114 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2116 [ #include <sys/types.h> ],
2118 [ ac_cv_have_u_int="yes" ],
2119 [ ac_cv_have_u_int="no" ]
2122 if test "x$ac_cv_have_u_int" = "xyes" ; then
2123 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
2127 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2129 [ #include <sys/types.h> ],
2130 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2131 [ ac_cv_have_intxx_t="yes" ],
2132 [ ac_cv_have_intxx_t="no" ]
2135 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2136 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
2140 if (test -z "$have_intxx_t" && \
2141 test "x$ac_cv_header_stdint_h" = "xyes")
2143 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2145 [ #include <stdint.h> ],
2146 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2148 AC_DEFINE(HAVE_INTXX_T)
2151 [ AC_MSG_RESULT(no) ]
2155 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2158 #include <sys/types.h>
2159 #ifdef HAVE_STDINT_H
2160 # include <stdint.h>
2162 #include <sys/socket.h>
2163 #ifdef HAVE_SYS_BITYPES_H
2164 # include <sys/bitypes.h>
2167 [ int64_t a; a = 1;],
2168 [ ac_cv_have_int64_t="yes" ],
2169 [ ac_cv_have_int64_t="no" ]
2172 if test "x$ac_cv_have_int64_t" = "xyes" ; then
2173 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
2176 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2178 [ #include <sys/types.h> ],
2179 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2180 [ ac_cv_have_u_intxx_t="yes" ],
2181 [ ac_cv_have_u_intxx_t="no" ]
2184 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2185 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
2189 if test -z "$have_u_intxx_t" ; then
2190 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2192 [ #include <sys/socket.h> ],
2193 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2195 AC_DEFINE(HAVE_U_INTXX_T)
2198 [ AC_MSG_RESULT(no) ]
2202 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2204 [ #include <sys/types.h> ],
2205 [ u_int64_t a; a = 1;],
2206 [ ac_cv_have_u_int64_t="yes" ],
2207 [ ac_cv_have_u_int64_t="no" ]
2210 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2211 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
2215 if test -z "$have_u_int64_t" ; then
2216 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2218 [ #include <sys/bitypes.h> ],
2219 [ u_int64_t a; a = 1],
2221 AC_DEFINE(HAVE_U_INT64_T)
2224 [ AC_MSG_RESULT(no) ]
2228 if test -z "$have_u_intxx_t" ; then
2229 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2232 #include <sys/types.h>
2234 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2235 [ ac_cv_have_uintxx_t="yes" ],
2236 [ ac_cv_have_uintxx_t="no" ]
2239 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2240 AC_DEFINE(HAVE_UINTXX_T, 1,
2241 [define if you have uintxx_t data type])
2245 if test -z "$have_uintxx_t" ; then
2246 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2248 [ #include <stdint.h> ],
2249 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2251 AC_DEFINE(HAVE_UINTXX_T)
2254 [ AC_MSG_RESULT(no) ]
2258 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2259 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2261 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2264 #include <sys/bitypes.h>
2267 int8_t a; int16_t b; int32_t c;
2268 u_int8_t e; u_int16_t f; u_int32_t g;
2269 a = b = c = e = f = g = 1;
2272 AC_DEFINE(HAVE_U_INTXX_T)
2273 AC_DEFINE(HAVE_INTXX_T)
2281 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2284 #include <sys/types.h>
2286 [ u_char foo; foo = 125; ],
2287 [ ac_cv_have_u_char="yes" ],
2288 [ ac_cv_have_u_char="no" ]
2291 if test "x$ac_cv_have_u_char" = "xyes" ; then
2292 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
2297 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2299 AC_CHECK_TYPES(in_addr_t,,,
2300 [#include <sys/types.h>
2301 #include <netinet/in.h>])
2303 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2306 #include <sys/types.h>
2308 [ size_t foo; foo = 1235; ],
2309 [ ac_cv_have_size_t="yes" ],
2310 [ ac_cv_have_size_t="no" ]
2313 if test "x$ac_cv_have_size_t" = "xyes" ; then
2314 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
2317 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2320 #include <sys/types.h>
2322 [ ssize_t foo; foo = 1235; ],
2323 [ ac_cv_have_ssize_t="yes" ],
2324 [ ac_cv_have_ssize_t="no" ]
2327 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2328 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
2331 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2336 [ clock_t foo; foo = 1235; ],
2337 [ ac_cv_have_clock_t="yes" ],
2338 [ ac_cv_have_clock_t="no" ]
2341 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2342 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
2345 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2348 #include <sys/types.h>
2349 #include <sys/socket.h>
2351 [ sa_family_t foo; foo = 1235; ],
2352 [ ac_cv_have_sa_family_t="yes" ],
2355 #include <sys/types.h>
2356 #include <sys/socket.h>
2357 #include <netinet/in.h>
2359 [ sa_family_t foo; foo = 1235; ],
2360 [ ac_cv_have_sa_family_t="yes" ],
2362 [ ac_cv_have_sa_family_t="no" ]
2366 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2367 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2368 [define if you have sa_family_t data type])
2371 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2374 #include <sys/types.h>
2376 [ pid_t foo; foo = 1235; ],
2377 [ ac_cv_have_pid_t="yes" ],
2378 [ ac_cv_have_pid_t="no" ]
2381 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2382 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
2385 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2388 #include <sys/types.h>
2390 [ mode_t foo; foo = 1235; ],
2391 [ ac_cv_have_mode_t="yes" ],
2392 [ ac_cv_have_mode_t="no" ]
2395 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2396 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
2400 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2403 #include <sys/types.h>
2404 #include <sys/socket.h>
2406 [ struct sockaddr_storage s; ],
2407 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2408 [ ac_cv_have_struct_sockaddr_storage="no" ]
2411 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2412 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2413 [define if you have struct sockaddr_storage data type])
2416 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2419 #include <sys/types.h>
2420 #include <netinet/in.h>
2422 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2423 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2424 [ ac_cv_have_struct_sockaddr_in6="no" ]
2427 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2428 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2429 [define if you have struct sockaddr_in6 data type])
2432 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2435 #include <sys/types.h>
2436 #include <netinet/in.h>
2438 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2439 [ ac_cv_have_struct_in6_addr="yes" ],
2440 [ ac_cv_have_struct_in6_addr="no" ]
2443 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2444 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2445 [define if you have struct in6_addr data type])
2448 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2451 #include <sys/types.h>
2452 #include <sys/socket.h>
2455 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2456 [ ac_cv_have_struct_addrinfo="yes" ],
2457 [ ac_cv_have_struct_addrinfo="no" ]
2460 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2461 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2462 [define if you have struct addrinfo data type])
2465 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2467 [ #include <sys/time.h> ],
2468 [ struct timeval tv; tv.tv_sec = 1;],
2469 [ ac_cv_have_struct_timeval="yes" ],
2470 [ ac_cv_have_struct_timeval="no" ]
2473 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2474 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
2475 have_struct_timeval=1
2478 AC_CHECK_TYPES(struct timespec)
2480 # We need int64_t or else certian parts of the compile will fail.
2481 if test "x$ac_cv_have_int64_t" = "xno" && \
2482 test "x$ac_cv_sizeof_long_int" != "x8" && \
2483 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2484 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2485 echo "an alternative compiler (I.E., GCC) before continuing."
2489 dnl test snprintf (broken on SCO w/gcc)
2494 #ifdef HAVE_SNPRINTF
2498 char expected_out[50];
2500 #if (SIZEOF_LONG_INT == 8)
2501 long int num = 0x7fffffffffffffff;
2503 long long num = 0x7fffffffffffffffll;
2505 strcpy(expected_out, "9223372036854775807");
2506 snprintf(buf, mazsize, "%lld", num);
2507 if(strcmp(buf, expected_out) != 0)
2514 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2515 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2519 dnl Checks for structure members
2520 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2521 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2522 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2523 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2524 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2525 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2526 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2527 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2528 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2529 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2530 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2531 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2532 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2533 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2534 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2535 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2536 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2538 AC_CHECK_MEMBERS([struct stat.st_blksize])
2539 AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2540 [Define if we don't have struct __res_state in resolv.h])],
2543 #if HAVE_SYS_TYPES_H
2544 # include <sys/types.h>
2546 #include <netinet/in.h>
2547 #include <arpa/nameser.h>
2551 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2552 ac_cv_have_ss_family_in_struct_ss, [
2555 #include <sys/types.h>
2556 #include <sys/socket.h>
2558 [ struct sockaddr_storage s; s.ss_family = 1; ],
2559 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2560 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2563 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2564 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
2567 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2568 ac_cv_have___ss_family_in_struct_ss, [
2571 #include <sys/types.h>
2572 #include <sys/socket.h>
2574 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2575 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2576 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2579 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2580 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2581 [Fields in struct sockaddr_storage])
2584 AC_CACHE_CHECK([for pw_class field in struct passwd],
2585 ac_cv_have_pw_class_in_struct_passwd, [
2590 [ struct passwd p; p.pw_class = 0; ],
2591 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2592 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2595 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2596 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2597 [Define if your password has a pw_class field])
2600 AC_CACHE_CHECK([for pw_expire field in struct passwd],
2601 ac_cv_have_pw_expire_in_struct_passwd, [
2606 [ struct passwd p; p.pw_expire = 0; ],
2607 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2608 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2611 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2612 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2613 [Define if your password has a pw_expire field])
2616 AC_CACHE_CHECK([for pw_change field in struct passwd],
2617 ac_cv_have_pw_change_in_struct_passwd, [
2622 [ struct passwd p; p.pw_change = 0; ],
2623 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2624 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2627 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2628 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2629 [Define if your password has a pw_change field])
2632 dnl make sure we're using the real structure members and not defines
2633 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2634 ac_cv_have_accrights_in_msghdr, [
2637 #include <sys/types.h>
2638 #include <sys/socket.h>
2639 #include <sys/uio.h>
2641 #ifdef msg_accrights
2642 #error "msg_accrights is a macro"
2646 m.msg_accrights = 0;
2650 [ ac_cv_have_accrights_in_msghdr="yes" ],
2651 [ ac_cv_have_accrights_in_msghdr="no" ]
2654 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2655 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2656 [Define if your system uses access rights style
2657 file descriptor passing])
2660 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2661 ac_cv_have_control_in_msghdr, [
2664 #include <sys/types.h>
2665 #include <sys/socket.h>
2666 #include <sys/uio.h>
2669 #error "msg_control is a macro"
2677 [ ac_cv_have_control_in_msghdr="yes" ],
2678 [ ac_cv_have_control_in_msghdr="no" ]
2681 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2682 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2683 [Define if your system uses ancillary data style
2684 file descriptor passing])
2687 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2689 [ extern char *__progname; printf("%s", __progname); ],
2690 [ ac_cv_libc_defines___progname="yes" ],
2691 [ ac_cv_libc_defines___progname="no" ]
2694 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2695 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
2698 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2702 [ printf("%s", __FUNCTION__); ],
2703 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2704 [ ac_cv_cc_implements___FUNCTION__="no" ]
2707 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2708 AC_DEFINE(HAVE___FUNCTION__, 1,
2709 [Define if compiler implements __FUNCTION__])
2712 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2716 [ printf("%s", __func__); ],
2717 [ ac_cv_cc_implements___func__="yes" ],
2718 [ ac_cv_cc_implements___func__="no" ]
2721 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2722 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
2725 AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
2727 [#include <stdarg.h>
2730 [ ac_cv_have_va_copy="yes" ],
2731 [ ac_cv_have_va_copy="no" ]
2734 if test "x$ac_cv_have_va_copy" = "xyes" ; then
2735 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
2738 AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
2740 [#include <stdarg.h>
2743 [ ac_cv_have___va_copy="yes" ],
2744 [ ac_cv_have___va_copy="no" ]
2747 if test "x$ac_cv_have___va_copy" = "xyes" ; then
2748 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
2751 AC_CACHE_CHECK([whether getopt has optreset support],
2752 ac_cv_have_getopt_optreset, [
2757 [ extern int optreset; optreset = 0; ],
2758 [ ac_cv_have_getopt_optreset="yes" ],
2759 [ ac_cv_have_getopt_optreset="no" ]
2762 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2763 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2764 [Define if your getopt(3) defines and uses optreset])
2767 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2769 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2770 [ ac_cv_libc_defines_sys_errlist="yes" ],
2771 [ ac_cv_libc_defines_sys_errlist="no" ]
2774 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2775 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2776 [Define if your system defines sys_errlist[]])
2780 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2782 [ extern int sys_nerr; printf("%i", sys_nerr);],
2783 [ ac_cv_libc_defines_sys_nerr="yes" ],
2784 [ ac_cv_libc_defines_sys_nerr="no" ]
2787 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2788 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
2792 # Check whether user wants sectok support
2794 [ --with-sectok Enable smartcard support using libsectok],
2796 if test "x$withval" != "xno" ; then
2797 if test "x$withval" != "xyes" ; then
2798 CPPFLAGS="$CPPFLAGS -I${withval}"
2799 LDFLAGS="$LDFLAGS -L${withval}"
2800 if test ! -z "$need_dash_r" ; then
2801 LDFLAGS="$LDFLAGS -R${withval}"
2803 if test ! -z "$blibpath" ; then
2804 blibpath="$blibpath:${withval}"
2807 AC_CHECK_HEADERS(sectok.h)
2808 if test "$ac_cv_header_sectok_h" != yes; then
2809 AC_MSG_ERROR(Can't find sectok.h)
2811 AC_CHECK_LIB(sectok, sectok_open)
2812 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2813 AC_MSG_ERROR(Can't find libsectok)
2815 AC_DEFINE(SMARTCARD, 1,
2816 [Define if you want smartcard support])
2817 AC_DEFINE(USE_SECTOK, 1,
2818 [Define if you want smartcard support
2820 SCARD_MSG="yes, using sectok"
2825 # Check whether user wants OpenSC support
2828 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2830 if test "x$withval" != "xno" ; then
2831 if test "x$withval" != "xyes" ; then
2832 OPENSC_CONFIG=$withval/bin/opensc-config
2834 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2836 if test "$OPENSC_CONFIG" != "no"; then
2837 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2838 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2839 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2840 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2841 AC_DEFINE(SMARTCARD)
2842 AC_DEFINE(USE_OPENSC, 1,
2843 [Define if you want smartcard support
2845 SCARD_MSG="yes, using OpenSC"
2851 # Check libraries needed by DNS fingerprint support
2852 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2853 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2854 [Define if getrrsetbyname() exists])],
2856 # Needed by our getrrsetbyname()
2857 AC_SEARCH_LIBS(res_query, resolv)
2858 AC_SEARCH_LIBS(dn_expand, resolv)
2859 AC_MSG_CHECKING(if res_query will link)
2860 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2863 LIBS="$LIBS -lresolv"
2864 AC_MSG_CHECKING(for res_query in -lresolv)
2869 res_query (0, 0, 0, 0, 0);
2873 [LIBS="$LIBS -lresolv"
2874 AC_MSG_RESULT(yes)],
2878 AC_CHECK_FUNCS(_getshort _getlong)
2879 AC_CHECK_DECLS([_getshort, _getlong], , ,
2880 [#include <sys/types.h>
2881 #include <arpa/nameser.h>])
2882 AC_CHECK_MEMBER(HEADER.ad,
2883 [AC_DEFINE(HAVE_HEADER_AD, 1,
2884 [Define if HEADER.ad exists in arpa/nameser.h])],,
2885 [#include <arpa/nameser.h>])
2888 # Check whether user wants Kerberos 5 support
2890 AC_ARG_WITH(kerberos5,
2891 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2892 [ if test "x$withval" != "xno" ; then
2893 if test "x$withval" = "xyes" ; then
2894 KRB5ROOT="/usr/local"
2899 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
2902 AC_MSG_CHECKING(for krb5-config)
2903 if test -x $KRB5ROOT/bin/krb5-config ; then
2904 KRB5CONF=$KRB5ROOT/bin/krb5-config
2905 AC_MSG_RESULT($KRB5CONF)
2907 AC_MSG_CHECKING(for gssapi support)
2908 if $KRB5CONF | grep gssapi >/dev/null ; then
2910 AC_DEFINE(GSSAPI, 1,
2911 [Define this if you want GSSAPI
2912 support in the version 2 protocol])
2918 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2919 K5LIBS="`$KRB5CONF --libs $k5confopts`"
2920 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2921 AC_MSG_CHECKING(whether we are using Heimdal)
2922 AC_TRY_COMPILE([ #include <krb5.h> ],
2923 [ char *tmp = heimdal_version; ],
2924 [ AC_MSG_RESULT(yes)
2925 AC_DEFINE(HEIMDAL, 1,
2926 [Define this if you are using the
2927 Heimdal version of Kerberos V5]) ],
2932 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2933 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2934 AC_MSG_CHECKING(whether we are using Heimdal)
2935 AC_TRY_COMPILE([ #include <krb5.h> ],
2936 [ char *tmp = heimdal_version; ],
2937 [ AC_MSG_RESULT(yes)
2939 K5LIBS="-lkrb5 -ldes"
2940 K5LIBS="$K5LIBS -lcom_err -lasn1"
2941 AC_CHECK_LIB(roken, net_write,
2942 [K5LIBS="$K5LIBS -lroken"])
2945 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2948 AC_SEARCH_LIBS(dn_expand, resolv)
2950 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2952 K5LIBS="-lgssapi $K5LIBS" ],
2953 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2955 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2956 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2961 AC_CHECK_HEADER(gssapi.h, ,
2962 [ unset ac_cv_header_gssapi_h
2963 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2964 AC_CHECK_HEADERS(gssapi.h, ,
2965 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2971 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2972 AC_CHECK_HEADER(gssapi_krb5.h, ,
2973 [ CPPFLAGS="$oldCPP" ])
2976 if test ! -z "$need_dash_r" ; then
2977 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2979 if test ! -z "$blibpath" ; then
2980 blibpath="$blibpath:${KRB5ROOT}/lib"
2983 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2984 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2985 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2987 LIBS="$LIBS $K5LIBS"
2988 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
2989 [Define this if you want to use libkafs' AFS support]))
2994 # Looking for programs, paths and files
2996 PRIVSEP_PATH=/var/empty
2997 AC_ARG_WITH(privsep-path,
2998 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
3000 if test -n "$withval" && test "x$withval" != "xno" && \
3001 test "x${withval}" != "xyes"; then
3002 PRIVSEP_PATH=$withval
3006 AC_SUBST(PRIVSEP_PATH)
3009 [ --with-xauth=PATH Specify path to xauth program ],
3011 if test -n "$withval" && test "x$withval" != "xno" && \
3012 test "x${withval}" != "xyes"; then
3018 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3019 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3020 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3021 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3022 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
3023 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
3024 xauth_path="/usr/openwin/bin/xauth"
3030 AC_ARG_ENABLE(strip,
3031 [ --disable-strip Disable calling strip(1) on install],
3033 if test "x$enableval" = "xno" ; then
3040 if test -z "$xauth_path" ; then
3041 XAUTH_PATH="undefined"
3042 AC_SUBST(XAUTH_PATH)
3044 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3045 [Define if xauth is found in your path])
3046 XAUTH_PATH=$xauth_path
3047 AC_SUBST(XAUTH_PATH)
3050 # Check for mail directory (last resort if we cannot get it from headers)
3051 if test ! -z "$MAIL" ; then
3052 maildir=`dirname $MAIL`
3053 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3054 [Set this to your mail directory if you don't have maillock.h])
3057 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
3058 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3059 disable_ptmx_check=yes
3061 if test -z "$no_dev_ptmx" ; then
3062 if test "x$disable_ptmx_check" != "xyes" ; then
3063 AC_CHECK_FILE("/dev/ptmx",
3065 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3066 [Define if you have /dev/ptmx])
3073 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
3074 AC_CHECK_FILE("/dev/ptc",
3076 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3077 [Define if you have /dev/ptc])
3082 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3085 # Options from here on. Some of these are preset by platform above
3086 AC_ARG_WITH(mantype,
3087 [ --with-mantype=man|cat|doc Set man page type],
3094 AC_MSG_ERROR(invalid man type: $withval)
3099 if test -z "$MANTYPE"; then
3100 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3101 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
3102 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3104 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3111 if test "$MANTYPE" = "doc"; then
3118 # Check whether to enable MD5 passwords
3120 AC_ARG_WITH(md5-passwords,
3121 [ --with-md5-passwords Enable use of MD5 passwords],
3123 if test "x$withval" != "xno" ; then
3124 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3125 [Define if you want to allow MD5 passwords])
3131 # Whether to disable shadow password support
3133 [ --without-shadow Disable shadow password support],
3135 if test "x$withval" = "xno" ; then
3136 AC_DEFINE(DISABLE_SHADOW)
3142 if test -z "$disable_shadow" ; then
3143 AC_MSG_CHECKING([if the systems has expire shadow information])
3146 #include <sys/types.h>
3149 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3150 [ sp_expire_available=yes ], []
3153 if test "x$sp_expire_available" = "xyes" ; then
3155 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3156 [Define if you want to use shadow password expire field])
3162 # Use ip address instead of hostname in $DISPLAY
3163 if test ! -z "$IPADDR_IN_DISPLAY" ; then
3164 DISPLAY_HACK_MSG="yes"
3165 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3166 [Define if you need to use IP address
3167 instead of hostname in $DISPLAY])
3169 DISPLAY_HACK_MSG="no"
3170 AC_ARG_WITH(ipaddr-display,
3171 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3173 if test "x$withval" != "xno" ; then
3174 AC_DEFINE(IPADDR_IN_DISPLAY)
3175 DISPLAY_HACK_MSG="yes"
3181 # check for /etc/default/login and use it if present.
3182 AC_ARG_ENABLE(etc-default-login,
3183 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3184 [ if test "x$enableval" = "xno"; then
3185 AC_MSG_NOTICE([/etc/default/login handling disabled])
3186 etc_default_login=no
3188 etc_default_login=yes
3190 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3192 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3193 etc_default_login=no
3195 etc_default_login=yes
3199 if test "x$etc_default_login" != "xno"; then
3200 AC_CHECK_FILE("/etc/default/login",
3201 [ external_path_file=/etc/default/login ])
3202 if test "x$external_path_file" = "x/etc/default/login"; then
3203 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3204 [Define if your system has /etc/default/login])
3208 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3209 if test $ac_cv_func_login_getcapbool = "yes" && \
3210 test $ac_cv_header_login_cap_h = "yes" ; then
3211 external_path_file=/etc/login.conf
3214 # Whether to mess with the default path
3215 SERVER_PATH_MSG="(default)"
3216 AC_ARG_WITH(default-path,
3217 [ --with-default-path= Specify default \$PATH environment for server],
3219 if test "x$external_path_file" = "x/etc/login.conf" ; then
3221 --with-default-path=PATH has no effect on this system.
3222 Edit /etc/login.conf instead.])
3223 elif test "x$withval" != "xno" ; then
3224 if test ! -z "$external_path_file" ; then
3226 --with-default-path=PATH will only be used if PATH is not defined in
3227 $external_path_file .])
3229 user_path="$withval"
3230 SERVER_PATH_MSG="$withval"
3233 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3234 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3236 if test ! -z "$external_path_file" ; then
3238 If PATH is defined in $external_path_file, ensure the path to scp is included,
3239 otherwise scp will not work.])
3243 /* find out what STDPATH is */
3248 #ifndef _PATH_STDPATH
3249 # ifdef _PATH_USERPATH /* Irix */
3250 # define _PATH_STDPATH _PATH_USERPATH
3252 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3255 #include <sys/types.h>
3256 #include <sys/stat.h>
3258 #define DATA "conftest.stdpath"
3265 fd = fopen(DATA,"w");
3269 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3275 [ user_path=`cat conftest.stdpath` ],
3276 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3277 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3279 # make sure $bindir is in USER_PATH so scp will work
3280 t_bindir=`eval echo ${bindir}`
3282 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3285 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3287 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3288 if test $? -ne 0 ; then
3289 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3290 if test $? -ne 0 ; then
3291 user_path=$user_path:$t_bindir
3292 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3297 if test "x$external_path_file" != "x/etc/login.conf" ; then
3298 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
3302 # Set superuser path separately to user path
3303 AC_ARG_WITH(superuser-path,
3304 [ --with-superuser-path= Specify different path for super-user],
3306 if test -n "$withval" && test "x$withval" != "xno" && \
3307 test "x${withval}" != "xyes"; then
3308 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3309 [Define if you want a different $PATH
3311 superuser_path=$withval
3317 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3318 IPV4_IN6_HACK_MSG="no"
3320 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3322 if test "x$withval" != "xno" ; then
3324 AC_DEFINE(IPV4_IN_IPV6, 1,
3325 [Detect IPv4 in IPv6 mapped addresses
3327 IPV4_IN6_HACK_MSG="yes"
3332 if test "x$inet6_default_4in6" = "xyes"; then
3333 AC_MSG_RESULT([yes (default)])
3334 AC_DEFINE(IPV4_IN_IPV6)
3335 IPV4_IN6_HACK_MSG="yes"
3337 AC_MSG_RESULT([no (default)])
3342 # Whether to enable BSD auth support
3344 AC_ARG_WITH(bsd-auth,
3345 [ --with-bsd-auth Enable BSD auth support],
3347 if test "x$withval" != "xno" ; then
3348 AC_DEFINE(BSD_AUTH, 1,
3349 [Define if you have BSD auth support])
3355 # Where to place sshd.pid
3357 # make sure the directory exists
3358 if test ! -d $piddir ; then
3359 piddir=`eval echo ${sysconfdir}`
3361 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3365 AC_ARG_WITH(pid-dir,
3366 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3368 if test -n "$withval" && test "x$withval" != "xno" && \
3369 test "x${withval}" != "xyes"; then
3371 if test ! -d $piddir ; then
3372 AC_MSG_WARN([** no $piddir directory on this system **])
3378 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
3381 dnl allow user to disable some login recording features
3382 AC_ARG_ENABLE(lastlog,
3383 [ --disable-lastlog disable use of lastlog even if detected [no]],
3385 if test "x$enableval" = "xno" ; then
3386 AC_DEFINE(DISABLE_LASTLOG)
3391 [ --disable-utmp disable use of utmp even if detected [no]],
3393 if test "x$enableval" = "xno" ; then
3394 AC_DEFINE(DISABLE_UTMP)
3398 AC_ARG_ENABLE(utmpx,
3399 [ --disable-utmpx disable use of utmpx even if detected [no]],
3401 if test "x$enableval" = "xno" ; then
3402 AC_DEFINE(DISABLE_UTMPX, 1,
3403 [Define if you don't want to use utmpx])
3408 [ --disable-wtmp disable use of wtmp even if detected [no]],
3410 if test "x$enableval" = "xno" ; then
3411 AC_DEFINE(DISABLE_WTMP)
3415 AC_ARG_ENABLE(wtmpx,
3416 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
3418 if test "x$enableval" = "xno" ; then
3419 AC_DEFINE(DISABLE_WTMPX, 1,
3420 [Define if you don't want to use wtmpx])
3424 AC_ARG_ENABLE(libutil,
3425 [ --disable-libutil disable use of libutil (login() etc.) [no]],
3427 if test "x$enableval" = "xno" ; then
3428 AC_DEFINE(DISABLE_LOGIN)
3432 AC_ARG_ENABLE(pututline,
3433 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
3435 if test "x$enableval" = "xno" ; then
3436 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3437 [Define if you don't want to use pututline()
3438 etc. to write [uw]tmp])
3442 AC_ARG_ENABLE(pututxline,
3443 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
3445 if test "x$enableval" = "xno" ; then
3446 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3447 [Define if you don't want to use pututxline()
3448 etc. to write [uw]tmpx])
3452 AC_ARG_WITH(lastlog,
3453 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
3455 if test "x$withval" = "xno" ; then
3456 AC_DEFINE(DISABLE_LASTLOG)
3457 elif test -n "$withval" && test "x${withval}" != "xyes"; then
3458 conf_lastlog_location=$withval
3463 dnl lastlog, [uw]tmpx? detection
3464 dnl NOTE: set the paths in the platform section to avoid the
3465 dnl need for command-line parameters
3466 dnl lastlog and [uw]tmp are subject to a file search if all else fails
3468 dnl lastlog detection
3469 dnl NOTE: the code itself will detect if lastlog is a directory
3470 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3472 #include <sys/types.h>
3474 #ifdef HAVE_LASTLOG_H
3475 # include <lastlog.h>
3484 [ char *lastlog = LASTLOG_FILE; ],
3485 [ AC_MSG_RESULT(yes) ],
3488 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3490 #include <sys/types.h>
3492 #ifdef HAVE_LASTLOG_H
3493 # include <lastlog.h>
3499 [ char *lastlog = _PATH_LASTLOG; ],
3500 [ AC_MSG_RESULT(yes) ],
3503 system_lastlog_path=no
3508 if test -z "$conf_lastlog_location"; then
3509 if test x"$system_lastlog_path" = x"no" ; then
3510 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3511 if (test -d "$f" || test -f "$f") ; then
3512 conf_lastlog_location=$f
3515 if test -z "$conf_lastlog_location"; then
3516 AC_MSG_WARN([** Cannot find lastlog **])
3517 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
3522 if test -n "$conf_lastlog_location"; then
3523 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3524 [Define if you want to specify the path to your lastlog file])
3528 AC_MSG_CHECKING([if your system defines UTMP_FILE])
3530 #include <sys/types.h>
3536 [ char *utmp = UTMP_FILE; ],
3537 [ AC_MSG_RESULT(yes) ],
3539 system_utmp_path=no ]
3541 if test -z "$conf_utmp_location"; then
3542 if test x"$system_utmp_path" = x"no" ; then
3543 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3544 if test -f $f ; then
3545 conf_utmp_location=$f
3548 if test -z "$conf_utmp_location"; then
3549 AC_DEFINE(DISABLE_UTMP)
3553 if test -n "$conf_utmp_location"; then
3554 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3555 [Define if you want to specify the path to your utmp file])
3559 AC_MSG_CHECKING([if your system defines WTMP_FILE])
3561 #include <sys/types.h>
3567 [ char *wtmp = WTMP_FILE; ],
3568 [ AC_MSG_RESULT(yes) ],
3570 system_wtmp_path=no ]
3572 if test -z "$conf_wtmp_location"; then
3573 if test x"$system_wtmp_path" = x"no" ; then
3574 for f in /usr/adm/wtmp /var/log/wtmp; do
3575 if test -f $f ; then
3576 conf_wtmp_location=$f
3579 if test -z "$conf_wtmp_location"; then
3580 AC_DEFINE(DISABLE_WTMP)
3584 if test -n "$conf_wtmp_location"; then
3585 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3586 [Define if you want to specify the path to your wtmp file])
3590 dnl utmpx detection - I don't know any system so perverse as to require
3591 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3593 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3595 #include <sys/types.h>
3604 [ char *utmpx = UTMPX_FILE; ],
3605 [ AC_MSG_RESULT(yes) ],
3607 system_utmpx_path=no ]
3609 if test -z "$conf_utmpx_location"; then
3610 if test x"$system_utmpx_path" = x"no" ; then
3611 AC_DEFINE(DISABLE_UTMPX)
3614 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3615 [Define if you want to specify the path to your utmpx file])
3619 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3621 #include <sys/types.h>
3630 [ char *wtmpx = WTMPX_FILE; ],
3631 [ AC_MSG_RESULT(yes) ],
3633 system_wtmpx_path=no ]
3635 if test -z "$conf_wtmpx_location"; then
3636 if test x"$system_wtmpx_path" = x"no" ; then
3637 AC_DEFINE(DISABLE_WTMPX)
3640 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3641 [Define if you want to specify the path to your wtmpx file])
3645 if test ! -z "$blibpath" ; then
3646 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3647 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3650 dnl remove pam and dl because they are in $LIBPAM
3651 if test "$PAM_MSG" = yes ; then
3652 LIBS=`echo $LIBS | sed 's/-lpam //'`
3654 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3655 LIBS=`echo $LIBS | sed 's/-ldl //'`
3658 dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3660 CFLAGS="$CFLAGS $werror_flags"
3663 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3664 scard/Makefile ssh_prng_cmds survey.sh])
3667 # Print summary of options
3669 # Someone please show me a better way :)
3670 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3671 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3672 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3673 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3674 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3675 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3676 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
3677 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3678 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3679 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3682 echo "OpenSSH has been configured with the following options:"
3683 echo " User binaries: $B"
3684 echo " System binaries: $C"
3685 echo " Configuration files: $D"
3686 echo " Askpass program: $E"
3687 echo " Manual pages: $F"
3688 echo " PID file: $G"
3689 echo " Privilege separation chroot path: $H"
3690 if test "x$external_path_file" = "x/etc/login.conf" ; then
3691 echo " At runtime, sshd will use the path defined in $external_path_file"
3692 echo " Make sure the path to scp is present, otherwise scp will not work"
3694 echo " sshd default user PATH: $I"
3695 if test ! -z "$external_path_file"; then
3696 echo " (If PATH is set in $external_path_file it will be used instead. If"
3697 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3700 if test ! -z "$superuser_path" ; then
3701 echo " sshd superuser user PATH: $J"
3703 echo " Manpage format: $MANTYPE"
3704 echo " PAM support: $PAM_MSG"
3705 echo " KerberosV support: $KRB5_MSG"
3706 echo " Smartcard support: $SCARD_MSG"
3707 echo " S/KEY support: $SKEY_MSG"
3708 echo " TCP Wrappers support: $TCPW_MSG"
3709 echo " MD5 password support: $MD5_MSG"
3710 echo " libedit support: $LIBEDIT_MSG"
3711 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
3712 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3713 echo " BSD Auth support: $BSD_AUTH_MSG"
3714 echo " Random number source: $RAND_MSG"
3715 if test ! -z "$USE_RAND_HELPER" ; then
3716 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
3721 echo " Host: ${host}"
3722 echo " Compiler: ${CC}"
3723 echo " Compiler flags: ${CFLAGS}"
3724 echo "Preprocessor flags: ${CPPFLAGS}"
3725 echo " Linker flags: ${LDFLAGS}"
3726 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
3730 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
3731 echo "SVR4 style packages are supported with \"make package\""
3735 if test "x$PAM_MSG" = "xyes" ; then
3736 echo "PAM is enabled. You may need to install a PAM control file "
3737 echo "for sshd, otherwise password authentication may fail. "
3738 echo "Example PAM control files can be found in the contrib/ "
3743 if test ! -z "$RAND_HELPER_CMDHASH" ; then
3744 echo "WARNING: you are using the builtin random number collection "
3745 echo "service. Please read WARNING.RNG and request that your OS "
3746 echo "vendor includes kernel-based random number collection in "
3747 echo "future versions of your OS."
3751 if test ! -z "$NO_PEERCHECK" ; then
3752 echo "WARNING: the operating system that you are using does not "
3753 echo "appear to support either the getpeereid() API nor the "
3754 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3755 echo "enforce security checks to prevent unauthorised connections to "
3756 echo "ssh-agent. Their absence increases the risk that a malicious "
3757 echo "user can connect to your agent. "
3761 if test "$AUDIT_MODULE" = "bsm" ; then
3762 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3763 echo "See the Solaris section in README.platform for details."