blob: f60bbdd27bc55939dbd9603d36b740911f1a26db [file] [log] [blame]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001# $Id: configure.ac,v 1.233 2004/11/07 09:14:34 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 Tucker4398cf52004-04-06 21:39:02 +1000222 check_for_hpux_broken_getaddrinfo=1
Darren Tuckera56f1912004-11-02 20:30:54 +1100223 check_for_conflicting_getspnam=1
Tim Ricef028f1e2002-07-19 12:41:10 -0700224 LIBS="$LIBS -lsec"
225 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000226 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100227*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100228 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000229 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000230 AC_DEFINE(SETEUID_BREAKS_SETUID)
231 AC_DEFINE(BROKEN_SETREUID)
232 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000233 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000234 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100235 ;;
236*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100237 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000238 AC_DEFINE(WITH_IRIX_ARRAY)
239 AC_DEFINE(WITH_IRIX_PROJECT)
240 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000241 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000242 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000243 AC_DEFINE(SETEUID_BREAKS_SETUID)
244 AC_DEFINE(BROKEN_SETREUID)
245 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000246 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000247 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000248 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100249 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100250*-*-linux*)
251 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100252 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000253 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100254 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000255 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000256 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000257 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Darren Tuckere59b5082004-06-28 16:01:19 +1000258 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
Damien Miller7bcb0892000-03-11 20:45:40 +1100259 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000260 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000261 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000262 AC_DEFINE(BROKEN_CMSG_TYPE)
263 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000264 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100265 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000266mips-sony-bsd|mips-sony-newsos4)
267 AC_DEFINE(HAVE_NEWS4)
268 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000269 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100270*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000271 check_for_libcrypt_before=1
Tim Rice88368a32003-12-08 12:35:59 -0800272 if test "x$withval" != "xno" ; then
273 need_dash_r=1
274 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100275 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100276*-*-freebsd*)
277 check_for_libcrypt_later=1
278 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000279*-*-bsdi*)
280 AC_DEFINE(SETEUID_BREAKS_SETUID)
281 AC_DEFINE(BROKEN_SETREUID)
282 AC_DEFINE(BROKEN_SETREGID)
283 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000284*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000285 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100286 conf_utmp_location=/etc/utmp
287 conf_wtmp_location=/usr/adm/wtmp
288 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000289 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000290 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000291 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100292 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000293 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100294*-*-solaris*)
Tim Ricead4a1882004-02-29 15:53:37 -0800295 if test "x$withval" != "xno" ; then
296 need_dash_r=1
297 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100298 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000299 AC_DEFINE(LOGIN_NEEDS_UTMPX)
300 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000301 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker21dd0892004-08-16 23:12:05 +1000302 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000303 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000304 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
305 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000306 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000307 # hardwire lastlog location (can't detect it on some versions)
308 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000309 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
310 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
311 if test "$sol2ver" -ge 8; then
312 AC_MSG_RESULT(yes)
313 AC_DEFINE(DISABLE_UTMP)
314 AC_DEFINE(DISABLE_WTMP)
315 else
316 AC_MSG_RESULT(no)
317 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100318 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000319*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000320 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000321 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100322 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000323 conf_utmp_location=/etc/utmp
324 conf_wtmp_location=/var/adm/wtmp
325 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000326 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000327 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000328*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700329 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000330 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000331 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000332 AC_DEFINE(SETEUID_BREAKS_SETUID)
333 AC_DEFINE(BROKEN_SETREUID)
334 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000335 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000336*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700337 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000338 AC_CHECK_LIB(dl, dlsym, ,)
Damien Millerfd9885e2001-01-10 08:16:53 +1100339 IPADDR_IN_DISPLAY=yes
340 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000341 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000342 AC_DEFINE(SETEUID_BREAKS_SETUID)
343 AC_DEFINE(BROKEN_SETREUID)
344 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000345 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000346 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700347 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
348 # Attention: always take care to bind libsocket and libnsl before libc,
349 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000350 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100351*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100352 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700353 AC_DEFINE(SETEUID_BREAKS_SETUID)
354 AC_DEFINE(BROKEN_SETREUID)
355 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100356 ;;
357*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100358 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700359 AC_DEFINE(SETEUID_BREAKS_SETUID)
360 AC_DEFINE(BROKEN_SETREUID)
361 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100362 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100363*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100364 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100365*-*-sco3.2v4*)
Tim Ricefcb62202004-01-23 18:35:16 -0800366 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize"
Tim Ricee8c898a2004-02-23 21:47:04 -0800367 LIBS="$LIBS -los -lprot -lcrypt_i -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100368 RANLIB=true
369 no_dev_ptmx=1
370 AC_DEFINE(BROKEN_SYS_TERMIO_H)
371 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000372 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000373 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100374 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Ricefe6d5aa2004-04-16 20:03:07 -0700375 AC_DEFINE(SETEUID_BREAKS_SETUID)
376 AC_DEFINE(BROKEN_SETREUID)
377 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700378 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100379 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700380 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700381 do_sco3_extra_lib_check=yes
Tim Ricef7ba8f62004-06-20 10:37:32 -0700382 TEST_SHELL=ksh
Damien Miller78315eb2000-09-29 23:01:36 +1100383 ;;
384*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800385 if test -z "$GCC"; then
386 CFLAGS="$CFLAGS -belf"
387 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100388 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000389 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100390 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000391 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000392 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700393 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700394 AC_DEFINE(SETEUID_BREAKS_SETUID)
395 AC_DEFINE(BROKEN_SETREUID)
396 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700397 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700398 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Miller217f5672001-02-16 12:12:41 +1100399 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700400 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700401 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000402 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000403*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100404 AC_DEFINE(NO_SSH_LASTLOG)
405 AC_DEFINE(SETEUID_BREAKS_SETUID)
406 AC_DEFINE(BROKEN_SETREUID)
407 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000408 AC_DEFINE(USE_PIPES)
409 AC_DEFINE(DISABLE_FD_PASSING)
410 LDFLAGS="$LDFLAGS"
411 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
412 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000413 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000414*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100415 AC_DEFINE(SETEUID_BREAKS_SETUID)
416 AC_DEFINE(BROKEN_SETREUID)
417 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000418 AC_DEFINE(WITH_ABBREV_NO_TTY)
419 AC_DEFINE(USE_PIPES)
420 AC_DEFINE(DISABLE_FD_PASSING)
421 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100422 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000423 MANTYPE=cat
424 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000425*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100426 AC_DEFINE(SETEUID_BREAKS_SETUID)
427 AC_DEFINE(BROKEN_SETREUID)
428 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000429 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700430 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700431 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000432 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
433 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
434 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700435 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000436*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000437 AC_MSG_CHECKING(for Digital Unix SIA)
438 no_osfsia=""
439 AC_ARG_WITH(osfsia,
440 [ --with-osfsia Enable Digital Unix SIA],
441 [
442 if test "x$withval" = "xno" ; then
443 AC_MSG_RESULT(disabled)
444 no_osfsia=1
445 fi
446 ],
447 )
448 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000449 if test -f /etc/sia/matrix.conf; then
450 AC_MSG_RESULT(yes)
451 AC_DEFINE(HAVE_OSF_SIA)
452 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000453 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000454 LIBS="$LIBS -lsecurity -ldb -lm -laud"
455 else
456 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100457 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000458 fi
459 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000460 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700461 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000462 AC_DEFINE(BROKEN_SETREUID)
463 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000464 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000465
466*-*-nto-qnx)
467 AC_DEFINE(USE_PIPES)
468 AC_DEFINE(NO_X11_UNIX_SOCKETS)
469 AC_DEFINE(MISSING_NFDBITS)
470 AC_DEFINE(MISSING_HOWMANY)
471 AC_DEFINE(MISSING_FD_MASK)
472 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100473esac
474
Damien Millere37bfc12000-06-05 09:37:43 +1000475# Allow user to specify flags
476AC_ARG_WITH(cflags,
477 [ --with-cflags Specify additional flags to pass to compiler],
478 [
479 if test "x$withval" != "xno" ; then
480 CFLAGS="$CFLAGS $withval"
481 fi
482 ]
483)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000484AC_ARG_WITH(cppflags,
485 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
486 [
487 if test "x$withval" != "xno"; then
488 CPPFLAGS="$CPPFLAGS $withval"
489 fi
490 ]
491)
Damien Millere37bfc12000-06-05 09:37:43 +1000492AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000493 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000494 [
495 if test "x$withval" != "xno" ; then
496 LDFLAGS="$LDFLAGS $withval"
497 fi
498 ]
499)
500AC_ARG_WITH(libs,
501 [ --with-libs Specify additional libraries to link with],
502 [
503 if test "x$withval" != "xno" ; then
504 LIBS="$LIBS $withval"
505 fi
506 ]
507)
508
Darren Tucker6eb93042003-06-29 21:30:41 +1000509AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000510AC_RUN_IFELSE(
511 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000512#include <stdio.h>
513int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000514 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000515 [ AC_MSG_RESULT(yes) ],
516 [
517 AC_MSG_RESULT(no)
518 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000519 ],
520 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000521)
522
Tim Rice4cec93f2002-02-26 08:40:48 -0800523# Checks for header files.
Damien Miller36f49652004-08-15 18:40:59 +1000524AC_CHECK_HEADERS(bstring.h crypt.h dirent.h endian.h features.h \
525 floatingpoint.h getopt.h glob.h ia.h lastlog.h limits.h login.h \
526 login_cap.h maillock.h ndir.h netdb.h netgroup.h \
Damien Miller0f47c532004-01-02 18:01:30 +1100527 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000528 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Damien Miller36f49652004-08-15 18:40:59 +1000529 strings.h sys/dir.h sys/strtio.h sys/audit.h sys/bitypes.h \
530 sys/bsdtty.h sys/cdefs.h sys/mman.h sys/ndir.h sys/prctl.h \
Darren Tucker48d99d32004-08-29 17:04:50 +1000531 sys/pstat.h sys/select.h sys/stat.h sys/stream.h \
Damien Miller36f49652004-08-15 18:40:59 +1000532 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h sys/un.h \
533 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 -0800534
Darren Tucker48d99d32004-08-29 17:04:50 +1000535# sys/ptms.h requires sys/stream.h to be included first on Solaris
536AC_CHECK_HEADERS(sys/ptms.h, [], [], [
537#ifdef HAVE_SYS_STREAM_H
538# include <sys/stream.h>
539#endif
540])
541
Damien Millera22ba012000-03-02 23:09:20 +1100542# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700543AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
544AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000545
Damien Millerdf288022001-02-18 13:07:07 +1100546dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700547if test "x$with_tcp_wrappers" != "xno" ; then
548 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
549 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
550 fi
551fi
Damien Millerdf288022001-02-18 13:07:07 +1100552
Tim Rice1e1ef642003-09-11 22:19:31 -0700553dnl IRIX and Solaris 2.5.1 have dirname() in libgen
554AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
555 AC_CHECK_LIB(gen, dirname,[
556 AC_CACHE_CHECK([for broken dirname],
557 ac_cv_have_broken_dirname, [
558 save_LIBS="$LIBS"
559 LIBS="$LIBS -lgen"
560 AC_TRY_RUN(
561 [
562#include <libgen.h>
563#include <string.h>
564
565int main(int argc, char **argv) {
566 char *s, buf[32];
567
568 strncpy(buf,"/etc", 32);
569 s = dirname(buf);
570 if (!s || strncmp(s, "/", 32) != 0) {
571 exit(1);
572 } else {
573 exit(0);
574 }
575}
576 ],
577 [ ac_cv_have_broken_dirname="no" ],
578 [ ac_cv_have_broken_dirname="yes" ]
579 )
580 LIBS="$save_LIBS"
581 ])
582 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
583 LIBS="$LIBS -lgen"
584 AC_DEFINE(HAVE_DIRNAME)
585 AC_CHECK_HEADERS(libgen.h)
586 fi
587 ])
588])
589
590AC_CHECK_FUNC(getspnam, ,
591 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
592AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
593
Tim Rice13aae5e2001-10-21 17:53:58 -0700594dnl zlib is required
595AC_ARG_WITH(zlib,
596 [ --with-zlib=PATH Use zlib in PATH],
597 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000598 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100599 AC_MSG_ERROR([*** zlib is required ***])
600 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700601 if test -d "$withval/lib"; then
602 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700603 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700604 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700605 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700606 fi
607 else
608 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700609 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700610 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700611 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700612 fi
613 fi
614 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700615 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700616 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700617 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700618 fi
619 ]
620)
621
Tim Ricefcb62202004-01-23 18:35:16 -0800622AC_CHECK_LIB(z, deflate, ,
623 [
624 saved_CPPFLAGS="$CPPFLAGS"
625 saved_LDFLAGS="$LDFLAGS"
626 save_LIBS="$LIBS"
627 dnl Check default zlib install dir
628 if test -n "${need_dash_r}"; then
629 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
630 else
631 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
632 fi
633 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
634 LIBS="$LIBS -lz"
635 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
636 [
637 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
638 ]
639 )
640 ]
641)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100642AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100643
644AC_ARG_WITH(zlib-version-check,
645 [ --without-zlib-version-check Disable zlib version check],
646 [ if test "x$withval" = "xno" ; then
647 zlib_check_nonfatal=1
648 fi
649 ]
650)
651
Darren Tucker2dcd2392004-01-23 17:13:33 +1100652AC_MSG_CHECKING(for zlib 1.1.4 or greater)
Darren Tucker623d92f2004-09-12 22:36:15 +1000653AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2dcd2392004-01-23 17:13:33 +1100654#include <zlib.h>
655int main()
656{
657 int a, b, c, v;
658 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
659 exit(1);
660 v = a*1000000 + b*1000 + c;
661 if (v >= 1001004)
662 exit(0);
663 exit(2);
664}
Darren Tucker623d92f2004-09-12 22:36:15 +1000665 ]])],
Darren Tucker2dcd2392004-01-23 17:13:33 +1100666 AC_MSG_RESULT(yes),
667 [ AC_MSG_RESULT(no)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100668 if test -z "$zlib_check_nonfatal" ; then
669 AC_MSG_ERROR([*** zlib too old - check config.log ***
670Your reported zlib version has known security problems. It's possible your
671vendor has fixed these problems without changing the version number. If you
672are sure this is the case, you can disable the check by running
673"./configure --without-zlib-version-check".
674If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
675 else
676 AC_MSG_WARN([zlib version may have security problems])
677 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000678 ],
679 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100680)
Damien Miller6f9c3372000-10-25 10:06:04 +1100681
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000682dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100683AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000684 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
685)
Damien Millera8e06ce2003-11-21 23:48:55 +1100686AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700687 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
688 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000689)
Damien Millerab18c411999-11-11 10:40:23 +1100690
Tim Ricee589a292001-11-03 11:09:32 -0800691dnl Checks for libutil functions
692AC_CHECK_HEADERS(libutil.h)
693AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
694AC_CHECK_FUNCS(logout updwtmp logwtmp)
695
Ben Lindstrom8697e082001-02-24 21:41:10 +0000696AC_FUNC_STRFTIME
697
Damien Miller3c027682001-03-14 11:39:45 +1100698# Check for ALTDIRFUNC glob() extension
699AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
700AC_EGREP_CPP(FOUNDIT,
701 [
702 #include <glob.h>
703 #ifdef GLOB_ALTDIRFUNC
704 FOUNDIT
705 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100706 ],
Damien Miller3c027682001-03-14 11:39:45 +1100707 [
708 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
709 AC_MSG_RESULT(yes)
710 ],
711 [
712 AC_MSG_RESULT(no)
713 ]
714)
Damien Millerab18c411999-11-11 10:40:23 +1100715
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000716# Check for g.gl_matchc glob() extension
717AC_MSG_CHECKING(for gl_matchc field in glob_t)
718AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100719 [
720 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000721 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100722 ],
723 [
724 AC_DEFINE(GLOB_HAS_GL_MATCHC)
725 AC_MSG_RESULT(yes)
726 ],
727 [
728 AC_MSG_RESULT(no)
729 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000730)
731
Damien Miller18bb4732001-03-28 14:35:30 +1000732AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000733AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000734 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000735#include <sys/types.h>
736#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700737int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000738 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100739 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000740 [
741 AC_MSG_RESULT(no)
742 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000743 ],
744 [
745 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
746 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000747 ]
748)
749
Damien Miller36f49652004-08-15 18:40:59 +1000750AC_MSG_CHECKING([for /proc/pid/fd directory])
751if test -d "/proc/$$/fd" ; then
752 AC_DEFINE(HAVE_PROC_PID)
753 AC_MSG_RESULT(yes)
754else
755 AC_MSG_RESULT(no)
756fi
757
Damien Millerc547bf12001-02-16 10:18:12 +1100758# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100759SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100760AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700761 [ --with-skey[[=PATH]] Enable S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100762 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100763 [
764 if test "x$withval" != "xno" ; then
765
766 if test "x$withval" != "xyes" ; then
767 CPPFLAGS="$CPPFLAGS -I${withval}/include"
768 LDFLAGS="$LDFLAGS -L${withval}/lib"
769 fi
770
771 AC_DEFINE(SKEY)
772 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100773 SKEY_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100774
Tim Rice4cec93f2002-02-26 08:40:48 -0800775 AC_MSG_CHECKING([for s/key support])
776 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100777 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800778#include <stdio.h>
779#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700780int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800781 ],
782 [AC_MSG_RESULT(yes)],
783 [
784 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100785 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
786 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000787 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
788 AC_TRY_COMPILE(
789 [#include <stdio.h>
790 #include <skey.h>],
791 [(void)skeychallenge(NULL,"name","",0);],
792 [AC_MSG_RESULT(yes)
793 AC_DEFINE(SKEYCHALLENGE_4ARG)],
794 [AC_MSG_RESULT(no)]
795 )
Damien Millerc547bf12001-02-16 10:18:12 +1100796 fi
797 ]
798)
799
800# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700801TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100802AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700803 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
Damien Millera8e06ce2003-11-21 23:48:55 +1100804 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100805 [
806 if test "x$withval" != "xno" ; then
807 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700808 saved_LDFLAGS="$LDFLAGS"
809 saved_CPPFLAGS="$CPPFLAGS"
810 if test -n "${withval}" -a "${withval}" != "yes"; then
811 if test -d "${withval}/lib"; then
812 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700813 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700814 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700815 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700816 fi
817 else
818 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700819 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700820 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700821 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700822 fi
823 fi
824 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700825 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700826 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700827 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700828 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700829 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800830 LIBWRAP="-lwrap"
831 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100832 AC_MSG_CHECKING(for libwrap)
833 AC_TRY_LINK(
834 [
Damien Miller0ac45002004-04-14 20:14:26 +1000835#include <sys/types.h>
836#include <sys/socket.h>
837#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100838#include <tcpd.h>
839 int deny_severity = 0, allow_severity = 0;
840 ],
841 [hosts_access(0);],
842 [
843 AC_MSG_RESULT(yes)
844 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800845 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700846 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100847 ],
848 [
849 AC_MSG_ERROR([*** libwrap missing])
850 ]
851 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800852 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100853 fi
854 ]
855)
856
Darren Tucker16bcc1c2004-11-07 20:14:34 +1100857# Check whether user wants libedit support
858LIBEDIT_MSG="no"
859AC_ARG_WITH(libedit,
860 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
861 [ if test "x$withval" != "xno" ; then
862 AC_CHECK_LIB(edit, el_init,
863 [ AC_DEFINE(USE_LIBEDIT, [], [Use libedit for sftp])
864 LIBEDIT="-ledit -lcurses"
865 LIBEDIT_MSG="yes"
866 AC_SUBST(LIBEDIT)
867 ],
868 [], [-lcurses]
869 )
870 fi ]
871)
872
Damien Millerfe1f1432003-02-24 15:45:42 +1100873dnl Checks for library functions. Please keep in alphabetical order
874AC_CHECK_FUNCS(\
Darren Tucker60bd4092004-06-25 14:03:34 +1000875 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
Damien Miller36f49652004-08-15 18:40:59 +1000876 bindresvport_sa clock closefrom dirfd fchmod fchown freeaddrinfo \
877 futimes getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000878 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100879 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000880 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100881 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000882 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100883 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000884 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000885 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100886 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100887)
Tim Rice13aae5e2001-10-21 17:53:58 -0700888
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000889# IRIX has a const char return value for gai_strerror()
890AC_CHECK_FUNCS(gai_strerror,[
891 AC_DEFINE(HAVE_GAI_STRERROR)
892 AC_TRY_COMPILE([
893#include <sys/types.h>
894#include <sys/socket.h>
895#include <netdb.h>
896
897const char *gai_strerror(int);],[
898char *str;
899
900str = gai_strerror(0);],[
901 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
902 [Define if gai_strerror() returns const char *])])])
903
Damien Millercd6853c2003-01-28 11:33:42 +1100904AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
905
Darren Tuckerf1159b52003-07-07 19:44:01 +1000906dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000907AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000908AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000909
Darren Tuckerb2427c82003-09-10 15:22:44 +1000910dnl tcsendbreak might be a macro
911AC_CHECK_DECL(tcsendbreak,
912 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100913 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000914 [#include <termios.h>]
915)
916
Darren Tucker5bb14002004-04-23 18:53:10 +1000917AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
918
Darren Tucker2a6b0292003-12-31 14:59:17 +1100919AC_CHECK_FUNCS(setresuid, [
920 dnl Some platorms have setresuid that isn't implemented, test for this
921 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +1000922 AC_RUN_IFELSE(
923 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +1100924#include <stdlib.h>
925#include <errno.h>
926int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000927 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +1100928 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100929 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000930 AC_MSG_RESULT(not implemented)],
931 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100932 )
933])
Darren Tuckere937be32003-12-17 18:53:26 +1100934
Darren Tucker2a6b0292003-12-31 14:59:17 +1100935AC_CHECK_FUNCS(setresgid, [
936 dnl Some platorms have setresgid that isn't implemented, test for this
937 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +1000938 AC_RUN_IFELSE(
939 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +1100940#include <stdlib.h>
941#include <errno.h>
942int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000943 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +1100944 [AC_MSG_RESULT(yes)],
945 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000946 AC_MSG_RESULT(not implemented)],
947 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100948 )
949])
Darren Tuckere937be32003-12-17 18:53:26 +1100950
Damien Millerad833b32000-08-23 10:46:23 +1000951dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000952AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000953dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000954AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000955AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000956dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000957AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000958AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100959
Damien Millera8e06ce2003-11-21 23:48:55 +1100960AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100961 [AC_DEFINE(HAVE_DAEMON)],
962 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
963)
964
Damien Millera8e06ce2003-11-21 23:48:55 +1100965AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100966 [AC_DEFINE(HAVE_GETPAGESIZE)],
967 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
968)
969
Damien Millercb170cb2000-07-01 16:52:55 +1000970# Check for broken snprintf
971if test "x$ac_cv_func_snprintf" = "xyes" ; then
972 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000973 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000974 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +1000975#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700976int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +1000977 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100978 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000979 [
980 AC_MSG_RESULT(no)
981 AC_DEFINE(BROKEN_SNPRINTF)
982 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000983 ],
984 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +1000985 )
986fi
987
Damien Millerb4097182004-05-23 14:09:40 +1000988# Check for missing getpeereid (or equiv) support
989NO_PEERCHECK=""
990if test "x$ac_cv_func_getpeereid" != "xyes" ; then
991 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
992 AC_TRY_COMPILE(
993 [#include <sys/types.h>
994 #include <sys/socket.h>],
995 [int i = SO_PEERCRED;],
996 [AC_MSG_RESULT(yes)],
997 [AC_MSG_RESULT(no)
998 NO_PEERCHECK=1]
999 )
1000fi
1001
Damien Millere8328192003-01-07 15:18:32 +11001002dnl see whether mkstemp() requires XXXXXX
1003if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1004AC_MSG_CHECKING([for (overly) strict mkstemp])
1005AC_TRY_RUN(
1006 [
1007#include <stdlib.h>
1008main() { char template[]="conftest.mkstemp-test";
1009if (mkstemp(template) == -1)
1010 exit(1);
1011unlink(template); exit(0);
1012}
1013 ],
1014 [
1015 AC_MSG_RESULT(no)
1016 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001017 [
Damien Millere8328192003-01-07 15:18:32 +11001018 AC_MSG_RESULT(yes)
1019 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1020 ],
1021 [
1022 AC_MSG_RESULT(yes)
1023 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001024 ]
Damien Millere8328192003-01-07 15:18:32 +11001025)
1026fi
1027
Darren Tucker70a3d552003-08-21 17:58:29 +10001028dnl make sure that openpty does not reacquire controlling terminal
1029if test ! -z "$check_for_openpty_ctty_bug"; then
1030 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1031 AC_TRY_RUN(
1032 [
1033#include <stdio.h>
1034#include <sys/fcntl.h>
1035#include <sys/types.h>
1036#include <sys/wait.h>
1037
1038int
1039main()
1040{
1041 pid_t pid;
1042 int fd, ptyfd, ttyfd, status;
1043
1044 pid = fork();
1045 if (pid < 0) { /* failed */
1046 exit(1);
1047 } else if (pid > 0) { /* parent */
1048 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001049 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001050 exit(WEXITSTATUS(status));
1051 else
1052 exit(2);
1053 } else { /* child */
1054 close(0); close(1); close(2);
1055 setsid();
1056 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1057 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1058 if (fd >= 0)
1059 exit(3); /* Acquired ctty: broken */
1060 else
1061 exit(0); /* Did not acquire ctty: OK */
1062 }
1063}
1064 ],
1065 [
1066 AC_MSG_RESULT(yes)
1067 ],
1068 [
1069 AC_MSG_RESULT(no)
1070 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1071 ]
1072 )
1073fi
1074
Darren Tucker4398cf52004-04-06 21:39:02 +10001075if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1076 AC_MSG_CHECKING(if getaddrinfo seems to work)
1077 AC_TRY_RUN(
1078 [
1079#include <stdio.h>
1080#include <sys/socket.h>
1081#include <netdb.h>
1082#include <errno.h>
1083#include <netinet/in.h>
1084
1085#define TEST_PORT "2222"
1086
1087int
1088main(void)
1089{
1090 int err, sock;
1091 struct addrinfo *gai_ai, *ai, hints;
1092 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1093
1094 memset(&hints, 0, sizeof(hints));
1095 hints.ai_family = PF_UNSPEC;
1096 hints.ai_socktype = SOCK_STREAM;
1097 hints.ai_flags = AI_PASSIVE;
1098
1099 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1100 if (err != 0) {
1101 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1102 exit(1);
1103 }
1104
1105 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1106 if (ai->ai_family != AF_INET6)
1107 continue;
1108
1109 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1110 sizeof(ntop), strport, sizeof(strport),
1111 NI_NUMERICHOST|NI_NUMERICSERV);
1112
1113 if (err != 0) {
1114 if (err == EAI_SYSTEM)
1115 perror("getnameinfo EAI_SYSTEM");
1116 else
1117 fprintf(stderr, "getnameinfo failed: %s\n",
1118 gai_strerror(err));
1119 exit(2);
1120 }
1121
1122 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1123 if (sock < 0)
1124 perror("socket");
1125 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1126 if (errno == EBADF)
1127 exit(3);
1128 }
1129 }
1130 exit(0);
1131}
1132 ],
1133 [
1134 AC_MSG_RESULT(yes)
1135 ],
1136 [
1137 AC_MSG_RESULT(no)
1138 AC_DEFINE(BROKEN_GETADDRINFO)
1139 ]
1140 )
1141fi
1142
Darren Tuckera56f1912004-11-02 20:30:54 +11001143if test "x$check_for_conflicting_getspnam" = "x1"; then
1144 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1145 AC_COMPILE_IFELSE(
1146 [
1147#include <shadow.h>
1148int main(void) {exit(0);}
1149 ],
1150 [
1151 AC_MSG_RESULT(no)
1152 ],
1153 [
1154 AC_MSG_RESULT(yes)
1155 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1156 [Conflicting defs for getspnam])
1157 ]
1158 )
1159fi
1160
Damien Miller606f8802000-09-16 15:39:56 +11001161AC_FUNC_GETPGRP
1162
Damien Millera64b57a2001-01-17 10:44:13 +11001163# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001164PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001165AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001166 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001167 [
Damien Millera64b57a2001-01-17 10:44:13 +11001168 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001169 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1170 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001171 AC_MSG_ERROR([PAM headers not found])
1172 fi
1173
1174 AC_CHECK_LIB(dl, dlopen, , )
1175 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1176 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001177 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001178
Damien Millera64b57a2001-01-17 10:44:13 +11001179 PAM_MSG="yes"
1180
1181 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001182 if test $ac_cv_lib_dl_dlopen = yes; then
1183 LIBPAM="-lpam -ldl"
1184 else
1185 LIBPAM="-lpam"
1186 fi
1187 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001188 fi
1189 ]
1190)
Damien Millera22ba012000-03-02 23:09:20 +11001191
Damien Millera64b57a2001-01-17 10:44:13 +11001192# Check for older PAM
1193if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001194 # Check PAM strerror arguments (old PAM)
1195 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1196 AC_TRY_COMPILE(
1197 [
Damien Miller81171112000-04-23 11:14:01 +10001198#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001199#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001200#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001201#elif defined (HAVE_PAM_PAM_APPL_H)
1202#include <pam/pam_appl.h>
1203#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001204 ],
1205 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001206 [AC_MSG_RESULT(no)],
1207 [
1208 AC_DEFINE(HAVE_OLD_PAM)
1209 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001210 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001211 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001212 )
Damien Millera22ba012000-03-02 23:09:20 +11001213fi
1214
Tim Riceaef73712002-05-11 13:17:42 -07001215# Search for OpenSSL
1216saved_CPPFLAGS="$CPPFLAGS"
1217saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001218AC_ARG_WITH(ssl-dir,
1219 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1220 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001221 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -07001222 if test -d "$withval/lib"; then
1223 if test -n "${need_dash_r}"; then
1224 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1225 else
1226 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1227 fi
1228 else
1229 if test -n "${need_dash_r}"; then
1230 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1231 else
1232 LDFLAGS="-L${withval} ${LDFLAGS}"
1233 fi
1234 fi
1235 if test -d "$withval/include"; then
1236 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1237 else
1238 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1239 fi
Damien Millera22ba012000-03-02 23:09:20 +11001240 fi
1241 ]
1242)
Tim Rice3d5352e2004-02-12 09:27:21 -08001243LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001244AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001245 [
Tim Riceaef73712002-05-11 13:17:42 -07001246 dnl Check default openssl install dir
1247 if test -n "${need_dash_r}"; then
1248 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001249 else
Tim Riceaef73712002-05-11 13:17:42 -07001250 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001251 fi
Tim Riceaef73712002-05-11 13:17:42 -07001252 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1253 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1254 [
1255 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1256 ]
1257 )
1258 ]
1259)
1260
Tim Riced730b782002-08-13 18:52:10 -07001261# Determine OpenSSL header version
1262AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001263AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001264 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001265#include <stdio.h>
1266#include <string.h>
1267#include <openssl/opensslv.h>
1268#define DATA "conftest.sslincver"
1269int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001270 FILE *fd;
1271 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001272
Damien Millera8e06ce2003-11-21 23:48:55 +11001273 fd = fopen(DATA,"w");
1274 if(fd == NULL)
1275 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001276
1277 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1278 exit(1);
1279
1280 exit(0);
1281}
Darren Tucker623d92f2004-09-12 22:36:15 +10001282 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001283 [
1284 ssl_header_ver=`cat conftest.sslincver`
1285 AC_MSG_RESULT($ssl_header_ver)
1286 ],
1287 [
1288 AC_MSG_RESULT(not found)
1289 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001290 ],
1291 [
1292 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001293 ]
1294)
1295
1296# Determine OpenSSL library version
1297AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001298AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001299 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001300#include <stdio.h>
1301#include <string.h>
1302#include <openssl/opensslv.h>
1303#include <openssl/crypto.h>
1304#define DATA "conftest.ssllibver"
1305int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001306 FILE *fd;
1307 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001308
Damien Millera8e06ce2003-11-21 23:48:55 +11001309 fd = fopen(DATA,"w");
1310 if(fd == NULL)
1311 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001312
1313 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1314 exit(1);
1315
1316 exit(0);
1317}
Darren Tucker623d92f2004-09-12 22:36:15 +10001318 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001319 [
1320 ssl_library_ver=`cat conftest.ssllibver`
1321 AC_MSG_RESULT($ssl_library_ver)
1322 ],
1323 [
1324 AC_MSG_RESULT(not found)
1325 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001326 ],
1327 [
1328 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001329 ]
1330)
Damien Millera22ba012000-03-02 23:09:20 +11001331
Damien Millerec932372002-01-22 22:16:03 +11001332# Sanity check OpenSSL headers
1333AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001334AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001335 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001336#include <string.h>
1337#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001338int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001339 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001340 [
1341 AC_MSG_RESULT(yes)
1342 ],
1343 [
1344 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001345 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1346Check config.log for details.
1347Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001348 ],
1349 [
1350 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001351 ]
1352)
1353
Tim Rice3d5352e2004-02-12 09:27:21 -08001354# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1355# because the system crypt() is more featureful.
1356if test "x$check_for_libcrypt_before" = "x1"; then
1357 AC_CHECK_LIB(crypt, crypt)
1358fi
1359
Damien Millera8e06ce2003-11-21 23:48:55 +11001360# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001361# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001362if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001363 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001364fi
1365
Damien Miller6c21c512002-01-22 21:57:53 +11001366
1367### Configure cryptographic random number support
1368
1369# Check wheter OpenSSL seeds itself
1370AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001371AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001372 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001373#include <string.h>
1374#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001375int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001376 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001377 [
1378 OPENSSL_SEEDS_ITSELF=yes
1379 AC_MSG_RESULT(yes)
1380 ],
1381 [
1382 AC_MSG_RESULT(no)
1383 # Default to use of the rand helper if OpenSSL doesn't
1384 # seed itself
1385 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001386 ],
1387 [
1388 AC_MSG_WARN([cross compiling: assuming yes])
1389 # This is safe, since all recent OpenSSL versions will
1390 # complain at runtime if not seeded correctly.
1391 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001392 ]
1393)
1394
1395
1396# Do we want to force the use of the rand helper?
1397AC_ARG_WITH(rand-helper,
1398 [ --with-rand-helper Use subprocess to gather strong randomness ],
1399 [
1400 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001401 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001402 # the previous test showed it to be unseeded.
1403 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1404 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1405 OPENSSL_SEEDS_ITSELF=yes
1406 USE_RAND_HELPER=""
1407 fi
1408 else
1409 USE_RAND_HELPER=yes
1410 fi
1411 ],
1412)
1413
1414# Which randomness source do we use?
1415if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1416 # OpenSSL only
1417 AC_DEFINE(OPENSSL_PRNG_ONLY)
1418 RAND_MSG="OpenSSL internal ONLY"
1419 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001420elif test ! -z "$USE_RAND_HELPER" ; then
1421 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001422 RAND_MSG="ssh-rand-helper"
1423 INSTALL_SSH_RAND_HELPER="yes"
1424fi
1425AC_SUBST(INSTALL_SSH_RAND_HELPER)
1426
1427### Configuration of ssh-rand-helper
1428
1429# PRNGD TCP socket
1430AC_ARG_WITH(prngd-port,
1431 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1432 [
Damien Millere996d722002-01-23 11:20:59 +11001433 case "$withval" in
1434 no)
1435 withval=""
1436 ;;
1437 [[0-9]]*)
1438 ;;
1439 *)
1440 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1441 ;;
1442 esac
1443 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001444 PRNGD_PORT="$withval"
1445 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1446 fi
1447 ]
1448)
1449
1450# PRNGD Unix domain socket
1451AC_ARG_WITH(prngd-socket,
1452 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1453 [
Damien Millere996d722002-01-23 11:20:59 +11001454 case "$withval" in
1455 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001456 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001457 ;;
1458 no)
1459 withval=""
1460 ;;
1461 /*)
1462 ;;
1463 *)
1464 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1465 ;;
1466 esac
1467
1468 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001469 if test ! -z "$PRNGD_PORT" ; then
1470 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1471 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001472 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001473 AC_MSG_WARN(Entropy socket is not readable)
1474 fi
1475 PRNGD_SOCKET="$withval"
1476 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1477 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001478 ],
1479 [
1480 # Check for existing socket only if we don't have a random device already
1481 if test "$USE_RAND_HELPER" = yes ; then
1482 AC_MSG_CHECKING(for PRNGD/EGD socket)
1483 # Insert other locations here
1484 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1485 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1486 PRNGD_SOCKET="$sock"
1487 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1488 break;
1489 fi
1490 done
1491 if test ! -z "$PRNGD_SOCKET" ; then
1492 AC_MSG_RESULT($PRNGD_SOCKET)
1493 else
1494 AC_MSG_RESULT(not found)
1495 fi
1496 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001497 ]
1498)
1499
1500# Change default command timeout for hashing entropy source
1501entropy_timeout=200
1502AC_ARG_WITH(entropy-timeout,
1503 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1504 [
1505 if test "x$withval" != "xno" ; then
1506 entropy_timeout=$withval
1507 fi
1508 ]
1509)
Damien Miller6c21c512002-01-22 21:57:53 +11001510AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1511
Damien Millerd3f6ad22002-06-25 10:24:47 +10001512SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001513AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001514 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001515 [
1516 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001517 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001518 fi
1519 ]
1520)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001521AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1522AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001523
Tim Rice88f2ab52002-03-17 12:17:34 -08001524# We do this little dance with the search path to insure
1525# that programs that we select for use by installed programs
1526# (which may be run by the super-user) come from trusted
1527# locations before they come from the user's private area.
1528# This should help avoid accidentally configuring some
1529# random version of a program in someone's personal bin.
1530
1531OPATH=$PATH
1532PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001533test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001534test -d /sbin && PATH=$PATH:/sbin
1535test -d /usr/sbin && PATH=$PATH:/usr/sbin
1536PATH=$PATH:/etc:$OPATH
1537
Damien Millera8e06ce2003-11-21 23:48:55 +11001538# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001539OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1540OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1541OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1542OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1543OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1544OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1545OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1546OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1547OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1548OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1549OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1550OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1551OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1552OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1553OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1554OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001555# restore PATH
1556PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001557
1558# Where does ssh-rand-helper get its randomness from?
1559INSTALL_SSH_PRNG_CMDS=""
1560if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1561 if test ! -z "$PRNGD_PORT" ; then
1562 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1563 elif test ! -z "$PRNGD_SOCKET" ; then
1564 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1565 else
1566 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1567 RAND_HELPER_CMDHASH=yes
1568 INSTALL_SSH_PRNG_CMDS="yes"
1569 fi
1570fi
1571AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1572
1573
Ben Lindstromb5628642000-10-18 00:02:25 +00001574# Cheap hack to ensure NEWS-OS libraries are arranged right.
1575if test ! -z "$SONY" ; then
1576 LIBS="$LIBS -liberty";
1577fi
1578
Damien Millera22ba012000-03-02 23:09:20 +11001579# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001580AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001581AC_CHECK_SIZEOF(short int, 2)
1582AC_CHECK_SIZEOF(int, 4)
1583AC_CHECK_SIZEOF(long int, 4)
1584AC_CHECK_SIZEOF(long long int, 8)
1585
Damien Millerfa2bb692002-04-23 23:22:25 +10001586# Sanity check long long for some platforms (AIX)
1587if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1588 ac_cv_sizeof_long_long_int=0
1589fi
1590
Damien Millera22ba012000-03-02 23:09:20 +11001591# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001592AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1593 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001594 [ #include <sys/types.h> ],
1595 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001596 [ ac_cv_have_u_int="yes" ],
1597 [ ac_cv_have_u_int="no" ]
1598 )
1599])
1600if test "x$ac_cv_have_u_int" = "xyes" ; then
1601 AC_DEFINE(HAVE_U_INT)
1602 have_u_int=1
1603fi
1604
Damien Miller61e50f12000-05-08 20:49:37 +10001605AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1606 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001607 [ #include <sys/types.h> ],
1608 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001609 [ ac_cv_have_intxx_t="yes" ],
1610 [ ac_cv_have_intxx_t="no" ]
1611 )
1612])
1613if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1614 AC_DEFINE(HAVE_INTXX_T)
1615 have_intxx_t=1
1616fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001617
1618if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001619 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001620then
1621 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1622 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001623 [ #include <stdint.h> ],
1624 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001625 [
1626 AC_DEFINE(HAVE_INTXX_T)
1627 AC_MSG_RESULT(yes)
1628 ],
1629 [ AC_MSG_RESULT(no) ]
1630 )
1631fi
1632
Damien Miller578783e2000-09-23 14:12:24 +11001633AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1634 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001635 [
1636#include <sys/types.h>
1637#ifdef HAVE_STDINT_H
1638# include <stdint.h>
1639#endif
1640#include <sys/socket.h>
1641#ifdef HAVE_SYS_BITYPES_H
1642# include <sys/bitypes.h>
1643#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001644 ],
1645 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001646 [ ac_cv_have_int64_t="yes" ],
1647 [ ac_cv_have_int64_t="no" ]
1648 )
1649])
1650if test "x$ac_cv_have_int64_t" = "xyes" ; then
1651 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001652fi
1653
Damien Miller61e50f12000-05-08 20:49:37 +10001654AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1655 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001656 [ #include <sys/types.h> ],
1657 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001658 [ ac_cv_have_u_intxx_t="yes" ],
1659 [ ac_cv_have_u_intxx_t="no" ]
1660 )
1661])
1662if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1663 AC_DEFINE(HAVE_U_INTXX_T)
1664 have_u_intxx_t=1
1665fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001666
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001667if test -z "$have_u_intxx_t" ; then
1668 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1669 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001670 [ #include <sys/socket.h> ],
1671 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001672 [
1673 AC_DEFINE(HAVE_U_INTXX_T)
1674 AC_MSG_RESULT(yes)
1675 ],
1676 [ AC_MSG_RESULT(no) ]
1677 )
1678fi
1679
Damien Miller578783e2000-09-23 14:12:24 +11001680AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1681 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001682 [ #include <sys/types.h> ],
1683 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001684 [ ac_cv_have_u_int64_t="yes" ],
1685 [ ac_cv_have_u_int64_t="no" ]
1686 )
1687])
1688if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1689 AC_DEFINE(HAVE_U_INT64_T)
1690 have_u_int64_t=1
1691fi
1692
Tim Rice4cec93f2002-02-26 08:40:48 -08001693if test -z "$have_u_int64_t" ; then
1694 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1695 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001696 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001697 [ u_int64_t a; a = 1],
1698 [
1699 AC_DEFINE(HAVE_U_INT64_T)
1700 AC_MSG_RESULT(yes)
1701 ],
1702 [ AC_MSG_RESULT(no) ]
1703 )
1704fi
1705
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001706if test -z "$have_u_intxx_t" ; then
1707 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1708 AC_TRY_COMPILE(
1709 [
1710#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001711 ],
1712 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001713 [ ac_cv_have_uintxx_t="yes" ],
1714 [ ac_cv_have_uintxx_t="no" ]
1715 )
1716 ])
1717 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1718 AC_DEFINE(HAVE_UINTXX_T)
1719 fi
1720fi
1721
1722if test -z "$have_uintxx_t" ; then
1723 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1724 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001725 [ #include <stdint.h> ],
1726 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001727 [
1728 AC_DEFINE(HAVE_UINTXX_T)
1729 AC_MSG_RESULT(yes)
1730 ],
1731 [ AC_MSG_RESULT(no) ]
1732 )
1733fi
1734
Damien Milleredb82922000-06-20 13:25:52 +10001735if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001736 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001737then
1738 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1739 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001740 [
1741#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001742 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001743 [
Damien Miller70494d12000-04-03 15:57:06 +10001744 int8_t a; int16_t b; int32_t c;
1745 u_int8_t e; u_int16_t f; u_int32_t g;
1746 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001747 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001748 [
1749 AC_DEFINE(HAVE_U_INTXX_T)
1750 AC_DEFINE(HAVE_INTXX_T)
1751 AC_MSG_RESULT(yes)
1752 ],
1753 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001754 )
Damien Millerb29ea912000-01-15 14:12:03 +11001755fi
1756
Damien Miller58be7382001-09-15 21:31:54 +10001757
1758AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1759 AC_TRY_COMPILE(
1760 [
1761#include <sys/types.h>
1762 ],
1763 [ u_char foo; foo = 125; ],
1764 [ ac_cv_have_u_char="yes" ],
1765 [ ac_cv_have_u_char="no" ]
1766 )
1767])
1768if test "x$ac_cv_have_u_char" = "xyes" ; then
1769 AC_DEFINE(HAVE_U_CHAR)
1770fi
1771
Tim Rice13aae5e2001-10-21 17:53:58 -07001772TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001773
Tim Rice200a5c02002-02-26 22:12:34 -08001774AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001775
Damien Miller61e50f12000-05-08 20:49:37 +10001776AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1777 AC_TRY_COMPILE(
1778 [
1779#include <sys/types.h>
1780 ],
1781 [ size_t foo; foo = 1235; ],
1782 [ ac_cv_have_size_t="yes" ],
1783 [ ac_cv_have_size_t="no" ]
1784 )
1785])
1786if test "x$ac_cv_have_size_t" = "xyes" ; then
1787 AC_DEFINE(HAVE_SIZE_T)
1788fi
Damien Miller95058511999-12-29 10:36:45 +11001789
Damien Miller615f9392000-05-17 22:53:33 +10001790AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1791 AC_TRY_COMPILE(
1792 [
1793#include <sys/types.h>
1794 ],
1795 [ ssize_t foo; foo = 1235; ],
1796 [ ac_cv_have_ssize_t="yes" ],
1797 [ ac_cv_have_ssize_t="no" ]
1798 )
1799])
1800if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1801 AC_DEFINE(HAVE_SSIZE_T)
1802fi
1803
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001804AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1805 AC_TRY_COMPILE(
1806 [
1807#include <time.h>
1808 ],
1809 [ clock_t foo; foo = 1235; ],
1810 [ ac_cv_have_clock_t="yes" ],
1811 [ ac_cv_have_clock_t="no" ]
1812 )
1813])
1814if test "x$ac_cv_have_clock_t" = "xyes" ; then
1815 AC_DEFINE(HAVE_CLOCK_T)
1816fi
1817
Damien Millerb54b40e2000-06-23 08:23:34 +10001818AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1819 AC_TRY_COMPILE(
1820 [
1821#include <sys/types.h>
1822#include <sys/socket.h>
1823 ],
1824 [ sa_family_t foo; foo = 1235; ],
1825 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001826 [ AC_TRY_COMPILE(
1827 [
1828#include <sys/types.h>
1829#include <sys/socket.h>
1830#include <netinet/in.h>
1831 ],
1832 [ sa_family_t foo; foo = 1235; ],
1833 [ ac_cv_have_sa_family_t="yes" ],
1834
Damien Millerb54b40e2000-06-23 08:23:34 +10001835 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001836 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001837 )
1838])
1839if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1840 AC_DEFINE(HAVE_SA_FAMILY_T)
1841fi
1842
Damien Miller0f91b4e2000-06-18 15:43:25 +10001843AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1844 AC_TRY_COMPILE(
1845 [
1846#include <sys/types.h>
1847 ],
1848 [ pid_t foo; foo = 1235; ],
1849 [ ac_cv_have_pid_t="yes" ],
1850 [ ac_cv_have_pid_t="no" ]
1851 )
1852])
1853if test "x$ac_cv_have_pid_t" = "xyes" ; then
1854 AC_DEFINE(HAVE_PID_T)
1855fi
1856
1857AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1858 AC_TRY_COMPILE(
1859 [
1860#include <sys/types.h>
1861 ],
1862 [ mode_t foo; foo = 1235; ],
1863 [ ac_cv_have_mode_t="yes" ],
1864 [ ac_cv_have_mode_t="no" ]
1865 )
1866])
1867if test "x$ac_cv_have_mode_t" = "xyes" ; then
1868 AC_DEFINE(HAVE_MODE_T)
1869fi
1870
Damien Miller61e50f12000-05-08 20:49:37 +10001871
1872AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1873 AC_TRY_COMPILE(
1874 [
Damien Miller81171112000-04-23 11:14:01 +10001875#include <sys/types.h>
1876#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001877 ],
1878 [ struct sockaddr_storage s; ],
1879 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1880 [ ac_cv_have_struct_sockaddr_storage="no" ]
1881 )
1882])
1883if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1884 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1885fi
Damien Miller34132e52000-01-14 15:45:46 +11001886
Damien Miller61e50f12000-05-08 20:49:37 +10001887AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1888 AC_TRY_COMPILE(
1889 [
Damien Miller7b22d652000-06-18 14:07:04 +10001890#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001891#include <netinet/in.h>
1892 ],
1893 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1894 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1895 [ ac_cv_have_struct_sockaddr_in6="no" ]
1896 )
1897])
1898if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1899 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1900fi
Damien Miller34132e52000-01-14 15:45:46 +11001901
Damien Miller61e50f12000-05-08 20:49:37 +10001902AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1903 AC_TRY_COMPILE(
1904 [
Damien Miller7b22d652000-06-18 14:07:04 +10001905#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001906#include <netinet/in.h>
1907 ],
1908 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1909 [ ac_cv_have_struct_in6_addr="yes" ],
1910 [ ac_cv_have_struct_in6_addr="no" ]
1911 )
1912])
1913if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1914 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1915fi
Damien Miller34132e52000-01-14 15:45:46 +11001916
Damien Miller61e50f12000-05-08 20:49:37 +10001917AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1918 AC_TRY_COMPILE(
1919 [
Damien Miller81171112000-04-23 11:14:01 +10001920#include <sys/types.h>
1921#include <sys/socket.h>
1922#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001923 ],
1924 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1925 [ ac_cv_have_struct_addrinfo="yes" ],
1926 [ ac_cv_have_struct_addrinfo="no" ]
1927 )
1928])
1929if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1930 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1931fi
1932
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001933AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1934 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001935 [ #include <sys/time.h> ],
1936 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001937 [ ac_cv_have_struct_timeval="yes" ],
1938 [ ac_cv_have_struct_timeval="no" ]
1939 )
1940])
1941if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1942 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1943 have_struct_timeval=1
1944fi
1945
Tim Rice4e4dc562003-03-18 10:21:40 -08001946AC_CHECK_TYPES(struct timespec)
1947
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001948# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001949if test "x$ac_cv_have_int64_t" = "xno" -a \
1950 "x$ac_cv_sizeof_long_int" != "x8" -a \
1951 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001952 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1953 echo "an alternative compiler (I.E., GCC) before continuing."
1954 echo ""
1955 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001956else
1957dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001958 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001959 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08001960#include <stdio.h>
1961#include <string.h>
1962#ifdef HAVE_SNPRINTF
1963main()
1964{
1965 char buf[50];
1966 char expected_out[50];
1967 int mazsize = 50 ;
1968#if (SIZEOF_LONG_INT == 8)
1969 long int num = 0x7fffffffffffffff;
1970#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001971 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001972#endif
1973 strcpy(expected_out, "9223372036854775807");
1974 snprintf(buf, mazsize, "%lld", num);
1975 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001976 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001977 exit(0);
1978}
1979#else
1980main() { exit(0); }
1981#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10001982 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001983 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08001984 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001985fi
1986
Damien Miller78315eb2000-09-29 23:01:36 +11001987dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001988OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1989OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1990OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1991OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1992OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001993OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001994OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1995OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001996OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001997OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1998OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1999OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2000OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002001OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2002OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2003OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2004OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002005
2006AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00002007
Damien Miller61e50f12000-05-08 20:49:37 +10002008AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2009 ac_cv_have_ss_family_in_struct_ss, [
2010 AC_TRY_COMPILE(
2011 [
Damien Miller81171112000-04-23 11:14:01 +10002012#include <sys/types.h>
2013#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002014 ],
2015 [ struct sockaddr_storage s; s.ss_family = 1; ],
2016 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2017 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2018 )
2019])
2020if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2021 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2022fi
2023
Damien Miller61e50f12000-05-08 20:49:37 +10002024AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2025 ac_cv_have___ss_family_in_struct_ss, [
2026 AC_TRY_COMPILE(
2027 [
Damien Miller81171112000-04-23 11:14:01 +10002028#include <sys/types.h>
2029#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002030 ],
2031 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2032 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2033 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2034 )
2035])
2036if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2037 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2038fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002039
Damien Millerad833b32000-08-23 10:46:23 +10002040AC_CACHE_CHECK([for pw_class field in struct passwd],
2041 ac_cv_have_pw_class_in_struct_passwd, [
2042 AC_TRY_COMPILE(
2043 [
Damien Millerad833b32000-08-23 10:46:23 +10002044#include <pwd.h>
2045 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002046 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002047 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2048 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2049 )
2050])
2051if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2052 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2053fi
2054
Kevin Steves82456952001-06-22 21:14:18 +00002055AC_CACHE_CHECK([for pw_expire field in struct passwd],
2056 ac_cv_have_pw_expire_in_struct_passwd, [
2057 AC_TRY_COMPILE(
2058 [
2059#include <pwd.h>
2060 ],
2061 [ struct passwd p; p.pw_expire = 0; ],
2062 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2063 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2064 )
2065])
2066if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2067 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2068fi
2069
2070AC_CACHE_CHECK([for pw_change field in struct passwd],
2071 ac_cv_have_pw_change_in_struct_passwd, [
2072 AC_TRY_COMPILE(
2073 [
2074#include <pwd.h>
2075 ],
2076 [ struct passwd p; p.pw_change = 0; ],
2077 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2078 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2079 )
2080])
2081if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2082 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2083fi
Damien Miller61e50f12000-05-08 20:49:37 +10002084
Tim Rice28bbb0c2002-05-27 17:37:32 -07002085dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002086AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2087 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002088 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002089 [
Tim Riceae49fe62002-04-12 10:26:21 -07002090#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002091#include <sys/socket.h>
2092#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002093int main() {
2094#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002095#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002096exit(1);
2097#endif
2098struct msghdr m;
2099m.msg_accrights = 0;
2100exit(0);
2101}
Kevin Steves939c9db2002-03-22 17:23:25 +00002102 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002103 [ ac_cv_have_accrights_in_msghdr="yes" ],
2104 [ ac_cv_have_accrights_in_msghdr="no" ]
2105 )
2106])
2107if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2108 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2109fi
2110
Kevin Stevesa44e0352002-04-07 16:18:03 +00002111AC_CACHE_CHECK([for msg_control field in struct msghdr],
2112 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002113 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002114 [
Tim Riceae49fe62002-04-12 10:26:21 -07002115#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002116#include <sys/socket.h>
2117#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002118int main() {
2119#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002120#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002121exit(1);
2122#endif
2123struct msghdr m;
2124m.msg_control = 0;
2125exit(0);
2126}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002127 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002128 [ ac_cv_have_control_in_msghdr="yes" ],
2129 [ ac_cv_have_control_in_msghdr="no" ]
2130 )
2131])
2132if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2133 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2134fi
2135
Damien Miller61e50f12000-05-08 20:49:37 +10002136AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002137 AC_TRY_LINK([],
2138 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002139 [ ac_cv_libc_defines___progname="yes" ],
2140 [ ac_cv_libc_defines___progname="no" ]
2141 )
2142])
2143if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2144 AC_DEFINE(HAVE___PROGNAME)
2145fi
2146
Kevin Steves4846f4a2002-03-22 18:19:53 +00002147AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2148 AC_TRY_LINK([
2149#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002150],
2151 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002152 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2153 [ ac_cv_cc_implements___FUNCTION__="no" ]
2154 )
2155])
2156if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2157 AC_DEFINE(HAVE___FUNCTION__)
2158fi
2159
2160AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2161 AC_TRY_LINK([
2162#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002163],
2164 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002165 [ ac_cv_cc_implements___func__="yes" ],
2166 [ ac_cv_cc_implements___func__="no" ]
2167 )
2168])
2169if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2170 AC_DEFINE(HAVE___func__)
2171fi
2172
Damien Miller4f8e6692001-07-14 13:22:53 +10002173AC_CACHE_CHECK([whether getopt has optreset support],
2174 ac_cv_have_getopt_optreset, [
2175 AC_TRY_LINK(
2176 [
2177#include <getopt.h>
2178 ],
2179 [ extern int optreset; optreset = 0; ],
2180 [ ac_cv_have_getopt_optreset="yes" ],
2181 [ ac_cv_have_getopt_optreset="no" ]
2182 )
2183])
2184if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2185 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2186fi
Damien Millera22ba012000-03-02 23:09:20 +11002187
Damien Millerecbb26d2000-07-15 14:59:14 +10002188AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002189 AC_TRY_LINK([],
2190 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002191 [ ac_cv_libc_defines_sys_errlist="yes" ],
2192 [ ac_cv_libc_defines_sys_errlist="no" ]
2193 )
2194])
2195if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2196 AC_DEFINE(HAVE_SYS_ERRLIST)
2197fi
2198
2199
Damien Miller11fa2cc2000-08-16 10:35:58 +10002200AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002201 AC_TRY_LINK([],
2202 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002203 [ ac_cv_libc_defines_sys_nerr="yes" ],
2204 [ ac_cv_libc_defines_sys_nerr="no" ]
2205 )
2206])
2207if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2208 AC_DEFINE(HAVE_SYS_NERR)
2209fi
2210
Damien Millera8e06ce2003-11-21 23:48:55 +11002211SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002212# Check whether user wants sectok support
2213AC_ARG_WITH(sectok,
2214 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002215 [
2216 if test "x$withval" != "xno" ; then
2217 if test "x$withval" != "xyes" ; then
2218 CPPFLAGS="$CPPFLAGS -I${withval}"
2219 LDFLAGS="$LDFLAGS -L${withval}"
2220 if test ! -z "$need_dash_r" ; then
2221 LDFLAGS="$LDFLAGS -R${withval}"
2222 fi
2223 if test ! -z "$blibpath" ; then
2224 blibpath="$blibpath:${withval}"
2225 fi
2226 fi
2227 AC_CHECK_HEADERS(sectok.h)
2228 if test "$ac_cv_header_sectok_h" != yes; then
2229 AC_MSG_ERROR(Can't find sectok.h)
2230 fi
2231 AC_CHECK_LIB(sectok, sectok_open)
2232 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2233 AC_MSG_ERROR(Can't find libsectok)
2234 fi
2235 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002236 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002237 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002238 fi
2239 ]
2240)
2241
2242# Check whether user wants OpenSC support
2243AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10002244 AC_HELP_STRING([--with-opensc=PFX],
2245 [Enable smartcard support using OpenSC]),
2246 opensc_config_prefix="$withval", opensc_config_prefix="")
2247if test x$opensc_config_prefix != x ; then
2248 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2249 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2250 if test "$OPENSC_CONFIG" != "no"; then
2251 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2252 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2253 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2254 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2255 AC_DEFINE(SMARTCARD)
2256 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11002257 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10002258 fi
2259fi
Damien Miller85de5802001-09-18 14:01:11 +10002260
Darren Tucker5f88d342003-10-15 16:57:57 +10002261# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002262AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002263 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002264 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002265 # Needed by our getrrsetbyname()
2266 AC_SEARCH_LIBS(res_query, resolv)
2267 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002268 AC_MSG_CHECKING(if res_query will link)
2269 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2270 [AC_MSG_RESULT(no)
2271 saved_LIBS="$LIBS"
2272 LIBS="$LIBS -lresolv"
2273 AC_MSG_CHECKING(for res_query in -lresolv)
2274 AC_LINK_IFELSE([
2275#include <resolv.h>
2276int main()
2277{
2278 res_query (0, 0, 0, 0, 0);
2279 return 0;
2280}
2281 ],
2282 [LIBS="$LIBS -lresolv"
2283 AC_MSG_RESULT(yes)],
2284 [LIBS="$saved_LIBS"
2285 AC_MSG_RESULT(no)])
2286 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002287 AC_CHECK_FUNCS(_getshort _getlong)
2288 AC_CHECK_MEMBER(HEADER.ad,
2289 [AC_DEFINE(HAVE_HEADER_AD)],,
2290 [#include <arpa/nameser.h>])
2291 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002292
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002293# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002294KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002295AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002296 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002297 [ if test "x$withval" != "xno" ; then
2298 if test "x$withval" = "xyes" ; then
2299 KRB5ROOT="/usr/local"
2300 else
2301 KRB5ROOT=${withval}
2302 fi
2303
2304 AC_DEFINE(KRB5)
2305 KRB5_MSG="yes"
2306
2307 AC_MSG_CHECKING(for krb5-config)
2308 if test -x $KRB5ROOT/bin/krb5-config ; then
2309 KRB5CONF=$KRB5ROOT/bin/krb5-config
2310 AC_MSG_RESULT($KRB5CONF)
2311
2312 AC_MSG_CHECKING(for gssapi support)
2313 if $KRB5CONF | grep gssapi >/dev/null ; then
2314 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002315 AC_DEFINE(GSSAPI)
2316 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002317 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002318 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002319 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002320 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002321 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2322 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002323 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002324 AC_MSG_CHECKING(whether we are using Heimdal)
2325 AC_TRY_COMPILE([ #include <krb5.h> ],
2326 [ char *tmp = heimdal_version; ],
2327 [ AC_MSG_RESULT(yes)
2328 AC_DEFINE(HEIMDAL) ],
2329 AC_MSG_RESULT(no)
2330 )
2331 else
2332 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002333 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002334 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002335 AC_MSG_CHECKING(whether we are using Heimdal)
2336 AC_TRY_COMPILE([ #include <krb5.h> ],
2337 [ char *tmp = heimdal_version; ],
2338 [ AC_MSG_RESULT(yes)
2339 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002340 K5LIBS="-lkrb5 -ldes"
2341 K5LIBS="$K5LIBS -lcom_err -lasn1"
2342 AC_CHECK_LIB(roken, net_write,
2343 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002344 ],
2345 [ AC_MSG_RESULT(no)
2346 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2347 ]
2348 )
Damien Miller200d0a72003-06-30 19:21:36 +10002349 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002350
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002351 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2352 [ AC_DEFINE(GSSAPI)
2353 K5LIBS="-lgssapi $K5LIBS" ],
2354 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2355 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002356 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002357 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2358 $K5LIBS)
2359 ],
2360 $K5LIBS)
2361
2362 AC_CHECK_HEADER(gssapi.h, ,
2363 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002364 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002365 AC_CHECK_HEADERS(gssapi.h, ,
2366 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002367 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002368 ]
2369 )
2370
2371 oldCPP="$CPPFLAGS"
2372 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2373 AC_CHECK_HEADER(gssapi_krb5.h, ,
2374 [ CPPFLAGS="$oldCPP" ])
2375
Damien Millera8e06ce2003-11-21 23:48:55 +11002376 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002377 if test ! -z "$need_dash_r" ; then
2378 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2379 fi
2380 if test ! -z "$blibpath" ; then
2381 blibpath="$blibpath:${KRB5ROOT}/lib"
2382 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002383 fi
2384
2385 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2386 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2387 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2388
2389 LIBS="$LIBS $K5LIBS"
2390 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002391 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002392 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002393)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002394
Damien Millera22ba012000-03-02 23:09:20 +11002395# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002396
Damien Millerf58c6722002-05-13 13:15:42 +10002397PRIVSEP_PATH=/var/empty
2398AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002399 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002400 [
2401 if test "x$withval" != "$no" ; then
2402 PRIVSEP_PATH=$withval
2403 fi
2404 ]
2405)
2406AC_SUBST(PRIVSEP_PATH)
2407
Damien Millera22ba012000-03-02 23:09:20 +11002408AC_ARG_WITH(xauth,
2409 [ --with-xauth=PATH Specify path to xauth program ],
2410 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002411 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002412 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002413 fi
2414 ],
2415 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002416 TestPath="$PATH"
2417 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2418 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2419 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2420 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2421 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002422 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002423 xauth_path="/usr/openwin/bin/xauth"
2424 fi
2425 ]
2426)
2427
Damien Miller7d901272003-01-13 16:55:22 +11002428STRIP_OPT=-s
2429AC_ARG_ENABLE(strip,
2430 [ --disable-strip Disable calling strip(1) on install],
2431 [
2432 if test "x$enableval" = "xno" ; then
2433 STRIP_OPT=
2434 fi
2435 ]
2436)
2437AC_SUBST(STRIP_OPT)
2438
Damien Millera19cf472000-11-29 13:28:50 +11002439if test -z "$xauth_path" ; then
2440 XAUTH_PATH="undefined"
2441 AC_SUBST(XAUTH_PATH)
2442else
Damien Millera22ba012000-03-02 23:09:20 +11002443 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002444 XAUTH_PATH=$xauth_path
2445 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002446fi
Damien Millera22ba012000-03-02 23:09:20 +11002447
2448# Check for mail directory (last resort if we cannot get it from headers)
2449if test ! -z "$MAIL" ; then
2450 maildir=`dirname $MAIL`
2451 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2452fi
2453
Darren Tucker623d92f2004-09-12 22:36:15 +10002454if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002455 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2456 disable_ptmx_check=yes
2457fi
Damien Millera22ba012000-03-02 23:09:20 +11002458if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002459 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002460 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002461 [
2462 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2463 have_dev_ptmx=1
2464 ]
2465 )
2466 fi
Damien Millera22ba012000-03-02 23:09:20 +11002467fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002468
Darren Tucker623d92f2004-09-12 22:36:15 +10002469if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002470 AC_CHECK_FILE("/dev/ptc",
2471 [
2472 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2473 have_dev_ptc=1
2474 ]
2475 )
2476else
2477 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2478fi
Damien Miller204ad072000-03-02 23:56:12 +11002479
Damien Millera22ba012000-03-02 23:09:20 +11002480# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002481AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002482 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002483 [
Damien Miller897741e2001-04-16 10:41:46 +10002484 case "$withval" in
2485 man|cat|doc)
2486 MANTYPE=$withval
2487 ;;
2488 *)
2489 AC_MSG_ERROR(invalid man type: $withval)
2490 ;;
2491 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002492 ]
2493)
Ben Lindstrombc709922001-04-18 18:04:21 +00002494if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002495 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2496 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002497 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2498 MANTYPE=doc
2499 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2500 MANTYPE=man
2501 else
2502 MANTYPE=cat
2503 fi
2504fi
Damien Miller670a4b82000-01-22 13:53:11 +11002505AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002506if test "$MANTYPE" = "doc"; then
2507 mansubdir=man;
2508else
2509 mansubdir=$MANTYPE;
2510fi
2511AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002512
Damien Millera22ba012000-03-02 23:09:20 +11002513# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002514MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002515AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002516 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002517 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002518 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002519 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002520 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002521 fi
2522 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002523)
2524
Damien Millera22ba012000-03-02 23:09:20 +11002525# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002526AC_ARG_WITH(shadow,
2527 [ --without-shadow Disable shadow password support],
2528 [
2529 if test "x$withval" = "xno" ; then
2530 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002531 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002532 fi
2533 ]
2534)
2535
Damien Miller1f335fb2000-06-26 11:31:33 +10002536if test -z "$disable_shadow" ; then
2537 AC_MSG_CHECKING([if the systems has expire shadow information])
2538 AC_TRY_COMPILE(
2539 [
2540#include <sys/types.h>
2541#include <shadow.h>
2542 struct spwd sp;
2543 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2544 [ sp_expire_available=yes ], []
2545 )
2546
2547 if test "x$sp_expire_available" = "xyes" ; then
2548 AC_MSG_RESULT(yes)
2549 AC_DEFINE(HAS_SHADOW_EXPIRE)
2550 else
2551 AC_MSG_RESULT(no)
2552 fi
2553fi
2554
Damien Millera22ba012000-03-02 23:09:20 +11002555# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002556if test ! -z "$IPADDR_IN_DISPLAY" ; then
2557 DISPLAY_HACK_MSG="yes"
2558 AC_DEFINE(IPADDR_IN_DISPLAY)
2559else
Damien Millera8e06ce2003-11-21 23:48:55 +11002560 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002561 AC_ARG_WITH(ipaddr-display,
2562 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2563 [
2564 if test "x$withval" != "xno" ; then
2565 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002566 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002567 fi
2568 ]
2569 )
2570fi
Damien Miller76112de1999-12-21 11:18:08 +11002571
Darren Tuckere1a790d2003-09-16 11:52:19 +10002572# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002573AC_ARG_ENABLE(etc-default-login,
2574 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
Darren Tuckera0c2b392004-09-11 23:26:37 +10002575 [ AC_CHECK_FILE("/etc/default/login",
2576 [ external_path_file=/etc/default/login ])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002577
Darren Tucker623d92f2004-09-12 22:36:15 +10002578 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2579 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002580 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2581 elif test "x$external_path_file" = "x/etc/default/login"; then
2582 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2583 fi
2584 ]
2585)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002586
Tim Rice43a1c132002-04-17 21:19:14 -07002587dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2588if test $ac_cv_func_login_getcapbool = "yes" -a \
2589 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002590 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002591fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002592
Damien Millera22ba012000-03-02 23:09:20 +11002593# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002594SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002595AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002596 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002597 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002598 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002599 AC_MSG_WARN([
2600--with-default-path=PATH has no effect on this system.
2601Edit /etc/login.conf instead.])
2602 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002603 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002604 AC_MSG_WARN([
2605--with-default-path=PATH will only be used if PATH is not defined in
2606$external_path_file .])
2607 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002608 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002609 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002610 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002611 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002612 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2613 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002614 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002615 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002616 AC_MSG_WARN([
2617If PATH is defined in $external_path_file, ensure the path to scp is included,
2618otherwise scp will not work.])
2619 fi
2620 AC_TRY_RUN(
2621 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002622/* find out what STDPATH is */
2623#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002624#ifdef HAVE_PATHS_H
2625# include <paths.h>
2626#endif
2627#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002628# ifdef _PATH_USERPATH /* Irix */
2629# define _PATH_STDPATH _PATH_USERPATH
2630# else
2631# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2632# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002633#endif
2634#include <sys/types.h>
2635#include <sys/stat.h>
2636#include <fcntl.h>
2637#define DATA "conftest.stdpath"
2638
2639main()
2640{
2641 FILE *fd;
2642 int rc;
2643
2644 fd = fopen(DATA,"w");
2645 if(fd == NULL)
2646 exit(1);
2647
2648 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2649 exit(1);
2650
2651 exit(0);
2652}
2653 ], [ user_path=`cat conftest.stdpath` ],
2654 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2655 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2656 )
2657# make sure $bindir is in USER_PATH so scp will work
2658 t_bindir=`eval echo ${bindir}`
2659 case $t_bindir in
2660 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2661 esac
2662 case $t_bindir in
2663 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2664 esac
2665 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2666 if test $? -ne 0 ; then
2667 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2668 if test $? -ne 0 ; then
2669 user_path=$user_path:$t_bindir
2670 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2671 fi
2672 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002673 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002674)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002675if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002676 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2677 AC_SUBST(user_path)
2678fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002679
Damien Millera18bbd32002-05-13 10:48:57 +10002680# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002681AC_ARG_WITH(superuser-path,
2682 [ --with-superuser-path= Specify different path for super-user],
2683 [
2684 if test "x$withval" != "xno" ; then
2685 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2686 superuser_path=$withval
2687 fi
2688 ]
2689)
2690
2691
Damien Miller61e50f12000-05-08 20:49:37 +10002692AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002693IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002694AC_ARG_WITH(4in6,
2695 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2696 [
2697 if test "x$withval" != "xno" ; then
2698 AC_MSG_RESULT(yes)
2699 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002700 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002701 else
2702 AC_MSG_RESULT(no)
2703 fi
2704 ],[
2705 if test "x$inet6_default_4in6" = "xyes"; then
2706 AC_MSG_RESULT([yes (default)])
2707 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002708 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002709 else
2710 AC_MSG_RESULT([no (default)])
2711 fi
2712 ]
2713)
2714
Damien Miller60396b02001-02-18 17:01:00 +11002715# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002716BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002717AC_ARG_WITH(bsd-auth,
2718 [ --with-bsd-auth Enable BSD auth support],
2719 [
2720 if test "x$withval" != "xno" ; then
2721 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002722 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002723 fi
2724 ]
2725)
2726
Damien Millera22ba012000-03-02 23:09:20 +11002727# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002728piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002729# make sure the directory exists
2730if test ! -d $piddir ; then
2731 piddir=`eval echo ${sysconfdir}`
2732 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002733 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002734 esac
2735fi
2736
Tim Rice88f2ab52002-03-17 12:17:34 -08002737AC_ARG_WITH(pid-dir,
2738 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2739 [
2740 if test "x$withval" != "xno" ; then
2741 piddir=$withval
2742 if test ! -d $piddir ; then
2743 AC_MSG_WARN([** no $piddir directory on this system **])
2744 fi
2745 fi
2746 ]
2747)
2748
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002749AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002750AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002751
andre2ff7b5d2000-06-03 14:57:40 +00002752dnl allow user to disable some login recording features
2753AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002754 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002755 [
2756 if test "x$enableval" = "xno" ; then
2757 AC_DEFINE(DISABLE_LASTLOG)
2758 fi
2759 ]
andre2ff7b5d2000-06-03 14:57:40 +00002760)
2761AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002762 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002763 [
2764 if test "x$enableval" = "xno" ; then
2765 AC_DEFINE(DISABLE_UTMP)
2766 fi
2767 ]
andre2ff7b5d2000-06-03 14:57:40 +00002768)
2769AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002770 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002771 [
2772 if test "x$enableval" = "xno" ; then
2773 AC_DEFINE(DISABLE_UTMPX)
2774 fi
2775 ]
andre2ff7b5d2000-06-03 14:57:40 +00002776)
2777AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002778 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002779 [
2780 if test "x$enableval" = "xno" ; then
2781 AC_DEFINE(DISABLE_WTMP)
2782 fi
2783 ]
andre2ff7b5d2000-06-03 14:57:40 +00002784)
2785AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002786 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002787 [
2788 if test "x$enableval" = "xno" ; then
2789 AC_DEFINE(DISABLE_WTMPX)
2790 fi
2791 ]
andre2ff7b5d2000-06-03 14:57:40 +00002792)
2793AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002794 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002795 [
2796 if test "x$enableval" = "xno" ; then
2797 AC_DEFINE(DISABLE_LOGIN)
2798 fi
2799 ]
andre2ff7b5d2000-06-03 14:57:40 +00002800)
2801AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002802 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002803 [
2804 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002805 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002806 fi
2807 ]
andre2ff7b5d2000-06-03 14:57:40 +00002808)
2809AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002810 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002811 [
2812 if test "x$enableval" = "xno" ; then
2813 AC_DEFINE(DISABLE_PUTUTXLINE)
2814 fi
2815 ]
andre2ff7b5d2000-06-03 14:57:40 +00002816)
2817AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002818 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002819 [
2820 if test "x$withval" = "xno" ; then
2821 AC_DEFINE(DISABLE_LASTLOG)
2822 else
2823 conf_lastlog_location=$withval
2824 fi
2825 ]
2826)
andre2ff7b5d2000-06-03 14:57:40 +00002827
2828dnl lastlog, [uw]tmpx? detection
2829dnl NOTE: set the paths in the platform section to avoid the
2830dnl need for command-line parameters
2831dnl lastlog and [uw]tmp are subject to a file search if all else fails
2832
2833dnl lastlog detection
2834dnl NOTE: the code itself will detect if lastlog is a directory
2835AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2836AC_TRY_COMPILE([
2837#include <sys/types.h>
2838#include <utmp.h>
2839#ifdef HAVE_LASTLOG_H
2840# include <lastlog.h>
2841#endif
Damien Miller2994e082000-06-04 15:51:47 +10002842#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002843# include <paths.h>
2844#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002845#ifdef HAVE_LOGIN_H
2846# include <login.h>
2847#endif
andre2ff7b5d2000-06-03 14:57:40 +00002848 ],
2849 [ char *lastlog = LASTLOG_FILE; ],
2850 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002851 [
2852 AC_MSG_RESULT(no)
2853 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2854 AC_TRY_COMPILE([
2855#include <sys/types.h>
2856#include <utmp.h>
2857#ifdef HAVE_LASTLOG_H
2858# include <lastlog.h>
2859#endif
2860#ifdef HAVE_PATHS_H
2861# include <paths.h>
2862#endif
2863 ],
2864 [ char *lastlog = _PATH_LASTLOG; ],
2865 [ AC_MSG_RESULT(yes) ],
2866 [
andree441aa32000-06-12 22:34:38 +00002867 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002868 system_lastlog_path=no
2869 ])
2870 ]
andre2ff7b5d2000-06-03 14:57:40 +00002871)
Damien Miller2994e082000-06-04 15:51:47 +10002872
andre2ff7b5d2000-06-03 14:57:40 +00002873if test -z "$conf_lastlog_location"; then
2874 if test x"$system_lastlog_path" = x"no" ; then
2875 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002876 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002877 conf_lastlog_location=$f
2878 fi
2879 done
2880 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002881 AC_MSG_WARN([** Cannot find lastlog **])
2882 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002883 fi
2884 fi
2885fi
2886
2887if test -n "$conf_lastlog_location"; then
2888 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2889fi
2890
2891dnl utmp detection
2892AC_MSG_CHECKING([if your system defines UTMP_FILE])
2893AC_TRY_COMPILE([
2894#include <sys/types.h>
2895#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002896#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002897# include <paths.h>
2898#endif
2899 ],
2900 [ char *utmp = UTMP_FILE; ],
2901 [ AC_MSG_RESULT(yes) ],
2902 [ AC_MSG_RESULT(no)
2903 system_utmp_path=no ]
2904)
2905if test -z "$conf_utmp_location"; then
2906 if test x"$system_utmp_path" = x"no" ; then
2907 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2908 if test -f $f ; then
2909 conf_utmp_location=$f
2910 fi
2911 done
2912 if test -z "$conf_utmp_location"; then
2913 AC_DEFINE(DISABLE_UTMP)
2914 fi
2915 fi
2916fi
2917if test -n "$conf_utmp_location"; then
2918 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2919fi
2920
2921dnl wtmp detection
2922AC_MSG_CHECKING([if your system defines WTMP_FILE])
2923AC_TRY_COMPILE([
2924#include <sys/types.h>
2925#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002926#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002927# include <paths.h>
2928#endif
2929 ],
2930 [ char *wtmp = WTMP_FILE; ],
2931 [ AC_MSG_RESULT(yes) ],
2932 [ AC_MSG_RESULT(no)
2933 system_wtmp_path=no ]
2934)
2935if test -z "$conf_wtmp_location"; then
2936 if test x"$system_wtmp_path" = x"no" ; then
2937 for f in /usr/adm/wtmp /var/log/wtmp; do
2938 if test -f $f ; then
2939 conf_wtmp_location=$f
2940 fi
2941 done
2942 if test -z "$conf_wtmp_location"; then
2943 AC_DEFINE(DISABLE_WTMP)
2944 fi
2945 fi
2946fi
2947if test -n "$conf_wtmp_location"; then
2948 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2949fi
2950
2951
2952dnl utmpx detection - I don't know any system so perverse as to require
2953dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2954dnl there, though.
2955AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2956AC_TRY_COMPILE([
2957#include <sys/types.h>
2958#include <utmp.h>
2959#ifdef HAVE_UTMPX_H
2960#include <utmpx.h>
2961#endif
Damien Miller2994e082000-06-04 15:51:47 +10002962#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002963# include <paths.h>
2964#endif
2965 ],
2966 [ char *utmpx = UTMPX_FILE; ],
2967 [ AC_MSG_RESULT(yes) ],
2968 [ AC_MSG_RESULT(no)
2969 system_utmpx_path=no ]
2970)
2971if test -z "$conf_utmpx_location"; then
2972 if test x"$system_utmpx_path" = x"no" ; then
2973 AC_DEFINE(DISABLE_UTMPX)
2974 fi
2975else
2976 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2977fi
2978
2979dnl wtmpx detection
2980AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2981AC_TRY_COMPILE([
2982#include <sys/types.h>
2983#include <utmp.h>
2984#ifdef HAVE_UTMPX_H
2985#include <utmpx.h>
2986#endif
Damien Miller2994e082000-06-04 15:51:47 +10002987#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002988# include <paths.h>
2989#endif
2990 ],
2991 [ char *wtmpx = WTMPX_FILE; ],
2992 [ AC_MSG_RESULT(yes) ],
2993 [ AC_MSG_RESULT(no)
2994 system_wtmpx_path=no ]
2995)
2996if test -z "$conf_wtmpx_location"; then
2997 if test x"$system_wtmpx_path" = x"no" ; then
2998 AC_DEFINE(DISABLE_WTMPX)
2999 fi
3000else
3001 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
3002fi
3003
Damien Miller4018c192000-04-30 09:30:44 +10003004
Damien Miller29ea30d2000-03-17 10:54:15 +11003005if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003006 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3007 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003008fi
3009
Tim Rice4cec93f2002-02-26 08:40:48 -08003010dnl remove pam and dl because they are in $LIBPAM
3011if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003012 LIBS=`echo $LIBS | sed 's/-lpam //'`
3013fi
3014if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3015 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003016fi
3017
Damien Millerbac2d8a2000-09-05 16:13:06 +11003018AC_EXEEXT
Tim Rice5af9db92004-06-19 19:31:06 -07003019AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
Tim Rice13aae5e2001-10-21 17:53:58 -07003020AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003021
Damien Miller7b22d652000-06-18 14:07:04 +10003022# Print summary of options
3023
Damien Miller7b22d652000-06-18 14:07:04 +10003024# Someone please show me a better way :)
3025A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3026B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3027C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3028D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003029E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003030F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003031G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003032H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3033I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3034J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003035
3036echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003037echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003038echo " User binaries: $B"
3039echo " System binaries: $C"
3040echo " Configuration files: $D"
3041echo " Askpass program: $E"
3042echo " Manual pages: $F"
3043echo " PID file: $G"
3044echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003045if test "x$external_path_file" = "x/etc/login.conf" ; then
3046echo " At runtime, sshd will use the path defined in $external_path_file"
3047echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003048else
Damien Millerf58c6722002-05-13 13:15:42 +10003049echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003050 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003051echo " (If PATH is set in $external_path_file it will be used instead. If"
3052echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3053 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003054fi
Damien Millera18bbd32002-05-13 10:48:57 +10003055if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003056echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003057fi
Damien Millerf58c6722002-05-13 13:15:42 +10003058echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003059echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003060echo " KerberosV support: $KRB5_MSG"
3061echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003062echo " S/KEY support: $SKEY_MSG"
3063echo " TCP Wrappers support: $TCPW_MSG"
3064echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003065echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003066echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003067echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3068echo " BSD Auth support: $BSD_AUTH_MSG"
3069echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003070if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003071echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003072fi
3073
Damien Miller7b22d652000-06-18 14:07:04 +10003074echo ""
3075
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003076echo " Host: ${host}"
3077echo " Compiler: ${CC}"
3078echo " Compiler flags: ${CFLAGS}"
3079echo "Preprocessor flags: ${CPPFLAGS}"
3080echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003081echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003082
3083echo ""
3084
Tim Rice6f1f7582004-05-30 21:38:51 -07003085if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003086 echo "SVR4 style packages are supported with \"make package\""
3087 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003088fi
3089
Damien Miller82cf0ce2000-12-20 13:34:48 +11003090if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003091 echo "PAM is enabled. You may need to install a PAM control file "
3092 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003093 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003094 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003095 echo ""
3096fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003097
Damien Miller6c21c512002-01-22 21:57:53 +11003098if test ! -z "$RAND_HELPER_CMDHASH" ; then
3099 echo "WARNING: you are using the builtin random number collection "
3100 echo "service. Please read WARNING.RNG and request that your OS "
3101 echo "vendor includes kernel-based random number collection in "
3102 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003103 echo ""
3104fi
Damien Miller60396b02001-02-18 17:01:00 +11003105
Damien Millerb4097182004-05-23 14:09:40 +10003106if test ! -z "$NO_PEERCHECK" ; then
3107 echo "WARNING: the operating system that you are using does not "
3108 echo "appear to support either the getpeereid() API nor the "
3109 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3110 echo "enforce security checks to prevent unauthorised connections to "
3111 echo "ssh-agent. Their absence increases the risk that a malicious "
3112 echo "user can connect to your agent. "
3113 echo ""
3114fi
3115