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)
212 check_for_hpux_broken_getaddrinfo=1
214 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
217 PATH="$PATH:/usr/etc"
218 AC_DEFINE(BROKEN_INET_NTOA)
219 AC_DEFINE(SETEUID_BREAKS_SETUID)
220 AC_DEFINE(BROKEN_SETREUID)
221 AC_DEFINE(BROKEN_SETREGID)
222 AC_DEFINE(WITH_ABBREV_NO_TTY)
223 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
226 PATH="$PATH:/usr/etc"
227 AC_DEFINE(WITH_IRIX_ARRAY)
228 AC_DEFINE(WITH_IRIX_PROJECT)
229 AC_DEFINE(WITH_IRIX_AUDIT)
230 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
231 AC_DEFINE(BROKEN_INET_NTOA)
232 AC_DEFINE(SETEUID_BREAKS_SETUID)
233 AC_DEFINE(BROKEN_SETREUID)
234 AC_DEFINE(BROKEN_SETREGID)
235 AC_DEFINE(BROKEN_UPDWTMPX)
236 AC_DEFINE(WITH_ABBREV_NO_TTY)
237 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
241 check_for_libcrypt_later=1
242 check_for_openpty_ctty_bug=1
243 AC_DEFINE(DONT_TRY_OTHER_AF)
244 AC_DEFINE(PAM_TTY_KLUDGE)
245 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
246 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
247 inet6_default_4in6=yes
250 AC_DEFINE(BROKEN_CMSG_TYPE)
254 mips-sony-bsd|mips-sony-newsos4)
255 AC_DEFINE(HAVE_NEWS4)
259 check_for_libcrypt_before=1
260 if test "x$withval" != "xno" ; then
265 check_for_libcrypt_later=1
268 AC_DEFINE(SETEUID_BREAKS_SETUID)
269 AC_DEFINE(BROKEN_SETREUID)
270 AC_DEFINE(BROKEN_SETREGID)
273 conf_lastlog_location="/usr/adm/lastlog"
274 conf_utmp_location=/etc/utmp
275 conf_wtmp_location=/usr/adm/wtmp
278 AC_DEFINE(BROKEN_REALPATH)
280 AC_DEFINE(BROKEN_SAVED_UIDS)
283 if test "x$withval" != "xno" ; then
286 AC_DEFINE(PAM_SUN_CODEBASE)
287 AC_DEFINE(LOGIN_NEEDS_UTMPX)
288 AC_DEFINE(LOGIN_NEEDS_TERM)
289 AC_DEFINE(PAM_TTY_KLUDGE)
290 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
291 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
292 AC_DEFINE(SSHD_ACQUIRES_CTTY)
293 external_path_file=/etc/default/login
294 # hardwire lastlog location (can't detect it on some versions)
295 conf_lastlog_location="/var/adm/lastlog"
296 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
297 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
298 if test "$sol2ver" -ge 8; then
300 AC_DEFINE(DISABLE_UTMP)
301 AC_DEFINE(DISABLE_WTMP)
307 CPPFLAGS="$CPPFLAGS -DSUNOS4"
308 AC_CHECK_FUNCS(getpwanam)
309 AC_DEFINE(PAM_SUN_CODEBASE)
310 conf_utmp_location=/etc/utmp
311 conf_wtmp_location=/var/adm/wtmp
312 conf_lastlog_location=/var/adm/lastlog
318 AC_DEFINE(SSHD_ACQUIRES_CTTY)
319 AC_DEFINE(SETEUID_BREAKS_SETUID)
320 AC_DEFINE(BROKEN_SETREUID)
321 AC_DEFINE(BROKEN_SETREGID)
324 # /usr/ucblib MUST NOT be searched on ReliantUNIX
325 AC_CHECK_LIB(dl, dlsym, ,)
326 IPADDR_IN_DISPLAY=yes
328 AC_DEFINE(IP_TOS_IS_BROKEN)
329 AC_DEFINE(SETEUID_BREAKS_SETUID)
330 AC_DEFINE(BROKEN_SETREUID)
331 AC_DEFINE(BROKEN_SETREGID)
332 AC_DEFINE(SSHD_ACQUIRES_CTTY)
333 external_path_file=/etc/default/login
334 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
335 # Attention: always take care to bind libsocket and libnsl before libc,
336 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
340 AC_DEFINE(SETEUID_BREAKS_SETUID)
341 AC_DEFINE(BROKEN_SETREUID)
342 AC_DEFINE(BROKEN_SETREGID)
346 AC_DEFINE(SETEUID_BREAKS_SETUID)
347 AC_DEFINE(BROKEN_SETREUID)
348 AC_DEFINE(BROKEN_SETREGID)
353 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize"
354 LIBS="$LIBS -los -lprot -lcrypt_i -lx -ltinfo -lm"
357 AC_DEFINE(BROKEN_SYS_TERMIO_H)
359 AC_DEFINE(HAVE_SECUREWARE)
360 AC_DEFINE(DISABLE_SHADOW)
361 AC_DEFINE(BROKEN_SAVED_UIDS)
362 AC_DEFINE(SETEUID_BREAKS_SETUID)
363 AC_DEFINE(BROKEN_SETREUID)
364 AC_DEFINE(BROKEN_SETREGID)
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.])
749 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
753 [(void)skeychallenge(NULL,"name","",0);],
755 AC_DEFINE(SKEYCHALLENGE_4ARG)],
762 # Check whether user wants TCP wrappers support
764 AC_ARG_WITH(tcp-wrappers,
765 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
766 (optionally in PATH)],
768 if test "x$withval" != "xno" ; then
770 saved_LDFLAGS="$LDFLAGS"
771 saved_CPPFLAGS="$CPPFLAGS"
772 if test -n "${withval}" -a "${withval}" != "yes"; then
773 if test -d "${withval}/lib"; then
774 if test -n "${need_dash_r}"; then
775 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
777 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
780 if test -n "${need_dash_r}"; then
781 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
783 LDFLAGS="-L${withval} ${LDFLAGS}"
786 if test -d "${withval}/include"; then
787 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
789 CPPFLAGS="-I${withval} ${CPPFLAGS}"
793 LIBS="$LIBWRAP $LIBS"
794 AC_MSG_CHECKING(for libwrap)
797 #include <sys/types.h>
798 #include <sys/socket.h>
799 #include <netinet/in.h>
801 int deny_severity = 0, allow_severity = 0;
811 AC_MSG_ERROR([*** libwrap missing])
819 dnl Checks for library functions. Please keep in alphabetical order
821 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
822 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
823 getaddrinfo getcwd getgrouplist getnameinfo getopt \
824 getpeereid _getpty getrlimit getttyent glob inet_aton \
825 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
826 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
827 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
828 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
829 setproctitle setregid setreuid setrlimit \
830 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
831 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
832 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
835 # IRIX has a const char return value for gai_strerror()
836 AC_CHECK_FUNCS(gai_strerror,[
837 AC_DEFINE(HAVE_GAI_STRERROR)
839 #include <sys/types.h>
840 #include <sys/socket.h>
843 const char *gai_strerror(int);],[
846 str = gai_strerror(0);],[
847 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
848 [Define if gai_strerror() returns const char *])])])
850 AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
852 dnl Make sure prototypes are defined for these before using them.
853 AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
854 AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
856 dnl tcsendbreak might be a macro
857 AC_CHECK_DECL(tcsendbreak,
858 [AC_DEFINE(HAVE_TCSENDBREAK)],
859 [AC_CHECK_FUNCS(tcsendbreak)],
860 [#include <termios.h>]
863 AC_CHECK_FUNCS(setresuid, [
864 dnl Some platorms have setresuid that isn't implemented, test for this
865 AC_MSG_CHECKING(if setresuid seems to work)
869 int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
871 [AC_MSG_RESULT(yes)],
872 [AC_DEFINE(BROKEN_SETRESUID)
873 AC_MSG_RESULT(not implemented)]
877 AC_CHECK_FUNCS(setresgid, [
878 dnl Some platorms have setresgid that isn't implemented, test for this
879 AC_MSG_CHECKING(if setresgid seems to work)
883 int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
885 [AC_MSG_RESULT(yes)],
886 [AC_DEFINE(BROKEN_SETRESGID)
887 AC_MSG_RESULT(not implemented)]
891 dnl Checks for time functions
892 AC_CHECK_FUNCS(gettimeofday time)
893 dnl Checks for utmp functions
894 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
895 AC_CHECK_FUNCS(utmpname)
896 dnl Checks for utmpx functions
897 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
898 AC_CHECK_FUNCS(setutxent utmpxname)
900 AC_CHECK_FUNC(daemon,
901 [AC_DEFINE(HAVE_DAEMON)],
902 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
905 AC_CHECK_FUNC(getpagesize,
906 [AC_DEFINE(HAVE_GETPAGESIZE)],
907 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
910 # Check for broken snprintf
911 if test "x$ac_cv_func_snprintf" = "xyes" ; then
912 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
916 int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
918 [AC_MSG_RESULT(yes)],
921 AC_DEFINE(BROKEN_SNPRINTF)
922 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
927 dnl see whether mkstemp() requires XXXXXX
928 if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
929 AC_MSG_CHECKING([for (overly) strict mkstemp])
933 main() { char template[]="conftest.mkstemp-test";
934 if (mkstemp(template) == -1)
936 unlink(template); exit(0);
944 AC_DEFINE(HAVE_STRICT_MKSTEMP)
948 AC_DEFINE(HAVE_STRICT_MKSTEMP)
953 dnl make sure that openpty does not reacquire controlling terminal
954 if test ! -z "$check_for_openpty_ctty_bug"; then
955 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
959 #include <sys/fcntl.h>
960 #include <sys/types.h>
961 #include <sys/wait.h>
967 int fd, ptyfd, ttyfd, status;
970 if (pid < 0) { /* failed */
972 } else if (pid > 0) { /* parent */
973 waitpid(pid, &status, 0);
974 if (WIFEXITED(status))
975 exit(WEXITSTATUS(status));
979 close(0); close(1); close(2);
981 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
982 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
984 exit(3); /* Acquired ctty: broken */
986 exit(0); /* Did not acquire ctty: OK */
995 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1000 if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1001 AC_MSG_CHECKING(if getaddrinfo seems to work)
1005 #include <sys/socket.h>
1008 #include <netinet/in.h>
1010 #define TEST_PORT "2222"
1016 struct addrinfo *gai_ai, *ai, hints;
1017 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1019 memset(&hints, 0, sizeof(hints));
1020 hints.ai_family = PF_UNSPEC;
1021 hints.ai_socktype = SOCK_STREAM;
1022 hints.ai_flags = AI_PASSIVE;
1024 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1026 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1030 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1031 if (ai->ai_family != AF_INET6)
1034 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1035 sizeof(ntop), strport, sizeof(strport),
1036 NI_NUMERICHOST|NI_NUMERICSERV);
1039 if (err == EAI_SYSTEM)
1040 perror("getnameinfo EAI_SYSTEM");
1042 fprintf(stderr, "getnameinfo failed: %s\n",
1047 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1050 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1063 AC_DEFINE(BROKEN_GETADDRINFO)
1070 # Check for PAM libs
1073 [ --with-pam Enable PAM support ],
1075 if test "x$withval" != "xno" ; then
1076 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1077 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1078 AC_MSG_ERROR([PAM headers not found])
1081 AC_CHECK_LIB(dl, dlopen, , )
1082 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1083 AC_CHECK_FUNCS(pam_getenvlist)
1084 AC_CHECK_FUNCS(pam_putenv)
1089 if test $ac_cv_lib_dl_dlopen = yes; then
1099 # Check for older PAM
1100 if test "x$PAM_MSG" = "xyes" ; then
1101 # Check PAM strerror arguments (old PAM)
1102 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1106 #if defined(HAVE_SECURITY_PAM_APPL_H)
1107 #include <security/pam_appl.h>
1108 #elif defined (HAVE_PAM_PAM_APPL_H)
1109 #include <pam/pam_appl.h>
1112 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1113 [AC_MSG_RESULT(no)],
1115 AC_DEFINE(HAVE_OLD_PAM)
1117 PAM_MSG="yes (old library)"
1122 # Search for OpenSSL
1123 saved_CPPFLAGS="$CPPFLAGS"
1124 saved_LDFLAGS="$LDFLAGS"
1125 AC_ARG_WITH(ssl-dir,
1126 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1128 if test "x$withval" != "xno" ; then
1129 if test -d "$withval/lib"; then
1130 if test -n "${need_dash_r}"; then
1131 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1133 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1136 if test -n "${need_dash_r}"; then
1137 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1139 LDFLAGS="-L${withval} ${LDFLAGS}"
1142 if test -d "$withval/include"; then
1143 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1145 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1150 LIBS="-lcrypto $LIBS"
1151 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1153 dnl Check default openssl install dir
1154 if test -n "${need_dash_r}"; then
1155 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1157 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1159 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1160 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1162 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1168 # Determine OpenSSL header version
1169 AC_MSG_CHECKING([OpenSSL header version])
1174 #include <openssl/opensslv.h>
1175 #define DATA "conftest.sslincver"
1180 fd = fopen(DATA,"w");
1184 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1191 ssl_header_ver=`cat conftest.sslincver`
1192 AC_MSG_RESULT($ssl_header_ver)
1195 AC_MSG_RESULT(not found)
1196 AC_MSG_ERROR(OpenSSL version header not found.)
1200 # Determine OpenSSL library version
1201 AC_MSG_CHECKING([OpenSSL library version])
1206 #include <openssl/opensslv.h>
1207 #include <openssl/crypto.h>
1208 #define DATA "conftest.ssllibver"
1213 fd = fopen(DATA,"w");
1217 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1224 ssl_library_ver=`cat conftest.ssllibver`
1225 AC_MSG_RESULT($ssl_library_ver)
1228 AC_MSG_RESULT(not found)
1229 AC_MSG_ERROR(OpenSSL library not found.)
1233 # Sanity check OpenSSL headers
1234 AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1238 #include <openssl/opensslv.h>
1239 int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1246 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1247 Check config.log for details.
1248 Also see contrib/findssl.sh for help identifying header/library mismatches.])
1252 # Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1253 # because the system crypt() is more featureful.
1254 if test "x$check_for_libcrypt_before" = "x1"; then
1255 AC_CHECK_LIB(crypt, crypt)
1258 # Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1259 # version in OpenSSL.
1260 if test "x$check_for_libcrypt_later" = "x1"; then
1261 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1265 ### Configure cryptographic random number support
1267 # Check wheter OpenSSL seeds itself
1268 AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1272 #include <openssl/rand.h>
1273 int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1276 OPENSSL_SEEDS_ITSELF=yes
1281 # Default to use of the rand helper if OpenSSL doesn't
1288 # Do we want to force the use of the rand helper?
1289 AC_ARG_WITH(rand-helper,
1290 [ --with-rand-helper Use subprocess to gather strong randomness ],
1292 if test "x$withval" = "xno" ; then
1293 # Force use of OpenSSL's internal RNG, even if
1294 # the previous test showed it to be unseeded.
1295 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1296 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1297 OPENSSL_SEEDS_ITSELF=yes
1306 # Which randomness source do we use?
1307 if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1309 AC_DEFINE(OPENSSL_PRNG_ONLY)
1310 RAND_MSG="OpenSSL internal ONLY"
1311 INSTALL_SSH_RAND_HELPER=""
1312 elif test ! -z "$USE_RAND_HELPER" ; then
1313 # install rand helper
1314 RAND_MSG="ssh-rand-helper"
1315 INSTALL_SSH_RAND_HELPER="yes"
1317 AC_SUBST(INSTALL_SSH_RAND_HELPER)
1319 ### Configuration of ssh-rand-helper
1322 AC_ARG_WITH(prngd-port,
1323 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1332 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1335 if test ! -z "$withval" ; then
1336 PRNGD_PORT="$withval"
1337 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1342 # PRNGD Unix domain socket
1343 AC_ARG_WITH(prngd-socket,
1344 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1348 withval="/var/run/egd-pool"
1356 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1360 if test ! -z "$withval" ; then
1361 if test ! -z "$PRNGD_PORT" ; then
1362 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1364 if test ! -r "$withval" ; then
1365 AC_MSG_WARN(Entropy socket is not readable)
1367 PRNGD_SOCKET="$withval"
1368 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1372 # Check for existing socket only if we don't have a random device already
1373 if test "$USE_RAND_HELPER" = yes ; then
1374 AC_MSG_CHECKING(for PRNGD/EGD socket)
1375 # Insert other locations here
1376 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1377 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1378 PRNGD_SOCKET="$sock"
1379 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1383 if test ! -z "$PRNGD_SOCKET" ; then
1384 AC_MSG_RESULT($PRNGD_SOCKET)
1386 AC_MSG_RESULT(not found)
1392 # Change default command timeout for hashing entropy source
1394 AC_ARG_WITH(entropy-timeout,
1395 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1397 if test "x$withval" != "xno" ; then
1398 entropy_timeout=$withval
1402 AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1404 SSH_PRIVSEP_USER=sshd
1405 AC_ARG_WITH(privsep-user,
1406 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
1408 if test -n "$withval"; then
1409 SSH_PRIVSEP_USER=$withval
1413 AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1414 AC_SUBST(SSH_PRIVSEP_USER)
1416 # We do this little dance with the search path to insure
1417 # that programs that we select for use by installed programs
1418 # (which may be run by the super-user) come from trusted
1419 # locations before they come from the user's private area.
1420 # This should help avoid accidentally configuring some
1421 # random version of a program in someone's personal bin.
1425 test -h /bin 2> /dev/null && PATH=/usr/bin
1426 test -d /sbin && PATH=$PATH:/sbin
1427 test -d /usr/sbin && PATH=$PATH:/usr/sbin
1428 PATH=$PATH:/etc:$OPATH
1430 # These programs are used by the command hashing source to gather entropy
1431 OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1432 OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1433 OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1434 OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1435 OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1436 OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1437 OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1438 OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1439 OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1440 OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1441 OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1442 OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1443 OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1444 OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1445 OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1446 OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
1450 # Where does ssh-rand-helper get its randomness from?
1451 INSTALL_SSH_PRNG_CMDS=""
1452 if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1453 if test ! -z "$PRNGD_PORT" ; then
1454 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1455 elif test ! -z "$PRNGD_SOCKET" ; then
1456 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1458 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1459 RAND_HELPER_CMDHASH=yes
1460 INSTALL_SSH_PRNG_CMDS="yes"
1463 AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1466 # Cheap hack to ensure NEWS-OS libraries are arranged right.
1467 if test ! -z "$SONY" ; then
1468 LIBS="$LIBS -liberty";
1471 # Checks for data types
1472 AC_CHECK_SIZEOF(char, 1)
1473 AC_CHECK_SIZEOF(short int, 2)
1474 AC_CHECK_SIZEOF(int, 4)
1475 AC_CHECK_SIZEOF(long int, 4)
1476 AC_CHECK_SIZEOF(long long int, 8)
1478 # Sanity check long long for some platforms (AIX)
1479 if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1480 ac_cv_sizeof_long_long_int=0
1483 # More checks for data types
1484 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1486 [ #include <sys/types.h> ],
1488 [ ac_cv_have_u_int="yes" ],
1489 [ ac_cv_have_u_int="no" ]
1492 if test "x$ac_cv_have_u_int" = "xyes" ; then
1493 AC_DEFINE(HAVE_U_INT)
1497 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1499 [ #include <sys/types.h> ],
1500 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1501 [ ac_cv_have_intxx_t="yes" ],
1502 [ ac_cv_have_intxx_t="no" ]
1505 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1506 AC_DEFINE(HAVE_INTXX_T)
1510 if (test -z "$have_intxx_t" && \
1511 test "x$ac_cv_header_stdint_h" = "xyes")
1513 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1515 [ #include <stdint.h> ],
1516 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1518 AC_DEFINE(HAVE_INTXX_T)
1521 [ AC_MSG_RESULT(no) ]
1525 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1528 #include <sys/types.h>
1529 #ifdef HAVE_STDINT_H
1530 # include <stdint.h>
1532 #include <sys/socket.h>
1533 #ifdef HAVE_SYS_BITYPES_H
1534 # include <sys/bitypes.h>
1537 [ int64_t a; a = 1;],
1538 [ ac_cv_have_int64_t="yes" ],
1539 [ ac_cv_have_int64_t="no" ]
1542 if test "x$ac_cv_have_int64_t" = "xyes" ; then
1543 AC_DEFINE(HAVE_INT64_T)
1546 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1548 [ #include <sys/types.h> ],
1549 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1550 [ ac_cv_have_u_intxx_t="yes" ],
1551 [ ac_cv_have_u_intxx_t="no" ]
1554 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1555 AC_DEFINE(HAVE_U_INTXX_T)
1559 if test -z "$have_u_intxx_t" ; then
1560 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1562 [ #include <sys/socket.h> ],
1563 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1565 AC_DEFINE(HAVE_U_INTXX_T)
1568 [ AC_MSG_RESULT(no) ]
1572 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1574 [ #include <sys/types.h> ],
1575 [ u_int64_t a; a = 1;],
1576 [ ac_cv_have_u_int64_t="yes" ],
1577 [ ac_cv_have_u_int64_t="no" ]
1580 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1581 AC_DEFINE(HAVE_U_INT64_T)
1585 if test -z "$have_u_int64_t" ; then
1586 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1588 [ #include <sys/bitypes.h> ],
1589 [ u_int64_t a; a = 1],
1591 AC_DEFINE(HAVE_U_INT64_T)
1594 [ AC_MSG_RESULT(no) ]
1598 if test -z "$have_u_intxx_t" ; then
1599 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1602 #include <sys/types.h>
1604 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1605 [ ac_cv_have_uintxx_t="yes" ],
1606 [ ac_cv_have_uintxx_t="no" ]
1609 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1610 AC_DEFINE(HAVE_UINTXX_T)
1614 if test -z "$have_uintxx_t" ; then
1615 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1617 [ #include <stdint.h> ],
1618 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1620 AC_DEFINE(HAVE_UINTXX_T)
1623 [ AC_MSG_RESULT(no) ]
1627 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1628 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
1630 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1633 #include <sys/bitypes.h>
1636 int8_t a; int16_t b; int32_t c;
1637 u_int8_t e; u_int16_t f; u_int32_t g;
1638 a = b = c = e = f = g = 1;
1641 AC_DEFINE(HAVE_U_INTXX_T)
1642 AC_DEFINE(HAVE_INTXX_T)
1650 AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1653 #include <sys/types.h>
1655 [ u_char foo; foo = 125; ],
1656 [ ac_cv_have_u_char="yes" ],
1657 [ ac_cv_have_u_char="no" ]
1660 if test "x$ac_cv_have_u_char" = "xyes" ; then
1661 AC_DEFINE(HAVE_U_CHAR)
1666 AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
1668 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1671 #include <sys/types.h>
1673 [ size_t foo; foo = 1235; ],
1674 [ ac_cv_have_size_t="yes" ],
1675 [ ac_cv_have_size_t="no" ]
1678 if test "x$ac_cv_have_size_t" = "xyes" ; then
1679 AC_DEFINE(HAVE_SIZE_T)
1682 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1685 #include <sys/types.h>
1687 [ ssize_t foo; foo = 1235; ],
1688 [ ac_cv_have_ssize_t="yes" ],
1689 [ ac_cv_have_ssize_t="no" ]
1692 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1693 AC_DEFINE(HAVE_SSIZE_T)
1696 AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1701 [ clock_t foo; foo = 1235; ],
1702 [ ac_cv_have_clock_t="yes" ],
1703 [ ac_cv_have_clock_t="no" ]
1706 if test "x$ac_cv_have_clock_t" = "xyes" ; then
1707 AC_DEFINE(HAVE_CLOCK_T)
1710 AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1713 #include <sys/types.h>
1714 #include <sys/socket.h>
1716 [ sa_family_t foo; foo = 1235; ],
1717 [ ac_cv_have_sa_family_t="yes" ],
1720 #include <sys/types.h>
1721 #include <sys/socket.h>
1722 #include <netinet/in.h>
1724 [ sa_family_t foo; foo = 1235; ],
1725 [ ac_cv_have_sa_family_t="yes" ],
1727 [ ac_cv_have_sa_family_t="no" ]
1731 if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1732 AC_DEFINE(HAVE_SA_FAMILY_T)
1735 AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1738 #include <sys/types.h>
1740 [ pid_t foo; foo = 1235; ],
1741 [ ac_cv_have_pid_t="yes" ],
1742 [ ac_cv_have_pid_t="no" ]
1745 if test "x$ac_cv_have_pid_t" = "xyes" ; then
1746 AC_DEFINE(HAVE_PID_T)
1749 AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1752 #include <sys/types.h>
1754 [ mode_t foo; foo = 1235; ],
1755 [ ac_cv_have_mode_t="yes" ],
1756 [ ac_cv_have_mode_t="no" ]
1759 if test "x$ac_cv_have_mode_t" = "xyes" ; then
1760 AC_DEFINE(HAVE_MODE_T)
1764 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1767 #include <sys/types.h>
1768 #include <sys/socket.h>
1770 [ struct sockaddr_storage s; ],
1771 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1772 [ ac_cv_have_struct_sockaddr_storage="no" ]
1775 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1776 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1779 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1782 #include <sys/types.h>
1783 #include <netinet/in.h>
1785 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1786 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1787 [ ac_cv_have_struct_sockaddr_in6="no" ]
1790 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1791 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1794 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1797 #include <sys/types.h>
1798 #include <netinet/in.h>
1800 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1801 [ ac_cv_have_struct_in6_addr="yes" ],
1802 [ ac_cv_have_struct_in6_addr="no" ]
1805 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1806 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1809 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1812 #include <sys/types.h>
1813 #include <sys/socket.h>
1816 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1817 [ ac_cv_have_struct_addrinfo="yes" ],
1818 [ ac_cv_have_struct_addrinfo="no" ]
1821 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1822 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1825 AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1827 [ #include <sys/time.h> ],
1828 [ struct timeval tv; tv.tv_sec = 1;],
1829 [ ac_cv_have_struct_timeval="yes" ],
1830 [ ac_cv_have_struct_timeval="no" ]
1833 if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1834 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1835 have_struct_timeval=1
1838 AC_CHECK_TYPES(struct timespec)
1840 # We need int64_t or else certian parts of the compile will fail.
1841 if test "x$ac_cv_have_int64_t" = "xno" -a \
1842 "x$ac_cv_sizeof_long_int" != "x8" -a \
1843 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1844 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1845 echo "an alternative compiler (I.E., GCC) before continuing."
1849 dnl test snprintf (broken on SCO w/gcc)
1854 #ifdef HAVE_SNPRINTF
1858 char expected_out[50];
1860 #if (SIZEOF_LONG_INT == 8)
1861 long int num = 0x7fffffffffffffff;
1863 long long num = 0x7fffffffffffffffll;
1865 strcpy(expected_out, "9223372036854775807");
1866 snprintf(buf, mazsize, "%lld", num);
1867 if(strcmp(buf, expected_out) != 0)
1874 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1878 dnl Checks for structure members
1879 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1880 OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1881 OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1882 OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1883 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
1884 OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
1885 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1886 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
1887 OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
1888 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1889 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1890 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1891 OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1892 OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1893 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1894 OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1895 OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
1897 AC_CHECK_MEMBERS([struct stat.st_blksize])
1899 AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1900 ac_cv_have_ss_family_in_struct_ss, [
1903 #include <sys/types.h>
1904 #include <sys/socket.h>
1906 [ struct sockaddr_storage s; s.ss_family = 1; ],
1907 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1908 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1911 if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1912 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1915 AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1916 ac_cv_have___ss_family_in_struct_ss, [
1919 #include <sys/types.h>
1920 #include <sys/socket.h>
1922 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1923 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1924 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1927 if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1928 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1931 AC_CACHE_CHECK([for pw_class field in struct passwd],
1932 ac_cv_have_pw_class_in_struct_passwd, [
1937 [ struct passwd p; p.pw_class = 0; ],
1938 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1939 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1942 if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1943 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1946 AC_CACHE_CHECK([for pw_expire field in struct passwd],
1947 ac_cv_have_pw_expire_in_struct_passwd, [
1952 [ struct passwd p; p.pw_expire = 0; ],
1953 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1954 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1957 if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1958 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1961 AC_CACHE_CHECK([for pw_change field in struct passwd],
1962 ac_cv_have_pw_change_in_struct_passwd, [
1967 [ struct passwd p; p.pw_change = 0; ],
1968 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1969 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1972 if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1973 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1976 dnl make sure we're using the real structure members and not defines
1977 AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1978 ac_cv_have_accrights_in_msghdr, [
1981 #include <sys/types.h>
1982 #include <sys/socket.h>
1983 #include <sys/uio.h>
1985 #ifdef msg_accrights
1989 m.msg_accrights = 0;
1993 [ ac_cv_have_accrights_in_msghdr="yes" ],
1994 [ ac_cv_have_accrights_in_msghdr="no" ]
1997 if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1998 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2001 AC_CACHE_CHECK([for msg_control field in struct msghdr],
2002 ac_cv_have_control_in_msghdr, [
2005 #include <sys/types.h>
2006 #include <sys/socket.h>
2007 #include <sys/uio.h>
2017 [ ac_cv_have_control_in_msghdr="yes" ],
2018 [ ac_cv_have_control_in_msghdr="no" ]
2021 if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2022 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2025 AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2027 [ extern char *__progname; printf("%s", __progname); ],
2028 [ ac_cv_libc_defines___progname="yes" ],
2029 [ ac_cv_libc_defines___progname="no" ]
2032 if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2033 AC_DEFINE(HAVE___PROGNAME)
2036 AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2040 [ printf("%s", __FUNCTION__); ],
2041 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2042 [ ac_cv_cc_implements___FUNCTION__="no" ]
2045 if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2046 AC_DEFINE(HAVE___FUNCTION__)
2049 AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2053 [ printf("%s", __func__); ],
2054 [ ac_cv_cc_implements___func__="yes" ],
2055 [ ac_cv_cc_implements___func__="no" ]
2058 if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2059 AC_DEFINE(HAVE___func__)
2062 AC_CACHE_CHECK([whether getopt has optreset support],
2063 ac_cv_have_getopt_optreset, [
2068 [ extern int optreset; optreset = 0; ],
2069 [ ac_cv_have_getopt_optreset="yes" ],
2070 [ ac_cv_have_getopt_optreset="no" ]
2073 if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2074 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2077 AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2079 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2080 [ ac_cv_libc_defines_sys_errlist="yes" ],
2081 [ ac_cv_libc_defines_sys_errlist="no" ]
2084 if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2085 AC_DEFINE(HAVE_SYS_ERRLIST)
2089 AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2091 [ extern int sys_nerr; printf("%i", sys_nerr);],
2092 [ ac_cv_libc_defines_sys_nerr="yes" ],
2093 [ ac_cv_libc_defines_sys_nerr="no" ]
2096 if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2097 AC_DEFINE(HAVE_SYS_NERR)
2101 # Check whether user wants sectok support
2103 [ --with-sectok Enable smartcard support using libsectok],
2105 if test "x$withval" != "xno" ; then
2106 if test "x$withval" != "xyes" ; then
2107 CPPFLAGS="$CPPFLAGS -I${withval}"
2108 LDFLAGS="$LDFLAGS -L${withval}"
2109 if test ! -z "$need_dash_r" ; then
2110 LDFLAGS="$LDFLAGS -R${withval}"
2112 if test ! -z "$blibpath" ; then
2113 blibpath="$blibpath:${withval}"
2116 AC_CHECK_HEADERS(sectok.h)
2117 if test "$ac_cv_header_sectok_h" != yes; then
2118 AC_MSG_ERROR(Can't find sectok.h)
2120 AC_CHECK_LIB(sectok, sectok_open)
2121 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2122 AC_MSG_ERROR(Can't find libsectok)
2124 AC_DEFINE(SMARTCARD)
2125 AC_DEFINE(USE_SECTOK)
2126 SCARD_MSG="yes, using sectok"
2131 # Check whether user wants OpenSC support
2133 AC_HELP_STRING([--with-opensc=PFX],
2134 [Enable smartcard support using OpenSC]),
2135 opensc_config_prefix="$withval", opensc_config_prefix="")
2136 if test x$opensc_config_prefix != x ; then
2137 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2138 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2139 if test "$OPENSC_CONFIG" != "no"; then
2140 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2141 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2142 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2143 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2144 AC_DEFINE(SMARTCARD)
2145 AC_DEFINE(USE_OPENSC)
2146 SCARD_MSG="yes, using OpenSC"
2150 # Check libraries needed by DNS fingerprint support
2151 AC_SEARCH_LIBS(getrrsetbyname, resolv,
2152 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
2154 # Needed by our getrrsetbyname()
2155 AC_SEARCH_LIBS(res_query, resolv)
2156 AC_SEARCH_LIBS(dn_expand, resolv)
2157 AC_CHECK_FUNCS(_getshort _getlong)
2158 AC_CHECK_MEMBER(HEADER.ad,
2159 [AC_DEFINE(HAVE_HEADER_AD)],,
2160 [#include <arpa/nameser.h>])
2163 # Check whether user wants Kerberos 5 support
2165 AC_ARG_WITH(kerberos5,
2166 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2167 [ if test "x$withval" != "xno" ; then
2168 if test "x$withval" = "xyes" ; then
2169 KRB5ROOT="/usr/local"
2177 AC_MSG_CHECKING(for krb5-config)
2178 if test -x $KRB5ROOT/bin/krb5-config ; then
2179 KRB5CONF=$KRB5ROOT/bin/krb5-config
2180 AC_MSG_RESULT($KRB5CONF)
2182 AC_MSG_CHECKING(for gssapi support)
2183 if $KRB5CONF | grep gssapi >/dev/null ; then
2191 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2192 K5LIBS="`$KRB5CONF --libs $k5confopts`"
2193 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2194 AC_MSG_CHECKING(whether we are using Heimdal)
2195 AC_TRY_COMPILE([ #include <krb5.h> ],
2196 [ char *tmp = heimdal_version; ],
2197 [ AC_MSG_RESULT(yes)
2198 AC_DEFINE(HEIMDAL) ],
2203 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2204 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2205 AC_MSG_CHECKING(whether we are using Heimdal)
2206 AC_TRY_COMPILE([ #include <krb5.h> ],
2207 [ char *tmp = heimdal_version; ],
2208 [ AC_MSG_RESULT(yes)
2210 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2213 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2216 AC_SEARCH_LIBS(dn_expand, resolv)
2218 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2220 K5LIBS="-lgssapi $K5LIBS" ],
2221 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2223 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
2224 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2229 AC_CHECK_HEADER(gssapi.h, ,
2230 [ unset ac_cv_header_gssapi_h
2231 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2232 AC_CHECK_HEADERS(gssapi.h, ,
2233 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
2239 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2240 AC_CHECK_HEADER(gssapi_krb5.h, ,
2241 [ CPPFLAGS="$oldCPP" ])
2244 if test ! -z "$need_dash_r" ; then
2245 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2247 if test ! -z "$blibpath" ; then
2248 blibpath="$blibpath:${KRB5ROOT}/lib"
2252 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2253 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2254 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2256 LIBS="$LIBS $K5LIBS"
2257 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
2258 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
2262 # Looking for programs, paths and files
2264 PRIVSEP_PATH=/var/empty
2265 AC_ARG_WITH(privsep-path,
2266 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
2268 if test "x$withval" != "$no" ; then
2269 PRIVSEP_PATH=$withval
2273 AC_SUBST(PRIVSEP_PATH)
2276 [ --with-xauth=PATH Specify path to xauth program ],
2278 if test "x$withval" != "xno" ; then
2284 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2285 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2286 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2287 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2288 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
2289 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
2290 xauth_path="/usr/openwin/bin/xauth"
2296 AC_ARG_ENABLE(strip,
2297 [ --disable-strip Disable calling strip(1) on install],
2299 if test "x$enableval" = "xno" ; then
2306 if test -z "$xauth_path" ; then
2307 XAUTH_PATH="undefined"
2308 AC_SUBST(XAUTH_PATH)
2310 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
2311 XAUTH_PATH=$xauth_path
2312 AC_SUBST(XAUTH_PATH)
2315 # Check for mail directory (last resort if we cannot get it from headers)
2316 if test ! -z "$MAIL" ; then
2317 maildir=`dirname $MAIL`
2318 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2321 if test -z "$no_dev_ptmx" ; then
2322 if test "x$disable_ptmx_check" != "xyes" ; then
2323 AC_CHECK_FILE("/dev/ptmx",
2325 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2331 AC_CHECK_FILE("/dev/ptc",
2333 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2338 # Options from here on. Some of these are preset by platform above
2339 AC_ARG_WITH(mantype,
2340 [ --with-mantype=man|cat|doc Set man page type],
2347 AC_MSG_ERROR(invalid man type: $withval)
2352 if test -z "$MANTYPE"; then
2353 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2354 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
2355 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2357 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2364 if test "$MANTYPE" = "doc"; then
2371 # Check whether to enable MD5 passwords
2373 AC_ARG_WITH(md5-passwords,
2374 [ --with-md5-passwords Enable use of MD5 passwords],
2376 if test "x$withval" != "xno" ; then
2377 AC_DEFINE(HAVE_MD5_PASSWORDS)
2383 # Whether to disable shadow password support
2385 [ --without-shadow Disable shadow password support],
2387 if test "x$withval" = "xno" ; then
2388 AC_DEFINE(DISABLE_SHADOW)
2394 if test -z "$disable_shadow" ; then
2395 AC_MSG_CHECKING([if the systems has expire shadow information])
2398 #include <sys/types.h>
2401 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2402 [ sp_expire_available=yes ], []
2405 if test "x$sp_expire_available" = "xyes" ; then
2407 AC_DEFINE(HAS_SHADOW_EXPIRE)
2413 # Use ip address instead of hostname in $DISPLAY
2414 if test ! -z "$IPADDR_IN_DISPLAY" ; then
2415 DISPLAY_HACK_MSG="yes"
2416 AC_DEFINE(IPADDR_IN_DISPLAY)
2418 DISPLAY_HACK_MSG="no"
2419 AC_ARG_WITH(ipaddr-display,
2420 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2422 if test "x$withval" != "xno" ; then
2423 AC_DEFINE(IPADDR_IN_DISPLAY)
2424 DISPLAY_HACK_MSG="yes"
2430 # check for /etc/default/login and use it if present.
2431 AC_ARG_ENABLE(etc-default-login,
2432 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2434 AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2436 if test "x$external_path_file" = "x/etc/default/login"; then
2437 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2441 dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2442 if test $ac_cv_func_login_getcapbool = "yes" -a \
2443 $ac_cv_header_login_cap_h = "yes" ; then
2444 external_path_file=/etc/login.conf
2447 # Whether to mess with the default path
2448 SERVER_PATH_MSG="(default)"
2449 AC_ARG_WITH(default-path,
2450 [ --with-default-path= Specify default \$PATH environment for server],
2452 if test "x$external_path_file" = "x/etc/login.conf" ; then
2454 --with-default-path=PATH has no effect on this system.
2455 Edit /etc/login.conf instead.])
2456 elif test "x$withval" != "xno" ; then
2457 if test ! -z "$external_path_file" ; then
2459 --with-default-path=PATH will only be used if PATH is not defined in
2460 $external_path_file .])
2462 user_path="$withval"
2463 SERVER_PATH_MSG="$withval"
2466 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2467 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2469 if test ! -z "$external_path_file" ; then
2471 If PATH is defined in $external_path_file, ensure the path to scp is included,
2472 otherwise scp will not work.])
2476 /* find out what STDPATH is */
2481 #ifndef _PATH_STDPATH
2482 # ifdef _PATH_USERPATH /* Irix */
2483 # define _PATH_STDPATH _PATH_USERPATH
2485 # define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2488 #include <sys/types.h>
2489 #include <sys/stat.h>
2491 #define DATA "conftest.stdpath"
2498 fd = fopen(DATA,"w");
2502 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2507 ], [ user_path=`cat conftest.stdpath` ],
2508 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2509 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2511 # make sure $bindir is in USER_PATH so scp will work
2512 t_bindir=`eval echo ${bindir}`
2514 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2517 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2519 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2520 if test $? -ne 0 ; then
2521 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2522 if test $? -ne 0 ; then
2523 user_path=$user_path:$t_bindir
2524 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2529 if test "x$external_path_file" != "x/etc/login.conf" ; then
2530 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2534 # Set superuser path separately to user path
2535 AC_ARG_WITH(superuser-path,
2536 [ --with-superuser-path= Specify different path for super-user],
2538 if test "x$withval" != "xno" ; then
2539 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2540 superuser_path=$withval
2546 AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2547 IPV4_IN6_HACK_MSG="no"
2549 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2551 if test "x$withval" != "xno" ; then
2553 AC_DEFINE(IPV4_IN_IPV6)
2554 IPV4_IN6_HACK_MSG="yes"
2559 if test "x$inet6_default_4in6" = "xyes"; then
2560 AC_MSG_RESULT([yes (default)])
2561 AC_DEFINE(IPV4_IN_IPV6)
2562 IPV4_IN6_HACK_MSG="yes"
2564 AC_MSG_RESULT([no (default)])
2569 # Whether to enable BSD auth support
2571 AC_ARG_WITH(bsd-auth,
2572 [ --with-bsd-auth Enable BSD auth support],
2574 if test "x$withval" != "xno" ; then
2581 # Where to place sshd.pid
2583 # make sure the directory exists
2584 if test ! -d $piddir ; then
2585 piddir=`eval echo ${sysconfdir}`
2587 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2591 AC_ARG_WITH(pid-dir,
2592 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2594 if test "x$withval" != "xno" ; then
2596 if test ! -d $piddir ; then
2597 AC_MSG_WARN([** no $piddir directory on this system **])
2603 AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2606 dnl allow user to disable some login recording features
2607 AC_ARG_ENABLE(lastlog,
2608 [ --disable-lastlog disable use of lastlog even if detected [no]],
2610 if test "x$enableval" = "xno" ; then
2611 AC_DEFINE(DISABLE_LASTLOG)
2616 [ --disable-utmp disable use of utmp even if detected [no]],
2618 if test "x$enableval" = "xno" ; then
2619 AC_DEFINE(DISABLE_UTMP)
2623 AC_ARG_ENABLE(utmpx,
2624 [ --disable-utmpx disable use of utmpx even if detected [no]],
2626 if test "x$enableval" = "xno" ; then
2627 AC_DEFINE(DISABLE_UTMPX)
2632 [ --disable-wtmp disable use of wtmp even if detected [no]],
2634 if test "x$enableval" = "xno" ; then
2635 AC_DEFINE(DISABLE_WTMP)
2639 AC_ARG_ENABLE(wtmpx,
2640 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2642 if test "x$enableval" = "xno" ; then
2643 AC_DEFINE(DISABLE_WTMPX)
2647 AC_ARG_ENABLE(libutil,
2648 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2650 if test "x$enableval" = "xno" ; then
2651 AC_DEFINE(DISABLE_LOGIN)
2655 AC_ARG_ENABLE(pututline,
2656 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2658 if test "x$enableval" = "xno" ; then
2659 AC_DEFINE(DISABLE_PUTUTLINE)
2663 AC_ARG_ENABLE(pututxline,
2664 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2666 if test "x$enableval" = "xno" ; then
2667 AC_DEFINE(DISABLE_PUTUTXLINE)
2671 AC_ARG_WITH(lastlog,
2672 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2674 if test "x$withval" = "xno" ; then
2675 AC_DEFINE(DISABLE_LASTLOG)
2677 conf_lastlog_location=$withval
2682 dnl lastlog, [uw]tmpx? detection
2683 dnl NOTE: set the paths in the platform section to avoid the
2684 dnl need for command-line parameters
2685 dnl lastlog and [uw]tmp are subject to a file search if all else fails
2687 dnl lastlog detection
2688 dnl NOTE: the code itself will detect if lastlog is a directory
2689 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2691 #include <sys/types.h>
2693 #ifdef HAVE_LASTLOG_H
2694 # include <lastlog.h>
2703 [ char *lastlog = LASTLOG_FILE; ],
2704 [ AC_MSG_RESULT(yes) ],
2707 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2709 #include <sys/types.h>
2711 #ifdef HAVE_LASTLOG_H
2712 # include <lastlog.h>
2718 [ char *lastlog = _PATH_LASTLOG; ],
2719 [ AC_MSG_RESULT(yes) ],
2722 system_lastlog_path=no
2727 if test -z "$conf_lastlog_location"; then
2728 if test x"$system_lastlog_path" = x"no" ; then
2729 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2730 if (test -d "$f" || test -f "$f") ; then
2731 conf_lastlog_location=$f
2734 if test -z "$conf_lastlog_location"; then
2735 AC_MSG_WARN([** Cannot find lastlog **])
2736 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2741 if test -n "$conf_lastlog_location"; then
2742 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2746 AC_MSG_CHECKING([if your system defines UTMP_FILE])
2748 #include <sys/types.h>
2754 [ char *utmp = UTMP_FILE; ],
2755 [ AC_MSG_RESULT(yes) ],
2757 system_utmp_path=no ]
2759 if test -z "$conf_utmp_location"; then
2760 if test x"$system_utmp_path" = x"no" ; then
2761 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2762 if test -f $f ; then
2763 conf_utmp_location=$f
2766 if test -z "$conf_utmp_location"; then
2767 AC_DEFINE(DISABLE_UTMP)
2771 if test -n "$conf_utmp_location"; then
2772 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2776 AC_MSG_CHECKING([if your system defines WTMP_FILE])
2778 #include <sys/types.h>
2784 [ char *wtmp = WTMP_FILE; ],
2785 [ AC_MSG_RESULT(yes) ],
2787 system_wtmp_path=no ]
2789 if test -z "$conf_wtmp_location"; then
2790 if test x"$system_wtmp_path" = x"no" ; then
2791 for f in /usr/adm/wtmp /var/log/wtmp; do
2792 if test -f $f ; then
2793 conf_wtmp_location=$f
2796 if test -z "$conf_wtmp_location"; then
2797 AC_DEFINE(DISABLE_WTMP)
2801 if test -n "$conf_wtmp_location"; then
2802 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2806 dnl utmpx detection - I don't know any system so perverse as to require
2807 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2809 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2811 #include <sys/types.h>
2820 [ char *utmpx = UTMPX_FILE; ],
2821 [ AC_MSG_RESULT(yes) ],
2823 system_utmpx_path=no ]
2825 if test -z "$conf_utmpx_location"; then
2826 if test x"$system_utmpx_path" = x"no" ; then
2827 AC_DEFINE(DISABLE_UTMPX)
2830 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2834 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2836 #include <sys/types.h>
2845 [ char *wtmpx = WTMPX_FILE; ],
2846 [ AC_MSG_RESULT(yes) ],
2848 system_wtmpx_path=no ]
2850 if test -z "$conf_wtmpx_location"; then
2851 if test x"$system_wtmpx_path" = x"no" ; then
2852 AC_DEFINE(DISABLE_WTMPX)
2855 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2859 if test ! -z "$blibpath" ; then
2860 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2861 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
2864 dnl remove pam and dl because they are in $LIBPAM
2865 if test "$PAM_MSG" = yes ; then
2866 LIBS=`echo $LIBS | sed 's/-lpam //'`
2868 if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2869 LIBS=`echo $LIBS | sed 's/-ldl //'`
2873 AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2876 # Print summary of options
2878 # Someone please show me a better way :)
2879 A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2880 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2881 C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2882 D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2883 E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2884 F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2885 G=`eval echo ${piddir}` ; G=`eval echo ${G}`
2886 H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2887 I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2888 J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
2891 echo "OpenSSH has been configured with the following options:"
2892 echo " User binaries: $B"
2893 echo " System binaries: $C"
2894 echo " Configuration files: $D"
2895 echo " Askpass program: $E"
2896 echo " Manual pages: $F"
2897 echo " PID file: $G"
2898 echo " Privilege separation chroot path: $H"
2899 if test "x$external_path_file" = "x/etc/login.conf" ; then
2900 echo " At runtime, sshd will use the path defined in $external_path_file"
2901 echo " Make sure the path to scp is present, otherwise scp will not work"
2903 echo " sshd default user PATH: $I"
2904 if test ! -z "$external_path_file"; then
2905 echo " (If PATH is set in $external_path_file it will be used instead. If"
2906 echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2909 if test ! -z "$superuser_path" ; then
2910 echo " sshd superuser user PATH: $J"
2912 echo " Manpage format: $MANTYPE"
2913 echo " PAM support: $PAM_MSG"
2914 echo " KerberosV support: $KRB5_MSG"
2915 echo " Smartcard support: $SCARD_MSG"
2916 echo " S/KEY support: $SKEY_MSG"
2917 echo " TCP Wrappers support: $TCPW_MSG"
2918 echo " MD5 password support: $MD5_MSG"
2919 echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2920 echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2921 echo " BSD Auth support: $BSD_AUTH_MSG"
2922 echo " Random number source: $RAND_MSG"
2923 if test ! -z "$USE_RAND_HELPER" ; then
2924 echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
2929 echo " Host: ${host}"
2930 echo " Compiler: ${CC}"
2931 echo " Compiler flags: ${CFLAGS}"
2932 echo "Preprocessor flags: ${CPPFLAGS}"
2933 echo " Linker flags: ${LDFLAGS}"
2934 echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
2938 if test "x$PAM_MSG" = "xyes" ; then
2939 echo "PAM is enabled. You may need to install a PAM control file "
2940 echo "for sshd, otherwise password authentication may fail. "
2941 echo "Example PAM control files can be found in the contrib/ "
2946 if test ! -z "$RAND_HELPER_CMDHASH" ; then
2947 echo "WARNING: you are using the builtin random number collection "
2948 echo "service. Please read WARNING.RNG and request that your OS "
2949 echo "vendor includes kernel-based random number collection in "
2950 echo "future versions of your OS."