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)
600 GLOBUS_INCLUDE="${gsi_path}/include/${globus_flavor_type}"
601 if test ! -d "$GLOBUS_INCLUDE" ; then
602 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_INCLUDE})
604 GSI_CPPFLAGS="-I${GLOBUS_INCLUDE}"
606 AC_MSG_CHECKING(for Globus linkline)
607 if test -x $GPT_LOCATION/sbin/gpt_build_config ; then
608 $GPT_LOCATION/sbin/gpt_build_config -f ${globus_flavor_type} -link shared -src pkg_data_src.gpt
609 . ./gpt_build_temp.sh
610 GSI_LDFLAGS="-L${gsi_path}/lib"
611 GSI_LIBS="$GPT_CONFIG_PGM_LINKS"
612 export LD_LIBRARY_PATH="${gsi_path}/lib:$LD_LIBRARY_PATH"
614 AC_MSG_ERROR(Cannot find gpt_build_config: GPT installation is incomplete)
616 if test -z "$GSI_LIBS" ; then
617 AC_MSG_ERROR(gpt_build_config failed)
621 LIBS="$LIBS $GSI_LIBS"
622 LDFLAGS="$LDFLAGS $GSI_LDFLAGS"
623 CPPFLAGS="$CPPFLAGS $GSI_CPPFLAGS"
625 # test that we got the libraries OK
633 AC_MSG_ERROR(link with Globus libraries failed)
640 AC_SUBST(INSTALL_GSISSH)
641 # End Globus/GSI section
643 # Check whether user wants S/Key support
646 [ --with-skey[[=PATH]] Enable S/Key support
647 (optionally in PATH)],
649 if test "x$withval" != "xno" ; then
651 if test "x$withval" != "xyes" ; then
652 CPPFLAGS="$CPPFLAGS -I${withval}/include"
653 LDFLAGS="$LDFLAGS -L${withval}/lib"
660 AC_MSG_CHECKING([for s/key support])
665 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
667 [AC_MSG_RESULT(yes)],
670 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
676 # Check whether user wants TCP wrappers support
678 AC_ARG_WITH(tcp-wrappers,
679 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
680 (optionally in PATH)],
682 if test "x$withval" != "xno" ; then
684 saved_LDFLAGS="$LDFLAGS"
685 saved_CPPFLAGS="$CPPFLAGS"
686 if test -n "${withval}" -a "${withval}" != "yes"; then
687 if test -d "${withval}/lib"; then
688 if test -n "${need_dash_r}"; then
689 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
691 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
694 if test -n "${need_dash_r}"; then
695 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
697 LDFLAGS="-L${withval} ${LDFLAGS}"
700 if test -d "${withval}/include"; then
701 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
703 CPPFLAGS="-I${withval} ${CPPFLAGS}"
707 LIBS="$LIBWRAP $LIBS"
708 AC_MSG_CHECKING(for libwrap)
712 int deny_severity = 0, allow_severity = 0;
722 AC_MSG_ERROR([*** libwrap missing])
730 dnl Checks for library functions. Please keep in alphabetical order
732 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename bcopy \
733 bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
734 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
735 getpeereid _getpty getrlimit getrusage getttyent glob inet_aton \
736 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
737 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openpty pstat \
738 readpassphrase realpath recvmsg rresvport_af sendmsg setdtablesize \
739 setegid setenv seteuid setgroups setlogin setpcred setproctitle \
740 setresgid setreuid setrlimit setsid setvbuf sigaction sigvec \
741 snprintf socketpair strerror strlcat strlcpy strmode strnvis \
742 sysconf tcgetpgrp truncate utimes vhangup vsnprintf waitpid \
745 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
746 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
748 dnl IRIX has basename() in libgen
749 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
751 dnl Make sure strsep prototype is defined before defining HAVE_STRSEP
752 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
754 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
755 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
756 AC_CHECK_LIB(gen, dirname,[
757 AC_CACHE_CHECK([for broken dirname],
758 ac_cv_have_broken_dirname, [
766 int main(int argc, char **argv) {
769 strncpy(buf,"/etc", 32);
771 if (!s || strncmp(s, "/", 32) != 0) {
778 [ ac_cv_have_broken_dirname="no" ],
779 [ ac_cv_have_broken_dirname="yes" ]
783 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
785 AC_DEFINE(HAVE_DIRNAME)
786 AC_CHECK_HEADERS(libgen.h)
791 dnl Checks for time functions
792 AC_CHECK_FUNCS(gettimeofday time)
793 dnl Checks for utmp functions
794 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
795 AC_CHECK_FUNCS(utmpname)
796 dnl Checks for utmpx functions
797 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
798 AC_CHECK_FUNCS(setutxent utmpxname)
800 AC_CHECK_FUNC(daemon,
801 [AC_DEFINE(HAVE_DAEMON)],
802 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
805 AC_CHECK_FUNC(getpagesize,
806 [AC_DEFINE(HAVE_GETPAGESIZE)],
807 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
810 # Check for broken snprintf
811 if test "x$ac_cv_func_snprintf" = "xyes" ; then
812 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
816 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
818 [AC_MSG_RESULT(yes)],
821 AC_DEFINE(BROKEN_SNPRINTF)
822 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
827 dnl see whether mkstemp() requires XXXXXX
828 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
829 AC_MSG_CHECKING([for (overly) strict mkstemp])
833 main() { char template[]="conftest.mkstemp-test";
834 if (mkstemp(template) == -1)
836 unlink(template); exit(0);
844 AC_DEFINE(HAVE_STRICT_MKSTEMP)
848 AC_DEFINE(HAVE_STRICT_MKSTEMP)
858 [ --with-pam Enable PAM support ],
860 if test "x$withval" != "xno" ; then
861 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
862 AC_MSG_ERROR([PAM headers not found])
865 AC_CHECK_LIB(dl, dlopen, , )
866 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
867 AC_CHECK_FUNCS(pam_getenvlist)
868 AC_CHECK_FUNCS(pam_putenv)
874 if test $ac_cv_lib_dl_dlopen = yes; then
884 # Check for older PAM
885 if test "x$PAM_MSG" = "xyes" ; then
886 # Check PAM strerror arguments (old PAM)
887 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
891 #include <security/pam_appl.h>
893 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
896 AC_DEFINE(HAVE_OLD_PAM)
898 PAM_MSG="yes (old library)"
903 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
904 # because the system crypt() is more featureful.
905 if test "x$check_for_libcrypt_before" = "x1"; then
906 AC_CHECK_LIB(crypt, crypt)
910 saved_CPPFLAGS="$CPPFLAGS"
911 saved_LDFLAGS="$LDFLAGS"
913 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
915 if test "x$withval" != "xno" ; then
916 if test -d "$withval/lib"; then
917 if test -n "${need_dash_r}"; then
918 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
920 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
923 if test -n "${need_dash_r}"; then
924 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
926 LDFLAGS="-L${withval} ${LDFLAGS}"
929 if test -d "$withval/include"; then
930 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
932 CPPFLAGS="-I${withval} ${CPPFLAGS}"
937 if test -z "$GSI_LIBS" ; then
938 LIBS="$LIBS -lcrypto"
940 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
942 dnl Check default openssl install dir
943 if test -n "${need_dash_r}"; then
944 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
946 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
948 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
949 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
951 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
957 # Determine OpenSSL header version
958 AC_MSG_CHECKING([OpenSSL header version])
963 #include <openssl/opensslv.h>
964 #define DATA "conftest.sslincver"
969 fd = fopen(DATA,"w");
973 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
980 ssl_header_ver=`cat conftest.sslincver`
981 AC_MSG_RESULT($ssl_header_ver)
984 AC_MSG_RESULT(not found)
985 AC_MSG_ERROR(OpenSSL version header not found.)
989 # Determine OpenSSL library version
990 AC_MSG_CHECKING([OpenSSL library version])
995 #include <openssl/opensslv.h>
996 #include <openssl/crypto.h>
997 #define DATA "conftest.ssllibver"
1002 fd = fopen(DATA,"w");
1006 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1013 ssl_library_ver=`cat conftest.ssllibver`
1014 AC_MSG_RESULT($ssl_library_ver)
1017 AC_MSG_RESULT(not found)
1018 AC_MSG_ERROR(OpenSSL library not found.)
1022 # Sanity check OpenSSL headers
1023 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1027 #include <openssl/opensslv.h>
1028 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1035 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
1039 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1040 # version in OpenSSL. Skip this for PAM
1041 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
1042 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1046 ### Configure cryptographic random number support
1048 # Check wheter OpenSSL seeds itself
1049 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1053 #include <openssl/rand.h>
1054 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1057 OPENSSL_SEEDS_ITSELF=yes
1062 # Default to use of the rand helper if OpenSSL doesn't
1069 # Do we want to force the use of the rand helper?
1070 AC_ARG_WITH(rand-helper,
1071 [ --with-rand-helper Use subprocess to gather strong randomness ],
1073 if test "x$withval" = "xno" ; then
1074 # Force use of OpenSSL's internal RNG, even if
1075 # the previous test showed it to be unseeded.
1076 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1077 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1078 OPENSSL_SEEDS_ITSELF=yes
1087 # Which randomness source do we use?
1088 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1090 AC_DEFINE(OPENSSL_PRNG_ONLY)
1091 RAND_MSG="OpenSSL internal ONLY"
1092 INSTALL_SSH_RAND_HELPER=""
1093 elif test ! -z "$USE_RAND_HELPER" ; then
1094 # install rand helper
1095 RAND_MSG="ssh-rand-helper"
1096 INSTALL_SSH_RAND_HELPER="yes"
1098 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1100 ### Configuration of ssh-rand-helper
1103 AC_ARG_WITH(prngd-port,
1104 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1113 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1116 if test ! -z "$withval" ; then
1117 PRNGD_PORT="$withval"
1118 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1123 # PRNGD Unix domain socket
1124 AC_ARG_WITH(prngd-socket,
1125 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1129 withval="/var/run/egd-pool"
1137 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1141 if test ! -z "$withval" ; then
1142 if test ! -z "$PRNGD_PORT" ; then
1143 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1145 if test ! -r "$withval" ; then
1146 AC_MSG_WARN(Entropy socket is not readable)
1148 PRNGD_SOCKET="$withval"
1149 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1153 # Check for existing socket only if we don't have a random device already
1154 if test "$USE_RAND_HELPER" = yes ; then
1155 AC_MSG_CHECKING(for PRNGD/EGD socket)
1156 # Insert other locations here
1157 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1158 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1159 PRNGD_SOCKET="$sock"
1160 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1164 if test ! -z "$PRNGD_SOCKET" ; then
1165 AC_MSG_RESULT($PRNGD_SOCKET)
1167 AC_MSG_RESULT(not found)
1173 # Change default command timeout for hashing entropy source
1175 AC_ARG_WITH(entropy-timeout,
1176 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1178 if test "x$withval" != "xno" ; then
1179 entropy_timeout=$withval
1183 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1185 SSH_PRIVSEP_USER=sshd
1186 AC_ARG_WITH(privsep-user,
1187 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1189 if test -n "$withval"; then
1190 SSH_PRIVSEP_USER=$withval
1194 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1195 AC_SUBST(SSH_PRIVSEP_USER)
1197 # We do this little dance with the search path to insure
1198 # that programs that we select for use by installed programs
1199 # (which may be run by the super-user) come from trusted
1200 # locations before they come from the user's private area.
1201 # This should help avoid accidentally configuring some
1202 # random version of a program in someone's personal bin.
1206 test -h /bin 2> /dev/null && PATH=/usr/bin
1207 test -d /sbin && PATH=$PATH:/sbin
1208 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1209 PATH=$PATH:/etc:$OPATH
1211 # These programs are used by the command hashing source to gather entropy
1212 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1213 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1214 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1215 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1216 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1217 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1218 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1219 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1220 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1221 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1222 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1223 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1224 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1225 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1226 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1227 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1231 # Where does ssh-rand-helper get its randomness from?
1232 INSTALL_SSH_PRNG_CMDS=""
1233 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1234 if test ! -z "$PRNGD_PORT" ; then
1235 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1236 elif test ! -z "$PRNGD_SOCKET" ; then
1237 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1239 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1240 RAND_HELPER_CMDHASH=yes
1241 INSTALL_SSH_PRNG_CMDS="yes"
1244 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1247 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1248 if test ! -z "$SONY" ; then
1249 LIBS="$LIBS -liberty";
1252 # Checks for data types
1253 AC_CHECK_SIZEOF(char, 1)
1254 AC_CHECK_SIZEOF(short int, 2)
1255 AC_CHECK_SIZEOF(int, 4)
1256 AC_CHECK_SIZEOF(long int, 4)
1257 AC_CHECK_SIZEOF(long long int, 8)
1259 # Sanity check long long for some platforms (AIX)
1260 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1261 ac_cv_sizeof_long_long_int=0
1264 # More checks for data types
1265 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1267 [ #include <sys/types.h> ],
1269 [ ac_cv_have_u_int="yes" ],
1270 [ ac_cv_have_u_int="no" ]
1273 if test "x$ac_cv_have_u_int" = "xyes" ; then
1274 AC_DEFINE(HAVE_U_INT)
1278 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1280 [ #include <sys/types.h> ],
1281 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1282 [ ac_cv_have_intxx_t="yes" ],
1283 [ ac_cv_have_intxx_t="no" ]
1286 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1287 AC_DEFINE(HAVE_INTXX_T)
1291 if (test -z "$have_intxx_t" && \
1292 test "x$ac_cv_header_stdint_h" = "xyes")
1294 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1296 [ #include <stdint.h> ],
1297 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1299 AC_DEFINE(HAVE_INTXX_T)
1302 [ AC_MSG_RESULT(no) ]
1306 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1309 #include <sys/types.h>
1310 #ifdef HAVE_STDINT_H
1311 # include <stdint.h>
1313 #include <sys/socket.h>
1314 #ifdef HAVE_SYS_BITYPES_H
1315 # include <sys/bitypes.h>
1318 [ int64_t a; a = 1;],
1319 [ ac_cv_have_int64_t="yes" ],
1320 [ ac_cv_have_int64_t="no" ]
1323 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1324 AC_DEFINE(HAVE_INT64_T)
1327 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1329 [ #include <sys/types.h> ],
1330 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1331 [ ac_cv_have_u_intxx_t="yes" ],
1332 [ ac_cv_have_u_intxx_t="no" ]
1335 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1336 AC_DEFINE(HAVE_U_INTXX_T)
1340 if test -z "$have_u_intxx_t" ; then
1341 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1343 [ #include <sys/socket.h> ],
1344 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1346 AC_DEFINE(HAVE_U_INTXX_T)
1349 [ AC_MSG_RESULT(no) ]
1353 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1355 [ #include <sys/types.h> ],
1356 [ u_int64_t a; a = 1;],
1357 [ ac_cv_have_u_int64_t="yes" ],
1358 [ ac_cv_have_u_int64_t="no" ]
1361 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1362 AC_DEFINE(HAVE_U_INT64_T)
1366 if test -z "$have_u_int64_t" ; then
1367 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1369 [ #include <sys/bitypes.h> ],
1370 [ u_int64_t a; a = 1],
1372 AC_DEFINE(HAVE_U_INT64_T)
1375 [ AC_MSG_RESULT(no) ]
1379 if test -z "$have_u_intxx_t" ; then
1380 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1383 #include <sys/types.h>
1385 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1386 [ ac_cv_have_uintxx_t="yes" ],
1387 [ ac_cv_have_uintxx_t="no" ]
1390 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1391 AC_DEFINE(HAVE_UINTXX_T)
1395 if test -z "$have_uintxx_t" ; then
1396 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1398 [ #include <stdint.h> ],
1399 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1401 AC_DEFINE(HAVE_UINTXX_T)
1404 [ AC_MSG_RESULT(no) ]
1408 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1409 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1411 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1414 #include <sys/bitypes.h>
1417 int8_t a; int16_t b; int32_t c;
1418 u_int8_t e; u_int16_t f; u_int32_t g;
1419 a = b = c = e = f = g = 1;
1422 AC_DEFINE(HAVE_U_INTXX_T)
1423 AC_DEFINE(HAVE_INTXX_T)
1431 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1434 #include <sys/types.h>
1436 [ u_char foo; foo = 125; ],
1437 [ ac_cv_have_u_char="yes" ],
1438 [ ac_cv_have_u_char="no" ]
1441 if test "x$ac_cv_have_u_char" = "xyes" ; then
1442 AC_DEFINE(HAVE_U_CHAR)
1447 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1449 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1452 #include <sys/types.h>
1454 [ size_t foo; foo = 1235; ],
1455 [ ac_cv_have_size_t="yes" ],
1456 [ ac_cv_have_size_t="no" ]
1459 if test "x$ac_cv_have_size_t" = "xyes" ; then
1460 AC_DEFINE(HAVE_SIZE_T)
1463 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1466 #include <sys/types.h>
1468 [ ssize_t foo; foo = 1235; ],
1469 [ ac_cv_have_ssize_t="yes" ],
1470 [ ac_cv_have_ssize_t="no" ]
1473 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1474 AC_DEFINE(HAVE_SSIZE_T)
1477 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1482 [ clock_t foo; foo = 1235; ],
1483 [ ac_cv_have_clock_t="yes" ],
1484 [ ac_cv_have_clock_t="no" ]
1487 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1488 AC_DEFINE(HAVE_CLOCK_T)
1491 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1494 #include <sys/types.h>
1495 #include <sys/socket.h>
1497 [ sa_family_t foo; foo = 1235; ],
1498 [ ac_cv_have_sa_family_t="yes" ],
1501 #include <sys/types.h>
1502 #include <sys/socket.h>
1503 #include <netinet/in.h>
1505 [ sa_family_t foo; foo = 1235; ],
1506 [ ac_cv_have_sa_family_t="yes" ],
1508 [ ac_cv_have_sa_family_t="no" ]
1512 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1513 AC_DEFINE(HAVE_SA_FAMILY_T)
1516 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1519 #include <sys/types.h>
1521 [ pid_t foo; foo = 1235; ],
1522 [ ac_cv_have_pid_t="yes" ],
1523 [ ac_cv_have_pid_t="no" ]
1526 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1527 AC_DEFINE(HAVE_PID_T)
1530 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1533 #include <sys/types.h>
1535 [ mode_t foo; foo = 1235; ],
1536 [ ac_cv_have_mode_t="yes" ],
1537 [ ac_cv_have_mode_t="no" ]
1540 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1541 AC_DEFINE(HAVE_MODE_T)
1545 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1548 #include <sys/types.h>
1549 #include <sys/socket.h>
1551 [ struct sockaddr_storage s; ],
1552 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1553 [ ac_cv_have_struct_sockaddr_storage="no" ]
1556 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1557 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1560 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1563 #include <sys/types.h>
1564 #include <netinet/in.h>
1566 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1567 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1568 [ ac_cv_have_struct_sockaddr_in6="no" ]
1571 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1572 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1575 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1578 #include <sys/types.h>
1579 #include <netinet/in.h>
1581 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1582 [ ac_cv_have_struct_in6_addr="yes" ],
1583 [ ac_cv_have_struct_in6_addr="no" ]
1586 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1587 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1590 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1593 #include <sys/types.h>
1594 #include <sys/socket.h>
1597 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1598 [ ac_cv_have_struct_addrinfo="yes" ],
1599 [ ac_cv_have_struct_addrinfo="no" ]
1602 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1603 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1606 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1608 [ #include <sys/time.h> ],
1609 [ struct timeval tv; tv.tv_sec = 1;],
1610 [ ac_cv_have_struct_timeval="yes" ],
1611 [ ac_cv_have_struct_timeval="no" ]
1614 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1615 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1616 have_struct_timeval=1
1619 AC_CHECK_TYPES(struct timespec)
1621 # We need int64_t or else certian parts of the compile will fail.
1622 if test "x$ac_cv_have_int64_t" = "xno" -a \
1623 "x$ac_cv_sizeof_long_int" != "x8" -a \
1624 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1625 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1626 echo "an alternative compiler (I.E., GCC) before continuing."
1630 dnl test snprintf (broken on SCO w/gcc)
1635 #ifdef HAVE_SNPRINTF
1639 char expected_out[50];
1641 #if (SIZEOF_LONG_INT == 8)
1642 long int num = 0x7fffffffffffffff;
1644 long long num = 0x7fffffffffffffffll;
1646 strcpy(expected_out, "9223372036854775807");
1647 snprintf(buf, mazsize, "%lld", num);
1648 if(strcmp(buf, expected_out) != 0)
1655 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1659 dnl Checks for structure members
1660 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1661 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1662 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1663 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1664 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1665 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1666 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1667 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1668 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1669 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1670 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1671 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1672 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1673 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1674 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1675 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1676 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1678 AC_CHECK_MEMBERS([struct stat.st_blksize])
1680 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1681 ac_cv_have_ss_family_in_struct_ss, [
1684 #include <sys/types.h>
1685 #include <sys/socket.h>
1687 [ struct sockaddr_storage s; s.ss_family = 1; ],
1688 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1689 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1692 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1693 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1696 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1697 ac_cv_have___ss_family_in_struct_ss, [
1700 #include <sys/types.h>
1701 #include <sys/socket.h>
1703 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1704 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1705 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1708 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1709 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1712 AC_CACHE_CHECK([for pw_class field in struct passwd],
1713 ac_cv_have_pw_class_in_struct_passwd, [
1718 [ struct passwd p; p.pw_class = 0; ],
1719 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1720 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1723 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1724 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1727 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1728 ac_cv_have_pw_expire_in_struct_passwd, [
1733 [ struct passwd p; p.pw_expire = 0; ],
1734 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1735 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1738 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1739 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1742 AC_CACHE_CHECK([for pw_change field in struct passwd],
1743 ac_cv_have_pw_change_in_struct_passwd, [
1748 [ struct passwd p; p.pw_change = 0; ],
1749 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1750 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1753 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1754 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1757 dnl make sure we're using the real structure members and not defines
1758 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1759 ac_cv_have_accrights_in_msghdr, [
1762 #include <sys/types.h>
1763 #include <sys/socket.h>
1764 #include <sys/uio.h>
1766 #ifdef msg_accrights
1770 m.msg_accrights = 0;
1774 [ ac_cv_have_accrights_in_msghdr="yes" ],
1775 [ ac_cv_have_accrights_in_msghdr="no" ]
1778 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1779 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1782 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1783 ac_cv_have_control_in_msghdr, [
1786 #include <sys/types.h>
1787 #include <sys/socket.h>
1788 #include <sys/uio.h>
1798 [ ac_cv_have_control_in_msghdr="yes" ],
1799 [ ac_cv_have_control_in_msghdr="no" ]
1802 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1803 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1806 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1808 [ extern char *__progname; printf("%s", __progname); ],
1809 [ ac_cv_libc_defines___progname="yes" ],
1810 [ ac_cv_libc_defines___progname="no" ]
1813 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1814 AC_DEFINE(HAVE___PROGNAME)
1817 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1821 [ printf("%s", __FUNCTION__); ],
1822 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1823 [ ac_cv_cc_implements___FUNCTION__="no" ]
1826 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1827 AC_DEFINE(HAVE___FUNCTION__)
1830 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1834 [ printf("%s", __func__); ],
1835 [ ac_cv_cc_implements___func__="yes" ],
1836 [ ac_cv_cc_implements___func__="no" ]
1839 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1840 AC_DEFINE(HAVE___func__)
1843 AC_CACHE_CHECK([whether getopt has optreset support],
1844 ac_cv_have_getopt_optreset, [
1849 [ extern int optreset; optreset = 0; ],
1850 [ ac_cv_have_getopt_optreset="yes" ],
1851 [ ac_cv_have_getopt_optreset="no" ]
1854 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1855 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1858 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1860 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1861 [ ac_cv_libc_defines_sys_errlist="yes" ],
1862 [ ac_cv_libc_defines_sys_errlist="no" ]
1865 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1866 AC_DEFINE(HAVE_SYS_ERRLIST)
1870 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1872 [ extern int sys_nerr; printf("%i", sys_nerr);],
1873 [ ac_cv_libc_defines_sys_nerr="yes" ],
1874 [ ac_cv_libc_defines_sys_nerr="no" ]
1877 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1878 AC_DEFINE(HAVE_SYS_NERR)
1883 # Check whether user wants sectok support
1885 [ --with-sectok Enable smartcard support using libsectok],
1887 if test "x$withval" != "xno" ; then
1888 if test "x$withval" != "xyes" ; then
1889 CPPFLAGS="$CPPFLAGS -I${withval}"
1890 LDFLAGS="$LDFLAGS -L${withval}"
1891 if test ! -z "$need_dash_r" ; then
1892 LDFLAGS="$LDFLAGS -R${withval}"
1894 if test ! -z "$blibpath" ; then
1895 blibpath="$blibpath:${withval}"
1898 AC_CHECK_HEADERS(sectok.h)
1899 if test "$ac_cv_header_sectok_h" != yes; then
1900 AC_MSG_ERROR(Can't find sectok.h)
1902 AC_CHECK_LIB(sectok, sectok_open)
1903 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1904 AC_MSG_ERROR(Can't find libsectok)
1906 AC_DEFINE(SMARTCARD)
1907 AC_DEFINE(USE_SECTOK)
1908 SCARD_MSG="yes, using sectok"
1913 # Check whether user wants OpenSC support
1915 AC_HELP_STRING([--with-opensc=PFX],
1916 [Enable smartcard support using OpenSC]),
1917 opensc_config_prefix="$withval", opensc_config_prefix="")
1918 if test x$opensc_config_prefix != x ; then
1919 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1920 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1921 if test "$OPENSC_CONFIG" != "no"; then
1922 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1923 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1924 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1925 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1926 AC_DEFINE(SMARTCARD)
1927 AC_DEFINE(USE_OPENSC)
1928 SCARD_MSG="yes, using OpenSC"
1932 # Check whether user wants Kerberos 5 support
1934 AC_ARG_WITH(kerberos5,
1935 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1937 if test "x$withval" != "xno" ; then
1938 if test "x$withval" = "xyes" ; then
1939 KRB5ROOT="/usr/local"
1943 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1944 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1947 AC_MSG_CHECKING(whether we are using Heimdal)
1948 AC_TRY_COMPILE([ #include <krb5.h> ],
1949 [ char *tmp = heimdal_version; ],
1950 [ AC_MSG_RESULT(yes)
1952 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1955 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1958 if test ! -z "$need_dash_r" ; then
1959 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1961 if test ! -z "$blibpath" ; then
1962 blibpath="$blibpath:${KRB5ROOT}/lib"
1964 AC_CHECK_LIB(resolv, dn_expand, , )
1966 # If we're using some other GSSAPI
1967 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
1968 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
1970 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1972 K5LIBS="-lgssapi $K5LIBS" ],
1973 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
1975 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
1976 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
1981 AC_CHECK_HEADER(gssapi.h, ,
1982 [ unset ac_cv_header_gssapi_h
1983 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1984 AC_CHECK_HEADERS(gssapi.h, ,
1985 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
1990 AC_CHECK_LIB(gssapi, gss_krb5_copy_ccache, /bin/true,
1991 [ K5LIBS="-lgssapi_krb5 $K5LIBS"
1992 AC_CHECK_LIB(gssapi_krb5, gss_krb5_copy_ccache, /bin/true,
1993 AC_MSG_WARN([Cannot find gss_krb5_copy_ccache -- build may fail]),
1999 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2000 AC_CHECK_HEADER(gssapi_krb5.h, ,
2001 [ CPPFLAGS="$oldCPP" ])
2003 if test -z "$GSSAPI"; then
2011 # Check whether user wants Kerberos 4 support
2013 AC_ARG_WITH(kerberos4,
2014 [ --with-kerberos4=PATH Enable Kerberos 4 support],
2016 if test "x$withval" != "xno" ; then
2017 if test "x$withval" != "xyes" ; then
2018 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2019 LDFLAGS="$LDFLAGS -L${withval}/lib"
2020 if test ! -z "$need_dash_r" ; then
2021 LDFLAGS="$LDFLAGS -R${withval}/lib"
2023 if test ! -z "$blibpath" ; then
2024 blibpath="$blibpath:${withval}/lib"
2027 if test -d /usr/include/kerberosIV ; then
2028 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
2032 AC_CHECK_HEADERS(krb.h)
2033 if test "$ac_cv_header_krb_h" != yes; then
2034 AC_MSG_WARN([Cannot find krb.h, build may fail])
2036 AC_CHECK_LIB(krb, main)
2037 if test "$ac_cv_lib_krb_main" != yes; then
2038 AC_CHECK_LIB(krb4, main)
2039 if test "$ac_cv_lib_krb4_main" != yes; then
2040 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
2047 AC_CHECK_LIB(des, des_cbc_encrypt)
2048 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
2049 AC_CHECK_LIB(des425, des_cbc_encrypt)
2050 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
2051 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
2058 AC_CHECK_LIB(resolv, dn_expand, , )
2066 # Check whether user wants AFS_KRB5 support
2068 AC_ARG_WITH(afs-krb5,
2069 [ --with-afs-krb5[[=AKLOG_PATH]] Enable aklog to get token (default=/usr/bin/aklog).],
2071 if test "x$withval" != "xno" ; then
2073 if test "x$withval" != "xyes" ; then
2074 AC_DEFINE_UNQUOTED(AKLOG_PATH, "$withval")
2076 AC_DEFINE_UNQUOTED(AKLOG_PATH, "/usr/bin/aklog")
2079 if test -z "$KRB5" ; then
2080 AC_MSG_WARN([AFS_KRB5 requires Kerberos 5 support, build may fail])
2083 LIBS="-lkrbafs $LIBS"
2084 if test ! -z "$AFS_LIBS" ; then
2085 LIBS="$LIBS $AFS_LIBS"
2093 # Check whether user wants AFS support
2096 [ --with-afs=PATH Enable AFS support],
2098 if test "x$withval" != "xno" ; then
2100 if test "x$withval" != "xyes" ; then
2101 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2102 LDFLAGS="$LDFLAGS -L${withval}/lib"
2105 if test -z "$KRB4" ; then
2106 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
2110 if test ! -z "$AFS_LIBS" ; then
2111 LIBS="$LIBS $AFS_LIBS"
2118 LIBS="$LIBS $KLIBS $K5LIBS"
2120 AC_ARG_WITH(session-hooks,
2121 [ --with-session-hooks Enable hooks for executing external commands before/after a session],
2122 [ AC_DEFINE(SESSION_HOOKS) ]
2125 # Looking for programs, paths and files
2127 PRIVSEP_PATH=/var/empty
2128 AC_ARG_WITH(privsep-path,
2129 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2131 if test "x$withval" != "$no" ; then
2132 PRIVSEP_PATH=$withval
2136 AC_SUBST(PRIVSEP_PATH)
2139 [ --with-xauth=PATH Specify path to xauth program ],
2141 if test "x$withval" != "xno" ; then
2147 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2148 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2149 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2150 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2151 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2152 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2153 xauth_path="/usr/openwin/bin/xauth"
2159 AC_ARG_ENABLE(strip,
2160 [ --disable-strip Disable calling strip(1) on install],
2162 if test "x$enableval" = "xno" ; then
2169 if test -z "$xauth_path" ; then
2170 XAUTH_PATH="undefined"
2171 AC_SUBST(XAUTH_PATH)
2173 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2174 XAUTH_PATH=$xauth_path
2175 AC_SUBST(XAUTH_PATH)
2178 # Check for mail directory (last resort if we cannot get it from headers)
2179 if test ! -z "$MAIL" ; then
2180 maildir=`dirname $MAIL`
2181 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2184 if test -z "$no_dev_ptmx" ; then
2185 if test "x$disable_ptmx_check" != "xyes" ; then
2186 AC_CHECK_FILE("/dev/ptmx",
2188 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2194 AC_CHECK_FILE("/dev/ptc",
2196 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2201 # Options from here on. Some of these are preset by platform above
2202 AC_ARG_WITH(mantype,
2203 [ --with-mantype=man|cat|doc Set man page type],
2210 AC_MSG_ERROR(invalid man type: $withval)
2215 if test -z "$MANTYPE"; then
2216 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2217 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2218 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2220 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2227 if test "$MANTYPE" = "doc"; then
2234 # Check whether to enable MD5 passwords
2236 AC_ARG_WITH(md5-passwords,
2237 [ --with-md5-passwords Enable use of MD5 passwords],
2239 if test "x$withval" != "xno" ; then
2240 AC_DEFINE(HAVE_MD5_PASSWORDS)
2246 # Whether to disable shadow password support
2248 [ --without-shadow Disable shadow password support],
2250 if test "x$withval" = "xno" ; then
2251 AC_DEFINE(DISABLE_SHADOW)
2257 if test -z "$disable_shadow" ; then
2258 AC_MSG_CHECKING([if the systems has expire shadow information])
2261 #include <sys/types.h>
2264 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2265 [ sp_expire_available=yes ], []
2268 if test "x$sp_expire_available" = "xyes" ; then
2270 AC_DEFINE(HAS_SHADOW_EXPIRE)
2276 # Use ip address instead of hostname in $DISPLAY
2277 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2278 DISPLAY_HACK_MSG="yes"
2279 AC_DEFINE(IPADDR_IN_DISPLAY)
2281 DISPLAY_HACK_MSG="no"
2282 AC_ARG_WITH(ipaddr-display,
2283 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2285 if test "x$withval" != "xno" ; then
2286 AC_DEFINE(IPADDR_IN_DISPLAY)
2287 DISPLAY_HACK_MSG="yes"
2293 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2294 if test $ac_cv_func_login_getcapbool = "yes" -a \
2295 $ac_cv_header_login_cap_h = "yes" ; then
2298 # Whether to mess with the default path
2299 SERVER_PATH_MSG="(default)"
2300 AC_ARG_WITH(default-path,
2301 [ --with-default-path= Specify default \$PATH environment for server],
2303 if test "$USES_LOGIN_CONF" = "yes" ; then
2305 --with-default-path=PATH has no effect on this system.
2306 Edit /etc/login.conf instead.])
2307 elif test "x$withval" != "xno" ; then
2308 user_path="$withval"
2309 SERVER_PATH_MSG="$withval"
2312 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2313 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2317 /* find out what STDPATH is */
2322 #ifndef _PATH_STDPATH
2323 # ifdef _PATH_USERPATH /* Irix */
2324 # define _PATH_STDPATH _PATH_USERPATH
2326 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2329 #include <sys/types.h>
2330 #include <sys/stat.h>
2332 #define DATA "conftest.stdpath"
2339 fd = fopen(DATA,"w");
2343 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2348 ], [ user_path=`cat conftest.stdpath` ],
2349 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2350 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2352 # make sure $bindir is in USER_PATH so scp will work
2353 t_bindir=`eval echo ${bindir}`
2355 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2358 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2360 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2361 if test $? -ne 0 ; then
2362 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2363 if test $? -ne 0 ; then
2364 user_path=$user_path:$t_bindir
2365 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2370 if test "$USES_LOGIN_CONF" != "yes" ; then
2371 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2375 # Set superuser path separately to user path
2376 AC_ARG_WITH(superuser-path,
2377 [ --with-superuser-path= Specify different path for super-user],
2379 if test "x$withval" != "xno" ; then
2380 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2381 superuser_path=$withval
2387 # Whether to force IPv4 by default (needed on broken glibc Linux)
2389 AC_ARG_WITH(ipv4-default,
2390 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2392 if test "x$withval" != "xno" ; then
2393 AC_DEFINE(IPV4_DEFAULT)
2399 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2400 IPV4_IN6_HACK_MSG="no"
2402 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2404 if test "x$withval" != "xno" ; then
2406 AC_DEFINE(IPV4_IN_IPV6)
2407 IPV4_IN6_HACK_MSG="yes"
2412 if test "x$inet6_default_4in6" = "xyes"; then
2413 AC_MSG_RESULT([yes (default)])
2414 AC_DEFINE(IPV4_IN_IPV6)
2415 IPV4_IN6_HACK_MSG="yes"
2417 AC_MSG_RESULT([no (default)])
2422 # Whether to enable BSD auth support
2424 AC_ARG_WITH(bsd-auth,
2425 [ --with-bsd-auth Enable BSD auth support],
2427 if test "x$withval" != "xno" ; then
2434 # Where to place sshd.pid
2436 # make sure the directory exists
2437 if test ! -d $piddir ; then
2438 piddir=`eval echo ${sysconfdir}`
2440 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2444 AC_ARG_WITH(pid-dir,
2445 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2447 if test "x$withval" != "xno" ; then
2449 if test ! -d $piddir ; then
2450 AC_MSG_WARN([** no $piddir directory on this system **])
2456 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2459 dnl allow user to disable some login recording features
2460 AC_ARG_ENABLE(lastlog,
2461 [ --disable-lastlog disable use of lastlog even if detected [no]],
2462 [ AC_DEFINE(DISABLE_LASTLOG) ]
2465 [ --disable-utmp disable use of utmp even if detected [no]],
2466 [ AC_DEFINE(DISABLE_UTMP) ]
2468 AC_ARG_ENABLE(utmpx,
2469 [ --disable-utmpx disable use of utmpx even if detected [no]],
2470 [ AC_DEFINE(DISABLE_UTMPX) ]
2473 [ --disable-wtmp disable use of wtmp even if detected [no]],
2474 [ AC_DEFINE(DISABLE_WTMP) ]
2476 AC_ARG_ENABLE(wtmpx,
2477 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2478 [ AC_DEFINE(DISABLE_WTMPX) ]
2480 AC_ARG_ENABLE(libutil,
2481 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2482 [ AC_DEFINE(DISABLE_LOGIN) ]
2484 AC_ARG_ENABLE(pututline,
2485 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2486 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2488 AC_ARG_ENABLE(pututxline,
2489 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2490 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2492 AC_ARG_WITH(lastlog,
2493 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2495 if test "x$withval" = "xno" ; then
2496 AC_DEFINE(DISABLE_LASTLOG)
2498 conf_lastlog_location=$withval
2503 dnl lastlog, [uw]tmpx? detection
2504 dnl NOTE: set the paths in the platform section to avoid the
2505 dnl need for command-line parameters
2506 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2508 dnl lastlog detection
2509 dnl NOTE: the code itself will detect if lastlog is a directory
2510 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2512 #include <sys/types.h>
2514 #ifdef HAVE_LASTLOG_H
2515 # include <lastlog.h>
2524 [ char *lastlog = LASTLOG_FILE; ],
2525 [ AC_MSG_RESULT(yes) ],
2528 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2530 #include <sys/types.h>
2532 #ifdef HAVE_LASTLOG_H
2533 # include <lastlog.h>
2539 [ char *lastlog = _PATH_LASTLOG; ],
2540 [ AC_MSG_RESULT(yes) ],
2543 system_lastlog_path=no
2548 if test -z "$conf_lastlog_location"; then
2549 if test x"$system_lastlog_path" = x"no" ; then
2550 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2551 if (test -d "$f" || test -f "$f") ; then
2552 conf_lastlog_location=$f
2555 if test -z "$conf_lastlog_location"; then
2556 AC_MSG_WARN([** Cannot find lastlog **])
2557 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2562 if test -n "$conf_lastlog_location"; then
2563 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2567 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2569 #include <sys/types.h>
2575 [ char *utmp = UTMP_FILE; ],
2576 [ AC_MSG_RESULT(yes) ],
2578 system_utmp_path=no ]
2580 if test -z "$conf_utmp_location"; then
2581 if test x"$system_utmp_path" = x"no" ; then
2582 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2583 if test -f $f ; then
2584 conf_utmp_location=$f
2587 if test -z "$conf_utmp_location"; then
2588 AC_DEFINE(DISABLE_UTMP)
2592 if test -n "$conf_utmp_location"; then
2593 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2597 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2599 #include <sys/types.h>
2605 [ char *wtmp = WTMP_FILE; ],
2606 [ AC_MSG_RESULT(yes) ],
2608 system_wtmp_path=no ]
2610 if test -z "$conf_wtmp_location"; then
2611 if test x"$system_wtmp_path" = x"no" ; then
2612 for f in /usr/adm/wtmp /var/log/wtmp; do
2613 if test -f $f ; then
2614 conf_wtmp_location=$f
2617 if test -z "$conf_wtmp_location"; then
2618 AC_DEFINE(DISABLE_WTMP)
2622 if test -n "$conf_wtmp_location"; then
2623 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2627 dnl utmpx detection - I don't know any system so perverse as to require
2628 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2630 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2632 #include <sys/types.h>
2641 [ char *utmpx = UTMPX_FILE; ],
2642 [ AC_MSG_RESULT(yes) ],
2644 system_utmpx_path=no ]
2646 if test -z "$conf_utmpx_location"; then
2647 if test x"$system_utmpx_path" = x"no" ; then
2648 AC_DEFINE(DISABLE_UTMPX)
2651 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2655 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2657 #include <sys/types.h>
2666 [ char *wtmpx = WTMPX_FILE; ],
2667 [ AC_MSG_RESULT(yes) ],
2669 system_wtmpx_path=no ]
2671 if test -z "$conf_wtmpx_location"; then
2672 if test x"$system_wtmpx_path" = x"no" ; then
2673 AC_DEFINE(DISABLE_WTMPX)
2676 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2680 if test ! -z "$blibpath" ; then
2681 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2682 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2685 dnl remove pam and dl because they are in $LIBPAM
2686 if test "$PAM_MSG" = yes ; then
2687 LIBS=`echo $LIBS | sed 's/-lpam //'`
2689 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2690 LIBS=`echo $LIBS | sed 's/-ldl //'`
2694 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2697 # Print summary of options
2699 # Someone please show me a better way :)
2700 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2701 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2702 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2703 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2704 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2705 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2706 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2707 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2708 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2709 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2712 echo "OpenSSH has been configured with the following options:"
2713 echo " User binaries: $B"
2714 echo " System binaries: $C"
2715 echo " Configuration files: $D"
2716 echo " Askpass program: $E"
2717 echo " Manual pages: $F"
2718 echo " PID file: $G"
2719 echo " Privilege separation chroot path: $H"
2720 if test "$USES_LOGIN_CONF" = "yes" ; then
2721 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2723 echo " sshd default user PATH: $I"
2725 if test ! -z "$superuser_path" ; then
2726 echo " sshd superuser user PATH: $J"
2728 echo " Manpage format: $MANTYPE"
2729 echo " PAM support: ${PAM_MSG}"
2730 echo " KerberosIV support: $KRB4_MSG"
2731 echo " KerberosV support: $KRB5_MSG"
2732 echo " Smartcard support: $SCARD_MSG"
2733 echo " AFS support: $AFS_MSG"
2734 echo " S/KEY support: $SKEY_MSG"
2735 echo " TCP Wrappers support: $TCPW_MSG"
2736 echo " MD5 password support: $MD5_MSG"
2737 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2738 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2739 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2740 echo " BSD Auth support: $BSD_AUTH_MSG"
2741 echo " Random number source: $RAND_MSG"
2742 if test ! -z "$USE_RAND_HELPER" ; then
2743 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2748 echo " Host: ${host}"
2749 echo " Compiler: ${CC}"
2750 echo " Compiler flags: ${CFLAGS}"
2751 echo "Preprocessor flags: ${CPPFLAGS}"
2752 echo " Linker flags: ${LDFLAGS}"
2753 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2757 if test "x$PAM_MSG" = "xyes" ; then
2758 echo "PAM is enabled. You may need to install a PAM control file "
2759 echo "for sshd, otherwise password authentication may fail. "
2760 echo "Example PAM control files can be found in the contrib/ "
2765 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2766 echo "WARNING: you are using the builtin random number collection "
2767 echo "service. Please read WARNING.RNG and request that your OS "
2768 echo "vendor includes kernel-based random number collection in "
2769 echo "future versions of your OS."