1 # $Id: configure.ac,v 1.260 2005/04/24 07:52:23 dtucker Exp $
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"
85 [ --without-rpath Disable auto-added -R linker paths],
87 if test "x$withval" = "xno" ; then
90 if test "x$withval" = "xyes" ; then
96 # Check for some target-specific stuff
99 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
100 if (test -z "$blibpath"); then
101 blibpath="/usr/lib:/lib"
103 saved_LDFLAGS="$LDFLAGS"
104 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
105 if (test -z "$blibflags"); then
106 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
107 AC_TRY_LINK([], [], [blibflags=$tryflags])
110 if (test -z "$blibflags"); then
111 AC_MSG_RESULT(not found)
112 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
114 AC_MSG_RESULT($blibflags)
116 LDFLAGS="$saved_LDFLAGS"
117 dnl Check for authenticate. Might be in libs.a on older AIXes
118 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
119 [AC_CHECK_LIB(s,authenticate,
120 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
124 dnl Check for various auth function declarations in headers.
125 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
126 passwdexpired, setauthdb], , , [#include <usersec.h>])
127 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
128 AC_CHECK_DECLS(loginfailed,
129 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
131 [#include <usersec.h>],
132 [(void)loginfailed("user","host","tty",0);],
134 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
138 [#include <usersec.h>]
140 AC_CHECK_FUNCS(setauthdb)
141 check_for_aix_broken_getaddrinfo=1
142 AC_DEFINE(BROKEN_REALPATH)
143 AC_DEFINE(SETEUID_BREAKS_SETUID)
144 AC_DEFINE(BROKEN_SETREUID)
145 AC_DEFINE(BROKEN_SETREGID)
146 dnl AIX handles lastlog as part of its login message
147 AC_DEFINE(DISABLE_LASTLOG)
148 AC_DEFINE(LOGIN_NEEDS_UTMPX)
149 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
152 check_for_libcrypt_later=1
153 LIBS="$LIBS /usr/lib/textmode.o"
154 AC_DEFINE(HAVE_CYGWIN)
156 AC_DEFINE(DISABLE_SHADOW)
157 AC_DEFINE(IP_TOS_IS_BROKEN)
158 AC_DEFINE(NO_X11_UNIX_SOCKETS)
159 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
160 AC_DEFINE(DISABLE_FD_PASSING)
163 AC_DEFINE(IP_TOS_IS_BROKEN)
164 AC_DEFINE(SETEUID_BREAKS_SETUID)
165 AC_DEFINE(BROKEN_SETREUID)
166 AC_DEFINE(BROKEN_SETREGID)
169 AC_MSG_CHECKING(if we have working getaddrinfo)
170 AC_TRY_RUN([#include <mach-o/dyld.h>
171 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
175 }], [AC_MSG_RESULT(working)],
176 [AC_MSG_RESULT(buggy)
177 AC_DEFINE(BROKEN_GETADDRINFO)],
178 [AC_MSG_RESULT(assume it is working)])
179 AC_DEFINE(SETEUID_BREAKS_SETUID)
180 AC_DEFINE(BROKEN_SETREUID)
181 AC_DEFINE(BROKEN_SETREGID)
182 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
185 if test -z "$GCC"; then
188 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
189 IPADDR_IN_DISPLAY=yes
190 AC_DEFINE(HAVE_SECUREWARE)
192 AC_DEFINE(LOGIN_NO_ENDOPT)
193 AC_DEFINE(LOGIN_NEEDS_UTMPX)
194 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
195 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
196 LIBS="$LIBS -lsec -lsecpw"
197 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
198 disable_ptmx_check=yes
201 if test -z "$GCC"; then
204 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
205 IPADDR_IN_DISPLAY=yes
207 AC_DEFINE(LOGIN_NO_ENDOPT)
208 AC_DEFINE(LOGIN_NEEDS_UTMPX)
209 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
210 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
212 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
215 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
216 IPADDR_IN_DISPLAY=yes
217 AC_DEFINE(PAM_SUN_CODEBASE)
219 AC_DEFINE(LOGIN_NO_ENDOPT)
220 AC_DEFINE(LOGIN_NEEDS_UTMPX)
221 AC_DEFINE(DISABLE_UTMP)
222 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
223 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
224 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
225 check_for_hpux_broken_getaddrinfo=1
226 check_for_conflicting_getspnam=1
228 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
231 PATH="$PATH:/usr/etc"
232 AC_DEFINE(BROKEN_INET_NTOA)
233 AC_DEFINE(SETEUID_BREAKS_SETUID)
234 AC_DEFINE(BROKEN_SETREUID)
235 AC_DEFINE(BROKEN_SETREGID)
236 AC_DEFINE(WITH_ABBREV_NO_TTY)
237 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
240 PATH="$PATH:/usr/etc"
241 AC_DEFINE(WITH_IRIX_ARRAY)
242 AC_DEFINE(WITH_IRIX_PROJECT)
243 AC_DEFINE(WITH_IRIX_AUDIT)
244 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
245 AC_DEFINE(BROKEN_INET_NTOA)
246 AC_DEFINE(SETEUID_BREAKS_SETUID)
247 AC_DEFINE(BROKEN_SETREUID)
248 AC_DEFINE(BROKEN_SETREGID)
249 AC_DEFINE(BROKEN_UPDWTMPX)
250 AC_DEFINE(WITH_ABBREV_NO_TTY)
251 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
255 check_for_libcrypt_later=1
256 check_for_openpty_ctty_bug=1
257 AC_DEFINE(DONT_TRY_OTHER_AF)
258 AC_DEFINE(PAM_TTY_KLUDGE)
259 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
260 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
261 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
262 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
263 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
264 inet6_default_4in6=yes
267 AC_DEFINE(BROKEN_CMSG_TYPE)
271 mips-sony-bsd|mips-sony-newsos4)
272 AC_DEFINE(HAVE_NEWS4)
276 check_for_libcrypt_before=1
277 if test "x$withval" != "xno" ; then
282 check_for_libcrypt_later=1
285 AC_DEFINE(SETEUID_BREAKS_SETUID)
286 AC_DEFINE(BROKEN_SETREUID)
287 AC_DEFINE(BROKEN_SETREGID)
290 conf_lastlog_location="/usr/adm/lastlog"
291 conf_utmp_location=/etc/utmp
292 conf_wtmp_location=/usr/adm/wtmp
295 AC_DEFINE(BROKEN_REALPATH)
297 AC_DEFINE(BROKEN_SAVED_UIDS)
300 if test "x$withval" != "xno" ; then
303 AC_DEFINE(PAM_SUN_CODEBASE)
304 AC_DEFINE(LOGIN_NEEDS_UTMPX)
305 AC_DEFINE(LOGIN_NEEDS_TERM)
306 AC_DEFINE(PAM_TTY_KLUDGE)
307 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
308 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
309 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
310 AC_DEFINE(SSHD_ACQUIRES_CTTY)
311 external_path_file=/etc/default/login
312 # hardwire lastlog location (can't detect it on some versions)
313 conf_lastlog_location="/var/adm/lastlog"
314 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
315 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
316 if test "$sol2ver" -ge 8; then
318 AC_DEFINE(DISABLE_UTMP)
319 AC_DEFINE(DISABLE_WTMP)
325 CPPFLAGS="$CPPFLAGS -DSUNOS4"
326 AC_CHECK_FUNCS(getpwanam)
327 AC_DEFINE(PAM_SUN_CODEBASE)
328 conf_utmp_location=/etc/utmp
329 conf_wtmp_location=/var/adm/wtmp
330 conf_lastlog_location=/var/adm/lastlog
336 AC_DEFINE(SSHD_ACQUIRES_CTTY)
337 AC_DEFINE(SETEUID_BREAKS_SETUID)
338 AC_DEFINE(BROKEN_SETREUID)
339 AC_DEFINE(BROKEN_SETREGID)
342 # /usr/ucblib MUST NOT be searched on ReliantUNIX
343 AC_CHECK_LIB(dl, dlsym, ,)
344 # -lresolv needs to be at then end of LIBS or DNS lookups break
345 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
346 IPADDR_IN_DISPLAY=yes
348 AC_DEFINE(IP_TOS_IS_BROKEN)
349 AC_DEFINE(SETEUID_BREAKS_SETUID)
350 AC_DEFINE(BROKEN_SETREUID)
351 AC_DEFINE(BROKEN_SETREGID)
352 AC_DEFINE(SSHD_ACQUIRES_CTTY)
353 external_path_file=/etc/default/login
354 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
355 # Attention: always take care to bind libsocket and libnsl before libc,
356 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
358 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
361 AC_DEFINE(SETEUID_BREAKS_SETUID)
362 AC_DEFINE(BROKEN_SETREUID)
363 AC_DEFINE(BROKEN_SETREGID)
364 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
366 # UnixWare 7.x, OpenUNIX 8
369 AC_DEFINE(SETEUID_BREAKS_SETUID)
370 AC_DEFINE(BROKEN_SETREUID)
371 AC_DEFINE(BROKEN_SETREGID)
372 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
376 # SCO UNIX and OEM versions of SCO UNIX
378 AC_MSG_ERROR("This Platform is no longer supported.")
382 if test -z "$GCC"; then
383 CFLAGS="$CFLAGS -belf"
385 LIBS="$LIBS -lprot -lx -ltinfo -lm"
388 AC_DEFINE(HAVE_SECUREWARE)
389 AC_DEFINE(DISABLE_SHADOW)
390 AC_DEFINE(DISABLE_FD_PASSING)
391 AC_DEFINE(SETEUID_BREAKS_SETUID)
392 AC_DEFINE(BROKEN_SETREUID)
393 AC_DEFINE(BROKEN_SETREGID)
394 AC_DEFINE(WITH_ABBREV_NO_TTY)
395 AC_DEFINE(BROKEN_UPDWTMPX)
396 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
397 AC_CHECK_FUNCS(getluid setluid)
402 AC_DEFINE(NO_SSH_LASTLOG)
403 AC_DEFINE(SETEUID_BREAKS_SETUID)
404 AC_DEFINE(BROKEN_SETREUID)
405 AC_DEFINE(BROKEN_SETREGID)
407 AC_DEFINE(DISABLE_FD_PASSING)
409 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
413 AC_DEFINE(SETEUID_BREAKS_SETUID)
414 AC_DEFINE(BROKEN_SETREUID)
415 AC_DEFINE(BROKEN_SETREGID)
416 AC_DEFINE(WITH_ABBREV_NO_TTY)
418 AC_DEFINE(DISABLE_FD_PASSING)
420 LIBS="$LIBS -lgen -lacid -ldb"
424 AC_DEFINE(SETEUID_BREAKS_SETUID)
425 AC_DEFINE(BROKEN_SETREUID)
426 AC_DEFINE(BROKEN_SETREGID)
428 AC_DEFINE(DISABLE_FD_PASSING)
429 AC_DEFINE(NO_SSH_LASTLOG)
430 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
431 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
435 AC_MSG_CHECKING(for Digital Unix SIA)
438 [ --with-osfsia Enable Digital Unix SIA],
440 if test "x$withval" = "xno" ; then
441 AC_MSG_RESULT(disabled)
446 if test -z "$no_osfsia" ; then
447 if test -f /etc/sia/matrix.conf; then
449 AC_DEFINE(HAVE_OSF_SIA)
450 AC_DEFINE(DISABLE_LOGIN)
451 AC_DEFINE(DISABLE_FD_PASSING)
452 LIBS="$LIBS -lsecurity -ldb -lm -laud"
455 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
458 AC_DEFINE(BROKEN_GETADDRINFO)
459 AC_DEFINE(SETEUID_BREAKS_SETUID)
460 AC_DEFINE(BROKEN_SETREUID)
461 AC_DEFINE(BROKEN_SETREGID)
466 AC_DEFINE(NO_X11_UNIX_SOCKETS)
467 AC_DEFINE(MISSING_NFDBITS)
468 AC_DEFINE(MISSING_HOWMANY)
469 AC_DEFINE(MISSING_FD_MASK)
473 # Allow user to specify flags
475 [ --with-cflags Specify additional flags to pass to compiler],
477 if test -n "$withval" && test "x$withval" != "xno" && \
478 test "x${withval}" != "xyes"; then
479 CFLAGS="$CFLAGS $withval"
483 AC_ARG_WITH(cppflags,
484 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
486 if test -n "$withval" && test "x$withval" != "xno" && \
487 test "x${withval}" != "xyes"; then
488 CPPFLAGS="$CPPFLAGS $withval"
493 [ --with-ldflags Specify additional flags to pass to linker],
495 if test -n "$withval" && test "x$withval" != "xno" && \
496 test "x${withval}" != "xyes"; then
497 LDFLAGS="$LDFLAGS $withval"
502 [ --with-libs Specify additional libraries to link with],
504 if test -n "$withval" && test "x$withval" != "xno" && \
505 test "x${withval}" != "xyes"; then
506 LIBS="$LIBS $withval"
511 AC_MSG_CHECKING(compiler and flags for sanity)
517 [ AC_MSG_RESULT(yes) ],
520 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
522 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
525 # Checks for header files.
526 AC_CHECK_HEADERS(bstring.h crypt.h dirent.h endian.h features.h \
527 floatingpoint.h getopt.h glob.h ia.h lastlog.h limits.h login.h \
528 login_cap.h maillock.h ndir.h netdb.h netgroup.h \
529 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
530 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
531 strings.h sys/dir.h sys/strtio.h sys/audit.h sys/bitypes.h \
532 sys/bsdtty.h sys/cdefs.h sys/mman.h sys/ndir.h sys/prctl.h \
533 sys/pstat.h sys/select.h sys/stat.h sys/stream.h \
534 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h sys/un.h \
535 time.h tmpdir.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
537 # sys/ptms.h requires sys/stream.h to be included first on Solaris
538 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
539 #ifdef HAVE_SYS_STREAM_H
540 # include <sys/stream.h>
544 # Checks for libraries.
545 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
546 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
548 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
549 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
550 AC_CHECK_LIB(gen, dirname,[
551 AC_CACHE_CHECK([for broken dirname],
552 ac_cv_have_broken_dirname, [
560 int main(int argc, char **argv) {
563 strncpy(buf,"/etc", 32);
565 if (!s || strncmp(s, "/", 32) != 0) {
572 [ ac_cv_have_broken_dirname="no" ],
573 [ ac_cv_have_broken_dirname="yes" ]
577 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
579 AC_DEFINE(HAVE_DIRNAME)
580 AC_CHECK_HEADERS(libgen.h)
585 AC_CHECK_FUNC(getspnam, ,
586 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
587 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
591 [ --with-zlib=PATH Use zlib in PATH],
592 [ if test "x$withval" = "xno" ; then
593 AC_MSG_ERROR([*** zlib is required ***])
594 elif test "x$withval" != "xyes"; then
595 if test -d "$withval/lib"; then
596 if test -n "${need_dash_r}"; then
597 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
599 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
602 if test -n "${need_dash_r}"; then
603 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
605 LDFLAGS="-L${withval} ${LDFLAGS}"
608 if test -d "$withval/include"; then
609 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
611 CPPFLAGS="-I${withval} ${CPPFLAGS}"
616 AC_CHECK_LIB(z, deflate, ,
618 saved_CPPFLAGS="$CPPFLAGS"
619 saved_LDFLAGS="$LDFLAGS"
621 dnl Check default zlib install dir
622 if test -n "${need_dash_r}"; then
623 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
625 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
627 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
629 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
631 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
636 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
638 AC_ARG_WITH(zlib-version-check,
639 [ --without-zlib-version-check Disable zlib version check],
640 [ if test "x$withval" = "xno" ; then
641 zlib_check_nonfatal=1
646 AC_MSG_CHECKING(for possibly buggy zlib)
647 AC_RUN_IFELSE([AC_LANG_SOURCE([[
652 int a=0, b=0, c=0, d=0, n, v;
653 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
654 if (n != 3 && n != 4)
656 v = a*1000000 + b*10000 + c*100 + d;
657 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
660 if (a == 1 && b == 1 && c >= 4)
663 /* 1.2.1.2 and up are OK */
672 if test -z "$zlib_check_nonfatal" ; then
673 AC_MSG_ERROR([*** zlib too old - check config.log ***
674 Your reported zlib version has known security problems. It's possible your
675 vendor has fixed these problems without changing the version number. If you
676 are sure this is the case, you can disable the check by running
677 "./configure --without-zlib-version-check".
678 If you are in doubt, upgrade zlib to version 1.2.1.2 or greater.
679 See http://www.gzip.org/zlib/ for details.])
681 AC_MSG_WARN([zlib version may have security problems])
684 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
688 AC_CHECK_FUNC(strcasecmp,
689 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
691 AC_CHECK_FUNC(utimes,
692 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
693 LIBS="$LIBS -lc89"]) ]
696 dnl Checks for libutil functions
697 AC_CHECK_HEADERS(libutil.h)
698 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
699 AC_CHECK_FUNCS(logout updwtmp logwtmp)
703 # Check for ALTDIRFUNC glob() extension
704 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
705 AC_EGREP_CPP(FOUNDIT,
708 #ifdef GLOB_ALTDIRFUNC
713 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
721 # Check for g.gl_matchc glob() extension
722 AC_MSG_CHECKING(for gl_matchc field in glob_t)
723 AC_EGREP_CPP(FOUNDIT,
726 int main(void){glob_t g; g.gl_matchc = 1;}
729 AC_DEFINE(GLOB_HAS_GL_MATCHC)
737 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
740 #include <sys/types.h>
742 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
744 [AC_MSG_RESULT(yes)],
747 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
750 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
751 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
755 AC_MSG_CHECKING([for /proc/pid/fd directory])
756 if test -d "/proc/$$/fd" ; then
757 AC_DEFINE(HAVE_PROC_PID)
763 # Check whether user wants S/Key support
766 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
768 if test "x$withval" != "xno" ; then
770 if test "x$withval" != "xyes" ; then
771 CPPFLAGS="$CPPFLAGS -I${withval}/include"
772 LDFLAGS="$LDFLAGS -L${withval}/lib"
779 AC_MSG_CHECKING([for s/key support])
784 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
786 [AC_MSG_RESULT(yes)],
789 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
791 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
795 [(void)skeychallenge(NULL,"name","",0);],
797 AC_DEFINE(SKEYCHALLENGE_4ARG)],
804 # Check whether user wants TCP wrappers support
806 AC_ARG_WITH(tcp-wrappers,
807 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
809 if test "x$withval" != "xno" ; then
811 saved_LDFLAGS="$LDFLAGS"
812 saved_CPPFLAGS="$CPPFLAGS"
813 if test -n "${withval}" && \
814 test "x${withval}" != "xyes"; then
815 if test -d "${withval}/lib"; then
816 if test -n "${need_dash_r}"; then
817 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
819 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
822 if test -n "${need_dash_r}"; then
823 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
825 LDFLAGS="-L${withval} ${LDFLAGS}"
828 if test -d "${withval}/include"; then
829 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
831 CPPFLAGS="-I${withval} ${CPPFLAGS}"
835 LIBS="$LIBWRAP $LIBS"
836 AC_MSG_CHECKING(for libwrap)
839 #include <sys/types.h>
840 #include <sys/socket.h>
841 #include <netinet/in.h>
843 int deny_severity = 0, allow_severity = 0;
853 AC_MSG_ERROR([*** libwrap missing])
861 # Check whether user wants libedit support
864 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
865 [ if test "x$withval" != "xno" ; then
866 if test "x$withval" != "xyes"; then
867 CPPFLAGS="$CPPFLAGS -I$withval/include"
868 LDFLAGS="$LDFLAGS -L$withval/lib"
870 AC_CHECK_LIB(edit, el_init,
871 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
872 LIBEDIT="-ledit -lcurses"
876 [ AC_MSG_ERROR(libedit not found) ],
884 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
886 AC_MSG_CHECKING(for supported audit module)
891 dnl Checks for headers, libs and functions
892 AC_CHECK_HEADERS(bsm/audit.h, [],
893 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
894 AC_CHECK_LIB(bsm, getaudit, [],
895 [AC_MSG_ERROR(BSM enabled and required library not found)])
896 AC_CHECK_FUNCS(getaudit, [],
897 [AC_MSG_ERROR(BSM enabled and required function not found)])
899 AC_CHECK_FUNCS(getaudit_addr)
900 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
905 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
908 AC_MSG_ERROR([Unknown audit module $withval])
913 dnl Checks for library functions. Please keep in alphabetical order
915 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
916 bindresvport_sa clock closefrom dirfd fchdir fchmod fchown \
917 freeaddrinfo futimes getaddrinfo getcwd getgrouplist getnameinfo \
918 getopt getpeereid _getpty getrlimit getttyent glob inet_aton \
919 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
920 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
921 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
922 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
923 setproctitle setregid setreuid setrlimit \
924 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
925 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
926 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
929 # IRIX has a const char return value for gai_strerror()
930 AC_CHECK_FUNCS(gai_strerror,[
931 AC_DEFINE(HAVE_GAI_STRERROR)
933 #include <sys/types.h>
934 #include <sys/socket.h>
937 const char *gai_strerror(int);],[
940 str = gai_strerror(0);],[
941 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
942 [Define if gai_strerror() returns const char *])])])
944 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
946 dnl Make sure prototypes are defined for these before using them.
947 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
948 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
950 dnl tcsendbreak might be a macro
951 AC_CHECK_DECL(tcsendbreak,
952 [AC_DEFINE(HAVE_TCSENDBREAK)],
953 [AC_CHECK_FUNCS(tcsendbreak)],
954 [#include <termios.h>]
957 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
959 AC_CHECK_FUNCS(setresuid, [
960 dnl Some platorms have setresuid that isn't implemented, test for this
961 AC_MSG_CHECKING(if setresuid seems to work)
966 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
968 [AC_MSG_RESULT(yes)],
969 [AC_DEFINE(BROKEN_SETRESUID)
970 AC_MSG_RESULT(not implemented)],
971 [AC_MSG_WARN([cross compiling: not checking setresuid])]
975 AC_CHECK_FUNCS(setresgid, [
976 dnl Some platorms have setresgid that isn't implemented, test for this
977 AC_MSG_CHECKING(if setresgid seems to work)
982 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
984 [AC_MSG_RESULT(yes)],
985 [AC_DEFINE(BROKEN_SETRESGID)
986 AC_MSG_RESULT(not implemented)],
987 [AC_MSG_WARN([cross compiling: not checking setresuid])]
991 dnl Checks for time functions
992 AC_CHECK_FUNCS(gettimeofday time)
993 dnl Checks for utmp functions
994 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
995 AC_CHECK_FUNCS(utmpname)
996 dnl Checks for utmpx functions
997 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
998 AC_CHECK_FUNCS(setutxent utmpxname)
1000 AC_CHECK_FUNC(daemon,
1001 [AC_DEFINE(HAVE_DAEMON)],
1002 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1005 AC_CHECK_FUNC(getpagesize,
1006 [AC_DEFINE(HAVE_GETPAGESIZE)],
1007 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1010 # Check for broken snprintf
1011 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1012 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1016 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1018 [AC_MSG_RESULT(yes)],
1021 AC_DEFINE(BROKEN_SNPRINTF)
1022 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1024 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1028 # Check for missing getpeereid (or equiv) support
1030 if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1031 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1033 [#include <sys/types.h>
1034 #include <sys/socket.h>],
1035 [int i = SO_PEERCRED;],
1036 [ AC_MSG_RESULT(yes)
1037 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1044 dnl see whether mkstemp() requires XXXXXX
1045 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1046 AC_MSG_CHECKING([for (overly) strict mkstemp])
1050 main() { char template[]="conftest.mkstemp-test";
1051 if (mkstemp(template) == -1)
1053 unlink(template); exit(0);
1061 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1065 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1070 dnl make sure that openpty does not reacquire controlling terminal
1071 if test ! -z "$check_for_openpty_ctty_bug"; then
1072 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1076 #include <sys/fcntl.h>
1077 #include <sys/types.h>
1078 #include <sys/wait.h>
1084 int fd, ptyfd, ttyfd, status;
1087 if (pid < 0) { /* failed */
1089 } else if (pid > 0) { /* parent */
1090 waitpid(pid, &status, 0);
1091 if (WIFEXITED(status))
1092 exit(WEXITSTATUS(status));
1095 } else { /* child */
1096 close(0); close(1); close(2);
1098 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1099 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1101 exit(3); /* Acquired ctty: broken */
1103 exit(0); /* Did not acquire ctty: OK */
1112 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1117 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1118 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1119 AC_MSG_CHECKING(if getaddrinfo seems to work)
1123 #include <sys/socket.h>
1126 #include <netinet/in.h>
1128 #define TEST_PORT "2222"
1134 struct addrinfo *gai_ai, *ai, hints;
1135 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1137 memset(&hints, 0, sizeof(hints));
1138 hints.ai_family = PF_UNSPEC;
1139 hints.ai_socktype = SOCK_STREAM;
1140 hints.ai_flags = AI_PASSIVE;
1142 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1144 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1148 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1149 if (ai->ai_family != AF_INET6)
1152 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1153 sizeof(ntop), strport, sizeof(strport),
1154 NI_NUMERICHOST|NI_NUMERICSERV);
1157 if (err == EAI_SYSTEM)
1158 perror("getnameinfo EAI_SYSTEM");
1160 fprintf(stderr, "getnameinfo failed: %s\n",
1165 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1168 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1181 AC_DEFINE(BROKEN_GETADDRINFO)
1186 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1187 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1188 AC_MSG_CHECKING(if getaddrinfo seems to work)
1192 #include <sys/socket.h>
1195 #include <netinet/in.h>
1197 #define TEST_PORT "2222"
1203 struct addrinfo *gai_ai, *ai, hints;
1204 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1206 memset(&hints, 0, sizeof(hints));
1207 hints.ai_family = PF_UNSPEC;
1208 hints.ai_socktype = SOCK_STREAM;
1209 hints.ai_flags = AI_PASSIVE;
1211 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1213 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1217 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1218 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1221 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1222 sizeof(ntop), strport, sizeof(strport),
1223 NI_NUMERICHOST|NI_NUMERICSERV);
1225 if (ai->ai_family == AF_INET && err != 0) {
1226 perror("getnameinfo");
1235 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1236 [Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1240 AC_DEFINE(BROKEN_GETADDRINFO)
1245 if test "x$check_for_conflicting_getspnam" = "x1"; then
1246 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1250 int main(void) {exit(0);}
1257 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1258 [Conflicting defs for getspnam])
1265 # Check for PAM libs
1268 [ --with-pam Enable PAM support ],
1270 if test "x$withval" != "xno" ; then
1271 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1272 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1273 AC_MSG_ERROR([PAM headers not found])
1276 AC_CHECK_LIB(dl, dlopen, , )
1277 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1278 AC_CHECK_FUNCS(pam_getenvlist)
1279 AC_CHECK_FUNCS(pam_putenv)
1284 if test $ac_cv_lib_dl_dlopen = yes; then
1294 # Check for older PAM
1295 if test "x$PAM_MSG" = "xyes" ; then
1296 # Check PAM strerror arguments (old PAM)
1297 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1301 #if defined(HAVE_SECURITY_PAM_APPL_H)
1302 #include <security/pam_appl.h>
1303 #elif defined (HAVE_PAM_PAM_APPL_H)
1304 #include <pam/pam_appl.h>
1307 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1308 [AC_MSG_RESULT(no)],
1310 AC_DEFINE(HAVE_OLD_PAM)
1312 PAM_MSG="yes (old library)"
1317 # Search for OpenSSL
1318 saved_CPPFLAGS="$CPPFLAGS"
1319 saved_LDFLAGS="$LDFLAGS"
1320 AC_ARG_WITH(ssl-dir,
1321 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1323 if test "x$withval" != "xno" ; then
1326 ./*|../*) withval="`pwd`/$withval"
1328 if test -d "$withval/lib"; then
1329 if test -n "${need_dash_r}"; then
1330 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1332 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1335 if test -n "${need_dash_r}"; then
1336 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1338 LDFLAGS="-L${withval} ${LDFLAGS}"
1341 if test -d "$withval/include"; then
1342 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1344 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1349 LIBS="-lcrypto $LIBS"
1350 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1352 dnl Check default openssl install dir
1353 if test -n "${need_dash_r}"; then
1354 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1356 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1358 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1359 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1361 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1367 # Determine OpenSSL header version
1368 AC_MSG_CHECKING([OpenSSL header version])
1373 #include <openssl/opensslv.h>
1374 #define DATA "conftest.sslincver"
1379 fd = fopen(DATA,"w");
1383 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1390 ssl_header_ver=`cat conftest.sslincver`
1391 AC_MSG_RESULT($ssl_header_ver)
1394 AC_MSG_RESULT(not found)
1395 AC_MSG_ERROR(OpenSSL version header not found.)
1398 AC_MSG_WARN([cross compiling: not checking])
1402 # Determine OpenSSL library version
1403 AC_MSG_CHECKING([OpenSSL library version])
1408 #include <openssl/opensslv.h>
1409 #include <openssl/crypto.h>
1410 #define DATA "conftest.ssllibver"
1415 fd = fopen(DATA,"w");
1419 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1426 ssl_library_ver=`cat conftest.ssllibver`
1427 AC_MSG_RESULT($ssl_library_ver)
1430 AC_MSG_RESULT(not found)
1431 AC_MSG_ERROR(OpenSSL library not found.)
1434 AC_MSG_WARN([cross compiling: not checking])
1438 # Sanity check OpenSSL headers
1439 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1443 #include <openssl/opensslv.h>
1444 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1451 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1452 Check config.log for details.
1453 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1456 AC_MSG_WARN([cross compiling: not checking])
1460 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1461 # because the system crypt() is more featureful.
1462 if test "x$check_for_libcrypt_before" = "x1"; then
1463 AC_CHECK_LIB(crypt, crypt)
1466 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1467 # version in OpenSSL.
1468 if test "x$check_for_libcrypt_later" = "x1"; then
1469 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1473 ### Configure cryptographic random number support
1475 # Check wheter OpenSSL seeds itself
1476 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1480 #include <openssl/rand.h>
1481 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1484 OPENSSL_SEEDS_ITSELF=yes
1489 # Default to use of the rand helper if OpenSSL doesn't
1494 AC_MSG_WARN([cross compiling: assuming yes])
1495 # This is safe, since all recent OpenSSL versions will
1496 # complain at runtime if not seeded correctly.
1497 OPENSSL_SEEDS_ITSELF=yes
1502 # Do we want to force the use of the rand helper?
1503 AC_ARG_WITH(rand-helper,
1504 [ --with-rand-helper Use subprocess to gather strong randomness ],
1506 if test "x$withval" = "xno" ; then
1507 # Force use of OpenSSL's internal RNG, even if
1508 # the previous test showed it to be unseeded.
1509 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1510 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1511 OPENSSL_SEEDS_ITSELF=yes
1520 # Which randomness source do we use?
1521 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
1523 AC_DEFINE(OPENSSL_PRNG_ONLY)
1524 RAND_MSG="OpenSSL internal ONLY"
1525 INSTALL_SSH_RAND_HELPER=""
1526 elif test ! -z "$USE_RAND_HELPER" ; then
1527 # install rand helper
1528 RAND_MSG="ssh-rand-helper"
1529 INSTALL_SSH_RAND_HELPER="yes"
1531 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1533 ### Configuration of ssh-rand-helper
1536 AC_ARG_WITH(prngd-port,
1537 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1546 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1549 if test ! -z "$withval" ; then
1550 PRNGD_PORT="$withval"
1551 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1556 # PRNGD Unix domain socket
1557 AC_ARG_WITH(prngd-socket,
1558 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1562 withval="/var/run/egd-pool"
1570 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1574 if test ! -z "$withval" ; then
1575 if test ! -z "$PRNGD_PORT" ; then
1576 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1578 if test ! -r "$withval" ; then
1579 AC_MSG_WARN(Entropy socket is not readable)
1581 PRNGD_SOCKET="$withval"
1582 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1586 # Check for existing socket only if we don't have a random device already
1587 if test "$USE_RAND_HELPER" = yes ; then
1588 AC_MSG_CHECKING(for PRNGD/EGD socket)
1589 # Insert other locations here
1590 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1591 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1592 PRNGD_SOCKET="$sock"
1593 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1597 if test ! -z "$PRNGD_SOCKET" ; then
1598 AC_MSG_RESULT($PRNGD_SOCKET)
1600 AC_MSG_RESULT(not found)
1606 # Change default command timeout for hashing entropy source
1608 AC_ARG_WITH(entropy-timeout,
1609 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1611 if test -n "$withval" && test "x$withval" != "xno" && \
1612 test "x${withval}" != "xyes"; then
1613 entropy_timeout=$withval
1617 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1619 SSH_PRIVSEP_USER=sshd
1620 AC_ARG_WITH(privsep-user,
1621 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1623 if test -n "$withval" && test "x$withval" != "xno" && \
1624 test "x${withval}" != "xyes"; then
1625 SSH_PRIVSEP_USER=$withval
1629 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1630 AC_SUBST(SSH_PRIVSEP_USER)
1632 # We do this little dance with the search path to insure
1633 # that programs that we select for use by installed programs
1634 # (which may be run by the super-user) come from trusted
1635 # locations before they come from the user's private area.
1636 # This should help avoid accidentally configuring some
1637 # random version of a program in someone's personal bin.
1641 test -h /bin 2> /dev/null && PATH=/usr/bin
1642 test -d /sbin && PATH=$PATH:/sbin
1643 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1644 PATH=$PATH:/etc:$OPATH
1646 # These programs are used by the command hashing source to gather entropy
1647 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1648 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1649 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1650 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1651 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1652 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1653 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1654 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1655 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1656 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1657 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1658 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1659 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1660 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1661 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1662 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1666 # Where does ssh-rand-helper get its randomness from?
1667 INSTALL_SSH_PRNG_CMDS=""
1668 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1669 if test ! -z "$PRNGD_PORT" ; then
1670 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1671 elif test ! -z "$PRNGD_SOCKET" ; then
1672 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1674 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1675 RAND_HELPER_CMDHASH=yes
1676 INSTALL_SSH_PRNG_CMDS="yes"
1679 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1682 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1683 if test ! -z "$SONY" ; then
1684 LIBS="$LIBS -liberty";
1687 # Checks for data types
1688 AC_CHECK_SIZEOF(char, 1)
1689 AC_CHECK_SIZEOF(short int, 2)
1690 AC_CHECK_SIZEOF(int, 4)
1691 AC_CHECK_SIZEOF(long int, 4)
1692 AC_CHECK_SIZEOF(long long int, 8)
1694 # Sanity check long long for some platforms (AIX)
1695 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1696 ac_cv_sizeof_long_long_int=0
1699 # More checks for data types
1700 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1702 [ #include <sys/types.h> ],
1704 [ ac_cv_have_u_int="yes" ],
1705 [ ac_cv_have_u_int="no" ]
1708 if test "x$ac_cv_have_u_int" = "xyes" ; then
1709 AC_DEFINE(HAVE_U_INT)
1713 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1715 [ #include <sys/types.h> ],
1716 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1717 [ ac_cv_have_intxx_t="yes" ],
1718 [ ac_cv_have_intxx_t="no" ]
1721 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1722 AC_DEFINE(HAVE_INTXX_T)
1726 if (test -z "$have_intxx_t" && \
1727 test "x$ac_cv_header_stdint_h" = "xyes")
1729 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1731 [ #include <stdint.h> ],
1732 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1734 AC_DEFINE(HAVE_INTXX_T)
1737 [ AC_MSG_RESULT(no) ]
1741 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1744 #include <sys/types.h>
1745 #ifdef HAVE_STDINT_H
1746 # include <stdint.h>
1748 #include <sys/socket.h>
1749 #ifdef HAVE_SYS_BITYPES_H
1750 # include <sys/bitypes.h>
1753 [ int64_t a; a = 1;],
1754 [ ac_cv_have_int64_t="yes" ],
1755 [ ac_cv_have_int64_t="no" ]
1758 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1759 AC_DEFINE(HAVE_INT64_T)
1762 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1764 [ #include <sys/types.h> ],
1765 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1766 [ ac_cv_have_u_intxx_t="yes" ],
1767 [ ac_cv_have_u_intxx_t="no" ]
1770 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1771 AC_DEFINE(HAVE_U_INTXX_T)
1775 if test -z "$have_u_intxx_t" ; then
1776 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1778 [ #include <sys/socket.h> ],
1779 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1781 AC_DEFINE(HAVE_U_INTXX_T)
1784 [ AC_MSG_RESULT(no) ]
1788 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1790 [ #include <sys/types.h> ],
1791 [ u_int64_t a; a = 1;],
1792 [ ac_cv_have_u_int64_t="yes" ],
1793 [ ac_cv_have_u_int64_t="no" ]
1796 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1797 AC_DEFINE(HAVE_U_INT64_T)
1801 if test -z "$have_u_int64_t" ; then
1802 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1804 [ #include <sys/bitypes.h> ],
1805 [ u_int64_t a; a = 1],
1807 AC_DEFINE(HAVE_U_INT64_T)
1810 [ AC_MSG_RESULT(no) ]
1814 if test -z "$have_u_intxx_t" ; then
1815 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1818 #include <sys/types.h>
1820 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1821 [ ac_cv_have_uintxx_t="yes" ],
1822 [ ac_cv_have_uintxx_t="no" ]
1825 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1826 AC_DEFINE(HAVE_UINTXX_T)
1830 if test -z "$have_uintxx_t" ; then
1831 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1833 [ #include <stdint.h> ],
1834 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1836 AC_DEFINE(HAVE_UINTXX_T)
1839 [ AC_MSG_RESULT(no) ]
1843 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1844 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1846 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1849 #include <sys/bitypes.h>
1852 int8_t a; int16_t b; int32_t c;
1853 u_int8_t e; u_int16_t f; u_int32_t g;
1854 a = b = c = e = f = g = 1;
1857 AC_DEFINE(HAVE_U_INTXX_T)
1858 AC_DEFINE(HAVE_INTXX_T)
1866 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1869 #include <sys/types.h>
1871 [ u_char foo; foo = 125; ],
1872 [ ac_cv_have_u_char="yes" ],
1873 [ ac_cv_have_u_char="no" ]
1876 if test "x$ac_cv_have_u_char" = "xyes" ; then
1877 AC_DEFINE(HAVE_U_CHAR)
1882 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1884 AC_CHECK_TYPES(in_addr_t,,,
1885 [#include <sys/types.h>
1886 #include <netinet/in.h>])
1888 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1891 #include <sys/types.h>
1893 [ size_t foo; foo = 1235; ],
1894 [ ac_cv_have_size_t="yes" ],
1895 [ ac_cv_have_size_t="no" ]
1898 if test "x$ac_cv_have_size_t" = "xyes" ; then
1899 AC_DEFINE(HAVE_SIZE_T)
1902 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1905 #include <sys/types.h>
1907 [ ssize_t foo; foo = 1235; ],
1908 [ ac_cv_have_ssize_t="yes" ],
1909 [ ac_cv_have_ssize_t="no" ]
1912 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1913 AC_DEFINE(HAVE_SSIZE_T)
1916 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1921 [ clock_t foo; foo = 1235; ],
1922 [ ac_cv_have_clock_t="yes" ],
1923 [ ac_cv_have_clock_t="no" ]
1926 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1927 AC_DEFINE(HAVE_CLOCK_T)
1930 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1933 #include <sys/types.h>
1934 #include <sys/socket.h>
1936 [ sa_family_t foo; foo = 1235; ],
1937 [ ac_cv_have_sa_family_t="yes" ],
1940 #include <sys/types.h>
1941 #include <sys/socket.h>
1942 #include <netinet/in.h>
1944 [ sa_family_t foo; foo = 1235; ],
1945 [ ac_cv_have_sa_family_t="yes" ],
1947 [ ac_cv_have_sa_family_t="no" ]
1951 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1952 AC_DEFINE(HAVE_SA_FAMILY_T)
1955 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1958 #include <sys/types.h>
1960 [ pid_t foo; foo = 1235; ],
1961 [ ac_cv_have_pid_t="yes" ],
1962 [ ac_cv_have_pid_t="no" ]
1965 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1966 AC_DEFINE(HAVE_PID_T)
1969 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1972 #include <sys/types.h>
1974 [ mode_t foo; foo = 1235; ],
1975 [ ac_cv_have_mode_t="yes" ],
1976 [ ac_cv_have_mode_t="no" ]
1979 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1980 AC_DEFINE(HAVE_MODE_T)
1984 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1987 #include <sys/types.h>
1988 #include <sys/socket.h>
1990 [ struct sockaddr_storage s; ],
1991 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1992 [ ac_cv_have_struct_sockaddr_storage="no" ]
1995 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1996 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1999 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2002 #include <sys/types.h>
2003 #include <netinet/in.h>
2005 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2006 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2007 [ ac_cv_have_struct_sockaddr_in6="no" ]
2010 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2011 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2014 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2017 #include <sys/types.h>
2018 #include <netinet/in.h>
2020 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2021 [ ac_cv_have_struct_in6_addr="yes" ],
2022 [ ac_cv_have_struct_in6_addr="no" ]
2025 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2026 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2029 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2032 #include <sys/types.h>
2033 #include <sys/socket.h>
2036 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2037 [ ac_cv_have_struct_addrinfo="yes" ],
2038 [ ac_cv_have_struct_addrinfo="no" ]
2041 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2042 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2045 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2047 [ #include <sys/time.h> ],
2048 [ struct timeval tv; tv.tv_sec = 1;],
2049 [ ac_cv_have_struct_timeval="yes" ],
2050 [ ac_cv_have_struct_timeval="no" ]
2053 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2054 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2055 have_struct_timeval=1
2058 AC_CHECK_TYPES(struct timespec)
2060 # We need int64_t or else certian parts of the compile will fail.
2061 if test "x$ac_cv_have_int64_t" = "xno" && \
2062 test "x$ac_cv_sizeof_long_int" != "x8" && \
2063 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2064 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2065 echo "an alternative compiler (I.E., GCC) before continuing."
2069 dnl test snprintf (broken on SCO w/gcc)
2074 #ifdef HAVE_SNPRINTF
2078 char expected_out[50];
2080 #if (SIZEOF_LONG_INT == 8)
2081 long int num = 0x7fffffffffffffff;
2083 long long num = 0x7fffffffffffffffll;
2085 strcpy(expected_out, "9223372036854775807");
2086 snprintf(buf, mazsize, "%lld", num);
2087 if(strcmp(buf, expected_out) != 0)
2094 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2095 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2099 dnl Checks for structure members
2100 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2101 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2102 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2103 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2104 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2105 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2106 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2107 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2108 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2109 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2110 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2111 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2112 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2113 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2114 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2115 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2116 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2118 AC_CHECK_MEMBERS([struct stat.st_blksize])
2120 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2121 ac_cv_have_ss_family_in_struct_ss, [
2124 #include <sys/types.h>
2125 #include <sys/socket.h>
2127 [ struct sockaddr_storage s; s.ss_family = 1; ],
2128 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2129 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2132 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2133 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2136 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2137 ac_cv_have___ss_family_in_struct_ss, [
2140 #include <sys/types.h>
2141 #include <sys/socket.h>
2143 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2144 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2145 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2148 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2149 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2152 AC_CACHE_CHECK([for pw_class field in struct passwd],
2153 ac_cv_have_pw_class_in_struct_passwd, [
2158 [ struct passwd p; p.pw_class = 0; ],
2159 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2160 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2163 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2164 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2167 AC_CACHE_CHECK([for pw_expire field in struct passwd],
2168 ac_cv_have_pw_expire_in_struct_passwd, [
2173 [ struct passwd p; p.pw_expire = 0; ],
2174 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2175 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2178 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2179 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2182 AC_CACHE_CHECK([for pw_change field in struct passwd],
2183 ac_cv_have_pw_change_in_struct_passwd, [
2188 [ struct passwd p; p.pw_change = 0; ],
2189 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2190 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2193 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2194 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2197 dnl make sure we're using the real structure members and not defines
2198 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2199 ac_cv_have_accrights_in_msghdr, [
2202 #include <sys/types.h>
2203 #include <sys/socket.h>
2204 #include <sys/uio.h>
2206 #ifdef msg_accrights
2207 #error "msg_accrights is a macro"
2211 m.msg_accrights = 0;
2215 [ ac_cv_have_accrights_in_msghdr="yes" ],
2216 [ ac_cv_have_accrights_in_msghdr="no" ]
2219 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2220 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2223 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2224 ac_cv_have_control_in_msghdr, [
2227 #include <sys/types.h>
2228 #include <sys/socket.h>
2229 #include <sys/uio.h>
2232 #error "msg_control is a macro"
2240 [ ac_cv_have_control_in_msghdr="yes" ],
2241 [ ac_cv_have_control_in_msghdr="no" ]
2244 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2245 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2248 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2250 [ extern char *__progname; printf("%s", __progname); ],
2251 [ ac_cv_libc_defines___progname="yes" ],
2252 [ ac_cv_libc_defines___progname="no" ]
2255 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2256 AC_DEFINE(HAVE___PROGNAME)
2259 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2263 [ printf("%s", __FUNCTION__); ],
2264 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2265 [ ac_cv_cc_implements___FUNCTION__="no" ]
2268 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2269 AC_DEFINE(HAVE___FUNCTION__)
2272 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2276 [ printf("%s", __func__); ],
2277 [ ac_cv_cc_implements___func__="yes" ],
2278 [ ac_cv_cc_implements___func__="no" ]
2281 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2282 AC_DEFINE(HAVE___func__)
2285 AC_CACHE_CHECK([whether getopt has optreset support],
2286 ac_cv_have_getopt_optreset, [
2291 [ extern int optreset; optreset = 0; ],
2292 [ ac_cv_have_getopt_optreset="yes" ],
2293 [ ac_cv_have_getopt_optreset="no" ]
2296 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2297 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2300 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2302 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2303 [ ac_cv_libc_defines_sys_errlist="yes" ],
2304 [ ac_cv_libc_defines_sys_errlist="no" ]
2307 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2308 AC_DEFINE(HAVE_SYS_ERRLIST)
2312 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2314 [ extern int sys_nerr; printf("%i", sys_nerr);],
2315 [ ac_cv_libc_defines_sys_nerr="yes" ],
2316 [ ac_cv_libc_defines_sys_nerr="no" ]
2319 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2320 AC_DEFINE(HAVE_SYS_NERR)
2324 # Check whether user wants sectok support
2326 [ --with-sectok Enable smartcard support using libsectok],
2328 if test "x$withval" != "xno" ; then
2329 if test "x$withval" != "xyes" ; then
2330 CPPFLAGS="$CPPFLAGS -I${withval}"
2331 LDFLAGS="$LDFLAGS -L${withval}"
2332 if test ! -z "$need_dash_r" ; then
2333 LDFLAGS="$LDFLAGS -R${withval}"
2335 if test ! -z "$blibpath" ; then
2336 blibpath="$blibpath:${withval}"
2339 AC_CHECK_HEADERS(sectok.h)
2340 if test "$ac_cv_header_sectok_h" != yes; then
2341 AC_MSG_ERROR(Can't find sectok.h)
2343 AC_CHECK_LIB(sectok, sectok_open)
2344 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2345 AC_MSG_ERROR(Can't find libsectok)
2347 AC_DEFINE(SMARTCARD)
2348 AC_DEFINE(USE_SECTOK)
2349 SCARD_MSG="yes, using sectok"
2354 # Check whether user wants OpenSC support
2357 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2359 if test "x$withval" != "xno" ; then
2360 if test "x$withval" != "xyes" ; then
2361 OPENSC_CONFIG=$withval/bin/opensc-config
2363 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2365 if test "$OPENSC_CONFIG" != "no"; then
2366 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2367 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2368 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2369 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2370 AC_DEFINE(SMARTCARD)
2371 AC_DEFINE(USE_OPENSC)
2372 SCARD_MSG="yes, using OpenSC"
2378 # Check libraries needed by DNS fingerprint support
2379 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2380 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
2382 # Needed by our getrrsetbyname()
2383 AC_SEARCH_LIBS(res_query, resolv)
2384 AC_SEARCH_LIBS(dn_expand, resolv)
2385 AC_MSG_CHECKING(if res_query will link)
2386 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2389 LIBS="$LIBS -lresolv"
2390 AC_MSG_CHECKING(for res_query in -lresolv)
2395 res_query (0, 0, 0, 0, 0);
2399 [LIBS="$LIBS -lresolv"
2400 AC_MSG_RESULT(yes)],
2404 AC_CHECK_FUNCS(_getshort _getlong)
2405 AC_CHECK_MEMBER(HEADER.ad,
2406 [AC_DEFINE(HAVE_HEADER_AD)],,
2407 [#include <arpa/nameser.h>])
2410 # Check whether user wants Kerberos 5 support
2412 AC_ARG_WITH(kerberos5,
2413 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2414 [ if test "x$withval" != "xno" ; then
2415 if test "x$withval" = "xyes" ; then
2416 KRB5ROOT="/usr/local"
2424 AC_MSG_CHECKING(for krb5-config)
2425 if test -x $KRB5ROOT/bin/krb5-config ; then
2426 KRB5CONF=$KRB5ROOT/bin/krb5-config
2427 AC_MSG_RESULT($KRB5CONF)
2429 AC_MSG_CHECKING(for gssapi support)
2430 if $KRB5CONF | grep gssapi >/dev/null ; then
2438 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2439 K5LIBS="`$KRB5CONF --libs $k5confopts`"
2440 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2441 AC_MSG_CHECKING(whether we are using Heimdal)
2442 AC_TRY_COMPILE([ #include <krb5.h> ],
2443 [ char *tmp = heimdal_version; ],
2444 [ AC_MSG_RESULT(yes)
2445 AC_DEFINE(HEIMDAL) ],
2450 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2451 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2452 AC_MSG_CHECKING(whether we are using Heimdal)
2453 AC_TRY_COMPILE([ #include <krb5.h> ],
2454 [ char *tmp = heimdal_version; ],
2455 [ AC_MSG_RESULT(yes)
2457 K5LIBS="-lkrb5 -ldes"
2458 K5LIBS="$K5LIBS -lcom_err -lasn1"
2459 AC_CHECK_LIB(roken, net_write,
2460 [K5LIBS="$K5LIBS -lroken"])
2463 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2466 AC_SEARCH_LIBS(dn_expand, resolv)
2468 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2470 K5LIBS="-lgssapi $K5LIBS" ],
2471 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2473 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2474 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2479 AC_CHECK_HEADER(gssapi.h, ,
2480 [ unset ac_cv_header_gssapi_h
2481 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2482 AC_CHECK_HEADERS(gssapi.h, ,
2483 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2489 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2490 AC_CHECK_HEADER(gssapi_krb5.h, ,
2491 [ CPPFLAGS="$oldCPP" ])
2494 if test ! -z "$need_dash_r" ; then
2495 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2497 if test ! -z "$blibpath" ; then
2498 blibpath="$blibpath:${KRB5ROOT}/lib"
2502 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2503 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2504 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2506 LIBS="$LIBS $K5LIBS"
2507 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2508 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
2512 # Looking for programs, paths and files
2514 PRIVSEP_PATH=/var/empty
2515 AC_ARG_WITH(privsep-path,
2516 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2518 if test -n "$withval" && test "x$withval" != "xno" && \
2519 test "x${withval}" != "xyes"; then
2520 PRIVSEP_PATH=$withval
2524 AC_SUBST(PRIVSEP_PATH)
2527 [ --with-xauth=PATH Specify path to xauth program ],
2529 if test -n "$withval" && test "x$withval" != "xno" && \
2530 test "x${withval}" != "xyes"; then
2536 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2537 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2538 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2539 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2540 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2541 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2542 xauth_path="/usr/openwin/bin/xauth"
2548 AC_ARG_ENABLE(strip,
2549 [ --disable-strip Disable calling strip(1) on install],
2551 if test "x$enableval" = "xno" ; then
2558 if test -z "$xauth_path" ; then
2559 XAUTH_PATH="undefined"
2560 AC_SUBST(XAUTH_PATH)
2562 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2563 XAUTH_PATH=$xauth_path
2564 AC_SUBST(XAUTH_PATH)
2567 # Check for mail directory (last resort if we cannot get it from headers)
2568 if test ! -z "$MAIL" ; then
2569 maildir=`dirname $MAIL`
2570 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2573 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
2574 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2575 disable_ptmx_check=yes
2577 if test -z "$no_dev_ptmx" ; then
2578 if test "x$disable_ptmx_check" != "xyes" ; then
2579 AC_CHECK_FILE("/dev/ptmx",
2581 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2588 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
2589 AC_CHECK_FILE("/dev/ptc",
2591 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2596 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2599 # Options from here on. Some of these are preset by platform above
2600 AC_ARG_WITH(mantype,
2601 [ --with-mantype=man|cat|doc Set man page type],
2608 AC_MSG_ERROR(invalid man type: $withval)
2613 if test -z "$MANTYPE"; then
2614 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2615 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2616 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2618 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2625 if test "$MANTYPE" = "doc"; then
2632 # Check whether to enable MD5 passwords
2634 AC_ARG_WITH(md5-passwords,
2635 [ --with-md5-passwords Enable use of MD5 passwords],
2637 if test "x$withval" != "xno" ; then
2638 AC_DEFINE(HAVE_MD5_PASSWORDS)
2644 # Whether to disable shadow password support
2646 [ --without-shadow Disable shadow password support],
2648 if test "x$withval" = "xno" ; then
2649 AC_DEFINE(DISABLE_SHADOW)
2655 if test -z "$disable_shadow" ; then
2656 AC_MSG_CHECKING([if the systems has expire shadow information])
2659 #include <sys/types.h>
2662 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2663 [ sp_expire_available=yes ], []
2666 if test "x$sp_expire_available" = "xyes" ; then
2668 AC_DEFINE(HAS_SHADOW_EXPIRE)
2674 # Use ip address instead of hostname in $DISPLAY
2675 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2676 DISPLAY_HACK_MSG="yes"
2677 AC_DEFINE(IPADDR_IN_DISPLAY)
2679 DISPLAY_HACK_MSG="no"
2680 AC_ARG_WITH(ipaddr-display,
2681 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2683 if test "x$withval" != "xno" ; then
2684 AC_DEFINE(IPADDR_IN_DISPLAY)
2685 DISPLAY_HACK_MSG="yes"
2691 # check for /etc/default/login and use it if present.
2692 AC_ARG_ENABLE(etc-default-login,
2693 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
2694 [ if test "x$enableval" = "xno"; then
2695 AC_MSG_NOTICE([/etc/default/login handling disabled])
2696 etc_default_login=no
2698 etc_default_login=yes
2700 [ etc_default_login=yes ]
2703 if test "x$etc_default_login" != "xno"; then
2704 AC_CHECK_FILE("/etc/default/login",
2705 [ external_path_file=/etc/default/login ])
2706 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2708 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2709 elif test "x$external_path_file" = "x/etc/default/login"; then
2710 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2714 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2715 if test $ac_cv_func_login_getcapbool = "yes" && \
2716 test $ac_cv_header_login_cap_h = "yes" ; then
2717 external_path_file=/etc/login.conf
2720 # Whether to mess with the default path
2721 SERVER_PATH_MSG="(default)"
2722 AC_ARG_WITH(default-path,
2723 [ --with-default-path= Specify default \$PATH environment for server],
2725 if test "x$external_path_file" = "x/etc/login.conf" ; then
2727 --with-default-path=PATH has no effect on this system.
2728 Edit /etc/login.conf instead.])
2729 elif test "x$withval" != "xno" ; then
2730 if test ! -z "$external_path_file" ; then
2732 --with-default-path=PATH will only be used if PATH is not defined in
2733 $external_path_file .])
2735 user_path="$withval"
2736 SERVER_PATH_MSG="$withval"
2739 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2740 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2742 if test ! -z "$external_path_file" ; then
2744 If PATH is defined in $external_path_file, ensure the path to scp is included,
2745 otherwise scp will not work.])
2749 /* find out what STDPATH is */
2754 #ifndef _PATH_STDPATH
2755 # ifdef _PATH_USERPATH /* Irix */
2756 # define _PATH_STDPATH _PATH_USERPATH
2758 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2761 #include <sys/types.h>
2762 #include <sys/stat.h>
2764 #define DATA "conftest.stdpath"
2771 fd = fopen(DATA,"w");
2775 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2780 ], [ user_path=`cat conftest.stdpath` ],
2781 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2782 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2784 # make sure $bindir is in USER_PATH so scp will work
2785 t_bindir=`eval echo ${bindir}`
2787 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2790 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2792 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2793 if test $? -ne 0 ; then
2794 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2795 if test $? -ne 0 ; then
2796 user_path=$user_path:$t_bindir
2797 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2802 if test "x$external_path_file" != "x/etc/login.conf" ; then
2803 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2807 # Set superuser path separately to user path
2808 AC_ARG_WITH(superuser-path,
2809 [ --with-superuser-path= Specify different path for super-user],
2811 if test -n "$withval" && test "x$withval" != "xno" && \
2812 test "x${withval}" != "xyes"; then
2813 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2814 superuser_path=$withval
2820 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2821 IPV4_IN6_HACK_MSG="no"
2823 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2825 if test "x$withval" != "xno" ; then
2827 AC_DEFINE(IPV4_IN_IPV6)
2828 IPV4_IN6_HACK_MSG="yes"
2833 if test "x$inet6_default_4in6" = "xyes"; then
2834 AC_MSG_RESULT([yes (default)])
2835 AC_DEFINE(IPV4_IN_IPV6)
2836 IPV4_IN6_HACK_MSG="yes"
2838 AC_MSG_RESULT([no (default)])
2843 # Whether to enable BSD auth support
2845 AC_ARG_WITH(bsd-auth,
2846 [ --with-bsd-auth Enable BSD auth support],
2848 if test "x$withval" != "xno" ; then
2855 # Where to place sshd.pid
2857 # make sure the directory exists
2858 if test ! -d $piddir ; then
2859 piddir=`eval echo ${sysconfdir}`
2861 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2865 AC_ARG_WITH(pid-dir,
2866 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2868 if test -n "$withval" && test "x$withval" != "xno" && \
2869 test "x${withval}" != "xyes"; then
2871 if test ! -d $piddir ; then
2872 AC_MSG_WARN([** no $piddir directory on this system **])
2878 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2881 dnl allow user to disable some login recording features
2882 AC_ARG_ENABLE(lastlog,
2883 [ --disable-lastlog disable use of lastlog even if detected [no]],
2885 if test "x$enableval" = "xno" ; then
2886 AC_DEFINE(DISABLE_LASTLOG)
2891 [ --disable-utmp disable use of utmp even if detected [no]],
2893 if test "x$enableval" = "xno" ; then
2894 AC_DEFINE(DISABLE_UTMP)
2898 AC_ARG_ENABLE(utmpx,
2899 [ --disable-utmpx disable use of utmpx even if detected [no]],
2901 if test "x$enableval" = "xno" ; then
2902 AC_DEFINE(DISABLE_UTMPX)
2907 [ --disable-wtmp disable use of wtmp even if detected [no]],
2909 if test "x$enableval" = "xno" ; then
2910 AC_DEFINE(DISABLE_WTMP)
2914 AC_ARG_ENABLE(wtmpx,
2915 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2917 if test "x$enableval" = "xno" ; then
2918 AC_DEFINE(DISABLE_WTMPX)
2922 AC_ARG_ENABLE(libutil,
2923 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2925 if test "x$enableval" = "xno" ; then
2926 AC_DEFINE(DISABLE_LOGIN)
2930 AC_ARG_ENABLE(pututline,
2931 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2933 if test "x$enableval" = "xno" ; then
2934 AC_DEFINE(DISABLE_PUTUTLINE)
2938 AC_ARG_ENABLE(pututxline,
2939 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2941 if test "x$enableval" = "xno" ; then
2942 AC_DEFINE(DISABLE_PUTUTXLINE)
2946 AC_ARG_WITH(lastlog,
2947 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2949 if test "x$withval" = "xno" ; then
2950 AC_DEFINE(DISABLE_LASTLOG)
2951 elif test -n "$withval" && test "x${withval}" != "xyes"; then
2952 conf_lastlog_location=$withval
2957 dnl lastlog, [uw]tmpx? detection
2958 dnl NOTE: set the paths in the platform section to avoid the
2959 dnl need for command-line parameters
2960 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2962 dnl lastlog detection
2963 dnl NOTE: the code itself will detect if lastlog is a directory
2964 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2966 #include <sys/types.h>
2968 #ifdef HAVE_LASTLOG_H
2969 # include <lastlog.h>
2978 [ char *lastlog = LASTLOG_FILE; ],
2979 [ AC_MSG_RESULT(yes) ],
2982 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2984 #include <sys/types.h>
2986 #ifdef HAVE_LASTLOG_H
2987 # include <lastlog.h>
2993 [ char *lastlog = _PATH_LASTLOG; ],
2994 [ AC_MSG_RESULT(yes) ],
2997 system_lastlog_path=no
3002 if test -z "$conf_lastlog_location"; then
3003 if test x"$system_lastlog_path" = x"no" ; then
3004 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3005 if (test -d "$f" || test -f "$f") ; then
3006 conf_lastlog_location=$f
3009 if test -z "$conf_lastlog_location"; then
3010 AC_MSG_WARN([** Cannot find lastlog **])
3011 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
3016 if test -n "$conf_lastlog_location"; then
3017 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
3021 AC_MSG_CHECKING([if your system defines UTMP_FILE])
3023 #include <sys/types.h>
3029 [ char *utmp = UTMP_FILE; ],
3030 [ AC_MSG_RESULT(yes) ],
3032 system_utmp_path=no ]
3034 if test -z "$conf_utmp_location"; then
3035 if test x"$system_utmp_path" = x"no" ; then
3036 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3037 if test -f $f ; then
3038 conf_utmp_location=$f
3041 if test -z "$conf_utmp_location"; then
3042 AC_DEFINE(DISABLE_UTMP)
3046 if test -n "$conf_utmp_location"; then
3047 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
3051 AC_MSG_CHECKING([if your system defines WTMP_FILE])
3053 #include <sys/types.h>
3059 [ char *wtmp = WTMP_FILE; ],
3060 [ AC_MSG_RESULT(yes) ],
3062 system_wtmp_path=no ]
3064 if test -z "$conf_wtmp_location"; then
3065 if test x"$system_wtmp_path" = x"no" ; then
3066 for f in /usr/adm/wtmp /var/log/wtmp; do
3067 if test -f $f ; then
3068 conf_wtmp_location=$f
3071 if test -z "$conf_wtmp_location"; then
3072 AC_DEFINE(DISABLE_WTMP)
3076 if test -n "$conf_wtmp_location"; then
3077 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
3081 dnl utmpx detection - I don't know any system so perverse as to require
3082 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3084 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3086 #include <sys/types.h>
3095 [ char *utmpx = UTMPX_FILE; ],
3096 [ AC_MSG_RESULT(yes) ],
3098 system_utmpx_path=no ]
3100 if test -z "$conf_utmpx_location"; then
3101 if test x"$system_utmpx_path" = x"no" ; then
3102 AC_DEFINE(DISABLE_UTMPX)
3105 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
3109 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3111 #include <sys/types.h>
3120 [ char *wtmpx = WTMPX_FILE; ],
3121 [ AC_MSG_RESULT(yes) ],
3123 system_wtmpx_path=no ]
3125 if test -z "$conf_wtmpx_location"; then
3126 if test x"$system_wtmpx_path" = x"no" ; then
3127 AC_DEFINE(DISABLE_WTMPX)
3130 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
3134 if test ! -z "$blibpath" ; then
3135 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3136 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3139 dnl remove pam and dl because they are in $LIBPAM
3140 if test "$PAM_MSG" = yes ; then
3141 LIBS=`echo $LIBS | sed 's/-lpam //'`
3143 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3144 LIBS=`echo $LIBS | sed 's/-ldl //'`
3148 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3149 scard/Makefile ssh_prng_cmds survey.sh])
3152 # Print summary of options
3154 # Someone please show me a better way :)
3155 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3156 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3157 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3158 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3159 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3160 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3161 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
3162 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3163 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3164 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3167 echo "OpenSSH has been configured with the following options:"
3168 echo " User binaries: $B"
3169 echo " System binaries: $C"
3170 echo " Configuration files: $D"
3171 echo " Askpass program: $E"
3172 echo " Manual pages: $F"
3173 echo " PID file: $G"
3174 echo " Privilege separation chroot path: $H"
3175 if test "x$external_path_file" = "x/etc/login.conf" ; then
3176 echo " At runtime, sshd will use the path defined in $external_path_file"
3177 echo " Make sure the path to scp is present, otherwise scp will not work"
3179 echo " sshd default user PATH: $I"
3180 if test ! -z "$external_path_file"; then
3181 echo " (If PATH is set in $external_path_file it will be used instead. If"
3182 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3185 if test ! -z "$superuser_path" ; then
3186 echo " sshd superuser user PATH: $J"
3188 echo " Manpage format: $MANTYPE"
3189 echo " PAM support: $PAM_MSG"
3190 echo " KerberosV support: $KRB5_MSG"
3191 echo " Smartcard support: $SCARD_MSG"
3192 echo " S/KEY support: $SKEY_MSG"
3193 echo " TCP Wrappers support: $TCPW_MSG"
3194 echo " MD5 password support: $MD5_MSG"
3195 echo " libedit support: $LIBEDIT_MSG"
3196 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
3197 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3198 echo " BSD Auth support: $BSD_AUTH_MSG"
3199 echo " Random number source: $RAND_MSG"
3200 if test ! -z "$USE_RAND_HELPER" ; then
3201 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
3206 echo " Host: ${host}"
3207 echo " Compiler: ${CC}"
3208 echo " Compiler flags: ${CFLAGS}"
3209 echo "Preprocessor flags: ${CPPFLAGS}"
3210 echo " Linker flags: ${LDFLAGS}"
3211 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
3215 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
3216 echo "SVR4 style packages are supported with \"make package\""
3220 if test "x$PAM_MSG" = "xyes" ; then
3221 echo "PAM is enabled. You may need to install a PAM control file "
3222 echo "for sshd, otherwise password authentication may fail. "
3223 echo "Example PAM control files can be found in the contrib/ "
3228 if test ! -z "$RAND_HELPER_CMDHASH" ; then
3229 echo "WARNING: you are using the builtin random number collection "
3230 echo "service. Please read WARNING.RNG and request that your OS "
3231 echo "vendor includes kernel-based random number collection in "
3232 echo "future versions of your OS."
3236 if test ! -z "$NO_PEERCHECK" ; then
3237 echo "WARNING: the operating system that you are using does not "
3238 echo "appear to support either the getpeereid() API nor the "
3239 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3240 echo "enforce security checks to prevent unauthorised connections to "
3241 echo "ssh-agent. Their absence increases the risk that a malicious "
3242 echo "user can connect to your agent. "
3246 if test "$AUDIT_MODULE" = "bsm" ; then
3247 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3248 echo "See the Solaris section in README.platform for details."