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],
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)
1076 AC_MSG_CHECKING(for Globus include path)
1077 GLOBUS_INCLUDE="${gsi_path}/include/${globus_flavor_type}"
1078 if test ! -d "$GLOBUS_INCLUDE" ; then
1079 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_INCLUDE})
1081 GSI_CPPFLAGS="-I${GLOBUS_INCLUDE}"
1085 # Find GPT linkline helper
1088 AC_MSG_CHECKING(for GPT linkline helper)
1089 if test -x $GPT_LOCATION/sbin/gpt_build_config ; then
1090 gpt_linkline_helper="$GPT_LOCATION/sbin/gpt_build_config"
1091 elif test -x ${gsi_path}/sbin/gpt_build_config ; then
1092 gpt_linkline_helper="${gsi_path}/sbin/gpt_build_config"
1094 AC_MSG_ERROR(Cannot find gpt_build_config: GPT installation is incomplete)
1099 # Build Globus linkline
1102 if test -n "${gsi_static}"; then
1103 ${gpt_linkline_helper} -f ${globus_flavor_type} -link static -src pkg_data_src.gpt
1105 ${gpt_linkline_helper} -f ${globus_flavor_type} -link shared -src pkg_data_src.gpt
1107 . ./gpt_build_temp.sh
1108 if test -n "${need_dash_r}"; then
1109 GSI_LDFLAGS="-L${gsi_path}/lib -R{gsi_path}/lib"
1111 GSI_LDFLAGS="-L${gsi_path}/lib"
1113 GSI_LIBS="$GPT_CONFIG_PGM_LINKS"
1114 LD_LIBRARY_PATH="${gsi_path}/lib:$LD_LIBRARY_PATH"; export LD_LIBRARY_PATH
1117 # Test Globus linkline
1120 AC_MSG_CHECKING(for Globus linkline)
1121 if test -z "$GSI_LIBS" ; then
1122 AC_MSG_ERROR(gpt_build_config failed)
1126 AC_DEFINE(HAVE_GSSAPI_H)
1128 LIBS="$LIBS $GSI_LIBS"
1129 LDFLAGS="$LDFLAGS $GSI_LDFLAGS"
1130 CPPFLAGS="$CPPFLAGS $GSI_CPPFLAGS"
1132 AC_MSG_CHECKING(that Globus linkline works)
1133 # test that we got the libraries OK
1141 AC_MSG_ERROR(link with Globus libraries failed)
1144 AC_CHECK_FUNCS(globus_gss_assist_map_and_authorize)
1145 INSTALL_GSISSH="yes"
1149 # End Globus/GSI section
1151 AC_MSG_CHECKING([for /proc/pid/fd directory])
1152 if test -d "/proc/$$/fd" ; then
1153 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
1159 # Check whether user wants S/Key support
1162 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
1164 if test "x$withval" != "xno" ; then
1166 if test "x$withval" != "xyes" ; then
1167 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1168 LDFLAGS="$LDFLAGS -L${withval}/lib"
1171 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
1175 AC_MSG_CHECKING([for s/key support])
1180 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
1182 [AC_MSG_RESULT(yes)],
1185 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1187 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1191 [(void)skeychallenge(NULL,"name","",0);],
1193 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1194 [Define if your skeychallenge()
1195 function takes 4 arguments (NetBSD)])],
1202 # Check whether user wants TCP wrappers support
1204 AC_ARG_WITH(tcp-wrappers,
1205 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
1207 if test "x$withval" != "xno" ; then
1209 saved_LDFLAGS="$LDFLAGS"
1210 saved_CPPFLAGS="$CPPFLAGS"
1211 if test -n "${withval}" && \
1212 test "x${withval}" != "xyes"; then
1213 if test -d "${withval}/lib"; then
1214 if test -n "${need_dash_r}"; then
1215 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1217 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1220 if test -n "${need_dash_r}"; then
1221 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1223 LDFLAGS="-L${withval} ${LDFLAGS}"
1226 if test -d "${withval}/include"; then
1227 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1229 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1233 LIBS="$LIBWRAP $LIBS"
1234 AC_MSG_CHECKING(for libwrap)
1237 #include <sys/types.h>
1238 #include <sys/socket.h>
1239 #include <netinet/in.h>
1241 int deny_severity = 0, allow_severity = 0;
1246 AC_DEFINE(LIBWRAP, 1,
1248 TCP Wrappers support])
1253 AC_MSG_ERROR([*** libwrap missing])
1261 # Check whether user wants libedit support
1263 AC_ARG_WITH(libedit,
1264 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1265 [ if test "x$withval" != "xno" ; then
1266 if test "x$withval" != "xyes"; then
1267 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1268 if test -n "${need_dash_r}"; then
1269 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1271 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1274 AC_CHECK_LIB(edit, el_init,
1275 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
1276 LIBEDIT="-ledit -lcurses"
1280 [ AC_MSG_ERROR(libedit not found) ],
1283 AC_MSG_CHECKING(if libedit version is compatible)
1286 #include <histedit.h>
1290 el_init("", NULL, NULL, NULL);
1294 [ AC_MSG_RESULT(yes) ],
1296 AC_MSG_ERROR(libedit version is not compatible) ]
1303 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1305 AC_MSG_CHECKING(for supported audit module)
1310 dnl Checks for headers, libs and functions
1311 AC_CHECK_HEADERS(bsm/audit.h, [],
1312 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1313 AC_CHECK_LIB(bsm, getaudit, [],
1314 [AC_MSG_ERROR(BSM enabled and required library not found)])
1315 AC_CHECK_FUNCS(getaudit, [],
1316 [AC_MSG_ERROR(BSM enabled and required function not found)])
1317 # These are optional
1318 AC_CHECK_FUNCS(getaudit_addr)
1319 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
1323 AC_MSG_RESULT(debug)
1324 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
1330 AC_MSG_ERROR([Unknown audit module $withval])
1335 dnl Checks for library functions. Please keep in alphabetical order
1420 # IRIX has a const char return value for gai_strerror()
1421 AC_CHECK_FUNCS(gai_strerror,[
1422 AC_DEFINE(HAVE_GAI_STRERROR)
1424 #include <sys/types.h>
1425 #include <sys/socket.h>
1428 const char *gai_strerror(int);],[
1431 str = gai_strerror(0);],[
1432 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1433 [Define if gai_strerror() returns const char *])])])
1435 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1436 [Some systems put nanosleep outside of libc]))
1438 dnl Make sure prototypes are defined for these before using them.
1439 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1440 AC_CHECK_DECL(strsep,
1441 [AC_CHECK_FUNCS(strsep)],
1444 #ifdef HAVE_STRING_H
1445 # include <string.h>
1449 dnl tcsendbreak might be a macro
1450 AC_CHECK_DECL(tcsendbreak,
1451 [AC_DEFINE(HAVE_TCSENDBREAK)],
1452 [AC_CHECK_FUNCS(tcsendbreak)],
1453 [#include <termios.h>]
1456 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1458 AC_CHECK_FUNCS(setresuid, [
1459 dnl Some platorms have setresuid that isn't implemented, test for this
1460 AC_MSG_CHECKING(if setresuid seems to work)
1465 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1467 [AC_MSG_RESULT(yes)],
1468 [AC_DEFINE(BROKEN_SETRESUID, 1,
1469 [Define if your setresuid() is broken])
1470 AC_MSG_RESULT(not implemented)],
1471 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1475 AC_CHECK_FUNCS(setresgid, [
1476 dnl Some platorms have setresgid that isn't implemented, test for this
1477 AC_MSG_CHECKING(if setresgid seems to work)
1482 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1484 [AC_MSG_RESULT(yes)],
1485 [AC_DEFINE(BROKEN_SETRESGID, 1,
1486 [Define if your setresgid() is broken])
1487 AC_MSG_RESULT(not implemented)],
1488 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1492 dnl Checks for time functions
1493 AC_CHECK_FUNCS(gettimeofday time)
1494 dnl Checks for utmp functions
1495 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1496 AC_CHECK_FUNCS(utmpname)
1497 dnl Checks for utmpx functions
1498 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1499 AC_CHECK_FUNCS(setutxent utmpxname)
1501 AC_CHECK_FUNC(daemon,
1502 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1503 [AC_CHECK_LIB(bsd, daemon,
1504 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1507 AC_CHECK_FUNC(getpagesize,
1508 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1509 [Define if your libraries define getpagesize()])],
1510 [AC_CHECK_LIB(ucb, getpagesize,
1511 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1514 # Check for broken snprintf
1515 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1516 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1520 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1522 [AC_MSG_RESULT(yes)],
1525 AC_DEFINE(BROKEN_SNPRINTF, 1,
1526 [Define if your snprintf is busted])
1527 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1529 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1533 # If we don't have a working asprintf, then we strongly depend on vsnprintf
1534 # returning the right thing on overflow: the number of characters it tried to
1535 # create (as per SUSv3)
1536 if test "x$ac_cv_func_asprintf" != "xyes" && \
1537 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1538 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1541 #include <sys/types.h>
1545 int x_snprintf(char *str,size_t count,const char *fmt,...)
1547 size_t ret; va_list ap;
1548 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1554 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1556 [AC_MSG_RESULT(yes)],
1559 AC_DEFINE(BROKEN_SNPRINTF, 1,
1560 [Define if your snprintf is busted])
1561 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1563 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1567 # On systems where [v]snprintf is broken, but is declared in stdio,
1568 # check that the fmt argument is const char * or just char *.
1569 # This is only useful for when BROKEN_SNPRINTF
1570 AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1571 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1572 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1573 int main(void) { snprintf(0, 0, 0); }
1576 AC_DEFINE(SNPRINTF_CONST, [const],
1577 [Define as const if snprintf() can declare const char *fmt])],
1579 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1581 # Check for missing getpeereid (or equiv) support
1583 if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1584 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1586 [#include <sys/types.h>
1587 #include <sys/socket.h>],
1588 [int i = SO_PEERCRED;],
1589 [ AC_MSG_RESULT(yes)
1590 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
1597 dnl see whether mkstemp() requires XXXXXX
1598 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1599 AC_MSG_CHECKING([for (overly) strict mkstemp])
1603 main() { char template[]="conftest.mkstemp-test";
1604 if (mkstemp(template) == -1)
1606 unlink(template); exit(0);
1614 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
1618 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1623 dnl make sure that openpty does not reacquire controlling terminal
1624 if test ! -z "$check_for_openpty_ctty_bug"; then
1625 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1629 #include <sys/fcntl.h>
1630 #include <sys/types.h>
1631 #include <sys/wait.h>
1637 int fd, ptyfd, ttyfd, status;
1640 if (pid < 0) { /* failed */
1642 } else if (pid > 0) { /* parent */
1643 waitpid(pid, &status, 0);
1644 if (WIFEXITED(status))
1645 exit(WEXITSTATUS(status));
1648 } else { /* child */
1649 close(0); close(1); close(2);
1651 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1652 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1654 exit(3); /* Acquired ctty: broken */
1656 exit(0); /* Did not acquire ctty: OK */
1665 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1668 AC_MSG_RESULT(cross-compiling, assuming yes)
1673 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1674 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1675 AC_MSG_CHECKING(if getaddrinfo seems to work)
1679 #include <sys/socket.h>
1682 #include <netinet/in.h>
1684 #define TEST_PORT "2222"
1690 struct addrinfo *gai_ai, *ai, hints;
1691 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1693 memset(&hints, 0, sizeof(hints));
1694 hints.ai_family = PF_UNSPEC;
1695 hints.ai_socktype = SOCK_STREAM;
1696 hints.ai_flags = AI_PASSIVE;
1698 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1700 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1704 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1705 if (ai->ai_family != AF_INET6)
1708 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1709 sizeof(ntop), strport, sizeof(strport),
1710 NI_NUMERICHOST|NI_NUMERICSERV);
1713 if (err == EAI_SYSTEM)
1714 perror("getnameinfo EAI_SYSTEM");
1716 fprintf(stderr, "getnameinfo failed: %s\n",
1721 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1724 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1737 AC_DEFINE(BROKEN_GETADDRINFO)
1740 AC_MSG_RESULT(cross-compiling, assuming yes)
1745 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1746 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1747 AC_MSG_CHECKING(if getaddrinfo seems to work)
1751 #include <sys/socket.h>
1754 #include <netinet/in.h>
1756 #define TEST_PORT "2222"
1762 struct addrinfo *gai_ai, *ai, hints;
1763 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1765 memset(&hints, 0, sizeof(hints));
1766 hints.ai_family = PF_UNSPEC;
1767 hints.ai_socktype = SOCK_STREAM;
1768 hints.ai_flags = AI_PASSIVE;
1770 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1772 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1776 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1777 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1780 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1781 sizeof(ntop), strport, sizeof(strport),
1782 NI_NUMERICHOST|NI_NUMERICSERV);
1784 if (ai->ai_family == AF_INET && err != 0) {
1785 perror("getnameinfo");
1794 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1795 [Define if you have a getaddrinfo that fails
1796 for the all-zeros IPv6 address])
1800 AC_DEFINE(BROKEN_GETADDRINFO)
1802 AC_MSG_RESULT(cross-compiling, assuming no)
1807 if test "x$check_for_conflicting_getspnam" = "x1"; then
1808 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1812 int main(void) {exit(0);}
1819 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1820 [Conflicting defs for getspnam])
1827 # Check for PAM libs
1830 [ --with-pam Enable PAM support ],
1832 if test "x$withval" != "xno" ; then
1833 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1834 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1835 AC_MSG_ERROR([PAM headers not found])
1838 AC_CHECK_LIB(dl, dlopen, , )
1839 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1840 AC_CHECK_FUNCS(pam_getenvlist)
1841 AC_CHECK_FUNCS(pam_putenv)
1845 AC_DEFINE(USE_PAM, 1,
1846 [Define if you want to enable PAM support])
1847 if test $ac_cv_lib_dl_dlopen = yes; then
1857 AC_CHECK_LIB(dl, dlopen, , )
1858 AC_CHECK_LIB(pam, pam_set_item, , )
1859 AC_CHECK_FUNCS(pam_getenvlist)
1860 AC_CHECK_FUNCS(pam_putenv)
1862 if (test "x$ac_cv_header_security_pam_appl_h" = "xyes" || \
1863 test "x$ac_cv_header_pam_pam_appl_h" = "xyes") &&
1864 test "x$ac_cv_lib_pam_pam_set_item" = "xyes" ; then
1869 if test $ac_cv_lib_dl_dlopen = yes; then
1879 # Check for older PAM
1880 if test "x$PAM_MSG" = "xyes" ; then
1881 # Check PAM strerror arguments (old PAM)
1882 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1886 #if defined(HAVE_SECURITY_PAM_APPL_H)
1887 #include <security/pam_appl.h>
1888 #elif defined (HAVE_PAM_PAM_APPL_H)
1889 #include <pam/pam_appl.h>
1892 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1893 [AC_MSG_RESULT(no)],
1895 AC_DEFINE(HAVE_OLD_PAM, 1,
1896 [Define if you have an old version of PAM
1897 which takes only one argument to pam_strerror])
1899 PAM_MSG="yes (old library)"
1904 # Search for OpenSSL
1905 saved_CPPFLAGS="$CPPFLAGS"
1906 saved_LDFLAGS="$LDFLAGS"
1907 AC_ARG_WITH(ssl-dir,
1908 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1910 if test "x$withval" != "xno" ; then
1913 ./*|../*) withval="`pwd`/$withval"
1915 if test -d "$withval/lib"; then
1916 if test -n "${need_dash_r}"; then
1917 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1919 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1922 if test -n "${need_dash_r}"; then
1923 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1925 LDFLAGS="-L${withval} ${LDFLAGS}"
1928 if test -d "$withval/include"; then
1929 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1931 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1937 if test -z "$GSI_LIBS" ; then
1938 LIBS="-lcrypto $LIBS"
1940 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1941 [Define if your ssl headers are included
1942 with #include <openssl/header.h>]),
1944 dnl Check default openssl install dir
1945 if test -n "${need_dash_r}"; then
1946 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1948 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1950 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1951 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1953 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1959 # Determine OpenSSL header version
1960 AC_MSG_CHECKING([OpenSSL header version])
1965 #include <openssl/opensslv.h>
1966 #define DATA "conftest.sslincver"
1971 fd = fopen(DATA,"w");
1975 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1982 ssl_header_ver=`cat conftest.sslincver`
1983 AC_MSG_RESULT($ssl_header_ver)
1986 AC_MSG_RESULT(not found)
1987 AC_MSG_ERROR(OpenSSL version header not found.)
1990 AC_MSG_WARN([cross compiling: not checking])
1994 # Determine OpenSSL library version
1995 AC_MSG_CHECKING([OpenSSL library version])
2000 #include <openssl/opensslv.h>
2001 #include <openssl/crypto.h>
2002 #define DATA "conftest.ssllibver"
2007 fd = fopen(DATA,"w");
2011 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
2018 ssl_library_ver=`cat conftest.ssllibver`
2019 AC_MSG_RESULT($ssl_library_ver)
2022 AC_MSG_RESULT(not found)
2023 AC_MSG_ERROR(OpenSSL library not found.)
2026 AC_MSG_WARN([cross compiling: not checking])
2030 # Sanity check OpenSSL headers
2031 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
2035 #include <openssl/opensslv.h>
2036 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
2043 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
2044 Check config.log for details.
2045 Also see contrib/findssl.sh for help identifying header/library mismatches.])
2048 AC_MSG_WARN([cross compiling: not checking])
2052 # Check for OpenSSL without EVP_aes_{192,256}_cbc
2053 AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
2057 #include <openssl/evp.h>
2058 int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
2065 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2066 [libcrypto is missing AES 192 and 256 bit functions])
2070 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2071 # because the system crypt() is more featureful.
2072 if test "x$check_for_libcrypt_before" = "x1"; then
2073 AC_CHECK_LIB(crypt, crypt)
2076 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
2077 # version in OpenSSL.
2078 if test "x$check_for_libcrypt_later" = "x1"; then
2079 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
2082 AC_CHECK_LIB(iaf, ia_openinfo)
2084 ### Configure cryptographic random number support
2086 # Check wheter OpenSSL seeds itself
2087 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
2091 #include <openssl/rand.h>
2092 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
2095 OPENSSL_SEEDS_ITSELF=yes
2100 # Default to use of the rand helper if OpenSSL doesn't
2105 AC_MSG_WARN([cross compiling: assuming yes])
2106 # This is safe, since all recent OpenSSL versions will
2107 # complain at runtime if not seeded correctly.
2108 OPENSSL_SEEDS_ITSELF=yes
2113 # Do we want to force the use of the rand helper?
2114 AC_ARG_WITH(rand-helper,
2115 [ --with-rand-helper Use subprocess to gather strong randomness ],
2117 if test "x$withval" = "xno" ; then
2118 # Force use of OpenSSL's internal RNG, even if
2119 # the previous test showed it to be unseeded.
2120 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2121 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2122 OPENSSL_SEEDS_ITSELF=yes
2131 # Which randomness source do we use?
2132 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
2134 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2135 [Define if you want OpenSSL's internally seeded PRNG only])
2136 RAND_MSG="OpenSSL internal ONLY"
2137 INSTALL_SSH_RAND_HELPER=""
2138 elif test ! -z "$USE_RAND_HELPER" ; then
2139 # install rand helper
2140 RAND_MSG="ssh-rand-helper"
2141 INSTALL_SSH_RAND_HELPER="yes"
2143 AC_SUBST(INSTALL_SSH_RAND_HELPER)
2145 ### Configuration of ssh-rand-helper
2148 AC_ARG_WITH(prngd-port,
2149 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2158 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2161 if test ! -z "$withval" ; then
2162 PRNGD_PORT="$withval"
2163 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2164 [Port number of PRNGD/EGD random number socket])
2169 # PRNGD Unix domain socket
2170 AC_ARG_WITH(prngd-socket,
2171 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2175 withval="/var/run/egd-pool"
2183 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2187 if test ! -z "$withval" ; then
2188 if test ! -z "$PRNGD_PORT" ; then
2189 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2191 if test ! -r "$withval" ; then
2192 AC_MSG_WARN(Entropy socket is not readable)
2194 PRNGD_SOCKET="$withval"
2195 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2196 [Location of PRNGD/EGD random number socket])
2200 # Check for existing socket only if we don't have a random device already
2201 if test "$USE_RAND_HELPER" = yes ; then
2202 AC_MSG_CHECKING(for PRNGD/EGD socket)
2203 # Insert other locations here
2204 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2205 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2206 PRNGD_SOCKET="$sock"
2207 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2211 if test ! -z "$PRNGD_SOCKET" ; then
2212 AC_MSG_RESULT($PRNGD_SOCKET)
2214 AC_MSG_RESULT(not found)
2220 # Change default command timeout for hashing entropy source
2222 AC_ARG_WITH(entropy-timeout,
2223 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2225 if test -n "$withval" && test "x$withval" != "xno" && \
2226 test "x${withval}" != "xyes"; then
2227 entropy_timeout=$withval
2231 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2232 [Builtin PRNG command timeout])
2234 SSH_PRIVSEP_USER=sshd
2235 AC_ARG_WITH(privsep-user,
2236 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
2238 if test -n "$withval" && test "x$withval" != "xno" && \
2239 test "x${withval}" != "xyes"; then
2240 SSH_PRIVSEP_USER=$withval
2244 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2245 [non-privileged user for privilege separation])
2246 AC_SUBST(SSH_PRIVSEP_USER)
2248 # We do this little dance with the search path to insure
2249 # that programs that we select for use by installed programs
2250 # (which may be run by the super-user) come from trusted
2251 # locations before they come from the user's private area.
2252 # This should help avoid accidentally configuring some
2253 # random version of a program in someone's personal bin.
2257 test -h /bin 2> /dev/null && PATH=/usr/bin
2258 test -d /sbin && PATH=$PATH:/sbin
2259 test -d /usr/sbin && PATH=$PATH:/usr/sbin
2260 PATH=$PATH:/etc:$OPATH
2262 # These programs are used by the command hashing source to gather entropy
2263 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2264 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2265 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2266 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2267 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2268 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2269 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2270 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2271 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2272 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2273 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2274 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2275 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2276 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2277 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2278 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
2282 # Where does ssh-rand-helper get its randomness from?
2283 INSTALL_SSH_PRNG_CMDS=""
2284 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2285 if test ! -z "$PRNGD_PORT" ; then
2286 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2287 elif test ! -z "$PRNGD_SOCKET" ; then
2288 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2290 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2291 RAND_HELPER_CMDHASH=yes
2292 INSTALL_SSH_PRNG_CMDS="yes"
2295 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2298 # Cheap hack to ensure NEWS-OS libraries are arranged right.
2299 if test ! -z "$SONY" ; then
2300 LIBS="$LIBS -liberty";
2303 # Check for long long datatypes
2304 AC_CHECK_TYPES([long long, unsigned long long, long double])
2306 # Check datatype sizes
2307 AC_CHECK_SIZEOF(char, 1)
2308 AC_CHECK_SIZEOF(short int, 2)
2309 AC_CHECK_SIZEOF(int, 4)
2310 AC_CHECK_SIZEOF(long int, 4)
2311 AC_CHECK_SIZEOF(long long int, 8)
2313 # Sanity check long long for some platforms (AIX)
2314 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2315 ac_cv_sizeof_long_long_int=0
2318 # compute LLONG_MIN and LLONG_MAX if we don't know them.
2319 if test -z "$have_llong_max"; then
2320 AC_MSG_CHECKING([for max value of long long])
2324 /* Why is this so damn hard? */
2328 #define __USE_ISOC99
2330 #define DATA "conftest.llminmax"
2333 long long i, llmin, llmax = 0;
2335 if((f = fopen(DATA,"w")) == NULL)
2338 #if defined(LLONG_MIN) && defined(LLONG_MAX)
2339 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2343 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2344 /* This will work on one's complement and two's complement */
2345 for (i = 1; i > llmax; i <<= 1, i++)
2347 llmin = llmax + 1LL; /* wrap */
2351 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2352 || llmax - 1 > llmax) {
2353 fprintf(f, "unknown unknown\n");
2357 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
2364 llong_min=`$AWK '{print $1}' conftest.llminmax`
2365 llong_max=`$AWK '{print $2}' conftest.llminmax`
2367 # snprintf on some Tru64s doesn't understand "%lld"
2370 if test "x$ac_cv_sizeof_long_long_int" = "x8" &&
2371 test "x$llong_max" = "xld"; then
2372 llong_min="-9223372036854775808"
2373 llong_max="9223372036854775807"
2378 AC_MSG_RESULT($llong_max)
2379 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2380 [max value of long long calculated by configure])
2381 AC_MSG_CHECKING([for min value of long long])
2382 AC_MSG_RESULT($llong_min)
2383 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2384 [min value of long long calculated by configure])
2387 AC_MSG_RESULT(not found)
2390 AC_MSG_WARN([cross compiling: not checking])
2396 # More checks for data types
2397 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2399 [ #include <sys/types.h> ],
2401 [ ac_cv_have_u_int="yes" ],
2402 [ ac_cv_have_u_int="no" ]
2405 if test "x$ac_cv_have_u_int" = "xyes" ; then
2406 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
2410 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2412 [ #include <sys/types.h> ],
2413 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2414 [ ac_cv_have_intxx_t="yes" ],
2415 [ ac_cv_have_intxx_t="no" ]
2418 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2419 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
2423 if (test -z "$have_intxx_t" && \
2424 test "x$ac_cv_header_stdint_h" = "xyes")
2426 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2428 [ #include <stdint.h> ],
2429 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2431 AC_DEFINE(HAVE_INTXX_T)
2434 [ AC_MSG_RESULT(no) ]
2438 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2441 #include <sys/types.h>
2442 #ifdef HAVE_STDINT_H
2443 # include <stdint.h>
2445 #include <sys/socket.h>
2446 #ifdef HAVE_SYS_BITYPES_H
2447 # include <sys/bitypes.h>
2450 [ int64_t a; a = 1;],
2451 [ ac_cv_have_int64_t="yes" ],
2452 [ ac_cv_have_int64_t="no" ]
2455 if test "x$ac_cv_have_int64_t" = "xyes" ; then
2456 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
2459 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2461 [ #include <sys/types.h> ],
2462 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2463 [ ac_cv_have_u_intxx_t="yes" ],
2464 [ ac_cv_have_u_intxx_t="no" ]
2467 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2468 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
2472 if test -z "$have_u_intxx_t" ; then
2473 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2475 [ #include <sys/socket.h> ],
2476 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2478 AC_DEFINE(HAVE_U_INTXX_T)
2481 [ AC_MSG_RESULT(no) ]
2485 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2487 [ #include <sys/types.h> ],
2488 [ u_int64_t a; a = 1;],
2489 [ ac_cv_have_u_int64_t="yes" ],
2490 [ ac_cv_have_u_int64_t="no" ]
2493 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2494 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
2498 if test -z "$have_u_int64_t" ; then
2499 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2501 [ #include <sys/bitypes.h> ],
2502 [ u_int64_t a; a = 1],
2504 AC_DEFINE(HAVE_U_INT64_T)
2507 [ AC_MSG_RESULT(no) ]
2511 if test -z "$have_u_intxx_t" ; then
2512 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2515 #include <sys/types.h>
2517 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2518 [ ac_cv_have_uintxx_t="yes" ],
2519 [ ac_cv_have_uintxx_t="no" ]
2522 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2523 AC_DEFINE(HAVE_UINTXX_T, 1,
2524 [define if you have uintxx_t data type])
2528 if test -z "$have_uintxx_t" ; then
2529 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2531 [ #include <stdint.h> ],
2532 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2534 AC_DEFINE(HAVE_UINTXX_T)
2537 [ AC_MSG_RESULT(no) ]
2541 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2542 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2544 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2547 #include <sys/bitypes.h>
2550 int8_t a; int16_t b; int32_t c;
2551 u_int8_t e; u_int16_t f; u_int32_t g;
2552 a = b = c = e = f = g = 1;
2555 AC_DEFINE(HAVE_U_INTXX_T)
2556 AC_DEFINE(HAVE_INTXX_T)
2564 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2567 #include <sys/types.h>
2569 [ u_char foo; foo = 125; ],
2570 [ ac_cv_have_u_char="yes" ],
2571 [ ac_cv_have_u_char="no" ]
2574 if test "x$ac_cv_have_u_char" = "xyes" ; then
2575 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
2580 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2582 AC_CHECK_TYPES(in_addr_t,,,
2583 [#include <sys/types.h>
2584 #include <netinet/in.h>])
2586 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2589 #include <sys/types.h>
2591 [ size_t foo; foo = 1235; ],
2592 [ ac_cv_have_size_t="yes" ],
2593 [ ac_cv_have_size_t="no" ]
2596 if test "x$ac_cv_have_size_t" = "xyes" ; then
2597 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
2600 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2603 #include <sys/types.h>
2605 [ ssize_t foo; foo = 1235; ],
2606 [ ac_cv_have_ssize_t="yes" ],
2607 [ ac_cv_have_ssize_t="no" ]
2610 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2611 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
2614 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2619 [ clock_t foo; foo = 1235; ],
2620 [ ac_cv_have_clock_t="yes" ],
2621 [ ac_cv_have_clock_t="no" ]
2624 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2625 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
2628 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2631 #include <sys/types.h>
2632 #include <sys/socket.h>
2634 [ sa_family_t foo; foo = 1235; ],
2635 [ ac_cv_have_sa_family_t="yes" ],
2638 #include <sys/types.h>
2639 #include <sys/socket.h>
2640 #include <netinet/in.h>
2642 [ sa_family_t foo; foo = 1235; ],
2643 [ ac_cv_have_sa_family_t="yes" ],
2645 [ ac_cv_have_sa_family_t="no" ]
2649 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2650 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2651 [define if you have sa_family_t data type])
2654 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2657 #include <sys/types.h>
2659 [ pid_t foo; foo = 1235; ],
2660 [ ac_cv_have_pid_t="yes" ],
2661 [ ac_cv_have_pid_t="no" ]
2664 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2665 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
2668 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2671 #include <sys/types.h>
2673 [ mode_t foo; foo = 1235; ],
2674 [ ac_cv_have_mode_t="yes" ],
2675 [ ac_cv_have_mode_t="no" ]
2678 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2679 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
2683 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2686 #include <sys/types.h>
2687 #include <sys/socket.h>
2689 [ struct sockaddr_storage s; ],
2690 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2691 [ ac_cv_have_struct_sockaddr_storage="no" ]
2694 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2695 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2696 [define if you have struct sockaddr_storage data type])
2699 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2702 #include <sys/types.h>
2703 #include <netinet/in.h>
2705 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2706 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2707 [ ac_cv_have_struct_sockaddr_in6="no" ]
2710 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2711 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2712 [define if you have struct sockaddr_in6 data type])
2715 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2718 #include <sys/types.h>
2719 #include <netinet/in.h>
2721 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2722 [ ac_cv_have_struct_in6_addr="yes" ],
2723 [ ac_cv_have_struct_in6_addr="no" ]
2726 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2727 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2728 [define if you have struct in6_addr data type])
2731 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2734 #include <sys/types.h>
2735 #include <sys/socket.h>
2738 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2739 [ ac_cv_have_struct_addrinfo="yes" ],
2740 [ ac_cv_have_struct_addrinfo="no" ]
2743 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2744 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2745 [define if you have struct addrinfo data type])
2748 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2750 [ #include <sys/time.h> ],
2751 [ struct timeval tv; tv.tv_sec = 1;],
2752 [ ac_cv_have_struct_timeval="yes" ],
2753 [ ac_cv_have_struct_timeval="no" ]
2756 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2757 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
2758 have_struct_timeval=1
2761 AC_CHECK_TYPES(struct timespec)
2763 # We need int64_t or else certian parts of the compile will fail.
2764 if test "x$ac_cv_have_int64_t" = "xno" && \
2765 test "x$ac_cv_sizeof_long_int" != "x8" && \
2766 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2767 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2768 echo "an alternative compiler (I.E., GCC) before continuing."
2772 dnl test snprintf (broken on SCO w/gcc)
2777 #ifdef HAVE_SNPRINTF
2781 char expected_out[50];
2783 #if (SIZEOF_LONG_INT == 8)
2784 long int num = 0x7fffffffffffffff;
2786 long long num = 0x7fffffffffffffffll;
2788 strcpy(expected_out, "9223372036854775807");
2789 snprintf(buf, mazsize, "%lld", num);
2790 if(strcmp(buf, expected_out) != 0)
2797 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2798 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2802 dnl Checks for structure members
2803 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2804 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2805 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2806 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2807 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2808 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2809 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2810 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2811 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2812 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2813 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2814 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2815 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2816 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2817 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2818 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2819 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2821 AC_CHECK_MEMBERS([struct stat.st_blksize])
2822 AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2823 [Define if we don't have struct __res_state in resolv.h])],
2826 #if HAVE_SYS_TYPES_H
2827 # include <sys/types.h>
2829 #include <netinet/in.h>
2830 #include <arpa/nameser.h>
2834 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2835 ac_cv_have_ss_family_in_struct_ss, [
2838 #include <sys/types.h>
2839 #include <sys/socket.h>
2841 [ struct sockaddr_storage s; s.ss_family = 1; ],
2842 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2843 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2846 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2847 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
2850 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2851 ac_cv_have___ss_family_in_struct_ss, [
2854 #include <sys/types.h>
2855 #include <sys/socket.h>
2857 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2858 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2859 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2862 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2863 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2864 [Fields in struct sockaddr_storage])
2867 AC_CACHE_CHECK([for pw_class field in struct passwd],
2868 ac_cv_have_pw_class_in_struct_passwd, [
2873 [ struct passwd p; p.pw_class = 0; ],
2874 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2875 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2878 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2879 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2880 [Define if your password has a pw_class field])
2883 AC_CACHE_CHECK([for pw_expire field in struct passwd],
2884 ac_cv_have_pw_expire_in_struct_passwd, [
2889 [ struct passwd p; p.pw_expire = 0; ],
2890 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2891 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2894 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2895 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2896 [Define if your password has a pw_expire field])
2899 AC_CACHE_CHECK([for pw_change field in struct passwd],
2900 ac_cv_have_pw_change_in_struct_passwd, [
2905 [ struct passwd p; p.pw_change = 0; ],
2906 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2907 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2910 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2911 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2912 [Define if your password has a pw_change field])
2915 dnl make sure we're using the real structure members and not defines
2916 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2917 ac_cv_have_accrights_in_msghdr, [
2920 #include <sys/types.h>
2921 #include <sys/socket.h>
2922 #include <sys/uio.h>
2924 #ifdef msg_accrights
2925 #error "msg_accrights is a macro"
2929 m.msg_accrights = 0;
2933 [ ac_cv_have_accrights_in_msghdr="yes" ],
2934 [ ac_cv_have_accrights_in_msghdr="no" ]
2937 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2938 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2939 [Define if your system uses access rights style
2940 file descriptor passing])
2943 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2944 ac_cv_have_control_in_msghdr, [
2947 #include <sys/types.h>
2948 #include <sys/socket.h>
2949 #include <sys/uio.h>
2952 #error "msg_control is a macro"
2960 [ ac_cv_have_control_in_msghdr="yes" ],
2961 [ ac_cv_have_control_in_msghdr="no" ]
2964 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2965 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2966 [Define if your system uses ancillary data style
2967 file descriptor passing])
2970 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2972 [ extern char *__progname; printf("%s", __progname); ],
2973 [ ac_cv_libc_defines___progname="yes" ],
2974 [ ac_cv_libc_defines___progname="no" ]
2977 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2978 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
2981 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2985 [ printf("%s", __FUNCTION__); ],
2986 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2987 [ ac_cv_cc_implements___FUNCTION__="no" ]
2990 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2991 AC_DEFINE(HAVE___FUNCTION__, 1,
2992 [Define if compiler implements __FUNCTION__])
2995 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2999 [ printf("%s", __func__); ],
3000 [ ac_cv_cc_implements___func__="yes" ],
3001 [ ac_cv_cc_implements___func__="no" ]
3004 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
3005 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
3008 AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3010 [#include <stdarg.h>
3013 [ ac_cv_have_va_copy="yes" ],
3014 [ ac_cv_have_va_copy="no" ]
3017 if test "x$ac_cv_have_va_copy" = "xyes" ; then
3018 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3021 AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3023 [#include <stdarg.h>
3026 [ ac_cv_have___va_copy="yes" ],
3027 [ ac_cv_have___va_copy="no" ]
3030 if test "x$ac_cv_have___va_copy" = "xyes" ; then
3031 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3034 AC_CACHE_CHECK([whether getopt has optreset support],
3035 ac_cv_have_getopt_optreset, [
3040 [ extern int optreset; optreset = 0; ],
3041 [ ac_cv_have_getopt_optreset="yes" ],
3042 [ ac_cv_have_getopt_optreset="no" ]
3045 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
3046 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3047 [Define if your getopt(3) defines and uses optreset])
3050 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
3052 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
3053 [ ac_cv_libc_defines_sys_errlist="yes" ],
3054 [ ac_cv_libc_defines_sys_errlist="no" ]
3057 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
3058 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3059 [Define if your system defines sys_errlist[]])
3063 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
3065 [ extern int sys_nerr; printf("%i", sys_nerr);],
3066 [ ac_cv_libc_defines_sys_nerr="yes" ],
3067 [ ac_cv_libc_defines_sys_nerr="no" ]
3070 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
3071 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
3075 # Check whether user wants sectok support
3077 [ --with-sectok Enable smartcard support using libsectok],
3079 if test "x$withval" != "xno" ; then
3080 if test "x$withval" != "xyes" ; then
3081 CPPFLAGS="$CPPFLAGS -I${withval}"
3082 LDFLAGS="$LDFLAGS -L${withval}"
3083 if test ! -z "$need_dash_r" ; then
3084 LDFLAGS="$LDFLAGS -R${withval}"
3086 if test ! -z "$blibpath" ; then
3087 blibpath="$blibpath:${withval}"
3090 AC_CHECK_HEADERS(sectok.h)
3091 if test "$ac_cv_header_sectok_h" != yes; then
3092 AC_MSG_ERROR(Can't find sectok.h)
3094 AC_CHECK_LIB(sectok, sectok_open)
3095 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3096 AC_MSG_ERROR(Can't find libsectok)
3098 AC_DEFINE(SMARTCARD, 1,
3099 [Define if you want smartcard support])
3100 AC_DEFINE(USE_SECTOK, 1,
3101 [Define if you want smartcard support
3103 SCARD_MSG="yes, using sectok"
3108 # Check whether user wants OpenSC support
3111 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
3113 if test "x$withval" != "xno" ; then
3114 if test "x$withval" != "xyes" ; then
3115 OPENSC_CONFIG=$withval/bin/opensc-config
3117 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3119 if test "$OPENSC_CONFIG" != "no"; then
3120 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3121 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3122 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
3123 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
3124 AC_DEFINE(SMARTCARD)
3125 AC_DEFINE(USE_OPENSC, 1,
3126 [Define if you want smartcard support
3128 SCARD_MSG="yes, using OpenSC"
3134 # Check libraries needed by DNS fingerprint support
3135 AC_SEARCH_LIBS(getrrsetbyname, resolv,
3136 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3137 [Define if getrrsetbyname() exists])],
3139 # Needed by our getrrsetbyname()
3140 AC_SEARCH_LIBS(res_query, resolv)
3141 AC_SEARCH_LIBS(dn_expand, resolv)
3142 AC_MSG_CHECKING(if res_query will link)
3143 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
3146 LIBS="$LIBS -lresolv"
3147 AC_MSG_CHECKING(for res_query in -lresolv)
3152 res_query (0, 0, 0, 0, 0);
3156 [LIBS="$LIBS -lresolv"
3157 AC_MSG_RESULT(yes)],
3161 AC_CHECK_FUNCS(_getshort _getlong)
3162 AC_CHECK_DECLS([_getshort, _getlong], , ,
3163 [#include <sys/types.h>
3164 #include <arpa/nameser.h>])
3165 AC_CHECK_MEMBER(HEADER.ad,
3166 [AC_DEFINE(HAVE_HEADER_AD, 1,
3167 [Define if HEADER.ad exists in arpa/nameser.h])],,
3168 [#include <arpa/nameser.h>])
3171 # Check whether user wants Kerberos 5 support
3173 AC_ARG_WITH(kerberos5,
3174 [ --with-kerberos5=PATH Enable Kerberos 5 support],
3175 [ if test "x$withval" != "xno" ; then
3176 if test "x$withval" = "xyes" ; then
3177 KRB5ROOT="/usr/local"
3182 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
3185 AC_MSG_CHECKING(for krb5-config)
3186 if test -x $KRB5ROOT/bin/krb5-config ; then
3187 KRB5CONF=$KRB5ROOT/bin/krb5-config
3188 AC_MSG_RESULT($KRB5CONF)
3190 AC_MSG_CHECKING(for gssapi support)
3191 if $KRB5CONF | grep gssapi >/dev/null ; then
3193 AC_DEFINE(GSSAPI, 1,
3194 [Define this if you want GSSAPI
3195 support in the version 2 protocol])
3201 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3202 K5LIBS="`$KRB5CONF --libs $k5confopts`"
3203 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
3204 AC_MSG_CHECKING(whether we are using Heimdal)
3205 AC_TRY_COMPILE([ #include <krb5.h> ],
3206 [ char *tmp = heimdal_version; ],
3207 [ AC_MSG_RESULT(yes)
3208 AC_DEFINE(HEIMDAL, 1,
3209 [Define this if you are using the
3210 Heimdal version of Kerberos V5]) ],
3215 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
3216 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
3217 AC_MSG_CHECKING(whether we are using Heimdal)
3218 AC_TRY_COMPILE([ #include <krb5.h> ],
3219 [ char *tmp = heimdal_version; ],
3220 [ AC_MSG_RESULT(yes)
3222 K5LIBS="-lkrb5 -ldes"
3223 K5LIBS="$K5LIBS -lcom_err -lasn1"
3224 AC_CHECK_LIB(roken, net_write,
3225 [K5LIBS="$K5LIBS -lroken"])
3228 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3231 AC_SEARCH_LIBS(dn_expand, resolv)
3233 AC_CHECK_LIB(gssapi,gss_init_sec_context,
3235 K5LIBS="-lgssapi $K5LIBS" ],
3236 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3238 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
3239 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3244 AC_CHECK_HEADER(gssapi.h, ,
3245 [ unset ac_cv_header_gssapi_h
3246 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3247 AC_CHECK_HEADERS(gssapi.h, ,
3248 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
3254 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3255 AC_CHECK_HEADER(gssapi_krb5.h, ,
3256 [ CPPFLAGS="$oldCPP" ])
3258 # If we're using some other GSSAPI
3259 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
3260 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
3263 if test -z "$GSSAPI"; then
3268 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3269 AC_CHECK_HEADER(gssapi_krb5.h, ,
3270 [ CPPFLAGS="$oldCPP" ])
3273 if test ! -z "$need_dash_r" ; then
3274 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3276 if test ! -z "$blibpath" ; then
3277 blibpath="$blibpath:${KRB5ROOT}/lib"
3280 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3281 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3282 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3284 LIBS="$LIBS $K5LIBS"
3285 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3286 [Define this if you want to use libkafs' AFS support]))
3291 # Check whether user wants AFS_KRB5 support
3293 AC_ARG_WITH(afs-krb5,
3294 [ --with-afs-krb5[[=AKLOG_PATH]] Enable aklog to get token (default=/usr/bin/aklog).],
3296 if test "x$withval" != "xno" ; then
3298 if test "x$withval" != "xyes" ; then
3299 AC_DEFINE_UNQUOTED(AKLOG_PATH, "$withval",
3300 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3302 AC_DEFINE_UNQUOTED(AKLOG_PATH,
3304 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3307 if test -z "$KRB5ROOT" ; then
3308 AC_MSG_WARN([AFS_KRB5 requires Kerberos 5 support, build may fail])
3311 LIBS="-lkrbafs -lkrb4 $LIBS"
3312 if test ! -z "$AFS_LIBS" ; then
3313 LIBS="$LIBS $AFS_LIBS"
3315 AC_DEFINE(AFS_KRB5, 1,
3316 [Define this if you want to use AFS/Kerberos 5 option, which runs aklog.])
3322 AC_ARG_WITH(session-hooks,
3323 [ --with-session-hooks Enable hooks for executing external commands before/after a session],
3324 [ AC_DEFINE(SESSION_HOOKS, 1, [Define this if you want support for startup/shutdown hooks]) ]
3327 # Looking for programs, paths and files
3329 PRIVSEP_PATH=/var/empty
3330 AC_ARG_WITH(privsep-path,
3331 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
3333 if test -n "$withval" && test "x$withval" != "xno" && \
3334 test "x${withval}" != "xyes"; then
3335 PRIVSEP_PATH=$withval
3339 AC_SUBST(PRIVSEP_PATH)
3342 [ --with-xauth=PATH Specify path to xauth program ],
3344 if test -n "$withval" && test "x$withval" != "xno" && \
3345 test "x${withval}" != "xyes"; then
3351 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3352 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3353 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3354 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3355 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
3356 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
3357 xauth_path="/usr/openwin/bin/xauth"
3363 AC_ARG_ENABLE(strip,
3364 [ --disable-strip Disable calling strip(1) on install],
3366 if test "x$enableval" = "xno" ; then
3373 if test -z "$xauth_path" ; then
3374 XAUTH_PATH="undefined"
3375 AC_SUBST(XAUTH_PATH)
3377 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3378 [Define if xauth is found in your path])
3379 XAUTH_PATH=$xauth_path
3380 AC_SUBST(XAUTH_PATH)
3383 # Check for mail directory (last resort if we cannot get it from headers)
3384 if test ! -z "$MAIL" ; then
3385 maildir=`dirname $MAIL`
3386 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3387 [Set this to your mail directory if you don't have maillock.h])
3390 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
3391 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3392 disable_ptmx_check=yes
3394 if test -z "$no_dev_ptmx" ; then
3395 if test "x$disable_ptmx_check" != "xyes" ; then
3396 AC_CHECK_FILE("/dev/ptmx",
3398 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3399 [Define if you have /dev/ptmx])
3406 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
3407 AC_CHECK_FILE("/dev/ptc",
3409 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3410 [Define if you have /dev/ptc])
3415 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3418 # Options from here on. Some of these are preset by platform above
3419 AC_ARG_WITH(mantype,
3420 [ --with-mantype=man|cat|doc Set man page type],
3427 AC_MSG_ERROR(invalid man type: $withval)
3432 if test -z "$MANTYPE"; then
3433 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3434 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
3435 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3437 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3444 if test "$MANTYPE" = "doc"; then
3451 # Check whether to enable MD5 passwords
3453 AC_ARG_WITH(md5-passwords,
3454 [ --with-md5-passwords Enable use of MD5 passwords],
3456 if test "x$withval" != "xno" ; then
3457 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3458 [Define if you want to allow MD5 passwords])
3464 # Whether to disable shadow password support
3466 [ --without-shadow Disable shadow password support],
3468 if test "x$withval" = "xno" ; then
3469 AC_DEFINE(DISABLE_SHADOW)
3475 if test -z "$disable_shadow" ; then
3476 AC_MSG_CHECKING([if the systems has expire shadow information])
3479 #include <sys/types.h>
3482 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3483 [ sp_expire_available=yes ], []
3486 if test "x$sp_expire_available" = "xyes" ; then
3488 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3489 [Define if you want to use shadow password expire field])
3495 # Use ip address instead of hostname in $DISPLAY
3496 if test ! -z "$IPADDR_IN_DISPLAY" ; then
3497 DISPLAY_HACK_MSG="yes"
3498 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3499 [Define if you need to use IP address
3500 instead of hostname in $DISPLAY])
3502 DISPLAY_HACK_MSG="no"
3503 AC_ARG_WITH(ipaddr-display,
3504 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3506 if test "x$withval" != "xno" ; then
3507 AC_DEFINE(IPADDR_IN_DISPLAY)
3508 DISPLAY_HACK_MSG="yes"
3514 # check for /etc/default/login and use it if present.
3515 AC_ARG_ENABLE(etc-default-login,
3516 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3517 [ if test "x$enableval" = "xno"; then
3518 AC_MSG_NOTICE([/etc/default/login handling disabled])
3519 etc_default_login=no
3521 etc_default_login=yes
3523 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3525 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3526 etc_default_login=no
3528 etc_default_login=yes
3532 if test "x$etc_default_login" != "xno"; then
3533 AC_CHECK_FILE("/etc/default/login",
3534 [ external_path_file=/etc/default/login ])
3535 if test "x$external_path_file" = "x/etc/default/login"; then
3536 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3537 [Define if your system has /etc/default/login])
3541 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3542 if test $ac_cv_func_login_getcapbool = "yes" && \
3543 test $ac_cv_header_login_cap_h = "yes" ; then
3544 external_path_file=/etc/login.conf
3547 # Whether to mess with the default path
3548 SERVER_PATH_MSG="(default)"
3549 AC_ARG_WITH(default-path,
3550 [ --with-default-path= Specify default \$PATH environment for server],
3552 if test "x$external_path_file" = "x/etc/login.conf" ; then
3554 --with-default-path=PATH has no effect on this system.
3555 Edit /etc/login.conf instead.])
3556 elif test "x$withval" != "xno" ; then
3557 if test ! -z "$external_path_file" ; then
3559 --with-default-path=PATH will only be used if PATH is not defined in
3560 $external_path_file .])
3562 user_path="$withval"
3563 SERVER_PATH_MSG="$withval"
3566 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3567 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3569 if test ! -z "$external_path_file" ; then
3571 If PATH is defined in $external_path_file, ensure the path to scp is included,
3572 otherwise scp will not work.])
3576 /* find out what STDPATH is */
3581 #ifndef _PATH_STDPATH
3582 # ifdef _PATH_USERPATH /* Irix */
3583 # define _PATH_STDPATH _PATH_USERPATH
3585 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3588 #include <sys/types.h>
3589 #include <sys/stat.h>
3591 #define DATA "conftest.stdpath"
3598 fd = fopen(DATA,"w");
3602 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3608 [ user_path=`cat conftest.stdpath` ],
3609 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3610 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3614 if test "x$external_path_file" != "x/etc/login.conf" ; then
3615 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
3619 # Set superuser path separately to user path
3620 AC_ARG_WITH(superuser-path,
3621 [ --with-superuser-path= Specify different path for super-user],
3623 if test -n "$withval" && test "x$withval" != "xno" && \
3624 test "x${withval}" != "xyes"; then
3625 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3626 [Define if you want a different $PATH
3628 superuser_path=$withval
3634 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3635 IPV4_IN6_HACK_MSG="no"
3637 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3639 if test "x$withval" != "xno" ; then
3641 AC_DEFINE(IPV4_IN_IPV6, 1,
3642 [Detect IPv4 in IPv6 mapped addresses
3644 IPV4_IN6_HACK_MSG="yes"
3649 if test "x$inet6_default_4in6" = "xyes"; then
3650 AC_MSG_RESULT([yes (default)])
3651 AC_DEFINE(IPV4_IN_IPV6)
3652 IPV4_IN6_HACK_MSG="yes"
3654 AC_MSG_RESULT([no (default)])
3659 # Whether to enable BSD auth support
3661 AC_ARG_WITH(bsd-auth,
3662 [ --with-bsd-auth Enable BSD auth support],
3664 if test "x$withval" != "xno" ; then
3665 AC_DEFINE(BSD_AUTH, 1,
3666 [Define if you have BSD auth support])
3672 # Where to place sshd.pid
3674 # make sure the directory exists
3675 if test ! -d $piddir ; then
3676 piddir=`eval echo ${sysconfdir}`
3678 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3682 AC_ARG_WITH(pid-dir,
3683 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3685 if test -n "$withval" && test "x$withval" != "xno" && \
3686 test "x${withval}" != "xyes"; then
3688 if test ! -d $piddir ; then
3689 AC_MSG_WARN([** no $piddir directory on this system **])
3695 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
3698 dnl allow user to disable some login recording features
3699 AC_ARG_ENABLE(lastlog,
3700 [ --disable-lastlog disable use of lastlog even if detected [no]],
3702 if test "x$enableval" = "xno" ; then
3703 AC_DEFINE(DISABLE_LASTLOG)
3708 [ --disable-utmp disable use of utmp even if detected [no]],
3710 if test "x$enableval" = "xno" ; then
3711 AC_DEFINE(DISABLE_UTMP)
3715 AC_ARG_ENABLE(utmpx,
3716 [ --disable-utmpx disable use of utmpx even if detected [no]],
3718 if test "x$enableval" = "xno" ; then
3719 AC_DEFINE(DISABLE_UTMPX, 1,
3720 [Define if you don't want to use utmpx])
3725 [ --disable-wtmp disable use of wtmp even if detected [no]],
3727 if test "x$enableval" = "xno" ; then
3728 AC_DEFINE(DISABLE_WTMP)
3732 AC_ARG_ENABLE(wtmpx,
3733 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
3735 if test "x$enableval" = "xno" ; then
3736 AC_DEFINE(DISABLE_WTMPX, 1,
3737 [Define if you don't want to use wtmpx])
3741 AC_ARG_ENABLE(libutil,
3742 [ --disable-libutil disable use of libutil (login() etc.) [no]],
3744 if test "x$enableval" = "xno" ; then
3745 AC_DEFINE(DISABLE_LOGIN)
3749 AC_ARG_ENABLE(pututline,
3750 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
3752 if test "x$enableval" = "xno" ; then
3753 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3754 [Define if you don't want to use pututline()
3755 etc. to write [uw]tmp])
3759 AC_ARG_ENABLE(pututxline,
3760 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
3762 if test "x$enableval" = "xno" ; then
3763 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3764 [Define if you don't want to use pututxline()
3765 etc. to write [uw]tmpx])
3769 AC_ARG_WITH(lastlog,
3770 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
3772 if test "x$withval" = "xno" ; then
3773 AC_DEFINE(DISABLE_LASTLOG)
3774 elif test -n "$withval" && test "x${withval}" != "xyes"; then
3775 conf_lastlog_location=$withval
3780 dnl lastlog, [uw]tmpx? detection
3781 dnl NOTE: set the paths in the platform section to avoid the
3782 dnl need for command-line parameters
3783 dnl lastlog and [uw]tmp are subject to a file search if all else fails
3785 dnl lastlog detection
3786 dnl NOTE: the code itself will detect if lastlog is a directory
3787 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3789 #include <sys/types.h>
3791 #ifdef HAVE_LASTLOG_H
3792 # include <lastlog.h>
3801 [ char *lastlog = LASTLOG_FILE; ],
3802 [ AC_MSG_RESULT(yes) ],
3805 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3807 #include <sys/types.h>
3809 #ifdef HAVE_LASTLOG_H
3810 # include <lastlog.h>
3816 [ char *lastlog = _PATH_LASTLOG; ],
3817 [ AC_MSG_RESULT(yes) ],
3820 system_lastlog_path=no
3825 if test -z "$conf_lastlog_location"; then
3826 if test x"$system_lastlog_path" = x"no" ; then
3827 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3828 if (test -d "$f" || test -f "$f") ; then
3829 conf_lastlog_location=$f
3832 if test -z "$conf_lastlog_location"; then
3833 AC_MSG_WARN([** Cannot find lastlog **])
3834 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
3839 if test -n "$conf_lastlog_location"; then
3840 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3841 [Define if you want to specify the path to your lastlog file])
3845 AC_MSG_CHECKING([if your system defines UTMP_FILE])
3847 #include <sys/types.h>
3853 [ char *utmp = UTMP_FILE; ],
3854 [ AC_MSG_RESULT(yes) ],
3856 system_utmp_path=no ]
3858 if test -z "$conf_utmp_location"; then
3859 if test x"$system_utmp_path" = x"no" ; then
3860 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3861 if test -f $f ; then
3862 conf_utmp_location=$f
3865 if test -z "$conf_utmp_location"; then
3866 AC_DEFINE(DISABLE_UTMP)
3870 if test -n "$conf_utmp_location"; then
3871 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3872 [Define if you want to specify the path to your utmp file])
3876 AC_MSG_CHECKING([if your system defines WTMP_FILE])
3878 #include <sys/types.h>
3884 [ char *wtmp = WTMP_FILE; ],
3885 [ AC_MSG_RESULT(yes) ],
3887 system_wtmp_path=no ]
3889 if test -z "$conf_wtmp_location"; then
3890 if test x"$system_wtmp_path" = x"no" ; then
3891 for f in /usr/adm/wtmp /var/log/wtmp; do
3892 if test -f $f ; then
3893 conf_wtmp_location=$f
3896 if test -z "$conf_wtmp_location"; then
3897 AC_DEFINE(DISABLE_WTMP)
3901 if test -n "$conf_wtmp_location"; then
3902 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3903 [Define if you want to specify the path to your wtmp file])
3907 dnl utmpx detection - I don't know any system so perverse as to require
3908 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3910 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3912 #include <sys/types.h>
3921 [ char *utmpx = UTMPX_FILE; ],
3922 [ AC_MSG_RESULT(yes) ],
3924 system_utmpx_path=no ]
3926 if test -z "$conf_utmpx_location"; then
3927 if test x"$system_utmpx_path" = x"no" ; then
3928 AC_DEFINE(DISABLE_UTMPX)
3931 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3932 [Define if you want to specify the path to your utmpx file])
3936 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3938 #include <sys/types.h>
3947 [ char *wtmpx = WTMPX_FILE; ],
3948 [ AC_MSG_RESULT(yes) ],
3950 system_wtmpx_path=no ]
3952 if test -z "$conf_wtmpx_location"; then
3953 if test x"$system_wtmpx_path" = x"no" ; then
3954 AC_DEFINE(DISABLE_WTMPX)
3957 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3958 [Define if you want to specify the path to your wtmpx file])
3962 if test ! -z "$blibpath" ; then
3963 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3964 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3967 dnl remove pam and dl because they are in $LIBPAM
3968 if test "$PAM_MSG" = yes ; then
3969 LIBS=`echo $LIBS | sed 's/-lpam //'`
3971 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3972 LIBS=`echo $LIBS | sed 's/-ldl //'`
3975 dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3977 CFLAGS="$CFLAGS $werror_flags"
3980 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3981 scard/Makefile ssh_prng_cmds survey.sh])
3984 # Print summary of options
3986 # Someone please show me a better way :)
3987 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3988 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3989 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3990 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3991 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3992 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3993 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3994 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3995 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3998 echo "OpenSSH has been configured with the following options:"
3999 echo " User binaries: $B"
4000 echo " System binaries: $C"
4001 echo " Configuration files: $D"
4002 echo " Askpass program: $E"
4003 echo " Manual pages: $F"
4004 echo " Privilege separation chroot path: $H"
4005 if test "x$external_path_file" = "x/etc/login.conf" ; then
4006 echo " At runtime, sshd will use the path defined in $external_path_file"
4007 echo " Make sure the path to scp is present, otherwise scp will not work"
4009 echo " sshd default user PATH: $I"
4010 if test ! -z "$external_path_file"; then
4011 echo " (If PATH is set in $external_path_file it will be used instead. If"
4012 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4015 if test ! -z "$superuser_path" ; then
4016 echo " sshd superuser user PATH: $J"
4018 echo " Manpage format: $MANTYPE"
4019 echo " PAM support: $PAM_MSG"
4020 echo " KerberosV support: $KRB5_MSG"
4021 echo " Smartcard support: $SCARD_MSG"
4022 echo " S/KEY support: $SKEY_MSG"
4023 echo " TCP Wrappers support: $TCPW_MSG"
4024 echo " MD5 password support: $MD5_MSG"
4025 echo " libedit support: $LIBEDIT_MSG"
4026 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
4027 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4028 echo " BSD Auth support: $BSD_AUTH_MSG"
4029 echo " Random number source: $RAND_MSG"
4030 if test ! -z "$USE_RAND_HELPER" ; then
4031 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
4036 echo " Host: ${host}"
4037 echo " Compiler: ${CC}"
4038 echo " Compiler flags: ${CFLAGS}"
4039 echo "Preprocessor flags: ${CPPFLAGS}"
4040 echo " Linker flags: ${LDFLAGS}"
4041 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
4045 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
4046 echo "SVR4 style packages are supported with \"make package\""
4050 if test "x$PAM_MSG" = "xyes" ; then
4051 echo "PAM is enabled. You may need to install a PAM control file "
4052 echo "for sshd, otherwise password authentication may fail. "
4053 echo "Example PAM control files can be found in the contrib/ "
4058 if test ! -z "$RAND_HELPER_CMDHASH" ; then
4059 echo "WARNING: you are using the builtin random number collection "
4060 echo "service. Please read WARNING.RNG and request that your OS "
4061 echo "vendor includes kernel-based random number collection in "
4062 echo "future versions of your OS."
4066 if test ! -z "$NO_PEERCHECK" ; then
4067 echo "WARNING: the operating system that you are using does not "
4068 echo "appear to support either the getpeereid() API nor the "
4069 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
4070 echo "enforce security checks to prevent unauthorised connections to "
4071 echo "ssh-agent. Their absence increases the risk that a malicious "
4072 echo "user can connect to your agent. "
4076 if test "$AUDIT_MODULE" = "bsm" ; then
4077 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4078 echo "See the Solaris section in README.platform for details."