1 # $Id: configure.ac,v 1.275 2005/06/07 07:53:40 dtucker Exp $
3 # Copyright (c) 1999-2004 Damien Miller
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 AC_INIT(OpenSSH, Portable, 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"
86 if test -z "$have_llong_max"; then
87 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
88 unset ac_cv_have_decl_LLONG_MAX
89 saved_CFLAGS="$CFLAGS"
90 CFLAGS="$CFLAGS -std=gnu99"
91 AC_CHECK_DECL(LLONG_MAX,
93 [CFLAGS="$saved_CFLAGS"],
99 if test -z "$have_llong_max"; then
100 AC_MSG_CHECKING([for max value of long long])
104 /* Why is this so damn hard? */
110 #define DATA "conftest.llminmax"
113 long long i, llmin, llmax = 0;
115 if((f = fopen(DATA,"w")) == NULL)
118 #if defined(LLONG_MIN) && defined(LLONG_MAX)
119 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
123 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
124 /* This will work on one's complement and two's complement */
125 for (i = 1; i > llmax; i <<= 1, i++)
127 llmin = llmax + 1LL; /* wrap */
131 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
132 || llmax - 1 > llmax) {
133 fprintf(f, "unknown unknown\n");
137 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
144 llong_min=`$AWK '{print $1}' conftest.llminmax`
145 llong_max=`$AWK '{print $2}' conftest.llminmax`
146 AC_MSG_RESULT($llong_max)
147 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
148 [max value of long long calculated by configure])
149 AC_MSG_CHECKING([for min value of long long])
150 AC_MSG_RESULT($llong_min)
151 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
152 [min value of long long calculated by configure])
155 AC_MSG_RESULT(not found)
158 AC_MSG_WARN([cross compiling: not checking])
164 [ --without-rpath Disable auto-added -R linker paths],
166 if test "x$withval" = "xno" ; then
169 if test "x$withval" = "xyes" ; then
175 # Check for some target-specific stuff
178 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
179 if (test -z "$blibpath"); then
180 blibpath="/usr/lib:/lib"
182 saved_LDFLAGS="$LDFLAGS"
183 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
184 if (test -z "$blibflags"); then
185 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
186 AC_TRY_LINK([], [], [blibflags=$tryflags])
189 if (test -z "$blibflags"); then
190 AC_MSG_RESULT(not found)
191 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
193 AC_MSG_RESULT($blibflags)
195 LDFLAGS="$saved_LDFLAGS"
196 dnl Check for authenticate. Might be in libs.a on older AIXes
197 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
198 [AC_CHECK_LIB(s,authenticate,
199 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
203 dnl Check for various auth function declarations in headers.
204 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
205 passwdexpired, setauthdb], , , [#include <usersec.h>])
206 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
207 AC_CHECK_DECLS(loginfailed,
208 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
210 [#include <usersec.h>],
211 [(void)loginfailed("user","host","tty",0);],
213 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
217 [#include <usersec.h>]
219 AC_CHECK_FUNCS(setauthdb)
220 check_for_aix_broken_getaddrinfo=1
221 AC_DEFINE(BROKEN_REALPATH)
222 AC_DEFINE(SETEUID_BREAKS_SETUID)
223 AC_DEFINE(BROKEN_SETREUID)
224 AC_DEFINE(BROKEN_SETREGID)
225 dnl AIX handles lastlog as part of its login message
226 AC_DEFINE(DISABLE_LASTLOG)
227 AC_DEFINE(LOGIN_NEEDS_UTMPX)
228 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
231 check_for_libcrypt_later=1
232 LIBS="$LIBS /usr/lib/textmode.o"
233 AC_DEFINE(HAVE_CYGWIN)
235 AC_DEFINE(DISABLE_SHADOW)
236 AC_DEFINE(IP_TOS_IS_BROKEN)
237 AC_DEFINE(NO_X11_UNIX_SOCKETS)
238 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
239 AC_DEFINE(DISABLE_FD_PASSING)
242 AC_DEFINE(IP_TOS_IS_BROKEN)
243 AC_DEFINE(SETEUID_BREAKS_SETUID)
244 AC_DEFINE(BROKEN_SETREUID)
245 AC_DEFINE(BROKEN_SETREGID)
248 AC_MSG_CHECKING(if we have working getaddrinfo)
249 AC_TRY_RUN([#include <mach-o/dyld.h>
250 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
254 }], [AC_MSG_RESULT(working)],
255 [AC_MSG_RESULT(buggy)
256 AC_DEFINE(BROKEN_GETADDRINFO)],
257 [AC_MSG_RESULT(assume it is working)])
258 AC_DEFINE(SETEUID_BREAKS_SETUID)
259 AC_DEFINE(BROKEN_SETREUID)
260 AC_DEFINE(BROKEN_SETREGID)
261 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
264 # first we define all of the options common to all HP-UX releases
265 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
266 IPADDR_IN_DISPLAY=yes
268 AC_DEFINE(LOGIN_NO_ENDOPT)
269 AC_DEFINE(LOGIN_NEEDS_UTMPX)
270 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
271 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
273 AC_CHECK_LIB(xnet, t_error, ,
274 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
276 # next, we define all of the options specific to major releases
279 if test -z "$GCC"; then
284 AC_DEFINE(PAM_SUN_CODEBASE)
285 AC_DEFINE(DISABLE_UTMP)
286 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
287 check_for_hpux_broken_getaddrinfo=1
288 check_for_conflicting_getspnam=1
292 # lastly, we define options specific to minor releases
295 AC_DEFINE(HAVE_SECUREWARE)
296 disable_ptmx_check=yes
302 PATH="$PATH:/usr/etc"
303 AC_DEFINE(BROKEN_INET_NTOA)
304 AC_DEFINE(SETEUID_BREAKS_SETUID)
305 AC_DEFINE(BROKEN_SETREUID)
306 AC_DEFINE(BROKEN_SETREGID)
307 AC_DEFINE(WITH_ABBREV_NO_TTY)
308 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
311 PATH="$PATH:/usr/etc"
312 AC_DEFINE(WITH_IRIX_ARRAY)
313 AC_DEFINE(WITH_IRIX_PROJECT)
314 AC_DEFINE(WITH_IRIX_AUDIT)
315 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
316 AC_DEFINE(BROKEN_INET_NTOA)
317 AC_DEFINE(SETEUID_BREAKS_SETUID)
318 AC_DEFINE(BROKEN_SETREUID)
319 AC_DEFINE(BROKEN_SETREGID)
320 AC_DEFINE(BROKEN_UPDWTMPX)
321 AC_DEFINE(WITH_ABBREV_NO_TTY)
322 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
326 check_for_libcrypt_later=1
327 check_for_openpty_ctty_bug=1
328 AC_DEFINE(DONT_TRY_OTHER_AF)
329 AC_DEFINE(PAM_TTY_KLUDGE)
330 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
331 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
332 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
333 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
334 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
335 inet6_default_4in6=yes
338 AC_DEFINE(BROKEN_CMSG_TYPE)
342 mips-sony-bsd|mips-sony-newsos4)
343 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
347 check_for_libcrypt_before=1
348 if test "x$withval" != "xno" ; then
353 check_for_libcrypt_later=1
356 AC_DEFINE(SETEUID_BREAKS_SETUID)
357 AC_DEFINE(BROKEN_SETREUID)
358 AC_DEFINE(BROKEN_SETREGID)
361 conf_lastlog_location="/usr/adm/lastlog"
362 conf_utmp_location=/etc/utmp
363 conf_wtmp_location=/usr/adm/wtmp
366 AC_DEFINE(BROKEN_REALPATH)
368 AC_DEFINE(BROKEN_SAVED_UIDS)
371 if test "x$withval" != "xno" ; then
374 AC_DEFINE(PAM_SUN_CODEBASE)
375 AC_DEFINE(LOGIN_NEEDS_UTMPX)
376 AC_DEFINE(LOGIN_NEEDS_TERM)
377 AC_DEFINE(PAM_TTY_KLUDGE)
378 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
379 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
380 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
381 AC_DEFINE(SSHD_ACQUIRES_CTTY)
382 external_path_file=/etc/default/login
383 # hardwire lastlog location (can't detect it on some versions)
384 conf_lastlog_location="/var/adm/lastlog"
385 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
386 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
387 if test "$sol2ver" -ge 8; then
389 AC_DEFINE(DISABLE_UTMP)
390 AC_DEFINE(DISABLE_WTMP)
396 CPPFLAGS="$CPPFLAGS -DSUNOS4"
397 AC_CHECK_FUNCS(getpwanam)
398 AC_DEFINE(PAM_SUN_CODEBASE)
399 conf_utmp_location=/etc/utmp
400 conf_wtmp_location=/var/adm/wtmp
401 conf_lastlog_location=/var/adm/lastlog
407 AC_DEFINE(SSHD_ACQUIRES_CTTY)
408 AC_DEFINE(SETEUID_BREAKS_SETUID)
409 AC_DEFINE(BROKEN_SETREUID)
410 AC_DEFINE(BROKEN_SETREGID)
413 # /usr/ucblib MUST NOT be searched on ReliantUNIX
414 AC_CHECK_LIB(dl, dlsym, ,)
415 # -lresolv needs to be at then end of LIBS or DNS lookups break
416 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
417 IPADDR_IN_DISPLAY=yes
419 AC_DEFINE(IP_TOS_IS_BROKEN)
420 AC_DEFINE(SETEUID_BREAKS_SETUID)
421 AC_DEFINE(BROKEN_SETREUID)
422 AC_DEFINE(BROKEN_SETREGID)
423 AC_DEFINE(SSHD_ACQUIRES_CTTY)
424 external_path_file=/etc/default/login
425 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
426 # Attention: always take care to bind libsocket and libnsl before libc,
427 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
429 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
432 AC_DEFINE(SETEUID_BREAKS_SETUID)
433 AC_DEFINE(BROKEN_SETREUID)
434 AC_DEFINE(BROKEN_SETREGID)
435 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
437 # UnixWare 7.x, OpenUNIX 8
440 AC_DEFINE(SETEUID_BREAKS_SETUID)
441 AC_DEFINE(BROKEN_SETREUID)
442 AC_DEFINE(BROKEN_SETREGID)
443 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
445 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
446 TEST_SHELL=/u95/bin/sh
452 # SCO UNIX and OEM versions of SCO UNIX
454 AC_MSG_ERROR("This Platform is no longer supported.")
458 if test -z "$GCC"; then
459 CFLAGS="$CFLAGS -belf"
461 LIBS="$LIBS -lprot -lx -ltinfo -lm"
464 AC_DEFINE(HAVE_SECUREWARE)
465 AC_DEFINE(DISABLE_SHADOW)
466 AC_DEFINE(DISABLE_FD_PASSING)
467 AC_DEFINE(SETEUID_BREAKS_SETUID)
468 AC_DEFINE(BROKEN_SETREUID)
469 AC_DEFINE(BROKEN_SETREGID)
470 AC_DEFINE(WITH_ABBREV_NO_TTY)
471 AC_DEFINE(BROKEN_UPDWTMPX)
472 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
473 AC_CHECK_FUNCS(getluid setluid)
478 AC_DEFINE(NO_SSH_LASTLOG)
479 AC_DEFINE(SETEUID_BREAKS_SETUID)
480 AC_DEFINE(BROKEN_SETREUID)
481 AC_DEFINE(BROKEN_SETREGID)
483 AC_DEFINE(DISABLE_FD_PASSING)
485 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
489 AC_DEFINE(SETEUID_BREAKS_SETUID)
490 AC_DEFINE(BROKEN_SETREUID)
491 AC_DEFINE(BROKEN_SETREGID)
492 AC_DEFINE(WITH_ABBREV_NO_TTY)
494 AC_DEFINE(DISABLE_FD_PASSING)
496 LIBS="$LIBS -lgen -lacid -ldb"
500 AC_DEFINE(SETEUID_BREAKS_SETUID)
501 AC_DEFINE(BROKEN_SETREUID)
502 AC_DEFINE(BROKEN_SETREGID)
504 AC_DEFINE(DISABLE_FD_PASSING)
505 AC_DEFINE(NO_SSH_LASTLOG)
506 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
507 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
511 AC_MSG_CHECKING(for Digital Unix SIA)
514 [ --with-osfsia Enable Digital Unix SIA],
516 if test "x$withval" = "xno" ; then
517 AC_MSG_RESULT(disabled)
522 if test -z "$no_osfsia" ; then
523 if test -f /etc/sia/matrix.conf; then
525 AC_DEFINE(HAVE_OSF_SIA)
526 AC_DEFINE(DISABLE_LOGIN)
527 AC_DEFINE(DISABLE_FD_PASSING)
528 LIBS="$LIBS -lsecurity -ldb -lm -laud"
531 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
534 AC_DEFINE(BROKEN_GETADDRINFO)
535 AC_DEFINE(SETEUID_BREAKS_SETUID)
536 AC_DEFINE(BROKEN_SETREUID)
537 AC_DEFINE(BROKEN_SETREGID)
542 AC_DEFINE(NO_X11_UNIX_SOCKETS)
543 AC_DEFINE(MISSING_NFDBITS)
544 AC_DEFINE(MISSING_HOWMANY)
545 AC_DEFINE(MISSING_FD_MASK)
549 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
550 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
551 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
552 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
556 # Allow user to specify flags
558 [ --with-cflags Specify additional flags to pass to compiler],
560 if test -n "$withval" && test "x$withval" != "xno" && \
561 test "x${withval}" != "xyes"; then
562 CFLAGS="$CFLAGS $withval"
566 AC_ARG_WITH(cppflags,
567 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
569 if test -n "$withval" && test "x$withval" != "xno" && \
570 test "x${withval}" != "xyes"; then
571 CPPFLAGS="$CPPFLAGS $withval"
576 [ --with-ldflags Specify additional flags to pass to linker],
578 if test -n "$withval" && test "x$withval" != "xno" && \
579 test "x${withval}" != "xyes"; then
580 LDFLAGS="$LDFLAGS $withval"
585 [ --with-libs Specify additional libraries to link with],
587 if test -n "$withval" && test "x$withval" != "xno" && \
588 test "x${withval}" != "xyes"; then
589 LIBS="$LIBS $withval"
594 AC_MSG_CHECKING(compiler and flags for sanity)
600 [ AC_MSG_RESULT(yes) ],
603 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
605 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
608 dnl Checks for header files.
633 security/pam_appl.h \
669 # sys/ptms.h requires sys/stream.h to be included first on Solaris
670 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
671 #ifdef HAVE_SYS_STREAM_H
672 # include <sys/stream.h>
676 # Checks for libraries.
677 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
678 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
680 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
681 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
682 AC_CHECK_LIB(gen, dirname,[
683 AC_CACHE_CHECK([for broken dirname],
684 ac_cv_have_broken_dirname, [
692 int main(int argc, char **argv) {
695 strncpy(buf,"/etc", 32);
697 if (!s || strncmp(s, "/", 32) != 0) {
704 [ ac_cv_have_broken_dirname="no" ],
705 [ ac_cv_have_broken_dirname="yes" ]
709 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
711 AC_DEFINE(HAVE_DIRNAME)
712 AC_CHECK_HEADERS(libgen.h)
717 AC_CHECK_FUNC(getspnam, ,
718 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
719 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
723 [ --with-zlib=PATH Use zlib in PATH],
724 [ if test "x$withval" = "xno" ; then
725 AC_MSG_ERROR([*** zlib is required ***])
726 elif test "x$withval" != "xyes"; then
727 if test -d "$withval/lib"; then
728 if test -n "${need_dash_r}"; then
729 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
731 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
734 if test -n "${need_dash_r}"; then
735 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
737 LDFLAGS="-L${withval} ${LDFLAGS}"
740 if test -d "$withval/include"; then
741 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
743 CPPFLAGS="-I${withval} ${CPPFLAGS}"
748 AC_CHECK_LIB(z, deflate, ,
750 saved_CPPFLAGS="$CPPFLAGS"
751 saved_LDFLAGS="$LDFLAGS"
753 dnl Check default zlib install dir
754 if test -n "${need_dash_r}"; then
755 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
757 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
759 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
761 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
763 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
768 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
770 AC_ARG_WITH(zlib-version-check,
771 [ --without-zlib-version-check Disable zlib version check],
772 [ if test "x$withval" = "xno" ; then
773 zlib_check_nonfatal=1
778 AC_MSG_CHECKING(for possibly buggy zlib)
779 AC_RUN_IFELSE([AC_LANG_SOURCE([[
784 int a=0, b=0, c=0, d=0, n, v;
785 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
786 if (n != 3 && n != 4)
788 v = a*1000000 + b*10000 + c*100 + d;
789 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
792 if (a == 1 && b == 1 && c >= 4)
795 /* 1.2.1.2 and up are OK */
804 if test -z "$zlib_check_nonfatal" ; then
805 AC_MSG_ERROR([*** zlib too old - check config.log ***
806 Your reported zlib version has known security problems. It's possible your
807 vendor has fixed these problems without changing the version number. If you
808 are sure this is the case, you can disable the check by running
809 "./configure --without-zlib-version-check".
810 If you are in doubt, upgrade zlib to version 1.2.1.2 or greater.
811 See http://www.gzip.org/zlib/ for details.])
813 AC_MSG_WARN([zlib version may have security problems])
816 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
820 AC_CHECK_FUNC(strcasecmp,
821 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
823 AC_CHECK_FUNC(utimes,
824 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
825 LIBS="$LIBS -lc89"]) ]
828 dnl Checks for libutil functions
829 AC_CHECK_HEADERS(libutil.h)
830 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
831 AC_CHECK_FUNCS(logout updwtmp logwtmp)
835 # Check for ALTDIRFUNC glob() extension
836 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
837 AC_EGREP_CPP(FOUNDIT,
840 #ifdef GLOB_ALTDIRFUNC
845 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
853 # Check for g.gl_matchc glob() extension
854 AC_MSG_CHECKING(for gl_matchc field in glob_t)
855 AC_EGREP_CPP(FOUNDIT,
858 int main(void){glob_t g; g.gl_matchc = 1;}
861 AC_DEFINE(GLOB_HAS_GL_MATCHC)
869 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
872 #include <sys/types.h>
874 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
876 [AC_MSG_RESULT(yes)],
879 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
882 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
883 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
887 AC_MSG_CHECKING([for /proc/pid/fd directory])
888 if test -d "/proc/$$/fd" ; then
889 AC_DEFINE(HAVE_PROC_PID)
895 # Check whether user wants S/Key support
898 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
900 if test "x$withval" != "xno" ; then
902 if test "x$withval" != "xyes" ; then
903 CPPFLAGS="$CPPFLAGS -I${withval}/include"
904 LDFLAGS="$LDFLAGS -L${withval}/lib"
911 AC_MSG_CHECKING([for s/key support])
916 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
918 [AC_MSG_RESULT(yes)],
921 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
923 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
927 [(void)skeychallenge(NULL,"name","",0);],
929 AC_DEFINE(SKEYCHALLENGE_4ARG)],
936 # Check whether user wants TCP wrappers support
938 AC_ARG_WITH(tcp-wrappers,
939 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
941 if test "x$withval" != "xno" ; then
943 saved_LDFLAGS="$LDFLAGS"
944 saved_CPPFLAGS="$CPPFLAGS"
945 if test -n "${withval}" && \
946 test "x${withval}" != "xyes"; then
947 if test -d "${withval}/lib"; then
948 if test -n "${need_dash_r}"; then
949 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
951 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
954 if test -n "${need_dash_r}"; then
955 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
957 LDFLAGS="-L${withval} ${LDFLAGS}"
960 if test -d "${withval}/include"; then
961 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
963 CPPFLAGS="-I${withval} ${CPPFLAGS}"
967 LIBS="$LIBWRAP $LIBS"
968 AC_MSG_CHECKING(for libwrap)
971 #include <sys/types.h>
972 #include <sys/socket.h>
973 #include <netinet/in.h>
975 int deny_severity = 0, allow_severity = 0;
985 AC_MSG_ERROR([*** libwrap missing])
993 # Check whether user wants libedit support
996 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
997 [ if test "x$withval" != "xno" ; then
998 if test "x$withval" != "xyes"; then
999 CPPFLAGS="$CPPFLAGS -I$withval/include"
1000 LDFLAGS="$LDFLAGS -L$withval/lib"
1002 AC_CHECK_LIB(edit, el_init,
1003 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
1004 LIBEDIT="-ledit -lcurses"
1008 [ AC_MSG_ERROR(libedit not found) ],
1016 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1018 AC_MSG_CHECKING(for supported audit module)
1023 dnl Checks for headers, libs and functions
1024 AC_CHECK_HEADERS(bsm/audit.h, [],
1025 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1026 AC_CHECK_LIB(bsm, getaudit, [],
1027 [AC_MSG_ERROR(BSM enabled and required library not found)])
1028 AC_CHECK_FUNCS(getaudit, [],
1029 [AC_MSG_ERROR(BSM enabled and required function not found)])
1030 # These are optional
1031 AC_CHECK_FUNCS(getaudit_addr)
1032 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
1036 AC_MSG_RESULT(debug)
1037 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
1040 AC_MSG_ERROR([Unknown audit module $withval])
1045 dnl Checks for library functions. Please keep in alphabetical order
1130 # IRIX has a const char return value for gai_strerror()
1131 AC_CHECK_FUNCS(gai_strerror,[
1132 AC_DEFINE(HAVE_GAI_STRERROR)
1134 #include <sys/types.h>
1135 #include <sys/socket.h>
1138 const char *gai_strerror(int);],[
1141 str = gai_strerror(0);],[
1142 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1143 [Define if gai_strerror() returns const char *])])])
1145 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1147 dnl Make sure prototypes are defined for these before using them.
1148 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1149 AC_CHECK_DECL(strsep,
1150 [AC_CHECK_FUNCS(strsep)],
1153 #ifdef HAVE_STRING_H
1154 # include <string.h>
1158 dnl tcsendbreak might be a macro
1159 AC_CHECK_DECL(tcsendbreak,
1160 [AC_DEFINE(HAVE_TCSENDBREAK)],
1161 [AC_CHECK_FUNCS(tcsendbreak)],
1162 [#include <termios.h>]
1165 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1167 AC_CHECK_FUNCS(setresuid, [
1168 dnl Some platorms have setresuid that isn't implemented, test for this
1169 AC_MSG_CHECKING(if setresuid seems to work)
1174 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1176 [AC_MSG_RESULT(yes)],
1177 [AC_DEFINE(BROKEN_SETRESUID)
1178 AC_MSG_RESULT(not implemented)],
1179 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1183 AC_CHECK_FUNCS(setresgid, [
1184 dnl Some platorms have setresgid that isn't implemented, test for this
1185 AC_MSG_CHECKING(if setresgid seems to work)
1190 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1192 [AC_MSG_RESULT(yes)],
1193 [AC_DEFINE(BROKEN_SETRESGID)
1194 AC_MSG_RESULT(not implemented)],
1195 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1199 dnl Checks for time functions
1200 AC_CHECK_FUNCS(gettimeofday time)
1201 dnl Checks for utmp functions
1202 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1203 AC_CHECK_FUNCS(utmpname)
1204 dnl Checks for utmpx functions
1205 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1206 AC_CHECK_FUNCS(setutxent utmpxname)
1208 AC_CHECK_FUNC(daemon,
1209 [AC_DEFINE(HAVE_DAEMON)],
1210 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1213 AC_CHECK_FUNC(getpagesize,
1214 [AC_DEFINE(HAVE_GETPAGESIZE)],
1215 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1218 # Check for broken snprintf
1219 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1220 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1224 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1226 [AC_MSG_RESULT(yes)],
1229 AC_DEFINE(BROKEN_SNPRINTF)
1230 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1232 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1236 # Check for missing getpeereid (or equiv) support
1238 if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1239 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1241 [#include <sys/types.h>
1242 #include <sys/socket.h>],
1243 [int i = SO_PEERCRED;],
1244 [ AC_MSG_RESULT(yes)
1245 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1252 dnl see whether mkstemp() requires XXXXXX
1253 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1254 AC_MSG_CHECKING([for (overly) strict mkstemp])
1258 main() { char template[]="conftest.mkstemp-test";
1259 if (mkstemp(template) == -1)
1261 unlink(template); exit(0);
1269 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1273 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1278 dnl make sure that openpty does not reacquire controlling terminal
1279 if test ! -z "$check_for_openpty_ctty_bug"; then
1280 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1284 #include <sys/fcntl.h>
1285 #include <sys/types.h>
1286 #include <sys/wait.h>
1292 int fd, ptyfd, ttyfd, status;
1295 if (pid < 0) { /* failed */
1297 } else if (pid > 0) { /* parent */
1298 waitpid(pid, &status, 0);
1299 if (WIFEXITED(status))
1300 exit(WEXITSTATUS(status));
1303 } else { /* child */
1304 close(0); close(1); close(2);
1306 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1307 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1309 exit(3); /* Acquired ctty: broken */
1311 exit(0); /* Did not acquire ctty: OK */
1320 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1325 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1326 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1327 AC_MSG_CHECKING(if getaddrinfo seems to work)
1331 #include <sys/socket.h>
1334 #include <netinet/in.h>
1336 #define TEST_PORT "2222"
1342 struct addrinfo *gai_ai, *ai, hints;
1343 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1345 memset(&hints, 0, sizeof(hints));
1346 hints.ai_family = PF_UNSPEC;
1347 hints.ai_socktype = SOCK_STREAM;
1348 hints.ai_flags = AI_PASSIVE;
1350 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1352 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1356 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1357 if (ai->ai_family != AF_INET6)
1360 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1361 sizeof(ntop), strport, sizeof(strport),
1362 NI_NUMERICHOST|NI_NUMERICSERV);
1365 if (err == EAI_SYSTEM)
1366 perror("getnameinfo EAI_SYSTEM");
1368 fprintf(stderr, "getnameinfo failed: %s\n",
1373 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1376 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1389 AC_DEFINE(BROKEN_GETADDRINFO)
1394 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1395 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1396 AC_MSG_CHECKING(if getaddrinfo seems to work)
1400 #include <sys/socket.h>
1403 #include <netinet/in.h>
1405 #define TEST_PORT "2222"
1411 struct addrinfo *gai_ai, *ai, hints;
1412 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1414 memset(&hints, 0, sizeof(hints));
1415 hints.ai_family = PF_UNSPEC;
1416 hints.ai_socktype = SOCK_STREAM;
1417 hints.ai_flags = AI_PASSIVE;
1419 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1421 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1425 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1426 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1429 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1430 sizeof(ntop), strport, sizeof(strport),
1431 NI_NUMERICHOST|NI_NUMERICSERV);
1433 if (ai->ai_family == AF_INET && err != 0) {
1434 perror("getnameinfo");
1443 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1444 [Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1448 AC_DEFINE(BROKEN_GETADDRINFO)
1453 if test "x$check_for_conflicting_getspnam" = "x1"; then
1454 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1458 int main(void) {exit(0);}
1465 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1466 [Conflicting defs for getspnam])
1473 # Check for PAM libs
1476 [ --with-pam Enable PAM support ],
1478 if test "x$withval" != "xno" ; then
1479 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1480 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1481 AC_MSG_ERROR([PAM headers not found])
1484 AC_CHECK_LIB(dl, dlopen, , )
1485 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1486 AC_CHECK_FUNCS(pam_getenvlist)
1487 AC_CHECK_FUNCS(pam_putenv)
1492 if test $ac_cv_lib_dl_dlopen = yes; then
1502 # Check for older PAM
1503 if test "x$PAM_MSG" = "xyes" ; then
1504 # Check PAM strerror arguments (old PAM)
1505 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1509 #if defined(HAVE_SECURITY_PAM_APPL_H)
1510 #include <security/pam_appl.h>
1511 #elif defined (HAVE_PAM_PAM_APPL_H)
1512 #include <pam/pam_appl.h>
1515 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1516 [AC_MSG_RESULT(no)],
1518 AC_DEFINE(HAVE_OLD_PAM)
1520 PAM_MSG="yes (old library)"
1525 # Search for OpenSSL
1526 saved_CPPFLAGS="$CPPFLAGS"
1527 saved_LDFLAGS="$LDFLAGS"
1528 AC_ARG_WITH(ssl-dir,
1529 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1531 if test "x$withval" != "xno" ; then
1534 ./*|../*) withval="`pwd`/$withval"
1536 if test -d "$withval/lib"; then
1537 if test -n "${need_dash_r}"; then
1538 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1540 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1543 if test -n "${need_dash_r}"; then
1544 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1546 LDFLAGS="-L${withval} ${LDFLAGS}"
1549 if test -d "$withval/include"; then
1550 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1552 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1557 LIBS="-lcrypto $LIBS"
1558 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1560 dnl Check default openssl install dir
1561 if test -n "${need_dash_r}"; then
1562 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1564 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1566 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1567 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1569 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1575 # Determine OpenSSL header version
1576 AC_MSG_CHECKING([OpenSSL header version])
1581 #include <openssl/opensslv.h>
1582 #define DATA "conftest.sslincver"
1587 fd = fopen(DATA,"w");
1591 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1598 ssl_header_ver=`cat conftest.sslincver`
1599 AC_MSG_RESULT($ssl_header_ver)
1602 AC_MSG_RESULT(not found)
1603 AC_MSG_ERROR(OpenSSL version header not found.)
1606 AC_MSG_WARN([cross compiling: not checking])
1610 # Determine OpenSSL library version
1611 AC_MSG_CHECKING([OpenSSL library version])
1616 #include <openssl/opensslv.h>
1617 #include <openssl/crypto.h>
1618 #define DATA "conftest.ssllibver"
1623 fd = fopen(DATA,"w");
1627 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1634 ssl_library_ver=`cat conftest.ssllibver`
1635 AC_MSG_RESULT($ssl_library_ver)
1638 AC_MSG_RESULT(not found)
1639 AC_MSG_ERROR(OpenSSL library not found.)
1642 AC_MSG_WARN([cross compiling: not checking])
1646 # Sanity check OpenSSL headers
1647 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1651 #include <openssl/opensslv.h>
1652 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1659 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1660 Check config.log for details.
1661 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1664 AC_MSG_WARN([cross compiling: not checking])
1668 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1669 # because the system crypt() is more featureful.
1670 if test "x$check_for_libcrypt_before" = "x1"; then
1671 AC_CHECK_LIB(crypt, crypt)
1674 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1675 # version in OpenSSL.
1676 if test "x$check_for_libcrypt_later" = "x1"; then
1677 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1681 ### Configure cryptographic random number support
1683 # Check wheter OpenSSL seeds itself
1684 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1688 #include <openssl/rand.h>
1689 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1692 OPENSSL_SEEDS_ITSELF=yes
1697 # Default to use of the rand helper if OpenSSL doesn't
1702 AC_MSG_WARN([cross compiling: assuming yes])
1703 # This is safe, since all recent OpenSSL versions will
1704 # complain at runtime if not seeded correctly.
1705 OPENSSL_SEEDS_ITSELF=yes
1710 # Do we want to force the use of the rand helper?
1711 AC_ARG_WITH(rand-helper,
1712 [ --with-rand-helper Use subprocess to gather strong randomness ],
1714 if test "x$withval" = "xno" ; then
1715 # Force use of OpenSSL's internal RNG, even if
1716 # the previous test showed it to be unseeded.
1717 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1718 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1719 OPENSSL_SEEDS_ITSELF=yes
1728 # Which randomness source do we use?
1729 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
1731 AC_DEFINE(OPENSSL_PRNG_ONLY)
1732 RAND_MSG="OpenSSL internal ONLY"
1733 INSTALL_SSH_RAND_HELPER=""
1734 elif test ! -z "$USE_RAND_HELPER" ; then
1735 # install rand helper
1736 RAND_MSG="ssh-rand-helper"
1737 INSTALL_SSH_RAND_HELPER="yes"
1739 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1741 ### Configuration of ssh-rand-helper
1744 AC_ARG_WITH(prngd-port,
1745 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1754 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1757 if test ! -z "$withval" ; then
1758 PRNGD_PORT="$withval"
1759 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1764 # PRNGD Unix domain socket
1765 AC_ARG_WITH(prngd-socket,
1766 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1770 withval="/var/run/egd-pool"
1778 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1782 if test ! -z "$withval" ; then
1783 if test ! -z "$PRNGD_PORT" ; then
1784 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1786 if test ! -r "$withval" ; then
1787 AC_MSG_WARN(Entropy socket is not readable)
1789 PRNGD_SOCKET="$withval"
1790 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1794 # Check for existing socket only if we don't have a random device already
1795 if test "$USE_RAND_HELPER" = yes ; then
1796 AC_MSG_CHECKING(for PRNGD/EGD socket)
1797 # Insert other locations here
1798 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1799 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1800 PRNGD_SOCKET="$sock"
1801 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1805 if test ! -z "$PRNGD_SOCKET" ; then
1806 AC_MSG_RESULT($PRNGD_SOCKET)
1808 AC_MSG_RESULT(not found)
1814 # Change default command timeout for hashing entropy source
1816 AC_ARG_WITH(entropy-timeout,
1817 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1819 if test -n "$withval" && test "x$withval" != "xno" && \
1820 test "x${withval}" != "xyes"; then
1821 entropy_timeout=$withval
1825 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1827 SSH_PRIVSEP_USER=sshd
1828 AC_ARG_WITH(privsep-user,
1829 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1831 if test -n "$withval" && test "x$withval" != "xno" && \
1832 test "x${withval}" != "xyes"; then
1833 SSH_PRIVSEP_USER=$withval
1837 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1838 AC_SUBST(SSH_PRIVSEP_USER)
1840 # We do this little dance with the search path to insure
1841 # that programs that we select for use by installed programs
1842 # (which may be run by the super-user) come from trusted
1843 # locations before they come from the user's private area.
1844 # This should help avoid accidentally configuring some
1845 # random version of a program in someone's personal bin.
1849 test -h /bin 2> /dev/null && PATH=/usr/bin
1850 test -d /sbin && PATH=$PATH:/sbin
1851 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1852 PATH=$PATH:/etc:$OPATH
1854 # These programs are used by the command hashing source to gather entropy
1855 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1856 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1857 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1858 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1859 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1860 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1861 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1862 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1863 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1864 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1865 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1866 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1867 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1868 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1869 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1870 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1874 # Where does ssh-rand-helper get its randomness from?
1875 INSTALL_SSH_PRNG_CMDS=""
1876 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1877 if test ! -z "$PRNGD_PORT" ; then
1878 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1879 elif test ! -z "$PRNGD_SOCKET" ; then
1880 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1882 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1883 RAND_HELPER_CMDHASH=yes
1884 INSTALL_SSH_PRNG_CMDS="yes"
1887 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1890 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1891 if test ! -z "$SONY" ; then
1892 LIBS="$LIBS -liberty";
1895 # Checks for data types
1896 AC_CHECK_SIZEOF(char, 1)
1897 AC_CHECK_SIZEOF(short int, 2)
1898 AC_CHECK_SIZEOF(int, 4)
1899 AC_CHECK_SIZEOF(long int, 4)
1900 AC_CHECK_SIZEOF(long long int, 8)
1902 # Sanity check long long for some platforms (AIX)
1903 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1904 ac_cv_sizeof_long_long_int=0
1907 # More checks for data types
1908 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1910 [ #include <sys/types.h> ],
1912 [ ac_cv_have_u_int="yes" ],
1913 [ ac_cv_have_u_int="no" ]
1916 if test "x$ac_cv_have_u_int" = "xyes" ; then
1917 AC_DEFINE(HAVE_U_INT)
1921 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1923 [ #include <sys/types.h> ],
1924 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1925 [ ac_cv_have_intxx_t="yes" ],
1926 [ ac_cv_have_intxx_t="no" ]
1929 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1930 AC_DEFINE(HAVE_INTXX_T)
1934 if (test -z "$have_intxx_t" && \
1935 test "x$ac_cv_header_stdint_h" = "xyes")
1937 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1939 [ #include <stdint.h> ],
1940 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1942 AC_DEFINE(HAVE_INTXX_T)
1945 [ AC_MSG_RESULT(no) ]
1949 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1952 #include <sys/types.h>
1953 #ifdef HAVE_STDINT_H
1954 # include <stdint.h>
1956 #include <sys/socket.h>
1957 #ifdef HAVE_SYS_BITYPES_H
1958 # include <sys/bitypes.h>
1961 [ int64_t a; a = 1;],
1962 [ ac_cv_have_int64_t="yes" ],
1963 [ ac_cv_have_int64_t="no" ]
1966 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1967 AC_DEFINE(HAVE_INT64_T)
1970 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1972 [ #include <sys/types.h> ],
1973 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1974 [ ac_cv_have_u_intxx_t="yes" ],
1975 [ ac_cv_have_u_intxx_t="no" ]
1978 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1979 AC_DEFINE(HAVE_U_INTXX_T)
1983 if test -z "$have_u_intxx_t" ; then
1984 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1986 [ #include <sys/socket.h> ],
1987 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1989 AC_DEFINE(HAVE_U_INTXX_T)
1992 [ AC_MSG_RESULT(no) ]
1996 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1998 [ #include <sys/types.h> ],
1999 [ u_int64_t a; a = 1;],
2000 [ ac_cv_have_u_int64_t="yes" ],
2001 [ ac_cv_have_u_int64_t="no" ]
2004 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2005 AC_DEFINE(HAVE_U_INT64_T)
2009 if test -z "$have_u_int64_t" ; then
2010 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2012 [ #include <sys/bitypes.h> ],
2013 [ u_int64_t a; a = 1],
2015 AC_DEFINE(HAVE_U_INT64_T)
2018 [ AC_MSG_RESULT(no) ]
2022 if test -z "$have_u_intxx_t" ; then
2023 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2026 #include <sys/types.h>
2028 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2029 [ ac_cv_have_uintxx_t="yes" ],
2030 [ ac_cv_have_uintxx_t="no" ]
2033 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2034 AC_DEFINE(HAVE_UINTXX_T)
2038 if test -z "$have_uintxx_t" ; then
2039 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2041 [ #include <stdint.h> ],
2042 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2044 AC_DEFINE(HAVE_UINTXX_T)
2047 [ AC_MSG_RESULT(no) ]
2051 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2052 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2054 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2057 #include <sys/bitypes.h>
2060 int8_t a; int16_t b; int32_t c;
2061 u_int8_t e; u_int16_t f; u_int32_t g;
2062 a = b = c = e = f = g = 1;
2065 AC_DEFINE(HAVE_U_INTXX_T)
2066 AC_DEFINE(HAVE_INTXX_T)
2074 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2077 #include <sys/types.h>
2079 [ u_char foo; foo = 125; ],
2080 [ ac_cv_have_u_char="yes" ],
2081 [ ac_cv_have_u_char="no" ]
2084 if test "x$ac_cv_have_u_char" = "xyes" ; then
2085 AC_DEFINE(HAVE_U_CHAR)
2090 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2092 AC_CHECK_TYPES(in_addr_t,,,
2093 [#include <sys/types.h>
2094 #include <netinet/in.h>])
2096 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2099 #include <sys/types.h>
2101 [ size_t foo; foo = 1235; ],
2102 [ ac_cv_have_size_t="yes" ],
2103 [ ac_cv_have_size_t="no" ]
2106 if test "x$ac_cv_have_size_t" = "xyes" ; then
2107 AC_DEFINE(HAVE_SIZE_T)
2110 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2113 #include <sys/types.h>
2115 [ ssize_t foo; foo = 1235; ],
2116 [ ac_cv_have_ssize_t="yes" ],
2117 [ ac_cv_have_ssize_t="no" ]
2120 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2121 AC_DEFINE(HAVE_SSIZE_T)
2124 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2129 [ clock_t foo; foo = 1235; ],
2130 [ ac_cv_have_clock_t="yes" ],
2131 [ ac_cv_have_clock_t="no" ]
2134 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2135 AC_DEFINE(HAVE_CLOCK_T)
2138 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2141 #include <sys/types.h>
2142 #include <sys/socket.h>
2144 [ sa_family_t foo; foo = 1235; ],
2145 [ ac_cv_have_sa_family_t="yes" ],
2148 #include <sys/types.h>
2149 #include <sys/socket.h>
2150 #include <netinet/in.h>
2152 [ sa_family_t foo; foo = 1235; ],
2153 [ ac_cv_have_sa_family_t="yes" ],
2155 [ ac_cv_have_sa_family_t="no" ]
2159 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2160 AC_DEFINE(HAVE_SA_FAMILY_T)
2163 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2166 #include <sys/types.h>
2168 [ pid_t foo; foo = 1235; ],
2169 [ ac_cv_have_pid_t="yes" ],
2170 [ ac_cv_have_pid_t="no" ]
2173 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2174 AC_DEFINE(HAVE_PID_T)
2177 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2180 #include <sys/types.h>
2182 [ mode_t foo; foo = 1235; ],
2183 [ ac_cv_have_mode_t="yes" ],
2184 [ ac_cv_have_mode_t="no" ]
2187 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2188 AC_DEFINE(HAVE_MODE_T)
2192 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2195 #include <sys/types.h>
2196 #include <sys/socket.h>
2198 [ struct sockaddr_storage s; ],
2199 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2200 [ ac_cv_have_struct_sockaddr_storage="no" ]
2203 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2204 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2207 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2210 #include <sys/types.h>
2211 #include <netinet/in.h>
2213 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2214 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2215 [ ac_cv_have_struct_sockaddr_in6="no" ]
2218 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2219 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2222 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2225 #include <sys/types.h>
2226 #include <netinet/in.h>
2228 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2229 [ ac_cv_have_struct_in6_addr="yes" ],
2230 [ ac_cv_have_struct_in6_addr="no" ]
2233 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2234 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2237 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2240 #include <sys/types.h>
2241 #include <sys/socket.h>
2244 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2245 [ ac_cv_have_struct_addrinfo="yes" ],
2246 [ ac_cv_have_struct_addrinfo="no" ]
2249 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2250 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2253 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2255 [ #include <sys/time.h> ],
2256 [ struct timeval tv; tv.tv_sec = 1;],
2257 [ ac_cv_have_struct_timeval="yes" ],
2258 [ ac_cv_have_struct_timeval="no" ]
2261 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2262 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2263 have_struct_timeval=1
2266 AC_CHECK_TYPES(struct timespec)
2268 # We need int64_t or else certian parts of the compile will fail.
2269 if test "x$ac_cv_have_int64_t" = "xno" && \
2270 test "x$ac_cv_sizeof_long_int" != "x8" && \
2271 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2272 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2273 echo "an alternative compiler (I.E., GCC) before continuing."
2277 dnl test snprintf (broken on SCO w/gcc)
2282 #ifdef HAVE_SNPRINTF
2286 char expected_out[50];
2288 #if (SIZEOF_LONG_INT == 8)
2289 long int num = 0x7fffffffffffffff;
2291 long long num = 0x7fffffffffffffffll;
2293 strcpy(expected_out, "9223372036854775807");
2294 snprintf(buf, mazsize, "%lld", num);
2295 if(strcmp(buf, expected_out) != 0)
2302 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2303 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2307 dnl Checks for structure members
2308 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2309 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2310 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2311 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2312 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2313 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2314 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2315 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2316 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2317 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2318 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2319 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2320 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2321 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2322 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2323 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2324 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2326 AC_CHECK_MEMBERS([struct stat.st_blksize])
2328 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2329 ac_cv_have_ss_family_in_struct_ss, [
2332 #include <sys/types.h>
2333 #include <sys/socket.h>
2335 [ struct sockaddr_storage s; s.ss_family = 1; ],
2336 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2337 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2340 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2341 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2344 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2345 ac_cv_have___ss_family_in_struct_ss, [
2348 #include <sys/types.h>
2349 #include <sys/socket.h>
2351 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2352 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2353 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2356 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2357 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2360 AC_CACHE_CHECK([for pw_class field in struct passwd],
2361 ac_cv_have_pw_class_in_struct_passwd, [
2366 [ struct passwd p; p.pw_class = 0; ],
2367 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2368 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2371 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2372 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2375 AC_CACHE_CHECK([for pw_expire field in struct passwd],
2376 ac_cv_have_pw_expire_in_struct_passwd, [
2381 [ struct passwd p; p.pw_expire = 0; ],
2382 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2383 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2386 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2387 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2390 AC_CACHE_CHECK([for pw_change field in struct passwd],
2391 ac_cv_have_pw_change_in_struct_passwd, [
2396 [ struct passwd p; p.pw_change = 0; ],
2397 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2398 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2401 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2402 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2405 dnl make sure we're using the real structure members and not defines
2406 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2407 ac_cv_have_accrights_in_msghdr, [
2410 #include <sys/types.h>
2411 #include <sys/socket.h>
2412 #include <sys/uio.h>
2414 #ifdef msg_accrights
2415 #error "msg_accrights is a macro"
2419 m.msg_accrights = 0;
2423 [ ac_cv_have_accrights_in_msghdr="yes" ],
2424 [ ac_cv_have_accrights_in_msghdr="no" ]
2427 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2428 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2431 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2432 ac_cv_have_control_in_msghdr, [
2435 #include <sys/types.h>
2436 #include <sys/socket.h>
2437 #include <sys/uio.h>
2440 #error "msg_control is a macro"
2448 [ ac_cv_have_control_in_msghdr="yes" ],
2449 [ ac_cv_have_control_in_msghdr="no" ]
2452 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2453 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2456 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2458 [ extern char *__progname; printf("%s", __progname); ],
2459 [ ac_cv_libc_defines___progname="yes" ],
2460 [ ac_cv_libc_defines___progname="no" ]
2463 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2464 AC_DEFINE(HAVE___PROGNAME)
2467 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2471 [ printf("%s", __FUNCTION__); ],
2472 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2473 [ ac_cv_cc_implements___FUNCTION__="no" ]
2476 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2477 AC_DEFINE(HAVE___FUNCTION__)
2480 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2484 [ printf("%s", __func__); ],
2485 [ ac_cv_cc_implements___func__="yes" ],
2486 [ ac_cv_cc_implements___func__="no" ]
2489 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2490 AC_DEFINE(HAVE___func__)
2493 AC_CACHE_CHECK([whether getopt has optreset support],
2494 ac_cv_have_getopt_optreset, [
2499 [ extern int optreset; optreset = 0; ],
2500 [ ac_cv_have_getopt_optreset="yes" ],
2501 [ ac_cv_have_getopt_optreset="no" ]
2504 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2505 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2508 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2510 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2511 [ ac_cv_libc_defines_sys_errlist="yes" ],
2512 [ ac_cv_libc_defines_sys_errlist="no" ]
2515 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2516 AC_DEFINE(HAVE_SYS_ERRLIST)
2520 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2522 [ extern int sys_nerr; printf("%i", sys_nerr);],
2523 [ ac_cv_libc_defines_sys_nerr="yes" ],
2524 [ ac_cv_libc_defines_sys_nerr="no" ]
2527 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2528 AC_DEFINE(HAVE_SYS_NERR)
2532 # Check whether user wants sectok support
2534 [ --with-sectok Enable smartcard support using libsectok],
2536 if test "x$withval" != "xno" ; then
2537 if test "x$withval" != "xyes" ; then
2538 CPPFLAGS="$CPPFLAGS -I${withval}"
2539 LDFLAGS="$LDFLAGS -L${withval}"
2540 if test ! -z "$need_dash_r" ; then
2541 LDFLAGS="$LDFLAGS -R${withval}"
2543 if test ! -z "$blibpath" ; then
2544 blibpath="$blibpath:${withval}"
2547 AC_CHECK_HEADERS(sectok.h)
2548 if test "$ac_cv_header_sectok_h" != yes; then
2549 AC_MSG_ERROR(Can't find sectok.h)
2551 AC_CHECK_LIB(sectok, sectok_open)
2552 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2553 AC_MSG_ERROR(Can't find libsectok)
2555 AC_DEFINE(SMARTCARD)
2556 AC_DEFINE(USE_SECTOK)
2557 SCARD_MSG="yes, using sectok"
2562 # Check whether user wants OpenSC support
2565 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2567 if test "x$withval" != "xno" ; then
2568 if test "x$withval" != "xyes" ; then
2569 OPENSC_CONFIG=$withval/bin/opensc-config
2571 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2573 if test "$OPENSC_CONFIG" != "no"; then
2574 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2575 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2576 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2577 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2578 AC_DEFINE(SMARTCARD)
2579 AC_DEFINE(USE_OPENSC)
2580 SCARD_MSG="yes, using OpenSC"
2586 # Check libraries needed by DNS fingerprint support
2587 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2588 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
2590 # Needed by our getrrsetbyname()
2591 AC_SEARCH_LIBS(res_query, resolv)
2592 AC_SEARCH_LIBS(dn_expand, resolv)
2593 AC_MSG_CHECKING(if res_query will link)
2594 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2597 LIBS="$LIBS -lresolv"
2598 AC_MSG_CHECKING(for res_query in -lresolv)
2603 res_query (0, 0, 0, 0, 0);
2607 [LIBS="$LIBS -lresolv"
2608 AC_MSG_RESULT(yes)],
2612 AC_CHECK_FUNCS(_getshort _getlong)
2613 AC_CHECK_DECLS([_getshort, _getlong], , ,
2614 [#include <sys/types.h>
2615 #include <arpa/nameser.h>])
2616 AC_CHECK_MEMBER(HEADER.ad,
2617 [AC_DEFINE(HAVE_HEADER_AD)],,
2618 [#include <arpa/nameser.h>])
2621 # Check whether user wants Kerberos 5 support
2623 AC_ARG_WITH(kerberos5,
2624 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2625 [ if test "x$withval" != "xno" ; then
2626 if test "x$withval" = "xyes" ; then
2627 KRB5ROOT="/usr/local"
2635 AC_MSG_CHECKING(for krb5-config)
2636 if test -x $KRB5ROOT/bin/krb5-config ; then
2637 KRB5CONF=$KRB5ROOT/bin/krb5-config
2638 AC_MSG_RESULT($KRB5CONF)
2640 AC_MSG_CHECKING(for gssapi support)
2641 if $KRB5CONF | grep gssapi >/dev/null ; then
2649 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2650 K5LIBS="`$KRB5CONF --libs $k5confopts`"
2651 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2652 AC_MSG_CHECKING(whether we are using Heimdal)
2653 AC_TRY_COMPILE([ #include <krb5.h> ],
2654 [ char *tmp = heimdal_version; ],
2655 [ AC_MSG_RESULT(yes)
2656 AC_DEFINE(HEIMDAL) ],
2661 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2662 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2663 AC_MSG_CHECKING(whether we are using Heimdal)
2664 AC_TRY_COMPILE([ #include <krb5.h> ],
2665 [ char *tmp = heimdal_version; ],
2666 [ AC_MSG_RESULT(yes)
2668 K5LIBS="-lkrb5 -ldes"
2669 K5LIBS="$K5LIBS -lcom_err -lasn1"
2670 AC_CHECK_LIB(roken, net_write,
2671 [K5LIBS="$K5LIBS -lroken"])
2674 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2677 AC_SEARCH_LIBS(dn_expand, resolv)
2679 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2681 K5LIBS="-lgssapi $K5LIBS" ],
2682 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2684 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2685 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2690 AC_CHECK_HEADER(gssapi.h, ,
2691 [ unset ac_cv_header_gssapi_h
2692 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2693 AC_CHECK_HEADERS(gssapi.h, ,
2694 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2700 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2701 AC_CHECK_HEADER(gssapi_krb5.h, ,
2702 [ CPPFLAGS="$oldCPP" ])
2705 if test ! -z "$need_dash_r" ; then
2706 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2708 if test ! -z "$blibpath" ; then
2709 blibpath="$blibpath:${KRB5ROOT}/lib"
2713 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2714 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2715 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2717 LIBS="$LIBS $K5LIBS"
2718 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2719 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
2723 # Looking for programs, paths and files
2725 PRIVSEP_PATH=/var/empty
2726 AC_ARG_WITH(privsep-path,
2727 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2729 if test -n "$withval" && test "x$withval" != "xno" && \
2730 test "x${withval}" != "xyes"; then
2731 PRIVSEP_PATH=$withval
2735 AC_SUBST(PRIVSEP_PATH)
2738 [ --with-xauth=PATH Specify path to xauth program ],
2740 if test -n "$withval" && test "x$withval" != "xno" && \
2741 test "x${withval}" != "xyes"; then
2747 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2748 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2749 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2750 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2751 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2752 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2753 xauth_path="/usr/openwin/bin/xauth"
2759 AC_ARG_ENABLE(strip,
2760 [ --disable-strip Disable calling strip(1) on install],
2762 if test "x$enableval" = "xno" ; then
2769 if test -z "$xauth_path" ; then
2770 XAUTH_PATH="undefined"
2771 AC_SUBST(XAUTH_PATH)
2773 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2774 XAUTH_PATH=$xauth_path
2775 AC_SUBST(XAUTH_PATH)
2778 # Check for mail directory (last resort if we cannot get it from headers)
2779 if test ! -z "$MAIL" ; then
2780 maildir=`dirname $MAIL`
2781 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2784 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
2785 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2786 disable_ptmx_check=yes
2788 if test -z "$no_dev_ptmx" ; then
2789 if test "x$disable_ptmx_check" != "xyes" ; then
2790 AC_CHECK_FILE("/dev/ptmx",
2792 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2799 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
2800 AC_CHECK_FILE("/dev/ptc",
2802 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2807 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2810 # Options from here on. Some of these are preset by platform above
2811 AC_ARG_WITH(mantype,
2812 [ --with-mantype=man|cat|doc Set man page type],
2819 AC_MSG_ERROR(invalid man type: $withval)
2824 if test -z "$MANTYPE"; then
2825 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2826 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2827 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2829 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2836 if test "$MANTYPE" = "doc"; then
2843 # Check whether to enable MD5 passwords
2845 AC_ARG_WITH(md5-passwords,
2846 [ --with-md5-passwords Enable use of MD5 passwords],
2848 if test "x$withval" != "xno" ; then
2849 AC_DEFINE(HAVE_MD5_PASSWORDS)
2855 # Whether to disable shadow password support
2857 [ --without-shadow Disable shadow password support],
2859 if test "x$withval" = "xno" ; then
2860 AC_DEFINE(DISABLE_SHADOW)
2866 if test -z "$disable_shadow" ; then
2867 AC_MSG_CHECKING([if the systems has expire shadow information])
2870 #include <sys/types.h>
2873 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2874 [ sp_expire_available=yes ], []
2877 if test "x$sp_expire_available" = "xyes" ; then
2879 AC_DEFINE(HAS_SHADOW_EXPIRE)
2885 # Use ip address instead of hostname in $DISPLAY
2886 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2887 DISPLAY_HACK_MSG="yes"
2888 AC_DEFINE(IPADDR_IN_DISPLAY)
2890 DISPLAY_HACK_MSG="no"
2891 AC_ARG_WITH(ipaddr-display,
2892 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2894 if test "x$withval" != "xno" ; then
2895 AC_DEFINE(IPADDR_IN_DISPLAY)
2896 DISPLAY_HACK_MSG="yes"
2902 # check for /etc/default/login and use it if present.
2903 AC_ARG_ENABLE(etc-default-login,
2904 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
2905 [ if test "x$enableval" = "xno"; then
2906 AC_MSG_NOTICE([/etc/default/login handling disabled])
2907 etc_default_login=no
2909 etc_default_login=yes
2911 [ etc_default_login=yes ]
2914 if test "x$etc_default_login" != "xno"; then
2915 AC_CHECK_FILE("/etc/default/login",
2916 [ external_path_file=/etc/default/login ])
2917 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2919 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2920 elif test "x$external_path_file" = "x/etc/default/login"; then
2921 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2925 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2926 if test $ac_cv_func_login_getcapbool = "yes" && \
2927 test $ac_cv_header_login_cap_h = "yes" ; then
2928 external_path_file=/etc/login.conf
2931 # Whether to mess with the default path
2932 SERVER_PATH_MSG="(default)"
2933 AC_ARG_WITH(default-path,
2934 [ --with-default-path= Specify default \$PATH environment for server],
2936 if test "x$external_path_file" = "x/etc/login.conf" ; then
2938 --with-default-path=PATH has no effect on this system.
2939 Edit /etc/login.conf instead.])
2940 elif test "x$withval" != "xno" ; then
2941 if test ! -z "$external_path_file" ; then
2943 --with-default-path=PATH will only be used if PATH is not defined in
2944 $external_path_file .])
2946 user_path="$withval"
2947 SERVER_PATH_MSG="$withval"
2950 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2951 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2953 if test ! -z "$external_path_file" ; then
2955 If PATH is defined in $external_path_file, ensure the path to scp is included,
2956 otherwise scp will not work.])
2960 /* find out what STDPATH is */
2965 #ifndef _PATH_STDPATH
2966 # ifdef _PATH_USERPATH /* Irix */
2967 # define _PATH_STDPATH _PATH_USERPATH
2969 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2972 #include <sys/types.h>
2973 #include <sys/stat.h>
2975 #define DATA "conftest.stdpath"
2982 fd = fopen(DATA,"w");
2986 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2991 ], [ user_path=`cat conftest.stdpath` ],
2992 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2993 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2995 # make sure $bindir is in USER_PATH so scp will work
2996 t_bindir=`eval echo ${bindir}`
2998 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3001 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3003 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3004 if test $? -ne 0 ; then
3005 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3006 if test $? -ne 0 ; then
3007 user_path=$user_path:$t_bindir
3008 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3013 if test "x$external_path_file" != "x/etc/login.conf" ; then
3014 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
3018 # Set superuser path separately to user path
3019 AC_ARG_WITH(superuser-path,
3020 [ --with-superuser-path= Specify different path for super-user],
3022 if test -n "$withval" && test "x$withval" != "xno" && \
3023 test "x${withval}" != "xyes"; then
3024 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
3025 superuser_path=$withval
3031 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3032 IPV4_IN6_HACK_MSG="no"
3034 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3036 if test "x$withval" != "xno" ; then
3038 AC_DEFINE(IPV4_IN_IPV6)
3039 IPV4_IN6_HACK_MSG="yes"
3044 if test "x$inet6_default_4in6" = "xyes"; then
3045 AC_MSG_RESULT([yes (default)])
3046 AC_DEFINE(IPV4_IN_IPV6)
3047 IPV4_IN6_HACK_MSG="yes"
3049 AC_MSG_RESULT([no (default)])
3054 # Whether to enable BSD auth support
3056 AC_ARG_WITH(bsd-auth,
3057 [ --with-bsd-auth Enable BSD auth support],
3059 if test "x$withval" != "xno" ; then
3066 # Where to place sshd.pid
3068 # make sure the directory exists
3069 if test ! -d $piddir ; then
3070 piddir=`eval echo ${sysconfdir}`
3072 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3076 AC_ARG_WITH(pid-dir,
3077 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3079 if test -n "$withval" && test "x$withval" != "xno" && \
3080 test "x${withval}" != "xyes"; then
3082 if test ! -d $piddir ; then
3083 AC_MSG_WARN([** no $piddir directory on this system **])
3089 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
3092 dnl allow user to disable some login recording features
3093 AC_ARG_ENABLE(lastlog,
3094 [ --disable-lastlog disable use of lastlog even if detected [no]],
3096 if test "x$enableval" = "xno" ; then
3097 AC_DEFINE(DISABLE_LASTLOG)
3102 [ --disable-utmp disable use of utmp even if detected [no]],
3104 if test "x$enableval" = "xno" ; then
3105 AC_DEFINE(DISABLE_UTMP)
3109 AC_ARG_ENABLE(utmpx,
3110 [ --disable-utmpx disable use of utmpx even if detected [no]],
3112 if test "x$enableval" = "xno" ; then
3113 AC_DEFINE(DISABLE_UTMPX)
3118 [ --disable-wtmp disable use of wtmp even if detected [no]],
3120 if test "x$enableval" = "xno" ; then
3121 AC_DEFINE(DISABLE_WTMP)
3125 AC_ARG_ENABLE(wtmpx,
3126 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
3128 if test "x$enableval" = "xno" ; then
3129 AC_DEFINE(DISABLE_WTMPX)
3133 AC_ARG_ENABLE(libutil,
3134 [ --disable-libutil disable use of libutil (login() etc.) [no]],
3136 if test "x$enableval" = "xno" ; then
3137 AC_DEFINE(DISABLE_LOGIN)
3141 AC_ARG_ENABLE(pututline,
3142 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
3144 if test "x$enableval" = "xno" ; then
3145 AC_DEFINE(DISABLE_PUTUTLINE)
3149 AC_ARG_ENABLE(pututxline,
3150 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
3152 if test "x$enableval" = "xno" ; then
3153 AC_DEFINE(DISABLE_PUTUTXLINE)
3157 AC_ARG_WITH(lastlog,
3158 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
3160 if test "x$withval" = "xno" ; then
3161 AC_DEFINE(DISABLE_LASTLOG)
3162 elif test -n "$withval" && test "x${withval}" != "xyes"; then
3163 conf_lastlog_location=$withval
3168 dnl lastlog, [uw]tmpx? detection
3169 dnl NOTE: set the paths in the platform section to avoid the
3170 dnl need for command-line parameters
3171 dnl lastlog and [uw]tmp are subject to a file search if all else fails
3173 dnl lastlog detection
3174 dnl NOTE: the code itself will detect if lastlog is a directory
3175 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3177 #include <sys/types.h>
3179 #ifdef HAVE_LASTLOG_H
3180 # include <lastlog.h>
3189 [ char *lastlog = LASTLOG_FILE; ],
3190 [ AC_MSG_RESULT(yes) ],
3193 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3195 #include <sys/types.h>
3197 #ifdef HAVE_LASTLOG_H
3198 # include <lastlog.h>
3204 [ char *lastlog = _PATH_LASTLOG; ],
3205 [ AC_MSG_RESULT(yes) ],
3208 system_lastlog_path=no
3213 if test -z "$conf_lastlog_location"; then
3214 if test x"$system_lastlog_path" = x"no" ; then
3215 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3216 if (test -d "$f" || test -f "$f") ; then
3217 conf_lastlog_location=$f
3220 if test -z "$conf_lastlog_location"; then
3221 AC_MSG_WARN([** Cannot find lastlog **])
3222 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
3227 if test -n "$conf_lastlog_location"; then
3228 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
3232 AC_MSG_CHECKING([if your system defines UTMP_FILE])
3234 #include <sys/types.h>
3240 [ char *utmp = UTMP_FILE; ],
3241 [ AC_MSG_RESULT(yes) ],
3243 system_utmp_path=no ]
3245 if test -z "$conf_utmp_location"; then
3246 if test x"$system_utmp_path" = x"no" ; then
3247 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3248 if test -f $f ; then
3249 conf_utmp_location=$f
3252 if test -z "$conf_utmp_location"; then
3253 AC_DEFINE(DISABLE_UTMP)
3257 if test -n "$conf_utmp_location"; then
3258 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
3262 AC_MSG_CHECKING([if your system defines WTMP_FILE])
3264 #include <sys/types.h>
3270 [ char *wtmp = WTMP_FILE; ],
3271 [ AC_MSG_RESULT(yes) ],
3273 system_wtmp_path=no ]
3275 if test -z "$conf_wtmp_location"; then
3276 if test x"$system_wtmp_path" = x"no" ; then
3277 for f in /usr/adm/wtmp /var/log/wtmp; do
3278 if test -f $f ; then
3279 conf_wtmp_location=$f
3282 if test -z "$conf_wtmp_location"; then
3283 AC_DEFINE(DISABLE_WTMP)
3287 if test -n "$conf_wtmp_location"; then
3288 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
3292 dnl utmpx detection - I don't know any system so perverse as to require
3293 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3295 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3297 #include <sys/types.h>
3306 [ char *utmpx = UTMPX_FILE; ],
3307 [ AC_MSG_RESULT(yes) ],
3309 system_utmpx_path=no ]
3311 if test -z "$conf_utmpx_location"; then
3312 if test x"$system_utmpx_path" = x"no" ; then
3313 AC_DEFINE(DISABLE_UTMPX)
3316 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
3320 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3322 #include <sys/types.h>
3331 [ char *wtmpx = WTMPX_FILE; ],
3332 [ AC_MSG_RESULT(yes) ],
3334 system_wtmpx_path=no ]
3336 if test -z "$conf_wtmpx_location"; then
3337 if test x"$system_wtmpx_path" = x"no" ; then
3338 AC_DEFINE(DISABLE_WTMPX)
3341 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
3345 if test ! -z "$blibpath" ; then
3346 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3347 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3350 dnl remove pam and dl because they are in $LIBPAM
3351 if test "$PAM_MSG" = yes ; then
3352 LIBS=`echo $LIBS | sed 's/-lpam //'`
3354 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3355 LIBS=`echo $LIBS | sed 's/-ldl //'`
3359 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3360 scard/Makefile ssh_prng_cmds survey.sh])
3363 # Print summary of options
3365 # Someone please show me a better way :)
3366 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3367 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3368 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3369 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3370 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3371 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3372 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
3373 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3374 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3375 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3378 echo "OpenSSH has been configured with the following options:"
3379 echo " User binaries: $B"
3380 echo " System binaries: $C"
3381 echo " Configuration files: $D"
3382 echo " Askpass program: $E"
3383 echo " Manual pages: $F"
3384 echo " PID file: $G"
3385 echo " Privilege separation chroot path: $H"
3386 if test "x$external_path_file" = "x/etc/login.conf" ; then
3387 echo " At runtime, sshd will use the path defined in $external_path_file"
3388 echo " Make sure the path to scp is present, otherwise scp will not work"
3390 echo " sshd default user PATH: $I"
3391 if test ! -z "$external_path_file"; then
3392 echo " (If PATH is set in $external_path_file it will be used instead. If"
3393 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3396 if test ! -z "$superuser_path" ; then
3397 echo " sshd superuser user PATH: $J"
3399 echo " Manpage format: $MANTYPE"
3400 echo " PAM support: $PAM_MSG"
3401 echo " KerberosV support: $KRB5_MSG"
3402 echo " Smartcard support: $SCARD_MSG"
3403 echo " S/KEY support: $SKEY_MSG"
3404 echo " TCP Wrappers support: $TCPW_MSG"
3405 echo " MD5 password support: $MD5_MSG"
3406 echo " libedit support: $LIBEDIT_MSG"
3407 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
3408 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3409 echo " BSD Auth support: $BSD_AUTH_MSG"
3410 echo " Random number source: $RAND_MSG"
3411 if test ! -z "$USE_RAND_HELPER" ; then
3412 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
3417 echo " Host: ${host}"
3418 echo " Compiler: ${CC}"
3419 echo " Compiler flags: ${CFLAGS}"
3420 echo "Preprocessor flags: ${CPPFLAGS}"
3421 echo " Linker flags: ${LDFLAGS}"
3422 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
3426 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
3427 echo "SVR4 style packages are supported with \"make package\""
3431 if test "x$PAM_MSG" = "xyes" ; then
3432 echo "PAM is enabled. You may need to install a PAM control file "
3433 echo "for sshd, otherwise password authentication may fail. "
3434 echo "Example PAM control files can be found in the contrib/ "
3439 if test ! -z "$RAND_HELPER_CMDHASH" ; then
3440 echo "WARNING: you are using the builtin random number collection "
3441 echo "service. Please read WARNING.RNG and request that your OS "
3442 echo "vendor includes kernel-based random number collection in "
3443 echo "future versions of your OS."
3447 if test ! -z "$NO_PEERCHECK" ; then
3448 echo "WARNING: the operating system that you are using does not "
3449 echo "appear to support either the getpeereid() API nor the "
3450 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3451 echo "enforce security checks to prevent unauthorised connections to "
3452 echo "ssh-agent. Their absence increases the risk that a malicious "
3453 echo "user can connect to your agent. "
3457 if test "$AUDIT_MODULE" = "bsm" ; then
3458 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3459 echo "See the Solaris section in README.platform for details."