3 # Copyright (c) 1999-2004 Damien Miller
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
18 AC_CONFIG_SRCDIR([ssh.c])
20 AC_CONFIG_HEADER(config.h)
25 # Checks for programs.
31 AC_PATH_PROG(CAT, cat)
32 AC_PATH_PROG(KILL, kill)
33 AC_PATH_PROGS(PERL, perl5 perl)
34 AC_PATH_PROG(SED, sed)
36 AC_PATH_PROG(ENT, ent)
38 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
42 AC_SUBST(TEST_SHELL,sh)
45 AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47 AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49 AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
54 if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
58 # Use LOGIN_PROGRAM from environment if possible
59 if test ! -z "$LOGIN_PROGRAM" ; then
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
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
81 AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
83 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
84 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
85 CFLAGS="$CFLAGS -Wsign-compare"
87 if test -z "$have_llong_max"; then
88 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
89 unset ac_cv_have_decl_LLONG_MAX
90 saved_CFLAGS="$CFLAGS"
91 CFLAGS="$CFLAGS -std=gnu99"
92 AC_CHECK_DECL(LLONG_MAX,
94 [CFLAGS="$saved_CFLAGS"],
100 if test -z "$have_llong_max"; then
101 AC_MSG_CHECKING([for max value of long long])
105 /* Why is this so damn hard? */
111 #define DATA "conftest.llminmax"
114 long long i, llmin, llmax = 0;
116 if((f = fopen(DATA,"w")) == NULL)
119 #if defined(LLONG_MIN) && defined(LLONG_MAX)
120 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
124 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
125 /* This will work on one's complement and two's complement */
126 for (i = 1; i > llmax; i <<= 1, i++)
128 llmin = llmax + 1LL; /* wrap */
132 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
133 || llmax - 1 > llmax) {
134 fprintf(f, "unknown unknown\n");
138 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
145 llong_min=`$AWK '{print $1}' conftest.llminmax`
146 llong_max=`$AWK '{print $2}' conftest.llminmax`
147 AC_MSG_RESULT($llong_max)
148 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
149 [max value of long long calculated by configure])
150 AC_MSG_CHECKING([for min value of long long])
151 AC_MSG_RESULT($llong_min)
152 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
153 [min value of long long calculated by configure])
156 AC_MSG_RESULT(not found)
159 AC_MSG_WARN([cross compiling: not checking])
165 [ --without-rpath Disable auto-added -R linker paths],
167 if test "x$withval" = "xno" ; then
170 if test "x$withval" = "xyes" ; then
176 # Check for some target-specific stuff
179 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
180 if (test -z "$blibpath"); then
181 blibpath="/usr/lib:/lib"
183 saved_LDFLAGS="$LDFLAGS"
184 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
185 if (test -z "$blibflags"); then
186 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
187 AC_TRY_LINK([], [], [blibflags=$tryflags])
190 if (test -z "$blibflags"); then
191 AC_MSG_RESULT(not found)
192 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
194 AC_MSG_RESULT($blibflags)
196 LDFLAGS="$saved_LDFLAGS"
197 dnl Check for authenticate. Might be in libs.a on older AIXes
198 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
199 [AC_CHECK_LIB(s,authenticate,
200 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
204 dnl Check for various auth function declarations in headers.
205 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
206 passwdexpired, setauthdb], , , [#include <usersec.h>])
207 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
208 AC_CHECK_DECLS(loginfailed,
209 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
211 [#include <usersec.h>],
212 [(void)loginfailed("user","host","tty",0);],
214 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
218 [#include <usersec.h>]
220 AC_CHECK_FUNCS(setauthdb)
221 check_for_aix_broken_getaddrinfo=1
222 AC_DEFINE(BROKEN_REALPATH)
223 AC_DEFINE(SETEUID_BREAKS_SETUID)
224 AC_DEFINE(BROKEN_SETREUID)
225 AC_DEFINE(BROKEN_SETREGID)
226 dnl AIX handles lastlog as part of its login message
227 AC_DEFINE(DISABLE_LASTLOG)
228 AC_DEFINE(LOGIN_NEEDS_UTMPX)
229 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
232 check_for_libcrypt_later=1
233 LIBS="$LIBS /usr/lib/textmode.o"
234 AC_DEFINE(HAVE_CYGWIN)
236 AC_DEFINE(DISABLE_SHADOW)
237 AC_DEFINE(IP_TOS_IS_BROKEN)
238 AC_DEFINE(NO_X11_UNIX_SOCKETS)
239 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
240 AC_DEFINE(DISABLE_FD_PASSING)
243 AC_DEFINE(IP_TOS_IS_BROKEN)
244 AC_DEFINE(SETEUID_BREAKS_SETUID)
245 AC_DEFINE(BROKEN_SETREUID)
246 AC_DEFINE(BROKEN_SETREGID)
249 AC_MSG_CHECKING(if we have working getaddrinfo)
250 AC_TRY_RUN([#include <mach-o/dyld.h>
251 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
255 }], [AC_MSG_RESULT(working)],
256 [AC_MSG_RESULT(buggy)
257 AC_DEFINE(BROKEN_GETADDRINFO)],
258 [AC_MSG_RESULT(assume it is working)])
259 AC_DEFINE(SETEUID_BREAKS_SETUID)
260 AC_DEFINE(BROKEN_SETREUID)
261 AC_DEFINE(BROKEN_SETREGID)
262 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
265 # first we define all of the options common to all HP-UX releases
266 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
267 IPADDR_IN_DISPLAY=yes
269 AC_DEFINE(LOGIN_NO_ENDOPT)
270 AC_DEFINE(LOGIN_NEEDS_UTMPX)
271 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
272 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
274 AC_CHECK_LIB(xnet, t_error, ,
275 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
277 # next, we define all of the options specific to major releases
280 if test -z "$GCC"; then
285 AC_DEFINE(PAM_SUN_CODEBASE)
286 AC_DEFINE(DISABLE_UTMP)
287 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
288 check_for_hpux_broken_getaddrinfo=1
289 check_for_conflicting_getspnam=1
293 # lastly, we define options specific to minor releases
296 AC_DEFINE(HAVE_SECUREWARE)
297 disable_ptmx_check=yes
303 PATH="$PATH:/usr/etc"
304 AC_DEFINE(BROKEN_INET_NTOA)
305 AC_DEFINE(SETEUID_BREAKS_SETUID)
306 AC_DEFINE(BROKEN_SETREUID)
307 AC_DEFINE(BROKEN_SETREGID)
308 AC_DEFINE(WITH_ABBREV_NO_TTY)
309 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
312 PATH="$PATH:/usr/etc"
313 AC_DEFINE(WITH_IRIX_ARRAY)
314 AC_DEFINE(WITH_IRIX_PROJECT)
315 AC_DEFINE(WITH_IRIX_AUDIT)
316 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
317 AC_DEFINE(BROKEN_INET_NTOA)
318 AC_DEFINE(SETEUID_BREAKS_SETUID)
319 AC_DEFINE(BROKEN_SETREUID)
320 AC_DEFINE(BROKEN_SETREGID)
321 AC_DEFINE(BROKEN_UPDWTMPX)
322 AC_DEFINE(WITH_ABBREV_NO_TTY)
323 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
327 check_for_libcrypt_later=1
328 check_for_openpty_ctty_bug=1
329 AC_DEFINE(DONT_TRY_OTHER_AF)
330 AC_DEFINE(PAM_TTY_KLUDGE)
331 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
332 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
333 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
334 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
335 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
336 inet6_default_4in6=yes
339 AC_DEFINE(BROKEN_CMSG_TYPE)
343 mips-sony-bsd|mips-sony-newsos4)
344 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
348 check_for_libcrypt_before=1
349 if test "x$withval" != "xno" ; then
354 check_for_libcrypt_later=1
357 AC_DEFINE(SETEUID_BREAKS_SETUID)
358 AC_DEFINE(BROKEN_SETREUID)
359 AC_DEFINE(BROKEN_SETREGID)
362 conf_lastlog_location="/usr/adm/lastlog"
363 conf_utmp_location=/etc/utmp
364 conf_wtmp_location=/usr/adm/wtmp
367 AC_DEFINE(BROKEN_REALPATH)
369 AC_DEFINE(BROKEN_SAVED_UIDS)
372 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
375 if test "x$withval" != "xno" ; then
378 AC_DEFINE(PAM_SUN_CODEBASE)
379 AC_DEFINE(LOGIN_NEEDS_UTMPX)
380 AC_DEFINE(LOGIN_NEEDS_TERM)
381 AC_DEFINE(PAM_TTY_KLUDGE)
382 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
383 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
384 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
385 AC_DEFINE(SSHD_ACQUIRES_CTTY)
386 external_path_file=/etc/default/login
387 # hardwire lastlog location (can't detect it on some versions)
388 conf_lastlog_location="/var/adm/lastlog"
389 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
390 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
391 if test "$sol2ver" -ge 8; then
393 AC_DEFINE(DISABLE_UTMP)
394 AC_DEFINE(DISABLE_WTMP)
400 CPPFLAGS="$CPPFLAGS -DSUNOS4"
401 AC_CHECK_FUNCS(getpwanam)
402 AC_DEFINE(PAM_SUN_CODEBASE)
403 conf_utmp_location=/etc/utmp
404 conf_wtmp_location=/var/adm/wtmp
405 conf_lastlog_location=/var/adm/lastlog
411 AC_DEFINE(SSHD_ACQUIRES_CTTY)
412 AC_DEFINE(SETEUID_BREAKS_SETUID)
413 AC_DEFINE(BROKEN_SETREUID)
414 AC_DEFINE(BROKEN_SETREGID)
417 # /usr/ucblib MUST NOT be searched on ReliantUNIX
418 AC_CHECK_LIB(dl, dlsym, ,)
419 # -lresolv needs to be at then end of LIBS or DNS lookups break
420 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
421 IPADDR_IN_DISPLAY=yes
423 AC_DEFINE(IP_TOS_IS_BROKEN)
424 AC_DEFINE(SETEUID_BREAKS_SETUID)
425 AC_DEFINE(BROKEN_SETREUID)
426 AC_DEFINE(BROKEN_SETREGID)
427 AC_DEFINE(SSHD_ACQUIRES_CTTY)
428 external_path_file=/etc/default/login
429 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
430 # Attention: always take care to bind libsocket and libnsl before libc,
431 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
433 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
436 AC_DEFINE(SETEUID_BREAKS_SETUID)
437 AC_DEFINE(BROKEN_SETREUID)
438 AC_DEFINE(BROKEN_SETREGID)
439 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
441 # UnixWare 7.x, OpenUNIX 8
444 AC_DEFINE(SETEUID_BREAKS_SETUID)
445 AC_DEFINE(BROKEN_SETREUID)
446 AC_DEFINE(BROKEN_SETREGID)
447 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
449 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
450 TEST_SHELL=/u95/bin/sh
456 # SCO UNIX and OEM versions of SCO UNIX
458 AC_MSG_ERROR("This Platform is no longer supported.")
462 if test -z "$GCC"; then
463 CFLAGS="$CFLAGS -belf"
465 LIBS="$LIBS -lprot -lx -ltinfo -lm"
468 AC_DEFINE(HAVE_SECUREWARE)
469 AC_DEFINE(DISABLE_SHADOW)
470 AC_DEFINE(DISABLE_FD_PASSING)
471 AC_DEFINE(SETEUID_BREAKS_SETUID)
472 AC_DEFINE(BROKEN_SETREUID)
473 AC_DEFINE(BROKEN_SETREGID)
474 AC_DEFINE(WITH_ABBREV_NO_TTY)
475 AC_DEFINE(BROKEN_UPDWTMPX)
476 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
477 AC_CHECK_FUNCS(getluid setluid)
482 AC_DEFINE(NO_SSH_LASTLOG)
483 AC_DEFINE(SETEUID_BREAKS_SETUID)
484 AC_DEFINE(BROKEN_SETREUID)
485 AC_DEFINE(BROKEN_SETREGID)
487 AC_DEFINE(DISABLE_FD_PASSING)
489 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
493 AC_DEFINE(SETEUID_BREAKS_SETUID)
494 AC_DEFINE(BROKEN_SETREUID)
495 AC_DEFINE(BROKEN_SETREGID)
496 AC_DEFINE(WITH_ABBREV_NO_TTY)
498 AC_DEFINE(DISABLE_FD_PASSING)
500 LIBS="$LIBS -lgen -lacid -ldb"
504 AC_DEFINE(SETEUID_BREAKS_SETUID)
505 AC_DEFINE(BROKEN_SETREUID)
506 AC_DEFINE(BROKEN_SETREGID)
508 AC_DEFINE(DISABLE_FD_PASSING)
509 AC_DEFINE(NO_SSH_LASTLOG)
510 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
511 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
515 AC_MSG_CHECKING(for Digital Unix SIA)
518 [ --with-osfsia Enable Digital Unix SIA],
520 if test "x$withval" = "xno" ; then
521 AC_MSG_RESULT(disabled)
526 if test -z "$no_osfsia" ; then
527 if test -f /etc/sia/matrix.conf; then
529 AC_DEFINE(HAVE_OSF_SIA)
530 AC_DEFINE(DISABLE_LOGIN)
531 AC_DEFINE(DISABLE_FD_PASSING)
532 LIBS="$LIBS -lsecurity -ldb -lm -laud"
535 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
538 AC_DEFINE(BROKEN_GETADDRINFO)
539 AC_DEFINE(SETEUID_BREAKS_SETUID)
540 AC_DEFINE(BROKEN_SETREUID)
541 AC_DEFINE(BROKEN_SETREGID)
546 AC_DEFINE(NO_X11_UNIX_SOCKETS)
547 AC_DEFINE(MISSING_NFDBITS)
548 AC_DEFINE(MISSING_HOWMANY)
549 AC_DEFINE(MISSING_FD_MASK)
553 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
554 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
555 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
556 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
560 # Allow user to specify flags
562 [ --with-cflags Specify additional flags to pass to compiler],
564 if test -n "$withval" && test "x$withval" != "xno" && \
565 test "x${withval}" != "xyes"; then
566 CFLAGS="$CFLAGS $withval"
570 AC_ARG_WITH(cppflags,
571 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
573 if test -n "$withval" && test "x$withval" != "xno" && \
574 test "x${withval}" != "xyes"; then
575 CPPFLAGS="$CPPFLAGS $withval"
580 [ --with-ldflags Specify additional flags to pass to linker],
582 if test -n "$withval" && test "x$withval" != "xno" && \
583 test "x${withval}" != "xyes"; then
584 LDFLAGS="$LDFLAGS $withval"
589 [ --with-libs Specify additional libraries to link with],
591 if test -n "$withval" && test "x$withval" != "xno" && \
592 test "x${withval}" != "xyes"; then
593 LIBS="$LIBS $withval"
598 [ --with-Werror Build main code with -Werror],
600 if test -n "$withval" && test "x$withval" != "xno"; then
601 werror_flags="-Werror"
602 if "x${withval}" != "xyes"; then
603 werror_flags="$withval"
609 AC_MSG_CHECKING(compiler and flags for sanity)
615 [ AC_MSG_RESULT(yes) ],
618 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
620 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
623 dnl Checks for header files.
648 security/pam_appl.h \
684 # sys/ptms.h requires sys/stream.h to be included first on Solaris
685 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
686 #ifdef HAVE_SYS_STREAM_H
687 # include <sys/stream.h>
691 # Checks for libraries.
692 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
693 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
695 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
696 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
697 AC_CHECK_LIB(gen, dirname,[
698 AC_CACHE_CHECK([for broken dirname],
699 ac_cv_have_broken_dirname, [
707 int main(int argc, char **argv) {
710 strncpy(buf,"/etc", 32);
712 if (!s || strncmp(s, "/", 32) != 0) {
719 [ ac_cv_have_broken_dirname="no" ],
720 [ ac_cv_have_broken_dirname="yes" ]
724 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
726 AC_DEFINE(HAVE_DIRNAME)
727 AC_CHECK_HEADERS(libgen.h)
732 AC_CHECK_FUNC(getspnam, ,
733 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
734 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
738 [ --with-zlib=PATH Use zlib in PATH],
739 [ if test "x$withval" = "xno" ; then
740 AC_MSG_ERROR([*** zlib is required ***])
741 elif test "x$withval" != "xyes"; then
742 if test -d "$withval/lib"; then
743 if test -n "${need_dash_r}"; then
744 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
746 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
749 if test -n "${need_dash_r}"; then
750 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
752 LDFLAGS="-L${withval} ${LDFLAGS}"
755 if test -d "$withval/include"; then
756 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
758 CPPFLAGS="-I${withval} ${CPPFLAGS}"
763 AC_CHECK_LIB(z, deflate, ,
765 saved_CPPFLAGS="$CPPFLAGS"
766 saved_LDFLAGS="$LDFLAGS"
768 dnl Check default zlib install dir
769 if test -n "${need_dash_r}"; then
770 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
772 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
774 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
776 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
778 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
783 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
785 AC_ARG_WITH(zlib-version-check,
786 [ --without-zlib-version-check Disable zlib version check],
787 [ if test "x$withval" = "xno" ; then
788 zlib_check_nonfatal=1
793 AC_MSG_CHECKING(for possibly buggy zlib)
794 AC_RUN_IFELSE([AC_LANG_SOURCE([[
799 int a=0, b=0, c=0, d=0, n, v;
800 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
801 if (n != 3 && n != 4)
803 v = a*1000000 + b*10000 + c*100 + d;
804 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
807 if (a == 1 && b == 1 && c >= 4)
810 /* 1.2.3 and up are OK */
819 if test -z "$zlib_check_nonfatal" ; then
820 AC_MSG_ERROR([*** zlib too old - check config.log ***
821 Your reported zlib version has known security problems. It's possible your
822 vendor has fixed these problems without changing the version number. If you
823 are sure this is the case, you can disable the check by running
824 "./configure --without-zlib-version-check".
825 If you are in doubt, upgrade zlib to version 1.2.3 or greater.
826 See http://www.gzip.org/zlib/ for details.])
828 AC_MSG_WARN([zlib version may have security problems])
831 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
835 AC_CHECK_FUNC(strcasecmp,
836 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
838 AC_CHECK_FUNC(utimes,
839 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
840 LIBS="$LIBS -lc89"]) ]
843 dnl Checks for libutil functions
844 AC_CHECK_HEADERS(libutil.h)
845 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
846 AC_CHECK_FUNCS(logout updwtmp logwtmp)
850 # Check for ALTDIRFUNC glob() extension
851 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
852 AC_EGREP_CPP(FOUNDIT,
855 #ifdef GLOB_ALTDIRFUNC
860 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
868 # Check for g.gl_matchc glob() extension
869 AC_MSG_CHECKING(for gl_matchc field in glob_t)
870 AC_EGREP_CPP(FOUNDIT,
873 int main(void){glob_t g; g.gl_matchc = 1;}
876 AC_DEFINE(GLOB_HAS_GL_MATCHC)
884 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
887 #include <sys/types.h>
889 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
891 [AC_MSG_RESULT(yes)],
894 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
897 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
898 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
902 AC_MSG_CHECKING([for /proc/pid/fd directory])
903 if test -d "/proc/$$/fd" ; then
904 AC_DEFINE(HAVE_PROC_PID)
910 # Check whether user wants S/Key support
913 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
915 if test "x$withval" != "xno" ; then
917 if test "x$withval" != "xyes" ; then
918 CPPFLAGS="$CPPFLAGS -I${withval}/include"
919 LDFLAGS="$LDFLAGS -L${withval}/lib"
926 AC_MSG_CHECKING([for s/key support])
931 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
933 [AC_MSG_RESULT(yes)],
936 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
938 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
942 [(void)skeychallenge(NULL,"name","",0);],
944 AC_DEFINE(SKEYCHALLENGE_4ARG)],
951 # Check whether user wants TCP wrappers support
953 AC_ARG_WITH(tcp-wrappers,
954 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
956 if test "x$withval" != "xno" ; then
958 saved_LDFLAGS="$LDFLAGS"
959 saved_CPPFLAGS="$CPPFLAGS"
960 if test -n "${withval}" && \
961 test "x${withval}" != "xyes"; then
962 if test -d "${withval}/lib"; then
963 if test -n "${need_dash_r}"; then
964 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
966 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
969 if test -n "${need_dash_r}"; then
970 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
972 LDFLAGS="-L${withval} ${LDFLAGS}"
975 if test -d "${withval}/include"; then
976 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
978 CPPFLAGS="-I${withval} ${CPPFLAGS}"
982 LIBS="$LIBWRAP $LIBS"
983 AC_MSG_CHECKING(for libwrap)
986 #include <sys/types.h>
987 #include <sys/socket.h>
988 #include <netinet/in.h>
990 int deny_severity = 0, allow_severity = 0;
1000 AC_MSG_ERROR([*** libwrap missing])
1008 # Check whether user wants libedit support
1010 AC_ARG_WITH(libedit,
1011 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1012 [ if test "x$withval" != "xno" ; then
1013 if test "x$withval" != "xyes"; then
1014 CPPFLAGS="$CPPFLAGS -I$withval/include"
1015 LDFLAGS="$LDFLAGS -L$withval/lib"
1017 AC_CHECK_LIB(edit, el_init,
1018 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
1019 LIBEDIT="-ledit -lcurses"
1023 [ AC_MSG_ERROR(libedit not found) ],
1031 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1033 AC_MSG_CHECKING(for supported audit module)
1038 dnl Checks for headers, libs and functions
1039 AC_CHECK_HEADERS(bsm/audit.h, [],
1040 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1041 AC_CHECK_LIB(bsm, getaudit, [],
1042 [AC_MSG_ERROR(BSM enabled and required library not found)])
1043 AC_CHECK_FUNCS(getaudit, [],
1044 [AC_MSG_ERROR(BSM enabled and required function not found)])
1045 # These are optional
1046 AC_CHECK_FUNCS(getaudit_addr)
1047 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
1051 AC_MSG_RESULT(debug)
1052 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
1055 AC_MSG_ERROR([Unknown audit module $withval])
1060 dnl Checks for library functions. Please keep in alphabetical order
1145 # IRIX has a const char return value for gai_strerror()
1146 AC_CHECK_FUNCS(gai_strerror,[
1147 AC_DEFINE(HAVE_GAI_STRERROR)
1149 #include <sys/types.h>
1150 #include <sys/socket.h>
1153 const char *gai_strerror(int);],[
1156 str = gai_strerror(0);],[
1157 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1158 [Define if gai_strerror() returns const char *])])])
1160 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1162 dnl Make sure prototypes are defined for these before using them.
1163 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1164 AC_CHECK_DECL(strsep,
1165 [AC_CHECK_FUNCS(strsep)],
1168 #ifdef HAVE_STRING_H
1169 # include <string.h>
1173 dnl tcsendbreak might be a macro
1174 AC_CHECK_DECL(tcsendbreak,
1175 [AC_DEFINE(HAVE_TCSENDBREAK)],
1176 [AC_CHECK_FUNCS(tcsendbreak)],
1177 [#include <termios.h>]
1180 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1182 AC_CHECK_FUNCS(setresuid, [
1183 dnl Some platorms have setresuid that isn't implemented, test for this
1184 AC_MSG_CHECKING(if setresuid seems to work)
1189 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1191 [AC_MSG_RESULT(yes)],
1192 [AC_DEFINE(BROKEN_SETRESUID)
1193 AC_MSG_RESULT(not implemented)],
1194 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1198 AC_CHECK_FUNCS(setresgid, [
1199 dnl Some platorms have setresgid that isn't implemented, test for this
1200 AC_MSG_CHECKING(if setresgid seems to work)
1205 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1207 [AC_MSG_RESULT(yes)],
1208 [AC_DEFINE(BROKEN_SETRESGID)
1209 AC_MSG_RESULT(not implemented)],
1210 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1214 dnl Checks for time functions
1215 AC_CHECK_FUNCS(gettimeofday time)
1216 dnl Checks for utmp functions
1217 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1218 AC_CHECK_FUNCS(utmpname)
1219 dnl Checks for utmpx functions
1220 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1221 AC_CHECK_FUNCS(setutxent utmpxname)
1223 AC_CHECK_FUNC(daemon,
1224 [AC_DEFINE(HAVE_DAEMON)],
1225 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1228 AC_CHECK_FUNC(getpagesize,
1229 [AC_DEFINE(HAVE_GETPAGESIZE)],
1230 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1233 # Check for broken snprintf
1234 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1235 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1239 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1241 [AC_MSG_RESULT(yes)],
1244 AC_DEFINE(BROKEN_SNPRINTF)
1245 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1247 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1251 # Check for missing getpeereid (or equiv) support
1253 if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1254 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1256 [#include <sys/types.h>
1257 #include <sys/socket.h>],
1258 [int i = SO_PEERCRED;],
1259 [ AC_MSG_RESULT(yes)
1260 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1267 dnl see whether mkstemp() requires XXXXXX
1268 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1269 AC_MSG_CHECKING([for (overly) strict mkstemp])
1273 main() { char template[]="conftest.mkstemp-test";
1274 if (mkstemp(template) == -1)
1276 unlink(template); exit(0);
1284 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1288 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1293 dnl make sure that openpty does not reacquire controlling terminal
1294 if test ! -z "$check_for_openpty_ctty_bug"; then
1295 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1299 #include <sys/fcntl.h>
1300 #include <sys/types.h>
1301 #include <sys/wait.h>
1307 int fd, ptyfd, ttyfd, status;
1310 if (pid < 0) { /* failed */
1312 } else if (pid > 0) { /* parent */
1313 waitpid(pid, &status, 0);
1314 if (WIFEXITED(status))
1315 exit(WEXITSTATUS(status));
1318 } else { /* child */
1319 close(0); close(1); close(2);
1321 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1322 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1324 exit(3); /* Acquired ctty: broken */
1326 exit(0); /* Did not acquire ctty: OK */
1335 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1340 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1341 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1342 AC_MSG_CHECKING(if getaddrinfo seems to work)
1346 #include <sys/socket.h>
1349 #include <netinet/in.h>
1351 #define TEST_PORT "2222"
1357 struct addrinfo *gai_ai, *ai, hints;
1358 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1360 memset(&hints, 0, sizeof(hints));
1361 hints.ai_family = PF_UNSPEC;
1362 hints.ai_socktype = SOCK_STREAM;
1363 hints.ai_flags = AI_PASSIVE;
1365 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1367 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1371 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1372 if (ai->ai_family != AF_INET6)
1375 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1376 sizeof(ntop), strport, sizeof(strport),
1377 NI_NUMERICHOST|NI_NUMERICSERV);
1380 if (err == EAI_SYSTEM)
1381 perror("getnameinfo EAI_SYSTEM");
1383 fprintf(stderr, "getnameinfo failed: %s\n",
1388 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1391 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1404 AC_DEFINE(BROKEN_GETADDRINFO)
1409 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1410 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1411 AC_MSG_CHECKING(if getaddrinfo seems to work)
1415 #include <sys/socket.h>
1418 #include <netinet/in.h>
1420 #define TEST_PORT "2222"
1426 struct addrinfo *gai_ai, *ai, hints;
1427 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1429 memset(&hints, 0, sizeof(hints));
1430 hints.ai_family = PF_UNSPEC;
1431 hints.ai_socktype = SOCK_STREAM;
1432 hints.ai_flags = AI_PASSIVE;
1434 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1436 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1440 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1441 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1444 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1445 sizeof(ntop), strport, sizeof(strport),
1446 NI_NUMERICHOST|NI_NUMERICSERV);
1448 if (ai->ai_family == AF_INET && err != 0) {
1449 perror("getnameinfo");
1458 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1459 [Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1463 AC_DEFINE(BROKEN_GETADDRINFO)
1468 if test "x$check_for_conflicting_getspnam" = "x1"; then
1469 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1473 int main(void) {exit(0);}
1480 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1481 [Conflicting defs for getspnam])
1488 # Check for PAM libs
1491 [ --with-pam Enable PAM support ],
1493 if test "x$withval" != "xno" ; then
1494 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1495 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1496 AC_MSG_ERROR([PAM headers not found])
1499 AC_CHECK_LIB(dl, dlopen, , )
1500 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1501 AC_CHECK_FUNCS(pam_getenvlist)
1502 AC_CHECK_FUNCS(pam_putenv)
1507 if test $ac_cv_lib_dl_dlopen = yes; then
1517 # Check for older PAM
1518 if test "x$PAM_MSG" = "xyes" ; then
1519 # Check PAM strerror arguments (old PAM)
1520 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1524 #if defined(HAVE_SECURITY_PAM_APPL_H)
1525 #include <security/pam_appl.h>
1526 #elif defined (HAVE_PAM_PAM_APPL_H)
1527 #include <pam/pam_appl.h>
1530 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1531 [AC_MSG_RESULT(no)],
1533 AC_DEFINE(HAVE_OLD_PAM)
1535 PAM_MSG="yes (old library)"
1540 # Search for OpenSSL
1541 saved_CPPFLAGS="$CPPFLAGS"
1542 saved_LDFLAGS="$LDFLAGS"
1543 AC_ARG_WITH(ssl-dir,
1544 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1546 if test "x$withval" != "xno" ; then
1549 ./*|../*) withval="`pwd`/$withval"
1551 if test -d "$withval/lib"; then
1552 if test -n "${need_dash_r}"; then
1553 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1555 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1558 if test -n "${need_dash_r}"; then
1559 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1561 LDFLAGS="-L${withval} ${LDFLAGS}"
1564 if test -d "$withval/include"; then
1565 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1567 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1572 LIBS="-lcrypto $LIBS"
1573 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1575 dnl Check default openssl install dir
1576 if test -n "${need_dash_r}"; then
1577 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1579 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1581 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1582 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1584 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1590 # Determine OpenSSL header version
1591 AC_MSG_CHECKING([OpenSSL header version])
1596 #include <openssl/opensslv.h>
1597 #define DATA "conftest.sslincver"
1602 fd = fopen(DATA,"w");
1606 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1613 ssl_header_ver=`cat conftest.sslincver`
1614 AC_MSG_RESULT($ssl_header_ver)
1617 AC_MSG_RESULT(not found)
1618 AC_MSG_ERROR(OpenSSL version header not found.)
1621 AC_MSG_WARN([cross compiling: not checking])
1625 # Determine OpenSSL library version
1626 AC_MSG_CHECKING([OpenSSL library version])
1631 #include <openssl/opensslv.h>
1632 #include <openssl/crypto.h>
1633 #define DATA "conftest.ssllibver"
1638 fd = fopen(DATA,"w");
1642 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1649 ssl_library_ver=`cat conftest.ssllibver`
1650 AC_MSG_RESULT($ssl_library_ver)
1653 AC_MSG_RESULT(not found)
1654 AC_MSG_ERROR(OpenSSL library not found.)
1657 AC_MSG_WARN([cross compiling: not checking])
1661 # Sanity check OpenSSL headers
1662 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1666 #include <openssl/opensslv.h>
1667 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1674 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1675 Check config.log for details.
1676 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1679 AC_MSG_WARN([cross compiling: not checking])
1683 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1684 # because the system crypt() is more featureful.
1685 if test "x$check_for_libcrypt_before" = "x1"; then
1686 AC_CHECK_LIB(crypt, crypt)
1689 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1690 # version in OpenSSL.
1691 if test "x$check_for_libcrypt_later" = "x1"; then
1692 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1696 ### Configure cryptographic random number support
1698 # Check wheter OpenSSL seeds itself
1699 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1703 #include <openssl/rand.h>
1704 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1707 OPENSSL_SEEDS_ITSELF=yes
1712 # Default to use of the rand helper if OpenSSL doesn't
1717 AC_MSG_WARN([cross compiling: assuming yes])
1718 # This is safe, since all recent OpenSSL versions will
1719 # complain at runtime if not seeded correctly.
1720 OPENSSL_SEEDS_ITSELF=yes
1725 # Do we want to force the use of the rand helper?
1726 AC_ARG_WITH(rand-helper,
1727 [ --with-rand-helper Use subprocess to gather strong randomness ],
1729 if test "x$withval" = "xno" ; then
1730 # Force use of OpenSSL's internal RNG, even if
1731 # the previous test showed it to be unseeded.
1732 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1733 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1734 OPENSSL_SEEDS_ITSELF=yes
1743 # Which randomness source do we use?
1744 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
1746 AC_DEFINE(OPENSSL_PRNG_ONLY)
1747 RAND_MSG="OpenSSL internal ONLY"
1748 INSTALL_SSH_RAND_HELPER=""
1749 elif test ! -z "$USE_RAND_HELPER" ; then
1750 # install rand helper
1751 RAND_MSG="ssh-rand-helper"
1752 INSTALL_SSH_RAND_HELPER="yes"
1754 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1756 ### Configuration of ssh-rand-helper
1759 AC_ARG_WITH(prngd-port,
1760 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1769 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1772 if test ! -z "$withval" ; then
1773 PRNGD_PORT="$withval"
1774 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1779 # PRNGD Unix domain socket
1780 AC_ARG_WITH(prngd-socket,
1781 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1785 withval="/var/run/egd-pool"
1793 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1797 if test ! -z "$withval" ; then
1798 if test ! -z "$PRNGD_PORT" ; then
1799 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1801 if test ! -r "$withval" ; then
1802 AC_MSG_WARN(Entropy socket is not readable)
1804 PRNGD_SOCKET="$withval"
1805 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1809 # Check for existing socket only if we don't have a random device already
1810 if test "$USE_RAND_HELPER" = yes ; then
1811 AC_MSG_CHECKING(for PRNGD/EGD socket)
1812 # Insert other locations here
1813 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1814 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1815 PRNGD_SOCKET="$sock"
1816 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1820 if test ! -z "$PRNGD_SOCKET" ; then
1821 AC_MSG_RESULT($PRNGD_SOCKET)
1823 AC_MSG_RESULT(not found)
1829 # Change default command timeout for hashing entropy source
1831 AC_ARG_WITH(entropy-timeout,
1832 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1834 if test -n "$withval" && test "x$withval" != "xno" && \
1835 test "x${withval}" != "xyes"; then
1836 entropy_timeout=$withval
1840 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1842 SSH_PRIVSEP_USER=sshd
1843 AC_ARG_WITH(privsep-user,
1844 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1846 if test -n "$withval" && test "x$withval" != "xno" && \
1847 test "x${withval}" != "xyes"; then
1848 SSH_PRIVSEP_USER=$withval
1852 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1853 AC_SUBST(SSH_PRIVSEP_USER)
1855 # We do this little dance with the search path to insure
1856 # that programs that we select for use by installed programs
1857 # (which may be run by the super-user) come from trusted
1858 # locations before they come from the user's private area.
1859 # This should help avoid accidentally configuring some
1860 # random version of a program in someone's personal bin.
1864 test -h /bin 2> /dev/null && PATH=/usr/bin
1865 test -d /sbin && PATH=$PATH:/sbin
1866 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1867 PATH=$PATH:/etc:$OPATH
1869 # These programs are used by the command hashing source to gather entropy
1870 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1871 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1872 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1873 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1874 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1875 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1876 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1877 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1878 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1879 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1880 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1881 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1882 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1883 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1884 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1885 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1889 # Where does ssh-rand-helper get its randomness from?
1890 INSTALL_SSH_PRNG_CMDS=""
1891 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1892 if test ! -z "$PRNGD_PORT" ; then
1893 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1894 elif test ! -z "$PRNGD_SOCKET" ; then
1895 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1897 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1898 RAND_HELPER_CMDHASH=yes
1899 INSTALL_SSH_PRNG_CMDS="yes"
1902 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1905 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1906 if test ! -z "$SONY" ; then
1907 LIBS="$LIBS -liberty";
1910 # Checks for data types
1911 AC_CHECK_SIZEOF(char, 1)
1912 AC_CHECK_SIZEOF(short int, 2)
1913 AC_CHECK_SIZEOF(int, 4)
1914 AC_CHECK_SIZEOF(long int, 4)
1915 AC_CHECK_SIZEOF(long long int, 8)
1917 # Sanity check long long for some platforms (AIX)
1918 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1919 ac_cv_sizeof_long_long_int=0
1922 # More checks for data types
1923 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1925 [ #include <sys/types.h> ],
1927 [ ac_cv_have_u_int="yes" ],
1928 [ ac_cv_have_u_int="no" ]
1931 if test "x$ac_cv_have_u_int" = "xyes" ; then
1932 AC_DEFINE(HAVE_U_INT)
1936 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1938 [ #include <sys/types.h> ],
1939 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1940 [ ac_cv_have_intxx_t="yes" ],
1941 [ ac_cv_have_intxx_t="no" ]
1944 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1945 AC_DEFINE(HAVE_INTXX_T)
1949 if (test -z "$have_intxx_t" && \
1950 test "x$ac_cv_header_stdint_h" = "xyes")
1952 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1954 [ #include <stdint.h> ],
1955 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1957 AC_DEFINE(HAVE_INTXX_T)
1960 [ AC_MSG_RESULT(no) ]
1964 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1967 #include <sys/types.h>
1968 #ifdef HAVE_STDINT_H
1969 # include <stdint.h>
1971 #include <sys/socket.h>
1972 #ifdef HAVE_SYS_BITYPES_H
1973 # include <sys/bitypes.h>
1976 [ int64_t a; a = 1;],
1977 [ ac_cv_have_int64_t="yes" ],
1978 [ ac_cv_have_int64_t="no" ]
1981 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1982 AC_DEFINE(HAVE_INT64_T)
1985 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1987 [ #include <sys/types.h> ],
1988 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1989 [ ac_cv_have_u_intxx_t="yes" ],
1990 [ ac_cv_have_u_intxx_t="no" ]
1993 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1994 AC_DEFINE(HAVE_U_INTXX_T)
1998 if test -z "$have_u_intxx_t" ; then
1999 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2001 [ #include <sys/socket.h> ],
2002 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2004 AC_DEFINE(HAVE_U_INTXX_T)
2007 [ AC_MSG_RESULT(no) ]
2011 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2013 [ #include <sys/types.h> ],
2014 [ u_int64_t a; a = 1;],
2015 [ ac_cv_have_u_int64_t="yes" ],
2016 [ ac_cv_have_u_int64_t="no" ]
2019 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2020 AC_DEFINE(HAVE_U_INT64_T)
2024 if test -z "$have_u_int64_t" ; then
2025 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2027 [ #include <sys/bitypes.h> ],
2028 [ u_int64_t a; a = 1],
2030 AC_DEFINE(HAVE_U_INT64_T)
2033 [ AC_MSG_RESULT(no) ]
2037 if test -z "$have_u_intxx_t" ; then
2038 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2041 #include <sys/types.h>
2043 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2044 [ ac_cv_have_uintxx_t="yes" ],
2045 [ ac_cv_have_uintxx_t="no" ]
2048 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2049 AC_DEFINE(HAVE_UINTXX_T)
2053 if test -z "$have_uintxx_t" ; then
2054 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2056 [ #include <stdint.h> ],
2057 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2059 AC_DEFINE(HAVE_UINTXX_T)
2062 [ AC_MSG_RESULT(no) ]
2066 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2067 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2069 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2072 #include <sys/bitypes.h>
2075 int8_t a; int16_t b; int32_t c;
2076 u_int8_t e; u_int16_t f; u_int32_t g;
2077 a = b = c = e = f = g = 1;
2080 AC_DEFINE(HAVE_U_INTXX_T)
2081 AC_DEFINE(HAVE_INTXX_T)
2089 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2092 #include <sys/types.h>
2094 [ u_char foo; foo = 125; ],
2095 [ ac_cv_have_u_char="yes" ],
2096 [ ac_cv_have_u_char="no" ]
2099 if test "x$ac_cv_have_u_char" = "xyes" ; then
2100 AC_DEFINE(HAVE_U_CHAR)
2105 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2107 AC_CHECK_TYPES(in_addr_t,,,
2108 [#include <sys/types.h>
2109 #include <netinet/in.h>])
2111 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2114 #include <sys/types.h>
2116 [ size_t foo; foo = 1235; ],
2117 [ ac_cv_have_size_t="yes" ],
2118 [ ac_cv_have_size_t="no" ]
2121 if test "x$ac_cv_have_size_t" = "xyes" ; then
2122 AC_DEFINE(HAVE_SIZE_T)
2125 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2128 #include <sys/types.h>
2130 [ ssize_t foo; foo = 1235; ],
2131 [ ac_cv_have_ssize_t="yes" ],
2132 [ ac_cv_have_ssize_t="no" ]
2135 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2136 AC_DEFINE(HAVE_SSIZE_T)
2139 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2144 [ clock_t foo; foo = 1235; ],
2145 [ ac_cv_have_clock_t="yes" ],
2146 [ ac_cv_have_clock_t="no" ]
2149 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2150 AC_DEFINE(HAVE_CLOCK_T)
2153 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2156 #include <sys/types.h>
2157 #include <sys/socket.h>
2159 [ sa_family_t foo; foo = 1235; ],
2160 [ ac_cv_have_sa_family_t="yes" ],
2163 #include <sys/types.h>
2164 #include <sys/socket.h>
2165 #include <netinet/in.h>
2167 [ sa_family_t foo; foo = 1235; ],
2168 [ ac_cv_have_sa_family_t="yes" ],
2170 [ ac_cv_have_sa_family_t="no" ]
2174 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2175 AC_DEFINE(HAVE_SA_FAMILY_T)
2178 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2181 #include <sys/types.h>
2183 [ pid_t foo; foo = 1235; ],
2184 [ ac_cv_have_pid_t="yes" ],
2185 [ ac_cv_have_pid_t="no" ]
2188 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2189 AC_DEFINE(HAVE_PID_T)
2192 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2195 #include <sys/types.h>
2197 [ mode_t foo; foo = 1235; ],
2198 [ ac_cv_have_mode_t="yes" ],
2199 [ ac_cv_have_mode_t="no" ]
2202 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2203 AC_DEFINE(HAVE_MODE_T)
2207 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2210 #include <sys/types.h>
2211 #include <sys/socket.h>
2213 [ struct sockaddr_storage s; ],
2214 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2215 [ ac_cv_have_struct_sockaddr_storage="no" ]
2218 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2219 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2222 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2225 #include <sys/types.h>
2226 #include <netinet/in.h>
2228 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2229 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2230 [ ac_cv_have_struct_sockaddr_in6="no" ]
2233 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2234 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2237 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2240 #include <sys/types.h>
2241 #include <netinet/in.h>
2243 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2244 [ ac_cv_have_struct_in6_addr="yes" ],
2245 [ ac_cv_have_struct_in6_addr="no" ]
2248 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2249 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2252 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2255 #include <sys/types.h>
2256 #include <sys/socket.h>
2259 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2260 [ ac_cv_have_struct_addrinfo="yes" ],
2261 [ ac_cv_have_struct_addrinfo="no" ]
2264 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2265 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2268 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2270 [ #include <sys/time.h> ],
2271 [ struct timeval tv; tv.tv_sec = 1;],
2272 [ ac_cv_have_struct_timeval="yes" ],
2273 [ ac_cv_have_struct_timeval="no" ]
2276 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2277 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2278 have_struct_timeval=1
2281 AC_CHECK_TYPES(struct timespec)
2283 # We need int64_t or else certian parts of the compile will fail.
2284 if test "x$ac_cv_have_int64_t" = "xno" && \
2285 test "x$ac_cv_sizeof_long_int" != "x8" && \
2286 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2287 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2288 echo "an alternative compiler (I.E., GCC) before continuing."
2292 dnl test snprintf (broken on SCO w/gcc)
2297 #ifdef HAVE_SNPRINTF
2301 char expected_out[50];
2303 #if (SIZEOF_LONG_INT == 8)
2304 long int num = 0x7fffffffffffffff;
2306 long long num = 0x7fffffffffffffffll;
2308 strcpy(expected_out, "9223372036854775807");
2309 snprintf(buf, mazsize, "%lld", num);
2310 if(strcmp(buf, expected_out) != 0)
2317 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2318 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2322 dnl Checks for structure members
2323 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2324 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2325 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2326 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2327 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2328 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2329 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2330 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2331 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2332 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2333 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2334 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2335 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2336 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2337 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2338 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2339 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2341 AC_CHECK_MEMBERS([struct stat.st_blksize])
2343 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2344 ac_cv_have_ss_family_in_struct_ss, [
2347 #include <sys/types.h>
2348 #include <sys/socket.h>
2350 [ struct sockaddr_storage s; s.ss_family = 1; ],
2351 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2352 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2355 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2356 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2359 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2360 ac_cv_have___ss_family_in_struct_ss, [
2363 #include <sys/types.h>
2364 #include <sys/socket.h>
2366 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2367 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2368 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2371 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2372 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2375 AC_CACHE_CHECK([for pw_class field in struct passwd],
2376 ac_cv_have_pw_class_in_struct_passwd, [
2381 [ struct passwd p; p.pw_class = 0; ],
2382 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2383 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2386 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2387 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2390 AC_CACHE_CHECK([for pw_expire field in struct passwd],
2391 ac_cv_have_pw_expire_in_struct_passwd, [
2396 [ struct passwd p; p.pw_expire = 0; ],
2397 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2398 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2401 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2402 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2405 AC_CACHE_CHECK([for pw_change field in struct passwd],
2406 ac_cv_have_pw_change_in_struct_passwd, [
2411 [ struct passwd p; p.pw_change = 0; ],
2412 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2413 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2416 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2417 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2420 dnl make sure we're using the real structure members and not defines
2421 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2422 ac_cv_have_accrights_in_msghdr, [
2425 #include <sys/types.h>
2426 #include <sys/socket.h>
2427 #include <sys/uio.h>
2429 #ifdef msg_accrights
2430 #error "msg_accrights is a macro"
2434 m.msg_accrights = 0;
2438 [ ac_cv_have_accrights_in_msghdr="yes" ],
2439 [ ac_cv_have_accrights_in_msghdr="no" ]
2442 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2443 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2446 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2447 ac_cv_have_control_in_msghdr, [
2450 #include <sys/types.h>
2451 #include <sys/socket.h>
2452 #include <sys/uio.h>
2455 #error "msg_control is a macro"
2463 [ ac_cv_have_control_in_msghdr="yes" ],
2464 [ ac_cv_have_control_in_msghdr="no" ]
2467 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2468 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2471 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2473 [ extern char *__progname; printf("%s", __progname); ],
2474 [ ac_cv_libc_defines___progname="yes" ],
2475 [ ac_cv_libc_defines___progname="no" ]
2478 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2479 AC_DEFINE(HAVE___PROGNAME)
2482 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2486 [ printf("%s", __FUNCTION__); ],
2487 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2488 [ ac_cv_cc_implements___FUNCTION__="no" ]
2491 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2492 AC_DEFINE(HAVE___FUNCTION__)
2495 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2499 [ printf("%s", __func__); ],
2500 [ ac_cv_cc_implements___func__="yes" ],
2501 [ ac_cv_cc_implements___func__="no" ]
2504 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2505 AC_DEFINE(HAVE___func__)
2508 AC_CACHE_CHECK([whether getopt has optreset support],
2509 ac_cv_have_getopt_optreset, [
2514 [ extern int optreset; optreset = 0; ],
2515 [ ac_cv_have_getopt_optreset="yes" ],
2516 [ ac_cv_have_getopt_optreset="no" ]
2519 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2520 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2523 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2525 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2526 [ ac_cv_libc_defines_sys_errlist="yes" ],
2527 [ ac_cv_libc_defines_sys_errlist="no" ]
2530 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2531 AC_DEFINE(HAVE_SYS_ERRLIST)
2535 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2537 [ extern int sys_nerr; printf("%i", sys_nerr);],
2538 [ ac_cv_libc_defines_sys_nerr="yes" ],
2539 [ ac_cv_libc_defines_sys_nerr="no" ]
2542 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2543 AC_DEFINE(HAVE_SYS_NERR)
2547 # Check whether user wants sectok support
2549 [ --with-sectok Enable smartcard support using libsectok],
2551 if test "x$withval" != "xno" ; then
2552 if test "x$withval" != "xyes" ; then
2553 CPPFLAGS="$CPPFLAGS -I${withval}"
2554 LDFLAGS="$LDFLAGS -L${withval}"
2555 if test ! -z "$need_dash_r" ; then
2556 LDFLAGS="$LDFLAGS -R${withval}"
2558 if test ! -z "$blibpath" ; then
2559 blibpath="$blibpath:${withval}"
2562 AC_CHECK_HEADERS(sectok.h)
2563 if test "$ac_cv_header_sectok_h" != yes; then
2564 AC_MSG_ERROR(Can't find sectok.h)
2566 AC_CHECK_LIB(sectok, sectok_open)
2567 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2568 AC_MSG_ERROR(Can't find libsectok)
2570 AC_DEFINE(SMARTCARD)
2571 AC_DEFINE(USE_SECTOK)
2572 SCARD_MSG="yes, using sectok"
2577 # Check whether user wants OpenSC support
2580 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2582 if test "x$withval" != "xno" ; then
2583 if test "x$withval" != "xyes" ; then
2584 OPENSC_CONFIG=$withval/bin/opensc-config
2586 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2588 if test "$OPENSC_CONFIG" != "no"; then
2589 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2590 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2591 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2592 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2593 AC_DEFINE(SMARTCARD)
2594 AC_DEFINE(USE_OPENSC)
2595 SCARD_MSG="yes, using OpenSC"
2601 # Check libraries needed by DNS fingerprint support
2602 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2603 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
2605 # Needed by our getrrsetbyname()
2606 AC_SEARCH_LIBS(res_query, resolv)
2607 AC_SEARCH_LIBS(dn_expand, resolv)
2608 AC_MSG_CHECKING(if res_query will link)
2609 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2612 LIBS="$LIBS -lresolv"
2613 AC_MSG_CHECKING(for res_query in -lresolv)
2618 res_query (0, 0, 0, 0, 0);
2622 [LIBS="$LIBS -lresolv"
2623 AC_MSG_RESULT(yes)],
2627 AC_CHECK_FUNCS(_getshort _getlong)
2628 AC_CHECK_DECLS([_getshort, _getlong], , ,
2629 [#include <sys/types.h>
2630 #include <arpa/nameser.h>])
2631 AC_CHECK_MEMBER(HEADER.ad,
2632 [AC_DEFINE(HAVE_HEADER_AD)],,
2633 [#include <arpa/nameser.h>])
2636 # Check whether user wants Kerberos 5 support
2638 AC_ARG_WITH(kerberos5,
2639 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2640 [ if test "x$withval" != "xno" ; then
2641 if test "x$withval" = "xyes" ; then
2642 KRB5ROOT="/usr/local"
2650 AC_MSG_CHECKING(for krb5-config)
2651 if test -x $KRB5ROOT/bin/krb5-config ; then
2652 KRB5CONF=$KRB5ROOT/bin/krb5-config
2653 AC_MSG_RESULT($KRB5CONF)
2655 AC_MSG_CHECKING(for gssapi support)
2656 if $KRB5CONF | grep gssapi >/dev/null ; then
2664 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2665 K5LIBS="`$KRB5CONF --libs $k5confopts`"
2666 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2667 AC_MSG_CHECKING(whether we are using Heimdal)
2668 AC_TRY_COMPILE([ #include <krb5.h> ],
2669 [ char *tmp = heimdal_version; ],
2670 [ AC_MSG_RESULT(yes)
2671 AC_DEFINE(HEIMDAL) ],
2676 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2677 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2678 AC_MSG_CHECKING(whether we are using Heimdal)
2679 AC_TRY_COMPILE([ #include <krb5.h> ],
2680 [ char *tmp = heimdal_version; ],
2681 [ AC_MSG_RESULT(yes)
2683 K5LIBS="-lkrb5 -ldes"
2684 K5LIBS="$K5LIBS -lcom_err -lasn1"
2685 AC_CHECK_LIB(roken, net_write,
2686 [K5LIBS="$K5LIBS -lroken"])
2689 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2692 AC_SEARCH_LIBS(dn_expand, resolv)
2694 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2696 K5LIBS="-lgssapi $K5LIBS" ],
2697 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2699 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2700 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2705 AC_CHECK_HEADER(gssapi.h, ,
2706 [ unset ac_cv_header_gssapi_h
2707 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2708 AC_CHECK_HEADERS(gssapi.h, ,
2709 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2715 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2716 AC_CHECK_HEADER(gssapi_krb5.h, ,
2717 [ CPPFLAGS="$oldCPP" ])
2720 if test ! -z "$need_dash_r" ; then
2721 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2723 if test ! -z "$blibpath" ; then
2724 blibpath="$blibpath:${KRB5ROOT}/lib"
2728 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2729 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2730 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2732 LIBS="$LIBS $K5LIBS"
2733 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2737 # Looking for programs, paths and files
2739 PRIVSEP_PATH=/var/empty
2740 AC_ARG_WITH(privsep-path,
2741 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2743 if test -n "$withval" && test "x$withval" != "xno" && \
2744 test "x${withval}" != "xyes"; then
2745 PRIVSEP_PATH=$withval
2749 AC_SUBST(PRIVSEP_PATH)
2752 [ --with-xauth=PATH Specify path to xauth program ],
2754 if test -n "$withval" && test "x$withval" != "xno" && \
2755 test "x${withval}" != "xyes"; then
2761 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2762 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2763 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2764 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2765 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2766 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2767 xauth_path="/usr/openwin/bin/xauth"
2773 AC_ARG_ENABLE(strip,
2774 [ --disable-strip Disable calling strip(1) on install],
2776 if test "x$enableval" = "xno" ; then
2783 if test -z "$xauth_path" ; then
2784 XAUTH_PATH="undefined"
2785 AC_SUBST(XAUTH_PATH)
2787 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2788 XAUTH_PATH=$xauth_path
2789 AC_SUBST(XAUTH_PATH)
2792 # Check for mail directory (last resort if we cannot get it from headers)
2793 if test ! -z "$MAIL" ; then
2794 maildir=`dirname $MAIL`
2795 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2798 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
2799 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2800 disable_ptmx_check=yes
2802 if test -z "$no_dev_ptmx" ; then
2803 if test "x$disable_ptmx_check" != "xyes" ; then
2804 AC_CHECK_FILE("/dev/ptmx",
2806 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2813 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
2814 AC_CHECK_FILE("/dev/ptc",
2816 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2821 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2824 # Options from here on. Some of these are preset by platform above
2825 AC_ARG_WITH(mantype,
2826 [ --with-mantype=man|cat|doc Set man page type],
2833 AC_MSG_ERROR(invalid man type: $withval)
2838 if test -z "$MANTYPE"; then
2839 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2840 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2841 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2843 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2850 if test "$MANTYPE" = "doc"; then
2857 # Check whether to enable MD5 passwords
2859 AC_ARG_WITH(md5-passwords,
2860 [ --with-md5-passwords Enable use of MD5 passwords],
2862 if test "x$withval" != "xno" ; then
2863 AC_DEFINE(HAVE_MD5_PASSWORDS)
2869 # Whether to disable shadow password support
2871 [ --without-shadow Disable shadow password support],
2873 if test "x$withval" = "xno" ; then
2874 AC_DEFINE(DISABLE_SHADOW)
2880 if test -z "$disable_shadow" ; then
2881 AC_MSG_CHECKING([if the systems has expire shadow information])
2884 #include <sys/types.h>
2887 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2888 [ sp_expire_available=yes ], []
2891 if test "x$sp_expire_available" = "xyes" ; then
2893 AC_DEFINE(HAS_SHADOW_EXPIRE)
2899 # Use ip address instead of hostname in $DISPLAY
2900 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2901 DISPLAY_HACK_MSG="yes"
2902 AC_DEFINE(IPADDR_IN_DISPLAY)
2904 DISPLAY_HACK_MSG="no"
2905 AC_ARG_WITH(ipaddr-display,
2906 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2908 if test "x$withval" != "xno" ; then
2909 AC_DEFINE(IPADDR_IN_DISPLAY)
2910 DISPLAY_HACK_MSG="yes"
2916 # check for /etc/default/login and use it if present.
2917 AC_ARG_ENABLE(etc-default-login,
2918 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
2919 [ if test "x$enableval" = "xno"; then
2920 AC_MSG_NOTICE([/etc/default/login handling disabled])
2921 etc_default_login=no
2923 etc_default_login=yes
2925 [ etc_default_login=yes ]
2928 if test "x$etc_default_login" != "xno"; then
2929 AC_CHECK_FILE("/etc/default/login",
2930 [ external_path_file=/etc/default/login ])
2931 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2933 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2934 elif test "x$external_path_file" = "x/etc/default/login"; then
2935 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2939 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2940 if test $ac_cv_func_login_getcapbool = "yes" && \
2941 test $ac_cv_header_login_cap_h = "yes" ; then
2942 external_path_file=/etc/login.conf
2945 # Whether to mess with the default path
2946 SERVER_PATH_MSG="(default)"
2947 AC_ARG_WITH(default-path,
2948 [ --with-default-path= Specify default \$PATH environment for server],
2950 if test "x$external_path_file" = "x/etc/login.conf" ; then
2952 --with-default-path=PATH has no effect on this system.
2953 Edit /etc/login.conf instead.])
2954 elif test "x$withval" != "xno" ; then
2955 if test ! -z "$external_path_file" ; then
2957 --with-default-path=PATH will only be used if PATH is not defined in
2958 $external_path_file .])
2960 user_path="$withval"
2961 SERVER_PATH_MSG="$withval"
2964 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2965 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2967 if test ! -z "$external_path_file" ; then
2969 If PATH is defined in $external_path_file, ensure the path to scp is included,
2970 otherwise scp will not work.])
2974 /* find out what STDPATH is */
2979 #ifndef _PATH_STDPATH
2980 # ifdef _PATH_USERPATH /* Irix */
2981 # define _PATH_STDPATH _PATH_USERPATH
2983 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2986 #include <sys/types.h>
2987 #include <sys/stat.h>
2989 #define DATA "conftest.stdpath"
2996 fd = fopen(DATA,"w");
3000 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3005 ], [ user_path=`cat conftest.stdpath` ],
3006 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3007 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3009 # make sure $bindir is in USER_PATH so scp will work
3010 t_bindir=`eval echo ${bindir}`
3012 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3015 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3017 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3018 if test $? -ne 0 ; then
3019 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3020 if test $? -ne 0 ; then
3021 user_path=$user_path:$t_bindir
3022 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3027 if test "x$external_path_file" != "x/etc/login.conf" ; then
3028 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
3032 # Set superuser path separately to user path
3033 AC_ARG_WITH(superuser-path,
3034 [ --with-superuser-path= Specify different path for super-user],
3036 if test -n "$withval" && test "x$withval" != "xno" && \
3037 test "x${withval}" != "xyes"; then
3038 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
3039 superuser_path=$withval
3045 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3046 IPV4_IN6_HACK_MSG="no"
3048 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3050 if test "x$withval" != "xno" ; then
3052 AC_DEFINE(IPV4_IN_IPV6)
3053 IPV4_IN6_HACK_MSG="yes"
3058 if test "x$inet6_default_4in6" = "xyes"; then
3059 AC_MSG_RESULT([yes (default)])
3060 AC_DEFINE(IPV4_IN_IPV6)
3061 IPV4_IN6_HACK_MSG="yes"
3063 AC_MSG_RESULT([no (default)])
3068 # Whether to enable BSD auth support
3070 AC_ARG_WITH(bsd-auth,
3071 [ --with-bsd-auth Enable BSD auth support],
3073 if test "x$withval" != "xno" ; then
3080 # Where to place sshd.pid
3082 # make sure the directory exists
3083 if test ! -d $piddir ; then
3084 piddir=`eval echo ${sysconfdir}`
3086 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3090 AC_ARG_WITH(pid-dir,
3091 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3093 if test -n "$withval" && test "x$withval" != "xno" && \
3094 test "x${withval}" != "xyes"; then
3096 if test ! -d $piddir ; then
3097 AC_MSG_WARN([** no $piddir directory on this system **])
3103 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
3106 dnl allow user to disable some login recording features
3107 AC_ARG_ENABLE(lastlog,
3108 [ --disable-lastlog disable use of lastlog even if detected [no]],
3110 if test "x$enableval" = "xno" ; then
3111 AC_DEFINE(DISABLE_LASTLOG)
3116 [ --disable-utmp disable use of utmp even if detected [no]],
3118 if test "x$enableval" = "xno" ; then
3119 AC_DEFINE(DISABLE_UTMP)
3123 AC_ARG_ENABLE(utmpx,
3124 [ --disable-utmpx disable use of utmpx even if detected [no]],
3126 if test "x$enableval" = "xno" ; then
3127 AC_DEFINE(DISABLE_UTMPX)
3132 [ --disable-wtmp disable use of wtmp even if detected [no]],
3134 if test "x$enableval" = "xno" ; then
3135 AC_DEFINE(DISABLE_WTMP)
3139 AC_ARG_ENABLE(wtmpx,
3140 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
3142 if test "x$enableval" = "xno" ; then
3143 AC_DEFINE(DISABLE_WTMPX)
3147 AC_ARG_ENABLE(libutil,
3148 [ --disable-libutil disable use of libutil (login() etc.) [no]],
3150 if test "x$enableval" = "xno" ; then
3151 AC_DEFINE(DISABLE_LOGIN)
3155 AC_ARG_ENABLE(pututline,
3156 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
3158 if test "x$enableval" = "xno" ; then
3159 AC_DEFINE(DISABLE_PUTUTLINE)
3163 AC_ARG_ENABLE(pututxline,
3164 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
3166 if test "x$enableval" = "xno" ; then
3167 AC_DEFINE(DISABLE_PUTUTXLINE)
3171 AC_ARG_WITH(lastlog,
3172 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
3174 if test "x$withval" = "xno" ; then
3175 AC_DEFINE(DISABLE_LASTLOG)
3176 elif test -n "$withval" && test "x${withval}" != "xyes"; then
3177 conf_lastlog_location=$withval
3182 dnl lastlog, [uw]tmpx? detection
3183 dnl NOTE: set the paths in the platform section to avoid the
3184 dnl need for command-line parameters
3185 dnl lastlog and [uw]tmp are subject to a file search if all else fails
3187 dnl lastlog detection
3188 dnl NOTE: the code itself will detect if lastlog is a directory
3189 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3191 #include <sys/types.h>
3193 #ifdef HAVE_LASTLOG_H
3194 # include <lastlog.h>
3203 [ char *lastlog = LASTLOG_FILE; ],
3204 [ AC_MSG_RESULT(yes) ],
3207 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3209 #include <sys/types.h>
3211 #ifdef HAVE_LASTLOG_H
3212 # include <lastlog.h>
3218 [ char *lastlog = _PATH_LASTLOG; ],
3219 [ AC_MSG_RESULT(yes) ],
3222 system_lastlog_path=no
3227 if test -z "$conf_lastlog_location"; then
3228 if test x"$system_lastlog_path" = x"no" ; then
3229 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3230 if (test -d "$f" || test -f "$f") ; then
3231 conf_lastlog_location=$f
3234 if test -z "$conf_lastlog_location"; then
3235 AC_MSG_WARN([** Cannot find lastlog **])
3236 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
3241 if test -n "$conf_lastlog_location"; then
3242 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
3246 AC_MSG_CHECKING([if your system defines UTMP_FILE])
3248 #include <sys/types.h>
3254 [ char *utmp = UTMP_FILE; ],
3255 [ AC_MSG_RESULT(yes) ],
3257 system_utmp_path=no ]
3259 if test -z "$conf_utmp_location"; then
3260 if test x"$system_utmp_path" = x"no" ; then
3261 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3262 if test -f $f ; then
3263 conf_utmp_location=$f
3266 if test -z "$conf_utmp_location"; then
3267 AC_DEFINE(DISABLE_UTMP)
3271 if test -n "$conf_utmp_location"; then
3272 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
3276 AC_MSG_CHECKING([if your system defines WTMP_FILE])
3278 #include <sys/types.h>
3284 [ char *wtmp = WTMP_FILE; ],
3285 [ AC_MSG_RESULT(yes) ],
3287 system_wtmp_path=no ]
3289 if test -z "$conf_wtmp_location"; then
3290 if test x"$system_wtmp_path" = x"no" ; then
3291 for f in /usr/adm/wtmp /var/log/wtmp; do
3292 if test -f $f ; then
3293 conf_wtmp_location=$f
3296 if test -z "$conf_wtmp_location"; then
3297 AC_DEFINE(DISABLE_WTMP)
3301 if test -n "$conf_wtmp_location"; then
3302 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
3306 dnl utmpx detection - I don't know any system so perverse as to require
3307 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3309 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3311 #include <sys/types.h>
3320 [ char *utmpx = UTMPX_FILE; ],
3321 [ AC_MSG_RESULT(yes) ],
3323 system_utmpx_path=no ]
3325 if test -z "$conf_utmpx_location"; then
3326 if test x"$system_utmpx_path" = x"no" ; then
3327 AC_DEFINE(DISABLE_UTMPX)
3330 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
3334 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3336 #include <sys/types.h>
3345 [ char *wtmpx = WTMPX_FILE; ],
3346 [ AC_MSG_RESULT(yes) ],
3348 system_wtmpx_path=no ]
3350 if test -z "$conf_wtmpx_location"; then
3351 if test x"$system_wtmpx_path" = x"no" ; then
3352 AC_DEFINE(DISABLE_WTMPX)
3355 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
3359 if test ! -z "$blibpath" ; then
3360 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3361 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3364 dnl remove pam and dl because they are in $LIBPAM
3365 if test "$PAM_MSG" = yes ; then
3366 LIBS=`echo $LIBS | sed 's/-lpam //'`
3368 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3369 LIBS=`echo $LIBS | sed 's/-ldl //'`
3372 dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3374 CFLAGS="$CFLAGS $werror_flags"
3377 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3378 scard/Makefile ssh_prng_cmds survey.sh])
3381 # Print summary of options
3383 # Someone please show me a better way :)
3384 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3385 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3386 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3387 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3388 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3389 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3390 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
3391 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3392 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3393 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3396 echo "OpenSSH has been configured with the following options:"
3397 echo " User binaries: $B"
3398 echo " System binaries: $C"
3399 echo " Configuration files: $D"
3400 echo " Askpass program: $E"
3401 echo " Manual pages: $F"
3402 echo " PID file: $G"
3403 echo " Privilege separation chroot path: $H"
3404 if test "x$external_path_file" = "x/etc/login.conf" ; then
3405 echo " At runtime, sshd will use the path defined in $external_path_file"
3406 echo " Make sure the path to scp is present, otherwise scp will not work"
3408 echo " sshd default user PATH: $I"
3409 if test ! -z "$external_path_file"; then
3410 echo " (If PATH is set in $external_path_file it will be used instead. If"
3411 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3414 if test ! -z "$superuser_path" ; then
3415 echo " sshd superuser user PATH: $J"
3417 echo " Manpage format: $MANTYPE"
3418 echo " PAM support: $PAM_MSG"
3419 echo " KerberosV support: $KRB5_MSG"
3420 echo " Smartcard support: $SCARD_MSG"
3421 echo " S/KEY support: $SKEY_MSG"
3422 echo " TCP Wrappers support: $TCPW_MSG"
3423 echo " MD5 password support: $MD5_MSG"
3424 echo " libedit support: $LIBEDIT_MSG"
3425 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
3426 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3427 echo " BSD Auth support: $BSD_AUTH_MSG"
3428 echo " Random number source: $RAND_MSG"
3429 if test ! -z "$USE_RAND_HELPER" ; then
3430 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
3435 echo " Host: ${host}"
3436 echo " Compiler: ${CC}"
3437 echo " Compiler flags: ${CFLAGS}"
3438 echo "Preprocessor flags: ${CPPFLAGS}"
3439 echo " Linker flags: ${LDFLAGS}"
3440 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
3444 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
3445 echo "SVR4 style packages are supported with \"make package\""
3449 if test "x$PAM_MSG" = "xyes" ; then
3450 echo "PAM is enabled. You may need to install a PAM control file "
3451 echo "for sshd, otherwise password authentication may fail. "
3452 echo "Example PAM control files can be found in the contrib/ "
3457 if test ! -z "$RAND_HELPER_CMDHASH" ; then
3458 echo "WARNING: you are using the builtin random number collection "
3459 echo "service. Please read WARNING.RNG and request that your OS "
3460 echo "vendor includes kernel-based random number collection in "
3461 echo "future versions of your OS."
3465 if test ! -z "$NO_PEERCHECK" ; then
3466 echo "WARNING: the operating system that you are using does not "
3467 echo "appear to support either the getpeereid() API nor the "
3468 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3469 echo "enforce security checks to prevent unauthorised connections to "
3470 echo "ssh-agent. Their absence increases the risk that a malicious "
3471 echo "user can connect to your agent. "
3475 if test "$AUDIT_MODULE" = "bsm" ; then
3476 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3477 echo "See the Solaris section in README.platform for details."