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
403 AC_DEFINE(SETEUID_BREAKS_SETUID)
404 AC_DEFINE(BROKEN_SETREUID)
405 AC_DEFINE(BROKEN_SETREGID)
408 conf_lastlog_location="/usr/adm/lastlog"
409 conf_utmp_location=/etc/utmp
410 conf_wtmp_location=/usr/adm/wtmp
412 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
413 AC_DEFINE(BROKEN_REALPATH)
415 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
418 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
421 if test "x$withval" != "xno" ; then
424 AC_DEFINE(PAM_SUN_CODEBASE)
425 AC_DEFINE(LOGIN_NEEDS_UTMPX)
426 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
427 [Some versions of /bin/login need the TERM supplied
429 AC_DEFINE(PAM_TTY_KLUDGE)
430 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
431 [Define if pam_chauthtok wants real uid set
432 to the unpriv'ed user])
433 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
434 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
435 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
436 [Define if sshd somehow reacquires a controlling TTY
438 external_path_file=/etc/default/login
439 # hardwire lastlog location (can't detect it on some versions)
440 conf_lastlog_location="/var/adm/lastlog"
441 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
442 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
443 if test "$sol2ver" -ge 8; then
445 AC_DEFINE(DISABLE_UTMP)
446 AC_DEFINE(DISABLE_WTMP, 1,
447 [Define if you don't want to use wtmp])
453 CPPFLAGS="$CPPFLAGS -DSUNOS4"
454 AC_CHECK_FUNCS(getpwanam)
455 AC_DEFINE(PAM_SUN_CODEBASE)
456 conf_utmp_location=/etc/utmp
457 conf_wtmp_location=/var/adm/wtmp
458 conf_lastlog_location=/var/adm/lastlog
464 AC_DEFINE(SSHD_ACQUIRES_CTTY)
465 AC_DEFINE(SETEUID_BREAKS_SETUID)
466 AC_DEFINE(BROKEN_SETREUID)
467 AC_DEFINE(BROKEN_SETREGID)
470 # /usr/ucblib MUST NOT be searched on ReliantUNIX
471 AC_CHECK_LIB(dl, dlsym, ,)
472 # -lresolv needs to be at then end of LIBS or DNS lookups break
473 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
474 IPADDR_IN_DISPLAY=yes
476 AC_DEFINE(IP_TOS_IS_BROKEN)
477 AC_DEFINE(SETEUID_BREAKS_SETUID)
478 AC_DEFINE(BROKEN_SETREUID)
479 AC_DEFINE(BROKEN_SETREGID)
480 AC_DEFINE(SSHD_ACQUIRES_CTTY)
481 external_path_file=/etc/default/login
482 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
483 # Attention: always take care to bind libsocket and libnsl before libc,
484 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
486 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
489 AC_DEFINE(SETEUID_BREAKS_SETUID)
490 AC_DEFINE(BROKEN_SETREUID)
491 AC_DEFINE(BROKEN_SETREGID)
492 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
494 # UnixWare 7.x, OpenUNIX 8
496 check_for_libcrypt_later=1
497 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
499 AC_DEFINE(SETEUID_BREAKS_SETUID)
500 AC_DEFINE(BROKEN_SETREUID)
501 AC_DEFINE(BROKEN_SETREGID)
502 AC_DEFINE(PASSWD_NEEDS_USERNAME)
504 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
505 TEST_SHELL=/u95/bin/sh
506 AC_DEFINE(BROKEN_LIBIAF, 1,
507 [ia_uinfo routines not supported by OS yet])
513 # SCO UNIX and OEM versions of SCO UNIX
515 AC_MSG_ERROR("This Platform is no longer supported.")
519 if test -z "$GCC"; then
520 CFLAGS="$CFLAGS -belf"
522 LIBS="$LIBS -lprot -lx -ltinfo -lm"
525 AC_DEFINE(HAVE_SECUREWARE)
526 AC_DEFINE(DISABLE_SHADOW)
527 AC_DEFINE(DISABLE_FD_PASSING)
528 AC_DEFINE(SETEUID_BREAKS_SETUID)
529 AC_DEFINE(BROKEN_SETREUID)
530 AC_DEFINE(BROKEN_SETREGID)
531 AC_DEFINE(WITH_ABBREV_NO_TTY)
532 AC_DEFINE(BROKEN_UPDWTMPX)
533 AC_DEFINE(PASSWD_NEEDS_USERNAME)
534 AC_CHECK_FUNCS(getluid setluid)
539 AC_DEFINE(NO_SSH_LASTLOG, 1,
540 [Define if you don't want to use lastlog in session.c])
541 AC_DEFINE(SETEUID_BREAKS_SETUID)
542 AC_DEFINE(BROKEN_SETREUID)
543 AC_DEFINE(BROKEN_SETREGID)
545 AC_DEFINE(DISABLE_FD_PASSING)
547 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
551 AC_DEFINE(SETEUID_BREAKS_SETUID)
552 AC_DEFINE(BROKEN_SETREUID)
553 AC_DEFINE(BROKEN_SETREGID)
554 AC_DEFINE(WITH_ABBREV_NO_TTY)
556 AC_DEFINE(DISABLE_FD_PASSING)
558 LIBS="$LIBS -lgen -lacid -ldb"
562 AC_DEFINE(SETEUID_BREAKS_SETUID)
563 AC_DEFINE(BROKEN_SETREUID)
564 AC_DEFINE(BROKEN_SETREGID)
566 AC_DEFINE(DISABLE_FD_PASSING)
567 AC_DEFINE(NO_SSH_LASTLOG)
568 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
569 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
573 AC_MSG_CHECKING(for Digital Unix SIA)
576 [ --with-osfsia Enable Digital Unix SIA],
578 if test "x$withval" = "xno" ; then
579 AC_MSG_RESULT(disabled)
584 if test -z "$no_osfsia" ; then
585 if test -f /etc/sia/matrix.conf; then
587 AC_DEFINE(HAVE_OSF_SIA, 1,
588 [Define if you have Digital Unix Security
589 Integration Architecture])
590 AC_DEFINE(DISABLE_LOGIN, 1,
591 [Define if you don't want to use your
592 system's login() call])
593 AC_DEFINE(DISABLE_FD_PASSING)
594 LIBS="$LIBS -lsecurity -ldb -lm -laud"
597 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
598 [String used in /etc/passwd to denote locked account])
601 AC_DEFINE(BROKEN_GETADDRINFO)
602 AC_DEFINE(SETEUID_BREAKS_SETUID)
603 AC_DEFINE(BROKEN_SETREUID)
604 AC_DEFINE(BROKEN_SETREGID)
609 AC_DEFINE(NO_X11_UNIX_SOCKETS)
610 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
611 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
612 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
616 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
617 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
618 AC_DEFINE(NEED_SETPRGP)
619 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
623 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
624 AC_DEFINE(MISSING_HOWMANY)
625 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
629 # Allow user to specify flags
631 [ --with-cflags Specify additional flags to pass to compiler],
633 if test -n "$withval" && test "x$withval" != "xno" && \
634 test "x${withval}" != "xyes"; then
635 CFLAGS="$CFLAGS $withval"
639 AC_ARG_WITH(cppflags,
640 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
642 if test -n "$withval" && test "x$withval" != "xno" && \
643 test "x${withval}" != "xyes"; then
644 CPPFLAGS="$CPPFLAGS $withval"
649 [ --with-ldflags Specify additional flags to pass to linker],
651 if test -n "$withval" && test "x$withval" != "xno" && \
652 test "x${withval}" != "xyes"; then
653 LDFLAGS="$LDFLAGS $withval"
658 [ --with-libs Specify additional libraries to link with],
660 if test -n "$withval" && test "x$withval" != "xno" && \
661 test "x${withval}" != "xyes"; then
662 LIBS="$LIBS $withval"
667 [ --with-Werror Build main code with -Werror],
669 if test -n "$withval" && test "x$withval" != "xno"; then
670 werror_flags="-Werror"
671 if "x${withval}" != "xyes"; then
672 werror_flags="$withval"
678 AC_MSG_CHECKING(compiler and flags for sanity)
684 [ AC_MSG_RESULT(yes) ],
687 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
689 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
692 dnl Checks for header files.
718 security/pam_appl.h \
754 # sys/ptms.h requires sys/stream.h to be included first on Solaris
755 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
756 #ifdef HAVE_SYS_STREAM_H
757 # include <sys/stream.h>
761 # Checks for libraries.
762 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
763 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
765 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
766 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
767 AC_CHECK_LIB(gen, dirname,[
768 AC_CACHE_CHECK([for broken dirname],
769 ac_cv_have_broken_dirname, [
777 int main(int argc, char **argv) {
780 strncpy(buf,"/etc", 32);
782 if (!s || strncmp(s, "/", 32) != 0) {
789 [ ac_cv_have_broken_dirname="no" ],
790 [ ac_cv_have_broken_dirname="yes" ]
794 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
796 AC_DEFINE(HAVE_DIRNAME)
797 AC_CHECK_HEADERS(libgen.h)
802 AC_CHECK_FUNC(getspnam, ,
803 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
804 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
805 [Define if you have the basename function.]))
809 [ --with-zlib=PATH Use zlib in PATH],
810 [ if test "x$withval" = "xno" ; then
811 AC_MSG_ERROR([*** zlib is required ***])
812 elif test "x$withval" != "xyes"; then
813 if test -d "$withval/lib"; then
814 if test -n "${need_dash_r}"; then
815 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
817 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
820 if test -n "${need_dash_r}"; then
821 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
823 LDFLAGS="-L${withval} ${LDFLAGS}"
826 if test -d "$withval/include"; then
827 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
829 CPPFLAGS="-I${withval} ${CPPFLAGS}"
834 AC_CHECK_LIB(z, deflate, ,
836 saved_CPPFLAGS="$CPPFLAGS"
837 saved_LDFLAGS="$LDFLAGS"
839 dnl Check default zlib install dir
840 if test -n "${need_dash_r}"; then
841 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
843 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
845 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
847 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
849 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
854 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
856 AC_ARG_WITH(zlib-version-check,
857 [ --without-zlib-version-check Disable zlib version check],
858 [ if test "x$withval" = "xno" ; then
859 zlib_check_nonfatal=1
864 AC_MSG_CHECKING(for possibly buggy zlib)
865 AC_RUN_IFELSE([AC_LANG_SOURCE([[
870 int a=0, b=0, c=0, d=0, n, v;
871 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
872 if (n != 3 && n != 4)
874 v = a*1000000 + b*10000 + c*100 + d;
875 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
878 if (a == 1 && b == 1 && c >= 4)
881 /* 1.2.3 and up are OK */
890 if test -z "$zlib_check_nonfatal" ; then
891 AC_MSG_ERROR([*** zlib too old - check config.log ***
892 Your reported zlib version has known security problems. It's possible your
893 vendor has fixed these problems without changing the version number. If you
894 are sure this is the case, you can disable the check by running
895 "./configure --without-zlib-version-check".
896 If you are in doubt, upgrade zlib to version 1.2.3 or greater.
897 See http://www.gzip.org/zlib/ for details.])
899 AC_MSG_WARN([zlib version may have security problems])
902 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
906 AC_CHECK_FUNC(strcasecmp,
907 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
909 AC_CHECK_FUNC(utimes,
910 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
911 LIBS="$LIBS -lc89"]) ]
914 dnl Checks for libutil functions
915 AC_CHECK_HEADERS(libutil.h)
916 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
917 [Define if your libraries define login()])])
918 AC_CHECK_FUNCS(logout updwtmp logwtmp)
922 # Check for ALTDIRFUNC glob() extension
923 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
924 AC_EGREP_CPP(FOUNDIT,
927 #ifdef GLOB_ALTDIRFUNC
932 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
933 [Define if your system glob() function has
934 the GLOB_ALTDIRFUNC extension])
942 # Check for g.gl_matchc glob() extension
943 AC_MSG_CHECKING(for gl_matchc field in glob_t)
944 AC_EGREP_CPP(FOUNDIT,
947 int main(void){glob_t g; g.gl_matchc = 1;}
950 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
951 [Define if your system glob() function has
952 gl_matchc options in glob_t])
960 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
963 #include <sys/types.h>
965 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
967 [AC_MSG_RESULT(yes)],
970 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
971 [Define in your struct dirent expects you to
972 allocate extra space for d_name])
975 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
976 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
980 AC_MSG_CHECKING([for /proc/pid/fd directory])
981 if test -d "/proc/$$/fd" ; then
982 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
988 # Check whether user wants S/Key support
991 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
993 if test "x$withval" != "xno" ; then
995 if test "x$withval" != "xyes" ; then
996 CPPFLAGS="$CPPFLAGS -I${withval}/include"
997 LDFLAGS="$LDFLAGS -L${withval}/lib"
1000 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
1004 AC_MSG_CHECKING([for s/key support])
1009 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
1011 [AC_MSG_RESULT(yes)],
1014 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1016 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1020 [(void)skeychallenge(NULL,"name","",0);],
1022 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1023 [Define if your skeychallenge()
1024 function takes 4 arguments (NetBSD)])],
1031 # Check whether user wants TCP wrappers support
1033 AC_ARG_WITH(tcp-wrappers,
1034 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
1036 if test "x$withval" != "xno" ; then
1038 saved_LDFLAGS="$LDFLAGS"
1039 saved_CPPFLAGS="$CPPFLAGS"
1040 if test -n "${withval}" && \
1041 test "x${withval}" != "xyes"; then
1042 if test -d "${withval}/lib"; then
1043 if test -n "${need_dash_r}"; then
1044 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1046 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1049 if test -n "${need_dash_r}"; then
1050 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1052 LDFLAGS="-L${withval} ${LDFLAGS}"
1055 if test -d "${withval}/include"; then
1056 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1058 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1062 LIBS="$LIBWRAP $LIBS"
1063 AC_MSG_CHECKING(for libwrap)
1066 #include <sys/types.h>
1067 #include <sys/socket.h>
1068 #include <netinet/in.h>
1070 int deny_severity = 0, allow_severity = 0;
1075 AC_DEFINE(LIBWRAP, 1,
1077 TCP Wrappers support])
1082 AC_MSG_ERROR([*** libwrap missing])
1090 # Check whether user wants libedit support
1092 AC_ARG_WITH(libedit,
1093 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1094 [ if test "x$withval" != "xno" ; then
1095 if test "x$withval" != "xyes"; then
1096 CPPFLAGS="$CPPFLAGS -I$withval/include"
1097 LDFLAGS="$LDFLAGS -L$withval/lib"
1099 AC_CHECK_LIB(edit, el_init,
1100 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
1101 LIBEDIT="-ledit -lcurses"
1105 [ AC_MSG_ERROR(libedit not found) ],
1108 AC_MSG_CHECKING(if libedit version is compatible)
1111 #include <histedit.h>
1115 el_init("", NULL, NULL, NULL);
1119 [ AC_MSG_RESULT(yes) ],
1121 AC_MSG_ERROR(libedit version is not compatible) ]
1128 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1130 AC_MSG_CHECKING(for supported audit module)
1135 dnl Checks for headers, libs and functions
1136 AC_CHECK_HEADERS(bsm/audit.h, [],
1137 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1138 AC_CHECK_LIB(bsm, getaudit, [],
1139 [AC_MSG_ERROR(BSM enabled and required library not found)])
1140 AC_CHECK_FUNCS(getaudit, [],
1141 [AC_MSG_ERROR(BSM enabled and required function not found)])
1142 # These are optional
1143 AC_CHECK_FUNCS(getaudit_addr)
1144 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
1148 AC_MSG_RESULT(debug)
1149 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
1155 AC_MSG_ERROR([Unknown audit module $withval])
1160 dnl Checks for library functions. Please keep in alphabetical order
1244 # IRIX has a const char return value for gai_strerror()
1245 AC_CHECK_FUNCS(gai_strerror,[
1246 AC_DEFINE(HAVE_GAI_STRERROR)
1248 #include <sys/types.h>
1249 #include <sys/socket.h>
1252 const char *gai_strerror(int);],[
1255 str = gai_strerror(0);],[
1256 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1257 [Define if gai_strerror() returns const char *])])])
1259 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1260 [Some systems put nanosleep outside of libc]))
1262 dnl Make sure prototypes are defined for these before using them.
1263 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1264 AC_CHECK_DECL(strsep,
1265 [AC_CHECK_FUNCS(strsep)],
1268 #ifdef HAVE_STRING_H
1269 # include <string.h>
1273 dnl tcsendbreak might be a macro
1274 AC_CHECK_DECL(tcsendbreak,
1275 [AC_DEFINE(HAVE_TCSENDBREAK)],
1276 [AC_CHECK_FUNCS(tcsendbreak)],
1277 [#include <termios.h>]
1280 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1282 AC_CHECK_FUNCS(setresuid, [
1283 dnl Some platorms have setresuid that isn't implemented, test for this
1284 AC_MSG_CHECKING(if setresuid seems to work)
1289 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1291 [AC_MSG_RESULT(yes)],
1292 [AC_DEFINE(BROKEN_SETRESUID, 1,
1293 [Define if your setresuid() is broken])
1294 AC_MSG_RESULT(not implemented)],
1295 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1299 AC_CHECK_FUNCS(setresgid, [
1300 dnl Some platorms have setresgid that isn't implemented, test for this
1301 AC_MSG_CHECKING(if setresgid seems to work)
1306 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1308 [AC_MSG_RESULT(yes)],
1309 [AC_DEFINE(BROKEN_SETRESGID, 1,
1310 [Define if your setresgid() is broken])
1311 AC_MSG_RESULT(not implemented)],
1312 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1316 dnl Checks for time functions
1317 AC_CHECK_FUNCS(gettimeofday time)
1318 dnl Checks for utmp functions
1319 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1320 AC_CHECK_FUNCS(utmpname)
1321 dnl Checks for utmpx functions
1322 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1323 AC_CHECK_FUNCS(setutxent utmpxname)
1325 AC_CHECK_FUNC(daemon,
1326 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1327 [AC_CHECK_LIB(bsd, daemon,
1328 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1331 AC_CHECK_FUNC(getpagesize,
1332 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1333 [Define if your libraries define getpagesize()])],
1334 [AC_CHECK_LIB(ucb, getpagesize,
1335 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1338 # Check for broken snprintf
1339 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1340 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1344 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1346 [AC_MSG_RESULT(yes)],
1349 AC_DEFINE(BROKEN_SNPRINTF, 1,
1350 [Define if your snprintf is busted])
1351 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1353 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1357 # Check for missing getpeereid (or equiv) support
1359 if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1360 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1362 [#include <sys/types.h>
1363 #include <sys/socket.h>],
1364 [int i = SO_PEERCRED;],
1365 [ AC_MSG_RESULT(yes)
1366 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
1373 dnl see whether mkstemp() requires XXXXXX
1374 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1375 AC_MSG_CHECKING([for (overly) strict mkstemp])
1379 main() { char template[]="conftest.mkstemp-test";
1380 if (mkstemp(template) == -1)
1382 unlink(template); exit(0);
1390 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
1394 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1399 dnl make sure that openpty does not reacquire controlling terminal
1400 if test ! -z "$check_for_openpty_ctty_bug"; then
1401 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1405 #include <sys/fcntl.h>
1406 #include <sys/types.h>
1407 #include <sys/wait.h>
1413 int fd, ptyfd, ttyfd, status;
1416 if (pid < 0) { /* failed */
1418 } else if (pid > 0) { /* parent */
1419 waitpid(pid, &status, 0);
1420 if (WIFEXITED(status))
1421 exit(WEXITSTATUS(status));
1424 } else { /* child */
1425 close(0); close(1); close(2);
1427 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1428 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1430 exit(3); /* Acquired ctty: broken */
1432 exit(0); /* Did not acquire ctty: OK */
1441 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1446 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1447 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1448 AC_MSG_CHECKING(if getaddrinfo seems to work)
1452 #include <sys/socket.h>
1455 #include <netinet/in.h>
1457 #define TEST_PORT "2222"
1463 struct addrinfo *gai_ai, *ai, hints;
1464 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1466 memset(&hints, 0, sizeof(hints));
1467 hints.ai_family = PF_UNSPEC;
1468 hints.ai_socktype = SOCK_STREAM;
1469 hints.ai_flags = AI_PASSIVE;
1471 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1473 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1477 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1478 if (ai->ai_family != AF_INET6)
1481 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1482 sizeof(ntop), strport, sizeof(strport),
1483 NI_NUMERICHOST|NI_NUMERICSERV);
1486 if (err == EAI_SYSTEM)
1487 perror("getnameinfo EAI_SYSTEM");
1489 fprintf(stderr, "getnameinfo failed: %s\n",
1494 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1497 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1510 AC_DEFINE(BROKEN_GETADDRINFO)
1515 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1516 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1517 AC_MSG_CHECKING(if getaddrinfo seems to work)
1521 #include <sys/socket.h>
1524 #include <netinet/in.h>
1526 #define TEST_PORT "2222"
1532 struct addrinfo *gai_ai, *ai, hints;
1533 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1535 memset(&hints, 0, sizeof(hints));
1536 hints.ai_family = PF_UNSPEC;
1537 hints.ai_socktype = SOCK_STREAM;
1538 hints.ai_flags = AI_PASSIVE;
1540 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1542 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1546 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1547 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1550 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1551 sizeof(ntop), strport, sizeof(strport),
1552 NI_NUMERICHOST|NI_NUMERICSERV);
1554 if (ai->ai_family == AF_INET && err != 0) {
1555 perror("getnameinfo");
1564 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1565 [Define if you have a getaddrinfo that fails
1566 for the all-zeros IPv6 address])
1570 AC_DEFINE(BROKEN_GETADDRINFO)
1575 if test "x$check_for_conflicting_getspnam" = "x1"; then
1576 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1580 int main(void) {exit(0);}
1587 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1588 [Conflicting defs for getspnam])
1595 # Check for PAM libs
1598 [ --with-pam Enable PAM support ],
1600 if test "x$withval" != "xno" ; then
1601 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1602 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1603 AC_MSG_ERROR([PAM headers not found])
1606 AC_CHECK_LIB(dl, dlopen, , )
1607 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1608 AC_CHECK_FUNCS(pam_getenvlist)
1609 AC_CHECK_FUNCS(pam_putenv)
1613 AC_DEFINE(USE_PAM, 1,
1614 [Define if you want to enable PAM support])
1615 if test $ac_cv_lib_dl_dlopen = yes; then
1625 # Check for older PAM
1626 if test "x$PAM_MSG" = "xyes" ; then
1627 # Check PAM strerror arguments (old PAM)
1628 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1632 #if defined(HAVE_SECURITY_PAM_APPL_H)
1633 #include <security/pam_appl.h>
1634 #elif defined (HAVE_PAM_PAM_APPL_H)
1635 #include <pam/pam_appl.h>
1638 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1639 [AC_MSG_RESULT(no)],
1641 AC_DEFINE(HAVE_OLD_PAM, 1,
1642 [Define if you have an old version of PAM
1643 which takes only one argument to pam_strerror])
1645 PAM_MSG="yes (old library)"
1650 # Search for OpenSSL
1651 saved_CPPFLAGS="$CPPFLAGS"
1652 saved_LDFLAGS="$LDFLAGS"
1653 AC_ARG_WITH(ssl-dir,
1654 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1656 if test "x$withval" != "xno" ; then
1659 ./*|../*) withval="`pwd`/$withval"
1661 if test -d "$withval/lib"; then
1662 if test -n "${need_dash_r}"; then
1663 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1665 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1668 if test -n "${need_dash_r}"; then
1669 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1671 LDFLAGS="-L${withval} ${LDFLAGS}"
1674 if test -d "$withval/include"; then
1675 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1677 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1682 LIBS="-lcrypto $LIBS"
1683 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1684 [Define if your ssl headers are included
1685 with #include <openssl/header.h>]),
1687 dnl Check default openssl install dir
1688 if test -n "${need_dash_r}"; then
1689 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1691 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1693 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1694 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1696 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1702 # Determine OpenSSL header version
1703 AC_MSG_CHECKING([OpenSSL header version])
1708 #include <openssl/opensslv.h>
1709 #define DATA "conftest.sslincver"
1714 fd = fopen(DATA,"w");
1718 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1725 ssl_header_ver=`cat conftest.sslincver`
1726 AC_MSG_RESULT($ssl_header_ver)
1729 AC_MSG_RESULT(not found)
1730 AC_MSG_ERROR(OpenSSL version header not found.)
1733 AC_MSG_WARN([cross compiling: not checking])
1737 # Determine OpenSSL library version
1738 AC_MSG_CHECKING([OpenSSL library version])
1743 #include <openssl/opensslv.h>
1744 #include <openssl/crypto.h>
1745 #define DATA "conftest.ssllibver"
1750 fd = fopen(DATA,"w");
1754 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1761 ssl_library_ver=`cat conftest.ssllibver`
1762 AC_MSG_RESULT($ssl_library_ver)
1765 AC_MSG_RESULT(not found)
1766 AC_MSG_ERROR(OpenSSL library not found.)
1769 AC_MSG_WARN([cross compiling: not checking])
1773 # Sanity check OpenSSL headers
1774 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1778 #include <openssl/opensslv.h>
1779 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1786 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1787 Check config.log for details.
1788 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1791 AC_MSG_WARN([cross compiling: not checking])
1795 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1796 # because the system crypt() is more featureful.
1797 if test "x$check_for_libcrypt_before" = "x1"; then
1798 AC_CHECK_LIB(crypt, crypt)
1801 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1802 # version in OpenSSL.
1803 if test "x$check_for_libcrypt_later" = "x1"; then
1804 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1807 AC_CHECK_LIB(iaf, ia_openinfo)
1809 ### Configure cryptographic random number support
1811 # Check wheter OpenSSL seeds itself
1812 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1816 #include <openssl/rand.h>
1817 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1820 OPENSSL_SEEDS_ITSELF=yes
1825 # Default to use of the rand helper if OpenSSL doesn't
1830 AC_MSG_WARN([cross compiling: assuming yes])
1831 # This is safe, since all recent OpenSSL versions will
1832 # complain at runtime if not seeded correctly.
1833 OPENSSL_SEEDS_ITSELF=yes
1838 # Do we want to force the use of the rand helper?
1839 AC_ARG_WITH(rand-helper,
1840 [ --with-rand-helper Use subprocess to gather strong randomness ],
1842 if test "x$withval" = "xno" ; then
1843 # Force use of OpenSSL's internal RNG, even if
1844 # the previous test showed it to be unseeded.
1845 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1846 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1847 OPENSSL_SEEDS_ITSELF=yes
1856 # Which randomness source do we use?
1857 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
1859 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1860 [Define if you want OpenSSL's internally seeded PRNG only])
1861 RAND_MSG="OpenSSL internal ONLY"
1862 INSTALL_SSH_RAND_HELPER=""
1863 elif test ! -z "$USE_RAND_HELPER" ; then
1864 # install rand helper
1865 RAND_MSG="ssh-rand-helper"
1866 INSTALL_SSH_RAND_HELPER="yes"
1868 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1870 ### Configuration of ssh-rand-helper
1873 AC_ARG_WITH(prngd-port,
1874 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1883 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1886 if test ! -z "$withval" ; then
1887 PRNGD_PORT="$withval"
1888 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1889 [Port number of PRNGD/EGD random number socket])
1894 # PRNGD Unix domain socket
1895 AC_ARG_WITH(prngd-socket,
1896 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1900 withval="/var/run/egd-pool"
1908 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1912 if test ! -z "$withval" ; then
1913 if test ! -z "$PRNGD_PORT" ; then
1914 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1916 if test ! -r "$withval" ; then
1917 AC_MSG_WARN(Entropy socket is not readable)
1919 PRNGD_SOCKET="$withval"
1920 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1921 [Location of PRNGD/EGD random number socket])
1925 # Check for existing socket only if we don't have a random device already
1926 if test "$USE_RAND_HELPER" = yes ; then
1927 AC_MSG_CHECKING(for PRNGD/EGD socket)
1928 # Insert other locations here
1929 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1930 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1931 PRNGD_SOCKET="$sock"
1932 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1936 if test ! -z "$PRNGD_SOCKET" ; then
1937 AC_MSG_RESULT($PRNGD_SOCKET)
1939 AC_MSG_RESULT(not found)
1945 # Change default command timeout for hashing entropy source
1947 AC_ARG_WITH(entropy-timeout,
1948 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1950 if test -n "$withval" && test "x$withval" != "xno" && \
1951 test "x${withval}" != "xyes"; then
1952 entropy_timeout=$withval
1956 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
1957 [Builtin PRNG command timeout])
1959 SSH_PRIVSEP_USER=sshd
1960 AC_ARG_WITH(privsep-user,
1961 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1963 if test -n "$withval" && test "x$withval" != "xno" && \
1964 test "x${withval}" != "xyes"; then
1965 SSH_PRIVSEP_USER=$withval
1969 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
1970 [non-privileged user for privilege separation])
1971 AC_SUBST(SSH_PRIVSEP_USER)
1973 # We do this little dance with the search path to insure
1974 # that programs that we select for use by installed programs
1975 # (which may be run by the super-user) come from trusted
1976 # locations before they come from the user's private area.
1977 # This should help avoid accidentally configuring some
1978 # random version of a program in someone's personal bin.
1982 test -h /bin 2> /dev/null && PATH=/usr/bin
1983 test -d /sbin && PATH=$PATH:/sbin
1984 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1985 PATH=$PATH:/etc:$OPATH
1987 # These programs are used by the command hashing source to gather entropy
1988 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1989 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1990 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1991 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1992 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1993 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1994 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1995 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1996 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1997 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1998 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1999 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2000 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2001 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2002 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2003 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
2007 # Where does ssh-rand-helper get its randomness from?
2008 INSTALL_SSH_PRNG_CMDS=""
2009 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2010 if test ! -z "$PRNGD_PORT" ; then
2011 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2012 elif test ! -z "$PRNGD_SOCKET" ; then
2013 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2015 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2016 RAND_HELPER_CMDHASH=yes
2017 INSTALL_SSH_PRNG_CMDS="yes"
2020 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2023 # Cheap hack to ensure NEWS-OS libraries are arranged right.
2024 if test ! -z "$SONY" ; then
2025 LIBS="$LIBS -liberty";
2028 # Checks for data types
2029 AC_CHECK_SIZEOF(char, 1)
2030 AC_CHECK_SIZEOF(short int, 2)
2031 AC_CHECK_SIZEOF(int, 4)
2032 AC_CHECK_SIZEOF(long int, 4)
2033 AC_CHECK_SIZEOF(long long int, 8)
2035 # Sanity check long long for some platforms (AIX)
2036 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2037 ac_cv_sizeof_long_long_int=0
2040 # More checks for data types
2041 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2043 [ #include <sys/types.h> ],
2045 [ ac_cv_have_u_int="yes" ],
2046 [ ac_cv_have_u_int="no" ]
2049 if test "x$ac_cv_have_u_int" = "xyes" ; then
2050 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
2054 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2056 [ #include <sys/types.h> ],
2057 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2058 [ ac_cv_have_intxx_t="yes" ],
2059 [ ac_cv_have_intxx_t="no" ]
2062 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2063 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
2067 if (test -z "$have_intxx_t" && \
2068 test "x$ac_cv_header_stdint_h" = "xyes")
2070 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2072 [ #include <stdint.h> ],
2073 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2075 AC_DEFINE(HAVE_INTXX_T)
2078 [ AC_MSG_RESULT(no) ]
2082 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2085 #include <sys/types.h>
2086 #ifdef HAVE_STDINT_H
2087 # include <stdint.h>
2089 #include <sys/socket.h>
2090 #ifdef HAVE_SYS_BITYPES_H
2091 # include <sys/bitypes.h>
2094 [ int64_t a; a = 1;],
2095 [ ac_cv_have_int64_t="yes" ],
2096 [ ac_cv_have_int64_t="no" ]
2099 if test "x$ac_cv_have_int64_t" = "xyes" ; then
2100 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
2103 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2105 [ #include <sys/types.h> ],
2106 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2107 [ ac_cv_have_u_intxx_t="yes" ],
2108 [ ac_cv_have_u_intxx_t="no" ]
2111 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2112 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
2116 if test -z "$have_u_intxx_t" ; then
2117 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2119 [ #include <sys/socket.h> ],
2120 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2122 AC_DEFINE(HAVE_U_INTXX_T)
2125 [ AC_MSG_RESULT(no) ]
2129 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2131 [ #include <sys/types.h> ],
2132 [ u_int64_t a; a = 1;],
2133 [ ac_cv_have_u_int64_t="yes" ],
2134 [ ac_cv_have_u_int64_t="no" ]
2137 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2138 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
2142 if test -z "$have_u_int64_t" ; then
2143 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2145 [ #include <sys/bitypes.h> ],
2146 [ u_int64_t a; a = 1],
2148 AC_DEFINE(HAVE_U_INT64_T)
2151 [ AC_MSG_RESULT(no) ]
2155 if test -z "$have_u_intxx_t" ; then
2156 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2159 #include <sys/types.h>
2161 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2162 [ ac_cv_have_uintxx_t="yes" ],
2163 [ ac_cv_have_uintxx_t="no" ]
2166 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2167 AC_DEFINE(HAVE_UINTXX_T, 1,
2168 [define if you have uintxx_t data type])
2172 if test -z "$have_uintxx_t" ; then
2173 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2175 [ #include <stdint.h> ],
2176 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2178 AC_DEFINE(HAVE_UINTXX_T)
2181 [ AC_MSG_RESULT(no) ]
2185 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2186 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2188 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2191 #include <sys/bitypes.h>
2194 int8_t a; int16_t b; int32_t c;
2195 u_int8_t e; u_int16_t f; u_int32_t g;
2196 a = b = c = e = f = g = 1;
2199 AC_DEFINE(HAVE_U_INTXX_T)
2200 AC_DEFINE(HAVE_INTXX_T)
2208 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2211 #include <sys/types.h>
2213 [ u_char foo; foo = 125; ],
2214 [ ac_cv_have_u_char="yes" ],
2215 [ ac_cv_have_u_char="no" ]
2218 if test "x$ac_cv_have_u_char" = "xyes" ; then
2219 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
2224 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2226 AC_CHECK_TYPES(in_addr_t,,,
2227 [#include <sys/types.h>
2228 #include <netinet/in.h>])
2230 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2233 #include <sys/types.h>
2235 [ size_t foo; foo = 1235; ],
2236 [ ac_cv_have_size_t="yes" ],
2237 [ ac_cv_have_size_t="no" ]
2240 if test "x$ac_cv_have_size_t" = "xyes" ; then
2241 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
2244 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2247 #include <sys/types.h>
2249 [ ssize_t foo; foo = 1235; ],
2250 [ ac_cv_have_ssize_t="yes" ],
2251 [ ac_cv_have_ssize_t="no" ]
2254 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2255 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
2258 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2263 [ clock_t foo; foo = 1235; ],
2264 [ ac_cv_have_clock_t="yes" ],
2265 [ ac_cv_have_clock_t="no" ]
2268 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2269 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
2272 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2275 #include <sys/types.h>
2276 #include <sys/socket.h>
2278 [ sa_family_t foo; foo = 1235; ],
2279 [ ac_cv_have_sa_family_t="yes" ],
2282 #include <sys/types.h>
2283 #include <sys/socket.h>
2284 #include <netinet/in.h>
2286 [ sa_family_t foo; foo = 1235; ],
2287 [ ac_cv_have_sa_family_t="yes" ],
2289 [ ac_cv_have_sa_family_t="no" ]
2293 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2294 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2295 [define if you have sa_family_t data type])
2298 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2301 #include <sys/types.h>
2303 [ pid_t foo; foo = 1235; ],
2304 [ ac_cv_have_pid_t="yes" ],
2305 [ ac_cv_have_pid_t="no" ]
2308 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2309 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
2312 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2315 #include <sys/types.h>
2317 [ mode_t foo; foo = 1235; ],
2318 [ ac_cv_have_mode_t="yes" ],
2319 [ ac_cv_have_mode_t="no" ]
2322 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2323 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
2327 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2330 #include <sys/types.h>
2331 #include <sys/socket.h>
2333 [ struct sockaddr_storage s; ],
2334 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2335 [ ac_cv_have_struct_sockaddr_storage="no" ]
2338 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2339 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2340 [define if you have struct sockaddr_storage data type])
2343 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2346 #include <sys/types.h>
2347 #include <netinet/in.h>
2349 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2350 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2351 [ ac_cv_have_struct_sockaddr_in6="no" ]
2354 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2355 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2356 [define if you have struct sockaddr_in6 data type])
2359 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2362 #include <sys/types.h>
2363 #include <netinet/in.h>
2365 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2366 [ ac_cv_have_struct_in6_addr="yes" ],
2367 [ ac_cv_have_struct_in6_addr="no" ]
2370 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2371 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2372 [define if you have struct in6_addr data type])
2375 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2378 #include <sys/types.h>
2379 #include <sys/socket.h>
2382 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2383 [ ac_cv_have_struct_addrinfo="yes" ],
2384 [ ac_cv_have_struct_addrinfo="no" ]
2387 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2388 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2389 [define if you have struct addrinfo data type])
2392 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2394 [ #include <sys/time.h> ],
2395 [ struct timeval tv; tv.tv_sec = 1;],
2396 [ ac_cv_have_struct_timeval="yes" ],
2397 [ ac_cv_have_struct_timeval="no" ]
2400 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2401 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
2402 have_struct_timeval=1
2405 AC_CHECK_TYPES(struct timespec)
2407 # We need int64_t or else certian parts of the compile will fail.
2408 if test "x$ac_cv_have_int64_t" = "xno" && \
2409 test "x$ac_cv_sizeof_long_int" != "x8" && \
2410 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2411 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2412 echo "an alternative compiler (I.E., GCC) before continuing."
2416 dnl test snprintf (broken on SCO w/gcc)
2421 #ifdef HAVE_SNPRINTF
2425 char expected_out[50];
2427 #if (SIZEOF_LONG_INT == 8)
2428 long int num = 0x7fffffffffffffff;
2430 long long num = 0x7fffffffffffffffll;
2432 strcpy(expected_out, "9223372036854775807");
2433 snprintf(buf, mazsize, "%lld", num);
2434 if(strcmp(buf, expected_out) != 0)
2441 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2442 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2446 dnl Checks for structure members
2447 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2448 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2449 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2450 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2451 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2452 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2453 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2454 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2455 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2456 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2457 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2458 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2459 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2460 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2461 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2462 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2463 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2465 AC_CHECK_MEMBERS([struct stat.st_blksize])
2467 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2468 ac_cv_have_ss_family_in_struct_ss, [
2471 #include <sys/types.h>
2472 #include <sys/socket.h>
2474 [ struct sockaddr_storage s; s.ss_family = 1; ],
2475 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2476 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2479 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2480 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
2483 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2484 ac_cv_have___ss_family_in_struct_ss, [
2487 #include <sys/types.h>
2488 #include <sys/socket.h>
2490 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2491 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2492 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2495 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2496 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2497 [Fields in struct sockaddr_storage])
2500 AC_CACHE_CHECK([for pw_class field in struct passwd],
2501 ac_cv_have_pw_class_in_struct_passwd, [
2506 [ struct passwd p; p.pw_class = 0; ],
2507 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2508 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2511 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2512 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2513 [Define if your password has a pw_class field])
2516 AC_CACHE_CHECK([for pw_expire field in struct passwd],
2517 ac_cv_have_pw_expire_in_struct_passwd, [
2522 [ struct passwd p; p.pw_expire = 0; ],
2523 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2524 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2527 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2528 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2529 [Define if your password has a pw_expire field])
2532 AC_CACHE_CHECK([for pw_change field in struct passwd],
2533 ac_cv_have_pw_change_in_struct_passwd, [
2538 [ struct passwd p; p.pw_change = 0; ],
2539 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2540 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2543 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2544 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2545 [Define if your password has a pw_change field])
2548 dnl make sure we're using the real structure members and not defines
2549 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2550 ac_cv_have_accrights_in_msghdr, [
2553 #include <sys/types.h>
2554 #include <sys/socket.h>
2555 #include <sys/uio.h>
2557 #ifdef msg_accrights
2558 #error "msg_accrights is a macro"
2562 m.msg_accrights = 0;
2566 [ ac_cv_have_accrights_in_msghdr="yes" ],
2567 [ ac_cv_have_accrights_in_msghdr="no" ]
2570 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2571 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2572 [Define if your system uses access rights style
2573 file descriptor passing])
2576 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2577 ac_cv_have_control_in_msghdr, [
2580 #include <sys/types.h>
2581 #include <sys/socket.h>
2582 #include <sys/uio.h>
2585 #error "msg_control is a macro"
2593 [ ac_cv_have_control_in_msghdr="yes" ],
2594 [ ac_cv_have_control_in_msghdr="no" ]
2597 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2598 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2599 [Define if your system uses ancillary data style
2600 file descriptor passing])
2603 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2605 [ extern char *__progname; printf("%s", __progname); ],
2606 [ ac_cv_libc_defines___progname="yes" ],
2607 [ ac_cv_libc_defines___progname="no" ]
2610 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2611 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
2614 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2618 [ printf("%s", __FUNCTION__); ],
2619 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2620 [ ac_cv_cc_implements___FUNCTION__="no" ]
2623 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2624 AC_DEFINE(HAVE___FUNCTION__, 1,
2625 [Define if compiler implements __FUNCTION__])
2628 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2632 [ printf("%s", __func__); ],
2633 [ ac_cv_cc_implements___func__="yes" ],
2634 [ ac_cv_cc_implements___func__="no" ]
2637 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2638 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
2641 AC_CACHE_CHECK([whether getopt has optreset support],
2642 ac_cv_have_getopt_optreset, [
2647 [ extern int optreset; optreset = 0; ],
2648 [ ac_cv_have_getopt_optreset="yes" ],
2649 [ ac_cv_have_getopt_optreset="no" ]
2652 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2653 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2654 [Define if your getopt(3) defines and uses optreset])
2657 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2659 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2660 [ ac_cv_libc_defines_sys_errlist="yes" ],
2661 [ ac_cv_libc_defines_sys_errlist="no" ]
2664 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2665 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2666 [Define if your system defines sys_errlist[]])
2670 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2672 [ extern int sys_nerr; printf("%i", sys_nerr);],
2673 [ ac_cv_libc_defines_sys_nerr="yes" ],
2674 [ ac_cv_libc_defines_sys_nerr="no" ]
2677 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2678 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
2682 # Check whether user wants sectok support
2684 [ --with-sectok Enable smartcard support using libsectok],
2686 if test "x$withval" != "xno" ; then
2687 if test "x$withval" != "xyes" ; then
2688 CPPFLAGS="$CPPFLAGS -I${withval}"
2689 LDFLAGS="$LDFLAGS -L${withval}"
2690 if test ! -z "$need_dash_r" ; then
2691 LDFLAGS="$LDFLAGS -R${withval}"
2693 if test ! -z "$blibpath" ; then
2694 blibpath="$blibpath:${withval}"
2697 AC_CHECK_HEADERS(sectok.h)
2698 if test "$ac_cv_header_sectok_h" != yes; then
2699 AC_MSG_ERROR(Can't find sectok.h)
2701 AC_CHECK_LIB(sectok, sectok_open)
2702 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2703 AC_MSG_ERROR(Can't find libsectok)
2705 AC_DEFINE(SMARTCARD, 1,
2706 [Define if you want smartcard support])
2707 AC_DEFINE(USE_SECTOK, 1,
2708 [Define if you want smartcard support
2710 SCARD_MSG="yes, using sectok"
2715 # Check whether user wants OpenSC support
2718 [--with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2720 if test "x$withval" != "xno" ; then
2721 if test "x$withval" != "xyes" ; then
2722 OPENSC_CONFIG=$withval/bin/opensc-config
2724 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2726 if test "$OPENSC_CONFIG" != "no"; then
2727 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2728 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2729 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2730 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2731 AC_DEFINE(SMARTCARD)
2732 AC_DEFINE(USE_OPENSC, 1,
2733 [Define if you want smartcard support
2735 SCARD_MSG="yes, using OpenSC"
2741 # Check libraries needed by DNS fingerprint support
2742 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2743 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2744 [Define if getrrsetbyname() exists])],
2746 # Needed by our getrrsetbyname()
2747 AC_SEARCH_LIBS(res_query, resolv)
2748 AC_SEARCH_LIBS(dn_expand, resolv)
2749 AC_MSG_CHECKING(if res_query will link)
2750 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2753 LIBS="$LIBS -lresolv"
2754 AC_MSG_CHECKING(for res_query in -lresolv)
2759 res_query (0, 0, 0, 0, 0);
2763 [LIBS="$LIBS -lresolv"
2764 AC_MSG_RESULT(yes)],
2768 AC_CHECK_FUNCS(_getshort _getlong)
2769 AC_CHECK_DECLS([_getshort, _getlong], , ,
2770 [#include <sys/types.h>
2771 #include <arpa/nameser.h>])
2772 AC_CHECK_MEMBER(HEADER.ad,
2773 [AC_DEFINE(HAVE_HEADER_AD, 1,
2774 [Define if HEADER.ad exists in arpa/nameser.h])],,
2775 [#include <arpa/nameser.h>])
2778 # Check whether user wants Kerberos 5 support
2780 AC_ARG_WITH(kerberos5,
2781 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2782 [ if test "x$withval" != "xno" ; then
2783 if test "x$withval" = "xyes" ; then
2784 KRB5ROOT="/usr/local"
2789 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
2792 AC_MSG_CHECKING(for krb5-config)
2793 if test -x $KRB5ROOT/bin/krb5-config ; then
2794 KRB5CONF=$KRB5ROOT/bin/krb5-config
2795 AC_MSG_RESULT($KRB5CONF)
2797 AC_MSG_CHECKING(for gssapi support)
2798 if $KRB5CONF | grep gssapi >/dev/null ; then
2800 AC_DEFINE(GSSAPI, 1,
2801 [Define this if you want GSSAPI
2802 support in the version 2 protocol])
2808 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2809 K5LIBS="`$KRB5CONF --libs $k5confopts`"
2810 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2811 AC_MSG_CHECKING(whether we are using Heimdal)
2812 AC_TRY_COMPILE([ #include <krb5.h> ],
2813 [ char *tmp = heimdal_version; ],
2814 [ AC_MSG_RESULT(yes)
2815 AC_DEFINE(HEIMDAL, 1,
2816 [Define this if you are using the
2817 Heimdal version of Kerberos V5]) ],
2822 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2823 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2824 AC_MSG_CHECKING(whether we are using Heimdal)
2825 AC_TRY_COMPILE([ #include <krb5.h> ],
2826 [ char *tmp = heimdal_version; ],
2827 [ AC_MSG_RESULT(yes)
2829 K5LIBS="-lkrb5 -ldes"
2830 K5LIBS="$K5LIBS -lcom_err -lasn1"
2831 AC_CHECK_LIB(roken, net_write,
2832 [K5LIBS="$K5LIBS -lroken"])
2835 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2838 AC_SEARCH_LIBS(dn_expand, resolv)
2840 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2842 K5LIBS="-lgssapi $K5LIBS" ],
2843 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2845 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2846 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2851 AC_CHECK_HEADER(gssapi.h, ,
2852 [ unset ac_cv_header_gssapi_h
2853 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2854 AC_CHECK_HEADERS(gssapi.h, ,
2855 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2861 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2862 AC_CHECK_HEADER(gssapi_krb5.h, ,
2863 [ CPPFLAGS="$oldCPP" ])
2866 if test ! -z "$need_dash_r" ; then
2867 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2869 if test ! -z "$blibpath" ; then
2870 blibpath="$blibpath:${KRB5ROOT}/lib"
2873 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2874 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2875 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2877 LIBS="$LIBS $K5LIBS"
2878 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
2879 [Define this if you want to use libkafs' AFS support]))
2884 # Looking for programs, paths and files
2886 PRIVSEP_PATH=/var/empty
2887 AC_ARG_WITH(privsep-path,
2888 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2890 if test -n "$withval" && test "x$withval" != "xno" && \
2891 test "x${withval}" != "xyes"; then
2892 PRIVSEP_PATH=$withval
2896 AC_SUBST(PRIVSEP_PATH)
2899 [ --with-xauth=PATH Specify path to xauth program ],
2901 if test -n "$withval" && test "x$withval" != "xno" && \
2902 test "x${withval}" != "xyes"; then
2908 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2909 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2910 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2911 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2912 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2913 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2914 xauth_path="/usr/openwin/bin/xauth"
2920 AC_ARG_ENABLE(strip,
2921 [ --disable-strip Disable calling strip(1) on install],
2923 if test "x$enableval" = "xno" ; then
2930 if test -z "$xauth_path" ; then
2931 XAUTH_PATH="undefined"
2932 AC_SUBST(XAUTH_PATH)
2934 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
2935 [Define if xauth is found in your path])
2936 XAUTH_PATH=$xauth_path
2937 AC_SUBST(XAUTH_PATH)
2940 # Check for mail directory (last resort if we cannot get it from headers)
2941 if test ! -z "$MAIL" ; then
2942 maildir=`dirname $MAIL`
2943 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
2944 [Set this to your mail directory if you don't have maillock.h])
2947 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
2948 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2949 disable_ptmx_check=yes
2951 if test -z "$no_dev_ptmx" ; then
2952 if test "x$disable_ptmx_check" != "xyes" ; then
2953 AC_CHECK_FILE("/dev/ptmx",
2955 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
2956 [Define if you have /dev/ptmx])
2963 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
2964 AC_CHECK_FILE("/dev/ptc",
2966 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
2967 [Define if you have /dev/ptc])
2972 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2975 # Options from here on. Some of these are preset by platform above
2976 AC_ARG_WITH(mantype,
2977 [ --with-mantype=man|cat|doc Set man page type],
2984 AC_MSG_ERROR(invalid man type: $withval)
2989 if test -z "$MANTYPE"; then
2990 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2991 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2992 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2994 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3001 if test "$MANTYPE" = "doc"; then
3008 # Check whether to enable MD5 passwords
3010 AC_ARG_WITH(md5-passwords,
3011 [ --with-md5-passwords Enable use of MD5 passwords],
3013 if test "x$withval" != "xno" ; then
3014 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3015 [Define if you want to allow MD5 passwords])
3021 # Whether to disable shadow password support
3023 [ --without-shadow Disable shadow password support],
3025 if test "x$withval" = "xno" ; then
3026 AC_DEFINE(DISABLE_SHADOW)
3032 if test -z "$disable_shadow" ; then
3033 AC_MSG_CHECKING([if the systems has expire shadow information])
3036 #include <sys/types.h>
3039 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3040 [ sp_expire_available=yes ], []
3043 if test "x$sp_expire_available" = "xyes" ; then
3045 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3046 [Define if you want to use shadow password expire field])
3052 # Use ip address instead of hostname in $DISPLAY
3053 if test ! -z "$IPADDR_IN_DISPLAY" ; then
3054 DISPLAY_HACK_MSG="yes"
3055 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3056 [Define if you need to use IP address
3057 instead of hostname in $DISPLAY])
3059 DISPLAY_HACK_MSG="no"
3060 AC_ARG_WITH(ipaddr-display,
3061 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3063 if test "x$withval" != "xno" ; then
3064 AC_DEFINE(IPADDR_IN_DISPLAY)
3065 DISPLAY_HACK_MSG="yes"
3071 # check for /etc/default/login and use it if present.
3072 AC_ARG_ENABLE(etc-default-login,
3073 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3074 [ if test "x$enableval" = "xno"; then
3075 AC_MSG_NOTICE([/etc/default/login handling disabled])
3076 etc_default_login=no
3078 etc_default_login=yes
3080 [ etc_default_login=yes ]
3083 if test "x$etc_default_login" != "xno"; then
3084 AC_CHECK_FILE("/etc/default/login",
3085 [ external_path_file=/etc/default/login ])
3086 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3088 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
3089 elif test "x$external_path_file" = "x/etc/default/login"; then
3090 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3091 [Define if your system has /etc/default/login])
3095 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3096 if test $ac_cv_func_login_getcapbool = "yes" && \
3097 test $ac_cv_header_login_cap_h = "yes" ; then
3098 external_path_file=/etc/login.conf
3101 # Whether to mess with the default path
3102 SERVER_PATH_MSG="(default)"
3103 AC_ARG_WITH(default-path,
3104 [ --with-default-path= Specify default \$PATH environment for server],
3106 if test "x$external_path_file" = "x/etc/login.conf" ; then
3108 --with-default-path=PATH has no effect on this system.
3109 Edit /etc/login.conf instead.])
3110 elif test "x$withval" != "xno" ; then
3111 if test ! -z "$external_path_file" ; then
3113 --with-default-path=PATH will only be used if PATH is not defined in
3114 $external_path_file .])
3116 user_path="$withval"
3117 SERVER_PATH_MSG="$withval"
3120 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3121 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3123 if test ! -z "$external_path_file" ; then
3125 If PATH is defined in $external_path_file, ensure the path to scp is included,
3126 otherwise scp will not work.])
3130 /* find out what STDPATH is */
3135 #ifndef _PATH_STDPATH
3136 # ifdef _PATH_USERPATH /* Irix */
3137 # define _PATH_STDPATH _PATH_USERPATH
3139 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3142 #include <sys/types.h>
3143 #include <sys/stat.h>
3145 #define DATA "conftest.stdpath"
3152 fd = fopen(DATA,"w");
3156 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3161 ], [ user_path=`cat conftest.stdpath` ],
3162 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3163 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3165 # make sure $bindir is in USER_PATH so scp will work
3166 t_bindir=`eval echo ${bindir}`
3168 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3171 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3173 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3174 if test $? -ne 0 ; then
3175 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3176 if test $? -ne 0 ; then
3177 user_path=$user_path:$t_bindir
3178 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3183 if test "x$external_path_file" != "x/etc/login.conf" ; then
3184 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
3188 # Set superuser path separately to user path
3189 AC_ARG_WITH(superuser-path,
3190 [ --with-superuser-path= Specify different path for super-user],
3192 if test -n "$withval" && test "x$withval" != "xno" && \
3193 test "x${withval}" != "xyes"; then
3194 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3195 [Define if you want a different $PATH
3197 superuser_path=$withval
3203 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3204 IPV4_IN6_HACK_MSG="no"
3206 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3208 if test "x$withval" != "xno" ; then
3210 AC_DEFINE(IPV4_IN_IPV6, 1,
3211 [Detect IPv4 in IPv6 mapped addresses
3213 IPV4_IN6_HACK_MSG="yes"
3218 if test "x$inet6_default_4in6" = "xyes"; then
3219 AC_MSG_RESULT([yes (default)])
3220 AC_DEFINE(IPV4_IN_IPV6)
3221 IPV4_IN6_HACK_MSG="yes"
3223 AC_MSG_RESULT([no (default)])
3228 # Whether to enable BSD auth support
3230 AC_ARG_WITH(bsd-auth,
3231 [ --with-bsd-auth Enable BSD auth support],
3233 if test "x$withval" != "xno" ; then
3234 AC_DEFINE(BSD_AUTH, 1,
3235 [Define if you have BSD auth support])
3241 # Where to place sshd.pid
3243 # make sure the directory exists
3244 if test ! -d $piddir ; then
3245 piddir=`eval echo ${sysconfdir}`
3247 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3251 AC_ARG_WITH(pid-dir,
3252 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3254 if test -n "$withval" && test "x$withval" != "xno" && \
3255 test "x${withval}" != "xyes"; then
3257 if test ! -d $piddir ; then
3258 AC_MSG_WARN([** no $piddir directory on this system **])
3264 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
3267 dnl allow user to disable some login recording features
3268 AC_ARG_ENABLE(lastlog,
3269 [ --disable-lastlog disable use of lastlog even if detected [no]],
3271 if test "x$enableval" = "xno" ; then
3272 AC_DEFINE(DISABLE_LASTLOG)
3277 [ --disable-utmp disable use of utmp even if detected [no]],
3279 if test "x$enableval" = "xno" ; then
3280 AC_DEFINE(DISABLE_UTMP)
3284 AC_ARG_ENABLE(utmpx,
3285 [ --disable-utmpx disable use of utmpx even if detected [no]],
3287 if test "x$enableval" = "xno" ; then
3288 AC_DEFINE(DISABLE_UTMPX, 1,
3289 [Define if you don't want to use utmpx])
3294 [ --disable-wtmp disable use of wtmp even if detected [no]],
3296 if test "x$enableval" = "xno" ; then
3297 AC_DEFINE(DISABLE_WTMP)
3301 AC_ARG_ENABLE(wtmpx,
3302 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
3304 if test "x$enableval" = "xno" ; then
3305 AC_DEFINE(DISABLE_WTMPX, 1,
3306 [Define if you don't want to use wtmpx])
3310 AC_ARG_ENABLE(libutil,
3311 [ --disable-libutil disable use of libutil (login() etc.) [no]],
3313 if test "x$enableval" = "xno" ; then
3314 AC_DEFINE(DISABLE_LOGIN)
3318 AC_ARG_ENABLE(pututline,
3319 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
3321 if test "x$enableval" = "xno" ; then
3322 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3323 [Define if you don't want to use pututline()
3324 etc. to write [uw]tmp])
3328 AC_ARG_ENABLE(pututxline,
3329 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
3331 if test "x$enableval" = "xno" ; then
3332 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3333 [Define if you don't want to use pututxline()
3334 etc. to write [uw]tmpx])
3338 AC_ARG_WITH(lastlog,
3339 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
3341 if test "x$withval" = "xno" ; then
3342 AC_DEFINE(DISABLE_LASTLOG)
3343 elif test -n "$withval" && test "x${withval}" != "xyes"; then
3344 conf_lastlog_location=$withval
3349 dnl lastlog, [uw]tmpx? detection
3350 dnl NOTE: set the paths in the platform section to avoid the
3351 dnl need for command-line parameters
3352 dnl lastlog and [uw]tmp are subject to a file search if all else fails
3354 dnl lastlog detection
3355 dnl NOTE: the code itself will detect if lastlog is a directory
3356 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3358 #include <sys/types.h>
3360 #ifdef HAVE_LASTLOG_H
3361 # include <lastlog.h>
3370 [ char *lastlog = LASTLOG_FILE; ],
3371 [ AC_MSG_RESULT(yes) ],
3374 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3376 #include <sys/types.h>
3378 #ifdef HAVE_LASTLOG_H
3379 # include <lastlog.h>
3385 [ char *lastlog = _PATH_LASTLOG; ],
3386 [ AC_MSG_RESULT(yes) ],
3389 system_lastlog_path=no
3394 if test -z "$conf_lastlog_location"; then
3395 if test x"$system_lastlog_path" = x"no" ; then
3396 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3397 if (test -d "$f" || test -f "$f") ; then
3398 conf_lastlog_location=$f
3401 if test -z "$conf_lastlog_location"; then
3402 AC_MSG_WARN([** Cannot find lastlog **])
3403 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
3408 if test -n "$conf_lastlog_location"; then
3409 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3410 [Define if you want to specify the path to your lastlog file])
3414 AC_MSG_CHECKING([if your system defines UTMP_FILE])
3416 #include <sys/types.h>
3422 [ char *utmp = UTMP_FILE; ],
3423 [ AC_MSG_RESULT(yes) ],
3425 system_utmp_path=no ]
3427 if test -z "$conf_utmp_location"; then
3428 if test x"$system_utmp_path" = x"no" ; then
3429 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3430 if test -f $f ; then
3431 conf_utmp_location=$f
3434 if test -z "$conf_utmp_location"; then
3435 AC_DEFINE(DISABLE_UTMP)
3439 if test -n "$conf_utmp_location"; then
3440 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3441 [Define if you want to specify the path to your utmp file])
3445 AC_MSG_CHECKING([if your system defines WTMP_FILE])
3447 #include <sys/types.h>
3453 [ char *wtmp = WTMP_FILE; ],
3454 [ AC_MSG_RESULT(yes) ],
3456 system_wtmp_path=no ]
3458 if test -z "$conf_wtmp_location"; then
3459 if test x"$system_wtmp_path" = x"no" ; then
3460 for f in /usr/adm/wtmp /var/log/wtmp; do
3461 if test -f $f ; then
3462 conf_wtmp_location=$f
3465 if test -z "$conf_wtmp_location"; then
3466 AC_DEFINE(DISABLE_WTMP)
3470 if test -n "$conf_wtmp_location"; then
3471 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3472 [Define if you want to specify the path to your wtmp file])
3476 dnl utmpx detection - I don't know any system so perverse as to require
3477 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3479 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3481 #include <sys/types.h>
3490 [ char *utmpx = UTMPX_FILE; ],
3491 [ AC_MSG_RESULT(yes) ],
3493 system_utmpx_path=no ]
3495 if test -z "$conf_utmpx_location"; then
3496 if test x"$system_utmpx_path" = x"no" ; then
3497 AC_DEFINE(DISABLE_UTMPX)
3500 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3501 [Define if you want to specify the path to your utmpx file])
3505 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3507 #include <sys/types.h>
3516 [ char *wtmpx = WTMPX_FILE; ],
3517 [ AC_MSG_RESULT(yes) ],
3519 system_wtmpx_path=no ]
3521 if test -z "$conf_wtmpx_location"; then
3522 if test x"$system_wtmpx_path" = x"no" ; then
3523 AC_DEFINE(DISABLE_WTMPX)
3526 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3527 [Define if you want to specify the path to your wtmpx file])
3531 if test ! -z "$blibpath" ; then
3532 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3533 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3536 dnl remove pam and dl because they are in $LIBPAM
3537 if test "$PAM_MSG" = yes ; then
3538 LIBS=`echo $LIBS | sed 's/-lpam //'`
3540 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3541 LIBS=`echo $LIBS | sed 's/-ldl //'`
3544 dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3546 CFLAGS="$CFLAGS $werror_flags"
3549 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3550 scard/Makefile ssh_prng_cmds survey.sh])
3553 # Print summary of options
3555 # Someone please show me a better way :)
3556 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3557 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3558 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3559 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3560 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3561 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3562 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
3563 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3564 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3565 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3568 echo "OpenSSH has been configured with the following options:"
3569 echo " User binaries: $B"
3570 echo " System binaries: $C"
3571 echo " Configuration files: $D"
3572 echo " Askpass program: $E"
3573 echo " Manual pages: $F"
3574 echo " PID file: $G"
3575 echo " Privilege separation chroot path: $H"
3576 if test "x$external_path_file" = "x/etc/login.conf" ; then
3577 echo " At runtime, sshd will use the path defined in $external_path_file"
3578 echo " Make sure the path to scp is present, otherwise scp will not work"
3580 echo " sshd default user PATH: $I"
3581 if test ! -z "$external_path_file"; then
3582 echo " (If PATH is set in $external_path_file it will be used instead. If"
3583 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3586 if test ! -z "$superuser_path" ; then
3587 echo " sshd superuser user PATH: $J"
3589 echo " Manpage format: $MANTYPE"
3590 echo " PAM support: $PAM_MSG"
3591 echo " KerberosV support: $KRB5_MSG"
3592 echo " Smartcard support: $SCARD_MSG"
3593 echo " S/KEY support: $SKEY_MSG"
3594 echo " TCP Wrappers support: $TCPW_MSG"
3595 echo " MD5 password support: $MD5_MSG"
3596 echo " libedit support: $LIBEDIT_MSG"
3597 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
3598 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3599 echo " BSD Auth support: $BSD_AUTH_MSG"
3600 echo " Random number source: $RAND_MSG"
3601 if test ! -z "$USE_RAND_HELPER" ; then
3602 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
3607 echo " Host: ${host}"
3608 echo " Compiler: ${CC}"
3609 echo " Compiler flags: ${CFLAGS}"
3610 echo "Preprocessor flags: ${CPPFLAGS}"
3611 echo " Linker flags: ${LDFLAGS}"
3612 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
3616 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
3617 echo "SVR4 style packages are supported with \"make package\""
3621 if test "x$PAM_MSG" = "xyes" ; then
3622 echo "PAM is enabled. You may need to install a PAM control file "
3623 echo "for sshd, otherwise password authentication may fail. "
3624 echo "Example PAM control files can be found in the contrib/ "
3629 if test ! -z "$RAND_HELPER_CMDHASH" ; then
3630 echo "WARNING: you are using the builtin random number collection "
3631 echo "service. Please read WARNING.RNG and request that your OS "
3632 echo "vendor includes kernel-based random number collection in "
3633 echo "future versions of your OS."
3637 if test ! -z "$NO_PEERCHECK" ; then
3638 echo "WARNING: the operating system that you are using does not "
3639 echo "appear to support either the getpeereid() API nor the "
3640 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3641 echo "enforce security checks to prevent unauthorised connections to "
3642 echo "ssh-agent. Their absence increases the risk that a malicious "
3643 echo "user can connect to your agent. "
3647 if test "$AUDIT_MODULE" = "bsm" ; then
3648 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3649 echo "See the Solaris section in README.platform for details."