4 AC_CONFIG_SRCDIR([ssh.c])
6 AC_CONFIG_HEADER(config.h)
11 # Checks for programs.
16 AC_PATH_PROGS(PERL, perl5 perl)
18 AC_PATH_PROG(ENT, ent)
20 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
21 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
22 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
28 if test -z "$AR" ; then
29 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
32 # Use LOGIN_PROGRAM from environment if possible
33 if test ! -z "$LOGIN_PROGRAM" ; then
34 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
37 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
38 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
39 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
43 if test -z "$LD" ; then
49 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
50 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
53 # Check for some target-specific stuff
57 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
58 LDFLAGS="$LDFLAGS -L/usr/local/lib"
59 if (test "$LD" != "gcc" && test -z "$blibpath"); then
60 AC_MSG_CHECKING([if linkage editor ($LD) accepts -blibpath])
61 saved_LDFLAGS="$LDFLAGS"
62 LDFLAGS="$LDFLAGS -blibpath:/usr/lib:/lib:/usr/local/lib"
67 blibpath="/usr/lib:/lib:/usr/local/lib"
71 LDFLAGS="$saved_LDFLAGS"
73 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
74 [AC_CHECK_LIB(s,authenticate,
75 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
79 AC_DEFINE(BROKEN_GETADDRINFO)
80 AC_DEFINE(BROKEN_REALPATH)
81 dnl AIX handles lastlog as part of its login message
82 AC_DEFINE(DISABLE_LASTLOG)
83 AC_DEFINE(LOGIN_NEEDS_UTMPX)
86 LIBS="$LIBS /usr/lib/textmode.o"
87 AC_DEFINE(HAVE_CYGWIN)
89 AC_DEFINE(DISABLE_SHADOW)
90 AC_DEFINE(IPV4_DEFAULT)
91 AC_DEFINE(IP_TOS_IS_BROKEN)
92 AC_DEFINE(NO_X11_UNIX_SOCKETS)
93 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
94 AC_DEFINE(DISABLE_FD_PASSING)
95 AC_DEFINE(SETGROUPS_NOOP)
98 AC_DEFINE(IP_TOS_IS_BROKEN)
101 AC_MSG_CHECKING(if we have working getaddrinfo)
102 AC_TRY_RUN([#include <mach-o/dyld.h>
103 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
107 }], [AC_MSG_RESULT(working)],
108 [AC_MSG_RESULT(buggy)
109 AC_DEFINE(BROKEN_GETADDRINFO)],
110 [AC_MSG_RESULT(assume it is working)])
113 if test -z "$GCC"; then
116 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
117 IPADDR_IN_DISPLAY=yes
118 AC_DEFINE(HAVE_SECUREWARE)
120 AC_DEFINE(LOGIN_NO_ENDOPT)
121 AC_DEFINE(LOGIN_NEEDS_UTMPX)
122 AC_DEFINE(DISABLE_SHADOW)
123 AC_DEFINE(DISABLE_UTMP)
124 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
125 LIBS="$LIBS -lsec -lsecpw"
126 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
127 disable_ptmx_check=yes
130 if test -z "$GCC"; then
133 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
134 IPADDR_IN_DISPLAY=yes
136 AC_DEFINE(LOGIN_NO_ENDOPT)
137 AC_DEFINE(LOGIN_NEEDS_UTMPX)
138 AC_DEFINE(DISABLE_SHADOW)
139 AC_DEFINE(DISABLE_UTMP)
140 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
142 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
145 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
146 IPADDR_IN_DISPLAY=yes
147 AC_DEFINE(PAM_SUN_CODEBASE)
149 AC_DEFINE(LOGIN_NO_ENDOPT)
150 AC_DEFINE(LOGIN_NEEDS_UTMPX)
151 AC_DEFINE(DISABLE_SHADOW)
152 AC_DEFINE(DISABLE_UTMP)
153 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
155 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
158 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
160 PATH="$PATH:/usr/etc"
161 AC_DEFINE(BROKEN_INET_NTOA)
162 AC_DEFINE(WITH_ABBREV_NO_TTY)
165 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
167 PATH="$PATH:/usr/etc"
168 AC_DEFINE(WITH_IRIX_ARRAY)
169 AC_DEFINE(WITH_IRIX_PROJECT)
170 AC_DEFINE(WITH_IRIX_AUDIT)
171 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
172 AC_DEFINE(BROKEN_INET_NTOA)
173 AC_DEFINE(WITH_ABBREV_NO_TTY)
177 check_for_libcrypt_later=1
178 AC_DEFINE(DONT_TRY_OTHER_AF)
179 AC_DEFINE(PAM_TTY_KLUDGE)
180 inet6_default_4in6=yes
182 mips-sony-bsd|mips-sony-newsos4)
183 AC_DEFINE(HAVE_NEWS4)
187 check_for_libcrypt_before=1
191 check_for_libcrypt_later=1
194 conf_lastlog_location="/usr/adm/lastlog"
195 conf_utmp_location=/etc/utmp
196 conf_wtmp_location=/usr/adm/wtmp
199 AC_DEFINE(BROKEN_REALPATH)
201 AC_DEFINE(BROKEN_SAVED_UIDS)
202 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
206 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
207 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
209 AC_DEFINE(PAM_SUN_CODEBASE)
210 AC_DEFINE(LOGIN_NEEDS_UTMPX)
211 AC_DEFINE(LOGIN_NEEDS_TERM)
212 AC_DEFINE(PAM_TTY_KLUDGE)
213 # hardwire lastlog location (can't detect it on some versions)
214 conf_lastlog_location="/var/adm/lastlog"
215 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
216 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
217 if test "$sol2ver" -ge 8; then
219 AC_DEFINE(DISABLE_UTMP)
220 AC_DEFINE(DISABLE_WTMP)
226 CPPFLAGS="$CPPFLAGS -DSUNOS4"
227 AC_CHECK_FUNCS(getpwanam)
228 AC_DEFINE(PAM_SUN_CODEBASE)
229 conf_utmp_location=/etc/utmp
230 conf_wtmp_location=/var/adm/wtmp
231 conf_lastlog_location=/var/adm/lastlog
235 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
236 LDFLAGS="$LDFLAGS -L/usr/local/lib"
241 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
242 # /usr/ucblib MUST NOT be searched on ReliantUNIX
243 LDFLAGS="$LDFLAGS -L/usr/local/lib"
244 IPADDR_IN_DISPLAY=yes
246 AC_DEFINE(IP_TOS_IS_BROKEN)
247 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
248 # Attention: always take care to bind libsocket and libnsl before libc,
249 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
252 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
253 LDFLAGS="$LDFLAGS -L/usr/local/lib"
257 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
258 LDFLAGS="$LDFLAGS -L/usr/local/lib"
262 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
263 LDFLAGS="$LDFLAGS -L/usr/local/lib"
266 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
267 LDFLAGS="$LDFLAGS -L/usr/local/lib"
268 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
271 AC_DEFINE(BROKEN_SYS_TERMIO_H)
273 AC_DEFINE(HAVE_SECUREWARE)
274 AC_DEFINE(DISABLE_SHADOW)
275 AC_DEFINE(BROKEN_SAVED_UIDS)
276 AC_CHECK_FUNCS(getluid setluid)
278 do_sco3_extra_lib_check=yes
281 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
282 LDFLAGS="$LDFLAGS -L/usr/local/lib"
283 LIBS="$LIBS -lprot -lx -ltinfo -lm"
286 AC_DEFINE(HAVE_SECUREWARE)
287 AC_DEFINE(DISABLE_SHADOW)
288 AC_DEFINE(DISABLE_FD_PASSING)
289 AC_CHECK_FUNCS(getluid setluid)
296 AC_DEFINE(DISABLE_FD_PASSING)
298 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
305 AC_DEFINE(DISABLE_FD_PASSING)
306 AC_DEFINE(NO_SSH_LASTLOG)
307 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
308 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
312 AC_MSG_CHECKING(for Digital Unix SIA)
315 [ --with-osfsia Enable Digital Unix SIA],
317 if test "x$withval" = "xno" ; then
318 AC_MSG_RESULT(disabled)
323 if test -z "$no_osfsia" ; then
324 if test -f /etc/sia/matrix.conf; then
326 AC_DEFINE(HAVE_OSF_SIA)
327 AC_DEFINE(DISABLE_LOGIN)
328 LIBS="$LIBS -lsecurity -ldb -lm -laud"
337 AC_DEFINE(NO_X11_UNIX_SOCKETS)
338 AC_DEFINE(MISSING_NFDBITS)
339 AC_DEFINE(MISSING_HOWMANY)
340 AC_DEFINE(MISSING_FD_MASK)
344 # Allow user to specify flags
346 [ --with-cflags Specify additional flags to pass to compiler],
348 if test "x$withval" != "xno" ; then
349 CFLAGS="$CFLAGS $withval"
353 AC_ARG_WITH(cppflags,
354 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
356 if test "x$withval" != "xno"; then
357 CPPFLAGS="$CPPFLAGS $withval"
362 [ --with-ldflags Specify additional flags to pass to linker],
364 if test "x$withval" != "xno" ; then
365 LDFLAGS="$LDFLAGS $withval"
370 [ --with-libs Specify additional libraries to link with],
372 if test "x$withval" != "xno" ; then
373 LIBS="$LIBS $withval"
378 # Checks for header files.
379 AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
380 getopt.h glob.h ia.h lastlog.h limits.h login.h \
381 login_cap.h maillock.h netdb.h netgroup.h \
382 netinet/in_systm.h paths.h pty.h readpassphrase.h \
383 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
384 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
385 sys/mman.h sys/select.h sys/stat.h \
386 sys/stropts.h sys/sysmacros.h sys/time.h \
387 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
388 util.h utime.h utmp.h utmpx.h)
390 # Checks for libraries.
391 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
392 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
394 dnl SCO OS3 needs this for libwrap
395 if test "x$with_tcp_wrappers" != "xno" ; then
396 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
397 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
401 AC_CHECK_FUNC(getspnam, ,
402 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
405 [ --without-rpath Disable auto-added -R linker paths],
407 if test "x$withval" = "xno" ; then
410 if test "x$withval" = "xyes" ; then
418 [ --with-zlib=PATH Use zlib in PATH],
420 if test "x$withval" = "xno" ; then
421 AC_MSG_ERROR([*** zlib is required ***])
423 if test -d "$withval/lib"; then
424 if test -n "${need_dash_r}"; then
425 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
427 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
430 if test -n "${need_dash_r}"; then
431 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
433 LDFLAGS="-L${withval} ${LDFLAGS}"
436 if test -d "$withval/include"; then
437 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
439 CPPFLAGS="-I${withval} ${CPPFLAGS}"
444 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
447 AC_CHECK_FUNC(strcasecmp,
448 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
450 AC_CHECK_FUNC(utimes,
451 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
452 LIBS="$LIBS -lc89"]) ]
455 dnl Checks for libutil functions
456 AC_CHECK_HEADERS(libutil.h)
457 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
458 AC_CHECK_FUNCS(logout updwtmp logwtmp)
462 # Check for ALTDIRFUNC glob() extension
463 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
464 AC_EGREP_CPP(FOUNDIT,
467 #ifdef GLOB_ALTDIRFUNC
472 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
480 # Check for g.gl_matchc glob() extension
481 AC_MSG_CHECKING(for gl_matchc field in glob_t)
482 AC_EGREP_CPP(FOUNDIT,
485 int main(void){glob_t g; g.gl_matchc = 1;}
488 AC_DEFINE(GLOB_HAS_GL_MATCHC)
496 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
499 #include <sys/types.h>
501 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
503 [AC_MSG_RESULT(yes)],
506 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
510 # Check whether the user wants GSSAPI mechglue support
511 AC_ARG_WITH(mechglue,
512 [ --with-mechglue=PATH Build with GSSAPI mechglue library],
514 AC_MSG_CHECKING(for mechglue library)
516 if test -e ${withval}/libgssapi.a ; then
517 mechglue_lib=${withval}/libgssapi.a
518 elif test -e ${withval}/lib/libgssapi.a ; then
519 mechglue_lib=${withval}/lib/libgssapi.a
521 AC_MSG_ERROR("Can't find libgssapi in ${withval}");
523 LIBS="$LIBS ${mechglue_lib}"
524 AC_MSG_RESULT(${mechglue_lib})
526 # if test -e ${withval}/gssapi.h ; then
527 # CPPFLAGS="$CPPFLAGS -I${withval}"
528 # elif test -e ${withval}/include/gssapi.h ; then
529 # CPPFLAGS="$CPPFLAGS -I${withval}/include"
531 # AC_MSG_ERROR("Can't find gssapi.h in ${withval}");
534 AC_CHECK_LIB(dl, dlopen, , )
535 if test $ac_cv_lib_dl_dlopen = yes; then
536 LDFLAGS="$LDFLAGS -ldl -Wl,-Bsymbolic"
547 # Check whether the user wants GSI (Globus) support
550 [ --with-gsi=PATH Enable GSI/Globus authentication support],
557 [ --with-globus=PATH Enable GSI/Globus authentication support],
563 # Check whether the user has a Globus flavor type
564 globus_flavor_type="no"
565 AC_ARG_WITH(globus-flavor,
566 [ --with-globus-flavor=TYPE Describe Globus flavor type (ex: gcc32dbg, etc.)],
568 globus_flavor_type="$withval"
572 if test "x$gsi_path" != "xno" ; then
573 # Globus GSSAPI configuration
576 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
577 AC_MSG_ERROR([Previously configured GSSAPI library conflicts with Globus/GSI.])
579 if test -z "$GSSAPI"; then
584 # Find GLOBUS/GSI installation Directory
586 AC_MSG_CHECKING(for Globus installation)
587 globus_dev_dir=$gsi_path
588 if test "x$globus_dev_dir" = "xyes" ; then
589 AC_MSG_ERROR(Cannot find Globus installation -- a path must be specified!)
591 AC_MSG_RESULT($globus_dev_dir)
593 # Find GLOBUS/GSI flavor Directory
595 AC_MSG_CHECKING(for Globus flavor)
596 if test "x$globus_flavor_type" = "xno" ; then
597 AC_MSG_ERROR(No Globus flavor type specified)
598 elif test "x$globus_flavor_type" = "xyes" ; then
599 AC_MSG_ERROR(No Globus flavor type specified)
601 GLOBUS_FLAVOR_TYPE_INCL_DIR="${globus_dev_dir}/include/${globus_flavor_type}"
602 if test ! -d "$GLOBUS_FLAVOR_TYPE_INCL_DIR" ; then
603 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_FLAVOR_TYPE_INCL_DIR})
605 GSI_CPPFLAGS="-I${GLOBUS_FLAVOR_TYPE_INCL_DIR}"
607 AC_MSG_RESULT($globus_flavor_type)
609 # Build possible libraries off of the flavor name
611 libglobus_gss_assist="${gsi_path}/lib/libglobus_gss_assist_${globus_flavor_type}.a"
612 libglobus_gssapi_gsi="${gsi_path}/lib/libglobus_gssapi_gsi_${globus_flavor_type}.a"
614 # Test that the base gss_assist library is present
616 if test -r ${libglobus_gss_assist} ; then
617 LIBS="$LIBS ${libglobus_gss_assist}"
619 AC_MSG_ERROR([*** libglobus_gss_assist missing])
622 AC_MSG_CHECKING(for libglobus_gss_assist)
630 AC_MSG_ERROR([*** libglobus_gss_assist missing])
634 # If we aren't using mechglue, test that gssapi_gsi is present
636 if test "$GSSAPI" != "mechglue"; then
637 if test -r ${libglobus_gssapi_gsi} ; then
638 LIBS="$LIBS ${libglobus_gssapi_gsi}"
640 AC_MSG_ERROR([*** libglobus_gssapi_gsi missing])
644 AC_MSG_CHECKING(for libglobus_gssapi_gsi)
652 AC_MSG_ERROR([*** libglobus_gssapi_gsi missing])
656 CPPFLAGS="$CPPFLAGS $GSI_CPPFLAGS"
661 AC_SUBST(INSTALL_GSISSH)
662 # End Globus/GSI section
664 # Check whether user wants S/Key support
667 [ --with-skey[[=PATH]] Enable S/Key support
668 (optionally in PATH)],
670 if test "x$withval" != "xno" ; then
672 if test "x$withval" != "xyes" ; then
673 CPPFLAGS="$CPPFLAGS -I${withval}/include"
674 LDFLAGS="$LDFLAGS -L${withval}/lib"
681 AC_MSG_CHECKING([for s/key support])
686 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
688 [AC_MSG_RESULT(yes)],
691 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
697 # Check whether user wants TCP wrappers support
699 AC_ARG_WITH(tcp-wrappers,
700 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
701 (optionally in PATH)],
703 if test "x$withval" != "xno" ; then
705 saved_LDFLAGS="$LDFLAGS"
706 saved_CPPFLAGS="$CPPFLAGS"
707 if test -n "${withval}" -a "${withval}" != "yes"; then
708 if test -d "${withval}/lib"; then
709 if test -n "${need_dash_r}"; then
710 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
712 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
715 if test -n "${need_dash_r}"; then
716 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
718 LDFLAGS="-L${withval} ${LDFLAGS}"
721 if test -d "${withval}/include"; then
722 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
724 CPPFLAGS="-I${withval} ${CPPFLAGS}"
728 LIBS="$LIBWRAP $LIBS"
729 AC_MSG_CHECKING(for libwrap)
733 int deny_severity = 0, allow_severity = 0;
743 AC_MSG_ERROR([*** libwrap missing])
751 dnl Checks for library functions.
752 AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
753 clock fchmod fchown freeaddrinfo futimes gai_strerror \
754 getaddrinfo getcwd getgrouplist getnameinfo getopt getpeereid\
755 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
756 inet_ntop innetgr login_getcapbool md5_crypt memmove \
757 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
758 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
759 setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
760 setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \
761 socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \
762 truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
764 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
765 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
766 AC_CHECK_LIB(gen, dirname,[
767 AC_CACHE_CHECK([for broken dirname],
768 ac_cv_have_broken_dirname, [
776 int main(int argc, char **argv) {
779 strncpy(buf,"/etc", 32);
781 if (!s || strncmp(s, "/", 32) != 0) {
788 [ ac_cv_have_broken_dirname="no" ],
789 [ ac_cv_have_broken_dirname="yes" ]
793 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
795 AC_DEFINE(HAVE_DIRNAME)
796 AC_CHECK_HEADERS(libgen.h)
801 dnl Checks for time functions
802 AC_CHECK_FUNCS(gettimeofday time)
803 dnl Checks for utmp functions
804 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
805 AC_CHECK_FUNCS(utmpname)
806 dnl Checks for utmpx functions
807 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
808 AC_CHECK_FUNCS(setutxent utmpxname)
810 AC_CHECK_FUNC(daemon,
811 [AC_DEFINE(HAVE_DAEMON)],
812 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
815 AC_CHECK_FUNC(getpagesize,
816 [AC_DEFINE(HAVE_GETPAGESIZE)],
817 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
820 # Check for broken snprintf
821 if test "x$ac_cv_func_snprintf" = "xyes" ; then
822 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
826 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
828 [AC_MSG_RESULT(yes)],
831 AC_DEFINE(BROKEN_SNPRINTF)
832 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
842 [ --with-pam Enable PAM support ],
844 if test "x$withval" != "xno" ; then
845 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
846 AC_MSG_ERROR([PAM headers not found])
849 AC_CHECK_LIB(dl, dlopen, , )
850 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
851 AC_CHECK_FUNCS(pam_getenvlist)
852 AC_CHECK_FUNCS(pam_putenv)
858 if test $ac_cv_lib_dl_dlopen = yes; then
869 # Check for older PAM
870 if test "x$PAM_MSG" = "xyes" ; then
871 # Check PAM strerror arguments (old PAM)
872 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
876 #include <security/pam_appl.h>
878 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
881 AC_DEFINE(HAVE_OLD_PAM)
883 PAM_MSG="yes (old library)"
888 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
889 # because the system crypt() is more featureful.
890 if test "x$check_for_libcrypt_before" = "x1"; then
891 AC_CHECK_LIB(crypt, crypt)
895 saved_CPPFLAGS="$CPPFLAGS"
896 saved_LDFLAGS="$LDFLAGS"
898 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
900 if test "x$withval" != "xno" ; then
901 if test -d "$withval/lib"; then
902 if test -n "${need_dash_r}"; then
903 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
905 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
908 if test -n "${need_dash_r}"; then
909 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
911 LDFLAGS="-L${withval} ${LDFLAGS}"
914 if test -d "$withval/include"; then
915 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
917 CPPFLAGS="-I${withval} ${CPPFLAGS}"
923 # Patch up SSL libraries for GSI authentication as needed
924 if test "x$globus_flavor_type" != "xno" ; then
926 # For Globus 2, always link with the static libraries
929 libssl_utils="${gsi_path}/lib/libglobus_ssl_utils_${globus_flavor_type}.a"
932 # Trouble arrives at GT 2.1.3+ with the reorg of globus_ssl_utils. Compensating for
933 # the new library linking required here through file tests to see which libraries to
937 libgsi_proxy_core="${gsi_path}/lib/libglobus_gsi_proxy_core_${globus_flavor_type}.a"
938 libgsi_credential="${gsi_path}/lib/libglobus_gsi_credential_${globus_flavor_type}.a"
939 libgsi_callback="${gsi_path}/lib/libglobus_gsi_callback_${globus_flavor_type}.a"
940 liboldgaa="${gsi_path}/lib/libglobus_oldgaa_${globus_flavor_type}.a"
941 libgsi_sysconfig="${gsi_path}/lib/libglobus_gsi_sysconfig_${globus_flavor_type}.a"
942 libproxy_ssl="${gsi_path}/lib/libglobus_proxy_ssl_${globus_flavor_type}.a"
943 libgsi_cert_utils="${gsi_path}/lib/libglobus_gsi_cert_utils_${globus_flavor_type}.a"
944 libopenssl_error="${gsi_path}/lib/libglobus_openssl_error_${globus_flavor_type}.a"
945 libopenssl="${gsi_path}/lib/libglobus_openssl_${globus_flavor_type}.a"
947 if test -r ${libgsi_proxy_core} \
948 -a -r ${libgsi_credential} \
949 -a -r ${libgsi_callback} \
951 -a -r ${libgsi_sysconfig} \
952 -a -r ${libproxy_ssl} \
953 -a -r ${libgsi_cert_utils} \
954 -a -r ${libopenssl_error} \
955 -a -r ${libopenssl} ; then
956 LIBS="$LIBS ${libgsi_proxy_core}"
957 LIBS="$LIBS ${libgsi_credential}"
958 LIBS="$LIBS ${libgsi_callback}"
959 LIBS="$LIBS ${liboldgaa}"
960 LIBS="$LIBS ${libgsi_sysconfig}"
961 LIBS="$LIBS ${libproxy_ssl}"
962 LIBS="$LIBS ${libgsi_cert_utils}"
963 LIBS="$LIBS ${libopenssl_error}"
964 LIBS="$LIBS ${libopenssl}"
965 elif test -r ${libssl_utils}; then
966 LIBS="$LIBS ${libssl_utils}"
968 AC_MSG_ERROR([*** missing one or more Globus GSI libraries])
971 AC_MSG_CHECKING(for Globus GSI libraries)
979 AC_MSG_ERROR([*** missing one or more Globus GSI libraries])
984 # Standard openssl libraries. They need to appear near the end of the link line.
987 LIBS="$LIBS ${gsi_path}/lib/libssl_${globus_flavor_type}.a"
988 LIBS="$LIBS ${gsi_path}/lib/libcrypto_${globus_flavor_type}.a"
990 AC_MSG_CHECKING(for Globus OpenSSL libraries)
998 AC_MSG_ERROR([*** missing one or more Globus OpenSSL libraries])
1003 # Another "GT 2.1.3+"ism.
1006 libcommon_path="${gsi_path}/lib/libglobus_common_${globus_flavor_type}.a"
1007 if test -r ${libcommon_path}; then
1008 LIBS="$LIBS ${libcommon_path}"
1009 AC_MSG_CHECKING(for libglobus_common)
1017 AC_MSG_ERROR([*** libglobus_common missing])
1022 if test "x$gsi_path" != "xno" ; then
1023 # Older GSI needs -lssl too
1024 LIBS="$LIBS -lssl -lcrypto"
1025 else # if no GSI authentication (i.e., OpenSSL default)
1026 LIBS="$LIBS -lcrypto"
1028 fi # globus_flavor_type
1030 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1032 dnl Check default openssl install dir
1033 if test -n "${need_dash_r}"; then
1034 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1036 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1038 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1039 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1041 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1047 # Determine OpenSSL header version
1048 AC_MSG_CHECKING([OpenSSL header version])
1053 #include <openssl/opensslv.h>
1054 #define DATA "conftest.sslincver"
1059 fd = fopen(DATA,"w");
1063 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1070 ssl_header_ver=`cat conftest.sslincver`
1071 AC_MSG_RESULT($ssl_header_ver)
1074 AC_MSG_RESULT(not found)
1075 AC_MSG_ERROR(OpenSSL version header not found.)
1079 # Determine OpenSSL library version
1080 AC_MSG_CHECKING([OpenSSL library version])
1085 #include <openssl/opensslv.h>
1086 #include <openssl/crypto.h>
1087 #define DATA "conftest.ssllibver"
1092 fd = fopen(DATA,"w");
1096 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1103 ssl_library_ver=`cat conftest.ssllibver`
1104 AC_MSG_RESULT($ssl_library_ver)
1107 AC_MSG_RESULT(not found)
1108 AC_MSG_ERROR(OpenSSL library not found.)
1112 # Sanity check OpenSSL headers
1113 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1117 #include <openssl/opensslv.h>
1118 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1125 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
1129 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1130 # version in OpenSSL. Skip this for PAM
1131 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
1132 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1136 ### Configure cryptographic random number support
1138 # Check wheter OpenSSL seeds itself
1139 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1143 #include <openssl/rand.h>
1144 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1147 OPENSSL_SEEDS_ITSELF=yes
1152 # Default to use of the rand helper if OpenSSL doesn't
1159 # Do we want to force the use of the rand helper?
1160 AC_ARG_WITH(rand-helper,
1161 [ --with-rand-helper Use subprocess to gather strong randomness ],
1163 if test "x$withval" = "xno" ; then
1164 # Force use of OpenSSL's internal RNG, even if
1165 # the previous test showed it to be unseeded.
1166 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1167 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1168 OPENSSL_SEEDS_ITSELF=yes
1177 # Which randomness source do we use?
1178 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1180 AC_DEFINE(OPENSSL_PRNG_ONLY)
1181 RAND_MSG="OpenSSL internal ONLY"
1182 INSTALL_SSH_RAND_HELPER=""
1183 elif test ! -z "$USE_RAND_HELPER" ; then
1184 # install rand helper
1185 RAND_MSG="ssh-rand-helper"
1186 INSTALL_SSH_RAND_HELPER="yes"
1188 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1190 ### Configuration of ssh-rand-helper
1193 AC_ARG_WITH(prngd-port,
1194 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1203 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1206 if test ! -z "$withval" ; then
1207 PRNGD_PORT="$withval"
1208 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1213 # PRNGD Unix domain socket
1214 AC_ARG_WITH(prngd-socket,
1215 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1219 withval="/var/run/egd-pool"
1227 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1231 if test ! -z "$withval" ; then
1232 if test ! -z "$PRNGD_PORT" ; then
1233 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1235 if test ! -r "$withval" ; then
1236 AC_MSG_WARN(Entropy socket is not readable)
1238 PRNGD_SOCKET="$withval"
1239 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1243 # Check for existing socket only if we don't have a random device already
1244 if test "$USE_RAND_HELPER" = yes ; then
1245 AC_MSG_CHECKING(for PRNGD/EGD socket)
1246 # Insert other locations here
1247 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1248 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1249 PRNGD_SOCKET="$sock"
1250 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1254 if test ! -z "$PRNGD_SOCKET" ; then
1255 AC_MSG_RESULT($PRNGD_SOCKET)
1257 AC_MSG_RESULT(not found)
1263 # Change default command timeout for hashing entropy source
1265 AC_ARG_WITH(entropy-timeout,
1266 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1268 if test "x$withval" != "xno" ; then
1269 entropy_timeout=$withval
1273 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1275 SSH_PRIVSEP_USER=sshd
1276 AC_ARG_WITH(privsep-user,
1277 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1279 if test -n "$withval"; then
1280 SSH_PRIVSEP_USER=$withval
1284 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1285 AC_SUBST(SSH_PRIVSEP_USER)
1287 # We do this little dance with the search path to insure
1288 # that programs that we select for use by installed programs
1289 # (which may be run by the super-user) come from trusted
1290 # locations before they come from the user's private area.
1291 # This should help avoid accidentally configuring some
1292 # random version of a program in someone's personal bin.
1296 test -h /bin 2> /dev/null && PATH=/usr/bin
1297 test -d /sbin && PATH=$PATH:/sbin
1298 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1299 PATH=$PATH:/etc:$OPATH
1301 # These programs are used by the command hashing source to gather entropy
1302 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1303 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1304 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1305 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1306 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1307 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1308 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1309 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1310 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1311 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1312 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1313 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1314 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1315 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1316 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1317 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1321 # Where does ssh-rand-helper get its randomness from?
1322 INSTALL_SSH_PRNG_CMDS=""
1323 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1324 if test ! -z "$PRNGD_PORT" ; then
1325 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1326 elif test ! -z "$PRNGD_SOCKET" ; then
1327 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1329 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1330 RAND_HELPER_CMDHASH=yes
1331 INSTALL_SSH_PRNG_CMDS="yes"
1334 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1337 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1338 if test ! -z "$SONY" ; then
1339 LIBS="$LIBS -liberty";
1342 # Checks for data types
1343 AC_CHECK_SIZEOF(char, 1)
1344 AC_CHECK_SIZEOF(short int, 2)
1345 AC_CHECK_SIZEOF(int, 4)
1346 AC_CHECK_SIZEOF(long int, 4)
1347 AC_CHECK_SIZEOF(long long int, 8)
1349 # Sanity check long long for some platforms (AIX)
1350 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1351 ac_cv_sizeof_long_long_int=0
1354 # More checks for data types
1355 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1357 [ #include <sys/types.h> ],
1359 [ ac_cv_have_u_int="yes" ],
1360 [ ac_cv_have_u_int="no" ]
1363 if test "x$ac_cv_have_u_int" = "xyes" ; then
1364 AC_DEFINE(HAVE_U_INT)
1368 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1370 [ #include <sys/types.h> ],
1371 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1372 [ ac_cv_have_intxx_t="yes" ],
1373 [ ac_cv_have_intxx_t="no" ]
1376 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1377 AC_DEFINE(HAVE_INTXX_T)
1381 if (test -z "$have_intxx_t" && \
1382 test "x$ac_cv_header_stdint_h" = "xyes")
1384 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1386 [ #include <stdint.h> ],
1387 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1389 AC_DEFINE(HAVE_INTXX_T)
1392 [ AC_MSG_RESULT(no) ]
1396 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1399 #include <sys/types.h>
1400 #ifdef HAVE_STDINT_H
1401 # include <stdint.h>
1403 #include <sys/socket.h>
1404 #ifdef HAVE_SYS_BITYPES_H
1405 # include <sys/bitypes.h>
1408 [ int64_t a; a = 1;],
1409 [ ac_cv_have_int64_t="yes" ],
1410 [ ac_cv_have_int64_t="no" ]
1413 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1414 AC_DEFINE(HAVE_INT64_T)
1417 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1419 [ #include <sys/types.h> ],
1420 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1421 [ ac_cv_have_u_intxx_t="yes" ],
1422 [ ac_cv_have_u_intxx_t="no" ]
1425 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1426 AC_DEFINE(HAVE_U_INTXX_T)
1430 if test -z "$have_u_intxx_t" ; then
1431 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1433 [ #include <sys/socket.h> ],
1434 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1436 AC_DEFINE(HAVE_U_INTXX_T)
1439 [ AC_MSG_RESULT(no) ]
1443 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1445 [ #include <sys/types.h> ],
1446 [ u_int64_t a; a = 1;],
1447 [ ac_cv_have_u_int64_t="yes" ],
1448 [ ac_cv_have_u_int64_t="no" ]
1451 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1452 AC_DEFINE(HAVE_U_INT64_T)
1456 if test -z "$have_u_int64_t" ; then
1457 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1459 [ #include <sys/bitypes.h> ],
1460 [ u_int64_t a; a = 1],
1462 AC_DEFINE(HAVE_U_INT64_T)
1465 [ AC_MSG_RESULT(no) ]
1469 if test -z "$have_u_intxx_t" ; then
1470 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1473 #include <sys/types.h>
1475 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1476 [ ac_cv_have_uintxx_t="yes" ],
1477 [ ac_cv_have_uintxx_t="no" ]
1480 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1481 AC_DEFINE(HAVE_UINTXX_T)
1485 if test -z "$have_uintxx_t" ; then
1486 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1488 [ #include <stdint.h> ],
1489 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1491 AC_DEFINE(HAVE_UINTXX_T)
1494 [ AC_MSG_RESULT(no) ]
1498 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1499 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1501 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1504 #include <sys/bitypes.h>
1507 int8_t a; int16_t b; int32_t c;
1508 u_int8_t e; u_int16_t f; u_int32_t g;
1509 a = b = c = e = f = g = 1;
1512 AC_DEFINE(HAVE_U_INTXX_T)
1513 AC_DEFINE(HAVE_INTXX_T)
1521 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1524 #include <sys/types.h>
1526 [ u_char foo; foo = 125; ],
1527 [ ac_cv_have_u_char="yes" ],
1528 [ ac_cv_have_u_char="no" ]
1531 if test "x$ac_cv_have_u_char" = "xyes" ; then
1532 AC_DEFINE(HAVE_U_CHAR)
1537 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1539 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1542 #include <sys/types.h>
1544 [ size_t foo; foo = 1235; ],
1545 [ ac_cv_have_size_t="yes" ],
1546 [ ac_cv_have_size_t="no" ]
1549 if test "x$ac_cv_have_size_t" = "xyes" ; then
1550 AC_DEFINE(HAVE_SIZE_T)
1553 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1556 #include <sys/types.h>
1558 [ ssize_t foo; foo = 1235; ],
1559 [ ac_cv_have_ssize_t="yes" ],
1560 [ ac_cv_have_ssize_t="no" ]
1563 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1564 AC_DEFINE(HAVE_SSIZE_T)
1567 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1572 [ clock_t foo; foo = 1235; ],
1573 [ ac_cv_have_clock_t="yes" ],
1574 [ ac_cv_have_clock_t="no" ]
1577 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1578 AC_DEFINE(HAVE_CLOCK_T)
1581 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1584 #include <sys/types.h>
1585 #include <sys/socket.h>
1587 [ sa_family_t foo; foo = 1235; ],
1588 [ ac_cv_have_sa_family_t="yes" ],
1591 #include <sys/types.h>
1592 #include <sys/socket.h>
1593 #include <netinet/in.h>
1595 [ sa_family_t foo; foo = 1235; ],
1596 [ ac_cv_have_sa_family_t="yes" ],
1598 [ ac_cv_have_sa_family_t="no" ]
1602 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1603 AC_DEFINE(HAVE_SA_FAMILY_T)
1606 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1609 #include <sys/types.h>
1611 [ pid_t foo; foo = 1235; ],
1612 [ ac_cv_have_pid_t="yes" ],
1613 [ ac_cv_have_pid_t="no" ]
1616 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1617 AC_DEFINE(HAVE_PID_T)
1620 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1623 #include <sys/types.h>
1625 [ mode_t foo; foo = 1235; ],
1626 [ ac_cv_have_mode_t="yes" ],
1627 [ ac_cv_have_mode_t="no" ]
1630 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1631 AC_DEFINE(HAVE_MODE_T)
1635 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1638 #include <sys/types.h>
1639 #include <sys/socket.h>
1641 [ struct sockaddr_storage s; ],
1642 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1643 [ ac_cv_have_struct_sockaddr_storage="no" ]
1646 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1647 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1650 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1653 #include <sys/types.h>
1654 #include <netinet/in.h>
1656 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1657 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1658 [ ac_cv_have_struct_sockaddr_in6="no" ]
1661 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1662 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1665 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1668 #include <sys/types.h>
1669 #include <netinet/in.h>
1671 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1672 [ ac_cv_have_struct_in6_addr="yes" ],
1673 [ ac_cv_have_struct_in6_addr="no" ]
1676 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1677 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1680 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1683 #include <sys/types.h>
1684 #include <sys/socket.h>
1687 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1688 [ ac_cv_have_struct_addrinfo="yes" ],
1689 [ ac_cv_have_struct_addrinfo="no" ]
1692 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1693 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1696 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1698 [ #include <sys/time.h> ],
1699 [ struct timeval tv; tv.tv_sec = 1;],
1700 [ ac_cv_have_struct_timeval="yes" ],
1701 [ ac_cv_have_struct_timeval="no" ]
1704 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1705 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1706 have_struct_timeval=1
1709 # If we don't have int64_t then we can't compile sftp-server. So don't
1710 # even attempt to do it.
1711 if test "x$ac_cv_have_int64_t" = "xno" -a \
1712 "x$ac_cv_sizeof_long_int" != "x8" -a \
1713 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1716 dnl test snprintf (broken on SCO w/gcc)
1721 #ifdef HAVE_SNPRINTF
1725 char expected_out[50];
1727 #if (SIZEOF_LONG_INT == 8)
1728 long int num = 0x7fffffffffffffff;
1730 long long num = 0x7fffffffffffffffll;
1732 strcpy(expected_out, "9223372036854775807");
1733 snprintf(buf, mazsize, "%lld", num);
1734 if(strcmp(buf, expected_out) != 0)
1741 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1746 dnl Checks for structure members
1747 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1748 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1749 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1750 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1751 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1752 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1753 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1754 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1755 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1756 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1757 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1758 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1759 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1760 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1761 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1762 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1763 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1765 AC_CHECK_MEMBERS([struct stat.st_blksize])
1767 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1768 ac_cv_have_ss_family_in_struct_ss, [
1771 #include <sys/types.h>
1772 #include <sys/socket.h>
1774 [ struct sockaddr_storage s; s.ss_family = 1; ],
1775 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1776 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1779 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1780 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1783 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1784 ac_cv_have___ss_family_in_struct_ss, [
1787 #include <sys/types.h>
1788 #include <sys/socket.h>
1790 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1791 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1792 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1795 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1796 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1799 AC_CACHE_CHECK([for pw_class field in struct passwd],
1800 ac_cv_have_pw_class_in_struct_passwd, [
1805 [ struct passwd p; p.pw_class = 0; ],
1806 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1807 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1810 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1811 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1814 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1815 ac_cv_have_pw_expire_in_struct_passwd, [
1820 [ struct passwd p; p.pw_expire = 0; ],
1821 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1822 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1825 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1826 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1829 AC_CACHE_CHECK([for pw_change field in struct passwd],
1830 ac_cv_have_pw_change_in_struct_passwd, [
1835 [ struct passwd p; p.pw_change = 0; ],
1836 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1837 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1840 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1841 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1844 dnl make sure we're using the real structure members and not defines
1845 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1846 ac_cv_have_accrights_in_msghdr, [
1849 #include <sys/types.h>
1850 #include <sys/socket.h>
1851 #include <sys/uio.h>
1853 #ifdef msg_accrights
1857 m.msg_accrights = 0;
1861 [ ac_cv_have_accrights_in_msghdr="yes" ],
1862 [ ac_cv_have_accrights_in_msghdr="no" ]
1865 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1866 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1869 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1870 ac_cv_have_control_in_msghdr, [
1873 #include <sys/types.h>
1874 #include <sys/socket.h>
1875 #include <sys/uio.h>
1885 [ ac_cv_have_control_in_msghdr="yes" ],
1886 [ ac_cv_have_control_in_msghdr="no" ]
1889 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1890 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1893 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1895 [ extern char *__progname; printf("%s", __progname); ],
1896 [ ac_cv_libc_defines___progname="yes" ],
1897 [ ac_cv_libc_defines___progname="no" ]
1900 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1901 AC_DEFINE(HAVE___PROGNAME)
1904 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1908 [ printf("%s", __FUNCTION__); ],
1909 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1910 [ ac_cv_cc_implements___FUNCTION__="no" ]
1913 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1914 AC_DEFINE(HAVE___FUNCTION__)
1917 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1921 [ printf("%s", __func__); ],
1922 [ ac_cv_cc_implements___func__="yes" ],
1923 [ ac_cv_cc_implements___func__="no" ]
1926 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1927 AC_DEFINE(HAVE___func__)
1930 AC_CACHE_CHECK([whether getopt has optreset support],
1931 ac_cv_have_getopt_optreset, [
1936 [ extern int optreset; optreset = 0; ],
1937 [ ac_cv_have_getopt_optreset="yes" ],
1938 [ ac_cv_have_getopt_optreset="no" ]
1941 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1942 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1945 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1947 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1948 [ ac_cv_libc_defines_sys_errlist="yes" ],
1949 [ ac_cv_libc_defines_sys_errlist="no" ]
1952 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1953 AC_DEFINE(HAVE_SYS_ERRLIST)
1957 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1959 [ extern int sys_nerr; printf("%i", sys_nerr);],
1960 [ ac_cv_libc_defines_sys_nerr="yes" ],
1961 [ ac_cv_libc_defines_sys_nerr="no" ]
1964 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1965 AC_DEFINE(HAVE_SYS_NERR)
1970 # Check whether user wants sectok support
1972 [ --with-sectok Enable smartcard support using libsectok],
1974 if test "x$withval" != "xno" ; then
1975 if test "x$withval" != "xyes" ; then
1976 CPPFLAGS="$CPPFLAGS -I${withval}"
1977 LDFLAGS="$LDFLAGS -L${withval}"
1978 if test ! -z "$need_dash_r" ; then
1979 LDFLAGS="$LDFLAGS -R${withval}"
1981 if test ! -z "$blibpath" ; then
1982 blibpath="$blibpath:${withval}"
1985 AC_CHECK_HEADERS(sectok.h)
1986 if test "$ac_cv_header_sectok_h" != yes; then
1987 AC_MSG_ERROR(Can't find sectok.h)
1989 AC_CHECK_LIB(sectok, sectok_open)
1990 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1991 AC_MSG_ERROR(Can't find libsectok)
1993 AC_DEFINE(SMARTCARD)
1994 AC_DEFINE(USE_SECTOK)
1995 SCARD_MSG="yes, using sectok"
2000 # Check whether user wants OpenSC support
2002 AC_HELP_STRING([--with-opensc=PFX],
2003 [Enable smartcard support using OpenSC]),
2004 opensc_config_prefix="$withval", opensc_config_prefix="")
2005 if test x$opensc_config_prefix != x ; then
2006 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2007 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2008 if test "$OPENSC_CONFIG" != "no"; then
2009 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2010 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2011 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2012 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2013 AC_DEFINE(SMARTCARD)
2014 AC_DEFINE(USE_OPENSC)
2015 SCARD_MSG="yes, using OpenSC"
2019 # Check whether user wants Kerberos 5 support
2021 AC_ARG_WITH(kerberos5,
2022 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2024 if test "x$withval" != "xno" ; then
2025 if test "x$withval" = "xyes" ; then
2026 KRB5ROOT="/usr/local"
2030 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2031 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2034 AC_MSG_CHECKING(whether we are using Heimdal)
2035 AC_TRY_COMPILE([ #include <krb5.h> ],
2036 [ char *tmp = heimdal_version; ],
2037 [ AC_MSG_RESULT(yes)
2039 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2042 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2045 if test ! -z "$need_dash_r" ; then
2046 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2048 if test ! -z "$blibpath" ; then
2049 blibpath="$blibpath:${KRB5ROOT}/lib"
2051 AC_CHECK_LIB(resolv, dn_expand, , )
2053 # If we're using some other GSSAPI
2054 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
2055 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
2057 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2059 K5LIBS="-lgssapi $K5LIBS" ],
2060 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2062 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2063 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2068 AC_CHECK_HEADER(gssapi.h, ,
2069 [ unset ac_cv_header_gssapi_h
2070 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2071 AC_CHECK_HEADERS(gssapi.h, ,
2072 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2077 AC_CHECK_LIB(gssapi, gss_krb5_copy_ccache, /bin/true,
2078 [ K5LIBS="-lgssapi_krb5 $K5LIBS"
2079 AC_CHECK_LIB(gssapi_krb5, gss_krb5_copy_ccache, /bin/true,
2080 AC_MSG_WARN([Cannot find gss_krb5_copy_ccache -- build may fail]),
2086 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2087 AC_CHECK_HEADER(gssapi_krb5.h, ,
2088 [ CPPFLAGS="$oldCPP" ])
2090 if test -z "$GSSAPI"; then
2098 # Check whether user wants Kerberos 4 support
2100 AC_ARG_WITH(kerberos4,
2101 [ --with-kerberos4=PATH Enable Kerberos 4 support],
2103 if test "x$withval" != "xno" ; then
2104 if test "x$withval" != "xyes" ; then
2105 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2106 LDFLAGS="$LDFLAGS -L${withval}/lib"
2107 if test ! -z "$need_dash_r" ; then
2108 LDFLAGS="$LDFLAGS -R${withval}/lib"
2110 if test ! -z "$blibpath" ; then
2111 blibpath="$blibpath:${withval}/lib"
2114 if test -d /usr/include/kerberosIV ; then
2115 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
2119 AC_CHECK_HEADERS(krb.h)
2120 if test "$ac_cv_header_krb_h" != yes; then
2121 AC_MSG_WARN([Cannot find krb.h, build may fail])
2123 AC_CHECK_LIB(krb, main)
2124 if test "$ac_cv_lib_krb_main" != yes; then
2125 AC_CHECK_LIB(krb4, main)
2126 if test "$ac_cv_lib_krb4_main" != yes; then
2127 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
2134 AC_CHECK_LIB(des, des_cbc_encrypt)
2135 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
2136 AC_CHECK_LIB(des425, des_cbc_encrypt)
2137 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
2138 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
2145 AC_CHECK_LIB(resolv, dn_expand, , )
2153 # Check whether user wants AFS support
2156 [ --with-afs=PATH Enable AFS support],
2158 if test "x$withval" != "xno" ; then
2160 if test "x$withval" != "xyes" ; then
2161 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2162 LDFLAGS="$LDFLAGS -L${withval}/lib"
2165 if test -z "$KRB4" ; then
2166 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
2170 if test ! -z "$AFS_LIBS" ; then
2171 LIBS="$LIBS $AFS_LIBS"
2178 LIBS="$LIBS $KLIBS $K5LIBS"
2180 # Looking for programs, paths and files
2182 PRIVSEP_PATH=/var/empty
2183 AC_ARG_WITH(privsep-path,
2184 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2186 if test "x$withval" != "$no" ; then
2187 PRIVSEP_PATH=$withval
2191 AC_SUBST(PRIVSEP_PATH)
2194 [ --with-xauth=PATH Specify path to xauth program ],
2196 if test "x$withval" != "xno" ; then
2202 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2203 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2204 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2205 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2206 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2207 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2208 xauth_path="/usr/openwin/bin/xauth"
2213 if test -z "$xauth_path" ; then
2214 XAUTH_PATH="undefined"
2215 AC_SUBST(XAUTH_PATH)
2217 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2218 XAUTH_PATH=$xauth_path
2219 AC_SUBST(XAUTH_PATH)
2222 # Check for mail directory (last resort if we cannot get it from headers)
2223 if test ! -z "$MAIL" ; then
2224 maildir=`dirname $MAIL`
2225 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2228 if test -z "$no_dev_ptmx" ; then
2229 if test "x$disable_ptmx_check" != "xyes" ; then
2230 AC_CHECK_FILE("/dev/ptmx",
2232 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2238 AC_CHECK_FILE("/dev/ptc",
2240 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2245 # Options from here on. Some of these are preset by platform above
2246 AC_ARG_WITH(mantype,
2247 [ --with-mantype=man|cat|doc Set man page type],
2254 AC_MSG_ERROR(invalid man type: $withval)
2259 if test -z "$MANTYPE"; then
2260 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2261 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2262 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2264 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2271 if test "$MANTYPE" = "doc"; then
2278 # Check whether to enable MD5 passwords
2280 AC_ARG_WITH(md5-passwords,
2281 [ --with-md5-passwords Enable use of MD5 passwords],
2283 if test "x$withval" != "xno" ; then
2284 AC_DEFINE(HAVE_MD5_PASSWORDS)
2290 # Whether to disable shadow password support
2292 [ --without-shadow Disable shadow password support],
2294 if test "x$withval" = "xno" ; then
2295 AC_DEFINE(DISABLE_SHADOW)
2301 if test -z "$disable_shadow" ; then
2302 AC_MSG_CHECKING([if the systems has expire shadow information])
2305 #include <sys/types.h>
2308 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2309 [ sp_expire_available=yes ], []
2312 if test "x$sp_expire_available" = "xyes" ; then
2314 AC_DEFINE(HAS_SHADOW_EXPIRE)
2320 # Use ip address instead of hostname in $DISPLAY
2321 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2322 DISPLAY_HACK_MSG="yes"
2323 AC_DEFINE(IPADDR_IN_DISPLAY)
2325 DISPLAY_HACK_MSG="no"
2326 AC_ARG_WITH(ipaddr-display,
2327 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2329 if test "x$withval" != "xno" ; then
2330 AC_DEFINE(IPADDR_IN_DISPLAY)
2331 DISPLAY_HACK_MSG="yes"
2337 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2338 if test $ac_cv_func_login_getcapbool = "yes" -a \
2339 $ac_cv_header_login_cap_h = "yes" ; then
2342 # Whether to mess with the default path
2343 SERVER_PATH_MSG="(default)"
2344 AC_ARG_WITH(default-path,
2345 [ --with-default-path= Specify default \$PATH environment for server],
2347 if test "$USES_LOGIN_CONF" = "yes" ; then
2349 --with-default-path=PATH has no effect on this system.
2350 Edit /etc/login.conf instead.])
2351 elif test "x$withval" != "xno" ; then
2352 user_path="$withval"
2353 SERVER_PATH_MSG="$withval"
2356 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2357 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2361 /* find out what STDPATH is */
2366 #ifndef _PATH_STDPATH
2367 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2369 #include <sys/types.h>
2370 #include <sys/stat.h>
2372 #define DATA "conftest.stdpath"
2379 fd = fopen(DATA,"w");
2383 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2388 ], [ user_path=`cat conftest.stdpath` ],
2389 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2390 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2394 if test "$USES_LOGIN_CONF" != "yes" ; then
2395 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2399 # Set superuser path separately to user path
2400 AC_ARG_WITH(superuser-path,
2401 [ --with-superuser-path= Specify different path for super-user],
2403 if test "x$withval" != "xno" ; then
2404 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2405 superuser_path=$withval
2411 # Whether to force IPv4 by default (needed on broken glibc Linux)
2413 AC_ARG_WITH(ipv4-default,
2414 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2416 if test "x$withval" != "xno" ; then
2417 AC_DEFINE(IPV4_DEFAULT)
2423 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2424 IPV4_IN6_HACK_MSG="no"
2426 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2428 if test "x$withval" != "xno" ; then
2430 AC_DEFINE(IPV4_IN_IPV6)
2431 IPV4_IN6_HACK_MSG="yes"
2436 if test "x$inet6_default_4in6" = "xyes"; then
2437 AC_MSG_RESULT([yes (default)])
2438 AC_DEFINE(IPV4_IN_IPV6)
2439 IPV4_IN6_HACK_MSG="yes"
2441 AC_MSG_RESULT([no (default)])
2446 # Whether to enable BSD auth support
2448 AC_ARG_WITH(bsd-auth,
2449 [ --with-bsd-auth Enable BSD auth support],
2451 if test "x$withval" != "xno" ; then
2458 # Where to place sshd.pid
2460 # make sure the directory exists
2461 if test ! -d $piddir ; then
2462 piddir=`eval echo ${sysconfdir}`
2464 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2468 AC_ARG_WITH(pid-dir,
2469 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2471 if test "x$withval" != "xno" ; then
2473 if test ! -d $piddir ; then
2474 AC_MSG_WARN([** no $piddir directory on this system **])
2480 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2483 dnl allow user to disable some login recording features
2484 AC_ARG_ENABLE(lastlog,
2485 [ --disable-lastlog disable use of lastlog even if detected [no]],
2486 [ AC_DEFINE(DISABLE_LASTLOG) ]
2489 [ --disable-utmp disable use of utmp even if detected [no]],
2490 [ AC_DEFINE(DISABLE_UTMP) ]
2492 AC_ARG_ENABLE(utmpx,
2493 [ --disable-utmpx disable use of utmpx even if detected [no]],
2494 [ AC_DEFINE(DISABLE_UTMPX) ]
2497 [ --disable-wtmp disable use of wtmp even if detected [no]],
2498 [ AC_DEFINE(DISABLE_WTMP) ]
2500 AC_ARG_ENABLE(wtmpx,
2501 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2502 [ AC_DEFINE(DISABLE_WTMPX) ]
2504 AC_ARG_ENABLE(libutil,
2505 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2506 [ AC_DEFINE(DISABLE_LOGIN) ]
2508 AC_ARG_ENABLE(pututline,
2509 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2510 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2512 AC_ARG_ENABLE(pututxline,
2513 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2514 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2516 AC_ARG_WITH(lastlog,
2517 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2519 if test "x$withval" = "xno" ; then
2520 AC_DEFINE(DISABLE_LASTLOG)
2522 conf_lastlog_location=$withval
2527 dnl lastlog, [uw]tmpx? detection
2528 dnl NOTE: set the paths in the platform section to avoid the
2529 dnl need for command-line parameters
2530 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2532 dnl lastlog detection
2533 dnl NOTE: the code itself will detect if lastlog is a directory
2534 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2536 #include <sys/types.h>
2538 #ifdef HAVE_LASTLOG_H
2539 # include <lastlog.h>
2548 [ char *lastlog = LASTLOG_FILE; ],
2549 [ AC_MSG_RESULT(yes) ],
2552 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2554 #include <sys/types.h>
2556 #ifdef HAVE_LASTLOG_H
2557 # include <lastlog.h>
2563 [ char *lastlog = _PATH_LASTLOG; ],
2564 [ AC_MSG_RESULT(yes) ],
2567 system_lastlog_path=no
2572 if test -z "$conf_lastlog_location"; then
2573 if test x"$system_lastlog_path" = x"no" ; then
2574 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2575 if (test -d "$f" || test -f "$f") ; then
2576 conf_lastlog_location=$f
2579 if test -z "$conf_lastlog_location"; then
2580 AC_MSG_WARN([** Cannot find lastlog **])
2581 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2586 if test -n "$conf_lastlog_location"; then
2587 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2591 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2593 #include <sys/types.h>
2599 [ char *utmp = UTMP_FILE; ],
2600 [ AC_MSG_RESULT(yes) ],
2602 system_utmp_path=no ]
2604 if test -z "$conf_utmp_location"; then
2605 if test x"$system_utmp_path" = x"no" ; then
2606 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2607 if test -f $f ; then
2608 conf_utmp_location=$f
2611 if test -z "$conf_utmp_location"; then
2612 AC_DEFINE(DISABLE_UTMP)
2616 if test -n "$conf_utmp_location"; then
2617 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2621 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2623 #include <sys/types.h>
2629 [ char *wtmp = WTMP_FILE; ],
2630 [ AC_MSG_RESULT(yes) ],
2632 system_wtmp_path=no ]
2634 if test -z "$conf_wtmp_location"; then
2635 if test x"$system_wtmp_path" = x"no" ; then
2636 for f in /usr/adm/wtmp /var/log/wtmp; do
2637 if test -f $f ; then
2638 conf_wtmp_location=$f
2641 if test -z "$conf_wtmp_location"; then
2642 AC_DEFINE(DISABLE_WTMP)
2646 if test -n "$conf_wtmp_location"; then
2647 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2651 dnl utmpx detection - I don't know any system so perverse as to require
2652 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2654 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2656 #include <sys/types.h>
2665 [ char *utmpx = UTMPX_FILE; ],
2666 [ AC_MSG_RESULT(yes) ],
2668 system_utmpx_path=no ]
2670 if test -z "$conf_utmpx_location"; then
2671 if test x"$system_utmpx_path" = x"no" ; then
2672 AC_DEFINE(DISABLE_UTMPX)
2675 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2679 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2681 #include <sys/types.h>
2690 [ char *wtmpx = WTMPX_FILE; ],
2691 [ AC_MSG_RESULT(yes) ],
2693 system_wtmpx_path=no ]
2695 if test -z "$conf_wtmpx_location"; then
2696 if test x"$system_wtmpx_path" = x"no" ; then
2697 AC_DEFINE(DISABLE_WTMPX)
2700 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2704 if test ! -z "$blibpath" ; then
2705 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2706 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2709 dnl remove pam and dl because they are in $LIBPAM
2710 if test "$PAM_MSG" = yes ; then
2711 LIBS=`echo $LIBS | sed 's/-lpam //'`
2713 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2714 LIBS=`echo $LIBS | sed 's/-ldl //'`
2718 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2721 # Print summary of options
2723 # Someone please show me a better way :)
2724 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2725 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2726 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2727 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2728 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2729 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2730 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2731 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2732 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2733 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2736 echo "OpenSSH has been configured with the following options:"
2737 echo " User binaries: $B"
2738 echo " System binaries: $C"
2739 echo " Configuration files: $D"
2740 echo " Askpass program: $E"
2741 echo " Manual pages: $F"
2742 echo " PID file: $G"
2743 echo " Privilege separation chroot path: $H"
2744 if test "$USES_LOGIN_CONF" = "yes" ; then
2745 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2747 echo " sshd default user PATH: $I"
2749 if test ! -z "$superuser_path" ; then
2750 echo " sshd superuser user PATH: $J"
2752 echo " Manpage format: $MANTYPE"
2753 echo " PAM support: ${PAM_MSG}"
2754 echo " KerberosIV support: $KRB4_MSG"
2755 echo " KerberosV support: $KRB5_MSG"
2756 echo " Smartcard support: $SCARD_MSG"
2757 echo " AFS support: $AFS_MSG"
2758 echo " S/KEY support: $SKEY_MSG"
2759 echo " TCP Wrappers support: $TCPW_MSG"
2760 echo " MD5 password support: $MD5_MSG"
2761 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2762 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2763 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2764 echo " BSD Auth support: $BSD_AUTH_MSG"
2765 echo " Random number source: $RAND_MSG"
2766 if test ! -z "$USE_RAND_HELPER" ; then
2767 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2772 echo " Host: ${host}"
2773 echo " Compiler: ${CC}"
2774 echo " Compiler flags: ${CFLAGS}"
2775 echo "Preprocessor flags: ${CPPFLAGS}"
2776 echo " Linker flags: ${LDFLAGS}"
2777 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2781 if test "x$PAM_MSG" = "xyes" ; then
2782 echo "PAM is enabled. You may need to install a PAM control file "
2783 echo "for sshd, otherwise password authentication may fail. "
2784 echo "Example PAM control files can be found in the contrib/ "
2789 if test ! -z "$NO_SFTP"; then
2790 echo "sftp-server will be disabled. Your compiler does not "
2791 echo "support 64bit integers."
2795 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2796 echo "WARNING: you are using the builtin random number collection "
2797 echo "service. Please read WARNING.RNG and request that your OS "
2798 echo "vendor includes kernel-based random number collection in "
2799 echo "future versions of your OS."