blob: 86b26daf9693b60387a276c57c0f357705478c82 [file] [log] [blame]
Darren Tucker2fba9932005-02-02 23:30:24 +11001# $Id: configure.ac,v 1.237 2005/02/02 12:30:25 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
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.
8#
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.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker59f79c42004-09-30 21:17:08 +100017AC_INIT(OpenSSH, Portable)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
61else
62 # Search for login
63 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
64 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
65 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
66 fi
67fi
68
Darren Tucker23bc8d02004-02-06 16:24:31 +110069AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
70if test ! -z "$PATH_PASSWD_PROG" ; then
71 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
72fi
73
Damien Miller166bd442000-03-16 10:48:25 +110074if test -z "$LD" ; then
75 LD=$CC
76fi
77AC_SUBST(LD)
78
Damien Miller166bd442000-03-16 10:48:25 +110079AC_C_INLINE
Damien Millera8e06ce2003-11-21 23:48:55 +110080if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Miller649d9992001-06-27 23:35:51 +100081 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110082fi
83
Tim Rice88368a32003-12-08 12:35:59 -080084AC_ARG_WITH(rpath,
85 [ --without-rpath Disable auto-added -R linker paths],
86 [
87 if test "x$withval" = "xno" ; then
88 need_dash_r=""
89 fi
90 if test "x$withval" = "xyes" ; then
91 need_dash_r=1
92 fi
93 ]
94)
95
Damien Millera22ba012000-03-02 23:09:20 +110096# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110097case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110098*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +110099 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000100 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800101 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100102 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000103 saved_LDFLAGS="$LDFLAGS"
104 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
105 if (test -z "$blibflags"); then
106 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
107 AC_TRY_LINK([], [], [blibflags=$tryflags])
108 fi
109 done
110 if (test -z "$blibflags"); then
111 AC_MSG_RESULT(not found)
112 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
113 else
114 AC_MSG_RESULT($blibflags)
115 fi
116 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000117 dnl Check for authenticate. Might be in libs.a on older AIXes
118 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -0700119 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000120 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700121 LIBS="$LIBS -ls"
122 ])
123 ])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000124 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
125 AC_CHECK_DECL(loginfailed,
126 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
127 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000128 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000129 [(void)loginfailed("user","host","tty",0);],
130 [AC_MSG_RESULT(yes)
131 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000132 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000133 )],
134 [],
135 [#include <usersec.h>]
136 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000137 AC_CHECK_FUNCS(setauthdb)
Damien Millereca71f82000-01-20 22:38:27 +1100138 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +1000139 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000140 AC_DEFINE(SETEUID_BREAKS_SETUID)
141 AC_DEFINE(BROKEN_SETREUID)
142 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000143 dnl AIX handles lastlog as part of its login message
144 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000145 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000146 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100147 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100148*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100149 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800150 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100151 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000152 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100153 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100154 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000155 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000156 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700157 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +0000158 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100159 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000160*-*-dgux*)
161 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100162 AC_DEFINE(SETEUID_BREAKS_SETUID)
163 AC_DEFINE(BROKEN_SETREUID)
164 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000165 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000166*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000167 AC_MSG_CHECKING(if we have working getaddrinfo)
168 AC_TRY_RUN([#include <mach-o/dyld.h>
169main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
170 exit(0);
171 else
172 exit(1);
173}], [AC_MSG_RESULT(working)],
174 [AC_MSG_RESULT(buggy)
175 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700176 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000177 AC_DEFINE(SETEUID_BREAKS_SETUID)
178 AC_DEFINE(BROKEN_SETREUID)
179 AC_DEFINE(BROKEN_SETREGID)
Damien Miller7a2ea782004-01-02 17:52:10 +1100180 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000181 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000182*-*-hpux10.26)
183 if test -z "$GCC"; then
184 CFLAGS="$CFLAGS -Ae"
185 fi
186 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
187 IPADDR_IN_DISPLAY=yes
188 AC_DEFINE(HAVE_SECUREWARE)
189 AC_DEFINE(USE_PIPES)
190 AC_DEFINE(LOGIN_NO_ENDOPT)
191 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000192 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000193 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700194 LIBS="$LIBS -lsec -lsecpw"
195 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000196 disable_ptmx_check=yes
197 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100198*-*-hpux10*)
199 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000200 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100201 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000202 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100203 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000204 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000205 AC_DEFINE(LOGIN_NO_ENDOPT)
206 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000207 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000208 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700209 LIBS="$LIBS -lsec"
210 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100211 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000212*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000213 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100214 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100215 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100216 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000217 AC_DEFINE(LOGIN_NO_ENDOPT)
218 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100219 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000220 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000221 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker2fba9932005-02-02 23:30:24 +1100222 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
Darren Tucker4398cf52004-04-06 21:39:02 +1000223 check_for_hpux_broken_getaddrinfo=1
Darren Tuckera56f1912004-11-02 20:30:54 +1100224 check_for_conflicting_getspnam=1
Tim Ricef028f1e2002-07-19 12:41:10 -0700225 LIBS="$LIBS -lsec"
226 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000227 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100228*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100229 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000230 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000231 AC_DEFINE(SETEUID_BREAKS_SETUID)
232 AC_DEFINE(BROKEN_SETREUID)
233 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000234 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000235 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100236 ;;
237*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100238 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000239 AC_DEFINE(WITH_IRIX_ARRAY)
240 AC_DEFINE(WITH_IRIX_PROJECT)
241 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000242 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000243 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000244 AC_DEFINE(SETEUID_BREAKS_SETUID)
245 AC_DEFINE(BROKEN_SETREUID)
246 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000247 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000248 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000249 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100250 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100251*-*-linux*)
252 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100253 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000254 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100255 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000256 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000257 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000258 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Darren Tuckere59b5082004-06-28 16:01:19 +1000259 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
Darren Tucker2fba9932005-02-02 23:30:24 +1100260 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
261 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
Damien Miller7bcb0892000-03-11 20:45:40 +1100262 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000263 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000264 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000265 AC_DEFINE(BROKEN_CMSG_TYPE)
266 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000267 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100268 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000269mips-sony-bsd|mips-sony-newsos4)
270 AC_DEFINE(HAVE_NEWS4)
271 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000272 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100273*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000274 check_for_libcrypt_before=1
Tim Rice88368a32003-12-08 12:35:59 -0800275 if test "x$withval" != "xno" ; then
276 need_dash_r=1
277 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100278 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100279*-*-freebsd*)
280 check_for_libcrypt_later=1
281 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000282*-*-bsdi*)
283 AC_DEFINE(SETEUID_BREAKS_SETUID)
284 AC_DEFINE(BROKEN_SETREUID)
285 AC_DEFINE(BROKEN_SETREGID)
286 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000287*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000288 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100289 conf_utmp_location=/etc/utmp
290 conf_wtmp_location=/usr/adm/wtmp
291 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000292 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000293 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000294 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100295 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000296 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100297*-*-solaris*)
Tim Ricead4a1882004-02-29 15:53:37 -0800298 if test "x$withval" != "xno" ; then
299 need_dash_r=1
300 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100301 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000302 AC_DEFINE(LOGIN_NEEDS_UTMPX)
303 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000304 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker21dd0892004-08-16 23:12:05 +1000305 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000306 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000307 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
308 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000309 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000310 # hardwire lastlog location (can't detect it on some versions)
311 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000312 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
313 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
314 if test "$sol2ver" -ge 8; then
315 AC_MSG_RESULT(yes)
316 AC_DEFINE(DISABLE_UTMP)
317 AC_DEFINE(DISABLE_WTMP)
318 else
319 AC_MSG_RESULT(no)
320 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100321 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000322*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000323 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000324 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100325 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000326 conf_utmp_location=/etc/utmp
327 conf_wtmp_location=/var/adm/wtmp
328 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000329 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000330 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000331*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700332 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000333 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000334 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000335 AC_DEFINE(SETEUID_BREAKS_SETUID)
336 AC_DEFINE(BROKEN_SETREUID)
337 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000338 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000339*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700340 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000341 AC_CHECK_LIB(dl, dlsym, ,)
Damien Millerfd9885e2001-01-10 08:16:53 +1100342 IPADDR_IN_DISPLAY=yes
343 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000344 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000345 AC_DEFINE(SETEUID_BREAKS_SETUID)
346 AC_DEFINE(BROKEN_SETREUID)
347 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000348 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000349 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700350 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
351 # Attention: always take care to bind libsocket and libnsl before libc,
352 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000353 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800354# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100355*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100356 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700357 AC_DEFINE(SETEUID_BREAKS_SETUID)
358 AC_DEFINE(BROKEN_SETREUID)
359 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100360 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800361# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100362*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100363 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700364 AC_DEFINE(SETEUID_BREAKS_SETUID)
365 AC_DEFINE(BROKEN_SETREUID)
366 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100367 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100368*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100369 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800370# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100371*-*-sco3.2v4*)
Tim Ricefcb62202004-01-23 18:35:16 -0800372 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize"
Tim Ricee8c898a2004-02-23 21:47:04 -0800373 LIBS="$LIBS -los -lprot -lcrypt_i -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100374 RANLIB=true
375 no_dev_ptmx=1
376 AC_DEFINE(BROKEN_SYS_TERMIO_H)
377 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000378 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000379 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100380 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Ricefe6d5aa2004-04-16 20:03:07 -0700381 AC_DEFINE(SETEUID_BREAKS_SETUID)
382 AC_DEFINE(BROKEN_SETREUID)
383 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700384 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100385 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700386 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700387 do_sco3_extra_lib_check=yes
Tim Ricef7ba8f62004-06-20 10:37:32 -0700388 TEST_SHELL=ksh
Damien Miller78315eb2000-09-29 23:01:36 +1100389 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800390# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100391*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800392 if test -z "$GCC"; then
393 CFLAGS="$CFLAGS -belf"
394 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100395 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000396 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100397 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000398 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000399 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700400 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700401 AC_DEFINE(SETEUID_BREAKS_SETUID)
402 AC_DEFINE(BROKEN_SETREUID)
403 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700404 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700405 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Miller217f5672001-02-16 12:12:41 +1100406 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700407 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700408 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000409 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000410*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100411 AC_DEFINE(NO_SSH_LASTLOG)
412 AC_DEFINE(SETEUID_BREAKS_SETUID)
413 AC_DEFINE(BROKEN_SETREUID)
414 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000415 AC_DEFINE(USE_PIPES)
416 AC_DEFINE(DISABLE_FD_PASSING)
417 LDFLAGS="$LDFLAGS"
418 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
419 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000420 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000421*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100422 AC_DEFINE(SETEUID_BREAKS_SETUID)
423 AC_DEFINE(BROKEN_SETREUID)
424 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000425 AC_DEFINE(WITH_ABBREV_NO_TTY)
426 AC_DEFINE(USE_PIPES)
427 AC_DEFINE(DISABLE_FD_PASSING)
428 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100429 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000430 MANTYPE=cat
431 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000432*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100433 AC_DEFINE(SETEUID_BREAKS_SETUID)
434 AC_DEFINE(BROKEN_SETREUID)
435 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000436 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700437 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700438 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000439 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
440 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
441 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700442 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000443*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000444 AC_MSG_CHECKING(for Digital Unix SIA)
445 no_osfsia=""
446 AC_ARG_WITH(osfsia,
447 [ --with-osfsia Enable Digital Unix SIA],
448 [
449 if test "x$withval" = "xno" ; then
450 AC_MSG_RESULT(disabled)
451 no_osfsia=1
452 fi
453 ],
454 )
455 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000456 if test -f /etc/sia/matrix.conf; then
457 AC_MSG_RESULT(yes)
458 AC_DEFINE(HAVE_OSF_SIA)
459 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000460 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000461 LIBS="$LIBS -lsecurity -ldb -lm -laud"
462 else
463 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100464 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000465 fi
466 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000467 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700468 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000469 AC_DEFINE(BROKEN_SETREUID)
470 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000471 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000472
473*-*-nto-qnx)
474 AC_DEFINE(USE_PIPES)
475 AC_DEFINE(NO_X11_UNIX_SOCKETS)
476 AC_DEFINE(MISSING_NFDBITS)
477 AC_DEFINE(MISSING_HOWMANY)
478 AC_DEFINE(MISSING_FD_MASK)
479 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100480esac
481
Damien Millere37bfc12000-06-05 09:37:43 +1000482# Allow user to specify flags
483AC_ARG_WITH(cflags,
484 [ --with-cflags Specify additional flags to pass to compiler],
485 [
486 if test "x$withval" != "xno" ; then
487 CFLAGS="$CFLAGS $withval"
488 fi
489 ]
490)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000491AC_ARG_WITH(cppflags,
492 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
493 [
494 if test "x$withval" != "xno"; then
495 CPPFLAGS="$CPPFLAGS $withval"
496 fi
497 ]
498)
Damien Millere37bfc12000-06-05 09:37:43 +1000499AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000500 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000501 [
502 if test "x$withval" != "xno" ; then
503 LDFLAGS="$LDFLAGS $withval"
504 fi
505 ]
506)
507AC_ARG_WITH(libs,
508 [ --with-libs Specify additional libraries to link with],
509 [
510 if test "x$withval" != "xno" ; then
511 LIBS="$LIBS $withval"
512 fi
513 ]
514)
515
Darren Tucker6eb93042003-06-29 21:30:41 +1000516AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000517AC_RUN_IFELSE(
518 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000519#include <stdio.h>
520int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000521 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000522 [ AC_MSG_RESULT(yes) ],
523 [
524 AC_MSG_RESULT(no)
525 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000526 ],
527 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000528)
529
Tim Rice4cec93f2002-02-26 08:40:48 -0800530# Checks for header files.
Damien Miller36f49652004-08-15 18:40:59 +1000531AC_CHECK_HEADERS(bstring.h crypt.h dirent.h endian.h features.h \
532 floatingpoint.h getopt.h glob.h ia.h lastlog.h limits.h login.h \
533 login_cap.h maillock.h ndir.h netdb.h netgroup.h \
Damien Miller0f47c532004-01-02 18:01:30 +1100534 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000535 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Damien Miller36f49652004-08-15 18:40:59 +1000536 strings.h sys/dir.h sys/strtio.h sys/audit.h sys/bitypes.h \
537 sys/bsdtty.h sys/cdefs.h sys/mman.h sys/ndir.h sys/prctl.h \
Darren Tucker48d99d32004-08-29 17:04:50 +1000538 sys/pstat.h sys/select.h sys/stat.h sys/stream.h \
Damien Miller36f49652004-08-15 18:40:59 +1000539 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h sys/un.h \
540 time.h tmpdir.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
Tim Rice4cec93f2002-02-26 08:40:48 -0800541
Darren Tucker48d99d32004-08-29 17:04:50 +1000542# sys/ptms.h requires sys/stream.h to be included first on Solaris
543AC_CHECK_HEADERS(sys/ptms.h, [], [], [
544#ifdef HAVE_SYS_STREAM_H
545# include <sys/stream.h>
546#endif
547])
548
Damien Millera22ba012000-03-02 23:09:20 +1100549# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700550AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
551AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000552
Damien Millerdf288022001-02-18 13:07:07 +1100553dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700554if test "x$with_tcp_wrappers" != "xno" ; then
555 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
556 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
557 fi
558fi
Damien Millerdf288022001-02-18 13:07:07 +1100559
Tim Rice1e1ef642003-09-11 22:19:31 -0700560dnl IRIX and Solaris 2.5.1 have dirname() in libgen
561AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
562 AC_CHECK_LIB(gen, dirname,[
563 AC_CACHE_CHECK([for broken dirname],
564 ac_cv_have_broken_dirname, [
565 save_LIBS="$LIBS"
566 LIBS="$LIBS -lgen"
567 AC_TRY_RUN(
568 [
569#include <libgen.h>
570#include <string.h>
571
572int main(int argc, char **argv) {
573 char *s, buf[32];
574
575 strncpy(buf,"/etc", 32);
576 s = dirname(buf);
577 if (!s || strncmp(s, "/", 32) != 0) {
578 exit(1);
579 } else {
580 exit(0);
581 }
582}
583 ],
584 [ ac_cv_have_broken_dirname="no" ],
585 [ ac_cv_have_broken_dirname="yes" ]
586 )
587 LIBS="$save_LIBS"
588 ])
589 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
590 LIBS="$LIBS -lgen"
591 AC_DEFINE(HAVE_DIRNAME)
592 AC_CHECK_HEADERS(libgen.h)
593 fi
594 ])
595])
596
597AC_CHECK_FUNC(getspnam, ,
598 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
599AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
600
Tim Rice13aae5e2001-10-21 17:53:58 -0700601dnl zlib is required
602AC_ARG_WITH(zlib,
603 [ --with-zlib=PATH Use zlib in PATH],
604 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000605 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100606 AC_MSG_ERROR([*** zlib is required ***])
607 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700608 if test -d "$withval/lib"; then
609 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700610 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700611 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700612 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700613 fi
614 else
615 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700616 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700617 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700618 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700619 fi
620 fi
621 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700622 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700623 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700624 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700625 fi
626 ]
627)
628
Tim Ricefcb62202004-01-23 18:35:16 -0800629AC_CHECK_LIB(z, deflate, ,
630 [
631 saved_CPPFLAGS="$CPPFLAGS"
632 saved_LDFLAGS="$LDFLAGS"
633 save_LIBS="$LIBS"
634 dnl Check default zlib install dir
635 if test -n "${need_dash_r}"; then
636 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
637 else
638 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
639 fi
640 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
641 LIBS="$LIBS -lz"
642 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
643 [
644 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
645 ]
646 )
647 ]
648)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100649AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100650
651AC_ARG_WITH(zlib-version-check,
652 [ --without-zlib-version-check Disable zlib version check],
653 [ if test "x$withval" = "xno" ; then
654 zlib_check_nonfatal=1
655 fi
656 ]
657)
658
Darren Tucker2dcd2392004-01-23 17:13:33 +1100659AC_MSG_CHECKING(for zlib 1.1.4 or greater)
Darren Tucker623d92f2004-09-12 22:36:15 +1000660AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2dcd2392004-01-23 17:13:33 +1100661#include <zlib.h>
662int main()
663{
664 int a, b, c, v;
665 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
666 exit(1);
667 v = a*1000000 + b*1000 + c;
668 if (v >= 1001004)
669 exit(0);
670 exit(2);
671}
Darren Tucker623d92f2004-09-12 22:36:15 +1000672 ]])],
Darren Tucker2dcd2392004-01-23 17:13:33 +1100673 AC_MSG_RESULT(yes),
674 [ AC_MSG_RESULT(no)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100675 if test -z "$zlib_check_nonfatal" ; then
676 AC_MSG_ERROR([*** zlib too old - check config.log ***
677Your reported zlib version has known security problems. It's possible your
678vendor has fixed these problems without changing the version number. If you
679are sure this is the case, you can disable the check by running
680"./configure --without-zlib-version-check".
681If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
682 else
683 AC_MSG_WARN([zlib version may have security problems])
684 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000685 ],
686 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100687)
Damien Miller6f9c3372000-10-25 10:06:04 +1100688
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000689dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100690AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000691 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
692)
Damien Millera8e06ce2003-11-21 23:48:55 +1100693AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700694 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
695 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000696)
Damien Millerab18c411999-11-11 10:40:23 +1100697
Tim Ricee589a292001-11-03 11:09:32 -0800698dnl Checks for libutil functions
699AC_CHECK_HEADERS(libutil.h)
700AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
701AC_CHECK_FUNCS(logout updwtmp logwtmp)
702
Ben Lindstrom8697e082001-02-24 21:41:10 +0000703AC_FUNC_STRFTIME
704
Damien Miller3c027682001-03-14 11:39:45 +1100705# Check for ALTDIRFUNC glob() extension
706AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
707AC_EGREP_CPP(FOUNDIT,
708 [
709 #include <glob.h>
710 #ifdef GLOB_ALTDIRFUNC
711 FOUNDIT
712 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100713 ],
Damien Miller3c027682001-03-14 11:39:45 +1100714 [
715 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
716 AC_MSG_RESULT(yes)
717 ],
718 [
719 AC_MSG_RESULT(no)
720 ]
721)
Damien Millerab18c411999-11-11 10:40:23 +1100722
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000723# Check for g.gl_matchc glob() extension
724AC_MSG_CHECKING(for gl_matchc field in glob_t)
725AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100726 [
727 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000728 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100729 ],
730 [
731 AC_DEFINE(GLOB_HAS_GL_MATCHC)
732 AC_MSG_RESULT(yes)
733 ],
734 [
735 AC_MSG_RESULT(no)
736 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000737)
738
Damien Miller18bb4732001-03-28 14:35:30 +1000739AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000740AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000741 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000742#include <sys/types.h>
743#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700744int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000745 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100746 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000747 [
748 AC_MSG_RESULT(no)
749 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000750 ],
751 [
752 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
753 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000754 ]
755)
756
Damien Miller36f49652004-08-15 18:40:59 +1000757AC_MSG_CHECKING([for /proc/pid/fd directory])
758if test -d "/proc/$$/fd" ; then
759 AC_DEFINE(HAVE_PROC_PID)
760 AC_MSG_RESULT(yes)
761else
762 AC_MSG_RESULT(no)
763fi
764
Damien Millerc547bf12001-02-16 10:18:12 +1100765# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100766SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100767AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700768 [ --with-skey[[=PATH]] Enable S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100769 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100770 [
771 if test "x$withval" != "xno" ; then
772
773 if test "x$withval" != "xyes" ; then
774 CPPFLAGS="$CPPFLAGS -I${withval}/include"
775 LDFLAGS="$LDFLAGS -L${withval}/lib"
776 fi
777
778 AC_DEFINE(SKEY)
779 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100780 SKEY_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100781
Tim Rice4cec93f2002-02-26 08:40:48 -0800782 AC_MSG_CHECKING([for s/key support])
783 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100784 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800785#include <stdio.h>
786#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700787int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800788 ],
789 [AC_MSG_RESULT(yes)],
790 [
791 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100792 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
793 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000794 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
795 AC_TRY_COMPILE(
796 [#include <stdio.h>
797 #include <skey.h>],
798 [(void)skeychallenge(NULL,"name","",0);],
799 [AC_MSG_RESULT(yes)
800 AC_DEFINE(SKEYCHALLENGE_4ARG)],
801 [AC_MSG_RESULT(no)]
802 )
Damien Millerc547bf12001-02-16 10:18:12 +1100803 fi
804 ]
805)
806
807# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700808TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100809AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700810 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
Damien Millera8e06ce2003-11-21 23:48:55 +1100811 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100812 [
813 if test "x$withval" != "xno" ; then
814 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700815 saved_LDFLAGS="$LDFLAGS"
816 saved_CPPFLAGS="$CPPFLAGS"
817 if test -n "${withval}" -a "${withval}" != "yes"; then
818 if test -d "${withval}/lib"; then
819 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700820 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700821 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700822 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700823 fi
824 else
825 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700826 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700827 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700828 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700829 fi
830 fi
831 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700832 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700833 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700834 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700835 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700836 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800837 LIBWRAP="-lwrap"
838 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100839 AC_MSG_CHECKING(for libwrap)
840 AC_TRY_LINK(
841 [
Damien Miller0ac45002004-04-14 20:14:26 +1000842#include <sys/types.h>
843#include <sys/socket.h>
844#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100845#include <tcpd.h>
846 int deny_severity = 0, allow_severity = 0;
847 ],
848 [hosts_access(0);],
849 [
850 AC_MSG_RESULT(yes)
851 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800852 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700853 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100854 ],
855 [
856 AC_MSG_ERROR([*** libwrap missing])
857 ]
858 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800859 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100860 fi
861 ]
862)
863
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100864# Check whether user wants libedit support
865LIBEDIT_MSG="no"
866AC_ARG_WITH(libedit,
867 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
868 [ if test "x$withval" != "xno" ; then
869 AC_CHECK_LIB(edit, el_init,
870 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
871 LIBEDIT="-ledit -lcurses"
872 LIBEDIT_MSG="yes"
873 AC_SUBST(LIBEDIT)
874 ],
875 [], [-lcurses]
876 )
877 fi ]
878)
879
Damien Millerfe1f1432003-02-24 15:45:42 +1100880dnl Checks for library functions. Please keep in alphabetical order
881AC_CHECK_FUNCS(\
Darren Tucker60bd4092004-06-25 14:03:34 +1000882 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
Darren Tuckerad7646a2005-02-02 10:43:59 +1100883 bindresvport_sa clock closefrom dirfd fchdir fchmod fchown \
884 freeaddrinfo futimes getaddrinfo getcwd getgrouplist getnameinfo \
885 getopt getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100886 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000887 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100888 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000889 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100890 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000891 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000892 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100893 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100894)
Tim Rice13aae5e2001-10-21 17:53:58 -0700895
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000896# IRIX has a const char return value for gai_strerror()
897AC_CHECK_FUNCS(gai_strerror,[
898 AC_DEFINE(HAVE_GAI_STRERROR)
899 AC_TRY_COMPILE([
900#include <sys/types.h>
901#include <sys/socket.h>
902#include <netdb.h>
903
904const char *gai_strerror(int);],[
905char *str;
906
907str = gai_strerror(0);],[
908 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
909 [Define if gai_strerror() returns const char *])])])
910
Damien Millercd6853c2003-01-28 11:33:42 +1100911AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
912
Darren Tuckerf1159b52003-07-07 19:44:01 +1000913dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000914AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000915AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000916
Darren Tuckerb2427c82003-09-10 15:22:44 +1000917dnl tcsendbreak might be a macro
918AC_CHECK_DECL(tcsendbreak,
919 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100920 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000921 [#include <termios.h>]
922)
923
Darren Tucker5bb14002004-04-23 18:53:10 +1000924AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
925
Darren Tucker2a6b0292003-12-31 14:59:17 +1100926AC_CHECK_FUNCS(setresuid, [
927 dnl Some platorms have setresuid that isn't implemented, test for this
928 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +1000929 AC_RUN_IFELSE(
930 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +1100931#include <stdlib.h>
932#include <errno.h>
933int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000934 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +1100935 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100936 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000937 AC_MSG_RESULT(not implemented)],
938 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100939 )
940])
Darren Tuckere937be32003-12-17 18:53:26 +1100941
Darren Tucker2a6b0292003-12-31 14:59:17 +1100942AC_CHECK_FUNCS(setresgid, [
943 dnl Some platorms have setresgid that isn't implemented, test for this
944 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +1000945 AC_RUN_IFELSE(
946 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +1100947#include <stdlib.h>
948#include <errno.h>
949int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000950 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +1100951 [AC_MSG_RESULT(yes)],
952 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000953 AC_MSG_RESULT(not implemented)],
954 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100955 )
956])
Darren Tuckere937be32003-12-17 18:53:26 +1100957
Damien Millerad833b32000-08-23 10:46:23 +1000958dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000959AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000960dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000961AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000962AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000963dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000964AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000965AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100966
Damien Millera8e06ce2003-11-21 23:48:55 +1100967AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100968 [AC_DEFINE(HAVE_DAEMON)],
969 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
970)
971
Damien Millera8e06ce2003-11-21 23:48:55 +1100972AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100973 [AC_DEFINE(HAVE_GETPAGESIZE)],
974 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
975)
976
Damien Millercb170cb2000-07-01 16:52:55 +1000977# Check for broken snprintf
978if test "x$ac_cv_func_snprintf" = "xyes" ; then
979 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000980 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000981 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +1000982#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700983int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +1000984 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100985 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000986 [
987 AC_MSG_RESULT(no)
988 AC_DEFINE(BROKEN_SNPRINTF)
989 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000990 ],
991 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +1000992 )
993fi
994
Damien Millerb4097182004-05-23 14:09:40 +1000995# Check for missing getpeereid (or equiv) support
996NO_PEERCHECK=""
997if test "x$ac_cv_func_getpeereid" != "xyes" ; then
998 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
999 AC_TRY_COMPILE(
1000 [#include <sys/types.h>
1001 #include <sys/socket.h>],
1002 [int i = SO_PEERCRED;],
1003 [AC_MSG_RESULT(yes)],
1004 [AC_MSG_RESULT(no)
1005 NO_PEERCHECK=1]
1006 )
1007fi
1008
Damien Millere8328192003-01-07 15:18:32 +11001009dnl see whether mkstemp() requires XXXXXX
1010if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1011AC_MSG_CHECKING([for (overly) strict mkstemp])
1012AC_TRY_RUN(
1013 [
1014#include <stdlib.h>
1015main() { char template[]="conftest.mkstemp-test";
1016if (mkstemp(template) == -1)
1017 exit(1);
1018unlink(template); exit(0);
1019}
1020 ],
1021 [
1022 AC_MSG_RESULT(no)
1023 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001024 [
Damien Millere8328192003-01-07 15:18:32 +11001025 AC_MSG_RESULT(yes)
1026 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1027 ],
1028 [
1029 AC_MSG_RESULT(yes)
1030 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001031 ]
Damien Millere8328192003-01-07 15:18:32 +11001032)
1033fi
1034
Darren Tucker70a3d552003-08-21 17:58:29 +10001035dnl make sure that openpty does not reacquire controlling terminal
1036if test ! -z "$check_for_openpty_ctty_bug"; then
1037 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1038 AC_TRY_RUN(
1039 [
1040#include <stdio.h>
1041#include <sys/fcntl.h>
1042#include <sys/types.h>
1043#include <sys/wait.h>
1044
1045int
1046main()
1047{
1048 pid_t pid;
1049 int fd, ptyfd, ttyfd, status;
1050
1051 pid = fork();
1052 if (pid < 0) { /* failed */
1053 exit(1);
1054 } else if (pid > 0) { /* parent */
1055 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001056 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001057 exit(WEXITSTATUS(status));
1058 else
1059 exit(2);
1060 } else { /* child */
1061 close(0); close(1); close(2);
1062 setsid();
1063 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1064 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1065 if (fd >= 0)
1066 exit(3); /* Acquired ctty: broken */
1067 else
1068 exit(0); /* Did not acquire ctty: OK */
1069 }
1070}
1071 ],
1072 [
1073 AC_MSG_RESULT(yes)
1074 ],
1075 [
1076 AC_MSG_RESULT(no)
1077 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1078 ]
1079 )
1080fi
1081
Darren Tucker4398cf52004-04-06 21:39:02 +10001082if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1083 AC_MSG_CHECKING(if getaddrinfo seems to work)
1084 AC_TRY_RUN(
1085 [
1086#include <stdio.h>
1087#include <sys/socket.h>
1088#include <netdb.h>
1089#include <errno.h>
1090#include <netinet/in.h>
1091
1092#define TEST_PORT "2222"
1093
1094int
1095main(void)
1096{
1097 int err, sock;
1098 struct addrinfo *gai_ai, *ai, hints;
1099 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1100
1101 memset(&hints, 0, sizeof(hints));
1102 hints.ai_family = PF_UNSPEC;
1103 hints.ai_socktype = SOCK_STREAM;
1104 hints.ai_flags = AI_PASSIVE;
1105
1106 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1107 if (err != 0) {
1108 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1109 exit(1);
1110 }
1111
1112 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1113 if (ai->ai_family != AF_INET6)
1114 continue;
1115
1116 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1117 sizeof(ntop), strport, sizeof(strport),
1118 NI_NUMERICHOST|NI_NUMERICSERV);
1119
1120 if (err != 0) {
1121 if (err == EAI_SYSTEM)
1122 perror("getnameinfo EAI_SYSTEM");
1123 else
1124 fprintf(stderr, "getnameinfo failed: %s\n",
1125 gai_strerror(err));
1126 exit(2);
1127 }
1128
1129 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1130 if (sock < 0)
1131 perror("socket");
1132 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1133 if (errno == EBADF)
1134 exit(3);
1135 }
1136 }
1137 exit(0);
1138}
1139 ],
1140 [
1141 AC_MSG_RESULT(yes)
1142 ],
1143 [
1144 AC_MSG_RESULT(no)
1145 AC_DEFINE(BROKEN_GETADDRINFO)
1146 ]
1147 )
1148fi
1149
Darren Tuckera56f1912004-11-02 20:30:54 +11001150if test "x$check_for_conflicting_getspnam" = "x1"; then
1151 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1152 AC_COMPILE_IFELSE(
1153 [
1154#include <shadow.h>
1155int main(void) {exit(0);}
1156 ],
1157 [
1158 AC_MSG_RESULT(no)
1159 ],
1160 [
1161 AC_MSG_RESULT(yes)
1162 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1163 [Conflicting defs for getspnam])
1164 ]
1165 )
1166fi
1167
Damien Miller606f8802000-09-16 15:39:56 +11001168AC_FUNC_GETPGRP
1169
Damien Millera64b57a2001-01-17 10:44:13 +11001170# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001171PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001172AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001173 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001174 [
Damien Millera64b57a2001-01-17 10:44:13 +11001175 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001176 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1177 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001178 AC_MSG_ERROR([PAM headers not found])
1179 fi
1180
1181 AC_CHECK_LIB(dl, dlopen, , )
1182 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1183 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001184 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001185
Damien Millera64b57a2001-01-17 10:44:13 +11001186 PAM_MSG="yes"
1187
1188 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001189 if test $ac_cv_lib_dl_dlopen = yes; then
1190 LIBPAM="-lpam -ldl"
1191 else
1192 LIBPAM="-lpam"
1193 fi
1194 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001195 fi
1196 ]
1197)
Damien Millera22ba012000-03-02 23:09:20 +11001198
Damien Millera64b57a2001-01-17 10:44:13 +11001199# Check for older PAM
1200if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001201 # Check PAM strerror arguments (old PAM)
1202 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1203 AC_TRY_COMPILE(
1204 [
Damien Miller81171112000-04-23 11:14:01 +10001205#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001206#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001207#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001208#elif defined (HAVE_PAM_PAM_APPL_H)
1209#include <pam/pam_appl.h>
1210#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001211 ],
1212 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001213 [AC_MSG_RESULT(no)],
1214 [
1215 AC_DEFINE(HAVE_OLD_PAM)
1216 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001217 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001218 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001219 )
Damien Millera22ba012000-03-02 23:09:20 +11001220fi
1221
Tim Riceaef73712002-05-11 13:17:42 -07001222# Search for OpenSSL
1223saved_CPPFLAGS="$CPPFLAGS"
1224saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001225AC_ARG_WITH(ssl-dir,
1226 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1227 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001228 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -07001229 if test -d "$withval/lib"; then
1230 if test -n "${need_dash_r}"; then
1231 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1232 else
1233 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1234 fi
1235 else
1236 if test -n "${need_dash_r}"; then
1237 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1238 else
1239 LDFLAGS="-L${withval} ${LDFLAGS}"
1240 fi
1241 fi
1242 if test -d "$withval/include"; then
1243 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1244 else
1245 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1246 fi
Damien Millera22ba012000-03-02 23:09:20 +11001247 fi
1248 ]
1249)
Tim Rice3d5352e2004-02-12 09:27:21 -08001250LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001251AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001252 [
Tim Riceaef73712002-05-11 13:17:42 -07001253 dnl Check default openssl install dir
1254 if test -n "${need_dash_r}"; then
1255 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001256 else
Tim Riceaef73712002-05-11 13:17:42 -07001257 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001258 fi
Tim Riceaef73712002-05-11 13:17:42 -07001259 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1260 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1261 [
1262 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1263 ]
1264 )
1265 ]
1266)
1267
Tim Riced730b782002-08-13 18:52:10 -07001268# Determine OpenSSL header version
1269AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001270AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001271 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001272#include <stdio.h>
1273#include <string.h>
1274#include <openssl/opensslv.h>
1275#define DATA "conftest.sslincver"
1276int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001277 FILE *fd;
1278 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001279
Damien Millera8e06ce2003-11-21 23:48:55 +11001280 fd = fopen(DATA,"w");
1281 if(fd == NULL)
1282 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001283
1284 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1285 exit(1);
1286
1287 exit(0);
1288}
Darren Tucker623d92f2004-09-12 22:36:15 +10001289 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001290 [
1291 ssl_header_ver=`cat conftest.sslincver`
1292 AC_MSG_RESULT($ssl_header_ver)
1293 ],
1294 [
1295 AC_MSG_RESULT(not found)
1296 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001297 ],
1298 [
1299 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001300 ]
1301)
1302
1303# Determine OpenSSL library version
1304AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001305AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001306 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001307#include <stdio.h>
1308#include <string.h>
1309#include <openssl/opensslv.h>
1310#include <openssl/crypto.h>
1311#define DATA "conftest.ssllibver"
1312int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001313 FILE *fd;
1314 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001315
Damien Millera8e06ce2003-11-21 23:48:55 +11001316 fd = fopen(DATA,"w");
1317 if(fd == NULL)
1318 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001319
1320 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1321 exit(1);
1322
1323 exit(0);
1324}
Darren Tucker623d92f2004-09-12 22:36:15 +10001325 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001326 [
1327 ssl_library_ver=`cat conftest.ssllibver`
1328 AC_MSG_RESULT($ssl_library_ver)
1329 ],
1330 [
1331 AC_MSG_RESULT(not found)
1332 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001333 ],
1334 [
1335 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001336 ]
1337)
Damien Millera22ba012000-03-02 23:09:20 +11001338
Damien Millerec932372002-01-22 22:16:03 +11001339# Sanity check OpenSSL headers
1340AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001341AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001342 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001343#include <string.h>
1344#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001345int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001346 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001347 [
1348 AC_MSG_RESULT(yes)
1349 ],
1350 [
1351 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001352 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1353Check config.log for details.
1354Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001355 ],
1356 [
1357 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001358 ]
1359)
1360
Tim Rice3d5352e2004-02-12 09:27:21 -08001361# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1362# because the system crypt() is more featureful.
1363if test "x$check_for_libcrypt_before" = "x1"; then
1364 AC_CHECK_LIB(crypt, crypt)
1365fi
1366
Damien Millera8e06ce2003-11-21 23:48:55 +11001367# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001368# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001369if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001370 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001371fi
1372
Damien Miller6c21c512002-01-22 21:57:53 +11001373
1374### Configure cryptographic random number support
1375
1376# Check wheter OpenSSL seeds itself
1377AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001378AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001379 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001380#include <string.h>
1381#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001382int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001383 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001384 [
1385 OPENSSL_SEEDS_ITSELF=yes
1386 AC_MSG_RESULT(yes)
1387 ],
1388 [
1389 AC_MSG_RESULT(no)
1390 # Default to use of the rand helper if OpenSSL doesn't
1391 # seed itself
1392 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001393 ],
1394 [
1395 AC_MSG_WARN([cross compiling: assuming yes])
1396 # This is safe, since all recent OpenSSL versions will
1397 # complain at runtime if not seeded correctly.
1398 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001399 ]
1400)
1401
1402
1403# Do we want to force the use of the rand helper?
1404AC_ARG_WITH(rand-helper,
1405 [ --with-rand-helper Use subprocess to gather strong randomness ],
1406 [
1407 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001408 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001409 # the previous test showed it to be unseeded.
1410 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1411 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1412 OPENSSL_SEEDS_ITSELF=yes
1413 USE_RAND_HELPER=""
1414 fi
1415 else
1416 USE_RAND_HELPER=yes
1417 fi
1418 ],
1419)
1420
1421# Which randomness source do we use?
1422if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1423 # OpenSSL only
1424 AC_DEFINE(OPENSSL_PRNG_ONLY)
1425 RAND_MSG="OpenSSL internal ONLY"
1426 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001427elif test ! -z "$USE_RAND_HELPER" ; then
1428 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001429 RAND_MSG="ssh-rand-helper"
1430 INSTALL_SSH_RAND_HELPER="yes"
1431fi
1432AC_SUBST(INSTALL_SSH_RAND_HELPER)
1433
1434### Configuration of ssh-rand-helper
1435
1436# PRNGD TCP socket
1437AC_ARG_WITH(prngd-port,
1438 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1439 [
Damien Millere996d722002-01-23 11:20:59 +11001440 case "$withval" in
1441 no)
1442 withval=""
1443 ;;
1444 [[0-9]]*)
1445 ;;
1446 *)
1447 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1448 ;;
1449 esac
1450 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001451 PRNGD_PORT="$withval"
1452 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1453 fi
1454 ]
1455)
1456
1457# PRNGD Unix domain socket
1458AC_ARG_WITH(prngd-socket,
1459 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1460 [
Damien Millere996d722002-01-23 11:20:59 +11001461 case "$withval" in
1462 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001463 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001464 ;;
1465 no)
1466 withval=""
1467 ;;
1468 /*)
1469 ;;
1470 *)
1471 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1472 ;;
1473 esac
1474
1475 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001476 if test ! -z "$PRNGD_PORT" ; then
1477 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1478 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001479 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001480 AC_MSG_WARN(Entropy socket is not readable)
1481 fi
1482 PRNGD_SOCKET="$withval"
1483 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1484 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001485 ],
1486 [
1487 # Check for existing socket only if we don't have a random device already
1488 if test "$USE_RAND_HELPER" = yes ; then
1489 AC_MSG_CHECKING(for PRNGD/EGD socket)
1490 # Insert other locations here
1491 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1492 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1493 PRNGD_SOCKET="$sock"
1494 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1495 break;
1496 fi
1497 done
1498 if test ! -z "$PRNGD_SOCKET" ; then
1499 AC_MSG_RESULT($PRNGD_SOCKET)
1500 else
1501 AC_MSG_RESULT(not found)
1502 fi
1503 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001504 ]
1505)
1506
1507# Change default command timeout for hashing entropy source
1508entropy_timeout=200
1509AC_ARG_WITH(entropy-timeout,
1510 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1511 [
1512 if test "x$withval" != "xno" ; then
1513 entropy_timeout=$withval
1514 fi
1515 ]
1516)
Damien Miller6c21c512002-01-22 21:57:53 +11001517AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1518
Damien Millerd3f6ad22002-06-25 10:24:47 +10001519SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001520AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001521 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001522 [
1523 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001524 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001525 fi
1526 ]
1527)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001528AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1529AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001530
Tim Rice88f2ab52002-03-17 12:17:34 -08001531# We do this little dance with the search path to insure
1532# that programs that we select for use by installed programs
1533# (which may be run by the super-user) come from trusted
1534# locations before they come from the user's private area.
1535# This should help avoid accidentally configuring some
1536# random version of a program in someone's personal bin.
1537
1538OPATH=$PATH
1539PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001540test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001541test -d /sbin && PATH=$PATH:/sbin
1542test -d /usr/sbin && PATH=$PATH:/usr/sbin
1543PATH=$PATH:/etc:$OPATH
1544
Damien Millera8e06ce2003-11-21 23:48:55 +11001545# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001546OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1547OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1548OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1549OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1550OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1551OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1552OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1553OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1554OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1555OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1556OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1557OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1558OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1559OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1560OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1561OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001562# restore PATH
1563PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001564
1565# Where does ssh-rand-helper get its randomness from?
1566INSTALL_SSH_PRNG_CMDS=""
1567if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1568 if test ! -z "$PRNGD_PORT" ; then
1569 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1570 elif test ! -z "$PRNGD_SOCKET" ; then
1571 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1572 else
1573 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1574 RAND_HELPER_CMDHASH=yes
1575 INSTALL_SSH_PRNG_CMDS="yes"
1576 fi
1577fi
1578AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1579
1580
Ben Lindstromb5628642000-10-18 00:02:25 +00001581# Cheap hack to ensure NEWS-OS libraries are arranged right.
1582if test ! -z "$SONY" ; then
1583 LIBS="$LIBS -liberty";
1584fi
1585
Damien Millera22ba012000-03-02 23:09:20 +11001586# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001587AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001588AC_CHECK_SIZEOF(short int, 2)
1589AC_CHECK_SIZEOF(int, 4)
1590AC_CHECK_SIZEOF(long int, 4)
1591AC_CHECK_SIZEOF(long long int, 8)
1592
Damien Millerfa2bb692002-04-23 23:22:25 +10001593# Sanity check long long for some platforms (AIX)
1594if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1595 ac_cv_sizeof_long_long_int=0
1596fi
1597
Damien Millera22ba012000-03-02 23:09:20 +11001598# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001599AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1600 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001601 [ #include <sys/types.h> ],
1602 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001603 [ ac_cv_have_u_int="yes" ],
1604 [ ac_cv_have_u_int="no" ]
1605 )
1606])
1607if test "x$ac_cv_have_u_int" = "xyes" ; then
1608 AC_DEFINE(HAVE_U_INT)
1609 have_u_int=1
1610fi
1611
Damien Miller61e50f12000-05-08 20:49:37 +10001612AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1613 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001614 [ #include <sys/types.h> ],
1615 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001616 [ ac_cv_have_intxx_t="yes" ],
1617 [ ac_cv_have_intxx_t="no" ]
1618 )
1619])
1620if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1621 AC_DEFINE(HAVE_INTXX_T)
1622 have_intxx_t=1
1623fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001624
1625if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001626 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001627then
1628 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1629 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001630 [ #include <stdint.h> ],
1631 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001632 [
1633 AC_DEFINE(HAVE_INTXX_T)
1634 AC_MSG_RESULT(yes)
1635 ],
1636 [ AC_MSG_RESULT(no) ]
1637 )
1638fi
1639
Damien Miller578783e2000-09-23 14:12:24 +11001640AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1641 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001642 [
1643#include <sys/types.h>
1644#ifdef HAVE_STDINT_H
1645# include <stdint.h>
1646#endif
1647#include <sys/socket.h>
1648#ifdef HAVE_SYS_BITYPES_H
1649# include <sys/bitypes.h>
1650#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001651 ],
1652 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001653 [ ac_cv_have_int64_t="yes" ],
1654 [ ac_cv_have_int64_t="no" ]
1655 )
1656])
1657if test "x$ac_cv_have_int64_t" = "xyes" ; then
1658 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001659fi
1660
Damien Miller61e50f12000-05-08 20:49:37 +10001661AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1662 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001663 [ #include <sys/types.h> ],
1664 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001665 [ ac_cv_have_u_intxx_t="yes" ],
1666 [ ac_cv_have_u_intxx_t="no" ]
1667 )
1668])
1669if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1670 AC_DEFINE(HAVE_U_INTXX_T)
1671 have_u_intxx_t=1
1672fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001673
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001674if test -z "$have_u_intxx_t" ; then
1675 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1676 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001677 [ #include <sys/socket.h> ],
1678 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001679 [
1680 AC_DEFINE(HAVE_U_INTXX_T)
1681 AC_MSG_RESULT(yes)
1682 ],
1683 [ AC_MSG_RESULT(no) ]
1684 )
1685fi
1686
Damien Miller578783e2000-09-23 14:12:24 +11001687AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1688 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001689 [ #include <sys/types.h> ],
1690 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001691 [ ac_cv_have_u_int64_t="yes" ],
1692 [ ac_cv_have_u_int64_t="no" ]
1693 )
1694])
1695if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1696 AC_DEFINE(HAVE_U_INT64_T)
1697 have_u_int64_t=1
1698fi
1699
Tim Rice4cec93f2002-02-26 08:40:48 -08001700if test -z "$have_u_int64_t" ; then
1701 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1702 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001703 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001704 [ u_int64_t a; a = 1],
1705 [
1706 AC_DEFINE(HAVE_U_INT64_T)
1707 AC_MSG_RESULT(yes)
1708 ],
1709 [ AC_MSG_RESULT(no) ]
1710 )
1711fi
1712
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001713if test -z "$have_u_intxx_t" ; then
1714 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1715 AC_TRY_COMPILE(
1716 [
1717#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001718 ],
1719 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001720 [ ac_cv_have_uintxx_t="yes" ],
1721 [ ac_cv_have_uintxx_t="no" ]
1722 )
1723 ])
1724 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1725 AC_DEFINE(HAVE_UINTXX_T)
1726 fi
1727fi
1728
1729if test -z "$have_uintxx_t" ; then
1730 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1731 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001732 [ #include <stdint.h> ],
1733 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001734 [
1735 AC_DEFINE(HAVE_UINTXX_T)
1736 AC_MSG_RESULT(yes)
1737 ],
1738 [ AC_MSG_RESULT(no) ]
1739 )
1740fi
1741
Damien Milleredb82922000-06-20 13:25:52 +10001742if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001743 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001744then
1745 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1746 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001747 [
1748#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001749 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001750 [
Damien Miller70494d12000-04-03 15:57:06 +10001751 int8_t a; int16_t b; int32_t c;
1752 u_int8_t e; u_int16_t f; u_int32_t g;
1753 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001754 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001755 [
1756 AC_DEFINE(HAVE_U_INTXX_T)
1757 AC_DEFINE(HAVE_INTXX_T)
1758 AC_MSG_RESULT(yes)
1759 ],
1760 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001761 )
Damien Millerb29ea912000-01-15 14:12:03 +11001762fi
1763
Damien Miller58be7382001-09-15 21:31:54 +10001764
1765AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1766 AC_TRY_COMPILE(
1767 [
1768#include <sys/types.h>
1769 ],
1770 [ u_char foo; foo = 125; ],
1771 [ ac_cv_have_u_char="yes" ],
1772 [ ac_cv_have_u_char="no" ]
1773 )
1774])
1775if test "x$ac_cv_have_u_char" = "xyes" ; then
1776 AC_DEFINE(HAVE_U_CHAR)
1777fi
1778
Tim Rice13aae5e2001-10-21 17:53:58 -07001779TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001780
Tim Rice200a5c02002-02-26 22:12:34 -08001781AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001782
Damien Miller61e50f12000-05-08 20:49:37 +10001783AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1784 AC_TRY_COMPILE(
1785 [
1786#include <sys/types.h>
1787 ],
1788 [ size_t foo; foo = 1235; ],
1789 [ ac_cv_have_size_t="yes" ],
1790 [ ac_cv_have_size_t="no" ]
1791 )
1792])
1793if test "x$ac_cv_have_size_t" = "xyes" ; then
1794 AC_DEFINE(HAVE_SIZE_T)
1795fi
Damien Miller95058511999-12-29 10:36:45 +11001796
Damien Miller615f9392000-05-17 22:53:33 +10001797AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1798 AC_TRY_COMPILE(
1799 [
1800#include <sys/types.h>
1801 ],
1802 [ ssize_t foo; foo = 1235; ],
1803 [ ac_cv_have_ssize_t="yes" ],
1804 [ ac_cv_have_ssize_t="no" ]
1805 )
1806])
1807if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1808 AC_DEFINE(HAVE_SSIZE_T)
1809fi
1810
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001811AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1812 AC_TRY_COMPILE(
1813 [
1814#include <time.h>
1815 ],
1816 [ clock_t foo; foo = 1235; ],
1817 [ ac_cv_have_clock_t="yes" ],
1818 [ ac_cv_have_clock_t="no" ]
1819 )
1820])
1821if test "x$ac_cv_have_clock_t" = "xyes" ; then
1822 AC_DEFINE(HAVE_CLOCK_T)
1823fi
1824
Damien Millerb54b40e2000-06-23 08:23:34 +10001825AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1826 AC_TRY_COMPILE(
1827 [
1828#include <sys/types.h>
1829#include <sys/socket.h>
1830 ],
1831 [ sa_family_t foo; foo = 1235; ],
1832 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001833 [ AC_TRY_COMPILE(
1834 [
1835#include <sys/types.h>
1836#include <sys/socket.h>
1837#include <netinet/in.h>
1838 ],
1839 [ sa_family_t foo; foo = 1235; ],
1840 [ ac_cv_have_sa_family_t="yes" ],
1841
Damien Millerb54b40e2000-06-23 08:23:34 +10001842 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001843 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001844 )
1845])
1846if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1847 AC_DEFINE(HAVE_SA_FAMILY_T)
1848fi
1849
Damien Miller0f91b4e2000-06-18 15:43:25 +10001850AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1851 AC_TRY_COMPILE(
1852 [
1853#include <sys/types.h>
1854 ],
1855 [ pid_t foo; foo = 1235; ],
1856 [ ac_cv_have_pid_t="yes" ],
1857 [ ac_cv_have_pid_t="no" ]
1858 )
1859])
1860if test "x$ac_cv_have_pid_t" = "xyes" ; then
1861 AC_DEFINE(HAVE_PID_T)
1862fi
1863
1864AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1865 AC_TRY_COMPILE(
1866 [
1867#include <sys/types.h>
1868 ],
1869 [ mode_t foo; foo = 1235; ],
1870 [ ac_cv_have_mode_t="yes" ],
1871 [ ac_cv_have_mode_t="no" ]
1872 )
1873])
1874if test "x$ac_cv_have_mode_t" = "xyes" ; then
1875 AC_DEFINE(HAVE_MODE_T)
1876fi
1877
Damien Miller61e50f12000-05-08 20:49:37 +10001878
1879AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1880 AC_TRY_COMPILE(
1881 [
Damien Miller81171112000-04-23 11:14:01 +10001882#include <sys/types.h>
1883#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001884 ],
1885 [ struct sockaddr_storage s; ],
1886 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1887 [ ac_cv_have_struct_sockaddr_storage="no" ]
1888 )
1889])
1890if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1891 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1892fi
Damien Miller34132e52000-01-14 15:45:46 +11001893
Damien Miller61e50f12000-05-08 20:49:37 +10001894AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1895 AC_TRY_COMPILE(
1896 [
Damien Miller7b22d652000-06-18 14:07:04 +10001897#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001898#include <netinet/in.h>
1899 ],
1900 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1901 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1902 [ ac_cv_have_struct_sockaddr_in6="no" ]
1903 )
1904])
1905if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1906 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1907fi
Damien Miller34132e52000-01-14 15:45:46 +11001908
Damien Miller61e50f12000-05-08 20:49:37 +10001909AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1910 AC_TRY_COMPILE(
1911 [
Damien Miller7b22d652000-06-18 14:07:04 +10001912#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001913#include <netinet/in.h>
1914 ],
1915 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1916 [ ac_cv_have_struct_in6_addr="yes" ],
1917 [ ac_cv_have_struct_in6_addr="no" ]
1918 )
1919])
1920if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1921 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1922fi
Damien Miller34132e52000-01-14 15:45:46 +11001923
Damien Miller61e50f12000-05-08 20:49:37 +10001924AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1925 AC_TRY_COMPILE(
1926 [
Damien Miller81171112000-04-23 11:14:01 +10001927#include <sys/types.h>
1928#include <sys/socket.h>
1929#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001930 ],
1931 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1932 [ ac_cv_have_struct_addrinfo="yes" ],
1933 [ ac_cv_have_struct_addrinfo="no" ]
1934 )
1935])
1936if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1937 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1938fi
1939
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001940AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1941 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001942 [ #include <sys/time.h> ],
1943 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001944 [ ac_cv_have_struct_timeval="yes" ],
1945 [ ac_cv_have_struct_timeval="no" ]
1946 )
1947])
1948if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1949 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1950 have_struct_timeval=1
1951fi
1952
Tim Rice4e4dc562003-03-18 10:21:40 -08001953AC_CHECK_TYPES(struct timespec)
1954
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001955# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001956if test "x$ac_cv_have_int64_t" = "xno" -a \
1957 "x$ac_cv_sizeof_long_int" != "x8" -a \
1958 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001959 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1960 echo "an alternative compiler (I.E., GCC) before continuing."
1961 echo ""
1962 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001963else
1964dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001965 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001966 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08001967#include <stdio.h>
1968#include <string.h>
1969#ifdef HAVE_SNPRINTF
1970main()
1971{
1972 char buf[50];
1973 char expected_out[50];
1974 int mazsize = 50 ;
1975#if (SIZEOF_LONG_INT == 8)
1976 long int num = 0x7fffffffffffffff;
1977#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001978 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001979#endif
1980 strcpy(expected_out, "9223372036854775807");
1981 snprintf(buf, mazsize, "%lld", num);
1982 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001983 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001984 exit(0);
1985}
1986#else
1987main() { exit(0); }
1988#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10001989 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001990 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08001991 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001992fi
1993
Damien Miller78315eb2000-09-29 23:01:36 +11001994dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001995OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1996OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1997OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1998OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1999OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002000OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002001OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2002OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002003OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002004OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2005OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2006OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2007OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002008OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2009OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2010OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2011OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002012
2013AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002014
Damien Miller61e50f12000-05-08 20:49:37 +10002015AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2016 ac_cv_have_ss_family_in_struct_ss, [
2017 AC_TRY_COMPILE(
2018 [
Damien Miller81171112000-04-23 11:14:01 +10002019#include <sys/types.h>
2020#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002021 ],
2022 [ struct sockaddr_storage s; s.ss_family = 1; ],
2023 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2024 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2025 )
2026])
2027if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2028 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2029fi
2030
Damien Miller61e50f12000-05-08 20:49:37 +10002031AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2032 ac_cv_have___ss_family_in_struct_ss, [
2033 AC_TRY_COMPILE(
2034 [
Damien Miller81171112000-04-23 11:14:01 +10002035#include <sys/types.h>
2036#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002037 ],
2038 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2039 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2040 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2041 )
2042])
2043if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2044 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2045fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002046
Damien Millerad833b32000-08-23 10:46:23 +10002047AC_CACHE_CHECK([for pw_class field in struct passwd],
2048 ac_cv_have_pw_class_in_struct_passwd, [
2049 AC_TRY_COMPILE(
2050 [
Damien Millerad833b32000-08-23 10:46:23 +10002051#include <pwd.h>
2052 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002053 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002054 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2055 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2056 )
2057])
2058if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2059 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2060fi
2061
Kevin Steves82456952001-06-22 21:14:18 +00002062AC_CACHE_CHECK([for pw_expire field in struct passwd],
2063 ac_cv_have_pw_expire_in_struct_passwd, [
2064 AC_TRY_COMPILE(
2065 [
2066#include <pwd.h>
2067 ],
2068 [ struct passwd p; p.pw_expire = 0; ],
2069 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2070 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2071 )
2072])
2073if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2074 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2075fi
2076
2077AC_CACHE_CHECK([for pw_change field in struct passwd],
2078 ac_cv_have_pw_change_in_struct_passwd, [
2079 AC_TRY_COMPILE(
2080 [
2081#include <pwd.h>
2082 ],
2083 [ struct passwd p; p.pw_change = 0; ],
2084 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2085 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2086 )
2087])
2088if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2089 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2090fi
Damien Miller61e50f12000-05-08 20:49:37 +10002091
Tim Rice28bbb0c2002-05-27 17:37:32 -07002092dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002093AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2094 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002095 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002096 [
Tim Riceae49fe62002-04-12 10:26:21 -07002097#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002098#include <sys/socket.h>
2099#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002100int main() {
2101#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002102#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002103exit(1);
2104#endif
2105struct msghdr m;
2106m.msg_accrights = 0;
2107exit(0);
2108}
Kevin Steves939c9db2002-03-22 17:23:25 +00002109 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002110 [ ac_cv_have_accrights_in_msghdr="yes" ],
2111 [ ac_cv_have_accrights_in_msghdr="no" ]
2112 )
2113])
2114if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2115 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2116fi
2117
Kevin Stevesa44e0352002-04-07 16:18:03 +00002118AC_CACHE_CHECK([for msg_control field in struct msghdr],
2119 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002120 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002121 [
Tim Riceae49fe62002-04-12 10:26:21 -07002122#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002123#include <sys/socket.h>
2124#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002125int main() {
2126#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002127#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002128exit(1);
2129#endif
2130struct msghdr m;
2131m.msg_control = 0;
2132exit(0);
2133}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002134 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002135 [ ac_cv_have_control_in_msghdr="yes" ],
2136 [ ac_cv_have_control_in_msghdr="no" ]
2137 )
2138])
2139if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2140 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2141fi
2142
Damien Miller61e50f12000-05-08 20:49:37 +10002143AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002144 AC_TRY_LINK([],
2145 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002146 [ ac_cv_libc_defines___progname="yes" ],
2147 [ ac_cv_libc_defines___progname="no" ]
2148 )
2149])
2150if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2151 AC_DEFINE(HAVE___PROGNAME)
2152fi
2153
Kevin Steves4846f4a2002-03-22 18:19:53 +00002154AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2155 AC_TRY_LINK([
2156#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002157],
2158 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002159 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2160 [ ac_cv_cc_implements___FUNCTION__="no" ]
2161 )
2162])
2163if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2164 AC_DEFINE(HAVE___FUNCTION__)
2165fi
2166
2167AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2168 AC_TRY_LINK([
2169#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002170],
2171 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002172 [ ac_cv_cc_implements___func__="yes" ],
2173 [ ac_cv_cc_implements___func__="no" ]
2174 )
2175])
2176if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2177 AC_DEFINE(HAVE___func__)
2178fi
2179
Damien Miller4f8e6692001-07-14 13:22:53 +10002180AC_CACHE_CHECK([whether getopt has optreset support],
2181 ac_cv_have_getopt_optreset, [
2182 AC_TRY_LINK(
2183 [
2184#include <getopt.h>
2185 ],
2186 [ extern int optreset; optreset = 0; ],
2187 [ ac_cv_have_getopt_optreset="yes" ],
2188 [ ac_cv_have_getopt_optreset="no" ]
2189 )
2190])
2191if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2192 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2193fi
Damien Millera22ba012000-03-02 23:09:20 +11002194
Damien Millerecbb26d2000-07-15 14:59:14 +10002195AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002196 AC_TRY_LINK([],
2197 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002198 [ ac_cv_libc_defines_sys_errlist="yes" ],
2199 [ ac_cv_libc_defines_sys_errlist="no" ]
2200 )
2201])
2202if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2203 AC_DEFINE(HAVE_SYS_ERRLIST)
2204fi
2205
2206
Damien Miller11fa2cc2000-08-16 10:35:58 +10002207AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002208 AC_TRY_LINK([],
2209 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002210 [ ac_cv_libc_defines_sys_nerr="yes" ],
2211 [ ac_cv_libc_defines_sys_nerr="no" ]
2212 )
2213])
2214if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2215 AC_DEFINE(HAVE_SYS_NERR)
2216fi
2217
Damien Millera8e06ce2003-11-21 23:48:55 +11002218SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002219# Check whether user wants sectok support
2220AC_ARG_WITH(sectok,
2221 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002222 [
2223 if test "x$withval" != "xno" ; then
2224 if test "x$withval" != "xyes" ; then
2225 CPPFLAGS="$CPPFLAGS -I${withval}"
2226 LDFLAGS="$LDFLAGS -L${withval}"
2227 if test ! -z "$need_dash_r" ; then
2228 LDFLAGS="$LDFLAGS -R${withval}"
2229 fi
2230 if test ! -z "$blibpath" ; then
2231 blibpath="$blibpath:${withval}"
2232 fi
2233 fi
2234 AC_CHECK_HEADERS(sectok.h)
2235 if test "$ac_cv_header_sectok_h" != yes; then
2236 AC_MSG_ERROR(Can't find sectok.h)
2237 fi
2238 AC_CHECK_LIB(sectok, sectok_open)
2239 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2240 AC_MSG_ERROR(Can't find libsectok)
2241 fi
2242 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002243 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002244 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002245 fi
2246 ]
2247)
2248
2249# Check whether user wants OpenSC support
2250AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10002251 AC_HELP_STRING([--with-opensc=PFX],
2252 [Enable smartcard support using OpenSC]),
2253 opensc_config_prefix="$withval", opensc_config_prefix="")
2254if test x$opensc_config_prefix != x ; then
2255 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2256 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2257 if test "$OPENSC_CONFIG" != "no"; then
2258 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2259 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2260 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2261 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2262 AC_DEFINE(SMARTCARD)
2263 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11002264 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10002265 fi
2266fi
Damien Miller85de5802001-09-18 14:01:11 +10002267
Darren Tucker5f88d342003-10-15 16:57:57 +10002268# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002269AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002270 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002271 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002272 # Needed by our getrrsetbyname()
2273 AC_SEARCH_LIBS(res_query, resolv)
2274 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002275 AC_MSG_CHECKING(if res_query will link)
2276 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2277 [AC_MSG_RESULT(no)
2278 saved_LIBS="$LIBS"
2279 LIBS="$LIBS -lresolv"
2280 AC_MSG_CHECKING(for res_query in -lresolv)
2281 AC_LINK_IFELSE([
2282#include <resolv.h>
2283int main()
2284{
2285 res_query (0, 0, 0, 0, 0);
2286 return 0;
2287}
2288 ],
2289 [LIBS="$LIBS -lresolv"
2290 AC_MSG_RESULT(yes)],
2291 [LIBS="$saved_LIBS"
2292 AC_MSG_RESULT(no)])
2293 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002294 AC_CHECK_FUNCS(_getshort _getlong)
2295 AC_CHECK_MEMBER(HEADER.ad,
2296 [AC_DEFINE(HAVE_HEADER_AD)],,
2297 [#include <arpa/nameser.h>])
2298 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002299
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002300# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002301KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002302AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002303 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002304 [ if test "x$withval" != "xno" ; then
2305 if test "x$withval" = "xyes" ; then
2306 KRB5ROOT="/usr/local"
2307 else
2308 KRB5ROOT=${withval}
2309 fi
2310
2311 AC_DEFINE(KRB5)
2312 KRB5_MSG="yes"
2313
2314 AC_MSG_CHECKING(for krb5-config)
2315 if test -x $KRB5ROOT/bin/krb5-config ; then
2316 KRB5CONF=$KRB5ROOT/bin/krb5-config
2317 AC_MSG_RESULT($KRB5CONF)
2318
2319 AC_MSG_CHECKING(for gssapi support)
2320 if $KRB5CONF | grep gssapi >/dev/null ; then
2321 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002322 AC_DEFINE(GSSAPI)
2323 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002324 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002325 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002326 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002327 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002328 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2329 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002330 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002331 AC_MSG_CHECKING(whether we are using Heimdal)
2332 AC_TRY_COMPILE([ #include <krb5.h> ],
2333 [ char *tmp = heimdal_version; ],
2334 [ AC_MSG_RESULT(yes)
2335 AC_DEFINE(HEIMDAL) ],
2336 AC_MSG_RESULT(no)
2337 )
2338 else
2339 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002340 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002341 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002342 AC_MSG_CHECKING(whether we are using Heimdal)
2343 AC_TRY_COMPILE([ #include <krb5.h> ],
2344 [ char *tmp = heimdal_version; ],
2345 [ AC_MSG_RESULT(yes)
2346 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002347 K5LIBS="-lkrb5 -ldes"
2348 K5LIBS="$K5LIBS -lcom_err -lasn1"
2349 AC_CHECK_LIB(roken, net_write,
2350 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002351 ],
2352 [ AC_MSG_RESULT(no)
2353 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2354 ]
2355 )
Damien Miller200d0a72003-06-30 19:21:36 +10002356 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002357
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002358 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2359 [ AC_DEFINE(GSSAPI)
2360 K5LIBS="-lgssapi $K5LIBS" ],
2361 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2362 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002363 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002364 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2365 $K5LIBS)
2366 ],
2367 $K5LIBS)
2368
2369 AC_CHECK_HEADER(gssapi.h, ,
2370 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002371 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002372 AC_CHECK_HEADERS(gssapi.h, ,
2373 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002374 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002375 ]
2376 )
2377
2378 oldCPP="$CPPFLAGS"
2379 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2380 AC_CHECK_HEADER(gssapi_krb5.h, ,
2381 [ CPPFLAGS="$oldCPP" ])
2382
Damien Millera8e06ce2003-11-21 23:48:55 +11002383 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002384 if test ! -z "$need_dash_r" ; then
2385 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2386 fi
2387 if test ! -z "$blibpath" ; then
2388 blibpath="$blibpath:${KRB5ROOT}/lib"
2389 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002390 fi
2391
2392 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2393 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2394 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2395
2396 LIBS="$LIBS $K5LIBS"
2397 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002398 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002399 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002400)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002401
Damien Millera22ba012000-03-02 23:09:20 +11002402# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002403
Damien Millerf58c6722002-05-13 13:15:42 +10002404PRIVSEP_PATH=/var/empty
2405AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002406 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002407 [
2408 if test "x$withval" != "$no" ; then
2409 PRIVSEP_PATH=$withval
2410 fi
2411 ]
2412)
2413AC_SUBST(PRIVSEP_PATH)
2414
Damien Millera22ba012000-03-02 23:09:20 +11002415AC_ARG_WITH(xauth,
2416 [ --with-xauth=PATH Specify path to xauth program ],
2417 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002418 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002419 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002420 fi
2421 ],
2422 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002423 TestPath="$PATH"
2424 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2425 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2426 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2427 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2428 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002429 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002430 xauth_path="/usr/openwin/bin/xauth"
2431 fi
2432 ]
2433)
2434
Damien Miller7d901272003-01-13 16:55:22 +11002435STRIP_OPT=-s
2436AC_ARG_ENABLE(strip,
2437 [ --disable-strip Disable calling strip(1) on install],
2438 [
2439 if test "x$enableval" = "xno" ; then
2440 STRIP_OPT=
2441 fi
2442 ]
2443)
2444AC_SUBST(STRIP_OPT)
2445
Damien Millera19cf472000-11-29 13:28:50 +11002446if test -z "$xauth_path" ; then
2447 XAUTH_PATH="undefined"
2448 AC_SUBST(XAUTH_PATH)
2449else
Damien Millera22ba012000-03-02 23:09:20 +11002450 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002451 XAUTH_PATH=$xauth_path
2452 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002453fi
Damien Millera22ba012000-03-02 23:09:20 +11002454
2455# Check for mail directory (last resort if we cannot get it from headers)
2456if test ! -z "$MAIL" ; then
2457 maildir=`dirname $MAIL`
2458 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2459fi
2460
Darren Tucker623d92f2004-09-12 22:36:15 +10002461if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002462 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2463 disable_ptmx_check=yes
2464fi
Damien Millera22ba012000-03-02 23:09:20 +11002465if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002466 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002467 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002468 [
2469 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2470 have_dev_ptmx=1
2471 ]
2472 )
2473 fi
Damien Millera22ba012000-03-02 23:09:20 +11002474fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002475
Darren Tucker623d92f2004-09-12 22:36:15 +10002476if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002477 AC_CHECK_FILE("/dev/ptc",
2478 [
2479 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2480 have_dev_ptc=1
2481 ]
2482 )
2483else
2484 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2485fi
Damien Miller204ad072000-03-02 23:56:12 +11002486
Damien Millera22ba012000-03-02 23:09:20 +11002487# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002488AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002489 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002490 [
Damien Miller897741e2001-04-16 10:41:46 +10002491 case "$withval" in
2492 man|cat|doc)
2493 MANTYPE=$withval
2494 ;;
2495 *)
2496 AC_MSG_ERROR(invalid man type: $withval)
2497 ;;
2498 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002499 ]
2500)
Ben Lindstrombc709922001-04-18 18:04:21 +00002501if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002502 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2503 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002504 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2505 MANTYPE=doc
2506 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2507 MANTYPE=man
2508 else
2509 MANTYPE=cat
2510 fi
2511fi
Damien Miller670a4b82000-01-22 13:53:11 +11002512AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002513if test "$MANTYPE" = "doc"; then
2514 mansubdir=man;
2515else
2516 mansubdir=$MANTYPE;
2517fi
2518AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002519
Damien Millera22ba012000-03-02 23:09:20 +11002520# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002521MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002522AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002523 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002524 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002525 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002526 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002527 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002528 fi
2529 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002530)
2531
Damien Millera22ba012000-03-02 23:09:20 +11002532# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002533AC_ARG_WITH(shadow,
2534 [ --without-shadow Disable shadow password support],
2535 [
2536 if test "x$withval" = "xno" ; then
2537 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002538 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002539 fi
2540 ]
2541)
2542
Damien Miller1f335fb2000-06-26 11:31:33 +10002543if test -z "$disable_shadow" ; then
2544 AC_MSG_CHECKING([if the systems has expire shadow information])
2545 AC_TRY_COMPILE(
2546 [
2547#include <sys/types.h>
2548#include <shadow.h>
2549 struct spwd sp;
2550 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2551 [ sp_expire_available=yes ], []
2552 )
2553
2554 if test "x$sp_expire_available" = "xyes" ; then
2555 AC_MSG_RESULT(yes)
2556 AC_DEFINE(HAS_SHADOW_EXPIRE)
2557 else
2558 AC_MSG_RESULT(no)
2559 fi
2560fi
2561
Damien Millera22ba012000-03-02 23:09:20 +11002562# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002563if test ! -z "$IPADDR_IN_DISPLAY" ; then
2564 DISPLAY_HACK_MSG="yes"
2565 AC_DEFINE(IPADDR_IN_DISPLAY)
2566else
Damien Millera8e06ce2003-11-21 23:48:55 +11002567 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002568 AC_ARG_WITH(ipaddr-display,
2569 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2570 [
2571 if test "x$withval" != "xno" ; then
2572 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002573 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002574 fi
2575 ]
2576 )
2577fi
Damien Miller76112de1999-12-21 11:18:08 +11002578
Darren Tuckere1a790d2003-09-16 11:52:19 +10002579# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002580AC_ARG_ENABLE(etc-default-login,
2581 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
Darren Tuckera0c2b392004-09-11 23:26:37 +10002582 [ AC_CHECK_FILE("/etc/default/login",
2583 [ external_path_file=/etc/default/login ])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002584
Darren Tucker623d92f2004-09-12 22:36:15 +10002585 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2586 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002587 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2588 elif test "x$external_path_file" = "x/etc/default/login"; then
2589 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2590 fi
2591 ]
2592)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002593
Tim Rice43a1c132002-04-17 21:19:14 -07002594dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2595if test $ac_cv_func_login_getcapbool = "yes" -a \
2596 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002597 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002598fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002599
Damien Millera22ba012000-03-02 23:09:20 +11002600# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002601SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002602AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002603 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002604 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002605 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002606 AC_MSG_WARN([
2607--with-default-path=PATH has no effect on this system.
2608Edit /etc/login.conf instead.])
2609 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002610 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002611 AC_MSG_WARN([
2612--with-default-path=PATH will only be used if PATH is not defined in
2613$external_path_file .])
2614 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002615 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002616 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002617 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002618 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002619 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2620 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002621 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002622 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002623 AC_MSG_WARN([
2624If PATH is defined in $external_path_file, ensure the path to scp is included,
2625otherwise scp will not work.])
2626 fi
2627 AC_TRY_RUN(
2628 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002629/* find out what STDPATH is */
2630#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002631#ifdef HAVE_PATHS_H
2632# include <paths.h>
2633#endif
2634#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002635# ifdef _PATH_USERPATH /* Irix */
2636# define _PATH_STDPATH _PATH_USERPATH
2637# else
2638# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2639# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002640#endif
2641#include <sys/types.h>
2642#include <sys/stat.h>
2643#include <fcntl.h>
2644#define DATA "conftest.stdpath"
2645
2646main()
2647{
2648 FILE *fd;
2649 int rc;
2650
2651 fd = fopen(DATA,"w");
2652 if(fd == NULL)
2653 exit(1);
2654
2655 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2656 exit(1);
2657
2658 exit(0);
2659}
2660 ], [ user_path=`cat conftest.stdpath` ],
2661 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2662 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2663 )
2664# make sure $bindir is in USER_PATH so scp will work
2665 t_bindir=`eval echo ${bindir}`
2666 case $t_bindir in
2667 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2668 esac
2669 case $t_bindir in
2670 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2671 esac
2672 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2673 if test $? -ne 0 ; then
2674 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2675 if test $? -ne 0 ; then
2676 user_path=$user_path:$t_bindir
2677 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2678 fi
2679 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002680 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002681)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002682if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002683 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2684 AC_SUBST(user_path)
2685fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002686
Damien Millera18bbd32002-05-13 10:48:57 +10002687# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002688AC_ARG_WITH(superuser-path,
2689 [ --with-superuser-path= Specify different path for super-user],
2690 [
2691 if test "x$withval" != "xno" ; then
2692 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2693 superuser_path=$withval
2694 fi
2695 ]
2696)
2697
2698
Damien Miller61e50f12000-05-08 20:49:37 +10002699AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002700IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002701AC_ARG_WITH(4in6,
2702 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2703 [
2704 if test "x$withval" != "xno" ; then
2705 AC_MSG_RESULT(yes)
2706 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002707 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002708 else
2709 AC_MSG_RESULT(no)
2710 fi
2711 ],[
2712 if test "x$inet6_default_4in6" = "xyes"; then
2713 AC_MSG_RESULT([yes (default)])
2714 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002715 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002716 else
2717 AC_MSG_RESULT([no (default)])
2718 fi
2719 ]
2720)
2721
Damien Miller60396b02001-02-18 17:01:00 +11002722# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002723BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002724AC_ARG_WITH(bsd-auth,
2725 [ --with-bsd-auth Enable BSD auth support],
2726 [
2727 if test "x$withval" != "xno" ; then
2728 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002729 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002730 fi
2731 ]
2732)
2733
Damien Millera22ba012000-03-02 23:09:20 +11002734# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002735piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002736# make sure the directory exists
2737if test ! -d $piddir ; then
2738 piddir=`eval echo ${sysconfdir}`
2739 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002740 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002741 esac
2742fi
2743
Tim Rice88f2ab52002-03-17 12:17:34 -08002744AC_ARG_WITH(pid-dir,
2745 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2746 [
2747 if test "x$withval" != "xno" ; then
2748 piddir=$withval
2749 if test ! -d $piddir ; then
2750 AC_MSG_WARN([** no $piddir directory on this system **])
2751 fi
2752 fi
2753 ]
2754)
2755
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002756AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002757AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002758
andre2ff7b5d2000-06-03 14:57:40 +00002759dnl allow user to disable some login recording features
2760AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002761 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002762 [
2763 if test "x$enableval" = "xno" ; then
2764 AC_DEFINE(DISABLE_LASTLOG)
2765 fi
2766 ]
andre2ff7b5d2000-06-03 14:57:40 +00002767)
2768AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002769 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002770 [
2771 if test "x$enableval" = "xno" ; then
2772 AC_DEFINE(DISABLE_UTMP)
2773 fi
2774 ]
andre2ff7b5d2000-06-03 14:57:40 +00002775)
2776AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002777 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002778 [
2779 if test "x$enableval" = "xno" ; then
2780 AC_DEFINE(DISABLE_UTMPX)
2781 fi
2782 ]
andre2ff7b5d2000-06-03 14:57:40 +00002783)
2784AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002785 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002786 [
2787 if test "x$enableval" = "xno" ; then
2788 AC_DEFINE(DISABLE_WTMP)
2789 fi
2790 ]
andre2ff7b5d2000-06-03 14:57:40 +00002791)
2792AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002793 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002794 [
2795 if test "x$enableval" = "xno" ; then
2796 AC_DEFINE(DISABLE_WTMPX)
2797 fi
2798 ]
andre2ff7b5d2000-06-03 14:57:40 +00002799)
2800AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002801 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002802 [
2803 if test "x$enableval" = "xno" ; then
2804 AC_DEFINE(DISABLE_LOGIN)
2805 fi
2806 ]
andre2ff7b5d2000-06-03 14:57:40 +00002807)
2808AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002809 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002810 [
2811 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002812 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002813 fi
2814 ]
andre2ff7b5d2000-06-03 14:57:40 +00002815)
2816AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002817 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002818 [
2819 if test "x$enableval" = "xno" ; then
2820 AC_DEFINE(DISABLE_PUTUTXLINE)
2821 fi
2822 ]
andre2ff7b5d2000-06-03 14:57:40 +00002823)
2824AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002825 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002826 [
2827 if test "x$withval" = "xno" ; then
2828 AC_DEFINE(DISABLE_LASTLOG)
2829 else
2830 conf_lastlog_location=$withval
2831 fi
2832 ]
2833)
andre2ff7b5d2000-06-03 14:57:40 +00002834
2835dnl lastlog, [uw]tmpx? detection
2836dnl NOTE: set the paths in the platform section to avoid the
2837dnl need for command-line parameters
2838dnl lastlog and [uw]tmp are subject to a file search if all else fails
2839
2840dnl lastlog detection
2841dnl NOTE: the code itself will detect if lastlog is a directory
2842AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2843AC_TRY_COMPILE([
2844#include <sys/types.h>
2845#include <utmp.h>
2846#ifdef HAVE_LASTLOG_H
2847# include <lastlog.h>
2848#endif
Damien Miller2994e082000-06-04 15:51:47 +10002849#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002850# include <paths.h>
2851#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002852#ifdef HAVE_LOGIN_H
2853# include <login.h>
2854#endif
andre2ff7b5d2000-06-03 14:57:40 +00002855 ],
2856 [ char *lastlog = LASTLOG_FILE; ],
2857 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002858 [
2859 AC_MSG_RESULT(no)
2860 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2861 AC_TRY_COMPILE([
2862#include <sys/types.h>
2863#include <utmp.h>
2864#ifdef HAVE_LASTLOG_H
2865# include <lastlog.h>
2866#endif
2867#ifdef HAVE_PATHS_H
2868# include <paths.h>
2869#endif
2870 ],
2871 [ char *lastlog = _PATH_LASTLOG; ],
2872 [ AC_MSG_RESULT(yes) ],
2873 [
andree441aa32000-06-12 22:34:38 +00002874 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002875 system_lastlog_path=no
2876 ])
2877 ]
andre2ff7b5d2000-06-03 14:57:40 +00002878)
Damien Miller2994e082000-06-04 15:51:47 +10002879
andre2ff7b5d2000-06-03 14:57:40 +00002880if test -z "$conf_lastlog_location"; then
2881 if test x"$system_lastlog_path" = x"no" ; then
2882 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002883 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002884 conf_lastlog_location=$f
2885 fi
2886 done
2887 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002888 AC_MSG_WARN([** Cannot find lastlog **])
2889 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002890 fi
2891 fi
2892fi
2893
2894if test -n "$conf_lastlog_location"; then
2895 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2896fi
2897
2898dnl utmp detection
2899AC_MSG_CHECKING([if your system defines UTMP_FILE])
2900AC_TRY_COMPILE([
2901#include <sys/types.h>
2902#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002903#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002904# include <paths.h>
2905#endif
2906 ],
2907 [ char *utmp = UTMP_FILE; ],
2908 [ AC_MSG_RESULT(yes) ],
2909 [ AC_MSG_RESULT(no)
2910 system_utmp_path=no ]
2911)
2912if test -z "$conf_utmp_location"; then
2913 if test x"$system_utmp_path" = x"no" ; then
2914 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2915 if test -f $f ; then
2916 conf_utmp_location=$f
2917 fi
2918 done
2919 if test -z "$conf_utmp_location"; then
2920 AC_DEFINE(DISABLE_UTMP)
2921 fi
2922 fi
2923fi
2924if test -n "$conf_utmp_location"; then
2925 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2926fi
2927
2928dnl wtmp detection
2929AC_MSG_CHECKING([if your system defines WTMP_FILE])
2930AC_TRY_COMPILE([
2931#include <sys/types.h>
2932#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002933#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002934# include <paths.h>
2935#endif
2936 ],
2937 [ char *wtmp = WTMP_FILE; ],
2938 [ AC_MSG_RESULT(yes) ],
2939 [ AC_MSG_RESULT(no)
2940 system_wtmp_path=no ]
2941)
2942if test -z "$conf_wtmp_location"; then
2943 if test x"$system_wtmp_path" = x"no" ; then
2944 for f in /usr/adm/wtmp /var/log/wtmp; do
2945 if test -f $f ; then
2946 conf_wtmp_location=$f
2947 fi
2948 done
2949 if test -z "$conf_wtmp_location"; then
2950 AC_DEFINE(DISABLE_WTMP)
2951 fi
2952 fi
2953fi
2954if test -n "$conf_wtmp_location"; then
2955 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2956fi
2957
2958
2959dnl utmpx detection - I don't know any system so perverse as to require
2960dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2961dnl there, though.
2962AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2963AC_TRY_COMPILE([
2964#include <sys/types.h>
2965#include <utmp.h>
2966#ifdef HAVE_UTMPX_H
2967#include <utmpx.h>
2968#endif
Damien Miller2994e082000-06-04 15:51:47 +10002969#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002970# include <paths.h>
2971#endif
2972 ],
2973 [ char *utmpx = UTMPX_FILE; ],
2974 [ AC_MSG_RESULT(yes) ],
2975 [ AC_MSG_RESULT(no)
2976 system_utmpx_path=no ]
2977)
2978if test -z "$conf_utmpx_location"; then
2979 if test x"$system_utmpx_path" = x"no" ; then
2980 AC_DEFINE(DISABLE_UTMPX)
2981 fi
2982else
2983 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2984fi
2985
2986dnl wtmpx detection
2987AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2988AC_TRY_COMPILE([
2989#include <sys/types.h>
2990#include <utmp.h>
2991#ifdef HAVE_UTMPX_H
2992#include <utmpx.h>
2993#endif
Damien Miller2994e082000-06-04 15:51:47 +10002994#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002995# include <paths.h>
2996#endif
2997 ],
2998 [ char *wtmpx = WTMPX_FILE; ],
2999 [ AC_MSG_RESULT(yes) ],
3000 [ AC_MSG_RESULT(no)
3001 system_wtmpx_path=no ]
3002)
3003if test -z "$conf_wtmpx_location"; then
3004 if test x"$system_wtmpx_path" = x"no" ; then
3005 AC_DEFINE(DISABLE_WTMPX)
3006 fi
3007else
3008 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
3009fi
3010
Damien Miller4018c192000-04-30 09:30:44 +10003011
Damien Miller29ea30d2000-03-17 10:54:15 +11003012if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003013 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3014 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003015fi
3016
Tim Rice4cec93f2002-02-26 08:40:48 -08003017dnl remove pam and dl because they are in $LIBPAM
3018if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003019 LIBS=`echo $LIBS | sed 's/-lpam //'`
3020fi
3021if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3022 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003023fi
3024
Damien Millerbac2d8a2000-09-05 16:13:06 +11003025AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003026AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3027 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003028AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003029
Damien Miller7b22d652000-06-18 14:07:04 +10003030# Print summary of options
3031
Damien Miller7b22d652000-06-18 14:07:04 +10003032# Someone please show me a better way :)
3033A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3034B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3035C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3036D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003037E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003038F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003039G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003040H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3041I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3042J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003043
3044echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003045echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003046echo " User binaries: $B"
3047echo " System binaries: $C"
3048echo " Configuration files: $D"
3049echo " Askpass program: $E"
3050echo " Manual pages: $F"
3051echo " PID file: $G"
3052echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003053if test "x$external_path_file" = "x/etc/login.conf" ; then
3054echo " At runtime, sshd will use the path defined in $external_path_file"
3055echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003056else
Damien Millerf58c6722002-05-13 13:15:42 +10003057echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003058 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003059echo " (If PATH is set in $external_path_file it will be used instead. If"
3060echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3061 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003062fi
Damien Millera18bbd32002-05-13 10:48:57 +10003063if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003064echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003065fi
Damien Millerf58c6722002-05-13 13:15:42 +10003066echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003067echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003068echo " KerberosV support: $KRB5_MSG"
3069echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003070echo " S/KEY support: $SKEY_MSG"
3071echo " TCP Wrappers support: $TCPW_MSG"
3072echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003073echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003074echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003075echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3076echo " BSD Auth support: $BSD_AUTH_MSG"
3077echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003078if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003079echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003080fi
3081
Damien Miller7b22d652000-06-18 14:07:04 +10003082echo ""
3083
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003084echo " Host: ${host}"
3085echo " Compiler: ${CC}"
3086echo " Compiler flags: ${CFLAGS}"
3087echo "Preprocessor flags: ${CPPFLAGS}"
3088echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003089echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003090
3091echo ""
3092
Tim Rice6f1f7582004-05-30 21:38:51 -07003093if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003094 echo "SVR4 style packages are supported with \"make package\""
3095 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003096fi
3097
Damien Miller82cf0ce2000-12-20 13:34:48 +11003098if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003099 echo "PAM is enabled. You may need to install a PAM control file "
3100 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003101 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003102 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003103 echo ""
3104fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003105
Damien Miller6c21c512002-01-22 21:57:53 +11003106if test ! -z "$RAND_HELPER_CMDHASH" ; then
3107 echo "WARNING: you are using the builtin random number collection "
3108 echo "service. Please read WARNING.RNG and request that your OS "
3109 echo "vendor includes kernel-based random number collection in "
3110 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003111 echo ""
3112fi
Damien Miller60396b02001-02-18 17:01:00 +11003113
Damien Millerb4097182004-05-23 14:09:40 +10003114if test ! -z "$NO_PEERCHECK" ; then
3115 echo "WARNING: the operating system that you are using does not "
3116 echo "appear to support either the getpeereid() API nor the "
3117 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3118 echo "enforce security checks to prevent unauthorised connections to "
3119 echo "ssh-agent. Their absence increases the risk that a malicious "
3120 echo "user can connect to your agent. "
3121 echo ""
3122fi
3123