3 # Copyright (c) 1999-2004 Damien Miller
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
18 AC_CONFIG_SRCDIR([ssh.c])
20 AC_CONFIG_HEADER(config.h)
25 # Checks for programs.
31 AC_PATH_PROG(CAT, cat)
32 AC_PATH_PROG(KILL, kill)
33 AC_PATH_PROGS(PERL, perl5 perl)
34 AC_PATH_PROG(SED, sed)
36 AC_PATH_PROG(ENT, ent)
38 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
42 AC_SUBST(TEST_SHELL,sh)
45 AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47 AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49 AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
54 if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
58 # Use LOGIN_PROGRAM from environment if possible
59 if test ! -z "$LOGIN_PROGRAM" ; then
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
61 [If your header files don't define LOGIN_PROGRAM,
62 then use this (detected) from environment and PATH])
65 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
66 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
67 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
71 AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
72 if test ! -z "$PATH_PASSWD_PROG" ; then
73 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
74 [Full path of your "passwd" program])
77 if test -z "$LD" ; then
84 AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
86 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
87 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
88 GCC_VER=`$CC --version`
91 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
93 *) CFLAGS="$CFLAGS -Wsign-compare" ;;
96 if test -z "$have_llong_max"; then
97 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
98 unset ac_cv_have_decl_LLONG_MAX
99 saved_CFLAGS="$CFLAGS"
100 CFLAGS="$CFLAGS -std=gnu99"
101 AC_CHECK_DECL(LLONG_MAX,
103 [CFLAGS="$saved_CFLAGS"],
104 [#include <limits.h>]
109 if test -z "$have_llong_max"; then
110 AC_MSG_CHECKING([for max value of long long])
114 /* Why is this so damn hard? */
120 #define DATA "conftest.llminmax"
123 long long i, llmin, llmax = 0;
125 if((f = fopen(DATA,"w")) == NULL)
128 #if defined(LLONG_MIN) && defined(LLONG_MAX)
129 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
133 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
134 /* This will work on one's complement and two's complement */
135 for (i = 1; i > llmax; i <<= 1, i++)
137 llmin = llmax + 1LL; /* wrap */
141 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
142 || llmax - 1 > llmax) {
143 fprintf(f, "unknown unknown\n");
147 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
154 llong_min=`$AWK '{print $1}' conftest.llminmax`
155 llong_max=`$AWK '{print $2}' conftest.llminmax`
156 AC_MSG_RESULT($llong_max)
157 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
158 [max value of long long calculated by configure])
159 AC_MSG_CHECKING([for min value of long long])
160 AC_MSG_RESULT($llong_min)
161 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
162 [min value of long long calculated by configure])
165 AC_MSG_RESULT(not found)
168 AC_MSG_WARN([cross compiling: not checking])
174 [ --without-rpath Disable auto-added -R linker paths],
176 if test "x$withval" = "xno" ; then
179 if test "x$withval" = "xyes" ; then
185 # Check for some target-specific stuff
188 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
189 if (test -z "$blibpath"); then
190 blibpath="/usr/lib:/lib"
192 saved_LDFLAGS="$LDFLAGS"
193 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
194 if (test -z "$blibflags"); then
195 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
196 AC_TRY_LINK([], [], [blibflags=$tryflags])
199 if (test -z "$blibflags"); then
200 AC_MSG_RESULT(not found)
201 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
203 AC_MSG_RESULT($blibflags)
205 LDFLAGS="$saved_LDFLAGS"
206 dnl Check for authenticate. Might be in libs.a on older AIXes
207 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
208 [Define if you want to enable AIX4's authenticate function])],
209 [AC_CHECK_LIB(s,authenticate,
210 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
214 dnl Check for various auth function declarations in headers.
215 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
216 passwdexpired, setauthdb], , , [#include <usersec.h>])
217 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
218 AC_CHECK_DECLS(loginfailed,
219 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
221 [#include <usersec.h>],
222 [(void)loginfailed("user","host","tty",0);],
224 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
225 [Define if your AIX loginfailed() function
226 takes 4 arguments (AIX >= 5.2)])],
230 [#include <usersec.h>]
232 AC_CHECK_FUNCS(setauthdb)
233 check_for_aix_broken_getaddrinfo=1
234 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
235 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
236 [Define if your platform breaks doing a seteuid before a setuid])
237 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
238 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
239 dnl AIX handles lastlog as part of its login message
240 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
241 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
242 [Some systems need a utmpx entry for /bin/login to work])
243 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
244 [Define to a Set Process Title type if your system is
245 supported by bsd-setproctitle.c])
248 check_for_libcrypt_later=1
249 LIBS="$LIBS /usr/lib/textmode.o"
250 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
251 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
252 AC_DEFINE(DISABLE_SHADOW, 1,
253 [Define if you want to disable shadow passwords])
254 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
255 [Define if your system choked on IP TOS setting])
256 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
257 [Define if X11 doesn't support AF_UNIX sockets on that system])
258 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
259 [Define if the concept of ports only accessible to
260 superusers isn't known])
261 AC_DEFINE(DISABLE_FD_PASSING, 1,
262 [Define if your platform needs to skip post auth
263 file descriptor passing])
266 AC_DEFINE(IP_TOS_IS_BROKEN)
267 AC_DEFINE(SETEUID_BREAKS_SETUID)
268 AC_DEFINE(BROKEN_SETREUID)
269 AC_DEFINE(BROKEN_SETREGID)
272 AC_MSG_CHECKING(if we have working getaddrinfo)
273 AC_TRY_RUN([#include <mach-o/dyld.h>
274 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
278 }], [AC_MSG_RESULT(working)],
279 [AC_MSG_RESULT(buggy)
280 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
281 [AC_MSG_RESULT(assume it is working)])
282 AC_DEFINE(SETEUID_BREAKS_SETUID)
283 AC_DEFINE(BROKEN_SETREUID)
284 AC_DEFINE(BROKEN_SETREGID)
285 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
286 [Define if your resolver libs need this for getrrsetbyname])
289 # first we define all of the options common to all HP-UX releases
290 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
291 IPADDR_IN_DISPLAY=yes
293 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
294 [Define if your login program cannot handle end of options ("--")])
295 AC_DEFINE(LOGIN_NEEDS_UTMPX)
296 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
297 [String used in /etc/passwd to denote locked account])
298 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
300 AC_CHECK_LIB(xnet, t_error, ,
301 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
303 # next, we define all of the options specific to major releases
306 if test -z "$GCC"; then
311 AC_DEFINE(PAM_SUN_CODEBASE, 1,
312 [Define if you are using Solaris-derived PAM which
313 passes pam_messages to the conversation function
314 with an extra level of indirection])
315 AC_DEFINE(DISABLE_UTMP, 1,
316 [Define if you don't want to use utmp])
317 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
318 check_for_hpux_broken_getaddrinfo=1
319 check_for_conflicting_getspnam=1
323 # lastly, we define options specific to minor releases
326 AC_DEFINE(HAVE_SECUREWARE, 1,
327 [Define if you have SecureWare-based
328 protected password database])
329 disable_ptmx_check=yes
335 PATH="$PATH:/usr/etc"
336 AC_DEFINE(BROKEN_INET_NTOA, 1,
337 [Define if you system's inet_ntoa is busted
338 (e.g. Irix gcc issue)])
339 AC_DEFINE(SETEUID_BREAKS_SETUID)
340 AC_DEFINE(BROKEN_SETREUID)
341 AC_DEFINE(BROKEN_SETREGID)
342 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
343 [Define if you shouldn't strip 'tty' from your
345 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
348 PATH="$PATH:/usr/etc"
349 AC_DEFINE(WITH_IRIX_ARRAY, 1,
350 [Define if you have/want arrays
351 (cluster-wide session managment, not C arrays)])
352 AC_DEFINE(WITH_IRIX_PROJECT, 1,
353 [Define if you want IRIX project management])
354 AC_DEFINE(WITH_IRIX_AUDIT, 1,
355 [Define if you want IRIX audit trails])
356 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
357 [Define if you want IRIX kernel jobs])])
358 AC_DEFINE(BROKEN_INET_NTOA)
359 AC_DEFINE(SETEUID_BREAKS_SETUID)
360 AC_DEFINE(BROKEN_SETREUID)
361 AC_DEFINE(BROKEN_SETREGID)
362 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
363 AC_DEFINE(WITH_ABBREV_NO_TTY)
364 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
368 check_for_libcrypt_later=1
369 check_for_openpty_ctty_bug=1
370 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
371 AC_DEFINE(PAM_TTY_KLUDGE, 1,
372 [Work around problematic Linux PAM modules handling of PAM_TTY])
373 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
374 [String used in /etc/passwd to denote locked account])
375 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
376 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
377 [Define to whatever link() returns for "not supported"
378 if it doesn't return EOPNOTSUPP.])
379 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
381 inet6_default_4in6=yes
384 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
385 [Define if cmsg_type is not passed correctly])
389 mips-sony-bsd|mips-sony-newsos4)
390 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
394 check_for_libcrypt_before=1
395 if test "x$withval" != "xno" ; then
400 check_for_libcrypt_later=1
401 AC_DEFINED(LOCKED_PASSWD_PREFIX, "*LOCKED*")
404 AC_DEFINE(SETEUID_BREAKS_SETUID)
405 AC_DEFINE(BROKEN_SETREUID)
406 AC_DEFINE(BROKEN_SETREGID)
409 conf_lastlog_location="/usr/adm/lastlog"
410 conf_utmp_location=/etc/utmp
411 conf_wtmp_location=/usr/adm/wtmp
413 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
414 AC_DEFINE(BROKEN_REALPATH)
416 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
419 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
422 if test "x$withval" != "xno" ; then
425 AC_DEFINE(PAM_SUN_CODEBASE)
426 AC_DEFINE(LOGIN_NEEDS_UTMPX)
427 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
428 [Some versions of /bin/login need the TERM supplied
430 AC_DEFINE(PAM_TTY_KLUDGE)
431 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
432 [Define if pam_chauthtok wants real uid set
433 to the unpriv'ed user])
434 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
435 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
436 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
437 [Define if sshd somehow reacquires a controlling TTY
439 external_path_file=/etc/default/login
440 # hardwire lastlog location (can't detect it on some versions)
441 conf_lastlog_location="/var/adm/lastlog"
442 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
443 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
444 if test "$sol2ver" -ge 8; then
446 AC_DEFINE(DISABLE_UTMP)
447 AC_DEFINE(DISABLE_WTMP, 1,
448 [Define if you don't want to use wtmp])
454 CPPFLAGS="$CPPFLAGS -DSUNOS4"
455 AC_CHECK_FUNCS(getpwanam)
456 AC_DEFINE(PAM_SUN_CODEBASE)
457 conf_utmp_location=/etc/utmp
458 conf_wtmp_location=/var/adm/wtmp
459 conf_lastlog_location=/var/adm/lastlog
465 AC_DEFINE(SSHD_ACQUIRES_CTTY)
466 AC_DEFINE(SETEUID_BREAKS_SETUID)
467 AC_DEFINE(BROKEN_SETREUID)
468 AC_DEFINE(BROKEN_SETREGID)
471 # /usr/ucblib MUST NOT be searched on ReliantUNIX
472 AC_CHECK_LIB(dl, dlsym, ,)
473 # -lresolv needs to be at then end of LIBS or DNS lookups break
474 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
475 IPADDR_IN_DISPLAY=yes
477 AC_DEFINE(IP_TOS_IS_BROKEN)
478 AC_DEFINE(SETEUID_BREAKS_SETUID)
479 AC_DEFINE(BROKEN_SETREUID)
480 AC_DEFINE(BROKEN_SETREGID)
481 AC_DEFINE(SSHD_ACQUIRES_CTTY)
482 external_path_file=/etc/default/login
483 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
484 # Attention: always take care to bind libsocket and libnsl before libc,
485 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
487 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
490 AC_DEFINE(SETEUID_BREAKS_SETUID)
491 AC_DEFINE(BROKEN_SETREUID)
492 AC_DEFINE(BROKEN_SETREGID)
493 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
495 # UnixWare 7.x, OpenUNIX 8
497 check_for_libcrypt_later=1
498 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
500 AC_DEFINE(SETEUID_BREAKS_SETUID)
501 AC_DEFINE(BROKEN_SETREUID)
502 AC_DEFINE(BROKEN_SETREGID)
503 AC_DEFINE(PASSWD_NEEDS_USERNAME)
505 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
506 TEST_SHELL=/u95/bin/sh
507 AC_DEFINE(BROKEN_LIBIAF, 1,
508 [ia_uinfo routines not supported by OS yet])
514 # SCO UNIX and OEM versions of SCO UNIX
516 AC_MSG_ERROR("This Platform is no longer supported.")
520 if test -z "$GCC"; then
521 CFLAGS="$CFLAGS -belf"
523 LIBS="$LIBS -lprot -lx -ltinfo -lm"
526 AC_DEFINE(HAVE_SECUREWARE)
527 AC_DEFINE(DISABLE_SHADOW)
528 AC_DEFINE(DISABLE_FD_PASSING)
529 AC_DEFINE(SETEUID_BREAKS_SETUID)
530 AC_DEFINE(BROKEN_SETREUID)
531 AC_DEFINE(BROKEN_SETREGID)
532 AC_DEFINE(WITH_ABBREV_NO_TTY)
533 AC_DEFINE(BROKEN_UPDWTMPX)
534 AC_DEFINE(PASSWD_NEEDS_USERNAME)
535 AC_CHECK_FUNCS(getluid setluid)
540 AC_DEFINE(NO_SSH_LASTLOG, 1,
541 [Define if you don't want to use lastlog in session.c])
542 AC_DEFINE(SETEUID_BREAKS_SETUID)
543 AC_DEFINE(BROKEN_SETREUID)
544 AC_DEFINE(BROKEN_SETREGID)
546 AC_DEFINE(DISABLE_FD_PASSING)
548 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
552 AC_DEFINE(SETEUID_BREAKS_SETUID)
553 AC_DEFINE(BROKEN_SETREUID)
554 AC_DEFINE(BROKEN_SETREGID)
555 AC_DEFINE(WITH_ABBREV_NO_TTY)
557 AC_DEFINE(DISABLE_FD_PASSING)
559 LIBS="$LIBS -lgen -lacid -ldb"
563 AC_DEFINE(SETEUID_BREAKS_SETUID)
564 AC_DEFINE(BROKEN_SETREUID)
565 AC_DEFINE(BROKEN_SETREGID)
567 AC_DEFINE(DISABLE_FD_PASSING)
568 AC_DEFINE(NO_SSH_LASTLOG)
569 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
570 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
574 AC_MSG_CHECKING(for Digital Unix SIA)
577 [ --with-osfsia Enable Digital Unix SIA],
579 if test "x$withval" = "xno" ; then
580 AC_MSG_RESULT(disabled)
585 if test -z "$no_osfsia" ; then
586 if test -f /etc/sia/matrix.conf; then
588 AC_DEFINE(HAVE_OSF_SIA, 1,
589 [Define if you have Digital Unix Security
590 Integration Architecture])
591 AC_DEFINE(DISABLE_LOGIN, 1,
592 [Define if you don't want to use your
593 system's login() call])
594 AC_DEFINE(DISABLE_FD_PASSING)
595 LIBS="$LIBS -lsecurity -ldb -lm -laud"
598 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
599 [String used in /etc/passwd to denote locked account])
602 AC_DEFINE(BROKEN_GETADDRINFO)
603 AC_DEFINE(SETEUID_BREAKS_SETUID)
604 AC_DEFINE(BROKEN_SETREUID)
605 AC_DEFINE(BROKEN_SETREGID)
610 AC_DEFINE(NO_X11_UNIX_SOCKETS)
611 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
612 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
613 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
617 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
618 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
619 AC_DEFINE(NEED_SETPRGP)
620 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
624 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
625 AC_DEFINE(MISSING_HOWMANY)
626 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
630 # Allow user to specify flags
632 [ --with-cflags Specify additional flags to pass to compiler],
634 if test -n "$withval" && test "x$withval" != "xno" && \
635 test "x${withval}" != "xyes"; then
636 CFLAGS="$CFLAGS $withval"
640 AC_ARG_WITH(cppflags,
641 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
643 if test -n "$withval" && test "x$withval" != "xno" && \
644 test "x${withval}" != "xyes"; then
645 CPPFLAGS="$CPPFLAGS $withval"
650 [ --with-ldflags Specify additional flags to pass to linker],
652 if test -n "$withval" && test "x$withval" != "xno" && \
653 test "x${withval}" != "xyes"; then
654 LDFLAGS="$LDFLAGS $withval"
659 [ --with-libs Specify additional libraries to link with],
661 if test -n "$withval" && test "x$withval" != "xno" && \
662 test "x${withval}" != "xyes"; then
663 LIBS="$LIBS $withval"
668 [ --with-Werror Build main code with -Werror],
670 if test -n "$withval" && test "x$withval" != "xno"; then
671 werror_flags="-Werror"
672 if "x${withval}" != "xyes"; then
673 werror_flags="$withval"
679 AC_MSG_CHECKING(compiler and flags for sanity)
685 [ AC_MSG_RESULT(yes) ],
688 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
690 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
693 dnl Checks for header files.
719 security/pam_appl.h \
755 # sys/ptms.h requires sys/stream.h to be included first on Solaris
756 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
757 #ifdef HAVE_SYS_STREAM_H
758 # include <sys/stream.h>
762 # Checks for libraries.
763 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
764 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
766 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
767 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
768 AC_CHECK_LIB(gen, dirname,[
769 AC_CACHE_CHECK([for broken dirname],
770 ac_cv_have_broken_dirname, [
778 int main(int argc, char **argv) {
781 strncpy(buf,"/etc", 32);
783 if (!s || strncmp(s, "/", 32) != 0) {
790 [ ac_cv_have_broken_dirname="no" ],
791 [ ac_cv_have_broken_dirname="yes" ]
795 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
797 AC_DEFINE(HAVE_DIRNAME)
798 AC_CHECK_HEADERS(libgen.h)
803 AC_CHECK_FUNC(getspnam, ,
804 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
805 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
806 [Define if you have the basename function.]))
810 [ --with-zlib=PATH Use zlib in PATH],
811 [ if test "x$withval" = "xno" ; then
812 AC_MSG_ERROR([*** zlib is required ***])
813 elif test "x$withval" != "xyes"; then
814 if test -d "$withval/lib"; then
815 if test -n "${need_dash_r}"; then
816 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
818 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
821 if test -n "${need_dash_r}"; then
822 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
824 LDFLAGS="-L${withval} ${LDFLAGS}"
827 if test -d "$withval/include"; then
828 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
830 CPPFLAGS="-I${withval} ${CPPFLAGS}"
835 AC_CHECK_LIB(z, deflate, ,
837 saved_CPPFLAGS="$CPPFLAGS"
838 saved_LDFLAGS="$LDFLAGS"
840 dnl Check default zlib install dir
841 if test -n "${need_dash_r}"; then
842 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
844 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
846 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
848 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
850 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
855 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
857 AC_ARG_WITH(zlib-version-check,
858 [ --without-zlib-version-check Disable zlib version check],
859 [ if test "x$withval" = "xno" ; then
860 zlib_check_nonfatal=1
865 AC_MSG_CHECKING(for possibly buggy zlib)
866 AC_RUN_IFELSE([AC_LANG_SOURCE([[
871 int a=0, b=0, c=0, d=0, n, v;
872 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
873 if (n != 3 && n != 4)
875 v = a*1000000 + b*10000 + c*100 + d;
876 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
879 if (a == 1 && b == 1 && c >= 4)
882 /* 1.2.3 and up are OK */
891 if test -z "$zlib_check_nonfatal" ; then
892 AC_MSG_ERROR([*** zlib too old - check config.log ***
893 Your reported zlib version has known security problems. It's possible your
894 vendor has fixed these problems without changing the version number. If you
895 are sure this is the case, you can disable the check by running
896 "./configure --without-zlib-version-check".
897 If you are in doubt, upgrade zlib to version 1.2.3 or greater.
898 See http://www.gzip.org/zlib/ for details.])
900 AC_MSG_WARN([zlib version may have security problems])
903 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
907 AC_CHECK_FUNC(strcasecmp,
908 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
910 AC_CHECK_FUNC(utimes,
911 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
912 LIBS="$LIBS -lc89"]) ]
915 dnl Checks for libutil functions
916 AC_CHECK_HEADERS(libutil.h)
917 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
918 [Define if your libraries define login()])])
919 AC_CHECK_FUNCS(logout updwtmp logwtmp)
923 # Check for ALTDIRFUNC glob() extension
924 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
925 AC_EGREP_CPP(FOUNDIT,
928 #ifdef GLOB_ALTDIRFUNC
933 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
934 [Define if your system glob() function has
935 the GLOB_ALTDIRFUNC extension])
943 # Check for g.gl_matchc glob() extension
944 AC_MSG_CHECKING(for gl_matchc field in glob_t)
945 AC_EGREP_CPP(FOUNDIT,
948 int main(void){glob_t g; g.gl_matchc = 1;}
951 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
952 [Define if your system glob() function has
953 gl_matchc options in glob_t])
961 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
964 #include <sys/types.h>
966 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
968 [AC_MSG_RESULT(yes)],
971 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
972 [Define in your struct dirent expects you to
973 allocate extra space for d_name])
976 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
977 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
981 AC_MSG_CHECKING([for /proc/pid/fd directory])
982 if test -d "/proc/$$/fd" ; then
983 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
989 # Check whether user wants S/Key support
992 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
994 if test "x$withval" != "xno" ; then
996 if test "x$withval" != "xyes" ; then
997 CPPFLAGS="$CPPFLAGS -I${withval}/include"
998 LDFLAGS="$LDFLAGS -L${withval}/lib"
1001 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
1005 AC_MSG_CHECKING([for s/key support])
1010 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
1012 [AC_MSG_RESULT(yes)],
1015 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1017 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1021 [(void)skeychallenge(NULL,"name","",0);],
1023 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1024 [Define if your skeychallenge()
1025 function takes 4 arguments (NetBSD)])],
1032 # Check whether user wants TCP wrappers support
1034 AC_ARG_WITH(tcp-wrappers,
1035 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
1037 if test "x$withval" != "xno" ; then
1039 saved_LDFLAGS="$LDFLAGS"
1040 saved_CPPFLAGS="$CPPFLAGS"
1041 if test -n "${withval}" && \
1042 test "x${withval}" != "xyes"; then
1043 if test -d "${withval}/lib"; then
1044 if test -n "${need_dash_r}"; then
1045 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1047 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1050 if test -n "${need_dash_r}"; then
1051 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1053 LDFLAGS="-L${withval} ${LDFLAGS}"
1056 if test -d "${withval}/include"; then
1057 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1059 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1063 LIBS="$LIBWRAP $LIBS"
1064 AC_MSG_CHECKING(for libwrap)
1067 #include <sys/types.h>
1068 #include <sys/socket.h>
1069 #include <netinet/in.h>
1071 int deny_severity = 0, allow_severity = 0;
1076 AC_DEFINE(LIBWRAP, 1,
1078 TCP Wrappers support])
1083 AC_MSG_ERROR([*** libwrap missing])
1091 # Check whether user wants libedit support
1093 AC_ARG_WITH(libedit,
1094 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1095 [ if test "x$withval" != "xno" ; then
1096 if test "x$withval" != "xyes"; then
1097 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1098 if test -n "${need_dash_r}"; then
1099 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1101 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1104 AC_CHECK_LIB(edit, el_init,
1105 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
1106 LIBEDIT="-ledit -lcurses"
1110 [ AC_MSG_ERROR(libedit not found) ],
1113 AC_MSG_CHECKING(if libedit version is compatible)
1116 #include <histedit.h>
1120 el_init("", NULL, NULL, NULL);
1124 [ AC_MSG_RESULT(yes) ],
1126 AC_MSG_ERROR(libedit version is not compatible) ]
1133 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1135 AC_MSG_CHECKING(for supported audit module)
1140 dnl Checks for headers, libs and functions
1141 AC_CHECK_HEADERS(bsm/audit.h, [],
1142 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1143 AC_CHECK_LIB(bsm, getaudit, [],
1144 [AC_MSG_ERROR(BSM enabled and required library not found)])
1145 AC_CHECK_FUNCS(getaudit, [],
1146 [AC_MSG_ERROR(BSM enabled and required function not found)])
1147 # These are optional
1148 AC_CHECK_FUNCS(getaudit_addr)
1149 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
1153 AC_MSG_RESULT(debug)
1154 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
1160 AC_MSG_ERROR([Unknown audit module $withval])
1165 dnl Checks for library functions. Please keep in alphabetical order
1249 # IRIX has a const char return value for gai_strerror()
1250 AC_CHECK_FUNCS(gai_strerror,[
1251 AC_DEFINE(HAVE_GAI_STRERROR)
1253 #include <sys/types.h>
1254 #include <sys/socket.h>
1257 const char *gai_strerror(int);],[
1260 str = gai_strerror(0);],[
1261 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1262 [Define if gai_strerror() returns const char *])])])
1264 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1265 [Some systems put nanosleep outside of libc]))
1267 dnl Make sure prototypes are defined for these before using them.
1268 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1269 AC_CHECK_DECL(strsep,
1270 [AC_CHECK_FUNCS(strsep)],
1273 #ifdef HAVE_STRING_H
1274 # include <string.h>
1278 dnl tcsendbreak might be a macro
1279 AC_CHECK_DECL(tcsendbreak,
1280 [AC_DEFINE(HAVE_TCSENDBREAK)],
1281 [AC_CHECK_FUNCS(tcsendbreak)],
1282 [#include <termios.h>]
1285 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1287 AC_CHECK_FUNCS(setresuid, [
1288 dnl Some platorms have setresuid that isn't implemented, test for this
1289 AC_MSG_CHECKING(if setresuid seems to work)
1294 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1296 [AC_MSG_RESULT(yes)],
1297 [AC_DEFINE(BROKEN_SETRESUID, 1,
1298 [Define if your setresuid() is broken])
1299 AC_MSG_RESULT(not implemented)],
1300 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1304 AC_CHECK_FUNCS(setresgid, [
1305 dnl Some platorms have setresgid that isn't implemented, test for this
1306 AC_MSG_CHECKING(if setresgid seems to work)
1311 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1313 [AC_MSG_RESULT(yes)],
1314 [AC_DEFINE(BROKEN_SETRESGID, 1,
1315 [Define if your setresgid() is broken])
1316 AC_MSG_RESULT(not implemented)],
1317 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1321 dnl Checks for time functions
1322 AC_CHECK_FUNCS(gettimeofday time)
1323 dnl Checks for utmp functions
1324 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1325 AC_CHECK_FUNCS(utmpname)
1326 dnl Checks for utmpx functions
1327 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1328 AC_CHECK_FUNCS(setutxent utmpxname)
1330 AC_CHECK_FUNC(daemon,
1331 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1332 [AC_CHECK_LIB(bsd, daemon,
1333 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1336 AC_CHECK_FUNC(getpagesize,
1337 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1338 [Define if your libraries define getpagesize()])],
1339 [AC_CHECK_LIB(ucb, getpagesize,
1340 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1343 # Check for broken snprintf
1344 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1345 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1349 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1351 [AC_MSG_RESULT(yes)],
1354 AC_DEFINE(BROKEN_SNPRINTF, 1,
1355 [Define if your snprintf is busted])
1356 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1358 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1362 # Check for missing getpeereid (or equiv) support
1364 if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1365 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1367 [#include <sys/types.h>
1368 #include <sys/socket.h>],
1369 [int i = SO_PEERCRED;],
1370 [ AC_MSG_RESULT(yes)
1371 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
1378 dnl see whether mkstemp() requires XXXXXX
1379 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1380 AC_MSG_CHECKING([for (overly) strict mkstemp])
1384 main() { char template[]="conftest.mkstemp-test";
1385 if (mkstemp(template) == -1)
1387 unlink(template); exit(0);
1395 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
1399 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1404 dnl make sure that openpty does not reacquire controlling terminal
1405 if test ! -z "$check_for_openpty_ctty_bug"; then
1406 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1410 #include <sys/fcntl.h>
1411 #include <sys/types.h>
1412 #include <sys/wait.h>
1418 int fd, ptyfd, ttyfd, status;
1421 if (pid < 0) { /* failed */
1423 } else if (pid > 0) { /* parent */
1424 waitpid(pid, &status, 0);
1425 if (WIFEXITED(status))
1426 exit(WEXITSTATUS(status));
1429 } else { /* child */
1430 close(0); close(1); close(2);
1432 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1433 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1435 exit(3); /* Acquired ctty: broken */
1437 exit(0); /* Did not acquire ctty: OK */
1446 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1451 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1452 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1453 AC_MSG_CHECKING(if getaddrinfo seems to work)
1457 #include <sys/socket.h>
1460 #include <netinet/in.h>
1462 #define TEST_PORT "2222"
1468 struct addrinfo *gai_ai, *ai, hints;
1469 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1471 memset(&hints, 0, sizeof(hints));
1472 hints.ai_family = PF_UNSPEC;
1473 hints.ai_socktype = SOCK_STREAM;
1474 hints.ai_flags = AI_PASSIVE;
1476 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1478 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1482 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1483 if (ai->ai_family != AF_INET6)
1486 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1487 sizeof(ntop), strport, sizeof(strport),
1488 NI_NUMERICHOST|NI_NUMERICSERV);
1491 if (err == EAI_SYSTEM)
1492 perror("getnameinfo EAI_SYSTEM");
1494 fprintf(stderr, "getnameinfo failed: %s\n",
1499 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1502 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1515 AC_DEFINE(BROKEN_GETADDRINFO)
1520 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1521 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1522 AC_MSG_CHECKING(if getaddrinfo seems to work)
1526 #include <sys/socket.h>
1529 #include <netinet/in.h>
1531 #define TEST_PORT "2222"
1537 struct addrinfo *gai_ai, *ai, hints;
1538 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1540 memset(&hints, 0, sizeof(hints));
1541 hints.ai_family = PF_UNSPEC;
1542 hints.ai_socktype = SOCK_STREAM;
1543 hints.ai_flags = AI_PASSIVE;
1545 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1547 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1551 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1552 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1555 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1556 sizeof(ntop), strport, sizeof(strport),
1557 NI_NUMERICHOST|NI_NUMERICSERV);
1559 if (ai->ai_family == AF_INET && err != 0) {
1560 perror("getnameinfo");
1569 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1570 [Define if you have a getaddrinfo that fails
1571 for the all-zeros IPv6 address])
1575 AC_DEFINE(BROKEN_GETADDRINFO)
1580 if test "x$check_for_conflicting_getspnam" = "x1"; then
1581 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1585 int main(void) {exit(0);}
1592 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1593 [Conflicting defs for getspnam])
1600 # Check for PAM libs
1603 [ --with-pam Enable PAM support ],
1605 if test "x$withval" != "xno" ; then
1606 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1607 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1608 AC_MSG_ERROR([PAM headers not found])
1611 AC_CHECK_LIB(dl, dlopen, , )
1612 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1613 AC_CHECK_FUNCS(pam_getenvlist)
1614 AC_CHECK_FUNCS(pam_putenv)
1618 AC_DEFINE(USE_PAM, 1,
1619 [Define if you want to enable PAM support])
1620 if test $ac_cv_lib_dl_dlopen = yes; then
1630 # Check for older PAM
1631 if test "x$PAM_MSG" = "xyes" ; then
1632 # Check PAM strerror arguments (old PAM)
1633 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1637 #if defined(HAVE_SECURITY_PAM_APPL_H)
1638 #include <security/pam_appl.h>
1639 #elif defined (HAVE_PAM_PAM_APPL_H)
1640 #include <pam/pam_appl.h>
1643 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1644 [AC_MSG_RESULT(no)],
1646 AC_DEFINE(HAVE_OLD_PAM, 1,
1647 [Define if you have an old version of PAM
1648 which takes only one argument to pam_strerror])
1650 PAM_MSG="yes (old library)"
1655 # Search for OpenSSL
1656 saved_CPPFLAGS="$CPPFLAGS"
1657 saved_LDFLAGS="$LDFLAGS"
1658 AC_ARG_WITH(ssl-dir,
1659 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1661 if test "x$withval" != "xno" ; then
1664 ./*|../*) withval="`pwd`/$withval"
1666 if test -d "$withval/lib"; then
1667 if test -n "${need_dash_r}"; then
1668 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1670 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1673 if test -n "${need_dash_r}"; then
1674 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1676 LDFLAGS="-L${withval} ${LDFLAGS}"
1679 if test -d "$withval/include"; then
1680 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1682 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1687 LIBS="-lcrypto $LIBS"
1688 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1689 [Define if your ssl headers are included
1690 with #include <openssl/header.h>]),
1692 dnl Check default openssl install dir
1693 if test -n "${need_dash_r}"; then
1694 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1696 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1698 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1699 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1701 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1707 # Determine OpenSSL header version
1708 AC_MSG_CHECKING([OpenSSL header version])
1713 #include <openssl/opensslv.h>
1714 #define DATA "conftest.sslincver"
1719 fd = fopen(DATA,"w");
1723 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1730 ssl_header_ver=`cat conftest.sslincver`
1731 AC_MSG_RESULT($ssl_header_ver)
1734 AC_MSG_RESULT(not found)
1735 AC_MSG_ERROR(OpenSSL version header not found.)
1738 AC_MSG_WARN([cross compiling: not checking])
1742 # Determine OpenSSL library version
1743 AC_MSG_CHECKING([OpenSSL library version])
1748 #include <openssl/opensslv.h>
1749 #include <openssl/crypto.h>
1750 #define DATA "conftest.ssllibver"
1755 fd = fopen(DATA,"w");
1759 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1766 ssl_library_ver=`cat conftest.ssllibver`
1767 AC_MSG_RESULT($ssl_library_ver)
1770 AC_MSG_RESULT(not found)
1771 AC_MSG_ERROR(OpenSSL library not found.)
1774 AC_MSG_WARN([cross compiling: not checking])
1778 # Sanity check OpenSSL headers
1779 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1783 #include <openssl/opensslv.h>
1784 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1791 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1792 Check config.log for details.
1793 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1796 AC_MSG_WARN([cross compiling: not checking])
1800 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1801 # because the system crypt() is more featureful.
1802 if test "x$check_for_libcrypt_before" = "x1"; then
1803 AC_CHECK_LIB(crypt, crypt)
1806 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1807 # version in OpenSSL.
1808 if test "x$check_for_libcrypt_later" = "x1"; then
1809 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1812 AC_CHECK_LIB(iaf, ia_openinfo)
1814 ### Configure cryptographic random number support
1816 # Check wheter OpenSSL seeds itself
1817 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1821 #include <openssl/rand.h>
1822 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1825 OPENSSL_SEEDS_ITSELF=yes
1830 # Default to use of the rand helper if OpenSSL doesn't
1835 AC_MSG_WARN([cross compiling: assuming yes])
1836 # This is safe, since all recent OpenSSL versions will
1837 # complain at runtime if not seeded correctly.
1838 OPENSSL_SEEDS_ITSELF=yes
1843 # Do we want to force the use of the rand helper?
1844 AC_ARG_WITH(rand-helper,
1845 [ --with-rand-helper Use subprocess to gather strong randomness ],
1847 if test "x$withval" = "xno" ; then
1848 # Force use of OpenSSL's internal RNG, even if
1849 # the previous test showed it to be unseeded.
1850 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1851 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1852 OPENSSL_SEEDS_ITSELF=yes
1861 # Which randomness source do we use?
1862 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
1864 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1865 [Define if you want OpenSSL's internally seeded PRNG only])
1866 RAND_MSG="OpenSSL internal ONLY"
1867 INSTALL_SSH_RAND_HELPER=""
1868 elif test ! -z "$USE_RAND_HELPER" ; then
1869 # install rand helper
1870 RAND_MSG="ssh-rand-helper"
1871 INSTALL_SSH_RAND_HELPER="yes"
1873 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1875 ### Configuration of ssh-rand-helper
1878 AC_ARG_WITH(prngd-port,
1879 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1888 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1891 if test ! -z "$withval" ; then
1892 PRNGD_PORT="$withval"
1893 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1894 [Port number of PRNGD/EGD random number socket])
1899 # PRNGD Unix domain socket
1900 AC_ARG_WITH(prngd-socket,
1901 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1905 withval="/var/run/egd-pool"
1913 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1917 if test ! -z "$withval" ; then
1918 if test ! -z "$PRNGD_PORT" ; then
1919 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1921 if test ! -r "$withval" ; then
1922 AC_MSG_WARN(Entropy socket is not readable)
1924 PRNGD_SOCKET="$withval"
1925 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1926 [Location of PRNGD/EGD random number socket])
1930 # Check for existing socket only if we don't have a random device already
1931 if test "$USE_RAND_HELPER" = yes ; then
1932 AC_MSG_CHECKING(for PRNGD/EGD socket)
1933 # Insert other locations here
1934 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1935 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1936 PRNGD_SOCKET="$sock"
1937 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1941 if test ! -z "$PRNGD_SOCKET" ; then
1942 AC_MSG_RESULT($PRNGD_SOCKET)
1944 AC_MSG_RESULT(not found)
1950 # Change default command timeout for hashing entropy source
1952 AC_ARG_WITH(entropy-timeout,
1953 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1955 if test -n "$withval" && test "x$withval" != "xno" && \
1956 test "x${withval}" != "xyes"; then
1957 entropy_timeout=$withval
1961 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
1962 [Builtin PRNG command timeout])
1964 SSH_PRIVSEP_USER=sshd
1965 AC_ARG_WITH(privsep-user,
1966 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1968 if test -n "$withval" && test "x$withval" != "xno" && \
1969 test "x${withval}" != "xyes"; then
1970 SSH_PRIVSEP_USER=$withval
1974 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
1975 [non-privileged user for privilege separation])
1976 AC_SUBST(SSH_PRIVSEP_USER)
1978 # We do this little dance with the search path to insure
1979 # that programs that we select for use by installed programs
1980 # (which may be run by the super-user) come from trusted
1981 # locations before they come from the user's private area.
1982 # This should help avoid accidentally configuring some
1983 # random version of a program in someone's personal bin.
1987 test -h /bin 2> /dev/null && PATH=/usr/bin
1988 test -d /sbin && PATH=$PATH:/sbin
1989 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1990 PATH=$PATH:/etc:$OPATH
1992 # These programs are used by the command hashing source to gather entropy
1993 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1994 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1995 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1996 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1997 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1998 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1999 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2000 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2001 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2002 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2003 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2004 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2005 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2006 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2007 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2008 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
2012 # Where does ssh-rand-helper get its randomness from?
2013 INSTALL_SSH_PRNG_CMDS=""
2014 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2015 if test ! -z "$PRNGD_PORT" ; then
2016 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2017 elif test ! -z "$PRNGD_SOCKET" ; then
2018 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2020 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2021 RAND_HELPER_CMDHASH=yes
2022 INSTALL_SSH_PRNG_CMDS="yes"
2025 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2028 # Cheap hack to ensure NEWS-OS libraries are arranged right.
2029 if test ! -z "$SONY" ; then
2030 LIBS="$LIBS -liberty";
2033 # Checks for data types
2034 AC_CHECK_SIZEOF(char, 1)
2035 AC_CHECK_SIZEOF(short int, 2)
2036 AC_CHECK_SIZEOF(int, 4)
2037 AC_CHECK_SIZEOF(long int, 4)
2038 AC_CHECK_SIZEOF(long long int, 8)
2040 # Sanity check long long for some platforms (AIX)
2041 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2042 ac_cv_sizeof_long_long_int=0
2045 # More checks for data types
2046 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2048 [ #include <sys/types.h> ],
2050 [ ac_cv_have_u_int="yes" ],
2051 [ ac_cv_have_u_int="no" ]
2054 if test "x$ac_cv_have_u_int" = "xyes" ; then
2055 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
2059 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2061 [ #include <sys/types.h> ],
2062 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2063 [ ac_cv_have_intxx_t="yes" ],
2064 [ ac_cv_have_intxx_t="no" ]
2067 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2068 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
2072 if (test -z "$have_intxx_t" && \
2073 test "x$ac_cv_header_stdint_h" = "xyes")
2075 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2077 [ #include <stdint.h> ],
2078 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2080 AC_DEFINE(HAVE_INTXX_T)
2083 [ AC_MSG_RESULT(no) ]
2087 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2090 #include <sys/types.h>
2091 #ifdef HAVE_STDINT_H
2092 # include <stdint.h>
2094 #include <sys/socket.h>
2095 #ifdef HAVE_SYS_BITYPES_H
2096 # include <sys/bitypes.h>
2099 [ int64_t a; a = 1;],
2100 [ ac_cv_have_int64_t="yes" ],
2101 [ ac_cv_have_int64_t="no" ]
2104 if test "x$ac_cv_have_int64_t" = "xyes" ; then
2105 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
2108 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2110 [ #include <sys/types.h> ],
2111 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2112 [ ac_cv_have_u_intxx_t="yes" ],
2113 [ ac_cv_have_u_intxx_t="no" ]
2116 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2117 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
2121 if test -z "$have_u_intxx_t" ; then
2122 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2124 [ #include <sys/socket.h> ],
2125 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2127 AC_DEFINE(HAVE_U_INTXX_T)
2130 [ AC_MSG_RESULT(no) ]
2134 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2136 [ #include <sys/types.h> ],
2137 [ u_int64_t a; a = 1;],
2138 [ ac_cv_have_u_int64_t="yes" ],
2139 [ ac_cv_have_u_int64_t="no" ]
2142 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2143 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
2147 if test -z "$have_u_int64_t" ; then
2148 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2150 [ #include <sys/bitypes.h> ],
2151 [ u_int64_t a; a = 1],
2153 AC_DEFINE(HAVE_U_INT64_T)
2156 [ AC_MSG_RESULT(no) ]
2160 if test -z "$have_u_intxx_t" ; then
2161 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2164 #include <sys/types.h>
2166 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2167 [ ac_cv_have_uintxx_t="yes" ],
2168 [ ac_cv_have_uintxx_t="no" ]
2171 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2172 AC_DEFINE(HAVE_UINTXX_T, 1,
2173 [define if you have uintxx_t data type])
2177 if test -z "$have_uintxx_t" ; then
2178 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2180 [ #include <stdint.h> ],
2181 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2183 AC_DEFINE(HAVE_UINTXX_T)
2186 [ AC_MSG_RESULT(no) ]
2190 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2191 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2193 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2196 #include <sys/bitypes.h>
2199 int8_t a; int16_t b; int32_t c;
2200 u_int8_t e; u_int16_t f; u_int32_t g;
2201 a = b = c = e = f = g = 1;
2204 AC_DEFINE(HAVE_U_INTXX_T)
2205 AC_DEFINE(HAVE_INTXX_T)
2213 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2216 #include <sys/types.h>
2218 [ u_char foo; foo = 125; ],
2219 [ ac_cv_have_u_char="yes" ],
2220 [ ac_cv_have_u_char="no" ]
2223 if test "x$ac_cv_have_u_char" = "xyes" ; then
2224 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
2229 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2231 AC_CHECK_TYPES(in_addr_t,,,
2232 [#include <sys/types.h>
2233 #include <netinet/in.h>])
2235 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2238 #include <sys/types.h>
2240 [ size_t foo; foo = 1235; ],
2241 [ ac_cv_have_size_t="yes" ],
2242 [ ac_cv_have_size_t="no" ]
2245 if test "x$ac_cv_have_size_t" = "xyes" ; then
2246 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
2249 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2252 #include <sys/types.h>
2254 [ ssize_t foo; foo = 1235; ],
2255 [ ac_cv_have_ssize_t="yes" ],
2256 [ ac_cv_have_ssize_t="no" ]
2259 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2260 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
2263 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2268 [ clock_t foo; foo = 1235; ],
2269 [ ac_cv_have_clock_t="yes" ],
2270 [ ac_cv_have_clock_t="no" ]
2273 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2274 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
2277 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2280 #include <sys/types.h>
2281 #include <sys/socket.h>
2283 [ sa_family_t foo; foo = 1235; ],
2284 [ ac_cv_have_sa_family_t="yes" ],
2287 #include <sys/types.h>
2288 #include <sys/socket.h>
2289 #include <netinet/in.h>
2291 [ sa_family_t foo; foo = 1235; ],
2292 [ ac_cv_have_sa_family_t="yes" ],
2294 [ ac_cv_have_sa_family_t="no" ]
2298 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2299 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2300 [define if you have sa_family_t data type])
2303 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2306 #include <sys/types.h>
2308 [ pid_t foo; foo = 1235; ],
2309 [ ac_cv_have_pid_t="yes" ],
2310 [ ac_cv_have_pid_t="no" ]
2313 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2314 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
2317 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2320 #include <sys/types.h>
2322 [ mode_t foo; foo = 1235; ],
2323 [ ac_cv_have_mode_t="yes" ],
2324 [ ac_cv_have_mode_t="no" ]
2327 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2328 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
2332 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2335 #include <sys/types.h>
2336 #include <sys/socket.h>
2338 [ struct sockaddr_storage s; ],
2339 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2340 [ ac_cv_have_struct_sockaddr_storage="no" ]
2343 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2344 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2345 [define if you have struct sockaddr_storage data type])
2348 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2351 #include <sys/types.h>
2352 #include <netinet/in.h>
2354 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2355 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2356 [ ac_cv_have_struct_sockaddr_in6="no" ]
2359 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2360 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2361 [define if you have struct sockaddr_in6 data type])
2364 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2367 #include <sys/types.h>
2368 #include <netinet/in.h>
2370 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2371 [ ac_cv_have_struct_in6_addr="yes" ],
2372 [ ac_cv_have_struct_in6_addr="no" ]
2375 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2376 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2377 [define if you have struct in6_addr data type])
2380 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2383 #include <sys/types.h>
2384 #include <sys/socket.h>
2387 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2388 [ ac_cv_have_struct_addrinfo="yes" ],
2389 [ ac_cv_have_struct_addrinfo="no" ]
2392 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2393 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2394 [define if you have struct addrinfo data type])
2397 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2399 [ #include <sys/time.h> ],
2400 [ struct timeval tv; tv.tv_sec = 1;],
2401 [ ac_cv_have_struct_timeval="yes" ],
2402 [ ac_cv_have_struct_timeval="no" ]
2405 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2406 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
2407 have_struct_timeval=1
2410 AC_CHECK_TYPES(struct timespec)
2412 # We need int64_t or else certian parts of the compile will fail.
2413 if test "x$ac_cv_have_int64_t" = "xno" && \
2414 test "x$ac_cv_sizeof_long_int" != "x8" && \
2415 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2416 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2417 echo "an alternative compiler (I.E., GCC) before continuing."
2421 dnl test snprintf (broken on SCO w/gcc)
2426 #ifdef HAVE_SNPRINTF
2430 char expected_out[50];
2432 #if (SIZEOF_LONG_INT == 8)
2433 long int num = 0x7fffffffffffffff;
2435 long long num = 0x7fffffffffffffffll;
2437 strcpy(expected_out, "9223372036854775807");
2438 snprintf(buf, mazsize, "%lld", num);
2439 if(strcmp(buf, expected_out) != 0)
2446 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2447 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2451 dnl Checks for structure members
2452 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2453 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2454 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2455 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2456 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2457 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2458 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2459 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2460 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2461 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2462 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2463 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2464 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2465 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2466 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2467 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2468 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2470 AC_CHECK_MEMBERS([struct stat.st_blksize])
2472 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2473 ac_cv_have_ss_family_in_struct_ss, [
2476 #include <sys/types.h>
2477 #include <sys/socket.h>
2479 [ struct sockaddr_storage s; s.ss_family = 1; ],
2480 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2481 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2484 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2485 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
2488 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2489 ac_cv_have___ss_family_in_struct_ss, [
2492 #include <sys/types.h>
2493 #include <sys/socket.h>
2495 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2496 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2497 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2500 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2501 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2502 [Fields in struct sockaddr_storage])
2505 AC_CACHE_CHECK([for pw_class field in struct passwd],
2506 ac_cv_have_pw_class_in_struct_passwd, [
2511 [ struct passwd p; p.pw_class = 0; ],
2512 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2513 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2516 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2517 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2518 [Define if your password has a pw_class field])
2521 AC_CACHE_CHECK([for pw_expire field in struct passwd],
2522 ac_cv_have_pw_expire_in_struct_passwd, [
2527 [ struct passwd p; p.pw_expire = 0; ],
2528 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2529 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2532 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2533 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2534 [Define if your password has a pw_expire field])
2537 AC_CACHE_CHECK([for pw_change field in struct passwd],
2538 ac_cv_have_pw_change_in_struct_passwd, [
2543 [ struct passwd p; p.pw_change = 0; ],
2544 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2545 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2548 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2549 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2550 [Define if your password has a pw_change field])
2553 dnl make sure we're using the real structure members and not defines
2554 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2555 ac_cv_have_accrights_in_msghdr, [
2558 #include <sys/types.h>
2559 #include <sys/socket.h>
2560 #include <sys/uio.h>
2562 #ifdef msg_accrights
2563 #error "msg_accrights is a macro"
2567 m.msg_accrights = 0;
2571 [ ac_cv_have_accrights_in_msghdr="yes" ],
2572 [ ac_cv_have_accrights_in_msghdr="no" ]
2575 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2576 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2577 [Define if your system uses access rights style
2578 file descriptor passing])
2581 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2582 ac_cv_have_control_in_msghdr, [
2585 #include <sys/types.h>
2586 #include <sys/socket.h>
2587 #include <sys/uio.h>
2590 #error "msg_control is a macro"
2598 [ ac_cv_have_control_in_msghdr="yes" ],
2599 [ ac_cv_have_control_in_msghdr="no" ]
2602 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2603 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2604 [Define if your system uses ancillary data style
2605 file descriptor passing])
2608 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2610 [ extern char *__progname; printf("%s", __progname); ],
2611 [ ac_cv_libc_defines___progname="yes" ],
2612 [ ac_cv_libc_defines___progname="no" ]
2615 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2616 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
2619 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2623 [ printf("%s", __FUNCTION__); ],
2624 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2625 [ ac_cv_cc_implements___FUNCTION__="no" ]
2628 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2629 AC_DEFINE(HAVE___FUNCTION__, 1,
2630 [Define if compiler implements __FUNCTION__])
2633 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2637 [ printf("%s", __func__); ],
2638 [ ac_cv_cc_implements___func__="yes" ],
2639 [ ac_cv_cc_implements___func__="no" ]
2642 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2643 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
2646 AC_CACHE_CHECK([whether getopt has optreset support],
2647 ac_cv_have_getopt_optreset, [
2652 [ extern int optreset; optreset = 0; ],
2653 [ ac_cv_have_getopt_optreset="yes" ],
2654 [ ac_cv_have_getopt_optreset="no" ]
2657 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2658 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2659 [Define if your getopt(3) defines and uses optreset])
2662 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2664 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2665 [ ac_cv_libc_defines_sys_errlist="yes" ],
2666 [ ac_cv_libc_defines_sys_errlist="no" ]
2669 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2670 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2671 [Define if your system defines sys_errlist[]])
2675 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2677 [ extern int sys_nerr; printf("%i", sys_nerr);],
2678 [ ac_cv_libc_defines_sys_nerr="yes" ],
2679 [ ac_cv_libc_defines_sys_nerr="no" ]
2682 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2683 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
2687 # Check whether user wants sectok support
2689 [ --with-sectok Enable smartcard support using libsectok],
2691 if test "x$withval" != "xno" ; then
2692 if test "x$withval" != "xyes" ; then
2693 CPPFLAGS="$CPPFLAGS -I${withval}"
2694 LDFLAGS="$LDFLAGS -L${withval}"
2695 if test ! -z "$need_dash_r" ; then
2696 LDFLAGS="$LDFLAGS -R${withval}"
2698 if test ! -z "$blibpath" ; then
2699 blibpath="$blibpath:${withval}"
2702 AC_CHECK_HEADERS(sectok.h)
2703 if test "$ac_cv_header_sectok_h" != yes; then
2704 AC_MSG_ERROR(Can't find sectok.h)
2706 AC_CHECK_LIB(sectok, sectok_open)
2707 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2708 AC_MSG_ERROR(Can't find libsectok)
2710 AC_DEFINE(SMARTCARD, 1,
2711 [Define if you want smartcard support])
2712 AC_DEFINE(USE_SECTOK, 1,
2713 [Define if you want smartcard support
2715 SCARD_MSG="yes, using sectok"
2720 # Check whether user wants OpenSC support
2723 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2725 if test "x$withval" != "xno" ; then
2726 if test "x$withval" != "xyes" ; then
2727 OPENSC_CONFIG=$withval/bin/opensc-config
2729 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2731 if test "$OPENSC_CONFIG" != "no"; then
2732 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2733 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2734 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2735 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2736 AC_DEFINE(SMARTCARD)
2737 AC_DEFINE(USE_OPENSC, 1,
2738 [Define if you want smartcard support
2740 SCARD_MSG="yes, using OpenSC"
2746 # Check libraries needed by DNS fingerprint support
2747 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2748 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2749 [Define if getrrsetbyname() exists])],
2751 # Needed by our getrrsetbyname()
2752 AC_SEARCH_LIBS(res_query, resolv)
2753 AC_SEARCH_LIBS(dn_expand, resolv)
2754 AC_MSG_CHECKING(if res_query will link)
2755 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2758 LIBS="$LIBS -lresolv"
2759 AC_MSG_CHECKING(for res_query in -lresolv)
2764 res_query (0, 0, 0, 0, 0);
2768 [LIBS="$LIBS -lresolv"
2769 AC_MSG_RESULT(yes)],
2773 AC_CHECK_FUNCS(_getshort _getlong)
2774 AC_CHECK_DECLS([_getshort, _getlong], , ,
2775 [#include <sys/types.h>
2776 #include <arpa/nameser.h>])
2777 AC_CHECK_MEMBER(HEADER.ad,
2778 [AC_DEFINE(HAVE_HEADER_AD, 1,
2779 [Define if HEADER.ad exists in arpa/nameser.h])],,
2780 [#include <arpa/nameser.h>])
2783 # Check whether user wants Kerberos 5 support
2785 AC_ARG_WITH(kerberos5,
2786 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2787 [ if test "x$withval" != "xno" ; then
2788 if test "x$withval" = "xyes" ; then
2789 KRB5ROOT="/usr/local"
2794 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
2797 AC_MSG_CHECKING(for krb5-config)
2798 if test -x $KRB5ROOT/bin/krb5-config ; then
2799 KRB5CONF=$KRB5ROOT/bin/krb5-config
2800 AC_MSG_RESULT($KRB5CONF)
2802 AC_MSG_CHECKING(for gssapi support)
2803 if $KRB5CONF | grep gssapi >/dev/null ; then
2805 AC_DEFINE(GSSAPI, 1,
2806 [Define this if you want GSSAPI
2807 support in the version 2 protocol])
2813 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2814 K5LIBS="`$KRB5CONF --libs $k5confopts`"
2815 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2816 AC_MSG_CHECKING(whether we are using Heimdal)
2817 AC_TRY_COMPILE([ #include <krb5.h> ],
2818 [ char *tmp = heimdal_version; ],
2819 [ AC_MSG_RESULT(yes)
2820 AC_DEFINE(HEIMDAL, 1,
2821 [Define this if you are using the
2822 Heimdal version of Kerberos V5]) ],
2827 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2828 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2829 AC_MSG_CHECKING(whether we are using Heimdal)
2830 AC_TRY_COMPILE([ #include <krb5.h> ],
2831 [ char *tmp = heimdal_version; ],
2832 [ AC_MSG_RESULT(yes)
2834 K5LIBS="-lkrb5 -ldes"
2835 K5LIBS="$K5LIBS -lcom_err -lasn1"
2836 AC_CHECK_LIB(roken, net_write,
2837 [K5LIBS="$K5LIBS -lroken"])
2840 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2843 AC_SEARCH_LIBS(dn_expand, resolv)
2845 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2847 K5LIBS="-lgssapi $K5LIBS" ],
2848 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2850 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2851 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2856 AC_CHECK_HEADER(gssapi.h, ,
2857 [ unset ac_cv_header_gssapi_h
2858 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2859 AC_CHECK_HEADERS(gssapi.h, ,
2860 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2866 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2867 AC_CHECK_HEADER(gssapi_krb5.h, ,
2868 [ CPPFLAGS="$oldCPP" ])
2871 if test ! -z "$need_dash_r" ; then
2872 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2874 if test ! -z "$blibpath" ; then
2875 blibpath="$blibpath:${KRB5ROOT}/lib"
2878 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2879 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2880 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2882 LIBS="$LIBS $K5LIBS"
2883 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
2884 [Define this if you want to use libkafs' AFS support]))
2889 # Looking for programs, paths and files
2891 PRIVSEP_PATH=/var/empty
2892 AC_ARG_WITH(privsep-path,
2893 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2895 if test -n "$withval" && test "x$withval" != "xno" && \
2896 test "x${withval}" != "xyes"; then
2897 PRIVSEP_PATH=$withval
2901 AC_SUBST(PRIVSEP_PATH)
2904 [ --with-xauth=PATH Specify path to xauth program ],
2906 if test -n "$withval" && test "x$withval" != "xno" && \
2907 test "x${withval}" != "xyes"; then
2913 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2914 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2915 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2916 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2917 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2918 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2919 xauth_path="/usr/openwin/bin/xauth"
2925 AC_ARG_ENABLE(strip,
2926 [ --disable-strip Disable calling strip(1) on install],
2928 if test "x$enableval" = "xno" ; then
2935 if test -z "$xauth_path" ; then
2936 XAUTH_PATH="undefined"
2937 AC_SUBST(XAUTH_PATH)
2939 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
2940 [Define if xauth is found in your path])
2941 XAUTH_PATH=$xauth_path
2942 AC_SUBST(XAUTH_PATH)
2945 # Check for mail directory (last resort if we cannot get it from headers)
2946 if test ! -z "$MAIL" ; then
2947 maildir=`dirname $MAIL`
2948 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
2949 [Set this to your mail directory if you don't have maillock.h])
2952 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
2953 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2954 disable_ptmx_check=yes
2956 if test -z "$no_dev_ptmx" ; then
2957 if test "x$disable_ptmx_check" != "xyes" ; then
2958 AC_CHECK_FILE("/dev/ptmx",
2960 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
2961 [Define if you have /dev/ptmx])
2968 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
2969 AC_CHECK_FILE("/dev/ptc",
2971 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
2972 [Define if you have /dev/ptc])
2977 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2980 # Options from here on. Some of these are preset by platform above
2981 AC_ARG_WITH(mantype,
2982 [ --with-mantype=man|cat|doc Set man page type],
2989 AC_MSG_ERROR(invalid man type: $withval)
2994 if test -z "$MANTYPE"; then
2995 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2996 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2997 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2999 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3006 if test "$MANTYPE" = "doc"; then
3013 # Check whether to enable MD5 passwords
3015 AC_ARG_WITH(md5-passwords,
3016 [ --with-md5-passwords Enable use of MD5 passwords],
3018 if test "x$withval" != "xno" ; then
3019 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3020 [Define if you want to allow MD5 passwords])
3026 # Whether to disable shadow password support
3028 [ --without-shadow Disable shadow password support],
3030 if test "x$withval" = "xno" ; then
3031 AC_DEFINE(DISABLE_SHADOW)
3037 if test -z "$disable_shadow" ; then
3038 AC_MSG_CHECKING([if the systems has expire shadow information])
3041 #include <sys/types.h>
3044 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3045 [ sp_expire_available=yes ], []
3048 if test "x$sp_expire_available" = "xyes" ; then
3050 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3051 [Define if you want to use shadow password expire field])
3057 # Use ip address instead of hostname in $DISPLAY
3058 if test ! -z "$IPADDR_IN_DISPLAY" ; then
3059 DISPLAY_HACK_MSG="yes"
3060 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3061 [Define if you need to use IP address
3062 instead of hostname in $DISPLAY])
3064 DISPLAY_HACK_MSG="no"
3065 AC_ARG_WITH(ipaddr-display,
3066 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3068 if test "x$withval" != "xno" ; then
3069 AC_DEFINE(IPADDR_IN_DISPLAY)
3070 DISPLAY_HACK_MSG="yes"
3076 # check for /etc/default/login and use it if present.
3077 AC_ARG_ENABLE(etc-default-login,
3078 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3079 [ if test "x$enableval" = "xno"; then
3080 AC_MSG_NOTICE([/etc/default/login handling disabled])
3081 etc_default_login=no
3083 etc_default_login=yes
3085 [ etc_default_login=yes ]
3088 if test "x$etc_default_login" != "xno"; then
3089 AC_CHECK_FILE("/etc/default/login",
3090 [ external_path_file=/etc/default/login ])
3091 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3093 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
3094 elif test "x$external_path_file" = "x/etc/default/login"; then
3095 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3096 [Define if your system has /etc/default/login])
3100 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3101 if test $ac_cv_func_login_getcapbool = "yes" && \
3102 test $ac_cv_header_login_cap_h = "yes" ; then
3103 external_path_file=/etc/login.conf
3106 # Whether to mess with the default path
3107 SERVER_PATH_MSG="(default)"
3108 AC_ARG_WITH(default-path,
3109 [ --with-default-path= Specify default \$PATH environment for server],
3111 if test "x$external_path_file" = "x/etc/login.conf" ; then
3113 --with-default-path=PATH has no effect on this system.
3114 Edit /etc/login.conf instead.])
3115 elif test "x$withval" != "xno" ; then
3116 if test ! -z "$external_path_file" ; then
3118 --with-default-path=PATH will only be used if PATH is not defined in
3119 $external_path_file .])
3121 user_path="$withval"
3122 SERVER_PATH_MSG="$withval"
3125 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3126 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3128 if test ! -z "$external_path_file" ; then
3130 If PATH is defined in $external_path_file, ensure the path to scp is included,
3131 otherwise scp will not work.])
3135 /* find out what STDPATH is */
3140 #ifndef _PATH_STDPATH
3141 # ifdef _PATH_USERPATH /* Irix */
3142 # define _PATH_STDPATH _PATH_USERPATH
3144 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3147 #include <sys/types.h>
3148 #include <sys/stat.h>
3150 #define DATA "conftest.stdpath"
3157 fd = fopen(DATA,"w");
3161 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3166 ], [ user_path=`cat conftest.stdpath` ],
3167 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3168 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3170 # make sure $bindir is in USER_PATH so scp will work
3171 t_bindir=`eval echo ${bindir}`
3173 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3176 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3178 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3179 if test $? -ne 0 ; then
3180 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3181 if test $? -ne 0 ; then
3182 user_path=$user_path:$t_bindir
3183 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3188 if test "x$external_path_file" != "x/etc/login.conf" ; then
3189 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
3193 # Set superuser path separately to user path
3194 AC_ARG_WITH(superuser-path,
3195 [ --with-superuser-path= Specify different path for super-user],
3197 if test -n "$withval" && test "x$withval" != "xno" && \
3198 test "x${withval}" != "xyes"; then
3199 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3200 [Define if you want a different $PATH
3202 superuser_path=$withval
3208 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3209 IPV4_IN6_HACK_MSG="no"
3211 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3213 if test "x$withval" != "xno" ; then
3215 AC_DEFINE(IPV4_IN_IPV6, 1,
3216 [Detect IPv4 in IPv6 mapped addresses
3218 IPV4_IN6_HACK_MSG="yes"
3223 if test "x$inet6_default_4in6" = "xyes"; then
3224 AC_MSG_RESULT([yes (default)])
3225 AC_DEFINE(IPV4_IN_IPV6)
3226 IPV4_IN6_HACK_MSG="yes"
3228 AC_MSG_RESULT([no (default)])
3233 # Whether to enable BSD auth support
3235 AC_ARG_WITH(bsd-auth,
3236 [ --with-bsd-auth Enable BSD auth support],
3238 if test "x$withval" != "xno" ; then
3239 AC_DEFINE(BSD_AUTH, 1,
3240 [Define if you have BSD auth support])
3246 # Where to place sshd.pid
3248 # make sure the directory exists
3249 if test ! -d $piddir ; then
3250 piddir=`eval echo ${sysconfdir}`
3252 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3256 AC_ARG_WITH(pid-dir,
3257 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3259 if test -n "$withval" && test "x$withval" != "xno" && \
3260 test "x${withval}" != "xyes"; then
3262 if test ! -d $piddir ; then
3263 AC_MSG_WARN([** no $piddir directory on this system **])
3269 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
3272 dnl allow user to disable some login recording features
3273 AC_ARG_ENABLE(lastlog,
3274 [ --disable-lastlog disable use of lastlog even if detected [no]],
3276 if test "x$enableval" = "xno" ; then
3277 AC_DEFINE(DISABLE_LASTLOG)
3282 [ --disable-utmp disable use of utmp even if detected [no]],
3284 if test "x$enableval" = "xno" ; then
3285 AC_DEFINE(DISABLE_UTMP)
3289 AC_ARG_ENABLE(utmpx,
3290 [ --disable-utmpx disable use of utmpx even if detected [no]],
3292 if test "x$enableval" = "xno" ; then
3293 AC_DEFINE(DISABLE_UTMPX, 1,
3294 [Define if you don't want to use utmpx])
3299 [ --disable-wtmp disable use of wtmp even if detected [no]],
3301 if test "x$enableval" = "xno" ; then
3302 AC_DEFINE(DISABLE_WTMP)
3306 AC_ARG_ENABLE(wtmpx,
3307 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
3309 if test "x$enableval" = "xno" ; then
3310 AC_DEFINE(DISABLE_WTMPX, 1,
3311 [Define if you don't want to use wtmpx])
3315 AC_ARG_ENABLE(libutil,
3316 [ --disable-libutil disable use of libutil (login() etc.) [no]],
3318 if test "x$enableval" = "xno" ; then
3319 AC_DEFINE(DISABLE_LOGIN)
3323 AC_ARG_ENABLE(pututline,
3324 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
3326 if test "x$enableval" = "xno" ; then
3327 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3328 [Define if you don't want to use pututline()
3329 etc. to write [uw]tmp])
3333 AC_ARG_ENABLE(pututxline,
3334 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
3336 if test "x$enableval" = "xno" ; then
3337 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3338 [Define if you don't want to use pututxline()
3339 etc. to write [uw]tmpx])
3343 AC_ARG_WITH(lastlog,
3344 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
3346 if test "x$withval" = "xno" ; then
3347 AC_DEFINE(DISABLE_LASTLOG)
3348 elif test -n "$withval" && test "x${withval}" != "xyes"; then
3349 conf_lastlog_location=$withval
3354 dnl lastlog, [uw]tmpx? detection
3355 dnl NOTE: set the paths in the platform section to avoid the
3356 dnl need for command-line parameters
3357 dnl lastlog and [uw]tmp are subject to a file search if all else fails
3359 dnl lastlog detection
3360 dnl NOTE: the code itself will detect if lastlog is a directory
3361 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3363 #include <sys/types.h>
3365 #ifdef HAVE_LASTLOG_H
3366 # include <lastlog.h>
3375 [ char *lastlog = LASTLOG_FILE; ],
3376 [ AC_MSG_RESULT(yes) ],
3379 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3381 #include <sys/types.h>
3383 #ifdef HAVE_LASTLOG_H
3384 # include <lastlog.h>
3390 [ char *lastlog = _PATH_LASTLOG; ],
3391 [ AC_MSG_RESULT(yes) ],
3394 system_lastlog_path=no
3399 if test -z "$conf_lastlog_location"; then
3400 if test x"$system_lastlog_path" = x"no" ; then
3401 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3402 if (test -d "$f" || test -f "$f") ; then
3403 conf_lastlog_location=$f
3406 if test -z "$conf_lastlog_location"; then
3407 AC_MSG_WARN([** Cannot find lastlog **])
3408 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
3413 if test -n "$conf_lastlog_location"; then
3414 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3415 [Define if you want to specify the path to your lastlog file])
3419 AC_MSG_CHECKING([if your system defines UTMP_FILE])
3421 #include <sys/types.h>
3427 [ char *utmp = UTMP_FILE; ],
3428 [ AC_MSG_RESULT(yes) ],
3430 system_utmp_path=no ]
3432 if test -z "$conf_utmp_location"; then
3433 if test x"$system_utmp_path" = x"no" ; then
3434 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3435 if test -f $f ; then
3436 conf_utmp_location=$f
3439 if test -z "$conf_utmp_location"; then
3440 AC_DEFINE(DISABLE_UTMP)
3444 if test -n "$conf_utmp_location"; then
3445 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3446 [Define if you want to specify the path to your utmp file])
3450 AC_MSG_CHECKING([if your system defines WTMP_FILE])
3452 #include <sys/types.h>
3458 [ char *wtmp = WTMP_FILE; ],
3459 [ AC_MSG_RESULT(yes) ],
3461 system_wtmp_path=no ]
3463 if test -z "$conf_wtmp_location"; then
3464 if test x"$system_wtmp_path" = x"no" ; then
3465 for f in /usr/adm/wtmp /var/log/wtmp; do
3466 if test -f $f ; then
3467 conf_wtmp_location=$f
3470 if test -z "$conf_wtmp_location"; then
3471 AC_DEFINE(DISABLE_WTMP)
3475 if test -n "$conf_wtmp_location"; then
3476 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3477 [Define if you want to specify the path to your wtmp file])
3481 dnl utmpx detection - I don't know any system so perverse as to require
3482 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3484 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3486 #include <sys/types.h>
3495 [ char *utmpx = UTMPX_FILE; ],
3496 [ AC_MSG_RESULT(yes) ],
3498 system_utmpx_path=no ]
3500 if test -z "$conf_utmpx_location"; then
3501 if test x"$system_utmpx_path" = x"no" ; then
3502 AC_DEFINE(DISABLE_UTMPX)
3505 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3506 [Define if you want to specify the path to your utmpx file])
3510 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3512 #include <sys/types.h>
3521 [ char *wtmpx = WTMPX_FILE; ],
3522 [ AC_MSG_RESULT(yes) ],
3524 system_wtmpx_path=no ]
3526 if test -z "$conf_wtmpx_location"; then
3527 if test x"$system_wtmpx_path" = x"no" ; then
3528 AC_DEFINE(DISABLE_WTMPX)
3531 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3532 [Define if you want to specify the path to your wtmpx file])
3536 if test ! -z "$blibpath" ; then
3537 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3538 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3541 dnl remove pam and dl because they are in $LIBPAM
3542 if test "$PAM_MSG" = yes ; then
3543 LIBS=`echo $LIBS | sed 's/-lpam //'`
3545 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3546 LIBS=`echo $LIBS | sed 's/-ldl //'`
3549 dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3551 CFLAGS="$CFLAGS $werror_flags"
3554 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3555 scard/Makefile ssh_prng_cmds survey.sh])
3558 # Print summary of options
3560 # Someone please show me a better way :)
3561 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3562 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3563 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3564 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3565 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3566 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3567 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
3568 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3569 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3570 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3573 echo "OpenSSH has been configured with the following options:"
3574 echo " User binaries: $B"
3575 echo " System binaries: $C"
3576 echo " Configuration files: $D"
3577 echo " Askpass program: $E"
3578 echo " Manual pages: $F"
3579 echo " PID file: $G"
3580 echo " Privilege separation chroot path: $H"
3581 if test "x$external_path_file" = "x/etc/login.conf" ; then
3582 echo " At runtime, sshd will use the path defined in $external_path_file"
3583 echo " Make sure the path to scp is present, otherwise scp will not work"
3585 echo " sshd default user PATH: $I"
3586 if test ! -z "$external_path_file"; then
3587 echo " (If PATH is set in $external_path_file it will be used instead. If"
3588 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3591 if test ! -z "$superuser_path" ; then
3592 echo " sshd superuser user PATH: $J"
3594 echo " Manpage format: $MANTYPE"
3595 echo " PAM support: $PAM_MSG"
3596 echo " KerberosV support: $KRB5_MSG"
3597 echo " Smartcard support: $SCARD_MSG"
3598 echo " S/KEY support: $SKEY_MSG"
3599 echo " TCP Wrappers support: $TCPW_MSG"
3600 echo " MD5 password support: $MD5_MSG"
3601 echo " libedit support: $LIBEDIT_MSG"
3602 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
3603 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3604 echo " BSD Auth support: $BSD_AUTH_MSG"
3605 echo " Random number source: $RAND_MSG"
3606 if test ! -z "$USE_RAND_HELPER" ; then
3607 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
3612 echo " Host: ${host}"
3613 echo " Compiler: ${CC}"
3614 echo " Compiler flags: ${CFLAGS}"
3615 echo "Preprocessor flags: ${CPPFLAGS}"
3616 echo " Linker flags: ${LDFLAGS}"
3617 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
3621 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
3622 echo "SVR4 style packages are supported with \"make package\""
3626 if test "x$PAM_MSG" = "xyes" ; then
3627 echo "PAM is enabled. You may need to install a PAM control file "
3628 echo "for sshd, otherwise password authentication may fail. "
3629 echo "Example PAM control files can be found in the contrib/ "
3634 if test ! -z "$RAND_HELPER_CMDHASH" ; then
3635 echo "WARNING: you are using the builtin random number collection "
3636 echo "service. Please read WARNING.RNG and request that your OS "
3637 echo "vendor includes kernel-based random number collection in "
3638 echo "future versions of your OS."
3642 if test ! -z "$NO_PEERCHECK" ; then
3643 echo "WARNING: the operating system that you are using does not "
3644 echo "appear to support either the getpeereid() API nor the "
3645 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3646 echo "enforce security checks to prevent unauthorised connections to "
3647 echo "ssh-agent. Their absence increases the risk that a malicious "
3648 echo "user can connect to your agent. "
3652 if test "$AUDIT_MODULE" = "bsm" ; then
3653 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3654 echo "See the Solaris section in README.platform for details."