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)
299 MAIL="/var/mail/username"
301 AC_CHECK_LIB(xnet, t_error, ,
302 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
304 # next, we define all of the options specific to major releases
307 if test -z "$GCC"; then
312 AC_DEFINE(PAM_SUN_CODEBASE, 1,
313 [Define if you are using Solaris-derived PAM which
314 passes pam_messages to the conversation function
315 with an extra level of indirection])
316 AC_DEFINE(DISABLE_UTMP, 1,
317 [Define if you don't want to use utmp])
318 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
319 check_for_hpux_broken_getaddrinfo=1
320 check_for_conflicting_getspnam=1
324 # lastly, we define options specific to minor releases
327 AC_DEFINE(HAVE_SECUREWARE, 1,
328 [Define if you have SecureWare-based
329 protected password database])
330 disable_ptmx_check=yes
336 PATH="$PATH:/usr/etc"
337 AC_DEFINE(BROKEN_INET_NTOA, 1,
338 [Define if you system's inet_ntoa is busted
339 (e.g. Irix gcc issue)])
340 AC_DEFINE(SETEUID_BREAKS_SETUID)
341 AC_DEFINE(BROKEN_SETREUID)
342 AC_DEFINE(BROKEN_SETREGID)
343 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
344 [Define if you shouldn't strip 'tty' from your
346 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
349 PATH="$PATH:/usr/etc"
350 AC_DEFINE(WITH_IRIX_ARRAY, 1,
351 [Define if you have/want arrays
352 (cluster-wide session managment, not C arrays)])
353 AC_DEFINE(WITH_IRIX_PROJECT, 1,
354 [Define if you want IRIX project management])
355 AC_DEFINE(WITH_IRIX_AUDIT, 1,
356 [Define if you want IRIX audit trails])
357 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
358 [Define if you want IRIX kernel jobs])])
359 AC_DEFINE(BROKEN_INET_NTOA)
360 AC_DEFINE(SETEUID_BREAKS_SETUID)
361 AC_DEFINE(BROKEN_SETREUID)
362 AC_DEFINE(BROKEN_SETREGID)
363 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
364 AC_DEFINE(WITH_ABBREV_NO_TTY)
365 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
369 check_for_libcrypt_later=1
370 check_for_openpty_ctty_bug=1
371 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
372 AC_DEFINE(PAM_TTY_KLUDGE, 1,
373 [Work around problematic Linux PAM modules handling of PAM_TTY])
374 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
375 [String used in /etc/passwd to denote locked account])
376 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
377 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
378 [Define to whatever link() returns for "not supported"
379 if it doesn't return EOPNOTSUPP.])
380 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
382 inet6_default_4in6=yes
385 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
386 [Define if cmsg_type is not passed correctly])
390 mips-sony-bsd|mips-sony-newsos4)
391 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
395 check_for_libcrypt_before=1
396 if test "x$withval" != "xno" ; then
401 check_for_libcrypt_later=1
402 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
405 AC_DEFINE(SETEUID_BREAKS_SETUID)
406 AC_DEFINE(BROKEN_SETREUID)
407 AC_DEFINE(BROKEN_SETREGID)
410 conf_lastlog_location="/usr/adm/lastlog"
411 conf_utmp_location=/etc/utmp
412 conf_wtmp_location=/usr/adm/wtmp
414 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
415 AC_DEFINE(BROKEN_REALPATH)
417 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
420 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
423 if test "x$withval" != "xno" ; then
426 AC_DEFINE(PAM_SUN_CODEBASE)
427 AC_DEFINE(LOGIN_NEEDS_UTMPX)
428 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
429 [Some versions of /bin/login need the TERM supplied
431 AC_DEFINE(PAM_TTY_KLUDGE)
432 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
433 [Define if pam_chauthtok wants real uid set
434 to the unpriv'ed user])
435 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
436 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
437 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
438 [Define if sshd somehow reacquires a controlling TTY
440 external_path_file=/etc/default/login
441 # hardwire lastlog location (can't detect it on some versions)
442 conf_lastlog_location="/var/adm/lastlog"
443 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
444 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
445 if test "$sol2ver" -ge 8; then
447 AC_DEFINE(DISABLE_UTMP)
448 AC_DEFINE(DISABLE_WTMP, 1,
449 [Define if you don't want to use wtmp])
455 CPPFLAGS="$CPPFLAGS -DSUNOS4"
456 AC_CHECK_FUNCS(getpwanam)
457 AC_DEFINE(PAM_SUN_CODEBASE)
458 conf_utmp_location=/etc/utmp
459 conf_wtmp_location=/var/adm/wtmp
460 conf_lastlog_location=/var/adm/lastlog
466 AC_DEFINE(SSHD_ACQUIRES_CTTY)
467 AC_DEFINE(SETEUID_BREAKS_SETUID)
468 AC_DEFINE(BROKEN_SETREUID)
469 AC_DEFINE(BROKEN_SETREGID)
472 # /usr/ucblib MUST NOT be searched on ReliantUNIX
473 AC_CHECK_LIB(dl, dlsym, ,)
474 # -lresolv needs to be at then end of LIBS or DNS lookups break
475 AC_CHECK_LIB(res_query, resolv, [ LIBS="$LIBS -lresolv" ])
476 IPADDR_IN_DISPLAY=yes
478 AC_DEFINE(IP_TOS_IS_BROKEN)
479 AC_DEFINE(SETEUID_BREAKS_SETUID)
480 AC_DEFINE(BROKEN_SETREUID)
481 AC_DEFINE(BROKEN_SETREGID)
482 AC_DEFINE(SSHD_ACQUIRES_CTTY)
483 external_path_file=/etc/default/login
484 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
485 # Attention: always take care to bind libsocket and libnsl before libc,
486 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
488 # UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
491 AC_DEFINE(SETEUID_BREAKS_SETUID)
492 AC_DEFINE(BROKEN_SETREUID)
493 AC_DEFINE(BROKEN_SETREGID)
494 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
496 # UnixWare 7.x, OpenUNIX 8
498 check_for_libcrypt_later=1
499 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
501 AC_DEFINE(SETEUID_BREAKS_SETUID)
502 AC_DEFINE(BROKEN_SETREUID)
503 AC_DEFINE(BROKEN_SETREGID)
504 AC_DEFINE(PASSWD_NEEDS_USERNAME)
506 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
507 TEST_SHELL=/u95/bin/sh
508 AC_DEFINE(BROKEN_LIBIAF, 1,
509 [ia_uinfo routines not supported by OS yet])
515 # SCO UNIX and OEM versions of SCO UNIX
517 AC_MSG_ERROR("This Platform is no longer supported.")
521 if test -z "$GCC"; then
522 CFLAGS="$CFLAGS -belf"
524 LIBS="$LIBS -lprot -lx -ltinfo -lm"
527 AC_DEFINE(HAVE_SECUREWARE)
528 AC_DEFINE(DISABLE_SHADOW)
529 AC_DEFINE(DISABLE_FD_PASSING)
530 AC_DEFINE(SETEUID_BREAKS_SETUID)
531 AC_DEFINE(BROKEN_SETREUID)
532 AC_DEFINE(BROKEN_SETREGID)
533 AC_DEFINE(WITH_ABBREV_NO_TTY)
534 AC_DEFINE(BROKEN_UPDWTMPX)
535 AC_DEFINE(PASSWD_NEEDS_USERNAME)
536 AC_CHECK_FUNCS(getluid setluid)
541 AC_DEFINE(NO_SSH_LASTLOG, 1,
542 [Define if you don't want to use lastlog in session.c])
543 AC_DEFINE(SETEUID_BREAKS_SETUID)
544 AC_DEFINE(BROKEN_SETREUID)
545 AC_DEFINE(BROKEN_SETREGID)
547 AC_DEFINE(DISABLE_FD_PASSING)
549 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
553 AC_DEFINE(SETEUID_BREAKS_SETUID)
554 AC_DEFINE(BROKEN_SETREUID)
555 AC_DEFINE(BROKEN_SETREGID)
556 AC_DEFINE(WITH_ABBREV_NO_TTY)
558 AC_DEFINE(DISABLE_FD_PASSING)
560 LIBS="$LIBS -lgen -lacid -ldb"
564 AC_DEFINE(SETEUID_BREAKS_SETUID)
565 AC_DEFINE(BROKEN_SETREUID)
566 AC_DEFINE(BROKEN_SETREGID)
568 AC_DEFINE(DISABLE_FD_PASSING)
569 AC_DEFINE(NO_SSH_LASTLOG)
570 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
571 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
575 AC_MSG_CHECKING(for Digital Unix SIA)
578 [ --with-osfsia Enable Digital Unix SIA],
580 if test "x$withval" = "xno" ; then
581 AC_MSG_RESULT(disabled)
586 if test -z "$no_osfsia" ; then
587 if test -f /etc/sia/matrix.conf; then
589 AC_DEFINE(HAVE_OSF_SIA, 1,
590 [Define if you have Digital Unix Security
591 Integration Architecture])
592 AC_DEFINE(DISABLE_LOGIN, 1,
593 [Define if you don't want to use your
594 system's login() call])
595 AC_DEFINE(DISABLE_FD_PASSING)
596 LIBS="$LIBS -lsecurity -ldb -lm -laud"
599 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
600 [String used in /etc/passwd to denote locked account])
603 AC_DEFINE(BROKEN_GETADDRINFO)
604 AC_DEFINE(SETEUID_BREAKS_SETUID)
605 AC_DEFINE(BROKEN_SETREUID)
606 AC_DEFINE(BROKEN_SETREGID)
611 AC_DEFINE(NO_X11_UNIX_SOCKETS)
612 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
613 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
614 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
618 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
619 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
620 AC_DEFINE(NEED_SETPRGP)
621 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
625 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
626 AC_DEFINE(MISSING_HOWMANY)
627 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
631 # Allow user to specify flags
633 [ --with-cflags Specify additional flags to pass to compiler],
635 if test -n "$withval" && test "x$withval" != "xno" && \
636 test "x${withval}" != "xyes"; then
637 CFLAGS="$CFLAGS $withval"
641 AC_ARG_WITH(cppflags,
642 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
644 if test -n "$withval" && test "x$withval" != "xno" && \
645 test "x${withval}" != "xyes"; then
646 CPPFLAGS="$CPPFLAGS $withval"
651 [ --with-ldflags Specify additional flags to pass to linker],
653 if test -n "$withval" && test "x$withval" != "xno" && \
654 test "x${withval}" != "xyes"; then
655 LDFLAGS="$LDFLAGS $withval"
660 [ --with-libs Specify additional libraries to link with],
662 if test -n "$withval" && test "x$withval" != "xno" && \
663 test "x${withval}" != "xyes"; then
664 LIBS="$LIBS $withval"
669 [ --with-Werror Build main code with -Werror],
671 if test -n "$withval" && test "x$withval" != "xno"; then
672 werror_flags="-Werror"
673 if "x${withval}" != "xyes"; then
674 werror_flags="$withval"
680 AC_MSG_CHECKING(compiler and flags for sanity)
686 [ AC_MSG_RESULT(yes) ],
689 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
691 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
694 dnl Checks for header files.
720 security/pam_appl.h \
756 # sys/ptms.h requires sys/stream.h to be included first on Solaris
757 AC_CHECK_HEADERS(sys/ptms.h, [], [], [
758 #ifdef HAVE_SYS_STREAM_H
759 # include <sys/stream.h>
763 # Checks for libraries.
764 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
765 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
767 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
768 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
769 AC_CHECK_LIB(gen, dirname,[
770 AC_CACHE_CHECK([for broken dirname],
771 ac_cv_have_broken_dirname, [
779 int main(int argc, char **argv) {
782 strncpy(buf,"/etc", 32);
784 if (!s || strncmp(s, "/", 32) != 0) {
791 [ ac_cv_have_broken_dirname="no" ],
792 [ ac_cv_have_broken_dirname="yes" ]
796 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
798 AC_DEFINE(HAVE_DIRNAME)
799 AC_CHECK_HEADERS(libgen.h)
804 AC_CHECK_FUNC(getspnam, ,
805 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
806 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
807 [Define if you have the basename function.]))
811 [ --with-zlib=PATH Use zlib in PATH],
812 [ if test "x$withval" = "xno" ; then
813 AC_MSG_ERROR([*** zlib is required ***])
814 elif test "x$withval" != "xyes"; then
815 if test -d "$withval/lib"; then
816 if test -n "${need_dash_r}"; then
817 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
819 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
822 if test -n "${need_dash_r}"; then
823 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
825 LDFLAGS="-L${withval} ${LDFLAGS}"
828 if test -d "$withval/include"; then
829 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
831 CPPFLAGS="-I${withval} ${CPPFLAGS}"
836 AC_CHECK_LIB(z, deflate, ,
838 saved_CPPFLAGS="$CPPFLAGS"
839 saved_LDFLAGS="$LDFLAGS"
841 dnl Check default zlib install dir
842 if test -n "${need_dash_r}"; then
843 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
845 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
847 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
849 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
851 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
856 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
858 AC_ARG_WITH(zlib-version-check,
859 [ --without-zlib-version-check Disable zlib version check],
860 [ if test "x$withval" = "xno" ; then
861 zlib_check_nonfatal=1
866 AC_MSG_CHECKING(for possibly buggy zlib)
867 AC_RUN_IFELSE([AC_LANG_SOURCE([[
872 int a=0, b=0, c=0, d=0, n, v;
873 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
874 if (n != 3 && n != 4)
876 v = a*1000000 + b*10000 + c*100 + d;
877 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
880 if (a == 1 && b == 1 && c >= 4)
883 /* 1.2.3 and up are OK */
892 if test -z "$zlib_check_nonfatal" ; then
893 AC_MSG_ERROR([*** zlib too old - check config.log ***
894 Your reported zlib version has known security problems. It's possible your
895 vendor has fixed these problems without changing the version number. If you
896 are sure this is the case, you can disable the check by running
897 "./configure --without-zlib-version-check".
898 If you are in doubt, upgrade zlib to version 1.2.3 or greater.
899 See http://www.gzip.org/zlib/ for details.])
901 AC_MSG_WARN([zlib version may have security problems])
904 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
908 AC_CHECK_FUNC(strcasecmp,
909 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
911 AC_CHECK_FUNC(utimes,
912 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
913 LIBS="$LIBS -lc89"]) ]
916 dnl Checks for libutil functions
917 AC_CHECK_HEADERS(libutil.h)
918 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
919 [Define if your libraries define login()])])
920 AC_CHECK_FUNCS(logout updwtmp logwtmp)
924 # Check for ALTDIRFUNC glob() extension
925 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
926 AC_EGREP_CPP(FOUNDIT,
929 #ifdef GLOB_ALTDIRFUNC
934 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
935 [Define if your system glob() function has
936 the GLOB_ALTDIRFUNC extension])
944 # Check for g.gl_matchc glob() extension
945 AC_MSG_CHECKING(for gl_matchc field in glob_t)
946 AC_EGREP_CPP(FOUNDIT,
949 int main(void){glob_t g; g.gl_matchc = 1;}
952 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
953 [Define if your system glob() function has
954 gl_matchc options in glob_t])
962 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
965 #include <sys/types.h>
967 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
969 [AC_MSG_RESULT(yes)],
972 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
973 [Define in your struct dirent expects you to
974 allocate extra space for d_name])
977 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
978 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
982 AC_MSG_CHECKING([for /proc/pid/fd directory])
983 if test -d "/proc/$$/fd" ; then
984 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
990 # Check whether user wants S/Key support
993 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
995 if test "x$withval" != "xno" ; then
997 if test "x$withval" != "xyes" ; then
998 CPPFLAGS="$CPPFLAGS -I${withval}/include"
999 LDFLAGS="$LDFLAGS -L${withval}/lib"
1002 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
1006 AC_MSG_CHECKING([for s/key support])
1011 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
1013 [AC_MSG_RESULT(yes)],
1016 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1018 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1022 [(void)skeychallenge(NULL,"name","",0);],
1024 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1025 [Define if your skeychallenge()
1026 function takes 4 arguments (NetBSD)])],
1033 # Check whether user wants TCP wrappers support
1035 AC_ARG_WITH(tcp-wrappers,
1036 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
1038 if test "x$withval" != "xno" ; then
1040 saved_LDFLAGS="$LDFLAGS"
1041 saved_CPPFLAGS="$CPPFLAGS"
1042 if test -n "${withval}" && \
1043 test "x${withval}" != "xyes"; then
1044 if test -d "${withval}/lib"; then
1045 if test -n "${need_dash_r}"; then
1046 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1048 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1051 if test -n "${need_dash_r}"; then
1052 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1054 LDFLAGS="-L${withval} ${LDFLAGS}"
1057 if test -d "${withval}/include"; then
1058 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1060 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1064 LIBS="$LIBWRAP $LIBS"
1065 AC_MSG_CHECKING(for libwrap)
1068 #include <sys/types.h>
1069 #include <sys/socket.h>
1070 #include <netinet/in.h>
1072 int deny_severity = 0, allow_severity = 0;
1077 AC_DEFINE(LIBWRAP, 1,
1079 TCP Wrappers support])
1084 AC_MSG_ERROR([*** libwrap missing])
1092 # Check whether user wants libedit support
1094 AC_ARG_WITH(libedit,
1095 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1096 [ if test "x$withval" != "xno" ; then
1097 if test "x$withval" != "xyes"; then
1098 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1099 if test -n "${need_dash_r}"; then
1100 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1102 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1105 AC_CHECK_LIB(edit, el_init,
1106 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
1107 LIBEDIT="-ledit -lcurses"
1111 [ AC_MSG_ERROR(libedit not found) ],
1114 AC_MSG_CHECKING(if libedit version is compatible)
1117 #include <histedit.h>
1121 el_init("", NULL, NULL, NULL);
1125 [ AC_MSG_RESULT(yes) ],
1127 AC_MSG_ERROR(libedit version is not compatible) ]
1134 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1136 AC_MSG_CHECKING(for supported audit module)
1141 dnl Checks for headers, libs and functions
1142 AC_CHECK_HEADERS(bsm/audit.h, [],
1143 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1144 AC_CHECK_LIB(bsm, getaudit, [],
1145 [AC_MSG_ERROR(BSM enabled and required library not found)])
1146 AC_CHECK_FUNCS(getaudit, [],
1147 [AC_MSG_ERROR(BSM enabled and required function not found)])
1148 # These are optional
1149 AC_CHECK_FUNCS(getaudit_addr)
1150 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
1154 AC_MSG_RESULT(debug)
1155 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
1161 AC_MSG_ERROR([Unknown audit module $withval])
1166 dnl Checks for library functions. Please keep in alphabetical order
1250 # IRIX has a const char return value for gai_strerror()
1251 AC_CHECK_FUNCS(gai_strerror,[
1252 AC_DEFINE(HAVE_GAI_STRERROR)
1254 #include <sys/types.h>
1255 #include <sys/socket.h>
1258 const char *gai_strerror(int);],[
1261 str = gai_strerror(0);],[
1262 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1263 [Define if gai_strerror() returns const char *])])])
1265 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1266 [Some systems put nanosleep outside of libc]))
1268 dnl Make sure prototypes are defined for these before using them.
1269 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1270 AC_CHECK_DECL(strsep,
1271 [AC_CHECK_FUNCS(strsep)],
1274 #ifdef HAVE_STRING_H
1275 # include <string.h>
1279 dnl tcsendbreak might be a macro
1280 AC_CHECK_DECL(tcsendbreak,
1281 [AC_DEFINE(HAVE_TCSENDBREAK)],
1282 [AC_CHECK_FUNCS(tcsendbreak)],
1283 [#include <termios.h>]
1286 AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1288 AC_CHECK_FUNCS(setresuid, [
1289 dnl Some platorms have setresuid that isn't implemented, test for this
1290 AC_MSG_CHECKING(if setresuid seems to work)
1295 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1297 [AC_MSG_RESULT(yes)],
1298 [AC_DEFINE(BROKEN_SETRESUID, 1,
1299 [Define if your setresuid() is broken])
1300 AC_MSG_RESULT(not implemented)],
1301 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1305 AC_CHECK_FUNCS(setresgid, [
1306 dnl Some platorms have setresgid that isn't implemented, test for this
1307 AC_MSG_CHECKING(if setresgid seems to work)
1312 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1314 [AC_MSG_RESULT(yes)],
1315 [AC_DEFINE(BROKEN_SETRESGID, 1,
1316 [Define if your setresgid() is broken])
1317 AC_MSG_RESULT(not implemented)],
1318 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1322 dnl Checks for time functions
1323 AC_CHECK_FUNCS(gettimeofday time)
1324 dnl Checks for utmp functions
1325 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1326 AC_CHECK_FUNCS(utmpname)
1327 dnl Checks for utmpx functions
1328 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1329 AC_CHECK_FUNCS(setutxent utmpxname)
1331 AC_CHECK_FUNC(daemon,
1332 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1333 [AC_CHECK_LIB(bsd, daemon,
1334 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1337 AC_CHECK_FUNC(getpagesize,
1338 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1339 [Define if your libraries define getpagesize()])],
1340 [AC_CHECK_LIB(ucb, getpagesize,
1341 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1344 # Check for broken snprintf
1345 if test "x$ac_cv_func_snprintf" = "xyes" ; then
1346 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1350 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1352 [AC_MSG_RESULT(yes)],
1355 AC_DEFINE(BROKEN_SNPRINTF, 1,
1356 [Define if your snprintf is busted])
1357 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1359 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1363 # Check for missing getpeereid (or equiv) support
1365 if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1366 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1368 [#include <sys/types.h>
1369 #include <sys/socket.h>],
1370 [int i = SO_PEERCRED;],
1371 [ AC_MSG_RESULT(yes)
1372 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
1379 dnl see whether mkstemp() requires XXXXXX
1380 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1381 AC_MSG_CHECKING([for (overly) strict mkstemp])
1385 main() { char template[]="conftest.mkstemp-test";
1386 if (mkstemp(template) == -1)
1388 unlink(template); exit(0);
1396 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
1400 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1405 dnl make sure that openpty does not reacquire controlling terminal
1406 if test ! -z "$check_for_openpty_ctty_bug"; then
1407 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1411 #include <sys/fcntl.h>
1412 #include <sys/types.h>
1413 #include <sys/wait.h>
1419 int fd, ptyfd, ttyfd, status;
1422 if (pid < 0) { /* failed */
1424 } else if (pid > 0) { /* parent */
1425 waitpid(pid, &status, 0);
1426 if (WIFEXITED(status))
1427 exit(WEXITSTATUS(status));
1430 } else { /* child */
1431 close(0); close(1); close(2);
1433 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1434 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1436 exit(3); /* Acquired ctty: broken */
1438 exit(0); /* Did not acquire ctty: OK */
1447 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1452 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1453 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1454 AC_MSG_CHECKING(if getaddrinfo seems to work)
1458 #include <sys/socket.h>
1461 #include <netinet/in.h>
1463 #define TEST_PORT "2222"
1469 struct addrinfo *gai_ai, *ai, hints;
1470 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1472 memset(&hints, 0, sizeof(hints));
1473 hints.ai_family = PF_UNSPEC;
1474 hints.ai_socktype = SOCK_STREAM;
1475 hints.ai_flags = AI_PASSIVE;
1477 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1479 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1483 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1484 if (ai->ai_family != AF_INET6)
1487 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1488 sizeof(ntop), strport, sizeof(strport),
1489 NI_NUMERICHOST|NI_NUMERICSERV);
1492 if (err == EAI_SYSTEM)
1493 perror("getnameinfo EAI_SYSTEM");
1495 fprintf(stderr, "getnameinfo failed: %s\n",
1500 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1503 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1516 AC_DEFINE(BROKEN_GETADDRINFO)
1521 if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1522 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1523 AC_MSG_CHECKING(if getaddrinfo seems to work)
1527 #include <sys/socket.h>
1530 #include <netinet/in.h>
1532 #define TEST_PORT "2222"
1538 struct addrinfo *gai_ai, *ai, hints;
1539 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1541 memset(&hints, 0, sizeof(hints));
1542 hints.ai_family = PF_UNSPEC;
1543 hints.ai_socktype = SOCK_STREAM;
1544 hints.ai_flags = AI_PASSIVE;
1546 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1548 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1552 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1553 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1556 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1557 sizeof(ntop), strport, sizeof(strport),
1558 NI_NUMERICHOST|NI_NUMERICSERV);
1560 if (ai->ai_family == AF_INET && err != 0) {
1561 perror("getnameinfo");
1570 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1571 [Define if you have a getaddrinfo that fails
1572 for the all-zeros IPv6 address])
1576 AC_DEFINE(BROKEN_GETADDRINFO)
1581 if test "x$check_for_conflicting_getspnam" = "x1"; then
1582 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1586 int main(void) {exit(0);}
1593 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1594 [Conflicting defs for getspnam])
1601 # Check for PAM libs
1604 [ --with-pam Enable PAM support ],
1606 if test "x$withval" != "xno" ; then
1607 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1608 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1609 AC_MSG_ERROR([PAM headers not found])
1612 AC_CHECK_LIB(dl, dlopen, , )
1613 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1614 AC_CHECK_FUNCS(pam_getenvlist)
1615 AC_CHECK_FUNCS(pam_putenv)
1619 AC_DEFINE(USE_PAM, 1,
1620 [Define if you want to enable PAM support])
1621 if test $ac_cv_lib_dl_dlopen = yes; then
1631 # Check for older PAM
1632 if test "x$PAM_MSG" = "xyes" ; then
1633 # Check PAM strerror arguments (old PAM)
1634 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1638 #if defined(HAVE_SECURITY_PAM_APPL_H)
1639 #include <security/pam_appl.h>
1640 #elif defined (HAVE_PAM_PAM_APPL_H)
1641 #include <pam/pam_appl.h>
1644 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1645 [AC_MSG_RESULT(no)],
1647 AC_DEFINE(HAVE_OLD_PAM, 1,
1648 [Define if you have an old version of PAM
1649 which takes only one argument to pam_strerror])
1651 PAM_MSG="yes (old library)"
1656 # Search for OpenSSL
1657 saved_CPPFLAGS="$CPPFLAGS"
1658 saved_LDFLAGS="$LDFLAGS"
1659 AC_ARG_WITH(ssl-dir,
1660 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1662 if test "x$withval" != "xno" ; then
1665 ./*|../*) withval="`pwd`/$withval"
1667 if test -d "$withval/lib"; then
1668 if test -n "${need_dash_r}"; then
1669 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1671 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1674 if test -n "${need_dash_r}"; then
1675 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1677 LDFLAGS="-L${withval} ${LDFLAGS}"
1680 if test -d "$withval/include"; then
1681 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1683 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1688 LIBS="-lcrypto $LIBS"
1689 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1690 [Define if your ssl headers are included
1691 with #include <openssl/header.h>]),
1693 dnl Check default openssl install dir
1694 if test -n "${need_dash_r}"; then
1695 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1697 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1699 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1700 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1702 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1708 # Determine OpenSSL header version
1709 AC_MSG_CHECKING([OpenSSL header version])
1714 #include <openssl/opensslv.h>
1715 #define DATA "conftest.sslincver"
1720 fd = fopen(DATA,"w");
1724 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1731 ssl_header_ver=`cat conftest.sslincver`
1732 AC_MSG_RESULT($ssl_header_ver)
1735 AC_MSG_RESULT(not found)
1736 AC_MSG_ERROR(OpenSSL version header not found.)
1739 AC_MSG_WARN([cross compiling: not checking])
1743 # Determine OpenSSL library version
1744 AC_MSG_CHECKING([OpenSSL library version])
1749 #include <openssl/opensslv.h>
1750 #include <openssl/crypto.h>
1751 #define DATA "conftest.ssllibver"
1756 fd = fopen(DATA,"w");
1760 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1767 ssl_library_ver=`cat conftest.ssllibver`
1768 AC_MSG_RESULT($ssl_library_ver)
1771 AC_MSG_RESULT(not found)
1772 AC_MSG_ERROR(OpenSSL library not found.)
1775 AC_MSG_WARN([cross compiling: not checking])
1779 # Sanity check OpenSSL headers
1780 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1784 #include <openssl/opensslv.h>
1785 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1792 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1793 Check config.log for details.
1794 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1797 AC_MSG_WARN([cross compiling: not checking])
1801 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1802 # because the system crypt() is more featureful.
1803 if test "x$check_for_libcrypt_before" = "x1"; then
1804 AC_CHECK_LIB(crypt, crypt)
1807 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1808 # version in OpenSSL.
1809 if test "x$check_for_libcrypt_later" = "x1"; then
1810 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1813 AC_CHECK_LIB(iaf, ia_openinfo)
1815 ### Configure cryptographic random number support
1817 # Check wheter OpenSSL seeds itself
1818 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1822 #include <openssl/rand.h>
1823 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1826 OPENSSL_SEEDS_ITSELF=yes
1831 # Default to use of the rand helper if OpenSSL doesn't
1836 AC_MSG_WARN([cross compiling: assuming yes])
1837 # This is safe, since all recent OpenSSL versions will
1838 # complain at runtime if not seeded correctly.
1839 OPENSSL_SEEDS_ITSELF=yes
1844 # Do we want to force the use of the rand helper?
1845 AC_ARG_WITH(rand-helper,
1846 [ --with-rand-helper Use subprocess to gather strong randomness ],
1848 if test "x$withval" = "xno" ; then
1849 # Force use of OpenSSL's internal RNG, even if
1850 # the previous test showed it to be unseeded.
1851 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1852 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1853 OPENSSL_SEEDS_ITSELF=yes
1862 # Which randomness source do we use?
1863 if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
1865 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1866 [Define if you want OpenSSL's internally seeded PRNG only])
1867 RAND_MSG="OpenSSL internal ONLY"
1868 INSTALL_SSH_RAND_HELPER=""
1869 elif test ! -z "$USE_RAND_HELPER" ; then
1870 # install rand helper
1871 RAND_MSG="ssh-rand-helper"
1872 INSTALL_SSH_RAND_HELPER="yes"
1874 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1876 ### Configuration of ssh-rand-helper
1879 AC_ARG_WITH(prngd-port,
1880 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1889 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1892 if test ! -z "$withval" ; then
1893 PRNGD_PORT="$withval"
1894 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1895 [Port number of PRNGD/EGD random number socket])
1900 # PRNGD Unix domain socket
1901 AC_ARG_WITH(prngd-socket,
1902 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1906 withval="/var/run/egd-pool"
1914 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1918 if test ! -z "$withval" ; then
1919 if test ! -z "$PRNGD_PORT" ; then
1920 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1922 if test ! -r "$withval" ; then
1923 AC_MSG_WARN(Entropy socket is not readable)
1925 PRNGD_SOCKET="$withval"
1926 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1927 [Location of PRNGD/EGD random number socket])
1931 # Check for existing socket only if we don't have a random device already
1932 if test "$USE_RAND_HELPER" = yes ; then
1933 AC_MSG_CHECKING(for PRNGD/EGD socket)
1934 # Insert other locations here
1935 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1936 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1937 PRNGD_SOCKET="$sock"
1938 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1942 if test ! -z "$PRNGD_SOCKET" ; then
1943 AC_MSG_RESULT($PRNGD_SOCKET)
1945 AC_MSG_RESULT(not found)
1951 # Change default command timeout for hashing entropy source
1953 AC_ARG_WITH(entropy-timeout,
1954 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1956 if test -n "$withval" && test "x$withval" != "xno" && \
1957 test "x${withval}" != "xyes"; then
1958 entropy_timeout=$withval
1962 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
1963 [Builtin PRNG command timeout])
1965 SSH_PRIVSEP_USER=sshd
1966 AC_ARG_WITH(privsep-user,
1967 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1969 if test -n "$withval" && test "x$withval" != "xno" && \
1970 test "x${withval}" != "xyes"; then
1971 SSH_PRIVSEP_USER=$withval
1975 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
1976 [non-privileged user for privilege separation])
1977 AC_SUBST(SSH_PRIVSEP_USER)
1979 # We do this little dance with the search path to insure
1980 # that programs that we select for use by installed programs
1981 # (which may be run by the super-user) come from trusted
1982 # locations before they come from the user's private area.
1983 # This should help avoid accidentally configuring some
1984 # random version of a program in someone's personal bin.
1988 test -h /bin 2> /dev/null && PATH=/usr/bin
1989 test -d /sbin && PATH=$PATH:/sbin
1990 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1991 PATH=$PATH:/etc:$OPATH
1993 # These programs are used by the command hashing source to gather entropy
1994 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1995 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1996 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1997 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1998 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1999 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2000 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2001 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2002 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2003 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2004 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2005 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2006 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2007 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2008 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2009 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
2013 # Where does ssh-rand-helper get its randomness from?
2014 INSTALL_SSH_PRNG_CMDS=""
2015 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2016 if test ! -z "$PRNGD_PORT" ; then
2017 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2018 elif test ! -z "$PRNGD_SOCKET" ; then
2019 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2021 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2022 RAND_HELPER_CMDHASH=yes
2023 INSTALL_SSH_PRNG_CMDS="yes"
2026 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2029 # Cheap hack to ensure NEWS-OS libraries are arranged right.
2030 if test ! -z "$SONY" ; then
2031 LIBS="$LIBS -liberty";
2034 # Checks for data types
2035 AC_CHECK_SIZEOF(char, 1)
2036 AC_CHECK_SIZEOF(short int, 2)
2037 AC_CHECK_SIZEOF(int, 4)
2038 AC_CHECK_SIZEOF(long int, 4)
2039 AC_CHECK_SIZEOF(long long int, 8)
2041 # Sanity check long long for some platforms (AIX)
2042 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2043 ac_cv_sizeof_long_long_int=0
2046 # More checks for data types
2047 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2049 [ #include <sys/types.h> ],
2051 [ ac_cv_have_u_int="yes" ],
2052 [ ac_cv_have_u_int="no" ]
2055 if test "x$ac_cv_have_u_int" = "xyes" ; then
2056 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
2060 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2062 [ #include <sys/types.h> ],
2063 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2064 [ ac_cv_have_intxx_t="yes" ],
2065 [ ac_cv_have_intxx_t="no" ]
2068 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2069 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
2073 if (test -z "$have_intxx_t" && \
2074 test "x$ac_cv_header_stdint_h" = "xyes")
2076 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2078 [ #include <stdint.h> ],
2079 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2081 AC_DEFINE(HAVE_INTXX_T)
2084 [ AC_MSG_RESULT(no) ]
2088 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2091 #include <sys/types.h>
2092 #ifdef HAVE_STDINT_H
2093 # include <stdint.h>
2095 #include <sys/socket.h>
2096 #ifdef HAVE_SYS_BITYPES_H
2097 # include <sys/bitypes.h>
2100 [ int64_t a; a = 1;],
2101 [ ac_cv_have_int64_t="yes" ],
2102 [ ac_cv_have_int64_t="no" ]
2105 if test "x$ac_cv_have_int64_t" = "xyes" ; then
2106 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
2109 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2111 [ #include <sys/types.h> ],
2112 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2113 [ ac_cv_have_u_intxx_t="yes" ],
2114 [ ac_cv_have_u_intxx_t="no" ]
2117 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2118 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
2122 if test -z "$have_u_intxx_t" ; then
2123 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2125 [ #include <sys/socket.h> ],
2126 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2128 AC_DEFINE(HAVE_U_INTXX_T)
2131 [ AC_MSG_RESULT(no) ]
2135 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2137 [ #include <sys/types.h> ],
2138 [ u_int64_t a; a = 1;],
2139 [ ac_cv_have_u_int64_t="yes" ],
2140 [ ac_cv_have_u_int64_t="no" ]
2143 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2144 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
2148 if test -z "$have_u_int64_t" ; then
2149 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2151 [ #include <sys/bitypes.h> ],
2152 [ u_int64_t a; a = 1],
2154 AC_DEFINE(HAVE_U_INT64_T)
2157 [ AC_MSG_RESULT(no) ]
2161 if test -z "$have_u_intxx_t" ; then
2162 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2165 #include <sys/types.h>
2167 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2168 [ ac_cv_have_uintxx_t="yes" ],
2169 [ ac_cv_have_uintxx_t="no" ]
2172 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2173 AC_DEFINE(HAVE_UINTXX_T, 1,
2174 [define if you have uintxx_t data type])
2178 if test -z "$have_uintxx_t" ; then
2179 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2181 [ #include <stdint.h> ],
2182 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2184 AC_DEFINE(HAVE_UINTXX_T)
2187 [ AC_MSG_RESULT(no) ]
2191 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2192 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2194 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2197 #include <sys/bitypes.h>
2200 int8_t a; int16_t b; int32_t c;
2201 u_int8_t e; u_int16_t f; u_int32_t g;
2202 a = b = c = e = f = g = 1;
2205 AC_DEFINE(HAVE_U_INTXX_T)
2206 AC_DEFINE(HAVE_INTXX_T)
2214 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2217 #include <sys/types.h>
2219 [ u_char foo; foo = 125; ],
2220 [ ac_cv_have_u_char="yes" ],
2221 [ ac_cv_have_u_char="no" ]
2224 if test "x$ac_cv_have_u_char" = "xyes" ; then
2225 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
2230 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2232 AC_CHECK_TYPES(in_addr_t,,,
2233 [#include <sys/types.h>
2234 #include <netinet/in.h>])
2236 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2239 #include <sys/types.h>
2241 [ size_t foo; foo = 1235; ],
2242 [ ac_cv_have_size_t="yes" ],
2243 [ ac_cv_have_size_t="no" ]
2246 if test "x$ac_cv_have_size_t" = "xyes" ; then
2247 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
2250 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2253 #include <sys/types.h>
2255 [ ssize_t foo; foo = 1235; ],
2256 [ ac_cv_have_ssize_t="yes" ],
2257 [ ac_cv_have_ssize_t="no" ]
2260 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2261 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
2264 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2269 [ clock_t foo; foo = 1235; ],
2270 [ ac_cv_have_clock_t="yes" ],
2271 [ ac_cv_have_clock_t="no" ]
2274 if test "x$ac_cv_have_clock_t" = "xyes" ; then
2275 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
2278 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2281 #include <sys/types.h>
2282 #include <sys/socket.h>
2284 [ sa_family_t foo; foo = 1235; ],
2285 [ ac_cv_have_sa_family_t="yes" ],
2288 #include <sys/types.h>
2289 #include <sys/socket.h>
2290 #include <netinet/in.h>
2292 [ sa_family_t foo; foo = 1235; ],
2293 [ ac_cv_have_sa_family_t="yes" ],
2295 [ ac_cv_have_sa_family_t="no" ]
2299 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2300 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2301 [define if you have sa_family_t data type])
2304 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2307 #include <sys/types.h>
2309 [ pid_t foo; foo = 1235; ],
2310 [ ac_cv_have_pid_t="yes" ],
2311 [ ac_cv_have_pid_t="no" ]
2314 if test "x$ac_cv_have_pid_t" = "xyes" ; then
2315 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
2318 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2321 #include <sys/types.h>
2323 [ mode_t foo; foo = 1235; ],
2324 [ ac_cv_have_mode_t="yes" ],
2325 [ ac_cv_have_mode_t="no" ]
2328 if test "x$ac_cv_have_mode_t" = "xyes" ; then
2329 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
2333 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2336 #include <sys/types.h>
2337 #include <sys/socket.h>
2339 [ struct sockaddr_storage s; ],
2340 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2341 [ ac_cv_have_struct_sockaddr_storage="no" ]
2344 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2345 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2346 [define if you have struct sockaddr_storage data type])
2349 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2352 #include <sys/types.h>
2353 #include <netinet/in.h>
2355 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2356 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2357 [ ac_cv_have_struct_sockaddr_in6="no" ]
2360 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2361 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2362 [define if you have struct sockaddr_in6 data type])
2365 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2368 #include <sys/types.h>
2369 #include <netinet/in.h>
2371 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2372 [ ac_cv_have_struct_in6_addr="yes" ],
2373 [ ac_cv_have_struct_in6_addr="no" ]
2376 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2377 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2378 [define if you have struct in6_addr data type])
2381 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2384 #include <sys/types.h>
2385 #include <sys/socket.h>
2388 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2389 [ ac_cv_have_struct_addrinfo="yes" ],
2390 [ ac_cv_have_struct_addrinfo="no" ]
2393 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2394 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2395 [define if you have struct addrinfo data type])
2398 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2400 [ #include <sys/time.h> ],
2401 [ struct timeval tv; tv.tv_sec = 1;],
2402 [ ac_cv_have_struct_timeval="yes" ],
2403 [ ac_cv_have_struct_timeval="no" ]
2406 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2407 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
2408 have_struct_timeval=1
2411 AC_CHECK_TYPES(struct timespec)
2413 # We need int64_t or else certian parts of the compile will fail.
2414 if test "x$ac_cv_have_int64_t" = "xno" && \
2415 test "x$ac_cv_sizeof_long_int" != "x8" && \
2416 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2417 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2418 echo "an alternative compiler (I.E., GCC) before continuing."
2422 dnl test snprintf (broken on SCO w/gcc)
2427 #ifdef HAVE_SNPRINTF
2431 char expected_out[50];
2433 #if (SIZEOF_LONG_INT == 8)
2434 long int num = 0x7fffffffffffffff;
2436 long long num = 0x7fffffffffffffffll;
2438 strcpy(expected_out, "9223372036854775807");
2439 snprintf(buf, mazsize, "%lld", num);
2440 if(strcmp(buf, expected_out) != 0)
2447 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2448 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2452 dnl Checks for structure members
2453 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2454 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2455 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2456 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2457 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2458 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2459 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2460 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2461 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2462 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2463 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2464 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2465 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2466 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2467 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2468 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2469 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2471 AC_CHECK_MEMBERS([struct stat.st_blksize])
2473 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2474 ac_cv_have_ss_family_in_struct_ss, [
2477 #include <sys/types.h>
2478 #include <sys/socket.h>
2480 [ struct sockaddr_storage s; s.ss_family = 1; ],
2481 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2482 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2485 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2486 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
2489 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2490 ac_cv_have___ss_family_in_struct_ss, [
2493 #include <sys/types.h>
2494 #include <sys/socket.h>
2496 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2497 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2498 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2501 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2502 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2503 [Fields in struct sockaddr_storage])
2506 AC_CACHE_CHECK([for pw_class field in struct passwd],
2507 ac_cv_have_pw_class_in_struct_passwd, [
2512 [ struct passwd p; p.pw_class = 0; ],
2513 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2514 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2517 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2518 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2519 [Define if your password has a pw_class field])
2522 AC_CACHE_CHECK([for pw_expire field in struct passwd],
2523 ac_cv_have_pw_expire_in_struct_passwd, [
2528 [ struct passwd p; p.pw_expire = 0; ],
2529 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2530 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2533 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2534 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2535 [Define if your password has a pw_expire field])
2538 AC_CACHE_CHECK([for pw_change field in struct passwd],
2539 ac_cv_have_pw_change_in_struct_passwd, [
2544 [ struct passwd p; p.pw_change = 0; ],
2545 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2546 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2549 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2550 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2551 [Define if your password has a pw_change field])
2554 dnl make sure we're using the real structure members and not defines
2555 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2556 ac_cv_have_accrights_in_msghdr, [
2559 #include <sys/types.h>
2560 #include <sys/socket.h>
2561 #include <sys/uio.h>
2563 #ifdef msg_accrights
2564 #error "msg_accrights is a macro"
2568 m.msg_accrights = 0;
2572 [ ac_cv_have_accrights_in_msghdr="yes" ],
2573 [ ac_cv_have_accrights_in_msghdr="no" ]
2576 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2577 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2578 [Define if your system uses access rights style
2579 file descriptor passing])
2582 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2583 ac_cv_have_control_in_msghdr, [
2586 #include <sys/types.h>
2587 #include <sys/socket.h>
2588 #include <sys/uio.h>
2591 #error "msg_control is a macro"
2599 [ ac_cv_have_control_in_msghdr="yes" ],
2600 [ ac_cv_have_control_in_msghdr="no" ]
2603 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2604 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2605 [Define if your system uses ancillary data style
2606 file descriptor passing])
2609 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2611 [ extern char *__progname; printf("%s", __progname); ],
2612 [ ac_cv_libc_defines___progname="yes" ],
2613 [ ac_cv_libc_defines___progname="no" ]
2616 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2617 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
2620 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2624 [ printf("%s", __FUNCTION__); ],
2625 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2626 [ ac_cv_cc_implements___FUNCTION__="no" ]
2629 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2630 AC_DEFINE(HAVE___FUNCTION__, 1,
2631 [Define if compiler implements __FUNCTION__])
2634 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2638 [ printf("%s", __func__); ],
2639 [ ac_cv_cc_implements___func__="yes" ],
2640 [ ac_cv_cc_implements___func__="no" ]
2643 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2644 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
2647 AC_CACHE_CHECK([whether getopt has optreset support],
2648 ac_cv_have_getopt_optreset, [
2653 [ extern int optreset; optreset = 0; ],
2654 [ ac_cv_have_getopt_optreset="yes" ],
2655 [ ac_cv_have_getopt_optreset="no" ]
2658 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2659 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2660 [Define if your getopt(3) defines and uses optreset])
2663 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2665 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2666 [ ac_cv_libc_defines_sys_errlist="yes" ],
2667 [ ac_cv_libc_defines_sys_errlist="no" ]
2670 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2671 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2672 [Define if your system defines sys_errlist[]])
2676 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2678 [ extern int sys_nerr; printf("%i", sys_nerr);],
2679 [ ac_cv_libc_defines_sys_nerr="yes" ],
2680 [ ac_cv_libc_defines_sys_nerr="no" ]
2683 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2684 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
2688 # Check whether user wants sectok support
2690 [ --with-sectok Enable smartcard support using libsectok],
2692 if test "x$withval" != "xno" ; then
2693 if test "x$withval" != "xyes" ; then
2694 CPPFLAGS="$CPPFLAGS -I${withval}"
2695 LDFLAGS="$LDFLAGS -L${withval}"
2696 if test ! -z "$need_dash_r" ; then
2697 LDFLAGS="$LDFLAGS -R${withval}"
2699 if test ! -z "$blibpath" ; then
2700 blibpath="$blibpath:${withval}"
2703 AC_CHECK_HEADERS(sectok.h)
2704 if test "$ac_cv_header_sectok_h" != yes; then
2705 AC_MSG_ERROR(Can't find sectok.h)
2707 AC_CHECK_LIB(sectok, sectok_open)
2708 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2709 AC_MSG_ERROR(Can't find libsectok)
2711 AC_DEFINE(SMARTCARD, 1,
2712 [Define if you want smartcard support])
2713 AC_DEFINE(USE_SECTOK, 1,
2714 [Define if you want smartcard support
2716 SCARD_MSG="yes, using sectok"
2721 # Check whether user wants OpenSC support
2724 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2726 if test "x$withval" != "xno" ; then
2727 if test "x$withval" != "xyes" ; then
2728 OPENSC_CONFIG=$withval/bin/opensc-config
2730 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2732 if test "$OPENSC_CONFIG" != "no"; then
2733 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2734 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2735 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2736 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2737 AC_DEFINE(SMARTCARD)
2738 AC_DEFINE(USE_OPENSC, 1,
2739 [Define if you want smartcard support
2741 SCARD_MSG="yes, using OpenSC"
2747 # Check libraries needed by DNS fingerprint support
2748 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2749 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2750 [Define if getrrsetbyname() exists])],
2752 # Needed by our getrrsetbyname()
2753 AC_SEARCH_LIBS(res_query, resolv)
2754 AC_SEARCH_LIBS(dn_expand, resolv)
2755 AC_MSG_CHECKING(if res_query will link)
2756 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2759 LIBS="$LIBS -lresolv"
2760 AC_MSG_CHECKING(for res_query in -lresolv)
2765 res_query (0, 0, 0, 0, 0);
2769 [LIBS="$LIBS -lresolv"
2770 AC_MSG_RESULT(yes)],
2774 AC_CHECK_FUNCS(_getshort _getlong)
2775 AC_CHECK_DECLS([_getshort, _getlong], , ,
2776 [#include <sys/types.h>
2777 #include <arpa/nameser.h>])
2778 AC_CHECK_MEMBER(HEADER.ad,
2779 [AC_DEFINE(HAVE_HEADER_AD, 1,
2780 [Define if HEADER.ad exists in arpa/nameser.h])],,
2781 [#include <arpa/nameser.h>])
2784 # Check whether user wants Kerberos 5 support
2786 AC_ARG_WITH(kerberos5,
2787 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2788 [ if test "x$withval" != "xno" ; then
2789 if test "x$withval" = "xyes" ; then
2790 KRB5ROOT="/usr/local"
2795 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
2798 AC_MSG_CHECKING(for krb5-config)
2799 if test -x $KRB5ROOT/bin/krb5-config ; then
2800 KRB5CONF=$KRB5ROOT/bin/krb5-config
2801 AC_MSG_RESULT($KRB5CONF)
2803 AC_MSG_CHECKING(for gssapi support)
2804 if $KRB5CONF | grep gssapi >/dev/null ; then
2806 AC_DEFINE(GSSAPI, 1,
2807 [Define this if you want GSSAPI
2808 support in the version 2 protocol])
2814 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2815 K5LIBS="`$KRB5CONF --libs $k5confopts`"
2816 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2817 AC_MSG_CHECKING(whether we are using Heimdal)
2818 AC_TRY_COMPILE([ #include <krb5.h> ],
2819 [ char *tmp = heimdal_version; ],
2820 [ AC_MSG_RESULT(yes)
2821 AC_DEFINE(HEIMDAL, 1,
2822 [Define this if you are using the
2823 Heimdal version of Kerberos V5]) ],
2828 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2829 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2830 AC_MSG_CHECKING(whether we are using Heimdal)
2831 AC_TRY_COMPILE([ #include <krb5.h> ],
2832 [ char *tmp = heimdal_version; ],
2833 [ AC_MSG_RESULT(yes)
2835 K5LIBS="-lkrb5 -ldes"
2836 K5LIBS="$K5LIBS -lcom_err -lasn1"
2837 AC_CHECK_LIB(roken, net_write,
2838 [K5LIBS="$K5LIBS -lroken"])
2841 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2844 AC_SEARCH_LIBS(dn_expand, resolv)
2846 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2848 K5LIBS="-lgssapi $K5LIBS" ],
2849 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2851 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2852 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2857 AC_CHECK_HEADER(gssapi.h, ,
2858 [ unset ac_cv_header_gssapi_h
2859 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2860 AC_CHECK_HEADERS(gssapi.h, ,
2861 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2867 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2868 AC_CHECK_HEADER(gssapi_krb5.h, ,
2869 [ CPPFLAGS="$oldCPP" ])
2872 if test ! -z "$need_dash_r" ; then
2873 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2875 if test ! -z "$blibpath" ; then
2876 blibpath="$blibpath:${KRB5ROOT}/lib"
2879 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2880 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2881 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2883 LIBS="$LIBS $K5LIBS"
2884 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
2885 [Define this if you want to use libkafs' AFS support]))
2890 # Looking for programs, paths and files
2892 PRIVSEP_PATH=/var/empty
2893 AC_ARG_WITH(privsep-path,
2894 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2896 if test -n "$withval" && test "x$withval" != "xno" && \
2897 test "x${withval}" != "xyes"; then
2898 PRIVSEP_PATH=$withval
2902 AC_SUBST(PRIVSEP_PATH)
2905 [ --with-xauth=PATH Specify path to xauth program ],
2907 if test -n "$withval" && test "x$withval" != "xno" && \
2908 test "x${withval}" != "xyes"; then
2914 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2915 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2916 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2917 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2918 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2919 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2920 xauth_path="/usr/openwin/bin/xauth"
2926 AC_ARG_ENABLE(strip,
2927 [ --disable-strip Disable calling strip(1) on install],
2929 if test "x$enableval" = "xno" ; then
2936 if test -z "$xauth_path" ; then
2937 XAUTH_PATH="undefined"
2938 AC_SUBST(XAUTH_PATH)
2940 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
2941 [Define if xauth is found in your path])
2942 XAUTH_PATH=$xauth_path
2943 AC_SUBST(XAUTH_PATH)
2946 # Check for mail directory (last resort if we cannot get it from headers)
2947 if test ! -z "$MAIL" ; then
2948 maildir=`dirname $MAIL`
2949 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
2950 [Set this to your mail directory if you don't have maillock.h])
2953 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
2954 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2955 disable_ptmx_check=yes
2957 if test -z "$no_dev_ptmx" ; then
2958 if test "x$disable_ptmx_check" != "xyes" ; then
2959 AC_CHECK_FILE("/dev/ptmx",
2961 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
2962 [Define if you have /dev/ptmx])
2969 if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
2970 AC_CHECK_FILE("/dev/ptc",
2972 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
2973 [Define if you have /dev/ptc])
2978 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2981 # Options from here on. Some of these are preset by platform above
2982 AC_ARG_WITH(mantype,
2983 [ --with-mantype=man|cat|doc Set man page type],
2990 AC_MSG_ERROR(invalid man type: $withval)
2995 if test -z "$MANTYPE"; then
2996 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2997 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2998 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3000 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3007 if test "$MANTYPE" = "doc"; then
3014 # Check whether to enable MD5 passwords
3016 AC_ARG_WITH(md5-passwords,
3017 [ --with-md5-passwords Enable use of MD5 passwords],
3019 if test "x$withval" != "xno" ; then
3020 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3021 [Define if you want to allow MD5 passwords])
3027 # Whether to disable shadow password support
3029 [ --without-shadow Disable shadow password support],
3031 if test "x$withval" = "xno" ; then
3032 AC_DEFINE(DISABLE_SHADOW)
3038 if test -z "$disable_shadow" ; then
3039 AC_MSG_CHECKING([if the systems has expire shadow information])
3042 #include <sys/types.h>
3045 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3046 [ sp_expire_available=yes ], []
3049 if test "x$sp_expire_available" = "xyes" ; then
3051 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3052 [Define if you want to use shadow password expire field])
3058 # Use ip address instead of hostname in $DISPLAY
3059 if test ! -z "$IPADDR_IN_DISPLAY" ; then
3060 DISPLAY_HACK_MSG="yes"
3061 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3062 [Define if you need to use IP address
3063 instead of hostname in $DISPLAY])
3065 DISPLAY_HACK_MSG="no"
3066 AC_ARG_WITH(ipaddr-display,
3067 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3069 if test "x$withval" != "xno" ; then
3070 AC_DEFINE(IPADDR_IN_DISPLAY)
3071 DISPLAY_HACK_MSG="yes"
3077 # check for /etc/default/login and use it if present.
3078 AC_ARG_ENABLE(etc-default-login,
3079 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3080 [ if test "x$enableval" = "xno"; then
3081 AC_MSG_NOTICE([/etc/default/login handling disabled])
3082 etc_default_login=no
3084 etc_default_login=yes
3086 [ etc_default_login=yes ]
3089 if test "x$etc_default_login" != "xno"; then
3090 AC_CHECK_FILE("/etc/default/login",
3091 [ external_path_file=/etc/default/login ])
3092 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3094 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
3095 elif test "x$external_path_file" = "x/etc/default/login"; then
3096 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3097 [Define if your system has /etc/default/login])
3101 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3102 if test $ac_cv_func_login_getcapbool = "yes" && \
3103 test $ac_cv_header_login_cap_h = "yes" ; then
3104 external_path_file=/etc/login.conf
3107 # Whether to mess with the default path
3108 SERVER_PATH_MSG="(default)"
3109 AC_ARG_WITH(default-path,
3110 [ --with-default-path= Specify default \$PATH environment for server],
3112 if test "x$external_path_file" = "x/etc/login.conf" ; then
3114 --with-default-path=PATH has no effect on this system.
3115 Edit /etc/login.conf instead.])
3116 elif test "x$withval" != "xno" ; then
3117 if test ! -z "$external_path_file" ; then
3119 --with-default-path=PATH will only be used if PATH is not defined in
3120 $external_path_file .])
3122 user_path="$withval"
3123 SERVER_PATH_MSG="$withval"
3126 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3127 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3129 if test ! -z "$external_path_file" ; then
3131 If PATH is defined in $external_path_file, ensure the path to scp is included,
3132 otherwise scp will not work.])
3136 /* find out what STDPATH is */
3141 #ifndef _PATH_STDPATH
3142 # ifdef _PATH_USERPATH /* Irix */
3143 # define _PATH_STDPATH _PATH_USERPATH
3145 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3148 #include <sys/types.h>
3149 #include <sys/stat.h>
3151 #define DATA "conftest.stdpath"
3158 fd = fopen(DATA,"w");
3162 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3167 ], [ user_path=`cat conftest.stdpath` ],
3168 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3169 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3171 # make sure $bindir is in USER_PATH so scp will work
3172 t_bindir=`eval echo ${bindir}`
3174 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3177 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3179 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3180 if test $? -ne 0 ; then
3181 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3182 if test $? -ne 0 ; then
3183 user_path=$user_path:$t_bindir
3184 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3189 if test "x$external_path_file" != "x/etc/login.conf" ; then
3190 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
3194 # Set superuser path separately to user path
3195 AC_ARG_WITH(superuser-path,
3196 [ --with-superuser-path= Specify different path for super-user],
3198 if test -n "$withval" && test "x$withval" != "xno" && \
3199 test "x${withval}" != "xyes"; then
3200 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3201 [Define if you want a different $PATH
3203 superuser_path=$withval
3209 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3210 IPV4_IN6_HACK_MSG="no"
3212 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3214 if test "x$withval" != "xno" ; then
3216 AC_DEFINE(IPV4_IN_IPV6, 1,
3217 [Detect IPv4 in IPv6 mapped addresses
3219 IPV4_IN6_HACK_MSG="yes"
3224 if test "x$inet6_default_4in6" = "xyes"; then
3225 AC_MSG_RESULT([yes (default)])
3226 AC_DEFINE(IPV4_IN_IPV6)
3227 IPV4_IN6_HACK_MSG="yes"
3229 AC_MSG_RESULT([no (default)])
3234 # Whether to enable BSD auth support
3236 AC_ARG_WITH(bsd-auth,
3237 [ --with-bsd-auth Enable BSD auth support],
3239 if test "x$withval" != "xno" ; then
3240 AC_DEFINE(BSD_AUTH, 1,
3241 [Define if you have BSD auth support])
3247 # Where to place sshd.pid
3249 # make sure the directory exists
3250 if test ! -d $piddir ; then
3251 piddir=`eval echo ${sysconfdir}`
3253 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3257 AC_ARG_WITH(pid-dir,
3258 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3260 if test -n "$withval" && test "x$withval" != "xno" && \
3261 test "x${withval}" != "xyes"; then
3263 if test ! -d $piddir ; then
3264 AC_MSG_WARN([** no $piddir directory on this system **])
3270 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
3273 dnl allow user to disable some login recording features
3274 AC_ARG_ENABLE(lastlog,
3275 [ --disable-lastlog disable use of lastlog even if detected [no]],
3277 if test "x$enableval" = "xno" ; then
3278 AC_DEFINE(DISABLE_LASTLOG)
3283 [ --disable-utmp disable use of utmp even if detected [no]],
3285 if test "x$enableval" = "xno" ; then
3286 AC_DEFINE(DISABLE_UTMP)
3290 AC_ARG_ENABLE(utmpx,
3291 [ --disable-utmpx disable use of utmpx even if detected [no]],
3293 if test "x$enableval" = "xno" ; then
3294 AC_DEFINE(DISABLE_UTMPX, 1,
3295 [Define if you don't want to use utmpx])
3300 [ --disable-wtmp disable use of wtmp even if detected [no]],
3302 if test "x$enableval" = "xno" ; then
3303 AC_DEFINE(DISABLE_WTMP)
3307 AC_ARG_ENABLE(wtmpx,
3308 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
3310 if test "x$enableval" = "xno" ; then
3311 AC_DEFINE(DISABLE_WTMPX, 1,
3312 [Define if you don't want to use wtmpx])
3316 AC_ARG_ENABLE(libutil,
3317 [ --disable-libutil disable use of libutil (login() etc.) [no]],
3319 if test "x$enableval" = "xno" ; then
3320 AC_DEFINE(DISABLE_LOGIN)
3324 AC_ARG_ENABLE(pututline,
3325 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
3327 if test "x$enableval" = "xno" ; then
3328 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3329 [Define if you don't want to use pututline()
3330 etc. to write [uw]tmp])
3334 AC_ARG_ENABLE(pututxline,
3335 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
3337 if test "x$enableval" = "xno" ; then
3338 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3339 [Define if you don't want to use pututxline()
3340 etc. to write [uw]tmpx])
3344 AC_ARG_WITH(lastlog,
3345 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
3347 if test "x$withval" = "xno" ; then
3348 AC_DEFINE(DISABLE_LASTLOG)
3349 elif test -n "$withval" && test "x${withval}" != "xyes"; then
3350 conf_lastlog_location=$withval
3355 dnl lastlog, [uw]tmpx? detection
3356 dnl NOTE: set the paths in the platform section to avoid the
3357 dnl need for command-line parameters
3358 dnl lastlog and [uw]tmp are subject to a file search if all else fails
3360 dnl lastlog detection
3361 dnl NOTE: the code itself will detect if lastlog is a directory
3362 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3364 #include <sys/types.h>
3366 #ifdef HAVE_LASTLOG_H
3367 # include <lastlog.h>
3376 [ char *lastlog = LASTLOG_FILE; ],
3377 [ AC_MSG_RESULT(yes) ],
3380 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3382 #include <sys/types.h>
3384 #ifdef HAVE_LASTLOG_H
3385 # include <lastlog.h>
3391 [ char *lastlog = _PATH_LASTLOG; ],
3392 [ AC_MSG_RESULT(yes) ],
3395 system_lastlog_path=no
3400 if test -z "$conf_lastlog_location"; then
3401 if test x"$system_lastlog_path" = x"no" ; then
3402 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3403 if (test -d "$f" || test -f "$f") ; then
3404 conf_lastlog_location=$f
3407 if test -z "$conf_lastlog_location"; then
3408 AC_MSG_WARN([** Cannot find lastlog **])
3409 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
3414 if test -n "$conf_lastlog_location"; then
3415 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3416 [Define if you want to specify the path to your lastlog file])
3420 AC_MSG_CHECKING([if your system defines UTMP_FILE])
3422 #include <sys/types.h>
3428 [ char *utmp = UTMP_FILE; ],
3429 [ AC_MSG_RESULT(yes) ],
3431 system_utmp_path=no ]
3433 if test -z "$conf_utmp_location"; then
3434 if test x"$system_utmp_path" = x"no" ; then
3435 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3436 if test -f $f ; then
3437 conf_utmp_location=$f
3440 if test -z "$conf_utmp_location"; then
3441 AC_DEFINE(DISABLE_UTMP)
3445 if test -n "$conf_utmp_location"; then
3446 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3447 [Define if you want to specify the path to your utmp file])
3451 AC_MSG_CHECKING([if your system defines WTMP_FILE])
3453 #include <sys/types.h>
3459 [ char *wtmp = WTMP_FILE; ],
3460 [ AC_MSG_RESULT(yes) ],
3462 system_wtmp_path=no ]
3464 if test -z "$conf_wtmp_location"; then
3465 if test x"$system_wtmp_path" = x"no" ; then
3466 for f in /usr/adm/wtmp /var/log/wtmp; do
3467 if test -f $f ; then
3468 conf_wtmp_location=$f
3471 if test -z "$conf_wtmp_location"; then
3472 AC_DEFINE(DISABLE_WTMP)
3476 if test -n "$conf_wtmp_location"; then
3477 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3478 [Define if you want to specify the path to your wtmp file])
3482 dnl utmpx detection - I don't know any system so perverse as to require
3483 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3485 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3487 #include <sys/types.h>
3496 [ char *utmpx = UTMPX_FILE; ],
3497 [ AC_MSG_RESULT(yes) ],
3499 system_utmpx_path=no ]
3501 if test -z "$conf_utmpx_location"; then
3502 if test x"$system_utmpx_path" = x"no" ; then
3503 AC_DEFINE(DISABLE_UTMPX)
3506 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3507 [Define if you want to specify the path to your utmpx file])
3511 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3513 #include <sys/types.h>
3522 [ char *wtmpx = WTMPX_FILE; ],
3523 [ AC_MSG_RESULT(yes) ],
3525 system_wtmpx_path=no ]
3527 if test -z "$conf_wtmpx_location"; then
3528 if test x"$system_wtmpx_path" = x"no" ; then
3529 AC_DEFINE(DISABLE_WTMPX)
3532 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3533 [Define if you want to specify the path to your wtmpx file])
3537 if test ! -z "$blibpath" ; then
3538 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3539 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3542 dnl remove pam and dl because they are in $LIBPAM
3543 if test "$PAM_MSG" = yes ; then
3544 LIBS=`echo $LIBS | sed 's/-lpam //'`
3546 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3547 LIBS=`echo $LIBS | sed 's/-ldl //'`
3550 dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3552 CFLAGS="$CFLAGS $werror_flags"
3555 AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3556 scard/Makefile ssh_prng_cmds survey.sh])
3559 # Print summary of options
3561 # Someone please show me a better way :)
3562 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3563 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3564 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3565 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3566 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3567 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3568 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
3569 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3570 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3571 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3574 echo "OpenSSH has been configured with the following options:"
3575 echo " User binaries: $B"
3576 echo " System binaries: $C"
3577 echo " Configuration files: $D"
3578 echo " Askpass program: $E"
3579 echo " Manual pages: $F"
3580 echo " PID file: $G"
3581 echo " Privilege separation chroot path: $H"
3582 if test "x$external_path_file" = "x/etc/login.conf" ; then
3583 echo " At runtime, sshd will use the path defined in $external_path_file"
3584 echo " Make sure the path to scp is present, otherwise scp will not work"
3586 echo " sshd default user PATH: $I"
3587 if test ! -z "$external_path_file"; then
3588 echo " (If PATH is set in $external_path_file it will be used instead. If"
3589 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3592 if test ! -z "$superuser_path" ; then
3593 echo " sshd superuser user PATH: $J"
3595 echo " Manpage format: $MANTYPE"
3596 echo " PAM support: $PAM_MSG"
3597 echo " KerberosV support: $KRB5_MSG"
3598 echo " Smartcard support: $SCARD_MSG"
3599 echo " S/KEY support: $SKEY_MSG"
3600 echo " TCP Wrappers support: $TCPW_MSG"
3601 echo " MD5 password support: $MD5_MSG"
3602 echo " libedit support: $LIBEDIT_MSG"
3603 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
3604 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3605 echo " BSD Auth support: $BSD_AUTH_MSG"
3606 echo " Random number source: $RAND_MSG"
3607 if test ! -z "$USE_RAND_HELPER" ; then
3608 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
3613 echo " Host: ${host}"
3614 echo " Compiler: ${CC}"
3615 echo " Compiler flags: ${CFLAGS}"
3616 echo "Preprocessor flags: ${CPPFLAGS}"
3617 echo " Linker flags: ${LDFLAGS}"
3618 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
3622 if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
3623 echo "SVR4 style packages are supported with \"make package\""
3627 if test "x$PAM_MSG" = "xyes" ; then
3628 echo "PAM is enabled. You may need to install a PAM control file "
3629 echo "for sshd, otherwise password authentication may fail. "
3630 echo "Example PAM control files can be found in the contrib/ "
3635 if test ! -z "$RAND_HELPER_CMDHASH" ; then
3636 echo "WARNING: you are using the builtin random number collection "
3637 echo "service. Please read WARNING.RNG and request that your OS "
3638 echo "vendor includes kernel-based random number collection in "
3639 echo "future versions of your OS."
3643 if test ! -z "$NO_PEERCHECK" ; then
3644 echo "WARNING: the operating system that you are using does not "
3645 echo "appear to support either the getpeereid() API nor the "
3646 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3647 echo "enforce security checks to prevent unauthorised connections to "
3648 echo "ssh-agent. Their absence increases the risk that a malicious "
3649 echo "user can connect to your agent. "
3653 if test "$AUDIT_MODULE" = "bsm" ; then
3654 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3655 echo "See the Solaris section in README.platform for details."