4 AC_CONFIG_SRCDIR([ssh.c])
6 AC_CONFIG_HEADER(config.h)
11 # Checks for programs.
17 AC_PATH_PROGS(PERL, perl5 perl)
18 AC_PATH_PROG(SED, sed)
20 AC_PATH_PROG(ENT, ent)
22 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
23 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
24 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
30 if test -z "$AR" ; then
31 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
34 # Use LOGIN_PROGRAM from environment if possible
35 if test ! -z "$LOGIN_PROGRAM" ; then
36 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
39 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
40 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
41 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
45 if test -z "$LD" ; then
51 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
52 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
55 # Check for some target-specific stuff
58 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
59 LDFLAGS="$LDFLAGS -L/usr/local/lib"
60 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
61 if (test -z "$blibpath"); then
62 blibpath="/usr/lib:/lib:/usr/local/lib"
64 saved_LDFLAGS="$LDFLAGS"
65 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
66 if (test -z "$blibflags"); then
67 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
68 AC_TRY_LINK([], [], [blibflags=$tryflags])
71 if (test -z "$blibflags"); then
72 AC_MSG_RESULT(not found)
73 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
75 AC_MSG_RESULT($blibflags)
77 LDFLAGS="$saved_LDFLAGS"
78 dnl Check for authenticate. Might be in libs.a on older AIXes
79 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
80 [AC_CHECK_LIB(s,authenticate,
81 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
85 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
86 AC_CHECK_DECL(loginfailed,
87 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
89 [#include <usersec.h>],
90 [(void)loginfailed("user","host","tty",0);],
92 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
96 [#include <usersec.h>]
98 AC_CHECK_FUNCS(setauthdb)
99 AC_DEFINE(BROKEN_GETADDRINFO)
100 AC_DEFINE(BROKEN_REALPATH)
101 AC_DEFINE(SETEUID_BREAKS_SETUID)
102 AC_DEFINE(BROKEN_SETREUID)
103 AC_DEFINE(BROKEN_SETREGID)
104 dnl AIX handles lastlog as part of its login message
105 AC_DEFINE(DISABLE_LASTLOG)
106 AC_DEFINE(LOGIN_NEEDS_UTMPX)
107 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
110 check_for_libcrypt_later=1
111 LIBS="$LIBS /usr/lib/textmode.o"
112 AC_DEFINE(HAVE_CYGWIN)
114 AC_DEFINE(DISABLE_SHADOW)
115 AC_DEFINE(IP_TOS_IS_BROKEN)
116 AC_DEFINE(NO_X11_UNIX_SOCKETS)
117 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
118 AC_DEFINE(DISABLE_FD_PASSING)
119 AC_DEFINE(SETGROUPS_NOOP)
122 AC_DEFINE(IP_TOS_IS_BROKEN)
125 AC_MSG_CHECKING(if we have working getaddrinfo)
126 AC_TRY_RUN([#include <mach-o/dyld.h>
127 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
131 }], [AC_MSG_RESULT(working)],
132 [AC_MSG_RESULT(buggy)
133 AC_DEFINE(BROKEN_GETADDRINFO)],
134 [AC_MSG_RESULT(assume it is working)])
135 AC_DEFINE(SETEUID_BREAKS_SETUID)
136 AC_DEFINE(BROKEN_SETREUID)
137 AC_DEFINE(BROKEN_SETREGID)
140 if test -z "$GCC"; then
143 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
144 IPADDR_IN_DISPLAY=yes
145 AC_DEFINE(HAVE_SECUREWARE)
147 AC_DEFINE(LOGIN_NO_ENDOPT)
148 AC_DEFINE(LOGIN_NEEDS_UTMPX)
149 AC_DEFINE(DISABLE_SHADOW)
150 AC_DEFINE(DISABLE_UTMP)
151 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
152 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
153 LIBS="$LIBS -lsec -lsecpw"
154 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
155 disable_ptmx_check=yes
158 if test -z "$GCC"; then
161 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
162 IPADDR_IN_DISPLAY=yes
164 AC_DEFINE(LOGIN_NO_ENDOPT)
165 AC_DEFINE(LOGIN_NEEDS_UTMPX)
166 AC_DEFINE(DISABLE_SHADOW)
167 AC_DEFINE(DISABLE_UTMP)
168 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
169 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
171 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
174 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
175 IPADDR_IN_DISPLAY=yes
176 AC_DEFINE(PAM_SUN_CODEBASE)
178 AC_DEFINE(LOGIN_NO_ENDOPT)
179 AC_DEFINE(LOGIN_NEEDS_UTMPX)
180 AC_DEFINE(DISABLE_SHADOW)
181 AC_DEFINE(DISABLE_UTMP)
182 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
183 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
185 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
188 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
190 PATH="$PATH:/usr/etc"
191 AC_DEFINE(BROKEN_INET_NTOA)
192 AC_DEFINE(WITH_ABBREV_NO_TTY)
193 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
196 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
198 PATH="$PATH:/usr/etc"
199 AC_DEFINE(WITH_IRIX_ARRAY)
200 AC_DEFINE(WITH_IRIX_PROJECT)
201 AC_DEFINE(WITH_IRIX_AUDIT)
202 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
203 AC_DEFINE(BROKEN_INET_NTOA)
204 AC_DEFINE(SETEUID_BREAKS_SETUID)
205 AC_DEFINE(BROKEN_SETREUID)
206 AC_DEFINE(BROKEN_SETREGID)
207 AC_DEFINE(WITH_ABBREV_NO_TTY)
208 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
212 check_for_libcrypt_later=1
213 check_for_openpty_ctty_bug=1
214 AC_DEFINE(DONT_TRY_OTHER_AF)
215 AC_DEFINE(PAM_TTY_KLUDGE)
216 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
217 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
218 inet6_default_4in6=yes
221 AC_DEFINE(BROKEN_CMSG_TYPE)
225 mips-sony-bsd|mips-sony-newsos4)
226 AC_DEFINE(HAVE_NEWS4)
230 check_for_libcrypt_before=1
234 check_for_libcrypt_later=1
237 AC_DEFINE(SETEUID_BREAKS_SETUID)
238 AC_DEFINE(BROKEN_SETREUID)
239 AC_DEFINE(BROKEN_SETREGID)
242 conf_lastlog_location="/usr/adm/lastlog"
243 conf_utmp_location=/etc/utmp
244 conf_wtmp_location=/usr/adm/wtmp
247 AC_DEFINE(BROKEN_REALPATH)
249 AC_DEFINE(BROKEN_SAVED_UIDS)
250 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
254 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
255 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
257 AC_DEFINE(PAM_SUN_CODEBASE)
258 AC_DEFINE(LOGIN_NEEDS_UTMPX)
259 AC_DEFINE(LOGIN_NEEDS_TERM)
260 AC_DEFINE(PAM_TTY_KLUDGE)
261 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
262 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
263 AC_DEFINE(SSHD_ACQUIRES_CTTY)
264 external_path_file=/etc/default/login
265 # hardwire lastlog location (can't detect it on some versions)
266 conf_lastlog_location="/var/adm/lastlog"
267 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
268 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
269 if test "$sol2ver" -ge 8; then
271 AC_DEFINE(DISABLE_UTMP)
272 AC_DEFINE(DISABLE_WTMP)
278 CPPFLAGS="$CPPFLAGS -DSUNOS4"
279 AC_CHECK_FUNCS(getpwanam)
280 AC_DEFINE(PAM_SUN_CODEBASE)
281 conf_utmp_location=/etc/utmp
282 conf_wtmp_location=/var/adm/wtmp
283 conf_lastlog_location=/var/adm/lastlog
287 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
288 LDFLAGS="$LDFLAGS -L/usr/local/lib"
291 AC_DEFINE(SSHD_ACQUIRES_CTTY)
292 AC_DEFINE(SETEUID_BREAKS_SETUID)
293 AC_DEFINE(BROKEN_SETREUID)
294 AC_DEFINE(BROKEN_SETREGID)
297 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
298 # /usr/ucblib MUST NOT be searched on ReliantUNIX
299 LDFLAGS="$LDFLAGS -L/usr/local/lib"
300 IPADDR_IN_DISPLAY=yes
302 AC_DEFINE(IP_TOS_IS_BROKEN)
303 AC_DEFINE(SSHD_ACQUIRES_CTTY)
304 external_path_file=/etc/default/login
305 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
306 # Attention: always take care to bind libsocket and libnsl before libc,
307 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
310 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
311 LDFLAGS="$LDFLAGS -L/usr/local/lib"
313 AC_DEFINE(SETEUID_BREAKS_SETUID)
314 AC_DEFINE(BROKEN_SETREUID)
315 AC_DEFINE(BROKEN_SETREGID)
318 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
319 LDFLAGS="$LDFLAGS -L/usr/local/lib"
321 AC_DEFINE(SETEUID_BREAKS_SETUID)
322 AC_DEFINE(BROKEN_SETREUID)
323 AC_DEFINE(BROKEN_SETREGID)
326 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
327 LDFLAGS="$LDFLAGS -L/usr/local/lib"
330 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
331 LDFLAGS="$LDFLAGS -L/usr/local/lib"
332 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
335 AC_DEFINE(BROKEN_SYS_TERMIO_H)
337 AC_DEFINE(HAVE_SECUREWARE)
338 AC_DEFINE(DISABLE_SHADOW)
339 AC_DEFINE(BROKEN_SAVED_UIDS)
340 AC_DEFINE(WITH_ABBREV_NO_TTY)
341 AC_CHECK_FUNCS(getluid setluid)
343 do_sco3_extra_lib_check=yes
346 if test -z "$GCC"; then
347 CFLAGS="$CFLAGS -belf"
349 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
350 LDFLAGS="$LDFLAGS -L/usr/local/lib"
351 LIBS="$LIBS -lprot -lx -ltinfo -lm"
354 AC_DEFINE(HAVE_SECUREWARE)
355 AC_DEFINE(DISABLE_SHADOW)
356 AC_DEFINE(DISABLE_FD_PASSING)
357 AC_DEFINE(SETEUID_BREAKS_SETUID)
358 AC_DEFINE(BROKEN_SETREUID)
359 AC_DEFINE(BROKEN_SETREGID)
360 AC_DEFINE(WITH_ABBREV_NO_TTY)
361 AC_CHECK_FUNCS(getluid setluid)
366 AC_DEFINE(DISABLE_FD_PASSING)
368 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
372 AC_DEFINE(WITH_ABBREV_NO_TTY)
374 AC_DEFINE(DISABLE_FD_PASSING)
376 LIBS="$LIBS -lgen -lacid"
381 AC_DEFINE(DISABLE_FD_PASSING)
382 AC_DEFINE(NO_SSH_LASTLOG)
383 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
384 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
388 AC_MSG_CHECKING(for Digital Unix SIA)
391 [ --with-osfsia Enable Digital Unix SIA],
393 if test "x$withval" = "xno" ; then
394 AC_MSG_RESULT(disabled)
399 if test -z "$no_osfsia" ; then
400 if test -f /etc/sia/matrix.conf; then
402 AC_DEFINE(HAVE_OSF_SIA)
403 AC_DEFINE(DISABLE_LOGIN)
404 AC_DEFINE(DISABLE_FD_PASSING)
405 LIBS="$LIBS -lsecurity -ldb -lm -laud"
410 AC_DEFINE(DISABLE_FD_PASSING)
411 AC_DEFINE(BROKEN_GETADDRINFO)
412 AC_DEFINE(SETEUID_BREAKS_SETUID)
413 AC_DEFINE(BROKEN_SETREUID)
414 AC_DEFINE(BROKEN_SETREGID)
415 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
420 AC_DEFINE(NO_X11_UNIX_SOCKETS)
421 AC_DEFINE(MISSING_NFDBITS)
422 AC_DEFINE(MISSING_HOWMANY)
423 AC_DEFINE(MISSING_FD_MASK)
427 # Allow user to specify flags
429 [ --with-cflags Specify additional flags to pass to compiler],
431 if test "x$withval" != "xno" ; then
432 CFLAGS="$CFLAGS $withval"
436 AC_ARG_WITH(cppflags,
437 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
439 if test "x$withval" != "xno"; then
440 CPPFLAGS="$CPPFLAGS $withval"
445 [ --with-ldflags Specify additional flags to pass to linker],
447 if test "x$withval" != "xno" ; then
448 LDFLAGS="$LDFLAGS $withval"
453 [ --with-libs Specify additional libraries to link with],
455 if test "x$withval" != "xno" ; then
456 LIBS="$LIBS $withval"
461 AC_MSG_CHECKING(compiler and flags for sanity)
466 [ AC_MSG_RESULT(yes) ],
469 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
473 # Checks for header files.
474 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
475 getopt.h glob.h ia.h lastlog.h limits.h login.h \
476 login_cap.h maillock.h netdb.h netgroup.h \
477 netinet/in_systm.h paths.h pty.h readpassphrase.h \
478 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
479 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
480 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
481 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
482 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
483 util.h utime.h utmp.h utmpx.h vis.h)
485 # Checks for libraries.
486 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
487 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
489 dnl SCO OS3 needs this for libwrap
490 if test "x$with_tcp_wrappers" != "xno" ; then
491 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
492 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
496 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
497 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
498 AC_CHECK_LIB(gen, dirname,[
499 AC_CACHE_CHECK([for broken dirname],
500 ac_cv_have_broken_dirname, [
508 int main(int argc, char **argv) {
511 strncpy(buf,"/etc", 32);
513 if (!s || strncmp(s, "/", 32) != 0) {
520 [ ac_cv_have_broken_dirname="no" ],
521 [ ac_cv_have_broken_dirname="yes" ]
525 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
527 AC_DEFINE(HAVE_DIRNAME)
528 AC_CHECK_HEADERS(libgen.h)
533 AC_CHECK_FUNC(getspnam, ,
534 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
535 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
538 [ --without-rpath Disable auto-added -R linker paths],
540 if test "x$withval" = "xno" ; then
543 if test "x$withval" = "xyes" ; then
551 [ --with-zlib=PATH Use zlib in PATH],
553 if test "x$withval" = "xno" ; then
554 AC_MSG_ERROR([*** zlib is required ***])
556 if test -d "$withval/lib"; then
557 if test -n "${need_dash_r}"; then
558 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
560 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
563 if test -n "${need_dash_r}"; then
564 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
566 LDFLAGS="-L${withval} ${LDFLAGS}"
569 if test -d "$withval/include"; then
570 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
572 CPPFLAGS="-I${withval} ${CPPFLAGS}"
577 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
580 AC_CHECK_FUNC(strcasecmp,
581 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
583 AC_CHECK_FUNC(utimes,
584 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
585 LIBS="$LIBS -lc89"]) ]
588 dnl Checks for libutil functions
589 AC_CHECK_HEADERS(libutil.h)
590 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
591 AC_CHECK_FUNCS(logout updwtmp logwtmp)
595 # Check for ALTDIRFUNC glob() extension
596 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
597 AC_EGREP_CPP(FOUNDIT,
600 #ifdef GLOB_ALTDIRFUNC
605 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
613 # Check for g.gl_matchc glob() extension
614 AC_MSG_CHECKING(for gl_matchc field in glob_t)
615 AC_EGREP_CPP(FOUNDIT,
618 int main(void){glob_t g; g.gl_matchc = 1;}
621 AC_DEFINE(GLOB_HAS_GL_MATCHC)
629 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
632 #include <sys/types.h>
634 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
636 [AC_MSG_RESULT(yes)],
639 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
643 # Check whether the user wants GSSAPI mechglue support
644 AC_ARG_WITH(mechglue,
645 [ --with-mechglue=PATH Build with GSSAPI mechglue library],
647 AC_MSG_CHECKING(for mechglue library)
649 if test -e ${withval}/libgssapi.a ; then
650 mechglue_lib=${withval}/libgssapi.a
651 elif test -e ${withval}/lib/libgssapi.a ; then
652 mechglue_lib=${withval}/lib/libgssapi.a
654 AC_MSG_ERROR("Can't find libgssapi in ${withval}");
656 LIBS="$LIBS ${mechglue_lib}"
657 AC_MSG_RESULT(${mechglue_lib})
659 AC_CHECK_LIB(dl, dlopen, , )
660 if test $ac_cv_lib_dl_dlopen = yes; then
661 LDFLAGS="$LDFLAGS -ldl -Wl,-Bsymbolic"
672 # Check whether the user wants GSI (Globus) support
675 [ --with-gsi=PATH Enable GSI/Globus authentication support],
682 [ --with-globus=PATH Enable GSI/Globus authentication support],
688 # Check whether the user has a Globus flavor type
689 globus_flavor_type="no"
690 AC_ARG_WITH(globus-flavor,
691 [ --with-globus-flavor=TYPE Describe Globus flavor type (ex: gcc32dbg, etc.)],
693 globus_flavor_type="$withval"
697 if test "x$gsi_path" != "xno" ; then
698 # Globus GSSAPI configuration
699 AC_MSG_CHECKING(for Globus GSI)
702 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
703 AC_MSG_ERROR([Previously configured GSSAPI library conflicts with Globus/GSI.])
705 if test -z "$GSSAPI"; then
710 if test "x$globus_install_dir" = "xyes" ; then
711 AC_MSG_ERROR(--with-globus=PATH must specify a path)
714 if test "x$globus_flavor_type" = "xno" ; then
715 AC_MSG_ERROR(--with-globus-flavor=TYPE must be specified)
717 if test "x$globus_flavor_type" = "xyes" ; then
718 AC_MSG_ERROR(--with-globus-flavor=TYPE must specify a flavor type)
721 GLOBUS_INCLUDE="${gsi_path}/include/${globus_flavor_type}"
722 if test ! -d "$GLOBUS_INCLUDE" ; then
723 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_INCLUDE})
725 GSI_CPPFLAGS="-I${GLOBUS_INCLUDE}"
727 if test -x ${gsi_path}/bin/globus-makefile-header ; then
728 GSI_LDFLAGS="-L${gsi_path}/lib"
729 GSI_LIBS=`${gsi_path}/bin/globus-makefile-header --flavor=${globus_flavor_type} globus_gss_assist | perl -n -e 'if (/GLOBUS_PKG_LIBS = (.*)/){print $1;}'`
730 elif test -x ${gsi_path}/sbin/globus-makefile-header ; then
731 GSI_LDFLAGS="-L${gsi_path}/lib"
732 GSI_LIBS=`${gsi_path}/sbin/globus-makefile-header --flavor=${globus_flavor_type} globus_gss_assist | perl -n -e 'if (/GLOBUS_PKG_LIBS = (.*)/){print $1;}'`
734 AC_MSG_ERROR(Cannot find globus-makefile-header: Globus installation is incomplete)
736 if test -z "$GSI_LIBS" ; then
737 AC_MSG_ERROR(globus-makefile-header failed)
740 LIBS="$LIBS $GSI_LIBS"
741 LDFLAGS="$LDFLAGS $GSI_LDFLAGS"
742 CPPFLAGS="$CPPFLAGS $GSI_CPPFLAGS"
744 # test that we got the libraries OK
752 AC_MSG_ERROR(link with Globus libraries failed)
759 AC_SUBST(INSTALL_GSISSH)
760 # End Globus/GSI section
762 # Check whether user wants S/Key support
765 [ --with-skey[[=PATH]] Enable S/Key support
766 (optionally in PATH)],
768 if test "x$withval" != "xno" ; then
770 if test "x$withval" != "xyes" ; then
771 CPPFLAGS="$CPPFLAGS -I${withval}/include"
772 LDFLAGS="$LDFLAGS -L${withval}/lib"
779 AC_MSG_CHECKING([for s/key support])
784 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
786 [AC_MSG_RESULT(yes)],
789 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
795 # Check whether user wants TCP wrappers support
797 AC_ARG_WITH(tcp-wrappers,
798 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
799 (optionally in PATH)],
801 if test "x$withval" != "xno" ; then
803 saved_LDFLAGS="$LDFLAGS"
804 saved_CPPFLAGS="$CPPFLAGS"
805 if test -n "${withval}" -a "${withval}" != "yes"; then
806 if test -d "${withval}/lib"; then
807 if test -n "${need_dash_r}"; then
808 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
810 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
813 if test -n "${need_dash_r}"; then
814 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
816 LDFLAGS="-L${withval} ${LDFLAGS}"
819 if test -d "${withval}/include"; then
820 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
822 CPPFLAGS="-I${withval} ${CPPFLAGS}"
826 LIBS="$LIBWRAP $LIBS"
827 AC_MSG_CHECKING(for libwrap)
831 int deny_severity = 0, allow_severity = 0;
841 AC_MSG_ERROR([*** libwrap missing])
849 dnl Checks for library functions. Please keep in alphabetical order
851 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
852 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
853 getaddrinfo getcwd getgrouplist getnameinfo getopt \
854 getpeereid _getpty getrlimit getttyent glob inet_aton \
855 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
856 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
857 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
858 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
859 setproctitle setregid setresgid setresuid setreuid setrlimit \
860 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
861 strlcat strlcpy strmode strnvis sysconf tcgetpgrp \
862 truncate utimes vhangup vsnprintf waitpid \
865 # IRIX has a const char return value for gai_strerror()
866 AC_CHECK_FUNCS(gai_strerror,[
867 AC_DEFINE(HAVE_GAI_STRERROR)
869 #include <sys/types.h>
870 #include <sys/socket.h>
873 const char *gai_strerror(int);],[
876 str = gai_strerror(0);],[
877 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
878 [Define if gai_strerror() returns const char *])])])
880 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
882 dnl Make sure prototypes are defined for these before using them.
883 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
884 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
886 dnl tcsendbreak might be a macro
887 AC_CHECK_DECL(tcsendbreak,
888 [AC_DEFINE(HAVE_TCSENDBREAK)],
889 [AC_CHECK_FUNCS(tcsendbreak)],
890 [#include <termios.h>]
893 dnl Checks for time functions
894 AC_CHECK_FUNCS(gettimeofday time)
895 dnl Checks for utmp functions
896 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
897 AC_CHECK_FUNCS(utmpname)
898 dnl Checks for utmpx functions
899 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
900 AC_CHECK_FUNCS(setutxent utmpxname)
902 AC_CHECK_FUNC(daemon,
903 [AC_DEFINE(HAVE_DAEMON)],
904 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
907 AC_CHECK_FUNC(getpagesize,
908 [AC_DEFINE(HAVE_GETPAGESIZE)],
909 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
912 # Check for broken snprintf
913 if test "x$ac_cv_func_snprintf" = "xyes" ; then
914 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
918 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
920 [AC_MSG_RESULT(yes)],
923 AC_DEFINE(BROKEN_SNPRINTF)
924 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
929 dnl see whether mkstemp() requires XXXXXX
930 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
931 AC_MSG_CHECKING([for (overly) strict mkstemp])
935 main() { char template[]="conftest.mkstemp-test";
936 if (mkstemp(template) == -1)
938 unlink(template); exit(0);
946 AC_DEFINE(HAVE_STRICT_MKSTEMP)
950 AC_DEFINE(HAVE_STRICT_MKSTEMP)
955 dnl make sure that openpty does not reacquire controlling terminal
956 if test ! -z "$check_for_openpty_ctty_bug"; then
957 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
961 #include <sys/fcntl.h>
962 #include <sys/types.h>
963 #include <sys/wait.h>
969 int fd, ptyfd, ttyfd, status;
972 if (pid < 0) { /* failed */
974 } else if (pid > 0) { /* parent */
975 waitpid(pid, &status, 0);
976 if (WIFEXITED(status))
977 exit(WEXITSTATUS(status));
981 close(0); close(1); close(2);
983 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
984 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
986 exit(3); /* Acquired ctty: broken */
988 exit(0); /* Did not acquire ctty: OK */
997 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1004 # Check for PAM libs
1007 [ --with-pam Enable PAM support ],
1009 if test "x$withval" != "xno" ; then
1010 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
1011 AC_MSG_ERROR([PAM headers not found])
1014 AC_CHECK_LIB(dl, dlopen, , )
1015 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1016 AC_CHECK_FUNCS(pam_getenvlist)
1017 AC_CHECK_FUNCS(pam_putenv)
1023 if test $ac_cv_lib_dl_dlopen = yes; then
1033 # Check for older PAM
1034 if test "x$PAM_MSG" = "xyes" ; then
1035 # Check PAM strerror arguments (old PAM)
1036 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1040 #include <security/pam_appl.h>
1042 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1043 [AC_MSG_RESULT(no)],
1045 AC_DEFINE(HAVE_OLD_PAM)
1047 PAM_MSG="yes (old library)"
1052 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1053 # because the system crypt() is more featureful.
1054 if test "x$check_for_libcrypt_before" = "x1"; then
1055 AC_CHECK_LIB(crypt, crypt)
1058 # Search for OpenSSL
1059 saved_CPPFLAGS="$CPPFLAGS"
1060 saved_LDFLAGS="$LDFLAGS"
1061 AC_ARG_WITH(ssl-dir,
1062 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1064 if test "x$withval" != "xno" ; then
1065 if test -d "$withval/lib"; then
1066 if test -n "${need_dash_r}"; then
1067 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1069 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1072 if test -n "${need_dash_r}"; then
1073 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1075 LDFLAGS="-L${withval} ${LDFLAGS}"
1078 if test -d "$withval/include"; then
1079 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1081 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1086 if test -z "$GSI_LIBS" ; then
1087 LIBS="$LIBS -lcrypto"
1089 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1091 dnl Check default openssl install dir
1092 if test -n "${need_dash_r}"; then
1093 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1095 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1097 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1098 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1100 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1106 # Determine OpenSSL header version
1107 AC_MSG_CHECKING([OpenSSL header version])
1112 #include <openssl/opensslv.h>
1113 #define DATA "conftest.sslincver"
1118 fd = fopen(DATA,"w");
1122 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1129 ssl_header_ver=`cat conftest.sslincver`
1130 AC_MSG_RESULT($ssl_header_ver)
1133 AC_MSG_RESULT(not found)
1134 AC_MSG_ERROR(OpenSSL version header not found.)
1138 # Determine OpenSSL library version
1139 AC_MSG_CHECKING([OpenSSL library version])
1144 #include <openssl/opensslv.h>
1145 #include <openssl/crypto.h>
1146 #define DATA "conftest.ssllibver"
1151 fd = fopen(DATA,"w");
1155 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1162 ssl_library_ver=`cat conftest.ssllibver`
1163 AC_MSG_RESULT($ssl_library_ver)
1166 AC_MSG_RESULT(not found)
1167 AC_MSG_ERROR(OpenSSL library not found.)
1171 # Sanity check OpenSSL headers
1172 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1176 #include <openssl/opensslv.h>
1177 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1184 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1185 Check config.log for details.
1186 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1190 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1191 # version in OpenSSL. Skip this for PAM
1192 if test "x$check_for_libcrypt_later" = "x1"; then
1193 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1197 ### Configure cryptographic random number support
1199 # Check wheter OpenSSL seeds itself
1200 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1204 #include <openssl/rand.h>
1205 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1208 OPENSSL_SEEDS_ITSELF=yes
1213 # Default to use of the rand helper if OpenSSL doesn't
1220 # Do we want to force the use of the rand helper?
1221 AC_ARG_WITH(rand-helper,
1222 [ --with-rand-helper Use subprocess to gather strong randomness ],
1224 if test "x$withval" = "xno" ; then
1225 # Force use of OpenSSL's internal RNG, even if
1226 # the previous test showed it to be unseeded.
1227 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1228 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1229 OPENSSL_SEEDS_ITSELF=yes
1238 # Which randomness source do we use?
1239 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1241 AC_DEFINE(OPENSSL_PRNG_ONLY)
1242 RAND_MSG="OpenSSL internal ONLY"
1243 INSTALL_SSH_RAND_HELPER=""
1244 elif test ! -z "$USE_RAND_HELPER" ; then
1245 # install rand helper
1246 RAND_MSG="ssh-rand-helper"
1247 INSTALL_SSH_RAND_HELPER="yes"
1249 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1251 ### Configuration of ssh-rand-helper
1254 AC_ARG_WITH(prngd-port,
1255 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1264 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1267 if test ! -z "$withval" ; then
1268 PRNGD_PORT="$withval"
1269 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1274 # PRNGD Unix domain socket
1275 AC_ARG_WITH(prngd-socket,
1276 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1280 withval="/var/run/egd-pool"
1288 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1292 if test ! -z "$withval" ; then
1293 if test ! -z "$PRNGD_PORT" ; then
1294 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1296 if test ! -r "$withval" ; then
1297 AC_MSG_WARN(Entropy socket is not readable)
1299 PRNGD_SOCKET="$withval"
1300 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1304 # Check for existing socket only if we don't have a random device already
1305 if test "$USE_RAND_HELPER" = yes ; then
1306 AC_MSG_CHECKING(for PRNGD/EGD socket)
1307 # Insert other locations here
1308 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1309 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1310 PRNGD_SOCKET="$sock"
1311 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1315 if test ! -z "$PRNGD_SOCKET" ; then
1316 AC_MSG_RESULT($PRNGD_SOCKET)
1318 AC_MSG_RESULT(not found)
1324 # Change default command timeout for hashing entropy source
1326 AC_ARG_WITH(entropy-timeout,
1327 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1329 if test "x$withval" != "xno" ; then
1330 entropy_timeout=$withval
1334 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1336 SSH_PRIVSEP_USER=sshd
1337 AC_ARG_WITH(privsep-user,
1338 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1340 if test -n "$withval"; then
1341 SSH_PRIVSEP_USER=$withval
1345 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1346 AC_SUBST(SSH_PRIVSEP_USER)
1348 # We do this little dance with the search path to insure
1349 # that programs that we select for use by installed programs
1350 # (which may be run by the super-user) come from trusted
1351 # locations before they come from the user's private area.
1352 # This should help avoid accidentally configuring some
1353 # random version of a program in someone's personal bin.
1357 test -h /bin 2> /dev/null && PATH=/usr/bin
1358 test -d /sbin && PATH=$PATH:/sbin
1359 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1360 PATH=$PATH:/etc:$OPATH
1362 # These programs are used by the command hashing source to gather entropy
1363 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1364 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1365 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1366 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1367 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1368 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1369 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1370 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1371 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1372 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1373 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1374 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1375 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1376 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1377 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1378 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1382 # Where does ssh-rand-helper get its randomness from?
1383 INSTALL_SSH_PRNG_CMDS=""
1384 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1385 if test ! -z "$PRNGD_PORT" ; then
1386 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1387 elif test ! -z "$PRNGD_SOCKET" ; then
1388 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1390 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1391 RAND_HELPER_CMDHASH=yes
1392 INSTALL_SSH_PRNG_CMDS="yes"
1395 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1398 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1399 if test ! -z "$SONY" ; then
1400 LIBS="$LIBS -liberty";
1403 # Checks for data types
1404 AC_CHECK_SIZEOF(char, 1)
1405 AC_CHECK_SIZEOF(short int, 2)
1406 AC_CHECK_SIZEOF(int, 4)
1407 AC_CHECK_SIZEOF(long int, 4)
1408 AC_CHECK_SIZEOF(long long int, 8)
1410 # Sanity check long long for some platforms (AIX)
1411 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1412 ac_cv_sizeof_long_long_int=0
1415 # More checks for data types
1416 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1418 [ #include <sys/types.h> ],
1420 [ ac_cv_have_u_int="yes" ],
1421 [ ac_cv_have_u_int="no" ]
1424 if test "x$ac_cv_have_u_int" = "xyes" ; then
1425 AC_DEFINE(HAVE_U_INT)
1429 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1431 [ #include <sys/types.h> ],
1432 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1433 [ ac_cv_have_intxx_t="yes" ],
1434 [ ac_cv_have_intxx_t="no" ]
1437 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1438 AC_DEFINE(HAVE_INTXX_T)
1442 if (test -z "$have_intxx_t" && \
1443 test "x$ac_cv_header_stdint_h" = "xyes")
1445 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1447 [ #include <stdint.h> ],
1448 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1450 AC_DEFINE(HAVE_INTXX_T)
1453 [ AC_MSG_RESULT(no) ]
1457 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1460 #include <sys/types.h>
1461 #ifdef HAVE_STDINT_H
1462 # include <stdint.h>
1464 #include <sys/socket.h>
1465 #ifdef HAVE_SYS_BITYPES_H
1466 # include <sys/bitypes.h>
1469 [ int64_t a; a = 1;],
1470 [ ac_cv_have_int64_t="yes" ],
1471 [ ac_cv_have_int64_t="no" ]
1474 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1475 AC_DEFINE(HAVE_INT64_T)
1478 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1480 [ #include <sys/types.h> ],
1481 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1482 [ ac_cv_have_u_intxx_t="yes" ],
1483 [ ac_cv_have_u_intxx_t="no" ]
1486 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1487 AC_DEFINE(HAVE_U_INTXX_T)
1491 if test -z "$have_u_intxx_t" ; then
1492 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1494 [ #include <sys/socket.h> ],
1495 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1497 AC_DEFINE(HAVE_U_INTXX_T)
1500 [ AC_MSG_RESULT(no) ]
1504 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1506 [ #include <sys/types.h> ],
1507 [ u_int64_t a; a = 1;],
1508 [ ac_cv_have_u_int64_t="yes" ],
1509 [ ac_cv_have_u_int64_t="no" ]
1512 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1513 AC_DEFINE(HAVE_U_INT64_T)
1517 if test -z "$have_u_int64_t" ; then
1518 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1520 [ #include <sys/bitypes.h> ],
1521 [ u_int64_t a; a = 1],
1523 AC_DEFINE(HAVE_U_INT64_T)
1526 [ AC_MSG_RESULT(no) ]
1530 if test -z "$have_u_intxx_t" ; then
1531 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1534 #include <sys/types.h>
1536 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1537 [ ac_cv_have_uintxx_t="yes" ],
1538 [ ac_cv_have_uintxx_t="no" ]
1541 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1542 AC_DEFINE(HAVE_UINTXX_T)
1546 if test -z "$have_uintxx_t" ; then
1547 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1549 [ #include <stdint.h> ],
1550 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1552 AC_DEFINE(HAVE_UINTXX_T)
1555 [ AC_MSG_RESULT(no) ]
1559 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1560 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1562 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1565 #include <sys/bitypes.h>
1568 int8_t a; int16_t b; int32_t c;
1569 u_int8_t e; u_int16_t f; u_int32_t g;
1570 a = b = c = e = f = g = 1;
1573 AC_DEFINE(HAVE_U_INTXX_T)
1574 AC_DEFINE(HAVE_INTXX_T)
1582 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1585 #include <sys/types.h>
1587 [ u_char foo; foo = 125; ],
1588 [ ac_cv_have_u_char="yes" ],
1589 [ ac_cv_have_u_char="no" ]
1592 if test "x$ac_cv_have_u_char" = "xyes" ; then
1593 AC_DEFINE(HAVE_U_CHAR)
1598 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1600 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1603 #include <sys/types.h>
1605 [ size_t foo; foo = 1235; ],
1606 [ ac_cv_have_size_t="yes" ],
1607 [ ac_cv_have_size_t="no" ]
1610 if test "x$ac_cv_have_size_t" = "xyes" ; then
1611 AC_DEFINE(HAVE_SIZE_T)
1614 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1617 #include <sys/types.h>
1619 [ ssize_t foo; foo = 1235; ],
1620 [ ac_cv_have_ssize_t="yes" ],
1621 [ ac_cv_have_ssize_t="no" ]
1624 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1625 AC_DEFINE(HAVE_SSIZE_T)
1628 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1633 [ clock_t foo; foo = 1235; ],
1634 [ ac_cv_have_clock_t="yes" ],
1635 [ ac_cv_have_clock_t="no" ]
1638 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1639 AC_DEFINE(HAVE_CLOCK_T)
1642 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1645 #include <sys/types.h>
1646 #include <sys/socket.h>
1648 [ sa_family_t foo; foo = 1235; ],
1649 [ ac_cv_have_sa_family_t="yes" ],
1652 #include <sys/types.h>
1653 #include <sys/socket.h>
1654 #include <netinet/in.h>
1656 [ sa_family_t foo; foo = 1235; ],
1657 [ ac_cv_have_sa_family_t="yes" ],
1659 [ ac_cv_have_sa_family_t="no" ]
1663 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1664 AC_DEFINE(HAVE_SA_FAMILY_T)
1667 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1670 #include <sys/types.h>
1672 [ pid_t foo; foo = 1235; ],
1673 [ ac_cv_have_pid_t="yes" ],
1674 [ ac_cv_have_pid_t="no" ]
1677 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1678 AC_DEFINE(HAVE_PID_T)
1681 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1684 #include <sys/types.h>
1686 [ mode_t foo; foo = 1235; ],
1687 [ ac_cv_have_mode_t="yes" ],
1688 [ ac_cv_have_mode_t="no" ]
1691 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1692 AC_DEFINE(HAVE_MODE_T)
1696 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1699 #include <sys/types.h>
1700 #include <sys/socket.h>
1702 [ struct sockaddr_storage s; ],
1703 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1704 [ ac_cv_have_struct_sockaddr_storage="no" ]
1707 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1708 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1711 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1714 #include <sys/types.h>
1715 #include <netinet/in.h>
1717 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1718 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1719 [ ac_cv_have_struct_sockaddr_in6="no" ]
1722 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1723 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1726 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1729 #include <sys/types.h>
1730 #include <netinet/in.h>
1732 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1733 [ ac_cv_have_struct_in6_addr="yes" ],
1734 [ ac_cv_have_struct_in6_addr="no" ]
1737 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1738 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1741 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1744 #include <sys/types.h>
1745 #include <sys/socket.h>
1748 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1749 [ ac_cv_have_struct_addrinfo="yes" ],
1750 [ ac_cv_have_struct_addrinfo="no" ]
1753 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1754 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1757 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1759 [ #include <sys/time.h> ],
1760 [ struct timeval tv; tv.tv_sec = 1;],
1761 [ ac_cv_have_struct_timeval="yes" ],
1762 [ ac_cv_have_struct_timeval="no" ]
1765 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1766 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1767 have_struct_timeval=1
1770 AC_CHECK_TYPES(struct timespec)
1772 # We need int64_t or else certian parts of the compile will fail.
1773 if test "x$ac_cv_have_int64_t" = "xno" -a \
1774 "x$ac_cv_sizeof_long_int" != "x8" -a \
1775 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1776 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1777 echo "an alternative compiler (I.E., GCC) before continuing."
1781 dnl test snprintf (broken on SCO w/gcc)
1786 #ifdef HAVE_SNPRINTF
1790 char expected_out[50];
1792 #if (SIZEOF_LONG_INT == 8)
1793 long int num = 0x7fffffffffffffff;
1795 long long num = 0x7fffffffffffffffll;
1797 strcpy(expected_out, "9223372036854775807");
1798 snprintf(buf, mazsize, "%lld", num);
1799 if(strcmp(buf, expected_out) != 0)
1806 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1810 dnl Checks for structure members
1811 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1812 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1813 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1814 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1815 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1816 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1817 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1818 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1819 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1820 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1821 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1822 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1823 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1824 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1825 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1826 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1827 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1829 AC_CHECK_MEMBERS([struct stat.st_blksize])
1831 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1832 ac_cv_have_ss_family_in_struct_ss, [
1835 #include <sys/types.h>
1836 #include <sys/socket.h>
1838 [ struct sockaddr_storage s; s.ss_family = 1; ],
1839 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1840 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1843 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1844 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1847 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1848 ac_cv_have___ss_family_in_struct_ss, [
1851 #include <sys/types.h>
1852 #include <sys/socket.h>
1854 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1855 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1856 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1859 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1860 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1863 AC_CACHE_CHECK([for pw_class field in struct passwd],
1864 ac_cv_have_pw_class_in_struct_passwd, [
1869 [ struct passwd p; p.pw_class = 0; ],
1870 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1871 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1874 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1875 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1878 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1879 ac_cv_have_pw_expire_in_struct_passwd, [
1884 [ struct passwd p; p.pw_expire = 0; ],
1885 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1886 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1889 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1890 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1893 AC_CACHE_CHECK([for pw_change field in struct passwd],
1894 ac_cv_have_pw_change_in_struct_passwd, [
1899 [ struct passwd p; p.pw_change = 0; ],
1900 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1901 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1904 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1905 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1908 dnl make sure we're using the real structure members and not defines
1909 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1910 ac_cv_have_accrights_in_msghdr, [
1913 #include <sys/types.h>
1914 #include <sys/socket.h>
1915 #include <sys/uio.h>
1917 #ifdef msg_accrights
1921 m.msg_accrights = 0;
1925 [ ac_cv_have_accrights_in_msghdr="yes" ],
1926 [ ac_cv_have_accrights_in_msghdr="no" ]
1929 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1930 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1933 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1934 ac_cv_have_control_in_msghdr, [
1937 #include <sys/types.h>
1938 #include <sys/socket.h>
1939 #include <sys/uio.h>
1949 [ ac_cv_have_control_in_msghdr="yes" ],
1950 [ ac_cv_have_control_in_msghdr="no" ]
1953 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1954 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1957 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1959 [ extern char *__progname; printf("%s", __progname); ],
1960 [ ac_cv_libc_defines___progname="yes" ],
1961 [ ac_cv_libc_defines___progname="no" ]
1964 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1965 AC_DEFINE(HAVE___PROGNAME)
1968 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1972 [ printf("%s", __FUNCTION__); ],
1973 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1974 [ ac_cv_cc_implements___FUNCTION__="no" ]
1977 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1978 AC_DEFINE(HAVE___FUNCTION__)
1981 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1985 [ printf("%s", __func__); ],
1986 [ ac_cv_cc_implements___func__="yes" ],
1987 [ ac_cv_cc_implements___func__="no" ]
1990 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1991 AC_DEFINE(HAVE___func__)
1994 AC_CACHE_CHECK([whether getopt has optreset support],
1995 ac_cv_have_getopt_optreset, [
2000 [ extern int optreset; optreset = 0; ],
2001 [ ac_cv_have_getopt_optreset="yes" ],
2002 [ ac_cv_have_getopt_optreset="no" ]
2005 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2006 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2009 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2011 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2012 [ ac_cv_libc_defines_sys_errlist="yes" ],
2013 [ ac_cv_libc_defines_sys_errlist="no" ]
2016 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2017 AC_DEFINE(HAVE_SYS_ERRLIST)
2021 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2023 [ extern int sys_nerr; printf("%i", sys_nerr);],
2024 [ ac_cv_libc_defines_sys_nerr="yes" ],
2025 [ ac_cv_libc_defines_sys_nerr="no" ]
2028 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2029 AC_DEFINE(HAVE_SYS_NERR)
2033 # Check whether user wants sectok support
2035 [ --with-sectok Enable smartcard support using libsectok],
2037 if test "x$withval" != "xno" ; then
2038 if test "x$withval" != "xyes" ; then
2039 CPPFLAGS="$CPPFLAGS -I${withval}"
2040 LDFLAGS="$LDFLAGS -L${withval}"
2041 if test ! -z "$need_dash_r" ; then
2042 LDFLAGS="$LDFLAGS -R${withval}"
2044 if test ! -z "$blibpath" ; then
2045 blibpath="$blibpath:${withval}"
2048 AC_CHECK_HEADERS(sectok.h)
2049 if test "$ac_cv_header_sectok_h" != yes; then
2050 AC_MSG_ERROR(Can't find sectok.h)
2052 AC_CHECK_LIB(sectok, sectok_open)
2053 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2054 AC_MSG_ERROR(Can't find libsectok)
2056 AC_DEFINE(SMARTCARD)
2057 AC_DEFINE(USE_SECTOK)
2058 SCARD_MSG="yes, using sectok"
2063 # Check whether user wants OpenSC support
2065 AC_HELP_STRING([--with-opensc=PFX],
2066 [Enable smartcard support using OpenSC]),
2067 opensc_config_prefix="$withval", opensc_config_prefix="")
2068 if test x$opensc_config_prefix != x ; then
2069 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2070 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2071 if test "$OPENSC_CONFIG" != "no"; then
2072 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2073 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2074 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2075 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2076 AC_DEFINE(SMARTCARD)
2077 AC_DEFINE(USE_OPENSC)
2078 SCARD_MSG="yes, using OpenSC"
2082 # Check whether user wants DNS support
2085 [ --with-dns Support for fetching keys from DNS (experimental)],
2087 if test "x$withval" != "xno" ; then
2090 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2091 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
2093 # Needed by our getrrsetbyname()
2094 AC_SEARCH_LIBS(res_query, resolv)
2095 AC_SEARCH_LIBS(dn_expand, resolv)
2096 AC_CHECK_FUNCS(_getshort _getlong)
2097 AC_CHECK_MEMBER(HEADER.ad,
2098 [AC_DEFINE(HAVE_HEADER_AD)],,
2099 [#include <arpa/nameser.h>])
2105 # Check whether user wants Kerberos 5 support
2107 AC_ARG_WITH(kerberos5,
2108 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2110 if test "x$withval" != "xno" ; then
2111 if test "x$withval" = "xyes" ; then
2112 KRB5ROOT="/usr/local"
2116 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2117 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2120 AC_MSG_CHECKING(whether we are using Heimdal)
2121 AC_TRY_COMPILE([ #include <krb5.h> ],
2122 [ char *tmp = heimdal_version; ],
2123 [ AC_MSG_RESULT(yes)
2125 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2128 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2131 if test ! -z "$need_dash_r" ; then
2132 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2134 if test ! -z "$blibpath" ; then
2135 blibpath="$blibpath:${KRB5ROOT}/lib"
2137 AC_SEARCH_LIBS(dn_expand, resolv)
2139 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2141 K5LIBS="-lgssapi $K5LIBS" ],
2142 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2144 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2145 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2150 AC_CHECK_HEADER(gssapi.h, ,
2151 [ unset ac_cv_header_gssapi_h
2152 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2153 AC_CHECK_HEADERS(gssapi.h, ,
2154 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2160 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2161 AC_CHECK_HEADER(gssapi_krb5.h, ,
2162 [ CPPFLAGS="$oldCPP" ])
2164 # If we're using some other GSSAPI
2165 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
2166 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
2168 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2170 K5LIBS="-lgssapi $K5LIBS" ],
2171 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2173 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2174 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2179 AC_CHECK_HEADER(gssapi.h, ,
2180 [ unset ac_cv_header_gssapi_h
2181 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2182 AC_CHECK_HEADERS(gssapi.h, ,
2183 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2188 AC_CHECK_LIB(gssapi, gss_krb5_copy_ccache, /bin/true,
2189 [ K5LIBS="-lgssapi_krb5 $K5LIBS"
2190 AC_CHECK_LIB(gssapi_krb5, gss_krb5_copy_ccache, /bin/true,
2191 AC_MSG_WARN([Cannot find gss_krb5_copy_ccache -- build may fail]),
2197 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2198 AC_CHECK_HEADER(gssapi_krb5.h, ,
2199 [ CPPFLAGS="$oldCPP" ])
2201 if test -z "$GSSAPI"; then
2210 # Check whether user wants AFS_KRB5 support
2212 AC_ARG_WITH(afs-krb5,
2213 [ --with-afs-krb5[[=AKLOG_PATH]] Enable aklog to get token (default=/usr/bin/aklog).],
2215 if test "x$withval" != "xno" ; then
2217 if test "x$withval" != "xyes" ; then
2218 AC_DEFINE_UNQUOTED(AKLOG_PATH, "$withval")
2220 AC_DEFINE_UNQUOTED(AKLOG_PATH, "/usr/bin/aklog")
2223 if test -z "$KRB5" ; then
2224 AC_MSG_WARN([AFS_KRB5 requires Kerberos 5 support, build may fail])
2227 LIBS="-lkrbafs $LIBS"
2228 if test ! -z "$AFS_LIBS" ; then
2229 LIBS="$LIBS $AFS_LIBS"
2236 LIBS="$LIBS $K5LIBS"
2238 AC_ARG_WITH(session-hooks,
2239 [ --with-session-hooks Enable hooks for executing external commands before/after a session],
2240 [ AC_DEFINE(SESSION_HOOKS) ]
2243 # Looking for programs, paths and files
2245 PRIVSEP_PATH=/var/empty
2246 AC_ARG_WITH(privsep-path,
2247 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2249 if test "x$withval" != "$no" ; then
2250 PRIVSEP_PATH=$withval
2254 AC_SUBST(PRIVSEP_PATH)
2257 [ --with-xauth=PATH Specify path to xauth program ],
2259 if test "x$withval" != "xno" ; then
2265 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2266 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2267 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2268 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2269 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2270 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2271 xauth_path="/usr/openwin/bin/xauth"
2277 AC_ARG_ENABLE(strip,
2278 [ --disable-strip Disable calling strip(1) on install],
2280 if test "x$enableval" = "xno" ; then
2287 if test -z "$xauth_path" ; then
2288 XAUTH_PATH="undefined"
2289 AC_SUBST(XAUTH_PATH)
2291 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2292 XAUTH_PATH=$xauth_path
2293 AC_SUBST(XAUTH_PATH)
2296 # Check for mail directory (last resort if we cannot get it from headers)
2297 if test ! -z "$MAIL" ; then
2298 maildir=`dirname $MAIL`
2299 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2302 if test -z "$no_dev_ptmx" ; then
2303 if test "x$disable_ptmx_check" != "xyes" ; then
2304 AC_CHECK_FILE("/dev/ptmx",
2306 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2312 AC_CHECK_FILE("/dev/ptc",
2314 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2319 # Options from here on. Some of these are preset by platform above
2320 AC_ARG_WITH(mantype,
2321 [ --with-mantype=man|cat|doc Set man page type],
2328 AC_MSG_ERROR(invalid man type: $withval)
2333 if test -z "$MANTYPE"; then
2334 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2335 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2336 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2338 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2345 if test "$MANTYPE" = "doc"; then
2352 # Check whether to enable MD5 passwords
2354 AC_ARG_WITH(md5-passwords,
2355 [ --with-md5-passwords Enable use of MD5 passwords],
2357 if test "x$withval" != "xno" ; then
2358 AC_DEFINE(HAVE_MD5_PASSWORDS)
2364 # Whether to disable shadow password support
2366 [ --without-shadow Disable shadow password support],
2368 if test "x$withval" = "xno" ; then
2369 AC_DEFINE(DISABLE_SHADOW)
2375 if test -z "$disable_shadow" ; then
2376 AC_MSG_CHECKING([if the systems has expire shadow information])
2379 #include <sys/types.h>
2382 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2383 [ sp_expire_available=yes ], []
2386 if test "x$sp_expire_available" = "xyes" ; then
2388 AC_DEFINE(HAS_SHADOW_EXPIRE)
2394 # Use ip address instead of hostname in $DISPLAY
2395 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2396 DISPLAY_HACK_MSG="yes"
2397 AC_DEFINE(IPADDR_IN_DISPLAY)
2399 DISPLAY_HACK_MSG="no"
2400 AC_ARG_WITH(ipaddr-display,
2401 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2403 if test "x$withval" != "xno" ; then
2404 AC_DEFINE(IPADDR_IN_DISPLAY)
2405 DISPLAY_HACK_MSG="yes"
2411 # check for /etc/default/login and use it if present.
2412 AC_ARG_ENABLE(etc-default-login,
2413 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2415 AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2417 if test "x$external_path_file" = "x/etc/default/login"; then
2418 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2422 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2423 if test $ac_cv_func_login_getcapbool = "yes" -a \
2424 $ac_cv_header_login_cap_h = "yes" ; then
2425 external_path_file=/etc/login.conf
2428 # Whether to mess with the default path
2429 SERVER_PATH_MSG="(default)"
2430 AC_ARG_WITH(default-path,
2431 [ --with-default-path= Specify default \$PATH environment for server],
2433 if test "x$external_path_file" = "x/etc/login.conf" ; then
2435 --with-default-path=PATH has no effect on this system.
2436 Edit /etc/login.conf instead.])
2437 elif test "x$withval" != "xno" ; then
2438 if test ! -z "$external_path_file" ; then
2440 --with-default-path=PATH will only be used if PATH is not defined in
2441 $external_path_file .])
2443 user_path="$withval"
2444 SERVER_PATH_MSG="$withval"
2447 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2448 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2450 if test ! -z "$external_path_file" ; then
2452 If PATH is defined in $external_path_file, ensure the path to scp is included,
2453 otherwise scp will not work.])
2457 /* find out what STDPATH is */
2462 #ifndef _PATH_STDPATH
2463 # ifdef _PATH_USERPATH /* Irix */
2464 # define _PATH_STDPATH _PATH_USERPATH
2466 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2469 #include <sys/types.h>
2470 #include <sys/stat.h>
2472 #define DATA "conftest.stdpath"
2479 fd = fopen(DATA,"w");
2483 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2488 ], [ user_path=`cat conftest.stdpath` ],
2489 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2490 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2492 # make sure $bindir is in USER_PATH so scp will work
2493 t_bindir=`eval echo ${bindir}`
2495 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2498 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2500 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2501 if test $? -ne 0 ; then
2502 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2503 if test $? -ne 0 ; then
2504 user_path=$user_path:$t_bindir
2505 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2510 if test "x$external_path_file" != "x/etc/login.conf" ; then
2511 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2515 # Set superuser path separately to user path
2516 AC_ARG_WITH(superuser-path,
2517 [ --with-superuser-path= Specify different path for super-user],
2519 if test "x$withval" != "xno" ; then
2520 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2521 superuser_path=$withval
2527 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2528 IPV4_IN6_HACK_MSG="no"
2530 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2532 if test "x$withval" != "xno" ; then
2534 AC_DEFINE(IPV4_IN_IPV6)
2535 IPV4_IN6_HACK_MSG="yes"
2540 if test "x$inet6_default_4in6" = "xyes"; then
2541 AC_MSG_RESULT([yes (default)])
2542 AC_DEFINE(IPV4_IN_IPV6)
2543 IPV4_IN6_HACK_MSG="yes"
2545 AC_MSG_RESULT([no (default)])
2550 # Whether to enable BSD auth support
2552 AC_ARG_WITH(bsd-auth,
2553 [ --with-bsd-auth Enable BSD auth support],
2555 if test "x$withval" != "xno" ; then
2562 # Where to place sshd.pid
2564 # make sure the directory exists
2565 if test ! -d $piddir ; then
2566 piddir=`eval echo ${sysconfdir}`
2568 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2572 AC_ARG_WITH(pid-dir,
2573 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2575 if test "x$withval" != "xno" ; then
2577 if test ! -d $piddir ; then
2578 AC_MSG_WARN([** no $piddir directory on this system **])
2584 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2587 dnl allow user to disable some login recording features
2588 AC_ARG_ENABLE(lastlog,
2589 [ --disable-lastlog disable use of lastlog even if detected [no]],
2591 if test "x$enableval" = "xno" ; then
2592 AC_DEFINE(DISABLE_LASTLOG)
2597 [ --disable-utmp disable use of utmp even if detected [no]],
2599 if test "x$enableval" = "xno" ; then
2600 AC_DEFINE(DISABLE_UTMP)
2604 AC_ARG_ENABLE(utmpx,
2605 [ --disable-utmpx disable use of utmpx even if detected [no]],
2607 if test "x$enableval" = "xno" ; then
2608 AC_DEFINE(DISABLE_UTMPX)
2613 [ --disable-wtmp disable use of wtmp even if detected [no]],
2615 if test "x$enableval" = "xno" ; then
2616 AC_DEFINE(DISABLE_WTMP)
2620 AC_ARG_ENABLE(wtmpx,
2621 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2623 if test "x$enableval" = "xno" ; then
2624 AC_DEFINE(DISABLE_WTMPX)
2628 AC_ARG_ENABLE(libutil,
2629 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2631 if test "x$enableval" = "xno" ; then
2632 AC_DEFINE(DISABLE_LOGIN)
2636 AC_ARG_ENABLE(pututline,
2637 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2639 if test "x$enableval" = "xno" ; then
2640 AC_DEFINE(DISABLE_PUTUTLINE)
2644 AC_ARG_ENABLE(pututxline,
2645 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2647 if test "x$enableval" = "xno" ; then
2648 AC_DEFINE(DISABLE_PUTUTXLINE)
2652 AC_ARG_WITH(lastlog,
2653 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2655 if test "x$withval" = "xno" ; then
2656 AC_DEFINE(DISABLE_LASTLOG)
2658 conf_lastlog_location=$withval
2663 dnl lastlog, [uw]tmpx? detection
2664 dnl NOTE: set the paths in the platform section to avoid the
2665 dnl need for command-line parameters
2666 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2668 dnl lastlog detection
2669 dnl NOTE: the code itself will detect if lastlog is a directory
2670 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2672 #include <sys/types.h>
2674 #ifdef HAVE_LASTLOG_H
2675 # include <lastlog.h>
2684 [ char *lastlog = LASTLOG_FILE; ],
2685 [ AC_MSG_RESULT(yes) ],
2688 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2690 #include <sys/types.h>
2692 #ifdef HAVE_LASTLOG_H
2693 # include <lastlog.h>
2699 [ char *lastlog = _PATH_LASTLOG; ],
2700 [ AC_MSG_RESULT(yes) ],
2703 system_lastlog_path=no
2708 if test -z "$conf_lastlog_location"; then
2709 if test x"$system_lastlog_path" = x"no" ; then
2710 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2711 if (test -d "$f" || test -f "$f") ; then
2712 conf_lastlog_location=$f
2715 if test -z "$conf_lastlog_location"; then
2716 AC_MSG_WARN([** Cannot find lastlog **])
2717 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2722 if test -n "$conf_lastlog_location"; then
2723 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2727 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2729 #include <sys/types.h>
2735 [ char *utmp = UTMP_FILE; ],
2736 [ AC_MSG_RESULT(yes) ],
2738 system_utmp_path=no ]
2740 if test -z "$conf_utmp_location"; then
2741 if test x"$system_utmp_path" = x"no" ; then
2742 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2743 if test -f $f ; then
2744 conf_utmp_location=$f
2747 if test -z "$conf_utmp_location"; then
2748 AC_DEFINE(DISABLE_UTMP)
2752 if test -n "$conf_utmp_location"; then
2753 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2757 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2759 #include <sys/types.h>
2765 [ char *wtmp = WTMP_FILE; ],
2766 [ AC_MSG_RESULT(yes) ],
2768 system_wtmp_path=no ]
2770 if test -z "$conf_wtmp_location"; then
2771 if test x"$system_wtmp_path" = x"no" ; then
2772 for f in /usr/adm/wtmp /var/log/wtmp; do
2773 if test -f $f ; then
2774 conf_wtmp_location=$f
2777 if test -z "$conf_wtmp_location"; then
2778 AC_DEFINE(DISABLE_WTMP)
2782 if test -n "$conf_wtmp_location"; then
2783 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2787 dnl utmpx detection - I don't know any system so perverse as to require
2788 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2790 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2792 #include <sys/types.h>
2801 [ char *utmpx = UTMPX_FILE; ],
2802 [ AC_MSG_RESULT(yes) ],
2804 system_utmpx_path=no ]
2806 if test -z "$conf_utmpx_location"; then
2807 if test x"$system_utmpx_path" = x"no" ; then
2808 AC_DEFINE(DISABLE_UTMPX)
2811 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2815 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2817 #include <sys/types.h>
2826 [ char *wtmpx = WTMPX_FILE; ],
2827 [ AC_MSG_RESULT(yes) ],
2829 system_wtmpx_path=no ]
2831 if test -z "$conf_wtmpx_location"; then
2832 if test x"$system_wtmpx_path" = x"no" ; then
2833 AC_DEFINE(DISABLE_WTMPX)
2836 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2840 if test ! -z "$blibpath" ; then
2841 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2842 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2845 dnl remove pam and dl because they are in $LIBPAM
2846 if test "$PAM_MSG" = yes ; then
2847 LIBS=`echo $LIBS | sed 's/-lpam //'`
2849 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2850 LIBS=`echo $LIBS | sed 's/-ldl //'`
2854 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2857 # Print summary of options
2859 # Someone please show me a better way :)
2860 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2861 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2862 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2863 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2864 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2865 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2866 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2867 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2868 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2869 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2872 echo "OpenSSH has been configured with the following options:"
2873 echo " User binaries: $B"
2874 echo " System binaries: $C"
2875 echo " Configuration files: $D"
2876 echo " Askpass program: $E"
2877 echo " Manual pages: $F"
2878 echo " PID file: $G"
2879 echo " Privilege separation chroot path: $H"
2880 if test "x$external_path_file" = "x/etc/login.conf" ; then
2881 echo " At runtime, sshd will use the path defined in $external_path_file"
2882 echo " Make sure the path to scp is present, otherwise scp will not work"
2884 echo " sshd default user PATH: $I"
2885 if test ! -z "$external_path_file"; then
2886 echo " (If PATH is set in $external_path_file it will be used instead. If"
2887 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2890 if test ! -z "$superuser_path" ; then
2891 echo " sshd superuser user PATH: $J"
2893 echo " Manpage format: $MANTYPE"
2894 echo " DNS support: $DNS_MSG"
2895 echo " PAM support: $PAM_MSG"
2896 echo " KerberosV support: $KRB5_MSG"
2897 echo " Smartcard support: $SCARD_MSG"
2898 echo " S/KEY support: $SKEY_MSG"
2899 echo " TCP Wrappers support: $TCPW_MSG"
2900 echo " MD5 password support: $MD5_MSG"
2901 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2902 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2903 echo " BSD Auth support: $BSD_AUTH_MSG"
2904 echo " Random number source: $RAND_MSG"
2905 if test ! -z "$USE_RAND_HELPER" ; then
2906 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2911 echo " Host: ${host}"
2912 echo " Compiler: ${CC}"
2913 echo " Compiler flags: ${CFLAGS}"
2914 echo "Preprocessor flags: ${CPPFLAGS}"
2915 echo " Linker flags: ${LDFLAGS}"
2916 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2920 if test "x$PAM_MSG" = "xyes" ; then
2921 echo "PAM is enabled. You may need to install a PAM control file "
2922 echo "for sshd, otherwise password authentication may fail. "
2923 echo "Example PAM control files can be found in the contrib/ "
2928 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2929 echo "WARNING: you are using the builtin random number collection "
2930 echo "service. Please read WARNING.RNG and request that your OS "
2931 echo "vendor includes kernel-based random number collection in "
2932 echo "future versions of your OS."