3 # Copyright (c) 1999-2004 Damien Miller
5 # Permission to use, copy, modify, and distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 AC_CONFIG_SRCDIR([ssh.c])
20 AC_CONFIG_HEADER(config.h)
25 # Checks for programs.
31 AC_PATH_PROGS(PERL, perl5 perl)
32 AC_PATH_PROG(SED, sed)
34 AC_PATH_PROG(ENT, ent)
36 AC_PATH_PROG(TEST_MINUS_S_SH, bash)
37 AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
38 AC_PATH_PROG(TEST_MINUS_S_SH, sh)
44 if test -z "$AR" ; then
45 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
48 # Use LOGIN_PROGRAM from environment if possible
49 if test ! -z "$LOGIN_PROGRAM" ; then
50 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
53 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
54 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
55 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
59 AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
60 if test ! -z "$PATH_PASSWD_PROG" ; then
61 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
64 if test -z "$LD" ; then
70 if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
71 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
75 [ --without-rpath Disable auto-added -R linker paths],
77 if test "x$withval" = "xno" ; then
80 if test "x$withval" = "xyes" ; then
86 # Check for some target-specific stuff
89 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
90 if (test -z "$blibpath"); then
91 blibpath="/usr/lib:/lib"
93 saved_LDFLAGS="$LDFLAGS"
94 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
95 if (test -z "$blibflags"); then
96 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
97 AC_TRY_LINK([], [], [blibflags=$tryflags])
100 if (test -z "$blibflags"); then
101 AC_MSG_RESULT(not found)
102 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
104 AC_MSG_RESULT($blibflags)
106 LDFLAGS="$saved_LDFLAGS"
107 dnl Check for authenticate. Might be in libs.a on older AIXes
108 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
109 [AC_CHECK_LIB(s,authenticate,
110 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
114 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
115 AC_CHECK_DECL(loginfailed,
116 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
118 [#include <usersec.h>],
119 [(void)loginfailed("user","host","tty",0);],
121 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
125 [#include <usersec.h>]
127 AC_CHECK_FUNCS(setauthdb)
128 AC_DEFINE(BROKEN_GETADDRINFO)
129 AC_DEFINE(BROKEN_REALPATH)
130 AC_DEFINE(SETEUID_BREAKS_SETUID)
131 AC_DEFINE(BROKEN_SETREUID)
132 AC_DEFINE(BROKEN_SETREGID)
133 dnl AIX handles lastlog as part of its login message
134 AC_DEFINE(DISABLE_LASTLOG)
135 AC_DEFINE(LOGIN_NEEDS_UTMPX)
136 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
139 check_for_libcrypt_later=1
140 LIBS="$LIBS /usr/lib/textmode.o"
141 AC_DEFINE(HAVE_CYGWIN)
143 AC_DEFINE(DISABLE_SHADOW)
144 AC_DEFINE(IP_TOS_IS_BROKEN)
145 AC_DEFINE(NO_X11_UNIX_SOCKETS)
146 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
147 AC_DEFINE(DISABLE_FD_PASSING)
148 AC_DEFINE(SETGROUPS_NOOP)
151 AC_DEFINE(IP_TOS_IS_BROKEN)
152 AC_DEFINE(SETEUID_BREAKS_SETUID)
153 AC_DEFINE(BROKEN_SETREUID)
154 AC_DEFINE(BROKEN_SETREGID)
157 AC_MSG_CHECKING(if we have working getaddrinfo)
158 AC_TRY_RUN([#include <mach-o/dyld.h>
159 main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
163 }], [AC_MSG_RESULT(working)],
164 [AC_MSG_RESULT(buggy)
165 AC_DEFINE(BROKEN_GETADDRINFO)],
166 [AC_MSG_RESULT(assume it is working)])
167 AC_DEFINE(SETEUID_BREAKS_SETUID)
168 AC_DEFINE(BROKEN_SETREUID)
169 AC_DEFINE(BROKEN_SETREGID)
170 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
173 if test -z "$GCC"; then
176 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
177 IPADDR_IN_DISPLAY=yes
178 AC_DEFINE(HAVE_SECUREWARE)
180 AC_DEFINE(LOGIN_NO_ENDOPT)
181 AC_DEFINE(LOGIN_NEEDS_UTMPX)
182 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
183 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
184 LIBS="$LIBS -lsec -lsecpw"
185 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
186 disable_ptmx_check=yes
189 if test -z "$GCC"; then
192 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
193 IPADDR_IN_DISPLAY=yes
195 AC_DEFINE(LOGIN_NO_ENDOPT)
196 AC_DEFINE(LOGIN_NEEDS_UTMPX)
197 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
198 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
200 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
203 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
204 IPADDR_IN_DISPLAY=yes
205 AC_DEFINE(PAM_SUN_CODEBASE)
207 AC_DEFINE(LOGIN_NO_ENDOPT)
208 AC_DEFINE(LOGIN_NEEDS_UTMPX)
209 AC_DEFINE(DISABLE_UTMP)
210 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
211 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
214 AC_DEFINE(BROKEN_GETADDRINFO);;
217 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
220 PATH="$PATH:/usr/etc"
221 AC_DEFINE(BROKEN_INET_NTOA)
222 AC_DEFINE(SETEUID_BREAKS_SETUID)
223 AC_DEFINE(BROKEN_SETREUID)
224 AC_DEFINE(BROKEN_SETREGID)
225 AC_DEFINE(WITH_ABBREV_NO_TTY)
226 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
229 PATH="$PATH:/usr/etc"
230 AC_DEFINE(WITH_IRIX_ARRAY)
231 AC_DEFINE(WITH_IRIX_PROJECT)
232 AC_DEFINE(WITH_IRIX_AUDIT)
233 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
234 AC_DEFINE(BROKEN_INET_NTOA)
235 AC_DEFINE(SETEUID_BREAKS_SETUID)
236 AC_DEFINE(BROKEN_SETREUID)
237 AC_DEFINE(BROKEN_SETREGID)
238 AC_DEFINE(BROKEN_UPDWTMPX)
239 AC_DEFINE(WITH_ABBREV_NO_TTY)
240 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
244 check_for_libcrypt_later=1
245 check_for_openpty_ctty_bug=1
246 AC_DEFINE(DONT_TRY_OTHER_AF)
247 AC_DEFINE(PAM_TTY_KLUDGE)
248 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
249 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
250 inet6_default_4in6=yes
253 AC_DEFINE(BROKEN_CMSG_TYPE)
257 mips-sony-bsd|mips-sony-newsos4)
258 AC_DEFINE(HAVE_NEWS4)
262 check_for_libcrypt_before=1
263 if test "x$withval" != "xno" ; then
268 check_for_libcrypt_later=1
271 AC_DEFINE(SETEUID_BREAKS_SETUID)
272 AC_DEFINE(BROKEN_SETREUID)
273 AC_DEFINE(BROKEN_SETREGID)
276 conf_lastlog_location="/usr/adm/lastlog"
277 conf_utmp_location=/etc/utmp
278 conf_wtmp_location=/usr/adm/wtmp
281 AC_DEFINE(BROKEN_REALPATH)
283 AC_DEFINE(BROKEN_SAVED_UIDS)
286 if test "x$withval" != "xno" ; then
289 AC_DEFINE(PAM_SUN_CODEBASE)
290 AC_DEFINE(LOGIN_NEEDS_UTMPX)
291 AC_DEFINE(LOGIN_NEEDS_TERM)
292 AC_DEFINE(PAM_TTY_KLUDGE)
293 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
294 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
295 AC_DEFINE(SSHD_ACQUIRES_CTTY)
296 external_path_file=/etc/default/login
297 # hardwire lastlog location (can't detect it on some versions)
298 conf_lastlog_location="/var/adm/lastlog"
299 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
300 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
301 if test "$sol2ver" -ge 8; then
303 AC_DEFINE(DISABLE_UTMP)
304 AC_DEFINE(DISABLE_WTMP)
310 CPPFLAGS="$CPPFLAGS -DSUNOS4"
311 AC_CHECK_FUNCS(getpwanam)
312 AC_DEFINE(PAM_SUN_CODEBASE)
313 conf_utmp_location=/etc/utmp
314 conf_wtmp_location=/var/adm/wtmp
315 conf_lastlog_location=/var/adm/lastlog
321 AC_DEFINE(SSHD_ACQUIRES_CTTY)
322 AC_DEFINE(SETEUID_BREAKS_SETUID)
323 AC_DEFINE(BROKEN_SETREUID)
324 AC_DEFINE(BROKEN_SETREGID)
327 # /usr/ucblib MUST NOT be searched on ReliantUNIX
328 AC_CHECK_LIB(dl, dlsym, ,)
329 IPADDR_IN_DISPLAY=yes
331 AC_DEFINE(IP_TOS_IS_BROKEN)
332 AC_DEFINE(SETEUID_BREAKS_SETUID)
333 AC_DEFINE(BROKEN_SETREUID)
334 AC_DEFINE(BROKEN_SETREGID)
335 AC_DEFINE(SSHD_ACQUIRES_CTTY)
336 external_path_file=/etc/default/login
337 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
338 # Attention: always take care to bind libsocket and libnsl before libc,
339 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
343 AC_DEFINE(SETEUID_BREAKS_SETUID)
344 AC_DEFINE(BROKEN_SETREUID)
345 AC_DEFINE(BROKEN_SETREGID)
349 AC_DEFINE(SETEUID_BREAKS_SETUID)
350 AC_DEFINE(BROKEN_SETREUID)
351 AC_DEFINE(BROKEN_SETREGID)
356 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize"
357 LIBS="$LIBS -los -lprot -lcrypt_i -lx -ltinfo -lm"
360 AC_DEFINE(BROKEN_SYS_TERMIO_H)
362 AC_DEFINE(HAVE_SECUREWARE)
363 AC_DEFINE(DISABLE_SHADOW)
364 AC_DEFINE(BROKEN_SAVED_UIDS)
365 AC_DEFINE(WITH_ABBREV_NO_TTY)
366 AC_CHECK_FUNCS(getluid setluid)
368 do_sco3_extra_lib_check=yes
371 if test -z "$GCC"; then
372 CFLAGS="$CFLAGS -belf"
374 LIBS="$LIBS -lprot -lx -ltinfo -lm"
377 AC_DEFINE(HAVE_SECUREWARE)
378 AC_DEFINE(DISABLE_SHADOW)
379 AC_DEFINE(DISABLE_FD_PASSING)
380 AC_DEFINE(SETEUID_BREAKS_SETUID)
381 AC_DEFINE(BROKEN_SETREUID)
382 AC_DEFINE(BROKEN_SETREGID)
383 AC_DEFINE(WITH_ABBREV_NO_TTY)
384 AC_CHECK_FUNCS(getluid setluid)
388 AC_DEFINE(NO_SSH_LASTLOG)
389 AC_DEFINE(SETEUID_BREAKS_SETUID)
390 AC_DEFINE(BROKEN_SETREUID)
391 AC_DEFINE(BROKEN_SETREGID)
393 AC_DEFINE(DISABLE_FD_PASSING)
395 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
399 AC_DEFINE(SETEUID_BREAKS_SETUID)
400 AC_DEFINE(BROKEN_SETREUID)
401 AC_DEFINE(BROKEN_SETREGID)
402 AC_DEFINE(WITH_ABBREV_NO_TTY)
404 AC_DEFINE(DISABLE_FD_PASSING)
406 LIBS="$LIBS -lgen -lacid -ldb"
410 AC_DEFINE(SETEUID_BREAKS_SETUID)
411 AC_DEFINE(BROKEN_SETREUID)
412 AC_DEFINE(BROKEN_SETREGID)
414 AC_DEFINE(DISABLE_FD_PASSING)
415 AC_DEFINE(NO_SSH_LASTLOG)
416 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
417 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
421 AC_MSG_CHECKING(for Digital Unix SIA)
424 [ --with-osfsia Enable Digital Unix SIA],
426 if test "x$withval" = "xno" ; then
427 AC_MSG_RESULT(disabled)
432 if test -z "$no_osfsia" ; then
433 if test -f /etc/sia/matrix.conf; then
435 AC_DEFINE(HAVE_OSF_SIA)
436 AC_DEFINE(DISABLE_LOGIN)
437 AC_DEFINE(DISABLE_FD_PASSING)
438 LIBS="$LIBS -lsecurity -ldb -lm -laud"
441 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
444 AC_DEFINE(BROKEN_GETADDRINFO)
445 AC_DEFINE(SETEUID_BREAKS_SETUID)
446 AC_DEFINE(BROKEN_SETREUID)
447 AC_DEFINE(BROKEN_SETREGID)
452 AC_DEFINE(NO_X11_UNIX_SOCKETS)
453 AC_DEFINE(MISSING_NFDBITS)
454 AC_DEFINE(MISSING_HOWMANY)
455 AC_DEFINE(MISSING_FD_MASK)
459 # Allow user to specify flags
461 [ --with-cflags Specify additional flags to pass to compiler],
463 if test "x$withval" != "xno" ; then
464 CFLAGS="$CFLAGS $withval"
468 AC_ARG_WITH(cppflags,
469 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
471 if test "x$withval" != "xno"; then
472 CPPFLAGS="$CPPFLAGS $withval"
477 [ --with-ldflags Specify additional flags to pass to linker],
479 if test "x$withval" != "xno" ; then
480 LDFLAGS="$LDFLAGS $withval"
485 [ --with-libs Specify additional libraries to link with],
487 if test "x$withval" != "xno" ; then
488 LIBS="$LIBS $withval"
493 AC_MSG_CHECKING(compiler and flags for sanity)
498 [ AC_MSG_RESULT(yes) ],
501 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
505 # Checks for header files.
506 AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
507 getopt.h glob.h ia.h lastlog.h limits.h login.h \
508 login_cap.h maillock.h netdb.h netgroup.h \
509 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
510 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
511 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
512 sys/cdefs.h sys/mman.h sys/prctl.h sys/pstat.h sys/ptms.h \
513 sys/select.h sys/stat.h sys/stream.h sys/stropts.h \
514 sys/sysmacros.h sys/time.h sys/timers.h sys/un.h time.h tmpdir.h \
515 ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
517 # Checks for libraries.
518 AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
519 AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
521 dnl SCO OS3 needs this for libwrap
522 if test "x$with_tcp_wrappers" != "xno" ; then
523 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
524 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
528 dnl IRIX and Solaris 2.5.1 have dirname() in libgen
529 AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
530 AC_CHECK_LIB(gen, dirname,[
531 AC_CACHE_CHECK([for broken dirname],
532 ac_cv_have_broken_dirname, [
540 int main(int argc, char **argv) {
543 strncpy(buf,"/etc", 32);
545 if (!s || strncmp(s, "/", 32) != 0) {
552 [ ac_cv_have_broken_dirname="no" ],
553 [ ac_cv_have_broken_dirname="yes" ]
557 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
559 AC_DEFINE(HAVE_DIRNAME)
560 AC_CHECK_HEADERS(libgen.h)
565 AC_CHECK_FUNC(getspnam, ,
566 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
567 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
571 [ --with-zlib=PATH Use zlib in PATH],
573 if test "x$withval" = "xno" ; then
574 AC_MSG_ERROR([*** zlib is required ***])
576 if test -d "$withval/lib"; then
577 if test -n "${need_dash_r}"; then
578 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
580 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
583 if test -n "${need_dash_r}"; then
584 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
586 LDFLAGS="-L${withval} ${LDFLAGS}"
589 if test -d "$withval/include"; then
590 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
592 CPPFLAGS="-I${withval} ${CPPFLAGS}"
597 AC_CHECK_LIB(z, deflate, ,
599 saved_CPPFLAGS="$CPPFLAGS"
600 saved_LDFLAGS="$LDFLAGS"
602 dnl Check default zlib install dir
603 if test -n "${need_dash_r}"; then
604 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
606 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
608 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
610 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
612 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
617 AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
619 AC_ARG_WITH(zlib-version-check,
620 [ --without-zlib-version-check Disable zlib version check],
621 [ if test "x$withval" = "xno" ; then
622 zlib_check_nonfatal=1
627 AC_MSG_CHECKING(for zlib 1.1.4 or greater)
633 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
635 v = a*1000000 + b*1000 + c;
643 if test -z "$zlib_check_nonfatal" ; then
644 AC_MSG_ERROR([*** zlib too old - check config.log ***
645 Your reported zlib version has known security problems. It's possible your
646 vendor has fixed these problems without changing the version number. If you
647 are sure this is the case, you can disable the check by running
648 "./configure --without-zlib-version-check".
649 If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
651 AC_MSG_WARN([zlib version may have security problems])
657 AC_CHECK_FUNC(strcasecmp,
658 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
660 AC_CHECK_FUNC(utimes,
661 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
662 LIBS="$LIBS -lc89"]) ]
665 dnl Checks for libutil functions
666 AC_CHECK_HEADERS(libutil.h)
667 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
668 AC_CHECK_FUNCS(logout updwtmp logwtmp)
672 # Check for ALTDIRFUNC glob() extension
673 AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
674 AC_EGREP_CPP(FOUNDIT,
677 #ifdef GLOB_ALTDIRFUNC
682 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
690 # Check for g.gl_matchc glob() extension
691 AC_MSG_CHECKING(for gl_matchc field in glob_t)
692 AC_EGREP_CPP(FOUNDIT,
695 int main(void){glob_t g; g.gl_matchc = 1;}
698 AC_DEFINE(GLOB_HAS_GL_MATCHC)
706 AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
709 #include <sys/types.h>
711 int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
713 [AC_MSG_RESULT(yes)],
716 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
720 # Check whether user wants S/Key support
723 [ --with-skey[[=PATH]] Enable S/Key support
724 (optionally in PATH)],
726 if test "x$withval" != "xno" ; then
728 if test "x$withval" != "xyes" ; then
729 CPPFLAGS="$CPPFLAGS -I${withval}/include"
730 LDFLAGS="$LDFLAGS -L${withval}/lib"
737 AC_MSG_CHECKING([for s/key support])
742 int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
744 [AC_MSG_RESULT(yes)],
747 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
753 # Check whether user wants TCP wrappers support
755 AC_ARG_WITH(tcp-wrappers,
756 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
757 (optionally in PATH)],
759 if test "x$withval" != "xno" ; then
761 saved_LDFLAGS="$LDFLAGS"
762 saved_CPPFLAGS="$CPPFLAGS"
763 if test -n "${withval}" -a "${withval}" != "yes"; then
764 if test -d "${withval}/lib"; then
765 if test -n "${need_dash_r}"; then
766 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
768 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
771 if test -n "${need_dash_r}"; then
772 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
774 LDFLAGS="-L${withval} ${LDFLAGS}"
777 if test -d "${withval}/include"; then
778 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
780 CPPFLAGS="-I${withval} ${CPPFLAGS}"
784 LIBS="$LIBWRAP $LIBS"
785 AC_MSG_CHECKING(for libwrap)
789 int deny_severity = 0, allow_severity = 0;
799 AC_MSG_ERROR([*** libwrap missing])
807 dnl Checks for library functions. Please keep in alphabetical order
809 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
810 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
811 getaddrinfo getcwd getgrouplist getnameinfo getopt \
812 getpeereid _getpty getrlimit getttyent glob inet_aton \
813 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
814 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
815 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
816 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
817 setproctitle setregid setreuid setrlimit \
818 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
819 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
820 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
823 # IRIX has a const char return value for gai_strerror()
824 AC_CHECK_FUNCS(gai_strerror,[
825 AC_DEFINE(HAVE_GAI_STRERROR)
827 #include <sys/types.h>
828 #include <sys/socket.h>
831 const char *gai_strerror(int);],[
834 str = gai_strerror(0);],[
835 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
836 [Define if gai_strerror() returns const char *])])])
838 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
840 dnl Make sure prototypes are defined for these before using them.
841 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
842 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
844 dnl tcsendbreak might be a macro
845 AC_CHECK_DECL(tcsendbreak,
846 [AC_DEFINE(HAVE_TCSENDBREAK)],
847 [AC_CHECK_FUNCS(tcsendbreak)],
848 [#include <termios.h>]
851 AC_CHECK_FUNCS(setresuid, [
852 dnl Some platorms have setresuid that isn't implemented, test for this
853 AC_MSG_CHECKING(if setresuid seems to work)
857 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
859 [AC_MSG_RESULT(yes)],
860 [AC_DEFINE(BROKEN_SETRESUID)
861 AC_MSG_RESULT(not implemented)]
865 AC_CHECK_FUNCS(setresgid, [
866 dnl Some platorms have setresgid that isn't implemented, test for this
867 AC_MSG_CHECKING(if setresgid seems to work)
871 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
873 [AC_MSG_RESULT(yes)],
874 [AC_DEFINE(BROKEN_SETRESGID)
875 AC_MSG_RESULT(not implemented)]
879 dnl Checks for time functions
880 AC_CHECK_FUNCS(gettimeofday time)
881 dnl Checks for utmp functions
882 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
883 AC_CHECK_FUNCS(utmpname)
884 dnl Checks for utmpx functions
885 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
886 AC_CHECK_FUNCS(setutxent utmpxname)
888 AC_CHECK_FUNC(daemon,
889 [AC_DEFINE(HAVE_DAEMON)],
890 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
893 AC_CHECK_FUNC(getpagesize,
894 [AC_DEFINE(HAVE_GETPAGESIZE)],
895 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
898 # Check for broken snprintf
899 if test "x$ac_cv_func_snprintf" = "xyes" ; then
900 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
904 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
906 [AC_MSG_RESULT(yes)],
909 AC_DEFINE(BROKEN_SNPRINTF)
910 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
915 dnl see whether mkstemp() requires XXXXXX
916 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
917 AC_MSG_CHECKING([for (overly) strict mkstemp])
921 main() { char template[]="conftest.mkstemp-test";
922 if (mkstemp(template) == -1)
924 unlink(template); exit(0);
932 AC_DEFINE(HAVE_STRICT_MKSTEMP)
936 AC_DEFINE(HAVE_STRICT_MKSTEMP)
941 dnl make sure that openpty does not reacquire controlling terminal
942 if test ! -z "$check_for_openpty_ctty_bug"; then
943 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
947 #include <sys/fcntl.h>
948 #include <sys/types.h>
949 #include <sys/wait.h>
955 int fd, ptyfd, ttyfd, status;
958 if (pid < 0) { /* failed */
960 } else if (pid > 0) { /* parent */
961 waitpid(pid, &status, 0);
962 if (WIFEXITED(status))
963 exit(WEXITSTATUS(status));
967 close(0); close(1); close(2);
969 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
970 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
972 exit(3); /* Acquired ctty: broken */
974 exit(0); /* Did not acquire ctty: OK */
983 AC_DEFINE(SSHD_ACQUIRES_CTTY)
993 [ --with-pam Enable PAM support ],
995 if test "x$withval" != "xno" ; then
996 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
997 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
998 AC_MSG_ERROR([PAM headers not found])
1001 AC_CHECK_LIB(dl, dlopen, , )
1002 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1003 AC_CHECK_FUNCS(pam_getenvlist)
1004 AC_CHECK_FUNCS(pam_putenv)
1009 if test $ac_cv_lib_dl_dlopen = yes; then
1019 # Check for older PAM
1020 if test "x$PAM_MSG" = "xyes" ; then
1021 # Check PAM strerror arguments (old PAM)
1022 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1026 #if defined(HAVE_SECURITY_PAM_APPL_H)
1027 #include <security/pam_appl.h>
1028 #elif defined (HAVE_PAM_PAM_APPL_H)
1029 #include <pam/pam_appl.h>
1032 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1033 [AC_MSG_RESULT(no)],
1035 AC_DEFINE(HAVE_OLD_PAM)
1037 PAM_MSG="yes (old library)"
1042 # Search for OpenSSL
1043 saved_CPPFLAGS="$CPPFLAGS"
1044 saved_LDFLAGS="$LDFLAGS"
1045 AC_ARG_WITH(ssl-dir,
1046 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1048 if test "x$withval" != "xno" ; then
1049 if test -d "$withval/lib"; then
1050 if test -n "${need_dash_r}"; then
1051 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1053 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1056 if test -n "${need_dash_r}"; then
1057 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1059 LDFLAGS="-L${withval} ${LDFLAGS}"
1062 if test -d "$withval/include"; then
1063 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1065 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1070 LIBS="-lcrypto $LIBS"
1071 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1073 dnl Check default openssl install dir
1074 if test -n "${need_dash_r}"; then
1075 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1077 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1079 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1080 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1082 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1088 # Determine OpenSSL header version
1089 AC_MSG_CHECKING([OpenSSL header version])
1094 #include <openssl/opensslv.h>
1095 #define DATA "conftest.sslincver"
1100 fd = fopen(DATA,"w");
1104 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1111 ssl_header_ver=`cat conftest.sslincver`
1112 AC_MSG_RESULT($ssl_header_ver)
1115 AC_MSG_RESULT(not found)
1116 AC_MSG_ERROR(OpenSSL version header not found.)
1120 # Determine OpenSSL library version
1121 AC_MSG_CHECKING([OpenSSL library version])
1126 #include <openssl/opensslv.h>
1127 #include <openssl/crypto.h>
1128 #define DATA "conftest.ssllibver"
1133 fd = fopen(DATA,"w");
1137 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1144 ssl_library_ver=`cat conftest.ssllibver`
1145 AC_MSG_RESULT($ssl_library_ver)
1148 AC_MSG_RESULT(not found)
1149 AC_MSG_ERROR(OpenSSL library not found.)
1153 # Sanity check OpenSSL headers
1154 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1158 #include <openssl/opensslv.h>
1159 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1166 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1167 Check config.log for details.
1168 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1172 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1173 # because the system crypt() is more featureful.
1174 if test "x$check_for_libcrypt_before" = "x1"; then
1175 AC_CHECK_LIB(crypt, crypt)
1178 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1179 # version in OpenSSL.
1180 if test "x$check_for_libcrypt_later" = "x1"; then
1181 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1185 ### Configure cryptographic random number support
1187 # Check wheter OpenSSL seeds itself
1188 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1192 #include <openssl/rand.h>
1193 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1196 OPENSSL_SEEDS_ITSELF=yes
1201 # Default to use of the rand helper if OpenSSL doesn't
1208 # Do we want to force the use of the rand helper?
1209 AC_ARG_WITH(rand-helper,
1210 [ --with-rand-helper Use subprocess to gather strong randomness ],
1212 if test "x$withval" = "xno" ; then
1213 # Force use of OpenSSL's internal RNG, even if
1214 # the previous test showed it to be unseeded.
1215 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1216 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1217 OPENSSL_SEEDS_ITSELF=yes
1226 # Which randomness source do we use?
1227 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1229 AC_DEFINE(OPENSSL_PRNG_ONLY)
1230 RAND_MSG="OpenSSL internal ONLY"
1231 INSTALL_SSH_RAND_HELPER=""
1232 elif test ! -z "$USE_RAND_HELPER" ; then
1233 # install rand helper
1234 RAND_MSG="ssh-rand-helper"
1235 INSTALL_SSH_RAND_HELPER="yes"
1237 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1239 ### Configuration of ssh-rand-helper
1242 AC_ARG_WITH(prngd-port,
1243 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1252 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1255 if test ! -z "$withval" ; then
1256 PRNGD_PORT="$withval"
1257 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1262 # PRNGD Unix domain socket
1263 AC_ARG_WITH(prngd-socket,
1264 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1268 withval="/var/run/egd-pool"
1276 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1280 if test ! -z "$withval" ; then
1281 if test ! -z "$PRNGD_PORT" ; then
1282 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1284 if test ! -r "$withval" ; then
1285 AC_MSG_WARN(Entropy socket is not readable)
1287 PRNGD_SOCKET="$withval"
1288 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1292 # Check for existing socket only if we don't have a random device already
1293 if test "$USE_RAND_HELPER" = yes ; then
1294 AC_MSG_CHECKING(for PRNGD/EGD socket)
1295 # Insert other locations here
1296 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1297 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1298 PRNGD_SOCKET="$sock"
1299 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1303 if test ! -z "$PRNGD_SOCKET" ; then
1304 AC_MSG_RESULT($PRNGD_SOCKET)
1306 AC_MSG_RESULT(not found)
1312 # Change default command timeout for hashing entropy source
1314 AC_ARG_WITH(entropy-timeout,
1315 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1317 if test "x$withval" != "xno" ; then
1318 entropy_timeout=$withval
1322 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1324 SSH_PRIVSEP_USER=sshd
1325 AC_ARG_WITH(privsep-user,
1326 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1328 if test -n "$withval"; then
1329 SSH_PRIVSEP_USER=$withval
1333 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1334 AC_SUBST(SSH_PRIVSEP_USER)
1336 # We do this little dance with the search path to insure
1337 # that programs that we select for use by installed programs
1338 # (which may be run by the super-user) come from trusted
1339 # locations before they come from the user's private area.
1340 # This should help avoid accidentally configuring some
1341 # random version of a program in someone's personal bin.
1345 test -h /bin 2> /dev/null && PATH=/usr/bin
1346 test -d /sbin && PATH=$PATH:/sbin
1347 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1348 PATH=$PATH:/etc:$OPATH
1350 # These programs are used by the command hashing source to gather entropy
1351 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1352 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1353 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1354 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1355 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1356 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1357 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1358 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1359 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1360 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1361 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1362 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1363 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1364 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1365 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1366 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1370 # Where does ssh-rand-helper get its randomness from?
1371 INSTALL_SSH_PRNG_CMDS=""
1372 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1373 if test ! -z "$PRNGD_PORT" ; then
1374 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1375 elif test ! -z "$PRNGD_SOCKET" ; then
1376 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1378 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1379 RAND_HELPER_CMDHASH=yes
1380 INSTALL_SSH_PRNG_CMDS="yes"
1383 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1386 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1387 if test ! -z "$SONY" ; then
1388 LIBS="$LIBS -liberty";
1391 # Checks for data types
1392 AC_CHECK_SIZEOF(char, 1)
1393 AC_CHECK_SIZEOF(short int, 2)
1394 AC_CHECK_SIZEOF(int, 4)
1395 AC_CHECK_SIZEOF(long int, 4)
1396 AC_CHECK_SIZEOF(long long int, 8)
1398 # Sanity check long long for some platforms (AIX)
1399 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1400 ac_cv_sizeof_long_long_int=0
1403 # More checks for data types
1404 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1406 [ #include <sys/types.h> ],
1408 [ ac_cv_have_u_int="yes" ],
1409 [ ac_cv_have_u_int="no" ]
1412 if test "x$ac_cv_have_u_int" = "xyes" ; then
1413 AC_DEFINE(HAVE_U_INT)
1417 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1419 [ #include <sys/types.h> ],
1420 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1421 [ ac_cv_have_intxx_t="yes" ],
1422 [ ac_cv_have_intxx_t="no" ]
1425 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1426 AC_DEFINE(HAVE_INTXX_T)
1430 if (test -z "$have_intxx_t" && \
1431 test "x$ac_cv_header_stdint_h" = "xyes")
1433 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1435 [ #include <stdint.h> ],
1436 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1438 AC_DEFINE(HAVE_INTXX_T)
1441 [ AC_MSG_RESULT(no) ]
1445 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1448 #include <sys/types.h>
1449 #ifdef HAVE_STDINT_H
1450 # include <stdint.h>
1452 #include <sys/socket.h>
1453 #ifdef HAVE_SYS_BITYPES_H
1454 # include <sys/bitypes.h>
1457 [ int64_t a; a = 1;],
1458 [ ac_cv_have_int64_t="yes" ],
1459 [ ac_cv_have_int64_t="no" ]
1462 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1463 AC_DEFINE(HAVE_INT64_T)
1466 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1468 [ #include <sys/types.h> ],
1469 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1470 [ ac_cv_have_u_intxx_t="yes" ],
1471 [ ac_cv_have_u_intxx_t="no" ]
1474 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1475 AC_DEFINE(HAVE_U_INTXX_T)
1479 if test -z "$have_u_intxx_t" ; then
1480 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1482 [ #include <sys/socket.h> ],
1483 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1485 AC_DEFINE(HAVE_U_INTXX_T)
1488 [ AC_MSG_RESULT(no) ]
1492 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1494 [ #include <sys/types.h> ],
1495 [ u_int64_t a; a = 1;],
1496 [ ac_cv_have_u_int64_t="yes" ],
1497 [ ac_cv_have_u_int64_t="no" ]
1500 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1501 AC_DEFINE(HAVE_U_INT64_T)
1505 if test -z "$have_u_int64_t" ; then
1506 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1508 [ #include <sys/bitypes.h> ],
1509 [ u_int64_t a; a = 1],
1511 AC_DEFINE(HAVE_U_INT64_T)
1514 [ AC_MSG_RESULT(no) ]
1518 if test -z "$have_u_intxx_t" ; then
1519 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1522 #include <sys/types.h>
1524 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1525 [ ac_cv_have_uintxx_t="yes" ],
1526 [ ac_cv_have_uintxx_t="no" ]
1529 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1530 AC_DEFINE(HAVE_UINTXX_T)
1534 if test -z "$have_uintxx_t" ; then
1535 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1537 [ #include <stdint.h> ],
1538 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1540 AC_DEFINE(HAVE_UINTXX_T)
1543 [ AC_MSG_RESULT(no) ]
1547 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1548 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1550 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1553 #include <sys/bitypes.h>
1556 int8_t a; int16_t b; int32_t c;
1557 u_int8_t e; u_int16_t f; u_int32_t g;
1558 a = b = c = e = f = g = 1;
1561 AC_DEFINE(HAVE_U_INTXX_T)
1562 AC_DEFINE(HAVE_INTXX_T)
1570 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1573 #include <sys/types.h>
1575 [ u_char foo; foo = 125; ],
1576 [ ac_cv_have_u_char="yes" ],
1577 [ ac_cv_have_u_char="no" ]
1580 if test "x$ac_cv_have_u_char" = "xyes" ; then
1581 AC_DEFINE(HAVE_U_CHAR)
1586 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1588 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1591 #include <sys/types.h>
1593 [ size_t foo; foo = 1235; ],
1594 [ ac_cv_have_size_t="yes" ],
1595 [ ac_cv_have_size_t="no" ]
1598 if test "x$ac_cv_have_size_t" = "xyes" ; then
1599 AC_DEFINE(HAVE_SIZE_T)
1602 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1605 #include <sys/types.h>
1607 [ ssize_t foo; foo = 1235; ],
1608 [ ac_cv_have_ssize_t="yes" ],
1609 [ ac_cv_have_ssize_t="no" ]
1612 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1613 AC_DEFINE(HAVE_SSIZE_T)
1616 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1621 [ clock_t foo; foo = 1235; ],
1622 [ ac_cv_have_clock_t="yes" ],
1623 [ ac_cv_have_clock_t="no" ]
1626 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1627 AC_DEFINE(HAVE_CLOCK_T)
1630 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1633 #include <sys/types.h>
1634 #include <sys/socket.h>
1636 [ sa_family_t foo; foo = 1235; ],
1637 [ ac_cv_have_sa_family_t="yes" ],
1640 #include <sys/types.h>
1641 #include <sys/socket.h>
1642 #include <netinet/in.h>
1644 [ sa_family_t foo; foo = 1235; ],
1645 [ ac_cv_have_sa_family_t="yes" ],
1647 [ ac_cv_have_sa_family_t="no" ]
1651 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1652 AC_DEFINE(HAVE_SA_FAMILY_T)
1655 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1658 #include <sys/types.h>
1660 [ pid_t foo; foo = 1235; ],
1661 [ ac_cv_have_pid_t="yes" ],
1662 [ ac_cv_have_pid_t="no" ]
1665 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1666 AC_DEFINE(HAVE_PID_T)
1669 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1672 #include <sys/types.h>
1674 [ mode_t foo; foo = 1235; ],
1675 [ ac_cv_have_mode_t="yes" ],
1676 [ ac_cv_have_mode_t="no" ]
1679 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1680 AC_DEFINE(HAVE_MODE_T)
1684 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1687 #include <sys/types.h>
1688 #include <sys/socket.h>
1690 [ struct sockaddr_storage s; ],
1691 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1692 [ ac_cv_have_struct_sockaddr_storage="no" ]
1695 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1696 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1699 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1702 #include <sys/types.h>
1703 #include <netinet/in.h>
1705 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1706 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1707 [ ac_cv_have_struct_sockaddr_in6="no" ]
1710 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1711 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1714 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1717 #include <sys/types.h>
1718 #include <netinet/in.h>
1720 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1721 [ ac_cv_have_struct_in6_addr="yes" ],
1722 [ ac_cv_have_struct_in6_addr="no" ]
1725 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1726 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1729 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1732 #include <sys/types.h>
1733 #include <sys/socket.h>
1736 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1737 [ ac_cv_have_struct_addrinfo="yes" ],
1738 [ ac_cv_have_struct_addrinfo="no" ]
1741 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1742 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1745 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1747 [ #include <sys/time.h> ],
1748 [ struct timeval tv; tv.tv_sec = 1;],
1749 [ ac_cv_have_struct_timeval="yes" ],
1750 [ ac_cv_have_struct_timeval="no" ]
1753 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1754 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1755 have_struct_timeval=1
1758 AC_CHECK_TYPES(struct timespec)
1760 # We need int64_t or else certian parts of the compile will fail.
1761 if test "x$ac_cv_have_int64_t" = "xno" -a \
1762 "x$ac_cv_sizeof_long_int" != "x8" -a \
1763 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1764 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1765 echo "an alternative compiler (I.E., GCC) before continuing."
1769 dnl test snprintf (broken on SCO w/gcc)
1774 #ifdef HAVE_SNPRINTF
1778 char expected_out[50];
1780 #if (SIZEOF_LONG_INT == 8)
1781 long int num = 0x7fffffffffffffff;
1783 long long num = 0x7fffffffffffffffll;
1785 strcpy(expected_out, "9223372036854775807");
1786 snprintf(buf, mazsize, "%lld", num);
1787 if(strcmp(buf, expected_out) != 0)
1794 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1798 dnl Checks for structure members
1799 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1800 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1801 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1802 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1803 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1804 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1805 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1806 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1807 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1808 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1809 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1810 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1811 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1812 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1813 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1814 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1815 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1817 AC_CHECK_MEMBERS([struct stat.st_blksize])
1819 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1820 ac_cv_have_ss_family_in_struct_ss, [
1823 #include <sys/types.h>
1824 #include <sys/socket.h>
1826 [ struct sockaddr_storage s; s.ss_family = 1; ],
1827 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1828 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1831 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1832 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1835 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1836 ac_cv_have___ss_family_in_struct_ss, [
1839 #include <sys/types.h>
1840 #include <sys/socket.h>
1842 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1843 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1844 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1847 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1848 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1851 AC_CACHE_CHECK([for pw_class field in struct passwd],
1852 ac_cv_have_pw_class_in_struct_passwd, [
1857 [ struct passwd p; p.pw_class = 0; ],
1858 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1859 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1862 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1863 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1866 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1867 ac_cv_have_pw_expire_in_struct_passwd, [
1872 [ struct passwd p; p.pw_expire = 0; ],
1873 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1874 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1877 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1878 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1881 AC_CACHE_CHECK([for pw_change field in struct passwd],
1882 ac_cv_have_pw_change_in_struct_passwd, [
1887 [ struct passwd p; p.pw_change = 0; ],
1888 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1889 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1892 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1893 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1896 dnl make sure we're using the real structure members and not defines
1897 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1898 ac_cv_have_accrights_in_msghdr, [
1901 #include <sys/types.h>
1902 #include <sys/socket.h>
1903 #include <sys/uio.h>
1905 #ifdef msg_accrights
1909 m.msg_accrights = 0;
1913 [ ac_cv_have_accrights_in_msghdr="yes" ],
1914 [ ac_cv_have_accrights_in_msghdr="no" ]
1917 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1918 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1921 AC_CACHE_CHECK([for msg_control field in struct msghdr],
1922 ac_cv_have_control_in_msghdr, [
1925 #include <sys/types.h>
1926 #include <sys/socket.h>
1927 #include <sys/uio.h>
1937 [ ac_cv_have_control_in_msghdr="yes" ],
1938 [ ac_cv_have_control_in_msghdr="no" ]
1941 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1942 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1945 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1947 [ extern char *__progname; printf("%s", __progname); ],
1948 [ ac_cv_libc_defines___progname="yes" ],
1949 [ ac_cv_libc_defines___progname="no" ]
1952 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1953 AC_DEFINE(HAVE___PROGNAME)
1956 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1960 [ printf("%s", __FUNCTION__); ],
1961 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1962 [ ac_cv_cc_implements___FUNCTION__="no" ]
1965 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1966 AC_DEFINE(HAVE___FUNCTION__)
1969 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1973 [ printf("%s", __func__); ],
1974 [ ac_cv_cc_implements___func__="yes" ],
1975 [ ac_cv_cc_implements___func__="no" ]
1978 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1979 AC_DEFINE(HAVE___func__)
1982 AC_CACHE_CHECK([whether getopt has optreset support],
1983 ac_cv_have_getopt_optreset, [
1988 [ extern int optreset; optreset = 0; ],
1989 [ ac_cv_have_getopt_optreset="yes" ],
1990 [ ac_cv_have_getopt_optreset="no" ]
1993 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1994 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1997 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1999 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2000 [ ac_cv_libc_defines_sys_errlist="yes" ],
2001 [ ac_cv_libc_defines_sys_errlist="no" ]
2004 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2005 AC_DEFINE(HAVE_SYS_ERRLIST)
2009 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2011 [ extern int sys_nerr; printf("%i", sys_nerr);],
2012 [ ac_cv_libc_defines_sys_nerr="yes" ],
2013 [ ac_cv_libc_defines_sys_nerr="no" ]
2016 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2017 AC_DEFINE(HAVE_SYS_NERR)
2021 # Check whether user wants sectok support
2023 [ --with-sectok Enable smartcard support using libsectok],
2025 if test "x$withval" != "xno" ; then
2026 if test "x$withval" != "xyes" ; then
2027 CPPFLAGS="$CPPFLAGS -I${withval}"
2028 LDFLAGS="$LDFLAGS -L${withval}"
2029 if test ! -z "$need_dash_r" ; then
2030 LDFLAGS="$LDFLAGS -R${withval}"
2032 if test ! -z "$blibpath" ; then
2033 blibpath="$blibpath:${withval}"
2036 AC_CHECK_HEADERS(sectok.h)
2037 if test "$ac_cv_header_sectok_h" != yes; then
2038 AC_MSG_ERROR(Can't find sectok.h)
2040 AC_CHECK_LIB(sectok, sectok_open)
2041 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2042 AC_MSG_ERROR(Can't find libsectok)
2044 AC_DEFINE(SMARTCARD)
2045 AC_DEFINE(USE_SECTOK)
2046 SCARD_MSG="yes, using sectok"
2051 # Check whether user wants OpenSC support
2053 AC_HELP_STRING([--with-opensc=PFX],
2054 [Enable smartcard support using OpenSC]),
2055 opensc_config_prefix="$withval", opensc_config_prefix="")
2056 if test x$opensc_config_prefix != x ; then
2057 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2058 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2059 if test "$OPENSC_CONFIG" != "no"; then
2060 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2061 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2062 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2063 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2064 AC_DEFINE(SMARTCARD)
2065 AC_DEFINE(USE_OPENSC)
2066 SCARD_MSG="yes, using OpenSC"
2070 # Check libraries needed by DNS fingerprint support
2071 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2072 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
2074 # Needed by our getrrsetbyname()
2075 AC_SEARCH_LIBS(res_query, resolv)
2076 AC_SEARCH_LIBS(dn_expand, resolv)
2077 AC_CHECK_FUNCS(_getshort _getlong)
2078 AC_CHECK_MEMBER(HEADER.ad,
2079 [AC_DEFINE(HAVE_HEADER_AD)],,
2080 [#include <arpa/nameser.h>])
2083 # Check whether user wants Kerberos 5 support
2085 AC_ARG_WITH(kerberos5,
2086 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2087 [ if test "x$withval" != "xno" ; then
2088 if test "x$withval" = "xyes" ; then
2089 KRB5ROOT="/usr/local"
2097 AC_MSG_CHECKING(for krb5-config)
2098 if test -x $KRB5ROOT/bin/krb5-config ; then
2099 KRB5CONF=$KRB5ROOT/bin/krb5-config
2100 AC_MSG_RESULT($KRB5CONF)
2102 AC_MSG_CHECKING(for gssapi support)
2103 if $KRB5CONF | grep gssapi >/dev/null ; then
2111 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2112 K5LIBS="`$KRB5CONF --libs $k5confopts`"
2113 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2114 AC_MSG_CHECKING(whether we are using Heimdal)
2115 AC_TRY_COMPILE([ #include <krb5.h> ],
2116 [ char *tmp = heimdal_version; ],
2117 [ AC_MSG_RESULT(yes)
2118 AC_DEFINE(HEIMDAL) ],
2123 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2124 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2125 AC_MSG_CHECKING(whether we are using Heimdal)
2126 AC_TRY_COMPILE([ #include <krb5.h> ],
2127 [ char *tmp = heimdal_version; ],
2128 [ AC_MSG_RESULT(yes)
2130 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2133 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2136 AC_SEARCH_LIBS(dn_expand, resolv)
2138 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2140 K5LIBS="-lgssapi $K5LIBS" ],
2141 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2143 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2144 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2149 AC_CHECK_HEADER(gssapi.h, ,
2150 [ unset ac_cv_header_gssapi_h
2151 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2152 AC_CHECK_HEADERS(gssapi.h, ,
2153 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2159 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2160 AC_CHECK_HEADER(gssapi_krb5.h, ,
2161 [ CPPFLAGS="$oldCPP" ])
2164 if test ! -z "$need_dash_r" ; then
2165 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2167 if test ! -z "$blibpath" ; then
2168 blibpath="$blibpath:${KRB5ROOT}/lib"
2172 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2173 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2174 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2176 LIBS="$LIBS $K5LIBS"
2177 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2181 # Looking for programs, paths and files
2183 PRIVSEP_PATH=/var/empty
2184 AC_ARG_WITH(privsep-path,
2185 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2187 if test "x$withval" != "$no" ; then
2188 PRIVSEP_PATH=$withval
2192 AC_SUBST(PRIVSEP_PATH)
2195 [ --with-xauth=PATH Specify path to xauth program ],
2197 if test "x$withval" != "xno" ; then
2203 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2204 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2205 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2206 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2207 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2208 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2209 xauth_path="/usr/openwin/bin/xauth"
2215 AC_ARG_ENABLE(strip,
2216 [ --disable-strip Disable calling strip(1) on install],
2218 if test "x$enableval" = "xno" ; then
2225 if test -z "$xauth_path" ; then
2226 XAUTH_PATH="undefined"
2227 AC_SUBST(XAUTH_PATH)
2229 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2230 XAUTH_PATH=$xauth_path
2231 AC_SUBST(XAUTH_PATH)
2234 # Check for mail directory (last resort if we cannot get it from headers)
2235 if test ! -z "$MAIL" ; then
2236 maildir=`dirname $MAIL`
2237 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2240 if test -z "$no_dev_ptmx" ; then
2241 if test "x$disable_ptmx_check" != "xyes" ; then
2242 AC_CHECK_FILE("/dev/ptmx",
2244 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2250 AC_CHECK_FILE("/dev/ptc",
2252 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2257 # Options from here on. Some of these are preset by platform above
2258 AC_ARG_WITH(mantype,
2259 [ --with-mantype=man|cat|doc Set man page type],
2266 AC_MSG_ERROR(invalid man type: $withval)
2271 if test -z "$MANTYPE"; then
2272 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2273 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2274 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2276 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2283 if test "$MANTYPE" = "doc"; then
2290 # Check whether to enable MD5 passwords
2292 AC_ARG_WITH(md5-passwords,
2293 [ --with-md5-passwords Enable use of MD5 passwords],
2295 if test "x$withval" != "xno" ; then
2296 AC_DEFINE(HAVE_MD5_PASSWORDS)
2302 # Whether to disable shadow password support
2304 [ --without-shadow Disable shadow password support],
2306 if test "x$withval" = "xno" ; then
2307 AC_DEFINE(DISABLE_SHADOW)
2313 if test -z "$disable_shadow" ; then
2314 AC_MSG_CHECKING([if the systems has expire shadow information])
2317 #include <sys/types.h>
2320 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2321 [ sp_expire_available=yes ], []
2324 if test "x$sp_expire_available" = "xyes" ; then
2326 AC_DEFINE(HAS_SHADOW_EXPIRE)
2332 # Use ip address instead of hostname in $DISPLAY
2333 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2334 DISPLAY_HACK_MSG="yes"
2335 AC_DEFINE(IPADDR_IN_DISPLAY)
2337 DISPLAY_HACK_MSG="no"
2338 AC_ARG_WITH(ipaddr-display,
2339 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2341 if test "x$withval" != "xno" ; then
2342 AC_DEFINE(IPADDR_IN_DISPLAY)
2343 DISPLAY_HACK_MSG="yes"
2349 # check for /etc/default/login and use it if present.
2350 AC_ARG_ENABLE(etc-default-login,
2351 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2353 AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2355 if test "x$external_path_file" = "x/etc/default/login"; then
2356 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2360 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2361 if test $ac_cv_func_login_getcapbool = "yes" -a \
2362 $ac_cv_header_login_cap_h = "yes" ; then
2363 external_path_file=/etc/login.conf
2366 # Whether to mess with the default path
2367 SERVER_PATH_MSG="(default)"
2368 AC_ARG_WITH(default-path,
2369 [ --with-default-path= Specify default \$PATH environment for server],
2371 if test "x$external_path_file" = "x/etc/login.conf" ; then
2373 --with-default-path=PATH has no effect on this system.
2374 Edit /etc/login.conf instead.])
2375 elif test "x$withval" != "xno" ; then
2376 if test ! -z "$external_path_file" ; then
2378 --with-default-path=PATH will only be used if PATH is not defined in
2379 $external_path_file .])
2381 user_path="$withval"
2382 SERVER_PATH_MSG="$withval"
2385 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2386 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2388 if test ! -z "$external_path_file" ; then
2390 If PATH is defined in $external_path_file, ensure the path to scp is included,
2391 otherwise scp will not work.])
2395 /* find out what STDPATH is */
2400 #ifndef _PATH_STDPATH
2401 # ifdef _PATH_USERPATH /* Irix */
2402 # define _PATH_STDPATH _PATH_USERPATH
2404 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2407 #include <sys/types.h>
2408 #include <sys/stat.h>
2410 #define DATA "conftest.stdpath"
2417 fd = fopen(DATA,"w");
2421 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2426 ], [ user_path=`cat conftest.stdpath` ],
2427 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2428 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2430 # make sure $bindir is in USER_PATH so scp will work
2431 t_bindir=`eval echo ${bindir}`
2433 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2436 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2438 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2439 if test $? -ne 0 ; then
2440 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2441 if test $? -ne 0 ; then
2442 user_path=$user_path:$t_bindir
2443 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2448 if test "x$external_path_file" != "x/etc/login.conf" ; then
2449 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2453 # Set superuser path separately to user path
2454 AC_ARG_WITH(superuser-path,
2455 [ --with-superuser-path= Specify different path for super-user],
2457 if test "x$withval" != "xno" ; then
2458 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2459 superuser_path=$withval
2465 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2466 IPV4_IN6_HACK_MSG="no"
2468 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2470 if test "x$withval" != "xno" ; then
2472 AC_DEFINE(IPV4_IN_IPV6)
2473 IPV4_IN6_HACK_MSG="yes"
2478 if test "x$inet6_default_4in6" = "xyes"; then
2479 AC_MSG_RESULT([yes (default)])
2480 AC_DEFINE(IPV4_IN_IPV6)
2481 IPV4_IN6_HACK_MSG="yes"
2483 AC_MSG_RESULT([no (default)])
2488 # Whether to enable BSD auth support
2490 AC_ARG_WITH(bsd-auth,
2491 [ --with-bsd-auth Enable BSD auth support],
2493 if test "x$withval" != "xno" ; then
2500 # Where to place sshd.pid
2502 # make sure the directory exists
2503 if test ! -d $piddir ; then
2504 piddir=`eval echo ${sysconfdir}`
2506 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2510 AC_ARG_WITH(pid-dir,
2511 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2513 if test "x$withval" != "xno" ; then
2515 if test ! -d $piddir ; then
2516 AC_MSG_WARN([** no $piddir directory on this system **])
2522 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2525 dnl allow user to disable some login recording features
2526 AC_ARG_ENABLE(lastlog,
2527 [ --disable-lastlog disable use of lastlog even if detected [no]],
2529 if test "x$enableval" = "xno" ; then
2530 AC_DEFINE(DISABLE_LASTLOG)
2535 [ --disable-utmp disable use of utmp even if detected [no]],
2537 if test "x$enableval" = "xno" ; then
2538 AC_DEFINE(DISABLE_UTMP)
2542 AC_ARG_ENABLE(utmpx,
2543 [ --disable-utmpx disable use of utmpx even if detected [no]],
2545 if test "x$enableval" = "xno" ; then
2546 AC_DEFINE(DISABLE_UTMPX)
2551 [ --disable-wtmp disable use of wtmp even if detected [no]],
2553 if test "x$enableval" = "xno" ; then
2554 AC_DEFINE(DISABLE_WTMP)
2558 AC_ARG_ENABLE(wtmpx,
2559 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2561 if test "x$enableval" = "xno" ; then
2562 AC_DEFINE(DISABLE_WTMPX)
2566 AC_ARG_ENABLE(libutil,
2567 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2569 if test "x$enableval" = "xno" ; then
2570 AC_DEFINE(DISABLE_LOGIN)
2574 AC_ARG_ENABLE(pututline,
2575 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2577 if test "x$enableval" = "xno" ; then
2578 AC_DEFINE(DISABLE_PUTUTLINE)
2582 AC_ARG_ENABLE(pututxline,
2583 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2585 if test "x$enableval" = "xno" ; then
2586 AC_DEFINE(DISABLE_PUTUTXLINE)
2590 AC_ARG_WITH(lastlog,
2591 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2593 if test "x$withval" = "xno" ; then
2594 AC_DEFINE(DISABLE_LASTLOG)
2596 conf_lastlog_location=$withval
2601 dnl lastlog, [uw]tmpx? detection
2602 dnl NOTE: set the paths in the platform section to avoid the
2603 dnl need for command-line parameters
2604 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2606 dnl lastlog detection
2607 dnl NOTE: the code itself will detect if lastlog is a directory
2608 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2610 #include <sys/types.h>
2612 #ifdef HAVE_LASTLOG_H
2613 # include <lastlog.h>
2622 [ char *lastlog = LASTLOG_FILE; ],
2623 [ AC_MSG_RESULT(yes) ],
2626 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2628 #include <sys/types.h>
2630 #ifdef HAVE_LASTLOG_H
2631 # include <lastlog.h>
2637 [ char *lastlog = _PATH_LASTLOG; ],
2638 [ AC_MSG_RESULT(yes) ],
2641 system_lastlog_path=no
2646 if test -z "$conf_lastlog_location"; then
2647 if test x"$system_lastlog_path" = x"no" ; then
2648 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2649 if (test -d "$f" || test -f "$f") ; then
2650 conf_lastlog_location=$f
2653 if test -z "$conf_lastlog_location"; then
2654 AC_MSG_WARN([** Cannot find lastlog **])
2655 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2660 if test -n "$conf_lastlog_location"; then
2661 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2665 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2667 #include <sys/types.h>
2673 [ char *utmp = UTMP_FILE; ],
2674 [ AC_MSG_RESULT(yes) ],
2676 system_utmp_path=no ]
2678 if test -z "$conf_utmp_location"; then
2679 if test x"$system_utmp_path" = x"no" ; then
2680 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2681 if test -f $f ; then
2682 conf_utmp_location=$f
2685 if test -z "$conf_utmp_location"; then
2686 AC_DEFINE(DISABLE_UTMP)
2690 if test -n "$conf_utmp_location"; then
2691 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2695 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2697 #include <sys/types.h>
2703 [ char *wtmp = WTMP_FILE; ],
2704 [ AC_MSG_RESULT(yes) ],
2706 system_wtmp_path=no ]
2708 if test -z "$conf_wtmp_location"; then
2709 if test x"$system_wtmp_path" = x"no" ; then
2710 for f in /usr/adm/wtmp /var/log/wtmp; do
2711 if test -f $f ; then
2712 conf_wtmp_location=$f
2715 if test -z "$conf_wtmp_location"; then
2716 AC_DEFINE(DISABLE_WTMP)
2720 if test -n "$conf_wtmp_location"; then
2721 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2725 dnl utmpx detection - I don't know any system so perverse as to require
2726 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2728 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2730 #include <sys/types.h>
2739 [ char *utmpx = UTMPX_FILE; ],
2740 [ AC_MSG_RESULT(yes) ],
2742 system_utmpx_path=no ]
2744 if test -z "$conf_utmpx_location"; then
2745 if test x"$system_utmpx_path" = x"no" ; then
2746 AC_DEFINE(DISABLE_UTMPX)
2749 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2753 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2755 #include <sys/types.h>
2764 [ char *wtmpx = WTMPX_FILE; ],
2765 [ AC_MSG_RESULT(yes) ],
2767 system_wtmpx_path=no ]
2769 if test -z "$conf_wtmpx_location"; then
2770 if test x"$system_wtmpx_path" = x"no" ; then
2771 AC_DEFINE(DISABLE_WTMPX)
2774 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2778 if test ! -z "$blibpath" ; then
2779 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2780 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2783 dnl remove pam and dl because they are in $LIBPAM
2784 if test "$PAM_MSG" = yes ; then
2785 LIBS=`echo $LIBS | sed 's/-lpam //'`
2787 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2788 LIBS=`echo $LIBS | sed 's/-ldl //'`
2792 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2795 # Print summary of options
2797 # Someone please show me a better way :)
2798 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2799 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2800 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2801 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2802 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2803 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2804 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2805 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2806 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2807 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2810 echo "OpenSSH has been configured with the following options:"
2811 echo " User binaries: $B"
2812 echo " System binaries: $C"
2813 echo " Configuration files: $D"
2814 echo " Askpass program: $E"
2815 echo " Manual pages: $F"
2816 echo " PID file: $G"
2817 echo " Privilege separation chroot path: $H"
2818 if test "x$external_path_file" = "x/etc/login.conf" ; then
2819 echo " At runtime, sshd will use the path defined in $external_path_file"
2820 echo " Make sure the path to scp is present, otherwise scp will not work"
2822 echo " sshd default user PATH: $I"
2823 if test ! -z "$external_path_file"; then
2824 echo " (If PATH is set in $external_path_file it will be used instead. If"
2825 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2828 if test ! -z "$superuser_path" ; then
2829 echo " sshd superuser user PATH: $J"
2831 echo " Manpage format: $MANTYPE"
2832 echo " PAM support: $PAM_MSG"
2833 echo " KerberosV support: $KRB5_MSG"
2834 echo " Smartcard support: $SCARD_MSG"
2835 echo " S/KEY support: $SKEY_MSG"
2836 echo " TCP Wrappers support: $TCPW_MSG"
2837 echo " MD5 password support: $MD5_MSG"
2838 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2839 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2840 echo " BSD Auth support: $BSD_AUTH_MSG"
2841 echo " Random number source: $RAND_MSG"
2842 if test ! -z "$USE_RAND_HELPER" ; then
2843 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2848 echo " Host: ${host}"
2849 echo " Compiler: ${CC}"
2850 echo " Compiler flags: ${CFLAGS}"
2851 echo "Preprocessor flags: ${CPPFLAGS}"
2852 echo " Linker flags: ${LDFLAGS}"
2853 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2857 if test "x$PAM_MSG" = "xyes" ; then
2858 echo "PAM is enabled. You may need to install a PAM control file "
2859 echo "for sshd, otherwise password authentication may fail. "
2860 echo "Example PAM control files can be found in the contrib/ "
2865 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2866 echo "WARNING: you are using the builtin random number collection "
2867 echo "service. Please read WARNING.RNG and request that your OS "
2868 echo "vendor includes kernel-based random number collection in "
2869 echo "future versions of your OS."