blob: 9b80c6a378c34494498a242ba62a9507a4c10634 [file] [log] [blame]
Darren Tuckera0c2b392004-09-11 23:26:37 +10001# $Id: configure.ac,v 1.229 2004/09/11 13:26:37 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
Tim Rice13aae5e2001-10-21 17:53:58 -070017AC_INIT
18AC_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
Tim Ricef028f1e2002-07-19 12:41:10 -0700223 LIBS="$LIBS -lsec"
224 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000225 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100226*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100227 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000228 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000229 AC_DEFINE(SETEUID_BREAKS_SETUID)
230 AC_DEFINE(BROKEN_SETREUID)
231 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000232 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000233 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100234 ;;
235*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100236 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000237 AC_DEFINE(WITH_IRIX_ARRAY)
238 AC_DEFINE(WITH_IRIX_PROJECT)
239 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000240 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000241 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000242 AC_DEFINE(SETEUID_BREAKS_SETUID)
243 AC_DEFINE(BROKEN_SETREUID)
244 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000245 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000246 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000247 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100248 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100249*-*-linux*)
250 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100251 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000252 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100253 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000254 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000255 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000256 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Darren Tuckere59b5082004-06-28 16:01:19 +1000257 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
Damien Miller7bcb0892000-03-11 20:45:40 +1100258 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000259 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000260 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000261 AC_DEFINE(BROKEN_CMSG_TYPE)
262 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000263 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100264 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000265mips-sony-bsd|mips-sony-newsos4)
266 AC_DEFINE(HAVE_NEWS4)
267 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000268 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100269*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000270 check_for_libcrypt_before=1
Tim Rice88368a32003-12-08 12:35:59 -0800271 if test "x$withval" != "xno" ; then
272 need_dash_r=1
273 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100274 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100275*-*-freebsd*)
276 check_for_libcrypt_later=1
277 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000278*-*-bsdi*)
279 AC_DEFINE(SETEUID_BREAKS_SETUID)
280 AC_DEFINE(BROKEN_SETREUID)
281 AC_DEFINE(BROKEN_SETREGID)
282 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000283*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000284 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100285 conf_utmp_location=/etc/utmp
286 conf_wtmp_location=/usr/adm/wtmp
287 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000288 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000289 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000290 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100291 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000292 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100293*-*-solaris*)
Tim Ricead4a1882004-02-29 15:53:37 -0800294 if test "x$withval" != "xno" ; then
295 need_dash_r=1
296 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100297 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000298 AC_DEFINE(LOGIN_NEEDS_UTMPX)
299 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000300 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker21dd0892004-08-16 23:12:05 +1000301 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID)
Darren Tuckere41bba52003-08-25 11:51:19 +1000302 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000303 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
304 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000305 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000306 # hardwire lastlog location (can't detect it on some versions)
307 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000308 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
309 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
310 if test "$sol2ver" -ge 8; then
311 AC_MSG_RESULT(yes)
312 AC_DEFINE(DISABLE_UTMP)
313 AC_DEFINE(DISABLE_WTMP)
314 else
315 AC_MSG_RESULT(no)
316 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100317 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000318*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000319 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000320 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100321 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000322 conf_utmp_location=/etc/utmp
323 conf_wtmp_location=/var/adm/wtmp
324 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000325 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000326 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000327*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700328 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000329 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000330 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000331 AC_DEFINE(SETEUID_BREAKS_SETUID)
332 AC_DEFINE(BROKEN_SETREUID)
333 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000334 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000335*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700336 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000337 AC_CHECK_LIB(dl, dlsym, ,)
Damien Millerfd9885e2001-01-10 08:16:53 +1100338 IPADDR_IN_DISPLAY=yes
339 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000340 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000341 AC_DEFINE(SETEUID_BREAKS_SETUID)
342 AC_DEFINE(BROKEN_SETREUID)
343 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000344 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000345 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700346 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
347 # Attention: always take care to bind libsocket and libnsl before libc,
348 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000349 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100350*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100351 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700352 AC_DEFINE(SETEUID_BREAKS_SETUID)
353 AC_DEFINE(BROKEN_SETREUID)
354 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100355 ;;
356*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100357 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700358 AC_DEFINE(SETEUID_BREAKS_SETUID)
359 AC_DEFINE(BROKEN_SETREUID)
360 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100361 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100362*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100363 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100364*-*-sco3.2v4*)
Tim Ricefcb62202004-01-23 18:35:16 -0800365 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize"
Tim Ricee8c898a2004-02-23 21:47:04 -0800366 LIBS="$LIBS -los -lprot -lcrypt_i -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100367 RANLIB=true
368 no_dev_ptmx=1
369 AC_DEFINE(BROKEN_SYS_TERMIO_H)
370 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000371 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000372 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100373 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Ricefe6d5aa2004-04-16 20:03:07 -0700374 AC_DEFINE(SETEUID_BREAKS_SETUID)
375 AC_DEFINE(BROKEN_SETREUID)
376 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700377 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100378 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700379 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700380 do_sco3_extra_lib_check=yes
Tim Ricef7ba8f62004-06-20 10:37:32 -0700381 TEST_SHELL=ksh
Damien Miller78315eb2000-09-29 23:01:36 +1100382 ;;
383*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800384 if test -z "$GCC"; then
385 CFLAGS="$CFLAGS -belf"
386 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100387 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000388 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100389 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000390 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000391 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700392 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700393 AC_DEFINE(SETEUID_BREAKS_SETUID)
394 AC_DEFINE(BROKEN_SETREUID)
395 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700396 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700397 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Miller217f5672001-02-16 12:12:41 +1100398 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700399 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700400 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000401 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000402*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100403 AC_DEFINE(NO_SSH_LASTLOG)
404 AC_DEFINE(SETEUID_BREAKS_SETUID)
405 AC_DEFINE(BROKEN_SETREUID)
406 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000407 AC_DEFINE(USE_PIPES)
408 AC_DEFINE(DISABLE_FD_PASSING)
409 LDFLAGS="$LDFLAGS"
410 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
411 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000412 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000413*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100414 AC_DEFINE(SETEUID_BREAKS_SETUID)
415 AC_DEFINE(BROKEN_SETREUID)
416 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000417 AC_DEFINE(WITH_ABBREV_NO_TTY)
418 AC_DEFINE(USE_PIPES)
419 AC_DEFINE(DISABLE_FD_PASSING)
420 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100421 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000422 MANTYPE=cat
423 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000424*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100425 AC_DEFINE(SETEUID_BREAKS_SETUID)
426 AC_DEFINE(BROKEN_SETREUID)
427 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000428 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700429 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700430 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000431 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
432 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
433 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700434 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000435*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000436 AC_MSG_CHECKING(for Digital Unix SIA)
437 no_osfsia=""
438 AC_ARG_WITH(osfsia,
439 [ --with-osfsia Enable Digital Unix SIA],
440 [
441 if test "x$withval" = "xno" ; then
442 AC_MSG_RESULT(disabled)
443 no_osfsia=1
444 fi
445 ],
446 )
447 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000448 if test -f /etc/sia/matrix.conf; then
449 AC_MSG_RESULT(yes)
450 AC_DEFINE(HAVE_OSF_SIA)
451 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000452 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000453 LIBS="$LIBS -lsecurity -ldb -lm -laud"
454 else
455 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100456 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000457 fi
458 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000459 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700460 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000461 AC_DEFINE(BROKEN_SETREUID)
462 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000463 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000464
465*-*-nto-qnx)
466 AC_DEFINE(USE_PIPES)
467 AC_DEFINE(NO_X11_UNIX_SOCKETS)
468 AC_DEFINE(MISSING_NFDBITS)
469 AC_DEFINE(MISSING_HOWMANY)
470 AC_DEFINE(MISSING_FD_MASK)
471 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100472esac
473
Damien Millere37bfc12000-06-05 09:37:43 +1000474# Allow user to specify flags
475AC_ARG_WITH(cflags,
476 [ --with-cflags Specify additional flags to pass to compiler],
477 [
478 if test "x$withval" != "xno" ; then
479 CFLAGS="$CFLAGS $withval"
480 fi
481 ]
482)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000483AC_ARG_WITH(cppflags,
484 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
485 [
486 if test "x$withval" != "xno"; then
487 CPPFLAGS="$CPPFLAGS $withval"
488 fi
489 ]
490)
Damien Millere37bfc12000-06-05 09:37:43 +1000491AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000492 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000493 [
494 if test "x$withval" != "xno" ; then
495 LDFLAGS="$LDFLAGS $withval"
496 fi
497 ]
498)
499AC_ARG_WITH(libs,
500 [ --with-libs Specify additional libraries to link with],
501 [
502 if test "x$withval" != "xno" ; then
503 LIBS="$LIBS $withval"
504 fi
505 ]
506)
507
Darren Tucker6eb93042003-06-29 21:30:41 +1000508AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000509AC_RUN_IFELSE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000510#include <stdio.h>
511int main(){exit(0);}
512 ],
513 [ AC_MSG_RESULT(yes) ],
514 [
515 AC_MSG_RESULT(no)
516 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000517 ],
518 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000519)
520
Tim Rice4cec93f2002-02-26 08:40:48 -0800521# Checks for header files.
Damien Miller36f49652004-08-15 18:40:59 +1000522AC_CHECK_HEADERS(bstring.h crypt.h dirent.h endian.h features.h \
523 floatingpoint.h getopt.h glob.h ia.h lastlog.h limits.h login.h \
524 login_cap.h maillock.h ndir.h netdb.h netgroup.h \
Damien Miller0f47c532004-01-02 18:01:30 +1100525 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000526 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Damien Miller36f49652004-08-15 18:40:59 +1000527 strings.h sys/dir.h sys/strtio.h sys/audit.h sys/bitypes.h \
528 sys/bsdtty.h sys/cdefs.h sys/mman.h sys/ndir.h sys/prctl.h \
Darren Tucker48d99d32004-08-29 17:04:50 +1000529 sys/pstat.h sys/select.h sys/stat.h sys/stream.h \
Damien Miller36f49652004-08-15 18:40:59 +1000530 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h sys/un.h \
531 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 -0800532
Darren Tucker48d99d32004-08-29 17:04:50 +1000533# sys/ptms.h requires sys/stream.h to be included first on Solaris
534AC_CHECK_HEADERS(sys/ptms.h, [], [], [
535#ifdef HAVE_SYS_STREAM_H
536# include <sys/stream.h>
537#endif
538])
539
Damien Millera22ba012000-03-02 23:09:20 +1100540# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700541AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
542AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000543
Damien Millerdf288022001-02-18 13:07:07 +1100544dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700545if test "x$with_tcp_wrappers" != "xno" ; then
546 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
547 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
548 fi
549fi
Damien Millerdf288022001-02-18 13:07:07 +1100550
Tim Rice1e1ef642003-09-11 22:19:31 -0700551dnl IRIX and Solaris 2.5.1 have dirname() in libgen
552AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
553 AC_CHECK_LIB(gen, dirname,[
554 AC_CACHE_CHECK([for broken dirname],
555 ac_cv_have_broken_dirname, [
556 save_LIBS="$LIBS"
557 LIBS="$LIBS -lgen"
558 AC_TRY_RUN(
559 [
560#include <libgen.h>
561#include <string.h>
562
563int main(int argc, char **argv) {
564 char *s, buf[32];
565
566 strncpy(buf,"/etc", 32);
567 s = dirname(buf);
568 if (!s || strncmp(s, "/", 32) != 0) {
569 exit(1);
570 } else {
571 exit(0);
572 }
573}
574 ],
575 [ ac_cv_have_broken_dirname="no" ],
576 [ ac_cv_have_broken_dirname="yes" ]
577 )
578 LIBS="$save_LIBS"
579 ])
580 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
581 LIBS="$LIBS -lgen"
582 AC_DEFINE(HAVE_DIRNAME)
583 AC_CHECK_HEADERS(libgen.h)
584 fi
585 ])
586])
587
588AC_CHECK_FUNC(getspnam, ,
589 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
590AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
591
Tim Rice13aae5e2001-10-21 17:53:58 -0700592dnl zlib is required
593AC_ARG_WITH(zlib,
594 [ --with-zlib=PATH Use zlib in PATH],
595 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000596 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100597 AC_MSG_ERROR([*** zlib is required ***])
598 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700599 if test -d "$withval/lib"; then
600 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700601 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700602 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700603 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700604 fi
605 else
606 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700607 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700608 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700609 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700610 fi
611 fi
612 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700613 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700614 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700615 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700616 fi
617 ]
618)
619
Tim Ricefcb62202004-01-23 18:35:16 -0800620AC_CHECK_LIB(z, deflate, ,
621 [
622 saved_CPPFLAGS="$CPPFLAGS"
623 saved_LDFLAGS="$LDFLAGS"
624 save_LIBS="$LIBS"
625 dnl Check default zlib install dir
626 if test -n "${need_dash_r}"; then
627 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
628 else
629 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
630 fi
631 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
632 LIBS="$LIBS -lz"
633 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
634 [
635 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
636 ]
637 )
638 ]
639)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100640AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100641
642AC_ARG_WITH(zlib-version-check,
643 [ --without-zlib-version-check Disable zlib version check],
644 [ if test "x$withval" = "xno" ; then
645 zlib_check_nonfatal=1
646 fi
647 ]
648)
649
Darren Tucker2dcd2392004-01-23 17:13:33 +1100650AC_MSG_CHECKING(for zlib 1.1.4 or greater)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000651AC_RUN_IFELSE([
Darren Tucker2dcd2392004-01-23 17:13:33 +1100652#include <zlib.h>
653int main()
654{
655 int a, b, c, v;
656 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
657 exit(1);
658 v = a*1000000 + b*1000 + c;
659 if (v >= 1001004)
660 exit(0);
661 exit(2);
662}
663 ],
664 AC_MSG_RESULT(yes),
665 [ AC_MSG_RESULT(no)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100666 if test -z "$zlib_check_nonfatal" ; then
667 AC_MSG_ERROR([*** zlib too old - check config.log ***
668Your reported zlib version has known security problems. It's possible your
669vendor has fixed these problems without changing the version number. If you
670are sure this is the case, you can disable the check by running
671"./configure --without-zlib-version-check".
672If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
673 else
674 AC_MSG_WARN([zlib version may have security problems])
675 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000676 ],
677 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100678)
Damien Miller6f9c3372000-10-25 10:06:04 +1100679
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000680dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100681AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000682 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
683)
Damien Millera8e06ce2003-11-21 23:48:55 +1100684AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700685 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
686 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000687)
Damien Millerab18c411999-11-11 10:40:23 +1100688
Tim Ricee589a292001-11-03 11:09:32 -0800689dnl Checks for libutil functions
690AC_CHECK_HEADERS(libutil.h)
691AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
692AC_CHECK_FUNCS(logout updwtmp logwtmp)
693
Ben Lindstrom8697e082001-02-24 21:41:10 +0000694AC_FUNC_STRFTIME
695
Damien Miller3c027682001-03-14 11:39:45 +1100696# Check for ALTDIRFUNC glob() extension
697AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
698AC_EGREP_CPP(FOUNDIT,
699 [
700 #include <glob.h>
701 #ifdef GLOB_ALTDIRFUNC
702 FOUNDIT
703 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100704 ],
Damien Miller3c027682001-03-14 11:39:45 +1100705 [
706 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
707 AC_MSG_RESULT(yes)
708 ],
709 [
710 AC_MSG_RESULT(no)
711 ]
712)
Damien Millerab18c411999-11-11 10:40:23 +1100713
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000714# Check for g.gl_matchc glob() extension
715AC_MSG_CHECKING(for gl_matchc field in glob_t)
716AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100717 [
718 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000719 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100720 ],
721 [
722 AC_DEFINE(GLOB_HAS_GL_MATCHC)
723 AC_MSG_RESULT(yes)
724 ],
725 [
726 AC_MSG_RESULT(no)
727 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000728)
729
Damien Miller18bb4732001-03-28 14:35:30 +1000730AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000731AC_RUN_IFELSE(
Damien Miller18bb4732001-03-28 14:35:30 +1000732 [
733#include <sys/types.h>
734#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700735int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000736 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100737 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000738 [
739 AC_MSG_RESULT(no)
740 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000741 ],
742 [
743 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
744 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000745 ]
746)
747
Damien Miller36f49652004-08-15 18:40:59 +1000748AC_MSG_CHECKING([for /proc/pid/fd directory])
749if test -d "/proc/$$/fd" ; then
750 AC_DEFINE(HAVE_PROC_PID)
751 AC_MSG_RESULT(yes)
752else
753 AC_MSG_RESULT(no)
754fi
755
Damien Millerc547bf12001-02-16 10:18:12 +1100756# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100757SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100758AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700759 [ --with-skey[[=PATH]] Enable S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100760 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100761 [
762 if test "x$withval" != "xno" ; then
763
764 if test "x$withval" != "xyes" ; then
765 CPPFLAGS="$CPPFLAGS -I${withval}/include"
766 LDFLAGS="$LDFLAGS -L${withval}/lib"
767 fi
768
769 AC_DEFINE(SKEY)
770 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100771 SKEY_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100772
Tim Rice4cec93f2002-02-26 08:40:48 -0800773 AC_MSG_CHECKING([for s/key support])
774 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100775 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800776#include <stdio.h>
777#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700778int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800779 ],
780 [AC_MSG_RESULT(yes)],
781 [
782 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100783 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
784 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000785 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
786 AC_TRY_COMPILE(
787 [#include <stdio.h>
788 #include <skey.h>],
789 [(void)skeychallenge(NULL,"name","",0);],
790 [AC_MSG_RESULT(yes)
791 AC_DEFINE(SKEYCHALLENGE_4ARG)],
792 [AC_MSG_RESULT(no)]
793 )
Damien Millerc547bf12001-02-16 10:18:12 +1100794 fi
795 ]
796)
797
798# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700799TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100800AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700801 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
Damien Millera8e06ce2003-11-21 23:48:55 +1100802 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100803 [
804 if test "x$withval" != "xno" ; then
805 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700806 saved_LDFLAGS="$LDFLAGS"
807 saved_CPPFLAGS="$CPPFLAGS"
808 if test -n "${withval}" -a "${withval}" != "yes"; then
809 if test -d "${withval}/lib"; then
810 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700811 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700812 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700813 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700814 fi
815 else
816 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700817 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700818 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700819 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700820 fi
821 fi
822 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700823 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700824 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700825 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700826 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700827 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800828 LIBWRAP="-lwrap"
829 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100830 AC_MSG_CHECKING(for libwrap)
831 AC_TRY_LINK(
832 [
Damien Miller0ac45002004-04-14 20:14:26 +1000833#include <sys/types.h>
834#include <sys/socket.h>
835#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100836#include <tcpd.h>
837 int deny_severity = 0, allow_severity = 0;
838 ],
839 [hosts_access(0);],
840 [
841 AC_MSG_RESULT(yes)
842 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800843 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700844 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100845 ],
846 [
847 AC_MSG_ERROR([*** libwrap missing])
848 ]
849 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800850 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100851 fi
852 ]
853)
854
Damien Millerfe1f1432003-02-24 15:45:42 +1100855dnl Checks for library functions. Please keep in alphabetical order
856AC_CHECK_FUNCS(\
Darren Tucker60bd4092004-06-25 14:03:34 +1000857 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
Damien Miller36f49652004-08-15 18:40:59 +1000858 bindresvport_sa clock closefrom dirfd fchmod fchown freeaddrinfo \
859 futimes getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000860 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100861 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000862 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100863 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000864 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100865 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000866 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000867 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100868 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100869)
Tim Rice13aae5e2001-10-21 17:53:58 -0700870
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000871# IRIX has a const char return value for gai_strerror()
872AC_CHECK_FUNCS(gai_strerror,[
873 AC_DEFINE(HAVE_GAI_STRERROR)
874 AC_TRY_COMPILE([
875#include <sys/types.h>
876#include <sys/socket.h>
877#include <netdb.h>
878
879const char *gai_strerror(int);],[
880char *str;
881
882str = gai_strerror(0);],[
883 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
884 [Define if gai_strerror() returns const char *])])])
885
Damien Millercd6853c2003-01-28 11:33:42 +1100886AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
887
Darren Tuckerf1159b52003-07-07 19:44:01 +1000888dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000889AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000890AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000891
Darren Tuckerb2427c82003-09-10 15:22:44 +1000892dnl tcsendbreak might be a macro
893AC_CHECK_DECL(tcsendbreak,
894 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100895 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000896 [#include <termios.h>]
897)
898
Darren Tucker5bb14002004-04-23 18:53:10 +1000899AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
900
Darren Tucker2a6b0292003-12-31 14:59:17 +1100901AC_CHECK_FUNCS(setresuid, [
902 dnl Some platorms have setresuid that isn't implemented, test for this
903 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000904 AC_RUN_IFELSE([
Darren Tuckere937be32003-12-17 18:53:26 +1100905#include <stdlib.h>
906#include <errno.h>
907int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100908 ],
909 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100910 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000911 AC_MSG_RESULT(not implemented)],
912 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100913 )
914])
Darren Tuckere937be32003-12-17 18:53:26 +1100915
Darren Tucker2a6b0292003-12-31 14:59:17 +1100916AC_CHECK_FUNCS(setresgid, [
917 dnl Some platorms have setresgid that isn't implemented, test for this
918 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000919 AC_RUN_IFELSE([
Darren Tuckere937be32003-12-17 18:53:26 +1100920#include <stdlib.h>
921#include <errno.h>
922int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100923 ],
924 [AC_MSG_RESULT(yes)],
925 [AC_DEFINE(BROKEN_SETRESGID)
Darren Tuckera0c2b392004-09-11 23:26:37 +1000926 AC_MSG_RESULT(not implemented)],
927 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +1100928 )
929])
Darren Tuckere937be32003-12-17 18:53:26 +1100930
Damien Millerad833b32000-08-23 10:46:23 +1000931dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000932AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000933dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000934AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000935AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000936dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000937AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000938AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100939
Damien Millera8e06ce2003-11-21 23:48:55 +1100940AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100941 [AC_DEFINE(HAVE_DAEMON)],
942 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
943)
944
Damien Millera8e06ce2003-11-21 23:48:55 +1100945AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100946 [AC_DEFINE(HAVE_GETPAGESIZE)],
947 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
948)
949
Damien Millercb170cb2000-07-01 16:52:55 +1000950# Check for broken snprintf
951if test "x$ac_cv_func_snprintf" = "xyes" ; then
952 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000953 AC_RUN_IFELSE(
Damien Millercb170cb2000-07-01 16:52:55 +1000954 [
955#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700956int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000957 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100958 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000959 [
960 AC_MSG_RESULT(no)
961 AC_DEFINE(BROKEN_SNPRINTF)
962 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000963 ],
964 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +1000965 )
966fi
967
Damien Millerb4097182004-05-23 14:09:40 +1000968# Check for missing getpeereid (or equiv) support
969NO_PEERCHECK=""
970if test "x$ac_cv_func_getpeereid" != "xyes" ; then
971 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
972 AC_TRY_COMPILE(
973 [#include <sys/types.h>
974 #include <sys/socket.h>],
975 [int i = SO_PEERCRED;],
976 [AC_MSG_RESULT(yes)],
977 [AC_MSG_RESULT(no)
978 NO_PEERCHECK=1]
979 )
980fi
981
Damien Millere8328192003-01-07 15:18:32 +1100982dnl see whether mkstemp() requires XXXXXX
983if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
984AC_MSG_CHECKING([for (overly) strict mkstemp])
985AC_TRY_RUN(
986 [
987#include <stdlib.h>
988main() { char template[]="conftest.mkstemp-test";
989if (mkstemp(template) == -1)
990 exit(1);
991unlink(template); exit(0);
992}
993 ],
994 [
995 AC_MSG_RESULT(no)
996 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100997 [
Damien Millere8328192003-01-07 15:18:32 +1100998 AC_MSG_RESULT(yes)
999 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1000 ],
1001 [
1002 AC_MSG_RESULT(yes)
1003 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001004 ]
Damien Millere8328192003-01-07 15:18:32 +11001005)
1006fi
1007
Darren Tucker70a3d552003-08-21 17:58:29 +10001008dnl make sure that openpty does not reacquire controlling terminal
1009if test ! -z "$check_for_openpty_ctty_bug"; then
1010 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1011 AC_TRY_RUN(
1012 [
1013#include <stdio.h>
1014#include <sys/fcntl.h>
1015#include <sys/types.h>
1016#include <sys/wait.h>
1017
1018int
1019main()
1020{
1021 pid_t pid;
1022 int fd, ptyfd, ttyfd, status;
1023
1024 pid = fork();
1025 if (pid < 0) { /* failed */
1026 exit(1);
1027 } else if (pid > 0) { /* parent */
1028 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001029 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001030 exit(WEXITSTATUS(status));
1031 else
1032 exit(2);
1033 } else { /* child */
1034 close(0); close(1); close(2);
1035 setsid();
1036 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1037 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1038 if (fd >= 0)
1039 exit(3); /* Acquired ctty: broken */
1040 else
1041 exit(0); /* Did not acquire ctty: OK */
1042 }
1043}
1044 ],
1045 [
1046 AC_MSG_RESULT(yes)
1047 ],
1048 [
1049 AC_MSG_RESULT(no)
1050 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1051 ]
1052 )
1053fi
1054
Darren Tucker4398cf52004-04-06 21:39:02 +10001055if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1056 AC_MSG_CHECKING(if getaddrinfo seems to work)
1057 AC_TRY_RUN(
1058 [
1059#include <stdio.h>
1060#include <sys/socket.h>
1061#include <netdb.h>
1062#include <errno.h>
1063#include <netinet/in.h>
1064
1065#define TEST_PORT "2222"
1066
1067int
1068main(void)
1069{
1070 int err, sock;
1071 struct addrinfo *gai_ai, *ai, hints;
1072 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1073
1074 memset(&hints, 0, sizeof(hints));
1075 hints.ai_family = PF_UNSPEC;
1076 hints.ai_socktype = SOCK_STREAM;
1077 hints.ai_flags = AI_PASSIVE;
1078
1079 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1080 if (err != 0) {
1081 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1082 exit(1);
1083 }
1084
1085 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1086 if (ai->ai_family != AF_INET6)
1087 continue;
1088
1089 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1090 sizeof(ntop), strport, sizeof(strport),
1091 NI_NUMERICHOST|NI_NUMERICSERV);
1092
1093 if (err != 0) {
1094 if (err == EAI_SYSTEM)
1095 perror("getnameinfo EAI_SYSTEM");
1096 else
1097 fprintf(stderr, "getnameinfo failed: %s\n",
1098 gai_strerror(err));
1099 exit(2);
1100 }
1101
1102 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1103 if (sock < 0)
1104 perror("socket");
1105 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1106 if (errno == EBADF)
1107 exit(3);
1108 }
1109 }
1110 exit(0);
1111}
1112 ],
1113 [
1114 AC_MSG_RESULT(yes)
1115 ],
1116 [
1117 AC_MSG_RESULT(no)
1118 AC_DEFINE(BROKEN_GETADDRINFO)
1119 ]
1120 )
1121fi
1122
Damien Miller606f8802000-09-16 15:39:56 +11001123AC_FUNC_GETPGRP
1124
Damien Millera64b57a2001-01-17 10:44:13 +11001125# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001126PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001127AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001128 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001129 [
Damien Millera64b57a2001-01-17 10:44:13 +11001130 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001131 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1132 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001133 AC_MSG_ERROR([PAM headers not found])
1134 fi
1135
1136 AC_CHECK_LIB(dl, dlopen, , )
1137 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1138 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001139 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001140
Damien Millera64b57a2001-01-17 10:44:13 +11001141 PAM_MSG="yes"
1142
1143 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001144 if test $ac_cv_lib_dl_dlopen = yes; then
1145 LIBPAM="-lpam -ldl"
1146 else
1147 LIBPAM="-lpam"
1148 fi
1149 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001150 fi
1151 ]
1152)
Damien Millera22ba012000-03-02 23:09:20 +11001153
Damien Millera64b57a2001-01-17 10:44:13 +11001154# Check for older PAM
1155if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001156 # Check PAM strerror arguments (old PAM)
1157 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1158 AC_TRY_COMPILE(
1159 [
Damien Miller81171112000-04-23 11:14:01 +10001160#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001161#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001162#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001163#elif defined (HAVE_PAM_PAM_APPL_H)
1164#include <pam/pam_appl.h>
1165#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001166 ],
1167 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001168 [AC_MSG_RESULT(no)],
1169 [
1170 AC_DEFINE(HAVE_OLD_PAM)
1171 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001172 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001173 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001174 )
Damien Millera22ba012000-03-02 23:09:20 +11001175fi
1176
Tim Riceaef73712002-05-11 13:17:42 -07001177# Search for OpenSSL
1178saved_CPPFLAGS="$CPPFLAGS"
1179saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001180AC_ARG_WITH(ssl-dir,
1181 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1182 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001183 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -07001184 if test -d "$withval/lib"; then
1185 if test -n "${need_dash_r}"; then
1186 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1187 else
1188 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1189 fi
1190 else
1191 if test -n "${need_dash_r}"; then
1192 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1193 else
1194 LDFLAGS="-L${withval} ${LDFLAGS}"
1195 fi
1196 fi
1197 if test -d "$withval/include"; then
1198 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1199 else
1200 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1201 fi
Damien Millera22ba012000-03-02 23:09:20 +11001202 fi
1203 ]
1204)
Tim Rice3d5352e2004-02-12 09:27:21 -08001205LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001206AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001207 [
Tim Riceaef73712002-05-11 13:17:42 -07001208 dnl Check default openssl install dir
1209 if test -n "${need_dash_r}"; then
1210 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001211 else
Tim Riceaef73712002-05-11 13:17:42 -07001212 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001213 fi
Tim Riceaef73712002-05-11 13:17:42 -07001214 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1215 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1216 [
1217 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1218 ]
1219 )
1220 ]
1221)
1222
Tim Riced730b782002-08-13 18:52:10 -07001223# Determine OpenSSL header version
1224AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001225AC_RUN_IFELSE(
Tim Riced730b782002-08-13 18:52:10 -07001226 [
1227#include <stdio.h>
1228#include <string.h>
1229#include <openssl/opensslv.h>
1230#define DATA "conftest.sslincver"
1231int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001232 FILE *fd;
1233 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001234
Damien Millera8e06ce2003-11-21 23:48:55 +11001235 fd = fopen(DATA,"w");
1236 if(fd == NULL)
1237 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001238
1239 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1240 exit(1);
1241
1242 exit(0);
1243}
1244 ],
1245 [
1246 ssl_header_ver=`cat conftest.sslincver`
1247 AC_MSG_RESULT($ssl_header_ver)
1248 ],
1249 [
1250 AC_MSG_RESULT(not found)
1251 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001252 ],
1253 [
1254 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001255 ]
1256)
1257
1258# Determine OpenSSL library version
1259AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001260AC_RUN_IFELSE(
Tim Riced730b782002-08-13 18:52:10 -07001261 [
1262#include <stdio.h>
1263#include <string.h>
1264#include <openssl/opensslv.h>
1265#include <openssl/crypto.h>
1266#define DATA "conftest.ssllibver"
1267int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001268 FILE *fd;
1269 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001270
Damien Millera8e06ce2003-11-21 23:48:55 +11001271 fd = fopen(DATA,"w");
1272 if(fd == NULL)
1273 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001274
1275 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1276 exit(1);
1277
1278 exit(0);
1279}
1280 ],
1281 [
1282 ssl_library_ver=`cat conftest.ssllibver`
1283 AC_MSG_RESULT($ssl_library_ver)
1284 ],
1285 [
1286 AC_MSG_RESULT(not found)
1287 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001288 ],
1289 [
1290 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001291 ]
1292)
Damien Millera22ba012000-03-02 23:09:20 +11001293
Damien Millerec932372002-01-22 22:16:03 +11001294# Sanity check OpenSSL headers
1295AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001296AC_RUN_IFELSE(
Damien Millerec932372002-01-22 22:16:03 +11001297 [
1298#include <string.h>
1299#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001300int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001301 ],
1302 [
1303 AC_MSG_RESULT(yes)
1304 ],
1305 [
1306 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001307 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1308Check config.log for details.
1309Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001310 ],
1311 [
1312 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001313 ]
1314)
1315
Tim Rice3d5352e2004-02-12 09:27:21 -08001316# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1317# because the system crypt() is more featureful.
1318if test "x$check_for_libcrypt_before" = "x1"; then
1319 AC_CHECK_LIB(crypt, crypt)
1320fi
1321
Damien Millera8e06ce2003-11-21 23:48:55 +11001322# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001323# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001324if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001325 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001326fi
1327
Damien Miller6c21c512002-01-22 21:57:53 +11001328
1329### Configure cryptographic random number support
1330
1331# Check wheter OpenSSL seeds itself
1332AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001333AC_RUN_IFELSE(
Damien Miller6c21c512002-01-22 21:57:53 +11001334 [
1335#include <string.h>
1336#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001337int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001338 ],
1339 [
1340 OPENSSL_SEEDS_ITSELF=yes
1341 AC_MSG_RESULT(yes)
1342 ],
1343 [
1344 AC_MSG_RESULT(no)
1345 # Default to use of the rand helper if OpenSSL doesn't
1346 # seed itself
1347 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001348 ],
1349 [
1350 AC_MSG_WARN([cross compiling: assuming yes])
1351 # This is safe, since all recent OpenSSL versions will
1352 # complain at runtime if not seeded correctly.
1353 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001354 ]
1355)
1356
1357
1358# Do we want to force the use of the rand helper?
1359AC_ARG_WITH(rand-helper,
1360 [ --with-rand-helper Use subprocess to gather strong randomness ],
1361 [
1362 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001363 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001364 # the previous test showed it to be unseeded.
1365 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1366 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1367 OPENSSL_SEEDS_ITSELF=yes
1368 USE_RAND_HELPER=""
1369 fi
1370 else
1371 USE_RAND_HELPER=yes
1372 fi
1373 ],
1374)
1375
1376# Which randomness source do we use?
1377if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1378 # OpenSSL only
1379 AC_DEFINE(OPENSSL_PRNG_ONLY)
1380 RAND_MSG="OpenSSL internal ONLY"
1381 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001382elif test ! -z "$USE_RAND_HELPER" ; then
1383 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001384 RAND_MSG="ssh-rand-helper"
1385 INSTALL_SSH_RAND_HELPER="yes"
1386fi
1387AC_SUBST(INSTALL_SSH_RAND_HELPER)
1388
1389### Configuration of ssh-rand-helper
1390
1391# PRNGD TCP socket
1392AC_ARG_WITH(prngd-port,
1393 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1394 [
Damien Millere996d722002-01-23 11:20:59 +11001395 case "$withval" in
1396 no)
1397 withval=""
1398 ;;
1399 [[0-9]]*)
1400 ;;
1401 *)
1402 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1403 ;;
1404 esac
1405 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001406 PRNGD_PORT="$withval"
1407 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1408 fi
1409 ]
1410)
1411
1412# PRNGD Unix domain socket
1413AC_ARG_WITH(prngd-socket,
1414 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1415 [
Damien Millere996d722002-01-23 11:20:59 +11001416 case "$withval" in
1417 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001418 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001419 ;;
1420 no)
1421 withval=""
1422 ;;
1423 /*)
1424 ;;
1425 *)
1426 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1427 ;;
1428 esac
1429
1430 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001431 if test ! -z "$PRNGD_PORT" ; then
1432 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1433 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001434 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001435 AC_MSG_WARN(Entropy socket is not readable)
1436 fi
1437 PRNGD_SOCKET="$withval"
1438 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1439 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001440 ],
1441 [
1442 # Check for existing socket only if we don't have a random device already
1443 if test "$USE_RAND_HELPER" = yes ; then
1444 AC_MSG_CHECKING(for PRNGD/EGD socket)
1445 # Insert other locations here
1446 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1447 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1448 PRNGD_SOCKET="$sock"
1449 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1450 break;
1451 fi
1452 done
1453 if test ! -z "$PRNGD_SOCKET" ; then
1454 AC_MSG_RESULT($PRNGD_SOCKET)
1455 else
1456 AC_MSG_RESULT(not found)
1457 fi
1458 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001459 ]
1460)
1461
1462# Change default command timeout for hashing entropy source
1463entropy_timeout=200
1464AC_ARG_WITH(entropy-timeout,
1465 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1466 [
1467 if test "x$withval" != "xno" ; then
1468 entropy_timeout=$withval
1469 fi
1470 ]
1471)
Damien Miller6c21c512002-01-22 21:57:53 +11001472AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1473
Damien Millerd3f6ad22002-06-25 10:24:47 +10001474SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001475AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001476 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001477 [
1478 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001479 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001480 fi
1481 ]
1482)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001483AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1484AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001485
Tim Rice88f2ab52002-03-17 12:17:34 -08001486# We do this little dance with the search path to insure
1487# that programs that we select for use by installed programs
1488# (which may be run by the super-user) come from trusted
1489# locations before they come from the user's private area.
1490# This should help avoid accidentally configuring some
1491# random version of a program in someone's personal bin.
1492
1493OPATH=$PATH
1494PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001495test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001496test -d /sbin && PATH=$PATH:/sbin
1497test -d /usr/sbin && PATH=$PATH:/usr/sbin
1498PATH=$PATH:/etc:$OPATH
1499
Damien Millera8e06ce2003-11-21 23:48:55 +11001500# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001501OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1502OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1503OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1504OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1505OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1506OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1507OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1508OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1509OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1510OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1511OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1512OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1513OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1514OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1515OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1516OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001517# restore PATH
1518PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001519
1520# Where does ssh-rand-helper get its randomness from?
1521INSTALL_SSH_PRNG_CMDS=""
1522if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1523 if test ! -z "$PRNGD_PORT" ; then
1524 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1525 elif test ! -z "$PRNGD_SOCKET" ; then
1526 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1527 else
1528 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1529 RAND_HELPER_CMDHASH=yes
1530 INSTALL_SSH_PRNG_CMDS="yes"
1531 fi
1532fi
1533AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1534
1535
Ben Lindstromb5628642000-10-18 00:02:25 +00001536# Cheap hack to ensure NEWS-OS libraries are arranged right.
1537if test ! -z "$SONY" ; then
1538 LIBS="$LIBS -liberty";
1539fi
1540
Damien Millera22ba012000-03-02 23:09:20 +11001541# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001542AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001543AC_CHECK_SIZEOF(short int, 2)
1544AC_CHECK_SIZEOF(int, 4)
1545AC_CHECK_SIZEOF(long int, 4)
1546AC_CHECK_SIZEOF(long long int, 8)
1547
Damien Millerfa2bb692002-04-23 23:22:25 +10001548# Sanity check long long for some platforms (AIX)
1549if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1550 ac_cv_sizeof_long_long_int=0
1551fi
1552
Damien Millera22ba012000-03-02 23:09:20 +11001553# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001554AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1555 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001556 [ #include <sys/types.h> ],
1557 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001558 [ ac_cv_have_u_int="yes" ],
1559 [ ac_cv_have_u_int="no" ]
1560 )
1561])
1562if test "x$ac_cv_have_u_int" = "xyes" ; then
1563 AC_DEFINE(HAVE_U_INT)
1564 have_u_int=1
1565fi
1566
Damien Miller61e50f12000-05-08 20:49:37 +10001567AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1568 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001569 [ #include <sys/types.h> ],
1570 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001571 [ ac_cv_have_intxx_t="yes" ],
1572 [ ac_cv_have_intxx_t="no" ]
1573 )
1574])
1575if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1576 AC_DEFINE(HAVE_INTXX_T)
1577 have_intxx_t=1
1578fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001579
1580if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001581 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001582then
1583 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1584 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001585 [ #include <stdint.h> ],
1586 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001587 [
1588 AC_DEFINE(HAVE_INTXX_T)
1589 AC_MSG_RESULT(yes)
1590 ],
1591 [ AC_MSG_RESULT(no) ]
1592 )
1593fi
1594
Damien Miller578783e2000-09-23 14:12:24 +11001595AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1596 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001597 [
1598#include <sys/types.h>
1599#ifdef HAVE_STDINT_H
1600# include <stdint.h>
1601#endif
1602#include <sys/socket.h>
1603#ifdef HAVE_SYS_BITYPES_H
1604# include <sys/bitypes.h>
1605#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001606 ],
1607 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001608 [ ac_cv_have_int64_t="yes" ],
1609 [ ac_cv_have_int64_t="no" ]
1610 )
1611])
1612if test "x$ac_cv_have_int64_t" = "xyes" ; then
1613 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001614fi
1615
Damien Miller61e50f12000-05-08 20:49:37 +10001616AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1617 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001618 [ #include <sys/types.h> ],
1619 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001620 [ ac_cv_have_u_intxx_t="yes" ],
1621 [ ac_cv_have_u_intxx_t="no" ]
1622 )
1623])
1624if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1625 AC_DEFINE(HAVE_U_INTXX_T)
1626 have_u_intxx_t=1
1627fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001628
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001629if test -z "$have_u_intxx_t" ; then
1630 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1631 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001632 [ #include <sys/socket.h> ],
1633 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001634 [
1635 AC_DEFINE(HAVE_U_INTXX_T)
1636 AC_MSG_RESULT(yes)
1637 ],
1638 [ AC_MSG_RESULT(no) ]
1639 )
1640fi
1641
Damien Miller578783e2000-09-23 14:12:24 +11001642AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1643 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001644 [ #include <sys/types.h> ],
1645 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001646 [ ac_cv_have_u_int64_t="yes" ],
1647 [ ac_cv_have_u_int64_t="no" ]
1648 )
1649])
1650if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1651 AC_DEFINE(HAVE_U_INT64_T)
1652 have_u_int64_t=1
1653fi
1654
Tim Rice4cec93f2002-02-26 08:40:48 -08001655if test -z "$have_u_int64_t" ; then
1656 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1657 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001658 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001659 [ u_int64_t a; a = 1],
1660 [
1661 AC_DEFINE(HAVE_U_INT64_T)
1662 AC_MSG_RESULT(yes)
1663 ],
1664 [ AC_MSG_RESULT(no) ]
1665 )
1666fi
1667
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001668if test -z "$have_u_intxx_t" ; then
1669 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1670 AC_TRY_COMPILE(
1671 [
1672#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001673 ],
1674 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001675 [ ac_cv_have_uintxx_t="yes" ],
1676 [ ac_cv_have_uintxx_t="no" ]
1677 )
1678 ])
1679 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1680 AC_DEFINE(HAVE_UINTXX_T)
1681 fi
1682fi
1683
1684if test -z "$have_uintxx_t" ; then
1685 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1686 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001687 [ #include <stdint.h> ],
1688 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001689 [
1690 AC_DEFINE(HAVE_UINTXX_T)
1691 AC_MSG_RESULT(yes)
1692 ],
1693 [ AC_MSG_RESULT(no) ]
1694 )
1695fi
1696
Damien Milleredb82922000-06-20 13:25:52 +10001697if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001698 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001699then
1700 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1701 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001702 [
1703#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001704 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001705 [
Damien Miller70494d12000-04-03 15:57:06 +10001706 int8_t a; int16_t b; int32_t c;
1707 u_int8_t e; u_int16_t f; u_int32_t g;
1708 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001709 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001710 [
1711 AC_DEFINE(HAVE_U_INTXX_T)
1712 AC_DEFINE(HAVE_INTXX_T)
1713 AC_MSG_RESULT(yes)
1714 ],
1715 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001716 )
Damien Millerb29ea912000-01-15 14:12:03 +11001717fi
1718
Damien Miller58be7382001-09-15 21:31:54 +10001719
1720AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1721 AC_TRY_COMPILE(
1722 [
1723#include <sys/types.h>
1724 ],
1725 [ u_char foo; foo = 125; ],
1726 [ ac_cv_have_u_char="yes" ],
1727 [ ac_cv_have_u_char="no" ]
1728 )
1729])
1730if test "x$ac_cv_have_u_char" = "xyes" ; then
1731 AC_DEFINE(HAVE_U_CHAR)
1732fi
1733
Tim Rice13aae5e2001-10-21 17:53:58 -07001734TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001735
Tim Rice200a5c02002-02-26 22:12:34 -08001736AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001737
Damien Miller61e50f12000-05-08 20:49:37 +10001738AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1739 AC_TRY_COMPILE(
1740 [
1741#include <sys/types.h>
1742 ],
1743 [ size_t foo; foo = 1235; ],
1744 [ ac_cv_have_size_t="yes" ],
1745 [ ac_cv_have_size_t="no" ]
1746 )
1747])
1748if test "x$ac_cv_have_size_t" = "xyes" ; then
1749 AC_DEFINE(HAVE_SIZE_T)
1750fi
Damien Miller95058511999-12-29 10:36:45 +11001751
Damien Miller615f9392000-05-17 22:53:33 +10001752AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1753 AC_TRY_COMPILE(
1754 [
1755#include <sys/types.h>
1756 ],
1757 [ ssize_t foo; foo = 1235; ],
1758 [ ac_cv_have_ssize_t="yes" ],
1759 [ ac_cv_have_ssize_t="no" ]
1760 )
1761])
1762if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1763 AC_DEFINE(HAVE_SSIZE_T)
1764fi
1765
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001766AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1767 AC_TRY_COMPILE(
1768 [
1769#include <time.h>
1770 ],
1771 [ clock_t foo; foo = 1235; ],
1772 [ ac_cv_have_clock_t="yes" ],
1773 [ ac_cv_have_clock_t="no" ]
1774 )
1775])
1776if test "x$ac_cv_have_clock_t" = "xyes" ; then
1777 AC_DEFINE(HAVE_CLOCK_T)
1778fi
1779
Damien Millerb54b40e2000-06-23 08:23:34 +10001780AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1781 AC_TRY_COMPILE(
1782 [
1783#include <sys/types.h>
1784#include <sys/socket.h>
1785 ],
1786 [ sa_family_t foo; foo = 1235; ],
1787 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001788 [ AC_TRY_COMPILE(
1789 [
1790#include <sys/types.h>
1791#include <sys/socket.h>
1792#include <netinet/in.h>
1793 ],
1794 [ sa_family_t foo; foo = 1235; ],
1795 [ ac_cv_have_sa_family_t="yes" ],
1796
Damien Millerb54b40e2000-06-23 08:23:34 +10001797 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001798 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001799 )
1800])
1801if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1802 AC_DEFINE(HAVE_SA_FAMILY_T)
1803fi
1804
Damien Miller0f91b4e2000-06-18 15:43:25 +10001805AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1806 AC_TRY_COMPILE(
1807 [
1808#include <sys/types.h>
1809 ],
1810 [ pid_t foo; foo = 1235; ],
1811 [ ac_cv_have_pid_t="yes" ],
1812 [ ac_cv_have_pid_t="no" ]
1813 )
1814])
1815if test "x$ac_cv_have_pid_t" = "xyes" ; then
1816 AC_DEFINE(HAVE_PID_T)
1817fi
1818
1819AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1820 AC_TRY_COMPILE(
1821 [
1822#include <sys/types.h>
1823 ],
1824 [ mode_t foo; foo = 1235; ],
1825 [ ac_cv_have_mode_t="yes" ],
1826 [ ac_cv_have_mode_t="no" ]
1827 )
1828])
1829if test "x$ac_cv_have_mode_t" = "xyes" ; then
1830 AC_DEFINE(HAVE_MODE_T)
1831fi
1832
Damien Miller61e50f12000-05-08 20:49:37 +10001833
1834AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1835 AC_TRY_COMPILE(
1836 [
Damien Miller81171112000-04-23 11:14:01 +10001837#include <sys/types.h>
1838#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001839 ],
1840 [ struct sockaddr_storage s; ],
1841 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1842 [ ac_cv_have_struct_sockaddr_storage="no" ]
1843 )
1844])
1845if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1846 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1847fi
Damien Miller34132e52000-01-14 15:45:46 +11001848
Damien Miller61e50f12000-05-08 20:49:37 +10001849AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1850 AC_TRY_COMPILE(
1851 [
Damien Miller7b22d652000-06-18 14:07:04 +10001852#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001853#include <netinet/in.h>
1854 ],
1855 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1856 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1857 [ ac_cv_have_struct_sockaddr_in6="no" ]
1858 )
1859])
1860if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1861 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1862fi
Damien Miller34132e52000-01-14 15:45:46 +11001863
Damien Miller61e50f12000-05-08 20:49:37 +10001864AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1865 AC_TRY_COMPILE(
1866 [
Damien Miller7b22d652000-06-18 14:07:04 +10001867#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001868#include <netinet/in.h>
1869 ],
1870 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1871 [ ac_cv_have_struct_in6_addr="yes" ],
1872 [ ac_cv_have_struct_in6_addr="no" ]
1873 )
1874])
1875if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1876 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1877fi
Damien Miller34132e52000-01-14 15:45:46 +11001878
Damien Miller61e50f12000-05-08 20:49:37 +10001879AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1880 AC_TRY_COMPILE(
1881 [
Damien Miller81171112000-04-23 11:14:01 +10001882#include <sys/types.h>
1883#include <sys/socket.h>
1884#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001885 ],
1886 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1887 [ ac_cv_have_struct_addrinfo="yes" ],
1888 [ ac_cv_have_struct_addrinfo="no" ]
1889 )
1890])
1891if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1892 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1893fi
1894
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001895AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1896 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001897 [ #include <sys/time.h> ],
1898 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001899 [ ac_cv_have_struct_timeval="yes" ],
1900 [ ac_cv_have_struct_timeval="no" ]
1901 )
1902])
1903if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1904 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1905 have_struct_timeval=1
1906fi
1907
Tim Rice4e4dc562003-03-18 10:21:40 -08001908AC_CHECK_TYPES(struct timespec)
1909
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001910# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001911if test "x$ac_cv_have_int64_t" = "xno" -a \
1912 "x$ac_cv_sizeof_long_int" != "x8" -a \
1913 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001914 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1915 echo "an alternative compiler (I.E., GCC) before continuing."
1916 echo ""
1917 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001918else
1919dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001920 AC_RUN_IFELSE(
Tim Ricebee3f222001-03-11 17:32:12 -08001921 [
1922#include <stdio.h>
1923#include <string.h>
1924#ifdef HAVE_SNPRINTF
1925main()
1926{
1927 char buf[50];
1928 char expected_out[50];
1929 int mazsize = 50 ;
1930#if (SIZEOF_LONG_INT == 8)
1931 long int num = 0x7fffffffffffffff;
1932#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001933 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001934#endif
1935 strcpy(expected_out, "9223372036854775807");
1936 snprintf(buf, mazsize, "%lld", num);
1937 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001938 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001939 exit(0);
1940}
1941#else
1942main() { exit(0); }
1943#endif
Darren Tuckera0c2b392004-09-11 23:26:37 +10001944 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
1945 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08001946 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001947fi
1948
Damien Miller78315eb2000-09-29 23:01:36 +11001949dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001950OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1951OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1952OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1953OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1954OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001955OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001956OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1957OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001958OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001959OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1960OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1961OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1962OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001963OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1964OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1965OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1966OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001967
1968AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001969
Damien Miller61e50f12000-05-08 20:49:37 +10001970AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1971 ac_cv_have_ss_family_in_struct_ss, [
1972 AC_TRY_COMPILE(
1973 [
Damien Miller81171112000-04-23 11:14:01 +10001974#include <sys/types.h>
1975#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001976 ],
1977 [ struct sockaddr_storage s; s.ss_family = 1; ],
1978 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1979 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1980 )
1981])
1982if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1983 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1984fi
1985
Damien Miller61e50f12000-05-08 20:49:37 +10001986AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1987 ac_cv_have___ss_family_in_struct_ss, [
1988 AC_TRY_COMPILE(
1989 [
Damien Miller81171112000-04-23 11:14:01 +10001990#include <sys/types.h>
1991#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001992 ],
1993 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1994 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1995 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1996 )
1997])
1998if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1999 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
2000fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002001
Damien Millerad833b32000-08-23 10:46:23 +10002002AC_CACHE_CHECK([for pw_class field in struct passwd],
2003 ac_cv_have_pw_class_in_struct_passwd, [
2004 AC_TRY_COMPILE(
2005 [
Damien Millerad833b32000-08-23 10:46:23 +10002006#include <pwd.h>
2007 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002008 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002009 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2010 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2011 )
2012])
2013if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2014 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
2015fi
2016
Kevin Steves82456952001-06-22 21:14:18 +00002017AC_CACHE_CHECK([for pw_expire field in struct passwd],
2018 ac_cv_have_pw_expire_in_struct_passwd, [
2019 AC_TRY_COMPILE(
2020 [
2021#include <pwd.h>
2022 ],
2023 [ struct passwd p; p.pw_expire = 0; ],
2024 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2025 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2026 )
2027])
2028if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2029 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
2030fi
2031
2032AC_CACHE_CHECK([for pw_change field in struct passwd],
2033 ac_cv_have_pw_change_in_struct_passwd, [
2034 AC_TRY_COMPILE(
2035 [
2036#include <pwd.h>
2037 ],
2038 [ struct passwd p; p.pw_change = 0; ],
2039 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2040 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2041 )
2042])
2043if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2044 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2045fi
Damien Miller61e50f12000-05-08 20:49:37 +10002046
Tim Rice28bbb0c2002-05-27 17:37:32 -07002047dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002048AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2049 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002050 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002051 [
Tim Riceae49fe62002-04-12 10:26:21 -07002052#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002053#include <sys/socket.h>
2054#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002055int main() {
2056#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002057#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002058exit(1);
2059#endif
2060struct msghdr m;
2061m.msg_accrights = 0;
2062exit(0);
2063}
Kevin Steves939c9db2002-03-22 17:23:25 +00002064 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002065 [ ac_cv_have_accrights_in_msghdr="yes" ],
2066 [ ac_cv_have_accrights_in_msghdr="no" ]
2067 )
2068])
2069if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2070 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2071fi
2072
Kevin Stevesa44e0352002-04-07 16:18:03 +00002073AC_CACHE_CHECK([for msg_control field in struct msghdr],
2074 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002075 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002076 [
Tim Riceae49fe62002-04-12 10:26:21 -07002077#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002078#include <sys/socket.h>
2079#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002080int main() {
2081#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002082#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002083exit(1);
2084#endif
2085struct msghdr m;
2086m.msg_control = 0;
2087exit(0);
2088}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002089 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002090 [ ac_cv_have_control_in_msghdr="yes" ],
2091 [ ac_cv_have_control_in_msghdr="no" ]
2092 )
2093])
2094if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2095 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2096fi
2097
Damien Miller61e50f12000-05-08 20:49:37 +10002098AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002099 AC_TRY_LINK([],
2100 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002101 [ ac_cv_libc_defines___progname="yes" ],
2102 [ ac_cv_libc_defines___progname="no" ]
2103 )
2104])
2105if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2106 AC_DEFINE(HAVE___PROGNAME)
2107fi
2108
Kevin Steves4846f4a2002-03-22 18:19:53 +00002109AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2110 AC_TRY_LINK([
2111#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002112],
2113 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002114 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2115 [ ac_cv_cc_implements___FUNCTION__="no" ]
2116 )
2117])
2118if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2119 AC_DEFINE(HAVE___FUNCTION__)
2120fi
2121
2122AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2123 AC_TRY_LINK([
2124#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002125],
2126 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002127 [ ac_cv_cc_implements___func__="yes" ],
2128 [ ac_cv_cc_implements___func__="no" ]
2129 )
2130])
2131if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2132 AC_DEFINE(HAVE___func__)
2133fi
2134
Damien Miller4f8e6692001-07-14 13:22:53 +10002135AC_CACHE_CHECK([whether getopt has optreset support],
2136 ac_cv_have_getopt_optreset, [
2137 AC_TRY_LINK(
2138 [
2139#include <getopt.h>
2140 ],
2141 [ extern int optreset; optreset = 0; ],
2142 [ ac_cv_have_getopt_optreset="yes" ],
2143 [ ac_cv_have_getopt_optreset="no" ]
2144 )
2145])
2146if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2147 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2148fi
Damien Millera22ba012000-03-02 23:09:20 +11002149
Damien Millerecbb26d2000-07-15 14:59:14 +10002150AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002151 AC_TRY_LINK([],
2152 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002153 [ ac_cv_libc_defines_sys_errlist="yes" ],
2154 [ ac_cv_libc_defines_sys_errlist="no" ]
2155 )
2156])
2157if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2158 AC_DEFINE(HAVE_SYS_ERRLIST)
2159fi
2160
2161
Damien Miller11fa2cc2000-08-16 10:35:58 +10002162AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002163 AC_TRY_LINK([],
2164 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002165 [ ac_cv_libc_defines_sys_nerr="yes" ],
2166 [ ac_cv_libc_defines_sys_nerr="no" ]
2167 )
2168])
2169if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2170 AC_DEFINE(HAVE_SYS_NERR)
2171fi
2172
Damien Millera8e06ce2003-11-21 23:48:55 +11002173SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002174# Check whether user wants sectok support
2175AC_ARG_WITH(sectok,
2176 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002177 [
2178 if test "x$withval" != "xno" ; then
2179 if test "x$withval" != "xyes" ; then
2180 CPPFLAGS="$CPPFLAGS -I${withval}"
2181 LDFLAGS="$LDFLAGS -L${withval}"
2182 if test ! -z "$need_dash_r" ; then
2183 LDFLAGS="$LDFLAGS -R${withval}"
2184 fi
2185 if test ! -z "$blibpath" ; then
2186 blibpath="$blibpath:${withval}"
2187 fi
2188 fi
2189 AC_CHECK_HEADERS(sectok.h)
2190 if test "$ac_cv_header_sectok_h" != yes; then
2191 AC_MSG_ERROR(Can't find sectok.h)
2192 fi
2193 AC_CHECK_LIB(sectok, sectok_open)
2194 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2195 AC_MSG_ERROR(Can't find libsectok)
2196 fi
2197 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002198 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002199 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002200 fi
2201 ]
2202)
2203
2204# Check whether user wants OpenSC support
2205AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10002206 AC_HELP_STRING([--with-opensc=PFX],
2207 [Enable smartcard support using OpenSC]),
2208 opensc_config_prefix="$withval", opensc_config_prefix="")
2209if test x$opensc_config_prefix != x ; then
2210 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2211 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2212 if test "$OPENSC_CONFIG" != "no"; then
2213 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2214 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2215 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2216 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2217 AC_DEFINE(SMARTCARD)
2218 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11002219 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10002220 fi
2221fi
Damien Miller85de5802001-09-18 14:01:11 +10002222
Darren Tucker5f88d342003-10-15 16:57:57 +10002223# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002224AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002225 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002226 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002227 # Needed by our getrrsetbyname()
2228 AC_SEARCH_LIBS(res_query, resolv)
2229 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002230 AC_MSG_CHECKING(if res_query will link)
2231 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2232 [AC_MSG_RESULT(no)
2233 saved_LIBS="$LIBS"
2234 LIBS="$LIBS -lresolv"
2235 AC_MSG_CHECKING(for res_query in -lresolv)
2236 AC_LINK_IFELSE([
2237#include <resolv.h>
2238int main()
2239{
2240 res_query (0, 0, 0, 0, 0);
2241 return 0;
2242}
2243 ],
2244 [LIBS="$LIBS -lresolv"
2245 AC_MSG_RESULT(yes)],
2246 [LIBS="$saved_LIBS"
2247 AC_MSG_RESULT(no)])
2248 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002249 AC_CHECK_FUNCS(_getshort _getlong)
2250 AC_CHECK_MEMBER(HEADER.ad,
2251 [AC_DEFINE(HAVE_HEADER_AD)],,
2252 [#include <arpa/nameser.h>])
2253 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002254
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002255# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002256KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002257AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002258 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002259 [ if test "x$withval" != "xno" ; then
2260 if test "x$withval" = "xyes" ; then
2261 KRB5ROOT="/usr/local"
2262 else
2263 KRB5ROOT=${withval}
2264 fi
2265
2266 AC_DEFINE(KRB5)
2267 KRB5_MSG="yes"
2268
2269 AC_MSG_CHECKING(for krb5-config)
2270 if test -x $KRB5ROOT/bin/krb5-config ; then
2271 KRB5CONF=$KRB5ROOT/bin/krb5-config
2272 AC_MSG_RESULT($KRB5CONF)
2273
2274 AC_MSG_CHECKING(for gssapi support)
2275 if $KRB5CONF | grep gssapi >/dev/null ; then
2276 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002277 AC_DEFINE(GSSAPI)
2278 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002279 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002280 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002281 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002282 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002283 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2284 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002285 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002286 AC_MSG_CHECKING(whether we are using Heimdal)
2287 AC_TRY_COMPILE([ #include <krb5.h> ],
2288 [ char *tmp = heimdal_version; ],
2289 [ AC_MSG_RESULT(yes)
2290 AC_DEFINE(HEIMDAL) ],
2291 AC_MSG_RESULT(no)
2292 )
2293 else
2294 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002295 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002296 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002297 AC_MSG_CHECKING(whether we are using Heimdal)
2298 AC_TRY_COMPILE([ #include <krb5.h> ],
2299 [ char *tmp = heimdal_version; ],
2300 [ AC_MSG_RESULT(yes)
2301 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002302 K5LIBS="-lkrb5 -ldes"
2303 K5LIBS="$K5LIBS -lcom_err -lasn1"
2304 AC_CHECK_LIB(roken, net_write,
2305 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002306 ],
2307 [ AC_MSG_RESULT(no)
2308 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2309 ]
2310 )
Damien Miller200d0a72003-06-30 19:21:36 +10002311 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002312
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002313 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2314 [ AC_DEFINE(GSSAPI)
2315 K5LIBS="-lgssapi $K5LIBS" ],
2316 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2317 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002318 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002319 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2320 $K5LIBS)
2321 ],
2322 $K5LIBS)
2323
2324 AC_CHECK_HEADER(gssapi.h, ,
2325 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002326 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002327 AC_CHECK_HEADERS(gssapi.h, ,
2328 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002329 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002330 ]
2331 )
2332
2333 oldCPP="$CPPFLAGS"
2334 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2335 AC_CHECK_HEADER(gssapi_krb5.h, ,
2336 [ CPPFLAGS="$oldCPP" ])
2337
Damien Millera8e06ce2003-11-21 23:48:55 +11002338 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002339 if test ! -z "$need_dash_r" ; then
2340 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2341 fi
2342 if test ! -z "$blibpath" ; then
2343 blibpath="$blibpath:${KRB5ROOT}/lib"
2344 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002345 fi
2346
2347 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2348 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2349 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2350
2351 LIBS="$LIBS $K5LIBS"
2352 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002353 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002354 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002355)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002356
Damien Millera22ba012000-03-02 23:09:20 +11002357# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002358
Damien Millerf58c6722002-05-13 13:15:42 +10002359PRIVSEP_PATH=/var/empty
2360AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002361 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002362 [
2363 if test "x$withval" != "$no" ; then
2364 PRIVSEP_PATH=$withval
2365 fi
2366 ]
2367)
2368AC_SUBST(PRIVSEP_PATH)
2369
Damien Millera22ba012000-03-02 23:09:20 +11002370AC_ARG_WITH(xauth,
2371 [ --with-xauth=PATH Specify path to xauth program ],
2372 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002373 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002374 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002375 fi
2376 ],
2377 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002378 TestPath="$PATH"
2379 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2380 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2381 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2382 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2383 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002384 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002385 xauth_path="/usr/openwin/bin/xauth"
2386 fi
2387 ]
2388)
2389
Damien Miller7d901272003-01-13 16:55:22 +11002390STRIP_OPT=-s
2391AC_ARG_ENABLE(strip,
2392 [ --disable-strip Disable calling strip(1) on install],
2393 [
2394 if test "x$enableval" = "xno" ; then
2395 STRIP_OPT=
2396 fi
2397 ]
2398)
2399AC_SUBST(STRIP_OPT)
2400
Damien Millera19cf472000-11-29 13:28:50 +11002401if test -z "$xauth_path" ; then
2402 XAUTH_PATH="undefined"
2403 AC_SUBST(XAUTH_PATH)
2404else
Damien Millera22ba012000-03-02 23:09:20 +11002405 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002406 XAUTH_PATH=$xauth_path
2407 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002408fi
Damien Millera22ba012000-03-02 23:09:20 +11002409
2410# Check for mail directory (last resort if we cannot get it from headers)
2411if test ! -z "$MAIL" ; then
2412 maildir=`dirname $MAIL`
2413 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2414fi
2415
Darren Tuckera0c2b392004-09-11 23:26:37 +10002416if test ! -z "$cross_compiling"; then
2417 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
2418 disable_ptmx_check=yes
2419fi
Damien Millera22ba012000-03-02 23:09:20 +11002420if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002421 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002422 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002423 [
2424 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2425 have_dev_ptmx=1
2426 ]
2427 )
2428 fi
Damien Millera22ba012000-03-02 23:09:20 +11002429fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10002430
2431if test -z "$cross_compiling"; then
2432 AC_CHECK_FILE("/dev/ptc",
2433 [
2434 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2435 have_dev_ptc=1
2436 ]
2437 )
2438else
2439 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
2440fi
Damien Miller204ad072000-03-02 23:56:12 +11002441
Damien Millera22ba012000-03-02 23:09:20 +11002442# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002443AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002444 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002445 [
Damien Miller897741e2001-04-16 10:41:46 +10002446 case "$withval" in
2447 man|cat|doc)
2448 MANTYPE=$withval
2449 ;;
2450 *)
2451 AC_MSG_ERROR(invalid man type: $withval)
2452 ;;
2453 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002454 ]
2455)
Ben Lindstrombc709922001-04-18 18:04:21 +00002456if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002457 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2458 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002459 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2460 MANTYPE=doc
2461 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2462 MANTYPE=man
2463 else
2464 MANTYPE=cat
2465 fi
2466fi
Damien Miller670a4b82000-01-22 13:53:11 +11002467AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002468if test "$MANTYPE" = "doc"; then
2469 mansubdir=man;
2470else
2471 mansubdir=$MANTYPE;
2472fi
2473AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002474
Damien Millera22ba012000-03-02 23:09:20 +11002475# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002476MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002477AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002478 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002479 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002480 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002481 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002482 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002483 fi
2484 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002485)
2486
Damien Millera22ba012000-03-02 23:09:20 +11002487# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002488AC_ARG_WITH(shadow,
2489 [ --without-shadow Disable shadow password support],
2490 [
2491 if test "x$withval" = "xno" ; then
2492 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002493 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002494 fi
2495 ]
2496)
2497
Damien Miller1f335fb2000-06-26 11:31:33 +10002498if test -z "$disable_shadow" ; then
2499 AC_MSG_CHECKING([if the systems has expire shadow information])
2500 AC_TRY_COMPILE(
2501 [
2502#include <sys/types.h>
2503#include <shadow.h>
2504 struct spwd sp;
2505 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2506 [ sp_expire_available=yes ], []
2507 )
2508
2509 if test "x$sp_expire_available" = "xyes" ; then
2510 AC_MSG_RESULT(yes)
2511 AC_DEFINE(HAS_SHADOW_EXPIRE)
2512 else
2513 AC_MSG_RESULT(no)
2514 fi
2515fi
2516
Damien Millera22ba012000-03-02 23:09:20 +11002517# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002518if test ! -z "$IPADDR_IN_DISPLAY" ; then
2519 DISPLAY_HACK_MSG="yes"
2520 AC_DEFINE(IPADDR_IN_DISPLAY)
2521else
Damien Millera8e06ce2003-11-21 23:48:55 +11002522 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002523 AC_ARG_WITH(ipaddr-display,
2524 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2525 [
2526 if test "x$withval" != "xno" ; then
2527 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002528 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002529 fi
2530 ]
2531 )
2532fi
Damien Miller76112de1999-12-21 11:18:08 +11002533
Darren Tuckere1a790d2003-09-16 11:52:19 +10002534# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002535AC_ARG_ENABLE(etc-default-login,
2536 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
Darren Tuckera0c2b392004-09-11 23:26:37 +10002537 [ AC_CHECK_FILE("/etc/default/login",
2538 [ external_path_file=/etc/default/login ])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002539
Darren Tuckera0c2b392004-09-11 23:26:37 +10002540 if test ! -z "$cross_compiling"; then
2541 AC_MSG_WARN([cross compiling: Disabling /etc/default/login test])
2542 elif test "x$external_path_file" = "x/etc/default/login"; then
2543 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2544 fi
2545 ]
2546)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002547
Tim Rice43a1c132002-04-17 21:19:14 -07002548dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2549if test $ac_cv_func_login_getcapbool = "yes" -a \
2550 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002551 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002552fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002553
Damien Millera22ba012000-03-02 23:09:20 +11002554# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002555SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002556AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002557 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002558 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002559 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002560 AC_MSG_WARN([
2561--with-default-path=PATH has no effect on this system.
2562Edit /etc/login.conf instead.])
2563 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002564 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002565 AC_MSG_WARN([
2566--with-default-path=PATH will only be used if PATH is not defined in
2567$external_path_file .])
2568 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002569 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002570 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002571 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002572 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002573 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2574 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002575 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002576 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002577 AC_MSG_WARN([
2578If PATH is defined in $external_path_file, ensure the path to scp is included,
2579otherwise scp will not work.])
2580 fi
2581 AC_TRY_RUN(
2582 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002583/* find out what STDPATH is */
2584#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002585#ifdef HAVE_PATHS_H
2586# include <paths.h>
2587#endif
2588#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002589# ifdef _PATH_USERPATH /* Irix */
2590# define _PATH_STDPATH _PATH_USERPATH
2591# else
2592# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2593# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002594#endif
2595#include <sys/types.h>
2596#include <sys/stat.h>
2597#include <fcntl.h>
2598#define DATA "conftest.stdpath"
2599
2600main()
2601{
2602 FILE *fd;
2603 int rc;
2604
2605 fd = fopen(DATA,"w");
2606 if(fd == NULL)
2607 exit(1);
2608
2609 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2610 exit(1);
2611
2612 exit(0);
2613}
2614 ], [ user_path=`cat conftest.stdpath` ],
2615 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2616 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2617 )
2618# make sure $bindir is in USER_PATH so scp will work
2619 t_bindir=`eval echo ${bindir}`
2620 case $t_bindir in
2621 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2622 esac
2623 case $t_bindir in
2624 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2625 esac
2626 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2627 if test $? -ne 0 ; then
2628 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2629 if test $? -ne 0 ; then
2630 user_path=$user_path:$t_bindir
2631 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2632 fi
2633 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002634 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002635)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002636if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002637 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2638 AC_SUBST(user_path)
2639fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002640
Damien Millera18bbd32002-05-13 10:48:57 +10002641# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002642AC_ARG_WITH(superuser-path,
2643 [ --with-superuser-path= Specify different path for super-user],
2644 [
2645 if test "x$withval" != "xno" ; then
2646 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2647 superuser_path=$withval
2648 fi
2649 ]
2650)
2651
2652
Damien Miller61e50f12000-05-08 20:49:37 +10002653AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002654IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002655AC_ARG_WITH(4in6,
2656 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2657 [
2658 if test "x$withval" != "xno" ; then
2659 AC_MSG_RESULT(yes)
2660 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002661 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002662 else
2663 AC_MSG_RESULT(no)
2664 fi
2665 ],[
2666 if test "x$inet6_default_4in6" = "xyes"; then
2667 AC_MSG_RESULT([yes (default)])
2668 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002669 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002670 else
2671 AC_MSG_RESULT([no (default)])
2672 fi
2673 ]
2674)
2675
Damien Miller60396b02001-02-18 17:01:00 +11002676# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002677BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002678AC_ARG_WITH(bsd-auth,
2679 [ --with-bsd-auth Enable BSD auth support],
2680 [
2681 if test "x$withval" != "xno" ; then
2682 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002683 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002684 fi
2685 ]
2686)
2687
Damien Millera22ba012000-03-02 23:09:20 +11002688# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002689piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002690# make sure the directory exists
2691if test ! -d $piddir ; then
2692 piddir=`eval echo ${sysconfdir}`
2693 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002694 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002695 esac
2696fi
2697
Tim Rice88f2ab52002-03-17 12:17:34 -08002698AC_ARG_WITH(pid-dir,
2699 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2700 [
2701 if test "x$withval" != "xno" ; then
2702 piddir=$withval
2703 if test ! -d $piddir ; then
2704 AC_MSG_WARN([** no $piddir directory on this system **])
2705 fi
2706 fi
2707 ]
2708)
2709
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002710AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002711AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002712
andre2ff7b5d2000-06-03 14:57:40 +00002713dnl allow user to disable some login recording features
2714AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002715 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002716 [
2717 if test "x$enableval" = "xno" ; then
2718 AC_DEFINE(DISABLE_LASTLOG)
2719 fi
2720 ]
andre2ff7b5d2000-06-03 14:57:40 +00002721)
2722AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002723 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002724 [
2725 if test "x$enableval" = "xno" ; then
2726 AC_DEFINE(DISABLE_UTMP)
2727 fi
2728 ]
andre2ff7b5d2000-06-03 14:57:40 +00002729)
2730AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002731 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002732 [
2733 if test "x$enableval" = "xno" ; then
2734 AC_DEFINE(DISABLE_UTMPX)
2735 fi
2736 ]
andre2ff7b5d2000-06-03 14:57:40 +00002737)
2738AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002739 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002740 [
2741 if test "x$enableval" = "xno" ; then
2742 AC_DEFINE(DISABLE_WTMP)
2743 fi
2744 ]
andre2ff7b5d2000-06-03 14:57:40 +00002745)
2746AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002747 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002748 [
2749 if test "x$enableval" = "xno" ; then
2750 AC_DEFINE(DISABLE_WTMPX)
2751 fi
2752 ]
andre2ff7b5d2000-06-03 14:57:40 +00002753)
2754AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002755 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002756 [
2757 if test "x$enableval" = "xno" ; then
2758 AC_DEFINE(DISABLE_LOGIN)
2759 fi
2760 ]
andre2ff7b5d2000-06-03 14:57:40 +00002761)
2762AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002763 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002764 [
2765 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002766 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002767 fi
2768 ]
andre2ff7b5d2000-06-03 14:57:40 +00002769)
2770AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002771 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002772 [
2773 if test "x$enableval" = "xno" ; then
2774 AC_DEFINE(DISABLE_PUTUTXLINE)
2775 fi
2776 ]
andre2ff7b5d2000-06-03 14:57:40 +00002777)
2778AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002779 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002780 [
2781 if test "x$withval" = "xno" ; then
2782 AC_DEFINE(DISABLE_LASTLOG)
2783 else
2784 conf_lastlog_location=$withval
2785 fi
2786 ]
2787)
andre2ff7b5d2000-06-03 14:57:40 +00002788
2789dnl lastlog, [uw]tmpx? detection
2790dnl NOTE: set the paths in the platform section to avoid the
2791dnl need for command-line parameters
2792dnl lastlog and [uw]tmp are subject to a file search if all else fails
2793
2794dnl lastlog detection
2795dnl NOTE: the code itself will detect if lastlog is a directory
2796AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2797AC_TRY_COMPILE([
2798#include <sys/types.h>
2799#include <utmp.h>
2800#ifdef HAVE_LASTLOG_H
2801# include <lastlog.h>
2802#endif
Damien Miller2994e082000-06-04 15:51:47 +10002803#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002804# include <paths.h>
2805#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002806#ifdef HAVE_LOGIN_H
2807# include <login.h>
2808#endif
andre2ff7b5d2000-06-03 14:57:40 +00002809 ],
2810 [ char *lastlog = LASTLOG_FILE; ],
2811 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002812 [
2813 AC_MSG_RESULT(no)
2814 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2815 AC_TRY_COMPILE([
2816#include <sys/types.h>
2817#include <utmp.h>
2818#ifdef HAVE_LASTLOG_H
2819# include <lastlog.h>
2820#endif
2821#ifdef HAVE_PATHS_H
2822# include <paths.h>
2823#endif
2824 ],
2825 [ char *lastlog = _PATH_LASTLOG; ],
2826 [ AC_MSG_RESULT(yes) ],
2827 [
andree441aa32000-06-12 22:34:38 +00002828 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002829 system_lastlog_path=no
2830 ])
2831 ]
andre2ff7b5d2000-06-03 14:57:40 +00002832)
Damien Miller2994e082000-06-04 15:51:47 +10002833
andre2ff7b5d2000-06-03 14:57:40 +00002834if test -z "$conf_lastlog_location"; then
2835 if test x"$system_lastlog_path" = x"no" ; then
2836 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002837 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002838 conf_lastlog_location=$f
2839 fi
2840 done
2841 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002842 AC_MSG_WARN([** Cannot find lastlog **])
2843 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002844 fi
2845 fi
2846fi
2847
2848if test -n "$conf_lastlog_location"; then
2849 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2850fi
2851
2852dnl utmp detection
2853AC_MSG_CHECKING([if your system defines UTMP_FILE])
2854AC_TRY_COMPILE([
2855#include <sys/types.h>
2856#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002857#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002858# include <paths.h>
2859#endif
2860 ],
2861 [ char *utmp = UTMP_FILE; ],
2862 [ AC_MSG_RESULT(yes) ],
2863 [ AC_MSG_RESULT(no)
2864 system_utmp_path=no ]
2865)
2866if test -z "$conf_utmp_location"; then
2867 if test x"$system_utmp_path" = x"no" ; then
2868 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2869 if test -f $f ; then
2870 conf_utmp_location=$f
2871 fi
2872 done
2873 if test -z "$conf_utmp_location"; then
2874 AC_DEFINE(DISABLE_UTMP)
2875 fi
2876 fi
2877fi
2878if test -n "$conf_utmp_location"; then
2879 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2880fi
2881
2882dnl wtmp detection
2883AC_MSG_CHECKING([if your system defines WTMP_FILE])
2884AC_TRY_COMPILE([
2885#include <sys/types.h>
2886#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002887#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002888# include <paths.h>
2889#endif
2890 ],
2891 [ char *wtmp = WTMP_FILE; ],
2892 [ AC_MSG_RESULT(yes) ],
2893 [ AC_MSG_RESULT(no)
2894 system_wtmp_path=no ]
2895)
2896if test -z "$conf_wtmp_location"; then
2897 if test x"$system_wtmp_path" = x"no" ; then
2898 for f in /usr/adm/wtmp /var/log/wtmp; do
2899 if test -f $f ; then
2900 conf_wtmp_location=$f
2901 fi
2902 done
2903 if test -z "$conf_wtmp_location"; then
2904 AC_DEFINE(DISABLE_WTMP)
2905 fi
2906 fi
2907fi
2908if test -n "$conf_wtmp_location"; then
2909 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2910fi
2911
2912
2913dnl utmpx detection - I don't know any system so perverse as to require
2914dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2915dnl there, though.
2916AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2917AC_TRY_COMPILE([
2918#include <sys/types.h>
2919#include <utmp.h>
2920#ifdef HAVE_UTMPX_H
2921#include <utmpx.h>
2922#endif
Damien Miller2994e082000-06-04 15:51:47 +10002923#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002924# include <paths.h>
2925#endif
2926 ],
2927 [ char *utmpx = UTMPX_FILE; ],
2928 [ AC_MSG_RESULT(yes) ],
2929 [ AC_MSG_RESULT(no)
2930 system_utmpx_path=no ]
2931)
2932if test -z "$conf_utmpx_location"; then
2933 if test x"$system_utmpx_path" = x"no" ; then
2934 AC_DEFINE(DISABLE_UTMPX)
2935 fi
2936else
2937 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2938fi
2939
2940dnl wtmpx detection
2941AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2942AC_TRY_COMPILE([
2943#include <sys/types.h>
2944#include <utmp.h>
2945#ifdef HAVE_UTMPX_H
2946#include <utmpx.h>
2947#endif
Damien Miller2994e082000-06-04 15:51:47 +10002948#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002949# include <paths.h>
2950#endif
2951 ],
2952 [ char *wtmpx = WTMPX_FILE; ],
2953 [ AC_MSG_RESULT(yes) ],
2954 [ AC_MSG_RESULT(no)
2955 system_wtmpx_path=no ]
2956)
2957if test -z "$conf_wtmpx_location"; then
2958 if test x"$system_wtmpx_path" = x"no" ; then
2959 AC_DEFINE(DISABLE_WTMPX)
2960 fi
2961else
2962 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2963fi
2964
Damien Miller4018c192000-04-30 09:30:44 +10002965
Damien Miller29ea30d2000-03-17 10:54:15 +11002966if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002967 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2968 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002969fi
2970
Tim Rice4cec93f2002-02-26 08:40:48 -08002971dnl remove pam and dl because they are in $LIBPAM
2972if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002973 LIBS=`echo $LIBS | sed 's/-lpam //'`
2974fi
2975if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2976 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002977fi
2978
Damien Millerbac2d8a2000-09-05 16:13:06 +11002979AC_EXEEXT
Tim Rice5af9db92004-06-19 19:31:06 -07002980AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
Tim Rice13aae5e2001-10-21 17:53:58 -07002981AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002982
Damien Miller7b22d652000-06-18 14:07:04 +10002983# Print summary of options
2984
Damien Miller7b22d652000-06-18 14:07:04 +10002985# Someone please show me a better way :)
2986A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2987B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2988C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2989D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002990E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002991F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002992G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002993H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2994I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2995J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002996
2997echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002998echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002999echo " User binaries: $B"
3000echo " System binaries: $C"
3001echo " Configuration files: $D"
3002echo " Askpass program: $E"
3003echo " Manual pages: $F"
3004echo " PID file: $G"
3005echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003006if test "x$external_path_file" = "x/etc/login.conf" ; then
3007echo " At runtime, sshd will use the path defined in $external_path_file"
3008echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003009else
Damien Millerf58c6722002-05-13 13:15:42 +10003010echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003011 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003012echo " (If PATH is set in $external_path_file it will be used instead. If"
3013echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3014 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003015fi
Damien Millera18bbd32002-05-13 10:48:57 +10003016if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003017echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003018fi
Damien Millerf58c6722002-05-13 13:15:42 +10003019echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003020echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003021echo " KerberosV support: $KRB5_MSG"
3022echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003023echo " S/KEY support: $SKEY_MSG"
3024echo " TCP Wrappers support: $TCPW_MSG"
3025echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003026echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003027echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3028echo " BSD Auth support: $BSD_AUTH_MSG"
3029echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003030if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003031echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003032fi
3033
Damien Miller7b22d652000-06-18 14:07:04 +10003034echo ""
3035
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003036echo " Host: ${host}"
3037echo " Compiler: ${CC}"
3038echo " Compiler flags: ${CFLAGS}"
3039echo "Preprocessor flags: ${CPPFLAGS}"
3040echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003041echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003042
3043echo ""
3044
Tim Rice6f1f7582004-05-30 21:38:51 -07003045if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003046 echo "SVR4 style packages are supported with \"make package\""
3047 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003048fi
3049
Damien Miller82cf0ce2000-12-20 13:34:48 +11003050if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003051 echo "PAM is enabled. You may need to install a PAM control file "
3052 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003053 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003054 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003055 echo ""
3056fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003057
Damien Miller6c21c512002-01-22 21:57:53 +11003058if test ! -z "$RAND_HELPER_CMDHASH" ; then
3059 echo "WARNING: you are using the builtin random number collection "
3060 echo "service. Please read WARNING.RNG and request that your OS "
3061 echo "vendor includes kernel-based random number collection in "
3062 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003063 echo ""
3064fi
Damien Miller60396b02001-02-18 17:01:00 +11003065
Damien Millerb4097182004-05-23 14:09:40 +10003066if test ! -z "$NO_PEERCHECK" ; then
3067 echo "WARNING: the operating system that you are using does not "
3068 echo "appear to support either the getpeereid() API nor the "
3069 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3070 echo "enforce security checks to prevent unauthorised connections to "
3071 echo "ssh-agent. Their absence increases the risk that a malicious "
3072 echo "user can connect to your agent. "
3073 echo ""
3074fi
3075