1 # $Id: configure.ac,v 1.292 2005/08/31 16:59:49 tim Exp $
4 # Copyright (c) 1999-2004 Damien Miller
6 # Permission to use, copy, modify, and distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
10 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
19 AC_CONFIG_SRCDIR([ssh.c])
21 AC_CONFIG_HEADER(config.h)
26 # Checks for programs.
32 AC_PATH_PROG(CAT, cat)
33 AC_PATH_PROG(KILL, kill)
34 AC_PATH_PROGS(PERL, perl5 perl)
35 AC_PATH_PROG(SED, sed)
37 AC_PATH_PROG(ENT, ent)
39 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
40 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
41 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
43 AC_SUBST(TEST_SHELL,sh)
46 AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
47 [/usr/sbin${PATH_SEPARATOR}/etc])
48 AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
49 [/usr/sbin${PATH_SEPARATOR}/etc])
50 AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
55 if test -z "$AR" ; then
56 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
59 # Use LOGIN_PROGRAM from environment if possible
60 if test ! -z "$LOGIN_PROGRAM" ; then
61 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
64 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
65 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
66 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
70 AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
71 if test ! -z "$PATH_PASSWD_PROG" ; then
72 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
75 if test -z "$LD" ; then
82 AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
84 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
85 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
86 GCC_VER=`$CC --version`
89 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
91 *) CFLAGS="$CFLAGS -Wsign-compare" ;;
94 if test -z "$have_llong_max"; then
95 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
96 unset ac_cv_have_decl_LLONG_MAX
97 saved_CFLAGS="$CFLAGS"
98 CFLAGS="$CFLAGS -std=gnu99"
99 AC_CHECK_DECL(LLONG_MAX,
101 [CFLAGS="$saved_CFLAGS"],
102 [#include <limits.h>]
107 if test -z "$have_llong_max"; then
108 AC_MSG_CHECKING([for max value of long long])
112 /* Why is this so damn hard? */
118 #define DATA "conftest.llminmax"
121 long long i, llmin, llmax = 0;
123 if((f = fopen(DATA,"w")) == NULL)
126 #if defined(LLONG_MIN) && defined(LLONG_MAX)
127 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
131 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
132 /* This will work on one's complement and two's complement */
133 for (i = 1; i > llmax; i <<= 1, i++)
135 llmin = llmax + 1LL; /* wrap */
139 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
140 || llmax - 1 > llmax) {
141 fprintf(f, "unknown unknown\n");
145 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
152 llong_min=`$AWK '{print $1}' conftest.llminmax`
153 llong_max=`$AWK '{print $2}' conftest.llminmax`
154 AC_MSG_RESULT($llong_max)
155 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
156 [max value of long long calculated by configure])
157 AC_MSG_CHECKING([for min value of long long])
158 AC_MSG_RESULT($llong_min)
159 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
160 [min value of long long calculated by configure])
163 AC_MSG_RESULT(not found)
166 AC_MSG_WARN([cross compiling: not checking])
172 [ --without-rpath Disable auto-added -R linker paths],
174 if test "x$withval" = "xno" ; then
177 if test "x$withval" = "xyes" ; then
183 # Check for some target-specific stuff
186 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
187 if (test -z "$blibpath"); then
188 blibpath="/usr/lib:/lib"
190 saved_LDFLAGS="$LDFLAGS"
191 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
192 if (test -z "$blibflags"); then
193 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
194 AC_TRY_LINK([], [], [blibflags=$tryflags])
197 if (test -z "$blibflags"); then
198 AC_MSG_RESULT(not found)
199 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
201 AC_MSG_RESULT($blibflags)
203 LDFLAGS="$saved_LDFLAGS"
204 dnl Check for authenticate. Might be in libs.a on older AIXes
205 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
206 [AC_CHECK_LIB(s,authenticate,
207 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
211 dnl Check for various auth function declarations in headers.
212 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
213 passwdexpired, setauthdb], , , [#include <usersec.h>])
214 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
215 AC_CHECK_DECLS(loginfailed,
216 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
218 [#include <usersec.h>],
219 [(void)loginfailed("user","host","tty",0);],
221 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
225 [#include <usersec.h>]
227 AC_CHECK_FUNCS(setauthdb)
228 check_for_aix_broken_getaddrinfo=1
229 AC_DEFINE(BROKEN_REALPATH)
230 AC_DEFINE(SETEUID_BREAKS_SETUID)
231 AC_DEFINE(BROKEN_SETREUID)
232 AC_DEFINE(BROKEN_SETREGID)
233 dnl AIX handles lastlog as part of its login message
234 AC_DEFINE(DISABLE_LASTLOG)
235 AC_DEFINE(LOGIN_NEEDS_UTMPX)
236 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
239 check_for_libcrypt_later=1
240 LIBS="$LIBS /usr/lib/textmode.o"
241 AC_DEFINE(HAVE_CYGWIN)
243 AC_DEFINE(DISABLE_SHADOW)
244 AC_DEFINE(IP_TOS_IS_BROKEN)
245 AC_DEFINE(NO_X11_UNIX_SOCKETS)
246 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
247 AC_DEFINE(DISABLE_FD_PASSING)
250 AC_DEFINE(IP_TOS_IS_BROKEN)
251 AC_DEFINE(SETEUID_BREAKS_SETUID)
252 AC_DEFINE(BROKEN_SETREUID)
253 AC_DEFINE(BROKEN_SETREGID)
256 AC_MSG_CHECKING(if we have working getaddrinfo)
257 AC_TRY_RUN([#include <mach-o/dyld.h>
258 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
262 }], [AC_MSG_RESULT(working)],
263 [AC_MSG_RESULT(buggy)
264 AC_DEFINE(BROKEN_GETADDRINFO)],
265 [AC_MSG_RESULT(assume it is working)])
266 AC_DEFINE(SETEUID_BREAKS_SETUID)
267 AC_DEFINE(BROKEN_SETREUID)
268 AC_DEFINE(BROKEN_SETREGID)
269 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
272 # first we define all of the options common to all HP-UX releases
273 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
274 IPADDR_IN_DISPLAY=yes
276 AC_DEFINE(LOGIN_NO_ENDOPT)
277 AC_DEFINE(LOGIN_NEEDS_UTMPX)
278 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
279 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
281 AC_CHECK_LIB(xnet, t_error, ,
282 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
284 # next, we define all of the options specific to major releases
287 if test -z "$GCC"; then
292 AC_DEFINE(PAM_SUN_CODEBASE)
293 AC_DEFINE(DISABLE_UTMP)
294 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
295 check_for_hpux_broken_getaddrinfo=1
296 check_for_conflicting_getspnam=1
300 # lastly, we define options specific to minor releases
303 AC_DEFINE(HAVE_SECUREWARE)
304 disable_ptmx_check=yes
310 PATH="$PATH:/usr/etc"
311 AC_DEFINE(BROKEN_INET_NTOA)
312 AC_DEFINE(SETEUID_BREAKS_SETUID)
313 AC_DEFINE(BROKEN_SETREUID)
314 AC_DEFINE(BROKEN_SETREGID)
315 AC_DEFINE(WITH_ABBREV_NO_TTY)
316 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
319 PATH="$PATH:/usr/etc"
320 AC_DEFINE(WITH_IRIX_ARRAY)
321 AC_DEFINE(WITH_IRIX_PROJECT)
322 AC_DEFINE(WITH_IRIX_AUDIT)
323 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
324 AC_DEFINE(BROKEN_INET_NTOA)
325 AC_DEFINE(SETEUID_BREAKS_SETUID)
326 AC_DEFINE(BROKEN_SETREUID)
327 AC_DEFINE(BROKEN_SETREGID)
328 AC_DEFINE(BROKEN_UPDWTMPX)
329 AC_DEFINE(WITH_ABBREV_NO_TTY)
330 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
334 check_for_libcrypt_later=1
335 check_for_openpty_ctty_bug=1
336 AC_DEFINE(DONT_TRY_OTHER_AF)
337 AC_DEFINE(PAM_TTY_KLUDGE)
338 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
339 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
340 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
341 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
342 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
343 inet6_default_4in6=yes
346 AC_DEFINE(BROKEN_CMSG_TYPE)
350 mips-sony-bsd|mips-sony-newsos4)
351 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
355 check_for_libcrypt_before=1
356 if test "x$withval" != "xno" ; then
361 check_for_libcrypt_later=1
364 AC_DEFINE(SETEUID_BREAKS_SETUID)
365 AC_DEFINE(BROKEN_SETREUID)
366 AC_DEFINE(BROKEN_SETREGID)
369 conf_lastlog_location="/usr/adm/lastlog"
370 conf_utmp_location=/etc/utmp
371 conf_wtmp_location=/usr/adm/wtmp
374 AC_DEFINE(BROKEN_REALPATH)
376 AC_DEFINE(BROKEN_SAVED_UIDS)
379 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
382 if test "x$withval" != "xno" ; then
385 AC_DEFINE(PAM_SUN_CODEBASE)
386 AC_DEFINE(LOGIN_NEEDS_UTMPX)
387 AC_DEFINE(LOGIN_NEEDS_TERM)
388 AC_DEFINE(PAM_TTY_KLUDGE)
389 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
390 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
391 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
392 AC_DEFINE(SSHD_ACQUIRES_CTTY)
393 external_path_file=/etc/default/login
394 # hardwire lastlog location (can't detect it on some versions)
395 conf_lastlog_location="/var/adm/lastlog"
396 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
397 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
398 if test "$sol2ver" -ge 8; then
400 AC_DEFINE(DISABLE_UTMP)
401 AC_DEFINE(DISABLE_WTMP)
407 CPPFLAGS="$CPPFLAGS -DSUNOS4"
408 AC_CHECK_FUNCS(getpwanam)
409 AC_DEFINE(PAM_SUN_CODEBASE)
410 conf_utmp_location=/etc/utmp
411 conf_wtmp_location=/var/adm/wtmp
412 conf_lastlog_location=/var/adm/lastlog
418 AC_DEFINE(SSHD_ACQUIRES_CTTY)
419 AC_DEFINE(SETEUID_BREAKS_SETUID)
420 AC_DEFINE(BROKEN_SETREUID)
421 AC_DEFINE(BROKEN_SETREGID)
424 # /usr/ucblib MUST NOT be searched on ReliantUNIX
425 AC_CHECK_LIB(dl, dlsym, ,)
426 # -lresolv needs to be at then end of LIBS or DNS lookups break
427 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
428 IPADDR_IN_DISPLAY=yes
430 AC_DEFINE(IP_TOS_IS_BROKEN)
431 AC_DEFINE(SETEUID_BREAKS_SETUID)
432 AC_DEFINE(BROKEN_SETREUID)
433 AC_DEFINE(BROKEN_SETREGID)
434 AC_DEFINE(SSHD_ACQUIRES_CTTY)
435 external_path_file=/etc/default/login
436 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
437 # Attention: always take care to bind libsocket and libnsl before libc,
438 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
440 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
443 AC_DEFINE(SETEUID_BREAKS_SETUID)
444 AC_DEFINE(BROKEN_SETREUID)
445 AC_DEFINE(BROKEN_SETREGID)
446 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
448 # UnixWare 7.x, OpenUNIX 8
450 check_for_libcrypt_later=1
451 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
453 AC_DEFINE(SETEUID_BREAKS_SETUID)
454 AC_DEFINE(BROKEN_SETREUID)
455 AC_DEFINE(BROKEN_SETREGID)
456 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
458 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
459 TEST_SHELL=/u95/bin/sh
460 AC_DEFINE(BROKEN_LIBIAF, 1, [ia_uinfo routines not supported by OS yet])
466 # SCO UNIX and OEM versions of SCO UNIX
468 AC_MSG_ERROR("This Platform is no longer supported.")
472 if test -z "$GCC"; then
473 CFLAGS="$CFLAGS -belf"
475 LIBS="$LIBS -lprot -lx -ltinfo -lm"
478 AC_DEFINE(HAVE_SECUREWARE)
479 AC_DEFINE(DISABLE_SHADOW)
480 AC_DEFINE(DISABLE_FD_PASSING)
481 AC_DEFINE(SETEUID_BREAKS_SETUID)
482 AC_DEFINE(BROKEN_SETREUID)
483 AC_DEFINE(BROKEN_SETREGID)
484 AC_DEFINE(WITH_ABBREV_NO_TTY)
485 AC_DEFINE(BROKEN_UPDWTMPX)
486 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
487 AC_CHECK_FUNCS(getluid setluid)
492 AC_DEFINE(NO_SSH_LASTLOG)
493 AC_DEFINE(SETEUID_BREAKS_SETUID)
494 AC_DEFINE(BROKEN_SETREUID)
495 AC_DEFINE(BROKEN_SETREGID)
497 AC_DEFINE(DISABLE_FD_PASSING)
499 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
503 AC_DEFINE(SETEUID_BREAKS_SETUID)
504 AC_DEFINE(BROKEN_SETREUID)
505 AC_DEFINE(BROKEN_SETREGID)
506 AC_DEFINE(WITH_ABBREV_NO_TTY)
508 AC_DEFINE(DISABLE_FD_PASSING)
510 LIBS="$LIBS -lgen -lacid -ldb"
514 AC_DEFINE(SETEUID_BREAKS_SETUID)
515 AC_DEFINE(BROKEN_SETREUID)
516 AC_DEFINE(BROKEN_SETREGID)
518 AC_DEFINE(DISABLE_FD_PASSING)
519 AC_DEFINE(NO_SSH_LASTLOG)
520 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
521 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
525 AC_MSG_CHECKING(for Digital Unix SIA)
528 [ --with-osfsia Enable Digital Unix SIA],
530 if test "x$withval" = "xno" ; then
531 AC_MSG_RESULT(disabled)
536 if test -z "$no_osfsia" ; then
537 if test -f /etc/sia/matrix.conf; then
539 AC_DEFINE(HAVE_OSF_SIA)
540 AC_DEFINE(DISABLE_LOGIN)
541 AC_DEFINE(DISABLE_FD_PASSING)
542 LIBS="$LIBS -lsecurity -ldb -lm -laud"
545 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
548 AC_DEFINE(BROKEN_GETADDRINFO)
549 AC_DEFINE(SETEUID_BREAKS_SETUID)
550 AC_DEFINE(BROKEN_SETREUID)
551 AC_DEFINE(BROKEN_SETREGID)
556 AC_DEFINE(NO_X11_UNIX_SOCKETS)
557 AC_DEFINE(MISSING_NFDBITS)
558 AC_DEFINE(MISSING_HOWMANY)
559 AC_DEFINE(MISSING_FD_MASK)
563 AC_DEFINE(BROKEN_GETGROUPS, [], [getgroups(0,NULL) will return -1])
564 AC_DEFINE(BROKEN_MMAP, [], [Ultrix mmap can't map files])
565 AC_DEFINE(NEED_SETPRGP, [], [Need setpgrp to acquire controlling tty])
566 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
570 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
571 AC_DEFINE(MISSING_HOWMANY)
572 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
576 # Allow user to specify flags
578 [ --with-cflags Specify additional flags to pass to compiler],
580 if test -n "$withval" && test "x$withval" != "xno" && \
581 test "x${withval}" != "xyes"; then
582 CFLAGS="$CFLAGS $withval"
586 AC_ARG_WITH(cppflags,
587 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
589 if test -n "$withval" && test "x$withval" != "xno" && \
590 test "x${withval}" != "xyes"; then
591 CPPFLAGS="$CPPFLAGS $withval"
596 [ --with-ldflags Specify additional flags to pass to linker],
598 if test -n "$withval" && test "x$withval" != "xno" && \
599 test "x${withval}" != "xyes"; then
600 LDFLAGS="$LDFLAGS $withval"
605 [ --with-libs Specify additional libraries to link with],
607 if test -n "$withval" && test "x$withval" != "xno" && \
608 test "x${withval}" != "xyes"; then
609 LIBS="$LIBS $withval"
614 [ --with-Werror Build main code with -Werror],
616 if test -n "$withval" && test "x$withval" != "xno"; then
617 werror_flags="-Werror"
618 if "x${withval}" != "xyes"; then
619 werror_flags="$withval"
625 AC_MSG_CHECKING(compiler and flags for sanity)
631 [ AC_MSG_RESULT(yes) ],
634 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
636 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
639 dnl Checks for header files.
665 security/pam_appl.h \
701 # sys/ptms.h requires sys/stream.h to be included first on Solaris
702 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
703 #ifdef HAVE_SYS_STREAM_H
704 # include <sys/stream.h>
708 # Checks for libraries.
709 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
710 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
712 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
713 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
714 AC_CHECK_LIB(gen, dirname,[
715 AC_CACHE_CHECK([for broken dirname],
716 ac_cv_have_broken_dirname, [
724 int main(int argc, char **argv) {
727 strncpy(buf,"/etc", 32);
729 if (!s || strncmp(s, "/", 32) != 0) {
736 [ ac_cv_have_broken_dirname="no" ],
737 [ ac_cv_have_broken_dirname="yes" ]
741 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
743 AC_DEFINE(HAVE_DIRNAME)
744 AC_CHECK_HEADERS(libgen.h)
749 AC_CHECK_FUNC(getspnam, ,
750 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
751 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
755 [ --with-zlib=PATH Use zlib in PATH],
756 [ if test "x$withval" = "xno" ; then
757 AC_MSG_ERROR([*** zlib is required ***])
758 elif test "x$withval" != "xyes"; then
759 if test -d "$withval/lib"; then
760 if test -n "${need_dash_r}"; then
761 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
763 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
766 if test -n "${need_dash_r}"; then
767 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
769 LDFLAGS="-L${withval} ${LDFLAGS}"
772 if test -d "$withval/include"; then
773 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
775 CPPFLAGS="-I${withval} ${CPPFLAGS}"
780 AC_CHECK_LIB(z, deflate, ,
782 saved_CPPFLAGS="$CPPFLAGS"
783 saved_LDFLAGS="$LDFLAGS"
785 dnl Check default zlib install dir
786 if test -n "${need_dash_r}"; then
787 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
789 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
791 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
793 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
795 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
800 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
802 AC_ARG_WITH(zlib-version-check,
803 [ --without-zlib-version-check Disable zlib version check],
804 [ if test "x$withval" = "xno" ; then
805 zlib_check_nonfatal=1
810 AC_MSG_CHECKING(for possibly buggy zlib)
811 AC_RUN_IFELSE([AC_LANG_SOURCE([[
816 int a=0, b=0, c=0, d=0, n, v;
817 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
818 if (n != 3 && n != 4)
820 v = a*1000000 + b*10000 + c*100 + d;
821 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
824 if (a == 1 && b == 1 && c >= 4)
827 /* 1.2.3 and up are OK */
836 if test -z "$zlib_check_nonfatal" ; then
837 AC_MSG_ERROR([*** zlib too old - check config.log ***
838 Your reported zlib version has known security problems. It's possible your
839 vendor has fixed these problems without changing the version number. If you
840 are sure this is the case, you can disable the check by running
841 "./configure --without-zlib-version-check".
842 If you are in doubt, upgrade zlib to version 1.2.3 or greater.
843 See http://www.gzip.org/zlib/ for details.])
845 AC_MSG_WARN([zlib version may have security problems])
848 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
852 AC_CHECK_FUNC(strcasecmp,
853 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
855 AC_CHECK_FUNC(utimes,
856 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
857 LIBS="$LIBS -lc89"]) ]
860 dnl Checks for libutil functions
861 AC_CHECK_HEADERS(libutil.h)
862 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
863 AC_CHECK_FUNCS(logout updwtmp logwtmp)
867 # Check for ALTDIRFUNC glob() extension
868 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
869 AC_EGREP_CPP(FOUNDIT,
872 #ifdef GLOB_ALTDIRFUNC
877 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
885 # Check for g.gl_matchc glob() extension
886 AC_MSG_CHECKING(for gl_matchc field in glob_t)
887 AC_EGREP_CPP(FOUNDIT,
890 int main(void){glob_t g; g.gl_matchc = 1;}
893 AC_DEFINE(GLOB_HAS_GL_MATCHC)
901 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
904 #include <sys/types.h>
906 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
908 [AC_MSG_RESULT(yes)],
911 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
914 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
915 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
919 AC_MSG_CHECKING([for /proc/pid/fd directory])
920 if test -d "/proc/$$/fd" ; then
921 AC_DEFINE(HAVE_PROC_PID)
927 # Check whether user wants S/Key support
930 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
932 if test "x$withval" != "xno" ; then
934 if test "x$withval" != "xyes" ; then
935 CPPFLAGS="$CPPFLAGS -I${withval}/include"
936 LDFLAGS="$LDFLAGS -L${withval}/lib"
943 AC_MSG_CHECKING([for s/key support])
948 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
950 [AC_MSG_RESULT(yes)],
953 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
955 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
959 [(void)skeychallenge(NULL,"name","",0);],
961 AC_DEFINE(SKEYCHALLENGE_4ARG)],
968 # Check whether user wants OPIE support
971 [ --with-opie[[=PATH]] Enable OPIE support
972 (optionally in PATH)],
974 if test "x$withval" != "xno" ; then
976 if test "x$withval" != "xyes" ; then
977 CPPFLAGS="$CPPFLAGS -I${withval}/include"
978 LDFLAGS="$LDFLAGS -L${withval}/lib"
986 AC_MSG_CHECKING([for opie support])
989 #include <sys/types.h>
992 int main() { char *ff = opie_keyinfo(""); ff=""; return 0; }
994 [AC_MSG_RESULT(yes)],
997 AC_MSG_ERROR([** Incomplete or missing opie libraries.])
1003 # Check whether user wants TCP wrappers support
1005 AC_ARG_WITH(tcp-wrappers,
1006 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
1008 if test "x$withval" != "xno" ; then
1010 saved_LDFLAGS="$LDFLAGS"
1011 saved_CPPFLAGS="$CPPFLAGS"
1012 if test -n "${withval}" && \
1013 test "x${withval}" != "xyes"; then
1014 if test -d "${withval}/lib"; then
1015 if test -n "${need_dash_r}"; then
1016 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1018 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1021 if test -n "${need_dash_r}"; then
1022 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1024 LDFLAGS="-L${withval} ${LDFLAGS}"
1027 if test -d "${withval}/include"; then
1028 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1030 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1034 LIBS="$LIBWRAP $LIBS"
1035 AC_MSG_CHECKING(for libwrap)
1038 #include <sys/types.h>
1039 #include <sys/socket.h>
1040 #include <netinet/in.h>
1042 int deny_severity = 0, allow_severity = 0;
1052 AC_MSG_ERROR([*** libwrap missing])
1060 # Check whether user wants libedit support
1062 AC_ARG_WITH(libedit,
1063 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1064 [ if test "x$withval" != "xno" ; then
1065 if test "x$withval" != "xyes"; then
1066 CPPFLAGS="$CPPFLAGS -I$withval/include"
1067 LDFLAGS="$LDFLAGS -L$withval/lib"
1069 AC_CHECK_LIB(edit, el_init,
1070 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
1071 LIBEDIT="-ledit -lcurses"
1075 [ AC_MSG_ERROR(libedit not found) ],
1078 AC_MSG_CHECKING(if libedit version is compatible)
1081 #include <histedit.h>
1085 el_init("", NULL, NULL, NULL);
1089 [ AC_MSG_RESULT(yes) ],
1091 AC_MSG_ERROR(libedit version is not compatible) ]
1098 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1100 AC_MSG_CHECKING(for supported audit module)
1105 dnl Checks for headers, libs and functions
1106 AC_CHECK_HEADERS(bsm/audit.h, [],
1107 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1108 AC_CHECK_LIB(bsm, getaudit, [],
1109 [AC_MSG_ERROR(BSM enabled and required library not found)])
1110 AC_CHECK_FUNCS(getaudit, [],
1111 [AC_MSG_ERROR(BSM enabled and required function not found)])
1112 # These are optional
1113 AC_CHECK_FUNCS(getaudit_addr)
1114 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
1118 AC_MSG_RESULT(debug)
1119 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
1125 AC_MSG_ERROR([Unknown audit module $withval])
1130 dnl Checks for library functions. Please keep in alphabetical order
1214 # IRIX has a const char return value for gai_strerror()
1215 AC_CHECK_FUNCS(gai_strerror,[
1216 AC_DEFINE(HAVE_GAI_STRERROR)
1218 #include <sys/types.h>
1219 #include <sys/socket.h>
1222 const char *gai_strerror(int);],[
1225 str = gai_strerror(0);],[
1226 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1227 [Define if gai_strerror() returns const char *])])])
1229 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
1231 dnl Make sure prototypes are defined for these before using them.
1232 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1233 AC_CHECK_DECL(strsep,
1234 [AC_CHECK_FUNCS(strsep)],
1237 #ifdef HAVE_STRING_H
1238 # include <string.h>
1242 dnl tcsendbreak might be a macro
1243 AC_CHECK_DECL(tcsendbreak,
1244 [AC_DEFINE(HAVE_TCSENDBREAK)],
1245 [AC_CHECK_FUNCS(tcsendbreak)],
1246 [#include <termios.h>]
1249 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1251 AC_CHECK_FUNCS(setresuid, [
1252 dnl Some platorms have setresuid that isn't implemented, test for this
1253 AC_MSG_CHECKING(if setresuid seems to work)
1258 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1260 [AC_MSG_RESULT(yes)],
1261 [AC_DEFINE(BROKEN_SETRESUID)
1262 AC_MSG_RESULT(not implemented)],
1263 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1267 AC_CHECK_FUNCS(setresgid, [
1268 dnl Some platorms have setresgid that isn't implemented, test for this
1269 AC_MSG_CHECKING(if setresgid seems to work)
1274 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1276 [AC_MSG_RESULT(yes)],
1277 [AC_DEFINE(BROKEN_SETRESGID)
1278 AC_MSG_RESULT(not implemented)],
1279 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1283 dnl Checks for time functions
1284 AC_CHECK_FUNCS(gettimeofday time)
1285 dnl Checks for utmp functions
1286 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1287 AC_CHECK_FUNCS(utmpname)
1288 dnl Checks for utmpx functions
1289 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1290 AC_CHECK_FUNCS(setutxent utmpxname)
1292 AC_CHECK_FUNC(daemon,
1293 [AC_DEFINE(HAVE_DAEMON)],
1294 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1297 AC_CHECK_FUNC(getpagesize,
1298 [AC_DEFINE(HAVE_GETPAGESIZE)],
1299 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1302 # Check for broken snprintf
1303 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1304 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1308 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1310 [AC_MSG_RESULT(yes)],
1313 AC_DEFINE(BROKEN_SNPRINTF)
1314 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1316 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1320 # Check for missing getpeereid (or equiv) support
1322 if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1323 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1325 [#include <sys/types.h>
1326 #include <sys/socket.h>],
1327 [int i = SO_PEERCRED;],
1328 [ AC_MSG_RESULT(yes)
1329 AC_DEFINE(HAVE_SO_PEERCRED, [], [Have PEERCRED socket option])
1336 dnl see whether mkstemp() requires XXXXXX
1337 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1338 AC_MSG_CHECKING([for (overly) strict mkstemp])
1342 main() { char template[]="conftest.mkstemp-test";
1343 if (mkstemp(template) == -1)
1345 unlink(template); exit(0);
1353 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1357 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1362 dnl make sure that openpty does not reacquire controlling terminal
1363 if test ! -z "$check_for_openpty_ctty_bug"; then
1364 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1368 #include <sys/fcntl.h>
1369 #include <sys/types.h>
1370 #include <sys/wait.h>
1376 int fd, ptyfd, ttyfd, status;
1379 if (pid < 0) { /* failed */
1381 } else if (pid > 0) { /* parent */
1382 waitpid(pid, &status, 0);
1383 if (WIFEXITED(status))
1384 exit(WEXITSTATUS(status));
1387 } else { /* child */
1388 close(0); close(1); close(2);
1390 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1391 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1393 exit(3); /* Acquired ctty: broken */
1395 exit(0); /* Did not acquire ctty: OK */
1404 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1409 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1410 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1411 AC_MSG_CHECKING(if getaddrinfo seems to work)
1415 #include <sys/socket.h>
1418 #include <netinet/in.h>
1420 #define TEST_PORT "2222"
1426 struct addrinfo *gai_ai, *ai, hints;
1427 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1429 memset(&hints, 0, sizeof(hints));
1430 hints.ai_family = PF_UNSPEC;
1431 hints.ai_socktype = SOCK_STREAM;
1432 hints.ai_flags = AI_PASSIVE;
1434 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1436 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1440 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1441 if (ai->ai_family != AF_INET6)
1444 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1445 sizeof(ntop), strport, sizeof(strport),
1446 NI_NUMERICHOST|NI_NUMERICSERV);
1449 if (err == EAI_SYSTEM)
1450 perror("getnameinfo EAI_SYSTEM");
1452 fprintf(stderr, "getnameinfo failed: %s\n",
1457 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1460 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1473 AC_DEFINE(BROKEN_GETADDRINFO)
1478 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1479 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1480 AC_MSG_CHECKING(if getaddrinfo seems to work)
1484 #include <sys/socket.h>
1487 #include <netinet/in.h>
1489 #define TEST_PORT "2222"
1495 struct addrinfo *gai_ai, *ai, hints;
1496 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1498 memset(&hints, 0, sizeof(hints));
1499 hints.ai_family = PF_UNSPEC;
1500 hints.ai_socktype = SOCK_STREAM;
1501 hints.ai_flags = AI_PASSIVE;
1503 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1505 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1509 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1510 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1513 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1514 sizeof(ntop), strport, sizeof(strport),
1515 NI_NUMERICHOST|NI_NUMERICSERV);
1517 if (ai->ai_family == AF_INET && err != 0) {
1518 perror("getnameinfo");
1527 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1528 [Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1532 AC_DEFINE(BROKEN_GETADDRINFO)
1537 if test "x$check_for_conflicting_getspnam" = "x1"; then
1538 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1542 int main(void) {exit(0);}
1549 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1550 [Conflicting defs for getspnam])
1557 # Check for PAM libs
1560 [ --with-pam Enable PAM support ],
1562 if test "x$withval" != "xno" ; then
1563 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1564 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1565 AC_MSG_ERROR([PAM headers not found])
1568 AC_CHECK_LIB(dl, dlopen, , )
1569 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1570 AC_CHECK_FUNCS(pam_getenvlist)
1571 AC_CHECK_FUNCS(pam_putenv)
1576 if test $ac_cv_lib_dl_dlopen = yes; then
1586 # Check for older PAM
1587 if test "x$PAM_MSG" = "xyes" ; then
1588 # Check PAM strerror arguments (old PAM)
1589 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1593 #if defined(HAVE_SECURITY_PAM_APPL_H)
1594 #include <security/pam_appl.h>
1595 #elif defined (HAVE_PAM_PAM_APPL_H)
1596 #include <pam/pam_appl.h>
1599 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1600 [AC_MSG_RESULT(no)],
1602 AC_DEFINE(HAVE_OLD_PAM)
1604 PAM_MSG="yes (old library)"
1609 # Search for OpenSSL
1610 saved_CPPFLAGS="$CPPFLAGS"
1611 saved_LDFLAGS="$LDFLAGS"
1612 AC_ARG_WITH(ssl-dir,
1613 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1615 if test "x$withval" != "xno" ; then
1618 ./*|../*) withval="`pwd`/$withval"
1620 if test -d "$withval/lib"; then
1621 if test -n "${need_dash_r}"; then
1622 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1624 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1627 if test -n "${need_dash_r}"; then
1628 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1630 LDFLAGS="-L${withval} ${LDFLAGS}"
1633 if test -d "$withval/include"; then
1634 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1636 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1641 LIBS="-lcrypto $LIBS"
1642 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1644 dnl Check default openssl install dir
1645 if test -n "${need_dash_r}"; then
1646 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1648 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1650 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1651 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1653 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1659 # Determine OpenSSL header version
1660 AC_MSG_CHECKING([OpenSSL header version])
1665 #include <openssl/opensslv.h>
1666 #define DATA "conftest.sslincver"
1671 fd = fopen(DATA,"w");
1675 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1682 ssl_header_ver=`cat conftest.sslincver`
1683 AC_MSG_RESULT($ssl_header_ver)
1686 AC_MSG_RESULT(not found)
1687 AC_MSG_ERROR(OpenSSL version header not found.)
1690 AC_MSG_WARN([cross compiling: not checking])
1694 # Determine OpenSSL library version
1695 AC_MSG_CHECKING([OpenSSL library version])
1700 #include <openssl/opensslv.h>
1701 #include <openssl/crypto.h>
1702 #define DATA "conftest.ssllibver"
1707 fd = fopen(DATA,"w");
1711 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1718 ssl_library_ver=`cat conftest.ssllibver`
1719 AC_MSG_RESULT($ssl_library_ver)
1722 AC_MSG_RESULT(not found)
1723 AC_MSG_ERROR(OpenSSL library not found.)
1726 AC_MSG_WARN([cross compiling: not checking])
1730 # Sanity check OpenSSL headers
1731 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1735 #include <openssl/opensslv.h>
1736 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1743 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1744 Check config.log for details.
1745 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1748 AC_MSG_WARN([cross compiling: not checking])
1752 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1753 # because the system crypt() is more featureful.
1754 if test "x$check_for_libcrypt_before" = "x1"; then
1755 AC_CHECK_LIB(crypt, crypt)
1758 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1759 # version in OpenSSL.
1760 if test "x$check_for_libcrypt_later" = "x1"; then
1761 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1764 AC_CHECK_LIB(iaf, ia_openinfo)
1766 ### Configure cryptographic random number support
1768 # Check wheter OpenSSL seeds itself
1769 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1773 #include <openssl/rand.h>
1774 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1777 OPENSSL_SEEDS_ITSELF=yes
1782 # Default to use of the rand helper if OpenSSL doesn't
1787 AC_MSG_WARN([cross compiling: assuming yes])
1788 # This is safe, since all recent OpenSSL versions will
1789 # complain at runtime if not seeded correctly.
1790 OPENSSL_SEEDS_ITSELF=yes
1795 # Do we want to force the use of the rand helper?
1796 AC_ARG_WITH(rand-helper,
1797 [ --with-rand-helper Use subprocess to gather strong randomness ],
1799 if test "x$withval" = "xno" ; then
1800 # Force use of OpenSSL's internal RNG, even if
1801 # the previous test showed it to be unseeded.
1802 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1803 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1804 OPENSSL_SEEDS_ITSELF=yes
1813 # Which randomness source do we use?
1814 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
1816 AC_DEFINE(OPENSSL_PRNG_ONLY)
1817 RAND_MSG="OpenSSL internal ONLY"
1818 INSTALL_SSH_RAND_HELPER=""
1819 elif test ! -z "$USE_RAND_HELPER" ; then
1820 # install rand helper
1821 RAND_MSG="ssh-rand-helper"
1822 INSTALL_SSH_RAND_HELPER="yes"
1824 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1826 ### Configuration of ssh-rand-helper
1829 AC_ARG_WITH(prngd-port,
1830 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1839 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1842 if test ! -z "$withval" ; then
1843 PRNGD_PORT="$withval"
1844 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1849 # PRNGD Unix domain socket
1850 AC_ARG_WITH(prngd-socket,
1851 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1855 withval="/var/run/egd-pool"
1863 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1867 if test ! -z "$withval" ; then
1868 if test ! -z "$PRNGD_PORT" ; then
1869 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1871 if test ! -r "$withval" ; then
1872 AC_MSG_WARN(Entropy socket is not readable)
1874 PRNGD_SOCKET="$withval"
1875 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1879 # Check for existing socket only if we don't have a random device already
1880 if test "$USE_RAND_HELPER" = yes ; then
1881 AC_MSG_CHECKING(for PRNGD/EGD socket)
1882 # Insert other locations here
1883 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1884 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1885 PRNGD_SOCKET="$sock"
1886 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1890 if test ! -z "$PRNGD_SOCKET" ; then
1891 AC_MSG_RESULT($PRNGD_SOCKET)
1893 AC_MSG_RESULT(not found)
1899 # Change default command timeout for hashing entropy source
1901 AC_ARG_WITH(entropy-timeout,
1902 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1904 if test -n "$withval" && test "x$withval" != "xno" && \
1905 test "x${withval}" != "xyes"; then
1906 entropy_timeout=$withval
1910 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1912 SSH_PRIVSEP_USER=sshd
1913 AC_ARG_WITH(privsep-user,
1914 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1916 if test -n "$withval" && test "x$withval" != "xno" && \
1917 test "x${withval}" != "xyes"; then
1918 SSH_PRIVSEP_USER=$withval
1922 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1923 AC_SUBST(SSH_PRIVSEP_USER)
1925 # We do this little dance with the search path to insure
1926 # that programs that we select for use by installed programs
1927 # (which may be run by the super-user) come from trusted
1928 # locations before they come from the user's private area.
1929 # This should help avoid accidentally configuring some
1930 # random version of a program in someone's personal bin.
1934 test -h /bin 2> /dev/null && PATH=/usr/bin
1935 test -d /sbin && PATH=$PATH:/sbin
1936 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1937 PATH=$PATH:/etc:$OPATH
1939 # These programs are used by the command hashing source to gather entropy
1940 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1941 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1942 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1943 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1944 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1945 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1946 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1947 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1948 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1949 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1950 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1951 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1952 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1953 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1954 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1955 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1959 # Where does ssh-rand-helper get its randomness from?
1960 INSTALL_SSH_PRNG_CMDS=""
1961 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1962 if test ! -z "$PRNGD_PORT" ; then
1963 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1964 elif test ! -z "$PRNGD_SOCKET" ; then
1965 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1967 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1968 RAND_HELPER_CMDHASH=yes
1969 INSTALL_SSH_PRNG_CMDS="yes"
1972 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1975 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1976 if test ! -z "$SONY" ; then
1977 LIBS="$LIBS -liberty";
1980 # Checks for data types
1981 AC_CHECK_SIZEOF(char, 1)
1982 AC_CHECK_SIZEOF(short int, 2)
1983 AC_CHECK_SIZEOF(int, 4)
1984 AC_CHECK_SIZEOF(long int, 4)
1985 AC_CHECK_SIZEOF(long long int, 8)
1987 # Sanity check long long for some platforms (AIX)
1988 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1989 ac_cv_sizeof_long_long_int=0
1992 # More checks for data types
1993 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1995 [ #include <sys/types.h> ],
1997 [ ac_cv_have_u_int="yes" ],
1998 [ ac_cv_have_u_int="no" ]
2001 if test "x$ac_cv_have_u_int" = "xyes" ; then
2002 AC_DEFINE(HAVE_U_INT)
2006 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2008 [ #include <sys/types.h> ],
2009 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2010 [ ac_cv_have_intxx_t="yes" ],
2011 [ ac_cv_have_intxx_t="no" ]
2014 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2015 AC_DEFINE(HAVE_INTXX_T)
2019 if (test -z "$have_intxx_t" && \
2020 test "x$ac_cv_header_stdint_h" = "xyes")
2022 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2024 [ #include <stdint.h> ],
2025 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2027 AC_DEFINE(HAVE_INTXX_T)
2030 [ AC_MSG_RESULT(no) ]
2034 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2037 #include <sys/types.h>
2038 #ifdef HAVE_STDINT_H
2039 # include <stdint.h>
2041 #include <sys/socket.h>
2042 #ifdef HAVE_SYS_BITYPES_H
2043 # include <sys/bitypes.h>
2046 [ int64_t a; a = 1;],
2047 [ ac_cv_have_int64_t="yes" ],
2048 [ ac_cv_have_int64_t="no" ]
2051 if test "x$ac_cv_have_int64_t" = "xyes" ; then
2052 AC_DEFINE(HAVE_INT64_T)
2055 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2057 [ #include <sys/types.h> ],
2058 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2059 [ ac_cv_have_u_intxx_t="yes" ],
2060 [ ac_cv_have_u_intxx_t="no" ]
2063 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2064 AC_DEFINE(HAVE_U_INTXX_T)
2068 if test -z "$have_u_intxx_t" ; then
2069 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2071 [ #include <sys/socket.h> ],
2072 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2074 AC_DEFINE(HAVE_U_INTXX_T)
2077 [ AC_MSG_RESULT(no) ]
2081 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2083 [ #include <sys/types.h> ],
2084 [ u_int64_t a; a = 1;],
2085 [ ac_cv_have_u_int64_t="yes" ],
2086 [ ac_cv_have_u_int64_t="no" ]
2089 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2090 AC_DEFINE(HAVE_U_INT64_T)
2094 if test -z "$have_u_int64_t" ; then
2095 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2097 [ #include <sys/bitypes.h> ],
2098 [ u_int64_t a; a = 1],
2100 AC_DEFINE(HAVE_U_INT64_T)
2103 [ AC_MSG_RESULT(no) ]
2107 if test -z "$have_u_intxx_t" ; then
2108 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2111 #include <sys/types.h>
2113 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2114 [ ac_cv_have_uintxx_t="yes" ],
2115 [ ac_cv_have_uintxx_t="no" ]
2118 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2119 AC_DEFINE(HAVE_UINTXX_T)
2123 if test -z "$have_uintxx_t" ; then
2124 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2126 [ #include <stdint.h> ],
2127 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2129 AC_DEFINE(HAVE_UINTXX_T)
2132 [ AC_MSG_RESULT(no) ]
2136 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2137 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2139 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2142 #include <sys/bitypes.h>
2145 int8_t a; int16_t b; int32_t c;
2146 u_int8_t e; u_int16_t f; u_int32_t g;
2147 a = b = c = e = f = g = 1;
2150 AC_DEFINE(HAVE_U_INTXX_T)
2151 AC_DEFINE(HAVE_INTXX_T)
2159 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2162 #include <sys/types.h>
2164 [ u_char foo; foo = 125; ],
2165 [ ac_cv_have_u_char="yes" ],
2166 [ ac_cv_have_u_char="no" ]
2169 if test "x$ac_cv_have_u_char" = "xyes" ; then
2170 AC_DEFINE(HAVE_U_CHAR)
2175 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2177 AC_CHECK_TYPES(in_addr_t,,,
2178 [#include <sys/types.h>
2179 #include <netinet/in.h>])
2181 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2184 #include <sys/types.h>
2186 [ size_t foo; foo = 1235; ],
2187 [ ac_cv_have_size_t="yes" ],
2188 [ ac_cv_have_size_t="no" ]
2191 if test "x$ac_cv_have_size_t" = "xyes" ; then
2192 AC_DEFINE(HAVE_SIZE_T)
2195 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2198 #include <sys/types.h>
2200 [ ssize_t foo; foo = 1235; ],
2201 [ ac_cv_have_ssize_t="yes" ],
2202 [ ac_cv_have_ssize_t="no" ]
2205 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2206 AC_DEFINE(HAVE_SSIZE_T)
2209 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2214 [ clock_t foo; foo = 1235; ],
2215 [ ac_cv_have_clock_t="yes" ],
2216 [ ac_cv_have_clock_t="no" ]
2219 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2220 AC_DEFINE(HAVE_CLOCK_T)
2223 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2226 #include <sys/types.h>
2227 #include <sys/socket.h>
2229 [ sa_family_t foo; foo = 1235; ],
2230 [ ac_cv_have_sa_family_t="yes" ],
2233 #include <sys/types.h>
2234 #include <sys/socket.h>
2235 #include <netinet/in.h>
2237 [ sa_family_t foo; foo = 1235; ],
2238 [ ac_cv_have_sa_family_t="yes" ],
2240 [ ac_cv_have_sa_family_t="no" ]
2244 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2245 AC_DEFINE(HAVE_SA_FAMILY_T)
2248 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2251 #include <sys/types.h>
2253 [ pid_t foo; foo = 1235; ],
2254 [ ac_cv_have_pid_t="yes" ],
2255 [ ac_cv_have_pid_t="no" ]
2258 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2259 AC_DEFINE(HAVE_PID_T)
2262 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2265 #include <sys/types.h>
2267 [ mode_t foo; foo = 1235; ],
2268 [ ac_cv_have_mode_t="yes" ],
2269 [ ac_cv_have_mode_t="no" ]
2272 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2273 AC_DEFINE(HAVE_MODE_T)
2277 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2280 #include <sys/types.h>
2281 #include <sys/socket.h>
2283 [ struct sockaddr_storage s; ],
2284 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2285 [ ac_cv_have_struct_sockaddr_storage="no" ]
2288 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2289 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
2292 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2295 #include <sys/types.h>
2296 #include <netinet/in.h>
2298 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2299 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2300 [ ac_cv_have_struct_sockaddr_in6="no" ]
2303 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2304 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
2307 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2310 #include <sys/types.h>
2311 #include <netinet/in.h>
2313 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2314 [ ac_cv_have_struct_in6_addr="yes" ],
2315 [ ac_cv_have_struct_in6_addr="no" ]
2318 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2319 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2322 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2325 #include <sys/types.h>
2326 #include <sys/socket.h>
2329 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2330 [ ac_cv_have_struct_addrinfo="yes" ],
2331 [ ac_cv_have_struct_addrinfo="no" ]
2334 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2335 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2338 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2340 [ #include <sys/time.h> ],
2341 [ struct timeval tv; tv.tv_sec = 1;],
2342 [ ac_cv_have_struct_timeval="yes" ],
2343 [ ac_cv_have_struct_timeval="no" ]
2346 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2347 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2348 have_struct_timeval=1
2351 AC_CHECK_TYPES(struct timespec)
2353 # We need int64_t or else certian parts of the compile will fail.
2354 if test "x$ac_cv_have_int64_t" = "xno" && \
2355 test "x$ac_cv_sizeof_long_int" != "x8" && \
2356 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2357 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2358 echo "an alternative compiler (I.E., GCC) before continuing."
2362 dnl test snprintf (broken on SCO w/gcc)
2367 #ifdef HAVE_SNPRINTF
2371 char expected_out[50];
2373 #if (SIZEOF_LONG_INT == 8)
2374 long int num = 0x7fffffffffffffff;
2376 long long num = 0x7fffffffffffffffll;
2378 strcpy(expected_out, "9223372036854775807");
2379 snprintf(buf, mazsize, "%lld", num);
2380 if(strcmp(buf, expected_out) != 0)
2387 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2388 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2392 dnl Checks for structure members
2393 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2394 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2395 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2396 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2397 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2398 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2399 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2400 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2401 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2402 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2403 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2404 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2405 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2406 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2407 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2408 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2409 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2411 AC_CHECK_MEMBERS([struct stat.st_blksize])
2413 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2414 ac_cv_have_ss_family_in_struct_ss, [
2417 #include <sys/types.h>
2418 #include <sys/socket.h>
2420 [ struct sockaddr_storage s; s.ss_family = 1; ],
2421 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2422 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2425 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2426 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2429 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2430 ac_cv_have___ss_family_in_struct_ss, [
2433 #include <sys/types.h>
2434 #include <sys/socket.h>
2436 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2437 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2438 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2441 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2442 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2445 AC_CACHE_CHECK([for pw_class field in struct passwd],
2446 ac_cv_have_pw_class_in_struct_passwd, [
2451 [ struct passwd p; p.pw_class = 0; ],
2452 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2453 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2456 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2457 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2460 AC_CACHE_CHECK([for pw_expire field in struct passwd],
2461 ac_cv_have_pw_expire_in_struct_passwd, [
2466 [ struct passwd p; p.pw_expire = 0; ],
2467 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2468 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2471 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2472 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2475 AC_CACHE_CHECK([for pw_change field in struct passwd],
2476 ac_cv_have_pw_change_in_struct_passwd, [
2481 [ struct passwd p; p.pw_change = 0; ],
2482 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2483 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2486 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2487 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2490 dnl make sure we're using the real structure members and not defines
2491 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2492 ac_cv_have_accrights_in_msghdr, [
2495 #include <sys/types.h>
2496 #include <sys/socket.h>
2497 #include <sys/uio.h>
2499 #ifdef msg_accrights
2500 #error "msg_accrights is a macro"
2504 m.msg_accrights = 0;
2508 [ ac_cv_have_accrights_in_msghdr="yes" ],
2509 [ ac_cv_have_accrights_in_msghdr="no" ]
2512 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2513 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2516 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2517 ac_cv_have_control_in_msghdr, [
2520 #include <sys/types.h>
2521 #include <sys/socket.h>
2522 #include <sys/uio.h>
2525 #error "msg_control is a macro"
2533 [ ac_cv_have_control_in_msghdr="yes" ],
2534 [ ac_cv_have_control_in_msghdr="no" ]
2537 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2538 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2541 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2543 [ extern char *__progname; printf("%s", __progname); ],
2544 [ ac_cv_libc_defines___progname="yes" ],
2545 [ ac_cv_libc_defines___progname="no" ]
2548 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2549 AC_DEFINE(HAVE___PROGNAME)
2552 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2556 [ printf("%s", __FUNCTION__); ],
2557 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2558 [ ac_cv_cc_implements___FUNCTION__="no" ]
2561 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2562 AC_DEFINE(HAVE___FUNCTION__)
2565 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2569 [ printf("%s", __func__); ],
2570 [ ac_cv_cc_implements___func__="yes" ],
2571 [ ac_cv_cc_implements___func__="no" ]
2574 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2575 AC_DEFINE(HAVE___func__)
2578 AC_CACHE_CHECK([whether getopt has optreset support],
2579 ac_cv_have_getopt_optreset, [
2588 [ extern int optreset; optreset = 0; ],
2589 [ ac_cv_have_getopt_optreset="yes" ],
2590 [ ac_cv_have_getopt_optreset="no" ]
2593 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2594 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2597 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2599 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2600 [ ac_cv_libc_defines_sys_errlist="yes" ],
2601 [ ac_cv_libc_defines_sys_errlist="no" ]
2604 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2605 AC_DEFINE(HAVE_SYS_ERRLIST)
2609 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2611 [ extern int sys_nerr; printf("%i", sys_nerr);],
2612 [ ac_cv_libc_defines_sys_nerr="yes" ],
2613 [ ac_cv_libc_defines_sys_nerr="no" ]
2616 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2617 AC_DEFINE(HAVE_SYS_NERR)
2621 # Check whether user wants sectok support
2623 [ --with-sectok Enable smartcard support using libsectok],
2625 if test "x$withval" != "xno" ; then
2626 if test "x$withval" != "xyes" ; then
2627 CPPFLAGS="$CPPFLAGS -I${withval}"
2628 LDFLAGS="$LDFLAGS -L${withval}"
2629 if test ! -z "$need_dash_r" ; then
2630 LDFLAGS="$LDFLAGS -R${withval}"
2632 if test ! -z "$blibpath" ; then
2633 blibpath="$blibpath:${withval}"
2636 AC_CHECK_HEADERS(sectok.h)
2637 if test "$ac_cv_header_sectok_h" != yes; then
2638 AC_MSG_ERROR(Can't find sectok.h)
2640 AC_CHECK_LIB(sectok, sectok_open)
2641 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2642 AC_MSG_ERROR(Can't find libsectok)
2644 AC_DEFINE(SMARTCARD)
2645 AC_DEFINE(USE_SECTOK)
2646 SCARD_MSG="yes, using sectok"
2651 # Check whether user wants OpenSC support
2654 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2656 if test "x$withval" != "xno" ; then
2657 if test "x$withval" != "xyes" ; then
2658 OPENSC_CONFIG=$withval/bin/opensc-config
2660 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2662 if test "$OPENSC_CONFIG" != "no"; then
2663 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2664 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2665 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2666 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2667 AC_DEFINE(SMARTCARD)
2668 AC_DEFINE(USE_OPENSC)
2669 SCARD_MSG="yes, using OpenSC"
2675 # Check libraries needed by DNS fingerprint support
2676 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2677 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
2679 # Needed by our getrrsetbyname()
2680 AC_SEARCH_LIBS(res_query, resolv)
2681 AC_SEARCH_LIBS(dn_expand, resolv)
2682 AC_MSG_CHECKING(if res_query will link)
2683 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2686 LIBS="$LIBS -lresolv"
2687 AC_MSG_CHECKING(for res_query in -lresolv)
2692 res_query (0, 0, 0, 0, 0);
2696 [LIBS="$LIBS -lresolv"
2697 AC_MSG_RESULT(yes)],
2701 AC_CHECK_FUNCS(_getshort _getlong)
2702 AC_CHECK_DECLS([_getshort, _getlong], , ,
2703 [#include <sys/types.h>
2704 #include <arpa/nameser.h>])
2705 AC_CHECK_MEMBER(HEADER.ad,
2706 [AC_DEFINE(HAVE_HEADER_AD)],,
2707 [#include <arpa/nameser.h>])
2710 # Check whether user wants Kerberos 5 support
2712 AC_ARG_WITH(kerberos5,
2713 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2714 [ if test "x$withval" != "xno" ; then
2715 if test "x$withval" = "xyes" ; then
2716 KRB5ROOT="/usr/local"
2724 AC_MSG_CHECKING(for krb5-config)
2725 if test -x $KRB5ROOT/bin/krb5-config ; then
2726 KRB5CONF=$KRB5ROOT/bin/krb5-config
2727 AC_MSG_RESULT($KRB5CONF)
2729 AC_MSG_CHECKING(for gssapi support)
2730 if $KRB5CONF | grep gssapi >/dev/null ; then
2738 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2739 K5LIBS="`$KRB5CONF --libs $k5confopts`"
2740 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2741 AC_MSG_CHECKING(whether we are using Heimdal)
2742 AC_TRY_COMPILE([ #include <krb5.h> ],
2743 [ char *tmp = heimdal_version; ],
2744 [ AC_MSG_RESULT(yes)
2745 AC_DEFINE(HEIMDAL) ],
2750 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2751 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2752 AC_MSG_CHECKING(whether we are using Heimdal)
2753 AC_TRY_COMPILE([ #include <krb5.h> ],
2754 [ char *tmp = heimdal_version; ],
2755 [ AC_MSG_RESULT(yes)
2757 K5LIBS="-lkrb5 -ldes"
2758 K5LIBS="$K5LIBS -lcom_err -lasn1"
2759 AC_CHECK_LIB(roken, net_write,
2760 [K5LIBS="$K5LIBS -lroken"])
2763 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2766 AC_SEARCH_LIBS(dn_expand, resolv)
2768 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2770 K5LIBS="-lgssapi $K5LIBS" ],
2771 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2773 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2774 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2779 AC_CHECK_HEADER(gssapi.h, ,
2780 [ unset ac_cv_header_gssapi_h
2781 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2782 AC_CHECK_HEADERS(gssapi.h, ,
2783 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2789 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2790 AC_CHECK_HEADER(gssapi_krb5.h, ,
2791 [ CPPFLAGS="$oldCPP" ])
2794 if test ! -z "$need_dash_r" ; then
2795 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2797 if test ! -z "$blibpath" ; then
2798 blibpath="$blibpath:${KRB5ROOT}/lib"
2802 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2803 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2804 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2806 LIBS="$LIBS $K5LIBS"
2807 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2811 # Looking for programs, paths and files
2813 PRIVSEP_PATH=/var/empty
2814 AC_ARG_WITH(privsep-path,
2815 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2817 if test -n "$withval" && test "x$withval" != "xno" && \
2818 test "x${withval}" != "xyes"; then
2819 PRIVSEP_PATH=$withval
2823 AC_SUBST(PRIVSEP_PATH)
2826 [ --with-xauth=PATH Specify path to xauth program ],
2828 if test -n "$withval" && test "x$withval" != "xno" && \
2829 test "x${withval}" != "xyes"; then
2835 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2836 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2837 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2838 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2839 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2840 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2841 xauth_path="/usr/openwin/bin/xauth"
2847 AC_ARG_ENABLE(strip,
2848 [ --disable-strip Disable calling strip(1) on install],
2850 if test "x$enableval" = "xno" ; then
2857 if test -z "$xauth_path" ; then
2858 XAUTH_PATH="undefined"
2859 AC_SUBST(XAUTH_PATH)
2861 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2862 XAUTH_PATH=$xauth_path
2863 AC_SUBST(XAUTH_PATH)
2866 # Check for mail directory (last resort if we cannot get it from headers)
2867 if test ! -z "$MAIL" ; then
2868 maildir=`dirname $MAIL`
2869 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2872 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
2873 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2874 disable_ptmx_check=yes
2876 if test -z "$no_dev_ptmx" ; then
2877 if test "x$disable_ptmx_check" != "xyes" ; then
2878 AC_CHECK_FILE("/dev/ptmx",
2880 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2887 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
2888 AC_CHECK_FILE("/dev/ptc",
2890 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2895 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2898 # Options from here on. Some of these are preset by platform above
2899 AC_ARG_WITH(mantype,
2900 [ --with-mantype=man|cat|doc Set man page type],
2907 AC_MSG_ERROR(invalid man type: $withval)
2912 if test -z "$MANTYPE"; then
2913 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2914 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2915 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2917 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2924 if test "$MANTYPE" = "doc"; then
2931 # Check whether to enable MD5 passwords
2933 AC_ARG_WITH(md5-passwords,
2934 [ --with-md5-passwords Enable use of MD5 passwords],
2936 if test "x$withval" != "xno" ; then
2937 AC_DEFINE(HAVE_MD5_PASSWORDS)
2943 # Whether to disable shadow password support
2945 [ --without-shadow Disable shadow password support],
2947 if test "x$withval" = "xno" ; then
2948 AC_DEFINE(DISABLE_SHADOW)
2954 if test -z "$disable_shadow" ; then
2955 AC_MSG_CHECKING([if the systems has expire shadow information])
2958 #include <sys/types.h>
2961 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2962 [ sp_expire_available=yes ], []
2965 if test "x$sp_expire_available" = "xyes" ; then
2967 AC_DEFINE(HAS_SHADOW_EXPIRE)
2973 # Use ip address instead of hostname in $DISPLAY
2974 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2975 DISPLAY_HACK_MSG="yes"
2976 AC_DEFINE(IPADDR_IN_DISPLAY)
2978 DISPLAY_HACK_MSG="no"
2979 AC_ARG_WITH(ipaddr-display,
2980 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2982 if test "x$withval" != "xno" ; then
2983 AC_DEFINE(IPADDR_IN_DISPLAY)
2984 DISPLAY_HACK_MSG="yes"
2990 # check for /etc/default/login and use it if present.
2991 AC_ARG_ENABLE(etc-default-login,
2992 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
2993 [ if test "x$enableval" = "xno"; then
2994 AC_MSG_NOTICE([/etc/default/login handling disabled])
2995 etc_default_login=no
2997 etc_default_login=yes
2999 [ etc_default_login=yes ]
3002 if test "x$etc_default_login" != "xno"; then
3003 AC_CHECK_FILE("/etc/default/login",
3004 [ external_path_file=/etc/default/login ])
3005 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3007 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
3008 elif test "x$external_path_file" = "x/etc/default/login"; then
3009 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
3013 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3014 if test $ac_cv_func_login_getcapbool = "yes" && \
3015 test $ac_cv_header_login_cap_h = "yes" ; then
3016 external_path_file=/etc/login.conf
3019 # Whether to mess with the default path
3020 SERVER_PATH_MSG="(default)"
3021 AC_ARG_WITH(default-path,
3022 [ --with-default-path= Specify default \$PATH environment for server],
3024 if test "x$external_path_file" = "x/etc/login.conf" ; then
3026 --with-default-path=PATH has no effect on this system.
3027 Edit /etc/login.conf instead.])
3028 elif test "x$withval" != "xno" ; then
3029 if test ! -z "$external_path_file" ; then
3031 --with-default-path=PATH will only be used if PATH is not defined in
3032 $external_path_file .])
3034 user_path="$withval"
3035 SERVER_PATH_MSG="$withval"
3038 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3039 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3041 if test ! -z "$external_path_file" ; then
3043 If PATH is defined in $external_path_file, ensure the path to scp is included,
3044 otherwise scp will not work.])
3048 /* find out what STDPATH is */
3053 #ifndef _PATH_STDPATH
3054 # ifdef _PATH_USERPATH /* Irix */
3055 # define _PATH_STDPATH _PATH_USERPATH
3057 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3060 #include <sys/types.h>
3061 #include <sys/stat.h>
3063 #define DATA "conftest.stdpath"
3070 fd = fopen(DATA,"w");
3074 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3079 ], [ user_path=`cat conftest.stdpath` ],
3080 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3081 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3083 # make sure $bindir is in USER_PATH so scp will work
3084 t_bindir=`eval echo ${bindir}`
3086 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3089 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3091 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3092 if test $? -ne 0 ; then
3093 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3094 if test $? -ne 0 ; then
3095 user_path=$user_path:$t_bindir
3096 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3101 if test "x$external_path_file" != "x/etc/login.conf" ; then
3102 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
3106 # Set superuser path separately to user path
3107 AC_ARG_WITH(superuser-path,
3108 [ --with-superuser-path= Specify different path for super-user],
3110 if test -n "$withval" && test "x$withval" != "xno" && \
3111 test "x${withval}" != "xyes"; then
3112 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
3113 superuser_path=$withval
3119 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3120 IPV4_IN6_HACK_MSG="no"
3122 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3124 if test "x$withval" != "xno" ; then
3126 AC_DEFINE(IPV4_IN_IPV6)
3127 IPV4_IN6_HACK_MSG="yes"
3132 if test "x$inet6_default_4in6" = "xyes"; then
3133 AC_MSG_RESULT([yes (default)])
3134 AC_DEFINE(IPV4_IN_IPV6)
3135 IPV4_IN6_HACK_MSG="yes"
3137 AC_MSG_RESULT([no (default)])
3142 # Whether to enable BSD auth support
3144 AC_ARG_WITH(bsd-auth,
3145 [ --with-bsd-auth Enable BSD auth support],
3147 if test "x$withval" != "xno" ; then
3154 # Where to place sshd.pid
3156 # make sure the directory exists
3157 if test ! -d $piddir ; then
3158 piddir=`eval echo ${sysconfdir}`
3160 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3164 AC_ARG_WITH(pid-dir,
3165 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3167 if test -n "$withval" && test "x$withval" != "xno" && \
3168 test "x${withval}" != "xyes"; then
3170 if test ! -d $piddir ; then
3171 AC_MSG_WARN([** no $piddir directory on this system **])
3177 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
3180 dnl allow user to disable some login recording features
3181 AC_ARG_ENABLE(lastlog,
3182 [ --disable-lastlog disable use of lastlog even if detected [no]],
3184 if test "x$enableval" = "xno" ; then
3185 AC_DEFINE(DISABLE_LASTLOG)
3190 [ --disable-utmp disable use of utmp even if detected [no]],
3192 if test "x$enableval" = "xno" ; then
3193 AC_DEFINE(DISABLE_UTMP)
3197 AC_ARG_ENABLE(utmpx,
3198 [ --disable-utmpx disable use of utmpx even if detected [no]],
3200 if test "x$enableval" = "xno" ; then
3201 AC_DEFINE(DISABLE_UTMPX)
3206 [ --disable-wtmp disable use of wtmp even if detected [no]],
3208 if test "x$enableval" = "xno" ; then
3209 AC_DEFINE(DISABLE_WTMP)
3213 AC_ARG_ENABLE(wtmpx,
3214 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
3216 if test "x$enableval" = "xno" ; then
3217 AC_DEFINE(DISABLE_WTMPX)
3221 AC_ARG_ENABLE(libutil,
3222 [ --disable-libutil disable use of libutil (login() etc.) [no]],
3224 if test "x$enableval" = "xno" ; then
3225 AC_DEFINE(DISABLE_LOGIN)
3229 AC_ARG_ENABLE(pututline,
3230 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
3232 if test "x$enableval" = "xno" ; then
3233 AC_DEFINE(DISABLE_PUTUTLINE)
3237 AC_ARG_ENABLE(pututxline,
3238 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
3240 if test "x$enableval" = "xno" ; then
3241 AC_DEFINE(DISABLE_PUTUTXLINE)
3245 AC_ARG_WITH(lastlog,
3246 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
3248 if test "x$withval" = "xno" ; then
3249 AC_DEFINE(DISABLE_LASTLOG)
3250 elif test -n "$withval" && test "x${withval}" != "xyes"; then
3251 conf_lastlog_location=$withval
3256 dnl lastlog, [uw]tmpx? detection
3257 dnl NOTE: set the paths in the platform section to avoid the
3258 dnl need for command-line parameters
3259 dnl lastlog and [uw]tmp are subject to a file search if all else fails
3261 dnl lastlog detection
3262 dnl NOTE: the code itself will detect if lastlog is a directory
3263 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3265 #include <sys/types.h>
3267 #ifdef HAVE_LASTLOG_H
3268 # include <lastlog.h>
3277 [ char *lastlog = LASTLOG_FILE; ],
3278 [ AC_MSG_RESULT(yes) ],
3281 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3283 #include <sys/types.h>
3285 #ifdef HAVE_LASTLOG_H
3286 # include <lastlog.h>
3292 [ char *lastlog = _PATH_LASTLOG; ],
3293 [ AC_MSG_RESULT(yes) ],
3296 system_lastlog_path=no
3301 if test -z "$conf_lastlog_location"; then
3302 if test x"$system_lastlog_path" = x"no" ; then
3303 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3304 if (test -d "$f" || test -f "$f") ; then
3305 conf_lastlog_location=$f
3308 if test -z "$conf_lastlog_location"; then
3309 AC_MSG_WARN([** Cannot find lastlog **])
3310 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
3315 if test -n "$conf_lastlog_location"; then
3316 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
3320 AC_MSG_CHECKING([if your system defines UTMP_FILE])
3322 #include <sys/types.h>
3328 [ char *utmp = UTMP_FILE; ],
3329 [ AC_MSG_RESULT(yes) ],
3331 system_utmp_path=no ]
3333 if test -z "$conf_utmp_location"; then
3334 if test x"$system_utmp_path" = x"no" ; then
3335 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3336 if test -f $f ; then
3337 conf_utmp_location=$f
3340 if test -z "$conf_utmp_location"; then
3341 AC_DEFINE(DISABLE_UTMP)
3345 if test -n "$conf_utmp_location"; then
3346 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
3350 AC_MSG_CHECKING([if your system defines WTMP_FILE])
3352 #include <sys/types.h>
3358 [ char *wtmp = WTMP_FILE; ],
3359 [ AC_MSG_RESULT(yes) ],
3361 system_wtmp_path=no ]
3363 if test -z "$conf_wtmp_location"; then
3364 if test x"$system_wtmp_path" = x"no" ; then
3365 for f in /usr/adm/wtmp /var/log/wtmp; do
3366 if test -f $f ; then
3367 conf_wtmp_location=$f
3370 if test -z "$conf_wtmp_location"; then
3371 AC_DEFINE(DISABLE_WTMP)
3375 if test -n "$conf_wtmp_location"; then
3376 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
3380 dnl utmpx detection - I don't know any system so perverse as to require
3381 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3383 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3385 #include <sys/types.h>
3394 [ char *utmpx = UTMPX_FILE; ],
3395 [ AC_MSG_RESULT(yes) ],
3397 system_utmpx_path=no ]
3399 if test -z "$conf_utmpx_location"; then
3400 if test x"$system_utmpx_path" = x"no" ; then
3401 AC_DEFINE(DISABLE_UTMPX)
3404 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
3408 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3410 #include <sys/types.h>
3419 [ char *wtmpx = WTMPX_FILE; ],
3420 [ AC_MSG_RESULT(yes) ],
3422 system_wtmpx_path=no ]
3424 if test -z "$conf_wtmpx_location"; then
3425 if test x"$system_wtmpx_path" = x"no" ; then
3426 AC_DEFINE(DISABLE_WTMPX)
3429 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
3433 if test ! -z "$blibpath" ; then
3434 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3435 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3438 dnl remove pam and dl because they are in $LIBPAM
3439 if test "$PAM_MSG" = yes ; then
3440 LIBS=`echo $LIBS | sed 's/-lpam //'`
3442 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3443 LIBS=`echo $LIBS | sed 's/-ldl //'`
3446 dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3448 CFLAGS="$CFLAGS $werror_flags"
3451 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3452 scard/Makefile ssh_prng_cmds survey.sh])
3455 # Print summary of options
3457 # Someone please show me a better way :)
3458 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3459 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3460 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3461 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3462 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3463 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3464 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
3465 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3466 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3467 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3470 echo "OpenSSH has been configured with the following options:"
3471 echo " User binaries: $B"
3472 echo " System binaries: $C"
3473 echo " Configuration files: $D"
3474 echo " Askpass program: $E"
3475 echo " Manual pages: $F"
3476 echo " PID file: $G"
3477 echo " Privilege separation chroot path: $H"
3478 if test "x$external_path_file" = "x/etc/login.conf" ; then
3479 echo " At runtime, sshd will use the path defined in $external_path_file"
3480 echo " Make sure the path to scp is present, otherwise scp will not work"
3482 echo " sshd default user PATH: $I"
3483 if test ! -z "$external_path_file"; then
3484 echo " (If PATH is set in $external_path_file it will be used instead. If"
3485 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3488 if test ! -z "$superuser_path" ; then
3489 echo " sshd superuser user PATH: $J"
3491 echo " Manpage format: $MANTYPE"
3492 echo " PAM support: $PAM_MSG"
3493 echo " KerberosV support: $KRB5_MSG"
3494 echo " Smartcard support: $SCARD_MSG"
3495 echo " S/KEY support: $SKEY_MSG"
3496 echo " OPIE support: $OPIE_MSG"
3497 echo " TCP Wrappers support: $TCPW_MSG"
3498 echo " MD5 password support: $MD5_MSG"
3499 echo " libedit support: $LIBEDIT_MSG"
3500 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
3501 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3502 echo " BSD Auth support: $BSD_AUTH_MSG"
3503 echo " Random number source: $RAND_MSG"
3504 if test ! -z "$USE_RAND_HELPER" ; then
3505 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
3510 echo " Host: ${host}"
3511 echo " Compiler: ${CC}"
3512 echo " Compiler flags: ${CFLAGS}"
3513 echo "Preprocessor flags: ${CPPFLAGS}"
3514 echo " Linker flags: ${LDFLAGS}"
3515 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
3519 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
3520 echo "SVR4 style packages are supported with \"make package\""
3524 if test "x$PAM_MSG" = "xyes" ; then
3525 echo "PAM is enabled. You may need to install a PAM control file "
3526 echo "for sshd, otherwise password authentication may fail. "
3527 echo "Example PAM control files can be found in the contrib/ "
3532 if test ! -z "$RAND_HELPER_CMDHASH" ; then
3533 echo "WARNING: you are using the builtin random number collection "
3534 echo "service. Please read WARNING.RNG and request that your OS "
3535 echo "vendor includes kernel-based random number collection in "
3536 echo "future versions of your OS."
3540 if test ! -z "$NO_PEERCHECK" ; then
3541 echo "WARNING: the operating system that you are using does not "
3542 echo "appear to support either the getpeereid() API nor the "
3543 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3544 echo "enforce security checks to prevent unauthorised connections to "
3545 echo "ssh-agent. Their absence increases the risk that a malicious "
3546 echo "user can connect to your agent. "
3550 if test "$AUDIT_MODULE" = "bsm" ; then
3551 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3552 echo "See the Solaris section in README.platform for details."