blob: b8f9700746800ab641e15fa6999918165ee17b03 [file] [log] [blame]
Darren Tuckera56f1912004-11-02 20:30:54 +11001# $Id: configure.ac,v 1.232 2004/11/02 09:30:54 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
Damien Millerfe1f1432003-02-24 15:45:42 +1100857dnl Checks for library functions. Please keep in alphabetical order
858AC_CHECK_FUNCS(\
Darren Tucker60bd4092004-06-25 14:03:34 +1000859 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
Damien Miller36f49652004-08-15 18:40:59 +1000860 bindresvport_sa clock closefrom dirfd fchmod fchown freeaddrinfo \
861 futimes getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000862 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100863 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000864 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100865 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000866 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100867 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000868 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000869 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100870 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100871)
Tim Rice13aae5e2001-10-21 17:53:58 -0700872
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000873# IRIX has a const char return value for gai_strerror()
874AC_CHECK_FUNCS(gai_strerror,[
875 AC_DEFINE(HAVE_GAI_STRERROR)
876 AC_TRY_COMPILE([
877#include <sys/types.h>
878#include <sys/socket.h>
879#include <netdb.h>
880
881const char *gai_strerror(int);],[
882char *str;
883
884str = gai_strerror(0);],[
885 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
886 [Define if gai_strerror() returns const char *])])])
887
Damien Millercd6853c2003-01-28 11:33:42 +1100888AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
889
Darren Tuckerf1159b52003-07-07 19:44:01 +1000890dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000891AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000892AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000893
Darren Tuckerb2427c82003-09-10 15:22:44 +1000894dnl tcsendbreak might be a macro
895AC_CHECK_DECL(tcsendbreak,
896 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100897 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000898 [#include <termios.h>]
899)
900
Darren Tucker5bb14002004-04-23 18:53:10 +1000901AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
902
Darren Tucker2a6b0292003-12-31 14:59:17 +1100903AC_CHECK_FUNCS(setresuid, [
904 dnl Some platorms have setresuid that isn't implemented, test for this
905 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +1000906 AC_RUN_IFELSE(
907 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +1100908#include <stdlib.h>
909#include <errno.h>
910int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000911 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +1100912 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100913 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000914 AC_MSG_RESULT(not implemented)],
915 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100916 )
917])
Darren Tuckere937be32003-12-17 18:53:26 +1100918
Darren Tucker2a6b0292003-12-31 14:59:17 +1100919AC_CHECK_FUNCS(setresgid, [
920 dnl Some platorms have setresgid that isn't implemented, test for this
921 AC_MSG_CHECKING(if setresgid 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; setresgid(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)],
929 [AC_DEFINE(BROKEN_SETRESGID)
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
Damien Millerad833b32000-08-23 10:46:23 +1000935dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000936AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000937dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000938AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000939AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000940dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000941AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000942AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100943
Damien Millera8e06ce2003-11-21 23:48:55 +1100944AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100945 [AC_DEFINE(HAVE_DAEMON)],
946 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
947)
948
Damien Millera8e06ce2003-11-21 23:48:55 +1100949AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100950 [AC_DEFINE(HAVE_GETPAGESIZE)],
951 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
952)
953
Damien Millercb170cb2000-07-01 16:52:55 +1000954# Check for broken snprintf
955if test "x$ac_cv_func_snprintf" = "xyes" ; then
956 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000957 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000958 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +1000959#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700960int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +1000961 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100962 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000963 [
964 AC_MSG_RESULT(no)
965 AC_DEFINE(BROKEN_SNPRINTF)
966 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000967 ],
968 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +1000969 )
970fi
971
Damien Millerb4097182004-05-23 14:09:40 +1000972# Check for missing getpeereid (or equiv) support
973NO_PEERCHECK=""
974if test "x$ac_cv_func_getpeereid" != "xyes" ; then
975 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
976 AC_TRY_COMPILE(
977 [#include <sys/types.h>
978 #include <sys/socket.h>],
979 [int i = SO_PEERCRED;],
980 [AC_MSG_RESULT(yes)],
981 [AC_MSG_RESULT(no)
982 NO_PEERCHECK=1]
983 )
984fi
985
Damien Millere8328192003-01-07 15:18:32 +1100986dnl see whether mkstemp() requires XXXXXX
987if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
988AC_MSG_CHECKING([for (overly) strict mkstemp])
989AC_TRY_RUN(
990 [
991#include <stdlib.h>
992main() { char template[]="conftest.mkstemp-test";
993if (mkstemp(template) == -1)
994 exit(1);
995unlink(template); exit(0);
996}
997 ],
998 [
999 AC_MSG_RESULT(no)
1000 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001001 [
Damien Millere8328192003-01-07 15:18:32 +11001002 AC_MSG_RESULT(yes)
1003 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1004 ],
1005 [
1006 AC_MSG_RESULT(yes)
1007 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001008 ]
Damien Millere8328192003-01-07 15:18:32 +11001009)
1010fi
1011
Darren Tucker70a3d552003-08-21 17:58:29 +10001012dnl make sure that openpty does not reacquire controlling terminal
1013if test ! -z "$check_for_openpty_ctty_bug"; then
1014 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1015 AC_TRY_RUN(
1016 [
1017#include <stdio.h>
1018#include <sys/fcntl.h>
1019#include <sys/types.h>
1020#include <sys/wait.h>
1021
1022int
1023main()
1024{
1025 pid_t pid;
1026 int fd, ptyfd, ttyfd, status;
1027
1028 pid = fork();
1029 if (pid < 0) { /* failed */
1030 exit(1);
1031 } else if (pid > 0) { /* parent */
1032 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001033 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001034 exit(WEXITSTATUS(status));
1035 else
1036 exit(2);
1037 } else { /* child */
1038 close(0); close(1); close(2);
1039 setsid();
1040 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1041 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1042 if (fd >= 0)
1043 exit(3); /* Acquired ctty: broken */
1044 else
1045 exit(0); /* Did not acquire ctty: OK */
1046 }
1047}
1048 ],
1049 [
1050 AC_MSG_RESULT(yes)
1051 ],
1052 [
1053 AC_MSG_RESULT(no)
1054 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1055 ]
1056 )
1057fi
1058
Darren Tucker4398cf52004-04-06 21:39:02 +10001059if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1060 AC_MSG_CHECKING(if getaddrinfo seems to work)
1061 AC_TRY_RUN(
1062 [
1063#include <stdio.h>
1064#include <sys/socket.h>
1065#include <netdb.h>
1066#include <errno.h>
1067#include <netinet/in.h>
1068
1069#define TEST_PORT "2222"
1070
1071int
1072main(void)
1073{
1074 int err, sock;
1075 struct addrinfo *gai_ai, *ai, hints;
1076 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1077
1078 memset(&hints, 0, sizeof(hints));
1079 hints.ai_family = PF_UNSPEC;
1080 hints.ai_socktype = SOCK_STREAM;
1081 hints.ai_flags = AI_PASSIVE;
1082
1083 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1084 if (err != 0) {
1085 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1086 exit(1);
1087 }
1088
1089 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1090 if (ai->ai_family != AF_INET6)
1091 continue;
1092
1093 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1094 sizeof(ntop), strport, sizeof(strport),
1095 NI_NUMERICHOST|NI_NUMERICSERV);
1096
1097 if (err != 0) {
1098 if (err == EAI_SYSTEM)
1099 perror("getnameinfo EAI_SYSTEM");
1100 else
1101 fprintf(stderr, "getnameinfo failed: %s\n",
1102 gai_strerror(err));
1103 exit(2);
1104 }
1105
1106 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1107 if (sock < 0)
1108 perror("socket");
1109 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1110 if (errno == EBADF)
1111 exit(3);
1112 }
1113 }
1114 exit(0);
1115}
1116 ],
1117 [
1118 AC_MSG_RESULT(yes)
1119 ],
1120 [
1121 AC_MSG_RESULT(no)
1122 AC_DEFINE(BROKEN_GETADDRINFO)
1123 ]
1124 )
1125fi
1126
Darren Tuckera56f1912004-11-02 20:30:54 +11001127if test "x$check_for_conflicting_getspnam" = "x1"; then
1128 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1129 AC_COMPILE_IFELSE(
1130 [
1131#include <shadow.h>
1132int main(void) {exit(0);}
1133 ],
1134 [
1135 AC_MSG_RESULT(no)
1136 ],
1137 [
1138 AC_MSG_RESULT(yes)
1139 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1140 [Conflicting defs for getspnam])
1141 ]
1142 )
1143fi
1144
Damien Miller606f8802000-09-16 15:39:56 +11001145AC_FUNC_GETPGRP
1146
Damien Millera64b57a2001-01-17 10:44:13 +11001147# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001148PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001149AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001150 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001151 [
Damien Millera64b57a2001-01-17 10:44:13 +11001152 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001153 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1154 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001155 AC_MSG_ERROR([PAM headers not found])
1156 fi
1157
1158 AC_CHECK_LIB(dl, dlopen, , )
1159 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1160 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001161 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001162
Damien Millera64b57a2001-01-17 10:44:13 +11001163 PAM_MSG="yes"
1164
1165 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001166 if test $ac_cv_lib_dl_dlopen = yes; then
1167 LIBPAM="-lpam -ldl"
1168 else
1169 LIBPAM="-lpam"
1170 fi
1171 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001172 fi
1173 ]
1174)
Damien Millera22ba012000-03-02 23:09:20 +11001175
Damien Millera64b57a2001-01-17 10:44:13 +11001176# Check for older PAM
1177if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001178 # Check PAM strerror arguments (old PAM)
1179 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1180 AC_TRY_COMPILE(
1181 [
Damien Miller81171112000-04-23 11:14:01 +10001182#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001183#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001184#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001185#elif defined (HAVE_PAM_PAM_APPL_H)
1186#include <pam/pam_appl.h>
1187#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001188 ],
1189 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001190 [AC_MSG_RESULT(no)],
1191 [
1192 AC_DEFINE(HAVE_OLD_PAM)
1193 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001194 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001195 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001196 )
Damien Millera22ba012000-03-02 23:09:20 +11001197fi
1198
Tim Riceaef73712002-05-11 13:17:42 -07001199# Search for OpenSSL
1200saved_CPPFLAGS="$CPPFLAGS"
1201saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001202AC_ARG_WITH(ssl-dir,
1203 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1204 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001205 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -07001206 if test -d "$withval/lib"; then
1207 if test -n "${need_dash_r}"; then
1208 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1209 else
1210 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1211 fi
1212 else
1213 if test -n "${need_dash_r}"; then
1214 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1215 else
1216 LDFLAGS="-L${withval} ${LDFLAGS}"
1217 fi
1218 fi
1219 if test -d "$withval/include"; then
1220 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1221 else
1222 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1223 fi
Damien Millera22ba012000-03-02 23:09:20 +11001224 fi
1225 ]
1226)
Tim Rice3d5352e2004-02-12 09:27:21 -08001227LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001228AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001229 [
Tim Riceaef73712002-05-11 13:17:42 -07001230 dnl Check default openssl install dir
1231 if test -n "${need_dash_r}"; then
1232 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001233 else
Tim Riceaef73712002-05-11 13:17:42 -07001234 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001235 fi
Tim Riceaef73712002-05-11 13:17:42 -07001236 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1237 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1238 [
1239 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1240 ]
1241 )
1242 ]
1243)
1244
Tim Riced730b782002-08-13 18:52:10 -07001245# Determine OpenSSL header version
1246AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001247AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001248 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001249#include <stdio.h>
1250#include <string.h>
1251#include <openssl/opensslv.h>
1252#define DATA "conftest.sslincver"
1253int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001254 FILE *fd;
1255 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001256
Damien Millera8e06ce2003-11-21 23:48:55 +11001257 fd = fopen(DATA,"w");
1258 if(fd == NULL)
1259 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001260
1261 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1262 exit(1);
1263
1264 exit(0);
1265}
Darren Tucker623d92f2004-09-12 22:36:15 +10001266 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001267 [
1268 ssl_header_ver=`cat conftest.sslincver`
1269 AC_MSG_RESULT($ssl_header_ver)
1270 ],
1271 [
1272 AC_MSG_RESULT(not found)
1273 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001274 ],
1275 [
1276 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001277 ]
1278)
1279
1280# Determine OpenSSL library version
1281AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001282AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001283 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001284#include <stdio.h>
1285#include <string.h>
1286#include <openssl/opensslv.h>
1287#include <openssl/crypto.h>
1288#define DATA "conftest.ssllibver"
1289int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001290 FILE *fd;
1291 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001292
Damien Millera8e06ce2003-11-21 23:48:55 +11001293 fd = fopen(DATA,"w");
1294 if(fd == NULL)
1295 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001296
1297 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1298 exit(1);
1299
1300 exit(0);
1301}
Darren Tucker623d92f2004-09-12 22:36:15 +10001302 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001303 [
1304 ssl_library_ver=`cat conftest.ssllibver`
1305 AC_MSG_RESULT($ssl_library_ver)
1306 ],
1307 [
1308 AC_MSG_RESULT(not found)
1309 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001310 ],
1311 [
1312 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001313 ]
1314)
Damien Millera22ba012000-03-02 23:09:20 +11001315
Damien Millerec932372002-01-22 22:16:03 +11001316# Sanity check OpenSSL headers
1317AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001318AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001319 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001320#include <string.h>
1321#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001322int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001323 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001324 [
1325 AC_MSG_RESULT(yes)
1326 ],
1327 [
1328 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001329 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1330Check config.log for details.
1331Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001332 ],
1333 [
1334 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001335 ]
1336)
1337
Tim Rice3d5352e2004-02-12 09:27:21 -08001338# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1339# because the system crypt() is more featureful.
1340if test "x$check_for_libcrypt_before" = "x1"; then
1341 AC_CHECK_LIB(crypt, crypt)
1342fi
1343
Damien Millera8e06ce2003-11-21 23:48:55 +11001344# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001345# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001346if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001347 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001348fi
1349
Damien Miller6c21c512002-01-22 21:57:53 +11001350
1351### Configure cryptographic random number support
1352
1353# Check wheter OpenSSL seeds itself
1354AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001355AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001356 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001357#include <string.h>
1358#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001359int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001360 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001361 [
1362 OPENSSL_SEEDS_ITSELF=yes
1363 AC_MSG_RESULT(yes)
1364 ],
1365 [
1366 AC_MSG_RESULT(no)
1367 # Default to use of the rand helper if OpenSSL doesn't
1368 # seed itself
1369 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001370 ],
1371 [
1372 AC_MSG_WARN([cross compiling: assuming yes])
1373 # This is safe, since all recent OpenSSL versions will
1374 # complain at runtime if not seeded correctly.
1375 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001376 ]
1377)
1378
1379
1380# Do we want to force the use of the rand helper?
1381AC_ARG_WITH(rand-helper,
1382 [ --with-rand-helper Use subprocess to gather strong randomness ],
1383 [
1384 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001385 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001386 # the previous test showed it to be unseeded.
1387 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1388 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1389 OPENSSL_SEEDS_ITSELF=yes
1390 USE_RAND_HELPER=""
1391 fi
1392 else
1393 USE_RAND_HELPER=yes
1394 fi
1395 ],
1396)
1397
1398# Which randomness source do we use?
1399if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1400 # OpenSSL only
1401 AC_DEFINE(OPENSSL_PRNG_ONLY)
1402 RAND_MSG="OpenSSL internal ONLY"
1403 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001404elif test ! -z "$USE_RAND_HELPER" ; then
1405 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001406 RAND_MSG="ssh-rand-helper"
1407 INSTALL_SSH_RAND_HELPER="yes"
1408fi
1409AC_SUBST(INSTALL_SSH_RAND_HELPER)
1410
1411### Configuration of ssh-rand-helper
1412
1413# PRNGD TCP socket
1414AC_ARG_WITH(prngd-port,
1415 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1416 [
Damien Millere996d722002-01-23 11:20:59 +11001417 case "$withval" in
1418 no)
1419 withval=""
1420 ;;
1421 [[0-9]]*)
1422 ;;
1423 *)
1424 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1425 ;;
1426 esac
1427 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001428 PRNGD_PORT="$withval"
1429 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1430 fi
1431 ]
1432)
1433
1434# PRNGD Unix domain socket
1435AC_ARG_WITH(prngd-socket,
1436 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1437 [
Damien Millere996d722002-01-23 11:20:59 +11001438 case "$withval" in
1439 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001440 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001441 ;;
1442 no)
1443 withval=""
1444 ;;
1445 /*)
1446 ;;
1447 *)
1448 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1449 ;;
1450 esac
1451
1452 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001453 if test ! -z "$PRNGD_PORT" ; then
1454 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1455 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001456 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001457 AC_MSG_WARN(Entropy socket is not readable)
1458 fi
1459 PRNGD_SOCKET="$withval"
1460 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1461 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001462 ],
1463 [
1464 # Check for existing socket only if we don't have a random device already
1465 if test "$USE_RAND_HELPER" = yes ; then
1466 AC_MSG_CHECKING(for PRNGD/EGD socket)
1467 # Insert other locations here
1468 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1469 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1470 PRNGD_SOCKET="$sock"
1471 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1472 break;
1473 fi
1474 done
1475 if test ! -z "$PRNGD_SOCKET" ; then
1476 AC_MSG_RESULT($PRNGD_SOCKET)
1477 else
1478 AC_MSG_RESULT(not found)
1479 fi
1480 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001481 ]
1482)
1483
1484# Change default command timeout for hashing entropy source
1485entropy_timeout=200
1486AC_ARG_WITH(entropy-timeout,
1487 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1488 [
1489 if test "x$withval" != "xno" ; then
1490 entropy_timeout=$withval
1491 fi
1492 ]
1493)
Damien Miller6c21c512002-01-22 21:57:53 +11001494AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1495
Damien Millerd3f6ad22002-06-25 10:24:47 +10001496SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001497AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001498 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001499 [
1500 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001501 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001502 fi
1503 ]
1504)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001505AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1506AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001507
Tim Rice88f2ab52002-03-17 12:17:34 -08001508# We do this little dance with the search path to insure
1509# that programs that we select for use by installed programs
1510# (which may be run by the super-user) come from trusted
1511# locations before they come from the user's private area.
1512# This should help avoid accidentally configuring some
1513# random version of a program in someone's personal bin.
1514
1515OPATH=$PATH
1516PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001517test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001518test -d /sbin && PATH=$PATH:/sbin
1519test -d /usr/sbin && PATH=$PATH:/usr/sbin
1520PATH=$PATH:/etc:$OPATH
1521
Damien Millera8e06ce2003-11-21 23:48:55 +11001522# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001523OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1524OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1525OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1526OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1527OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1528OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1529OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1530OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1531OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1532OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1533OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1534OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1535OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1536OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1537OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1538OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001539# restore PATH
1540PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001541
1542# Where does ssh-rand-helper get its randomness from?
1543INSTALL_SSH_PRNG_CMDS=""
1544if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1545 if test ! -z "$PRNGD_PORT" ; then
1546 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1547 elif test ! -z "$PRNGD_SOCKET" ; then
1548 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1549 else
1550 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1551 RAND_HELPER_CMDHASH=yes
1552 INSTALL_SSH_PRNG_CMDS="yes"
1553 fi
1554fi
1555AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1556
1557
Ben Lindstromb5628642000-10-18 00:02:25 +00001558# Cheap hack to ensure NEWS-OS libraries are arranged right.
1559if test ! -z "$SONY" ; then
1560 LIBS="$LIBS -liberty";
1561fi
1562
Damien Millera22ba012000-03-02 23:09:20 +11001563# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001564AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001565AC_CHECK_SIZEOF(short int, 2)
1566AC_CHECK_SIZEOF(int, 4)
1567AC_CHECK_SIZEOF(long int, 4)
1568AC_CHECK_SIZEOF(long long int, 8)
1569
Damien Millerfa2bb692002-04-23 23:22:25 +10001570# Sanity check long long for some platforms (AIX)
1571if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1572 ac_cv_sizeof_long_long_int=0
1573fi
1574
Damien Millera22ba012000-03-02 23:09:20 +11001575# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001576AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1577 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001578 [ #include <sys/types.h> ],
1579 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001580 [ ac_cv_have_u_int="yes" ],
1581 [ ac_cv_have_u_int="no" ]
1582 )
1583])
1584if test "x$ac_cv_have_u_int" = "xyes" ; then
1585 AC_DEFINE(HAVE_U_INT)
1586 have_u_int=1
1587fi
1588
Damien Miller61e50f12000-05-08 20:49:37 +10001589AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1590 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001591 [ #include <sys/types.h> ],
1592 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001593 [ ac_cv_have_intxx_t="yes" ],
1594 [ ac_cv_have_intxx_t="no" ]
1595 )
1596])
1597if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1598 AC_DEFINE(HAVE_INTXX_T)
1599 have_intxx_t=1
1600fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001601
1602if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001603 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001604then
1605 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1606 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001607 [ #include <stdint.h> ],
1608 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001609 [
1610 AC_DEFINE(HAVE_INTXX_T)
1611 AC_MSG_RESULT(yes)
1612 ],
1613 [ AC_MSG_RESULT(no) ]
1614 )
1615fi
1616
Damien Miller578783e2000-09-23 14:12:24 +11001617AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1618 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001619 [
1620#include <sys/types.h>
1621#ifdef HAVE_STDINT_H
1622# include <stdint.h>
1623#endif
1624#include <sys/socket.h>
1625#ifdef HAVE_SYS_BITYPES_H
1626# include <sys/bitypes.h>
1627#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001628 ],
1629 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001630 [ ac_cv_have_int64_t="yes" ],
1631 [ ac_cv_have_int64_t="no" ]
1632 )
1633])
1634if test "x$ac_cv_have_int64_t" = "xyes" ; then
1635 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001636fi
1637
Damien Miller61e50f12000-05-08 20:49:37 +10001638AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1639 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001640 [ #include <sys/types.h> ],
1641 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001642 [ ac_cv_have_u_intxx_t="yes" ],
1643 [ ac_cv_have_u_intxx_t="no" ]
1644 )
1645])
1646if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1647 AC_DEFINE(HAVE_U_INTXX_T)
1648 have_u_intxx_t=1
1649fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001650
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001651if test -z "$have_u_intxx_t" ; then
1652 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1653 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001654 [ #include <sys/socket.h> ],
1655 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001656 [
1657 AC_DEFINE(HAVE_U_INTXX_T)
1658 AC_MSG_RESULT(yes)
1659 ],
1660 [ AC_MSG_RESULT(no) ]
1661 )
1662fi
1663
Damien Miller578783e2000-09-23 14:12:24 +11001664AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1665 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001666 [ #include <sys/types.h> ],
1667 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001668 [ ac_cv_have_u_int64_t="yes" ],
1669 [ ac_cv_have_u_int64_t="no" ]
1670 )
1671])
1672if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1673 AC_DEFINE(HAVE_U_INT64_T)
1674 have_u_int64_t=1
1675fi
1676
Tim Rice4cec93f2002-02-26 08:40:48 -08001677if test -z "$have_u_int64_t" ; then
1678 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1679 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001680 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001681 [ u_int64_t a; a = 1],
1682 [
1683 AC_DEFINE(HAVE_U_INT64_T)
1684 AC_MSG_RESULT(yes)
1685 ],
1686 [ AC_MSG_RESULT(no) ]
1687 )
1688fi
1689
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001690if test -z "$have_u_intxx_t" ; then
1691 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1692 AC_TRY_COMPILE(
1693 [
1694#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001695 ],
1696 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001697 [ ac_cv_have_uintxx_t="yes" ],
1698 [ ac_cv_have_uintxx_t="no" ]
1699 )
1700 ])
1701 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1702 AC_DEFINE(HAVE_UINTXX_T)
1703 fi
1704fi
1705
1706if test -z "$have_uintxx_t" ; then
1707 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1708 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001709 [ #include <stdint.h> ],
1710 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001711 [
1712 AC_DEFINE(HAVE_UINTXX_T)
1713 AC_MSG_RESULT(yes)
1714 ],
1715 [ AC_MSG_RESULT(no) ]
1716 )
1717fi
1718
Damien Milleredb82922000-06-20 13:25:52 +10001719if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001720 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001721then
1722 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1723 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001724 [
1725#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001726 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001727 [
Damien Miller70494d12000-04-03 15:57:06 +10001728 int8_t a; int16_t b; int32_t c;
1729 u_int8_t e; u_int16_t f; u_int32_t g;
1730 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001731 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001732 [
1733 AC_DEFINE(HAVE_U_INTXX_T)
1734 AC_DEFINE(HAVE_INTXX_T)
1735 AC_MSG_RESULT(yes)
1736 ],
1737 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001738 )
Damien Millerb29ea912000-01-15 14:12:03 +11001739fi
1740
Damien Miller58be7382001-09-15 21:31:54 +10001741
1742AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1743 AC_TRY_COMPILE(
1744 [
1745#include <sys/types.h>
1746 ],
1747 [ u_char foo; foo = 125; ],
1748 [ ac_cv_have_u_char="yes" ],
1749 [ ac_cv_have_u_char="no" ]
1750 )
1751])
1752if test "x$ac_cv_have_u_char" = "xyes" ; then
1753 AC_DEFINE(HAVE_U_CHAR)
1754fi
1755
Tim Rice13aae5e2001-10-21 17:53:58 -07001756TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001757
Tim Rice200a5c02002-02-26 22:12:34 -08001758AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001759
Damien Miller61e50f12000-05-08 20:49:37 +10001760AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1761 AC_TRY_COMPILE(
1762 [
1763#include <sys/types.h>
1764 ],
1765 [ size_t foo; foo = 1235; ],
1766 [ ac_cv_have_size_t="yes" ],
1767 [ ac_cv_have_size_t="no" ]
1768 )
1769])
1770if test "x$ac_cv_have_size_t" = "xyes" ; then
1771 AC_DEFINE(HAVE_SIZE_T)
1772fi
Damien Miller95058511999-12-29 10:36:45 +11001773
Damien Miller615f9392000-05-17 22:53:33 +10001774AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1775 AC_TRY_COMPILE(
1776 [
1777#include <sys/types.h>
1778 ],
1779 [ ssize_t foo; foo = 1235; ],
1780 [ ac_cv_have_ssize_t="yes" ],
1781 [ ac_cv_have_ssize_t="no" ]
1782 )
1783])
1784if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1785 AC_DEFINE(HAVE_SSIZE_T)
1786fi
1787
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001788AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1789 AC_TRY_COMPILE(
1790 [
1791#include <time.h>
1792 ],
1793 [ clock_t foo; foo = 1235; ],
1794 [ ac_cv_have_clock_t="yes" ],
1795 [ ac_cv_have_clock_t="no" ]
1796 )
1797])
1798if test "x$ac_cv_have_clock_t" = "xyes" ; then
1799 AC_DEFINE(HAVE_CLOCK_T)
1800fi
1801
Damien Millerb54b40e2000-06-23 08:23:34 +10001802AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1803 AC_TRY_COMPILE(
1804 [
1805#include <sys/types.h>
1806#include <sys/socket.h>
1807 ],
1808 [ sa_family_t foo; foo = 1235; ],
1809 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001810 [ AC_TRY_COMPILE(
1811 [
1812#include <sys/types.h>
1813#include <sys/socket.h>
1814#include <netinet/in.h>
1815 ],
1816 [ sa_family_t foo; foo = 1235; ],
1817 [ ac_cv_have_sa_family_t="yes" ],
1818
Damien Millerb54b40e2000-06-23 08:23:34 +10001819 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001820 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001821 )
1822])
1823if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1824 AC_DEFINE(HAVE_SA_FAMILY_T)
1825fi
1826
Damien Miller0f91b4e2000-06-18 15:43:25 +10001827AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1828 AC_TRY_COMPILE(
1829 [
1830#include <sys/types.h>
1831 ],
1832 [ pid_t foo; foo = 1235; ],
1833 [ ac_cv_have_pid_t="yes" ],
1834 [ ac_cv_have_pid_t="no" ]
1835 )
1836])
1837if test "x$ac_cv_have_pid_t" = "xyes" ; then
1838 AC_DEFINE(HAVE_PID_T)
1839fi
1840
1841AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1842 AC_TRY_COMPILE(
1843 [
1844#include <sys/types.h>
1845 ],
1846 [ mode_t foo; foo = 1235; ],
1847 [ ac_cv_have_mode_t="yes" ],
1848 [ ac_cv_have_mode_t="no" ]
1849 )
1850])
1851if test "x$ac_cv_have_mode_t" = "xyes" ; then
1852 AC_DEFINE(HAVE_MODE_T)
1853fi
1854
Damien Miller61e50f12000-05-08 20:49:37 +10001855
1856AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1857 AC_TRY_COMPILE(
1858 [
Damien Miller81171112000-04-23 11:14:01 +10001859#include <sys/types.h>
1860#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001861 ],
1862 [ struct sockaddr_storage s; ],
1863 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1864 [ ac_cv_have_struct_sockaddr_storage="no" ]
1865 )
1866])
1867if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1868 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1869fi
Damien Miller34132e52000-01-14 15:45:46 +11001870
Damien Miller61e50f12000-05-08 20:49:37 +10001871AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1872 AC_TRY_COMPILE(
1873 [
Damien Miller7b22d652000-06-18 14:07:04 +10001874#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001875#include <netinet/in.h>
1876 ],
1877 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1878 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1879 [ ac_cv_have_struct_sockaddr_in6="no" ]
1880 )
1881])
1882if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1883 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1884fi
Damien Miller34132e52000-01-14 15:45:46 +11001885
Damien Miller61e50f12000-05-08 20:49:37 +10001886AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1887 AC_TRY_COMPILE(
1888 [
Damien Miller7b22d652000-06-18 14:07:04 +10001889#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001890#include <netinet/in.h>
1891 ],
1892 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1893 [ ac_cv_have_struct_in6_addr="yes" ],
1894 [ ac_cv_have_struct_in6_addr="no" ]
1895 )
1896])
1897if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1898 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1899fi
Damien Miller34132e52000-01-14 15:45:46 +11001900
Damien Miller61e50f12000-05-08 20:49:37 +10001901AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1902 AC_TRY_COMPILE(
1903 [
Damien Miller81171112000-04-23 11:14:01 +10001904#include <sys/types.h>
1905#include <sys/socket.h>
1906#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001907 ],
1908 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1909 [ ac_cv_have_struct_addrinfo="yes" ],
1910 [ ac_cv_have_struct_addrinfo="no" ]
1911 )
1912])
1913if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1914 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1915fi
1916
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001917AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1918 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001919 [ #include <sys/time.h> ],
1920 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001921 [ ac_cv_have_struct_timeval="yes" ],
1922 [ ac_cv_have_struct_timeval="no" ]
1923 )
1924])
1925if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1926 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1927 have_struct_timeval=1
1928fi
1929
Tim Rice4e4dc562003-03-18 10:21:40 -08001930AC_CHECK_TYPES(struct timespec)
1931
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001932# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001933if test "x$ac_cv_have_int64_t" = "xno" -a \
1934 "x$ac_cv_sizeof_long_int" != "x8" -a \
1935 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001936 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1937 echo "an alternative compiler (I.E., GCC) before continuing."
1938 echo ""
1939 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001940else
1941dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001942 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001943 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08001944#include <stdio.h>
1945#include <string.h>
1946#ifdef HAVE_SNPRINTF
1947main()
1948{
1949 char buf[50];
1950 char expected_out[50];
1951 int mazsize = 50 ;
1952#if (SIZEOF_LONG_INT == 8)
1953 long int num = 0x7fffffffffffffff;
1954#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001955 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001956#endif
1957 strcpy(expected_out, "9223372036854775807");
1958 snprintf(buf, mazsize, "%lld", num);
1959 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001960 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001961 exit(0);
1962}
1963#else
1964main() { exit(0); }
1965#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10001966 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10001967 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08001968 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001969fi
1970
Damien Miller78315eb2000-09-29 23:01:36 +11001971dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001972OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1973OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1974OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1975OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1976OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001977OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001978OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1979OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001980OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001981OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1982OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1983OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1984OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001985OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1986OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1987OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1988OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001989
1990AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001991
Damien Miller61e50f12000-05-08 20:49:37 +10001992AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1993 ac_cv_have_ss_family_in_struct_ss, [
1994 AC_TRY_COMPILE(
1995 [
Damien Miller81171112000-04-23 11:14:01 +10001996#include <sys/types.h>
1997#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001998 ],
1999 [ struct sockaddr_storage s; s.ss_family = 1; ],
2000 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2001 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2002 )
2003])
2004if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2005 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
2006fi
2007
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
Damien Millerbf1c9b21999-12-09 10:16:54 +11002023
Damien Millerad833b32000-08-23 10:46:23 +10002024AC_CACHE_CHECK([for pw_class field in struct passwd],
2025 ac_cv_have_pw_class_in_struct_passwd, [
2026 AC_TRY_COMPILE(
2027 [
Damien Millerad833b32000-08-23 10:46:23 +10002028#include <pwd.h>
2029 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002030 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002031 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2032 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2033 )
2034])
2035if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2036 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2037fi
2038
Kevin Steves82456952001-06-22 21:14:18 +00002039AC_CACHE_CHECK([for pw_expire field in struct passwd],
2040 ac_cv_have_pw_expire_in_struct_passwd, [
2041 AC_TRY_COMPILE(
2042 [
2043#include <pwd.h>
2044 ],
2045 [ struct passwd p; p.pw_expire = 0; ],
2046 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2047 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2048 )
2049])
2050if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2051 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2052fi
2053
2054AC_CACHE_CHECK([for pw_change field in struct passwd],
2055 ac_cv_have_pw_change_in_struct_passwd, [
2056 AC_TRY_COMPILE(
2057 [
2058#include <pwd.h>
2059 ],
2060 [ struct passwd p; p.pw_change = 0; ],
2061 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2062 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2063 )
2064])
2065if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2066 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2067fi
Damien Miller61e50f12000-05-08 20:49:37 +10002068
Tim Rice28bbb0c2002-05-27 17:37:32 -07002069dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002070AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2071 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002072 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002073 [
Tim Riceae49fe62002-04-12 10:26:21 -07002074#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002075#include <sys/socket.h>
2076#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002077int main() {
2078#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002079#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002080exit(1);
2081#endif
2082struct msghdr m;
2083m.msg_accrights = 0;
2084exit(0);
2085}
Kevin Steves939c9db2002-03-22 17:23:25 +00002086 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002087 [ ac_cv_have_accrights_in_msghdr="yes" ],
2088 [ ac_cv_have_accrights_in_msghdr="no" ]
2089 )
2090])
2091if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2092 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2093fi
2094
Kevin Stevesa44e0352002-04-07 16:18:03 +00002095AC_CACHE_CHECK([for msg_control field in struct msghdr],
2096 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002097 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002098 [
Tim Riceae49fe62002-04-12 10:26:21 -07002099#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002100#include <sys/socket.h>
2101#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002102int main() {
2103#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002104#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002105exit(1);
2106#endif
2107struct msghdr m;
2108m.msg_control = 0;
2109exit(0);
2110}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002111 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002112 [ ac_cv_have_control_in_msghdr="yes" ],
2113 [ ac_cv_have_control_in_msghdr="no" ]
2114 )
2115])
2116if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2117 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2118fi
2119
Damien Miller61e50f12000-05-08 20:49:37 +10002120AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002121 AC_TRY_LINK([],
2122 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002123 [ ac_cv_libc_defines___progname="yes" ],
2124 [ ac_cv_libc_defines___progname="no" ]
2125 )
2126])
2127if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2128 AC_DEFINE(HAVE___PROGNAME)
2129fi
2130
Kevin Steves4846f4a2002-03-22 18:19:53 +00002131AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2132 AC_TRY_LINK([
2133#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002134],
2135 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002136 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2137 [ ac_cv_cc_implements___FUNCTION__="no" ]
2138 )
2139])
2140if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2141 AC_DEFINE(HAVE___FUNCTION__)
2142fi
2143
2144AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2145 AC_TRY_LINK([
2146#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002147],
2148 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002149 [ ac_cv_cc_implements___func__="yes" ],
2150 [ ac_cv_cc_implements___func__="no" ]
2151 )
2152])
2153if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2154 AC_DEFINE(HAVE___func__)
2155fi
2156
Damien Miller4f8e6692001-07-14 13:22:53 +10002157AC_CACHE_CHECK([whether getopt has optreset support],
2158 ac_cv_have_getopt_optreset, [
2159 AC_TRY_LINK(
2160 [
2161#include <getopt.h>
2162 ],
2163 [ extern int optreset; optreset = 0; ],
2164 [ ac_cv_have_getopt_optreset="yes" ],
2165 [ ac_cv_have_getopt_optreset="no" ]
2166 )
2167])
2168if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2169 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2170fi
Damien Millera22ba012000-03-02 23:09:20 +11002171
Damien Millerecbb26d2000-07-15 14:59:14 +10002172AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002173 AC_TRY_LINK([],
2174 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002175 [ ac_cv_libc_defines_sys_errlist="yes" ],
2176 [ ac_cv_libc_defines_sys_errlist="no" ]
2177 )
2178])
2179if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2180 AC_DEFINE(HAVE_SYS_ERRLIST)
2181fi
2182
2183
Damien Miller11fa2cc2000-08-16 10:35:58 +10002184AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002185 AC_TRY_LINK([],
2186 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002187 [ ac_cv_libc_defines_sys_nerr="yes" ],
2188 [ ac_cv_libc_defines_sys_nerr="no" ]
2189 )
2190])
2191if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2192 AC_DEFINE(HAVE_SYS_NERR)
2193fi
2194
Damien Millera8e06ce2003-11-21 23:48:55 +11002195SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002196# Check whether user wants sectok support
2197AC_ARG_WITH(sectok,
2198 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002199 [
2200 if test "x$withval" != "xno" ; then
2201 if test "x$withval" != "xyes" ; then
2202 CPPFLAGS="$CPPFLAGS -I${withval}"
2203 LDFLAGS="$LDFLAGS -L${withval}"
2204 if test ! -z "$need_dash_r" ; then
2205 LDFLAGS="$LDFLAGS -R${withval}"
2206 fi
2207 if test ! -z "$blibpath" ; then
2208 blibpath="$blibpath:${withval}"
2209 fi
2210 fi
2211 AC_CHECK_HEADERS(sectok.h)
2212 if test "$ac_cv_header_sectok_h" != yes; then
2213 AC_MSG_ERROR(Can't find sectok.h)
2214 fi
2215 AC_CHECK_LIB(sectok, sectok_open)
2216 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2217 AC_MSG_ERROR(Can't find libsectok)
2218 fi
2219 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002220 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002221 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002222 fi
2223 ]
2224)
2225
2226# Check whether user wants OpenSC support
2227AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10002228 AC_HELP_STRING([--with-opensc=PFX],
2229 [Enable smartcard support using OpenSC]),
2230 opensc_config_prefix="$withval", opensc_config_prefix="")
2231if test x$opensc_config_prefix != x ; then
2232 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2233 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2234 if test "$OPENSC_CONFIG" != "no"; then
2235 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2236 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2237 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2238 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2239 AC_DEFINE(SMARTCARD)
2240 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11002241 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10002242 fi
2243fi
Damien Miller85de5802001-09-18 14:01:11 +10002244
Darren Tucker5f88d342003-10-15 16:57:57 +10002245# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002246AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002247 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002248 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002249 # Needed by our getrrsetbyname()
2250 AC_SEARCH_LIBS(res_query, resolv)
2251 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002252 AC_MSG_CHECKING(if res_query will link)
2253 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2254 [AC_MSG_RESULT(no)
2255 saved_LIBS="$LIBS"
2256 LIBS="$LIBS -lresolv"
2257 AC_MSG_CHECKING(for res_query in -lresolv)
2258 AC_LINK_IFELSE([
2259#include <resolv.h>
2260int main()
2261{
2262 res_query (0, 0, 0, 0, 0);
2263 return 0;
2264}
2265 ],
2266 [LIBS="$LIBS -lresolv"
2267 AC_MSG_RESULT(yes)],
2268 [LIBS="$saved_LIBS"
2269 AC_MSG_RESULT(no)])
2270 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002271 AC_CHECK_FUNCS(_getshort _getlong)
2272 AC_CHECK_MEMBER(HEADER.ad,
2273 [AC_DEFINE(HAVE_HEADER_AD)],,
2274 [#include <arpa/nameser.h>])
2275 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002276
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002277# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002278KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002279AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002280 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002281 [ if test "x$withval" != "xno" ; then
2282 if test "x$withval" = "xyes" ; then
2283 KRB5ROOT="/usr/local"
2284 else
2285 KRB5ROOT=${withval}
2286 fi
2287
2288 AC_DEFINE(KRB5)
2289 KRB5_MSG="yes"
2290
2291 AC_MSG_CHECKING(for krb5-config)
2292 if test -x $KRB5ROOT/bin/krb5-config ; then
2293 KRB5CONF=$KRB5ROOT/bin/krb5-config
2294 AC_MSG_RESULT($KRB5CONF)
2295
2296 AC_MSG_CHECKING(for gssapi support)
2297 if $KRB5CONF | grep gssapi >/dev/null ; then
2298 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002299 AC_DEFINE(GSSAPI)
2300 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002301 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002302 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002303 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002304 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002305 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2306 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002307 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002308 AC_MSG_CHECKING(whether we are using Heimdal)
2309 AC_TRY_COMPILE([ #include <krb5.h> ],
2310 [ char *tmp = heimdal_version; ],
2311 [ AC_MSG_RESULT(yes)
2312 AC_DEFINE(HEIMDAL) ],
2313 AC_MSG_RESULT(no)
2314 )
2315 else
2316 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002317 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002318 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002319 AC_MSG_CHECKING(whether we are using Heimdal)
2320 AC_TRY_COMPILE([ #include <krb5.h> ],
2321 [ char *tmp = heimdal_version; ],
2322 [ AC_MSG_RESULT(yes)
2323 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002324 K5LIBS="-lkrb5 -ldes"
2325 K5LIBS="$K5LIBS -lcom_err -lasn1"
2326 AC_CHECK_LIB(roken, net_write,
2327 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002328 ],
2329 [ AC_MSG_RESULT(no)
2330 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2331 ]
2332 )
Damien Miller200d0a72003-06-30 19:21:36 +10002333 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002334
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002335 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2336 [ AC_DEFINE(GSSAPI)
2337 K5LIBS="-lgssapi $K5LIBS" ],
2338 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2339 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002340 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002341 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2342 $K5LIBS)
2343 ],
2344 $K5LIBS)
2345
2346 AC_CHECK_HEADER(gssapi.h, ,
2347 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002348 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002349 AC_CHECK_HEADERS(gssapi.h, ,
2350 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002351 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002352 ]
2353 )
2354
2355 oldCPP="$CPPFLAGS"
2356 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2357 AC_CHECK_HEADER(gssapi_krb5.h, ,
2358 [ CPPFLAGS="$oldCPP" ])
2359
Damien Millera8e06ce2003-11-21 23:48:55 +11002360 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002361 if test ! -z "$need_dash_r" ; then
2362 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2363 fi
2364 if test ! -z "$blibpath" ; then
2365 blibpath="$blibpath:${KRB5ROOT}/lib"
2366 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002367 fi
2368
2369 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2370 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2371 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2372
2373 LIBS="$LIBS $K5LIBS"
2374 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002375 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002376 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002377)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002378
Damien Millera22ba012000-03-02 23:09:20 +11002379# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002380
Damien Millerf58c6722002-05-13 13:15:42 +10002381PRIVSEP_PATH=/var/empty
2382AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002383 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002384 [
2385 if test "x$withval" != "$no" ; then
2386 PRIVSEP_PATH=$withval
2387 fi
2388 ]
2389)
2390AC_SUBST(PRIVSEP_PATH)
2391
Damien Millera22ba012000-03-02 23:09:20 +11002392AC_ARG_WITH(xauth,
2393 [ --with-xauth=PATH Specify path to xauth program ],
2394 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002395 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002396 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002397 fi
2398 ],
2399 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002400 TestPath="$PATH"
2401 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2402 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2403 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2404 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2405 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002406 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002407 xauth_path="/usr/openwin/bin/xauth"
2408 fi
2409 ]
2410)
2411
Damien Miller7d901272003-01-13 16:55:22 +11002412STRIP_OPT=-s
2413AC_ARG_ENABLE(strip,
2414 [ --disable-strip Disable calling strip(1) on install],
2415 [
2416 if test "x$enableval" = "xno" ; then
2417 STRIP_OPT=
2418 fi
2419 ]
2420)
2421AC_SUBST(STRIP_OPT)
2422
Damien Millera19cf472000-11-29 13:28:50 +11002423if test -z "$xauth_path" ; then
2424 XAUTH_PATH="undefined"
2425 AC_SUBST(XAUTH_PATH)
2426else
Damien Millera22ba012000-03-02 23:09:20 +11002427 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002428 XAUTH_PATH=$xauth_path
2429 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002430fi
Damien Millera22ba012000-03-02 23:09:20 +11002431
2432# Check for mail directory (last resort if we cannot get it from headers)
2433if test ! -z "$MAIL" ; then
2434 maildir=`dirname $MAIL`
2435 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2436fi
2437
Darren Tucker623d92f2004-09-12 22:36:15 +10002438if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002439 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2440 disable_ptmx_check=yes
2441fi
Damien Millera22ba012000-03-02 23:09:20 +11002442if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002443 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002444 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002445 [
2446 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2447 have_dev_ptmx=1
2448 ]
2449 )
2450 fi
Damien Millera22ba012000-03-02 23:09:20 +11002451fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002452
Darren Tucker623d92f2004-09-12 22:36:15 +10002453if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002454 AC_CHECK_FILE("/dev/ptc",
2455 [
2456 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2457 have_dev_ptc=1
2458 ]
2459 )
2460else
2461 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2462fi
Damien Miller204ad072000-03-02 23:56:12 +11002463
Damien Millera22ba012000-03-02 23:09:20 +11002464# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002465AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002466 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002467 [
Damien Miller897741e2001-04-16 10:41:46 +10002468 case "$withval" in
2469 man|cat|doc)
2470 MANTYPE=$withval
2471 ;;
2472 *)
2473 AC_MSG_ERROR(invalid man type: $withval)
2474 ;;
2475 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002476 ]
2477)
Ben Lindstrombc709922001-04-18 18:04:21 +00002478if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002479 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2480 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002481 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2482 MANTYPE=doc
2483 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2484 MANTYPE=man
2485 else
2486 MANTYPE=cat
2487 fi
2488fi
Damien Miller670a4b82000-01-22 13:53:11 +11002489AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002490if test "$MANTYPE" = "doc"; then
2491 mansubdir=man;
2492else
2493 mansubdir=$MANTYPE;
2494fi
2495AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002496
Damien Millera22ba012000-03-02 23:09:20 +11002497# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002498MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002499AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002500 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002501 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002502 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002503 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002504 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002505 fi
2506 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002507)
2508
Damien Millera22ba012000-03-02 23:09:20 +11002509# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002510AC_ARG_WITH(shadow,
2511 [ --without-shadow Disable shadow password support],
2512 [
2513 if test "x$withval" = "xno" ; then
2514 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002515 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002516 fi
2517 ]
2518)
2519
Damien Miller1f335fb2000-06-26 11:31:33 +10002520if test -z "$disable_shadow" ; then
2521 AC_MSG_CHECKING([if the systems has expire shadow information])
2522 AC_TRY_COMPILE(
2523 [
2524#include <sys/types.h>
2525#include <shadow.h>
2526 struct spwd sp;
2527 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2528 [ sp_expire_available=yes ], []
2529 )
2530
2531 if test "x$sp_expire_available" = "xyes" ; then
2532 AC_MSG_RESULT(yes)
2533 AC_DEFINE(HAS_SHADOW_EXPIRE)
2534 else
2535 AC_MSG_RESULT(no)
2536 fi
2537fi
2538
Damien Millera22ba012000-03-02 23:09:20 +11002539# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002540if test ! -z "$IPADDR_IN_DISPLAY" ; then
2541 DISPLAY_HACK_MSG="yes"
2542 AC_DEFINE(IPADDR_IN_DISPLAY)
2543else
Damien Millera8e06ce2003-11-21 23:48:55 +11002544 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002545 AC_ARG_WITH(ipaddr-display,
2546 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2547 [
2548 if test "x$withval" != "xno" ; then
2549 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002550 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002551 fi
2552 ]
2553 )
2554fi
Damien Miller76112de1999-12-21 11:18:08 +11002555
Darren Tuckere1a790d2003-09-16 11:52:19 +10002556# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002557AC_ARG_ENABLE(etc-default-login,
2558 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
Darren Tuckera0c2b392004-09-11 23:26:37 +10002559 [ AC_CHECK_FILE("/etc/default/login",
2560 [ external_path_file=/etc/default/login ])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002561
Darren Tucker623d92f2004-09-12 22:36:15 +10002562 if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
2563 then
Darren Tuckera0c2b392004-09-11 23:26:37 +10002564 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2565 elif test "x$external_path_file" = "x/etc/default/login"; then
2566 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2567 fi
2568 ]
2569)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002570
Tim Rice43a1c132002-04-17 21:19:14 -07002571dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2572if test $ac_cv_func_login_getcapbool = "yes" -a \
2573 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002574 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002575fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002576
Damien Millera22ba012000-03-02 23:09:20 +11002577# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002578SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002579AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002580 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002581 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002582 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002583 AC_MSG_WARN([
2584--with-default-path=PATH has no effect on this system.
2585Edit /etc/login.conf instead.])
2586 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002587 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002588 AC_MSG_WARN([
2589--with-default-path=PATH will only be used if PATH is not defined in
2590$external_path_file .])
2591 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002592 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002593 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002594 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002595 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002596 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2597 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002598 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002599 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002600 AC_MSG_WARN([
2601If PATH is defined in $external_path_file, ensure the path to scp is included,
2602otherwise scp will not work.])
2603 fi
2604 AC_TRY_RUN(
2605 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002606/* find out what STDPATH is */
2607#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002608#ifdef HAVE_PATHS_H
2609# include <paths.h>
2610#endif
2611#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002612# ifdef _PATH_USERPATH /* Irix */
2613# define _PATH_STDPATH _PATH_USERPATH
2614# else
2615# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2616# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002617#endif
2618#include <sys/types.h>
2619#include <sys/stat.h>
2620#include <fcntl.h>
2621#define DATA "conftest.stdpath"
2622
2623main()
2624{
2625 FILE *fd;
2626 int rc;
2627
2628 fd = fopen(DATA,"w");
2629 if(fd == NULL)
2630 exit(1);
2631
2632 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2633 exit(1);
2634
2635 exit(0);
2636}
2637 ], [ user_path=`cat conftest.stdpath` ],
2638 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2639 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2640 )
2641# make sure $bindir is in USER_PATH so scp will work
2642 t_bindir=`eval echo ${bindir}`
2643 case $t_bindir in
2644 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2645 esac
2646 case $t_bindir in
2647 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2648 esac
2649 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2650 if test $? -ne 0 ; then
2651 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2652 if test $? -ne 0 ; then
2653 user_path=$user_path:$t_bindir
2654 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2655 fi
2656 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002657 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002658)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002659if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002660 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2661 AC_SUBST(user_path)
2662fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002663
Damien Millera18bbd32002-05-13 10:48:57 +10002664# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002665AC_ARG_WITH(superuser-path,
2666 [ --with-superuser-path= Specify different path for super-user],
2667 [
2668 if test "x$withval" != "xno" ; then
2669 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2670 superuser_path=$withval
2671 fi
2672 ]
2673)
2674
2675
Damien Miller61e50f12000-05-08 20:49:37 +10002676AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002677IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002678AC_ARG_WITH(4in6,
2679 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2680 [
2681 if test "x$withval" != "xno" ; then
2682 AC_MSG_RESULT(yes)
2683 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002684 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002685 else
2686 AC_MSG_RESULT(no)
2687 fi
2688 ],[
2689 if test "x$inet6_default_4in6" = "xyes"; then
2690 AC_MSG_RESULT([yes (default)])
2691 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002692 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002693 else
2694 AC_MSG_RESULT([no (default)])
2695 fi
2696 ]
2697)
2698
Damien Miller60396b02001-02-18 17:01:00 +11002699# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002700BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002701AC_ARG_WITH(bsd-auth,
2702 [ --with-bsd-auth Enable BSD auth support],
2703 [
2704 if test "x$withval" != "xno" ; then
2705 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002706 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002707 fi
2708 ]
2709)
2710
Damien Millera22ba012000-03-02 23:09:20 +11002711# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002712piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002713# make sure the directory exists
2714if test ! -d $piddir ; then
2715 piddir=`eval echo ${sysconfdir}`
2716 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002717 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002718 esac
2719fi
2720
Tim Rice88f2ab52002-03-17 12:17:34 -08002721AC_ARG_WITH(pid-dir,
2722 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2723 [
2724 if test "x$withval" != "xno" ; then
2725 piddir=$withval
2726 if test ! -d $piddir ; then
2727 AC_MSG_WARN([** no $piddir directory on this system **])
2728 fi
2729 fi
2730 ]
2731)
2732
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002733AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002734AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002735
andre2ff7b5d2000-06-03 14:57:40 +00002736dnl allow user to disable some login recording features
2737AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002738 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002739 [
2740 if test "x$enableval" = "xno" ; then
2741 AC_DEFINE(DISABLE_LASTLOG)
2742 fi
2743 ]
andre2ff7b5d2000-06-03 14:57:40 +00002744)
2745AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002746 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002747 [
2748 if test "x$enableval" = "xno" ; then
2749 AC_DEFINE(DISABLE_UTMP)
2750 fi
2751 ]
andre2ff7b5d2000-06-03 14:57:40 +00002752)
2753AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002754 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002755 [
2756 if test "x$enableval" = "xno" ; then
2757 AC_DEFINE(DISABLE_UTMPX)
2758 fi
2759 ]
andre2ff7b5d2000-06-03 14:57:40 +00002760)
2761AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002762 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002763 [
2764 if test "x$enableval" = "xno" ; then
2765 AC_DEFINE(DISABLE_WTMP)
2766 fi
2767 ]
andre2ff7b5d2000-06-03 14:57:40 +00002768)
2769AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002770 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002771 [
2772 if test "x$enableval" = "xno" ; then
2773 AC_DEFINE(DISABLE_WTMPX)
2774 fi
2775 ]
andre2ff7b5d2000-06-03 14:57:40 +00002776)
2777AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002778 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002779 [
2780 if test "x$enableval" = "xno" ; then
2781 AC_DEFINE(DISABLE_LOGIN)
2782 fi
2783 ]
andre2ff7b5d2000-06-03 14:57:40 +00002784)
2785AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002786 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002787 [
2788 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002789 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002790 fi
2791 ]
andre2ff7b5d2000-06-03 14:57:40 +00002792)
2793AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002794 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002795 [
2796 if test "x$enableval" = "xno" ; then
2797 AC_DEFINE(DISABLE_PUTUTXLINE)
2798 fi
2799 ]
andre2ff7b5d2000-06-03 14:57:40 +00002800)
2801AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002802 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002803 [
2804 if test "x$withval" = "xno" ; then
2805 AC_DEFINE(DISABLE_LASTLOG)
2806 else
2807 conf_lastlog_location=$withval
2808 fi
2809 ]
2810)
andre2ff7b5d2000-06-03 14:57:40 +00002811
2812dnl lastlog, [uw]tmpx? detection
2813dnl NOTE: set the paths in the platform section to avoid the
2814dnl need for command-line parameters
2815dnl lastlog and [uw]tmp are subject to a file search if all else fails
2816
2817dnl lastlog detection
2818dnl NOTE: the code itself will detect if lastlog is a directory
2819AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2820AC_TRY_COMPILE([
2821#include <sys/types.h>
2822#include <utmp.h>
2823#ifdef HAVE_LASTLOG_H
2824# include <lastlog.h>
2825#endif
Damien Miller2994e082000-06-04 15:51:47 +10002826#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002827# include <paths.h>
2828#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002829#ifdef HAVE_LOGIN_H
2830# include <login.h>
2831#endif
andre2ff7b5d2000-06-03 14:57:40 +00002832 ],
2833 [ char *lastlog = LASTLOG_FILE; ],
2834 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002835 [
2836 AC_MSG_RESULT(no)
2837 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2838 AC_TRY_COMPILE([
2839#include <sys/types.h>
2840#include <utmp.h>
2841#ifdef HAVE_LASTLOG_H
2842# include <lastlog.h>
2843#endif
2844#ifdef HAVE_PATHS_H
2845# include <paths.h>
2846#endif
2847 ],
2848 [ char *lastlog = _PATH_LASTLOG; ],
2849 [ AC_MSG_RESULT(yes) ],
2850 [
andree441aa32000-06-12 22:34:38 +00002851 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002852 system_lastlog_path=no
2853 ])
2854 ]
andre2ff7b5d2000-06-03 14:57:40 +00002855)
Damien Miller2994e082000-06-04 15:51:47 +10002856
andre2ff7b5d2000-06-03 14:57:40 +00002857if test -z "$conf_lastlog_location"; then
2858 if test x"$system_lastlog_path" = x"no" ; then
2859 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002860 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002861 conf_lastlog_location=$f
2862 fi
2863 done
2864 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002865 AC_MSG_WARN([** Cannot find lastlog **])
2866 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002867 fi
2868 fi
2869fi
2870
2871if test -n "$conf_lastlog_location"; then
2872 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2873fi
2874
2875dnl utmp detection
2876AC_MSG_CHECKING([if your system defines UTMP_FILE])
2877AC_TRY_COMPILE([
2878#include <sys/types.h>
2879#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002880#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002881# include <paths.h>
2882#endif
2883 ],
2884 [ char *utmp = UTMP_FILE; ],
2885 [ AC_MSG_RESULT(yes) ],
2886 [ AC_MSG_RESULT(no)
2887 system_utmp_path=no ]
2888)
2889if test -z "$conf_utmp_location"; then
2890 if test x"$system_utmp_path" = x"no" ; then
2891 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2892 if test -f $f ; then
2893 conf_utmp_location=$f
2894 fi
2895 done
2896 if test -z "$conf_utmp_location"; then
2897 AC_DEFINE(DISABLE_UTMP)
2898 fi
2899 fi
2900fi
2901if test -n "$conf_utmp_location"; then
2902 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2903fi
2904
2905dnl wtmp detection
2906AC_MSG_CHECKING([if your system defines WTMP_FILE])
2907AC_TRY_COMPILE([
2908#include <sys/types.h>
2909#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002910#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002911# include <paths.h>
2912#endif
2913 ],
2914 [ char *wtmp = WTMP_FILE; ],
2915 [ AC_MSG_RESULT(yes) ],
2916 [ AC_MSG_RESULT(no)
2917 system_wtmp_path=no ]
2918)
2919if test -z "$conf_wtmp_location"; then
2920 if test x"$system_wtmp_path" = x"no" ; then
2921 for f in /usr/adm/wtmp /var/log/wtmp; do
2922 if test -f $f ; then
2923 conf_wtmp_location=$f
2924 fi
2925 done
2926 if test -z "$conf_wtmp_location"; then
2927 AC_DEFINE(DISABLE_WTMP)
2928 fi
2929 fi
2930fi
2931if test -n "$conf_wtmp_location"; then
2932 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2933fi
2934
2935
2936dnl utmpx detection - I don't know any system so perverse as to require
2937dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2938dnl there, though.
2939AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2940AC_TRY_COMPILE([
2941#include <sys/types.h>
2942#include <utmp.h>
2943#ifdef HAVE_UTMPX_H
2944#include <utmpx.h>
2945#endif
Damien Miller2994e082000-06-04 15:51:47 +10002946#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002947# include <paths.h>
2948#endif
2949 ],
2950 [ char *utmpx = UTMPX_FILE; ],
2951 [ AC_MSG_RESULT(yes) ],
2952 [ AC_MSG_RESULT(no)
2953 system_utmpx_path=no ]
2954)
2955if test -z "$conf_utmpx_location"; then
2956 if test x"$system_utmpx_path" = x"no" ; then
2957 AC_DEFINE(DISABLE_UTMPX)
2958 fi
2959else
2960 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2961fi
2962
2963dnl wtmpx detection
2964AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2965AC_TRY_COMPILE([
2966#include <sys/types.h>
2967#include <utmp.h>
2968#ifdef HAVE_UTMPX_H
2969#include <utmpx.h>
2970#endif
Damien Miller2994e082000-06-04 15:51:47 +10002971#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002972# include <paths.h>
2973#endif
2974 ],
2975 [ char *wtmpx = WTMPX_FILE; ],
2976 [ AC_MSG_RESULT(yes) ],
2977 [ AC_MSG_RESULT(no)
2978 system_wtmpx_path=no ]
2979)
2980if test -z "$conf_wtmpx_location"; then
2981 if test x"$system_wtmpx_path" = x"no" ; then
2982 AC_DEFINE(DISABLE_WTMPX)
2983 fi
2984else
2985 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2986fi
2987
Damien Miller4018c192000-04-30 09:30:44 +10002988
Damien Miller29ea30d2000-03-17 10:54:15 +11002989if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002990 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2991 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002992fi
2993
Tim Rice4cec93f2002-02-26 08:40:48 -08002994dnl remove pam and dl because they are in $LIBPAM
2995if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002996 LIBS=`echo $LIBS | sed 's/-lpam //'`
2997fi
2998if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2999 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003000fi
3001
Damien Millerbac2d8a2000-09-05 16:13:06 +11003002AC_EXEEXT
Tim Rice5af9db92004-06-19 19:31:06 -07003003AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
Tim Rice13aae5e2001-10-21 17:53:58 -07003004AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003005
Damien Miller7b22d652000-06-18 14:07:04 +10003006# Print summary of options
3007
Damien Miller7b22d652000-06-18 14:07:04 +10003008# Someone please show me a better way :)
3009A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3010B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3011C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3012D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003013E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003014F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003015G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003016H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3017I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3018J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003019
3020echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003021echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003022echo " User binaries: $B"
3023echo " System binaries: $C"
3024echo " Configuration files: $D"
3025echo " Askpass program: $E"
3026echo " Manual pages: $F"
3027echo " PID file: $G"
3028echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003029if test "x$external_path_file" = "x/etc/login.conf" ; then
3030echo " At runtime, sshd will use the path defined in $external_path_file"
3031echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003032else
Damien Millerf58c6722002-05-13 13:15:42 +10003033echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003034 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003035echo " (If PATH is set in $external_path_file it will be used instead. If"
3036echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3037 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003038fi
Damien Millera18bbd32002-05-13 10:48:57 +10003039if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003040echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003041fi
Damien Millerf58c6722002-05-13 13:15:42 +10003042echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003043echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003044echo " KerberosV support: $KRB5_MSG"
3045echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003046echo " S/KEY support: $SKEY_MSG"
3047echo " TCP Wrappers support: $TCPW_MSG"
3048echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003049echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003050echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3051echo " BSD Auth support: $BSD_AUTH_MSG"
3052echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003053if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003054echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003055fi
3056
Damien Miller7b22d652000-06-18 14:07:04 +10003057echo ""
3058
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003059echo " Host: ${host}"
3060echo " Compiler: ${CC}"
3061echo " Compiler flags: ${CFLAGS}"
3062echo "Preprocessor flags: ${CPPFLAGS}"
3063echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003064echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003065
3066echo ""
3067
Tim Rice6f1f7582004-05-30 21:38:51 -07003068if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003069 echo "SVR4 style packages are supported with \"make package\""
3070 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003071fi
3072
Damien Miller82cf0ce2000-12-20 13:34:48 +11003073if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003074 echo "PAM is enabled. You may need to install a PAM control file "
3075 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003076 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003077 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003078 echo ""
3079fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003080
Damien Miller6c21c512002-01-22 21:57:53 +11003081if test ! -z "$RAND_HELPER_CMDHASH" ; then
3082 echo "WARNING: you are using the builtin random number collection "
3083 echo "service. Please read WARNING.RNG and request that your OS "
3084 echo "vendor includes kernel-based random number collection in "
3085 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003086 echo ""
3087fi
Damien Miller60396b02001-02-18 17:01:00 +11003088
Damien Millerb4097182004-05-23 14:09:40 +10003089if test ! -z "$NO_PEERCHECK" ; then
3090 echo "WARNING: the operating system that you are using does not "
3091 echo "appear to support either the getpeereid() API nor the "
3092 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3093 echo "enforce security checks to prevent unauthorised connections to "
3094 echo "ssh-agent. Their absence increases the risk that a malicious "
3095 echo "user can connect to your agent. "
3096 echo ""
3097fi
3098