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)
18 AC_CONFIG_SRCDIR([ssh.c])
20 AC_CONFIG_HEADER(config.h)
25 # Checks for programs.
31 AC_PATH_PROG(CAT, cat)
32 AC_PATH_PROG(KILL, kill)
33 AC_PATH_PROGS(PERL, perl5 perl)
34 AC_PATH_PROG(SED, sed)
36 AC_PATH_PROG(ENT, ent)
38 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
42 AC_SUBST(TEST_SHELL,sh)
45 AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47 AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49 AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
54 if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
58 # Use LOGIN_PROGRAM from environment if possible
59 if test ! -z "$LOGIN_PROGRAM" ; then
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
63 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
64 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
65 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
69 AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
70 if test ! -z "$PATH_PASSWD_PROG" ; then
71 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
74 if test -z "$LD" ; then
80 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
81 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
83 # Check for -std=gnu99 support (needed for LLONG_MIN/MAX on Linux)
84 saved_CFLAGS="$CFLAGS"
85 CFLAGS="$CFLAGS -std=gnu99"
86 AC_MSG_CHECKING(whether cc accepts -std=gnu99 option)
87 AC_TRY_COMPILE([], [return(0);], [AC_MSG_RESULT(yes)],
89 CFLAGS="$saved_CFLAGS"],
94 [ --without-rpath Disable auto-added -R linker paths],
96 if test "x$withval" = "xno" ; then
99 if test "x$withval" = "xyes" ; then
105 # Check for some target-specific stuff
108 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
109 if (test -z "$blibpath"); then
110 blibpath="/usr/lib:/lib"
112 saved_LDFLAGS="$LDFLAGS"
113 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
114 if (test -z "$blibflags"); then
115 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
116 AC_TRY_LINK([], [], [blibflags=$tryflags])
119 if (test -z "$blibflags"); then
120 AC_MSG_RESULT(not found)
121 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
123 AC_MSG_RESULT($blibflags)
125 LDFLAGS="$saved_LDFLAGS"
126 dnl Check for authenticate. Might be in libs.a on older AIXes
127 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
128 [AC_CHECK_LIB(s,authenticate,
129 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
133 dnl Check for various auth function declarations in headers.
134 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
135 passwdexpired, setauthdb], , , [#include <usersec.h>])
136 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
137 AC_CHECK_DECLS(loginfailed,
138 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
140 [#include <usersec.h>],
141 [(void)loginfailed("user","host","tty",0);],
143 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
147 [#include <usersec.h>]
149 AC_CHECK_FUNCS(setauthdb)
150 check_for_aix_broken_getaddrinfo=1
151 AC_DEFINE(BROKEN_REALPATH)
152 AC_DEFINE(SETEUID_BREAKS_SETUID)
153 AC_DEFINE(BROKEN_SETREUID)
154 AC_DEFINE(BROKEN_SETREGID)
155 dnl AIX handles lastlog as part of its login message
156 AC_DEFINE(DISABLE_LASTLOG)
157 AC_DEFINE(LOGIN_NEEDS_UTMPX)
158 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
161 check_for_libcrypt_later=1
162 LIBS="$LIBS /usr/lib/textmode.o"
163 AC_DEFINE(HAVE_CYGWIN)
165 AC_DEFINE(DISABLE_SHADOW)
166 AC_DEFINE(IP_TOS_IS_BROKEN)
167 AC_DEFINE(NO_X11_UNIX_SOCKETS)
168 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
169 AC_DEFINE(DISABLE_FD_PASSING)
172 AC_DEFINE(IP_TOS_IS_BROKEN)
173 AC_DEFINE(SETEUID_BREAKS_SETUID)
174 AC_DEFINE(BROKEN_SETREUID)
175 AC_DEFINE(BROKEN_SETREGID)
178 AC_MSG_CHECKING(if we have working getaddrinfo)
179 AC_TRY_RUN([#include <mach-o/dyld.h>
180 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
184 }], [AC_MSG_RESULT(working)],
185 [AC_MSG_RESULT(buggy)
186 AC_DEFINE(BROKEN_GETADDRINFO)],
187 [AC_MSG_RESULT(assume it is working)])
188 AC_DEFINE(SETEUID_BREAKS_SETUID)
189 AC_DEFINE(BROKEN_SETREUID)
190 AC_DEFINE(BROKEN_SETREGID)
191 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
194 if test -z "$GCC"; then
197 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
198 IPADDR_IN_DISPLAY=yes
199 AC_DEFINE(HAVE_SECUREWARE)
201 AC_DEFINE(LOGIN_NO_ENDOPT)
202 AC_DEFINE(LOGIN_NEEDS_UTMPX)
203 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
204 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
205 LIBS="$LIBS -lsec -lsecpw"
206 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
207 disable_ptmx_check=yes
210 if test -z "$GCC"; then
213 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
214 IPADDR_IN_DISPLAY=yes
216 AC_DEFINE(LOGIN_NO_ENDOPT)
217 AC_DEFINE(LOGIN_NEEDS_UTMPX)
218 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
219 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
221 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
224 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
225 IPADDR_IN_DISPLAY=yes
226 AC_DEFINE(PAM_SUN_CODEBASE)
228 AC_DEFINE(LOGIN_NO_ENDOPT)
229 AC_DEFINE(LOGIN_NEEDS_UTMPX)
230 AC_DEFINE(DISABLE_UTMP)
231 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
232 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
233 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
234 check_for_hpux_broken_getaddrinfo=1
235 check_for_conflicting_getspnam=1
237 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
240 PATH="$PATH:/usr/etc"
241 AC_DEFINE(BROKEN_INET_NTOA)
242 AC_DEFINE(SETEUID_BREAKS_SETUID)
243 AC_DEFINE(BROKEN_SETREUID)
244 AC_DEFINE(BROKEN_SETREGID)
245 AC_DEFINE(WITH_ABBREV_NO_TTY)
246 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
249 PATH="$PATH:/usr/etc"
250 AC_DEFINE(WITH_IRIX_ARRAY)
251 AC_DEFINE(WITH_IRIX_PROJECT)
252 AC_DEFINE(WITH_IRIX_AUDIT)
253 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
254 AC_DEFINE(BROKEN_INET_NTOA)
255 AC_DEFINE(SETEUID_BREAKS_SETUID)
256 AC_DEFINE(BROKEN_SETREUID)
257 AC_DEFINE(BROKEN_SETREGID)
258 AC_DEFINE(BROKEN_UPDWTMPX)
259 AC_DEFINE(WITH_ABBREV_NO_TTY)
260 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
264 check_for_libcrypt_later=1
265 check_for_openpty_ctty_bug=1
266 AC_DEFINE(DONT_TRY_OTHER_AF)
267 AC_DEFINE(PAM_TTY_KLUDGE)
268 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
269 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
270 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
271 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
272 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
273 inet6_default_4in6=yes
276 AC_DEFINE(BROKEN_CMSG_TYPE)
280 mips-sony-bsd|mips-sony-newsos4)
281 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
285 check_for_libcrypt_before=1
286 if test "x$withval" != "xno" ; then
291 check_for_libcrypt_later=1
294 AC_DEFINE(SETEUID_BREAKS_SETUID)
295 AC_DEFINE(BROKEN_SETREUID)
296 AC_DEFINE(BROKEN_SETREGID)
299 conf_lastlog_location="/usr/adm/lastlog"
300 conf_utmp_location=/etc/utmp
301 conf_wtmp_location=/usr/adm/wtmp
304 AC_DEFINE(BROKEN_REALPATH)
306 AC_DEFINE(BROKEN_SAVED_UIDS)
309 if test "x$withval" != "xno" ; then
312 AC_DEFINE(PAM_SUN_CODEBASE)
313 AC_DEFINE(LOGIN_NEEDS_UTMPX)
314 AC_DEFINE(LOGIN_NEEDS_TERM)
315 AC_DEFINE(PAM_TTY_KLUDGE)
316 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
317 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
318 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
319 AC_DEFINE(SSHD_ACQUIRES_CTTY)
320 external_path_file=/etc/default/login
321 # hardwire lastlog location (can't detect it on some versions)
322 conf_lastlog_location="/var/adm/lastlog"
323 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
324 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
325 if test "$sol2ver" -ge 8; then
327 AC_DEFINE(DISABLE_UTMP)
328 AC_DEFINE(DISABLE_WTMP)
334 CPPFLAGS="$CPPFLAGS -DSUNOS4"
335 AC_CHECK_FUNCS(getpwanam)
336 AC_DEFINE(PAM_SUN_CODEBASE)
337 conf_utmp_location=/etc/utmp
338 conf_wtmp_location=/var/adm/wtmp
339 conf_lastlog_location=/var/adm/lastlog
345 AC_DEFINE(SSHD_ACQUIRES_CTTY)
346 AC_DEFINE(SETEUID_BREAKS_SETUID)
347 AC_DEFINE(BROKEN_SETREUID)
348 AC_DEFINE(BROKEN_SETREGID)
351 # /usr/ucblib MUST NOT be searched on ReliantUNIX
352 AC_CHECK_LIB(dl, dlsym, ,)
353 # -lresolv needs to be at then end of LIBS or DNS lookups break
354 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
355 IPADDR_IN_DISPLAY=yes
357 AC_DEFINE(IP_TOS_IS_BROKEN)
358 AC_DEFINE(SETEUID_BREAKS_SETUID)
359 AC_DEFINE(BROKEN_SETREUID)
360 AC_DEFINE(BROKEN_SETREGID)
361 AC_DEFINE(SSHD_ACQUIRES_CTTY)
362 external_path_file=/etc/default/login
363 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
364 # Attention: always take care to bind libsocket and libnsl before libc,
365 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
367 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
370 AC_DEFINE(SETEUID_BREAKS_SETUID)
371 AC_DEFINE(BROKEN_SETREUID)
372 AC_DEFINE(BROKEN_SETREGID)
373 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
375 # UnixWare 7.x, OpenUNIX 8
378 AC_DEFINE(SETEUID_BREAKS_SETUID)
379 AC_DEFINE(BROKEN_SETREUID)
380 AC_DEFINE(BROKEN_SETREGID)
381 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
385 # SCO UNIX and OEM versions of SCO UNIX
387 AC_MSG_ERROR("This Platform is no longer supported.")
391 if test -z "$GCC"; then
392 CFLAGS="$CFLAGS -belf"
394 LIBS="$LIBS -lprot -lx -ltinfo -lm"
397 AC_DEFINE(HAVE_SECUREWARE)
398 AC_DEFINE(DISABLE_SHADOW)
399 AC_DEFINE(DISABLE_FD_PASSING)
400 AC_DEFINE(SETEUID_BREAKS_SETUID)
401 AC_DEFINE(BROKEN_SETREUID)
402 AC_DEFINE(BROKEN_SETREGID)
403 AC_DEFINE(WITH_ABBREV_NO_TTY)
404 AC_DEFINE(BROKEN_UPDWTMPX)
405 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
406 AC_CHECK_FUNCS(getluid setluid)
411 AC_DEFINE(NO_SSH_LASTLOG)
412 AC_DEFINE(SETEUID_BREAKS_SETUID)
413 AC_DEFINE(BROKEN_SETREUID)
414 AC_DEFINE(BROKEN_SETREGID)
416 AC_DEFINE(DISABLE_FD_PASSING)
418 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
422 AC_DEFINE(SETEUID_BREAKS_SETUID)
423 AC_DEFINE(BROKEN_SETREUID)
424 AC_DEFINE(BROKEN_SETREGID)
425 AC_DEFINE(WITH_ABBREV_NO_TTY)
427 AC_DEFINE(DISABLE_FD_PASSING)
429 LIBS="$LIBS -lgen -lacid -ldb"
433 AC_DEFINE(SETEUID_BREAKS_SETUID)
434 AC_DEFINE(BROKEN_SETREUID)
435 AC_DEFINE(BROKEN_SETREGID)
437 AC_DEFINE(DISABLE_FD_PASSING)
438 AC_DEFINE(NO_SSH_LASTLOG)
439 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
440 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
444 AC_MSG_CHECKING(for Digital Unix SIA)
447 [ --with-osfsia Enable Digital Unix SIA],
449 if test "x$withval" = "xno" ; then
450 AC_MSG_RESULT(disabled)
455 if test -z "$no_osfsia" ; then
456 if test -f /etc/sia/matrix.conf; then
458 AC_DEFINE(HAVE_OSF_SIA)
459 AC_DEFINE(DISABLE_LOGIN)
460 AC_DEFINE(DISABLE_FD_PASSING)
461 LIBS="$LIBS -lsecurity -ldb -lm -laud"
464 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
467 AC_DEFINE(BROKEN_GETADDRINFO)
468 AC_DEFINE(SETEUID_BREAKS_SETUID)
469 AC_DEFINE(BROKEN_SETREUID)
470 AC_DEFINE(BROKEN_SETREGID)
475 AC_DEFINE(NO_X11_UNIX_SOCKETS)
476 AC_DEFINE(MISSING_NFDBITS)
477 AC_DEFINE(MISSING_HOWMANY)
478 AC_DEFINE(MISSING_FD_MASK)
482 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
483 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
484 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
485 AC_CHECK_HEADERS(sys/syslog.h)
488 # Allow user to specify flags
490 [ --with-cflags Specify additional flags to pass to compiler],
492 if test -n "$withval" && test "x$withval" != "xno" && \
493 test "x${withval}" != "xyes"; then
494 CFLAGS="$CFLAGS $withval"
498 AC_ARG_WITH(cppflags,
499 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
501 if test -n "$withval" && test "x$withval" != "xno" && \
502 test "x${withval}" != "xyes"; then
503 CPPFLAGS="$CPPFLAGS $withval"
508 [ --with-ldflags Specify additional flags to pass to linker],
510 if test -n "$withval" && test "x$withval" != "xno" && \
511 test "x${withval}" != "xyes"; then
512 LDFLAGS="$LDFLAGS $withval"
517 [ --with-libs Specify additional libraries to link with],
519 if test -n "$withval" && test "x$withval" != "xno" && \
520 test "x${withval}" != "xyes"; then
521 LIBS="$LIBS $withval"
526 AC_MSG_CHECKING(compiler and flags for sanity)
532 [ AC_MSG_RESULT(yes) ],
535 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
537 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
540 # Checks for header files.
541 AC_CHECK_HEADERS(bstring.h crypt.h dirent.h endian.h features.h \
542 floatingpoint.h getopt.h glob.h ia.h lastlog.h limits.h login.h \
543 login_cap.h maillock.h ndir.h netdb.h netgroup.h \
544 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
545 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
546 strings.h sys/dir.h sys/strtio.h sys/audit.h sys/bitypes.h \
547 sys/bsdtty.h sys/cdefs.h sys/mman.h sys/ndir.h sys/prctl.h \
548 sys/pstat.h sys/select.h sys/stat.h sys/stream.h \
549 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h sys/un.h \
550 time.h tmpdir.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
552 # sys/ptms.h requires sys/stream.h to be included first on Solaris
553 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
554 #ifdef HAVE_SYS_STREAM_H
555 # include <sys/stream.h>
559 # Checks for libraries.
560 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
561 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
563 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
564 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
565 AC_CHECK_LIB(gen, dirname,[
566 AC_CACHE_CHECK([for broken dirname],
567 ac_cv_have_broken_dirname, [
575 int main(int argc, char **argv) {
578 strncpy(buf,"/etc", 32);
580 if (!s || strncmp(s, "/", 32) != 0) {
587 [ ac_cv_have_broken_dirname="no" ],
588 [ ac_cv_have_broken_dirname="yes" ]
592 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
594 AC_DEFINE(HAVE_DIRNAME)
595 AC_CHECK_HEADERS(libgen.h)
600 AC_CHECK_FUNC(getspnam, ,
601 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
602 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
606 [ --with-zlib=PATH Use zlib in PATH],
607 [ if test "x$withval" = "xno" ; then
608 AC_MSG_ERROR([*** zlib is required ***])
609 elif test "x$withval" != "xyes"; then
610 if test -d "$withval/lib"; then
611 if test -n "${need_dash_r}"; then
612 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
614 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
617 if test -n "${need_dash_r}"; then
618 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
620 LDFLAGS="-L${withval} ${LDFLAGS}"
623 if test -d "$withval/include"; then
624 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
626 CPPFLAGS="-I${withval} ${CPPFLAGS}"
631 AC_CHECK_LIB(z, deflate, ,
633 saved_CPPFLAGS="$CPPFLAGS"
634 saved_LDFLAGS="$LDFLAGS"
636 dnl Check default zlib install dir
637 if test -n "${need_dash_r}"; then
638 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
640 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
642 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
644 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
646 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
651 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
653 AC_ARG_WITH(zlib-version-check,
654 [ --without-zlib-version-check Disable zlib version check],
655 [ if test "x$withval" = "xno" ; then
656 zlib_check_nonfatal=1
661 AC_MSG_CHECKING(for possibly buggy zlib)
662 AC_RUN_IFELSE([AC_LANG_SOURCE([[
667 int a=0, b=0, c=0, d=0, n, v;
668 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
669 if (n != 3 && n != 4)
671 v = a*1000000 + b*10000 + c*100 + d;
672 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
675 if (a == 1 && b == 1 && c >= 4)
678 /* 1.2.1.2 and up are OK */
687 if test -z "$zlib_check_nonfatal" ; then
688 AC_MSG_ERROR([*** zlib too old - check config.log ***
689 Your reported zlib version has known security problems. It's possible your
690 vendor has fixed these problems without changing the version number. If you
691 are sure this is the case, you can disable the check by running
692 "./configure --without-zlib-version-check".
693 If you are in doubt, upgrade zlib to version 1.2.1.2 or greater.
694 See http://www.gzip.org/zlib/ for details.])
696 AC_MSG_WARN([zlib version may have security problems])
699 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
703 AC_CHECK_FUNC(strcasecmp,
704 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
706 AC_CHECK_FUNC(utimes,
707 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
708 LIBS="$LIBS -lc89"]) ]
711 dnl Checks for libutil functions
712 AC_CHECK_HEADERS(libutil.h)
713 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
714 AC_CHECK_FUNCS(logout updwtmp logwtmp)
718 # Check for ALTDIRFUNC glob() extension
719 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
720 AC_EGREP_CPP(FOUNDIT,
723 #ifdef GLOB_ALTDIRFUNC
728 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
736 # Check for g.gl_matchc glob() extension
737 AC_MSG_CHECKING(for gl_matchc field in glob_t)
738 AC_EGREP_CPP(FOUNDIT,
741 int main(void){glob_t g; g.gl_matchc = 1;}
744 AC_DEFINE(GLOB_HAS_GL_MATCHC)
752 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
755 #include <sys/types.h>
757 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
759 [AC_MSG_RESULT(yes)],
762 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
765 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
766 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
770 AC_MSG_CHECKING([for /proc/pid/fd directory])
771 if test -d "/proc/$$/fd" ; then
772 AC_DEFINE(HAVE_PROC_PID)
778 # Check whether user wants S/Key support
781 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
783 if test "x$withval" != "xno" ; then
785 if test "x$withval" != "xyes" ; then
786 CPPFLAGS="$CPPFLAGS -I${withval}/include"
787 LDFLAGS="$LDFLAGS -L${withval}/lib"
794 AC_MSG_CHECKING([for s/key support])
799 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
801 [AC_MSG_RESULT(yes)],
804 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
806 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
810 [(void)skeychallenge(NULL,"name","",0);],
812 AC_DEFINE(SKEYCHALLENGE_4ARG)],
819 # Check whether user wants TCP wrappers support
821 AC_ARG_WITH(tcp-wrappers,
822 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
824 if test "x$withval" != "xno" ; then
826 saved_LDFLAGS="$LDFLAGS"
827 saved_CPPFLAGS="$CPPFLAGS"
828 if test -n "${withval}" && \
829 test "x${withval}" != "xyes"; then
830 if test -d "${withval}/lib"; then
831 if test -n "${need_dash_r}"; then
832 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
834 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
837 if test -n "${need_dash_r}"; then
838 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
840 LDFLAGS="-L${withval} ${LDFLAGS}"
843 if test -d "${withval}/include"; then
844 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
846 CPPFLAGS="-I${withval} ${CPPFLAGS}"
850 LIBS="$LIBWRAP $LIBS"
851 AC_MSG_CHECKING(for libwrap)
854 #include <sys/types.h>
855 #include <sys/socket.h>
856 #include <netinet/in.h>
858 int deny_severity = 0, allow_severity = 0;
868 AC_MSG_ERROR([*** libwrap missing])
876 # Check whether user wants libedit support
879 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
880 [ if test "x$withval" != "xno" ; then
881 if test "x$withval" != "xyes"; then
882 CPPFLAGS="$CPPFLAGS -I$withval/include"
883 LDFLAGS="$LDFLAGS -L$withval/lib"
885 AC_CHECK_LIB(edit, el_init,
886 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
887 LIBEDIT="-ledit -lcurses"
891 [ AC_MSG_ERROR(libedit not found) ],
899 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
901 AC_MSG_CHECKING(for supported audit module)
906 dnl Checks for headers, libs and functions
907 AC_CHECK_HEADERS(bsm/audit.h, [],
908 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
909 AC_CHECK_LIB(bsm, getaudit, [],
910 [AC_MSG_ERROR(BSM enabled and required library not found)])
911 AC_CHECK_FUNCS(getaudit, [],
912 [AC_MSG_ERROR(BSM enabled and required function not found)])
914 AC_CHECK_FUNCS(getaudit_addr)
915 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
920 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
923 AC_MSG_ERROR([Unknown audit module $withval])
928 dnl Checks for library functions. Please keep in alphabetical order
930 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
931 bindresvport_sa clock closefrom dirfd fchdir fchmod fchown \
932 freeaddrinfo futimes getaddrinfo getcwd getgrouplist getnameinfo \
933 getopt getpeereid _getpty getrlimit getttyent glob inet_aton \
934 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
935 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
936 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
937 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
938 setproctitle setregid setreuid setrlimit setsid setvbuf \
939 sigaction sigvec snprintf socketpair strdup strerror \
940 strlcat strlcpy strmode strnvis strtonum strtoul sysconf tcgetpgrp \
941 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
944 # IRIX has a const char return value for gai_strerror()
945 AC_CHECK_FUNCS(gai_strerror,[
946 AC_DEFINE(HAVE_GAI_STRERROR)
948 #include <sys/types.h>
949 #include <sys/socket.h>
952 const char *gai_strerror(int);],[
955 str = gai_strerror(0);],[
956 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
957 [Define if gai_strerror() returns const char *])])])
959 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
961 dnl Make sure prototypes are defined for these before using them.
962 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
963 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
965 dnl tcsendbreak might be a macro
966 AC_CHECK_DECL(tcsendbreak,
967 [AC_DEFINE(HAVE_TCSENDBREAK)],
968 [AC_CHECK_FUNCS(tcsendbreak)],
969 [#include <termios.h>]
972 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
974 AC_CHECK_FUNCS(setresuid, [
975 dnl Some platorms have setresuid that isn't implemented, test for this
976 AC_MSG_CHECKING(if setresuid seems to work)
981 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
983 [AC_MSG_RESULT(yes)],
984 [AC_DEFINE(BROKEN_SETRESUID)
985 AC_MSG_RESULT(not implemented)],
986 [AC_MSG_WARN([cross compiling: not checking setresuid])]
990 AC_CHECK_FUNCS(setresgid, [
991 dnl Some platorms have setresgid that isn't implemented, test for this
992 AC_MSG_CHECKING(if setresgid seems to work)
997 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
999 [AC_MSG_RESULT(yes)],
1000 [AC_DEFINE(BROKEN_SETRESGID)
1001 AC_MSG_RESULT(not implemented)],
1002 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1006 dnl Checks for time functions
1007 AC_CHECK_FUNCS(gettimeofday time)
1008 dnl Checks for utmp functions
1009 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1010 AC_CHECK_FUNCS(utmpname)
1011 dnl Checks for utmpx functions
1012 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1013 AC_CHECK_FUNCS(setutxent utmpxname)
1015 AC_CHECK_FUNC(daemon,
1016 [AC_DEFINE(HAVE_DAEMON)],
1017 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1020 AC_CHECK_FUNC(getpagesize,
1021 [AC_DEFINE(HAVE_GETPAGESIZE)],
1022 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1025 # Check for broken snprintf
1026 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1027 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1031 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1033 [AC_MSG_RESULT(yes)],
1036 AC_DEFINE(BROKEN_SNPRINTF)
1037 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1039 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1043 # Check for missing getpeereid (or equiv) support
1045 if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1046 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1048 [#include <sys/types.h>
1049 #include <sys/socket.h>],
1050 [int i = SO_PEERCRED;],
1051 [ AC_MSG_RESULT(yes)
1052 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1059 dnl see whether mkstemp() requires XXXXXX
1060 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1061 AC_MSG_CHECKING([for (overly) strict mkstemp])
1065 main() { char template[]="conftest.mkstemp-test";
1066 if (mkstemp(template) == -1)
1068 unlink(template); exit(0);
1076 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1080 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1085 dnl make sure that openpty does not reacquire controlling terminal
1086 if test ! -z "$check_for_openpty_ctty_bug"; then
1087 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1091 #include <sys/fcntl.h>
1092 #include <sys/types.h>
1093 #include <sys/wait.h>
1099 int fd, ptyfd, ttyfd, status;
1102 if (pid < 0) { /* failed */
1104 } else if (pid > 0) { /* parent */
1105 waitpid(pid, &status, 0);
1106 if (WIFEXITED(status))
1107 exit(WEXITSTATUS(status));
1110 } else { /* child */
1111 close(0); close(1); close(2);
1113 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1114 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1116 exit(3); /* Acquired ctty: broken */
1118 exit(0); /* Did not acquire ctty: OK */
1127 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1132 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1133 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1134 AC_MSG_CHECKING(if getaddrinfo seems to work)
1138 #include <sys/socket.h>
1141 #include <netinet/in.h>
1143 #define TEST_PORT "2222"
1149 struct addrinfo *gai_ai, *ai, hints;
1150 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1152 memset(&hints, 0, sizeof(hints));
1153 hints.ai_family = PF_UNSPEC;
1154 hints.ai_socktype = SOCK_STREAM;
1155 hints.ai_flags = AI_PASSIVE;
1157 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1159 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1163 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1164 if (ai->ai_family != AF_INET6)
1167 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1168 sizeof(ntop), strport, sizeof(strport),
1169 NI_NUMERICHOST|NI_NUMERICSERV);
1172 if (err == EAI_SYSTEM)
1173 perror("getnameinfo EAI_SYSTEM");
1175 fprintf(stderr, "getnameinfo failed: %s\n",
1180 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1183 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1196 AC_DEFINE(BROKEN_GETADDRINFO)
1201 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1202 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1203 AC_MSG_CHECKING(if getaddrinfo seems to work)
1207 #include <sys/socket.h>
1210 #include <netinet/in.h>
1212 #define TEST_PORT "2222"
1218 struct addrinfo *gai_ai, *ai, hints;
1219 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1221 memset(&hints, 0, sizeof(hints));
1222 hints.ai_family = PF_UNSPEC;
1223 hints.ai_socktype = SOCK_STREAM;
1224 hints.ai_flags = AI_PASSIVE;
1226 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1228 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1232 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1233 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1236 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1237 sizeof(ntop), strport, sizeof(strport),
1238 NI_NUMERICHOST|NI_NUMERICSERV);
1240 if (ai->ai_family == AF_INET && err != 0) {
1241 perror("getnameinfo");
1250 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1251 [Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1255 AC_DEFINE(BROKEN_GETADDRINFO)
1260 if test "x$check_for_conflicting_getspnam" = "x1"; then
1261 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1265 int main(void) {exit(0);}
1272 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1273 [Conflicting defs for getspnam])
1280 # Check for PAM libs
1283 [ --with-pam Enable PAM support ],
1285 if test "x$withval" != "xno" ; then
1286 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1287 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1288 AC_MSG_ERROR([PAM headers not found])
1291 AC_CHECK_LIB(dl, dlopen, , )
1292 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1293 AC_CHECK_FUNCS(pam_getenvlist)
1294 AC_CHECK_FUNCS(pam_putenv)
1299 if test $ac_cv_lib_dl_dlopen = yes; then
1309 # Check for older PAM
1310 if test "x$PAM_MSG" = "xyes" ; then
1311 # Check PAM strerror arguments (old PAM)
1312 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1316 #if defined(HAVE_SECURITY_PAM_APPL_H)
1317 #include <security/pam_appl.h>
1318 #elif defined (HAVE_PAM_PAM_APPL_H)
1319 #include <pam/pam_appl.h>
1322 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1323 [AC_MSG_RESULT(no)],
1325 AC_DEFINE(HAVE_OLD_PAM)
1327 PAM_MSG="yes (old library)"
1332 # Search for OpenSSL
1333 saved_CPPFLAGS="$CPPFLAGS"
1334 saved_LDFLAGS="$LDFLAGS"
1335 AC_ARG_WITH(ssl-dir,
1336 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1338 if test "x$withval" != "xno" ; then
1341 ./*|../*) withval="`pwd`/$withval"
1343 if test -d "$withval/lib"; then
1344 if test -n "${need_dash_r}"; then
1345 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1347 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1350 if test -n "${need_dash_r}"; then
1351 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1353 LDFLAGS="-L${withval} ${LDFLAGS}"
1356 if test -d "$withval/include"; then
1357 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1359 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1364 LIBS="-lcrypto $LIBS"
1365 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1367 dnl Check default openssl install dir
1368 if test -n "${need_dash_r}"; then
1369 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1371 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1373 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1374 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1376 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1382 # Determine OpenSSL header version
1383 AC_MSG_CHECKING([OpenSSL header version])
1388 #include <openssl/opensslv.h>
1389 #define DATA "conftest.sslincver"
1394 fd = fopen(DATA,"w");
1398 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1405 ssl_header_ver=`cat conftest.sslincver`
1406 AC_MSG_RESULT($ssl_header_ver)
1409 AC_MSG_RESULT(not found)
1410 AC_MSG_ERROR(OpenSSL version header not found.)
1413 AC_MSG_WARN([cross compiling: not checking])
1417 # Determine OpenSSL library version
1418 AC_MSG_CHECKING([OpenSSL library version])
1423 #include <openssl/opensslv.h>
1424 #include <openssl/crypto.h>
1425 #define DATA "conftest.ssllibver"
1430 fd = fopen(DATA,"w");
1434 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1441 ssl_library_ver=`cat conftest.ssllibver`
1442 AC_MSG_RESULT($ssl_library_ver)
1445 AC_MSG_RESULT(not found)
1446 AC_MSG_ERROR(OpenSSL library not found.)
1449 AC_MSG_WARN([cross compiling: not checking])
1453 # Sanity check OpenSSL headers
1454 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1458 #include <openssl/opensslv.h>
1459 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1466 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1467 Check config.log for details.
1468 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1471 AC_MSG_WARN([cross compiling: not checking])
1475 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1476 # because the system crypt() is more featureful.
1477 if test "x$check_for_libcrypt_before" = "x1"; then
1478 AC_CHECK_LIB(crypt, crypt)
1481 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1482 # version in OpenSSL.
1483 if test "x$check_for_libcrypt_later" = "x1"; then
1484 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1488 ### Configure cryptographic random number support
1490 # Check wheter OpenSSL seeds itself
1491 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1495 #include <openssl/rand.h>
1496 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1499 OPENSSL_SEEDS_ITSELF=yes
1504 # Default to use of the rand helper if OpenSSL doesn't
1509 AC_MSG_WARN([cross compiling: assuming yes])
1510 # This is safe, since all recent OpenSSL versions will
1511 # complain at runtime if not seeded correctly.
1512 OPENSSL_SEEDS_ITSELF=yes
1517 # Do we want to force the use of the rand helper?
1518 AC_ARG_WITH(rand-helper,
1519 [ --with-rand-helper Use subprocess to gather strong randomness ],
1521 if test "x$withval" = "xno" ; then
1522 # Force use of OpenSSL's internal RNG, even if
1523 # the previous test showed it to be unseeded.
1524 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1525 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1526 OPENSSL_SEEDS_ITSELF=yes
1535 # Which randomness source do we use?
1536 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
1538 AC_DEFINE(OPENSSL_PRNG_ONLY)
1539 RAND_MSG="OpenSSL internal ONLY"
1540 INSTALL_SSH_RAND_HELPER=""
1541 elif test ! -z "$USE_RAND_HELPER" ; then
1542 # install rand helper
1543 RAND_MSG="ssh-rand-helper"
1544 INSTALL_SSH_RAND_HELPER="yes"
1546 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1548 ### Configuration of ssh-rand-helper
1551 AC_ARG_WITH(prngd-port,
1552 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1561 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1564 if test ! -z "$withval" ; then
1565 PRNGD_PORT="$withval"
1566 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1571 # PRNGD Unix domain socket
1572 AC_ARG_WITH(prngd-socket,
1573 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1577 withval="/var/run/egd-pool"
1585 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1589 if test ! -z "$withval" ; then
1590 if test ! -z "$PRNGD_PORT" ; then
1591 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1593 if test ! -r "$withval" ; then
1594 AC_MSG_WARN(Entropy socket is not readable)
1596 PRNGD_SOCKET="$withval"
1597 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1601 # Check for existing socket only if we don't have a random device already
1602 if test "$USE_RAND_HELPER" = yes ; then
1603 AC_MSG_CHECKING(for PRNGD/EGD socket)
1604 # Insert other locations here
1605 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1606 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1607 PRNGD_SOCKET="$sock"
1608 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1612 if test ! -z "$PRNGD_SOCKET" ; then
1613 AC_MSG_RESULT($PRNGD_SOCKET)
1615 AC_MSG_RESULT(not found)
1621 # Change default command timeout for hashing entropy source
1623 AC_ARG_WITH(entropy-timeout,
1624 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1626 if test -n "$withval" && test "x$withval" != "xno" && \
1627 test "x${withval}" != "xyes"; then
1628 entropy_timeout=$withval
1632 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1634 SSH_PRIVSEP_USER=sshd
1635 AC_ARG_WITH(privsep-user,
1636 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1638 if test -n "$withval" && test "x$withval" != "xno" && \
1639 test "x${withval}" != "xyes"; then
1640 SSH_PRIVSEP_USER=$withval
1644 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1645 AC_SUBST(SSH_PRIVSEP_USER)
1647 # We do this little dance with the search path to insure
1648 # that programs that we select for use by installed programs
1649 # (which may be run by the super-user) come from trusted
1650 # locations before they come from the user's private area.
1651 # This should help avoid accidentally configuring some
1652 # random version of a program in someone's personal bin.
1656 test -h /bin 2> /dev/null && PATH=/usr/bin
1657 test -d /sbin && PATH=$PATH:/sbin
1658 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1659 PATH=$PATH:/etc:$OPATH
1661 # These programs are used by the command hashing source to gather entropy
1662 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1663 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1664 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1665 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1666 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1667 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1668 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1669 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1670 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1671 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1672 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1673 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1674 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1675 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1676 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1677 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1681 # Where does ssh-rand-helper get its randomness from?
1682 INSTALL_SSH_PRNG_CMDS=""
1683 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1684 if test ! -z "$PRNGD_PORT" ; then
1685 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1686 elif test ! -z "$PRNGD_SOCKET" ; then
1687 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1689 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1690 RAND_HELPER_CMDHASH=yes
1691 INSTALL_SSH_PRNG_CMDS="yes"
1694 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1697 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1698 if test ! -z "$SONY" ; then
1699 LIBS="$LIBS -liberty";
1702 # Checks for data types
1703 AC_CHECK_SIZEOF(char, 1)
1704 AC_CHECK_SIZEOF(short int, 2)
1705 AC_CHECK_SIZEOF(int, 4)
1706 AC_CHECK_SIZEOF(long int, 4)
1707 AC_CHECK_SIZEOF(long long int, 8)
1709 # Sanity check long long for some platforms (AIX)
1710 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1711 ac_cv_sizeof_long_long_int=0
1714 # More checks for data types
1715 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1717 [ #include <sys/types.h> ],
1719 [ ac_cv_have_u_int="yes" ],
1720 [ ac_cv_have_u_int="no" ]
1723 if test "x$ac_cv_have_u_int" = "xyes" ; then
1724 AC_DEFINE(HAVE_U_INT)
1728 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1730 [ #include <sys/types.h> ],
1731 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1732 [ ac_cv_have_intxx_t="yes" ],
1733 [ ac_cv_have_intxx_t="no" ]
1736 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1737 AC_DEFINE(HAVE_INTXX_T)
1741 if (test -z "$have_intxx_t" && \
1742 test "x$ac_cv_header_stdint_h" = "xyes")
1744 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1746 [ #include <stdint.h> ],
1747 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1749 AC_DEFINE(HAVE_INTXX_T)
1752 [ AC_MSG_RESULT(no) ]
1756 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1759 #include <sys/types.h>
1760 #ifdef HAVE_STDINT_H
1761 # include <stdint.h>
1763 #include <sys/socket.h>
1764 #ifdef HAVE_SYS_BITYPES_H
1765 # include <sys/bitypes.h>
1768 [ int64_t a; a = 1;],
1769 [ ac_cv_have_int64_t="yes" ],
1770 [ ac_cv_have_int64_t="no" ]
1773 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1774 AC_DEFINE(HAVE_INT64_T)
1777 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1779 [ #include <sys/types.h> ],
1780 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1781 [ ac_cv_have_u_intxx_t="yes" ],
1782 [ ac_cv_have_u_intxx_t="no" ]
1785 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1786 AC_DEFINE(HAVE_U_INTXX_T)
1790 if test -z "$have_u_intxx_t" ; then
1791 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1793 [ #include <sys/socket.h> ],
1794 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1796 AC_DEFINE(HAVE_U_INTXX_T)
1799 [ AC_MSG_RESULT(no) ]
1803 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1805 [ #include <sys/types.h> ],
1806 [ u_int64_t a; a = 1;],
1807 [ ac_cv_have_u_int64_t="yes" ],
1808 [ ac_cv_have_u_int64_t="no" ]
1811 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1812 AC_DEFINE(HAVE_U_INT64_T)
1816 if test -z "$have_u_int64_t" ; then
1817 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1819 [ #include <sys/bitypes.h> ],
1820 [ u_int64_t a; a = 1],
1822 AC_DEFINE(HAVE_U_INT64_T)
1825 [ AC_MSG_RESULT(no) ]
1829 if test -z "$have_u_intxx_t" ; then
1830 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1833 #include <sys/types.h>
1835 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1836 [ ac_cv_have_uintxx_t="yes" ],
1837 [ ac_cv_have_uintxx_t="no" ]
1840 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1841 AC_DEFINE(HAVE_UINTXX_T)
1845 if test -z "$have_uintxx_t" ; then
1846 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1848 [ #include <stdint.h> ],
1849 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1851 AC_DEFINE(HAVE_UINTXX_T)
1854 [ AC_MSG_RESULT(no) ]
1858 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1859 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1861 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1864 #include <sys/bitypes.h>
1867 int8_t a; int16_t b; int32_t c;
1868 u_int8_t e; u_int16_t f; u_int32_t g;
1869 a = b = c = e = f = g = 1;
1872 AC_DEFINE(HAVE_U_INTXX_T)
1873 AC_DEFINE(HAVE_INTXX_T)
1881 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1884 #include <sys/types.h>
1886 [ u_char foo; foo = 125; ],
1887 [ ac_cv_have_u_char="yes" ],
1888 [ ac_cv_have_u_char="no" ]
1891 if test "x$ac_cv_have_u_char" = "xyes" ; then
1892 AC_DEFINE(HAVE_U_CHAR)
1897 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1899 AC_CHECK_TYPES(in_addr_t,,,
1900 [#include <sys/types.h>
1901 #include <netinet/in.h>])
1903 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1906 #include <sys/types.h>
1908 [ size_t foo; foo = 1235; ],
1909 [ ac_cv_have_size_t="yes" ],
1910 [ ac_cv_have_size_t="no" ]
1913 if test "x$ac_cv_have_size_t" = "xyes" ; then
1914 AC_DEFINE(HAVE_SIZE_T)
1917 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1920 #include <sys/types.h>
1922 [ ssize_t foo; foo = 1235; ],
1923 [ ac_cv_have_ssize_t="yes" ],
1924 [ ac_cv_have_ssize_t="no" ]
1927 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1928 AC_DEFINE(HAVE_SSIZE_T)
1931 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1936 [ clock_t foo; foo = 1235; ],
1937 [ ac_cv_have_clock_t="yes" ],
1938 [ ac_cv_have_clock_t="no" ]
1941 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1942 AC_DEFINE(HAVE_CLOCK_T)
1945 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1948 #include <sys/types.h>
1949 #include <sys/socket.h>
1951 [ sa_family_t foo; foo = 1235; ],
1952 [ ac_cv_have_sa_family_t="yes" ],
1955 #include <sys/types.h>
1956 #include <sys/socket.h>
1957 #include <netinet/in.h>
1959 [ sa_family_t foo; foo = 1235; ],
1960 [ ac_cv_have_sa_family_t="yes" ],
1962 [ ac_cv_have_sa_family_t="no" ]
1966 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1967 AC_DEFINE(HAVE_SA_FAMILY_T)
1970 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1973 #include <sys/types.h>
1975 [ pid_t foo; foo = 1235; ],
1976 [ ac_cv_have_pid_t="yes" ],
1977 [ ac_cv_have_pid_t="no" ]
1980 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1981 AC_DEFINE(HAVE_PID_T)
1984 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1987 #include <sys/types.h>
1989 [ mode_t foo; foo = 1235; ],
1990 [ ac_cv_have_mode_t="yes" ],
1991 [ ac_cv_have_mode_t="no" ]
1994 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1995 AC_DEFINE(HAVE_MODE_T)
1999 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2002 #include <sys/types.h>
2003 #include <sys/socket.h>
2005 [ struct sockaddr_storage s; ],
2006 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2007 [ ac_cv_have_struct_sockaddr_storage="no" ]
2010 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2011 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2014 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2017 #include <sys/types.h>
2018 #include <netinet/in.h>
2020 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2021 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2022 [ ac_cv_have_struct_sockaddr_in6="no" ]
2025 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2026 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2029 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2032 #include <sys/types.h>
2033 #include <netinet/in.h>
2035 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2036 [ ac_cv_have_struct_in6_addr="yes" ],
2037 [ ac_cv_have_struct_in6_addr="no" ]
2040 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2041 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2044 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2047 #include <sys/types.h>
2048 #include <sys/socket.h>
2051 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2052 [ ac_cv_have_struct_addrinfo="yes" ],
2053 [ ac_cv_have_struct_addrinfo="no" ]
2056 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2057 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2060 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2062 [ #include <sys/time.h> ],
2063 [ struct timeval tv; tv.tv_sec = 1;],
2064 [ ac_cv_have_struct_timeval="yes" ],
2065 [ ac_cv_have_struct_timeval="no" ]
2068 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2069 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2070 have_struct_timeval=1
2073 AC_CHECK_TYPES(struct timespec)
2075 # We need int64_t or else certian parts of the compile will fail.
2076 if test "x$ac_cv_have_int64_t" = "xno" && \
2077 test "x$ac_cv_sizeof_long_int" != "x8" && \
2078 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2079 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2080 echo "an alternative compiler (I.E., GCC) before continuing."
2084 dnl test snprintf (broken on SCO w/gcc)
2089 #ifdef HAVE_SNPRINTF
2093 char expected_out[50];
2095 #if (SIZEOF_LONG_INT == 8)
2096 long int num = 0x7fffffffffffffff;
2098 long long num = 0x7fffffffffffffffll;
2100 strcpy(expected_out, "9223372036854775807");
2101 snprintf(buf, mazsize, "%lld", num);
2102 if(strcmp(buf, expected_out) != 0)
2109 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2110 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2114 dnl Checks for structure members
2115 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2116 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2117 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2118 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2119 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2120 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2121 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2122 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2123 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2124 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2125 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2126 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2127 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2128 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2129 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2130 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2131 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2133 AC_CHECK_MEMBERS([struct stat.st_blksize])
2135 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2136 ac_cv_have_ss_family_in_struct_ss, [
2139 #include <sys/types.h>
2140 #include <sys/socket.h>
2142 [ struct sockaddr_storage s; s.ss_family = 1; ],
2143 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2144 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2147 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2148 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2151 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2152 ac_cv_have___ss_family_in_struct_ss, [
2155 #include <sys/types.h>
2156 #include <sys/socket.h>
2158 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2159 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2160 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2163 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2164 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2167 AC_CACHE_CHECK([for pw_class field in struct passwd],
2168 ac_cv_have_pw_class_in_struct_passwd, [
2173 [ struct passwd p; p.pw_class = 0; ],
2174 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2175 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2178 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2179 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2182 AC_CACHE_CHECK([for pw_expire field in struct passwd],
2183 ac_cv_have_pw_expire_in_struct_passwd, [
2188 [ struct passwd p; p.pw_expire = 0; ],
2189 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2190 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2193 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2194 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2197 AC_CACHE_CHECK([for pw_change field in struct passwd],
2198 ac_cv_have_pw_change_in_struct_passwd, [
2203 [ struct passwd p; p.pw_change = 0; ],
2204 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2205 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2208 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2209 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2212 dnl make sure we're using the real structure members and not defines
2213 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2214 ac_cv_have_accrights_in_msghdr, [
2217 #include <sys/types.h>
2218 #include <sys/socket.h>
2219 #include <sys/uio.h>
2221 #ifdef msg_accrights
2222 #error "msg_accrights is a macro"
2226 m.msg_accrights = 0;
2230 [ ac_cv_have_accrights_in_msghdr="yes" ],
2231 [ ac_cv_have_accrights_in_msghdr="no" ]
2234 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2235 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2238 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2239 ac_cv_have_control_in_msghdr, [
2242 #include <sys/types.h>
2243 #include <sys/socket.h>
2244 #include <sys/uio.h>
2247 #error "msg_control is a macro"
2255 [ ac_cv_have_control_in_msghdr="yes" ],
2256 [ ac_cv_have_control_in_msghdr="no" ]
2259 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2260 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2263 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2265 [ extern char *__progname; printf("%s", __progname); ],
2266 [ ac_cv_libc_defines___progname="yes" ],
2267 [ ac_cv_libc_defines___progname="no" ]
2270 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2271 AC_DEFINE(HAVE___PROGNAME)
2274 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2278 [ printf("%s", __FUNCTION__); ],
2279 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2280 [ ac_cv_cc_implements___FUNCTION__="no" ]
2283 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2284 AC_DEFINE(HAVE___FUNCTION__)
2287 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2291 [ printf("%s", __func__); ],
2292 [ ac_cv_cc_implements___func__="yes" ],
2293 [ ac_cv_cc_implements___func__="no" ]
2296 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2297 AC_DEFINE(HAVE___func__)
2300 AC_CACHE_CHECK([whether getopt has optreset support],
2301 ac_cv_have_getopt_optreset, [
2306 [ extern int optreset; optreset = 0; ],
2307 [ ac_cv_have_getopt_optreset="yes" ],
2308 [ ac_cv_have_getopt_optreset="no" ]
2311 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2312 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2315 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2317 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2318 [ ac_cv_libc_defines_sys_errlist="yes" ],
2319 [ ac_cv_libc_defines_sys_errlist="no" ]
2322 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2323 AC_DEFINE(HAVE_SYS_ERRLIST)
2327 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2329 [ extern int sys_nerr; printf("%i", sys_nerr);],
2330 [ ac_cv_libc_defines_sys_nerr="yes" ],
2331 [ ac_cv_libc_defines_sys_nerr="no" ]
2334 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2335 AC_DEFINE(HAVE_SYS_NERR)
2339 # Check whether user wants sectok support
2341 [ --with-sectok Enable smartcard support using libsectok],
2343 if test "x$withval" != "xno" ; then
2344 if test "x$withval" != "xyes" ; then
2345 CPPFLAGS="$CPPFLAGS -I${withval}"
2346 LDFLAGS="$LDFLAGS -L${withval}"
2347 if test ! -z "$need_dash_r" ; then
2348 LDFLAGS="$LDFLAGS -R${withval}"
2350 if test ! -z "$blibpath" ; then
2351 blibpath="$blibpath:${withval}"
2354 AC_CHECK_HEADERS(sectok.h)
2355 if test "$ac_cv_header_sectok_h" != yes; then
2356 AC_MSG_ERROR(Can't find sectok.h)
2358 AC_CHECK_LIB(sectok, sectok_open)
2359 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2360 AC_MSG_ERROR(Can't find libsectok)
2362 AC_DEFINE(SMARTCARD)
2363 AC_DEFINE(USE_SECTOK)
2364 SCARD_MSG="yes, using sectok"
2369 # Check whether user wants OpenSC support
2372 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2374 if test "x$withval" != "xno" ; then
2375 if test "x$withval" != "xyes" ; then
2376 OPENSC_CONFIG=$withval/bin/opensc-config
2378 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2380 if test "$OPENSC_CONFIG" != "no"; then
2381 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2382 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2383 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2384 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2385 AC_DEFINE(SMARTCARD)
2386 AC_DEFINE(USE_OPENSC)
2387 SCARD_MSG="yes, using OpenSC"
2393 # Check libraries needed by DNS fingerprint support
2394 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2395 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
2397 # Needed by our getrrsetbyname()
2398 AC_SEARCH_LIBS(res_query, resolv)
2399 AC_SEARCH_LIBS(dn_expand, resolv)
2400 AC_MSG_CHECKING(if res_query will link)
2401 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2404 LIBS="$LIBS -lresolv"
2405 AC_MSG_CHECKING(for res_query in -lresolv)
2410 res_query (0, 0, 0, 0, 0);
2414 [LIBS="$LIBS -lresolv"
2415 AC_MSG_RESULT(yes)],
2419 AC_CHECK_FUNCS(_getshort _getlong)
2420 AC_CHECK_DECLS([_getshort, _getlong])
2421 AC_CHECK_MEMBER(HEADER.ad,
2422 [AC_DEFINE(HAVE_HEADER_AD)],,
2423 [#include <arpa/nameser.h>])
2426 # Check whether user wants Kerberos 5 support
2428 AC_ARG_WITH(kerberos5,
2429 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2430 [ if test "x$withval" != "xno" ; then
2431 if test "x$withval" = "xyes" ; then
2432 KRB5ROOT="/usr/local"
2440 AC_MSG_CHECKING(for krb5-config)
2441 if test -x $KRB5ROOT/bin/krb5-config ; then
2442 KRB5CONF=$KRB5ROOT/bin/krb5-config
2443 AC_MSG_RESULT($KRB5CONF)
2445 AC_MSG_CHECKING(for gssapi support)
2446 if $KRB5CONF | grep gssapi >/dev/null ; then
2454 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2455 K5LIBS="`$KRB5CONF --libs $k5confopts`"
2456 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2457 AC_MSG_CHECKING(whether we are using Heimdal)
2458 AC_TRY_COMPILE([ #include <krb5.h> ],
2459 [ char *tmp = heimdal_version; ],
2460 [ AC_MSG_RESULT(yes)
2461 AC_DEFINE(HEIMDAL) ],
2466 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2467 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2468 AC_MSG_CHECKING(whether we are using Heimdal)
2469 AC_TRY_COMPILE([ #include <krb5.h> ],
2470 [ char *tmp = heimdal_version; ],
2471 [ AC_MSG_RESULT(yes)
2473 K5LIBS="-lkrb5 -ldes"
2474 K5LIBS="$K5LIBS -lcom_err -lasn1"
2475 AC_CHECK_LIB(roken, net_write,
2476 [K5LIBS="$K5LIBS -lroken"])
2479 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2482 AC_SEARCH_LIBS(dn_expand, resolv)
2484 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2486 K5LIBS="-lgssapi $K5LIBS" ],
2487 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2489 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2490 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2495 AC_CHECK_HEADER(gssapi.h, ,
2496 [ unset ac_cv_header_gssapi_h
2497 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2498 AC_CHECK_HEADERS(gssapi.h, ,
2499 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2505 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2506 AC_CHECK_HEADER(gssapi_krb5.h, ,
2507 [ CPPFLAGS="$oldCPP" ])
2510 if test ! -z "$need_dash_r" ; then
2511 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2513 if test ! -z "$blibpath" ; then
2514 blibpath="$blibpath:${KRB5ROOT}/lib"
2518 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2519 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2520 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2522 LIBS="$LIBS $K5LIBS"
2523 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2524 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
2528 # Looking for programs, paths and files
2530 PRIVSEP_PATH=/var/empty
2531 AC_ARG_WITH(privsep-path,
2532 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2534 if test -n "$withval" && test "x$withval" != "xno" && \
2535 test "x${withval}" != "xyes"; then
2536 PRIVSEP_PATH=$withval
2540 AC_SUBST(PRIVSEP_PATH)
2543 [ --with-xauth=PATH Specify path to xauth program ],
2545 if test -n "$withval" && test "x$withval" != "xno" && \
2546 test "x${withval}" != "xyes"; then
2552 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2553 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2554 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2555 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2556 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2557 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2558 xauth_path="/usr/openwin/bin/xauth"
2564 AC_ARG_ENABLE(strip,
2565 [ --disable-strip Disable calling strip(1) on install],
2567 if test "x$enableval" = "xno" ; then
2574 if test -z "$xauth_path" ; then
2575 XAUTH_PATH="undefined"
2576 AC_SUBST(XAUTH_PATH)
2578 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2579 XAUTH_PATH=$xauth_path
2580 AC_SUBST(XAUTH_PATH)
2583 # Check for mail directory (last resort if we cannot get it from headers)
2584 if test ! -z "$MAIL" ; then
2585 maildir=`dirname $MAIL`
2586 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2589 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
2590 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2591 disable_ptmx_check=yes
2593 if test -z "$no_dev_ptmx" ; then
2594 if test "x$disable_ptmx_check" != "xyes" ; then
2595 AC_CHECK_FILE("/dev/ptmx",
2597 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2604 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
2605 AC_CHECK_FILE("/dev/ptc",
2607 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2612 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2615 # Options from here on. Some of these are preset by platform above
2616 AC_ARG_WITH(mantype,
2617 [ --with-mantype=man|cat|doc Set man page type],
2624 AC_MSG_ERROR(invalid man type: $withval)
2629 if test -z "$MANTYPE"; then
2630 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2631 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2632 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2634 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2641 if test "$MANTYPE" = "doc"; then
2648 # Check whether to enable MD5 passwords
2650 AC_ARG_WITH(md5-passwords,
2651 [ --with-md5-passwords Enable use of MD5 passwords],
2653 if test "x$withval" != "xno" ; then
2654 AC_DEFINE(HAVE_MD5_PASSWORDS)
2660 # Whether to disable shadow password support
2662 [ --without-shadow Disable shadow password support],
2664 if test "x$withval" = "xno" ; then
2665 AC_DEFINE(DISABLE_SHADOW)
2671 if test -z "$disable_shadow" ; then
2672 AC_MSG_CHECKING([if the systems has expire shadow information])
2675 #include <sys/types.h>
2678 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2679 [ sp_expire_available=yes ], []
2682 if test "x$sp_expire_available" = "xyes" ; then
2684 AC_DEFINE(HAS_SHADOW_EXPIRE)
2690 # Use ip address instead of hostname in $DISPLAY
2691 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2692 DISPLAY_HACK_MSG="yes"
2693 AC_DEFINE(IPADDR_IN_DISPLAY)
2695 DISPLAY_HACK_MSG="no"
2696 AC_ARG_WITH(ipaddr-display,
2697 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2699 if test "x$withval" != "xno" ; then
2700 AC_DEFINE(IPADDR_IN_DISPLAY)
2701 DISPLAY_HACK_MSG="yes"
2707 # check for /etc/default/login and use it if present.
2708 AC_ARG_ENABLE(etc-default-login,
2709 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
2710 [ if test "x$enableval" = "xno"; then
2711 AC_MSG_NOTICE([/etc/default/login handling disabled])
2712 etc_default_login=no
2714 etc_default_login=yes
2716 [ etc_default_login=yes ]
2719 if test "x$etc_default_login" != "xno"; then
2720 AC_CHECK_FILE("/etc/default/login",
2721 [ external_path_file=/etc/default/login ])
2722 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2724 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2725 elif test "x$external_path_file" = "x/etc/default/login"; then
2726 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2730 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2731 if test $ac_cv_func_login_getcapbool = "yes" && \
2732 test $ac_cv_header_login_cap_h = "yes" ; then
2733 external_path_file=/etc/login.conf
2736 # Whether to mess with the default path
2737 SERVER_PATH_MSG="(default)"
2738 AC_ARG_WITH(default-path,
2739 [ --with-default-path= Specify default \$PATH environment for server],
2741 if test "x$external_path_file" = "x/etc/login.conf" ; then
2743 --with-default-path=PATH has no effect on this system.
2744 Edit /etc/login.conf instead.])
2745 elif test "x$withval" != "xno" ; then
2746 if test ! -z "$external_path_file" ; then
2748 --with-default-path=PATH will only be used if PATH is not defined in
2749 $external_path_file .])
2751 user_path="$withval"
2752 SERVER_PATH_MSG="$withval"
2755 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2756 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2758 if test ! -z "$external_path_file" ; then
2760 If PATH is defined in $external_path_file, ensure the path to scp is included,
2761 otherwise scp will not work.])
2765 /* find out what STDPATH is */
2770 #ifndef _PATH_STDPATH
2771 # ifdef _PATH_USERPATH /* Irix */
2772 # define _PATH_STDPATH _PATH_USERPATH
2774 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2777 #include <sys/types.h>
2778 #include <sys/stat.h>
2780 #define DATA "conftest.stdpath"
2787 fd = fopen(DATA,"w");
2791 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2796 ], [ user_path=`cat conftest.stdpath` ],
2797 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2798 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2800 # make sure $bindir is in USER_PATH so scp will work
2801 t_bindir=`eval echo ${bindir}`
2803 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2806 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2808 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2809 if test $? -ne 0 ; then
2810 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2811 if test $? -ne 0 ; then
2812 user_path=$user_path:$t_bindir
2813 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2818 if test "x$external_path_file" != "x/etc/login.conf" ; then
2819 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2823 # Set superuser path separately to user path
2824 AC_ARG_WITH(superuser-path,
2825 [ --with-superuser-path= Specify different path for super-user],
2827 if test -n "$withval" && test "x$withval" != "xno" && \
2828 test "x${withval}" != "xyes"; then
2829 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2830 superuser_path=$withval
2836 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2837 IPV4_IN6_HACK_MSG="no"
2839 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2841 if test "x$withval" != "xno" ; then
2843 AC_DEFINE(IPV4_IN_IPV6)
2844 IPV4_IN6_HACK_MSG="yes"
2849 if test "x$inet6_default_4in6" = "xyes"; then
2850 AC_MSG_RESULT([yes (default)])
2851 AC_DEFINE(IPV4_IN_IPV6)
2852 IPV4_IN6_HACK_MSG="yes"
2854 AC_MSG_RESULT([no (default)])
2859 # Whether to enable BSD auth support
2861 AC_ARG_WITH(bsd-auth,
2862 [ --with-bsd-auth Enable BSD auth support],
2864 if test "x$withval" != "xno" ; then
2871 # Where to place sshd.pid
2873 # make sure the directory exists
2874 if test ! -d $piddir ; then
2875 piddir=`eval echo ${sysconfdir}`
2877 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2881 AC_ARG_WITH(pid-dir,
2882 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2884 if test -n "$withval" && test "x$withval" != "xno" && \
2885 test "x${withval}" != "xyes"; then
2887 if test ! -d $piddir ; then
2888 AC_MSG_WARN([** no $piddir directory on this system **])
2894 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2897 dnl allow user to disable some login recording features
2898 AC_ARG_ENABLE(lastlog,
2899 [ --disable-lastlog disable use of lastlog even if detected [no]],
2901 if test "x$enableval" = "xno" ; then
2902 AC_DEFINE(DISABLE_LASTLOG)
2907 [ --disable-utmp disable use of utmp even if detected [no]],
2909 if test "x$enableval" = "xno" ; then
2910 AC_DEFINE(DISABLE_UTMP)
2914 AC_ARG_ENABLE(utmpx,
2915 [ --disable-utmpx disable use of utmpx even if detected [no]],
2917 if test "x$enableval" = "xno" ; then
2918 AC_DEFINE(DISABLE_UTMPX)
2923 [ --disable-wtmp disable use of wtmp even if detected [no]],
2925 if test "x$enableval" = "xno" ; then
2926 AC_DEFINE(DISABLE_WTMP)
2930 AC_ARG_ENABLE(wtmpx,
2931 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2933 if test "x$enableval" = "xno" ; then
2934 AC_DEFINE(DISABLE_WTMPX)
2938 AC_ARG_ENABLE(libutil,
2939 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2941 if test "x$enableval" = "xno" ; then
2942 AC_DEFINE(DISABLE_LOGIN)
2946 AC_ARG_ENABLE(pututline,
2947 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2949 if test "x$enableval" = "xno" ; then
2950 AC_DEFINE(DISABLE_PUTUTLINE)
2954 AC_ARG_ENABLE(pututxline,
2955 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2957 if test "x$enableval" = "xno" ; then
2958 AC_DEFINE(DISABLE_PUTUTXLINE)
2962 AC_ARG_WITH(lastlog,
2963 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2965 if test "x$withval" = "xno" ; then
2966 AC_DEFINE(DISABLE_LASTLOG)
2967 elif test -n "$withval" && test "x${withval}" != "xyes"; then
2968 conf_lastlog_location=$withval
2973 dnl lastlog, [uw]tmpx? detection
2974 dnl NOTE: set the paths in the platform section to avoid the
2975 dnl need for command-line parameters
2976 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2978 dnl lastlog detection
2979 dnl NOTE: the code itself will detect if lastlog is a directory
2980 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2982 #include <sys/types.h>
2984 #ifdef HAVE_LASTLOG_H
2985 # include <lastlog.h>
2994 [ char *lastlog = LASTLOG_FILE; ],
2995 [ AC_MSG_RESULT(yes) ],
2998 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3000 #include <sys/types.h>
3002 #ifdef HAVE_LASTLOG_H
3003 # include <lastlog.h>
3009 [ char *lastlog = _PATH_LASTLOG; ],
3010 [ AC_MSG_RESULT(yes) ],
3013 system_lastlog_path=no
3018 if test -z "$conf_lastlog_location"; then
3019 if test x"$system_lastlog_path" = x"no" ; then
3020 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3021 if (test -d "$f" || test -f "$f") ; then
3022 conf_lastlog_location=$f
3025 if test -z "$conf_lastlog_location"; then
3026 AC_MSG_WARN([** Cannot find lastlog **])
3027 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
3032 if test -n "$conf_lastlog_location"; then
3033 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
3037 AC_MSG_CHECKING([if your system defines UTMP_FILE])
3039 #include <sys/types.h>
3045 [ char *utmp = UTMP_FILE; ],
3046 [ AC_MSG_RESULT(yes) ],
3048 system_utmp_path=no ]
3050 if test -z "$conf_utmp_location"; then
3051 if test x"$system_utmp_path" = x"no" ; then
3052 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3053 if test -f $f ; then
3054 conf_utmp_location=$f
3057 if test -z "$conf_utmp_location"; then
3058 AC_DEFINE(DISABLE_UTMP)
3062 if test -n "$conf_utmp_location"; then
3063 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
3067 AC_MSG_CHECKING([if your system defines WTMP_FILE])
3069 #include <sys/types.h>
3075 [ char *wtmp = WTMP_FILE; ],
3076 [ AC_MSG_RESULT(yes) ],
3078 system_wtmp_path=no ]
3080 if test -z "$conf_wtmp_location"; then
3081 if test x"$system_wtmp_path" = x"no" ; then
3082 for f in /usr/adm/wtmp /var/log/wtmp; do
3083 if test -f $f ; then
3084 conf_wtmp_location=$f
3087 if test -z "$conf_wtmp_location"; then
3088 AC_DEFINE(DISABLE_WTMP)
3092 if test -n "$conf_wtmp_location"; then
3093 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
3097 dnl utmpx detection - I don't know any system so perverse as to require
3098 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3100 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3102 #include <sys/types.h>
3111 [ char *utmpx = UTMPX_FILE; ],
3112 [ AC_MSG_RESULT(yes) ],
3114 system_utmpx_path=no ]
3116 if test -z "$conf_utmpx_location"; then
3117 if test x"$system_utmpx_path" = x"no" ; then
3118 AC_DEFINE(DISABLE_UTMPX)
3121 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
3125 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3127 #include <sys/types.h>
3136 [ char *wtmpx = WTMPX_FILE; ],
3137 [ AC_MSG_RESULT(yes) ],
3139 system_wtmpx_path=no ]
3141 if test -z "$conf_wtmpx_location"; then
3142 if test x"$system_wtmpx_path" = x"no" ; then
3143 AC_DEFINE(DISABLE_WTMPX)
3146 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
3150 if test ! -z "$blibpath" ; then
3151 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3152 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3155 dnl remove pam and dl because they are in $LIBPAM
3156 if test "$PAM_MSG" = yes ; then
3157 LIBS=`echo $LIBS | sed 's/-lpam //'`
3159 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3160 LIBS=`echo $LIBS | sed 's/-ldl //'`
3164 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3165 scard/Makefile ssh_prng_cmds survey.sh])
3168 # Print summary of options
3170 # Someone please show me a better way :)
3171 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3172 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3173 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3174 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3175 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3176 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3177 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
3178 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3179 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3180 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3183 echo "OpenSSH has been configured with the following options:"
3184 echo " User binaries: $B"
3185 echo " System binaries: $C"
3186 echo " Configuration files: $D"
3187 echo " Askpass program: $E"
3188 echo " Manual pages: $F"
3189 echo " PID file: $G"
3190 echo " Privilege separation chroot path: $H"
3191 if test "x$external_path_file" = "x/etc/login.conf" ; then
3192 echo " At runtime, sshd will use the path defined in $external_path_file"
3193 echo " Make sure the path to scp is present, otherwise scp will not work"
3195 echo " sshd default user PATH: $I"
3196 if test ! -z "$external_path_file"; then
3197 echo " (If PATH is set in $external_path_file it will be used instead. If"
3198 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3201 if test ! -z "$superuser_path" ; then
3202 echo " sshd superuser user PATH: $J"
3204 echo " Manpage format: $MANTYPE"
3205 echo " PAM support: $PAM_MSG"
3206 echo " KerberosV support: $KRB5_MSG"
3207 echo " Smartcard support: $SCARD_MSG"
3208 echo " S/KEY support: $SKEY_MSG"
3209 echo " TCP Wrappers support: $TCPW_MSG"
3210 echo " MD5 password support: $MD5_MSG"
3211 echo " libedit support: $LIBEDIT_MSG"
3212 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
3213 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3214 echo " BSD Auth support: $BSD_AUTH_MSG"
3215 echo " Random number source: $RAND_MSG"
3216 if test ! -z "$USE_RAND_HELPER" ; then
3217 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
3222 echo " Host: ${host}"
3223 echo " Compiler: ${CC}"
3224 echo " Compiler flags: ${CFLAGS}"
3225 echo "Preprocessor flags: ${CPPFLAGS}"
3226 echo " Linker flags: ${LDFLAGS}"
3227 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
3231 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
3232 echo "SVR4 style packages are supported with \"make package\""
3236 if test "x$PAM_MSG" = "xyes" ; then
3237 echo "PAM is enabled. You may need to install a PAM control file "
3238 echo "for sshd, otherwise password authentication may fail. "
3239 echo "Example PAM control files can be found in the contrib/ "
3244 if test ! -z "$RAND_HELPER_CMDHASH" ; then
3245 echo "WARNING: you are using the builtin random number collection "
3246 echo "service. Please read WARNING.RNG and request that your OS "
3247 echo "vendor includes kernel-based random number collection in "
3248 echo "future versions of your OS."
3252 if test ! -z "$NO_PEERCHECK" ; then
3253 echo "WARNING: the operating system that you are using does not "
3254 echo "appear to support either the getpeereid() API nor the "
3255 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3256 echo "enforce security checks to prevent unauthorised connections to "
3257 echo "ssh-agent. Their absence increases the risk that a malicious "
3258 echo "user can connect to your agent. "
3262 if test "$AUDIT_MODULE" = "bsm" ; then
3263 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3264 echo "See the Solaris section in README.platform for details."