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 Enable Globus GSI authentication support],
682 [ --with-globus Enable Globus GSI authentication support],
688 AC_ARG_WITH(globus-static,
689 [ --with-globus-static Link statically with Globus GSI libraries],
692 if test "x$gsi_path" == "xno" ; then
698 # Check whether the user has a Globus flavor type
699 globus_flavor_type="no"
700 AC_ARG_WITH(globus-flavor,
701 [ --with-globus-flavor=TYPE Specify Globus flavor type (ex: gcc32dbg)],
703 globus_flavor_type="$withval"
704 if test "x$gsi_path" == "xno" ; then
710 if test "x$gsi_path" != "xno" ; then
711 # Globus GSSAPI configuration
712 AC_MSG_CHECKING(for Globus GSI)
715 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
716 AC_MSG_ERROR([Previously configured GSSAPI library conflicts with Globus GSI.])
718 if test -z "$GSSAPI"; then
723 if test "x$gsi_path" = "xyes" ; then
724 if test -z "$GLOBUS_LOCATION" ; then
725 AC_MSG_ERROR(GLOBUS_LOCATION environment variable must be set.)
727 gsi_path="$GLOBUS_LOCATION"
730 GLOBUS_LOCATION="$gsi_path"
731 export GLOBUS_LOCATION
732 if test ! -d "$GLOBUS_LOCATION" ; then
733 AC_MSG_ERROR(Cannot find Globus installation. Set GLOBUS_LOCATION environment variable.)
736 if test "x$globus_flavor_type" = "xno" ; then
737 AC_MSG_ERROR(--with-globus-flavor=TYPE must be specified)
739 if test "x$globus_flavor_type" = "xyes" ; then
740 AC_MSG_ERROR(--with-globus-flavor=TYPE must specify a flavor type)
744 AC_MSG_CHECKING(for Globus include path)
745 GLOBUS_INCLUDE="${gsi_path}/include/${globus_flavor_type}"
746 if test ! -d "$GLOBUS_INCLUDE" ; then
747 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_INCLUDE})
749 GSI_CPPFLAGS="-I${GLOBUS_INCLUDE}"
753 # Find GPT linkline helper
756 AC_MSG_CHECKING(for GPT linkline helper)
757 if test -x $GPT_LOCATION/sbin/gpt_build_config ; then
758 gpt_linkline_helper="$GPT_LOCATION/sbin/gpt_build_config"
759 elif test -x ${gsi_path}/sbin/gpt_build_config ; then
760 gpt_linkline_helper="${gsi_path}/sbin/gpt_build_config"
762 AC_MSG_ERROR(Cannot find gpt_build_config: GPT installation is incomplete)
767 # Build Globus linkline
770 if test -n "${gsi_static}"; then
771 ${gpt_linkline_helper} -f ${globus_flavor_type} -link static -src pkg_data_src.gpt
773 ${gpt_linkline_helper} -f ${globus_flavor_type} -link shared -src pkg_data_src.gpt
775 . ./gpt_build_temp.sh
776 if test -n "${need_dash_r}"; then
777 GSI_LDFLAGS="-L${gsi_path}/lib -R{gsi_path}/lib"
779 GSI_LDFLAGS="-L${gsi_path}/lib"
781 GSI_LIBS="$GPT_CONFIG_PGM_LINKS"
782 LD_LIBRARY_PATH="${gsi_path}/lib:$LD_LIBRARY_PATH"; export LD_LIBRARY_PATH
785 # Test Globus linkline
788 AC_MSG_CHECKING(for Globus linkline)
789 if test -z "$GSI_LIBS" ; then
790 AC_MSG_ERROR(gpt_build_config failed)
794 LIBS="$LIBS $GSI_LIBS"
795 LDFLAGS="$LDFLAGS $GSI_LDFLAGS"
796 CPPFLAGS="$CPPFLAGS $GSI_CPPFLAGS"
798 AC_MSG_CHECKING(that Globus linkline works)
799 # test that we got the libraries OK
807 AC_MSG_ERROR(link with Globus libraries failed)
814 # End Globus/GSI section
816 # Check whether user wants S/Key support
819 [ --with-skey[[=PATH]] Enable S/Key support
820 (optionally in PATH)],
822 if test "x$withval" != "xno" ; then
824 if test "x$withval" != "xyes" ; then
825 CPPFLAGS="$CPPFLAGS -I${withval}/include"
826 LDFLAGS="$LDFLAGS -L${withval}/lib"
833 AC_MSG_CHECKING([for s/key support])
838 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
840 [AC_MSG_RESULT(yes)],
843 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
849 # Check whether user wants TCP wrappers support
851 AC_ARG_WITH(tcp-wrappers,
852 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
853 (optionally in PATH)],
855 if test "x$withval" != "xno" ; then
857 saved_LDFLAGS="$LDFLAGS"
858 saved_CPPFLAGS="$CPPFLAGS"
859 if test -n "${withval}" -a "${withval}" != "yes"; then
860 if test -d "${withval}/lib"; then
861 if test -n "${need_dash_r}"; then
862 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
864 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
867 if test -n "${need_dash_r}"; then
868 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
870 LDFLAGS="-L${withval} ${LDFLAGS}"
873 if test -d "${withval}/include"; then
874 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
876 CPPFLAGS="-I${withval} ${CPPFLAGS}"
880 LIBS="$LIBWRAP $LIBS"
881 AC_MSG_CHECKING(for libwrap)
885 int deny_severity = 0, allow_severity = 0;
895 AC_MSG_ERROR([*** libwrap missing])
903 dnl Checks for library functions. Please keep in alphabetical order
905 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename \
906 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
907 getaddrinfo getcwd getgrouplist getnameinfo getopt \
908 getpeereid _getpty getrlimit getttyent glob inet_aton \
909 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
910 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
911 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
912 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
913 setproctitle setregid setresgid setresuid setreuid setrlimit \
914 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
915 strlcat strlcpy strmode strnvis sysconf tcgetpgrp \
916 truncate utimes vhangup vsnprintf waitpid \
919 # IRIX has a const char return value for gai_strerror()
920 AC_CHECK_FUNCS(gai_strerror,[
921 AC_DEFINE(HAVE_GAI_STRERROR)
923 #include <sys/types.h>
924 #include <sys/socket.h>
927 const char *gai_strerror(int);],[
930 str = gai_strerror(0);],[
931 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
932 [Define if gai_strerror() returns const char *])])])
934 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
936 dnl Make sure prototypes are defined for these before using them.
937 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
938 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
940 dnl tcsendbreak might be a macro
941 AC_CHECK_DECL(tcsendbreak,
942 [AC_DEFINE(HAVE_TCSENDBREAK)],
943 [AC_CHECK_FUNCS(tcsendbreak)],
944 [#include <termios.h>]
947 dnl Checks for time functions
948 AC_CHECK_FUNCS(gettimeofday time)
949 dnl Checks for utmp functions
950 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
951 AC_CHECK_FUNCS(utmpname)
952 dnl Checks for utmpx functions
953 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
954 AC_CHECK_FUNCS(setutxent utmpxname)
956 AC_CHECK_FUNC(daemon,
957 [AC_DEFINE(HAVE_DAEMON)],
958 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
961 AC_CHECK_FUNC(getpagesize,
962 [AC_DEFINE(HAVE_GETPAGESIZE)],
963 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
966 # Check for broken snprintf
967 if test "x$ac_cv_func_snprintf" = "xyes" ; then
968 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
972 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
974 [AC_MSG_RESULT(yes)],
977 AC_DEFINE(BROKEN_SNPRINTF)
978 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
983 dnl see whether mkstemp() requires XXXXXX
984 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
985 AC_MSG_CHECKING([for (overly) strict mkstemp])
989 main() { char template[]="conftest.mkstemp-test";
990 if (mkstemp(template) == -1)
992 unlink(template); exit(0);
1000 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1004 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1009 dnl make sure that openpty does not reacquire controlling terminal
1010 if test ! -z "$check_for_openpty_ctty_bug"; then
1011 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1015 #include <sys/fcntl.h>
1016 #include <sys/types.h>
1017 #include <sys/wait.h>
1023 int fd, ptyfd, ttyfd, status;
1026 if (pid < 0) { /* failed */
1028 } else if (pid > 0) { /* parent */
1029 waitpid(pid, &status, 0);
1030 if (WIFEXITED(status))
1031 exit(WEXITSTATUS(status));
1034 } else { /* child */
1035 close(0); close(1); close(2);
1037 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1038 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1040 exit(3); /* Acquired ctty: broken */
1042 exit(0); /* Did not acquire ctty: OK */
1051 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1058 # Check for PAM libs
1061 [ --with-pam Enable PAM support ],
1063 if test "x$withval" != "xno" ; then
1064 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
1065 AC_MSG_ERROR([PAM headers not found])
1068 AC_CHECK_LIB(dl, dlopen, , )
1069 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1070 AC_CHECK_FUNCS(pam_getenvlist)
1071 AC_CHECK_FUNCS(pam_putenv)
1077 if test $ac_cv_lib_dl_dlopen = yes; then
1088 # Check for older PAM
1089 if test "x$PAM_MSG" = "xyes" ; then
1090 # Check PAM strerror arguments (old PAM)
1091 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1095 #include <security/pam_appl.h>
1097 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1098 [AC_MSG_RESULT(no)],
1100 AC_DEFINE(HAVE_OLD_PAM)
1102 PAM_MSG="yes (old library)"
1107 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1108 # because the system crypt() is more featureful.
1109 if test "x$check_for_libcrypt_before" = "x1"; then
1110 AC_CHECK_LIB(crypt, crypt)
1113 # Search for OpenSSL
1114 saved_CPPFLAGS="$CPPFLAGS"
1115 saved_LDFLAGS="$LDFLAGS"
1116 AC_ARG_WITH(ssl-dir,
1117 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1119 if test "x$withval" != "xno" ; then
1120 if test -d "$withval/lib"; then
1121 if test -n "${need_dash_r}"; then
1122 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1124 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1127 if test -n "${need_dash_r}"; then
1128 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1130 LDFLAGS="-L${withval} ${LDFLAGS}"
1133 if test -d "$withval/include"; then
1134 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1136 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1142 if test -z "$GSI_LIBS" ; then
1143 LIBS="$LIBS -lcrypto"
1146 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1148 dnl Check default openssl install dir
1149 if test -n "${need_dash_r}"; then
1150 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1152 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1154 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1155 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1157 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1163 # Determine OpenSSL header version
1164 AC_MSG_CHECKING([OpenSSL header version])
1169 #include <openssl/opensslv.h>
1170 #define DATA "conftest.sslincver"
1175 fd = fopen(DATA,"w");
1179 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1186 ssl_header_ver=`cat conftest.sslincver`
1187 AC_MSG_RESULT($ssl_header_ver)
1190 AC_MSG_RESULT(not found)
1191 AC_MSG_ERROR(OpenSSL version header not found.)
1195 # Determine OpenSSL library version
1196 AC_MSG_CHECKING([OpenSSL library version])
1201 #include <openssl/opensslv.h>
1202 #include <openssl/crypto.h>
1203 #define DATA "conftest.ssllibver"
1208 fd = fopen(DATA,"w");
1212 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1219 ssl_library_ver=`cat conftest.ssllibver`
1220 AC_MSG_RESULT($ssl_library_ver)
1223 AC_MSG_RESULT(not found)
1224 AC_MSG_ERROR(OpenSSL library not found.)
1228 # Sanity check OpenSSL headers
1229 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1233 #include <openssl/opensslv.h>
1234 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1241 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1242 Check config.log for details.
1243 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1247 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1248 # version in OpenSSL. Skip this for PAM
1249 if test "x$check_for_libcrypt_later" = "x1"; then
1250 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1254 ### Configure cryptographic random number support
1256 # Check wheter OpenSSL seeds itself
1257 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1261 #include <openssl/rand.h>
1262 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1265 OPENSSL_SEEDS_ITSELF=yes
1270 # Default to use of the rand helper if OpenSSL doesn't
1277 # Do we want to force the use of the rand helper?
1278 AC_ARG_WITH(rand-helper,
1279 [ --with-rand-helper Use subprocess to gather strong randomness ],
1281 if test "x$withval" = "xno" ; then
1282 # Force use of OpenSSL's internal RNG, even if
1283 # the previous test showed it to be unseeded.
1284 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1285 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1286 OPENSSL_SEEDS_ITSELF=yes
1295 # Which randomness source do we use?
1296 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1298 AC_DEFINE(OPENSSL_PRNG_ONLY)
1299 RAND_MSG="OpenSSL internal ONLY"
1300 INSTALL_SSH_RAND_HELPER=""
1301 elif test ! -z "$USE_RAND_HELPER" ; then
1302 # install rand helper
1303 RAND_MSG="ssh-rand-helper"
1304 INSTALL_SSH_RAND_HELPER="yes"
1306 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1308 ### Configuration of ssh-rand-helper
1311 AC_ARG_WITH(prngd-port,
1312 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1321 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1324 if test ! -z "$withval" ; then
1325 PRNGD_PORT="$withval"
1326 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1331 # PRNGD Unix domain socket
1332 AC_ARG_WITH(prngd-socket,
1333 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1337 withval="/var/run/egd-pool"
1345 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1349 if test ! -z "$withval" ; then
1350 if test ! -z "$PRNGD_PORT" ; then
1351 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1353 if test ! -r "$withval" ; then
1354 AC_MSG_WARN(Entropy socket is not readable)
1356 PRNGD_SOCKET="$withval"
1357 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1361 # Check for existing socket only if we don't have a random device already
1362 if test "$USE_RAND_HELPER" = yes ; then
1363 AC_MSG_CHECKING(for PRNGD/EGD socket)
1364 # Insert other locations here
1365 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1366 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1367 PRNGD_SOCKET="$sock"
1368 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1372 if test ! -z "$PRNGD_SOCKET" ; then
1373 AC_MSG_RESULT($PRNGD_SOCKET)
1375 AC_MSG_RESULT(not found)
1381 # Change default command timeout for hashing entropy source
1383 AC_ARG_WITH(entropy-timeout,
1384 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1386 if test "x$withval" != "xno" ; then
1387 entropy_timeout=$withval
1391 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1393 SSH_PRIVSEP_USER=sshd
1394 AC_ARG_WITH(privsep-user,
1395 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1397 if test -n "$withval"; then
1398 SSH_PRIVSEP_USER=$withval
1402 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1403 AC_SUBST(SSH_PRIVSEP_USER)
1405 # We do this little dance with the search path to insure
1406 # that programs that we select for use by installed programs
1407 # (which may be run by the super-user) come from trusted
1408 # locations before they come from the user's private area.
1409 # This should help avoid accidentally configuring some
1410 # random version of a program in someone's personal bin.
1414 test -h /bin 2> /dev/null && PATH=/usr/bin
1415 test -d /sbin && PATH=$PATH:/sbin
1416 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1417 PATH=$PATH:/etc:$OPATH
1419 # These programs are used by the command hashing source to gather entropy
1420 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1421 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1422 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1423 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1424 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1425 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1426 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1427 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1428 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1429 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1430 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1431 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1432 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1433 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1434 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1435 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1439 # Where does ssh-rand-helper get its randomness from?
1440 INSTALL_SSH_PRNG_CMDS=""
1441 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1442 if test ! -z "$PRNGD_PORT" ; then
1443 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1444 elif test ! -z "$PRNGD_SOCKET" ; then
1445 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1447 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1448 RAND_HELPER_CMDHASH=yes
1449 INSTALL_SSH_PRNG_CMDS="yes"
1452 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1455 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1456 if test ! -z "$SONY" ; then
1457 LIBS="$LIBS -liberty";
1460 # Checks for data types
1461 AC_CHECK_SIZEOF(char, 1)
1462 AC_CHECK_SIZEOF(short int, 2)
1463 AC_CHECK_SIZEOF(int, 4)
1464 AC_CHECK_SIZEOF(long int, 4)
1465 AC_CHECK_SIZEOF(long long int, 8)
1467 # Sanity check long long for some platforms (AIX)
1468 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1469 ac_cv_sizeof_long_long_int=0
1472 # More checks for data types
1473 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1475 [ #include <sys/types.h> ],
1477 [ ac_cv_have_u_int="yes" ],
1478 [ ac_cv_have_u_int="no" ]
1481 if test "x$ac_cv_have_u_int" = "xyes" ; then
1482 AC_DEFINE(HAVE_U_INT)
1486 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1488 [ #include <sys/types.h> ],
1489 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1490 [ ac_cv_have_intxx_t="yes" ],
1491 [ ac_cv_have_intxx_t="no" ]
1494 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1495 AC_DEFINE(HAVE_INTXX_T)
1499 if (test -z "$have_intxx_t" && \
1500 test "x$ac_cv_header_stdint_h" = "xyes")
1502 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1504 [ #include <stdint.h> ],
1505 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1507 AC_DEFINE(HAVE_INTXX_T)
1510 [ AC_MSG_RESULT(no) ]
1514 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1517 #include <sys/types.h>
1518 #ifdef HAVE_STDINT_H
1519 # include <stdint.h>
1521 #include <sys/socket.h>
1522 #ifdef HAVE_SYS_BITYPES_H
1523 # include <sys/bitypes.h>
1526 [ int64_t a; a = 1;],
1527 [ ac_cv_have_int64_t="yes" ],
1528 [ ac_cv_have_int64_t="no" ]
1531 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1532 AC_DEFINE(HAVE_INT64_T)
1535 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1537 [ #include <sys/types.h> ],
1538 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1539 [ ac_cv_have_u_intxx_t="yes" ],
1540 [ ac_cv_have_u_intxx_t="no" ]
1543 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1544 AC_DEFINE(HAVE_U_INTXX_T)
1548 if test -z "$have_u_intxx_t" ; then
1549 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1551 [ #include <sys/socket.h> ],
1552 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1554 AC_DEFINE(HAVE_U_INTXX_T)
1557 [ AC_MSG_RESULT(no) ]
1561 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1563 [ #include <sys/types.h> ],
1564 [ u_int64_t a; a = 1;],
1565 [ ac_cv_have_u_int64_t="yes" ],
1566 [ ac_cv_have_u_int64_t="no" ]
1569 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1570 AC_DEFINE(HAVE_U_INT64_T)
1574 if test -z "$have_u_int64_t" ; then
1575 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1577 [ #include <sys/bitypes.h> ],
1578 [ u_int64_t a; a = 1],
1580 AC_DEFINE(HAVE_U_INT64_T)
1583 [ AC_MSG_RESULT(no) ]
1587 if test -z "$have_u_intxx_t" ; then
1588 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1591 #include <sys/types.h>
1593 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1594 [ ac_cv_have_uintxx_t="yes" ],
1595 [ ac_cv_have_uintxx_t="no" ]
1598 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1599 AC_DEFINE(HAVE_UINTXX_T)
1603 if test -z "$have_uintxx_t" ; then
1604 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1606 [ #include <stdint.h> ],
1607 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1609 AC_DEFINE(HAVE_UINTXX_T)
1612 [ AC_MSG_RESULT(no) ]
1616 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1617 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1619 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1622 #include <sys/bitypes.h>
1625 int8_t a; int16_t b; int32_t c;
1626 u_int8_t e; u_int16_t f; u_int32_t g;
1627 a = b = c = e = f = g = 1;
1630 AC_DEFINE(HAVE_U_INTXX_T)
1631 AC_DEFINE(HAVE_INTXX_T)
1639 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1642 #include <sys/types.h>
1644 [ u_char foo; foo = 125; ],
1645 [ ac_cv_have_u_char="yes" ],
1646 [ ac_cv_have_u_char="no" ]
1649 if test "x$ac_cv_have_u_char" = "xyes" ; then
1650 AC_DEFINE(HAVE_U_CHAR)
1655 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1657 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1660 #include <sys/types.h>
1662 [ size_t foo; foo = 1235; ],
1663 [ ac_cv_have_size_t="yes" ],
1664 [ ac_cv_have_size_t="no" ]
1667 if test "x$ac_cv_have_size_t" = "xyes" ; then
1668 AC_DEFINE(HAVE_SIZE_T)
1671 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1674 #include <sys/types.h>
1676 [ ssize_t foo; foo = 1235; ],
1677 [ ac_cv_have_ssize_t="yes" ],
1678 [ ac_cv_have_ssize_t="no" ]
1681 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1682 AC_DEFINE(HAVE_SSIZE_T)
1685 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1690 [ clock_t foo; foo = 1235; ],
1691 [ ac_cv_have_clock_t="yes" ],
1692 [ ac_cv_have_clock_t="no" ]
1695 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1696 AC_DEFINE(HAVE_CLOCK_T)
1699 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1702 #include <sys/types.h>
1703 #include <sys/socket.h>
1705 [ sa_family_t foo; foo = 1235; ],
1706 [ ac_cv_have_sa_family_t="yes" ],
1709 #include <sys/types.h>
1710 #include <sys/socket.h>
1711 #include <netinet/in.h>
1713 [ sa_family_t foo; foo = 1235; ],
1714 [ ac_cv_have_sa_family_t="yes" ],
1716 [ ac_cv_have_sa_family_t="no" ]
1720 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1721 AC_DEFINE(HAVE_SA_FAMILY_T)
1724 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1727 #include <sys/types.h>
1729 [ pid_t foo; foo = 1235; ],
1730 [ ac_cv_have_pid_t="yes" ],
1731 [ ac_cv_have_pid_t="no" ]
1734 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1735 AC_DEFINE(HAVE_PID_T)
1738 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1741 #include <sys/types.h>
1743 [ mode_t foo; foo = 1235; ],
1744 [ ac_cv_have_mode_t="yes" ],
1745 [ ac_cv_have_mode_t="no" ]
1748 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1749 AC_DEFINE(HAVE_MODE_T)
1753 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1756 #include <sys/types.h>
1757 #include <sys/socket.h>
1759 [ struct sockaddr_storage s; ],
1760 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1761 [ ac_cv_have_struct_sockaddr_storage="no" ]
1764 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1765 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1768 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1771 #include <sys/types.h>
1772 #include <netinet/in.h>
1774 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1775 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1776 [ ac_cv_have_struct_sockaddr_in6="no" ]
1779 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1780 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1783 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1786 #include <sys/types.h>
1787 #include <netinet/in.h>
1789 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1790 [ ac_cv_have_struct_in6_addr="yes" ],
1791 [ ac_cv_have_struct_in6_addr="no" ]
1794 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1795 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1798 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1801 #include <sys/types.h>
1802 #include <sys/socket.h>
1805 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1806 [ ac_cv_have_struct_addrinfo="yes" ],
1807 [ ac_cv_have_struct_addrinfo="no" ]
1810 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1811 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1814 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1816 [ #include <sys/time.h> ],
1817 [ struct timeval tv; tv.tv_sec = 1;],
1818 [ ac_cv_have_struct_timeval="yes" ],
1819 [ ac_cv_have_struct_timeval="no" ]
1822 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1823 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1824 have_struct_timeval=1
1827 AC_CHECK_TYPES(struct timespec)
1829 # We need int64_t or else certian parts of the compile will fail.
1830 if test "x$ac_cv_have_int64_t" = "xno" -a \
1831 "x$ac_cv_sizeof_long_int" != "x8" -a \
1832 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1833 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1834 echo "an alternative compiler (I.E., GCC) before continuing."
1838 dnl test snprintf (broken on SCO w/gcc)
1843 #ifdef HAVE_SNPRINTF
1847 char expected_out[50];
1849 #if (SIZEOF_LONG_INT == 8)
1850 long int num = 0x7fffffffffffffff;
1852 long long num = 0x7fffffffffffffffll;
1854 strcpy(expected_out, "9223372036854775807");
1855 snprintf(buf, mazsize, "%lld", num);
1856 if(strcmp(buf, expected_out) != 0)
1863 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1867 dnl Checks for structure members
1868 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1869 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1870 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1871 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1872 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1873 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1874 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1875 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1876 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1877 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1878 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1879 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1880 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1881 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1882 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1883 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1884 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1886 AC_CHECK_MEMBERS([struct stat.st_blksize])
1888 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1889 ac_cv_have_ss_family_in_struct_ss, [
1892 #include <sys/types.h>
1893 #include <sys/socket.h>
1895 [ struct sockaddr_storage s; s.ss_family = 1; ],
1896 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1897 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1900 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1901 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1904 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1905 ac_cv_have___ss_family_in_struct_ss, [
1908 #include <sys/types.h>
1909 #include <sys/socket.h>
1911 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1912 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1913 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1916 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1917 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1920 AC_CACHE_CHECK([for pw_class field in struct passwd],
1921 ac_cv_have_pw_class_in_struct_passwd, [
1926 [ struct passwd p; p.pw_class = 0; ],
1927 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1928 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1931 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1932 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1935 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1936 ac_cv_have_pw_expire_in_struct_passwd, [
1941 [ struct passwd p; p.pw_expire = 0; ],
1942 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1943 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1946 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1947 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1950 AC_CACHE_CHECK([for pw_change field in struct passwd],
1951 ac_cv_have_pw_change_in_struct_passwd, [
1956 [ struct passwd p; p.pw_change = 0; ],
1957 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1958 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1961 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1962 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1965 dnl make sure we're using the real structure members and not defines
1966 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1967 ac_cv_have_accrights_in_msghdr, [
1970 #include <sys/types.h>
1971 #include <sys/socket.h>
1972 #include <sys/uio.h>
1974 #ifdef msg_accrights
1978 m.msg_accrights = 0;
1982 [ ac_cv_have_accrights_in_msghdr="yes" ],
1983 [ ac_cv_have_accrights_in_msghdr="no" ]
1986 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1987 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1990 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1991 ac_cv_have_control_in_msghdr, [
1994 #include <sys/types.h>
1995 #include <sys/socket.h>
1996 #include <sys/uio.h>
2006 [ ac_cv_have_control_in_msghdr="yes" ],
2007 [ ac_cv_have_control_in_msghdr="no" ]
2010 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2011 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2014 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2016 [ extern char *__progname; printf("%s", __progname); ],
2017 [ ac_cv_libc_defines___progname="yes" ],
2018 [ ac_cv_libc_defines___progname="no" ]
2021 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2022 AC_DEFINE(HAVE___PROGNAME)
2025 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2029 [ printf("%s", __FUNCTION__); ],
2030 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2031 [ ac_cv_cc_implements___FUNCTION__="no" ]
2034 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2035 AC_DEFINE(HAVE___FUNCTION__)
2038 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2042 [ printf("%s", __func__); ],
2043 [ ac_cv_cc_implements___func__="yes" ],
2044 [ ac_cv_cc_implements___func__="no" ]
2047 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2048 AC_DEFINE(HAVE___func__)
2051 AC_CACHE_CHECK([whether getopt has optreset support],
2052 ac_cv_have_getopt_optreset, [
2057 [ extern int optreset; optreset = 0; ],
2058 [ ac_cv_have_getopt_optreset="yes" ],
2059 [ ac_cv_have_getopt_optreset="no" ]
2062 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2063 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2066 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2068 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2069 [ ac_cv_libc_defines_sys_errlist="yes" ],
2070 [ ac_cv_libc_defines_sys_errlist="no" ]
2073 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2074 AC_DEFINE(HAVE_SYS_ERRLIST)
2078 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2080 [ extern int sys_nerr; printf("%i", sys_nerr);],
2081 [ ac_cv_libc_defines_sys_nerr="yes" ],
2082 [ ac_cv_libc_defines_sys_nerr="no" ]
2085 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2086 AC_DEFINE(HAVE_SYS_NERR)
2090 # Check whether user wants sectok support
2092 [ --with-sectok Enable smartcard support using libsectok],
2094 if test "x$withval" != "xno" ; then
2095 if test "x$withval" != "xyes" ; then
2096 CPPFLAGS="$CPPFLAGS -I${withval}"
2097 LDFLAGS="$LDFLAGS -L${withval}"
2098 if test ! -z "$need_dash_r" ; then
2099 LDFLAGS="$LDFLAGS -R${withval}"
2101 if test ! -z "$blibpath" ; then
2102 blibpath="$blibpath:${withval}"
2105 AC_CHECK_HEADERS(sectok.h)
2106 if test "$ac_cv_header_sectok_h" != yes; then
2107 AC_MSG_ERROR(Can't find sectok.h)
2109 AC_CHECK_LIB(sectok, sectok_open)
2110 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2111 AC_MSG_ERROR(Can't find libsectok)
2113 AC_DEFINE(SMARTCARD)
2114 AC_DEFINE(USE_SECTOK)
2115 SCARD_MSG="yes, using sectok"
2120 # Check whether user wants OpenSC support
2122 AC_HELP_STRING([--with-opensc=PFX],
2123 [Enable smartcard support using OpenSC]),
2124 opensc_config_prefix="$withval", opensc_config_prefix="")
2125 if test x$opensc_config_prefix != x ; then
2126 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2127 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2128 if test "$OPENSC_CONFIG" != "no"; then
2129 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2130 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2131 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2132 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2133 AC_DEFINE(SMARTCARD)
2134 AC_DEFINE(USE_OPENSC)
2135 SCARD_MSG="yes, using OpenSC"
2139 # Check whether user wants DNS support
2142 [ --with-dns Support for fetching keys from DNS (experimental)],
2144 if test "x$withval" != "xno" ; then
2147 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2148 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
2150 # Needed by our getrrsetbyname()
2151 AC_SEARCH_LIBS(res_query, resolv)
2152 AC_SEARCH_LIBS(dn_expand, resolv)
2153 AC_CHECK_FUNCS(_getshort _getlong)
2154 AC_CHECK_MEMBER(HEADER.ad,
2155 [AC_DEFINE(HAVE_HEADER_AD)],,
2156 [#include <arpa/nameser.h>])
2162 # Check whether user wants Kerberos 5 support
2164 AC_ARG_WITH(kerberos5,
2165 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2167 if test "x$withval" != "xno" ; then
2168 if test "x$withval" = "xyes" ; then
2169 KRB5ROOT="/usr/local"
2173 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2174 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2177 AC_MSG_CHECKING(whether we are using Heimdal)
2178 AC_TRY_COMPILE([ #include <krb5.h> ],
2179 [ char *tmp = heimdal_version; ],
2180 [ AC_MSG_RESULT(yes)
2182 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2185 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2188 if test ! -z "$need_dash_r" ; then
2189 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2191 if test ! -z "$blibpath" ; then
2192 blibpath="$blibpath:${KRB5ROOT}/lib"
2194 AC_SEARCH_LIBS(dn_expand, resolv)
2196 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2198 K5LIBS="-lgssapi $K5LIBS" ],
2199 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2201 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2202 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2207 AC_CHECK_HEADER(gssapi.h, ,
2208 [ unset ac_cv_header_gssapi_h
2209 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2210 AC_CHECK_HEADERS(gssapi.h, ,
2211 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2217 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2218 AC_CHECK_HEADER(gssapi_krb5.h, ,
2219 [ CPPFLAGS="$oldCPP" ])
2221 # If we're using some other GSSAPI
2222 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
2223 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
2225 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2227 K5LIBS="-lgssapi $K5LIBS" ],
2228 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2230 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2231 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2236 AC_CHECK_HEADER(gssapi.h, ,
2237 [ unset ac_cv_header_gssapi_h
2238 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2239 AC_CHECK_HEADERS(gssapi.h, ,
2240 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2245 AC_CHECK_LIB(gssapi, gss_krb5_copy_ccache, /bin/true,
2246 [ K5LIBS="-lgssapi_krb5 $K5LIBS"
2247 AC_CHECK_LIB(gssapi_krb5, gss_krb5_copy_ccache, /bin/true,
2248 AC_MSG_WARN([Cannot find gss_krb5_copy_ccache -- build may fail]),
2254 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2255 AC_CHECK_HEADER(gssapi_krb5.h, ,
2256 [ CPPFLAGS="$oldCPP" ])
2258 if test -z "$GSSAPI"; then
2267 # Check whether user wants AFS_KRB5 support
2269 AC_ARG_WITH(afs-krb5,
2270 [ --with-afs-krb5[[=AKLOG_PATH]] Enable aklog to get token (default=/usr/bin/aklog).],
2272 if test "x$withval" != "xno" ; then
2274 if test "x$withval" != "xyes" ; then
2275 AC_DEFINE_UNQUOTED(AKLOG_PATH, "$withval")
2277 AC_DEFINE_UNQUOTED(AKLOG_PATH, "/usr/bin/aklog")
2280 if test -z "$KRB5" ; then
2281 AC_MSG_WARN([AFS_KRB5 requires Kerberos 5 support, build may fail])
2284 LIBS="-lkrbafs $LIBS"
2285 if test ! -z "$AFS_LIBS" ; then
2286 LIBS="$LIBS $AFS_LIBS"
2293 LIBS="$LIBS $K5LIBS"
2295 AC_ARG_WITH(session-hooks,
2296 [ --with-session-hooks Enable hooks for executing external commands before/after a session],
2297 [ AC_DEFINE(SESSION_HOOKS) ]
2300 # Looking for programs, paths and files
2302 PRIVSEP_PATH=/var/empty
2303 AC_ARG_WITH(privsep-path,
2304 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2306 if test "x$withval" != "$no" ; then
2307 PRIVSEP_PATH=$withval
2311 AC_SUBST(PRIVSEP_PATH)
2314 [ --with-xauth=PATH Specify path to xauth program ],
2316 if test "x$withval" != "xno" ; then
2322 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2323 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2324 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2325 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2326 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2327 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2328 xauth_path="/usr/openwin/bin/xauth"
2334 AC_ARG_ENABLE(strip,
2335 [ --disable-strip Disable calling strip(1) on install],
2337 if test "x$enableval" = "xno" ; then
2344 if test -z "$xauth_path" ; then
2345 XAUTH_PATH="undefined"
2346 AC_SUBST(XAUTH_PATH)
2348 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2349 XAUTH_PATH=$xauth_path
2350 AC_SUBST(XAUTH_PATH)
2353 # Check for mail directory (last resort if we cannot get it from headers)
2354 if test ! -z "$MAIL" ; then
2355 maildir=`dirname $MAIL`
2356 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2359 if test -z "$no_dev_ptmx" ; then
2360 if test "x$disable_ptmx_check" != "xyes" ; then
2361 AC_CHECK_FILE("/dev/ptmx",
2363 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2369 AC_CHECK_FILE("/dev/ptc",
2371 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2376 # Options from here on. Some of these are preset by platform above
2377 AC_ARG_WITH(mantype,
2378 [ --with-mantype=man|cat|doc Set man page type],
2385 AC_MSG_ERROR(invalid man type: $withval)
2390 if test -z "$MANTYPE"; then
2391 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2392 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2393 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2395 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2402 if test "$MANTYPE" = "doc"; then
2409 # Check whether to enable MD5 passwords
2411 AC_ARG_WITH(md5-passwords,
2412 [ --with-md5-passwords Enable use of MD5 passwords],
2414 if test "x$withval" != "xno" ; then
2415 AC_DEFINE(HAVE_MD5_PASSWORDS)
2421 # Whether to disable shadow password support
2423 [ --without-shadow Disable shadow password support],
2425 if test "x$withval" = "xno" ; then
2426 AC_DEFINE(DISABLE_SHADOW)
2432 if test -z "$disable_shadow" ; then
2433 AC_MSG_CHECKING([if the systems has expire shadow information])
2436 #include <sys/types.h>
2439 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2440 [ sp_expire_available=yes ], []
2443 if test "x$sp_expire_available" = "xyes" ; then
2445 AC_DEFINE(HAS_SHADOW_EXPIRE)
2451 # Use ip address instead of hostname in $DISPLAY
2452 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2453 DISPLAY_HACK_MSG="yes"
2454 AC_DEFINE(IPADDR_IN_DISPLAY)
2456 DISPLAY_HACK_MSG="no"
2457 AC_ARG_WITH(ipaddr-display,
2458 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2460 if test "x$withval" != "xno" ; then
2461 AC_DEFINE(IPADDR_IN_DISPLAY)
2462 DISPLAY_HACK_MSG="yes"
2468 # check for /etc/default/login and use it if present.
2469 AC_ARG_ENABLE(etc-default-login,
2470 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2472 AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2474 if test "x$external_path_file" = "x/etc/default/login"; then
2475 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2479 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2480 if test $ac_cv_func_login_getcapbool = "yes" -a \
2481 $ac_cv_header_login_cap_h = "yes" ; then
2482 external_path_file=/etc/login.conf
2485 # Whether to mess with the default path
2486 SERVER_PATH_MSG="(default)"
2487 AC_ARG_WITH(default-path,
2488 [ --with-default-path= Specify default \$PATH environment for server],
2490 if test "x$external_path_file" = "x/etc/login.conf" ; then
2492 --with-default-path=PATH has no effect on this system.
2493 Edit /etc/login.conf instead.])
2494 elif test "x$withval" != "xno" ; then
2495 if test ! -z "$external_path_file" ; then
2497 --with-default-path=PATH will only be used if PATH is not defined in
2498 $external_path_file .])
2500 user_path="$withval"
2501 SERVER_PATH_MSG="$withval"
2504 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2505 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2507 if test ! -z "$external_path_file" ; then
2509 If PATH is defined in $external_path_file, ensure the path to scp is included,
2510 otherwise scp will not work.])
2514 /* find out what STDPATH is */
2519 #ifndef _PATH_STDPATH
2520 # ifdef _PATH_USERPATH /* Irix */
2521 # define _PATH_STDPATH _PATH_USERPATH
2523 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2526 #include <sys/types.h>
2527 #include <sys/stat.h>
2529 #define DATA "conftest.stdpath"
2536 fd = fopen(DATA,"w");
2540 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2545 ], [ user_path=`cat conftest.stdpath` ],
2546 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2547 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2551 if test "x$external_path_file" != "x/etc/login.conf" ; then
2552 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2556 # Set superuser path separately to user path
2557 AC_ARG_WITH(superuser-path,
2558 [ --with-superuser-path= Specify different path for super-user],
2560 if test "x$withval" != "xno" ; then
2561 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2562 superuser_path=$withval
2568 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2569 IPV4_IN6_HACK_MSG="no"
2571 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2573 if test "x$withval" != "xno" ; then
2575 AC_DEFINE(IPV4_IN_IPV6)
2576 IPV4_IN6_HACK_MSG="yes"
2581 if test "x$inet6_default_4in6" = "xyes"; then
2582 AC_MSG_RESULT([yes (default)])
2583 AC_DEFINE(IPV4_IN_IPV6)
2584 IPV4_IN6_HACK_MSG="yes"
2586 AC_MSG_RESULT([no (default)])
2591 # Whether to enable BSD auth support
2593 AC_ARG_WITH(bsd-auth,
2594 [ --with-bsd-auth Enable BSD auth support],
2596 if test "x$withval" != "xno" ; then
2603 dnl allow user to disable some login recording features
2604 AC_ARG_ENABLE(lastlog,
2605 [ --disable-lastlog disable use of lastlog even if detected [no]],
2607 if test "x$enableval" = "xno" ; then
2608 AC_DEFINE(DISABLE_LASTLOG)
2613 [ --disable-utmp disable use of utmp even if detected [no]],
2615 if test "x$enableval" = "xno" ; then
2616 AC_DEFINE(DISABLE_UTMP)
2620 AC_ARG_ENABLE(utmpx,
2621 [ --disable-utmpx disable use of utmpx even if detected [no]],
2623 if test "x$enableval" = "xno" ; then
2624 AC_DEFINE(DISABLE_UTMPX)
2629 [ --disable-wtmp disable use of wtmp even if detected [no]],
2631 if test "x$enableval" = "xno" ; then
2632 AC_DEFINE(DISABLE_WTMP)
2636 AC_ARG_ENABLE(wtmpx,
2637 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2639 if test "x$enableval" = "xno" ; then
2640 AC_DEFINE(DISABLE_WTMPX)
2644 AC_ARG_ENABLE(libutil,
2645 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2647 if test "x$enableval" = "xno" ; then
2648 AC_DEFINE(DISABLE_LOGIN)
2652 AC_ARG_ENABLE(pututline,
2653 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2655 if test "x$enableval" = "xno" ; then
2656 AC_DEFINE(DISABLE_PUTUTLINE)
2660 AC_ARG_ENABLE(pututxline,
2661 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2663 if test "x$enableval" = "xno" ; then
2664 AC_DEFINE(DISABLE_PUTUTXLINE)
2668 AC_ARG_WITH(lastlog,
2669 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2671 if test "x$withval" = "xno" ; then
2672 AC_DEFINE(DISABLE_LASTLOG)
2674 conf_lastlog_location=$withval
2679 dnl lastlog, [uw]tmpx? detection
2680 dnl NOTE: set the paths in the platform section to avoid the
2681 dnl need for command-line parameters
2682 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2684 dnl lastlog detection
2685 dnl NOTE: the code itself will detect if lastlog is a directory
2686 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2688 #include <sys/types.h>
2690 #ifdef HAVE_LASTLOG_H
2691 # include <lastlog.h>
2700 [ char *lastlog = LASTLOG_FILE; ],
2701 [ AC_MSG_RESULT(yes) ],
2704 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2706 #include <sys/types.h>
2708 #ifdef HAVE_LASTLOG_H
2709 # include <lastlog.h>
2715 [ char *lastlog = _PATH_LASTLOG; ],
2716 [ AC_MSG_RESULT(yes) ],
2719 system_lastlog_path=no
2724 if test -z "$conf_lastlog_location"; then
2725 if test x"$system_lastlog_path" = x"no" ; then
2726 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2727 if (test -d "$f" || test -f "$f") ; then
2728 conf_lastlog_location=$f
2731 if test -z "$conf_lastlog_location"; then
2732 AC_MSG_WARN([** Cannot find lastlog **])
2733 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2738 if test -n "$conf_lastlog_location"; then
2739 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2743 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2745 #include <sys/types.h>
2751 [ char *utmp = UTMP_FILE; ],
2752 [ AC_MSG_RESULT(yes) ],
2754 system_utmp_path=no ]
2756 if test -z "$conf_utmp_location"; then
2757 if test x"$system_utmp_path" = x"no" ; then
2758 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2759 if test -f $f ; then
2760 conf_utmp_location=$f
2763 if test -z "$conf_utmp_location"; then
2764 AC_DEFINE(DISABLE_UTMP)
2768 if test -n "$conf_utmp_location"; then
2769 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2773 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2775 #include <sys/types.h>
2781 [ char *wtmp = WTMP_FILE; ],
2782 [ AC_MSG_RESULT(yes) ],
2784 system_wtmp_path=no ]
2786 if test -z "$conf_wtmp_location"; then
2787 if test x"$system_wtmp_path" = x"no" ; then
2788 for f in /usr/adm/wtmp /var/log/wtmp; do
2789 if test -f $f ; then
2790 conf_wtmp_location=$f
2793 if test -z "$conf_wtmp_location"; then
2794 AC_DEFINE(DISABLE_WTMP)
2798 if test -n "$conf_wtmp_location"; then
2799 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2803 dnl utmpx detection - I don't know any system so perverse as to require
2804 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2806 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2808 #include <sys/types.h>
2817 [ char *utmpx = UTMPX_FILE; ],
2818 [ AC_MSG_RESULT(yes) ],
2820 system_utmpx_path=no ]
2822 if test -z "$conf_utmpx_location"; then
2823 if test x"$system_utmpx_path" = x"no" ; then
2824 AC_DEFINE(DISABLE_UTMPX)
2827 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2831 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2833 #include <sys/types.h>
2842 [ char *wtmpx = WTMPX_FILE; ],
2843 [ AC_MSG_RESULT(yes) ],
2845 system_wtmpx_path=no ]
2847 if test -z "$conf_wtmpx_location"; then
2848 if test x"$system_wtmpx_path" = x"no" ; then
2849 AC_DEFINE(DISABLE_WTMPX)
2852 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2856 if test ! -z "$blibpath" ; then
2857 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2858 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2861 dnl remove pam and dl because they are in $LIBPAM
2862 if test "$PAM_MSG" = yes ; then
2863 LIBS=`echo $LIBS | sed 's/-lpam //'`
2865 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2866 LIBS=`echo $LIBS | sed 's/-ldl //'`
2870 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2873 # Print summary of options
2875 # Someone please show me a better way :)
2876 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2877 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2878 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2879 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2880 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2881 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2882 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2883 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2884 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2887 echo "OpenSSH has been configured with the following options:"
2888 echo " User binaries: $B"
2889 echo " System binaries: $C"
2890 echo " Configuration files: $D"
2891 echo " Askpass program: $E"
2892 echo " Manual pages: $F"
2893 echo " Privilege separation chroot path: $H"
2894 if test "x$external_path_file" = "x/etc/login.conf" ; then
2895 echo " At runtime, sshd will use the path defined in $external_path_file"
2896 echo " Make sure the path to scp is present, otherwise scp will not work"
2898 echo " sshd default user PATH: $I"
2899 if test ! -z "$external_path_file"; then
2900 echo " (If PATH is set in $external_path_file it will be used instead. If"
2901 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2904 if test ! -z "$superuser_path" ; then
2905 echo " sshd superuser user PATH: $J"
2907 echo " Manpage format: $MANTYPE"
2908 echo " DNS support: $DNS_MSG"
2909 echo " PAM support: $PAM_MSG"
2910 echo " KerberosV support: $KRB5_MSG"
2911 echo " Smartcard support: $SCARD_MSG"
2912 echo " S/KEY support: $SKEY_MSG"
2913 echo " TCP Wrappers support: $TCPW_MSG"
2914 echo " MD5 password support: $MD5_MSG"
2915 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2916 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2917 echo " BSD Auth support: $BSD_AUTH_MSG"
2918 echo " Random number source: $RAND_MSG"
2919 if test ! -z "$USE_RAND_HELPER" ; then
2920 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2925 echo " Host: ${host}"
2926 echo " Compiler: ${CC}"
2927 echo " Compiler flags: ${CFLAGS}"
2928 echo "Preprocessor flags: ${CPPFLAGS}"
2929 echo " Linker flags: ${LDFLAGS}"
2930 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2934 if test "x$PAM_MSG" = "xyes" ; then
2935 echo "PAM is enabled. You may need to install a PAM control file "
2936 echo "for sshd, otherwise password authentication may fail. "
2937 echo "Example PAM control files can be found in the contrib/ "
2942 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2943 echo "WARNING: you are using the builtin random number collection "
2944 echo "service. Please read WARNING.RNG and request that your OS "
2945 echo "vendor includes kernel-based random number collection in "
2946 echo "future versions of your OS."