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"
541 AC_DEFINE(HAVE_GSSAPI_EXT)
548 # Check whether the user wants GSI (Globus) support
551 [ --with-gsi=PATH Enable GSI/Globus authentication support],
558 [ --with-globus=PATH Enable GSI/Globus authentication support],
564 # Check whether the user has a Globus flavor type
565 globus_flavor_type="no"
566 AC_ARG_WITH(globus-flavor,
567 [ --with-globus-flavor=TYPE Describe Globus flavor type (ex: gcc32dbg, etc.)],
569 globus_flavor_type="$withval"
573 if test "x$gsi_path" != "xno" ; then
574 # Globus GSSAPI configuration
577 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
578 AC_MSG_ERROR([Previously configured GSSAPI library conflicts with Globus/GSI.])
580 if test -z "$GSSAPI"; then
585 # Find GLOBUS/GSI installation Directory
587 AC_MSG_CHECKING(for Globus installation)
588 globus_dev_dir=$gsi_path
589 if test "x$globus_dev_dir" = "xyes" ; then
590 AC_MSG_ERROR(Cannot find Globus installation -- a path must be specified!)
592 AC_MSG_RESULT($globus_dev_dir)
594 # Find GLOBUS/GSI flavor Directory
596 AC_MSG_CHECKING(for Globus flavor)
597 if test "x$globus_flavor_type" = "xno" ; then
598 AC_MSG_ERROR(No Globus flavor type specified)
599 elif test "x$globus_flavor_type" = "xyes" ; then
600 AC_MSG_ERROR(No Globus flavor type specified)
602 AC_DEFINE(HAVE_GSSAPI_EXT)
603 GLOBUS_FLAVOR_TYPE_INCL_DIR="${globus_dev_dir}/include/${globus_flavor_type}"
604 if test ! -d "$GLOBUS_FLAVOR_TYPE_INCL_DIR" ; then
605 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_FLAVOR_TYPE_INCL_DIR})
607 GSI_CPPFLAGS="-I${GLOBUS_FLAVOR_TYPE_INCL_DIR}"
609 AC_MSG_RESULT($globus_flavor_type)
611 # Build possible libraries off of the flavor name
613 libglobus_gss_assist="${gsi_path}/lib/libglobus_gss_assist_${globus_flavor_type}.a"
614 libglobus_gssapi_gsi="${gsi_path}/lib/libglobus_gssapi_gsi_${globus_flavor_type}.a"
616 # Test that the base gss_assist library is present
618 if test -r ${libglobus_gss_assist} ; then
619 LIBS="$LIBS ${libglobus_gss_assist}"
621 AC_MSG_ERROR([*** libglobus_gss_assist missing])
624 AC_MSG_CHECKING(for libglobus_gss_assist)
632 AC_MSG_ERROR([*** libglobus_gss_assist missing])
636 # If we aren't using mechglue, test that gssapi_gsi is present
637 if test "$GSSAPI" != "mechglue"; then
638 if test -r ${libglobus_gssapi_gsi} ; then
639 LIBS="$LIBS ${libglobus_gssapi_gsi}"
641 AC_MSG_ERROR([*** libglobus_gssapi_gsi missing])
645 AC_MSG_CHECKING(for libglobus_gssapi_gsi)
653 AC_MSG_ERROR([*** libglobus_gssapi_gsi missing])
657 CPPFLAGS="$CPPFLAGS $GSI_CPPFLAGS"
659 # End Globus/GSI section
661 # Check whether user wants S/Key support
664 [ --with-skey[[=PATH]] Enable S/Key support
665 (optionally in PATH)],
667 if test "x$withval" != "xno" ; then
669 if test "x$withval" != "xyes" ; then
670 CPPFLAGS="$CPPFLAGS -I${withval}/include"
671 LDFLAGS="$LDFLAGS -L${withval}/lib"
678 AC_MSG_CHECKING([for s/key support])
683 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
685 [AC_MSG_RESULT(yes)],
688 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
694 # Check whether user wants TCP wrappers support
696 AC_ARG_WITH(tcp-wrappers,
697 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
698 (optionally in PATH)],
700 if test "x$withval" != "xno" ; then
702 saved_LDFLAGS="$LDFLAGS"
703 saved_CPPFLAGS="$CPPFLAGS"
704 if test -n "${withval}" -a "${withval}" != "yes"; then
705 if test -d "${withval}/lib"; then
706 if test -n "${need_dash_r}"; then
707 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
709 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
712 if test -n "${need_dash_r}"; then
713 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
715 LDFLAGS="-L${withval} ${LDFLAGS}"
718 if test -d "${withval}/include"; then
719 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
721 CPPFLAGS="-I${withval} ${CPPFLAGS}"
725 LIBS="$LIBWRAP $LIBS"
726 AC_MSG_CHECKING(for libwrap)
730 int deny_severity = 0, allow_severity = 0;
740 AC_MSG_ERROR([*** libwrap missing])
748 dnl Checks for library functions.
749 AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
750 clock fchmod fchown freeaddrinfo futimes gai_strerror \
751 getaddrinfo getcwd getgrouplist getnameinfo getopt getpeereid\
752 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
753 inet_ntop innetgr login_getcapbool md5_crypt memmove \
754 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
755 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
756 setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
757 setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \
758 socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \
759 truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
761 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
762 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
763 AC_CHECK_LIB(gen, dirname,[
764 AC_CACHE_CHECK([for broken dirname],
765 ac_cv_have_broken_dirname, [
773 int main(int argc, char **argv) {
776 strncpy(buf,"/etc", 32);
778 if (!s || strncmp(s, "/", 32) != 0) {
785 [ ac_cv_have_broken_dirname="no" ],
786 [ ac_cv_have_broken_dirname="yes" ]
790 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
792 AC_DEFINE(HAVE_DIRNAME)
793 AC_CHECK_HEADERS(libgen.h)
798 dnl Checks for time functions
799 AC_CHECK_FUNCS(gettimeofday time)
800 dnl Checks for utmp functions
801 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
802 AC_CHECK_FUNCS(utmpname)
803 dnl Checks for utmpx functions
804 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
805 AC_CHECK_FUNCS(setutxent utmpxname)
807 AC_CHECK_FUNC(daemon,
808 [AC_DEFINE(HAVE_DAEMON)],
809 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
812 AC_CHECK_FUNC(getpagesize,
813 [AC_DEFINE(HAVE_GETPAGESIZE)],
814 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
817 # Check for broken snprintf
818 if test "x$ac_cv_func_snprintf" = "xyes" ; then
819 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
823 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
825 [AC_MSG_RESULT(yes)],
828 AC_DEFINE(BROKEN_SNPRINTF)
829 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
839 [ --with-pam Enable PAM support ],
841 if test "x$withval" != "xno" ; then
842 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
843 AC_MSG_ERROR([PAM headers not found])
846 AC_CHECK_LIB(dl, dlopen, , )
847 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
848 AC_CHECK_FUNCS(pam_getenvlist)
849 AC_CHECK_FUNCS(pam_putenv)
855 if test $ac_cv_lib_dl_dlopen = yes; then
866 # Check for older PAM
867 if test "x$PAM_MSG" = "xyes" ; then
868 # Check PAM strerror arguments (old PAM)
869 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
873 #include <security/pam_appl.h>
875 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
878 AC_DEFINE(HAVE_OLD_PAM)
880 PAM_MSG="yes (old library)"
885 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
886 # because the system crypt() is more featureful.
887 if test "x$check_for_libcrypt_before" = "x1"; then
888 AC_CHECK_LIB(crypt, crypt)
892 saved_CPPFLAGS="$CPPFLAGS"
893 saved_LDFLAGS="$LDFLAGS"
895 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
897 if test "x$withval" != "xno" ; then
898 if test -d "$withval/lib"; then
899 if test -n "${need_dash_r}"; then
900 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
902 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
905 if test -n "${need_dash_r}"; then
906 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
908 LDFLAGS="-L${withval} ${LDFLAGS}"
911 if test -d "$withval/include"; then
912 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
914 CPPFLAGS="-I${withval} ${CPPFLAGS}"
920 # Patch up SSL libraries for GSI authentication as needed
921 if test "x$globus_flavor_type" != "xno" ; then
923 # For Globus 2, always link with the static libraries
926 libssl_utils="${gsi_path}/lib/libglobus_ssl_utils_${globus_flavor_type}.a"
929 # Trouble arrives at GT 2.1.3+ with the reorg of globus_ssl_utils. Compensating for
930 # the new library linking required here through file tests to see which libraries to
934 libgsi_proxy_core="${gsi_path}/lib/libglobus_gsi_proxy_core_${globus_flavor_type}.a"
935 libgsi_credential="${gsi_path}/lib/libglobus_gsi_credential_${globus_flavor_type}.a"
936 libgsi_callback="${gsi_path}/lib/libglobus_gsi_callback_${globus_flavor_type}.a"
937 liboldgaa="${gsi_path}/lib/libglobus_oldgaa_${globus_flavor_type}.a"
938 libgsi_sysconfig="${gsi_path}/lib/libglobus_gsi_sysconfig_${globus_flavor_type}.a"
939 libproxy_ssl="${gsi_path}/lib/libglobus_proxy_ssl_${globus_flavor_type}.a"
940 libgsi_cert_utils="${gsi_path}/lib/libglobus_gsi_cert_utils_${globus_flavor_type}.a"
941 libopenssl_error="${gsi_path}/lib/libglobus_openssl_error_${globus_flavor_type}.a"
942 libopenssl="${gsi_path}/lib/libglobus_openssl_${globus_flavor_type}.a"
944 if test -r ${libgsi_proxy_core} \
945 -a -r ${libgsi_credential} \
946 -a -r ${libgsi_callback} \
948 -a -r ${libgsi_sysconfig} \
949 -a -r ${libproxy_ssl} \
950 -a -r ${libgsi_cert_utils} \
951 -a -r ${libopenssl_error} \
952 -a -r ${libopenssl} ; then
953 LIBS="$LIBS ${libgsi_proxy_core}"
954 LIBS="$LIBS ${libgsi_credential}"
955 LIBS="$LIBS ${libgsi_callback}"
956 LIBS="$LIBS ${liboldgaa}"
957 LIBS="$LIBS ${libgsi_sysconfig}"
958 LIBS="$LIBS ${libproxy_ssl}"
959 LIBS="$LIBS ${libgsi_cert_utils}"
960 LIBS="$LIBS ${libopenssl_error}"
961 LIBS="$LIBS ${libopenssl}"
962 elif test -r ${libssl_utils}; then
963 LIBS="$LIBS ${libssl_utils}"
965 AC_MSG_ERROR([*** missing one or more Globus GSI libraries])
968 AC_MSG_CHECKING(for Globus GSI libraries)
976 AC_MSG_ERROR([*** missing one or more Globus GSI libraries])
981 # Standard openssl libraries. They need to appear near the end of the link line.
984 LIBS="$LIBS ${gsi_path}/lib/libssl_${globus_flavor_type}.a"
985 LIBS="$LIBS ${gsi_path}/lib/libcrypto_${globus_flavor_type}.a"
987 AC_MSG_CHECKING(for Globus OpenSSL libraries)
995 AC_MSG_ERROR([*** missing one or more Globus OpenSSL libraries])
1000 # Another "GT 2.1.3+"ism.
1003 libcommon_path="${gsi_path}/lib/libglobus_common_${globus_flavor_type}.a"
1004 if test -r ${libcommon_path}; then
1005 LIBS="$LIBS ${libcommon_path}"
1006 AC_MSG_CHECKING(for libglobus_common)
1014 AC_MSG_ERROR([*** libglobus_common missing])
1019 if test "x$gsi_path" != "xno" ; then
1020 # Older GSI needs -lssl too
1021 LIBS="$LIBS -lssl -lcrypto"
1022 else # if no GSI authentication (i.e., OpenSSL default)
1023 LIBS="$LIBS -lcrypto"
1025 fi # globus_flavor_type
1027 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1029 dnl Check default openssl install dir
1030 if test -n "${need_dash_r}"; then
1031 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1033 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1035 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1036 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1038 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1044 # Determine OpenSSL header version
1045 AC_MSG_CHECKING([OpenSSL header version])
1050 #include <openssl/opensslv.h>
1051 #define DATA "conftest.sslincver"
1056 fd = fopen(DATA,"w");
1060 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1067 ssl_header_ver=`cat conftest.sslincver`
1068 AC_MSG_RESULT($ssl_header_ver)
1071 AC_MSG_RESULT(not found)
1072 AC_MSG_ERROR(OpenSSL version header not found.)
1076 # Determine OpenSSL library version
1077 AC_MSG_CHECKING([OpenSSL library version])
1082 #include <openssl/opensslv.h>
1083 #include <openssl/crypto.h>
1084 #define DATA "conftest.ssllibver"
1089 fd = fopen(DATA,"w");
1093 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1100 ssl_library_ver=`cat conftest.ssllibver`
1101 AC_MSG_RESULT($ssl_library_ver)
1104 AC_MSG_RESULT(not found)
1105 AC_MSG_ERROR(OpenSSL library not found.)
1109 # Sanity check OpenSSL headers
1110 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1114 #include <openssl/opensslv.h>
1115 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1122 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
1126 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1127 # version in OpenSSL. Skip this for PAM
1128 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
1129 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1133 ### Configure cryptographic random number support
1135 # Check wheter OpenSSL seeds itself
1136 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1140 #include <openssl/rand.h>
1141 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1144 OPENSSL_SEEDS_ITSELF=yes
1149 # Default to use of the rand helper if OpenSSL doesn't
1156 # Do we want to force the use of the rand helper?
1157 AC_ARG_WITH(rand-helper,
1158 [ --with-rand-helper Use subprocess to gather strong randomness ],
1160 if test "x$withval" = "xno" ; then
1161 # Force use of OpenSSL's internal RNG, even if
1162 # the previous test showed it to be unseeded.
1163 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1164 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1165 OPENSSL_SEEDS_ITSELF=yes
1174 # Which randomness source do we use?
1175 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1177 AC_DEFINE(OPENSSL_PRNG_ONLY)
1178 RAND_MSG="OpenSSL internal ONLY"
1179 INSTALL_SSH_RAND_HELPER=""
1180 elif test ! -z "$USE_RAND_HELPER" ; then
1181 # install rand helper
1182 RAND_MSG="ssh-rand-helper"
1183 INSTALL_SSH_RAND_HELPER="yes"
1185 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1187 ### Configuration of ssh-rand-helper
1190 AC_ARG_WITH(prngd-port,
1191 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1200 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1203 if test ! -z "$withval" ; then
1204 PRNGD_PORT="$withval"
1205 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1210 # PRNGD Unix domain socket
1211 AC_ARG_WITH(prngd-socket,
1212 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1216 withval="/var/run/egd-pool"
1224 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1228 if test ! -z "$withval" ; then
1229 if test ! -z "$PRNGD_PORT" ; then
1230 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1232 if test ! -r "$withval" ; then
1233 AC_MSG_WARN(Entropy socket is not readable)
1235 PRNGD_SOCKET="$withval"
1236 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1240 # Check for existing socket only if we don't have a random device already
1241 if test "$USE_RAND_HELPER" = yes ; then
1242 AC_MSG_CHECKING(for PRNGD/EGD socket)
1243 # Insert other locations here
1244 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1245 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1246 PRNGD_SOCKET="$sock"
1247 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1251 if test ! -z "$PRNGD_SOCKET" ; then
1252 AC_MSG_RESULT($PRNGD_SOCKET)
1254 AC_MSG_RESULT(not found)
1260 # Change default command timeout for hashing entropy source
1262 AC_ARG_WITH(entropy-timeout,
1263 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1265 if test "x$withval" != "xno" ; then
1266 entropy_timeout=$withval
1270 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1272 SSH_PRIVSEP_USER=sshd
1273 AC_ARG_WITH(privsep-user,
1274 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1276 if test -n "$withval"; then
1277 SSH_PRIVSEP_USER=$withval
1281 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1282 AC_SUBST(SSH_PRIVSEP_USER)
1284 # We do this little dance with the search path to insure
1285 # that programs that we select for use by installed programs
1286 # (which may be run by the super-user) come from trusted
1287 # locations before they come from the user's private area.
1288 # This should help avoid accidentally configuring some
1289 # random version of a program in someone's personal bin.
1293 test -h /bin 2> /dev/null && PATH=/usr/bin
1294 test -d /sbin && PATH=$PATH:/sbin
1295 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1296 PATH=$PATH:/etc:$OPATH
1298 # These programs are used by the command hashing source to gather entropy
1299 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1300 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1301 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1302 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1303 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1304 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1305 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1306 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1307 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1308 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1309 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1310 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1311 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1312 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1313 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1314 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1318 # Where does ssh-rand-helper get its randomness from?
1319 INSTALL_SSH_PRNG_CMDS=""
1320 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1321 if test ! -z "$PRNGD_PORT" ; then
1322 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1323 elif test ! -z "$PRNGD_SOCKET" ; then
1324 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1326 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1327 RAND_HELPER_CMDHASH=yes
1328 INSTALL_SSH_PRNG_CMDS="yes"
1331 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1334 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1335 if test ! -z "$SONY" ; then
1336 LIBS="$LIBS -liberty";
1339 # Checks for data types
1340 AC_CHECK_SIZEOF(char, 1)
1341 AC_CHECK_SIZEOF(short int, 2)
1342 AC_CHECK_SIZEOF(int, 4)
1343 AC_CHECK_SIZEOF(long int, 4)
1344 AC_CHECK_SIZEOF(long long int, 8)
1346 # Sanity check long long for some platforms (AIX)
1347 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1348 ac_cv_sizeof_long_long_int=0
1351 # More checks for data types
1352 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1354 [ #include <sys/types.h> ],
1356 [ ac_cv_have_u_int="yes" ],
1357 [ ac_cv_have_u_int="no" ]
1360 if test "x$ac_cv_have_u_int" = "xyes" ; then
1361 AC_DEFINE(HAVE_U_INT)
1365 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1367 [ #include <sys/types.h> ],
1368 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1369 [ ac_cv_have_intxx_t="yes" ],
1370 [ ac_cv_have_intxx_t="no" ]
1373 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1374 AC_DEFINE(HAVE_INTXX_T)
1378 if (test -z "$have_intxx_t" && \
1379 test "x$ac_cv_header_stdint_h" = "xyes")
1381 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1383 [ #include <stdint.h> ],
1384 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1386 AC_DEFINE(HAVE_INTXX_T)
1389 [ AC_MSG_RESULT(no) ]
1393 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1396 #include <sys/types.h>
1397 #ifdef HAVE_STDINT_H
1398 # include <stdint.h>
1400 #include <sys/socket.h>
1401 #ifdef HAVE_SYS_BITYPES_H
1402 # include <sys/bitypes.h>
1405 [ int64_t a; a = 1;],
1406 [ ac_cv_have_int64_t="yes" ],
1407 [ ac_cv_have_int64_t="no" ]
1410 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1411 AC_DEFINE(HAVE_INT64_T)
1414 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1416 [ #include <sys/types.h> ],
1417 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1418 [ ac_cv_have_u_intxx_t="yes" ],
1419 [ ac_cv_have_u_intxx_t="no" ]
1422 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1423 AC_DEFINE(HAVE_U_INTXX_T)
1427 if test -z "$have_u_intxx_t" ; then
1428 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1430 [ #include <sys/socket.h> ],
1431 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1433 AC_DEFINE(HAVE_U_INTXX_T)
1436 [ AC_MSG_RESULT(no) ]
1440 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1442 [ #include <sys/types.h> ],
1443 [ u_int64_t a; a = 1;],
1444 [ ac_cv_have_u_int64_t="yes" ],
1445 [ ac_cv_have_u_int64_t="no" ]
1448 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1449 AC_DEFINE(HAVE_U_INT64_T)
1453 if test -z "$have_u_int64_t" ; then
1454 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1456 [ #include <sys/bitypes.h> ],
1457 [ u_int64_t a; a = 1],
1459 AC_DEFINE(HAVE_U_INT64_T)
1462 [ AC_MSG_RESULT(no) ]
1466 if test -z "$have_u_intxx_t" ; then
1467 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1470 #include <sys/types.h>
1472 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1473 [ ac_cv_have_uintxx_t="yes" ],
1474 [ ac_cv_have_uintxx_t="no" ]
1477 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1478 AC_DEFINE(HAVE_UINTXX_T)
1482 if test -z "$have_uintxx_t" ; then
1483 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1485 [ #include <stdint.h> ],
1486 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1488 AC_DEFINE(HAVE_UINTXX_T)
1491 [ AC_MSG_RESULT(no) ]
1495 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1496 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1498 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1501 #include <sys/bitypes.h>
1504 int8_t a; int16_t b; int32_t c;
1505 u_int8_t e; u_int16_t f; u_int32_t g;
1506 a = b = c = e = f = g = 1;
1509 AC_DEFINE(HAVE_U_INTXX_T)
1510 AC_DEFINE(HAVE_INTXX_T)
1518 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1521 #include <sys/types.h>
1523 [ u_char foo; foo = 125; ],
1524 [ ac_cv_have_u_char="yes" ],
1525 [ ac_cv_have_u_char="no" ]
1528 if test "x$ac_cv_have_u_char" = "xyes" ; then
1529 AC_DEFINE(HAVE_U_CHAR)
1534 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1536 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1539 #include <sys/types.h>
1541 [ size_t foo; foo = 1235; ],
1542 [ ac_cv_have_size_t="yes" ],
1543 [ ac_cv_have_size_t="no" ]
1546 if test "x$ac_cv_have_size_t" = "xyes" ; then
1547 AC_DEFINE(HAVE_SIZE_T)
1550 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1553 #include <sys/types.h>
1555 [ ssize_t foo; foo = 1235; ],
1556 [ ac_cv_have_ssize_t="yes" ],
1557 [ ac_cv_have_ssize_t="no" ]
1560 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1561 AC_DEFINE(HAVE_SSIZE_T)
1564 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1569 [ clock_t foo; foo = 1235; ],
1570 [ ac_cv_have_clock_t="yes" ],
1571 [ ac_cv_have_clock_t="no" ]
1574 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1575 AC_DEFINE(HAVE_CLOCK_T)
1578 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1581 #include <sys/types.h>
1582 #include <sys/socket.h>
1584 [ sa_family_t foo; foo = 1235; ],
1585 [ ac_cv_have_sa_family_t="yes" ],
1588 #include <sys/types.h>
1589 #include <sys/socket.h>
1590 #include <netinet/in.h>
1592 [ sa_family_t foo; foo = 1235; ],
1593 [ ac_cv_have_sa_family_t="yes" ],
1595 [ ac_cv_have_sa_family_t="no" ]
1599 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1600 AC_DEFINE(HAVE_SA_FAMILY_T)
1603 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1606 #include <sys/types.h>
1608 [ pid_t foo; foo = 1235; ],
1609 [ ac_cv_have_pid_t="yes" ],
1610 [ ac_cv_have_pid_t="no" ]
1613 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1614 AC_DEFINE(HAVE_PID_T)
1617 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1620 #include <sys/types.h>
1622 [ mode_t foo; foo = 1235; ],
1623 [ ac_cv_have_mode_t="yes" ],
1624 [ ac_cv_have_mode_t="no" ]
1627 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1628 AC_DEFINE(HAVE_MODE_T)
1632 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1635 #include <sys/types.h>
1636 #include <sys/socket.h>
1638 [ struct sockaddr_storage s; ],
1639 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1640 [ ac_cv_have_struct_sockaddr_storage="no" ]
1643 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1644 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1647 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1650 #include <sys/types.h>
1651 #include <netinet/in.h>
1653 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1654 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1655 [ ac_cv_have_struct_sockaddr_in6="no" ]
1658 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1659 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1662 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1665 #include <sys/types.h>
1666 #include <netinet/in.h>
1668 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1669 [ ac_cv_have_struct_in6_addr="yes" ],
1670 [ ac_cv_have_struct_in6_addr="no" ]
1673 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1674 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1677 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1680 #include <sys/types.h>
1681 #include <sys/socket.h>
1684 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1685 [ ac_cv_have_struct_addrinfo="yes" ],
1686 [ ac_cv_have_struct_addrinfo="no" ]
1689 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1690 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1693 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1695 [ #include <sys/time.h> ],
1696 [ struct timeval tv; tv.tv_sec = 1;],
1697 [ ac_cv_have_struct_timeval="yes" ],
1698 [ ac_cv_have_struct_timeval="no" ]
1701 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1702 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1703 have_struct_timeval=1
1706 # If we don't have int64_t then we can't compile sftp-server. So don't
1707 # even attempt to do it.
1708 if test "x$ac_cv_have_int64_t" = "xno" -a \
1709 "x$ac_cv_sizeof_long_int" != "x8" -a \
1710 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1713 dnl test snprintf (broken on SCO w/gcc)
1718 #ifdef HAVE_SNPRINTF
1722 char expected_out[50];
1724 #if (SIZEOF_LONG_INT == 8)
1725 long int num = 0x7fffffffffffffff;
1727 long long num = 0x7fffffffffffffffll;
1729 strcpy(expected_out, "9223372036854775807");
1730 snprintf(buf, mazsize, "%lld", num);
1731 if(strcmp(buf, expected_out) != 0)
1738 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1743 dnl Checks for structure members
1744 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1745 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1746 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1747 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1748 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1749 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1750 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1751 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1752 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1753 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1754 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1755 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1756 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1757 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1758 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1759 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1760 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1762 AC_CHECK_MEMBERS([struct stat.st_blksize])
1764 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1765 ac_cv_have_ss_family_in_struct_ss, [
1768 #include <sys/types.h>
1769 #include <sys/socket.h>
1771 [ struct sockaddr_storage s; s.ss_family = 1; ],
1772 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1773 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1776 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1777 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1780 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1781 ac_cv_have___ss_family_in_struct_ss, [
1784 #include <sys/types.h>
1785 #include <sys/socket.h>
1787 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1788 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1789 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1792 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1793 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1796 AC_CACHE_CHECK([for pw_class field in struct passwd],
1797 ac_cv_have_pw_class_in_struct_passwd, [
1802 [ struct passwd p; p.pw_class = 0; ],
1803 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1804 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1807 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1808 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1811 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1812 ac_cv_have_pw_expire_in_struct_passwd, [
1817 [ struct passwd p; p.pw_expire = 0; ],
1818 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1819 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1822 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1823 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1826 AC_CACHE_CHECK([for pw_change field in struct passwd],
1827 ac_cv_have_pw_change_in_struct_passwd, [
1832 [ struct passwd p; p.pw_change = 0; ],
1833 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1834 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1837 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1838 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1841 dnl make sure we're using the real structure members and not defines
1842 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1843 ac_cv_have_accrights_in_msghdr, [
1846 #include <sys/types.h>
1847 #include <sys/socket.h>
1848 #include <sys/uio.h>
1850 #ifdef msg_accrights
1854 m.msg_accrights = 0;
1858 [ ac_cv_have_accrights_in_msghdr="yes" ],
1859 [ ac_cv_have_accrights_in_msghdr="no" ]
1862 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1863 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1866 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1867 ac_cv_have_control_in_msghdr, [
1870 #include <sys/types.h>
1871 #include <sys/socket.h>
1872 #include <sys/uio.h>
1882 [ ac_cv_have_control_in_msghdr="yes" ],
1883 [ ac_cv_have_control_in_msghdr="no" ]
1886 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1887 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1890 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1892 [ extern char *__progname; printf("%s", __progname); ],
1893 [ ac_cv_libc_defines___progname="yes" ],
1894 [ ac_cv_libc_defines___progname="no" ]
1897 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1898 AC_DEFINE(HAVE___PROGNAME)
1901 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1905 [ printf("%s", __FUNCTION__); ],
1906 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1907 [ ac_cv_cc_implements___FUNCTION__="no" ]
1910 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1911 AC_DEFINE(HAVE___FUNCTION__)
1914 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1918 [ printf("%s", __func__); ],
1919 [ ac_cv_cc_implements___func__="yes" ],
1920 [ ac_cv_cc_implements___func__="no" ]
1923 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1924 AC_DEFINE(HAVE___func__)
1927 AC_CACHE_CHECK([whether getopt has optreset support],
1928 ac_cv_have_getopt_optreset, [
1933 [ extern int optreset; optreset = 0; ],
1934 [ ac_cv_have_getopt_optreset="yes" ],
1935 [ ac_cv_have_getopt_optreset="no" ]
1938 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1939 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1942 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1944 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1945 [ ac_cv_libc_defines_sys_errlist="yes" ],
1946 [ ac_cv_libc_defines_sys_errlist="no" ]
1949 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1950 AC_DEFINE(HAVE_SYS_ERRLIST)
1954 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1956 [ extern int sys_nerr; printf("%i", sys_nerr);],
1957 [ ac_cv_libc_defines_sys_nerr="yes" ],
1958 [ ac_cv_libc_defines_sys_nerr="no" ]
1961 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1962 AC_DEFINE(HAVE_SYS_NERR)
1967 # Check whether user wants sectok support
1969 [ --with-sectok Enable smartcard support using libsectok],
1971 if test "x$withval" != "xno" ; then
1972 if test "x$withval" != "xyes" ; then
1973 CPPFLAGS="$CPPFLAGS -I${withval}"
1974 LDFLAGS="$LDFLAGS -L${withval}"
1975 if test ! -z "$need_dash_r" ; then
1976 LDFLAGS="$LDFLAGS -R${withval}"
1978 if test ! -z "$blibpath" ; then
1979 blibpath="$blibpath:${withval}"
1982 AC_CHECK_HEADERS(sectok.h)
1983 if test "$ac_cv_header_sectok_h" != yes; then
1984 AC_MSG_ERROR(Can't find sectok.h)
1986 AC_CHECK_LIB(sectok, sectok_open)
1987 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1988 AC_MSG_ERROR(Can't find libsectok)
1990 AC_DEFINE(SMARTCARD)
1991 AC_DEFINE(USE_SECTOK)
1992 SCARD_MSG="yes, using sectok"
1997 # Check whether user wants OpenSC support
1999 AC_HELP_STRING([--with-opensc=PFX],
2000 [Enable smartcard support using OpenSC]),
2001 opensc_config_prefix="$withval", opensc_config_prefix="")
2002 if test x$opensc_config_prefix != x ; then
2003 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2004 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2005 if test "$OPENSC_CONFIG" != "no"; then
2006 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2007 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2008 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2009 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2010 AC_DEFINE(SMARTCARD)
2011 AC_DEFINE(USE_OPENSC)
2012 SCARD_MSG="yes, using OpenSC"
2016 # Check whether user wants Kerberos 5 support
2018 AC_ARG_WITH(kerberos5,
2019 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2021 if test "x$withval" != "xno" ; then
2022 if test "x$withval" = "xyes" ; then
2023 KRB5ROOT="/usr/local"
2027 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2028 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2031 AC_MSG_CHECKING(whether we are using Heimdal)
2032 AC_TRY_COMPILE([ #include <krb5.h> ],
2033 [ char *tmp = heimdal_version; ],
2034 [ AC_MSG_RESULT(yes)
2036 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2039 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2042 if test ! -z "$need_dash_r" ; then
2043 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2045 if test ! -z "$blibpath" ; then
2046 blibpath="$blibpath:${KRB5ROOT}/lib"
2048 AC_CHECK_LIB(resolv, dn_expand, , )
2050 # If we're using some other GSSAPI
2051 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
2052 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
2054 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2056 K5LIBS="-lgssapi $K5LIBS" ],
2057 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2059 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2060 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2065 AC_CHECK_HEADER(gssapi.h, ,
2066 [ unset ac_cv_header_gssapi_h
2067 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2068 AC_CHECK_HEADERS(gssapi.h, ,
2069 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2074 AC_CHECK_LIB(gssapi, gss_krb5_copy_ccache, /bin/true,
2075 [ K5LIBS="-lgssapi_krb5 $K5LIBS"
2076 AC_CHECK_LIB(gssapi_krb5, gss_krb5_copy_ccache, /bin/true,
2077 AC_MSG_WARN([Cannot find gss_krb5_copy_ccache -- build may fail]),
2083 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2084 AC_CHECK_HEADER(gssapi_krb5.h, ,
2085 [ CPPFLAGS="$oldCPP" ])
2087 if test -z "$GSSAPI"; then
2095 # Check whether user wants Kerberos 4 support
2097 AC_ARG_WITH(kerberos4,
2098 [ --with-kerberos4=PATH Enable Kerberos 4 support],
2100 if test "x$withval" != "xno" ; then
2101 if test "x$withval" != "xyes" ; then
2102 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2103 LDFLAGS="$LDFLAGS -L${withval}/lib"
2104 if test ! -z "$need_dash_r" ; then
2105 LDFLAGS="$LDFLAGS -R${withval}/lib"
2107 if test ! -z "$blibpath" ; then
2108 blibpath="$blibpath:${withval}/lib"
2111 if test -d /usr/include/kerberosIV ; then
2112 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
2116 AC_CHECK_HEADERS(krb.h)
2117 if test "$ac_cv_header_krb_h" != yes; then
2118 AC_MSG_WARN([Cannot find krb.h, build may fail])
2120 AC_CHECK_LIB(krb, main)
2121 if test "$ac_cv_lib_krb_main" != yes; then
2122 AC_CHECK_LIB(krb4, main)
2123 if test "$ac_cv_lib_krb4_main" != yes; then
2124 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
2131 AC_CHECK_LIB(des, des_cbc_encrypt)
2132 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
2133 AC_CHECK_LIB(des425, des_cbc_encrypt)
2134 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
2135 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
2142 AC_CHECK_LIB(resolv, dn_expand, , )
2150 # Check whether user wants AFS_KRB5 support
2152 AC_ARG_WITH(afs-krb5,
2153 [ --with-afs-krb5[[=AKLOG_PATH]] Enable aklog to get token (default=/usr/bin/aklog).],
2155 if test "x$withval" != "xno" ; then
2157 if test "x$withval" != "xyes" ; then
2158 AC_DEFINE_UNQUOTED(AKLOG_PATH, "$withval")
2160 AC_DEFINE_UNQUOTED(AKLOG_PATH, "/usr/bin/aklog")
2163 if test -z "$KRB5" ; then
2164 AC_MSG_WARN([AFS_KRB5 requires Kerberos 5 support, build may fail])
2167 LIBS="-lkrbafs $LIBS"
2168 if test ! -z "$AFS_LIBS" ; then
2169 LIBS="$LIBS $AFS_LIBS"
2177 # Check whether user wants AFS support
2180 [ --with-afs=PATH Enable AFS support],
2182 if test "x$withval" != "xno" ; then
2184 if test "x$withval" != "xyes" ; then
2185 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2186 LDFLAGS="$LDFLAGS -L${withval}/lib"
2189 if test -z "$KRB4" ; then
2190 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
2194 if test ! -z "$AFS_LIBS" ; then
2195 LIBS="$LIBS $AFS_LIBS"
2202 LIBS="$LIBS $KLIBS $K5LIBS"
2204 # Looking for programs, paths and files
2206 PRIVSEP_PATH=/var/empty
2207 AC_ARG_WITH(privsep-path,
2208 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2210 if test "x$withval" != "$no" ; then
2211 PRIVSEP_PATH=$withval
2215 AC_SUBST(PRIVSEP_PATH)
2218 [ --with-xauth=PATH Specify path to xauth program ],
2220 if test "x$withval" != "xno" ; then
2226 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2227 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2228 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2229 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2230 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2231 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2232 xauth_path="/usr/openwin/bin/xauth"
2237 if test -z "$xauth_path" ; then
2238 XAUTH_PATH="undefined"
2239 AC_SUBST(XAUTH_PATH)
2241 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2242 XAUTH_PATH=$xauth_path
2243 AC_SUBST(XAUTH_PATH)
2246 # Check for mail directory (last resort if we cannot get it from headers)
2247 if test ! -z "$MAIL" ; then
2248 maildir=`dirname $MAIL`
2249 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2252 if test -z "$no_dev_ptmx" ; then
2253 if test "x$disable_ptmx_check" != "xyes" ; then
2254 AC_CHECK_FILE("/dev/ptmx",
2256 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2262 AC_CHECK_FILE("/dev/ptc",
2264 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2269 # Options from here on. Some of these are preset by platform above
2270 AC_ARG_WITH(mantype,
2271 [ --with-mantype=man|cat|doc Set man page type],
2278 AC_MSG_ERROR(invalid man type: $withval)
2283 if test -z "$MANTYPE"; then
2284 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2285 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2286 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2288 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2295 if test "$MANTYPE" = "doc"; then
2302 # Check whether to enable MD5 passwords
2304 AC_ARG_WITH(md5-passwords,
2305 [ --with-md5-passwords Enable use of MD5 passwords],
2307 if test "x$withval" != "xno" ; then
2308 AC_DEFINE(HAVE_MD5_PASSWORDS)
2314 # Whether to disable shadow password support
2316 [ --without-shadow Disable shadow password support],
2318 if test "x$withval" = "xno" ; then
2319 AC_DEFINE(DISABLE_SHADOW)
2325 if test -z "$disable_shadow" ; then
2326 AC_MSG_CHECKING([if the systems has expire shadow information])
2329 #include <sys/types.h>
2332 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2333 [ sp_expire_available=yes ], []
2336 if test "x$sp_expire_available" = "xyes" ; then
2338 AC_DEFINE(HAS_SHADOW_EXPIRE)
2344 # Use ip address instead of hostname in $DISPLAY
2345 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2346 DISPLAY_HACK_MSG="yes"
2347 AC_DEFINE(IPADDR_IN_DISPLAY)
2349 DISPLAY_HACK_MSG="no"
2350 AC_ARG_WITH(ipaddr-display,
2351 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2353 if test "x$withval" != "xno" ; then
2354 AC_DEFINE(IPADDR_IN_DISPLAY)
2355 DISPLAY_HACK_MSG="yes"
2361 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2362 if test $ac_cv_func_login_getcapbool = "yes" -a \
2363 $ac_cv_header_login_cap_h = "yes" ; then
2366 # Whether to mess with the default path
2367 SERVER_PATH_MSG="(default)"
2368 AC_ARG_WITH(default-path,
2369 [ --with-default-path= Specify default \$PATH environment for server],
2371 if test "$USES_LOGIN_CONF" = "yes" ; then
2373 --with-default-path=PATH has no effect on this system.
2374 Edit /etc/login.conf instead.])
2375 elif test "x$withval" != "xno" ; then
2376 user_path="$withval"
2377 SERVER_PATH_MSG="$withval"
2380 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2381 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2385 /* find out what STDPATH is */
2390 #ifndef _PATH_STDPATH
2391 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2393 #include <sys/types.h>
2394 #include <sys/stat.h>
2396 #define DATA "conftest.stdpath"
2403 fd = fopen(DATA,"w");
2407 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2412 ], [ user_path=`cat conftest.stdpath` ],
2413 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2414 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2418 if test "$USES_LOGIN_CONF" != "yes" ; then
2419 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2423 # Set superuser path separately to user path
2424 AC_ARG_WITH(superuser-path,
2425 [ --with-superuser-path= Specify different path for super-user],
2427 if test "x$withval" != "xno" ; then
2428 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2429 superuser_path=$withval
2435 # Whether to force IPv4 by default (needed on broken glibc Linux)
2437 AC_ARG_WITH(ipv4-default,
2438 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2440 if test "x$withval" != "xno" ; then
2441 AC_DEFINE(IPV4_DEFAULT)
2447 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2448 IPV4_IN6_HACK_MSG="no"
2450 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2452 if test "x$withval" != "xno" ; then
2454 AC_DEFINE(IPV4_IN_IPV6)
2455 IPV4_IN6_HACK_MSG="yes"
2460 if test "x$inet6_default_4in6" = "xyes"; then
2461 AC_MSG_RESULT([yes (default)])
2462 AC_DEFINE(IPV4_IN_IPV6)
2463 IPV4_IN6_HACK_MSG="yes"
2465 AC_MSG_RESULT([no (default)])
2470 # Whether to enable BSD auth support
2472 AC_ARG_WITH(bsd-auth,
2473 [ --with-bsd-auth Enable BSD auth support],
2475 if test "x$withval" != "xno" ; then
2482 # Where to place sshd.pid
2484 # make sure the directory exists
2485 if test ! -d $piddir ; then
2486 piddir=`eval echo ${sysconfdir}`
2488 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2492 AC_ARG_WITH(pid-dir,
2493 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2495 if test "x$withval" != "xno" ; then
2497 if test ! -d $piddir ; then
2498 AC_MSG_WARN([** no $piddir directory on this system **])
2504 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2507 dnl allow user to disable some login recording features
2508 AC_ARG_ENABLE(lastlog,
2509 [ --disable-lastlog disable use of lastlog even if detected [no]],
2510 [ AC_DEFINE(DISABLE_LASTLOG) ]
2513 [ --disable-utmp disable use of utmp even if detected [no]],
2514 [ AC_DEFINE(DISABLE_UTMP) ]
2516 AC_ARG_ENABLE(utmpx,
2517 [ --disable-utmpx disable use of utmpx even if detected [no]],
2518 [ AC_DEFINE(DISABLE_UTMPX) ]
2521 [ --disable-wtmp disable use of wtmp even if detected [no]],
2522 [ AC_DEFINE(DISABLE_WTMP) ]
2524 AC_ARG_ENABLE(wtmpx,
2525 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2526 [ AC_DEFINE(DISABLE_WTMPX) ]
2528 AC_ARG_ENABLE(libutil,
2529 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2530 [ AC_DEFINE(DISABLE_LOGIN) ]
2532 AC_ARG_ENABLE(pututline,
2533 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2534 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2536 AC_ARG_ENABLE(pututxline,
2537 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2538 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2540 AC_ARG_WITH(lastlog,
2541 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2543 if test "x$withval" = "xno" ; then
2544 AC_DEFINE(DISABLE_LASTLOG)
2546 conf_lastlog_location=$withval
2551 dnl lastlog, [uw]tmpx? detection
2552 dnl NOTE: set the paths in the platform section to avoid the
2553 dnl need for command-line parameters
2554 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2556 dnl lastlog detection
2557 dnl NOTE: the code itself will detect if lastlog is a directory
2558 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2560 #include <sys/types.h>
2562 #ifdef HAVE_LASTLOG_H
2563 # include <lastlog.h>
2572 [ char *lastlog = LASTLOG_FILE; ],
2573 [ AC_MSG_RESULT(yes) ],
2576 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2578 #include <sys/types.h>
2580 #ifdef HAVE_LASTLOG_H
2581 # include <lastlog.h>
2587 [ char *lastlog = _PATH_LASTLOG; ],
2588 [ AC_MSG_RESULT(yes) ],
2591 system_lastlog_path=no
2596 if test -z "$conf_lastlog_location"; then
2597 if test x"$system_lastlog_path" = x"no" ; then
2598 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2599 if (test -d "$f" || test -f "$f") ; then
2600 conf_lastlog_location=$f
2603 if test -z "$conf_lastlog_location"; then
2604 AC_MSG_WARN([** Cannot find lastlog **])
2605 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2610 if test -n "$conf_lastlog_location"; then
2611 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2615 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2617 #include <sys/types.h>
2623 [ char *utmp = UTMP_FILE; ],
2624 [ AC_MSG_RESULT(yes) ],
2626 system_utmp_path=no ]
2628 if test -z "$conf_utmp_location"; then
2629 if test x"$system_utmp_path" = x"no" ; then
2630 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2631 if test -f $f ; then
2632 conf_utmp_location=$f
2635 if test -z "$conf_utmp_location"; then
2636 AC_DEFINE(DISABLE_UTMP)
2640 if test -n "$conf_utmp_location"; then
2641 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2645 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2647 #include <sys/types.h>
2653 [ char *wtmp = WTMP_FILE; ],
2654 [ AC_MSG_RESULT(yes) ],
2656 system_wtmp_path=no ]
2658 if test -z "$conf_wtmp_location"; then
2659 if test x"$system_wtmp_path" = x"no" ; then
2660 for f in /usr/adm/wtmp /var/log/wtmp; do
2661 if test -f $f ; then
2662 conf_wtmp_location=$f
2665 if test -z "$conf_wtmp_location"; then
2666 AC_DEFINE(DISABLE_WTMP)
2670 if test -n "$conf_wtmp_location"; then
2671 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2675 dnl utmpx detection - I don't know any system so perverse as to require
2676 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2678 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2680 #include <sys/types.h>
2689 [ char *utmpx = UTMPX_FILE; ],
2690 [ AC_MSG_RESULT(yes) ],
2692 system_utmpx_path=no ]
2694 if test -z "$conf_utmpx_location"; then
2695 if test x"$system_utmpx_path" = x"no" ; then
2696 AC_DEFINE(DISABLE_UTMPX)
2699 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2703 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2705 #include <sys/types.h>
2714 [ char *wtmpx = WTMPX_FILE; ],
2715 [ AC_MSG_RESULT(yes) ],
2717 system_wtmpx_path=no ]
2719 if test -z "$conf_wtmpx_location"; then
2720 if test x"$system_wtmpx_path" = x"no" ; then
2721 AC_DEFINE(DISABLE_WTMPX)
2724 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2728 if test ! -z "$blibpath" ; then
2729 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2730 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2733 dnl remove pam and dl because they are in $LIBPAM
2734 if test "$PAM_MSG" = yes ; then
2735 LIBS=`echo $LIBS | sed 's/-lpam //'`
2737 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2738 LIBS=`echo $LIBS | sed 's/-ldl //'`
2742 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2745 # Print summary of options
2747 # Someone please show me a better way :)
2748 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2749 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2750 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2751 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2752 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2753 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2754 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2755 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2756 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2757 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2760 echo "OpenSSH has been configured with the following options:"
2761 echo " User binaries: $B"
2762 echo " System binaries: $C"
2763 echo " Configuration files: $D"
2764 echo " Askpass program: $E"
2765 echo " Manual pages: $F"
2766 echo " PID file: $G"
2767 echo " Privilege separation chroot path: $H"
2768 if test "$USES_LOGIN_CONF" = "yes" ; then
2769 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2771 echo " sshd default user PATH: $I"
2773 if test ! -z "$superuser_path" ; then
2774 echo " sshd superuser user PATH: $J"
2776 echo " Manpage format: $MANTYPE"
2777 echo " PAM support: ${PAM_MSG}"
2778 echo " KerberosIV support: $KRB4_MSG"
2779 echo " KerberosV support: $KRB5_MSG"
2780 echo " Smartcard support: $SCARD_MSG"
2781 echo " AFS support: $AFS_MSG"
2782 echo " S/KEY support: $SKEY_MSG"
2783 echo " TCP Wrappers support: $TCPW_MSG"
2784 echo " MD5 password support: $MD5_MSG"
2785 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2786 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2787 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2788 echo " BSD Auth support: $BSD_AUTH_MSG"
2789 echo " Random number source: $RAND_MSG"
2790 if test ! -z "$USE_RAND_HELPER" ; then
2791 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2796 echo " Host: ${host}"
2797 echo " Compiler: ${CC}"
2798 echo " Compiler flags: ${CFLAGS}"
2799 echo "Preprocessor flags: ${CPPFLAGS}"
2800 echo " Linker flags: ${LDFLAGS}"
2801 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2805 if test "x$PAM_MSG" = "xyes" ; then
2806 echo "PAM is enabled. You may need to install a PAM control file "
2807 echo "for sshd, otherwise password authentication may fail. "
2808 echo "Example PAM control files can be found in the contrib/ "
2813 if test ! -z "$NO_SFTP"; then
2814 echo "sftp-server will be disabled. Your compiler does not "
2815 echo "support 64bit integers."
2819 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2820 echo "WARNING: you are using the builtin random number collection "
2821 echo "service. Please read WARNING.RNG and request that your OS "
2822 echo "vendor includes kernel-based random number collection in "
2823 echo "future versions of your OS."