1 # $Id: configure.ac,v 1.276 2005/06/19 00:19:43 djm 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, 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 -Wno-uninitialized"
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 if test "x$withval" != "xno" ; then
375 AC_DEFINE(PAM_SUN_CODEBASE)
376 AC_DEFINE(LOGIN_NEEDS_UTMPX)
377 AC_DEFINE(LOGIN_NEEDS_TERM)
378 AC_DEFINE(PAM_TTY_KLUDGE)
379 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
380 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
381 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
382 AC_DEFINE(SSHD_ACQUIRES_CTTY)
383 external_path_file=/etc/default/login
384 # hardwire lastlog location (can't detect it on some versions)
385 conf_lastlog_location="/var/adm/lastlog"
386 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
387 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
388 if test "$sol2ver" -ge 8; then
390 AC_DEFINE(DISABLE_UTMP)
391 AC_DEFINE(DISABLE_WTMP)
397 CPPFLAGS="$CPPFLAGS -DSUNOS4"
398 AC_CHECK_FUNCS(getpwanam)
399 AC_DEFINE(PAM_SUN_CODEBASE)
400 conf_utmp_location=/etc/utmp
401 conf_wtmp_location=/var/adm/wtmp
402 conf_lastlog_location=/var/adm/lastlog
408 AC_DEFINE(SSHD_ACQUIRES_CTTY)
409 AC_DEFINE(SETEUID_BREAKS_SETUID)
410 AC_DEFINE(BROKEN_SETREUID)
411 AC_DEFINE(BROKEN_SETREGID)
414 # /usr/ucblib MUST NOT be searched on ReliantUNIX
415 AC_CHECK_LIB(dl, dlsym, ,)
416 # -lresolv needs to be at then end of LIBS or DNS lookups break
417 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
418 IPADDR_IN_DISPLAY=yes
420 AC_DEFINE(IP_TOS_IS_BROKEN)
421 AC_DEFINE(SETEUID_BREAKS_SETUID)
422 AC_DEFINE(BROKEN_SETREUID)
423 AC_DEFINE(BROKEN_SETREGID)
424 AC_DEFINE(SSHD_ACQUIRES_CTTY)
425 external_path_file=/etc/default/login
426 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
427 # Attention: always take care to bind libsocket and libnsl before libc,
428 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
430 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
433 AC_DEFINE(SETEUID_BREAKS_SETUID)
434 AC_DEFINE(BROKEN_SETREUID)
435 AC_DEFINE(BROKEN_SETREGID)
436 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
438 # UnixWare 7.x, OpenUNIX 8
441 AC_DEFINE(SETEUID_BREAKS_SETUID)
442 AC_DEFINE(BROKEN_SETREUID)
443 AC_DEFINE(BROKEN_SETREGID)
444 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
446 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
447 TEST_SHELL=/u95/bin/sh
453 # SCO UNIX and OEM versions of SCO UNIX
455 AC_MSG_ERROR("This Platform is no longer supported.")
459 if test -z "$GCC"; then
460 CFLAGS="$CFLAGS -belf"
462 LIBS="$LIBS -lprot -lx -ltinfo -lm"
465 AC_DEFINE(HAVE_SECUREWARE)
466 AC_DEFINE(DISABLE_SHADOW)
467 AC_DEFINE(DISABLE_FD_PASSING)
468 AC_DEFINE(SETEUID_BREAKS_SETUID)
469 AC_DEFINE(BROKEN_SETREUID)
470 AC_DEFINE(BROKEN_SETREGID)
471 AC_DEFINE(WITH_ABBREV_NO_TTY)
472 AC_DEFINE(BROKEN_UPDWTMPX)
473 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
474 AC_CHECK_FUNCS(getluid setluid)
479 AC_DEFINE(NO_SSH_LASTLOG)
480 AC_DEFINE(SETEUID_BREAKS_SETUID)
481 AC_DEFINE(BROKEN_SETREUID)
482 AC_DEFINE(BROKEN_SETREGID)
484 AC_DEFINE(DISABLE_FD_PASSING)
486 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
490 AC_DEFINE(SETEUID_BREAKS_SETUID)
491 AC_DEFINE(BROKEN_SETREUID)
492 AC_DEFINE(BROKEN_SETREGID)
493 AC_DEFINE(WITH_ABBREV_NO_TTY)
495 AC_DEFINE(DISABLE_FD_PASSING)
497 LIBS="$LIBS -lgen -lacid -ldb"
501 AC_DEFINE(SETEUID_BREAKS_SETUID)
502 AC_DEFINE(BROKEN_SETREUID)
503 AC_DEFINE(BROKEN_SETREGID)
505 AC_DEFINE(DISABLE_FD_PASSING)
506 AC_DEFINE(NO_SSH_LASTLOG)
507 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
508 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
512 AC_MSG_CHECKING(for Digital Unix SIA)
515 [ --with-osfsia Enable Digital Unix SIA],
517 if test "x$withval" = "xno" ; then
518 AC_MSG_RESULT(disabled)
523 if test -z "$no_osfsia" ; then
524 if test -f /etc/sia/matrix.conf; then
526 AC_DEFINE(HAVE_OSF_SIA)
527 AC_DEFINE(DISABLE_LOGIN)
528 AC_DEFINE(DISABLE_FD_PASSING)
529 LIBS="$LIBS -lsecurity -ldb -lm -laud"
532 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
535 AC_DEFINE(BROKEN_GETADDRINFO)
536 AC_DEFINE(SETEUID_BREAKS_SETUID)
537 AC_DEFINE(BROKEN_SETREUID)
538 AC_DEFINE(BROKEN_SETREGID)
543 AC_DEFINE(NO_X11_UNIX_SOCKETS)
544 AC_DEFINE(MISSING_NFDBITS)
545 AC_DEFINE(MISSING_HOWMANY)
546 AC_DEFINE(MISSING_FD_MASK)
550 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
551 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
552 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
553 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
557 # Allow user to specify flags
559 [ --with-cflags Specify additional flags to pass to compiler],
561 if test -n "$withval" && test "x$withval" != "xno" && \
562 test "x${withval}" != "xyes"; then
563 CFLAGS="$CFLAGS $withval"
567 AC_ARG_WITH(cppflags,
568 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
570 if test -n "$withval" && test "x$withval" != "xno" && \
571 test "x${withval}" != "xyes"; then
572 CPPFLAGS="$CPPFLAGS $withval"
577 [ --with-ldflags Specify additional flags to pass to linker],
579 if test -n "$withval" && test "x$withval" != "xno" && \
580 test "x${withval}" != "xyes"; then
581 LDFLAGS="$LDFLAGS $withval"
586 [ --with-libs Specify additional libraries to link with],
588 if test -n "$withval" && test "x$withval" != "xno" && \
589 test "x${withval}" != "xyes"; then
590 LIBS="$LIBS $withval"
595 AC_MSG_CHECKING(compiler and flags for sanity)
601 [ AC_MSG_RESULT(yes) ],
604 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
606 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
609 dnl Checks for header files.
634 security/pam_appl.h \
670 # sys/ptms.h requires sys/stream.h to be included first on Solaris
671 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
672 #ifdef HAVE_SYS_STREAM_H
673 # include <sys/stream.h>
677 # Checks for libraries.
678 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
679 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
681 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
682 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
683 AC_CHECK_LIB(gen, dirname,[
684 AC_CACHE_CHECK([for broken dirname],
685 ac_cv_have_broken_dirname, [
693 int main(int argc, char **argv) {
696 strncpy(buf,"/etc", 32);
698 if (!s || strncmp(s, "/", 32) != 0) {
705 [ ac_cv_have_broken_dirname="no" ],
706 [ ac_cv_have_broken_dirname="yes" ]
710 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
712 AC_DEFINE(HAVE_DIRNAME)
713 AC_CHECK_HEADERS(libgen.h)
718 AC_CHECK_FUNC(getspnam, ,
719 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
720 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
724 [ --with-zlib=PATH Use zlib in PATH],
725 [ if test "x$withval" = "xno" ; then
726 AC_MSG_ERROR([*** zlib is required ***])
727 elif test "x$withval" != "xyes"; then
728 if test -d "$withval/lib"; then
729 if test -n "${need_dash_r}"; then
730 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
732 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
735 if test -n "${need_dash_r}"; then
736 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
738 LDFLAGS="-L${withval} ${LDFLAGS}"
741 if test -d "$withval/include"; then
742 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
744 CPPFLAGS="-I${withval} ${CPPFLAGS}"
749 AC_CHECK_LIB(z, deflate, ,
751 saved_CPPFLAGS="$CPPFLAGS"
752 saved_LDFLAGS="$LDFLAGS"
754 dnl Check default zlib install dir
755 if test -n "${need_dash_r}"; then
756 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
758 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
760 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
762 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
764 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
769 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
771 AC_ARG_WITH(zlib-version-check,
772 [ --without-zlib-version-check Disable zlib version check],
773 [ if test "x$withval" = "xno" ; then
774 zlib_check_nonfatal=1
779 AC_MSG_CHECKING(for possibly buggy zlib)
780 AC_RUN_IFELSE([AC_LANG_SOURCE([[
785 int a=0, b=0, c=0, d=0, n, v;
786 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
787 if (n != 3 && n != 4)
789 v = a*1000000 + b*10000 + c*100 + d;
790 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
793 if (a == 1 && b == 1 && c >= 4)
796 /* 1.2.1.2 and up are OK */
805 if test -z "$zlib_check_nonfatal" ; then
806 AC_MSG_ERROR([*** zlib too old - check config.log ***
807 Your reported zlib version has known security problems. It's possible your
808 vendor has fixed these problems without changing the version number. If you
809 are sure this is the case, you can disable the check by running
810 "./configure --without-zlib-version-check".
811 If you are in doubt, upgrade zlib to version 1.2.1.2 or greater.
812 See http://www.gzip.org/zlib/ for details.])
814 AC_MSG_WARN([zlib version may have security problems])
817 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
821 AC_CHECK_FUNC(strcasecmp,
822 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
824 AC_CHECK_FUNC(utimes,
825 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
826 LIBS="$LIBS -lc89"]) ]
829 dnl Checks for libutil functions
830 AC_CHECK_HEADERS(libutil.h)
831 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
832 AC_CHECK_FUNCS(logout updwtmp logwtmp)
836 # Check for ALTDIRFUNC glob() extension
837 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
838 AC_EGREP_CPP(FOUNDIT,
841 #ifdef GLOB_ALTDIRFUNC
846 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
854 # Check for g.gl_matchc glob() extension
855 AC_MSG_CHECKING(for gl_matchc field in glob_t)
856 AC_EGREP_CPP(FOUNDIT,
859 int main(void){glob_t g; g.gl_matchc = 1;}
862 AC_DEFINE(GLOB_HAS_GL_MATCHC)
870 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
873 #include <sys/types.h>
875 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
877 [AC_MSG_RESULT(yes)],
880 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
883 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
884 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
888 AC_MSG_CHECKING([for /proc/pid/fd directory])
889 if test -d "/proc/$$/fd" ; then
890 AC_DEFINE(HAVE_PROC_PID)
896 # Check whether user wants S/Key support
899 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
901 if test "x$withval" != "xno" ; then
903 if test "x$withval" != "xyes" ; then
904 CPPFLAGS="$CPPFLAGS -I${withval}/include"
905 LDFLAGS="$LDFLAGS -L${withval}/lib"
912 AC_MSG_CHECKING([for s/key support])
917 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
919 [AC_MSG_RESULT(yes)],
922 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
924 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
928 [(void)skeychallenge(NULL,"name","",0);],
930 AC_DEFINE(SKEYCHALLENGE_4ARG)],
937 # Check whether user wants TCP wrappers support
939 AC_ARG_WITH(tcp-wrappers,
940 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
942 if test "x$withval" != "xno" ; then
944 saved_LDFLAGS="$LDFLAGS"
945 saved_CPPFLAGS="$CPPFLAGS"
946 if test -n "${withval}" && \
947 test "x${withval}" != "xyes"; then
948 if test -d "${withval}/lib"; then
949 if test -n "${need_dash_r}"; then
950 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
952 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
955 if test -n "${need_dash_r}"; then
956 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
958 LDFLAGS="-L${withval} ${LDFLAGS}"
961 if test -d "${withval}/include"; then
962 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
964 CPPFLAGS="-I${withval} ${CPPFLAGS}"
968 LIBS="$LIBWRAP $LIBS"
969 AC_MSG_CHECKING(for libwrap)
972 #include <sys/types.h>
973 #include <sys/socket.h>
974 #include <netinet/in.h>
976 int deny_severity = 0, allow_severity = 0;
986 AC_MSG_ERROR([*** libwrap missing])
994 # Check whether user wants libedit support
997 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
998 [ if test "x$withval" != "xno" ; then
999 if test "x$withval" != "xyes"; then
1000 CPPFLAGS="$CPPFLAGS -I$withval/include"
1001 LDFLAGS="$LDFLAGS -L$withval/lib"
1003 AC_CHECK_LIB(edit, el_init,
1004 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
1005 LIBEDIT="-ledit -lcurses"
1009 [ AC_MSG_ERROR(libedit not found) ],
1017 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1019 AC_MSG_CHECKING(for supported audit module)
1024 dnl Checks for headers, libs and functions
1025 AC_CHECK_HEADERS(bsm/audit.h, [],
1026 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1027 AC_CHECK_LIB(bsm, getaudit, [],
1028 [AC_MSG_ERROR(BSM enabled and required library not found)])
1029 AC_CHECK_FUNCS(getaudit, [],
1030 [AC_MSG_ERROR(BSM enabled and required function not found)])
1031 # These are optional
1032 AC_CHECK_FUNCS(getaudit_addr)
1033 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
1037 AC_MSG_RESULT(debug)
1038 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
1041 AC_MSG_ERROR([Unknown audit module $withval])
1046 dnl Checks for library functions. Please keep in alphabetical order
1131 # IRIX has a const char return value for gai_strerror()
1132 AC_CHECK_FUNCS(gai_strerror,[
1133 AC_DEFINE(HAVE_GAI_STRERROR)
1135 #include <sys/types.h>
1136 #include <sys/socket.h>
1139 const char *gai_strerror(int);],[
1142 str = gai_strerror(0);],[
1143 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1144 [Define if gai_strerror() returns const char *])])])
1146 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1148 dnl Make sure prototypes are defined for these before using them.
1149 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1150 AC_CHECK_DECL(strsep,
1151 [AC_CHECK_FUNCS(strsep)],
1154 #ifdef HAVE_STRING_H
1155 # include <string.h>
1159 dnl tcsendbreak might be a macro
1160 AC_CHECK_DECL(tcsendbreak,
1161 [AC_DEFINE(HAVE_TCSENDBREAK)],
1162 [AC_CHECK_FUNCS(tcsendbreak)],
1163 [#include <termios.h>]
1166 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1168 AC_CHECK_FUNCS(setresuid, [
1169 dnl Some platorms have setresuid that isn't implemented, test for this
1170 AC_MSG_CHECKING(if setresuid seems to work)
1175 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1177 [AC_MSG_RESULT(yes)],
1178 [AC_DEFINE(BROKEN_SETRESUID)
1179 AC_MSG_RESULT(not implemented)],
1180 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1184 AC_CHECK_FUNCS(setresgid, [
1185 dnl Some platorms have setresgid that isn't implemented, test for this
1186 AC_MSG_CHECKING(if setresgid seems to work)
1191 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1193 [AC_MSG_RESULT(yes)],
1194 [AC_DEFINE(BROKEN_SETRESGID)
1195 AC_MSG_RESULT(not implemented)],
1196 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1200 dnl Checks for time functions
1201 AC_CHECK_FUNCS(gettimeofday time)
1202 dnl Checks for utmp functions
1203 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1204 AC_CHECK_FUNCS(utmpname)
1205 dnl Checks for utmpx functions
1206 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1207 AC_CHECK_FUNCS(setutxent utmpxname)
1209 AC_CHECK_FUNC(daemon,
1210 [AC_DEFINE(HAVE_DAEMON)],
1211 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1214 AC_CHECK_FUNC(getpagesize,
1215 [AC_DEFINE(HAVE_GETPAGESIZE)],
1216 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1219 # Check for broken snprintf
1220 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1221 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1225 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1227 [AC_MSG_RESULT(yes)],
1230 AC_DEFINE(BROKEN_SNPRINTF)
1231 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1233 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1237 # Check for missing getpeereid (or equiv) support
1239 if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1240 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1242 [#include <sys/types.h>
1243 #include <sys/socket.h>],
1244 [int i = SO_PEERCRED;],
1245 [ AC_MSG_RESULT(yes)
1246 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1253 dnl see whether mkstemp() requires XXXXXX
1254 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1255 AC_MSG_CHECKING([for (overly) strict mkstemp])
1259 main() { char template[]="conftest.mkstemp-test";
1260 if (mkstemp(template) == -1)
1262 unlink(template); exit(0);
1270 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1274 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1279 dnl make sure that openpty does not reacquire controlling terminal
1280 if test ! -z "$check_for_openpty_ctty_bug"; then
1281 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1285 #include <sys/fcntl.h>
1286 #include <sys/types.h>
1287 #include <sys/wait.h>
1293 int fd, ptyfd, ttyfd, status;
1296 if (pid < 0) { /* failed */
1298 } else if (pid > 0) { /* parent */
1299 waitpid(pid, &status, 0);
1300 if (WIFEXITED(status))
1301 exit(WEXITSTATUS(status));
1304 } else { /* child */
1305 close(0); close(1); close(2);
1307 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1308 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1310 exit(3); /* Acquired ctty: broken */
1312 exit(0); /* Did not acquire ctty: OK */
1321 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1326 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1327 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1328 AC_MSG_CHECKING(if getaddrinfo seems to work)
1332 #include <sys/socket.h>
1335 #include <netinet/in.h>
1337 #define TEST_PORT "2222"
1343 struct addrinfo *gai_ai, *ai, hints;
1344 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1346 memset(&hints, 0, sizeof(hints));
1347 hints.ai_family = PF_UNSPEC;
1348 hints.ai_socktype = SOCK_STREAM;
1349 hints.ai_flags = AI_PASSIVE;
1351 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1353 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1357 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1358 if (ai->ai_family != AF_INET6)
1361 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1362 sizeof(ntop), strport, sizeof(strport),
1363 NI_NUMERICHOST|NI_NUMERICSERV);
1366 if (err == EAI_SYSTEM)
1367 perror("getnameinfo EAI_SYSTEM");
1369 fprintf(stderr, "getnameinfo failed: %s\n",
1374 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1377 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1390 AC_DEFINE(BROKEN_GETADDRINFO)
1395 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1396 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1397 AC_MSG_CHECKING(if getaddrinfo seems to work)
1401 #include <sys/socket.h>
1404 #include <netinet/in.h>
1406 #define TEST_PORT "2222"
1412 struct addrinfo *gai_ai, *ai, hints;
1413 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1415 memset(&hints, 0, sizeof(hints));
1416 hints.ai_family = PF_UNSPEC;
1417 hints.ai_socktype = SOCK_STREAM;
1418 hints.ai_flags = AI_PASSIVE;
1420 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1422 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1426 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1427 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1430 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1431 sizeof(ntop), strport, sizeof(strport),
1432 NI_NUMERICHOST|NI_NUMERICSERV);
1434 if (ai->ai_family == AF_INET && err != 0) {
1435 perror("getnameinfo");
1444 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1445 [Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1449 AC_DEFINE(BROKEN_GETADDRINFO)
1454 if test "x$check_for_conflicting_getspnam" = "x1"; then
1455 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1459 int main(void) {exit(0);}
1466 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1467 [Conflicting defs for getspnam])
1474 # Check for PAM libs
1477 [ --with-pam Enable PAM support ],
1479 if test "x$withval" != "xno" ; then
1480 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1481 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1482 AC_MSG_ERROR([PAM headers not found])
1485 AC_CHECK_LIB(dl, dlopen, , )
1486 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1487 AC_CHECK_FUNCS(pam_getenvlist)
1488 AC_CHECK_FUNCS(pam_putenv)
1493 if test $ac_cv_lib_dl_dlopen = yes; then
1503 # Check for older PAM
1504 if test "x$PAM_MSG" = "xyes" ; then
1505 # Check PAM strerror arguments (old PAM)
1506 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1510 #if defined(HAVE_SECURITY_PAM_APPL_H)
1511 #include <security/pam_appl.h>
1512 #elif defined (HAVE_PAM_PAM_APPL_H)
1513 #include <pam/pam_appl.h>
1516 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1517 [AC_MSG_RESULT(no)],
1519 AC_DEFINE(HAVE_OLD_PAM)
1521 PAM_MSG="yes (old library)"
1526 # Search for OpenSSL
1527 saved_CPPFLAGS="$CPPFLAGS"
1528 saved_LDFLAGS="$LDFLAGS"
1529 AC_ARG_WITH(ssl-dir,
1530 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1532 if test "x$withval" != "xno" ; then
1535 ./*|../*) withval="`pwd`/$withval"
1537 if test -d "$withval/lib"; then
1538 if test -n "${need_dash_r}"; then
1539 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1541 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1544 if test -n "${need_dash_r}"; then
1545 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1547 LDFLAGS="-L${withval} ${LDFLAGS}"
1550 if test -d "$withval/include"; then
1551 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1553 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1558 LIBS="-lcrypto $LIBS"
1559 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1561 dnl Check default openssl install dir
1562 if test -n "${need_dash_r}"; then
1563 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1565 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1567 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1568 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1570 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1576 # Determine OpenSSL header version
1577 AC_MSG_CHECKING([OpenSSL header version])
1582 #include <openssl/opensslv.h>
1583 #define DATA "conftest.sslincver"
1588 fd = fopen(DATA,"w");
1592 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1599 ssl_header_ver=`cat conftest.sslincver`
1600 AC_MSG_RESULT($ssl_header_ver)
1603 AC_MSG_RESULT(not found)
1604 AC_MSG_ERROR(OpenSSL version header not found.)
1607 AC_MSG_WARN([cross compiling: not checking])
1611 # Determine OpenSSL library version
1612 AC_MSG_CHECKING([OpenSSL library version])
1617 #include <openssl/opensslv.h>
1618 #include <openssl/crypto.h>
1619 #define DATA "conftest.ssllibver"
1624 fd = fopen(DATA,"w");
1628 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1635 ssl_library_ver=`cat conftest.ssllibver`
1636 AC_MSG_RESULT($ssl_library_ver)
1639 AC_MSG_RESULT(not found)
1640 AC_MSG_ERROR(OpenSSL library not found.)
1643 AC_MSG_WARN([cross compiling: not checking])
1647 # Sanity check OpenSSL headers
1648 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1652 #include <openssl/opensslv.h>
1653 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1660 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1661 Check config.log for details.
1662 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1665 AC_MSG_WARN([cross compiling: not checking])
1669 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1670 # because the system crypt() is more featureful.
1671 if test "x$check_for_libcrypt_before" = "x1"; then
1672 AC_CHECK_LIB(crypt, crypt)
1675 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1676 # version in OpenSSL.
1677 if test "x$check_for_libcrypt_later" = "x1"; then
1678 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1682 ### Configure cryptographic random number support
1684 # Check wheter OpenSSL seeds itself
1685 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1689 #include <openssl/rand.h>
1690 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1693 OPENSSL_SEEDS_ITSELF=yes
1698 # Default to use of the rand helper if OpenSSL doesn't
1703 AC_MSG_WARN([cross compiling: assuming yes])
1704 # This is safe, since all recent OpenSSL versions will
1705 # complain at runtime if not seeded correctly.
1706 OPENSSL_SEEDS_ITSELF=yes
1711 # Do we want to force the use of the rand helper?
1712 AC_ARG_WITH(rand-helper,
1713 [ --with-rand-helper Use subprocess to gather strong randomness ],
1715 if test "x$withval" = "xno" ; then
1716 # Force use of OpenSSL's internal RNG, even if
1717 # the previous test showed it to be unseeded.
1718 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1719 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1720 OPENSSL_SEEDS_ITSELF=yes
1729 # Which randomness source do we use?
1730 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
1732 AC_DEFINE(OPENSSL_PRNG_ONLY)
1733 RAND_MSG="OpenSSL internal ONLY"
1734 INSTALL_SSH_RAND_HELPER=""
1735 elif test ! -z "$USE_RAND_HELPER" ; then
1736 # install rand helper
1737 RAND_MSG="ssh-rand-helper"
1738 INSTALL_SSH_RAND_HELPER="yes"
1740 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1742 ### Configuration of ssh-rand-helper
1745 AC_ARG_WITH(prngd-port,
1746 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1755 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1758 if test ! -z "$withval" ; then
1759 PRNGD_PORT="$withval"
1760 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1765 # PRNGD Unix domain socket
1766 AC_ARG_WITH(prngd-socket,
1767 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1771 withval="/var/run/egd-pool"
1779 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1783 if test ! -z "$withval" ; then
1784 if test ! -z "$PRNGD_PORT" ; then
1785 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1787 if test ! -r "$withval" ; then
1788 AC_MSG_WARN(Entropy socket is not readable)
1790 PRNGD_SOCKET="$withval"
1791 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1795 # Check for existing socket only if we don't have a random device already
1796 if test "$USE_RAND_HELPER" = yes ; then
1797 AC_MSG_CHECKING(for PRNGD/EGD socket)
1798 # Insert other locations here
1799 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1800 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1801 PRNGD_SOCKET="$sock"
1802 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1806 if test ! -z "$PRNGD_SOCKET" ; then
1807 AC_MSG_RESULT($PRNGD_SOCKET)
1809 AC_MSG_RESULT(not found)
1815 # Change default command timeout for hashing entropy source
1817 AC_ARG_WITH(entropy-timeout,
1818 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1820 if test -n "$withval" && test "x$withval" != "xno" && \
1821 test "x${withval}" != "xyes"; then
1822 entropy_timeout=$withval
1826 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1828 SSH_PRIVSEP_USER=sshd
1829 AC_ARG_WITH(privsep-user,
1830 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1832 if test -n "$withval" && test "x$withval" != "xno" && \
1833 test "x${withval}" != "xyes"; then
1834 SSH_PRIVSEP_USER=$withval
1838 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1839 AC_SUBST(SSH_PRIVSEP_USER)
1841 # We do this little dance with the search path to insure
1842 # that programs that we select for use by installed programs
1843 # (which may be run by the super-user) come from trusted
1844 # locations before they come from the user's private area.
1845 # This should help avoid accidentally configuring some
1846 # random version of a program in someone's personal bin.
1850 test -h /bin 2> /dev/null && PATH=/usr/bin
1851 test -d /sbin && PATH=$PATH:/sbin
1852 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1853 PATH=$PATH:/etc:$OPATH
1855 # These programs are used by the command hashing source to gather entropy
1856 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1857 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1858 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1859 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1860 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1861 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1862 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1863 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1864 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1865 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1866 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1867 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1868 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1869 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1870 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1871 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1875 # Where does ssh-rand-helper get its randomness from?
1876 INSTALL_SSH_PRNG_CMDS=""
1877 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1878 if test ! -z "$PRNGD_PORT" ; then
1879 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1880 elif test ! -z "$PRNGD_SOCKET" ; then
1881 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1883 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1884 RAND_HELPER_CMDHASH=yes
1885 INSTALL_SSH_PRNG_CMDS="yes"
1888 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1891 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1892 if test ! -z "$SONY" ; then
1893 LIBS="$LIBS -liberty";
1896 # Checks for data types
1897 AC_CHECK_SIZEOF(char, 1)
1898 AC_CHECK_SIZEOF(short int, 2)
1899 AC_CHECK_SIZEOF(int, 4)
1900 AC_CHECK_SIZEOF(long int, 4)
1901 AC_CHECK_SIZEOF(long long int, 8)
1903 # Sanity check long long for some platforms (AIX)
1904 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1905 ac_cv_sizeof_long_long_int=0
1908 # More checks for data types
1909 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1911 [ #include <sys/types.h> ],
1913 [ ac_cv_have_u_int="yes" ],
1914 [ ac_cv_have_u_int="no" ]
1917 if test "x$ac_cv_have_u_int" = "xyes" ; then
1918 AC_DEFINE(HAVE_U_INT)
1922 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1924 [ #include <sys/types.h> ],
1925 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1926 [ ac_cv_have_intxx_t="yes" ],
1927 [ ac_cv_have_intxx_t="no" ]
1930 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1931 AC_DEFINE(HAVE_INTXX_T)
1935 if (test -z "$have_intxx_t" && \
1936 test "x$ac_cv_header_stdint_h" = "xyes")
1938 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1940 [ #include <stdint.h> ],
1941 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1943 AC_DEFINE(HAVE_INTXX_T)
1946 [ AC_MSG_RESULT(no) ]
1950 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1953 #include <sys/types.h>
1954 #ifdef HAVE_STDINT_H
1955 # include <stdint.h>
1957 #include <sys/socket.h>
1958 #ifdef HAVE_SYS_BITYPES_H
1959 # include <sys/bitypes.h>
1962 [ int64_t a; a = 1;],
1963 [ ac_cv_have_int64_t="yes" ],
1964 [ ac_cv_have_int64_t="no" ]
1967 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1968 AC_DEFINE(HAVE_INT64_T)
1971 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1973 [ #include <sys/types.h> ],
1974 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1975 [ ac_cv_have_u_intxx_t="yes" ],
1976 [ ac_cv_have_u_intxx_t="no" ]
1979 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1980 AC_DEFINE(HAVE_U_INTXX_T)
1984 if test -z "$have_u_intxx_t" ; then
1985 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1987 [ #include <sys/socket.h> ],
1988 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1990 AC_DEFINE(HAVE_U_INTXX_T)
1993 [ AC_MSG_RESULT(no) ]
1997 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1999 [ #include <sys/types.h> ],
2000 [ u_int64_t a; a = 1;],
2001 [ ac_cv_have_u_int64_t="yes" ],
2002 [ ac_cv_have_u_int64_t="no" ]
2005 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2006 AC_DEFINE(HAVE_U_INT64_T)
2010 if test -z "$have_u_int64_t" ; then
2011 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2013 [ #include <sys/bitypes.h> ],
2014 [ u_int64_t a; a = 1],
2016 AC_DEFINE(HAVE_U_INT64_T)
2019 [ AC_MSG_RESULT(no) ]
2023 if test -z "$have_u_intxx_t" ; then
2024 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2027 #include <sys/types.h>
2029 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2030 [ ac_cv_have_uintxx_t="yes" ],
2031 [ ac_cv_have_uintxx_t="no" ]
2034 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2035 AC_DEFINE(HAVE_UINTXX_T)
2039 if test -z "$have_uintxx_t" ; then
2040 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2042 [ #include <stdint.h> ],
2043 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2045 AC_DEFINE(HAVE_UINTXX_T)
2048 [ AC_MSG_RESULT(no) ]
2052 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2053 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2055 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2058 #include <sys/bitypes.h>
2061 int8_t a; int16_t b; int32_t c;
2062 u_int8_t e; u_int16_t f; u_int32_t g;
2063 a = b = c = e = f = g = 1;
2066 AC_DEFINE(HAVE_U_INTXX_T)
2067 AC_DEFINE(HAVE_INTXX_T)
2075 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2078 #include <sys/types.h>
2080 [ u_char foo; foo = 125; ],
2081 [ ac_cv_have_u_char="yes" ],
2082 [ ac_cv_have_u_char="no" ]
2085 if test "x$ac_cv_have_u_char" = "xyes" ; then
2086 AC_DEFINE(HAVE_U_CHAR)
2091 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2093 AC_CHECK_TYPES(in_addr_t,,,
2094 [#include <sys/types.h>
2095 #include <netinet/in.h>])
2097 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2100 #include <sys/types.h>
2102 [ size_t foo; foo = 1235; ],
2103 [ ac_cv_have_size_t="yes" ],
2104 [ ac_cv_have_size_t="no" ]
2107 if test "x$ac_cv_have_size_t" = "xyes" ; then
2108 AC_DEFINE(HAVE_SIZE_T)
2111 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2114 #include <sys/types.h>
2116 [ ssize_t foo; foo = 1235; ],
2117 [ ac_cv_have_ssize_t="yes" ],
2118 [ ac_cv_have_ssize_t="no" ]
2121 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2122 AC_DEFINE(HAVE_SSIZE_T)
2125 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2130 [ clock_t foo; foo = 1235; ],
2131 [ ac_cv_have_clock_t="yes" ],
2132 [ ac_cv_have_clock_t="no" ]
2135 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2136 AC_DEFINE(HAVE_CLOCK_T)
2139 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2142 #include <sys/types.h>
2143 #include <sys/socket.h>
2145 [ sa_family_t foo; foo = 1235; ],
2146 [ ac_cv_have_sa_family_t="yes" ],
2149 #include <sys/types.h>
2150 #include <sys/socket.h>
2151 #include <netinet/in.h>
2153 [ sa_family_t foo; foo = 1235; ],
2154 [ ac_cv_have_sa_family_t="yes" ],
2156 [ ac_cv_have_sa_family_t="no" ]
2160 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2161 AC_DEFINE(HAVE_SA_FAMILY_T)
2164 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2167 #include <sys/types.h>
2169 [ pid_t foo; foo = 1235; ],
2170 [ ac_cv_have_pid_t="yes" ],
2171 [ ac_cv_have_pid_t="no" ]
2174 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2175 AC_DEFINE(HAVE_PID_T)
2178 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2181 #include <sys/types.h>
2183 [ mode_t foo; foo = 1235; ],
2184 [ ac_cv_have_mode_t="yes" ],
2185 [ ac_cv_have_mode_t="no" ]
2188 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2189 AC_DEFINE(HAVE_MODE_T)
2193 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2196 #include <sys/types.h>
2197 #include <sys/socket.h>
2199 [ struct sockaddr_storage s; ],
2200 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2201 [ ac_cv_have_struct_sockaddr_storage="no" ]
2204 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2205 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2208 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2211 #include <sys/types.h>
2212 #include <netinet/in.h>
2214 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2215 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2216 [ ac_cv_have_struct_sockaddr_in6="no" ]
2219 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2220 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2223 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2226 #include <sys/types.h>
2227 #include <netinet/in.h>
2229 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2230 [ ac_cv_have_struct_in6_addr="yes" ],
2231 [ ac_cv_have_struct_in6_addr="no" ]
2234 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2235 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2238 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2241 #include <sys/types.h>
2242 #include <sys/socket.h>
2245 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2246 [ ac_cv_have_struct_addrinfo="yes" ],
2247 [ ac_cv_have_struct_addrinfo="no" ]
2250 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2251 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2254 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2256 [ #include <sys/time.h> ],
2257 [ struct timeval tv; tv.tv_sec = 1;],
2258 [ ac_cv_have_struct_timeval="yes" ],
2259 [ ac_cv_have_struct_timeval="no" ]
2262 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2263 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2264 have_struct_timeval=1
2267 AC_CHECK_TYPES(struct timespec)
2269 # We need int64_t or else certian parts of the compile will fail.
2270 if test "x$ac_cv_have_int64_t" = "xno" && \
2271 test "x$ac_cv_sizeof_long_int" != "x8" && \
2272 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2273 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2274 echo "an alternative compiler (I.E., GCC) before continuing."
2278 dnl test snprintf (broken on SCO w/gcc)
2283 #ifdef HAVE_SNPRINTF
2287 char expected_out[50];
2289 #if (SIZEOF_LONG_INT == 8)
2290 long int num = 0x7fffffffffffffff;
2292 long long num = 0x7fffffffffffffffll;
2294 strcpy(expected_out, "9223372036854775807");
2295 snprintf(buf, mazsize, "%lld", num);
2296 if(strcmp(buf, expected_out) != 0)
2303 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2304 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2308 dnl Checks for structure members
2309 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2310 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2311 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2312 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2313 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2314 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2315 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2316 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2317 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2318 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2319 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2320 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2321 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2322 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2323 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2324 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2325 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2327 AC_CHECK_MEMBERS([struct stat.st_blksize])
2329 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2330 ac_cv_have_ss_family_in_struct_ss, [
2333 #include <sys/types.h>
2334 #include <sys/socket.h>
2336 [ struct sockaddr_storage s; s.ss_family = 1; ],
2337 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2338 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2341 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2342 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2345 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2346 ac_cv_have___ss_family_in_struct_ss, [
2349 #include <sys/types.h>
2350 #include <sys/socket.h>
2352 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2353 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2354 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2357 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2358 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2361 AC_CACHE_CHECK([for pw_class field in struct passwd],
2362 ac_cv_have_pw_class_in_struct_passwd, [
2367 [ struct passwd p; p.pw_class = 0; ],
2368 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2369 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2372 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2373 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2376 AC_CACHE_CHECK([for pw_expire field in struct passwd],
2377 ac_cv_have_pw_expire_in_struct_passwd, [
2382 [ struct passwd p; p.pw_expire = 0; ],
2383 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2384 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2387 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2388 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2391 AC_CACHE_CHECK([for pw_change field in struct passwd],
2392 ac_cv_have_pw_change_in_struct_passwd, [
2397 [ struct passwd p; p.pw_change = 0; ],
2398 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2399 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2402 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2403 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2406 dnl make sure we're using the real structure members and not defines
2407 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2408 ac_cv_have_accrights_in_msghdr, [
2411 #include <sys/types.h>
2412 #include <sys/socket.h>
2413 #include <sys/uio.h>
2415 #ifdef msg_accrights
2416 #error "msg_accrights is a macro"
2420 m.msg_accrights = 0;
2424 [ ac_cv_have_accrights_in_msghdr="yes" ],
2425 [ ac_cv_have_accrights_in_msghdr="no" ]
2428 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2429 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2432 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2433 ac_cv_have_control_in_msghdr, [
2436 #include <sys/types.h>
2437 #include <sys/socket.h>
2438 #include <sys/uio.h>
2441 #error "msg_control is a macro"
2449 [ ac_cv_have_control_in_msghdr="yes" ],
2450 [ ac_cv_have_control_in_msghdr="no" ]
2453 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2454 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2457 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2459 [ extern char *__progname; printf("%s", __progname); ],
2460 [ ac_cv_libc_defines___progname="yes" ],
2461 [ ac_cv_libc_defines___progname="no" ]
2464 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2465 AC_DEFINE(HAVE___PROGNAME)
2468 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2472 [ printf("%s", __FUNCTION__); ],
2473 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2474 [ ac_cv_cc_implements___FUNCTION__="no" ]
2477 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2478 AC_DEFINE(HAVE___FUNCTION__)
2481 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2485 [ printf("%s", __func__); ],
2486 [ ac_cv_cc_implements___func__="yes" ],
2487 [ ac_cv_cc_implements___func__="no" ]
2490 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2491 AC_DEFINE(HAVE___func__)
2494 AC_CACHE_CHECK([whether getopt has optreset support],
2495 ac_cv_have_getopt_optreset, [
2500 [ extern int optreset; optreset = 0; ],
2501 [ ac_cv_have_getopt_optreset="yes" ],
2502 [ ac_cv_have_getopt_optreset="no" ]
2505 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2506 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2509 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2511 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2512 [ ac_cv_libc_defines_sys_errlist="yes" ],
2513 [ ac_cv_libc_defines_sys_errlist="no" ]
2516 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2517 AC_DEFINE(HAVE_SYS_ERRLIST)
2521 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2523 [ extern int sys_nerr; printf("%i", sys_nerr);],
2524 [ ac_cv_libc_defines_sys_nerr="yes" ],
2525 [ ac_cv_libc_defines_sys_nerr="no" ]
2528 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2529 AC_DEFINE(HAVE_SYS_NERR)
2533 # Check whether user wants sectok support
2535 [ --with-sectok Enable smartcard support using libsectok],
2537 if test "x$withval" != "xno" ; then
2538 if test "x$withval" != "xyes" ; then
2539 CPPFLAGS="$CPPFLAGS -I${withval}"
2540 LDFLAGS="$LDFLAGS -L${withval}"
2541 if test ! -z "$need_dash_r" ; then
2542 LDFLAGS="$LDFLAGS -R${withval}"
2544 if test ! -z "$blibpath" ; then
2545 blibpath="$blibpath:${withval}"
2548 AC_CHECK_HEADERS(sectok.h)
2549 if test "$ac_cv_header_sectok_h" != yes; then
2550 AC_MSG_ERROR(Can't find sectok.h)
2552 AC_CHECK_LIB(sectok, sectok_open)
2553 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2554 AC_MSG_ERROR(Can't find libsectok)
2556 AC_DEFINE(SMARTCARD)
2557 AC_DEFINE(USE_SECTOK)
2558 SCARD_MSG="yes, using sectok"
2563 # Check whether user wants OpenSC support
2566 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2568 if test "x$withval" != "xno" ; then
2569 if test "x$withval" != "xyes" ; then
2570 OPENSC_CONFIG=$withval/bin/opensc-config
2572 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2574 if test "$OPENSC_CONFIG" != "no"; then
2575 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2576 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2577 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2578 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2579 AC_DEFINE(SMARTCARD)
2580 AC_DEFINE(USE_OPENSC)
2581 SCARD_MSG="yes, using OpenSC"
2587 # Check libraries needed by DNS fingerprint support
2588 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2589 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
2591 # Needed by our getrrsetbyname()
2592 AC_SEARCH_LIBS(res_query, resolv)
2593 AC_SEARCH_LIBS(dn_expand, resolv)
2594 AC_MSG_CHECKING(if res_query will link)
2595 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2598 LIBS="$LIBS -lresolv"
2599 AC_MSG_CHECKING(for res_query in -lresolv)
2604 res_query (0, 0, 0, 0, 0);
2608 [LIBS="$LIBS -lresolv"
2609 AC_MSG_RESULT(yes)],
2613 AC_CHECK_FUNCS(_getshort _getlong)
2614 AC_CHECK_DECLS([_getshort, _getlong], , ,
2615 [#include <sys/types.h>
2616 #include <arpa/nameser.h>])
2617 AC_CHECK_MEMBER(HEADER.ad,
2618 [AC_DEFINE(HAVE_HEADER_AD)],,
2619 [#include <arpa/nameser.h>])
2622 # Check whether user wants Kerberos 5 support
2624 AC_ARG_WITH(kerberos5,
2625 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2626 [ if test "x$withval" != "xno" ; then
2627 if test "x$withval" = "xyes" ; then
2628 KRB5ROOT="/usr/local"
2636 AC_MSG_CHECKING(for krb5-config)
2637 if test -x $KRB5ROOT/bin/krb5-config ; then
2638 KRB5CONF=$KRB5ROOT/bin/krb5-config
2639 AC_MSG_RESULT($KRB5CONF)
2641 AC_MSG_CHECKING(for gssapi support)
2642 if $KRB5CONF | grep gssapi >/dev/null ; then
2650 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2651 K5LIBS="`$KRB5CONF --libs $k5confopts`"
2652 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2653 AC_MSG_CHECKING(whether we are using Heimdal)
2654 AC_TRY_COMPILE([ #include <krb5.h> ],
2655 [ char *tmp = heimdal_version; ],
2656 [ AC_MSG_RESULT(yes)
2657 AC_DEFINE(HEIMDAL) ],
2662 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2663 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2664 AC_MSG_CHECKING(whether we are using Heimdal)
2665 AC_TRY_COMPILE([ #include <krb5.h> ],
2666 [ char *tmp = heimdal_version; ],
2667 [ AC_MSG_RESULT(yes)
2669 K5LIBS="-lkrb5 -ldes"
2670 K5LIBS="$K5LIBS -lcom_err -lasn1"
2671 AC_CHECK_LIB(roken, net_write,
2672 [K5LIBS="$K5LIBS -lroken"])
2675 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2678 AC_SEARCH_LIBS(dn_expand, resolv)
2680 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2682 K5LIBS="-lgssapi $K5LIBS" ],
2683 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2685 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2686 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2691 AC_CHECK_HEADER(gssapi.h, ,
2692 [ unset ac_cv_header_gssapi_h
2693 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2694 AC_CHECK_HEADERS(gssapi.h, ,
2695 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2701 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2702 AC_CHECK_HEADER(gssapi_krb5.h, ,
2703 [ CPPFLAGS="$oldCPP" ])
2706 if test ! -z "$need_dash_r" ; then
2707 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2709 if test ! -z "$blibpath" ; then
2710 blibpath="$blibpath:${KRB5ROOT}/lib"
2714 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2715 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2716 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2718 LIBS="$LIBS $K5LIBS"
2719 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2720 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
2724 # Looking for programs, paths and files
2726 PRIVSEP_PATH=/var/empty
2727 AC_ARG_WITH(privsep-path,
2728 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2730 if test -n "$withval" && test "x$withval" != "xno" && \
2731 test "x${withval}" != "xyes"; then
2732 PRIVSEP_PATH=$withval
2736 AC_SUBST(PRIVSEP_PATH)
2739 [ --with-xauth=PATH Specify path to xauth program ],
2741 if test -n "$withval" && test "x$withval" != "xno" && \
2742 test "x${withval}" != "xyes"; then
2748 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2749 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2750 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2751 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2752 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2753 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2754 xauth_path="/usr/openwin/bin/xauth"
2760 AC_ARG_ENABLE(strip,
2761 [ --disable-strip Disable calling strip(1) on install],
2763 if test "x$enableval" = "xno" ; then
2770 if test -z "$xauth_path" ; then
2771 XAUTH_PATH="undefined"
2772 AC_SUBST(XAUTH_PATH)
2774 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2775 XAUTH_PATH=$xauth_path
2776 AC_SUBST(XAUTH_PATH)
2779 # Check for mail directory (last resort if we cannot get it from headers)
2780 if test ! -z "$MAIL" ; then
2781 maildir=`dirname $MAIL`
2782 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2785 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
2786 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2787 disable_ptmx_check=yes
2789 if test -z "$no_dev_ptmx" ; then
2790 if test "x$disable_ptmx_check" != "xyes" ; then
2791 AC_CHECK_FILE("/dev/ptmx",
2793 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2800 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
2801 AC_CHECK_FILE("/dev/ptc",
2803 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2808 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2811 # Options from here on. Some of these are preset by platform above
2812 AC_ARG_WITH(mantype,
2813 [ --with-mantype=man|cat|doc Set man page type],
2820 AC_MSG_ERROR(invalid man type: $withval)
2825 if test -z "$MANTYPE"; then
2826 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2827 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2828 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2830 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2837 if test "$MANTYPE" = "doc"; then
2844 # Check whether to enable MD5 passwords
2846 AC_ARG_WITH(md5-passwords,
2847 [ --with-md5-passwords Enable use of MD5 passwords],
2849 if test "x$withval" != "xno" ; then
2850 AC_DEFINE(HAVE_MD5_PASSWORDS)
2856 # Whether to disable shadow password support
2858 [ --without-shadow Disable shadow password support],
2860 if test "x$withval" = "xno" ; then
2861 AC_DEFINE(DISABLE_SHADOW)
2867 if test -z "$disable_shadow" ; then
2868 AC_MSG_CHECKING([if the systems has expire shadow information])
2871 #include <sys/types.h>
2874 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2875 [ sp_expire_available=yes ], []
2878 if test "x$sp_expire_available" = "xyes" ; then
2880 AC_DEFINE(HAS_SHADOW_EXPIRE)
2886 # Use ip address instead of hostname in $DISPLAY
2887 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2888 DISPLAY_HACK_MSG="yes"
2889 AC_DEFINE(IPADDR_IN_DISPLAY)
2891 DISPLAY_HACK_MSG="no"
2892 AC_ARG_WITH(ipaddr-display,
2893 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2895 if test "x$withval" != "xno" ; then
2896 AC_DEFINE(IPADDR_IN_DISPLAY)
2897 DISPLAY_HACK_MSG="yes"
2903 # check for /etc/default/login and use it if present.
2904 AC_ARG_ENABLE(etc-default-login,
2905 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
2906 [ if test "x$enableval" = "xno"; then
2907 AC_MSG_NOTICE([/etc/default/login handling disabled])
2908 etc_default_login=no
2910 etc_default_login=yes
2912 [ etc_default_login=yes ]
2915 if test "x$etc_default_login" != "xno"; then
2916 AC_CHECK_FILE("/etc/default/login",
2917 [ external_path_file=/etc/default/login ])
2918 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2920 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2921 elif test "x$external_path_file" = "x/etc/default/login"; then
2922 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2926 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2927 if test $ac_cv_func_login_getcapbool = "yes" && \
2928 test $ac_cv_header_login_cap_h = "yes" ; then
2929 external_path_file=/etc/login.conf
2932 # Whether to mess with the default path
2933 SERVER_PATH_MSG="(default)"
2934 AC_ARG_WITH(default-path,
2935 [ --with-default-path= Specify default \$PATH environment for server],
2937 if test "x$external_path_file" = "x/etc/login.conf" ; then
2939 --with-default-path=PATH has no effect on this system.
2940 Edit /etc/login.conf instead.])
2941 elif test "x$withval" != "xno" ; then
2942 if test ! -z "$external_path_file" ; then
2944 --with-default-path=PATH will only be used if PATH is not defined in
2945 $external_path_file .])
2947 user_path="$withval"
2948 SERVER_PATH_MSG="$withval"
2951 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2952 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2954 if test ! -z "$external_path_file" ; then
2956 If PATH is defined in $external_path_file, ensure the path to scp is included,
2957 otherwise scp will not work.])
2961 /* find out what STDPATH is */
2966 #ifndef _PATH_STDPATH
2967 # ifdef _PATH_USERPATH /* Irix */
2968 # define _PATH_STDPATH _PATH_USERPATH
2970 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2973 #include <sys/types.h>
2974 #include <sys/stat.h>
2976 #define DATA "conftest.stdpath"
2983 fd = fopen(DATA,"w");
2987 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2992 ], [ user_path=`cat conftest.stdpath` ],
2993 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2994 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2996 # make sure $bindir is in USER_PATH so scp will work
2997 t_bindir=`eval echo ${bindir}`
2999 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3002 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3004 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3005 if test $? -ne 0 ; then
3006 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3007 if test $? -ne 0 ; then
3008 user_path=$user_path:$t_bindir
3009 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3014 if test "x$external_path_file" != "x/etc/login.conf" ; then
3015 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
3019 # Set superuser path separately to user path
3020 AC_ARG_WITH(superuser-path,
3021 [ --with-superuser-path= Specify different path for super-user],
3023 if test -n "$withval" && test "x$withval" != "xno" && \
3024 test "x${withval}" != "xyes"; then
3025 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
3026 superuser_path=$withval
3032 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3033 IPV4_IN6_HACK_MSG="no"
3035 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3037 if test "x$withval" != "xno" ; then
3039 AC_DEFINE(IPV4_IN_IPV6)
3040 IPV4_IN6_HACK_MSG="yes"
3045 if test "x$inet6_default_4in6" = "xyes"; then
3046 AC_MSG_RESULT([yes (default)])
3047 AC_DEFINE(IPV4_IN_IPV6)
3048 IPV4_IN6_HACK_MSG="yes"
3050 AC_MSG_RESULT([no (default)])
3055 # Whether to enable BSD auth support
3057 AC_ARG_WITH(bsd-auth,
3058 [ --with-bsd-auth Enable BSD auth support],
3060 if test "x$withval" != "xno" ; then
3067 # Where to place sshd.pid
3069 # make sure the directory exists
3070 if test ! -d $piddir ; then
3071 piddir=`eval echo ${sysconfdir}`
3073 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3077 AC_ARG_WITH(pid-dir,
3078 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3080 if test -n "$withval" && test "x$withval" != "xno" && \
3081 test "x${withval}" != "xyes"; then
3083 if test ! -d $piddir ; then
3084 AC_MSG_WARN([** no $piddir directory on this system **])
3090 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
3093 dnl allow user to disable some login recording features
3094 AC_ARG_ENABLE(lastlog,
3095 [ --disable-lastlog disable use of lastlog even if detected [no]],
3097 if test "x$enableval" = "xno" ; then
3098 AC_DEFINE(DISABLE_LASTLOG)
3103 [ --disable-utmp disable use of utmp even if detected [no]],
3105 if test "x$enableval" = "xno" ; then
3106 AC_DEFINE(DISABLE_UTMP)
3110 AC_ARG_ENABLE(utmpx,
3111 [ --disable-utmpx disable use of utmpx even if detected [no]],
3113 if test "x$enableval" = "xno" ; then
3114 AC_DEFINE(DISABLE_UTMPX)
3119 [ --disable-wtmp disable use of wtmp even if detected [no]],
3121 if test "x$enableval" = "xno" ; then
3122 AC_DEFINE(DISABLE_WTMP)
3126 AC_ARG_ENABLE(wtmpx,
3127 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
3129 if test "x$enableval" = "xno" ; then
3130 AC_DEFINE(DISABLE_WTMPX)
3134 AC_ARG_ENABLE(libutil,
3135 [ --disable-libutil disable use of libutil (login() etc.) [no]],
3137 if test "x$enableval" = "xno" ; then
3138 AC_DEFINE(DISABLE_LOGIN)
3142 AC_ARG_ENABLE(pututline,
3143 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
3145 if test "x$enableval" = "xno" ; then
3146 AC_DEFINE(DISABLE_PUTUTLINE)
3150 AC_ARG_ENABLE(pututxline,
3151 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
3153 if test "x$enableval" = "xno" ; then
3154 AC_DEFINE(DISABLE_PUTUTXLINE)
3158 AC_ARG_WITH(lastlog,
3159 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
3161 if test "x$withval" = "xno" ; then
3162 AC_DEFINE(DISABLE_LASTLOG)
3163 elif test -n "$withval" && test "x${withval}" != "xyes"; then
3164 conf_lastlog_location=$withval
3169 dnl lastlog, [uw]tmpx? detection
3170 dnl NOTE: set the paths in the platform section to avoid the
3171 dnl need for command-line parameters
3172 dnl lastlog and [uw]tmp are subject to a file search if all else fails
3174 dnl lastlog detection
3175 dnl NOTE: the code itself will detect if lastlog is a directory
3176 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3178 #include <sys/types.h>
3180 #ifdef HAVE_LASTLOG_H
3181 # include <lastlog.h>
3190 [ char *lastlog = LASTLOG_FILE; ],
3191 [ AC_MSG_RESULT(yes) ],
3194 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3196 #include <sys/types.h>
3198 #ifdef HAVE_LASTLOG_H
3199 # include <lastlog.h>
3205 [ char *lastlog = _PATH_LASTLOG; ],
3206 [ AC_MSG_RESULT(yes) ],
3209 system_lastlog_path=no
3214 if test -z "$conf_lastlog_location"; then
3215 if test x"$system_lastlog_path" = x"no" ; then
3216 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3217 if (test -d "$f" || test -f "$f") ; then
3218 conf_lastlog_location=$f
3221 if test -z "$conf_lastlog_location"; then
3222 AC_MSG_WARN([** Cannot find lastlog **])
3223 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
3228 if test -n "$conf_lastlog_location"; then
3229 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
3233 AC_MSG_CHECKING([if your system defines UTMP_FILE])
3235 #include <sys/types.h>
3241 [ char *utmp = UTMP_FILE; ],
3242 [ AC_MSG_RESULT(yes) ],
3244 system_utmp_path=no ]
3246 if test -z "$conf_utmp_location"; then
3247 if test x"$system_utmp_path" = x"no" ; then
3248 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3249 if test -f $f ; then
3250 conf_utmp_location=$f
3253 if test -z "$conf_utmp_location"; then
3254 AC_DEFINE(DISABLE_UTMP)
3258 if test -n "$conf_utmp_location"; then
3259 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
3263 AC_MSG_CHECKING([if your system defines WTMP_FILE])
3265 #include <sys/types.h>
3271 [ char *wtmp = WTMP_FILE; ],
3272 [ AC_MSG_RESULT(yes) ],
3274 system_wtmp_path=no ]
3276 if test -z "$conf_wtmp_location"; then
3277 if test x"$system_wtmp_path" = x"no" ; then
3278 for f in /usr/adm/wtmp /var/log/wtmp; do
3279 if test -f $f ; then
3280 conf_wtmp_location=$f
3283 if test -z "$conf_wtmp_location"; then
3284 AC_DEFINE(DISABLE_WTMP)
3288 if test -n "$conf_wtmp_location"; then
3289 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
3293 dnl utmpx detection - I don't know any system so perverse as to require
3294 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3296 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3298 #include <sys/types.h>
3307 [ char *utmpx = UTMPX_FILE; ],
3308 [ AC_MSG_RESULT(yes) ],
3310 system_utmpx_path=no ]
3312 if test -z "$conf_utmpx_location"; then
3313 if test x"$system_utmpx_path" = x"no" ; then
3314 AC_DEFINE(DISABLE_UTMPX)
3317 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
3321 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3323 #include <sys/types.h>
3332 [ char *wtmpx = WTMPX_FILE; ],
3333 [ AC_MSG_RESULT(yes) ],
3335 system_wtmpx_path=no ]
3337 if test -z "$conf_wtmpx_location"; then
3338 if test x"$system_wtmpx_path" = x"no" ; then
3339 AC_DEFINE(DISABLE_WTMPX)
3342 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
3346 if test ! -z "$blibpath" ; then
3347 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3348 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3351 dnl remove pam and dl because they are in $LIBPAM
3352 if test "$PAM_MSG" = yes ; then
3353 LIBS=`echo $LIBS | sed 's/-lpam //'`
3355 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3356 LIBS=`echo $LIBS | sed 's/-ldl //'`
3360 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3361 scard/Makefile ssh_prng_cmds survey.sh])
3364 # Print summary of options
3366 # Someone please show me a better way :)
3367 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3368 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3369 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3370 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3371 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3372 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3373 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
3374 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3375 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3376 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3379 echo "OpenSSH has been configured with the following options:"
3380 echo " User binaries: $B"
3381 echo " System binaries: $C"
3382 echo " Configuration files: $D"
3383 echo " Askpass program: $E"
3384 echo " Manual pages: $F"
3385 echo " PID file: $G"
3386 echo " Privilege separation chroot path: $H"
3387 if test "x$external_path_file" = "x/etc/login.conf" ; then
3388 echo " At runtime, sshd will use the path defined in $external_path_file"
3389 echo " Make sure the path to scp is present, otherwise scp will not work"
3391 echo " sshd default user PATH: $I"
3392 if test ! -z "$external_path_file"; then
3393 echo " (If PATH is set in $external_path_file it will be used instead. If"
3394 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3397 if test ! -z "$superuser_path" ; then
3398 echo " sshd superuser user PATH: $J"
3400 echo " Manpage format: $MANTYPE"
3401 echo " PAM support: $PAM_MSG"
3402 echo " KerberosV support: $KRB5_MSG"
3403 echo " Smartcard support: $SCARD_MSG"
3404 echo " S/KEY support: $SKEY_MSG"
3405 echo " TCP Wrappers support: $TCPW_MSG"
3406 echo " MD5 password support: $MD5_MSG"
3407 echo " libedit support: $LIBEDIT_MSG"
3408 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
3409 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3410 echo " BSD Auth support: $BSD_AUTH_MSG"
3411 echo " Random number source: $RAND_MSG"
3412 if test ! -z "$USE_RAND_HELPER" ; then
3413 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
3418 echo " Host: ${host}"
3419 echo " Compiler: ${CC}"
3420 echo " Compiler flags: ${CFLAGS}"
3421 echo "Preprocessor flags: ${CPPFLAGS}"
3422 echo " Linker flags: ${LDFLAGS}"
3423 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
3427 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
3428 echo "SVR4 style packages are supported with \"make package\""
3432 if test "x$PAM_MSG" = "xyes" ; then
3433 echo "PAM is enabled. You may need to install a PAM control file "
3434 echo "for sshd, otherwise password authentication may fail. "
3435 echo "Example PAM control files can be found in the contrib/ "
3440 if test ! -z "$RAND_HELPER_CMDHASH" ; then
3441 echo "WARNING: you are using the builtin random number collection "
3442 echo "service. Please read WARNING.RNG and request that your OS "
3443 echo "vendor includes kernel-based random number collection in "
3444 echo "future versions of your OS."
3448 if test ! -z "$NO_PEERCHECK" ; then
3449 echo "WARNING: the operating system that you are using does not "
3450 echo "appear to support either the getpeereid() API nor the "
3451 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3452 echo "enforce security checks to prevent unauthorised connections to "
3453 echo "ssh-agent. Their absence increases the risk that a malicious "
3454 echo "user can connect to your agent. "
3458 if test "$AUDIT_MODULE" = "bsm" ; then
3459 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3460 echo "See the Solaris section in README.platform for details."