4 AC_CONFIG_SRCDIR([ssh.c])
6 AC_CONFIG_HEADER(config.h)
11 # Checks for programs.
16 AC_PATH_PROGS(PERL, perl5 perl)
18 AC_PATH_PROG(ENT, ent)
20 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
21 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
22 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
28 if test -z "$AR" ; then
29 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
32 # Use LOGIN_PROGRAM from environment if possible
33 if test ! -z "$LOGIN_PROGRAM" ; then
34 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
37 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
38 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
39 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
43 if test -z "$LD" ; then
49 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
50 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
53 # Check for some target-specific stuff
57 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
58 LDFLAGS="$LDFLAGS -L/usr/local/lib"
59 if (test "$LD" != "gcc" && test -z "$blibpath"); then
60 AC_MSG_CHECKING([if linkage editor ($LD) accepts -blibpath])
61 saved_LDFLAGS="$LDFLAGS"
62 LDFLAGS="$LDFLAGS -blibpath:/usr/lib:/lib:/usr/local/lib"
67 blibpath="/usr/lib:/lib:/usr/local/lib"
71 LDFLAGS="$saved_LDFLAGS"
73 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
74 [AC_CHECK_LIB(s,authenticate,
75 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
79 AC_DEFINE(BROKEN_GETADDRINFO)
80 AC_DEFINE(BROKEN_REALPATH)
81 dnl AIX handles lastlog as part of its login message
82 AC_DEFINE(DISABLE_LASTLOG)
83 AC_DEFINE(LOGIN_NEEDS_UTMPX)
86 LIBS="$LIBS /usr/lib/textmode.o"
87 AC_DEFINE(HAVE_CYGWIN)
89 AC_DEFINE(DISABLE_SHADOW)
90 AC_DEFINE(IPV4_DEFAULT)
91 AC_DEFINE(IP_TOS_IS_BROKEN)
92 AC_DEFINE(NO_X11_UNIX_SOCKETS)
93 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
94 AC_DEFINE(DISABLE_FD_PASSING)
95 AC_DEFINE(SETGROUPS_NOOP)
98 AC_DEFINE(IP_TOS_IS_BROKEN)
101 AC_MSG_CHECKING(if we have working getaddrinfo)
102 AC_TRY_RUN([#include <mach-o/dyld.h>
103 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
107 }], [AC_MSG_RESULT(working)],
108 [AC_MSG_RESULT(buggy)
109 AC_DEFINE(BROKEN_GETADDRINFO)],
110 [AC_MSG_RESULT(assume it is working)])
113 if test -z "$GCC"; then
116 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
117 IPADDR_IN_DISPLAY=yes
118 AC_DEFINE(HAVE_SECUREWARE)
120 AC_DEFINE(LOGIN_NO_ENDOPT)
121 AC_DEFINE(LOGIN_NEEDS_UTMPX)
122 AC_DEFINE(DISABLE_SHADOW)
123 AC_DEFINE(DISABLE_UTMP)
124 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
125 LIBS="$LIBS -lsec -lsecpw"
126 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
127 disable_ptmx_check=yes
130 if test -z "$GCC"; then
133 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
134 IPADDR_IN_DISPLAY=yes
136 AC_DEFINE(LOGIN_NO_ENDOPT)
137 AC_DEFINE(LOGIN_NEEDS_UTMPX)
138 AC_DEFINE(DISABLE_SHADOW)
139 AC_DEFINE(DISABLE_UTMP)
140 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
142 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
145 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
146 IPADDR_IN_DISPLAY=yes
147 AC_DEFINE(PAM_SUN_CODEBASE)
149 AC_DEFINE(LOGIN_NO_ENDOPT)
150 AC_DEFINE(LOGIN_NEEDS_UTMPX)
151 AC_DEFINE(DISABLE_SHADOW)
152 AC_DEFINE(DISABLE_UTMP)
153 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
155 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
158 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
160 PATH="$PATH:/usr/etc"
161 AC_DEFINE(BROKEN_INET_NTOA)
162 AC_DEFINE(WITH_ABBREV_NO_TTY)
165 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
167 PATH="$PATH:/usr/etc"
168 AC_DEFINE(WITH_IRIX_ARRAY)
169 AC_DEFINE(WITH_IRIX_PROJECT)
170 AC_DEFINE(WITH_IRIX_AUDIT)
171 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
172 AC_DEFINE(BROKEN_INET_NTOA)
173 AC_DEFINE(WITH_ABBREV_NO_TTY)
177 check_for_libcrypt_later=1
178 AC_DEFINE(DONT_TRY_OTHER_AF)
179 AC_DEFINE(PAM_TTY_KLUDGE)
180 inet6_default_4in6=yes
182 mips-sony-bsd|mips-sony-newsos4)
183 AC_DEFINE(HAVE_NEWS4)
187 check_for_libcrypt_before=1
191 check_for_libcrypt_later=1
194 conf_lastlog_location="/usr/adm/lastlog"
195 conf_utmp_location=/etc/utmp
196 conf_wtmp_location=/usr/adm/wtmp
199 AC_DEFINE(BROKEN_REALPATH)
201 AC_DEFINE(BROKEN_SAVED_UIDS)
202 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
206 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
207 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
209 AC_DEFINE(PAM_SUN_CODEBASE)
210 AC_DEFINE(LOGIN_NEEDS_UTMPX)
211 AC_DEFINE(LOGIN_NEEDS_TERM)
212 AC_DEFINE(PAM_TTY_KLUDGE)
213 # hardwire lastlog location (can't detect it on some versions)
214 conf_lastlog_location="/var/adm/lastlog"
215 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
216 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
217 if test "$sol2ver" -ge 8; then
219 AC_DEFINE(DISABLE_UTMP)
220 AC_DEFINE(DISABLE_WTMP)
226 CPPFLAGS="$CPPFLAGS -DSUNOS4"
227 AC_CHECK_FUNCS(getpwanam)
228 AC_DEFINE(PAM_SUN_CODEBASE)
229 conf_utmp_location=/etc/utmp
230 conf_wtmp_location=/var/adm/wtmp
231 conf_lastlog_location=/var/adm/lastlog
235 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
236 LDFLAGS="$LDFLAGS -L/usr/local/lib"
241 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
242 # /usr/ucblib MUST NOT be searched on ReliantUNIX
243 LDFLAGS="$LDFLAGS -L/usr/local/lib"
244 IPADDR_IN_DISPLAY=yes
246 AC_DEFINE(IP_TOS_IS_BROKEN)
247 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
248 # Attention: always take care to bind libsocket and libnsl before libc,
249 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
252 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
253 LDFLAGS="$LDFLAGS -L/usr/local/lib"
257 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
258 LDFLAGS="$LDFLAGS -L/usr/local/lib"
262 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
263 LDFLAGS="$LDFLAGS -L/usr/local/lib"
266 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
267 LDFLAGS="$LDFLAGS -L/usr/local/lib"
268 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
271 AC_DEFINE(BROKEN_SYS_TERMIO_H)
273 AC_DEFINE(HAVE_SECUREWARE)
274 AC_DEFINE(DISABLE_SHADOW)
275 AC_DEFINE(BROKEN_SAVED_UIDS)
276 AC_CHECK_FUNCS(getluid setluid)
278 do_sco3_extra_lib_check=yes
281 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
282 LDFLAGS="$LDFLAGS -L/usr/local/lib"
283 LIBS="$LIBS -lprot -lx -ltinfo -lm"
286 AC_DEFINE(HAVE_SECUREWARE)
287 AC_DEFINE(DISABLE_SHADOW)
288 AC_DEFINE(DISABLE_FD_PASSING)
289 AC_CHECK_FUNCS(getluid setluid)
296 AC_DEFINE(DISABLE_FD_PASSING)
298 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
305 AC_DEFINE(DISABLE_FD_PASSING)
306 AC_DEFINE(NO_SSH_LASTLOG)
307 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
308 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
312 AC_MSG_CHECKING(for Digital Unix SIA)
315 [ --with-osfsia Enable Digital Unix SIA],
317 if test "x$withval" = "xno" ; then
318 AC_MSG_RESULT(disabled)
323 if test -z "$no_osfsia" ; then
324 if test -f /etc/sia/matrix.conf; then
326 AC_DEFINE(HAVE_OSF_SIA)
327 AC_DEFINE(DISABLE_LOGIN)
328 LIBS="$LIBS -lsecurity -ldb -lm -laud"
337 AC_DEFINE(NO_X11_UNIX_SOCKETS)
338 AC_DEFINE(MISSING_NFDBITS)
339 AC_DEFINE(MISSING_HOWMANY)
340 AC_DEFINE(MISSING_FD_MASK)
344 # Allow user to specify flags
346 [ --with-cflags Specify additional flags to pass to compiler],
348 if test "x$withval" != "xno" ; then
349 CFLAGS="$CFLAGS $withval"
353 AC_ARG_WITH(cppflags,
354 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
356 if test "x$withval" != "xno"; then
357 CPPFLAGS="$CPPFLAGS $withval"
362 [ --with-ldflags Specify additional flags to pass to linker],
364 if test "x$withval" != "xno" ; then
365 LDFLAGS="$LDFLAGS $withval"
370 [ --with-libs Specify additional libraries to link with],
372 if test "x$withval" != "xno" ; then
373 LIBS="$LIBS $withval"
378 # Checks for header files.
379 AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
380 getopt.h glob.h ia.h lastlog.h limits.h login.h \
381 login_cap.h maillock.h netdb.h netgroup.h \
382 netinet/in_systm.h paths.h pty.h readpassphrase.h \
383 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
384 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
385 sys/mman.h sys/select.h sys/stat.h \
386 sys/stropts.h sys/sysmacros.h sys/time.h \
387 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
388 util.h utime.h utmp.h utmpx.h)
390 # Checks for libraries.
391 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
392 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
394 dnl SCO OS3 needs this for libwrap
395 if test "x$with_tcp_wrappers" != "xno" ; then
396 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
397 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
401 AC_CHECK_FUNC(getspnam, ,
402 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
405 [ --without-rpath Disable auto-added -R linker paths],
407 if test "x$withval" = "xno" ; then
410 if test "x$withval" = "xyes" ; then
418 [ --with-zlib=PATH Use zlib in PATH],
420 if test "x$withval" = "xno" ; then
421 AC_MSG_ERROR([*** zlib is required ***])
423 if test -d "$withval/lib"; then
424 if test -n "${need_dash_r}"; then
425 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
427 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
430 if test -n "${need_dash_r}"; then
431 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
433 LDFLAGS="-L${withval} ${LDFLAGS}"
436 if test -d "$withval/include"; then
437 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
439 CPPFLAGS="-I${withval} ${CPPFLAGS}"
444 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
447 AC_CHECK_FUNC(strcasecmp,
448 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
450 AC_CHECK_FUNC(utimes,
451 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
452 LIBS="$LIBS -lc89"]) ]
455 dnl Checks for libutil functions
456 AC_CHECK_HEADERS(libutil.h)
457 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
458 AC_CHECK_FUNCS(logout updwtmp logwtmp)
462 # Check for ALTDIRFUNC glob() extension
463 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
464 AC_EGREP_CPP(FOUNDIT,
467 #ifdef GLOB_ALTDIRFUNC
472 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
480 # Check for g.gl_matchc glob() extension
481 AC_MSG_CHECKING(for gl_matchc field in glob_t)
482 AC_EGREP_CPP(FOUNDIT,
485 int main(void){glob_t g; g.gl_matchc = 1;}
488 AC_DEFINE(GLOB_HAS_GL_MATCHC)
496 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
499 #include <sys/types.h>
501 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
503 [AC_MSG_RESULT(yes)],
506 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
510 # Check whether the user wants GSSAPI mechglue support
511 AC_ARG_WITH(mechglue,
512 [ --with-mechglue=PATH Build with GSSAPI mechglue library],
514 AC_MSG_CHECKING(for mechglue library)
516 if test -e ${withval}/libgssapi.a ; then
517 mechglue_lib=${withval}/libgssapi.a
518 elif test -e ${withval}/lib/libgssapi.a ; then
519 mechglue_lib=${withval}/lib/libgssapi.a
521 AC_MSG_ERROR("Can't find libgssapi in ${withval}");
523 LIBS="$LIBS ${mechglue_lib}"
524 AC_MSG_RESULT(${mechglue_lib})
526 # if test -e ${withval}/gssapi.h ; then
527 # CPPFLAGS="$CPPFLAGS -I${withval}"
528 # elif test -e ${withval}/include/gssapi.h ; then
529 # CPPFLAGS="$CPPFLAGS -I${withval}/include"
531 # AC_MSG_ERROR("Can't find gssapi.h in ${withval}");
534 AC_CHECK_LIB(dl, dlopen, , )
535 if test $ac_cv_lib_dl_dlopen = yes; then
536 LDFLAGS="$LDFLAGS -ldl -Wl,-Bsymbolic"
547 # Check whether the user wants GSI (Globus) support
550 [ --with-gsi=PATH Enable GSI/Globus authentication support],
557 [ --with-globus=PATH Enable GSI/Globus authentication support],
563 # Check whether the user has a Globus flavor type
564 globus_flavor_type="no"
565 AC_ARG_WITH(globus-flavor,
566 [ --with-globus-flavor=TYPE Describe Globus flavor type (ex: gcc32dbg, etc.)],
568 globus_flavor_type="$withval"
572 if test "x$gsi_path" != "xno" ; then
573 # Globus GSSAPI configuration
576 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
577 AC_MSG_ERROR([Previously configured GSSAPI library conflicts with Globus/GSI.])
579 if test -z "$GSSAPI"; then
584 # Find GLOBUS/GSI installation Directory
586 AC_MSG_CHECKING(for Globus installation)
587 globus_dev_dir=$gsi_path
588 if test "x$globus_dev_dir" = "xyes" ; then
589 AC_MSG_ERROR(Cannot find Globus installation -- a path must be specified!)
591 AC_MSG_RESULT($globus_dev_dir)
593 # Find GLOBUS/GSI flavor Directory
595 AC_MSG_CHECKING(for Globus flavor)
596 if test "x$globus_flavor_type" = "xno" ; then
597 AC_MSG_ERROR(No Globus flavor type specified)
598 elif test "x$globus_flavor_type" = "xyes" ; then
599 AC_MSG_ERROR(No Globus flavor type specified)
601 GLOBUS_FLAVOR_TYPE_INCL_DIR="${globus_dev_dir}/include/${globus_flavor_type}"
602 if test ! -d "$GLOBUS_FLAVOR_TYPE_INCL_DIR" ; then
603 AC_MSG_ERROR(Cannot find Globus flavor-specific include directory: ${GLOBUS_FLAVOR_TYPE_INCL_DIR})
605 GSI_CPPFLAGS="-I${GLOBUS_FLAVOR_TYPE_INCL_DIR}"
607 AC_MSG_RESULT($globus_flavor_type)
609 # Build possible libraries off of the flavor name
611 libglobus_gss_assist="${gsi_path}/lib/libglobus_gss_assist_${globus_flavor_type}.a"
612 libglobus_gssapi_gsi="${gsi_path}/lib/libglobus_gssapi_gsi_${globus_flavor_type}.a"
614 # Test that the base gss_assist library is present
616 if test -r ${libglobus_gss_assist} ; then
617 LIBS="$LIBS ${libglobus_gss_assist}"
619 AC_MSG_ERROR([*** libglobus_gss_assist missing])
622 AC_MSG_CHECKING(for libglobus_gss_assist)
630 AC_MSG_ERROR([*** libglobus_gss_assist missing])
634 # If we aren't using mechglue, test that gssapi_gsi is present
636 if test "$GSSAPI" != "mechglue"; then
637 if test -r ${libglobus_gssapi_gsi} ; then
638 LIBS="$LIBS ${libglobus_gssapi_gsi}"
640 AC_MSG_ERROR([*** libglobus_gssapi_gsi missing])
644 AC_MSG_CHECKING(for libglobus_gssapi_gsi)
652 AC_MSG_ERROR([*** libglobus_gssapi_gsi missing])
656 CPPFLAGS="$CPPFLAGS $GSI_CPPFLAGS"
658 # End Globus/GSI section
660 # Check whether user wants S/Key support
663 [ --with-skey[[=PATH]] Enable S/Key support
664 (optionally in PATH)],
666 if test "x$withval" != "xno" ; then
668 if test "x$withval" != "xyes" ; then
669 CPPFLAGS="$CPPFLAGS -I${withval}/include"
670 LDFLAGS="$LDFLAGS -L${withval}/lib"
677 AC_MSG_CHECKING([for s/key support])
682 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
684 [AC_MSG_RESULT(yes)],
687 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
693 # Check whether user wants TCP wrappers support
695 AC_ARG_WITH(tcp-wrappers,
696 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
697 (optionally in PATH)],
699 if test "x$withval" != "xno" ; then
701 saved_LDFLAGS="$LDFLAGS"
702 saved_CPPFLAGS="$CPPFLAGS"
703 if test -n "${withval}" -a "${withval}" != "yes"; then
704 if test -d "${withval}/lib"; then
705 if test -n "${need_dash_r}"; then
706 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
708 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
711 if test -n "${need_dash_r}"; then
712 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
714 LDFLAGS="-L${withval} ${LDFLAGS}"
717 if test -d "${withval}/include"; then
718 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
720 CPPFLAGS="-I${withval} ${CPPFLAGS}"
724 LIBS="$LIBWRAP $LIBS"
725 AC_MSG_CHECKING(for libwrap)
729 int deny_severity = 0, allow_severity = 0;
739 AC_MSG_ERROR([*** libwrap missing])
747 dnl Checks for library functions.
748 AC_CHECK_FUNCS(arc4random b64_ntop bcopy bindresvport_sa \
749 clock fchmod fchown freeaddrinfo futimes gai_strerror \
750 getaddrinfo getcwd getgrouplist getnameinfo getopt getpeereid\
751 getrlimit getrusage getttyent glob inet_aton inet_ntoa \
752 inet_ntop innetgr login_getcapbool md5_crypt memmove \
753 mkdtemp mmap ngetaddrinfo openpty ogetaddrinfo readpassphrase \
754 realpath recvmsg rresvport_af sendmsg setdtablesize setegid \
755 setenv seteuid setgroups setlogin setproctitle setresgid setreuid \
756 setrlimit setsid setpcred setvbuf sigaction sigvec snprintf \
757 socketpair strerror strlcat strlcpy strmode strsep sysconf tcgetpgrp \
758 truncate utimes vhangup vsnprintf waitpid __b64_ntop _getpty)
760 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
761 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
762 AC_CHECK_LIB(gen, dirname,[
763 AC_CACHE_CHECK([for broken dirname],
764 ac_cv_have_broken_dirname, [
772 int main(int argc, char **argv) {
775 strncpy(buf,"/etc", 32);
777 if (!s || strncmp(s, "/", 32) != 0) {
784 [ ac_cv_have_broken_dirname="no" ],
785 [ ac_cv_have_broken_dirname="yes" ]
789 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
791 AC_DEFINE(HAVE_DIRNAME)
792 AC_CHECK_HEADERS(libgen.h)
797 dnl Checks for time functions
798 AC_CHECK_FUNCS(gettimeofday time)
799 dnl Checks for utmp functions
800 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
801 AC_CHECK_FUNCS(utmpname)
802 dnl Checks for utmpx functions
803 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
804 AC_CHECK_FUNCS(setutxent utmpxname)
806 AC_CHECK_FUNC(daemon,
807 [AC_DEFINE(HAVE_DAEMON)],
808 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
811 AC_CHECK_FUNC(getpagesize,
812 [AC_DEFINE(HAVE_GETPAGESIZE)],
813 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
816 # Check for broken snprintf
817 if test "x$ac_cv_func_snprintf" = "xyes" ; then
818 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
822 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
824 [AC_MSG_RESULT(yes)],
827 AC_DEFINE(BROKEN_SNPRINTF)
828 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
838 [ --with-pam Enable PAM support ],
840 if test "x$withval" != "xno" ; then
841 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
842 AC_MSG_ERROR([PAM headers not found])
845 AC_CHECK_LIB(dl, dlopen, , )
846 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
847 AC_CHECK_FUNCS(pam_getenvlist)
848 AC_CHECK_FUNCS(pam_putenv)
854 if test $ac_cv_lib_dl_dlopen = yes; then
865 # Check for older PAM
866 if test "x$PAM_MSG" = "xyes" ; then
867 # Check PAM strerror arguments (old PAM)
868 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
872 #include <security/pam_appl.h>
874 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
877 AC_DEFINE(HAVE_OLD_PAM)
879 PAM_MSG="yes (old library)"
884 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
885 # because the system crypt() is more featureful.
886 if test "x$check_for_libcrypt_before" = "x1"; then
887 AC_CHECK_LIB(crypt, crypt)
891 saved_CPPFLAGS="$CPPFLAGS"
892 saved_LDFLAGS="$LDFLAGS"
894 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
896 if test "x$withval" != "xno" ; then
897 if test -d "$withval/lib"; then
898 if test -n "${need_dash_r}"; then
899 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
901 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
904 if test -n "${need_dash_r}"; then
905 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
907 LDFLAGS="-L${withval} ${LDFLAGS}"
910 if test -d "$withval/include"; then
911 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
913 CPPFLAGS="-I${withval} ${CPPFLAGS}"
919 # Patch up SSL libraries for GSI authentication as needed
920 if test "x$globus_flavor_type" != "xno" ; then
922 # For Globus 2, always link with the static libraries
925 libssl_utils="${gsi_path}/lib/libglobus_ssl_utils_${globus_flavor_type}.a"
928 # Trouble arrives at GT 2.1.3+ with the reorg of globus_ssl_utils. Compensating for
929 # the new library linking required here through file tests to see which libraries to
933 libgsi_proxy_core="${gsi_path}/lib/libglobus_gsi_proxy_core_${globus_flavor_type}.a"
934 libgsi_credential="${gsi_path}/lib/libglobus_gsi_credential_${globus_flavor_type}.a"
935 libgsi_callback="${gsi_path}/lib/libglobus_gsi_callback_${globus_flavor_type}.a"
936 liboldgaa="${gsi_path}/lib/libglobus_oldgaa_${globus_flavor_type}.a"
937 libgsi_sysconfig="${gsi_path}/lib/libglobus_gsi_sysconfig_${globus_flavor_type}.a"
938 libproxy_ssl="${gsi_path}/lib/libglobus_proxy_ssl_${globus_flavor_type}.a"
939 libgsi_cert_utils="${gsi_path}/lib/libglobus_gsi_cert_utils_${globus_flavor_type}.a"
940 libopenssl_error="${gsi_path}/lib/libglobus_openssl_error_${globus_flavor_type}.a"
941 libopenssl="${gsi_path}/lib/libglobus_openssl_${globus_flavor_type}.a"
943 if test -r ${libgsi_proxy_core} \
944 -a -r ${libgsi_credential} \
945 -a -r ${libgsi_callback} \
947 -a -r ${libgsi_sysconfig} \
948 -a -r ${libproxy_ssl} \
949 -a -r ${libgsi_cert_utils} \
950 -a -r ${libopenssl_error} \
951 -a -r ${libopenssl} ; then
952 LIBS="$LIBS ${libgsi_proxy_core}"
953 LIBS="$LIBS ${libgsi_credential}"
954 LIBS="$LIBS ${libgsi_callback}"
955 LIBS="$LIBS ${liboldgaa}"
956 LIBS="$LIBS ${libgsi_sysconfig}"
957 LIBS="$LIBS ${libproxy_ssl}"
958 LIBS="$LIBS ${libgsi_cert_utils}"
959 LIBS="$LIBS ${libopenssl_error}"
960 LIBS="$LIBS ${libopenssl}"
961 elif test -r ${libssl_utils}; then
962 LIBS="$LIBS ${libssl_utils}"
964 AC_MSG_ERROR([*** missing one or more Globus GSI libraries])
967 AC_MSG_CHECKING(for Globus GSI libraries)
975 AC_MSG_ERROR([*** missing one or more Globus GSI libraries])
980 # Standard openssl libraries. They need to appear near the end of the link line.
983 LIBS="$LIBS ${gsi_path}/lib/libssl_${globus_flavor_type}.a"
984 LIBS="$LIBS ${gsi_path}/lib/libcrypto_${globus_flavor_type}.a"
986 AC_MSG_CHECKING(for Globus OpenSSL libraries)
994 AC_MSG_ERROR([*** missing one or more Globus OpenSSL libraries])
999 # Another "GT 2.1.3+"ism.
1002 libcommon_path="${gsi_path}/lib/libglobus_common_${globus_flavor_type}.a"
1003 if test -r ${libcommon_path}; then
1004 LIBS="$LIBS ${libcommon_path}"
1005 AC_MSG_CHECKING(for libglobus_common)
1013 AC_MSG_ERROR([*** libglobus_common missing])
1018 if test "x$gsi_path" != "xno" ; then
1019 # Older GSI needs -lssl too
1020 LIBS="$LIBS -lssl -lcrypto"
1021 else # if no GSI authentication (i.e., OpenSSL default)
1022 LIBS="$LIBS -lcrypto"
1024 fi # globus_flavor_type
1026 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1028 dnl Check default openssl install dir
1029 if test -n "${need_dash_r}"; then
1030 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1032 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1034 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1035 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1037 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1043 # Determine OpenSSL header version
1044 AC_MSG_CHECKING([OpenSSL header version])
1049 #include <openssl/opensslv.h>
1050 #define DATA "conftest.sslincver"
1055 fd = fopen(DATA,"w");
1059 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1066 ssl_header_ver=`cat conftest.sslincver`
1067 AC_MSG_RESULT($ssl_header_ver)
1070 AC_MSG_RESULT(not found)
1071 AC_MSG_ERROR(OpenSSL version header not found.)
1075 # Determine OpenSSL library version
1076 AC_MSG_CHECKING([OpenSSL library version])
1081 #include <openssl/opensslv.h>
1082 #include <openssl/crypto.h>
1083 #define DATA "conftest.ssllibver"
1088 fd = fopen(DATA,"w");
1092 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1099 ssl_library_ver=`cat conftest.ssllibver`
1100 AC_MSG_RESULT($ssl_library_ver)
1103 AC_MSG_RESULT(not found)
1104 AC_MSG_ERROR(OpenSSL library not found.)
1108 # Sanity check OpenSSL headers
1109 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1113 #include <openssl/opensslv.h>
1114 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1121 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
1125 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1126 # version in OpenSSL. Skip this for PAM
1127 if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
1128 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1132 ### Configure cryptographic random number support
1134 # Check wheter OpenSSL seeds itself
1135 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1139 #include <openssl/rand.h>
1140 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1143 OPENSSL_SEEDS_ITSELF=yes
1148 # Default to use of the rand helper if OpenSSL doesn't
1155 # Do we want to force the use of the rand helper?
1156 AC_ARG_WITH(rand-helper,
1157 [ --with-rand-helper Use subprocess to gather strong randomness ],
1159 if test "x$withval" = "xno" ; then
1160 # Force use of OpenSSL's internal RNG, even if
1161 # the previous test showed it to be unseeded.
1162 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1163 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1164 OPENSSL_SEEDS_ITSELF=yes
1173 # Which randomness source do we use?
1174 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1176 AC_DEFINE(OPENSSL_PRNG_ONLY)
1177 RAND_MSG="OpenSSL internal ONLY"
1178 INSTALL_SSH_RAND_HELPER=""
1179 elif test ! -z "$USE_RAND_HELPER" ; then
1180 # install rand helper
1181 RAND_MSG="ssh-rand-helper"
1182 INSTALL_SSH_RAND_HELPER="yes"
1184 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1186 ### Configuration of ssh-rand-helper
1189 AC_ARG_WITH(prngd-port,
1190 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1199 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1202 if test ! -z "$withval" ; then
1203 PRNGD_PORT="$withval"
1204 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1209 # PRNGD Unix domain socket
1210 AC_ARG_WITH(prngd-socket,
1211 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1215 withval="/var/run/egd-pool"
1223 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1227 if test ! -z "$withval" ; then
1228 if test ! -z "$PRNGD_PORT" ; then
1229 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1231 if test ! -r "$withval" ; then
1232 AC_MSG_WARN(Entropy socket is not readable)
1234 PRNGD_SOCKET="$withval"
1235 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1239 # Check for existing socket only if we don't have a random device already
1240 if test "$USE_RAND_HELPER" = yes ; then
1241 AC_MSG_CHECKING(for PRNGD/EGD socket)
1242 # Insert other locations here
1243 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1244 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1245 PRNGD_SOCKET="$sock"
1246 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1250 if test ! -z "$PRNGD_SOCKET" ; then
1251 AC_MSG_RESULT($PRNGD_SOCKET)
1253 AC_MSG_RESULT(not found)
1259 # Change default command timeout for hashing entropy source
1261 AC_ARG_WITH(entropy-timeout,
1262 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1264 if test "x$withval" != "xno" ; then
1265 entropy_timeout=$withval
1269 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1271 SSH_PRIVSEP_USER=sshd
1272 AC_ARG_WITH(privsep-user,
1273 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1275 if test -n "$withval"; then
1276 SSH_PRIVSEP_USER=$withval
1280 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1281 AC_SUBST(SSH_PRIVSEP_USER)
1283 # We do this little dance with the search path to insure
1284 # that programs that we select for use by installed programs
1285 # (which may be run by the super-user) come from trusted
1286 # locations before they come from the user's private area.
1287 # This should help avoid accidentally configuring some
1288 # random version of a program in someone's personal bin.
1292 test -h /bin 2> /dev/null && PATH=/usr/bin
1293 test -d /sbin && PATH=$PATH:/sbin
1294 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1295 PATH=$PATH:/etc:$OPATH
1297 # These programs are used by the command hashing source to gather entropy
1298 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1299 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1300 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1301 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1302 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1303 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1304 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1305 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1306 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1307 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1308 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1309 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1310 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1311 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1312 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1313 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1317 # Where does ssh-rand-helper get its randomness from?
1318 INSTALL_SSH_PRNG_CMDS=""
1319 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1320 if test ! -z "$PRNGD_PORT" ; then
1321 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1322 elif test ! -z "$PRNGD_SOCKET" ; then
1323 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1325 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1326 RAND_HELPER_CMDHASH=yes
1327 INSTALL_SSH_PRNG_CMDS="yes"
1330 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1333 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1334 if test ! -z "$SONY" ; then
1335 LIBS="$LIBS -liberty";
1338 # Checks for data types
1339 AC_CHECK_SIZEOF(char, 1)
1340 AC_CHECK_SIZEOF(short int, 2)
1341 AC_CHECK_SIZEOF(int, 4)
1342 AC_CHECK_SIZEOF(long int, 4)
1343 AC_CHECK_SIZEOF(long long int, 8)
1345 # Sanity check long long for some platforms (AIX)
1346 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1347 ac_cv_sizeof_long_long_int=0
1350 # More checks for data types
1351 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1353 [ #include <sys/types.h> ],
1355 [ ac_cv_have_u_int="yes" ],
1356 [ ac_cv_have_u_int="no" ]
1359 if test "x$ac_cv_have_u_int" = "xyes" ; then
1360 AC_DEFINE(HAVE_U_INT)
1364 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1366 [ #include <sys/types.h> ],
1367 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1368 [ ac_cv_have_intxx_t="yes" ],
1369 [ ac_cv_have_intxx_t="no" ]
1372 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1373 AC_DEFINE(HAVE_INTXX_T)
1377 if (test -z "$have_intxx_t" && \
1378 test "x$ac_cv_header_stdint_h" = "xyes")
1380 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1382 [ #include <stdint.h> ],
1383 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1385 AC_DEFINE(HAVE_INTXX_T)
1388 [ AC_MSG_RESULT(no) ]
1392 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1395 #include <sys/types.h>
1396 #ifdef HAVE_STDINT_H
1397 # include <stdint.h>
1399 #include <sys/socket.h>
1400 #ifdef HAVE_SYS_BITYPES_H
1401 # include <sys/bitypes.h>
1404 [ int64_t a; a = 1;],
1405 [ ac_cv_have_int64_t="yes" ],
1406 [ ac_cv_have_int64_t="no" ]
1409 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1410 AC_DEFINE(HAVE_INT64_T)
1413 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1415 [ #include <sys/types.h> ],
1416 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1417 [ ac_cv_have_u_intxx_t="yes" ],
1418 [ ac_cv_have_u_intxx_t="no" ]
1421 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1422 AC_DEFINE(HAVE_U_INTXX_T)
1426 if test -z "$have_u_intxx_t" ; then
1427 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1429 [ #include <sys/socket.h> ],
1430 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1432 AC_DEFINE(HAVE_U_INTXX_T)
1435 [ AC_MSG_RESULT(no) ]
1439 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1441 [ #include <sys/types.h> ],
1442 [ u_int64_t a; a = 1;],
1443 [ ac_cv_have_u_int64_t="yes" ],
1444 [ ac_cv_have_u_int64_t="no" ]
1447 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1448 AC_DEFINE(HAVE_U_INT64_T)
1452 if test -z "$have_u_int64_t" ; then
1453 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1455 [ #include <sys/bitypes.h> ],
1456 [ u_int64_t a; a = 1],
1458 AC_DEFINE(HAVE_U_INT64_T)
1461 [ AC_MSG_RESULT(no) ]
1465 if test -z "$have_u_intxx_t" ; then
1466 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1469 #include <sys/types.h>
1471 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1472 [ ac_cv_have_uintxx_t="yes" ],
1473 [ ac_cv_have_uintxx_t="no" ]
1476 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1477 AC_DEFINE(HAVE_UINTXX_T)
1481 if test -z "$have_uintxx_t" ; then
1482 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1484 [ #include <stdint.h> ],
1485 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1487 AC_DEFINE(HAVE_UINTXX_T)
1490 [ AC_MSG_RESULT(no) ]
1494 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1495 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1497 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1500 #include <sys/bitypes.h>
1503 int8_t a; int16_t b; int32_t c;
1504 u_int8_t e; u_int16_t f; u_int32_t g;
1505 a = b = c = e = f = g = 1;
1508 AC_DEFINE(HAVE_U_INTXX_T)
1509 AC_DEFINE(HAVE_INTXX_T)
1517 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1520 #include <sys/types.h>
1522 [ u_char foo; foo = 125; ],
1523 [ ac_cv_have_u_char="yes" ],
1524 [ ac_cv_have_u_char="no" ]
1527 if test "x$ac_cv_have_u_char" = "xyes" ; then
1528 AC_DEFINE(HAVE_U_CHAR)
1533 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1535 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1538 #include <sys/types.h>
1540 [ size_t foo; foo = 1235; ],
1541 [ ac_cv_have_size_t="yes" ],
1542 [ ac_cv_have_size_t="no" ]
1545 if test "x$ac_cv_have_size_t" = "xyes" ; then
1546 AC_DEFINE(HAVE_SIZE_T)
1549 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1552 #include <sys/types.h>
1554 [ ssize_t foo; foo = 1235; ],
1555 [ ac_cv_have_ssize_t="yes" ],
1556 [ ac_cv_have_ssize_t="no" ]
1559 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1560 AC_DEFINE(HAVE_SSIZE_T)
1563 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1568 [ clock_t foo; foo = 1235; ],
1569 [ ac_cv_have_clock_t="yes" ],
1570 [ ac_cv_have_clock_t="no" ]
1573 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1574 AC_DEFINE(HAVE_CLOCK_T)
1577 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1580 #include <sys/types.h>
1581 #include <sys/socket.h>
1583 [ sa_family_t foo; foo = 1235; ],
1584 [ ac_cv_have_sa_family_t="yes" ],
1587 #include <sys/types.h>
1588 #include <sys/socket.h>
1589 #include <netinet/in.h>
1591 [ sa_family_t foo; foo = 1235; ],
1592 [ ac_cv_have_sa_family_t="yes" ],
1594 [ ac_cv_have_sa_family_t="no" ]
1598 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1599 AC_DEFINE(HAVE_SA_FAMILY_T)
1602 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1605 #include <sys/types.h>
1607 [ pid_t foo; foo = 1235; ],
1608 [ ac_cv_have_pid_t="yes" ],
1609 [ ac_cv_have_pid_t="no" ]
1612 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1613 AC_DEFINE(HAVE_PID_T)
1616 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1619 #include <sys/types.h>
1621 [ mode_t foo; foo = 1235; ],
1622 [ ac_cv_have_mode_t="yes" ],
1623 [ ac_cv_have_mode_t="no" ]
1626 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1627 AC_DEFINE(HAVE_MODE_T)
1631 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1634 #include <sys/types.h>
1635 #include <sys/socket.h>
1637 [ struct sockaddr_storage s; ],
1638 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1639 [ ac_cv_have_struct_sockaddr_storage="no" ]
1642 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1643 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1646 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1649 #include <sys/types.h>
1650 #include <netinet/in.h>
1652 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1653 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1654 [ ac_cv_have_struct_sockaddr_in6="no" ]
1657 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1658 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1661 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1664 #include <sys/types.h>
1665 #include <netinet/in.h>
1667 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1668 [ ac_cv_have_struct_in6_addr="yes" ],
1669 [ ac_cv_have_struct_in6_addr="no" ]
1672 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1673 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1676 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1679 #include <sys/types.h>
1680 #include <sys/socket.h>
1683 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1684 [ ac_cv_have_struct_addrinfo="yes" ],
1685 [ ac_cv_have_struct_addrinfo="no" ]
1688 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1689 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1692 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1694 [ #include <sys/time.h> ],
1695 [ struct timeval tv; tv.tv_sec = 1;],
1696 [ ac_cv_have_struct_timeval="yes" ],
1697 [ ac_cv_have_struct_timeval="no" ]
1700 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1701 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1702 have_struct_timeval=1
1705 # If we don't have int64_t then we can't compile sftp-server. So don't
1706 # even attempt to do it.
1707 if test "x$ac_cv_have_int64_t" = "xno" -a \
1708 "x$ac_cv_sizeof_long_int" != "x8" -a \
1709 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1712 dnl test snprintf (broken on SCO w/gcc)
1717 #ifdef HAVE_SNPRINTF
1721 char expected_out[50];
1723 #if (SIZEOF_LONG_INT == 8)
1724 long int num = 0x7fffffffffffffff;
1726 long long num = 0x7fffffffffffffffll;
1728 strcpy(expected_out, "9223372036854775807");
1729 snprintf(buf, mazsize, "%lld", num);
1730 if(strcmp(buf, expected_out) != 0)
1737 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1742 dnl Checks for structure members
1743 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1744 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1745 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1746 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1747 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1748 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1749 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1750 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1751 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1752 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1753 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1754 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1755 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1756 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1757 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1758 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1759 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1761 AC_CHECK_MEMBERS([struct stat.st_blksize])
1763 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1764 ac_cv_have_ss_family_in_struct_ss, [
1767 #include <sys/types.h>
1768 #include <sys/socket.h>
1770 [ struct sockaddr_storage s; s.ss_family = 1; ],
1771 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1772 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1775 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1776 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1779 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1780 ac_cv_have___ss_family_in_struct_ss, [
1783 #include <sys/types.h>
1784 #include <sys/socket.h>
1786 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1787 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1788 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1791 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1792 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1795 AC_CACHE_CHECK([for pw_class field in struct passwd],
1796 ac_cv_have_pw_class_in_struct_passwd, [
1801 [ struct passwd p; p.pw_class = 0; ],
1802 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1803 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1806 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1807 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1810 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1811 ac_cv_have_pw_expire_in_struct_passwd, [
1816 [ struct passwd p; p.pw_expire = 0; ],
1817 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1818 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1821 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1822 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1825 AC_CACHE_CHECK([for pw_change field in struct passwd],
1826 ac_cv_have_pw_change_in_struct_passwd, [
1831 [ struct passwd p; p.pw_change = 0; ],
1832 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1833 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1836 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1837 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1840 dnl make sure we're using the real structure members and not defines
1841 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1842 ac_cv_have_accrights_in_msghdr, [
1845 #include <sys/types.h>
1846 #include <sys/socket.h>
1847 #include <sys/uio.h>
1849 #ifdef msg_accrights
1853 m.msg_accrights = 0;
1857 [ ac_cv_have_accrights_in_msghdr="yes" ],
1858 [ ac_cv_have_accrights_in_msghdr="no" ]
1861 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1862 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1865 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1866 ac_cv_have_control_in_msghdr, [
1869 #include <sys/types.h>
1870 #include <sys/socket.h>
1871 #include <sys/uio.h>
1881 [ ac_cv_have_control_in_msghdr="yes" ],
1882 [ ac_cv_have_control_in_msghdr="no" ]
1885 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1886 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1889 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1891 [ extern char *__progname; printf("%s", __progname); ],
1892 [ ac_cv_libc_defines___progname="yes" ],
1893 [ ac_cv_libc_defines___progname="no" ]
1896 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1897 AC_DEFINE(HAVE___PROGNAME)
1900 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1904 [ printf("%s", __FUNCTION__); ],
1905 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1906 [ ac_cv_cc_implements___FUNCTION__="no" ]
1909 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1910 AC_DEFINE(HAVE___FUNCTION__)
1913 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1917 [ printf("%s", __func__); ],
1918 [ ac_cv_cc_implements___func__="yes" ],
1919 [ ac_cv_cc_implements___func__="no" ]
1922 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1923 AC_DEFINE(HAVE___func__)
1926 AC_CACHE_CHECK([whether getopt has optreset support],
1927 ac_cv_have_getopt_optreset, [
1932 [ extern int optreset; optreset = 0; ],
1933 [ ac_cv_have_getopt_optreset="yes" ],
1934 [ ac_cv_have_getopt_optreset="no" ]
1937 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1938 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1941 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1943 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1944 [ ac_cv_libc_defines_sys_errlist="yes" ],
1945 [ ac_cv_libc_defines_sys_errlist="no" ]
1948 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1949 AC_DEFINE(HAVE_SYS_ERRLIST)
1953 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1955 [ extern int sys_nerr; printf("%i", sys_nerr);],
1956 [ ac_cv_libc_defines_sys_nerr="yes" ],
1957 [ ac_cv_libc_defines_sys_nerr="no" ]
1960 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1961 AC_DEFINE(HAVE_SYS_NERR)
1966 # Check whether user wants sectok support
1968 [ --with-sectok Enable smartcard support using libsectok],
1970 if test "x$withval" != "xno" ; then
1971 if test "x$withval" != "xyes" ; then
1972 CPPFLAGS="$CPPFLAGS -I${withval}"
1973 LDFLAGS="$LDFLAGS -L${withval}"
1974 if test ! -z "$need_dash_r" ; then
1975 LDFLAGS="$LDFLAGS -R${withval}"
1977 if test ! -z "$blibpath" ; then
1978 blibpath="$blibpath:${withval}"
1981 AC_CHECK_HEADERS(sectok.h)
1982 if test "$ac_cv_header_sectok_h" != yes; then
1983 AC_MSG_ERROR(Can't find sectok.h)
1985 AC_CHECK_LIB(sectok, sectok_open)
1986 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1987 AC_MSG_ERROR(Can't find libsectok)
1989 AC_DEFINE(SMARTCARD)
1990 AC_DEFINE(USE_SECTOK)
1991 SCARD_MSG="yes, using sectok"
1996 # Check whether user wants OpenSC support
1998 AC_HELP_STRING([--with-opensc=PFX],
1999 [Enable smartcard support using OpenSC]),
2000 opensc_config_prefix="$withval", opensc_config_prefix="")
2001 if test x$opensc_config_prefix != x ; then
2002 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2003 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2004 if test "$OPENSC_CONFIG" != "no"; then
2005 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2006 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2007 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2008 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2009 AC_DEFINE(SMARTCARD)
2010 AC_DEFINE(USE_OPENSC)
2011 SCARD_MSG="yes, using OpenSC"
2015 # Check whether user wants Kerberos 5 support
2017 AC_ARG_WITH(kerberos5,
2018 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2020 if test "x$withval" != "xno" ; then
2021 if test "x$withval" = "xyes" ; then
2022 KRB5ROOT="/usr/local"
2026 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2027 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2030 AC_MSG_CHECKING(whether we are using Heimdal)
2031 AC_TRY_COMPILE([ #include <krb5.h> ],
2032 [ char *tmp = heimdal_version; ],
2033 [ AC_MSG_RESULT(yes)
2035 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2038 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2041 if test ! -z "$need_dash_r" ; then
2042 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2044 if test ! -z "$blibpath" ; then
2045 blibpath="$blibpath:${KRB5ROOT}/lib"
2047 AC_CHECK_LIB(resolv, dn_expand, , )
2049 # If we're using some other GSSAPI
2050 if test "$GSSAPI" -a "$GSSAPI" != "mechglue"; then
2051 AC_MSG_ERROR([$GSSAPI GSSAPI library conflicts with Kerberos support. Use mechglue instead.])
2053 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2055 K5LIBS="-lgssapi $K5LIBS" ],
2056 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2058 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2059 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2064 AC_CHECK_HEADER(gssapi.h, ,
2065 [ unset ac_cv_header_gssapi_h
2066 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2067 AC_CHECK_HEADERS(gssapi.h, ,
2068 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2073 AC_CHECK_LIB(gssapi, gss_krb5_copy_ccache, /bin/true,
2074 [ K5LIBS="-lgssapi_krb5 $K5LIBS"
2075 AC_CHECK_LIB(gssapi_krb5, gss_krb5_copy_ccache, /bin/true,
2076 AC_MSG_WARN([Cannot find gss_krb5_copy_ccache -- build may fail]),
2082 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2083 AC_CHECK_HEADER(gssapi_krb5.h, ,
2084 [ CPPFLAGS="$oldCPP" ])
2086 if test -z "$GSSAPI"; then
2094 # Check whether user wants Kerberos 4 support
2096 AC_ARG_WITH(kerberos4,
2097 [ --with-kerberos4=PATH Enable Kerberos 4 support],
2099 if test "x$withval" != "xno" ; then
2100 if test "x$withval" != "xyes" ; then
2101 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2102 LDFLAGS="$LDFLAGS -L${withval}/lib"
2103 if test ! -z "$need_dash_r" ; then
2104 LDFLAGS="$LDFLAGS -R${withval}/lib"
2106 if test ! -z "$blibpath" ; then
2107 blibpath="$blibpath:${withval}/lib"
2110 if test -d /usr/include/kerberosIV ; then
2111 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
2115 AC_CHECK_HEADERS(krb.h)
2116 if test "$ac_cv_header_krb_h" != yes; then
2117 AC_MSG_WARN([Cannot find krb.h, build may fail])
2119 AC_CHECK_LIB(krb, main)
2120 if test "$ac_cv_lib_krb_main" != yes; then
2121 AC_CHECK_LIB(krb4, main)
2122 if test "$ac_cv_lib_krb4_main" != yes; then
2123 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
2130 AC_CHECK_LIB(des, des_cbc_encrypt)
2131 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
2132 AC_CHECK_LIB(des425, des_cbc_encrypt)
2133 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
2134 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
2141 AC_CHECK_LIB(resolv, dn_expand, , )
2149 # Check whether user wants AFS support
2152 [ --with-afs=PATH Enable AFS support],
2154 if test "x$withval" != "xno" ; then
2156 if test "x$withval" != "xyes" ; then
2157 CPPFLAGS="$CPPFLAGS -I${withval}/include"
2158 LDFLAGS="$LDFLAGS -L${withval}/lib"
2161 if test -z "$KRB4" ; then
2162 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
2166 if test ! -z "$AFS_LIBS" ; then
2167 LIBS="$LIBS $AFS_LIBS"
2174 LIBS="$LIBS $KLIBS $K5LIBS"
2176 # Looking for programs, paths and files
2178 PRIVSEP_PATH=/var/empty
2179 AC_ARG_WITH(privsep-path,
2180 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2182 if test "x$withval" != "$no" ; then
2183 PRIVSEP_PATH=$withval
2187 AC_SUBST(PRIVSEP_PATH)
2190 [ --with-xauth=PATH Specify path to xauth program ],
2192 if test "x$withval" != "xno" ; then
2198 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2199 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2200 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2201 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2202 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2203 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2204 xauth_path="/usr/openwin/bin/xauth"
2209 if test -z "$xauth_path" ; then
2210 XAUTH_PATH="undefined"
2211 AC_SUBST(XAUTH_PATH)
2213 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2214 XAUTH_PATH=$xauth_path
2215 AC_SUBST(XAUTH_PATH)
2218 # Check for mail directory (last resort if we cannot get it from headers)
2219 if test ! -z "$MAIL" ; then
2220 maildir=`dirname $MAIL`
2221 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2224 if test -z "$no_dev_ptmx" ; then
2225 if test "x$disable_ptmx_check" != "xyes" ; then
2226 AC_CHECK_FILE("/dev/ptmx",
2228 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2234 AC_CHECK_FILE("/dev/ptc",
2236 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2241 # Options from here on. Some of these are preset by platform above
2242 AC_ARG_WITH(mantype,
2243 [ --with-mantype=man|cat|doc Set man page type],
2250 AC_MSG_ERROR(invalid man type: $withval)
2255 if test -z "$MANTYPE"; then
2256 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2257 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2258 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2260 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2267 if test "$MANTYPE" = "doc"; then
2274 # Check whether to enable MD5 passwords
2276 AC_ARG_WITH(md5-passwords,
2277 [ --with-md5-passwords Enable use of MD5 passwords],
2279 if test "x$withval" != "xno" ; then
2280 AC_DEFINE(HAVE_MD5_PASSWORDS)
2286 # Whether to disable shadow password support
2288 [ --without-shadow Disable shadow password support],
2290 if test "x$withval" = "xno" ; then
2291 AC_DEFINE(DISABLE_SHADOW)
2297 if test -z "$disable_shadow" ; then
2298 AC_MSG_CHECKING([if the systems has expire shadow information])
2301 #include <sys/types.h>
2304 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2305 [ sp_expire_available=yes ], []
2308 if test "x$sp_expire_available" = "xyes" ; then
2310 AC_DEFINE(HAS_SHADOW_EXPIRE)
2316 # Use ip address instead of hostname in $DISPLAY
2317 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2318 DISPLAY_HACK_MSG="yes"
2319 AC_DEFINE(IPADDR_IN_DISPLAY)
2321 DISPLAY_HACK_MSG="no"
2322 AC_ARG_WITH(ipaddr-display,
2323 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2325 if test "x$withval" != "xno" ; then
2326 AC_DEFINE(IPADDR_IN_DISPLAY)
2327 DISPLAY_HACK_MSG="yes"
2333 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2334 if test $ac_cv_func_login_getcapbool = "yes" -a \
2335 $ac_cv_header_login_cap_h = "yes" ; then
2338 # Whether to mess with the default path
2339 SERVER_PATH_MSG="(default)"
2340 AC_ARG_WITH(default-path,
2341 [ --with-default-path= Specify default \$PATH environment for server],
2343 if test "$USES_LOGIN_CONF" = "yes" ; then
2345 --with-default-path=PATH has no effect on this system.
2346 Edit /etc/login.conf instead.])
2347 elif test "x$withval" != "xno" ; then
2348 user_path="$withval"
2349 SERVER_PATH_MSG="$withval"
2352 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2353 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2357 /* find out what STDPATH is */
2362 #ifndef _PATH_STDPATH
2363 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2365 #include <sys/types.h>
2366 #include <sys/stat.h>
2368 #define DATA "conftest.stdpath"
2375 fd = fopen(DATA,"w");
2379 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2384 ], [ user_path=`cat conftest.stdpath` ],
2385 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2386 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2390 if test "$USES_LOGIN_CONF" != "yes" ; then
2391 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2395 # Set superuser path separately to user path
2396 AC_ARG_WITH(superuser-path,
2397 [ --with-superuser-path= Specify different path for super-user],
2399 if test "x$withval" != "xno" ; then
2400 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2401 superuser_path=$withval
2407 # Whether to force IPv4 by default (needed on broken glibc Linux)
2409 AC_ARG_WITH(ipv4-default,
2410 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2412 if test "x$withval" != "xno" ; then
2413 AC_DEFINE(IPV4_DEFAULT)
2419 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2420 IPV4_IN6_HACK_MSG="no"
2422 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2424 if test "x$withval" != "xno" ; then
2426 AC_DEFINE(IPV4_IN_IPV6)
2427 IPV4_IN6_HACK_MSG="yes"
2432 if test "x$inet6_default_4in6" = "xyes"; then
2433 AC_MSG_RESULT([yes (default)])
2434 AC_DEFINE(IPV4_IN_IPV6)
2435 IPV4_IN6_HACK_MSG="yes"
2437 AC_MSG_RESULT([no (default)])
2442 # Whether to enable BSD auth support
2444 AC_ARG_WITH(bsd-auth,
2445 [ --with-bsd-auth Enable BSD auth support],
2447 if test "x$withval" != "xno" ; then
2454 # Where to place sshd.pid
2456 # make sure the directory exists
2457 if test ! -d $piddir ; then
2458 piddir=`eval echo ${sysconfdir}`
2460 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2464 AC_ARG_WITH(pid-dir,
2465 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2467 if test "x$withval" != "xno" ; then
2469 if test ! -d $piddir ; then
2470 AC_MSG_WARN([** no $piddir directory on this system **])
2476 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2479 dnl allow user to disable some login recording features
2480 AC_ARG_ENABLE(lastlog,
2481 [ --disable-lastlog disable use of lastlog even if detected [no]],
2482 [ AC_DEFINE(DISABLE_LASTLOG) ]
2485 [ --disable-utmp disable use of utmp even if detected [no]],
2486 [ AC_DEFINE(DISABLE_UTMP) ]
2488 AC_ARG_ENABLE(utmpx,
2489 [ --disable-utmpx disable use of utmpx even if detected [no]],
2490 [ AC_DEFINE(DISABLE_UTMPX) ]
2493 [ --disable-wtmp disable use of wtmp even if detected [no]],
2494 [ AC_DEFINE(DISABLE_WTMP) ]
2496 AC_ARG_ENABLE(wtmpx,
2497 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2498 [ AC_DEFINE(DISABLE_WTMPX) ]
2500 AC_ARG_ENABLE(libutil,
2501 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2502 [ AC_DEFINE(DISABLE_LOGIN) ]
2504 AC_ARG_ENABLE(pututline,
2505 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2506 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2508 AC_ARG_ENABLE(pututxline,
2509 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2510 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2512 AC_ARG_WITH(lastlog,
2513 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2515 if test "x$withval" = "xno" ; then
2516 AC_DEFINE(DISABLE_LASTLOG)
2518 conf_lastlog_location=$withval
2523 dnl lastlog, [uw]tmpx? detection
2524 dnl NOTE: set the paths in the platform section to avoid the
2525 dnl need for command-line parameters
2526 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2528 dnl lastlog detection
2529 dnl NOTE: the code itself will detect if lastlog is a directory
2530 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2532 #include <sys/types.h>
2534 #ifdef HAVE_LASTLOG_H
2535 # include <lastlog.h>
2544 [ char *lastlog = LASTLOG_FILE; ],
2545 [ AC_MSG_RESULT(yes) ],
2548 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2550 #include <sys/types.h>
2552 #ifdef HAVE_LASTLOG_H
2553 # include <lastlog.h>
2559 [ char *lastlog = _PATH_LASTLOG; ],
2560 [ AC_MSG_RESULT(yes) ],
2563 system_lastlog_path=no
2568 if test -z "$conf_lastlog_location"; then
2569 if test x"$system_lastlog_path" = x"no" ; then
2570 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2571 if (test -d "$f" || test -f "$f") ; then
2572 conf_lastlog_location=$f
2575 if test -z "$conf_lastlog_location"; then
2576 AC_MSG_WARN([** Cannot find lastlog **])
2577 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2582 if test -n "$conf_lastlog_location"; then
2583 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2587 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2589 #include <sys/types.h>
2595 [ char *utmp = UTMP_FILE; ],
2596 [ AC_MSG_RESULT(yes) ],
2598 system_utmp_path=no ]
2600 if test -z "$conf_utmp_location"; then
2601 if test x"$system_utmp_path" = x"no" ; then
2602 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2603 if test -f $f ; then
2604 conf_utmp_location=$f
2607 if test -z "$conf_utmp_location"; then
2608 AC_DEFINE(DISABLE_UTMP)
2612 if test -n "$conf_utmp_location"; then
2613 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2617 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2619 #include <sys/types.h>
2625 [ char *wtmp = WTMP_FILE; ],
2626 [ AC_MSG_RESULT(yes) ],
2628 system_wtmp_path=no ]
2630 if test -z "$conf_wtmp_location"; then
2631 if test x"$system_wtmp_path" = x"no" ; then
2632 for f in /usr/adm/wtmp /var/log/wtmp; do
2633 if test -f $f ; then
2634 conf_wtmp_location=$f
2637 if test -z "$conf_wtmp_location"; then
2638 AC_DEFINE(DISABLE_WTMP)
2642 if test -n "$conf_wtmp_location"; then
2643 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2647 dnl utmpx detection - I don't know any system so perverse as to require
2648 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2650 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2652 #include <sys/types.h>
2661 [ char *utmpx = UTMPX_FILE; ],
2662 [ AC_MSG_RESULT(yes) ],
2664 system_utmpx_path=no ]
2666 if test -z "$conf_utmpx_location"; then
2667 if test x"$system_utmpx_path" = x"no" ; then
2668 AC_DEFINE(DISABLE_UTMPX)
2671 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2675 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2677 #include <sys/types.h>
2686 [ char *wtmpx = WTMPX_FILE; ],
2687 [ AC_MSG_RESULT(yes) ],
2689 system_wtmpx_path=no ]
2691 if test -z "$conf_wtmpx_location"; then
2692 if test x"$system_wtmpx_path" = x"no" ; then
2693 AC_DEFINE(DISABLE_WTMPX)
2696 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2700 if test ! -z "$blibpath" ; then
2701 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2702 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2705 dnl remove pam and dl because they are in $LIBPAM
2706 if test "$PAM_MSG" = yes ; then
2707 LIBS=`echo $LIBS | sed 's/-lpam //'`
2709 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2710 LIBS=`echo $LIBS | sed 's/-ldl //'`
2714 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2717 # Print summary of options
2719 # Someone please show me a better way :)
2720 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2721 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2722 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2723 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2724 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2725 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2726 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2727 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2728 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2729 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2732 echo "OpenSSH has been configured with the following options:"
2733 echo " User binaries: $B"
2734 echo " System binaries: $C"
2735 echo " Configuration files: $D"
2736 echo " Askpass program: $E"
2737 echo " Manual pages: $F"
2738 echo " PID file: $G"
2739 echo " Privilege separation chroot path: $H"
2740 if test "$USES_LOGIN_CONF" = "yes" ; then
2741 echo " At runtime, sshd will use the path defined in /etc/login.conf"
2743 echo " sshd default user PATH: $I"
2745 if test ! -z "$superuser_path" ; then
2746 echo " sshd superuser user PATH: $J"
2748 echo " Manpage format: $MANTYPE"
2749 echo " PAM support: ${PAM_MSG}"
2750 echo " KerberosIV support: $KRB4_MSG"
2751 echo " KerberosV support: $KRB5_MSG"
2752 echo " Smartcard support: $SCARD_MSG"
2753 echo " AFS support: $AFS_MSG"
2754 echo " S/KEY support: $SKEY_MSG"
2755 echo " TCP Wrappers support: $TCPW_MSG"
2756 echo " MD5 password support: $MD5_MSG"
2757 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2758 echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2759 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2760 echo " BSD Auth support: $BSD_AUTH_MSG"
2761 echo " Random number source: $RAND_MSG"
2762 if test ! -z "$USE_RAND_HELPER" ; then
2763 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2768 echo " Host: ${host}"
2769 echo " Compiler: ${CC}"
2770 echo " Compiler flags: ${CFLAGS}"
2771 echo "Preprocessor flags: ${CPPFLAGS}"
2772 echo " Linker flags: ${LDFLAGS}"
2773 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2777 if test "x$PAM_MSG" = "xyes" ; then
2778 echo "PAM is enabled. You may need to install a PAM control file "
2779 echo "for sshd, otherwise password authentication may fail. "
2780 echo "Example PAM control files can be found in the contrib/ "
2785 if test ! -z "$NO_SFTP"; then
2786 echo "sftp-server will be disabled. Your compiler does not "
2787 echo "support 64bit integers."
2791 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2792 echo "WARNING: you are using the builtin random number collection "
2793 echo "service. Please read WARNING.RNG and request that your OS "
2794 echo "vendor includes kernel-based random number collection in "
2795 echo "future versions of your OS."