3 # Copyright (c) 1999-2004 Damien Miller
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 AC_INIT(OpenSSH, Portable)
18 AC_CONFIG_SRCDIR([ssh.c])
20 AC_CONFIG_HEADER(config.h)
25 # Checks for programs.
31 AC_PATH_PROG(CAT, cat)
32 AC_PATH_PROG(KILL, kill)
33 AC_PATH_PROGS(PERL, perl5 perl)
34 AC_PATH_PROG(SED, sed)
36 AC_PATH_PROG(ENT, ent)
38 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
42 AC_SUBST(TEST_SHELL,sh)
45 AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47 AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49 AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
54 if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
58 # Use LOGIN_PROGRAM from environment if possible
59 if test ! -z "$LOGIN_PROGRAM" ; then
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
63 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
64 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
65 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
69 AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
70 if test ! -z "$PATH_PASSWD_PROG" ; then
71 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
74 if test -z "$LD" ; then
80 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
81 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
85 [ --without-rpath Disable auto-added -R linker paths],
87 if test "x$withval" = "xno" ; then
90 if test "x$withval" = "xyes" ; then
96 # Check for some target-specific stuff
99 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
100 if (test -z "$blibpath"); then
101 blibpath="/usr/lib:/lib"
103 saved_LDFLAGS="$LDFLAGS"
104 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
105 if (test -z "$blibflags"); then
106 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
107 AC_TRY_LINK([], [], [blibflags=$tryflags])
110 if (test -z "$blibflags"); then
111 AC_MSG_RESULT(not found)
112 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
114 AC_MSG_RESULT($blibflags)
116 LDFLAGS="$saved_LDFLAGS"
117 dnl Check for authenticate. Might be in libs.a on older AIXes
118 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
119 [AC_CHECK_LIB(s,authenticate,
120 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
124 dnl Check for various auth function declarations in headers.
125 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
126 passwdexpired], , , [#include <usersec.h>])
127 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
128 AC_CHECK_DECLS(loginfailed,
129 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
131 [#include <usersec.h>],
132 [(void)loginfailed("user","host","tty",0);],
134 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
138 [#include <usersec.h>]
140 AC_CHECK_FUNCS(setauthdb)
141 check_for_aix_broken_getaddrinfo=1
142 AC_DEFINE(BROKEN_REALPATH)
143 AC_DEFINE(SETEUID_BREAKS_SETUID)
144 AC_DEFINE(BROKEN_SETREUID)
145 AC_DEFINE(BROKEN_SETREGID)
146 dnl AIX handles lastlog as part of its login message
147 AC_DEFINE(DISABLE_LASTLOG)
148 AC_DEFINE(LOGIN_NEEDS_UTMPX)
149 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
152 check_for_libcrypt_later=1
153 LIBS="$LIBS /usr/lib/textmode.o"
154 AC_DEFINE(HAVE_CYGWIN)
156 AC_DEFINE(DISABLE_SHADOW)
157 AC_DEFINE(IP_TOS_IS_BROKEN)
158 AC_DEFINE(NO_X11_UNIX_SOCKETS)
159 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
160 AC_DEFINE(DISABLE_FD_PASSING)
163 AC_DEFINE(IP_TOS_IS_BROKEN)
164 AC_DEFINE(SETEUID_BREAKS_SETUID)
165 AC_DEFINE(BROKEN_SETREUID)
166 AC_DEFINE(BROKEN_SETREGID)
169 AC_MSG_CHECKING(if we have working getaddrinfo)
170 AC_TRY_RUN([#include <mach-o/dyld.h>
171 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
175 }], [AC_MSG_RESULT(working)],
176 [AC_MSG_RESULT(buggy)
177 AC_DEFINE(BROKEN_GETADDRINFO)],
178 [AC_MSG_RESULT(assume it is working)])
179 AC_DEFINE(SETEUID_BREAKS_SETUID)
180 AC_DEFINE(BROKEN_SETREUID)
181 AC_DEFINE(BROKEN_SETREGID)
182 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
185 if test -z "$GCC"; then
188 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
189 IPADDR_IN_DISPLAY=yes
190 AC_DEFINE(HAVE_SECUREWARE)
192 AC_DEFINE(LOGIN_NO_ENDOPT)
193 AC_DEFINE(LOGIN_NEEDS_UTMPX)
194 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
195 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
196 LIBS="$LIBS -lsec -lsecpw"
197 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
198 disable_ptmx_check=yes
201 if test -z "$GCC"; then
204 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
205 IPADDR_IN_DISPLAY=yes
207 AC_DEFINE(LOGIN_NO_ENDOPT)
208 AC_DEFINE(LOGIN_NEEDS_UTMPX)
209 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
210 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
212 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
215 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
216 IPADDR_IN_DISPLAY=yes
217 AC_DEFINE(PAM_SUN_CODEBASE)
219 AC_DEFINE(LOGIN_NO_ENDOPT)
220 AC_DEFINE(LOGIN_NEEDS_UTMPX)
221 AC_DEFINE(DISABLE_UTMP)
222 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
223 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
224 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
225 check_for_hpux_broken_getaddrinfo=1
226 check_for_conflicting_getspnam=1
228 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
231 PATH="$PATH:/usr/etc"
232 AC_DEFINE(BROKEN_INET_NTOA)
233 AC_DEFINE(SETEUID_BREAKS_SETUID)
234 AC_DEFINE(BROKEN_SETREUID)
235 AC_DEFINE(BROKEN_SETREGID)
236 AC_DEFINE(WITH_ABBREV_NO_TTY)
237 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
240 PATH="$PATH:/usr/etc"
241 AC_DEFINE(WITH_IRIX_ARRAY)
242 AC_DEFINE(WITH_IRIX_PROJECT)
243 AC_DEFINE(WITH_IRIX_AUDIT)
244 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
245 AC_DEFINE(BROKEN_INET_NTOA)
246 AC_DEFINE(SETEUID_BREAKS_SETUID)
247 AC_DEFINE(BROKEN_SETREUID)
248 AC_DEFINE(BROKEN_SETREGID)
249 AC_DEFINE(BROKEN_UPDWTMPX)
250 AC_DEFINE(WITH_ABBREV_NO_TTY)
251 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
255 check_for_libcrypt_later=1
256 check_for_openpty_ctty_bug=1
257 AC_DEFINE(DONT_TRY_OTHER_AF)
258 AC_DEFINE(PAM_TTY_KLUDGE)
259 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
260 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
261 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
262 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
263 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
264 inet6_default_4in6=yes
267 AC_DEFINE(BROKEN_CMSG_TYPE)
271 mips-sony-bsd|mips-sony-newsos4)
272 AC_DEFINE(HAVE_NEWS4)
276 check_for_libcrypt_before=1
277 if test "x$withval" != "xno" ; then
282 check_for_libcrypt_later=1
285 AC_DEFINE(SETEUID_BREAKS_SETUID)
286 AC_DEFINE(BROKEN_SETREUID)
287 AC_DEFINE(BROKEN_SETREGID)
290 conf_lastlog_location="/usr/adm/lastlog"
291 conf_utmp_location=/etc/utmp
292 conf_wtmp_location=/usr/adm/wtmp
295 AC_DEFINE(BROKEN_REALPATH)
297 AC_DEFINE(BROKEN_SAVED_UIDS)
300 if test "x$withval" != "xno" ; then
303 AC_DEFINE(PAM_SUN_CODEBASE)
304 AC_DEFINE(LOGIN_NEEDS_UTMPX)
305 AC_DEFINE(LOGIN_NEEDS_TERM)
306 AC_DEFINE(PAM_TTY_KLUDGE)
307 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
308 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
309 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
310 AC_DEFINE(SSHD_ACQUIRES_CTTY)
311 external_path_file=/etc/default/login
312 # hardwire lastlog location (can't detect it on some versions)
313 conf_lastlog_location="/var/adm/lastlog"
314 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
315 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
316 if test "$sol2ver" -ge 8; then
318 AC_DEFINE(DISABLE_UTMP)
319 AC_DEFINE(DISABLE_WTMP)
325 CPPFLAGS="$CPPFLAGS -DSUNOS4"
326 AC_CHECK_FUNCS(getpwanam)
327 AC_DEFINE(PAM_SUN_CODEBASE)
328 conf_utmp_location=/etc/utmp
329 conf_wtmp_location=/var/adm/wtmp
330 conf_lastlog_location=/var/adm/lastlog
336 AC_DEFINE(SSHD_ACQUIRES_CTTY)
337 AC_DEFINE(SETEUID_BREAKS_SETUID)
338 AC_DEFINE(BROKEN_SETREUID)
339 AC_DEFINE(BROKEN_SETREGID)
342 # /usr/ucblib MUST NOT be searched on ReliantUNIX
343 AC_CHECK_LIB(dl, dlsym, ,)
344 # -lresolv needs to be at then end of LIBS or DNS lookups break
345 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
346 IPADDR_IN_DISPLAY=yes
348 AC_DEFINE(IP_TOS_IS_BROKEN)
349 AC_DEFINE(SETEUID_BREAKS_SETUID)
350 AC_DEFINE(BROKEN_SETREUID)
351 AC_DEFINE(BROKEN_SETREGID)
352 AC_DEFINE(SSHD_ACQUIRES_CTTY)
353 external_path_file=/etc/default/login
354 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
355 # Attention: always take care to bind libsocket and libnsl before libc,
356 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
358 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
361 AC_DEFINE(SETEUID_BREAKS_SETUID)
362 AC_DEFINE(BROKEN_SETREUID)
363 AC_DEFINE(BROKEN_SETREGID)
365 # UnixWare 7.x, OpenUNIX 8
368 AC_DEFINE(SETEUID_BREAKS_SETUID)
369 AC_DEFINE(BROKEN_SETREUID)
370 AC_DEFINE(BROKEN_SETREGID)
374 # SCO UNIX and OEM versions of SCO UNIX
376 AC_MSG_ERROR("This Platform is no longer supported.")
380 if test -z "$GCC"; then
381 CFLAGS="$CFLAGS -belf"
383 LIBS="$LIBS -lprot -lx -ltinfo -lm"
386 AC_DEFINE(HAVE_SECUREWARE)
387 AC_DEFINE(DISABLE_SHADOW)
388 AC_DEFINE(DISABLE_FD_PASSING)
389 AC_DEFINE(SETEUID_BREAKS_SETUID)
390 AC_DEFINE(BROKEN_SETREUID)
391 AC_DEFINE(BROKEN_SETREGID)
392 AC_DEFINE(WITH_ABBREV_NO_TTY)
393 AC_DEFINE(BROKEN_UPDWTMPX)
394 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
395 AC_CHECK_FUNCS(getluid setluid)
400 AC_DEFINE(NO_SSH_LASTLOG)
401 AC_DEFINE(SETEUID_BREAKS_SETUID)
402 AC_DEFINE(BROKEN_SETREUID)
403 AC_DEFINE(BROKEN_SETREGID)
405 AC_DEFINE(DISABLE_FD_PASSING)
407 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
411 AC_DEFINE(SETEUID_BREAKS_SETUID)
412 AC_DEFINE(BROKEN_SETREUID)
413 AC_DEFINE(BROKEN_SETREGID)
414 AC_DEFINE(WITH_ABBREV_NO_TTY)
416 AC_DEFINE(DISABLE_FD_PASSING)
418 LIBS="$LIBS -lgen -lacid -ldb"
422 AC_DEFINE(SETEUID_BREAKS_SETUID)
423 AC_DEFINE(BROKEN_SETREUID)
424 AC_DEFINE(BROKEN_SETREGID)
426 AC_DEFINE(DISABLE_FD_PASSING)
427 AC_DEFINE(NO_SSH_LASTLOG)
428 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
429 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
433 AC_MSG_CHECKING(for Digital Unix SIA)
436 [ --with-osfsia Enable Digital Unix SIA],
438 if test "x$withval" = "xno" ; then
439 AC_MSG_RESULT(disabled)
444 if test -z "$no_osfsia" ; then
445 if test -f /etc/sia/matrix.conf; then
447 AC_DEFINE(HAVE_OSF_SIA)
448 AC_DEFINE(DISABLE_LOGIN)
449 AC_DEFINE(DISABLE_FD_PASSING)
450 LIBS="$LIBS -lsecurity -ldb -lm -laud"
453 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
456 AC_DEFINE(BROKEN_GETADDRINFO)
457 AC_DEFINE(SETEUID_BREAKS_SETUID)
458 AC_DEFINE(BROKEN_SETREUID)
459 AC_DEFINE(BROKEN_SETREGID)
464 AC_DEFINE(NO_X11_UNIX_SOCKETS)
465 AC_DEFINE(MISSING_NFDBITS)
466 AC_DEFINE(MISSING_HOWMANY)
467 AC_DEFINE(MISSING_FD_MASK)
471 # Allow user to specify flags
473 [ --with-cflags Specify additional flags to pass to compiler],
475 if test "x$withval" != "xno" ; then
476 CFLAGS="$CFLAGS $withval"
480 AC_ARG_WITH(cppflags,
481 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
483 if test "x$withval" != "xno"; then
484 CPPFLAGS="$CPPFLAGS $withval"
489 [ --with-ldflags Specify additional flags to pass to linker],
491 if test "x$withval" != "xno" ; then
492 LDFLAGS="$LDFLAGS $withval"
497 [ --with-libs Specify additional libraries to link with],
499 if test "x$withval" != "xno" ; then
500 LIBS="$LIBS $withval"
505 AC_MSG_CHECKING(compiler and flags for sanity)
511 [ AC_MSG_RESULT(yes) ],
514 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
516 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
519 # Checks for header files.
520 AC_CHECK_HEADERS(bstring.h crypt.h dirent.h endian.h features.h \
521 floatingpoint.h getopt.h glob.h ia.h lastlog.h limits.h login.h \
522 login_cap.h maillock.h ndir.h netdb.h netgroup.h \
523 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
524 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
525 strings.h sys/dir.h sys/strtio.h sys/audit.h sys/bitypes.h \
526 sys/bsdtty.h sys/cdefs.h sys/mman.h sys/ndir.h sys/prctl.h \
527 sys/pstat.h sys/select.h sys/stat.h sys/stream.h \
528 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h sys/un.h \
529 time.h tmpdir.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
531 # sys/ptms.h requires sys/stream.h to be included first on Solaris
532 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
533 #ifdef HAVE_SYS_STREAM_H
534 # include <sys/stream.h>
538 # Checks for libraries.
539 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
540 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
542 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
543 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
544 AC_CHECK_LIB(gen, dirname,[
545 AC_CACHE_CHECK([for broken dirname],
546 ac_cv_have_broken_dirname, [
554 int main(int argc, char **argv) {
557 strncpy(buf,"/etc", 32);
559 if (!s || strncmp(s, "/", 32) != 0) {
566 [ ac_cv_have_broken_dirname="no" ],
567 [ ac_cv_have_broken_dirname="yes" ]
571 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
573 AC_DEFINE(HAVE_DIRNAME)
574 AC_CHECK_HEADERS(libgen.h)
579 AC_CHECK_FUNC(getspnam, ,
580 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
581 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
585 [ --with-zlib=PATH Use zlib in PATH],
587 if test "x$withval" = "xno" ; then
588 AC_MSG_ERROR([*** zlib is required ***])
590 if test -d "$withval/lib"; then
591 if test -n "${need_dash_r}"; then
592 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
594 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
597 if test -n "${need_dash_r}"; then
598 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
600 LDFLAGS="-L${withval} ${LDFLAGS}"
603 if test -d "$withval/include"; then
604 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
606 CPPFLAGS="-I${withval} ${CPPFLAGS}"
611 AC_CHECK_LIB(z, deflate, ,
613 saved_CPPFLAGS="$CPPFLAGS"
614 saved_LDFLAGS="$LDFLAGS"
616 dnl Check default zlib install dir
617 if test -n "${need_dash_r}"; then
618 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
620 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
622 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
624 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
626 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
631 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
633 AC_ARG_WITH(zlib-version-check,
634 [ --without-zlib-version-check Disable zlib version check],
635 [ if test "x$withval" = "xno" ; then
636 zlib_check_nonfatal=1
641 AC_MSG_CHECKING(for zlib 1.1.4 or greater)
642 AC_RUN_IFELSE([AC_LANG_SOURCE([[
647 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
649 v = a*1000000 + b*1000 + c;
657 if test -z "$zlib_check_nonfatal" ; then
658 AC_MSG_ERROR([*** zlib too old - check config.log ***
659 Your reported zlib version has known security problems. It's possible your
660 vendor has fixed these problems without changing the version number. If you
661 are sure this is the case, you can disable the check by running
662 "./configure --without-zlib-version-check".
663 If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
665 AC_MSG_WARN([zlib version may have security problems])
668 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
672 AC_CHECK_FUNC(strcasecmp,
673 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
675 AC_CHECK_FUNC(utimes,
676 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
677 LIBS="$LIBS -lc89"]) ]
680 dnl Checks for libutil functions
681 AC_CHECK_HEADERS(libutil.h)
682 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
683 AC_CHECK_FUNCS(logout updwtmp logwtmp)
687 # Check for ALTDIRFUNC glob() extension
688 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
689 AC_EGREP_CPP(FOUNDIT,
692 #ifdef GLOB_ALTDIRFUNC
697 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
705 # Check for g.gl_matchc glob() extension
706 AC_MSG_CHECKING(for gl_matchc field in glob_t)
707 AC_EGREP_CPP(FOUNDIT,
710 int main(void){glob_t g; g.gl_matchc = 1;}
713 AC_DEFINE(GLOB_HAS_GL_MATCHC)
721 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
724 #include <sys/types.h>
726 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
728 [AC_MSG_RESULT(yes)],
731 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
734 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
735 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
739 AC_MSG_CHECKING([for /proc/pid/fd directory])
740 if test -d "/proc/$$/fd" ; then
741 AC_DEFINE(HAVE_PROC_PID)
747 # Check whether user wants S/Key support
750 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
752 if test "x$withval" != "xno" ; then
754 if test "x$withval" != "xyes" ; then
755 CPPFLAGS="$CPPFLAGS -I${withval}/include"
756 LDFLAGS="$LDFLAGS -L${withval}/lib"
763 AC_MSG_CHECKING([for s/key support])
768 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
770 [AC_MSG_RESULT(yes)],
773 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
775 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
779 [(void)skeychallenge(NULL,"name","",0);],
781 AC_DEFINE(SKEYCHALLENGE_4ARG)],
788 # Check whether user wants TCP wrappers support
790 AC_ARG_WITH(tcp-wrappers,
791 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
793 if test "x$withval" != "xno" ; then
795 saved_LDFLAGS="$LDFLAGS"
796 saved_CPPFLAGS="$CPPFLAGS"
797 if test -n "${withval}" && \
798 test "${withval}" != "yes"; then
799 if test -d "${withval}/lib"; then
800 if test -n "${need_dash_r}"; then
801 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
803 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
806 if test -n "${need_dash_r}"; then
807 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
809 LDFLAGS="-L${withval} ${LDFLAGS}"
812 if test -d "${withval}/include"; then
813 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
815 CPPFLAGS="-I${withval} ${CPPFLAGS}"
819 LIBS="$LIBWRAP $LIBS"
820 AC_MSG_CHECKING(for libwrap)
823 #include <sys/types.h>
824 #include <sys/socket.h>
825 #include <netinet/in.h>
827 int deny_severity = 0, allow_severity = 0;
837 AC_MSG_ERROR([*** libwrap missing])
845 # Check whether user wants libedit support
848 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
849 [ if test "x$withval" != "xno" ; then
850 AC_CHECK_LIB(edit, el_init,
851 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
852 LIBEDIT="-ledit -lcurses"
863 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
865 AC_MSG_CHECKING(for supported audit module)
870 dnl Checks for headers, libs and functions
871 AC_CHECK_HEADERS(bsm/audit.h, [],
872 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
873 AC_CHECK_LIB(bsm, getaudit, [],
874 [AC_MSG_ERROR(BSM enabled and required library not found)])
875 AC_CHECK_FUNCS(getaudit, [],
876 [AC_MSG_ERROR(BSM enabled and required function not found)])
878 AC_CHECK_FUNCS(getaudit_addr)
879 AC_DEFINE(USE_BSM_AUDIT, [], [Use BSM audit module])
884 AC_DEFINE(SSH_AUDIT_EVENTS, [], Use audit debugging module)
887 AC_MSG_ERROR([Unknown audit module $withval])
892 dnl Checks for library functions. Please keep in alphabetical order
894 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
895 bindresvport_sa clock closefrom dirfd fchdir fchmod fchown \
896 freeaddrinfo futimes getaddrinfo getcwd getgrouplist getnameinfo \
897 getopt getpeereid _getpty getrlimit getttyent glob inet_aton \
898 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
899 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
900 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
901 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
902 setproctitle setregid setreuid setrlimit \
903 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
904 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
905 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
908 # IRIX has a const char return value for gai_strerror()
909 AC_CHECK_FUNCS(gai_strerror,[
910 AC_DEFINE(HAVE_GAI_STRERROR)
912 #include <sys/types.h>
913 #include <sys/socket.h>
916 const char *gai_strerror(int);],[
919 str = gai_strerror(0);],[
920 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
921 [Define if gai_strerror() returns const char *])])])
923 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
925 dnl Make sure prototypes are defined for these before using them.
926 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
927 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
929 dnl tcsendbreak might be a macro
930 AC_CHECK_DECL(tcsendbreak,
931 [AC_DEFINE(HAVE_TCSENDBREAK)],
932 [AC_CHECK_FUNCS(tcsendbreak)],
933 [#include <termios.h>]
936 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
938 AC_CHECK_FUNCS(setresuid, [
939 dnl Some platorms have setresuid that isn't implemented, test for this
940 AC_MSG_CHECKING(if setresuid seems to work)
945 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
947 [AC_MSG_RESULT(yes)],
948 [AC_DEFINE(BROKEN_SETRESUID)
949 AC_MSG_RESULT(not implemented)],
950 [AC_MSG_WARN([cross compiling: not checking setresuid])]
954 AC_CHECK_FUNCS(setresgid, [
955 dnl Some platorms have setresgid that isn't implemented, test for this
956 AC_MSG_CHECKING(if setresgid seems to work)
961 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
963 [AC_MSG_RESULT(yes)],
964 [AC_DEFINE(BROKEN_SETRESGID)
965 AC_MSG_RESULT(not implemented)],
966 [AC_MSG_WARN([cross compiling: not checking setresuid])]
970 dnl Checks for time functions
971 AC_CHECK_FUNCS(gettimeofday time)
972 dnl Checks for utmp functions
973 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
974 AC_CHECK_FUNCS(utmpname)
975 dnl Checks for utmpx functions
976 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
977 AC_CHECK_FUNCS(setutxent utmpxname)
979 AC_CHECK_FUNC(daemon,
980 [AC_DEFINE(HAVE_DAEMON)],
981 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
984 AC_CHECK_FUNC(getpagesize,
985 [AC_DEFINE(HAVE_GETPAGESIZE)],
986 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
989 # Check for broken snprintf
990 if test "x$ac_cv_func_snprintf" = "xyes" ; then
991 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
995 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
997 [AC_MSG_RESULT(yes)],
1000 AC_DEFINE(BROKEN_SNPRINTF)
1001 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1003 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1007 # Check for missing getpeereid (or equiv) support
1009 if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1010 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1012 [#include <sys/types.h>
1013 #include <sys/socket.h>],
1014 [int i = SO_PEERCRED;],
1015 [AC_MSG_RESULT(yes)],
1021 dnl see whether mkstemp() requires XXXXXX
1022 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1023 AC_MSG_CHECKING([for (overly) strict mkstemp])
1027 main() { char template[]="conftest.mkstemp-test";
1028 if (mkstemp(template) == -1)
1030 unlink(template); exit(0);
1038 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1042 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1047 dnl make sure that openpty does not reacquire controlling terminal
1048 if test ! -z "$check_for_openpty_ctty_bug"; then
1049 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1053 #include <sys/fcntl.h>
1054 #include <sys/types.h>
1055 #include <sys/wait.h>
1061 int fd, ptyfd, ttyfd, status;
1064 if (pid < 0) { /* failed */
1066 } else if (pid > 0) { /* parent */
1067 waitpid(pid, &status, 0);
1068 if (WIFEXITED(status))
1069 exit(WEXITSTATUS(status));
1072 } else { /* child */
1073 close(0); close(1); close(2);
1075 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1076 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1078 exit(3); /* Acquired ctty: broken */
1080 exit(0); /* Did not acquire ctty: OK */
1089 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1094 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1095 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1096 AC_MSG_CHECKING(if getaddrinfo seems to work)
1100 #include <sys/socket.h>
1103 #include <netinet/in.h>
1105 #define TEST_PORT "2222"
1111 struct addrinfo *gai_ai, *ai, hints;
1112 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1114 memset(&hints, 0, sizeof(hints));
1115 hints.ai_family = PF_UNSPEC;
1116 hints.ai_socktype = SOCK_STREAM;
1117 hints.ai_flags = AI_PASSIVE;
1119 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1121 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1125 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1126 if (ai->ai_family != AF_INET6)
1129 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1130 sizeof(ntop), strport, sizeof(strport),
1131 NI_NUMERICHOST|NI_NUMERICSERV);
1134 if (err == EAI_SYSTEM)
1135 perror("getnameinfo EAI_SYSTEM");
1137 fprintf(stderr, "getnameinfo failed: %s\n",
1142 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1145 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1158 AC_DEFINE(BROKEN_GETADDRINFO)
1163 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1164 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1165 AC_MSG_CHECKING(if getaddrinfo seems to work)
1169 #include <sys/socket.h>
1172 #include <netinet/in.h>
1174 #define TEST_PORT "2222"
1180 struct addrinfo *gai_ai, *ai, hints;
1181 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1183 memset(&hints, 0, sizeof(hints));
1184 hints.ai_family = PF_UNSPEC;
1185 hints.ai_socktype = SOCK_STREAM;
1186 hints.ai_flags = AI_PASSIVE;
1188 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1190 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1194 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1195 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1198 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1199 sizeof(ntop), strport, sizeof(strport),
1200 NI_NUMERICHOST|NI_NUMERICSERV);
1202 if (ai->ai_family == AF_INET && err != 0) {
1203 perror("getnameinfo");
1212 AC_DEFINE(AIX_GETNAMEINFO_HACK, [],
1213 [Define if you have a getaddrinfo that fails for the all-zeros IPv6 address])
1217 AC_DEFINE(BROKEN_GETADDRINFO)
1222 if test "x$check_for_conflicting_getspnam" = "x1"; then
1223 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1227 int main(void) {exit(0);}
1234 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1235 [Conflicting defs for getspnam])
1242 # Check for PAM libs
1245 [ --with-pam Enable PAM support ],
1247 if test "x$withval" != "xno" ; then
1248 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1249 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1250 AC_MSG_ERROR([PAM headers not found])
1253 AC_CHECK_LIB(dl, dlopen, , )
1254 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1255 AC_CHECK_FUNCS(pam_getenvlist)
1256 AC_CHECK_FUNCS(pam_putenv)
1261 if test $ac_cv_lib_dl_dlopen = yes; then
1271 # Check for older PAM
1272 if test "x$PAM_MSG" = "xyes" ; then
1273 # Check PAM strerror arguments (old PAM)
1274 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1278 #if defined(HAVE_SECURITY_PAM_APPL_H)
1279 #include <security/pam_appl.h>
1280 #elif defined (HAVE_PAM_PAM_APPL_H)
1281 #include <pam/pam_appl.h>
1284 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1285 [AC_MSG_RESULT(no)],
1287 AC_DEFINE(HAVE_OLD_PAM)
1289 PAM_MSG="yes (old library)"
1294 # Search for OpenSSL
1295 saved_CPPFLAGS="$CPPFLAGS"
1296 saved_LDFLAGS="$LDFLAGS"
1297 AC_ARG_WITH(ssl-dir,
1298 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1300 if test "x$withval" != "xno" ; then
1303 ./*|../*) withval="`pwd`/$withval"
1305 if test -d "$withval/lib"; then
1306 if test -n "${need_dash_r}"; then
1307 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1309 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1312 if test -n "${need_dash_r}"; then
1313 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1315 LDFLAGS="-L${withval} ${LDFLAGS}"
1318 if test -d "$withval/include"; then
1319 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1321 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1326 LIBS="-lcrypto $LIBS"
1327 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1329 dnl Check default openssl install dir
1330 if test -n "${need_dash_r}"; then
1331 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1333 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1335 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1336 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1338 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1344 # Determine OpenSSL header version
1345 AC_MSG_CHECKING([OpenSSL header version])
1350 #include <openssl/opensslv.h>
1351 #define DATA "conftest.sslincver"
1356 fd = fopen(DATA,"w");
1360 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1367 ssl_header_ver=`cat conftest.sslincver`
1368 AC_MSG_RESULT($ssl_header_ver)
1371 AC_MSG_RESULT(not found)
1372 AC_MSG_ERROR(OpenSSL version header not found.)
1375 AC_MSG_WARN([cross compiling: not checking])
1379 # Determine OpenSSL library version
1380 AC_MSG_CHECKING([OpenSSL library version])
1385 #include <openssl/opensslv.h>
1386 #include <openssl/crypto.h>
1387 #define DATA "conftest.ssllibver"
1392 fd = fopen(DATA,"w");
1396 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1403 ssl_library_ver=`cat conftest.ssllibver`
1404 AC_MSG_RESULT($ssl_library_ver)
1407 AC_MSG_RESULT(not found)
1408 AC_MSG_ERROR(OpenSSL library not found.)
1411 AC_MSG_WARN([cross compiling: not checking])
1415 # Sanity check OpenSSL headers
1416 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1420 #include <openssl/opensslv.h>
1421 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1428 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1429 Check config.log for details.
1430 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1433 AC_MSG_WARN([cross compiling: not checking])
1437 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1438 # because the system crypt() is more featureful.
1439 if test "x$check_for_libcrypt_before" = "x1"; then
1440 AC_CHECK_LIB(crypt, crypt)
1443 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1444 # version in OpenSSL.
1445 if test "x$check_for_libcrypt_later" = "x1"; then
1446 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1450 ### Configure cryptographic random number support
1452 # Check wheter OpenSSL seeds itself
1453 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1457 #include <openssl/rand.h>
1458 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1461 OPENSSL_SEEDS_ITSELF=yes
1466 # Default to use of the rand helper if OpenSSL doesn't
1471 AC_MSG_WARN([cross compiling: assuming yes])
1472 # This is safe, since all recent OpenSSL versions will
1473 # complain at runtime if not seeded correctly.
1474 OPENSSL_SEEDS_ITSELF=yes
1479 # Do we want to force the use of the rand helper?
1480 AC_ARG_WITH(rand-helper,
1481 [ --with-rand-helper Use subprocess to gather strong randomness ],
1483 if test "x$withval" = "xno" ; then
1484 # Force use of OpenSSL's internal RNG, even if
1485 # the previous test showed it to be unseeded.
1486 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1487 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1488 OPENSSL_SEEDS_ITSELF=yes
1497 # Which randomness source do we use?
1498 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
1500 AC_DEFINE(OPENSSL_PRNG_ONLY)
1501 RAND_MSG="OpenSSL internal ONLY"
1502 INSTALL_SSH_RAND_HELPER=""
1503 elif test ! -z "$USE_RAND_HELPER" ; then
1504 # install rand helper
1505 RAND_MSG="ssh-rand-helper"
1506 INSTALL_SSH_RAND_HELPER="yes"
1508 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1510 ### Configuration of ssh-rand-helper
1513 AC_ARG_WITH(prngd-port,
1514 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1523 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1526 if test ! -z "$withval" ; then
1527 PRNGD_PORT="$withval"
1528 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1533 # PRNGD Unix domain socket
1534 AC_ARG_WITH(prngd-socket,
1535 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1539 withval="/var/run/egd-pool"
1547 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1551 if test ! -z "$withval" ; then
1552 if test ! -z "$PRNGD_PORT" ; then
1553 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1555 if test ! -r "$withval" ; then
1556 AC_MSG_WARN(Entropy socket is not readable)
1558 PRNGD_SOCKET="$withval"
1559 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1563 # Check for existing socket only if we don't have a random device already
1564 if test "$USE_RAND_HELPER" = yes ; then
1565 AC_MSG_CHECKING(for PRNGD/EGD socket)
1566 # Insert other locations here
1567 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1568 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1569 PRNGD_SOCKET="$sock"
1570 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1574 if test ! -z "$PRNGD_SOCKET" ; then
1575 AC_MSG_RESULT($PRNGD_SOCKET)
1577 AC_MSG_RESULT(not found)
1583 # Change default command timeout for hashing entropy source
1585 AC_ARG_WITH(entropy-timeout,
1586 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1588 if test "x$withval" != "xno" ; then
1589 entropy_timeout=$withval
1593 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1595 SSH_PRIVSEP_USER=sshd
1596 AC_ARG_WITH(privsep-user,
1597 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1599 if test -n "$withval"; then
1600 SSH_PRIVSEP_USER=$withval
1604 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1605 AC_SUBST(SSH_PRIVSEP_USER)
1607 # We do this little dance with the search path to insure
1608 # that programs that we select for use by installed programs
1609 # (which may be run by the super-user) come from trusted
1610 # locations before they come from the user's private area.
1611 # This should help avoid accidentally configuring some
1612 # random version of a program in someone's personal bin.
1616 test -h /bin 2> /dev/null && PATH=/usr/bin
1617 test -d /sbin && PATH=$PATH:/sbin
1618 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1619 PATH=$PATH:/etc:$OPATH
1621 # These programs are used by the command hashing source to gather entropy
1622 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1623 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1624 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1625 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1626 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1627 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1628 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1629 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1630 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1631 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1632 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1633 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1634 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1635 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1636 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1637 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1641 # Where does ssh-rand-helper get its randomness from?
1642 INSTALL_SSH_PRNG_CMDS=""
1643 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1644 if test ! -z "$PRNGD_PORT" ; then
1645 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1646 elif test ! -z "$PRNGD_SOCKET" ; then
1647 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1649 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1650 RAND_HELPER_CMDHASH=yes
1651 INSTALL_SSH_PRNG_CMDS="yes"
1654 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1657 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1658 if test ! -z "$SONY" ; then
1659 LIBS="$LIBS -liberty";
1662 # Checks for data types
1663 AC_CHECK_SIZEOF(char, 1)
1664 AC_CHECK_SIZEOF(short int, 2)
1665 AC_CHECK_SIZEOF(int, 4)
1666 AC_CHECK_SIZEOF(long int, 4)
1667 AC_CHECK_SIZEOF(long long int, 8)
1669 # Sanity check long long for some platforms (AIX)
1670 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1671 ac_cv_sizeof_long_long_int=0
1674 # More checks for data types
1675 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1677 [ #include <sys/types.h> ],
1679 [ ac_cv_have_u_int="yes" ],
1680 [ ac_cv_have_u_int="no" ]
1683 if test "x$ac_cv_have_u_int" = "xyes" ; then
1684 AC_DEFINE(HAVE_U_INT)
1688 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1690 [ #include <sys/types.h> ],
1691 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1692 [ ac_cv_have_intxx_t="yes" ],
1693 [ ac_cv_have_intxx_t="no" ]
1696 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1697 AC_DEFINE(HAVE_INTXX_T)
1701 if (test -z "$have_intxx_t" && \
1702 test "x$ac_cv_header_stdint_h" = "xyes")
1704 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1706 [ #include <stdint.h> ],
1707 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1709 AC_DEFINE(HAVE_INTXX_T)
1712 [ AC_MSG_RESULT(no) ]
1716 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1719 #include <sys/types.h>
1720 #ifdef HAVE_STDINT_H
1721 # include <stdint.h>
1723 #include <sys/socket.h>
1724 #ifdef HAVE_SYS_BITYPES_H
1725 # include <sys/bitypes.h>
1728 [ int64_t a; a = 1;],
1729 [ ac_cv_have_int64_t="yes" ],
1730 [ ac_cv_have_int64_t="no" ]
1733 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1734 AC_DEFINE(HAVE_INT64_T)
1737 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1739 [ #include <sys/types.h> ],
1740 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1741 [ ac_cv_have_u_intxx_t="yes" ],
1742 [ ac_cv_have_u_intxx_t="no" ]
1745 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1746 AC_DEFINE(HAVE_U_INTXX_T)
1750 if test -z "$have_u_intxx_t" ; then
1751 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1753 [ #include <sys/socket.h> ],
1754 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1756 AC_DEFINE(HAVE_U_INTXX_T)
1759 [ AC_MSG_RESULT(no) ]
1763 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1765 [ #include <sys/types.h> ],
1766 [ u_int64_t a; a = 1;],
1767 [ ac_cv_have_u_int64_t="yes" ],
1768 [ ac_cv_have_u_int64_t="no" ]
1771 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1772 AC_DEFINE(HAVE_U_INT64_T)
1776 if test -z "$have_u_int64_t" ; then
1777 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1779 [ #include <sys/bitypes.h> ],
1780 [ u_int64_t a; a = 1],
1782 AC_DEFINE(HAVE_U_INT64_T)
1785 [ AC_MSG_RESULT(no) ]
1789 if test -z "$have_u_intxx_t" ; then
1790 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1793 #include <sys/types.h>
1795 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1796 [ ac_cv_have_uintxx_t="yes" ],
1797 [ ac_cv_have_uintxx_t="no" ]
1800 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1801 AC_DEFINE(HAVE_UINTXX_T)
1805 if test -z "$have_uintxx_t" ; then
1806 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1808 [ #include <stdint.h> ],
1809 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1811 AC_DEFINE(HAVE_UINTXX_T)
1814 [ AC_MSG_RESULT(no) ]
1818 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1819 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1821 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1824 #include <sys/bitypes.h>
1827 int8_t a; int16_t b; int32_t c;
1828 u_int8_t e; u_int16_t f; u_int32_t g;
1829 a = b = c = e = f = g = 1;
1832 AC_DEFINE(HAVE_U_INTXX_T)
1833 AC_DEFINE(HAVE_INTXX_T)
1841 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1844 #include <sys/types.h>
1846 [ u_char foo; foo = 125; ],
1847 [ ac_cv_have_u_char="yes" ],
1848 [ ac_cv_have_u_char="no" ]
1851 if test "x$ac_cv_have_u_char" = "xyes" ; then
1852 AC_DEFINE(HAVE_U_CHAR)
1857 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1859 AC_CHECK_TYPES(in_addr_t,,,
1860 [#include <sys/types.h>
1861 #include <netinet/in.h>])
1863 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1866 #include <sys/types.h>
1868 [ size_t foo; foo = 1235; ],
1869 [ ac_cv_have_size_t="yes" ],
1870 [ ac_cv_have_size_t="no" ]
1873 if test "x$ac_cv_have_size_t" = "xyes" ; then
1874 AC_DEFINE(HAVE_SIZE_T)
1877 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1880 #include <sys/types.h>
1882 [ ssize_t foo; foo = 1235; ],
1883 [ ac_cv_have_ssize_t="yes" ],
1884 [ ac_cv_have_ssize_t="no" ]
1887 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1888 AC_DEFINE(HAVE_SSIZE_T)
1891 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1896 [ clock_t foo; foo = 1235; ],
1897 [ ac_cv_have_clock_t="yes" ],
1898 [ ac_cv_have_clock_t="no" ]
1901 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1902 AC_DEFINE(HAVE_CLOCK_T)
1905 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1908 #include <sys/types.h>
1909 #include <sys/socket.h>
1911 [ sa_family_t foo; foo = 1235; ],
1912 [ ac_cv_have_sa_family_t="yes" ],
1915 #include <sys/types.h>
1916 #include <sys/socket.h>
1917 #include <netinet/in.h>
1919 [ sa_family_t foo; foo = 1235; ],
1920 [ ac_cv_have_sa_family_t="yes" ],
1922 [ ac_cv_have_sa_family_t="no" ]
1926 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1927 AC_DEFINE(HAVE_SA_FAMILY_T)
1930 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1933 #include <sys/types.h>
1935 [ pid_t foo; foo = 1235; ],
1936 [ ac_cv_have_pid_t="yes" ],
1937 [ ac_cv_have_pid_t="no" ]
1940 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1941 AC_DEFINE(HAVE_PID_T)
1944 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1947 #include <sys/types.h>
1949 [ mode_t foo; foo = 1235; ],
1950 [ ac_cv_have_mode_t="yes" ],
1951 [ ac_cv_have_mode_t="no" ]
1954 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1955 AC_DEFINE(HAVE_MODE_T)
1959 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1962 #include <sys/types.h>
1963 #include <sys/socket.h>
1965 [ struct sockaddr_storage s; ],
1966 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1967 [ ac_cv_have_struct_sockaddr_storage="no" ]
1970 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1971 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1974 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1977 #include <sys/types.h>
1978 #include <netinet/in.h>
1980 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1981 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1982 [ ac_cv_have_struct_sockaddr_in6="no" ]
1985 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1986 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1989 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1992 #include <sys/types.h>
1993 #include <netinet/in.h>
1995 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1996 [ ac_cv_have_struct_in6_addr="yes" ],
1997 [ ac_cv_have_struct_in6_addr="no" ]
2000 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2001 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
2004 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2007 #include <sys/types.h>
2008 #include <sys/socket.h>
2011 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2012 [ ac_cv_have_struct_addrinfo="yes" ],
2013 [ ac_cv_have_struct_addrinfo="no" ]
2016 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2017 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
2020 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2022 [ #include <sys/time.h> ],
2023 [ struct timeval tv; tv.tv_sec = 1;],
2024 [ ac_cv_have_struct_timeval="yes" ],
2025 [ ac_cv_have_struct_timeval="no" ]
2028 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2029 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
2030 have_struct_timeval=1
2033 AC_CHECK_TYPES(struct timespec)
2035 # We need int64_t or else certian parts of the compile will fail.
2036 if test "x$ac_cv_have_int64_t" = "xno" && \
2037 test "x$ac_cv_sizeof_long_int" != "x8" && \
2038 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2039 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2040 echo "an alternative compiler (I.E., GCC) before continuing."
2044 dnl test snprintf (broken on SCO w/gcc)
2049 #ifdef HAVE_SNPRINTF
2053 char expected_out[50];
2055 #if (SIZEOF_LONG_INT == 8)
2056 long int num = 0x7fffffffffffffff;
2058 long long num = 0x7fffffffffffffffll;
2060 strcpy(expected_out, "9223372036854775807");
2061 snprintf(buf, mazsize, "%lld", num);
2062 if(strcmp(buf, expected_out) != 0)
2069 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2070 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2074 dnl Checks for structure members
2075 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2076 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2077 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2078 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2079 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2080 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2081 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2082 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2083 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2084 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2085 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2086 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2087 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2088 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2089 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2090 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2091 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2093 AC_CHECK_MEMBERS([struct stat.st_blksize])
2095 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2096 ac_cv_have_ss_family_in_struct_ss, [
2099 #include <sys/types.h>
2100 #include <sys/socket.h>
2102 [ struct sockaddr_storage s; s.ss_family = 1; ],
2103 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2104 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2107 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2108 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2111 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2112 ac_cv_have___ss_family_in_struct_ss, [
2115 #include <sys/types.h>
2116 #include <sys/socket.h>
2118 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2119 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2120 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2123 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2124 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2127 AC_CACHE_CHECK([for pw_class field in struct passwd],
2128 ac_cv_have_pw_class_in_struct_passwd, [
2133 [ struct passwd p; p.pw_class = 0; ],
2134 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2135 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2138 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2139 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2142 AC_CACHE_CHECK([for pw_expire field in struct passwd],
2143 ac_cv_have_pw_expire_in_struct_passwd, [
2148 [ struct passwd p; p.pw_expire = 0; ],
2149 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2150 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2153 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2154 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2157 AC_CACHE_CHECK([for pw_change field in struct passwd],
2158 ac_cv_have_pw_change_in_struct_passwd, [
2163 [ struct passwd p; p.pw_change = 0; ],
2164 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2165 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2168 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2169 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2172 dnl make sure we're using the real structure members and not defines
2173 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2174 ac_cv_have_accrights_in_msghdr, [
2177 #include <sys/types.h>
2178 #include <sys/socket.h>
2179 #include <sys/uio.h>
2181 #ifdef msg_accrights
2182 #error "msg_accrights is a macro"
2186 m.msg_accrights = 0;
2190 [ ac_cv_have_accrights_in_msghdr="yes" ],
2191 [ ac_cv_have_accrights_in_msghdr="no" ]
2194 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2195 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2198 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2199 ac_cv_have_control_in_msghdr, [
2202 #include <sys/types.h>
2203 #include <sys/socket.h>
2204 #include <sys/uio.h>
2207 #error "msg_control is a macro"
2215 [ ac_cv_have_control_in_msghdr="yes" ],
2216 [ ac_cv_have_control_in_msghdr="no" ]
2219 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2220 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2223 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2225 [ extern char *__progname; printf("%s", __progname); ],
2226 [ ac_cv_libc_defines___progname="yes" ],
2227 [ ac_cv_libc_defines___progname="no" ]
2230 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2231 AC_DEFINE(HAVE___PROGNAME)
2234 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2238 [ printf("%s", __FUNCTION__); ],
2239 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2240 [ ac_cv_cc_implements___FUNCTION__="no" ]
2243 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2244 AC_DEFINE(HAVE___FUNCTION__)
2247 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2251 [ printf("%s", __func__); ],
2252 [ ac_cv_cc_implements___func__="yes" ],
2253 [ ac_cv_cc_implements___func__="no" ]
2256 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2257 AC_DEFINE(HAVE___func__)
2260 AC_CACHE_CHECK([whether getopt has optreset support],
2261 ac_cv_have_getopt_optreset, [
2266 [ extern int optreset; optreset = 0; ],
2267 [ ac_cv_have_getopt_optreset="yes" ],
2268 [ ac_cv_have_getopt_optreset="no" ]
2271 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2272 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2275 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2277 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2278 [ ac_cv_libc_defines_sys_errlist="yes" ],
2279 [ ac_cv_libc_defines_sys_errlist="no" ]
2282 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2283 AC_DEFINE(HAVE_SYS_ERRLIST)
2287 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2289 [ extern int sys_nerr; printf("%i", sys_nerr);],
2290 [ ac_cv_libc_defines_sys_nerr="yes" ],
2291 [ ac_cv_libc_defines_sys_nerr="no" ]
2294 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2295 AC_DEFINE(HAVE_SYS_NERR)
2299 # Check whether user wants sectok support
2301 [ --with-sectok Enable smartcard support using libsectok],
2303 if test "x$withval" != "xno" ; then
2304 if test "x$withval" != "xyes" ; then
2305 CPPFLAGS="$CPPFLAGS -I${withval}"
2306 LDFLAGS="$LDFLAGS -L${withval}"
2307 if test ! -z "$need_dash_r" ; then
2308 LDFLAGS="$LDFLAGS -R${withval}"
2310 if test ! -z "$blibpath" ; then
2311 blibpath="$blibpath:${withval}"
2314 AC_CHECK_HEADERS(sectok.h)
2315 if test "$ac_cv_header_sectok_h" != yes; then
2316 AC_MSG_ERROR(Can't find sectok.h)
2318 AC_CHECK_LIB(sectok, sectok_open)
2319 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2320 AC_MSG_ERROR(Can't find libsectok)
2322 AC_DEFINE(SMARTCARD)
2323 AC_DEFINE(USE_SECTOK)
2324 SCARD_MSG="yes, using sectok"
2329 # Check whether user wants OpenSC support
2332 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2334 if test "x$withval" != "xno" ; then
2335 if test "x$withval" != "xyes" ; then
2336 OPENSC_CONFIG=$withval/bin/opensc-config
2338 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2340 if test "$OPENSC_CONFIG" != "no"; then
2341 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2342 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2343 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2344 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2345 AC_DEFINE(SMARTCARD)
2346 AC_DEFINE(USE_OPENSC)
2347 SCARD_MSG="yes, using OpenSC"
2353 # Check libraries needed by DNS fingerprint support
2354 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2355 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
2357 # Needed by our getrrsetbyname()
2358 AC_SEARCH_LIBS(res_query, resolv)
2359 AC_SEARCH_LIBS(dn_expand, resolv)
2360 AC_MSG_CHECKING(if res_query will link)
2361 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2364 LIBS="$LIBS -lresolv"
2365 AC_MSG_CHECKING(for res_query in -lresolv)
2370 res_query (0, 0, 0, 0, 0);
2374 [LIBS="$LIBS -lresolv"
2375 AC_MSG_RESULT(yes)],
2379 AC_CHECK_FUNCS(_getshort _getlong)
2380 AC_CHECK_MEMBER(HEADER.ad,
2381 [AC_DEFINE(HAVE_HEADER_AD)],,
2382 [#include <arpa/nameser.h>])
2385 # Check whether user wants Kerberos 5 support
2387 AC_ARG_WITH(kerberos5,
2388 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2389 [ if test "x$withval" != "xno" ; then
2390 if test "x$withval" = "xyes" ; then
2391 KRB5ROOT="/usr/local"
2399 AC_MSG_CHECKING(for krb5-config)
2400 if test -x $KRB5ROOT/bin/krb5-config ; then
2401 KRB5CONF=$KRB5ROOT/bin/krb5-config
2402 AC_MSG_RESULT($KRB5CONF)
2404 AC_MSG_CHECKING(for gssapi support)
2405 if $KRB5CONF | grep gssapi >/dev/null ; then
2413 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2414 K5LIBS="`$KRB5CONF --libs $k5confopts`"
2415 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2416 AC_MSG_CHECKING(whether we are using Heimdal)
2417 AC_TRY_COMPILE([ #include <krb5.h> ],
2418 [ char *tmp = heimdal_version; ],
2419 [ AC_MSG_RESULT(yes)
2420 AC_DEFINE(HEIMDAL) ],
2425 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2426 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2427 AC_MSG_CHECKING(whether we are using Heimdal)
2428 AC_TRY_COMPILE([ #include <krb5.h> ],
2429 [ char *tmp = heimdal_version; ],
2430 [ AC_MSG_RESULT(yes)
2432 K5LIBS="-lkrb5 -ldes"
2433 K5LIBS="$K5LIBS -lcom_err -lasn1"
2434 AC_CHECK_LIB(roken, net_write,
2435 [K5LIBS="$K5LIBS -lroken"])
2438 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2441 AC_SEARCH_LIBS(dn_expand, resolv)
2443 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2445 K5LIBS="-lgssapi $K5LIBS" ],
2446 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2448 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2449 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2454 AC_CHECK_HEADER(gssapi.h, ,
2455 [ unset ac_cv_header_gssapi_h
2456 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2457 AC_CHECK_HEADERS(gssapi.h, ,
2458 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2464 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2465 AC_CHECK_HEADER(gssapi_krb5.h, ,
2466 [ CPPFLAGS="$oldCPP" ])
2469 if test ! -z "$need_dash_r" ; then
2470 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2472 if test ! -z "$blibpath" ; then
2473 blibpath="$blibpath:${KRB5ROOT}/lib"
2477 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2478 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2479 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2481 LIBS="$LIBS $K5LIBS"
2482 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2483 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
2487 # Looking for programs, paths and files
2489 PRIVSEP_PATH=/var/empty
2490 AC_ARG_WITH(privsep-path,
2491 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2493 if test "x$withval" != "$no" ; then
2494 PRIVSEP_PATH=$withval
2498 AC_SUBST(PRIVSEP_PATH)
2501 [ --with-xauth=PATH Specify path to xauth program ],
2503 if test "x$withval" != "xno" ; then
2509 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2510 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2511 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2512 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2513 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2514 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2515 xauth_path="/usr/openwin/bin/xauth"
2521 AC_ARG_ENABLE(strip,
2522 [ --disable-strip Disable calling strip(1) on install],
2524 if test "x$enableval" = "xno" ; then
2531 if test -z "$xauth_path" ; then
2532 XAUTH_PATH="undefined"
2533 AC_SUBST(XAUTH_PATH)
2535 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2536 XAUTH_PATH=$xauth_path
2537 AC_SUBST(XAUTH_PATH)
2540 # Check for mail directory (last resort if we cannot get it from headers)
2541 if test ! -z "$MAIL" ; then
2542 maildir=`dirname $MAIL`
2543 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2546 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
2547 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2548 disable_ptmx_check=yes
2550 if test -z "$no_dev_ptmx" ; then
2551 if test "x$disable_ptmx_check" != "xyes" ; then
2552 AC_CHECK_FILE("/dev/ptmx",
2554 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2561 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
2562 AC_CHECK_FILE("/dev/ptc",
2564 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2569 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2572 # Options from here on. Some of these are preset by platform above
2573 AC_ARG_WITH(mantype,
2574 [ --with-mantype=man|cat|doc Set man page type],
2581 AC_MSG_ERROR(invalid man type: $withval)
2586 if test -z "$MANTYPE"; then
2587 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2588 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2589 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2591 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2598 if test "$MANTYPE" = "doc"; then
2605 # Check whether to enable MD5 passwords
2607 AC_ARG_WITH(md5-passwords,
2608 [ --with-md5-passwords Enable use of MD5 passwords],
2610 if test "x$withval" != "xno" ; then
2611 AC_DEFINE(HAVE_MD5_PASSWORDS)
2617 # Whether to disable shadow password support
2619 [ --without-shadow Disable shadow password support],
2621 if test "x$withval" = "xno" ; then
2622 AC_DEFINE(DISABLE_SHADOW)
2628 if test -z "$disable_shadow" ; then
2629 AC_MSG_CHECKING([if the systems has expire shadow information])
2632 #include <sys/types.h>
2635 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2636 [ sp_expire_available=yes ], []
2639 if test "x$sp_expire_available" = "xyes" ; then
2641 AC_DEFINE(HAS_SHADOW_EXPIRE)
2647 # Use ip address instead of hostname in $DISPLAY
2648 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2649 DISPLAY_HACK_MSG="yes"
2650 AC_DEFINE(IPADDR_IN_DISPLAY)
2652 DISPLAY_HACK_MSG="no"
2653 AC_ARG_WITH(ipaddr-display,
2654 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2656 if test "x$withval" != "xno" ; then
2657 AC_DEFINE(IPADDR_IN_DISPLAY)
2658 DISPLAY_HACK_MSG="yes"
2664 # check for /etc/default/login and use it if present.
2665 AC_ARG_ENABLE(etc-default-login,
2666 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
2667 [ if test "x$enableval" = "xno"; then
2668 AC_MSG_NOTICE([/etc/default/login handling disabled])
2669 etc_default_login=no
2671 etc_default_login=yes
2673 [ etc_default_login=yes ]
2676 if test "x$etc_default_login" != "xno"; then
2677 AC_CHECK_FILE("/etc/default/login",
2678 [ external_path_file=/etc/default/login ])
2679 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2681 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2682 elif test "x$external_path_file" = "x/etc/default/login"; then
2683 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2687 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2688 if test $ac_cv_func_login_getcapbool = "yes" && \
2689 test $ac_cv_header_login_cap_h = "yes" ; then
2690 external_path_file=/etc/login.conf
2693 # Whether to mess with the default path
2694 SERVER_PATH_MSG="(default)"
2695 AC_ARG_WITH(default-path,
2696 [ --with-default-path= Specify default \$PATH environment for server],
2698 if test "x$external_path_file" = "x/etc/login.conf" ; then
2700 --with-default-path=PATH has no effect on this system.
2701 Edit /etc/login.conf instead.])
2702 elif test "x$withval" != "xno" ; then
2703 if test ! -z "$external_path_file" ; then
2705 --with-default-path=PATH will only be used if PATH is not defined in
2706 $external_path_file .])
2708 user_path="$withval"
2709 SERVER_PATH_MSG="$withval"
2712 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2713 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2715 if test ! -z "$external_path_file" ; then
2717 If PATH is defined in $external_path_file, ensure the path to scp is included,
2718 otherwise scp will not work.])
2722 /* find out what STDPATH is */
2727 #ifndef _PATH_STDPATH
2728 # ifdef _PATH_USERPATH /* Irix */
2729 # define _PATH_STDPATH _PATH_USERPATH
2731 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2734 #include <sys/types.h>
2735 #include <sys/stat.h>
2737 #define DATA "conftest.stdpath"
2744 fd = fopen(DATA,"w");
2748 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2753 ], [ user_path=`cat conftest.stdpath` ],
2754 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2755 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2757 # make sure $bindir is in USER_PATH so scp will work
2758 t_bindir=`eval echo ${bindir}`
2760 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2763 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2765 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2766 if test $? -ne 0 ; then
2767 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2768 if test $? -ne 0 ; then
2769 user_path=$user_path:$t_bindir
2770 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2775 if test "x$external_path_file" != "x/etc/login.conf" ; then
2776 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2780 # Set superuser path separately to user path
2781 AC_ARG_WITH(superuser-path,
2782 [ --with-superuser-path= Specify different path for super-user],
2784 if test "x$withval" != "xno" ; then
2785 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2786 superuser_path=$withval
2792 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2793 IPV4_IN6_HACK_MSG="no"
2795 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2797 if test "x$withval" != "xno" ; then
2799 AC_DEFINE(IPV4_IN_IPV6)
2800 IPV4_IN6_HACK_MSG="yes"
2805 if test "x$inet6_default_4in6" = "xyes"; then
2806 AC_MSG_RESULT([yes (default)])
2807 AC_DEFINE(IPV4_IN_IPV6)
2808 IPV4_IN6_HACK_MSG="yes"
2810 AC_MSG_RESULT([no (default)])
2815 # Whether to enable BSD auth support
2817 AC_ARG_WITH(bsd-auth,
2818 [ --with-bsd-auth Enable BSD auth support],
2820 if test "x$withval" != "xno" ; then
2827 # Where to place sshd.pid
2829 # make sure the directory exists
2830 if test ! -d $piddir ; then
2831 piddir=`eval echo ${sysconfdir}`
2833 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2837 AC_ARG_WITH(pid-dir,
2838 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2840 if test "x$withval" != "xno" ; then
2842 if test ! -d $piddir ; then
2843 AC_MSG_WARN([** no $piddir directory on this system **])
2849 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2852 dnl allow user to disable some login recording features
2853 AC_ARG_ENABLE(lastlog,
2854 [ --disable-lastlog disable use of lastlog even if detected [no]],
2856 if test "x$enableval" = "xno" ; then
2857 AC_DEFINE(DISABLE_LASTLOG)
2862 [ --disable-utmp disable use of utmp even if detected [no]],
2864 if test "x$enableval" = "xno" ; then
2865 AC_DEFINE(DISABLE_UTMP)
2869 AC_ARG_ENABLE(utmpx,
2870 [ --disable-utmpx disable use of utmpx even if detected [no]],
2872 if test "x$enableval" = "xno" ; then
2873 AC_DEFINE(DISABLE_UTMPX)
2878 [ --disable-wtmp disable use of wtmp even if detected [no]],
2880 if test "x$enableval" = "xno" ; then
2881 AC_DEFINE(DISABLE_WTMP)
2885 AC_ARG_ENABLE(wtmpx,
2886 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2888 if test "x$enableval" = "xno" ; then
2889 AC_DEFINE(DISABLE_WTMPX)
2893 AC_ARG_ENABLE(libutil,
2894 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2896 if test "x$enableval" = "xno" ; then
2897 AC_DEFINE(DISABLE_LOGIN)
2901 AC_ARG_ENABLE(pututline,
2902 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2904 if test "x$enableval" = "xno" ; then
2905 AC_DEFINE(DISABLE_PUTUTLINE)
2909 AC_ARG_ENABLE(pututxline,
2910 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2912 if test "x$enableval" = "xno" ; then
2913 AC_DEFINE(DISABLE_PUTUTXLINE)
2917 AC_ARG_WITH(lastlog,
2918 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2920 if test "x$withval" = "xno" ; then
2921 AC_DEFINE(DISABLE_LASTLOG)
2923 conf_lastlog_location=$withval
2928 dnl lastlog, [uw]tmpx? detection
2929 dnl NOTE: set the paths in the platform section to avoid the
2930 dnl need for command-line parameters
2931 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2933 dnl lastlog detection
2934 dnl NOTE: the code itself will detect if lastlog is a directory
2935 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2937 #include <sys/types.h>
2939 #ifdef HAVE_LASTLOG_H
2940 # include <lastlog.h>
2949 [ char *lastlog = LASTLOG_FILE; ],
2950 [ AC_MSG_RESULT(yes) ],
2953 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2955 #include <sys/types.h>
2957 #ifdef HAVE_LASTLOG_H
2958 # include <lastlog.h>
2964 [ char *lastlog = _PATH_LASTLOG; ],
2965 [ AC_MSG_RESULT(yes) ],
2968 system_lastlog_path=no
2973 if test -z "$conf_lastlog_location"; then
2974 if test x"$system_lastlog_path" = x"no" ; then
2975 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2976 if (test -d "$f" || test -f "$f") ; then
2977 conf_lastlog_location=$f
2980 if test -z "$conf_lastlog_location"; then
2981 AC_MSG_WARN([** Cannot find lastlog **])
2982 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2987 if test -n "$conf_lastlog_location"; then
2988 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2992 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2994 #include <sys/types.h>
3000 [ char *utmp = UTMP_FILE; ],
3001 [ AC_MSG_RESULT(yes) ],
3003 system_utmp_path=no ]
3005 if test -z "$conf_utmp_location"; then
3006 if test x"$system_utmp_path" = x"no" ; then
3007 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3008 if test -f $f ; then
3009 conf_utmp_location=$f
3012 if test -z "$conf_utmp_location"; then
3013 AC_DEFINE(DISABLE_UTMP)
3017 if test -n "$conf_utmp_location"; then
3018 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
3022 AC_MSG_CHECKING([if your system defines WTMP_FILE])
3024 #include <sys/types.h>
3030 [ char *wtmp = WTMP_FILE; ],
3031 [ AC_MSG_RESULT(yes) ],
3033 system_wtmp_path=no ]
3035 if test -z "$conf_wtmp_location"; then
3036 if test x"$system_wtmp_path" = x"no" ; then
3037 for f in /usr/adm/wtmp /var/log/wtmp; do
3038 if test -f $f ; then
3039 conf_wtmp_location=$f
3042 if test -z "$conf_wtmp_location"; then
3043 AC_DEFINE(DISABLE_WTMP)
3047 if test -n "$conf_wtmp_location"; then
3048 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
3052 dnl utmpx detection - I don't know any system so perverse as to require
3053 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3055 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3057 #include <sys/types.h>
3066 [ char *utmpx = UTMPX_FILE; ],
3067 [ AC_MSG_RESULT(yes) ],
3069 system_utmpx_path=no ]
3071 if test -z "$conf_utmpx_location"; then
3072 if test x"$system_utmpx_path" = x"no" ; then
3073 AC_DEFINE(DISABLE_UTMPX)
3076 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
3080 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3082 #include <sys/types.h>
3091 [ char *wtmpx = WTMPX_FILE; ],
3092 [ AC_MSG_RESULT(yes) ],
3094 system_wtmpx_path=no ]
3096 if test -z "$conf_wtmpx_location"; then
3097 if test x"$system_wtmpx_path" = x"no" ; then
3098 AC_DEFINE(DISABLE_WTMPX)
3101 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
3105 if test ! -z "$blibpath" ; then
3106 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3107 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3110 dnl remove pam and dl because they are in $LIBPAM
3111 if test "$PAM_MSG" = yes ; then
3112 LIBS=`echo $LIBS | sed 's/-lpam //'`
3114 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3115 LIBS=`echo $LIBS | sed 's/-ldl //'`
3119 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3120 scard/Makefile ssh_prng_cmds survey.sh])
3123 # Print summary of options
3125 # Someone please show me a better way :)
3126 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3127 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3128 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3129 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3130 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3131 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3132 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
3133 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3134 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3135 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3138 echo "OpenSSH has been configured with the following options:"
3139 echo " User binaries: $B"
3140 echo " System binaries: $C"
3141 echo " Configuration files: $D"
3142 echo " Askpass program: $E"
3143 echo " Manual pages: $F"
3144 echo " PID file: $G"
3145 echo " Privilege separation chroot path: $H"
3146 if test "x$external_path_file" = "x/etc/login.conf" ; then
3147 echo " At runtime, sshd will use the path defined in $external_path_file"
3148 echo " Make sure the path to scp is present, otherwise scp will not work"
3150 echo " sshd default user PATH: $I"
3151 if test ! -z "$external_path_file"; then
3152 echo " (If PATH is set in $external_path_file it will be used instead. If"
3153 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3156 if test ! -z "$superuser_path" ; then
3157 echo " sshd superuser user PATH: $J"
3159 echo " Manpage format: $MANTYPE"
3160 echo " PAM support: $PAM_MSG"
3161 echo " KerberosV support: $KRB5_MSG"
3162 echo " Smartcard support: $SCARD_MSG"
3163 echo " S/KEY support: $SKEY_MSG"
3164 echo " TCP Wrappers support: $TCPW_MSG"
3165 echo " MD5 password support: $MD5_MSG"
3166 echo " libedit support: $LIBEDIT_MSG"
3167 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
3168 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3169 echo " BSD Auth support: $BSD_AUTH_MSG"
3170 echo " Random number source: $RAND_MSG"
3171 if test ! -z "$USE_RAND_HELPER" ; then
3172 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
3177 echo " Host: ${host}"
3178 echo " Compiler: ${CC}"
3179 echo " Compiler flags: ${CFLAGS}"
3180 echo "Preprocessor flags: ${CPPFLAGS}"
3181 echo " Linker flags: ${LDFLAGS}"
3182 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
3186 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
3187 echo "SVR4 style packages are supported with \"make package\""
3191 if test "x$PAM_MSG" = "xyes" ; then
3192 echo "PAM is enabled. You may need to install a PAM control file "
3193 echo "for sshd, otherwise password authentication may fail. "
3194 echo "Example PAM control files can be found in the contrib/ "
3199 if test ! -z "$RAND_HELPER_CMDHASH" ; then
3200 echo "WARNING: you are using the builtin random number collection "
3201 echo "service. Please read WARNING.RNG and request that your OS "
3202 echo "vendor includes kernel-based random number collection in "
3203 echo "future versions of your OS."
3207 if test ! -z "$NO_PEERCHECK" ; then
3208 echo "WARNING: the operating system that you are using does not "
3209 echo "appear to support either the getpeereid() API nor the "
3210 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3211 echo "enforce security checks to prevent unauthorised connections to "
3212 echo "ssh-agent. Their absence increases the risk that a malicious "
3213 echo "user can connect to your agent. "
3217 if test "$AUDIT_MODULE" = "bsm" ; then
3218 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3219 echo "See the Solaris section in README.platform for details."