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
585 AC_MSG_CHECKING(for Globus/GSI installation directory)
587 globus_install_dir=$gsi_path
589 if test "x$globus_install_dir" = "xyes" ; then
590 AC_MSG_ERROR(Cannot find Globus/GSI installation directory -- a path must be specified!)
592 AC_MSG_RESULT($globus_install_dir)
594 # Find GLOBUS/GSI development directory
595 AC_MSG_CHECKING(for Globus/GSI development directory)
597 if test -d ${globus_install_dir}/lib ; then
598 # Looks like a flat directory structure from configure/make
599 # and not globus-install or gsi-install
600 globus_dev_dir=$globus_install_dir
603 # Assume a true globus installation with architecture
604 # directories and run globus-development-path to find
605 # the development directory
607 # Set GLOBUS_INSTALL_PATH
608 GLOBUS_INSTALL_PATH=$globus_install_dir
609 export GLOBUS_INSTALL_PATH
611 dev_path_program=${globus_install_dir}/bin/globus-development-path
613 if test ! -x ${dev_path_program} ; then
614 AC_MSG_ERROR(Cannot find Globus/GSI installation directory: program ${dev_path_program} does not exist or is not executable)
617 globus_dev_dir=`${dev_path_program}`
619 if test -z "$globus_dev_dir" -o "X$globus_dev_dir" = "X<not found>" ; then
620 AC_MSG_ERROR(Cannot find Globus/GSI development directory)
623 if test ! -d "$globus_dev_dir" ; then
624 AC_MSG_ERROR(Cannot find Globus/GSI development directory: $globus_dev_dir does not exist)
627 AC_MSG_RESULT($globus_dev_dir)
629 # Find GLOBUS/GSI flavor Directory
630 AC_MSG_CHECKING(for Globus flavor type)
632 if test "x$globus_flavor_type" = "xno" ; then
633 if test "$GSSAPI" = "mechglue"; then
634 GSI_LIBS="-lglobus_gss_assist -lglobus_gaa"
636 GSI_LIBS="-lglobus_gss_assist -lglobus_gss -lglobus_gaa"
638 GSI_LDFLAGS="-L${globus_dev_dir}/lib"
639 GSI_CPPFLAGS="-I${globus_dev_dir}/include"
642 GLOBUS_FLAVOR_TYPE_INCL_DIR="${globus_dev_dir}/include/${globus_flavor_type}"
644 if test ! -d "$GLOBUS_FLAVOR_TYPE_INCL_DIR" ; then
645 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_FLAVOR_TYPE_INCL_DIR})
648 AC_MSG_RESULT($globus_flavor_type)
649 if test "$GSSAPI" = "mechglue"; then
650 GSI_LIBS="${gsi_path}/lib/libglobus_gss_assist_${globus_flavor_type}.a"
652 GSI_LIBS="${gsi_path}/lib/libglobus_gss_assist_${globus_flavor_type}.a ${gsi_path}/lib/libglobus_gssapi_gsi_${globus_flavor_type}.a"
654 GSI_CPPFLAGS="-I${GLOBUS_FLAVOR_TYPE_INCL_DIR}"
657 LIBS="$LIBS $GSI_LIBS"
658 LDFLAGS="$LDFLAGS $GSI_LDFLAGS"
659 CPPFLAGS="$CPPFLAGS $GSI_CPPFLAGS"
664 AC_SUBST(INSTALL_GSISSH)
665 # End Globus/GSI section
667 # Check whether user wants S/Key support
670 [ --with-skey[[=PATH]] Enable S/Key support
671 (optionally in PATH)],
673 if test "x$withval" != "xno" ; then
675 if test "x$withval" != "xyes" ; then
676 CPPFLAGS="$CPPFLAGS -I${withval}/include"
677 LDFLAGS="$LDFLAGS -L${withval}/lib"
684 AC_MSG_CHECKING([for s/key support])
689 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
691 [AC_MSG_RESULT(yes)],
694 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
700 # Check whether user wants TCP wrappers support
702 AC_ARG_WITH(tcp-wrappers,
703 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
704 (optionally in PATH)],
706 if test "x$withval" != "xno" ; then
708 saved_LDFLAGS="$LDFLAGS"
709 saved_CPPFLAGS="$CPPFLAGS"
710 if test -n "${withval}" -a "${withval}" != "yes"; then
711 if test -d "${withval}/lib"; then
712 if test -n "${need_dash_r}"; then
713 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
715 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
718 if test -n "${need_dash_r}"; then
719 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
721 LDFLAGS="-L${withval} ${LDFLAGS}"
724 if test -d "${withval}/include"; then
725 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
727 CPPFLAGS="-I${withval} ${CPPFLAGS}"
731 LIBS="$LIBWRAP $LIBS"
732 AC_MSG_CHECKING(for libwrap)
736 int deny_severity = 0, allow_severity = 0;
746 AC_MSG_ERROR([*** libwrap missing])
754 dnl Checks for library functions.
755 AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
756 clock fchmod fchown freeaddrinfo futimes gai_strerror \
757 getaddrinfo getcwd getgrouplist getnameinfo getopt getpeereid\
758 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
759 inet_ntop innetgr login_getcapbool md5_crypt memmove \
760 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
761 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
762 setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
763 setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \
764 socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \
765 truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
767 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
768 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
769 AC_CHECK_LIB(gen, dirname,[
770 AC_CACHE_CHECK([for broken dirname],
771 ac_cv_have_broken_dirname, [
779 int main(int argc, char **argv) {
782 strncpy(buf,"/etc", 32);
784 if (!s || strncmp(s, "/", 32) != 0) {
791 [ ac_cv_have_broken_dirname="no" ],
792 [ ac_cv_have_broken_dirname="yes" ]
796 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
798 AC_DEFINE(HAVE_DIRNAME)
799 AC_CHECK_HEADERS(libgen.h)
804 dnl Checks for time functions
805 AC_CHECK_FUNCS(gettimeofday time)
806 dnl Checks for utmp functions
807 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
808 AC_CHECK_FUNCS(utmpname)
809 dnl Checks for utmpx functions
810 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
811 AC_CHECK_FUNCS(setutxent utmpxname)
813 AC_CHECK_FUNC(daemon,
814 [AC_DEFINE(HAVE_DAEMON)],
815 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
818 AC_CHECK_FUNC(getpagesize,
819 [AC_DEFINE(HAVE_GETPAGESIZE)],
820 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
823 # Check for broken snprintf
824 if test "x$ac_cv_func_snprintf" = "xyes" ; then
825 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
829 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
831 [AC_MSG_RESULT(yes)],
834 AC_DEFINE(BROKEN_SNPRINTF)
835 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
845 [ --with-pam Enable PAM support ],
847 if test "x$withval" != "xno" ; then
848 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
849 AC_MSG_ERROR([PAM headers not found])
852 AC_CHECK_LIB(dl, dlopen, , )
853 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
854 AC_CHECK_FUNCS(pam_getenvlist)
855 AC_CHECK_FUNCS(pam_putenv)
861 if test $ac_cv_lib_dl_dlopen = yes; then
871 # Check for older PAM
872 if test "x$PAM_MSG" = "xyes" ; then
873 # Check PAM strerror arguments (old PAM)
874 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
878 #include <security/pam_appl.h>
880 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
883 AC_DEFINE(HAVE_OLD_PAM)
885 PAM_MSG="yes (old library)"
890 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
891 # because the system crypt() is more featureful.
892 if test "x$check_for_libcrypt_before" = "x1"; then
893 AC_CHECK_LIB(crypt, crypt)
897 saved_CPPFLAGS="$CPPFLAGS"
898 saved_LDFLAGS="$LDFLAGS"
900 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
902 if test "x$withval" != "xno" ; then
903 if test -d "$withval/lib"; then
904 if test -n "${need_dash_r}"; then
905 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
907 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
910 if test -n "${need_dash_r}"; then
911 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
913 LDFLAGS="-L${withval} ${LDFLAGS}"
916 if test -d "$withval/include"; then
917 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
919 CPPFLAGS="-I${withval} ${CPPFLAGS}"
925 # Patch up SSL libraries for GSI authentication as needed
926 if test "x$globus_flavor_type" != "xno" ; then
928 # For Globus 2, always link with the static libraries
931 libssl_utils="${gsi_path}/lib/libglobus_ssl_utils_${globus_flavor_type}.a"
934 # Trouble arrives at GT 2.1.3+ with the reorg of globus_ssl_utils. Compensating for
935 # the new library linking required here through file tests to see which libraries to
939 libgsi_proxy_core="${gsi_path}/lib/libglobus_gsi_proxy_core_${globus_flavor_type}.a"
940 libgsi_credential="${gsi_path}/lib/libglobus_gsi_credential_${globus_flavor_type}.a"
941 libgsi_callback="${gsi_path}/lib/libglobus_gsi_callback_${globus_flavor_type}.a"
942 liboldgaa="${gsi_path}/lib/libglobus_oldgaa_${globus_flavor_type}.a"
943 libgsi_sysconfig="${gsi_path}/lib/libglobus_gsi_sysconfig_${globus_flavor_type}.a"
944 libproxy_ssl="${gsi_path}/lib/libglobus_proxy_ssl_${globus_flavor_type}.a"
945 libgsi_cert_utils="${gsi_path}/lib/libglobus_gsi_cert_utils_${globus_flavor_type}.a"
946 libopenssl_error="${gsi_path}/lib/libglobus_openssl_error_${globus_flavor_type}.a"
947 libopenssl="${gsi_path}/lib/libglobus_openssl_${globus_flavor_type}.a"
949 if test -r ${libgsi_proxy_core} \
950 -a -r ${libgsi_credential} \
951 -a -r ${libgsi_callback} \
953 -a -r ${libgsi_sysconfig} \
954 -a -r ${libproxy_ssl} \
955 -a -r ${libgsi_cert_utils} \
956 -a -r ${libopenssl_error} \
957 -a -r ${libopenssl} ; then
958 LIBS="$LIBS ${libgsi_proxy_core}"
959 LIBS="$LIBS ${libgsi_credential}"
960 LIBS="$LIBS ${libgsi_callback}"
961 LIBS="$LIBS ${liboldgaa}"
962 LIBS="$LIBS ${libgsi_sysconfig}"
963 LIBS="$LIBS ${libproxy_ssl}"
964 LIBS="$LIBS ${libgsi_cert_utils}"
965 LIBS="$LIBS ${libopenssl_error}"
966 LIBS="$LIBS ${libopenssl}"
967 elif test -r ${libssl_utils}; then
968 LIBS="$LIBS ${libssl_utils}"
970 AC_MSG_ERROR(All of the required Globus Toolkit libraries are not present/configured correctly)
974 # Standard openssl libraries. They need to appear near the end of the link line.
977 LIBS="$LIBS ${gsi_path}/lib/libssl_${globus_flavor_type}.a"
978 LIBS="$LIBS ${gsi_path}/lib/libcrypto_${globus_flavor_type}.a"
981 # Another "GT 2.1.3+"ism.
984 libcommon_path="${gsi_path}/lib/libglobus_common_${globus_flavor_type}.a"
985 if test -r ${libcommon_path}; then
986 LIBS="$LIBS ${libcommon_path}"
989 if test "x$gsi_path" != "xno" ; then
990 # Older GSI needs -lssl too
991 LIBS="$LIBS -lssl -lcrypto"
992 else # if no GSI authentication (i.e., OpenSSL default)
993 LIBS="$LIBS -lcrypto"
995 fi # globus_flavor_type
997 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
999 dnl Check default openssl install dir
1000 if test -n "${need_dash_r}"; then
1001 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1003 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1005 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1006 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1008 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1014 # Determine OpenSSL header version
1015 AC_MSG_CHECKING([OpenSSL header version])
1020 #include <openssl/opensslv.h>
1021 #define DATA "conftest.sslincver"
1026 fd = fopen(DATA,"w");
1030 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1037 ssl_header_ver=`cat conftest.sslincver`
1038 AC_MSG_RESULT($ssl_header_ver)
1041 AC_MSG_RESULT(not found)
1042 AC_MSG_ERROR(OpenSSL version header not found.)
1046 # Determine OpenSSL library version
1047 AC_MSG_CHECKING([OpenSSL library version])
1052 #include <openssl/opensslv.h>
1053 #include <openssl/crypto.h>
1054 #define DATA "conftest.ssllibver"
1059 fd = fopen(DATA,"w");
1063 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1070 ssl_library_ver=`cat conftest.ssllibver`
1071 AC_MSG_RESULT($ssl_library_ver)
1074 AC_MSG_RESULT(not found)
1075 AC_MSG_ERROR(OpenSSL library not found.)
1079 # Sanity check OpenSSL headers
1080 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1084 #include <openssl/opensslv.h>
1085 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1092 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
1096 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1097 # version in OpenSSL. Skip this for PAM
1098 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
1099 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1103 ### Configure cryptographic random number support
1105 # Check wheter OpenSSL seeds itself
1106 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1110 #include <openssl/rand.h>
1111 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1114 OPENSSL_SEEDS_ITSELF=yes
1119 # Default to use of the rand helper if OpenSSL doesn't
1126 # Do we want to force the use of the rand helper?
1127 AC_ARG_WITH(rand-helper,
1128 [ --with-rand-helper Use subprocess to gather strong randomness ],
1130 if test "x$withval" = "xno" ; then
1131 # Force use of OpenSSL's internal RNG, even if
1132 # the previous test showed it to be unseeded.
1133 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1134 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1135 OPENSSL_SEEDS_ITSELF=yes
1144 # Which randomness source do we use?
1145 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1147 AC_DEFINE(OPENSSL_PRNG_ONLY)
1148 RAND_MSG="OpenSSL internal ONLY"
1149 INSTALL_SSH_RAND_HELPER=""
1150 elif test ! -z "$USE_RAND_HELPER" ; then
1151 # install rand helper
1152 RAND_MSG="ssh-rand-helper"
1153 INSTALL_SSH_RAND_HELPER="yes"
1155 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1157 ### Configuration of ssh-rand-helper
1160 AC_ARG_WITH(prngd-port,
1161 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1170 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1173 if test ! -z "$withval" ; then
1174 PRNGD_PORT="$withval"
1175 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1180 # PRNGD Unix domain socket
1181 AC_ARG_WITH(prngd-socket,
1182 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1186 withval="/var/run/egd-pool"
1194 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1198 if test ! -z "$withval" ; then
1199 if test ! -z "$PRNGD_PORT" ; then
1200 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1202 if test ! -r "$withval" ; then
1203 AC_MSG_WARN(Entropy socket is not readable)
1205 PRNGD_SOCKET="$withval"
1206 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1210 # Check for existing socket only if we don't have a random device already
1211 if test "$USE_RAND_HELPER" = yes ; then
1212 AC_MSG_CHECKING(for PRNGD/EGD socket)
1213 # Insert other locations here
1214 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1215 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1216 PRNGD_SOCKET="$sock"
1217 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1221 if test ! -z "$PRNGD_SOCKET" ; then
1222 AC_MSG_RESULT($PRNGD_SOCKET)
1224 AC_MSG_RESULT(not found)
1230 # Change default command timeout for hashing entropy source
1232 AC_ARG_WITH(entropy-timeout,
1233 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1235 if test "x$withval" != "xno" ; then
1236 entropy_timeout=$withval
1240 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1242 SSH_PRIVSEP_USER=sshd
1243 AC_ARG_WITH(privsep-user,
1244 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1246 if test -n "$withval"; then
1247 SSH_PRIVSEP_USER=$withval
1251 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1252 AC_SUBST(SSH_PRIVSEP_USER)
1254 # We do this little dance with the search path to insure
1255 # that programs that we select for use by installed programs
1256 # (which may be run by the super-user) come from trusted
1257 # locations before they come from the user's private area.
1258 # This should help avoid accidentally configuring some
1259 # random version of a program in someone's personal bin.
1263 test -h /bin 2> /dev/null && PATH=/usr/bin
1264 test -d /sbin && PATH=$PATH:/sbin
1265 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1266 PATH=$PATH:/etc:$OPATH
1268 # These programs are used by the command hashing source to gather entropy
1269 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1270 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1271 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1272 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1273 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1274 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1275 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1276 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1277 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1278 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1279 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1280 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1281 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1282 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1283 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1284 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1288 # Where does ssh-rand-helper get its randomness from?
1289 INSTALL_SSH_PRNG_CMDS=""
1290 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1291 if test ! -z "$PRNGD_PORT" ; then
1292 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1293 elif test ! -z "$PRNGD_SOCKET" ; then
1294 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1296 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1297 RAND_HELPER_CMDHASH=yes
1298 INSTALL_SSH_PRNG_CMDS="yes"
1301 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1304 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1305 if test ! -z "$SONY" ; then
1306 LIBS="$LIBS -liberty";
1309 # Checks for data types
1310 AC_CHECK_SIZEOF(char, 1)
1311 AC_CHECK_SIZEOF(short int, 2)
1312 AC_CHECK_SIZEOF(int, 4)
1313 AC_CHECK_SIZEOF(long int, 4)
1314 AC_CHECK_SIZEOF(long long int, 8)
1316 # Sanity check long long for some platforms (AIX)
1317 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1318 ac_cv_sizeof_long_long_int=0
1321 # More checks for data types
1322 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1324 [ #include <sys/types.h> ],
1326 [ ac_cv_have_u_int="yes" ],
1327 [ ac_cv_have_u_int="no" ]
1330 if test "x$ac_cv_have_u_int" = "xyes" ; then
1331 AC_DEFINE(HAVE_U_INT)
1335 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1337 [ #include <sys/types.h> ],
1338 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1339 [ ac_cv_have_intxx_t="yes" ],
1340 [ ac_cv_have_intxx_t="no" ]
1343 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1344 AC_DEFINE(HAVE_INTXX_T)
1348 if (test -z "$have_intxx_t" && \
1349 test "x$ac_cv_header_stdint_h" = "xyes")
1351 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1353 [ #include <stdint.h> ],
1354 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1356 AC_DEFINE(HAVE_INTXX_T)
1359 [ AC_MSG_RESULT(no) ]
1363 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1366 #include <sys/types.h>
1367 #ifdef HAVE_STDINT_H
1368 # include <stdint.h>
1370 #include <sys/socket.h>
1371 #ifdef HAVE_SYS_BITYPES_H
1372 # include <sys/bitypes.h>
1375 [ int64_t a; a = 1;],
1376 [ ac_cv_have_int64_t="yes" ],
1377 [ ac_cv_have_int64_t="no" ]
1380 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1381 AC_DEFINE(HAVE_INT64_T)
1384 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1386 [ #include <sys/types.h> ],
1387 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1388 [ ac_cv_have_u_intxx_t="yes" ],
1389 [ ac_cv_have_u_intxx_t="no" ]
1392 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1393 AC_DEFINE(HAVE_U_INTXX_T)
1397 if test -z "$have_u_intxx_t" ; then
1398 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1400 [ #include <sys/socket.h> ],
1401 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1403 AC_DEFINE(HAVE_U_INTXX_T)
1406 [ AC_MSG_RESULT(no) ]
1410 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1412 [ #include <sys/types.h> ],
1413 [ u_int64_t a; a = 1;],
1414 [ ac_cv_have_u_int64_t="yes" ],
1415 [ ac_cv_have_u_int64_t="no" ]
1418 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1419 AC_DEFINE(HAVE_U_INT64_T)
1423 if test -z "$have_u_int64_t" ; then
1424 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1426 [ #include <sys/bitypes.h> ],
1427 [ u_int64_t a; a = 1],
1429 AC_DEFINE(HAVE_U_INT64_T)
1432 [ AC_MSG_RESULT(no) ]
1436 if test -z "$have_u_intxx_t" ; then
1437 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1440 #include <sys/types.h>
1442 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1443 [ ac_cv_have_uintxx_t="yes" ],
1444 [ ac_cv_have_uintxx_t="no" ]
1447 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1448 AC_DEFINE(HAVE_UINTXX_T)
1452 if test -z "$have_uintxx_t" ; then
1453 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1455 [ #include <stdint.h> ],
1456 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1458 AC_DEFINE(HAVE_UINTXX_T)
1461 [ AC_MSG_RESULT(no) ]
1465 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1466 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1468 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1471 #include <sys/bitypes.h>
1474 int8_t a; int16_t b; int32_t c;
1475 u_int8_t e; u_int16_t f; u_int32_t g;
1476 a = b = c = e = f = g = 1;
1479 AC_DEFINE(HAVE_U_INTXX_T)
1480 AC_DEFINE(HAVE_INTXX_T)
1488 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1491 #include <sys/types.h>
1493 [ u_char foo; foo = 125; ],
1494 [ ac_cv_have_u_char="yes" ],
1495 [ ac_cv_have_u_char="no" ]
1498 if test "x$ac_cv_have_u_char" = "xyes" ; then
1499 AC_DEFINE(HAVE_U_CHAR)
1504 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1506 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1509 #include <sys/types.h>
1511 [ size_t foo; foo = 1235; ],
1512 [ ac_cv_have_size_t="yes" ],
1513 [ ac_cv_have_size_t="no" ]
1516 if test "x$ac_cv_have_size_t" = "xyes" ; then
1517 AC_DEFINE(HAVE_SIZE_T)
1520 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1523 #include <sys/types.h>
1525 [ ssize_t foo; foo = 1235; ],
1526 [ ac_cv_have_ssize_t="yes" ],
1527 [ ac_cv_have_ssize_t="no" ]
1530 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1531 AC_DEFINE(HAVE_SSIZE_T)
1534 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1539 [ clock_t foo; foo = 1235; ],
1540 [ ac_cv_have_clock_t="yes" ],
1541 [ ac_cv_have_clock_t="no" ]
1544 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1545 AC_DEFINE(HAVE_CLOCK_T)
1548 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1551 #include <sys/types.h>
1552 #include <sys/socket.h>
1554 [ sa_family_t foo; foo = 1235; ],
1555 [ ac_cv_have_sa_family_t="yes" ],
1558 #include <sys/types.h>
1559 #include <sys/socket.h>
1560 #include <netinet/in.h>
1562 [ sa_family_t foo; foo = 1235; ],
1563 [ ac_cv_have_sa_family_t="yes" ],
1565 [ ac_cv_have_sa_family_t="no" ]
1569 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1570 AC_DEFINE(HAVE_SA_FAMILY_T)
1573 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1576 #include <sys/types.h>
1578 [ pid_t foo; foo = 1235; ],
1579 [ ac_cv_have_pid_t="yes" ],
1580 [ ac_cv_have_pid_t="no" ]
1583 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1584 AC_DEFINE(HAVE_PID_T)
1587 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1590 #include <sys/types.h>
1592 [ mode_t foo; foo = 1235; ],
1593 [ ac_cv_have_mode_t="yes" ],
1594 [ ac_cv_have_mode_t="no" ]
1597 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1598 AC_DEFINE(HAVE_MODE_T)
1602 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1605 #include <sys/types.h>
1606 #include <sys/socket.h>
1608 [ struct sockaddr_storage s; ],
1609 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1610 [ ac_cv_have_struct_sockaddr_storage="no" ]
1613 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1614 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1617 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1620 #include <sys/types.h>
1621 #include <netinet/in.h>
1623 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1624 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1625 [ ac_cv_have_struct_sockaddr_in6="no" ]
1628 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1629 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1632 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1635 #include <sys/types.h>
1636 #include <netinet/in.h>
1638 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1639 [ ac_cv_have_struct_in6_addr="yes" ],
1640 [ ac_cv_have_struct_in6_addr="no" ]
1643 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1644 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1647 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1650 #include <sys/types.h>
1651 #include <sys/socket.h>
1654 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1655 [ ac_cv_have_struct_addrinfo="yes" ],
1656 [ ac_cv_have_struct_addrinfo="no" ]
1659 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1660 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1663 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1665 [ #include <sys/time.h> ],
1666 [ struct timeval tv; tv.tv_sec = 1;],
1667 [ ac_cv_have_struct_timeval="yes" ],
1668 [ ac_cv_have_struct_timeval="no" ]
1671 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1672 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1673 have_struct_timeval=1
1676 # If we don't have int64_t then we can't compile sftp-server. So don't
1677 # even attempt to do it.
1678 if test "x$ac_cv_have_int64_t" = "xno" -a \
1679 "x$ac_cv_sizeof_long_int" != "x8" -a \
1680 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1683 dnl test snprintf (broken on SCO w/gcc)
1688 #ifdef HAVE_SNPRINTF
1692 char expected_out[50];
1694 #if (SIZEOF_LONG_INT == 8)
1695 long int num = 0x7fffffffffffffff;
1697 long long num = 0x7fffffffffffffffll;
1699 strcpy(expected_out, "9223372036854775807");
1700 snprintf(buf, mazsize, "%lld", num);
1701 if(strcmp(buf, expected_out) != 0)
1708 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1713 dnl Checks for structure members
1714 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1715 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1716 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1717 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1718 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1719 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1720 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1721 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1722 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1723 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1724 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1725 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1726 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1727 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1728 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1729 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1730 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1732 AC_CHECK_MEMBERS([struct stat.st_blksize])
1734 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1735 ac_cv_have_ss_family_in_struct_ss, [
1738 #include <sys/types.h>
1739 #include <sys/socket.h>
1741 [ struct sockaddr_storage s; s.ss_family = 1; ],
1742 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1743 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1746 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1747 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1750 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1751 ac_cv_have___ss_family_in_struct_ss, [
1754 #include <sys/types.h>
1755 #include <sys/socket.h>
1757 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1758 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1759 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1762 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1763 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1766 AC_CACHE_CHECK([for pw_class field in struct passwd],
1767 ac_cv_have_pw_class_in_struct_passwd, [
1772 [ struct passwd p; p.pw_class = 0; ],
1773 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1774 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1777 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1778 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1781 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1782 ac_cv_have_pw_expire_in_struct_passwd, [
1787 [ struct passwd p; p.pw_expire = 0; ],
1788 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1789 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1792 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1793 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1796 AC_CACHE_CHECK([for pw_change field in struct passwd],
1797 ac_cv_have_pw_change_in_struct_passwd, [
1802 [ struct passwd p; p.pw_change = 0; ],
1803 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1804 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1807 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1808 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1811 dnl make sure we're using the real structure members and not defines
1812 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1813 ac_cv_have_accrights_in_msghdr, [
1816 #include <sys/types.h>
1817 #include <sys/socket.h>
1818 #include <sys/uio.h>
1820 #ifdef msg_accrights
1824 m.msg_accrights = 0;
1828 [ ac_cv_have_accrights_in_msghdr="yes" ],
1829 [ ac_cv_have_accrights_in_msghdr="no" ]
1832 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1833 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1836 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1837 ac_cv_have_control_in_msghdr, [
1840 #include <sys/types.h>
1841 #include <sys/socket.h>
1842 #include <sys/uio.h>
1852 [ ac_cv_have_control_in_msghdr="yes" ],
1853 [ ac_cv_have_control_in_msghdr="no" ]
1856 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1857 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1860 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1862 [ extern char *__progname; printf("%s", __progname); ],
1863 [ ac_cv_libc_defines___progname="yes" ],
1864 [ ac_cv_libc_defines___progname="no" ]
1867 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1868 AC_DEFINE(HAVE___PROGNAME)
1871 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1875 [ printf("%s", __FUNCTION__); ],
1876 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1877 [ ac_cv_cc_implements___FUNCTION__="no" ]
1880 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1881 AC_DEFINE(HAVE___FUNCTION__)
1884 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1888 [ printf("%s", __func__); ],
1889 [ ac_cv_cc_implements___func__="yes" ],
1890 [ ac_cv_cc_implements___func__="no" ]
1893 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1894 AC_DEFINE(HAVE___func__)
1897 AC_CACHE_CHECK([whether getopt has optreset support],
1898 ac_cv_have_getopt_optreset, [
1903 [ extern int optreset; optreset = 0; ],
1904 [ ac_cv_have_getopt_optreset="yes" ],
1905 [ ac_cv_have_getopt_optreset="no" ]
1908 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1909 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1912 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1914 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1915 [ ac_cv_libc_defines_sys_errlist="yes" ],
1916 [ ac_cv_libc_defines_sys_errlist="no" ]
1919 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1920 AC_DEFINE(HAVE_SYS_ERRLIST)
1924 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1926 [ extern int sys_nerr; printf("%i", sys_nerr);],
1927 [ ac_cv_libc_defines_sys_nerr="yes" ],
1928 [ ac_cv_libc_defines_sys_nerr="no" ]
1931 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1932 AC_DEFINE(HAVE_SYS_NERR)
1937 # Check whether user wants sectok support
1939 [ --with-sectok Enable smartcard support using libsectok],
1941 if test "x$withval" != "xno" ; then
1942 if test "x$withval" != "xyes" ; then
1943 CPPFLAGS="$CPPFLAGS -I${withval}"
1944 LDFLAGS="$LDFLAGS -L${withval}"
1945 if test ! -z "$need_dash_r" ; then
1946 LDFLAGS="$LDFLAGS -R${withval}"
1948 if test ! -z "$blibpath" ; then
1949 blibpath="$blibpath:${withval}"
1952 AC_CHECK_HEADERS(sectok.h)
1953 if test "$ac_cv_header_sectok_h" != yes; then
1954 AC_MSG_ERROR(Can't find sectok.h)
1956 AC_CHECK_LIB(sectok, sectok_open)
1957 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1958 AC_MSG_ERROR(Can't find libsectok)
1960 AC_DEFINE(SMARTCARD)
1961 AC_DEFINE(USE_SECTOK)
1962 SCARD_MSG="yes, using sectok"
1967 # Check whether user wants OpenSC support
1969 AC_HELP_STRING([--with-opensc=PFX],
1970 [Enable smartcard support using OpenSC]),
1971 opensc_config_prefix="$withval", opensc_config_prefix="")
1972 if test x$opensc_config_prefix != x ; then
1973 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1974 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1975 if test "$OPENSC_CONFIG" != "no"; then
1976 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1977 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1978 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1979 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1980 AC_DEFINE(SMARTCARD)
1981 AC_DEFINE(USE_OPENSC)
1982 SCARD_MSG="yes, using OpenSC"
1986 # Check whether user wants Kerberos 5 support
1988 AC_ARG_WITH(kerberos5,
1989 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1991 if test "x$withval" != "xno" ; then
1992 if test "x$withval" = "xyes" ; then
1993 KRB5ROOT="/usr/local"
1997 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1998 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2001 AC_MSG_CHECKING(whether we are using Heimdal)
2002 AC_TRY_COMPILE([ #include <krb5.h> ],
2003 [ char *tmp = heimdal_version; ],
2004 [ AC_MSG_RESULT(yes)
2006 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2009 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2012 if test ! -z "$need_dash_r" ; then
2013 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2015 if test ! -z "$blibpath" ; then
2016 blibpath="$blibpath:${KRB5ROOT}/lib"
2018 AC_CHECK_LIB(resolv, dn_expand, , )
2020 # If we're using some other GSSAPI
2021 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
2022 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
2024 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2026 K5LIBS="-lgssapi $K5LIBS" ],
2027 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2029 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2030 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2035 AC_CHECK_HEADER(gssapi.h, ,
2036 [ unset ac_cv_header_gssapi_h
2037 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2038 AC_CHECK_HEADERS(gssapi.h, ,
2039 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2044 AC_CHECK_LIB(gssapi, gss_krb5_copy_ccache, /bin/true,
2045 [ K5LIBS="-lgssapi_krb5 $K5LIBS"
2046 AC_CHECK_LIB(gssapi_krb5, gss_krb5_copy_ccache, /bin/true,
2047 AC_MSG_WARN([Cannot find gss_krb5_copy_ccache -- build may fail]),
2053 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2054 AC_CHECK_HEADER(gssapi_krb5.h, ,
2055 [ CPPFLAGS="$oldCPP" ])
2057 if test -z "$GSSAPI"; then
2065 # Check whether user wants Kerberos 4 support
2067 AC_ARG_WITH(kerberos4,
2068 [ --with-kerberos4=PATH Enable Kerberos 4 support],
2070 if test "x$withval" != "xno" ; then
2071 if test "x$withval" != "xyes" ; then
2072 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2073 LDFLAGS="$LDFLAGS -L${withval}/lib"
2074 if test ! -z "$need_dash_r" ; then
2075 LDFLAGS="$LDFLAGS -R${withval}/lib"
2077 if test ! -z "$blibpath" ; then
2078 blibpath="$blibpath:${withval}/lib"
2081 if test -d /usr/include/kerberosIV ; then
2082 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
2086 AC_CHECK_HEADERS(krb.h)
2087 if test "$ac_cv_header_krb_h" != yes; then
2088 AC_MSG_WARN([Cannot find krb.h, build may fail])
2090 AC_CHECK_LIB(krb, main)
2091 if test "$ac_cv_lib_krb_main" != yes; then
2092 AC_CHECK_LIB(krb4, main)
2093 if test "$ac_cv_lib_krb4_main" != yes; then
2094 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
2101 AC_CHECK_LIB(des, des_cbc_encrypt)
2102 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
2103 AC_CHECK_LIB(des425, des_cbc_encrypt)
2104 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
2105 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
2112 AC_CHECK_LIB(resolv, dn_expand, , )
2120 # Check whether user wants AFS support
2123 [ --with-afs=PATH Enable AFS support],
2125 if test "x$withval" != "xno" ; then
2127 if test "x$withval" != "xyes" ; then
2128 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2129 LDFLAGS="$LDFLAGS -L${withval}/lib"
2132 if test -z "$KRB4" ; then
2133 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
2137 if test ! -z "$AFS_LIBS" ; then
2138 LIBS="$LIBS $AFS_LIBS"
2145 LIBS="$LIBS $KLIBS $K5LIBS"
2147 # Looking for programs, paths and files
2149 PRIVSEP_PATH=/var/empty
2150 AC_ARG_WITH(privsep-path,
2151 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2153 if test "x$withval" != "$no" ; then
2154 PRIVSEP_PATH=$withval
2158 AC_SUBST(PRIVSEP_PATH)
2161 [ --with-xauth=PATH Specify path to xauth program ],
2163 if test "x$withval" != "xno" ; then
2169 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2170 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2171 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2172 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2173 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2174 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2175 xauth_path="/usr/openwin/bin/xauth"
2180 if test -z "$xauth_path" ; then
2181 XAUTH_PATH="undefined"
2182 AC_SUBST(XAUTH_PATH)
2184 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2185 XAUTH_PATH=$xauth_path
2186 AC_SUBST(XAUTH_PATH)
2189 # Check for mail directory (last resort if we cannot get it from headers)
2190 if test ! -z "$MAIL" ; then
2191 maildir=`dirname $MAIL`
2192 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2195 if test -z "$no_dev_ptmx" ; then
2196 if test "x$disable_ptmx_check" != "xyes" ; then
2197 AC_CHECK_FILE("/dev/ptmx",
2199 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2205 AC_CHECK_FILE("/dev/ptc",
2207 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2212 # Options from here on. Some of these are preset by platform above
2213 AC_ARG_WITH(mantype,
2214 [ --with-mantype=man|cat|doc Set man page type],
2221 AC_MSG_ERROR(invalid man type: $withval)
2226 if test -z "$MANTYPE"; then
2227 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2228 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2229 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2231 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2238 if test "$MANTYPE" = "doc"; then
2245 # Check whether to enable MD5 passwords
2247 AC_ARG_WITH(md5-passwords,
2248 [ --with-md5-passwords Enable use of MD5 passwords],
2250 if test "x$withval" != "xno" ; then
2251 AC_DEFINE(HAVE_MD5_PASSWORDS)
2257 # Whether to disable shadow password support
2259 [ --without-shadow Disable shadow password support],
2261 if test "x$withval" = "xno" ; then
2262 AC_DEFINE(DISABLE_SHADOW)
2268 if test -z "$disable_shadow" ; then
2269 AC_MSG_CHECKING([if the systems has expire shadow information])
2272 #include <sys/types.h>
2275 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2276 [ sp_expire_available=yes ], []
2279 if test "x$sp_expire_available" = "xyes" ; then
2281 AC_DEFINE(HAS_SHADOW_EXPIRE)
2287 # Use ip address instead of hostname in $DISPLAY
2288 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2289 DISPLAY_HACK_MSG="yes"
2290 AC_DEFINE(IPADDR_IN_DISPLAY)
2292 DISPLAY_HACK_MSG="no"
2293 AC_ARG_WITH(ipaddr-display,
2294 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2296 if test "x$withval" != "xno" ; then
2297 AC_DEFINE(IPADDR_IN_DISPLAY)
2298 DISPLAY_HACK_MSG="yes"
2304 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2305 if test $ac_cv_func_login_getcapbool = "yes" -a \
2306 $ac_cv_header_login_cap_h = "yes" ; then
2309 # Whether to mess with the default path
2310 SERVER_PATH_MSG="(default)"
2311 AC_ARG_WITH(default-path,
2312 [ --with-default-path= Specify default \$PATH environment for server],
2314 if test "$USES_LOGIN_CONF" = "yes" ; then
2316 --with-default-path=PATH has no effect on this system.
2317 Edit /etc/login.conf instead.])
2318 elif test "x$withval" != "xno" ; then
2319 user_path="$withval"
2320 SERVER_PATH_MSG="$withval"
2323 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2324 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2328 /* find out what STDPATH is */
2333 #ifndef _PATH_STDPATH
2334 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2336 #include <sys/types.h>
2337 #include <sys/stat.h>
2339 #define DATA "conftest.stdpath"
2346 fd = fopen(DATA,"w");
2350 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2355 ], [ user_path=`cat conftest.stdpath` ],
2356 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2357 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2359 # make sure $bindir is in USER_PATH so scp will work
2360 t_bindir=`eval echo ${bindir}`
2362 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2365 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2367 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2368 if test $? -ne 0 ; then
2369 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2370 if test $? -ne 0 ; then
2371 user_path=$user_path:$t_bindir
2372 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2377 if test "$USES_LOGIN_CONF" != "yes" ; then
2378 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2382 # Set superuser path separately to user path
2383 AC_ARG_WITH(superuser-path,
2384 [ --with-superuser-path= Specify different path for super-user],
2386 if test "x$withval" != "xno" ; then
2387 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2388 superuser_path=$withval
2394 # Whether to force IPv4 by default (needed on broken glibc Linux)
2396 AC_ARG_WITH(ipv4-default,
2397 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2399 if test "x$withval" != "xno" ; then
2400 AC_DEFINE(IPV4_DEFAULT)
2406 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2407 IPV4_IN6_HACK_MSG="no"
2409 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2411 if test "x$withval" != "xno" ; then
2413 AC_DEFINE(IPV4_IN_IPV6)
2414 IPV4_IN6_HACK_MSG="yes"
2419 if test "x$inet6_default_4in6" = "xyes"; then
2420 AC_MSG_RESULT([yes (default)])
2421 AC_DEFINE(IPV4_IN_IPV6)
2422 IPV4_IN6_HACK_MSG="yes"
2424 AC_MSG_RESULT([no (default)])
2429 # Whether to enable BSD auth support
2431 AC_ARG_WITH(bsd-auth,
2432 [ --with-bsd-auth Enable BSD auth support],
2434 if test "x$withval" != "xno" ; then
2441 # Where to place sshd.pid
2443 # make sure the directory exists
2444 if test ! -d $piddir ; then
2445 piddir=`eval echo ${sysconfdir}`
2447 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2451 AC_ARG_WITH(pid-dir,
2452 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2454 if test "x$withval" != "xno" ; then
2456 if test ! -d $piddir ; then
2457 AC_MSG_WARN([** no $piddir directory on this system **])
2463 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2466 dnl allow user to disable some login recording features
2467 AC_ARG_ENABLE(lastlog,
2468 [ --disable-lastlog disable use of lastlog even if detected [no]],
2469 [ AC_DEFINE(DISABLE_LASTLOG) ]
2472 [ --disable-utmp disable use of utmp even if detected [no]],
2473 [ AC_DEFINE(DISABLE_UTMP) ]
2475 AC_ARG_ENABLE(utmpx,
2476 [ --disable-utmpx disable use of utmpx even if detected [no]],
2477 [ AC_DEFINE(DISABLE_UTMPX) ]
2480 [ --disable-wtmp disable use of wtmp even if detected [no]],
2481 [ AC_DEFINE(DISABLE_WTMP) ]
2483 AC_ARG_ENABLE(wtmpx,
2484 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2485 [ AC_DEFINE(DISABLE_WTMPX) ]
2487 AC_ARG_ENABLE(libutil,
2488 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2489 [ AC_DEFINE(DISABLE_LOGIN) ]
2491 AC_ARG_ENABLE(pututline,
2492 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2493 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2495 AC_ARG_ENABLE(pututxline,
2496 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2497 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2499 AC_ARG_WITH(lastlog,
2500 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2502 if test "x$withval" = "xno" ; then
2503 AC_DEFINE(DISABLE_LASTLOG)
2505 conf_lastlog_location=$withval
2510 dnl lastlog, [uw]tmpx? detection
2511 dnl NOTE: set the paths in the platform section to avoid the
2512 dnl need for command-line parameters
2513 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2515 dnl lastlog detection
2516 dnl NOTE: the code itself will detect if lastlog is a directory
2517 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2519 #include <sys/types.h>
2521 #ifdef HAVE_LASTLOG_H
2522 # include <lastlog.h>
2531 [ char *lastlog = LASTLOG_FILE; ],
2532 [ AC_MSG_RESULT(yes) ],
2535 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2537 #include <sys/types.h>
2539 #ifdef HAVE_LASTLOG_H
2540 # include <lastlog.h>
2546 [ char *lastlog = _PATH_LASTLOG; ],
2547 [ AC_MSG_RESULT(yes) ],
2550 system_lastlog_path=no
2555 if test -z "$conf_lastlog_location"; then
2556 if test x"$system_lastlog_path" = x"no" ; then
2557 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2558 if (test -d "$f" || test -f "$f") ; then
2559 conf_lastlog_location=$f
2562 if test -z "$conf_lastlog_location"; then
2563 AC_MSG_WARN([** Cannot find lastlog **])
2564 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2569 if test -n "$conf_lastlog_location"; then
2570 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2574 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2576 #include <sys/types.h>
2582 [ char *utmp = UTMP_FILE; ],
2583 [ AC_MSG_RESULT(yes) ],
2585 system_utmp_path=no ]
2587 if test -z "$conf_utmp_location"; then
2588 if test x"$system_utmp_path" = x"no" ; then
2589 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2590 if test -f $f ; then
2591 conf_utmp_location=$f
2594 if test -z "$conf_utmp_location"; then
2595 AC_DEFINE(DISABLE_UTMP)
2599 if test -n "$conf_utmp_location"; then
2600 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2604 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2606 #include <sys/types.h>
2612 [ char *wtmp = WTMP_FILE; ],
2613 [ AC_MSG_RESULT(yes) ],
2615 system_wtmp_path=no ]
2617 if test -z "$conf_wtmp_location"; then
2618 if test x"$system_wtmp_path" = x"no" ; then
2619 for f in /usr/adm/wtmp /var/log/wtmp; do
2620 if test -f $f ; then
2621 conf_wtmp_location=$f
2624 if test -z "$conf_wtmp_location"; then
2625 AC_DEFINE(DISABLE_WTMP)
2629 if test -n "$conf_wtmp_location"; then
2630 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2634 dnl utmpx detection - I don't know any system so perverse as to require
2635 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2637 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2639 #include <sys/types.h>
2648 [ char *utmpx = UTMPX_FILE; ],
2649 [ AC_MSG_RESULT(yes) ],
2651 system_utmpx_path=no ]
2653 if test -z "$conf_utmpx_location"; then
2654 if test x"$system_utmpx_path" = x"no" ; then
2655 AC_DEFINE(DISABLE_UTMPX)
2658 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2662 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2664 #include <sys/types.h>
2673 [ char *wtmpx = WTMPX_FILE; ],
2674 [ AC_MSG_RESULT(yes) ],
2676 system_wtmpx_path=no ]
2678 if test -z "$conf_wtmpx_location"; then
2679 if test x"$system_wtmpx_path" = x"no" ; then
2680 AC_DEFINE(DISABLE_WTMPX)
2683 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2687 if test ! -z "$blibpath" ; then
2688 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2689 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2692 dnl remove pam and dl because they are in $LIBPAM
2693 if test "$PAM_MSG" = yes ; then
2694 LIBS=`echo $LIBS | sed 's/-lpam //'`
2696 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2697 LIBS=`echo $LIBS | sed 's/-ldl //'`
2701 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2704 # Print summary of options
2706 # Someone please show me a better way :)
2707 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2708 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2709 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2710 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2711 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2712 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2713 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2714 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2715 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2716 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2719 echo "OpenSSH has been configured with the following options:"
2720 echo " User binaries: $B"
2721 echo " System binaries: $C"
2722 echo " Configuration files: $D"
2723 echo " Askpass program: $E"
2724 echo " Manual pages: $F"
2725 echo " PID file: $G"
2726 echo " Privilege separation chroot path: $H"
2727 if test "$USES_LOGIN_CONF" = "yes" ; then
2728 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2730 echo " sshd default user PATH: $I"
2732 if test ! -z "$superuser_path" ; then
2733 echo " sshd superuser user PATH: $J"
2735 echo " Manpage format: $MANTYPE"
2736 echo " PAM support: ${PAM_MSG}"
2737 echo " KerberosIV support: $KRB4_MSG"
2738 echo " KerberosV support: $KRB5_MSG"
2739 echo " Smartcard support: $SCARD_MSG"
2740 echo " AFS support: $AFS_MSG"
2741 echo " S/KEY support: $SKEY_MSG"
2742 echo " TCP Wrappers support: $TCPW_MSG"
2743 echo " MD5 password support: $MD5_MSG"
2744 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2745 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2746 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2747 echo " BSD Auth support: $BSD_AUTH_MSG"
2748 echo " Random number source: $RAND_MSG"
2749 if test ! -z "$USE_RAND_HELPER" ; then
2750 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2755 echo " Host: ${host}"
2756 echo " Compiler: ${CC}"
2757 echo " Compiler flags: ${CFLAGS}"
2758 echo "Preprocessor flags: ${CPPFLAGS}"
2759 echo " Linker flags: ${LDFLAGS}"
2760 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2764 if test "x$PAM_MSG" = "xyes" ; then
2765 echo "PAM is enabled. You may need to install a PAM control file "
2766 echo "for sshd, otherwise password authentication may fail. "
2767 echo "Example PAM control files can be found in the contrib/ "
2772 if test ! -z "$NO_SFTP"; then
2773 echo "sftp-server will be disabled. Your compiler does not "
2774 echo "support 64bit integers."
2778 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2779 echo "WARNING: you are using the builtin random number collection "
2780 echo "service. Please read WARNING.RNG and request that your OS "
2781 echo "vendor includes kernel-based random number collection in "
2782 echo "future versions of your OS."