4 AC_CONFIG_SRCDIR([ssh.c])
6 AC_CONFIG_HEADER(config.h)
11 # Checks for programs.
16 AC_PATH_PROGS(PERL, perl5 perl)
17 AC_PATH_PROG(SED, sed)
19 AC_PATH_PROG(ENT, ent)
21 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
22 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
23 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
29 if test -z "$AR" ; then
30 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
33 # Use LOGIN_PROGRAM from environment if possible
34 if test ! -z "$LOGIN_PROGRAM" ; then
35 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
38 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
39 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
40 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
44 if test -z "$LD" ; then
50 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
51 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
54 # 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 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
79 [AC_CHECK_LIB(s,authenticate,
80 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
84 AC_DEFINE(BROKEN_GETADDRINFO)
85 AC_DEFINE(BROKEN_REALPATH)
86 dnl AIX handles lastlog as part of its login message
87 AC_DEFINE(DISABLE_LASTLOG)
88 AC_DEFINE(LOGIN_NEEDS_UTMPX)
89 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_CLOBBER_ARGV)
90 AC_DEFINE(SETPROCTITLE_PS_PADDING, '\0')
93 check_for_libcrypt_later=1
94 LIBS="$LIBS /usr/lib/textmode.o"
95 AC_DEFINE(HAVE_CYGWIN)
97 AC_DEFINE(DISABLE_SHADOW)
98 AC_DEFINE(IPV4_DEFAULT)
99 AC_DEFINE(IP_TOS_IS_BROKEN)
100 AC_DEFINE(NO_X11_UNIX_SOCKETS)
101 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
102 AC_DEFINE(DISABLE_FD_PASSING)
103 AC_DEFINE(SETGROUPS_NOOP)
106 AC_DEFINE(IP_TOS_IS_BROKEN)
109 AC_MSG_CHECKING(if we have working getaddrinfo)
110 AC_TRY_RUN([#include <mach-o/dyld.h>
111 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
115 }], [AC_MSG_RESULT(working)],
116 [AC_MSG_RESULT(buggy)
117 AC_DEFINE(BROKEN_GETADDRINFO)],
118 [AC_MSG_RESULT(assume it is working)])
121 if test -z "$GCC"; then
124 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
125 IPADDR_IN_DISPLAY=yes
126 AC_DEFINE(HAVE_SECUREWARE)
128 AC_DEFINE(LOGIN_NO_ENDOPT)
129 AC_DEFINE(LOGIN_NEEDS_UTMPX)
130 AC_DEFINE(DISABLE_SHADOW)
131 AC_DEFINE(DISABLE_UTMP)
132 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT)
133 LIBS="$LIBS -lsec -lsecpw"
134 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
135 disable_ptmx_check=yes
138 if test -z "$GCC"; then
141 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
142 IPADDR_IN_DISPLAY=yes
144 AC_DEFINE(LOGIN_NO_ENDOPT)
145 AC_DEFINE(LOGIN_NEEDS_UTMPX)
146 AC_DEFINE(DISABLE_SHADOW)
147 AC_DEFINE(DISABLE_UTMP)
148 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT)
150 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
153 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
154 IPADDR_IN_DISPLAY=yes
155 AC_DEFINE(PAM_SUN_CODEBASE)
157 AC_DEFINE(LOGIN_NO_ENDOPT)
158 AC_DEFINE(LOGIN_NEEDS_UTMPX)
159 AC_DEFINE(DISABLE_SHADOW)
160 AC_DEFINE(DISABLE_UTMP)
161 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT)
163 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
166 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
168 PATH="$PATH:/usr/etc"
169 AC_DEFINE(BROKEN_INET_NTOA)
170 AC_DEFINE(WITH_ABBREV_NO_TTY)
173 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
175 PATH="$PATH:/usr/etc"
176 AC_DEFINE(WITH_IRIX_ARRAY)
177 AC_DEFINE(WITH_IRIX_PROJECT)
178 AC_DEFINE(WITH_IRIX_AUDIT)
179 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
180 AC_DEFINE(BROKEN_INET_NTOA)
181 AC_DEFINE(WITH_ABBREV_NO_TTY)
185 check_for_libcrypt_later=1
186 AC_DEFINE(DONT_TRY_OTHER_AF)
187 AC_DEFINE(PAM_TTY_KLUDGE)
188 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_CLOBBER_ARGV)
189 AC_DEFINE(SETPROCTITLE_PS_PADDING, '\0')
190 inet6_default_4in6=yes
192 mips-sony-bsd|mips-sony-newsos4)
193 AC_DEFINE(HAVE_NEWS4)
197 check_for_libcrypt_before=1
201 check_for_libcrypt_later=1
204 conf_lastlog_location="/usr/adm/lastlog"
205 conf_utmp_location=/etc/utmp
206 conf_wtmp_location=/usr/adm/wtmp
209 AC_DEFINE(BROKEN_REALPATH)
211 AC_DEFINE(BROKEN_SAVED_UIDS)
212 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
216 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
217 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
219 AC_DEFINE(PAM_SUN_CODEBASE)
220 AC_DEFINE(LOGIN_NEEDS_UTMPX)
221 AC_DEFINE(LOGIN_NEEDS_TERM)
222 AC_DEFINE(PAM_TTY_KLUDGE)
223 AC_DEFINE(STREAMS_PUSH_ACQUIRES_CTTY)
224 # hardwire lastlog location (can't detect it on some versions)
225 conf_lastlog_location="/var/adm/lastlog"
226 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
227 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
228 if test "$sol2ver" -ge 8; then
230 AC_DEFINE(DISABLE_UTMP)
231 AC_DEFINE(DISABLE_WTMP)
237 CPPFLAGS="$CPPFLAGS -DSUNOS4"
238 AC_CHECK_FUNCS(getpwanam)
239 AC_DEFINE(PAM_SUN_CODEBASE)
240 conf_utmp_location=/etc/utmp
241 conf_wtmp_location=/var/adm/wtmp
242 conf_lastlog_location=/var/adm/lastlog
246 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
247 LDFLAGS="$LDFLAGS -L/usr/local/lib"
252 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
253 # /usr/ucblib MUST NOT be searched on ReliantUNIX
254 LDFLAGS="$LDFLAGS -L/usr/local/lib"
255 IPADDR_IN_DISPLAY=yes
257 AC_DEFINE(IP_TOS_IS_BROKEN)
258 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
259 # Attention: always take care to bind libsocket and libnsl before libc,
260 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
263 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
264 LDFLAGS="$LDFLAGS -L/usr/local/lib"
268 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
269 LDFLAGS="$LDFLAGS -L/usr/local/lib"
273 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
274 LDFLAGS="$LDFLAGS -L/usr/local/lib"
277 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
278 LDFLAGS="$LDFLAGS -L/usr/local/lib"
279 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
282 AC_DEFINE(BROKEN_SYS_TERMIO_H)
284 AC_DEFINE(HAVE_SECUREWARE)
285 AC_DEFINE(DISABLE_SHADOW)
286 AC_DEFINE(BROKEN_SAVED_UIDS)
287 AC_CHECK_FUNCS(getluid setluid)
289 do_sco3_extra_lib_check=yes
292 if test -z "$GCC"; then
293 CFLAGS="$CFLAGS -belf"
295 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
296 LDFLAGS="$LDFLAGS -L/usr/local/lib"
297 LIBS="$LIBS -lprot -lx -ltinfo -lm"
300 AC_DEFINE(HAVE_SECUREWARE)
301 AC_DEFINE(DISABLE_SHADOW)
302 AC_DEFINE(DISABLE_FD_PASSING)
303 AC_CHECK_FUNCS(getluid setluid)
308 AC_DEFINE(DISABLE_FD_PASSING)
310 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
315 AC_DEFINE(DISABLE_FD_PASSING)
316 AC_DEFINE(NO_SSH_LASTLOG)
317 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
318 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
322 AC_MSG_CHECKING(for Digital Unix SIA)
325 [ --with-osfsia Enable Digital Unix SIA],
327 if test "x$withval" = "xno" ; then
328 AC_MSG_RESULT(disabled)
333 if test -z "$no_osfsia" ; then
334 if test -f /etc/sia/matrix.conf; then
336 AC_DEFINE(HAVE_OSF_SIA)
337 AC_DEFINE(DISABLE_LOGIN)
338 AC_DEFINE(DISABLE_FD_PASSING)
339 LIBS="$LIBS -lsecurity -ldb -lm -laud"
344 AC_DEFINE(DISABLE_FD_PASSING)
349 AC_DEFINE(NO_X11_UNIX_SOCKETS)
350 AC_DEFINE(MISSING_NFDBITS)
351 AC_DEFINE(MISSING_HOWMANY)
352 AC_DEFINE(MISSING_FD_MASK)
356 # Allow user to specify flags
358 [ --with-cflags Specify additional flags to pass to compiler],
360 if test "x$withval" != "xno" ; then
361 CFLAGS="$CFLAGS $withval"
365 AC_ARG_WITH(cppflags,
366 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
368 if test "x$withval" != "xno"; then
369 CPPFLAGS="$CPPFLAGS $withval"
374 [ --with-ldflags Specify additional flags to pass to linker],
376 if test "x$withval" != "xno" ; then
377 LDFLAGS="$LDFLAGS $withval"
382 [ --with-libs Specify additional libraries to link with],
384 if test "x$withval" != "xno" ; then
385 LIBS="$LIBS $withval"
390 # Checks for header files.
391 AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
392 getopt.h glob.h ia.h lastlog.h libgen.h limits.h login.h \
393 login_cap.h maillock.h netdb.h netgroup.h \
394 netinet/in_systm.h paths.h pty.h readpassphrase.h \
395 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
396 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
397 sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
398 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
399 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
400 util.h utime.h utmp.h utmpx.h)
402 # Checks for libraries.
403 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
404 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
406 dnl SCO OS3 needs this for libwrap
407 if test "x$with_tcp_wrappers" != "xno" ; then
408 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
409 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
413 AC_CHECK_FUNC(getspnam, ,
414 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
417 [ --without-rpath Disable auto-added -R linker paths],
419 if test "x$withval" = "xno" ; then
422 if test "x$withval" = "xyes" ; then
430 [ --with-zlib=PATH Use zlib in PATH],
432 if test "x$withval" = "xno" ; then
433 AC_MSG_ERROR([*** zlib is required ***])
435 if test -d "$withval/lib"; then
436 if test -n "${need_dash_r}"; then
437 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
439 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
442 if test -n "${need_dash_r}"; then
443 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
445 LDFLAGS="-L${withval} ${LDFLAGS}"
448 if test -d "$withval/include"; then
449 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
451 CPPFLAGS="-I${withval} ${CPPFLAGS}"
456 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
459 AC_CHECK_FUNC(strcasecmp,
460 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
462 AC_CHECK_FUNC(utimes,
463 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
464 LIBS="$LIBS -lc89"]) ]
467 dnl Checks for libutil functions
468 AC_CHECK_HEADERS(libutil.h)
469 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
470 AC_CHECK_FUNCS(logout updwtmp logwtmp)
474 # Check for ALTDIRFUNC glob() extension
475 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
476 AC_EGREP_CPP(FOUNDIT,
479 #ifdef GLOB_ALTDIRFUNC
484 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
492 # Check for g.gl_matchc glob() extension
493 AC_MSG_CHECKING(for gl_matchc field in glob_t)
494 AC_EGREP_CPP(FOUNDIT,
497 int main(void){glob_t g; g.gl_matchc = 1;}
500 AC_DEFINE(GLOB_HAS_GL_MATCHC)
508 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
511 #include <sys/types.h>
513 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
515 [AC_MSG_RESULT(yes)],
518 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
522 # Check whether the user wants GSSAPI mechglue support
523 AC_ARG_WITH(mechglue,
524 [ --with-mechglue=PATH Build with GSSAPI mechglue library],
526 AC_MSG_CHECKING(for mechglue library)
528 if test -e ${withval}/libgssapi.a ; then
529 mechglue_lib=${withval}/libgssapi.a
530 elif test -e ${withval}/lib/libgssapi.a ; then
531 mechglue_lib=${withval}/lib/libgssapi.a
533 AC_MSG_ERROR("Can't find libgssapi in ${withval}");
535 LIBS="$LIBS ${mechglue_lib}"
536 AC_MSG_RESULT(${mechglue_lib})
538 AC_CHECK_LIB(dl, dlopen, , )
539 if test $ac_cv_lib_dl_dlopen = yes; then
540 LDFLAGS="$LDFLAGS -ldl -Wl,-Bsymbolic"
551 # Check whether the user wants GSI (Globus) support
554 [ --with-gsi=PATH Enable GSI/Globus authentication support],
561 [ --with-globus=PATH Enable GSI/Globus authentication support],
567 # Check whether the user has a Globus flavor type
568 globus_flavor_type="no"
569 AC_ARG_WITH(globus-flavor,
570 [ --with-globus-flavor=TYPE Describe Globus flavor type (ex: gcc32dbg, etc.)],
572 globus_flavor_type="$withval"
576 if test "x$gsi_path" != "xno" ; then
577 # Globus GSSAPI configuration
578 AC_MSG_CHECKING(for Globus GSI)
581 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
582 AC_MSG_ERROR([Previously configured GSSAPI library conflicts with Globus/GSI.])
584 if test -z "$GSSAPI"; then
589 if test "x$globus_install_dir" = "xyes" ; then
590 AC_MSG_ERROR(--with-globus=PATH must specify a path)
593 if test "x$globus_flavor_type" = "xno" ; then
594 AC_MSG_ERROR(--with-globus-flavor=TYPE must be specified)
596 if test "x$globus_flavor_type" = "xyes" ; then
597 AC_MSG_ERROR(--with-globus-flavor=TYPE must specify a flavor type)
601 AC_MSG_CHECKING(for Globus include path)
602 GLOBUS_INCLUDE="${gsi_path}/include/${globus_flavor_type}"
603 if test ! -d "$GLOBUS_INCLUDE" ; then
604 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_INCLUDE})
606 GSI_CPPFLAGS="-I${GLOBUS_INCLUDE}"
610 # Find GPT linkline helper
613 AC_MSG_CHECKING(for GPT linkline helper)
614 if test -x $GPT_LOCATION/sbin/gpt_build_config ; then
615 gpt_linkline_helper="$GPT_LOCATION/sbin/gpt_build_config"
616 elif test -x ${gsi_path}/sbin/gpt_build_config ; then
617 gpt_linkline_helper="${gsi_path}/sbin/gpt_build_config"
619 AC_MSG_ERROR(Cannot find gpt_build_config: GPT installation is incomplete)
624 # Build Globus linkline
627 ${gpt_linkline_helper} -f ${globus_flavor_type} -link shared -src pkg_data_src.gpt
628 . ./gpt_build_temp.sh
629 GSI_LDFLAGS="-L${gsi_path}/lib"
630 GSI_LIBS="$GPT_CONFIG_PGM_LINKS"
631 LD_LIBRARY_PATH="${gsi_path}/lib:$LD_LIBRARY_PATH"; export LD_LIBRARY_PATH
634 # Test Globus linkline
637 AC_MSG_CHECKING(for Globus linkline)
638 if test -z "$GSI_LIBS" ; then
639 AC_MSG_ERROR(gpt_build_config failed)
643 LIBS="$LIBS $GSI_LIBS"
644 LDFLAGS="$LDFLAGS $GSI_LDFLAGS"
645 CPPFLAGS="$CPPFLAGS $GSI_CPPFLAGS"
647 AC_MSG_CHECKING(that Globus linkline works)
648 # test that we got the libraries OK
656 AC_MSG_ERROR(link with Globus libraries failed)
663 # End Globus/GSI section
665 # Check whether user wants S/Key support
668 [ --with-skey[[=PATH]] Enable S/Key support
669 (optionally in PATH)],
671 if test "x$withval" != "xno" ; then
673 if test "x$withval" != "xyes" ; then
674 CPPFLAGS="$CPPFLAGS -I${withval}/include"
675 LDFLAGS="$LDFLAGS -L${withval}/lib"
682 AC_MSG_CHECKING([for s/key support])
687 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
689 [AC_MSG_RESULT(yes)],
692 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
698 # Check whether user wants TCP wrappers support
700 AC_ARG_WITH(tcp-wrappers,
701 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
702 (optionally in PATH)],
704 if test "x$withval" != "xno" ; then
706 saved_LDFLAGS="$LDFLAGS"
707 saved_CPPFLAGS="$CPPFLAGS"
708 if test -n "${withval}" -a "${withval}" != "yes"; then
709 if test -d "${withval}/lib"; then
710 if test -n "${need_dash_r}"; then
711 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
713 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
716 if test -n "${need_dash_r}"; then
717 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
719 LDFLAGS="-L${withval} ${LDFLAGS}"
722 if test -d "${withval}/include"; then
723 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
725 CPPFLAGS="-I${withval} ${CPPFLAGS}"
729 LIBS="$LIBWRAP $LIBS"
730 AC_MSG_CHECKING(for libwrap)
734 int deny_severity = 0, allow_severity = 0;
744 AC_MSG_ERROR([*** libwrap missing])
752 dnl Checks for library functions. Please keep in alphabetical order
754 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename bcopy \
755 bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
756 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
757 getpeereid _getpty getrlimit getrusage getttyent glob inet_aton \
758 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
759 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openpty pstat \
760 readpassphrase realpath recvmsg rresvport_af sendmsg setdtablesize \
761 setegid setenv seteuid setgroups setlogin setpcred setproctitle \
762 setresgid setreuid setrlimit setsid setvbuf sigaction sigvec \
763 snprintf socketpair strerror strlcat strlcpy strmode strnvis \
764 sysconf tcgetpgrp truncate utimes vhangup vsnprintf waitpid \
767 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
768 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
770 dnl IRIX has basename() in libgen
771 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
773 dnl Make sure strsep prototype is defined before defining HAVE_STRSEP
774 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
776 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
777 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
778 AC_CHECK_LIB(gen, dirname,[
779 AC_CACHE_CHECK([for broken dirname],
780 ac_cv_have_broken_dirname, [
788 int main(int argc, char **argv) {
791 strncpy(buf,"/etc", 32);
793 if (!s || strncmp(s, "/", 32) != 0) {
800 [ ac_cv_have_broken_dirname="no" ],
801 [ ac_cv_have_broken_dirname="yes" ]
805 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
807 AC_DEFINE(HAVE_DIRNAME)
808 AC_CHECK_HEADERS(libgen.h)
813 dnl Checks for time functions
814 AC_CHECK_FUNCS(gettimeofday time)
815 dnl Checks for utmp functions
816 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
817 AC_CHECK_FUNCS(utmpname)
818 dnl Checks for utmpx functions
819 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
820 AC_CHECK_FUNCS(setutxent utmpxname)
822 AC_CHECK_FUNC(daemon,
823 [AC_DEFINE(HAVE_DAEMON)],
824 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
827 AC_CHECK_FUNC(getpagesize,
828 [AC_DEFINE(HAVE_GETPAGESIZE)],
829 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
832 # Check for broken snprintf
833 if test "x$ac_cv_func_snprintf" = "xyes" ; then
834 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
838 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
840 [AC_MSG_RESULT(yes)],
843 AC_DEFINE(BROKEN_SNPRINTF)
844 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
849 dnl see whether mkstemp() requires XXXXXX
850 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
851 AC_MSG_CHECKING([for (overly) strict mkstemp])
855 main() { char template[]="conftest.mkstemp-test";
856 if (mkstemp(template) == -1)
858 unlink(template); exit(0);
866 AC_DEFINE(HAVE_STRICT_MKSTEMP)
870 AC_DEFINE(HAVE_STRICT_MKSTEMP)
880 [ --with-pam Enable PAM support ],
882 if test "x$withval" != "xno" ; then
883 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
884 AC_MSG_ERROR([PAM headers not found])
887 AC_CHECK_LIB(dl, dlopen, , )
888 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
889 AC_CHECK_FUNCS(pam_getenvlist)
890 AC_CHECK_FUNCS(pam_putenv)
896 if test $ac_cv_lib_dl_dlopen = yes; then
907 # Check for older PAM
908 if test "x$PAM_MSG" = "xyes" ; then
909 # Check PAM strerror arguments (old PAM)
910 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
914 #include <security/pam_appl.h>
916 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
919 AC_DEFINE(HAVE_OLD_PAM)
921 PAM_MSG="yes (old library)"
926 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
927 # because the system crypt() is more featureful.
928 if test "x$check_for_libcrypt_before" = "x1"; then
929 AC_CHECK_LIB(crypt, crypt)
933 saved_CPPFLAGS="$CPPFLAGS"
934 saved_LDFLAGS="$LDFLAGS"
936 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
938 if test "x$withval" != "xno" ; then
939 if test -d "$withval/lib"; then
940 if test -n "${need_dash_r}"; then
941 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
943 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
946 if test -n "${need_dash_r}"; then
947 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
949 LDFLAGS="-L${withval} ${LDFLAGS}"
952 if test -d "$withval/include"; then
953 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
955 CPPFLAGS="-I${withval} ${CPPFLAGS}"
961 if test -z "$GSI_LIBS" ; then
962 LIBS="$LIBS -lcrypto"
965 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
967 dnl Check default openssl install dir
968 if test -n "${need_dash_r}"; then
969 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
971 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
973 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
974 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
976 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
982 # Determine OpenSSL header version
983 AC_MSG_CHECKING([OpenSSL header version])
988 #include <openssl/opensslv.h>
989 #define DATA "conftest.sslincver"
994 fd = fopen(DATA,"w");
998 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1005 ssl_header_ver=`cat conftest.sslincver`
1006 AC_MSG_RESULT($ssl_header_ver)
1009 AC_MSG_RESULT(not found)
1010 AC_MSG_ERROR(OpenSSL version header not found.)
1014 # Determine OpenSSL library version
1015 AC_MSG_CHECKING([OpenSSL library version])
1020 #include <openssl/opensslv.h>
1021 #include <openssl/crypto.h>
1022 #define DATA "conftest.ssllibver"
1027 fd = fopen(DATA,"w");
1031 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1038 ssl_library_ver=`cat conftest.ssllibver`
1039 AC_MSG_RESULT($ssl_library_ver)
1042 AC_MSG_RESULT(not found)
1043 AC_MSG_ERROR(OpenSSL library not found.)
1047 # Sanity check OpenSSL headers
1048 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1052 #include <openssl/opensslv.h>
1053 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1060 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
1064 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1065 # version in OpenSSL. Skip this for PAM
1066 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
1067 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1071 ### Configure cryptographic random number support
1073 # Check wheter OpenSSL seeds itself
1074 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1078 #include <openssl/rand.h>
1079 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1082 OPENSSL_SEEDS_ITSELF=yes
1087 # Default to use of the rand helper if OpenSSL doesn't
1094 # Do we want to force the use of the rand helper?
1095 AC_ARG_WITH(rand-helper,
1096 [ --with-rand-helper Use subprocess to gather strong randomness ],
1098 if test "x$withval" = "xno" ; then
1099 # Force use of OpenSSL's internal RNG, even if
1100 # the previous test showed it to be unseeded.
1101 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1102 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1103 OPENSSL_SEEDS_ITSELF=yes
1112 # Which randomness source do we use?
1113 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1115 AC_DEFINE(OPENSSL_PRNG_ONLY)
1116 RAND_MSG="OpenSSL internal ONLY"
1117 INSTALL_SSH_RAND_HELPER=""
1118 elif test ! -z "$USE_RAND_HELPER" ; then
1119 # install rand helper
1120 RAND_MSG="ssh-rand-helper"
1121 INSTALL_SSH_RAND_HELPER="yes"
1123 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1125 ### Configuration of ssh-rand-helper
1128 AC_ARG_WITH(prngd-port,
1129 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1138 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1141 if test ! -z "$withval" ; then
1142 PRNGD_PORT="$withval"
1143 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1148 # PRNGD Unix domain socket
1149 AC_ARG_WITH(prngd-socket,
1150 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1154 withval="/var/run/egd-pool"
1162 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1166 if test ! -z "$withval" ; then
1167 if test ! -z "$PRNGD_PORT" ; then
1168 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1170 if test ! -r "$withval" ; then
1171 AC_MSG_WARN(Entropy socket is not readable)
1173 PRNGD_SOCKET="$withval"
1174 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1178 # Check for existing socket only if we don't have a random device already
1179 if test "$USE_RAND_HELPER" = yes ; then
1180 AC_MSG_CHECKING(for PRNGD/EGD socket)
1181 # Insert other locations here
1182 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1183 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1184 PRNGD_SOCKET="$sock"
1185 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1189 if test ! -z "$PRNGD_SOCKET" ; then
1190 AC_MSG_RESULT($PRNGD_SOCKET)
1192 AC_MSG_RESULT(not found)
1198 # Change default command timeout for hashing entropy source
1200 AC_ARG_WITH(entropy-timeout,
1201 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1203 if test "x$withval" != "xno" ; then
1204 entropy_timeout=$withval
1208 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1210 SSH_PRIVSEP_USER=sshd
1211 AC_ARG_WITH(privsep-user,
1212 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1214 if test -n "$withval"; then
1215 SSH_PRIVSEP_USER=$withval
1219 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1220 AC_SUBST(SSH_PRIVSEP_USER)
1222 # We do this little dance with the search path to insure
1223 # that programs that we select for use by installed programs
1224 # (which may be run by the super-user) come from trusted
1225 # locations before they come from the user's private area.
1226 # This should help avoid accidentally configuring some
1227 # random version of a program in someone's personal bin.
1231 test -h /bin 2> /dev/null && PATH=/usr/bin
1232 test -d /sbin && PATH=$PATH:/sbin
1233 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1234 PATH=$PATH:/etc:$OPATH
1236 # These programs are used by the command hashing source to gather entropy
1237 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1238 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1239 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1240 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1241 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1242 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1243 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1244 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1245 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1246 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1247 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1248 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1249 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1250 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1251 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1252 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1256 # Where does ssh-rand-helper get its randomness from?
1257 INSTALL_SSH_PRNG_CMDS=""
1258 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1259 if test ! -z "$PRNGD_PORT" ; then
1260 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1261 elif test ! -z "$PRNGD_SOCKET" ; then
1262 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1264 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1265 RAND_HELPER_CMDHASH=yes
1266 INSTALL_SSH_PRNG_CMDS="yes"
1269 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1272 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1273 if test ! -z "$SONY" ; then
1274 LIBS="$LIBS -liberty";
1277 # Checks for data types
1278 AC_CHECK_SIZEOF(char, 1)
1279 AC_CHECK_SIZEOF(short int, 2)
1280 AC_CHECK_SIZEOF(int, 4)
1281 AC_CHECK_SIZEOF(long int, 4)
1282 AC_CHECK_SIZEOF(long long int, 8)
1284 # Sanity check long long for some platforms (AIX)
1285 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1286 ac_cv_sizeof_long_long_int=0
1289 # More checks for data types
1290 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1292 [ #include <sys/types.h> ],
1294 [ ac_cv_have_u_int="yes" ],
1295 [ ac_cv_have_u_int="no" ]
1298 if test "x$ac_cv_have_u_int" = "xyes" ; then
1299 AC_DEFINE(HAVE_U_INT)
1303 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1305 [ #include <sys/types.h> ],
1306 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1307 [ ac_cv_have_intxx_t="yes" ],
1308 [ ac_cv_have_intxx_t="no" ]
1311 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1312 AC_DEFINE(HAVE_INTXX_T)
1316 if (test -z "$have_intxx_t" && \
1317 test "x$ac_cv_header_stdint_h" = "xyes")
1319 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1321 [ #include <stdint.h> ],
1322 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1324 AC_DEFINE(HAVE_INTXX_T)
1327 [ AC_MSG_RESULT(no) ]
1331 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1334 #include <sys/types.h>
1335 #ifdef HAVE_STDINT_H
1336 # include <stdint.h>
1338 #include <sys/socket.h>
1339 #ifdef HAVE_SYS_BITYPES_H
1340 # include <sys/bitypes.h>
1343 [ int64_t a; a = 1;],
1344 [ ac_cv_have_int64_t="yes" ],
1345 [ ac_cv_have_int64_t="no" ]
1348 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1349 AC_DEFINE(HAVE_INT64_T)
1352 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1354 [ #include <sys/types.h> ],
1355 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1356 [ ac_cv_have_u_intxx_t="yes" ],
1357 [ ac_cv_have_u_intxx_t="no" ]
1360 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1361 AC_DEFINE(HAVE_U_INTXX_T)
1365 if test -z "$have_u_intxx_t" ; then
1366 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1368 [ #include <sys/socket.h> ],
1369 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1371 AC_DEFINE(HAVE_U_INTXX_T)
1374 [ AC_MSG_RESULT(no) ]
1378 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1380 [ #include <sys/types.h> ],
1381 [ u_int64_t a; a = 1;],
1382 [ ac_cv_have_u_int64_t="yes" ],
1383 [ ac_cv_have_u_int64_t="no" ]
1386 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1387 AC_DEFINE(HAVE_U_INT64_T)
1391 if test -z "$have_u_int64_t" ; then
1392 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1394 [ #include <sys/bitypes.h> ],
1395 [ u_int64_t a; a = 1],
1397 AC_DEFINE(HAVE_U_INT64_T)
1400 [ AC_MSG_RESULT(no) ]
1404 if test -z "$have_u_intxx_t" ; then
1405 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1408 #include <sys/types.h>
1410 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1411 [ ac_cv_have_uintxx_t="yes" ],
1412 [ ac_cv_have_uintxx_t="no" ]
1415 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1416 AC_DEFINE(HAVE_UINTXX_T)
1420 if test -z "$have_uintxx_t" ; then
1421 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1423 [ #include <stdint.h> ],
1424 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1426 AC_DEFINE(HAVE_UINTXX_T)
1429 [ AC_MSG_RESULT(no) ]
1433 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1434 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1436 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1439 #include <sys/bitypes.h>
1442 int8_t a; int16_t b; int32_t c;
1443 u_int8_t e; u_int16_t f; u_int32_t g;
1444 a = b = c = e = f = g = 1;
1447 AC_DEFINE(HAVE_U_INTXX_T)
1448 AC_DEFINE(HAVE_INTXX_T)
1456 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1459 #include <sys/types.h>
1461 [ u_char foo; foo = 125; ],
1462 [ ac_cv_have_u_char="yes" ],
1463 [ ac_cv_have_u_char="no" ]
1466 if test "x$ac_cv_have_u_char" = "xyes" ; then
1467 AC_DEFINE(HAVE_U_CHAR)
1472 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1474 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1477 #include <sys/types.h>
1479 [ size_t foo; foo = 1235; ],
1480 [ ac_cv_have_size_t="yes" ],
1481 [ ac_cv_have_size_t="no" ]
1484 if test "x$ac_cv_have_size_t" = "xyes" ; then
1485 AC_DEFINE(HAVE_SIZE_T)
1488 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1491 #include <sys/types.h>
1493 [ ssize_t foo; foo = 1235; ],
1494 [ ac_cv_have_ssize_t="yes" ],
1495 [ ac_cv_have_ssize_t="no" ]
1498 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1499 AC_DEFINE(HAVE_SSIZE_T)
1502 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1507 [ clock_t foo; foo = 1235; ],
1508 [ ac_cv_have_clock_t="yes" ],
1509 [ ac_cv_have_clock_t="no" ]
1512 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1513 AC_DEFINE(HAVE_CLOCK_T)
1516 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1519 #include <sys/types.h>
1520 #include <sys/socket.h>
1522 [ sa_family_t foo; foo = 1235; ],
1523 [ ac_cv_have_sa_family_t="yes" ],
1526 #include <sys/types.h>
1527 #include <sys/socket.h>
1528 #include <netinet/in.h>
1530 [ sa_family_t foo; foo = 1235; ],
1531 [ ac_cv_have_sa_family_t="yes" ],
1533 [ ac_cv_have_sa_family_t="no" ]
1537 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1538 AC_DEFINE(HAVE_SA_FAMILY_T)
1541 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1544 #include <sys/types.h>
1546 [ pid_t foo; foo = 1235; ],
1547 [ ac_cv_have_pid_t="yes" ],
1548 [ ac_cv_have_pid_t="no" ]
1551 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1552 AC_DEFINE(HAVE_PID_T)
1555 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1558 #include <sys/types.h>
1560 [ mode_t foo; foo = 1235; ],
1561 [ ac_cv_have_mode_t="yes" ],
1562 [ ac_cv_have_mode_t="no" ]
1565 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1566 AC_DEFINE(HAVE_MODE_T)
1570 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1573 #include <sys/types.h>
1574 #include <sys/socket.h>
1576 [ struct sockaddr_storage s; ],
1577 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1578 [ ac_cv_have_struct_sockaddr_storage="no" ]
1581 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1582 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1585 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1588 #include <sys/types.h>
1589 #include <netinet/in.h>
1591 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1592 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1593 [ ac_cv_have_struct_sockaddr_in6="no" ]
1596 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1597 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1600 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1603 #include <sys/types.h>
1604 #include <netinet/in.h>
1606 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1607 [ ac_cv_have_struct_in6_addr="yes" ],
1608 [ ac_cv_have_struct_in6_addr="no" ]
1611 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1612 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1615 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1618 #include <sys/types.h>
1619 #include <sys/socket.h>
1622 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1623 [ ac_cv_have_struct_addrinfo="yes" ],
1624 [ ac_cv_have_struct_addrinfo="no" ]
1627 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1628 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1631 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1633 [ #include <sys/time.h> ],
1634 [ struct timeval tv; tv.tv_sec = 1;],
1635 [ ac_cv_have_struct_timeval="yes" ],
1636 [ ac_cv_have_struct_timeval="no" ]
1639 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1640 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1641 have_struct_timeval=1
1644 AC_CHECK_TYPES(struct timespec)
1646 # We need int64_t or else certian parts of the compile will fail.
1647 if test "x$ac_cv_have_int64_t" = "xno" -a \
1648 "x$ac_cv_sizeof_long_int" != "x8" -a \
1649 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1650 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1651 echo "an alternative compiler (I.E., GCC) before continuing."
1655 dnl test snprintf (broken on SCO w/gcc)
1660 #ifdef HAVE_SNPRINTF
1664 char expected_out[50];
1666 #if (SIZEOF_LONG_INT == 8)
1667 long int num = 0x7fffffffffffffff;
1669 long long num = 0x7fffffffffffffffll;
1671 strcpy(expected_out, "9223372036854775807");
1672 snprintf(buf, mazsize, "%lld", num);
1673 if(strcmp(buf, expected_out) != 0)
1680 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1684 dnl Checks for structure members
1685 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1686 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1687 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1688 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1689 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1690 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1691 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1692 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1693 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1694 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1695 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1696 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1697 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1698 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1699 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1700 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1701 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1703 AC_CHECK_MEMBERS([struct stat.st_blksize])
1705 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1706 ac_cv_have_ss_family_in_struct_ss, [
1709 #include <sys/types.h>
1710 #include <sys/socket.h>
1712 [ struct sockaddr_storage s; s.ss_family = 1; ],
1713 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1714 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1717 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1718 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1721 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1722 ac_cv_have___ss_family_in_struct_ss, [
1725 #include <sys/types.h>
1726 #include <sys/socket.h>
1728 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1729 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1730 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1733 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1734 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1737 AC_CACHE_CHECK([for pw_class field in struct passwd],
1738 ac_cv_have_pw_class_in_struct_passwd, [
1743 [ struct passwd p; p.pw_class = 0; ],
1744 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1745 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1748 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1749 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1752 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1753 ac_cv_have_pw_expire_in_struct_passwd, [
1758 [ struct passwd p; p.pw_expire = 0; ],
1759 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1760 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1763 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1764 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1767 AC_CACHE_CHECK([for pw_change field in struct passwd],
1768 ac_cv_have_pw_change_in_struct_passwd, [
1773 [ struct passwd p; p.pw_change = 0; ],
1774 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1775 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1778 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1779 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1782 dnl make sure we're using the real structure members and not defines
1783 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1784 ac_cv_have_accrights_in_msghdr, [
1787 #include <sys/types.h>
1788 #include <sys/socket.h>
1789 #include <sys/uio.h>
1791 #ifdef msg_accrights
1795 m.msg_accrights = 0;
1799 [ ac_cv_have_accrights_in_msghdr="yes" ],
1800 [ ac_cv_have_accrights_in_msghdr="no" ]
1803 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1804 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1807 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1808 ac_cv_have_control_in_msghdr, [
1811 #include <sys/types.h>
1812 #include <sys/socket.h>
1813 #include <sys/uio.h>
1823 [ ac_cv_have_control_in_msghdr="yes" ],
1824 [ ac_cv_have_control_in_msghdr="no" ]
1827 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1828 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1831 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1833 [ extern char *__progname; printf("%s", __progname); ],
1834 [ ac_cv_libc_defines___progname="yes" ],
1835 [ ac_cv_libc_defines___progname="no" ]
1838 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1839 AC_DEFINE(HAVE___PROGNAME)
1842 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1846 [ printf("%s", __FUNCTION__); ],
1847 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1848 [ ac_cv_cc_implements___FUNCTION__="no" ]
1851 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1852 AC_DEFINE(HAVE___FUNCTION__)
1855 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1859 [ printf("%s", __func__); ],
1860 [ ac_cv_cc_implements___func__="yes" ],
1861 [ ac_cv_cc_implements___func__="no" ]
1864 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1865 AC_DEFINE(HAVE___func__)
1868 AC_CACHE_CHECK([whether getopt has optreset support],
1869 ac_cv_have_getopt_optreset, [
1874 [ extern int optreset; optreset = 0; ],
1875 [ ac_cv_have_getopt_optreset="yes" ],
1876 [ ac_cv_have_getopt_optreset="no" ]
1879 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1880 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1883 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1885 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1886 [ ac_cv_libc_defines_sys_errlist="yes" ],
1887 [ ac_cv_libc_defines_sys_errlist="no" ]
1890 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1891 AC_DEFINE(HAVE_SYS_ERRLIST)
1895 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1897 [ extern int sys_nerr; printf("%i", sys_nerr);],
1898 [ ac_cv_libc_defines_sys_nerr="yes" ],
1899 [ ac_cv_libc_defines_sys_nerr="no" ]
1902 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1903 AC_DEFINE(HAVE_SYS_NERR)
1908 # Check whether user wants sectok support
1910 [ --with-sectok Enable smartcard support using libsectok],
1912 if test "x$withval" != "xno" ; then
1913 if test "x$withval" != "xyes" ; then
1914 CPPFLAGS="$CPPFLAGS -I${withval}"
1915 LDFLAGS="$LDFLAGS -L${withval}"
1916 if test ! -z "$need_dash_r" ; then
1917 LDFLAGS="$LDFLAGS -R${withval}"
1919 if test ! -z "$blibpath" ; then
1920 blibpath="$blibpath:${withval}"
1923 AC_CHECK_HEADERS(sectok.h)
1924 if test "$ac_cv_header_sectok_h" != yes; then
1925 AC_MSG_ERROR(Can't find sectok.h)
1927 AC_CHECK_LIB(sectok, sectok_open)
1928 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1929 AC_MSG_ERROR(Can't find libsectok)
1931 AC_DEFINE(SMARTCARD)
1932 AC_DEFINE(USE_SECTOK)
1933 SCARD_MSG="yes, using sectok"
1938 # Check whether user wants OpenSC support
1940 AC_HELP_STRING([--with-opensc=PFX],
1941 [Enable smartcard support using OpenSC]),
1942 opensc_config_prefix="$withval", opensc_config_prefix="")
1943 if test x$opensc_config_prefix != x ; then
1944 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1945 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1946 if test "$OPENSC_CONFIG" != "no"; then
1947 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1948 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1949 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1950 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1951 AC_DEFINE(SMARTCARD)
1952 AC_DEFINE(USE_OPENSC)
1953 SCARD_MSG="yes, using OpenSC"
1957 # Check whether user wants Kerberos 5 support
1959 AC_ARG_WITH(kerberos5,
1960 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1962 if test "x$withval" != "xno" ; then
1963 if test "x$withval" = "xyes" ; then
1964 KRB5ROOT="/usr/local"
1968 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1969 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1972 AC_MSG_CHECKING(whether we are using Heimdal)
1973 AC_TRY_COMPILE([ #include <krb5.h> ],
1974 [ char *tmp = heimdal_version; ],
1975 [ AC_MSG_RESULT(yes)
1977 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1980 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1983 if test ! -z "$need_dash_r" ; then
1984 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1986 if test ! -z "$blibpath" ; then
1987 blibpath="$blibpath:${KRB5ROOT}/lib"
1989 AC_CHECK_LIB(resolv, dn_expand, , )
1991 # If we're using some other GSSAPI
1992 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
1993 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
1995 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1997 K5LIBS="-lgssapi $K5LIBS" ],
1998 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2000 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2001 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2006 AC_CHECK_HEADER(gssapi.h, ,
2007 [ unset ac_cv_header_gssapi_h
2008 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2009 AC_CHECK_HEADERS(gssapi.h, ,
2010 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2015 AC_CHECK_LIB(gssapi, gss_krb5_copy_ccache, /bin/true,
2016 [ K5LIBS="-lgssapi_krb5 $K5LIBS"
2017 AC_CHECK_LIB(gssapi_krb5, gss_krb5_copy_ccache, /bin/true,
2018 AC_MSG_WARN([Cannot find gss_krb5_copy_ccache -- build may fail]),
2024 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2025 AC_CHECK_HEADER(gssapi_krb5.h, ,
2026 [ CPPFLAGS="$oldCPP" ])
2028 if test -z "$GSSAPI"; then
2036 # Check whether user wants Kerberos 4 support
2038 AC_ARG_WITH(kerberos4,
2039 [ --with-kerberos4=PATH Enable Kerberos 4 support],
2041 if test "x$withval" != "xno" ; then
2042 if test "x$withval" != "xyes" ; then
2043 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2044 LDFLAGS="$LDFLAGS -L${withval}/lib"
2045 if test ! -z "$need_dash_r" ; then
2046 LDFLAGS="$LDFLAGS -R${withval}/lib"
2048 if test ! -z "$blibpath" ; then
2049 blibpath="$blibpath:${withval}/lib"
2052 if test -d /usr/include/kerberosIV ; then
2053 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
2057 AC_CHECK_HEADERS(krb.h)
2058 if test "$ac_cv_header_krb_h" != yes; then
2059 AC_MSG_WARN([Cannot find krb.h, build may fail])
2061 AC_CHECK_LIB(krb, main)
2062 if test "$ac_cv_lib_krb_main" != yes; then
2063 AC_CHECK_LIB(krb4, main)
2064 if test "$ac_cv_lib_krb4_main" != yes; then
2065 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
2072 AC_CHECK_LIB(des, des_cbc_encrypt)
2073 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
2074 AC_CHECK_LIB(des425, des_cbc_encrypt)
2075 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
2076 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
2083 AC_CHECK_LIB(resolv, dn_expand, , )
2091 # Check whether user wants AFS_KRB5 support
2093 AC_ARG_WITH(afs-krb5,
2094 [ --with-afs-krb5[[=AKLOG_PATH]] Enable aklog to get token (default=/usr/bin/aklog).],
2096 if test "x$withval" != "xno" ; then
2098 if test "x$withval" != "xyes" ; then
2099 AC_DEFINE_UNQUOTED(AKLOG_PATH, "$withval")
2101 AC_DEFINE_UNQUOTED(AKLOG_PATH, "/usr/bin/aklog")
2104 if test -z "$KRB5" ; then
2105 AC_MSG_WARN([AFS_KRB5 requires Kerberos 5 support, build may fail])
2108 LIBS="-lkrbafs $LIBS"
2109 if test ! -z "$AFS_LIBS" ; then
2110 LIBS="$LIBS $AFS_LIBS"
2118 # Check whether user wants AFS support
2121 [ --with-afs=PATH Enable AFS support],
2123 if test "x$withval" != "xno" ; then
2125 if test "x$withval" != "xyes" ; then
2126 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2127 LDFLAGS="$LDFLAGS -L${withval}/lib"
2130 if test -z "$KRB4" ; then
2131 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
2135 if test ! -z "$AFS_LIBS" ; then
2136 LIBS="$LIBS $AFS_LIBS"
2143 LIBS="$LIBS $KLIBS $K5LIBS"
2145 AC_ARG_WITH(session-hooks,
2146 [ --with-session-hooks Enable hooks for executing external commands before/after a session],
2147 [ AC_DEFINE(SESSION_HOOKS) ]
2150 # Looking for programs, paths and files
2152 PRIVSEP_PATH=/var/empty
2153 AC_ARG_WITH(privsep-path,
2154 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2156 if test "x$withval" != "$no" ; then
2157 PRIVSEP_PATH=$withval
2161 AC_SUBST(PRIVSEP_PATH)
2164 [ --with-xauth=PATH Specify path to xauth program ],
2166 if test "x$withval" != "xno" ; then
2172 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2173 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2174 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2175 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2176 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2177 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2178 xauth_path="/usr/openwin/bin/xauth"
2184 AC_ARG_ENABLE(strip,
2185 [ --disable-strip Disable calling strip(1) on install],
2187 if test "x$enableval" = "xno" ; then
2194 if test -z "$xauth_path" ; then
2195 XAUTH_PATH="undefined"
2196 AC_SUBST(XAUTH_PATH)
2198 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2199 XAUTH_PATH=$xauth_path
2200 AC_SUBST(XAUTH_PATH)
2203 # Check for mail directory (last resort if we cannot get it from headers)
2204 if test ! -z "$MAIL" ; then
2205 maildir=`dirname $MAIL`
2206 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2209 if test -z "$no_dev_ptmx" ; then
2210 if test "x$disable_ptmx_check" != "xyes" ; then
2211 AC_CHECK_FILE("/dev/ptmx",
2213 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2219 AC_CHECK_FILE("/dev/ptc",
2221 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2226 # Options from here on. Some of these are preset by platform above
2227 AC_ARG_WITH(mantype,
2228 [ --with-mantype=man|cat|doc Set man page type],
2235 AC_MSG_ERROR(invalid man type: $withval)
2240 if test -z "$MANTYPE"; then
2241 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2242 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2243 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2245 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2252 if test "$MANTYPE" = "doc"; then
2259 # Check whether to enable MD5 passwords
2261 AC_ARG_WITH(md5-passwords,
2262 [ --with-md5-passwords Enable use of MD5 passwords],
2264 if test "x$withval" != "xno" ; then
2265 AC_DEFINE(HAVE_MD5_PASSWORDS)
2271 # Whether to disable shadow password support
2273 [ --without-shadow Disable shadow password support],
2275 if test "x$withval" = "xno" ; then
2276 AC_DEFINE(DISABLE_SHADOW)
2282 if test -z "$disable_shadow" ; then
2283 AC_MSG_CHECKING([if the systems has expire shadow information])
2286 #include <sys/types.h>
2289 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2290 [ sp_expire_available=yes ], []
2293 if test "x$sp_expire_available" = "xyes" ; then
2295 AC_DEFINE(HAS_SHADOW_EXPIRE)
2301 # Use ip address instead of hostname in $DISPLAY
2302 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2303 DISPLAY_HACK_MSG="yes"
2304 AC_DEFINE(IPADDR_IN_DISPLAY)
2306 DISPLAY_HACK_MSG="no"
2307 AC_ARG_WITH(ipaddr-display,
2308 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2310 if test "x$withval" != "xno" ; then
2311 AC_DEFINE(IPADDR_IN_DISPLAY)
2312 DISPLAY_HACK_MSG="yes"
2318 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2319 if test $ac_cv_func_login_getcapbool = "yes" -a \
2320 $ac_cv_header_login_cap_h = "yes" ; then
2323 # Whether to mess with the default path
2324 SERVER_PATH_MSG="(default)"
2325 AC_ARG_WITH(default-path,
2326 [ --with-default-path= Specify default \$PATH environment for server],
2328 if test "$USES_LOGIN_CONF" = "yes" ; then
2330 --with-default-path=PATH has no effect on this system.
2331 Edit /etc/login.conf instead.])
2332 elif test "x$withval" != "xno" ; then
2333 user_path="$withval"
2334 SERVER_PATH_MSG="$withval"
2337 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2338 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2342 /* find out what STDPATH is */
2347 #ifndef _PATH_STDPATH
2348 # ifdef _PATH_USERPATH /* Irix */
2349 # define _PATH_STDPATH _PATH_USERPATH
2351 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2354 #include <sys/types.h>
2355 #include <sys/stat.h>
2357 #define DATA "conftest.stdpath"
2364 fd = fopen(DATA,"w");
2368 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2373 ], [ user_path=`cat conftest.stdpath` ],
2374 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2375 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2379 if test "$USES_LOGIN_CONF" != "yes" ; then
2380 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2384 # Set superuser path separately to user path
2385 AC_ARG_WITH(superuser-path,
2386 [ --with-superuser-path= Specify different path for super-user],
2388 if test "x$withval" != "xno" ; then
2389 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2390 superuser_path=$withval
2396 # Whether to force IPv4 by default (needed on broken glibc Linux)
2398 AC_ARG_WITH(ipv4-default,
2399 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2401 if test "x$withval" != "xno" ; then
2402 AC_DEFINE(IPV4_DEFAULT)
2408 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2409 IPV4_IN6_HACK_MSG="no"
2411 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2413 if test "x$withval" != "xno" ; then
2415 AC_DEFINE(IPV4_IN_IPV6)
2416 IPV4_IN6_HACK_MSG="yes"
2421 if test "x$inet6_default_4in6" = "xyes"; then
2422 AC_MSG_RESULT([yes (default)])
2423 AC_DEFINE(IPV4_IN_IPV6)
2424 IPV4_IN6_HACK_MSG="yes"
2426 AC_MSG_RESULT([no (default)])
2431 # Whether to enable BSD auth support
2433 AC_ARG_WITH(bsd-auth,
2434 [ --with-bsd-auth Enable BSD auth support],
2436 if test "x$withval" != "xno" ; then
2443 dnl allow user to disable some login recording features
2444 AC_ARG_ENABLE(lastlog,
2445 [ --disable-lastlog disable use of lastlog even if detected [no]],
2446 [ AC_DEFINE(DISABLE_LASTLOG) ]
2449 [ --disable-utmp disable use of utmp even if detected [no]],
2450 [ AC_DEFINE(DISABLE_UTMP) ]
2452 AC_ARG_ENABLE(utmpx,
2453 [ --disable-utmpx disable use of utmpx even if detected [no]],
2454 [ AC_DEFINE(DISABLE_UTMPX) ]
2457 [ --disable-wtmp disable use of wtmp even if detected [no]],
2458 [ AC_DEFINE(DISABLE_WTMP) ]
2460 AC_ARG_ENABLE(wtmpx,
2461 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2462 [ AC_DEFINE(DISABLE_WTMPX) ]
2464 AC_ARG_ENABLE(libutil,
2465 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2466 [ AC_DEFINE(DISABLE_LOGIN) ]
2468 AC_ARG_ENABLE(pututline,
2469 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2470 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2472 AC_ARG_ENABLE(pututxline,
2473 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2474 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2476 AC_ARG_WITH(lastlog,
2477 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2479 if test "x$withval" = "xno" ; then
2480 AC_DEFINE(DISABLE_LASTLOG)
2482 conf_lastlog_location=$withval
2487 dnl lastlog, [uw]tmpx? detection
2488 dnl NOTE: set the paths in the platform section to avoid the
2489 dnl need for command-line parameters
2490 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2492 dnl lastlog detection
2493 dnl NOTE: the code itself will detect if lastlog is a directory
2494 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2496 #include <sys/types.h>
2498 #ifdef HAVE_LASTLOG_H
2499 # include <lastlog.h>
2508 [ char *lastlog = LASTLOG_FILE; ],
2509 [ AC_MSG_RESULT(yes) ],
2512 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2514 #include <sys/types.h>
2516 #ifdef HAVE_LASTLOG_H
2517 # include <lastlog.h>
2523 [ char *lastlog = _PATH_LASTLOG; ],
2524 [ AC_MSG_RESULT(yes) ],
2527 system_lastlog_path=no
2532 if test -z "$conf_lastlog_location"; then
2533 if test x"$system_lastlog_path" = x"no" ; then
2534 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2535 if (test -d "$f" || test -f "$f") ; then
2536 conf_lastlog_location=$f
2539 if test -z "$conf_lastlog_location"; then
2540 AC_MSG_WARN([** Cannot find lastlog **])
2541 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2546 if test -n "$conf_lastlog_location"; then
2547 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2551 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2553 #include <sys/types.h>
2559 [ char *utmp = UTMP_FILE; ],
2560 [ AC_MSG_RESULT(yes) ],
2562 system_utmp_path=no ]
2564 if test -z "$conf_utmp_location"; then
2565 if test x"$system_utmp_path" = x"no" ; then
2566 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2567 if test -f $f ; then
2568 conf_utmp_location=$f
2571 if test -z "$conf_utmp_location"; then
2572 AC_DEFINE(DISABLE_UTMP)
2576 if test -n "$conf_utmp_location"; then
2577 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2581 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2583 #include <sys/types.h>
2589 [ char *wtmp = WTMP_FILE; ],
2590 [ AC_MSG_RESULT(yes) ],
2592 system_wtmp_path=no ]
2594 if test -z "$conf_wtmp_location"; then
2595 if test x"$system_wtmp_path" = x"no" ; then
2596 for f in /usr/adm/wtmp /var/log/wtmp; do
2597 if test -f $f ; then
2598 conf_wtmp_location=$f
2601 if test -z "$conf_wtmp_location"; then
2602 AC_DEFINE(DISABLE_WTMP)
2606 if test -n "$conf_wtmp_location"; then
2607 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2611 dnl utmpx detection - I don't know any system so perverse as to require
2612 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2614 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2616 #include <sys/types.h>
2625 [ char *utmpx = UTMPX_FILE; ],
2626 [ AC_MSG_RESULT(yes) ],
2628 system_utmpx_path=no ]
2630 if test -z "$conf_utmpx_location"; then
2631 if test x"$system_utmpx_path" = x"no" ; then
2632 AC_DEFINE(DISABLE_UTMPX)
2635 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2639 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2641 #include <sys/types.h>
2650 [ char *wtmpx = WTMPX_FILE; ],
2651 [ AC_MSG_RESULT(yes) ],
2653 system_wtmpx_path=no ]
2655 if test -z "$conf_wtmpx_location"; then
2656 if test x"$system_wtmpx_path" = x"no" ; then
2657 AC_DEFINE(DISABLE_WTMPX)
2660 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2664 if test ! -z "$blibpath" ; then
2665 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2666 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2669 dnl remove pam and dl because they are in $LIBPAM
2670 if test "$PAM_MSG" = yes ; then
2671 LIBS=`echo $LIBS | sed 's/-lpam //'`
2673 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2674 LIBS=`echo $LIBS | sed 's/-ldl //'`
2678 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2681 # Print summary of options
2683 # Someone please show me a better way :)
2684 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2685 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2686 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2687 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2688 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2689 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2690 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2691 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2692 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2695 echo "OpenSSH has been configured with the following options:"
2696 echo " User binaries: $B"
2697 echo " System binaries: $C"
2698 echo " Configuration files: $D"
2699 echo " Askpass program: $E"
2700 echo " Manual pages: $F"
2701 echo " Privilege separation chroot path: $H"
2702 if test "$USES_LOGIN_CONF" = "yes" ; then
2703 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2705 echo " sshd default user PATH: $I"
2707 if test ! -z "$superuser_path" ; then
2708 echo " sshd superuser user PATH: $J"
2710 echo " Manpage format: $MANTYPE"
2711 echo " PAM support: ${PAM_MSG}"
2712 echo " KerberosIV support: $KRB4_MSG"
2713 echo " KerberosV support: $KRB5_MSG"
2714 echo " Smartcard support: $SCARD_MSG"
2715 echo " AFS support: $AFS_MSG"
2716 echo " S/KEY support: $SKEY_MSG"
2717 echo " TCP Wrappers support: $TCPW_MSG"
2718 echo " MD5 password support: $MD5_MSG"
2719 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2720 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2721 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2722 echo " BSD Auth support: $BSD_AUTH_MSG"
2723 echo " Random number source: $RAND_MSG"
2724 if test ! -z "$USE_RAND_HELPER" ; then
2725 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2730 echo " Host: ${host}"
2731 echo " Compiler: ${CC}"
2732 echo " Compiler flags: ${CFLAGS}"
2733 echo "Preprocessor flags: ${CPPFLAGS}"
2734 echo " Linker flags: ${LDFLAGS}"
2735 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2739 if test "x$PAM_MSG" = "xyes" ; then
2740 echo "PAM is enabled. You may need to install a PAM control file "
2741 echo "for sshd, otherwise password authentication may fail. "
2742 echo "Example PAM control files can be found in the contrib/ "
2747 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2748 echo "WARNING: you are using the builtin random number collection "
2749 echo "service. Please read WARNING.RNG and request that your OS "
2750 echo "vendor includes kernel-based random number collection in "
2751 echo "future versions of your OS."