4 AC_CONFIG_SRCDIR([ssh.c])
6 AC_CONFIG_HEADER(config.h)
11 # Checks for programs.
17 AC_PATH_PROGS(PERL, perl5 perl)
18 AC_PATH_PROG(SED, sed)
20 AC_PATH_PROG(ENT, ent)
22 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
23 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
24 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
30 if test -z "$AR" ; then
31 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
34 # Use LOGIN_PROGRAM from environment if possible
35 if test ! -z "$LOGIN_PROGRAM" ; then
36 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
39 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
40 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
41 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
45 if test -z "$LD" ; then
51 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
52 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
55 # Check for some target-specific stuff
58 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
59 LDFLAGS="$LDFLAGS -L/usr/local/lib"
60 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
61 if (test -z "$blibpath"); then
62 blibpath="/usr/lib:/lib:/usr/local/lib"
64 saved_LDFLAGS="$LDFLAGS"
65 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
66 if (test -z "$blibflags"); then
67 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
68 AC_TRY_LINK([], [], [blibflags=$tryflags])
71 if (test -z "$blibflags"); then
72 AC_MSG_RESULT(not found)
73 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
75 AC_MSG_RESULT($blibflags)
77 LDFLAGS="$saved_LDFLAGS"
78 dnl Check for authenticate. Might be in libs.a on older AIXes
79 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
80 [AC_CHECK_LIB(s,authenticate,
81 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
85 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
86 AC_CHECK_DECL(loginfailed,
87 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
89 [#include <usersec.h>],
90 [(void)loginfailed("user","host","tty",0);],
92 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
96 [#include <usersec.h>]
98 AC_CHECK_FUNCS(setauthdb)
99 AC_DEFINE(BROKEN_GETADDRINFO)
100 AC_DEFINE(BROKEN_REALPATH)
101 AC_DEFINE(SETEUID_BREAKS_SETUID)
102 AC_DEFINE(BROKEN_SETREUID)
103 AC_DEFINE(BROKEN_SETREGID)
104 dnl AIX handles lastlog as part of its login message
105 AC_DEFINE(DISABLE_LASTLOG)
106 AC_DEFINE(LOGIN_NEEDS_UTMPX)
107 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
110 check_for_libcrypt_later=1
111 LIBS="$LIBS /usr/lib/textmode.o"
112 AC_DEFINE(HAVE_CYGWIN)
114 AC_DEFINE(DISABLE_SHADOW)
115 AC_DEFINE(IP_TOS_IS_BROKEN)
116 AC_DEFINE(NO_X11_UNIX_SOCKETS)
117 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
118 AC_DEFINE(DISABLE_FD_PASSING)
119 AC_DEFINE(SETGROUPS_NOOP)
122 AC_DEFINE(IP_TOS_IS_BROKEN)
125 AC_MSG_CHECKING(if we have working getaddrinfo)
126 AC_TRY_RUN([#include <mach-o/dyld.h>
127 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
131 }], [AC_MSG_RESULT(working)],
132 [AC_MSG_RESULT(buggy)
133 AC_DEFINE(BROKEN_GETADDRINFO)],
134 AC_DEFINE(SETEUID_BREAKS_SETUID)
135 AC_DEFINE(BROKEN_SETREUID)
136 AC_DEFINE(BROKEN_SETREGID)
137 [AC_MSG_RESULT(assume it is working)])
140 if test -z "$GCC"; then
143 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
144 IPADDR_IN_DISPLAY=yes
145 AC_DEFINE(HAVE_SECUREWARE)
147 AC_DEFINE(LOGIN_NO_ENDOPT)
148 AC_DEFINE(LOGIN_NEEDS_UTMPX)
149 AC_DEFINE(DISABLE_SHADOW)
150 AC_DEFINE(DISABLE_UTMP)
151 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
152 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
153 LIBS="$LIBS -lsec -lsecpw"
154 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
155 disable_ptmx_check=yes
158 if test -z "$GCC"; then
161 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
162 IPADDR_IN_DISPLAY=yes
164 AC_DEFINE(LOGIN_NO_ENDOPT)
165 AC_DEFINE(LOGIN_NEEDS_UTMPX)
166 AC_DEFINE(DISABLE_SHADOW)
167 AC_DEFINE(DISABLE_UTMP)
168 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
169 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
171 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
174 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
175 IPADDR_IN_DISPLAY=yes
176 AC_DEFINE(PAM_SUN_CODEBASE)
178 AC_DEFINE(LOGIN_NO_ENDOPT)
179 AC_DEFINE(LOGIN_NEEDS_UTMPX)
180 AC_DEFINE(DISABLE_SHADOW)
181 AC_DEFINE(DISABLE_UTMP)
182 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
183 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
185 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
188 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
190 PATH="$PATH:/usr/etc"
191 AC_DEFINE(BROKEN_INET_NTOA)
192 AC_DEFINE(WITH_ABBREV_NO_TTY)
193 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
196 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
198 PATH="$PATH:/usr/etc"
199 AC_DEFINE(WITH_IRIX_ARRAY)
200 AC_DEFINE(WITH_IRIX_PROJECT)
201 AC_DEFINE(WITH_IRIX_AUDIT)
202 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
203 AC_DEFINE(BROKEN_INET_NTOA)
204 AC_DEFINE(WITH_ABBREV_NO_TTY)
205 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
209 check_for_libcrypt_later=1
210 check_for_openpty_ctty_bug=1
211 AC_DEFINE(DONT_TRY_OTHER_AF)
212 AC_DEFINE(PAM_TTY_KLUDGE)
213 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!!")
214 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
215 inet6_default_4in6=yes
218 AC_DEFINE(BROKEN_CMSG_TYPE)
222 mips-sony-bsd|mips-sony-newsos4)
223 AC_DEFINE(HAVE_NEWS4)
227 check_for_libcrypt_before=1
231 check_for_libcrypt_later=1
234 AC_DEFINE(SETEUID_BREAKS_SETUID)
235 AC_DEFINE(BROKEN_SETREUID)
236 AC_DEFINE(BROKEN_SETREGID)
239 conf_lastlog_location="/usr/adm/lastlog"
240 conf_utmp_location=/etc/utmp
241 conf_wtmp_location=/usr/adm/wtmp
244 AC_DEFINE(BROKEN_REALPATH)
246 AC_DEFINE(BROKEN_SAVED_UIDS)
247 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
251 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
252 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
254 AC_DEFINE(PAM_SUN_CODEBASE)
255 AC_DEFINE(LOGIN_NEEDS_UTMPX)
256 AC_DEFINE(LOGIN_NEEDS_TERM)
257 AC_DEFINE(PAM_TTY_KLUDGE)
258 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
259 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
260 AC_DEFINE(SSHD_ACQUIRES_CTTY)
261 external_path_file=/etc/default/login
262 # hardwire lastlog location (can't detect it on some versions)
263 conf_lastlog_location="/var/adm/lastlog"
264 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
265 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
266 if test "$sol2ver" -ge 8; then
268 AC_DEFINE(DISABLE_UTMP)
269 AC_DEFINE(DISABLE_WTMP)
275 CPPFLAGS="$CPPFLAGS -DSUNOS4"
276 AC_CHECK_FUNCS(getpwanam)
277 AC_DEFINE(PAM_SUN_CODEBASE)
278 conf_utmp_location=/etc/utmp
279 conf_wtmp_location=/var/adm/wtmp
280 conf_lastlog_location=/var/adm/lastlog
284 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
285 LDFLAGS="$LDFLAGS -L/usr/local/lib"
288 AC_DEFINE(SSHD_ACQUIRES_CTTY)
289 AC_DEFINE(SETEUID_BREAKS_SETUID)
290 AC_DEFINE(BROKEN_SETREUID)
291 AC_DEFINE(BROKEN_SETREGID)
294 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
295 # /usr/ucblib MUST NOT be searched on ReliantUNIX
296 LDFLAGS="$LDFLAGS -L/usr/local/lib"
297 IPADDR_IN_DISPLAY=yes
299 AC_DEFINE(IP_TOS_IS_BROKEN)
300 AC_DEFINE(SSHD_ACQUIRES_CTTY)
301 external_path_file=/etc/default/login
302 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
303 # Attention: always take care to bind libsocket and libnsl before libc,
304 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
307 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
308 LDFLAGS="$LDFLAGS -L/usr/local/lib"
310 AC_DEFINE(SETEUID_BREAKS_SETUID)
311 AC_DEFINE(BROKEN_SETREUID)
312 AC_DEFINE(BROKEN_SETREGID)
315 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
316 LDFLAGS="$LDFLAGS -L/usr/local/lib"
318 AC_DEFINE(SETEUID_BREAKS_SETUID)
319 AC_DEFINE(BROKEN_SETREUID)
320 AC_DEFINE(BROKEN_SETREGID)
323 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
324 LDFLAGS="$LDFLAGS -L/usr/local/lib"
327 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
328 LDFLAGS="$LDFLAGS -L/usr/local/lib"
329 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
332 AC_DEFINE(BROKEN_SYS_TERMIO_H)
334 AC_DEFINE(HAVE_SECUREWARE)
335 AC_DEFINE(DISABLE_SHADOW)
336 AC_DEFINE(BROKEN_SAVED_UIDS)
337 AC_DEFINE(WITH_ABBREV_NO_TTY)
338 AC_CHECK_FUNCS(getluid setluid)
340 do_sco3_extra_lib_check=yes
343 if test -z "$GCC"; then
344 CFLAGS="$CFLAGS -belf"
346 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
347 LDFLAGS="$LDFLAGS -L/usr/local/lib"
348 LIBS="$LIBS -lprot -lx -ltinfo -lm"
351 AC_DEFINE(HAVE_SECUREWARE)
352 AC_DEFINE(DISABLE_SHADOW)
353 AC_DEFINE(DISABLE_FD_PASSING)
354 AC_DEFINE(SETEUID_BREAKS_SETUID)
355 AC_DEFINE(BROKEN_SETREUID)
356 AC_DEFINE(BROKEN_SETREGID)
357 AC_DEFINE(WITH_ABBREV_NO_TTY)
358 AC_CHECK_FUNCS(getluid setluid)
363 AC_DEFINE(DISABLE_FD_PASSING)
365 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
369 AC_DEFINE(WITH_ABBREV_NO_TTY)
371 AC_DEFINE(DISABLE_FD_PASSING)
373 LIBS="$LIBS -lgen -lacid"
378 AC_DEFINE(DISABLE_FD_PASSING)
379 AC_DEFINE(NO_SSH_LASTLOG)
380 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
381 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
385 AC_MSG_CHECKING(for Digital Unix SIA)
388 [ --with-osfsia Enable Digital Unix SIA],
390 if test "x$withval" = "xno" ; then
391 AC_MSG_RESULT(disabled)
396 if test -z "$no_osfsia" ; then
397 if test -f /etc/sia/matrix.conf; then
399 AC_DEFINE(HAVE_OSF_SIA)
400 AC_DEFINE(DISABLE_LOGIN)
401 AC_DEFINE(DISABLE_FD_PASSING)
402 LIBS="$LIBS -lsecurity -ldb -lm -laud"
407 AC_DEFINE(DISABLE_FD_PASSING)
408 AC_DEFINE(BROKEN_GETADDRINFO)
409 AC_DEFINE(SETEIUD_BREAKS_SETUID)
410 AC_DEFINE(BROKEN_SETREUID)
411 AC_DEFINE(BROKEN_SETREGID)
412 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
417 AC_DEFINE(NO_X11_UNIX_SOCKETS)
418 AC_DEFINE(MISSING_NFDBITS)
419 AC_DEFINE(MISSING_HOWMANY)
420 AC_DEFINE(MISSING_FD_MASK)
424 # Allow user to specify flags
426 [ --with-cflags Specify additional flags to pass to compiler],
428 if test "x$withval" != "xno" ; then
429 CFLAGS="$CFLAGS $withval"
433 AC_ARG_WITH(cppflags,
434 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
436 if test "x$withval" != "xno"; then
437 CPPFLAGS="$CPPFLAGS $withval"
442 [ --with-ldflags Specify additional flags to pass to linker],
444 if test "x$withval" != "xno" ; then
445 LDFLAGS="$LDFLAGS $withval"
450 [ --with-libs Specify additional libraries to link with],
452 if test "x$withval" != "xno" ; then
453 LIBS="$LIBS $withval"
458 AC_MSG_CHECKING(compiler and flags for sanity)
463 [ AC_MSG_RESULT(yes) ],
466 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
470 # Checks for header files.
471 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
472 getopt.h glob.h ia.h lastlog.h limits.h login.h \
473 login_cap.h maillock.h netdb.h netgroup.h \
474 netinet/in_systm.h paths.h pty.h readpassphrase.h \
475 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
476 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
477 sys/cdefs.h sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
478 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
479 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
480 util.h utime.h utmp.h utmpx.h)
482 # Checks for libraries.
483 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
484 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
486 dnl SCO OS3 needs this for libwrap
487 if test "x$with_tcp_wrappers" != "xno" ; then
488 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
489 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
493 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
494 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
495 AC_CHECK_LIB(gen, dirname,[
496 AC_CACHE_CHECK([for broken dirname],
497 ac_cv_have_broken_dirname, [
505 int main(int argc, char **argv) {
508 strncpy(buf,"/etc", 32);
510 if (!s || strncmp(s, "/", 32) != 0) {
517 [ ac_cv_have_broken_dirname="no" ],
518 [ ac_cv_have_broken_dirname="yes" ]
522 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
524 AC_DEFINE(HAVE_DIRNAME)
525 AC_CHECK_HEADERS(libgen.h)
530 AC_CHECK_FUNC(getspnam, ,
531 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
532 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
535 [ --without-rpath Disable auto-added -R linker paths],
537 if test "x$withval" = "xno" ; then
540 if test "x$withval" = "xyes" ; then
548 [ --with-zlib=PATH Use zlib in PATH],
550 if test "x$withval" = "xno" ; then
551 AC_MSG_ERROR([*** zlib is required ***])
553 if test -d "$withval/lib"; then
554 if test -n "${need_dash_r}"; then
555 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
557 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
560 if test -n "${need_dash_r}"; then
561 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
563 LDFLAGS="-L${withval} ${LDFLAGS}"
566 if test -d "$withval/include"; then
567 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
569 CPPFLAGS="-I${withval} ${CPPFLAGS}"
574 AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
577 AC_CHECK_FUNC(strcasecmp,
578 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
580 AC_CHECK_FUNC(utimes,
581 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
582 LIBS="$LIBS -lc89"]) ]
585 dnl Checks for libutil functions
586 AC_CHECK_HEADERS(libutil.h)
587 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
588 AC_CHECK_FUNCS(logout updwtmp logwtmp)
592 # Check for ALTDIRFUNC glob() extension
593 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
594 AC_EGREP_CPP(FOUNDIT,
597 #ifdef GLOB_ALTDIRFUNC
602 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
610 # Check for g.gl_matchc glob() extension
611 AC_MSG_CHECKING(for gl_matchc field in glob_t)
612 AC_EGREP_CPP(FOUNDIT,
615 int main(void){glob_t g; g.gl_matchc = 1;}
618 AC_DEFINE(GLOB_HAS_GL_MATCHC)
626 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
629 #include <sys/types.h>
631 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
633 [AC_MSG_RESULT(yes)],
636 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
640 # Check whether user wants S/Key support
643 [ --with-skey[[=PATH]] Enable S/Key support
644 (optionally in PATH)],
646 if test "x$withval" != "xno" ; then
648 if test "x$withval" != "xyes" ; then
649 CPPFLAGS="$CPPFLAGS -I${withval}/include"
650 LDFLAGS="$LDFLAGS -L${withval}/lib"
657 AC_MSG_CHECKING([for s/key support])
662 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
664 [AC_MSG_RESULT(yes)],
667 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
673 # Check whether user wants TCP wrappers support
675 AC_ARG_WITH(tcp-wrappers,
676 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
677 (optionally in PATH)],
679 if test "x$withval" != "xno" ; then
681 saved_LDFLAGS="$LDFLAGS"
682 saved_CPPFLAGS="$CPPFLAGS"
683 if test -n "${withval}" -a "${withval}" != "yes"; then
684 if test -d "${withval}/lib"; then
685 if test -n "${need_dash_r}"; then
686 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
688 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
691 if test -n "${need_dash_r}"; then
692 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
694 LDFLAGS="-L${withval} ${LDFLAGS}"
697 if test -d "${withval}/include"; then
698 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
700 CPPFLAGS="-I${withval} ${CPPFLAGS}"
704 LIBS="$LIBWRAP $LIBS"
705 AC_MSG_CHECKING(for libwrap)
709 int deny_severity = 0, allow_severity = 0;
719 AC_MSG_ERROR([*** libwrap missing])
727 dnl Checks for library functions. Please keep in alphabetical order
729 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
730 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
731 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
732 getpeereid _getpty getrlimit getttyent glob inet_aton \
733 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
734 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
735 pstat readpassphrase realpath recvmsg rresvport_af sendmsg \
736 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
737 setproctitle setregid setresgid setresuid setreuid setrlimit \
738 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
739 strlcat strlcpy strmode strnvis sysconf tcgetpgrp \
740 truncate utimes vhangup vsnprintf waitpid \
743 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
745 dnl Make sure prototypes are defined for these before using them.
746 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
747 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
749 dnl tcsendbreak might be a macro
750 AC_CHECK_DECL(tcsendbreak,
751 [AC_DEFINE(HAVE_TCSENDBREAK)],
752 [AC_CHECK_FUNCS(tcsendbreak)],
753 [#include <termios.h>]
756 dnl Checks for time functions
757 AC_CHECK_FUNCS(gettimeofday time)
758 dnl Checks for utmp functions
759 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
760 AC_CHECK_FUNCS(utmpname)
761 dnl Checks for utmpx functions
762 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
763 AC_CHECK_FUNCS(setutxent utmpxname)
765 AC_CHECK_FUNC(daemon,
766 [AC_DEFINE(HAVE_DAEMON)],
767 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
770 AC_CHECK_FUNC(getpagesize,
771 [AC_DEFINE(HAVE_GETPAGESIZE)],
772 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
775 # Check for broken snprintf
776 if test "x$ac_cv_func_snprintf" = "xyes" ; then
777 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
781 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
783 [AC_MSG_RESULT(yes)],
786 AC_DEFINE(BROKEN_SNPRINTF)
787 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
792 dnl see whether mkstemp() requires XXXXXX
793 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
794 AC_MSG_CHECKING([for (overly) strict mkstemp])
798 main() { char template[]="conftest.mkstemp-test";
799 if (mkstemp(template) == -1)
801 unlink(template); exit(0);
809 AC_DEFINE(HAVE_STRICT_MKSTEMP)
813 AC_DEFINE(HAVE_STRICT_MKSTEMP)
818 dnl make sure that openpty does not reacquire controlling terminal
819 if test ! -z "$check_for_openpty_ctty_bug"; then
820 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
824 #include <sys/fcntl.h>
825 #include <sys/types.h>
826 #include <sys/wait.h>
832 int fd, ptyfd, ttyfd, status;
835 if (pid < 0) { /* failed */
837 } else if (pid > 0) { /* parent */
838 waitpid(pid, &status, 0);
839 if (WIFEXITED(status))
840 exit(WEXITSTATUS(status));
844 close(0); close(1); close(2);
846 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
847 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
849 exit(3); /* Acquired ctty: broken */
851 exit(0); /* Did not acquire ctty: OK */
860 AC_DEFINE(SSHD_ACQUIRES_CTTY)
870 [ --with-pam Enable PAM support ],
872 if test "x$withval" != "xno" ; then
873 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
874 AC_MSG_ERROR([PAM headers not found])
877 AC_CHECK_LIB(dl, dlopen, , )
878 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
879 AC_CHECK_FUNCS(pam_getenvlist)
880 AC_CHECK_FUNCS(pam_putenv)
886 if test $ac_cv_lib_dl_dlopen = yes; then
896 # Check for older PAM
897 if test "x$PAM_MSG" = "xyes" ; then
898 # Check PAM strerror arguments (old PAM)
899 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
903 #include <security/pam_appl.h>
905 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
908 AC_DEFINE(HAVE_OLD_PAM)
910 PAM_MSG="yes (old library)"
915 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
916 # because the system crypt() is more featureful.
917 if test "x$check_for_libcrypt_before" = "x1"; then
918 AC_CHECK_LIB(crypt, crypt)
922 saved_CPPFLAGS="$CPPFLAGS"
923 saved_LDFLAGS="$LDFLAGS"
925 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
927 if test "x$withval" != "xno" ; then
928 if test -d "$withval/lib"; then
929 if test -n "${need_dash_r}"; then
930 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
932 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
935 if test -n "${need_dash_r}"; then
936 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
938 LDFLAGS="-L${withval} ${LDFLAGS}"
941 if test -d "$withval/include"; then
942 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
944 CPPFLAGS="-I${withval} ${CPPFLAGS}"
949 LIBS="$LIBS -lcrypto"
950 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
952 dnl Check default openssl install dir
953 if test -n "${need_dash_r}"; then
954 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
956 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
958 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
959 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
961 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
967 # Determine OpenSSL header version
968 AC_MSG_CHECKING([OpenSSL header version])
973 #include <openssl/opensslv.h>
974 #define DATA "conftest.sslincver"
979 fd = fopen(DATA,"w");
983 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
990 ssl_header_ver=`cat conftest.sslincver`
991 AC_MSG_RESULT($ssl_header_ver)
994 AC_MSG_RESULT(not found)
995 AC_MSG_ERROR(OpenSSL version header not found.)
999 # Determine OpenSSL library version
1000 AC_MSG_CHECKING([OpenSSL library version])
1005 #include <openssl/opensslv.h>
1006 #include <openssl/crypto.h>
1007 #define DATA "conftest.ssllibver"
1012 fd = fopen(DATA,"w");
1016 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1023 ssl_library_ver=`cat conftest.ssllibver`
1024 AC_MSG_RESULT($ssl_library_ver)
1027 AC_MSG_RESULT(not found)
1028 AC_MSG_ERROR(OpenSSL library not found.)
1032 # Sanity check OpenSSL headers
1033 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1037 #include <openssl/opensslv.h>
1038 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1045 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1046 Check config.log for details.
1047 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1051 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1052 # version in OpenSSL. Skip this for PAM
1053 if test "x$check_for_libcrypt_later" = "x1"; then
1054 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1058 ### Configure cryptographic random number support
1060 # Check wheter OpenSSL seeds itself
1061 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1065 #include <openssl/rand.h>
1066 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1069 OPENSSL_SEEDS_ITSELF=yes
1074 # Default to use of the rand helper if OpenSSL doesn't
1081 # Do we want to force the use of the rand helper?
1082 AC_ARG_WITH(rand-helper,
1083 [ --with-rand-helper Use subprocess to gather strong randomness ],
1085 if test "x$withval" = "xno" ; then
1086 # Force use of OpenSSL's internal RNG, even if
1087 # the previous test showed it to be unseeded.
1088 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1089 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1090 OPENSSL_SEEDS_ITSELF=yes
1099 # Which randomness source do we use?
1100 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1102 AC_DEFINE(OPENSSL_PRNG_ONLY)
1103 RAND_MSG="OpenSSL internal ONLY"
1104 INSTALL_SSH_RAND_HELPER=""
1105 elif test ! -z "$USE_RAND_HELPER" ; then
1106 # install rand helper
1107 RAND_MSG="ssh-rand-helper"
1108 INSTALL_SSH_RAND_HELPER="yes"
1110 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1112 ### Configuration of ssh-rand-helper
1115 AC_ARG_WITH(prngd-port,
1116 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1125 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1128 if test ! -z "$withval" ; then
1129 PRNGD_PORT="$withval"
1130 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1135 # PRNGD Unix domain socket
1136 AC_ARG_WITH(prngd-socket,
1137 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1141 withval="/var/run/egd-pool"
1149 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1153 if test ! -z "$withval" ; then
1154 if test ! -z "$PRNGD_PORT" ; then
1155 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1157 if test ! -r "$withval" ; then
1158 AC_MSG_WARN(Entropy socket is not readable)
1160 PRNGD_SOCKET="$withval"
1161 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1165 # Check for existing socket only if we don't have a random device already
1166 if test "$USE_RAND_HELPER" = yes ; then
1167 AC_MSG_CHECKING(for PRNGD/EGD socket)
1168 # Insert other locations here
1169 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1170 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1171 PRNGD_SOCKET="$sock"
1172 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1176 if test ! -z "$PRNGD_SOCKET" ; then
1177 AC_MSG_RESULT($PRNGD_SOCKET)
1179 AC_MSG_RESULT(not found)
1185 # Change default command timeout for hashing entropy source
1187 AC_ARG_WITH(entropy-timeout,
1188 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1190 if test "x$withval" != "xno" ; then
1191 entropy_timeout=$withval
1195 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1197 SSH_PRIVSEP_USER=sshd
1198 AC_ARG_WITH(privsep-user,
1199 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1201 if test -n "$withval"; then
1202 SSH_PRIVSEP_USER=$withval
1206 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1207 AC_SUBST(SSH_PRIVSEP_USER)
1209 # We do this little dance with the search path to insure
1210 # that programs that we select for use by installed programs
1211 # (which may be run by the super-user) come from trusted
1212 # locations before they come from the user's private area.
1213 # This should help avoid accidentally configuring some
1214 # random version of a program in someone's personal bin.
1218 test -h /bin 2> /dev/null && PATH=/usr/bin
1219 test -d /sbin && PATH=$PATH:/sbin
1220 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1221 PATH=$PATH:/etc:$OPATH
1223 # These programs are used by the command hashing source to gather entropy
1224 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1225 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1226 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1227 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1228 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1229 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1230 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1231 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1232 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1233 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1234 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1235 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1236 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1237 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1238 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1239 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1243 # Where does ssh-rand-helper get its randomness from?
1244 INSTALL_SSH_PRNG_CMDS=""
1245 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1246 if test ! -z "$PRNGD_PORT" ; then
1247 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1248 elif test ! -z "$PRNGD_SOCKET" ; then
1249 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1251 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1252 RAND_HELPER_CMDHASH=yes
1253 INSTALL_SSH_PRNG_CMDS="yes"
1256 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1259 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1260 if test ! -z "$SONY" ; then
1261 LIBS="$LIBS -liberty";
1264 # Checks for data types
1265 AC_CHECK_SIZEOF(char, 1)
1266 AC_CHECK_SIZEOF(short int, 2)
1267 AC_CHECK_SIZEOF(int, 4)
1268 AC_CHECK_SIZEOF(long int, 4)
1269 AC_CHECK_SIZEOF(long long int, 8)
1271 # Sanity check long long for some platforms (AIX)
1272 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1273 ac_cv_sizeof_long_long_int=0
1276 # More checks for data types
1277 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1279 [ #include <sys/types.h> ],
1281 [ ac_cv_have_u_int="yes" ],
1282 [ ac_cv_have_u_int="no" ]
1285 if test "x$ac_cv_have_u_int" = "xyes" ; then
1286 AC_DEFINE(HAVE_U_INT)
1290 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1292 [ #include <sys/types.h> ],
1293 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1294 [ ac_cv_have_intxx_t="yes" ],
1295 [ ac_cv_have_intxx_t="no" ]
1298 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1299 AC_DEFINE(HAVE_INTXX_T)
1303 if (test -z "$have_intxx_t" && \
1304 test "x$ac_cv_header_stdint_h" = "xyes")
1306 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1308 [ #include <stdint.h> ],
1309 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1311 AC_DEFINE(HAVE_INTXX_T)
1314 [ AC_MSG_RESULT(no) ]
1318 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1321 #include <sys/types.h>
1322 #ifdef HAVE_STDINT_H
1323 # include <stdint.h>
1325 #include <sys/socket.h>
1326 #ifdef HAVE_SYS_BITYPES_H
1327 # include <sys/bitypes.h>
1330 [ int64_t a; a = 1;],
1331 [ ac_cv_have_int64_t="yes" ],
1332 [ ac_cv_have_int64_t="no" ]
1335 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1336 AC_DEFINE(HAVE_INT64_T)
1339 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1341 [ #include <sys/types.h> ],
1342 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1343 [ ac_cv_have_u_intxx_t="yes" ],
1344 [ ac_cv_have_u_intxx_t="no" ]
1347 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1348 AC_DEFINE(HAVE_U_INTXX_T)
1352 if test -z "$have_u_intxx_t" ; then
1353 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1355 [ #include <sys/socket.h> ],
1356 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1358 AC_DEFINE(HAVE_U_INTXX_T)
1361 [ AC_MSG_RESULT(no) ]
1365 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1367 [ #include <sys/types.h> ],
1368 [ u_int64_t a; a = 1;],
1369 [ ac_cv_have_u_int64_t="yes" ],
1370 [ ac_cv_have_u_int64_t="no" ]
1373 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1374 AC_DEFINE(HAVE_U_INT64_T)
1378 if test -z "$have_u_int64_t" ; then
1379 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1381 [ #include <sys/bitypes.h> ],
1382 [ u_int64_t a; a = 1],
1384 AC_DEFINE(HAVE_U_INT64_T)
1387 [ AC_MSG_RESULT(no) ]
1391 if test -z "$have_u_intxx_t" ; then
1392 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1395 #include <sys/types.h>
1397 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1398 [ ac_cv_have_uintxx_t="yes" ],
1399 [ ac_cv_have_uintxx_t="no" ]
1402 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1403 AC_DEFINE(HAVE_UINTXX_T)
1407 if test -z "$have_uintxx_t" ; then
1408 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1410 [ #include <stdint.h> ],
1411 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1413 AC_DEFINE(HAVE_UINTXX_T)
1416 [ AC_MSG_RESULT(no) ]
1420 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1421 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1423 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1426 #include <sys/bitypes.h>
1429 int8_t a; int16_t b; int32_t c;
1430 u_int8_t e; u_int16_t f; u_int32_t g;
1431 a = b = c = e = f = g = 1;
1434 AC_DEFINE(HAVE_U_INTXX_T)
1435 AC_DEFINE(HAVE_INTXX_T)
1443 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1446 #include <sys/types.h>
1448 [ u_char foo; foo = 125; ],
1449 [ ac_cv_have_u_char="yes" ],
1450 [ ac_cv_have_u_char="no" ]
1453 if test "x$ac_cv_have_u_char" = "xyes" ; then
1454 AC_DEFINE(HAVE_U_CHAR)
1459 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1461 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1464 #include <sys/types.h>
1466 [ size_t foo; foo = 1235; ],
1467 [ ac_cv_have_size_t="yes" ],
1468 [ ac_cv_have_size_t="no" ]
1471 if test "x$ac_cv_have_size_t" = "xyes" ; then
1472 AC_DEFINE(HAVE_SIZE_T)
1475 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1478 #include <sys/types.h>
1480 [ ssize_t foo; foo = 1235; ],
1481 [ ac_cv_have_ssize_t="yes" ],
1482 [ ac_cv_have_ssize_t="no" ]
1485 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1486 AC_DEFINE(HAVE_SSIZE_T)
1489 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1494 [ clock_t foo; foo = 1235; ],
1495 [ ac_cv_have_clock_t="yes" ],
1496 [ ac_cv_have_clock_t="no" ]
1499 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1500 AC_DEFINE(HAVE_CLOCK_T)
1503 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1506 #include <sys/types.h>
1507 #include <sys/socket.h>
1509 [ sa_family_t foo; foo = 1235; ],
1510 [ ac_cv_have_sa_family_t="yes" ],
1513 #include <sys/types.h>
1514 #include <sys/socket.h>
1515 #include <netinet/in.h>
1517 [ sa_family_t foo; foo = 1235; ],
1518 [ ac_cv_have_sa_family_t="yes" ],
1520 [ ac_cv_have_sa_family_t="no" ]
1524 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1525 AC_DEFINE(HAVE_SA_FAMILY_T)
1528 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1531 #include <sys/types.h>
1533 [ pid_t foo; foo = 1235; ],
1534 [ ac_cv_have_pid_t="yes" ],
1535 [ ac_cv_have_pid_t="no" ]
1538 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1539 AC_DEFINE(HAVE_PID_T)
1542 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1545 #include <sys/types.h>
1547 [ mode_t foo; foo = 1235; ],
1548 [ ac_cv_have_mode_t="yes" ],
1549 [ ac_cv_have_mode_t="no" ]
1552 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1553 AC_DEFINE(HAVE_MODE_T)
1557 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1560 #include <sys/types.h>
1561 #include <sys/socket.h>
1563 [ struct sockaddr_storage s; ],
1564 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1565 [ ac_cv_have_struct_sockaddr_storage="no" ]
1568 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1569 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1572 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1575 #include <sys/types.h>
1576 #include <netinet/in.h>
1578 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1579 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1580 [ ac_cv_have_struct_sockaddr_in6="no" ]
1583 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1584 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1587 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1590 #include <sys/types.h>
1591 #include <netinet/in.h>
1593 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1594 [ ac_cv_have_struct_in6_addr="yes" ],
1595 [ ac_cv_have_struct_in6_addr="no" ]
1598 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1599 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1602 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1605 #include <sys/types.h>
1606 #include <sys/socket.h>
1609 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1610 [ ac_cv_have_struct_addrinfo="yes" ],
1611 [ ac_cv_have_struct_addrinfo="no" ]
1614 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1615 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1618 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1620 [ #include <sys/time.h> ],
1621 [ struct timeval tv; tv.tv_sec = 1;],
1622 [ ac_cv_have_struct_timeval="yes" ],
1623 [ ac_cv_have_struct_timeval="no" ]
1626 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1627 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1628 have_struct_timeval=1
1631 AC_CHECK_TYPES(struct timespec)
1633 # We need int64_t or else certian parts of the compile will fail.
1634 if test "x$ac_cv_have_int64_t" = "xno" -a \
1635 "x$ac_cv_sizeof_long_int" != "x8" -a \
1636 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1637 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1638 echo "an alternative compiler (I.E., GCC) before continuing."
1642 dnl test snprintf (broken on SCO w/gcc)
1647 #ifdef HAVE_SNPRINTF
1651 char expected_out[50];
1653 #if (SIZEOF_LONG_INT == 8)
1654 long int num = 0x7fffffffffffffff;
1656 long long num = 0x7fffffffffffffffll;
1658 strcpy(expected_out, "9223372036854775807");
1659 snprintf(buf, mazsize, "%lld", num);
1660 if(strcmp(buf, expected_out) != 0)
1667 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1671 dnl Checks for structure members
1672 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1673 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1674 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1675 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1676 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1677 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1678 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1679 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1680 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1681 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1682 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1683 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1684 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1685 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1686 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1687 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1688 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1690 AC_CHECK_MEMBERS([struct stat.st_blksize])
1692 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1693 ac_cv_have_ss_family_in_struct_ss, [
1696 #include <sys/types.h>
1697 #include <sys/socket.h>
1699 [ struct sockaddr_storage s; s.ss_family = 1; ],
1700 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1701 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1704 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1705 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1708 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1709 ac_cv_have___ss_family_in_struct_ss, [
1712 #include <sys/types.h>
1713 #include <sys/socket.h>
1715 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1716 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1717 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1720 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1721 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1724 AC_CACHE_CHECK([for pw_class field in struct passwd],
1725 ac_cv_have_pw_class_in_struct_passwd, [
1730 [ struct passwd p; p.pw_class = 0; ],
1731 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1732 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1735 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1736 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1739 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1740 ac_cv_have_pw_expire_in_struct_passwd, [
1745 [ struct passwd p; p.pw_expire = 0; ],
1746 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1747 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1750 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1751 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1754 AC_CACHE_CHECK([for pw_change field in struct passwd],
1755 ac_cv_have_pw_change_in_struct_passwd, [
1760 [ struct passwd p; p.pw_change = 0; ],
1761 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1762 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1765 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1766 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1769 dnl make sure we're using the real structure members and not defines
1770 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1771 ac_cv_have_accrights_in_msghdr, [
1774 #include <sys/types.h>
1775 #include <sys/socket.h>
1776 #include <sys/uio.h>
1778 #ifdef msg_accrights
1782 m.msg_accrights = 0;
1786 [ ac_cv_have_accrights_in_msghdr="yes" ],
1787 [ ac_cv_have_accrights_in_msghdr="no" ]
1790 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1791 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1794 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1795 ac_cv_have_control_in_msghdr, [
1798 #include <sys/types.h>
1799 #include <sys/socket.h>
1800 #include <sys/uio.h>
1810 [ ac_cv_have_control_in_msghdr="yes" ],
1811 [ ac_cv_have_control_in_msghdr="no" ]
1814 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1815 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1818 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1820 [ extern char *__progname; printf("%s", __progname); ],
1821 [ ac_cv_libc_defines___progname="yes" ],
1822 [ ac_cv_libc_defines___progname="no" ]
1825 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1826 AC_DEFINE(HAVE___PROGNAME)
1829 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1833 [ printf("%s", __FUNCTION__); ],
1834 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1835 [ ac_cv_cc_implements___FUNCTION__="no" ]
1838 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1839 AC_DEFINE(HAVE___FUNCTION__)
1842 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1846 [ printf("%s", __func__); ],
1847 [ ac_cv_cc_implements___func__="yes" ],
1848 [ ac_cv_cc_implements___func__="no" ]
1851 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1852 AC_DEFINE(HAVE___func__)
1855 AC_CACHE_CHECK([whether getopt has optreset support],
1856 ac_cv_have_getopt_optreset, [
1861 [ extern int optreset; optreset = 0; ],
1862 [ ac_cv_have_getopt_optreset="yes" ],
1863 [ ac_cv_have_getopt_optreset="no" ]
1866 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1867 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1870 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1872 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1873 [ ac_cv_libc_defines_sys_errlist="yes" ],
1874 [ ac_cv_libc_defines_sys_errlist="no" ]
1877 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1878 AC_DEFINE(HAVE_SYS_ERRLIST)
1882 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1884 [ extern int sys_nerr; printf("%i", sys_nerr);],
1885 [ ac_cv_libc_defines_sys_nerr="yes" ],
1886 [ ac_cv_libc_defines_sys_nerr="no" ]
1889 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1890 AC_DEFINE(HAVE_SYS_NERR)
1894 # Check whether user wants sectok support
1896 [ --with-sectok Enable smartcard support using libsectok],
1898 if test "x$withval" != "xno" ; then
1899 if test "x$withval" != "xyes" ; then
1900 CPPFLAGS="$CPPFLAGS -I${withval}"
1901 LDFLAGS="$LDFLAGS -L${withval}"
1902 if test ! -z "$need_dash_r" ; then
1903 LDFLAGS="$LDFLAGS -R${withval}"
1905 if test ! -z "$blibpath" ; then
1906 blibpath="$blibpath:${withval}"
1909 AC_CHECK_HEADERS(sectok.h)
1910 if test "$ac_cv_header_sectok_h" != yes; then
1911 AC_MSG_ERROR(Can't find sectok.h)
1913 AC_CHECK_LIB(sectok, sectok_open)
1914 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1915 AC_MSG_ERROR(Can't find libsectok)
1917 AC_DEFINE(SMARTCARD)
1918 AC_DEFINE(USE_SECTOK)
1919 SCARD_MSG="yes, using sectok"
1924 # Check whether user wants OpenSC support
1926 AC_HELP_STRING([--with-opensc=PFX],
1927 [Enable smartcard support using OpenSC]),
1928 opensc_config_prefix="$withval", opensc_config_prefix="")
1929 if test x$opensc_config_prefix != x ; then
1930 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1931 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1932 if test "$OPENSC_CONFIG" != "no"; then
1933 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1934 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1935 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1936 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1937 AC_DEFINE(SMARTCARD)
1938 AC_DEFINE(USE_OPENSC)
1939 SCARD_MSG="yes, using OpenSC"
1943 # Check whether user wants DNS support
1946 [ --with-dns Support for fetching keys from DNS (experimental)],
1948 if test "x$withval" != "xno" ; then
1951 AC_SEARCH_LIBS(getrrsetbyname, resolv,
1952 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
1954 # Needed by our getrrsetbyname()
1955 AC_SEARCH_LIBS(res_query, resolv)
1956 AC_SEARCH_LIBS(dn_expand, resolv)
1957 AC_CHECK_FUNCS(_getshort _getlong)
1958 AC_CHECK_MEMBER(HEADER.ad,
1959 [AC_DEFINE(HAVE_HEADER_AD)],,
1960 [#include <arpa/nameser.h>])
1966 # Check whether user wants Kerberos 5 support
1968 AC_ARG_WITH(kerberos5,
1969 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1971 if test "x$withval" != "xno" ; then
1972 if test "x$withval" = "xyes" ; then
1973 KRB5ROOT="/usr/local"
1977 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1978 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1981 AC_MSG_CHECKING(whether we are using Heimdal)
1982 AC_TRY_COMPILE([ #include <krb5.h> ],
1983 [ char *tmp = heimdal_version; ],
1984 [ AC_MSG_RESULT(yes)
1986 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1989 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1992 if test ! -z "$need_dash_r" ; then
1993 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1995 if test ! -z "$blibpath" ; then
1996 blibpath="$blibpath:${KRB5ROOT}/lib"
1998 AC_SEARCH_LIBS(dn_expand, resolv)
2000 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2002 K5LIBS="-lgssapi $K5LIBS" ],
2003 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2005 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2006 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2011 AC_CHECK_HEADER(gssapi.h, ,
2012 [ unset ac_cv_header_gssapi_h
2013 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2014 AC_CHECK_HEADERS(gssapi.h, ,
2015 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2021 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2022 AC_CHECK_HEADER(gssapi_krb5.h, ,
2023 [ CPPFLAGS="$oldCPP" ])
2029 LIBS="$LIBS $K5LIBS"
2031 # Looking for programs, paths and files
2033 PRIVSEP_PATH=/var/empty
2034 AC_ARG_WITH(privsep-path,
2035 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2037 if test "x$withval" != "$no" ; then
2038 PRIVSEP_PATH=$withval
2042 AC_SUBST(PRIVSEP_PATH)
2045 [ --with-xauth=PATH Specify path to xauth program ],
2047 if test "x$withval" != "xno" ; then
2053 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2054 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2055 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2056 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2057 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2058 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2059 xauth_path="/usr/openwin/bin/xauth"
2065 AC_ARG_ENABLE(strip,
2066 [ --disable-strip Disable calling strip(1) on install],
2068 if test "x$enableval" = "xno" ; then
2075 if test -z "$xauth_path" ; then
2076 XAUTH_PATH="undefined"
2077 AC_SUBST(XAUTH_PATH)
2079 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2080 XAUTH_PATH=$xauth_path
2081 AC_SUBST(XAUTH_PATH)
2084 # Check for mail directory (last resort if we cannot get it from headers)
2085 if test ! -z "$MAIL" ; then
2086 maildir=`dirname $MAIL`
2087 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2090 if test -z "$no_dev_ptmx" ; then
2091 if test "x$disable_ptmx_check" != "xyes" ; then
2092 AC_CHECK_FILE("/dev/ptmx",
2094 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2100 AC_CHECK_FILE("/dev/ptc",
2102 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2107 # Options from here on. Some of these are preset by platform above
2108 AC_ARG_WITH(mantype,
2109 [ --with-mantype=man|cat|doc Set man page type],
2116 AC_MSG_ERROR(invalid man type: $withval)
2121 if test -z "$MANTYPE"; then
2122 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2123 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2124 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2126 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2133 if test "$MANTYPE" = "doc"; then
2140 # Check whether to enable MD5 passwords
2142 AC_ARG_WITH(md5-passwords,
2143 [ --with-md5-passwords Enable use of MD5 passwords],
2145 if test "x$withval" != "xno" ; then
2146 AC_DEFINE(HAVE_MD5_PASSWORDS)
2152 # Whether to disable shadow password support
2154 [ --without-shadow Disable shadow password support],
2156 if test "x$withval" = "xno" ; then
2157 AC_DEFINE(DISABLE_SHADOW)
2163 if test -z "$disable_shadow" ; then
2164 AC_MSG_CHECKING([if the systems has expire shadow information])
2167 #include <sys/types.h>
2170 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2171 [ sp_expire_available=yes ], []
2174 if test "x$sp_expire_available" = "xyes" ; then
2176 AC_DEFINE(HAS_SHADOW_EXPIRE)
2182 # Use ip address instead of hostname in $DISPLAY
2183 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2184 DISPLAY_HACK_MSG="yes"
2185 AC_DEFINE(IPADDR_IN_DISPLAY)
2187 DISPLAY_HACK_MSG="no"
2188 AC_ARG_WITH(ipaddr-display,
2189 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2191 if test "x$withval" != "xno" ; then
2192 AC_DEFINE(IPADDR_IN_DISPLAY)
2193 DISPLAY_HACK_MSG="yes"
2199 # check for /etc/default/login and use it if present.
2200 AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2202 if test "x$external_path_file" = "x/etc/default/login"; then
2203 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2206 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2207 if test $ac_cv_func_login_getcapbool = "yes" -a \
2208 $ac_cv_header_login_cap_h = "yes" ; then
2209 external_path_file=/etc/login.conf
2212 # Whether to mess with the default path
2213 SERVER_PATH_MSG="(default)"
2214 AC_ARG_WITH(default-path,
2215 [ --with-default-path= Specify default \$PATH environment for server],
2217 if test "x$external_path_file" = "x/etc/login.conf" ; then
2219 --with-default-path=PATH has no effect on this system.
2220 Edit /etc/login.conf instead.])
2221 elif test "x$withval" != "xno" ; then
2222 if test ! -z "$external_path_file" ; then
2224 --with-default-path=PATH will only be used if PATH is not defined in
2225 $external_path_file .])
2227 user_path="$withval"
2228 SERVER_PATH_MSG="$withval"
2231 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2232 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2234 if test ! -z "$external_path_file" ; then
2236 If PATH is defined in $external_path_file, ensure the path to scp is included,
2237 otherwise scp will not work.])
2241 /* find out what STDPATH is */
2246 #ifndef _PATH_STDPATH
2247 # ifdef _PATH_USERPATH /* Irix */
2248 # define _PATH_STDPATH _PATH_USERPATH
2250 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2253 #include <sys/types.h>
2254 #include <sys/stat.h>
2256 #define DATA "conftest.stdpath"
2263 fd = fopen(DATA,"w");
2267 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2272 ], [ user_path=`cat conftest.stdpath` ],
2273 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2274 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2276 # make sure $bindir is in USER_PATH so scp will work
2277 t_bindir=`eval echo ${bindir}`
2279 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2282 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2284 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2285 if test $? -ne 0 ; then
2286 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2287 if test $? -ne 0 ; then
2288 user_path=$user_path:$t_bindir
2289 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2294 if test "x$external_path_file" != "x/etc/login.conf" ; then
2295 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2299 # Set superuser path separately to user path
2300 AC_ARG_WITH(superuser-path,
2301 [ --with-superuser-path= Specify different path for super-user],
2303 if test "x$withval" != "xno" ; then
2304 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2305 superuser_path=$withval
2311 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2312 IPV4_IN6_HACK_MSG="no"
2314 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2316 if test "x$withval" != "xno" ; then
2318 AC_DEFINE(IPV4_IN_IPV6)
2319 IPV4_IN6_HACK_MSG="yes"
2324 if test "x$inet6_default_4in6" = "xyes"; then
2325 AC_MSG_RESULT([yes (default)])
2326 AC_DEFINE(IPV4_IN_IPV6)
2327 IPV4_IN6_HACK_MSG="yes"
2329 AC_MSG_RESULT([no (default)])
2334 # Whether to enable BSD auth support
2336 AC_ARG_WITH(bsd-auth,
2337 [ --with-bsd-auth Enable BSD auth support],
2339 if test "x$withval" != "xno" ; then
2346 # Where to place sshd.pid
2348 # make sure the directory exists
2349 if test ! -d $piddir ; then
2350 piddir=`eval echo ${sysconfdir}`
2352 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2356 AC_ARG_WITH(pid-dir,
2357 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2359 if test "x$withval" != "xno" ; then
2361 if test ! -d $piddir ; then
2362 AC_MSG_WARN([** no $piddir directory on this system **])
2368 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2371 dnl allow user to disable some login recording features
2372 AC_ARG_ENABLE(lastlog,
2373 [ --disable-lastlog disable use of lastlog even if detected [no]],
2375 if test "x$enableval" = "xno" ; then
2376 AC_DEFINE(DISABLE_LASTLOG)
2381 [ --disable-utmp disable use of utmp even if detected [no]],
2383 if test "x$enableval" = "xno" ; then
2384 AC_DEFINE(DISABLE_UTMP)
2388 AC_ARG_ENABLE(utmpx,
2389 [ --disable-utmpx disable use of utmpx even if detected [no]],
2391 if test "x$enableval" = "xno" ; then
2392 AC_DEFINE(DISABLE_UTMPX)
2397 [ --disable-wtmp disable use of wtmp even if detected [no]],
2399 if test "x$enableval" = "xno" ; then
2400 AC_DEFINE(DISABLE_WTMP)
2404 AC_ARG_ENABLE(wtmpx,
2405 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2407 if test "x$enableval" = "xno" ; then
2408 AC_DEFINE(DISABLE_WTMPX)
2412 AC_ARG_ENABLE(libutil,
2413 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2415 if test "x$enableval" = "xno" ; then
2416 AC_DEFINE(DISABLE_LOGIN)
2420 AC_ARG_ENABLE(pututline,
2421 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2423 if test "x$enableval" = "xno" ; then
2424 AC_DEFINE(DISABLE_PUTUTLINE)
2428 AC_ARG_ENABLE(pututxline,
2429 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2431 if test "x$enableval" = "xno" ; then
2432 AC_DEFINE(DISABLE_PUTUTXLINE)
2436 AC_ARG_WITH(lastlog,
2437 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2439 if test "x$withval" = "xno" ; then
2440 AC_DEFINE(DISABLE_LASTLOG)
2442 conf_lastlog_location=$withval
2447 dnl lastlog, [uw]tmpx? detection
2448 dnl NOTE: set the paths in the platform section to avoid the
2449 dnl need for command-line parameters
2450 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2452 dnl lastlog detection
2453 dnl NOTE: the code itself will detect if lastlog is a directory
2454 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2456 #include <sys/types.h>
2458 #ifdef HAVE_LASTLOG_H
2459 # include <lastlog.h>
2468 [ char *lastlog = LASTLOG_FILE; ],
2469 [ AC_MSG_RESULT(yes) ],
2472 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2474 #include <sys/types.h>
2476 #ifdef HAVE_LASTLOG_H
2477 # include <lastlog.h>
2483 [ char *lastlog = _PATH_LASTLOG; ],
2484 [ AC_MSG_RESULT(yes) ],
2487 system_lastlog_path=no
2492 if test -z "$conf_lastlog_location"; then
2493 if test x"$system_lastlog_path" = x"no" ; then
2494 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2495 if (test -d "$f" || test -f "$f") ; then
2496 conf_lastlog_location=$f
2499 if test -z "$conf_lastlog_location"; then
2500 AC_MSG_WARN([** Cannot find lastlog **])
2501 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2506 if test -n "$conf_lastlog_location"; then
2507 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2511 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2513 #include <sys/types.h>
2519 [ char *utmp = UTMP_FILE; ],
2520 [ AC_MSG_RESULT(yes) ],
2522 system_utmp_path=no ]
2524 if test -z "$conf_utmp_location"; then
2525 if test x"$system_utmp_path" = x"no" ; then
2526 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2527 if test -f $f ; then
2528 conf_utmp_location=$f
2531 if test -z "$conf_utmp_location"; then
2532 AC_DEFINE(DISABLE_UTMP)
2536 if test -n "$conf_utmp_location"; then
2537 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2541 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2543 #include <sys/types.h>
2549 [ char *wtmp = WTMP_FILE; ],
2550 [ AC_MSG_RESULT(yes) ],
2552 system_wtmp_path=no ]
2554 if test -z "$conf_wtmp_location"; then
2555 if test x"$system_wtmp_path" = x"no" ; then
2556 for f in /usr/adm/wtmp /var/log/wtmp; do
2557 if test -f $f ; then
2558 conf_wtmp_location=$f
2561 if test -z "$conf_wtmp_location"; then
2562 AC_DEFINE(DISABLE_WTMP)
2566 if test -n "$conf_wtmp_location"; then
2567 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2571 dnl utmpx detection - I don't know any system so perverse as to require
2572 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2574 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2576 #include <sys/types.h>
2585 [ char *utmpx = UTMPX_FILE; ],
2586 [ AC_MSG_RESULT(yes) ],
2588 system_utmpx_path=no ]
2590 if test -z "$conf_utmpx_location"; then
2591 if test x"$system_utmpx_path" = x"no" ; then
2592 AC_DEFINE(DISABLE_UTMPX)
2595 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2599 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2601 #include <sys/types.h>
2610 [ char *wtmpx = WTMPX_FILE; ],
2611 [ AC_MSG_RESULT(yes) ],
2613 system_wtmpx_path=no ]
2615 if test -z "$conf_wtmpx_location"; then
2616 if test x"$system_wtmpx_path" = x"no" ; then
2617 AC_DEFINE(DISABLE_WTMPX)
2620 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2624 if test ! -z "$blibpath" ; then
2625 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2626 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2629 dnl remove pam and dl because they are in $LIBPAM
2630 if test "$PAM_MSG" = yes ; then
2631 LIBS=`echo $LIBS | sed 's/-lpam //'`
2633 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2634 LIBS=`echo $LIBS | sed 's/-ldl //'`
2638 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2641 # Print summary of options
2643 # Someone please show me a better way :)
2644 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2645 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2646 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2647 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2648 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2649 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2650 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2651 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2652 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2653 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2656 echo "OpenSSH has been configured with the following options:"
2657 echo " User binaries: $B"
2658 echo " System binaries: $C"
2659 echo " Configuration files: $D"
2660 echo " Askpass program: $E"
2661 echo " Manual pages: $F"
2662 echo " PID file: $G"
2663 echo " Privilege separation chroot path: $H"
2664 if test "x$external_path_file" = "x/etc/login.conf" ; then
2665 echo " At runtime, sshd will use the path defined in $external_path_file"
2666 echo " Make sure the path to scp is present, otherwise scp will not work"
2668 echo " sshd default user PATH: $I"
2669 if test ! -z "$external_path_file"; then
2670 echo " (If PATH is set in $external_path_file it will be used instead. If"
2671 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2674 if test ! -z "$superuser_path" ; then
2675 echo " sshd superuser user PATH: $J"
2677 echo " Manpage format: $MANTYPE"
2678 echo " DNS support: $DNS_MSG"
2679 echo " PAM support: $PAM_MSG"
2680 echo " KerberosV support: $KRB5_MSG"
2681 echo " Smartcard support: $SCARD_MSG"
2682 echo " S/KEY support: $SKEY_MSG"
2683 echo " TCP Wrappers support: $TCPW_MSG"
2684 echo " MD5 password support: $MD5_MSG"
2685 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2686 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2687 echo " BSD Auth support: $BSD_AUTH_MSG"
2688 echo " Random number source: $RAND_MSG"
2689 if test ! -z "$USE_RAND_HELPER" ; then
2690 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2695 echo " Host: ${host}"
2696 echo " Compiler: ${CC}"
2697 echo " Compiler flags: ${CFLAGS}"
2698 echo "Preprocessor flags: ${CPPFLAGS}"
2699 echo " Linker flags: ${LDFLAGS}"
2700 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2704 if test "x$PAM_MSG" = "xyes" ; then
2705 echo "PAM is enabled. You may need to install a PAM control file "
2706 echo "for sshd, otherwise password authentication may fail. "
2707 echo "Example PAM control files can be found in the contrib/ "
2712 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2713 echo "WARNING: you are using the builtin random number collection "
2714 echo "service. Please read WARNING.RNG and request that your OS "
2715 echo "vendor includes kernel-based random number collection in "
2716 echo "future versions of your OS."