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_REVISION($Revision$)
19 AC_CONFIG_SRCDIR([ssh.c])
21 AC_CONFIG_HEADER(config.h)
26 # Checks for programs.
33 AC_PATH_PROG(CAT, cat)
34 AC_PATH_PROG(KILL, kill)
35 AC_PATH_PROGS(PERL, perl5 perl)
36 AC_PATH_PROG(SED, sed)
38 AC_PATH_PROG(ENT, ent)
40 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
41 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
42 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
44 AC_SUBST(TEST_SHELL,sh)
47 AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49 AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
50 [/usr/sbin${PATH_SEPARATOR}/etc])
51 AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
52 if test -x /sbin/sh; then
53 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
55 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
61 if test -z "$AR" ; then
62 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
65 # Use LOGIN_PROGRAM from environment if possible
66 if test ! -z "$LOGIN_PROGRAM" ; then
67 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
68 [If your header files don't define LOGIN_PROGRAM,
69 then use this (detected) from environment and PATH])
72 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
73 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
74 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
78 AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
79 if test ! -z "$PATH_PASSWD_PROG" ; then
80 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
81 [Full path of your "passwd" program])
84 if test -z "$LD" ; then
91 AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
93 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
94 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
95 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
98 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
100 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
101 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
105 if test -z "$have_llong_max"; then
106 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
107 unset ac_cv_have_decl_LLONG_MAX
108 saved_CFLAGS="$CFLAGS"
109 CFLAGS="$CFLAGS -std=gnu99"
110 AC_CHECK_DECL(LLONG_MAX,
112 [CFLAGS="$saved_CFLAGS"],
113 [#include <limits.h>]
119 [ --without-rpath Disable auto-added -R linker paths],
121 if test "x$withval" = "xno" ; then
124 if test "x$withval" = "xyes" ; then
130 # Check for some target-specific stuff
133 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
134 if (test -z "$blibpath"); then
135 blibpath="/usr/lib:/lib"
137 saved_LDFLAGS="$LDFLAGS"
138 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
139 if (test -z "$blibflags"); then
140 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
141 AC_TRY_LINK([], [], [blibflags=$tryflags])
144 if (test -z "$blibflags"); then
145 AC_MSG_RESULT(not found)
146 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
148 AC_MSG_RESULT($blibflags)
150 LDFLAGS="$saved_LDFLAGS"
151 dnl Check for authenticate. Might be in libs.a on older AIXes
152 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
153 [Define if you want to enable AIX4's authenticate function])],
154 [AC_CHECK_LIB(s,authenticate,
155 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
159 dnl Check for various auth function declarations in headers.
160 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
161 passwdexpired, setauthdb], , , [#include <usersec.h>])
162 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
163 AC_CHECK_DECLS(loginfailed,
164 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
166 [#include <usersec.h>],
167 [(void)loginfailed("user","host","tty",0);],
169 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
170 [Define if your AIX loginfailed() function
171 takes 4 arguments (AIX >= 5.2)])],
175 [#include <usersec.h>]
177 AC_CHECK_FUNCS(setauthdb)
178 check_for_aix_broken_getaddrinfo=1
179 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
180 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
181 [Define if your platform breaks doing a seteuid before a setuid])
182 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
183 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
184 dnl AIX handles lastlog as part of its login message
185 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
186 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
187 [Some systems need a utmpx entry for /bin/login to work])
188 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
189 [Define to a Set Process Title type if your system is
190 supported by bsd-setproctitle.c])
191 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
192 [AIX 5.2 and 5.3 (and presumably newer) require this])
195 check_for_libcrypt_later=1
196 LIBS="$LIBS /usr/lib/textmode.o"
197 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
198 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
199 AC_DEFINE(DISABLE_SHADOW, 1,
200 [Define if you want to disable shadow passwords])
201 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
202 [Define if your system choked on IP TOS setting])
203 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
204 [Define if X11 doesn't support AF_UNIX sockets on that system])
205 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
206 [Define if the concept of ports only accessible to
207 superusers isn't known])
208 AC_DEFINE(DISABLE_FD_PASSING, 1,
209 [Define if your platform needs to skip post auth
210 file descriptor passing])
213 AC_DEFINE(IP_TOS_IS_BROKEN)
214 AC_DEFINE(SETEUID_BREAKS_SETUID)
215 AC_DEFINE(BROKEN_SETREUID)
216 AC_DEFINE(BROKEN_SETREGID)
219 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
220 AC_DEFINE(SETEUID_BREAKS_SETUID)
221 AC_DEFINE(BROKEN_SETREUID)
222 AC_DEFINE(BROKEN_SETREGID)
223 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
224 [Define if your resolver libs need this for getrrsetbyname])
225 AC_MSG_CHECKING(if we have the Security Authorization Session API)
226 AC_TRY_COMPILE([#include <Security/AuthSession.h>],
227 [SessionCreate(0, 0);],
228 [ac_cv_use_security_session_api="yes"
229 AC_DEFINE(USE_SECURITY_SESSION_API, 1,
230 [platform has the Security Authorization Session API])
231 LIBS="$LIBS -framework Security"
233 [ac_cv_use_security_session_api="no"
235 AC_MSG_CHECKING(if we have an in-memory credentials cache)
237 [#include <Kerberos/Kerberos.h>],
239 (void) cc_initialize (&c, 0, NULL, NULL);],
240 [AC_DEFINE(USE_CCAPI, 1,
241 [platform uses an in-memory credentials cache])
242 LIBS="$LIBS -framework Security"
244 if test "x$ac_cv_use_security_session_api" = "xno"; then
245 AC_MSG_ERROR(*** Need a security framework to use the credentials cache API ***)
251 # first we define all of the options common to all HP-UX releases
252 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
253 IPADDR_IN_DISPLAY=yes
255 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
256 [Define if your login program cannot handle end of options ("--")])
257 AC_DEFINE(LOGIN_NEEDS_UTMPX)
258 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
259 [String used in /etc/passwd to denote locked account])
260 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
261 MAIL="/var/mail/username"
263 AC_CHECK_LIB(xnet, t_error, ,
264 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
266 # next, we define all of the options specific to major releases
269 if test -z "$GCC"; then
274 AC_DEFINE(PAM_SUN_CODEBASE, 1,
275 [Define if you are using Solaris-derived PAM which
276 passes pam_messages to the conversation function
277 with an extra level of indirection])
278 AC_DEFINE(DISABLE_UTMP, 1,
279 [Define if you don't want to use utmp])
280 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
281 check_for_hpux_broken_getaddrinfo=1
282 check_for_conflicting_getspnam=1
286 # lastly, we define options specific to minor releases
289 AC_DEFINE(HAVE_SECUREWARE, 1,
290 [Define if you have SecureWare-based
291 protected password database])
292 disable_ptmx_check=yes
298 PATH="$PATH:/usr/etc"
299 AC_DEFINE(BROKEN_INET_NTOA, 1,
300 [Define if you system's inet_ntoa is busted
301 (e.g. Irix gcc issue)])
302 AC_DEFINE(SETEUID_BREAKS_SETUID)
303 AC_DEFINE(BROKEN_SETREUID)
304 AC_DEFINE(BROKEN_SETREGID)
305 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
306 [Define if you shouldn't strip 'tty' from your
308 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
311 PATH="$PATH:/usr/etc"
312 AC_DEFINE(WITH_IRIX_ARRAY, 1,
313 [Define if you have/want arrays
314 (cluster-wide session managment, not C arrays)])
315 AC_DEFINE(WITH_IRIX_PROJECT, 1,
316 [Define if you want IRIX project management])
317 AC_DEFINE(WITH_IRIX_AUDIT, 1,
318 [Define if you want IRIX audit trails])
319 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
320 [Define if you want IRIX kernel jobs])])
321 AC_DEFINE(BROKEN_INET_NTOA)
322 AC_DEFINE(SETEUID_BREAKS_SETUID)
323 AC_DEFINE(BROKEN_SETREUID)
324 AC_DEFINE(BROKEN_SETREGID)
325 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
326 AC_DEFINE(WITH_ABBREV_NO_TTY)
327 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
331 check_for_libcrypt_later=1
332 check_for_openpty_ctty_bug=1
333 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
334 AC_DEFINE(PAM_TTY_KLUDGE, 1,
335 [Work around problematic Linux PAM modules handling of PAM_TTY])
336 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
337 [String used in /etc/passwd to denote locked account])
338 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
339 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
340 [Define to whatever link() returns for "not supported"
341 if it doesn't return EOPNOTSUPP.])
342 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
344 inet6_default_4in6=yes
347 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
348 [Define if cmsg_type is not passed correctly])
351 # tun(4) forwarding compat code
352 AC_CHECK_HEADERS(linux/if_tun.h)
353 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
354 AC_DEFINE(SSH_TUN_LINUX, 1,
355 [Open tunnel devices the Linux tun/tap way])
356 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
357 [Use tunnel device compatibility to OpenBSD])
358 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
359 [Prepend the address family to IP tunnel traffic])
362 mips-sony-bsd|mips-sony-newsos4)
363 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
367 check_for_libcrypt_before=1
368 if test "x$withval" != "xno" ; then
371 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
372 AC_CHECK_HEADER([net/if_tap.h], ,
373 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
374 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
375 [Prepend the address family to IP tunnel traffic])
378 check_for_libcrypt_later=1
379 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
380 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
381 AC_CHECK_HEADER([net/if_tap.h], ,
382 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
385 AC_DEFINE(SETEUID_BREAKS_SETUID)
386 AC_DEFINE(BROKEN_SETREUID)
387 AC_DEFINE(BROKEN_SETREGID)
390 conf_lastlog_location="/usr/adm/lastlog"
391 conf_utmp_location=/etc/utmp
392 conf_wtmp_location=/usr/adm/wtmp
394 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
395 AC_DEFINE(BROKEN_REALPATH)
397 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
400 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
401 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
402 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
405 if test "x$withval" != "xno" ; then
408 AC_DEFINE(PAM_SUN_CODEBASE)
409 AC_DEFINE(LOGIN_NEEDS_UTMPX)
410 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
411 [Some versions of /bin/login need the TERM supplied
413 AC_DEFINE(PAM_TTY_KLUDGE)
414 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
415 [Define if pam_chauthtok wants real uid set
416 to the unpriv'ed user])
417 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
418 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
419 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
420 [Define if sshd somehow reacquires a controlling TTY
422 external_path_file=/etc/default/login
423 # hardwire lastlog location (can't detect it on some versions)
424 conf_lastlog_location="/var/adm/lastlog"
425 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
426 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
427 if test "$sol2ver" -ge 8; then
429 AC_DEFINE(DISABLE_UTMP)
430 AC_DEFINE(DISABLE_WTMP, 1,
431 [Define if you don't want to use wtmp])
437 CPPFLAGS="$CPPFLAGS -DSUNOS4"
438 AC_CHECK_FUNCS(getpwanam)
439 AC_DEFINE(PAM_SUN_CODEBASE)
440 conf_utmp_location=/etc/utmp
441 conf_wtmp_location=/var/adm/wtmp
442 conf_lastlog_location=/var/adm/lastlog
448 AC_DEFINE(SSHD_ACQUIRES_CTTY)
449 AC_DEFINE(SETEUID_BREAKS_SETUID)
450 AC_DEFINE(BROKEN_SETREUID)
451 AC_DEFINE(BROKEN_SETREGID)
454 # /usr/ucblib MUST NOT be searched on ReliantUNIX
455 AC_CHECK_LIB(dl, dlsym, ,)
456 # -lresolv needs to be at the end of LIBS or DNS lookups break
457 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
458 IPADDR_IN_DISPLAY=yes
460 AC_DEFINE(IP_TOS_IS_BROKEN)
461 AC_DEFINE(SETEUID_BREAKS_SETUID)
462 AC_DEFINE(BROKEN_SETREUID)
463 AC_DEFINE(BROKEN_SETREGID)
464 AC_DEFINE(SSHD_ACQUIRES_CTTY)
465 external_path_file=/etc/default/login
466 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
467 # Attention: always take care to bind libsocket and libnsl before libc,
468 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
470 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
472 CFLAGS="$CFLAGS -Dva_list=_VA_LIST"
474 AC_DEFINE(SETEUID_BREAKS_SETUID)
475 AC_DEFINE(BROKEN_SETREUID)
476 AC_DEFINE(BROKEN_SETREGID)
477 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
478 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
480 # UnixWare 7.x, OpenUNIX 8
482 check_for_libcrypt_later=1
483 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
485 AC_DEFINE(SETEUID_BREAKS_SETUID)
486 AC_DEFINE(BROKEN_SETREUID)
487 AC_DEFINE(BROKEN_SETREGID)
488 AC_DEFINE(PASSWD_NEEDS_USERNAME)
490 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
491 TEST_SHELL=/u95/bin/sh
492 AC_DEFINE(BROKEN_LIBIAF, 1,
493 [ia_uinfo routines not supported by OS yet])
495 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
501 # SCO UNIX and OEM versions of SCO UNIX
503 AC_MSG_ERROR("This Platform is no longer supported.")
507 if test -z "$GCC"; then
508 CFLAGS="$CFLAGS -belf"
510 LIBS="$LIBS -lprot -lx -ltinfo -lm"
513 AC_DEFINE(HAVE_SECUREWARE)
514 AC_DEFINE(DISABLE_SHADOW)
515 AC_DEFINE(DISABLE_FD_PASSING)
516 AC_DEFINE(SETEUID_BREAKS_SETUID)
517 AC_DEFINE(BROKEN_SETREUID)
518 AC_DEFINE(BROKEN_SETREGID)
519 AC_DEFINE(WITH_ABBREV_NO_TTY)
520 AC_DEFINE(BROKEN_UPDWTMPX)
521 AC_DEFINE(PASSWD_NEEDS_USERNAME)
522 AC_CHECK_FUNCS(getluid setluid)
527 AC_DEFINE(NO_SSH_LASTLOG, 1,
528 [Define if you don't want to use lastlog in session.c])
529 AC_DEFINE(SETEUID_BREAKS_SETUID)
530 AC_DEFINE(BROKEN_SETREUID)
531 AC_DEFINE(BROKEN_SETREGID)
533 AC_DEFINE(DISABLE_FD_PASSING)
535 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
539 AC_DEFINE(SETEUID_BREAKS_SETUID)
540 AC_DEFINE(BROKEN_SETREUID)
541 AC_DEFINE(BROKEN_SETREGID)
542 AC_DEFINE(WITH_ABBREV_NO_TTY)
544 AC_DEFINE(DISABLE_FD_PASSING)
546 LIBS="$LIBS -lgen -lacid -ldb"
550 AC_DEFINE(SETEUID_BREAKS_SETUID)
551 AC_DEFINE(BROKEN_SETREUID)
552 AC_DEFINE(BROKEN_SETREGID)
554 AC_DEFINE(DISABLE_FD_PASSING)
555 AC_DEFINE(NO_SSH_LASTLOG)
556 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
557 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
561 AC_MSG_CHECKING(for Digital Unix SIA)
564 [ --with-osfsia Enable Digital Unix SIA],
566 if test "x$withval" = "xno" ; then
567 AC_MSG_RESULT(disabled)
572 if test -z "$no_osfsia" ; then
573 if test -f /etc/sia/matrix.conf; then
575 AC_DEFINE(HAVE_OSF_SIA, 1,
576 [Define if you have Digital Unix Security
577 Integration Architecture])
578 AC_DEFINE(DISABLE_LOGIN, 1,
579 [Define if you don't want to use your
580 system's login() call])
581 AC_DEFINE(DISABLE_FD_PASSING)
582 LIBS="$LIBS -lsecurity -ldb -lm -laud"
585 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
586 [String used in /etc/passwd to denote locked account])
589 AC_DEFINE(BROKEN_GETADDRINFO)
590 AC_DEFINE(SETEUID_BREAKS_SETUID)
591 AC_DEFINE(BROKEN_SETREUID)
592 AC_DEFINE(BROKEN_SETREGID)
597 AC_DEFINE(NO_X11_UNIX_SOCKETS)
598 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
599 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
600 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
601 AC_DEFINE(DISABLE_LASTLOG)
605 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
606 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
607 AC_DEFINE(NEED_SETPGRP)
608 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
612 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
613 AC_DEFINE(MISSING_HOWMANY)
614 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
618 # Allow user to specify flags
620 [ --with-cflags Specify additional flags to pass to compiler],
622 if test -n "$withval" && test "x$withval" != "xno" && \
623 test "x${withval}" != "xyes"; then
624 CFLAGS="$CFLAGS $withval"
628 AC_ARG_WITH(cppflags,
629 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
631 if test -n "$withval" && test "x$withval" != "xno" && \
632 test "x${withval}" != "xyes"; then
633 CPPFLAGS="$CPPFLAGS $withval"
638 [ --with-ldflags Specify additional flags to pass to linker],
640 if test -n "$withval" && test "x$withval" != "xno" && \
641 test "x${withval}" != "xyes"; then
642 LDFLAGS="$LDFLAGS $withval"
647 [ --with-libs Specify additional libraries to link with],
649 if test -n "$withval" && test "x$withval" != "xno" && \
650 test "x${withval}" != "xyes"; then
651 LIBS="$LIBS $withval"
656 [ --with-Werror Build main code with -Werror],
658 if test -n "$withval" && test "x$withval" != "xno"; then
659 werror_flags="-Werror"
660 if test "x${withval}" != "xyes"; then
661 werror_flags="$withval"
667 AC_MSG_CHECKING(compiler and flags for sanity)
673 [ AC_MSG_RESULT(yes) ],
676 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
678 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
681 dnl Checks for header files.
705 security/pam_appl.h \
741 # lastlog.h requires sys/time.h to be included first on Solaris
742 AC_CHECK_HEADERS(lastlog.h, [], [], [
743 #ifdef HAVE_SYS_TIME_H
744 # include <sys/time.h>
748 # sys/ptms.h requires sys/stream.h to be included first on Solaris
749 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
750 #ifdef HAVE_SYS_STREAM_H
751 # include <sys/stream.h>
755 # Checks for libraries.
756 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
757 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
759 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
760 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
761 AC_CHECK_LIB(gen, dirname,[
762 AC_CACHE_CHECK([for broken dirname],
763 ac_cv_have_broken_dirname, [
771 int main(int argc, char **argv) {
774 strncpy(buf,"/etc", 32);
776 if (!s || strncmp(s, "/", 32) != 0) {
783 [ ac_cv_have_broken_dirname="no" ],
784 [ ac_cv_have_broken_dirname="yes" ],
785 [ ac_cv_have_broken_dirname="no" ],
789 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
791 AC_DEFINE(HAVE_DIRNAME)
792 AC_CHECK_HEADERS(libgen.h)
797 AC_CHECK_FUNC(getspnam, ,
798 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
799 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
800 [Define if you have the basename function.]))
804 [ --with-zlib=PATH Use zlib in PATH],
805 [ if test "x$withval" = "xno" ; then
806 AC_MSG_ERROR([*** zlib is required ***])
807 elif test "x$withval" != "xyes"; then
808 if test -d "$withval/lib"; then
809 if test -n "${need_dash_r}"; then
810 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
812 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
815 if test -n "${need_dash_r}"; then
816 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
818 LDFLAGS="-L${withval} ${LDFLAGS}"
821 if test -d "$withval/include"; then
822 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
824 CPPFLAGS="-I${withval} ${CPPFLAGS}"
829 AC_CHECK_LIB(z, deflate, ,
831 saved_CPPFLAGS="$CPPFLAGS"
832 saved_LDFLAGS="$LDFLAGS"
834 dnl Check default zlib install dir
835 if test -n "${need_dash_r}"; then
836 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
838 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
840 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
842 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
844 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
849 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
851 AC_ARG_WITH(zlib-version-check,
852 [ --without-zlib-version-check Disable zlib version check],
853 [ if test "x$withval" = "xno" ; then
854 zlib_check_nonfatal=1
859 AC_MSG_CHECKING(for possibly buggy zlib)
860 AC_RUN_IFELSE([AC_LANG_SOURCE([[
865 int a=0, b=0, c=0, d=0, n, v;
866 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
867 if (n != 3 && n != 4)
869 v = a*1000000 + b*10000 + c*100 + d;
870 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
873 if (a == 1 && b == 1 && c >= 4)
876 /* 1.2.3 and up are OK */
885 if test -z "$zlib_check_nonfatal" ; then
886 AC_MSG_ERROR([*** zlib too old - check config.log ***
887 Your reported zlib version has known security problems. It's possible your
888 vendor has fixed these problems without changing the version number. If you
889 are sure this is the case, you can disable the check by running
890 "./configure --without-zlib-version-check".
891 If you are in doubt, upgrade zlib to version 1.2.3 or greater.
892 See http://www.gzip.org/zlib/ for details.])
894 AC_MSG_WARN([zlib version may have security problems])
897 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
901 AC_CHECK_FUNC(strcasecmp,
902 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
904 AC_CHECK_FUNCS(utimes,
905 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
906 LIBS="$LIBS -lc89"]) ]
909 dnl Checks for libutil functions
910 AC_CHECK_HEADERS(libutil.h)
911 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
912 [Define if your libraries define login()])])
913 AC_CHECK_FUNCS(logout updwtmp logwtmp)
917 # Check for ALTDIRFUNC glob() extension
918 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
919 AC_EGREP_CPP(FOUNDIT,
922 #ifdef GLOB_ALTDIRFUNC
927 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
928 [Define if your system glob() function has
929 the GLOB_ALTDIRFUNC extension])
937 # Check for g.gl_matchc glob() extension
938 AC_MSG_CHECKING(for gl_matchc field in glob_t)
939 AC_EGREP_CPP(FOUNDIT,
942 int main(void){glob_t g; g.gl_matchc = 1;}
945 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
946 [Define if your system glob() function has
947 gl_matchc options in glob_t])
955 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
958 #include <sys/types.h>
960 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
962 [AC_MSG_RESULT(yes)],
965 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
966 [Define if your struct dirent expects you to
967 allocate extra space for d_name])
970 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
971 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
975 # Check whether the user wants GSSAPI mechglue support
976 AC_ARG_WITH(mechglue,
977 [ --with-mechglue=PATH Build with GSSAPI mechglue library],
979 AC_MSG_CHECKING(for mechglue library)
981 if test -e ${withval}/libgssapi.a ; then
982 mechglue_lib=${withval}/libgssapi.a
983 elif test -e ${withval}/lib/libgssapi.a ; then
984 mechglue_lib=${withval}/lib/libgssapi.a
986 AC_MSG_ERROR("Can't find libgssapi in ${withval}");
988 LIBS="$LIBS ${mechglue_lib}"
989 AC_MSG_RESULT(${mechglue_lib})
991 AC_CHECK_LIB(dl, dlopen, , )
992 if test $ac_cv_lib_dl_dlopen = yes; then
993 LDFLAGS="$LDFLAGS -ldl -Wl,-Bsymbolic"
997 AC_DEFINE(MECHGLUE, 1, [Define this if you're building with GSSAPI MechGlue.])
1004 # Check whether the user wants GSI (Globus) support
1007 [ --with-gsi Enable Globus GSI authentication support],
1014 [ --with-globus Enable Globus GSI authentication support],
1020 AC_ARG_WITH(globus-static,
1021 [ --with-globus-static Link statically with Globus GSI libraries],
1023 gsi_static="-static"
1024 if test "x$gsi_path" = "xno" ; then
1030 # Check whether the user has a Globus flavor type
1031 globus_flavor_type="no"
1032 AC_ARG_WITH(globus-flavor,
1033 [ --with-globus-flavor=TYPE Specify Globus flavor type (ex: gcc32dbg)],
1035 globus_flavor_type="$withval"
1036 if test "x$gsi_path" = "xno" ; then
1042 if test "x$gsi_path" != "xno" ; then
1043 # Globus GSSAPI configuration
1044 AC_MSG_CHECKING(for Globus GSI)
1045 AC_DEFINE(GSI, 1, [Define if you want GSI/Globus authentication support.])
1047 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
1048 AC_MSG_ERROR([Previously configured GSSAPI library conflicts with Globus GSI.])
1050 if test -z "$GSSAPI"; then
1055 if test "x$gsi_path" = "xyes" ; then
1056 if test -z "$GLOBUS_LOCATION" ; then
1057 AC_MSG_ERROR(GLOBUS_LOCATION environment variable must be set.)
1059 gsi_path="$GLOBUS_LOCATION"
1062 GLOBUS_LOCATION="$gsi_path"
1063 export GLOBUS_LOCATION
1064 if test ! -d "$GLOBUS_LOCATION" ; then
1065 AC_MSG_ERROR(Cannot find Globus installation. Set GLOBUS_LOCATION environment variable.)
1068 if test "x$globus_flavor_type" = "xno" ; then
1069 AC_MSG_ERROR(--with-globus-flavor=TYPE must be specified)
1071 if test "x$globus_flavor_type" = "xyes" ; then
1072 AC_MSG_ERROR(--with-globus-flavor=TYPE must specify a flavor type)
1075 GLOBUS_INCLUDE="${gsi_path}/include/${globus_flavor_type}"
1076 if test ! -d "$GLOBUS_INCLUDE" ; then
1077 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_INCLUDE})
1079 GSI_CPPFLAGS="-I${GLOBUS_INCLUDE}"
1081 if test -x ${gsi_path}/bin/globus-makefile-header ; then
1082 GSI_LIBS=`${gsi_path}/bin/globus-makefile-header --flavor=${globus_flavor_type} ${gsi_static} globus_gss_assist | perl -n -e 'if (/GLOBUS_PKG_LIBS = (.*)/){print $1;}'`
1083 elif test -x ${gsi_path}/sbin/globus-makefile-header ; then
1084 GSI_LIBS=`${gsi_path}/sbin/globus-makefile-header --flavor=${globus_flavor_type} ${gsi_static} globus_gss_assist | perl -n -e 'if (/GLOBUS_PKG_LIBS = (.*)/){print $1;}'`
1086 AC_MSG_ERROR(Cannot find globus-makefile-header: Globus installation is incomplete)
1088 if test -n "${need_dash_r}"; then
1089 GSI_LDFLAGS="-L${gsi_path}/lib -R{gsi_path}/lib"
1091 GSI_LDFLAGS="-L${gsi_path}/lib"
1093 if test -z "$GSI_LIBS" ; then
1094 AC_MSG_ERROR(globus-makefile-header failed)
1097 AC_DEFINE(HAVE_GSSAPI_H)
1099 LIBS="$LIBS $GSI_LIBS"
1100 LDFLAGS="$LDFLAGS $GSI_LDFLAGS"
1101 CPPFLAGS="$CPPFLAGS $GSI_CPPFLAGS"
1103 # test that we got the libraries OK
1111 AC_MSG_ERROR(link with Globus libraries failed)
1114 INSTALL_GSISSH="yes"
1118 AC_SUBST(INSTALL_GSISSH)
1119 # End Globus/GSI section
1121 AC_MSG_CHECKING([for /proc/pid/fd directory])
1122 if test -d "/proc/$$/fd" ; then
1123 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
1129 # Check whether user wants S/Key support
1132 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
1134 if test "x$withval" != "xno" ; then
1136 if test "x$withval" != "xyes" ; then
1137 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1138 LDFLAGS="$LDFLAGS -L${withval}/lib"
1141 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
1145 AC_MSG_CHECKING([for s/key support])
1150 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
1152 [AC_MSG_RESULT(yes)],
1155 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1157 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1161 [(void)skeychallenge(NULL,"name","",0);],
1163 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1164 [Define if your skeychallenge()
1165 function takes 4 arguments (NetBSD)])],
1172 # Check whether user wants TCP wrappers support
1174 AC_ARG_WITH(tcp-wrappers,
1175 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
1177 if test "x$withval" != "xno" ; then
1179 saved_LDFLAGS="$LDFLAGS"
1180 saved_CPPFLAGS="$CPPFLAGS"
1181 if test -n "${withval}" && \
1182 test "x${withval}" != "xyes"; then
1183 if test -d "${withval}/lib"; then
1184 if test -n "${need_dash_r}"; then
1185 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1187 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1190 if test -n "${need_dash_r}"; then
1191 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1193 LDFLAGS="-L${withval} ${LDFLAGS}"
1196 if test -d "${withval}/include"; then
1197 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1199 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1203 LIBS="$LIBWRAP $LIBS"
1204 AC_MSG_CHECKING(for libwrap)
1207 #include <sys/types.h>
1208 #include <sys/socket.h>
1209 #include <netinet/in.h>
1211 int deny_severity = 0, allow_severity = 0;
1216 AC_DEFINE(LIBWRAP, 1,
1218 TCP Wrappers support])
1223 AC_MSG_ERROR([*** libwrap missing])
1231 # Check whether user wants libedit support
1233 AC_ARG_WITH(libedit,
1234 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1235 [ if test "x$withval" != "xno" ; then
1236 if test "x$withval" != "xyes"; then
1237 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1238 if test -n "${need_dash_r}"; then
1239 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1241 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1244 AC_CHECK_LIB(edit, el_init,
1245 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
1246 LIBEDIT="-ledit -lcurses"
1250 [ AC_MSG_ERROR(libedit not found) ],
1253 AC_MSG_CHECKING(if libedit version is compatible)
1256 #include <histedit.h>
1260 el_init("", NULL, NULL, NULL);
1264 [ AC_MSG_RESULT(yes) ],
1266 AC_MSG_ERROR(libedit version is not compatible) ]
1273 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1275 AC_MSG_CHECKING(for supported audit module)
1280 dnl Checks for headers, libs and functions
1281 AC_CHECK_HEADERS(bsm/audit.h, [],
1282 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1283 AC_CHECK_LIB(bsm, getaudit, [],
1284 [AC_MSG_ERROR(BSM enabled and required library not found)])
1285 AC_CHECK_FUNCS(getaudit, [],
1286 [AC_MSG_ERROR(BSM enabled and required function not found)])
1287 # These are optional
1288 AC_CHECK_FUNCS(getaudit_addr)
1289 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
1293 AC_MSG_RESULT(debug)
1294 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
1300 AC_MSG_ERROR([Unknown audit module $withval])
1305 dnl Checks for library functions. Please keep in alphabetical order
1390 # IRIX has a const char return value for gai_strerror()
1391 AC_CHECK_FUNCS(gai_strerror,[
1392 AC_DEFINE(HAVE_GAI_STRERROR)
1394 #include <sys/types.h>
1395 #include <sys/socket.h>
1398 const char *gai_strerror(int);],[
1401 str = gai_strerror(0);],[
1402 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1403 [Define if gai_strerror() returns const char *])])])
1405 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1406 [Some systems put nanosleep outside of libc]))
1408 dnl Make sure prototypes are defined for these before using them.
1409 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1410 AC_CHECK_DECL(strsep,
1411 [AC_CHECK_FUNCS(strsep)],
1414 #ifdef HAVE_STRING_H
1415 # include <string.h>
1419 dnl tcsendbreak might be a macro
1420 AC_CHECK_DECL(tcsendbreak,
1421 [AC_DEFINE(HAVE_TCSENDBREAK)],
1422 [AC_CHECK_FUNCS(tcsendbreak)],
1423 [#include <termios.h>]
1426 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1428 AC_CHECK_FUNCS(setresuid, [
1429 dnl Some platorms have setresuid that isn't implemented, test for this
1430 AC_MSG_CHECKING(if setresuid seems to work)
1435 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1437 [AC_MSG_RESULT(yes)],
1438 [AC_DEFINE(BROKEN_SETRESUID, 1,
1439 [Define if your setresuid() is broken])
1440 AC_MSG_RESULT(not implemented)],
1441 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1445 AC_CHECK_FUNCS(setresgid, [
1446 dnl Some platorms have setresgid that isn't implemented, test for this
1447 AC_MSG_CHECKING(if setresgid seems to work)
1452 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1454 [AC_MSG_RESULT(yes)],
1455 [AC_DEFINE(BROKEN_SETRESGID, 1,
1456 [Define if your setresgid() is broken])
1457 AC_MSG_RESULT(not implemented)],
1458 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1462 dnl Checks for time functions
1463 AC_CHECK_FUNCS(gettimeofday time)
1464 dnl Checks for utmp functions
1465 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1466 AC_CHECK_FUNCS(utmpname)
1467 dnl Checks for utmpx functions
1468 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1469 AC_CHECK_FUNCS(setutxent utmpxname)
1471 AC_CHECK_FUNC(daemon,
1472 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1473 [AC_CHECK_LIB(bsd, daemon,
1474 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1477 AC_CHECK_FUNC(getpagesize,
1478 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1479 [Define if your libraries define getpagesize()])],
1480 [AC_CHECK_LIB(ucb, getpagesize,
1481 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1484 # Check for broken snprintf
1485 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1486 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1490 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1492 [AC_MSG_RESULT(yes)],
1495 AC_DEFINE(BROKEN_SNPRINTF, 1,
1496 [Define if your snprintf is busted])
1497 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1499 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1503 # If we don't have a working asprintf, then we strongly depend on vsnprintf
1504 # returning the right thing on overflow: the number of characters it tried to
1505 # create (as per SUSv3)
1506 if test "x$ac_cv_func_asprintf" != "xyes" && \
1507 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1508 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1511 #include <sys/types.h>
1515 int x_snprintf(char *str,size_t count,const char *fmt,...)
1517 size_t ret; va_list ap;
1518 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1524 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1526 [AC_MSG_RESULT(yes)],
1529 AC_DEFINE(BROKEN_SNPRINTF, 1,
1530 [Define if your snprintf is busted])
1531 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1533 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1537 # On systems where [v]snprintf is broken, but is declared in stdio,
1538 # check that the fmt argument is const char * or just char *.
1539 # This is only useful for when BROKEN_SNPRINTF
1540 AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1541 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1542 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1543 int main(void) { snprintf(0, 0, 0); }
1546 AC_DEFINE(SNPRINTF_CONST, [const],
1547 [Define as const if snprintf() can declare const char *fmt])],
1549 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1551 # Check for missing getpeereid (or equiv) support
1553 if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1554 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1556 [#include <sys/types.h>
1557 #include <sys/socket.h>],
1558 [int i = SO_PEERCRED;],
1559 [ AC_MSG_RESULT(yes)
1560 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
1567 dnl see whether mkstemp() requires XXXXXX
1568 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1569 AC_MSG_CHECKING([for (overly) strict mkstemp])
1573 main() { char template[]="conftest.mkstemp-test";
1574 if (mkstemp(template) == -1)
1576 unlink(template); exit(0);
1584 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
1588 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1593 dnl make sure that openpty does not reacquire controlling terminal
1594 if test ! -z "$check_for_openpty_ctty_bug"; then
1595 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1599 #include <sys/fcntl.h>
1600 #include <sys/types.h>
1601 #include <sys/wait.h>
1607 int fd, ptyfd, ttyfd, status;
1610 if (pid < 0) { /* failed */
1612 } else if (pid > 0) { /* parent */
1613 waitpid(pid, &status, 0);
1614 if (WIFEXITED(status))
1615 exit(WEXITSTATUS(status));
1618 } else { /* child */
1619 close(0); close(1); close(2);
1621 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1622 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1624 exit(3); /* Acquired ctty: broken */
1626 exit(0); /* Did not acquire ctty: OK */
1635 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1638 AC_MSG_RESULT(cross-compiling, assuming yes)
1643 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1644 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1645 AC_MSG_CHECKING(if getaddrinfo seems to work)
1649 #include <sys/socket.h>
1652 #include <netinet/in.h>
1654 #define TEST_PORT "2222"
1660 struct addrinfo *gai_ai, *ai, hints;
1661 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1663 memset(&hints, 0, sizeof(hints));
1664 hints.ai_family = PF_UNSPEC;
1665 hints.ai_socktype = SOCK_STREAM;
1666 hints.ai_flags = AI_PASSIVE;
1668 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1670 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1674 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1675 if (ai->ai_family != AF_INET6)
1678 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1679 sizeof(ntop), strport, sizeof(strport),
1680 NI_NUMERICHOST|NI_NUMERICSERV);
1683 if (err == EAI_SYSTEM)
1684 perror("getnameinfo EAI_SYSTEM");
1686 fprintf(stderr, "getnameinfo failed: %s\n",
1691 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1694 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1707 AC_DEFINE(BROKEN_GETADDRINFO)
1710 AC_MSG_RESULT(cross-compiling, assuming yes)
1715 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1716 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1717 AC_MSG_CHECKING(if getaddrinfo seems to work)
1721 #include <sys/socket.h>
1724 #include <netinet/in.h>
1726 #define TEST_PORT "2222"
1732 struct addrinfo *gai_ai, *ai, hints;
1733 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1735 memset(&hints, 0, sizeof(hints));
1736 hints.ai_family = PF_UNSPEC;
1737 hints.ai_socktype = SOCK_STREAM;
1738 hints.ai_flags = AI_PASSIVE;
1740 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1742 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1746 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1747 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1750 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1751 sizeof(ntop), strport, sizeof(strport),
1752 NI_NUMERICHOST|NI_NUMERICSERV);
1754 if (ai->ai_family == AF_INET && err != 0) {
1755 perror("getnameinfo");
1764 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1765 [Define if you have a getaddrinfo that fails
1766 for the all-zeros IPv6 address])
1770 AC_DEFINE(BROKEN_GETADDRINFO)
1772 AC_MSG_RESULT(cross-compiling, assuming no)
1777 if test "x$check_for_conflicting_getspnam" = "x1"; then
1778 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1782 int main(void) {exit(0);}
1789 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1790 [Conflicting defs for getspnam])
1797 # Check for PAM libs
1800 [ --with-pam Enable PAM support ],
1802 if test "x$withval" != "xno" ; then
1803 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1804 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1805 AC_MSG_ERROR([PAM headers not found])
1808 AC_CHECK_LIB(dl, dlopen, , )
1809 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1810 AC_CHECK_FUNCS(pam_getenvlist)
1811 AC_CHECK_FUNCS(pam_putenv)
1815 AC_DEFINE(USE_PAM, 1,
1816 [Define if you want to enable PAM support])
1817 if test $ac_cv_lib_dl_dlopen = yes; then
1827 # Check for older PAM
1828 if test "x$PAM_MSG" = "xyes" ; then
1829 # Check PAM strerror arguments (old PAM)
1830 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1834 #if defined(HAVE_SECURITY_PAM_APPL_H)
1835 #include <security/pam_appl.h>
1836 #elif defined (HAVE_PAM_PAM_APPL_H)
1837 #include <pam/pam_appl.h>
1840 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1841 [AC_MSG_RESULT(no)],
1843 AC_DEFINE(HAVE_OLD_PAM, 1,
1844 [Define if you have an old version of PAM
1845 which takes only one argument to pam_strerror])
1847 PAM_MSG="yes (old library)"
1852 # Search for OpenSSL
1853 saved_CPPFLAGS="$CPPFLAGS"
1854 saved_LDFLAGS="$LDFLAGS"
1855 AC_ARG_WITH(ssl-dir,
1856 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1858 if test "x$withval" != "xno" ; then
1861 ./*|../*) withval="`pwd`/$withval"
1863 if test -d "$withval/lib"; then
1864 if test -n "${need_dash_r}"; then
1865 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1867 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1870 if test -n "${need_dash_r}"; then
1871 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1873 LDFLAGS="-L${withval} ${LDFLAGS}"
1876 if test -d "$withval/include"; then
1877 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1879 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1884 if test -z "$GSI_LIBS" ; then
1885 LIBS="-lcrypto $LIBS"
1887 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1888 [Define if your ssl headers are included
1889 with #include <openssl/header.h>]),
1891 dnl Check default openssl install dir
1892 if test -n "${need_dash_r}"; then
1893 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1895 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1897 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1898 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1900 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1906 # Determine OpenSSL header version
1907 AC_MSG_CHECKING([OpenSSL header version])
1912 #include <openssl/opensslv.h>
1913 #define DATA "conftest.sslincver"
1918 fd = fopen(DATA,"w");
1922 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1929 ssl_header_ver=`cat conftest.sslincver`
1930 AC_MSG_RESULT($ssl_header_ver)
1933 AC_MSG_RESULT(not found)
1934 AC_MSG_ERROR(OpenSSL version header not found.)
1937 AC_MSG_WARN([cross compiling: not checking])
1941 # Determine OpenSSL library version
1942 AC_MSG_CHECKING([OpenSSL library version])
1947 #include <openssl/opensslv.h>
1948 #include <openssl/crypto.h>
1949 #define DATA "conftest.ssllibver"
1954 fd = fopen(DATA,"w");
1958 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1965 ssl_library_ver=`cat conftest.ssllibver`
1966 AC_MSG_RESULT($ssl_library_ver)
1969 AC_MSG_RESULT(not found)
1970 AC_MSG_ERROR(OpenSSL library not found.)
1973 AC_MSG_WARN([cross compiling: not checking])
1977 # Sanity check OpenSSL headers
1978 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1982 #include <openssl/opensslv.h>
1983 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1990 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1991 Check config.log for details.
1992 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1995 AC_MSG_WARN([cross compiling: not checking])
1999 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2000 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2004 #include <openssl/evp.h>
2005 int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
2012 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2013 [libcrypto is missing AES 192 and 256 bit functions])
2017 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2018 # because the system crypt() is more featureful.
2019 if test "x$check_for_libcrypt_before" = "x1"; then
2020 AC_CHECK_LIB(crypt, crypt)
2023 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2024 # version in OpenSSL.
2025 if test "x$check_for_libcrypt_later" = "x1"; then
2026 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
2029 AC_CHECK_LIB(iaf, ia_openinfo)
2031 ### Configure cryptographic random number support
2033 # Check wheter OpenSSL seeds itself
2034 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
2038 #include <openssl/rand.h>
2039 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
2042 OPENSSL_SEEDS_ITSELF=yes
2047 # Default to use of the rand helper if OpenSSL doesn't
2052 AC_MSG_WARN([cross compiling: assuming yes])
2053 # This is safe, since all recent OpenSSL versions will
2054 # complain at runtime if not seeded correctly.
2055 OPENSSL_SEEDS_ITSELF=yes
2060 # Do we want to force the use of the rand helper?
2061 AC_ARG_WITH(rand-helper,
2062 [ --with-rand-helper Use subprocess to gather strong randomness ],
2064 if test "x$withval" = "xno" ; then
2065 # Force use of OpenSSL's internal RNG, even if
2066 # the previous test showed it to be unseeded.
2067 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2068 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2069 OPENSSL_SEEDS_ITSELF=yes
2078 # Which randomness source do we use?
2079 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
2081 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2082 [Define if you want OpenSSL's internally seeded PRNG only])
2083 RAND_MSG="OpenSSL internal ONLY"
2084 INSTALL_SSH_RAND_HELPER=""
2085 elif test ! -z "$USE_RAND_HELPER" ; then
2086 # install rand helper
2087 RAND_MSG="ssh-rand-helper"
2088 INSTALL_SSH_RAND_HELPER="yes"
2090 AC_SUBST(INSTALL_SSH_RAND_HELPER)
2092 ### Configuration of ssh-rand-helper
2095 AC_ARG_WITH(prngd-port,
2096 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2105 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2108 if test ! -z "$withval" ; then
2109 PRNGD_PORT="$withval"
2110 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2111 [Port number of PRNGD/EGD random number socket])
2116 # PRNGD Unix domain socket
2117 AC_ARG_WITH(prngd-socket,
2118 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2122 withval="/var/run/egd-pool"
2130 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2134 if test ! -z "$withval" ; then
2135 if test ! -z "$PRNGD_PORT" ; then
2136 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2138 if test ! -r "$withval" ; then
2139 AC_MSG_WARN(Entropy socket is not readable)
2141 PRNGD_SOCKET="$withval"
2142 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2143 [Location of PRNGD/EGD random number socket])
2147 # Check for existing socket only if we don't have a random device already
2148 if test "$USE_RAND_HELPER" = yes ; then
2149 AC_MSG_CHECKING(for PRNGD/EGD socket)
2150 # Insert other locations here
2151 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2152 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2153 PRNGD_SOCKET="$sock"
2154 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2158 if test ! -z "$PRNGD_SOCKET" ; then
2159 AC_MSG_RESULT($PRNGD_SOCKET)
2161 AC_MSG_RESULT(not found)
2167 # Change default command timeout for hashing entropy source
2169 AC_ARG_WITH(entropy-timeout,
2170 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2172 if test -n "$withval" && test "x$withval" != "xno" && \
2173 test "x${withval}" != "xyes"; then
2174 entropy_timeout=$withval
2178 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2179 [Builtin PRNG command timeout])
2181 SSH_PRIVSEP_USER=sshd
2182 AC_ARG_WITH(privsep-user,
2183 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
2185 if test -n "$withval" && test "x$withval" != "xno" && \
2186 test "x${withval}" != "xyes"; then
2187 SSH_PRIVSEP_USER=$withval
2191 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2192 [non-privileged user for privilege separation])
2193 AC_SUBST(SSH_PRIVSEP_USER)
2195 # We do this little dance with the search path to insure
2196 # that programs that we select for use by installed programs
2197 # (which may be run by the super-user) come from trusted
2198 # locations before they come from the user's private area.
2199 # This should help avoid accidentally configuring some
2200 # random version of a program in someone's personal bin.
2204 test -h /bin 2> /dev/null && PATH=/usr/bin
2205 test -d /sbin && PATH=$PATH:/sbin
2206 test -d /usr/sbin && PATH=$PATH:/usr/sbin
2207 PATH=$PATH:/etc:$OPATH
2209 # These programs are used by the command hashing source to gather entropy
2210 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2211 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2212 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2213 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2214 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2215 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2216 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2217 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2218 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2219 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2220 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2221 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2222 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2223 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2224 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2225 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
2229 # Where does ssh-rand-helper get its randomness from?
2230 INSTALL_SSH_PRNG_CMDS=""
2231 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2232 if test ! -z "$PRNGD_PORT" ; then
2233 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2234 elif test ! -z "$PRNGD_SOCKET" ; then
2235 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2237 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2238 RAND_HELPER_CMDHASH=yes
2239 INSTALL_SSH_PRNG_CMDS="yes"
2242 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2245 # Cheap hack to ensure NEWS-OS libraries are arranged right.
2246 if test ! -z "$SONY" ; then
2247 LIBS="$LIBS -liberty";
2250 # Check for long long datatypes
2251 AC_CHECK_TYPES([long long, unsigned long long, long double])
2253 # Check datatype sizes
2254 AC_CHECK_SIZEOF(char, 1)
2255 AC_CHECK_SIZEOF(short int, 2)
2256 AC_CHECK_SIZEOF(int, 4)
2257 AC_CHECK_SIZEOF(long int, 4)
2258 AC_CHECK_SIZEOF(long long int, 8)
2260 # Sanity check long long for some platforms (AIX)
2261 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2262 ac_cv_sizeof_long_long_int=0
2265 # compute LLONG_MIN and LLONG_MAX if we don't know them.
2266 if test -z "$have_llong_max"; then
2267 AC_MSG_CHECKING([for max value of long long])
2271 /* Why is this so damn hard? */
2275 #define __USE_ISOC99
2277 #define DATA "conftest.llminmax"
2280 long long i, llmin, llmax = 0;
2282 if((f = fopen(DATA,"w")) == NULL)
2285 #if defined(LLONG_MIN) && defined(LLONG_MAX)
2286 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2290 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2291 /* This will work on one's complement and two's complement */
2292 for (i = 1; i > llmax; i <<= 1, i++)
2294 llmin = llmax + 1LL; /* wrap */
2298 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2299 || llmax - 1 > llmax) {
2300 fprintf(f, "unknown unknown\n");
2304 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
2311 llong_min=`$AWK '{print $1}' conftest.llminmax`
2312 llong_max=`$AWK '{print $2}' conftest.llminmax`
2314 # snprintf on some Tru64s doesn't understand "%lld"
2317 if test "x$ac_cv_sizeof_long_long_int" = "x8" &&
2318 test "x$llong_max" = "xld"; then
2319 llong_min="-9223372036854775808"
2320 llong_max="9223372036854775807"
2325 AC_MSG_RESULT($llong_max)
2326 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2327 [max value of long long calculated by configure])
2328 AC_MSG_CHECKING([for min value of long long])
2329 AC_MSG_RESULT($llong_min)
2330 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2331 [min value of long long calculated by configure])
2334 AC_MSG_RESULT(not found)
2337 AC_MSG_WARN([cross compiling: not checking])
2343 # More checks for data types
2344 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2346 [ #include <sys/types.h> ],
2348 [ ac_cv_have_u_int="yes" ],
2349 [ ac_cv_have_u_int="no" ]
2352 if test "x$ac_cv_have_u_int" = "xyes" ; then
2353 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
2357 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2359 [ #include <sys/types.h> ],
2360 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2361 [ ac_cv_have_intxx_t="yes" ],
2362 [ ac_cv_have_intxx_t="no" ]
2365 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2366 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
2370 if (test -z "$have_intxx_t" && \
2371 test "x$ac_cv_header_stdint_h" = "xyes")
2373 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2375 [ #include <stdint.h> ],
2376 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2378 AC_DEFINE(HAVE_INTXX_T)
2381 [ AC_MSG_RESULT(no) ]
2385 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2388 #include <sys/types.h>
2389 #ifdef HAVE_STDINT_H
2390 # include <stdint.h>
2392 #include <sys/socket.h>
2393 #ifdef HAVE_SYS_BITYPES_H
2394 # include <sys/bitypes.h>
2397 [ int64_t a; a = 1;],
2398 [ ac_cv_have_int64_t="yes" ],
2399 [ ac_cv_have_int64_t="no" ]
2402 if test "x$ac_cv_have_int64_t" = "xyes" ; then
2403 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
2406 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2408 [ #include <sys/types.h> ],
2409 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2410 [ ac_cv_have_u_intxx_t="yes" ],
2411 [ ac_cv_have_u_intxx_t="no" ]
2414 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2415 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
2419 if test -z "$have_u_intxx_t" ; then
2420 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2422 [ #include <sys/socket.h> ],
2423 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2425 AC_DEFINE(HAVE_U_INTXX_T)
2428 [ AC_MSG_RESULT(no) ]
2432 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2434 [ #include <sys/types.h> ],
2435 [ u_int64_t a; a = 1;],
2436 [ ac_cv_have_u_int64_t="yes" ],
2437 [ ac_cv_have_u_int64_t="no" ]
2440 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2441 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
2445 if test -z "$have_u_int64_t" ; then
2446 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2448 [ #include <sys/bitypes.h> ],
2449 [ u_int64_t a; a = 1],
2451 AC_DEFINE(HAVE_U_INT64_T)
2454 [ AC_MSG_RESULT(no) ]
2458 if test -z "$have_u_intxx_t" ; then
2459 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2462 #include <sys/types.h>
2464 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2465 [ ac_cv_have_uintxx_t="yes" ],
2466 [ ac_cv_have_uintxx_t="no" ]
2469 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2470 AC_DEFINE(HAVE_UINTXX_T, 1,
2471 [define if you have uintxx_t data type])
2475 if test -z "$have_uintxx_t" ; then
2476 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2478 [ #include <stdint.h> ],
2479 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2481 AC_DEFINE(HAVE_UINTXX_T)
2484 [ AC_MSG_RESULT(no) ]
2488 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2489 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2491 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2494 #include <sys/bitypes.h>
2497 int8_t a; int16_t b; int32_t c;
2498 u_int8_t e; u_int16_t f; u_int32_t g;
2499 a = b = c = e = f = g = 1;
2502 AC_DEFINE(HAVE_U_INTXX_T)
2503 AC_DEFINE(HAVE_INTXX_T)
2511 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2514 #include <sys/types.h>
2516 [ u_char foo; foo = 125; ],
2517 [ ac_cv_have_u_char="yes" ],
2518 [ ac_cv_have_u_char="no" ]
2521 if test "x$ac_cv_have_u_char" = "xyes" ; then
2522 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
2527 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2529 AC_CHECK_TYPES(in_addr_t,,,
2530 [#include <sys/types.h>
2531 #include <netinet/in.h>])
2533 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2536 #include <sys/types.h>
2538 [ size_t foo; foo = 1235; ],
2539 [ ac_cv_have_size_t="yes" ],
2540 [ ac_cv_have_size_t="no" ]
2543 if test "x$ac_cv_have_size_t" = "xyes" ; then
2544 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
2547 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2550 #include <sys/types.h>
2552 [ ssize_t foo; foo = 1235; ],
2553 [ ac_cv_have_ssize_t="yes" ],
2554 [ ac_cv_have_ssize_t="no" ]
2557 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2558 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
2561 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2566 [ clock_t foo; foo = 1235; ],
2567 [ ac_cv_have_clock_t="yes" ],
2568 [ ac_cv_have_clock_t="no" ]
2571 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2572 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
2575 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2578 #include <sys/types.h>
2579 #include <sys/socket.h>
2581 [ sa_family_t foo; foo = 1235; ],
2582 [ ac_cv_have_sa_family_t="yes" ],
2585 #include <sys/types.h>
2586 #include <sys/socket.h>
2587 #include <netinet/in.h>
2589 [ sa_family_t foo; foo = 1235; ],
2590 [ ac_cv_have_sa_family_t="yes" ],
2592 [ ac_cv_have_sa_family_t="no" ]
2596 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2597 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2598 [define if you have sa_family_t data type])
2601 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2604 #include <sys/types.h>
2606 [ pid_t foo; foo = 1235; ],
2607 [ ac_cv_have_pid_t="yes" ],
2608 [ ac_cv_have_pid_t="no" ]
2611 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2612 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
2615 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2618 #include <sys/types.h>
2620 [ mode_t foo; foo = 1235; ],
2621 [ ac_cv_have_mode_t="yes" ],
2622 [ ac_cv_have_mode_t="no" ]
2625 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2626 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
2630 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2633 #include <sys/types.h>
2634 #include <sys/socket.h>
2636 [ struct sockaddr_storage s; ],
2637 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2638 [ ac_cv_have_struct_sockaddr_storage="no" ]
2641 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2642 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2643 [define if you have struct sockaddr_storage data type])
2646 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2649 #include <sys/types.h>
2650 #include <netinet/in.h>
2652 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2653 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2654 [ ac_cv_have_struct_sockaddr_in6="no" ]
2657 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2658 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2659 [define if you have struct sockaddr_in6 data type])
2662 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2665 #include <sys/types.h>
2666 #include <netinet/in.h>
2668 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2669 [ ac_cv_have_struct_in6_addr="yes" ],
2670 [ ac_cv_have_struct_in6_addr="no" ]
2673 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2674 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2675 [define if you have struct in6_addr data type])
2678 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2681 #include <sys/types.h>
2682 #include <sys/socket.h>
2685 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2686 [ ac_cv_have_struct_addrinfo="yes" ],
2687 [ ac_cv_have_struct_addrinfo="no" ]
2690 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2691 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2692 [define if you have struct addrinfo data type])
2695 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2697 [ #include <sys/time.h> ],
2698 [ struct timeval tv; tv.tv_sec = 1;],
2699 [ ac_cv_have_struct_timeval="yes" ],
2700 [ ac_cv_have_struct_timeval="no" ]
2703 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2704 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
2705 have_struct_timeval=1
2708 AC_CHECK_TYPES(struct timespec)
2710 # We need int64_t or else certian parts of the compile will fail.
2711 if test "x$ac_cv_have_int64_t" = "xno" && \
2712 test "x$ac_cv_sizeof_long_int" != "x8" && \
2713 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2714 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2715 echo "an alternative compiler (I.E., GCC) before continuing."
2719 dnl test snprintf (broken on SCO w/gcc)
2724 #ifdef HAVE_SNPRINTF
2728 char expected_out[50];
2730 #if (SIZEOF_LONG_INT == 8)
2731 long int num = 0x7fffffffffffffff;
2733 long long num = 0x7fffffffffffffffll;
2735 strcpy(expected_out, "9223372036854775807");
2736 snprintf(buf, mazsize, "%lld", num);
2737 if(strcmp(buf, expected_out) != 0)
2744 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2745 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2749 dnl Checks for structure members
2750 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2751 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2752 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2753 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2754 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2755 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2756 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2757 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2758 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2759 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2760 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2761 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2762 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2763 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2764 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2765 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2766 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2768 AC_CHECK_MEMBERS([struct stat.st_blksize])
2769 AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2770 [Define if we don't have struct __res_state in resolv.h])],
2773 #if HAVE_SYS_TYPES_H
2774 # include <sys/types.h>
2776 #include <netinet/in.h>
2777 #include <arpa/nameser.h>
2781 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2782 ac_cv_have_ss_family_in_struct_ss, [
2785 #include <sys/types.h>
2786 #include <sys/socket.h>
2788 [ struct sockaddr_storage s; s.ss_family = 1; ],
2789 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2790 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2793 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2794 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
2797 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2798 ac_cv_have___ss_family_in_struct_ss, [
2801 #include <sys/types.h>
2802 #include <sys/socket.h>
2804 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2805 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2806 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2809 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2810 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2811 [Fields in struct sockaddr_storage])
2814 AC_CACHE_CHECK([for pw_class field in struct passwd],
2815 ac_cv_have_pw_class_in_struct_passwd, [
2820 [ struct passwd p; p.pw_class = 0; ],
2821 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2822 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2825 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2826 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2827 [Define if your password has a pw_class field])
2830 AC_CACHE_CHECK([for pw_expire field in struct passwd],
2831 ac_cv_have_pw_expire_in_struct_passwd, [
2836 [ struct passwd p; p.pw_expire = 0; ],
2837 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2838 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2841 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2842 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2843 [Define if your password has a pw_expire field])
2846 AC_CACHE_CHECK([for pw_change field in struct passwd],
2847 ac_cv_have_pw_change_in_struct_passwd, [
2852 [ struct passwd p; p.pw_change = 0; ],
2853 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2854 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2857 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2858 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2859 [Define if your password has a pw_change field])
2862 dnl make sure we're using the real structure members and not defines
2863 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2864 ac_cv_have_accrights_in_msghdr, [
2867 #include <sys/types.h>
2868 #include <sys/socket.h>
2869 #include <sys/uio.h>
2871 #ifdef msg_accrights
2872 #error "msg_accrights is a macro"
2876 m.msg_accrights = 0;
2880 [ ac_cv_have_accrights_in_msghdr="yes" ],
2881 [ ac_cv_have_accrights_in_msghdr="no" ]
2884 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2885 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2886 [Define if your system uses access rights style
2887 file descriptor passing])
2890 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2891 ac_cv_have_control_in_msghdr, [
2894 #include <sys/types.h>
2895 #include <sys/socket.h>
2896 #include <sys/uio.h>
2899 #error "msg_control is a macro"
2907 [ ac_cv_have_control_in_msghdr="yes" ],
2908 [ ac_cv_have_control_in_msghdr="no" ]
2911 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2912 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2913 [Define if your system uses ancillary data style
2914 file descriptor passing])
2917 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2919 [ extern char *__progname; printf("%s", __progname); ],
2920 [ ac_cv_libc_defines___progname="yes" ],
2921 [ ac_cv_libc_defines___progname="no" ]
2924 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2925 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
2928 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2932 [ printf("%s", __FUNCTION__); ],
2933 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2934 [ ac_cv_cc_implements___FUNCTION__="no" ]
2937 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2938 AC_DEFINE(HAVE___FUNCTION__, 1,
2939 [Define if compiler implements __FUNCTION__])
2942 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2946 [ printf("%s", __func__); ],
2947 [ ac_cv_cc_implements___func__="yes" ],
2948 [ ac_cv_cc_implements___func__="no" ]
2951 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2952 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
2955 AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
2957 [#include <stdarg.h>
2960 [ ac_cv_have_va_copy="yes" ],
2961 [ ac_cv_have_va_copy="no" ]
2964 if test "x$ac_cv_have_va_copy" = "xyes" ; then
2965 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
2968 AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
2970 [#include <stdarg.h>
2973 [ ac_cv_have___va_copy="yes" ],
2974 [ ac_cv_have___va_copy="no" ]
2977 if test "x$ac_cv_have___va_copy" = "xyes" ; then
2978 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
2981 AC_CACHE_CHECK([whether getopt has optreset support],
2982 ac_cv_have_getopt_optreset, [
2987 [ extern int optreset; optreset = 0; ],
2988 [ ac_cv_have_getopt_optreset="yes" ],
2989 [ ac_cv_have_getopt_optreset="no" ]
2992 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2993 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2994 [Define if your getopt(3) defines and uses optreset])
2997 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2999 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
3000 [ ac_cv_libc_defines_sys_errlist="yes" ],
3001 [ ac_cv_libc_defines_sys_errlist="no" ]
3004 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
3005 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3006 [Define if your system defines sys_errlist[]])
3010 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
3012 [ extern int sys_nerr; printf("%i", sys_nerr);],
3013 [ ac_cv_libc_defines_sys_nerr="yes" ],
3014 [ ac_cv_libc_defines_sys_nerr="no" ]
3017 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
3018 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
3022 # Check whether user wants sectok support
3024 [ --with-sectok Enable smartcard support using libsectok],
3026 if test "x$withval" != "xno" ; then
3027 if test "x$withval" != "xyes" ; then
3028 CPPFLAGS="$CPPFLAGS -I${withval}"
3029 LDFLAGS="$LDFLAGS -L${withval}"
3030 if test ! -z "$need_dash_r" ; then
3031 LDFLAGS="$LDFLAGS -R${withval}"
3033 if test ! -z "$blibpath" ; then
3034 blibpath="$blibpath:${withval}"
3037 AC_CHECK_HEADERS(sectok.h)
3038 if test "$ac_cv_header_sectok_h" != yes; then
3039 AC_MSG_ERROR(Can't find sectok.h)
3041 AC_CHECK_LIB(sectok, sectok_open)
3042 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3043 AC_MSG_ERROR(Can't find libsectok)
3045 AC_DEFINE(SMARTCARD, 1,
3046 [Define if you want smartcard support])
3047 AC_DEFINE(USE_SECTOK, 1,
3048 [Define if you want smartcard support
3050 SCARD_MSG="yes, using sectok"
3055 # Check whether user wants OpenSC support
3058 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
3060 if test "x$withval" != "xno" ; then
3061 if test "x$withval" != "xyes" ; then
3062 OPENSC_CONFIG=$withval/bin/opensc-config
3064 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3066 if test "$OPENSC_CONFIG" != "no"; then
3067 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3068 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3069 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
3070 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
3071 AC_DEFINE(SMARTCARD)
3072 AC_DEFINE(USE_OPENSC, 1,
3073 [Define if you want smartcard support
3075 SCARD_MSG="yes, using OpenSC"
3081 # Check libraries needed by DNS fingerprint support
3082 AC_SEARCH_LIBS(getrrsetbyname, resolv,
3083 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3084 [Define if getrrsetbyname() exists])],
3086 # Needed by our getrrsetbyname()
3087 AC_SEARCH_LIBS(res_query, resolv)
3088 AC_SEARCH_LIBS(dn_expand, resolv)
3089 AC_MSG_CHECKING(if res_query will link)
3090 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
3093 LIBS="$LIBS -lresolv"
3094 AC_MSG_CHECKING(for res_query in -lresolv)
3099 res_query (0, 0, 0, 0, 0);
3103 [LIBS="$LIBS -lresolv"
3104 AC_MSG_RESULT(yes)],
3108 AC_CHECK_FUNCS(_getshort _getlong)
3109 AC_CHECK_DECLS([_getshort, _getlong], , ,
3110 [#include <sys/types.h>
3111 #include <arpa/nameser.h>])
3112 AC_CHECK_MEMBER(HEADER.ad,
3113 [AC_DEFINE(HAVE_HEADER_AD, 1,
3114 [Define if HEADER.ad exists in arpa/nameser.h])],,
3115 [#include <arpa/nameser.h>])
3118 # Check whether user wants Kerberos 5 support
3120 AC_ARG_WITH(kerberos5,
3121 [ --with-kerberos5=PATH Enable Kerberos 5 support],
3122 [ if test "x$withval" != "xno" ; then
3123 if test "x$withval" = "xyes" ; then
3124 KRB5ROOT="/usr/local"
3129 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
3132 AC_MSG_CHECKING(for krb5-config)
3133 if test -x $KRB5ROOT/bin/krb5-config ; then
3134 KRB5CONF=$KRB5ROOT/bin/krb5-config
3135 AC_MSG_RESULT($KRB5CONF)
3137 AC_MSG_CHECKING(for gssapi support)
3138 if $KRB5CONF | grep gssapi >/dev/null ; then
3140 AC_DEFINE(GSSAPI, 1,
3141 [Define this if you want GSSAPI
3142 support in the version 2 protocol])
3148 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3149 K5LIBS="`$KRB5CONF --libs $k5confopts`"
3150 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
3151 AC_MSG_CHECKING(whether we are using Heimdal)
3152 AC_TRY_COMPILE([ #include <krb5.h> ],
3153 [ char *tmp = heimdal_version; ],
3154 [ AC_MSG_RESULT(yes)
3155 AC_DEFINE(HEIMDAL, 1,
3156 [Define this if you are using the
3157 Heimdal version of Kerberos V5]) ],
3162 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
3163 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
3164 AC_MSG_CHECKING(whether we are using Heimdal)
3165 AC_TRY_COMPILE([ #include <krb5.h> ],
3166 [ char *tmp = heimdal_version; ],
3167 [ AC_MSG_RESULT(yes)
3169 K5LIBS="-lkrb5 -ldes"
3170 K5LIBS="$K5LIBS -lcom_err -lasn1"
3171 AC_CHECK_LIB(roken, net_write,
3172 [K5LIBS="$K5LIBS -lroken"])
3175 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3178 AC_SEARCH_LIBS(dn_expand, resolv)
3180 AC_CHECK_LIB(gssapi,gss_init_sec_context,
3182 K5LIBS="-lgssapi $K5LIBS" ],
3183 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3185 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
3186 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3191 AC_CHECK_HEADER(gssapi.h, ,
3192 [ unset ac_cv_header_gssapi_h
3193 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3194 AC_CHECK_HEADERS(gssapi.h, ,
3195 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
3201 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3202 AC_CHECK_HEADER(gssapi_krb5.h, ,
3203 [ CPPFLAGS="$oldCPP" ])
3205 # If we're using some other GSSAPI
3206 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
3207 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
3210 if test -z "$GSSAPI"; then
3215 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3216 AC_CHECK_HEADER(gssapi_krb5.h, ,
3217 [ CPPFLAGS="$oldCPP" ])
3220 if test ! -z "$need_dash_r" ; then
3221 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3223 if test ! -z "$blibpath" ; then
3224 blibpath="$blibpath:${KRB5ROOT}/lib"
3227 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3228 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3229 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3231 LIBS="$LIBS $K5LIBS"
3232 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3233 [Define this if you want to use libkafs' AFS support]))
3238 # Check whether user wants AFS_KRB5 support
3240 AC_ARG_WITH(afs-krb5,
3241 [ --with-afs-krb5[[=AKLOG_PATH]] Enable aklog to get token (default=/usr/bin/aklog).],
3243 if test "x$withval" != "xno" ; then
3245 if test "x$withval" != "xyes" ; then
3246 AC_DEFINE_UNQUOTED(AKLOG_PATH, "$withval",
3247 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3249 AC_DEFINE_UNQUOTED(AKLOG_PATH,
3251 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3254 if test -z "$KRB5ROOT" ; then
3255 AC_MSG_WARN([AFS_KRB5 requires Kerberos 5 support, build may fail])
3258 LIBS="-lkrbafs -lkrb4 $LIBS"
3259 if test ! -z "$AFS_LIBS" ; then
3260 LIBS="$LIBS $AFS_LIBS"
3262 AC_DEFINE(AFS_KRB5, 1,
3263 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3269 AC_ARG_WITH(session-hooks,
3270 [ --with-session-hooks Enable hooks for executing external commands before/after a session],
3271 [ AC_DEFINE(SESSION_HOOKS, 1, [Define this if you want support for startup/shutdown hooks]) ]
3274 # Looking for programs, paths and files
3276 PRIVSEP_PATH=/var/empty
3277 AC_ARG_WITH(privsep-path,
3278 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
3280 if test -n "$withval" && test "x$withval" != "xno" && \
3281 test "x${withval}" != "xyes"; then
3282 PRIVSEP_PATH=$withval
3286 AC_SUBST(PRIVSEP_PATH)
3289 [ --with-xauth=PATH Specify path to xauth program ],
3291 if test -n "$withval" && test "x$withval" != "xno" && \
3292 test "x${withval}" != "xyes"; then
3298 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3299 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3300 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3301 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3302 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
3303 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
3304 xauth_path="/usr/openwin/bin/xauth"
3310 AC_ARG_ENABLE(strip,
3311 [ --disable-strip Disable calling strip(1) on install],
3313 if test "x$enableval" = "xno" ; then
3320 if test -z "$xauth_path" ; then
3321 XAUTH_PATH="undefined"
3322 AC_SUBST(XAUTH_PATH)
3324 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3325 [Define if xauth is found in your path])
3326 XAUTH_PATH=$xauth_path
3327 AC_SUBST(XAUTH_PATH)
3330 # Check for mail directory (last resort if we cannot get it from headers)
3331 if test ! -z "$MAIL" ; then
3332 maildir=`dirname $MAIL`
3333 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3334 [Set this to your mail directory if you don't have maillock.h])
3337 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
3338 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3339 disable_ptmx_check=yes
3341 if test -z "$no_dev_ptmx" ; then
3342 if test "x$disable_ptmx_check" != "xyes" ; then
3343 AC_CHECK_FILE("/dev/ptmx",
3345 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3346 [Define if you have /dev/ptmx])
3353 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
3354 AC_CHECK_FILE("/dev/ptc",
3356 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3357 [Define if you have /dev/ptc])
3362 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3365 # Options from here on. Some of these are preset by platform above
3366 AC_ARG_WITH(mantype,
3367 [ --with-mantype=man|cat|doc Set man page type],
3374 AC_MSG_ERROR(invalid man type: $withval)
3379 if test -z "$MANTYPE"; then
3380 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3381 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
3382 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3384 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3391 if test "$MANTYPE" = "doc"; then
3398 # Check whether to enable MD5 passwords
3400 AC_ARG_WITH(md5-passwords,
3401 [ --with-md5-passwords Enable use of MD5 passwords],
3403 if test "x$withval" != "xno" ; then
3404 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3405 [Define if you want to allow MD5 passwords])
3411 # Whether to disable shadow password support
3413 [ --without-shadow Disable shadow password support],
3415 if test "x$withval" = "xno" ; then
3416 AC_DEFINE(DISABLE_SHADOW)
3422 if test -z "$disable_shadow" ; then
3423 AC_MSG_CHECKING([if the systems has expire shadow information])
3426 #include <sys/types.h>
3429 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3430 [ sp_expire_available=yes ], []
3433 if test "x$sp_expire_available" = "xyes" ; then
3435 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3436 [Define if you want to use shadow password expire field])
3442 # Use ip address instead of hostname in $DISPLAY
3443 if test ! -z "$IPADDR_IN_DISPLAY" ; then
3444 DISPLAY_HACK_MSG="yes"
3445 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3446 [Define if you need to use IP address
3447 instead of hostname in $DISPLAY])
3449 DISPLAY_HACK_MSG="no"
3450 AC_ARG_WITH(ipaddr-display,
3451 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3453 if test "x$withval" != "xno" ; then
3454 AC_DEFINE(IPADDR_IN_DISPLAY)
3455 DISPLAY_HACK_MSG="yes"
3461 # check for /etc/default/login and use it if present.
3462 AC_ARG_ENABLE(etc-default-login,
3463 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3464 [ if test "x$enableval" = "xno"; then
3465 AC_MSG_NOTICE([/etc/default/login handling disabled])
3466 etc_default_login=no
3468 etc_default_login=yes
3470 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3472 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3473 etc_default_login=no
3475 etc_default_login=yes
3479 if test "x$etc_default_login" != "xno"; then
3480 AC_CHECK_FILE("/etc/default/login",
3481 [ external_path_file=/etc/default/login ])
3482 if test "x$external_path_file" = "x/etc/default/login"; then
3483 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3484 [Define if your system has /etc/default/login])
3488 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3489 if test $ac_cv_func_login_getcapbool = "yes" && \
3490 test $ac_cv_header_login_cap_h = "yes" ; then
3491 external_path_file=/etc/login.conf
3494 # Whether to mess with the default path
3495 SERVER_PATH_MSG="(default)"
3496 AC_ARG_WITH(default-path,
3497 [ --with-default-path= Specify default \$PATH environment for server],
3499 if test "x$external_path_file" = "x/etc/login.conf" ; then
3501 --with-default-path=PATH has no effect on this system.
3502 Edit /etc/login.conf instead.])
3503 elif test "x$withval" != "xno" ; then
3504 if test ! -z "$external_path_file" ; then
3506 --with-default-path=PATH will only be used if PATH is not defined in
3507 $external_path_file .])
3509 user_path="$withval"
3510 SERVER_PATH_MSG="$withval"
3513 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3514 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3516 if test ! -z "$external_path_file" ; then
3518 If PATH is defined in $external_path_file, ensure the path to scp is included,
3519 otherwise scp will not work.])
3523 /* find out what STDPATH is */
3528 #ifndef _PATH_STDPATH
3529 # ifdef _PATH_USERPATH /* Irix */
3530 # define _PATH_STDPATH _PATH_USERPATH
3532 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3535 #include <sys/types.h>
3536 #include <sys/stat.h>
3538 #define DATA "conftest.stdpath"
3545 fd = fopen(DATA,"w");
3549 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3555 [ user_path=`cat conftest.stdpath` ],
3556 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3557 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3559 # make sure $bindir is in USER_PATH so scp will work
3560 t_bindir=`eval echo ${bindir}`
3562 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3565 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3567 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3568 if test $? -ne 0 ; then
3569 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3570 if test $? -ne 0 ; then
3571 user_path=$user_path:$t_bindir
3572 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3577 if test "x$external_path_file" != "x/etc/login.conf" ; then
3578 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
3582 # Set superuser path separately to user path
3583 AC_ARG_WITH(superuser-path,
3584 [ --with-superuser-path= Specify different path for super-user],
3586 if test -n "$withval" && test "x$withval" != "xno" && \
3587 test "x${withval}" != "xyes"; then
3588 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3589 [Define if you want a different $PATH
3591 superuser_path=$withval
3597 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3598 IPV4_IN6_HACK_MSG="no"
3600 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3602 if test "x$withval" != "xno" ; then
3604 AC_DEFINE(IPV4_IN_IPV6, 1,
3605 [Detect IPv4 in IPv6 mapped addresses
3607 IPV4_IN6_HACK_MSG="yes"
3612 if test "x$inet6_default_4in6" = "xyes"; then
3613 AC_MSG_RESULT([yes (default)])
3614 AC_DEFINE(IPV4_IN_IPV6)
3615 IPV4_IN6_HACK_MSG="yes"
3617 AC_MSG_RESULT([no (default)])
3622 # Whether to enable BSD auth support
3624 AC_ARG_WITH(bsd-auth,
3625 [ --with-bsd-auth Enable BSD auth support],
3627 if test "x$withval" != "xno" ; then
3628 AC_DEFINE(BSD_AUTH, 1,
3629 [Define if you have BSD auth support])
3635 # Where to place sshd.pid
3637 # make sure the directory exists
3638 if test ! -d $piddir ; then
3639 piddir=`eval echo ${sysconfdir}`
3641 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3645 AC_ARG_WITH(pid-dir,
3646 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3648 if test -n "$withval" && test "x$withval" != "xno" && \
3649 test "x${withval}" != "xyes"; then
3651 if test ! -d $piddir ; then
3652 AC_MSG_WARN([** no $piddir directory on this system **])
3658 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
3661 dnl allow user to disable some login recording features
3662 AC_ARG_ENABLE(lastlog,
3663 [ --disable-lastlog disable use of lastlog even if detected [no]],
3665 if test "x$enableval" = "xno" ; then
3666 AC_DEFINE(DISABLE_LASTLOG)
3671 [ --disable-utmp disable use of utmp even if detected [no]],
3673 if test "x$enableval" = "xno" ; then
3674 AC_DEFINE(DISABLE_UTMP)
3678 AC_ARG_ENABLE(utmpx,
3679 [ --disable-utmpx disable use of utmpx even if detected [no]],
3681 if test "x$enableval" = "xno" ; then
3682 AC_DEFINE(DISABLE_UTMPX, 1,
3683 [Define if you don't want to use utmpx])
3688 [ --disable-wtmp disable use of wtmp even if detected [no]],
3690 if test "x$enableval" = "xno" ; then
3691 AC_DEFINE(DISABLE_WTMP)
3695 AC_ARG_ENABLE(wtmpx,
3696 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
3698 if test "x$enableval" = "xno" ; then
3699 AC_DEFINE(DISABLE_WTMPX, 1,
3700 [Define if you don't want to use wtmpx])
3704 AC_ARG_ENABLE(libutil,
3705 [ --disable-libutil disable use of libutil (login() etc.) [no]],
3707 if test "x$enableval" = "xno" ; then
3708 AC_DEFINE(DISABLE_LOGIN)
3712 AC_ARG_ENABLE(pututline,
3713 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
3715 if test "x$enableval" = "xno" ; then
3716 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3717 [Define if you don't want to use pututline()
3718 etc. to write [uw]tmp])
3722 AC_ARG_ENABLE(pututxline,
3723 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
3725 if test "x$enableval" = "xno" ; then
3726 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3727 [Define if you don't want to use pututxline()
3728 etc. to write [uw]tmpx])
3732 AC_ARG_WITH(lastlog,
3733 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
3735 if test "x$withval" = "xno" ; then
3736 AC_DEFINE(DISABLE_LASTLOG)
3737 elif test -n "$withval" && test "x${withval}" != "xyes"; then
3738 conf_lastlog_location=$withval
3743 dnl lastlog, [uw]tmpx? detection
3744 dnl NOTE: set the paths in the platform section to avoid the
3745 dnl need for command-line parameters
3746 dnl lastlog and [uw]tmp are subject to a file search if all else fails
3748 dnl lastlog detection
3749 dnl NOTE: the code itself will detect if lastlog is a directory
3750 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3752 #include <sys/types.h>
3754 #ifdef HAVE_LASTLOG_H
3755 # include <lastlog.h>
3764 [ char *lastlog = LASTLOG_FILE; ],
3765 [ AC_MSG_RESULT(yes) ],
3768 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3770 #include <sys/types.h>
3772 #ifdef HAVE_LASTLOG_H
3773 # include <lastlog.h>
3779 [ char *lastlog = _PATH_LASTLOG; ],
3780 [ AC_MSG_RESULT(yes) ],
3783 system_lastlog_path=no
3788 if test -z "$conf_lastlog_location"; then
3789 if test x"$system_lastlog_path" = x"no" ; then
3790 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3791 if (test -d "$f" || test -f "$f") ; then
3792 conf_lastlog_location=$f
3795 if test -z "$conf_lastlog_location"; then
3796 AC_MSG_WARN([** Cannot find lastlog **])
3797 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
3802 if test -n "$conf_lastlog_location"; then
3803 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3804 [Define if you want to specify the path to your lastlog file])
3808 AC_MSG_CHECKING([if your system defines UTMP_FILE])
3810 #include <sys/types.h>
3816 [ char *utmp = UTMP_FILE; ],
3817 [ AC_MSG_RESULT(yes) ],
3819 system_utmp_path=no ]
3821 if test -z "$conf_utmp_location"; then
3822 if test x"$system_utmp_path" = x"no" ; then
3823 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3824 if test -f $f ; then
3825 conf_utmp_location=$f
3828 if test -z "$conf_utmp_location"; then
3829 AC_DEFINE(DISABLE_UTMP)
3833 if test -n "$conf_utmp_location"; then
3834 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3835 [Define if you want to specify the path to your utmp file])
3839 AC_MSG_CHECKING([if your system defines WTMP_FILE])
3841 #include <sys/types.h>
3847 [ char *wtmp = WTMP_FILE; ],
3848 [ AC_MSG_RESULT(yes) ],
3850 system_wtmp_path=no ]
3852 if test -z "$conf_wtmp_location"; then
3853 if test x"$system_wtmp_path" = x"no" ; then
3854 for f in /usr/adm/wtmp /var/log/wtmp; do
3855 if test -f $f ; then
3856 conf_wtmp_location=$f
3859 if test -z "$conf_wtmp_location"; then
3860 AC_DEFINE(DISABLE_WTMP)
3864 if test -n "$conf_wtmp_location"; then
3865 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3866 [Define if you want to specify the path to your wtmp file])
3870 dnl utmpx detection - I don't know any system so perverse as to require
3871 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3873 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3875 #include <sys/types.h>
3884 [ char *utmpx = UTMPX_FILE; ],
3885 [ AC_MSG_RESULT(yes) ],
3887 system_utmpx_path=no ]
3889 if test -z "$conf_utmpx_location"; then
3890 if test x"$system_utmpx_path" = x"no" ; then
3891 AC_DEFINE(DISABLE_UTMPX)
3894 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3895 [Define if you want to specify the path to your utmpx file])
3899 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3901 #include <sys/types.h>
3910 [ char *wtmpx = WTMPX_FILE; ],
3911 [ AC_MSG_RESULT(yes) ],
3913 system_wtmpx_path=no ]
3915 if test -z "$conf_wtmpx_location"; then
3916 if test x"$system_wtmpx_path" = x"no" ; then
3917 AC_DEFINE(DISABLE_WTMPX)
3920 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3921 [Define if you want to specify the path to your wtmpx file])
3925 if test ! -z "$blibpath" ; then
3926 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3927 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3930 dnl remove pam and dl because they are in $LIBPAM
3931 if test "$PAM_MSG" = yes ; then
3932 LIBS=`echo $LIBS | sed 's/-lpam //'`
3934 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3935 LIBS=`echo $LIBS | sed 's/-ldl //'`
3938 dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3940 CFLAGS="$CFLAGS $werror_flags"
3943 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3944 scard/Makefile ssh_prng_cmds survey.sh])
3947 # Print summary of options
3949 # Someone please show me a better way :)
3950 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3951 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3952 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3953 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3954 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3955 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3956 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
3957 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3958 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3959 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3962 echo "OpenSSH has been configured with the following options:"
3963 echo " User binaries: $B"
3964 echo " System binaries: $C"
3965 echo " Configuration files: $D"
3966 echo " Askpass program: $E"
3967 echo " Manual pages: $F"
3968 echo " PID file: $G"
3969 echo " Privilege separation chroot path: $H"
3970 if test "x$external_path_file" = "x/etc/login.conf" ; then
3971 echo " At runtime, sshd will use the path defined in $external_path_file"
3972 echo " Make sure the path to scp is present, otherwise scp will not work"
3974 echo " sshd default user PATH: $I"
3975 if test ! -z "$external_path_file"; then
3976 echo " (If PATH is set in $external_path_file it will be used instead. If"
3977 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3980 if test ! -z "$superuser_path" ; then
3981 echo " sshd superuser user PATH: $J"
3983 echo " Manpage format: $MANTYPE"
3984 echo " PAM support: $PAM_MSG"
3985 echo " KerberosV support: $KRB5_MSG"
3986 echo " Smartcard support: $SCARD_MSG"
3987 echo " S/KEY support: $SKEY_MSG"
3988 echo " TCP Wrappers support: $TCPW_MSG"
3989 echo " MD5 password support: $MD5_MSG"
3990 echo " libedit support: $LIBEDIT_MSG"
3991 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
3992 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3993 echo " BSD Auth support: $BSD_AUTH_MSG"
3994 echo " Random number source: $RAND_MSG"
3995 if test ! -z "$USE_RAND_HELPER" ; then
3996 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
4001 echo " Host: ${host}"
4002 echo " Compiler: ${CC}"
4003 echo " Compiler flags: ${CFLAGS}"
4004 echo "Preprocessor flags: ${CPPFLAGS}"
4005 echo " Linker flags: ${LDFLAGS}"
4006 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
4010 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
4011 echo "SVR4 style packages are supported with \"make package\""
4015 if test "x$PAM_MSG" = "xyes" ; then
4016 echo "PAM is enabled. You may need to install a PAM control file "
4017 echo "for sshd, otherwise password authentication may fail. "
4018 echo "Example PAM control files can be found in the contrib/ "
4023 if test ! -z "$RAND_HELPER_CMDHASH" ; then
4024 echo "WARNING: you are using the builtin random number collection "
4025 echo "service. Please read WARNING.RNG and request that your OS "
4026 echo "vendor includes kernel-based random number collection in "
4027 echo "future versions of your OS."
4031 if test ! -z "$NO_PEERCHECK" ; then
4032 echo "WARNING: the operating system that you are using does not "
4033 echo "appear to support either the getpeereid() API nor the "
4034 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
4035 echo "enforce security checks to prevent unauthorised connections to "
4036 echo "ssh-agent. Their absence increases the risk that a malicious "
4037 echo "user can connect to your agent. "
4041 if test "$AUDIT_MODULE" = "bsm" ; then
4042 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4043 echo "See the Solaris section in README.platform for details."