blob: 9f5d11935e47c48f75f1af67bf36272f71dcc049 [file] [log] [blame]
Tim Rice6f1f7582004-05-30 21:38:51 -07001# $Id: configure.ac,v 1.219 2004/05/31 04:38:51 tim 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 Riceb8fbb8e2001-04-21 14:31:52 -070031AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080032AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110033AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100034AC_PATH_PROG(ENT, ent)
35AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110036AC_PATH_PROG(TEST_MINUS_S_SH, bash)
37AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
38AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070039AC_PATH_PROG(SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110040
Tim Rice6f1f7582004-05-30 21:38:51 -070041dnl for buildpkg.sh
42AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
43 [/usr/sbin${PATH_SEPARATOR}/etc])
44AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
45 [/usr/sbin${PATH_SEPARATOR}/etc])
46AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
47
Damien Millere8bb4502001-09-25 16:39:35 +100048# System features
49AC_SYS_LARGEFILE
50
Damien Miller3f62aba2000-11-29 11:56:35 +110051if test -z "$AR" ; then
52 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
53fi
54
Damien Millerad833b32000-08-23 10:46:23 +100055# Use LOGIN_PROGRAM from environment if possible
56if test ! -z "$LOGIN_PROGRAM" ; then
57 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
58else
59 # Search for login
60 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
61 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
62 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
63 fi
64fi
65
Darren Tucker23bc8d02004-02-06 16:24:31 +110066AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
67if test ! -z "$PATH_PASSWD_PROG" ; then
68 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
69fi
70
Damien Miller166bd442000-03-16 10:48:25 +110071if test -z "$LD" ; then
72 LD=$CC
73fi
74AC_SUBST(LD)
75
Damien Miller166bd442000-03-16 10:48:25 +110076AC_C_INLINE
Damien Millera8e06ce2003-11-21 23:48:55 +110077if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Miller649d9992001-06-27 23:35:51 +100078 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110079fi
80
Tim Rice88368a32003-12-08 12:35:59 -080081AC_ARG_WITH(rpath,
82 [ --without-rpath Disable auto-added -R linker paths],
83 [
84 if test "x$withval" = "xno" ; then
85 need_dash_r=""
86 fi
87 if test "x$withval" = "xyes" ; then
88 need_dash_r=1
89 fi
90 ]
91)
92
Damien Millera22ba012000-03-02 23:09:20 +110093# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110094case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110095*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +110096 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +100097 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -080098 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +110099 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000100 saved_LDFLAGS="$LDFLAGS"
101 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
102 if (test -z "$blibflags"); then
103 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
104 AC_TRY_LINK([], [], [blibflags=$tryflags])
105 fi
106 done
107 if (test -z "$blibflags"); then
108 AC_MSG_RESULT(not found)
109 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
110 else
111 AC_MSG_RESULT($blibflags)
112 fi
113 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000114 dnl Check for authenticate. Might be in libs.a on older AIXes
115 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -0700116 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000117 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700118 LIBS="$LIBS -ls"
119 ])
120 ])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000121 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
122 AC_CHECK_DECL(loginfailed,
123 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
124 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000125 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000126 [(void)loginfailed("user","host","tty",0);],
127 [AC_MSG_RESULT(yes)
128 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000129 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000130 )],
131 [],
132 [#include <usersec.h>]
133 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000134 AC_CHECK_FUNCS(setauthdb)
Damien Millereca71f82000-01-20 22:38:27 +1100135 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +1000136 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000137 AC_DEFINE(SETEUID_BREAKS_SETUID)
138 AC_DEFINE(BROKEN_SETREUID)
139 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000140 dnl AIX handles lastlog as part of its login message
141 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000142 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000143 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100144 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100145*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100146 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800147 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100148 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000149 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100150 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100151 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000152 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000153 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700154 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +0000155 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100156 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000157*-*-dgux*)
158 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100159 AC_DEFINE(SETEUID_BREAKS_SETUID)
160 AC_DEFINE(BROKEN_SETREUID)
161 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000162 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000163*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000164 AC_MSG_CHECKING(if we have working getaddrinfo)
165 AC_TRY_RUN([#include <mach-o/dyld.h>
166main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
167 exit(0);
168 else
169 exit(1);
170}], [AC_MSG_RESULT(working)],
171 [AC_MSG_RESULT(buggy)
172 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700173 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000174 AC_DEFINE(SETEUID_BREAKS_SETUID)
175 AC_DEFINE(BROKEN_SETREUID)
176 AC_DEFINE(BROKEN_SETREGID)
Damien Miller7a2ea782004-01-02 17:52:10 +1100177 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000178 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000179*-*-hpux10.26)
180 if test -z "$GCC"; then
181 CFLAGS="$CFLAGS -Ae"
182 fi
183 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
184 IPADDR_IN_DISPLAY=yes
185 AC_DEFINE(HAVE_SECUREWARE)
186 AC_DEFINE(USE_PIPES)
187 AC_DEFINE(LOGIN_NO_ENDOPT)
188 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000189 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000190 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700191 LIBS="$LIBS -lsec -lsecpw"
192 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000193 disable_ptmx_check=yes
194 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100195*-*-hpux10*)
196 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000197 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100198 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000199 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100200 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000201 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000202 AC_DEFINE(LOGIN_NO_ENDOPT)
203 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000204 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000205 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700206 LIBS="$LIBS -lsec"
207 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100208 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000209*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000210 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100211 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100212 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100213 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000214 AC_DEFINE(LOGIN_NO_ENDOPT)
215 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100216 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000217 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000218 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker4398cf52004-04-06 21:39:02 +1000219 check_for_hpux_broken_getaddrinfo=1
Tim Ricef028f1e2002-07-19 12:41:10 -0700220 LIBS="$LIBS -lsec"
221 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000222 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100223*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100224 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000225 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000226 AC_DEFINE(SETEUID_BREAKS_SETUID)
227 AC_DEFINE(BROKEN_SETREUID)
228 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000229 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000230 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100231 ;;
232*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100233 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000234 AC_DEFINE(WITH_IRIX_ARRAY)
235 AC_DEFINE(WITH_IRIX_PROJECT)
236 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000237 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000238 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000239 AC_DEFINE(SETEUID_BREAKS_SETUID)
240 AC_DEFINE(BROKEN_SETREUID)
241 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000242 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000243 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000244 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100245 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100246*-*-linux*)
247 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100248 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000249 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100250 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000251 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000252 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000253 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller7bcb0892000-03-11 20:45:40 +1100254 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000255 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000256 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000257 AC_DEFINE(BROKEN_CMSG_TYPE)
258 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000259 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100260 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000261mips-sony-bsd|mips-sony-newsos4)
262 AC_DEFINE(HAVE_NEWS4)
263 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000264 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100265*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000266 check_for_libcrypt_before=1
Tim Rice88368a32003-12-08 12:35:59 -0800267 if test "x$withval" != "xno" ; then
268 need_dash_r=1
269 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100270 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100271*-*-freebsd*)
272 check_for_libcrypt_later=1
273 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000274*-*-bsdi*)
275 AC_DEFINE(SETEUID_BREAKS_SETUID)
276 AC_DEFINE(BROKEN_SETREUID)
277 AC_DEFINE(BROKEN_SETREGID)
278 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000279*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000280 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100281 conf_utmp_location=/etc/utmp
282 conf_wtmp_location=/usr/adm/wtmp
283 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000284 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000285 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000286 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100287 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000288 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100289*-*-solaris*)
Tim Ricead4a1882004-02-29 15:53:37 -0800290 if test "x$withval" != "xno" ; then
291 need_dash_r=1
292 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100293 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000294 AC_DEFINE(LOGIN_NEEDS_UTMPX)
295 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000296 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000297 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000298 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
299 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000300 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000301 # hardwire lastlog location (can't detect it on some versions)
302 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000303 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
304 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
305 if test "$sol2ver" -ge 8; then
306 AC_MSG_RESULT(yes)
307 AC_DEFINE(DISABLE_UTMP)
308 AC_DEFINE(DISABLE_WTMP)
309 else
310 AC_MSG_RESULT(no)
311 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100312 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000313*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000314 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000315 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100316 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000317 conf_utmp_location=/etc/utmp
318 conf_wtmp_location=/var/adm/wtmp
319 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000320 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000321 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000322*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700323 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000324 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000325 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000326 AC_DEFINE(SETEUID_BREAKS_SETUID)
327 AC_DEFINE(BROKEN_SETREUID)
328 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000329 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000330*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700331 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000332 AC_CHECK_LIB(dl, dlsym, ,)
Damien Millerfd9885e2001-01-10 08:16:53 +1100333 IPADDR_IN_DISPLAY=yes
334 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000335 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000336 AC_DEFINE(SETEUID_BREAKS_SETUID)
337 AC_DEFINE(BROKEN_SETREUID)
338 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000339 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000340 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700341 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
342 # Attention: always take care to bind libsocket and libnsl before libc,
343 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000344 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100345*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100346 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700347 AC_DEFINE(SETEUID_BREAKS_SETUID)
348 AC_DEFINE(BROKEN_SETREUID)
349 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100350 ;;
351*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100352 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700353 AC_DEFINE(SETEUID_BREAKS_SETUID)
354 AC_DEFINE(BROKEN_SETREUID)
355 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100356 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100357*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100358 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100359*-*-sco3.2v4*)
Tim Ricefcb62202004-01-23 18:35:16 -0800360 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize"
Tim Ricee8c898a2004-02-23 21:47:04 -0800361 LIBS="$LIBS -los -lprot -lcrypt_i -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100362 RANLIB=true
363 no_dev_ptmx=1
364 AC_DEFINE(BROKEN_SYS_TERMIO_H)
365 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000366 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000367 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100368 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Ricefe6d5aa2004-04-16 20:03:07 -0700369 AC_DEFINE(SETEUID_BREAKS_SETUID)
370 AC_DEFINE(BROKEN_SETREUID)
371 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700372 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100373 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700374 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700375 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100376 ;;
377*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800378 if test -z "$GCC"; then
379 CFLAGS="$CFLAGS -belf"
380 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100381 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000382 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100383 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000384 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000385 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700386 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700387 AC_DEFINE(SETEUID_BREAKS_SETUID)
388 AC_DEFINE(BROKEN_SETREUID)
389 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700390 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100391 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700392 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000393 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000394*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100395 AC_DEFINE(NO_SSH_LASTLOG)
396 AC_DEFINE(SETEUID_BREAKS_SETUID)
397 AC_DEFINE(BROKEN_SETREUID)
398 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000399 AC_DEFINE(USE_PIPES)
400 AC_DEFINE(DISABLE_FD_PASSING)
401 LDFLAGS="$LDFLAGS"
402 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
403 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000404 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000405*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100406 AC_DEFINE(SETEUID_BREAKS_SETUID)
407 AC_DEFINE(BROKEN_SETREUID)
408 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000409 AC_DEFINE(WITH_ABBREV_NO_TTY)
410 AC_DEFINE(USE_PIPES)
411 AC_DEFINE(DISABLE_FD_PASSING)
412 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100413 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000414 MANTYPE=cat
415 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000416*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100417 AC_DEFINE(SETEUID_BREAKS_SETUID)
418 AC_DEFINE(BROKEN_SETREUID)
419 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000420 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700421 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700422 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000423 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
424 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
425 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700426 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000427*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000428 AC_MSG_CHECKING(for Digital Unix SIA)
429 no_osfsia=""
430 AC_ARG_WITH(osfsia,
431 [ --with-osfsia Enable Digital Unix SIA],
432 [
433 if test "x$withval" = "xno" ; then
434 AC_MSG_RESULT(disabled)
435 no_osfsia=1
436 fi
437 ],
438 )
439 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000440 if test -f /etc/sia/matrix.conf; then
441 AC_MSG_RESULT(yes)
442 AC_DEFINE(HAVE_OSF_SIA)
443 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000444 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000445 LIBS="$LIBS -lsecurity -ldb -lm -laud"
446 else
447 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100448 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000449 fi
450 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000451 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700452 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000453 AC_DEFINE(BROKEN_SETREUID)
454 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000455 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000456
457*-*-nto-qnx)
458 AC_DEFINE(USE_PIPES)
459 AC_DEFINE(NO_X11_UNIX_SOCKETS)
460 AC_DEFINE(MISSING_NFDBITS)
461 AC_DEFINE(MISSING_HOWMANY)
462 AC_DEFINE(MISSING_FD_MASK)
463 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100464esac
465
Damien Millere37bfc12000-06-05 09:37:43 +1000466# Allow user to specify flags
467AC_ARG_WITH(cflags,
468 [ --with-cflags Specify additional flags to pass to compiler],
469 [
470 if test "x$withval" != "xno" ; then
471 CFLAGS="$CFLAGS $withval"
472 fi
473 ]
474)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000475AC_ARG_WITH(cppflags,
476 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
477 [
478 if test "x$withval" != "xno"; then
479 CPPFLAGS="$CPPFLAGS $withval"
480 fi
481 ]
482)
Damien Millere37bfc12000-06-05 09:37:43 +1000483AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000484 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000485 [
486 if test "x$withval" != "xno" ; then
487 LDFLAGS="$LDFLAGS $withval"
488 fi
489 ]
490)
491AC_ARG_WITH(libs,
492 [ --with-libs Specify additional libraries to link with],
493 [
494 if test "x$withval" != "xno" ; then
495 LIBS="$LIBS $withval"
496 fi
497 ]
498)
499
Darren Tucker6eb93042003-06-29 21:30:41 +1000500AC_MSG_CHECKING(compiler and flags for sanity)
501AC_TRY_RUN([
502#include <stdio.h>
503int main(){exit(0);}
504 ],
505 [ AC_MSG_RESULT(yes) ],
506 [
507 AC_MSG_RESULT(no)
508 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
509 ]
510)
511
Tim Rice4cec93f2002-02-26 08:40:48 -0800512# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000513AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000514 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800515 login_cap.h maillock.h netdb.h netgroup.h \
Damien Miller0f47c532004-01-02 18:01:30 +1100516 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000517 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000518 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
Damien Miller6c4914a2004-03-03 11:08:59 +1100519 sys/cdefs.h sys/mman.h sys/prctl.h sys/pstat.h sys/ptms.h \
520 sys/select.h sys/stat.h sys/stream.h sys/stropts.h \
521 sys/sysmacros.h sys/time.h sys/timers.h sys/un.h time.h tmpdir.h \
522 ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
Tim Rice4cec93f2002-02-26 08:40:48 -0800523
Damien Millera22ba012000-03-02 23:09:20 +1100524# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700525AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
526AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000527
Damien Millerdf288022001-02-18 13:07:07 +1100528dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700529if test "x$with_tcp_wrappers" != "xno" ; then
530 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
531 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
532 fi
533fi
Damien Millerdf288022001-02-18 13:07:07 +1100534
Tim Rice1e1ef642003-09-11 22:19:31 -0700535dnl IRIX and Solaris 2.5.1 have dirname() in libgen
536AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
537 AC_CHECK_LIB(gen, dirname,[
538 AC_CACHE_CHECK([for broken dirname],
539 ac_cv_have_broken_dirname, [
540 save_LIBS="$LIBS"
541 LIBS="$LIBS -lgen"
542 AC_TRY_RUN(
543 [
544#include <libgen.h>
545#include <string.h>
546
547int main(int argc, char **argv) {
548 char *s, buf[32];
549
550 strncpy(buf,"/etc", 32);
551 s = dirname(buf);
552 if (!s || strncmp(s, "/", 32) != 0) {
553 exit(1);
554 } else {
555 exit(0);
556 }
557}
558 ],
559 [ ac_cv_have_broken_dirname="no" ],
560 [ ac_cv_have_broken_dirname="yes" ]
561 )
562 LIBS="$save_LIBS"
563 ])
564 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
565 LIBS="$LIBS -lgen"
566 AC_DEFINE(HAVE_DIRNAME)
567 AC_CHECK_HEADERS(libgen.h)
568 fi
569 ])
570])
571
572AC_CHECK_FUNC(getspnam, ,
573 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
574AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
575
Tim Rice13aae5e2001-10-21 17:53:58 -0700576dnl zlib is required
577AC_ARG_WITH(zlib,
578 [ --with-zlib=PATH Use zlib in PATH],
579 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000580 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100581 AC_MSG_ERROR([*** zlib is required ***])
582 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700583 if test -d "$withval/lib"; then
584 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700585 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700586 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700587 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700588 fi
589 else
590 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700591 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700592 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700593 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700594 fi
595 fi
596 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700597 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700598 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700599 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700600 fi
601 ]
602)
603
Tim Ricefcb62202004-01-23 18:35:16 -0800604AC_CHECK_LIB(z, deflate, ,
605 [
606 saved_CPPFLAGS="$CPPFLAGS"
607 saved_LDFLAGS="$LDFLAGS"
608 save_LIBS="$LIBS"
609 dnl Check default zlib install dir
610 if test -n "${need_dash_r}"; then
611 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
612 else
613 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
614 fi
615 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
616 LIBS="$LIBS -lz"
617 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
618 [
619 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
620 ]
621 )
622 ]
623)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100624AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100625
626AC_ARG_WITH(zlib-version-check,
627 [ --without-zlib-version-check Disable zlib version check],
628 [ if test "x$withval" = "xno" ; then
629 zlib_check_nonfatal=1
630 fi
631 ]
632)
633
Darren Tucker2dcd2392004-01-23 17:13:33 +1100634AC_MSG_CHECKING(for zlib 1.1.4 or greater)
635AC_TRY_RUN([
636#include <zlib.h>
637int main()
638{
639 int a, b, c, v;
640 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
641 exit(1);
642 v = a*1000000 + b*1000 + c;
643 if (v >= 1001004)
644 exit(0);
645 exit(2);
646}
647 ],
648 AC_MSG_RESULT(yes),
649 [ AC_MSG_RESULT(no)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100650 if test -z "$zlib_check_nonfatal" ; then
651 AC_MSG_ERROR([*** zlib too old - check config.log ***
652Your reported zlib version has known security problems. It's possible your
653vendor has fixed these problems without changing the version number. If you
654are sure this is the case, you can disable the check by running
655"./configure --without-zlib-version-check".
656If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
657 else
658 AC_MSG_WARN([zlib version may have security problems])
659 fi
660 ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100661)
Damien Miller6f9c3372000-10-25 10:06:04 +1100662
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000663dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100664AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000665 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
666)
Damien Millera8e06ce2003-11-21 23:48:55 +1100667AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700668 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
669 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000670)
Damien Millerab18c411999-11-11 10:40:23 +1100671
Tim Ricee589a292001-11-03 11:09:32 -0800672dnl Checks for libutil functions
673AC_CHECK_HEADERS(libutil.h)
674AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
675AC_CHECK_FUNCS(logout updwtmp logwtmp)
676
Ben Lindstrom8697e082001-02-24 21:41:10 +0000677AC_FUNC_STRFTIME
678
Damien Miller3c027682001-03-14 11:39:45 +1100679# Check for ALTDIRFUNC glob() extension
680AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
681AC_EGREP_CPP(FOUNDIT,
682 [
683 #include <glob.h>
684 #ifdef GLOB_ALTDIRFUNC
685 FOUNDIT
686 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100687 ],
Damien Miller3c027682001-03-14 11:39:45 +1100688 [
689 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
690 AC_MSG_RESULT(yes)
691 ],
692 [
693 AC_MSG_RESULT(no)
694 ]
695)
Damien Millerab18c411999-11-11 10:40:23 +1100696
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000697# Check for g.gl_matchc glob() extension
698AC_MSG_CHECKING(for gl_matchc field in glob_t)
699AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100700 [
701 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000702 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100703 ],
704 [
705 AC_DEFINE(GLOB_HAS_GL_MATCHC)
706 AC_MSG_RESULT(yes)
707 ],
708 [
709 AC_MSG_RESULT(no)
710 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000711)
712
Damien Miller18bb4732001-03-28 14:35:30 +1000713AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
714AC_TRY_RUN(
715 [
716#include <sys/types.h>
717#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700718int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000719 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100720 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000721 [
722 AC_MSG_RESULT(no)
723 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
724 ]
725)
726
Damien Millerc547bf12001-02-16 10:18:12 +1100727# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100728SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100729AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700730 [ --with-skey[[=PATH]] Enable S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100731 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100732 [
733 if test "x$withval" != "xno" ; then
734
735 if test "x$withval" != "xyes" ; then
736 CPPFLAGS="$CPPFLAGS -I${withval}/include"
737 LDFLAGS="$LDFLAGS -L${withval}/lib"
738 fi
739
740 AC_DEFINE(SKEY)
741 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100742 SKEY_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100743
Tim Rice4cec93f2002-02-26 08:40:48 -0800744 AC_MSG_CHECKING([for s/key support])
745 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100746 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800747#include <stdio.h>
748#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700749int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800750 ],
751 [AC_MSG_RESULT(yes)],
752 [
753 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100754 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
755 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000756 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
757 AC_TRY_COMPILE(
758 [#include <stdio.h>
759 #include <skey.h>],
760 [(void)skeychallenge(NULL,"name","",0);],
761 [AC_MSG_RESULT(yes)
762 AC_DEFINE(SKEYCHALLENGE_4ARG)],
763 [AC_MSG_RESULT(no)]
764 )
Damien Millerc547bf12001-02-16 10:18:12 +1100765 fi
766 ]
767)
768
769# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700770TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100771AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700772 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
Damien Millera8e06ce2003-11-21 23:48:55 +1100773 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100774 [
775 if test "x$withval" != "xno" ; then
776 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700777 saved_LDFLAGS="$LDFLAGS"
778 saved_CPPFLAGS="$CPPFLAGS"
779 if test -n "${withval}" -a "${withval}" != "yes"; then
780 if test -d "${withval}/lib"; then
781 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700782 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700783 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700784 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700785 fi
786 else
787 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700788 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700789 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700790 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700791 fi
792 fi
793 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700794 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700795 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700796 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700797 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700798 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800799 LIBWRAP="-lwrap"
800 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100801 AC_MSG_CHECKING(for libwrap)
802 AC_TRY_LINK(
803 [
Damien Miller0ac45002004-04-14 20:14:26 +1000804#include <sys/types.h>
805#include <sys/socket.h>
806#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100807#include <tcpd.h>
808 int deny_severity = 0, allow_severity = 0;
809 ],
810 [hosts_access(0);],
811 [
812 AC_MSG_RESULT(yes)
813 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800814 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700815 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100816 ],
817 [
818 AC_MSG_ERROR([*** libwrap missing])
819 ]
820 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800821 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100822 fi
823 ]
824)
825
Damien Millerfe1f1432003-02-24 15:45:42 +1100826dnl Checks for library functions. Please keep in alphabetical order
827AC_CHECK_FUNCS(\
Damien Millerf09ad862003-09-19 16:41:01 +1000828 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
Damien Miller5fe46a42003-06-05 09:53:31 +1000829 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000830 getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000831 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100832 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000833 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100834 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000835 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100836 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000837 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000838 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100839 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100840)
Tim Rice13aae5e2001-10-21 17:53:58 -0700841
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000842# IRIX has a const char return value for gai_strerror()
843AC_CHECK_FUNCS(gai_strerror,[
844 AC_DEFINE(HAVE_GAI_STRERROR)
845 AC_TRY_COMPILE([
846#include <sys/types.h>
847#include <sys/socket.h>
848#include <netdb.h>
849
850const char *gai_strerror(int);],[
851char *str;
852
853str = gai_strerror(0);],[
854 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
855 [Define if gai_strerror() returns const char *])])])
856
Damien Millercd6853c2003-01-28 11:33:42 +1100857AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
858
Darren Tuckerf1159b52003-07-07 19:44:01 +1000859dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000860AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000861AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000862
Darren Tuckerb2427c82003-09-10 15:22:44 +1000863dnl tcsendbreak might be a macro
864AC_CHECK_DECL(tcsendbreak,
865 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100866 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000867 [#include <termios.h>]
868)
869
Darren Tucker5bb14002004-04-23 18:53:10 +1000870AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
871
Darren Tucker2a6b0292003-12-31 14:59:17 +1100872AC_CHECK_FUNCS(setresuid, [
873 dnl Some platorms have setresuid that isn't implemented, test for this
874 AC_MSG_CHECKING(if setresuid seems to work)
875 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100876#include <stdlib.h>
877#include <errno.h>
878int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100879 ],
880 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100881 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tucker2a6b0292003-12-31 14:59:17 +1100882 AC_MSG_RESULT(not implemented)]
883 )
884])
Darren Tuckere937be32003-12-17 18:53:26 +1100885
Darren Tucker2a6b0292003-12-31 14:59:17 +1100886AC_CHECK_FUNCS(setresgid, [
887 dnl Some platorms have setresgid that isn't implemented, test for this
888 AC_MSG_CHECKING(if setresgid seems to work)
889 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100890#include <stdlib.h>
891#include <errno.h>
892int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100893 ],
894 [AC_MSG_RESULT(yes)],
895 [AC_DEFINE(BROKEN_SETRESGID)
896 AC_MSG_RESULT(not implemented)]
897 )
898])
Darren Tuckere937be32003-12-17 18:53:26 +1100899
Damien Millerad833b32000-08-23 10:46:23 +1000900dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000901AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000902dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000903AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000904AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000905dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000906AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000907AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100908
Damien Millera8e06ce2003-11-21 23:48:55 +1100909AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100910 [AC_DEFINE(HAVE_DAEMON)],
911 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
912)
913
Damien Millera8e06ce2003-11-21 23:48:55 +1100914AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100915 [AC_DEFINE(HAVE_GETPAGESIZE)],
916 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
917)
918
Damien Millercb170cb2000-07-01 16:52:55 +1000919# Check for broken snprintf
920if test "x$ac_cv_func_snprintf" = "xyes" ; then
921 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
922 AC_TRY_RUN(
923 [
924#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700925int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000926 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100927 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000928 [
929 AC_MSG_RESULT(no)
930 AC_DEFINE(BROKEN_SNPRINTF)
931 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
932 ]
933 )
934fi
935
Damien Millerb4097182004-05-23 14:09:40 +1000936# Check for missing getpeereid (or equiv) support
937NO_PEERCHECK=""
938if test "x$ac_cv_func_getpeereid" != "xyes" ; then
939 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
940 AC_TRY_COMPILE(
941 [#include <sys/types.h>
942 #include <sys/socket.h>],
943 [int i = SO_PEERCRED;],
944 [AC_MSG_RESULT(yes)],
945 [AC_MSG_RESULT(no)
946 NO_PEERCHECK=1]
947 )
948fi
949
Damien Millere8328192003-01-07 15:18:32 +1100950dnl see whether mkstemp() requires XXXXXX
951if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
952AC_MSG_CHECKING([for (overly) strict mkstemp])
953AC_TRY_RUN(
954 [
955#include <stdlib.h>
956main() { char template[]="conftest.mkstemp-test";
957if (mkstemp(template) == -1)
958 exit(1);
959unlink(template); exit(0);
960}
961 ],
962 [
963 AC_MSG_RESULT(no)
964 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100965 [
Damien Millere8328192003-01-07 15:18:32 +1100966 AC_MSG_RESULT(yes)
967 AC_DEFINE(HAVE_STRICT_MKSTEMP)
968 ],
969 [
970 AC_MSG_RESULT(yes)
971 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +1100972 ]
Damien Millere8328192003-01-07 15:18:32 +1100973)
974fi
975
Darren Tucker70a3d552003-08-21 17:58:29 +1000976dnl make sure that openpty does not reacquire controlling terminal
977if test ! -z "$check_for_openpty_ctty_bug"; then
978 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
979 AC_TRY_RUN(
980 [
981#include <stdio.h>
982#include <sys/fcntl.h>
983#include <sys/types.h>
984#include <sys/wait.h>
985
986int
987main()
988{
989 pid_t pid;
990 int fd, ptyfd, ttyfd, status;
991
992 pid = fork();
993 if (pid < 0) { /* failed */
994 exit(1);
995 } else if (pid > 0) { /* parent */
996 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +1100997 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +1000998 exit(WEXITSTATUS(status));
999 else
1000 exit(2);
1001 } else { /* child */
1002 close(0); close(1); close(2);
1003 setsid();
1004 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1005 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1006 if (fd >= 0)
1007 exit(3); /* Acquired ctty: broken */
1008 else
1009 exit(0); /* Did not acquire ctty: OK */
1010 }
1011}
1012 ],
1013 [
1014 AC_MSG_RESULT(yes)
1015 ],
1016 [
1017 AC_MSG_RESULT(no)
1018 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1019 ]
1020 )
1021fi
1022
Darren Tucker4398cf52004-04-06 21:39:02 +10001023if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1024 AC_MSG_CHECKING(if getaddrinfo seems to work)
1025 AC_TRY_RUN(
1026 [
1027#include <stdio.h>
1028#include <sys/socket.h>
1029#include <netdb.h>
1030#include <errno.h>
1031#include <netinet/in.h>
1032
1033#define TEST_PORT "2222"
1034
1035int
1036main(void)
1037{
1038 int err, sock;
1039 struct addrinfo *gai_ai, *ai, hints;
1040 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1041
1042 memset(&hints, 0, sizeof(hints));
1043 hints.ai_family = PF_UNSPEC;
1044 hints.ai_socktype = SOCK_STREAM;
1045 hints.ai_flags = AI_PASSIVE;
1046
1047 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1048 if (err != 0) {
1049 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1050 exit(1);
1051 }
1052
1053 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1054 if (ai->ai_family != AF_INET6)
1055 continue;
1056
1057 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1058 sizeof(ntop), strport, sizeof(strport),
1059 NI_NUMERICHOST|NI_NUMERICSERV);
1060
1061 if (err != 0) {
1062 if (err == EAI_SYSTEM)
1063 perror("getnameinfo EAI_SYSTEM");
1064 else
1065 fprintf(stderr, "getnameinfo failed: %s\n",
1066 gai_strerror(err));
1067 exit(2);
1068 }
1069
1070 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1071 if (sock < 0)
1072 perror("socket");
1073 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1074 if (errno == EBADF)
1075 exit(3);
1076 }
1077 }
1078 exit(0);
1079}
1080 ],
1081 [
1082 AC_MSG_RESULT(yes)
1083 ],
1084 [
1085 AC_MSG_RESULT(no)
1086 AC_DEFINE(BROKEN_GETADDRINFO)
1087 ]
1088 )
1089fi
1090
Damien Miller606f8802000-09-16 15:39:56 +11001091AC_FUNC_GETPGRP
1092
Damien Millera64b57a2001-01-17 10:44:13 +11001093# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001094PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001095AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001096 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001097 [
Damien Millera64b57a2001-01-17 10:44:13 +11001098 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001099 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1100 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001101 AC_MSG_ERROR([PAM headers not found])
1102 fi
1103
1104 AC_CHECK_LIB(dl, dlopen, , )
1105 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1106 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001107 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001108
Damien Millera64b57a2001-01-17 10:44:13 +11001109 PAM_MSG="yes"
1110
1111 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001112 if test $ac_cv_lib_dl_dlopen = yes; then
1113 LIBPAM="-lpam -ldl"
1114 else
1115 LIBPAM="-lpam"
1116 fi
1117 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001118 fi
1119 ]
1120)
Damien Millera22ba012000-03-02 23:09:20 +11001121
Damien Millera64b57a2001-01-17 10:44:13 +11001122# Check for older PAM
1123if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001124 # Check PAM strerror arguments (old PAM)
1125 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1126 AC_TRY_COMPILE(
1127 [
Damien Miller81171112000-04-23 11:14:01 +10001128#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001129#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001130#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001131#elif defined (HAVE_PAM_PAM_APPL_H)
1132#include <pam/pam_appl.h>
1133#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001134 ],
1135 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001136 [AC_MSG_RESULT(no)],
1137 [
1138 AC_DEFINE(HAVE_OLD_PAM)
1139 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001140 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001141 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001142 )
Damien Millera22ba012000-03-02 23:09:20 +11001143fi
1144
Tim Riceaef73712002-05-11 13:17:42 -07001145# Search for OpenSSL
1146saved_CPPFLAGS="$CPPFLAGS"
1147saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001148AC_ARG_WITH(ssl-dir,
1149 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1150 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001151 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -07001152 if test -d "$withval/lib"; then
1153 if test -n "${need_dash_r}"; then
1154 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1155 else
1156 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1157 fi
1158 else
1159 if test -n "${need_dash_r}"; then
1160 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1161 else
1162 LDFLAGS="-L${withval} ${LDFLAGS}"
1163 fi
1164 fi
1165 if test -d "$withval/include"; then
1166 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1167 else
1168 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1169 fi
Damien Millera22ba012000-03-02 23:09:20 +11001170 fi
1171 ]
1172)
Tim Rice3d5352e2004-02-12 09:27:21 -08001173LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001174AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001175 [
Tim Riceaef73712002-05-11 13:17:42 -07001176 dnl Check default openssl install dir
1177 if test -n "${need_dash_r}"; then
1178 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001179 else
Tim Riceaef73712002-05-11 13:17:42 -07001180 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001181 fi
Tim Riceaef73712002-05-11 13:17:42 -07001182 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1183 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1184 [
1185 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1186 ]
1187 )
1188 ]
1189)
1190
Tim Riced730b782002-08-13 18:52:10 -07001191# Determine OpenSSL header version
1192AC_MSG_CHECKING([OpenSSL header version])
1193AC_TRY_RUN(
1194 [
1195#include <stdio.h>
1196#include <string.h>
1197#include <openssl/opensslv.h>
1198#define DATA "conftest.sslincver"
1199int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001200 FILE *fd;
1201 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001202
Damien Millera8e06ce2003-11-21 23:48:55 +11001203 fd = fopen(DATA,"w");
1204 if(fd == NULL)
1205 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001206
1207 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1208 exit(1);
1209
1210 exit(0);
1211}
1212 ],
1213 [
1214 ssl_header_ver=`cat conftest.sslincver`
1215 AC_MSG_RESULT($ssl_header_ver)
1216 ],
1217 [
1218 AC_MSG_RESULT(not found)
1219 AC_MSG_ERROR(OpenSSL version header not found.)
1220 ]
1221)
1222
1223# Determine OpenSSL library version
1224AC_MSG_CHECKING([OpenSSL library version])
1225AC_TRY_RUN(
1226 [
1227#include <stdio.h>
1228#include <string.h>
1229#include <openssl/opensslv.h>
1230#include <openssl/crypto.h>
1231#define DATA "conftest.ssllibver"
1232int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001233 FILE *fd;
1234 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001235
Damien Millera8e06ce2003-11-21 23:48:55 +11001236 fd = fopen(DATA,"w");
1237 if(fd == NULL)
1238 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001239
1240 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1241 exit(1);
1242
1243 exit(0);
1244}
1245 ],
1246 [
1247 ssl_library_ver=`cat conftest.ssllibver`
1248 AC_MSG_RESULT($ssl_library_ver)
1249 ],
1250 [
1251 AC_MSG_RESULT(not found)
1252 AC_MSG_ERROR(OpenSSL library not found.)
1253 ]
1254)
Damien Millera22ba012000-03-02 23:09:20 +11001255
Damien Millerec932372002-01-22 22:16:03 +11001256# Sanity check OpenSSL headers
1257AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1258AC_TRY_RUN(
1259 [
1260#include <string.h>
1261#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001262int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001263 ],
1264 [
1265 AC_MSG_RESULT(yes)
1266 ],
1267 [
1268 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001269 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1270Check config.log for details.
1271Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001272 ]
1273)
1274
Tim Rice3d5352e2004-02-12 09:27:21 -08001275# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1276# because the system crypt() is more featureful.
1277if test "x$check_for_libcrypt_before" = "x1"; then
1278 AC_CHECK_LIB(crypt, crypt)
1279fi
1280
Damien Millera8e06ce2003-11-21 23:48:55 +11001281# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001282# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001283if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001284 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001285fi
1286
Damien Miller6c21c512002-01-22 21:57:53 +11001287
1288### Configure cryptographic random number support
1289
1290# Check wheter OpenSSL seeds itself
1291AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1292AC_TRY_RUN(
1293 [
1294#include <string.h>
1295#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001296int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001297 ],
1298 [
1299 OPENSSL_SEEDS_ITSELF=yes
1300 AC_MSG_RESULT(yes)
1301 ],
1302 [
1303 AC_MSG_RESULT(no)
1304 # Default to use of the rand helper if OpenSSL doesn't
1305 # seed itself
1306 USE_RAND_HELPER=yes
1307 ]
1308)
1309
1310
1311# Do we want to force the use of the rand helper?
1312AC_ARG_WITH(rand-helper,
1313 [ --with-rand-helper Use subprocess to gather strong randomness ],
1314 [
1315 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001316 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001317 # the previous test showed it to be unseeded.
1318 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1319 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1320 OPENSSL_SEEDS_ITSELF=yes
1321 USE_RAND_HELPER=""
1322 fi
1323 else
1324 USE_RAND_HELPER=yes
1325 fi
1326 ],
1327)
1328
1329# Which randomness source do we use?
1330if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1331 # OpenSSL only
1332 AC_DEFINE(OPENSSL_PRNG_ONLY)
1333 RAND_MSG="OpenSSL internal ONLY"
1334 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001335elif test ! -z "$USE_RAND_HELPER" ; then
1336 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001337 RAND_MSG="ssh-rand-helper"
1338 INSTALL_SSH_RAND_HELPER="yes"
1339fi
1340AC_SUBST(INSTALL_SSH_RAND_HELPER)
1341
1342### Configuration of ssh-rand-helper
1343
1344# PRNGD TCP socket
1345AC_ARG_WITH(prngd-port,
1346 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1347 [
Damien Millere996d722002-01-23 11:20:59 +11001348 case "$withval" in
1349 no)
1350 withval=""
1351 ;;
1352 [[0-9]]*)
1353 ;;
1354 *)
1355 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1356 ;;
1357 esac
1358 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001359 PRNGD_PORT="$withval"
1360 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1361 fi
1362 ]
1363)
1364
1365# PRNGD Unix domain socket
1366AC_ARG_WITH(prngd-socket,
1367 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1368 [
Damien Millere996d722002-01-23 11:20:59 +11001369 case "$withval" in
1370 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001371 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001372 ;;
1373 no)
1374 withval=""
1375 ;;
1376 /*)
1377 ;;
1378 *)
1379 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1380 ;;
1381 esac
1382
1383 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001384 if test ! -z "$PRNGD_PORT" ; then
1385 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1386 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001387 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001388 AC_MSG_WARN(Entropy socket is not readable)
1389 fi
1390 PRNGD_SOCKET="$withval"
1391 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1392 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001393 ],
1394 [
1395 # Check for existing socket only if we don't have a random device already
1396 if test "$USE_RAND_HELPER" = yes ; then
1397 AC_MSG_CHECKING(for PRNGD/EGD socket)
1398 # Insert other locations here
1399 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1400 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1401 PRNGD_SOCKET="$sock"
1402 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1403 break;
1404 fi
1405 done
1406 if test ! -z "$PRNGD_SOCKET" ; then
1407 AC_MSG_RESULT($PRNGD_SOCKET)
1408 else
1409 AC_MSG_RESULT(not found)
1410 fi
1411 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001412 ]
1413)
1414
1415# Change default command timeout for hashing entropy source
1416entropy_timeout=200
1417AC_ARG_WITH(entropy-timeout,
1418 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1419 [
1420 if test "x$withval" != "xno" ; then
1421 entropy_timeout=$withval
1422 fi
1423 ]
1424)
Damien Miller6c21c512002-01-22 21:57:53 +11001425AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1426
Damien Millerd3f6ad22002-06-25 10:24:47 +10001427SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001428AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001429 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001430 [
1431 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001432 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001433 fi
1434 ]
1435)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001436AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1437AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001438
Tim Rice88f2ab52002-03-17 12:17:34 -08001439# We do this little dance with the search path to insure
1440# that programs that we select for use by installed programs
1441# (which may be run by the super-user) come from trusted
1442# locations before they come from the user's private area.
1443# This should help avoid accidentally configuring some
1444# random version of a program in someone's personal bin.
1445
1446OPATH=$PATH
1447PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001448test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001449test -d /sbin && PATH=$PATH:/sbin
1450test -d /usr/sbin && PATH=$PATH:/usr/sbin
1451PATH=$PATH:/etc:$OPATH
1452
Damien Millera8e06ce2003-11-21 23:48:55 +11001453# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001454OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1455OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1456OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1457OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1458OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1459OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1460OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1461OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1462OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1463OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1464OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1465OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1466OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1467OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1468OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1469OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001470# restore PATH
1471PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001472
1473# Where does ssh-rand-helper get its randomness from?
1474INSTALL_SSH_PRNG_CMDS=""
1475if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1476 if test ! -z "$PRNGD_PORT" ; then
1477 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1478 elif test ! -z "$PRNGD_SOCKET" ; then
1479 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1480 else
1481 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1482 RAND_HELPER_CMDHASH=yes
1483 INSTALL_SSH_PRNG_CMDS="yes"
1484 fi
1485fi
1486AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1487
1488
Ben Lindstromb5628642000-10-18 00:02:25 +00001489# Cheap hack to ensure NEWS-OS libraries are arranged right.
1490if test ! -z "$SONY" ; then
1491 LIBS="$LIBS -liberty";
1492fi
1493
Damien Millera22ba012000-03-02 23:09:20 +11001494# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001495AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001496AC_CHECK_SIZEOF(short int, 2)
1497AC_CHECK_SIZEOF(int, 4)
1498AC_CHECK_SIZEOF(long int, 4)
1499AC_CHECK_SIZEOF(long long int, 8)
1500
Damien Millerfa2bb692002-04-23 23:22:25 +10001501# Sanity check long long for some platforms (AIX)
1502if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1503 ac_cv_sizeof_long_long_int=0
1504fi
1505
Damien Millera22ba012000-03-02 23:09:20 +11001506# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001507AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1508 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001509 [ #include <sys/types.h> ],
1510 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001511 [ ac_cv_have_u_int="yes" ],
1512 [ ac_cv_have_u_int="no" ]
1513 )
1514])
1515if test "x$ac_cv_have_u_int" = "xyes" ; then
1516 AC_DEFINE(HAVE_U_INT)
1517 have_u_int=1
1518fi
1519
Damien Miller61e50f12000-05-08 20:49:37 +10001520AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1521 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001522 [ #include <sys/types.h> ],
1523 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001524 [ ac_cv_have_intxx_t="yes" ],
1525 [ ac_cv_have_intxx_t="no" ]
1526 )
1527])
1528if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1529 AC_DEFINE(HAVE_INTXX_T)
1530 have_intxx_t=1
1531fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001532
1533if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001534 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001535then
1536 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1537 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001538 [ #include <stdint.h> ],
1539 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001540 [
1541 AC_DEFINE(HAVE_INTXX_T)
1542 AC_MSG_RESULT(yes)
1543 ],
1544 [ AC_MSG_RESULT(no) ]
1545 )
1546fi
1547
Damien Miller578783e2000-09-23 14:12:24 +11001548AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1549 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001550 [
1551#include <sys/types.h>
1552#ifdef HAVE_STDINT_H
1553# include <stdint.h>
1554#endif
1555#include <sys/socket.h>
1556#ifdef HAVE_SYS_BITYPES_H
1557# include <sys/bitypes.h>
1558#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001559 ],
1560 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001561 [ ac_cv_have_int64_t="yes" ],
1562 [ ac_cv_have_int64_t="no" ]
1563 )
1564])
1565if test "x$ac_cv_have_int64_t" = "xyes" ; then
1566 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001567fi
1568
Damien Miller61e50f12000-05-08 20:49:37 +10001569AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1570 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001571 [ #include <sys/types.h> ],
1572 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001573 [ ac_cv_have_u_intxx_t="yes" ],
1574 [ ac_cv_have_u_intxx_t="no" ]
1575 )
1576])
1577if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1578 AC_DEFINE(HAVE_U_INTXX_T)
1579 have_u_intxx_t=1
1580fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001581
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001582if test -z "$have_u_intxx_t" ; then
1583 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1584 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001585 [ #include <sys/socket.h> ],
1586 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001587 [
1588 AC_DEFINE(HAVE_U_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 u_int64_t types], ac_cv_have_u_int64_t, [
1596 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001597 [ #include <sys/types.h> ],
1598 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001599 [ ac_cv_have_u_int64_t="yes" ],
1600 [ ac_cv_have_u_int64_t="no" ]
1601 )
1602])
1603if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1604 AC_DEFINE(HAVE_U_INT64_T)
1605 have_u_int64_t=1
1606fi
1607
Tim Rice4cec93f2002-02-26 08:40:48 -08001608if test -z "$have_u_int64_t" ; then
1609 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1610 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001611 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001612 [ u_int64_t a; a = 1],
1613 [
1614 AC_DEFINE(HAVE_U_INT64_T)
1615 AC_MSG_RESULT(yes)
1616 ],
1617 [ AC_MSG_RESULT(no) ]
1618 )
1619fi
1620
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001621if test -z "$have_u_intxx_t" ; then
1622 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1623 AC_TRY_COMPILE(
1624 [
1625#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001626 ],
1627 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001628 [ ac_cv_have_uintxx_t="yes" ],
1629 [ ac_cv_have_uintxx_t="no" ]
1630 )
1631 ])
1632 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1633 AC_DEFINE(HAVE_UINTXX_T)
1634 fi
1635fi
1636
1637if test -z "$have_uintxx_t" ; then
1638 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1639 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001640 [ #include <stdint.h> ],
1641 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001642 [
1643 AC_DEFINE(HAVE_UINTXX_T)
1644 AC_MSG_RESULT(yes)
1645 ],
1646 [ AC_MSG_RESULT(no) ]
1647 )
1648fi
1649
Damien Milleredb82922000-06-20 13:25:52 +10001650if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001651 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001652then
1653 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1654 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001655 [
1656#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001657 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001658 [
Damien Miller70494d12000-04-03 15:57:06 +10001659 int8_t a; int16_t b; int32_t c;
1660 u_int8_t e; u_int16_t f; u_int32_t g;
1661 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001662 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001663 [
1664 AC_DEFINE(HAVE_U_INTXX_T)
1665 AC_DEFINE(HAVE_INTXX_T)
1666 AC_MSG_RESULT(yes)
1667 ],
1668 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001669 )
Damien Millerb29ea912000-01-15 14:12:03 +11001670fi
1671
Damien Miller58be7382001-09-15 21:31:54 +10001672
1673AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1674 AC_TRY_COMPILE(
1675 [
1676#include <sys/types.h>
1677 ],
1678 [ u_char foo; foo = 125; ],
1679 [ ac_cv_have_u_char="yes" ],
1680 [ ac_cv_have_u_char="no" ]
1681 )
1682])
1683if test "x$ac_cv_have_u_char" = "xyes" ; then
1684 AC_DEFINE(HAVE_U_CHAR)
1685fi
1686
Tim Rice13aae5e2001-10-21 17:53:58 -07001687TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001688
Tim Rice200a5c02002-02-26 22:12:34 -08001689AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001690
Damien Miller61e50f12000-05-08 20:49:37 +10001691AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1692 AC_TRY_COMPILE(
1693 [
1694#include <sys/types.h>
1695 ],
1696 [ size_t foo; foo = 1235; ],
1697 [ ac_cv_have_size_t="yes" ],
1698 [ ac_cv_have_size_t="no" ]
1699 )
1700])
1701if test "x$ac_cv_have_size_t" = "xyes" ; then
1702 AC_DEFINE(HAVE_SIZE_T)
1703fi
Damien Miller95058511999-12-29 10:36:45 +11001704
Damien Miller615f9392000-05-17 22:53:33 +10001705AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1706 AC_TRY_COMPILE(
1707 [
1708#include <sys/types.h>
1709 ],
1710 [ ssize_t foo; foo = 1235; ],
1711 [ ac_cv_have_ssize_t="yes" ],
1712 [ ac_cv_have_ssize_t="no" ]
1713 )
1714])
1715if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1716 AC_DEFINE(HAVE_SSIZE_T)
1717fi
1718
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001719AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1720 AC_TRY_COMPILE(
1721 [
1722#include <time.h>
1723 ],
1724 [ clock_t foo; foo = 1235; ],
1725 [ ac_cv_have_clock_t="yes" ],
1726 [ ac_cv_have_clock_t="no" ]
1727 )
1728])
1729if test "x$ac_cv_have_clock_t" = "xyes" ; then
1730 AC_DEFINE(HAVE_CLOCK_T)
1731fi
1732
Damien Millerb54b40e2000-06-23 08:23:34 +10001733AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1734 AC_TRY_COMPILE(
1735 [
1736#include <sys/types.h>
1737#include <sys/socket.h>
1738 ],
1739 [ sa_family_t foo; foo = 1235; ],
1740 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001741 [ AC_TRY_COMPILE(
1742 [
1743#include <sys/types.h>
1744#include <sys/socket.h>
1745#include <netinet/in.h>
1746 ],
1747 [ sa_family_t foo; foo = 1235; ],
1748 [ ac_cv_have_sa_family_t="yes" ],
1749
Damien Millerb54b40e2000-06-23 08:23:34 +10001750 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001751 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001752 )
1753])
1754if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1755 AC_DEFINE(HAVE_SA_FAMILY_T)
1756fi
1757
Damien Miller0f91b4e2000-06-18 15:43:25 +10001758AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1759 AC_TRY_COMPILE(
1760 [
1761#include <sys/types.h>
1762 ],
1763 [ pid_t foo; foo = 1235; ],
1764 [ ac_cv_have_pid_t="yes" ],
1765 [ ac_cv_have_pid_t="no" ]
1766 )
1767])
1768if test "x$ac_cv_have_pid_t" = "xyes" ; then
1769 AC_DEFINE(HAVE_PID_T)
1770fi
1771
1772AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1773 AC_TRY_COMPILE(
1774 [
1775#include <sys/types.h>
1776 ],
1777 [ mode_t foo; foo = 1235; ],
1778 [ ac_cv_have_mode_t="yes" ],
1779 [ ac_cv_have_mode_t="no" ]
1780 )
1781])
1782if test "x$ac_cv_have_mode_t" = "xyes" ; then
1783 AC_DEFINE(HAVE_MODE_T)
1784fi
1785
Damien Miller61e50f12000-05-08 20:49:37 +10001786
1787AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1788 AC_TRY_COMPILE(
1789 [
Damien Miller81171112000-04-23 11:14:01 +10001790#include <sys/types.h>
1791#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001792 ],
1793 [ struct sockaddr_storage s; ],
1794 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1795 [ ac_cv_have_struct_sockaddr_storage="no" ]
1796 )
1797])
1798if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1799 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1800fi
Damien Miller34132e52000-01-14 15:45:46 +11001801
Damien Miller61e50f12000-05-08 20:49:37 +10001802AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1803 AC_TRY_COMPILE(
1804 [
Damien Miller7b22d652000-06-18 14:07:04 +10001805#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001806#include <netinet/in.h>
1807 ],
1808 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1809 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1810 [ ac_cv_have_struct_sockaddr_in6="no" ]
1811 )
1812])
1813if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1814 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1815fi
Damien Miller34132e52000-01-14 15:45:46 +11001816
Damien Miller61e50f12000-05-08 20:49:37 +10001817AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1818 AC_TRY_COMPILE(
1819 [
Damien Miller7b22d652000-06-18 14:07:04 +10001820#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001821#include <netinet/in.h>
1822 ],
1823 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1824 [ ac_cv_have_struct_in6_addr="yes" ],
1825 [ ac_cv_have_struct_in6_addr="no" ]
1826 )
1827])
1828if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1829 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1830fi
Damien Miller34132e52000-01-14 15:45:46 +11001831
Damien Miller61e50f12000-05-08 20:49:37 +10001832AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1833 AC_TRY_COMPILE(
1834 [
Damien Miller81171112000-04-23 11:14:01 +10001835#include <sys/types.h>
1836#include <sys/socket.h>
1837#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001838 ],
1839 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1840 [ ac_cv_have_struct_addrinfo="yes" ],
1841 [ ac_cv_have_struct_addrinfo="no" ]
1842 )
1843])
1844if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1845 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1846fi
1847
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001848AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1849 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001850 [ #include <sys/time.h> ],
1851 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001852 [ ac_cv_have_struct_timeval="yes" ],
1853 [ ac_cv_have_struct_timeval="no" ]
1854 )
1855])
1856if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1857 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1858 have_struct_timeval=1
1859fi
1860
Tim Rice4e4dc562003-03-18 10:21:40 -08001861AC_CHECK_TYPES(struct timespec)
1862
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001863# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001864if test "x$ac_cv_have_int64_t" = "xno" -a \
1865 "x$ac_cv_sizeof_long_int" != "x8" -a \
1866 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001867 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1868 echo "an alternative compiler (I.E., GCC) before continuing."
1869 echo ""
1870 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001871else
1872dnl test snprintf (broken on SCO w/gcc)
1873 AC_TRY_RUN(
1874 [
1875#include <stdio.h>
1876#include <string.h>
1877#ifdef HAVE_SNPRINTF
1878main()
1879{
1880 char buf[50];
1881 char expected_out[50];
1882 int mazsize = 50 ;
1883#if (SIZEOF_LONG_INT == 8)
1884 long int num = 0x7fffffffffffffff;
1885#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001886 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001887#endif
1888 strcpy(expected_out, "9223372036854775807");
1889 snprintf(buf, mazsize, "%lld", num);
1890 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001891 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001892 exit(0);
1893}
1894#else
1895main() { exit(0); }
1896#endif
1897 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1898 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001899fi
1900
Damien Miller78315eb2000-09-29 23:01:36 +11001901dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001902OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1903OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1904OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1905OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1906OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001907OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001908OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1909OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001910OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001911OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1912OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1913OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1914OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001915OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1916OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1917OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1918OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001919
1920AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001921
Damien Miller61e50f12000-05-08 20:49:37 +10001922AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1923 ac_cv_have_ss_family_in_struct_ss, [
1924 AC_TRY_COMPILE(
1925 [
Damien Miller81171112000-04-23 11:14:01 +10001926#include <sys/types.h>
1927#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001928 ],
1929 [ struct sockaddr_storage s; s.ss_family = 1; ],
1930 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1931 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1932 )
1933])
1934if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1935 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1936fi
1937
Damien Miller61e50f12000-05-08 20:49:37 +10001938AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1939 ac_cv_have___ss_family_in_struct_ss, [
1940 AC_TRY_COMPILE(
1941 [
Damien Miller81171112000-04-23 11:14:01 +10001942#include <sys/types.h>
1943#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001944 ],
1945 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1946 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1947 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1948 )
1949])
1950if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1951 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1952fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001953
Damien Millerad833b32000-08-23 10:46:23 +10001954AC_CACHE_CHECK([for pw_class field in struct passwd],
1955 ac_cv_have_pw_class_in_struct_passwd, [
1956 AC_TRY_COMPILE(
1957 [
Damien Millerad833b32000-08-23 10:46:23 +10001958#include <pwd.h>
1959 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001960 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001961 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1962 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1963 )
1964])
1965if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1966 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1967fi
1968
Kevin Steves82456952001-06-22 21:14:18 +00001969AC_CACHE_CHECK([for pw_expire field in struct passwd],
1970 ac_cv_have_pw_expire_in_struct_passwd, [
1971 AC_TRY_COMPILE(
1972 [
1973#include <pwd.h>
1974 ],
1975 [ struct passwd p; p.pw_expire = 0; ],
1976 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1977 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1978 )
1979])
1980if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1981 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1982fi
1983
1984AC_CACHE_CHECK([for pw_change field in struct passwd],
1985 ac_cv_have_pw_change_in_struct_passwd, [
1986 AC_TRY_COMPILE(
1987 [
1988#include <pwd.h>
1989 ],
1990 [ struct passwd p; p.pw_change = 0; ],
1991 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1992 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1993 )
1994])
1995if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1996 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1997fi
Damien Miller61e50f12000-05-08 20:49:37 +10001998
Tim Rice28bbb0c2002-05-27 17:37:32 -07001999dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002000AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2001 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07002002 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00002003 [
Tim Riceae49fe62002-04-12 10:26:21 -07002004#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002005#include <sys/socket.h>
2006#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002007int main() {
2008#ifdef msg_accrights
2009exit(1);
2010#endif
2011struct msghdr m;
2012m.msg_accrights = 0;
2013exit(0);
2014}
Kevin Steves939c9db2002-03-22 17:23:25 +00002015 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002016 [ ac_cv_have_accrights_in_msghdr="yes" ],
2017 [ ac_cv_have_accrights_in_msghdr="no" ]
2018 )
2019])
2020if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2021 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2022fi
2023
Kevin Stevesa44e0352002-04-07 16:18:03 +00002024AC_CACHE_CHECK([for msg_control field in struct msghdr],
2025 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07002026 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002027 [
Tim Riceae49fe62002-04-12 10:26:21 -07002028#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002029#include <sys/socket.h>
2030#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002031int main() {
2032#ifdef msg_control
2033exit(1);
2034#endif
2035struct msghdr m;
2036m.msg_control = 0;
2037exit(0);
2038}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002039 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002040 [ ac_cv_have_control_in_msghdr="yes" ],
2041 [ ac_cv_have_control_in_msghdr="no" ]
2042 )
2043])
2044if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2045 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2046fi
2047
Damien Miller61e50f12000-05-08 20:49:37 +10002048AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002049 AC_TRY_LINK([],
2050 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002051 [ ac_cv_libc_defines___progname="yes" ],
2052 [ ac_cv_libc_defines___progname="no" ]
2053 )
2054])
2055if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2056 AC_DEFINE(HAVE___PROGNAME)
2057fi
2058
Kevin Steves4846f4a2002-03-22 18:19:53 +00002059AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2060 AC_TRY_LINK([
2061#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002062],
2063 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002064 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2065 [ ac_cv_cc_implements___FUNCTION__="no" ]
2066 )
2067])
2068if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2069 AC_DEFINE(HAVE___FUNCTION__)
2070fi
2071
2072AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2073 AC_TRY_LINK([
2074#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002075],
2076 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002077 [ ac_cv_cc_implements___func__="yes" ],
2078 [ ac_cv_cc_implements___func__="no" ]
2079 )
2080])
2081if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2082 AC_DEFINE(HAVE___func__)
2083fi
2084
Damien Miller4f8e6692001-07-14 13:22:53 +10002085AC_CACHE_CHECK([whether getopt has optreset support],
2086 ac_cv_have_getopt_optreset, [
2087 AC_TRY_LINK(
2088 [
2089#include <getopt.h>
2090 ],
2091 [ extern int optreset; optreset = 0; ],
2092 [ ac_cv_have_getopt_optreset="yes" ],
2093 [ ac_cv_have_getopt_optreset="no" ]
2094 )
2095])
2096if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2097 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2098fi
Damien Millera22ba012000-03-02 23:09:20 +11002099
Damien Millerecbb26d2000-07-15 14:59:14 +10002100AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002101 AC_TRY_LINK([],
2102 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002103 [ ac_cv_libc_defines_sys_errlist="yes" ],
2104 [ ac_cv_libc_defines_sys_errlist="no" ]
2105 )
2106])
2107if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2108 AC_DEFINE(HAVE_SYS_ERRLIST)
2109fi
2110
2111
Damien Miller11fa2cc2000-08-16 10:35:58 +10002112AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002113 AC_TRY_LINK([],
2114 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002115 [ ac_cv_libc_defines_sys_nerr="yes" ],
2116 [ ac_cv_libc_defines_sys_nerr="no" ]
2117 )
2118])
2119if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2120 AC_DEFINE(HAVE_SYS_NERR)
2121fi
2122
Damien Millera8e06ce2003-11-21 23:48:55 +11002123SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002124# Check whether user wants sectok support
2125AC_ARG_WITH(sectok,
2126 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002127 [
2128 if test "x$withval" != "xno" ; then
2129 if test "x$withval" != "xyes" ; then
2130 CPPFLAGS="$CPPFLAGS -I${withval}"
2131 LDFLAGS="$LDFLAGS -L${withval}"
2132 if test ! -z "$need_dash_r" ; then
2133 LDFLAGS="$LDFLAGS -R${withval}"
2134 fi
2135 if test ! -z "$blibpath" ; then
2136 blibpath="$blibpath:${withval}"
2137 fi
2138 fi
2139 AC_CHECK_HEADERS(sectok.h)
2140 if test "$ac_cv_header_sectok_h" != yes; then
2141 AC_MSG_ERROR(Can't find sectok.h)
2142 fi
2143 AC_CHECK_LIB(sectok, sectok_open)
2144 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2145 AC_MSG_ERROR(Can't find libsectok)
2146 fi
2147 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002148 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002149 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002150 fi
2151 ]
2152)
2153
2154# Check whether user wants OpenSC support
2155AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10002156 AC_HELP_STRING([--with-opensc=PFX],
2157 [Enable smartcard support using OpenSC]),
2158 opensc_config_prefix="$withval", opensc_config_prefix="")
2159if test x$opensc_config_prefix != x ; then
2160 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2161 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2162 if test "$OPENSC_CONFIG" != "no"; then
2163 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2164 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2165 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2166 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2167 AC_DEFINE(SMARTCARD)
2168 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11002169 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10002170 fi
2171fi
Damien Miller85de5802001-09-18 14:01:11 +10002172
Darren Tucker5f88d342003-10-15 16:57:57 +10002173# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002174AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002175 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002176 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002177 # Needed by our getrrsetbyname()
2178 AC_SEARCH_LIBS(res_query, resolv)
2179 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002180 AC_MSG_CHECKING(if res_query will link)
2181 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2182 [AC_MSG_RESULT(no)
2183 saved_LIBS="$LIBS"
2184 LIBS="$LIBS -lresolv"
2185 AC_MSG_CHECKING(for res_query in -lresolv)
2186 AC_LINK_IFELSE([
2187#include <resolv.h>
2188int main()
2189{
2190 res_query (0, 0, 0, 0, 0);
2191 return 0;
2192}
2193 ],
2194 [LIBS="$LIBS -lresolv"
2195 AC_MSG_RESULT(yes)],
2196 [LIBS="$saved_LIBS"
2197 AC_MSG_RESULT(no)])
2198 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002199 AC_CHECK_FUNCS(_getshort _getlong)
2200 AC_CHECK_MEMBER(HEADER.ad,
2201 [AC_DEFINE(HAVE_HEADER_AD)],,
2202 [#include <arpa/nameser.h>])
2203 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002204
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002205# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002206KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002207AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002208 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002209 [ if test "x$withval" != "xno" ; then
2210 if test "x$withval" = "xyes" ; then
2211 KRB5ROOT="/usr/local"
2212 else
2213 KRB5ROOT=${withval}
2214 fi
2215
2216 AC_DEFINE(KRB5)
2217 KRB5_MSG="yes"
2218
2219 AC_MSG_CHECKING(for krb5-config)
2220 if test -x $KRB5ROOT/bin/krb5-config ; then
2221 KRB5CONF=$KRB5ROOT/bin/krb5-config
2222 AC_MSG_RESULT($KRB5CONF)
2223
2224 AC_MSG_CHECKING(for gssapi support)
2225 if $KRB5CONF | grep gssapi >/dev/null ; then
2226 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002227 AC_DEFINE(GSSAPI)
2228 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002229 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002230 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002231 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002232 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002233 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2234 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002235 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002236 AC_MSG_CHECKING(whether we are using Heimdal)
2237 AC_TRY_COMPILE([ #include <krb5.h> ],
2238 [ char *tmp = heimdal_version; ],
2239 [ AC_MSG_RESULT(yes)
2240 AC_DEFINE(HEIMDAL) ],
2241 AC_MSG_RESULT(no)
2242 )
2243 else
2244 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002245 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002246 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002247 AC_MSG_CHECKING(whether we are using Heimdal)
2248 AC_TRY_COMPILE([ #include <krb5.h> ],
2249 [ char *tmp = heimdal_version; ],
2250 [ AC_MSG_RESULT(yes)
2251 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002252 K5LIBS="-lkrb5 -ldes"
2253 K5LIBS="$K5LIBS -lcom_err -lasn1"
2254 AC_CHECK_LIB(roken, net_write,
2255 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002256 ],
2257 [ AC_MSG_RESULT(no)
2258 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2259 ]
2260 )
Damien Miller200d0a72003-06-30 19:21:36 +10002261 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002262
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002263 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2264 [ AC_DEFINE(GSSAPI)
2265 K5LIBS="-lgssapi $K5LIBS" ],
2266 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2267 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002268 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002269 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2270 $K5LIBS)
2271 ],
2272 $K5LIBS)
2273
2274 AC_CHECK_HEADER(gssapi.h, ,
2275 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002276 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002277 AC_CHECK_HEADERS(gssapi.h, ,
2278 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002279 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002280 ]
2281 )
2282
2283 oldCPP="$CPPFLAGS"
2284 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2285 AC_CHECK_HEADER(gssapi_krb5.h, ,
2286 [ CPPFLAGS="$oldCPP" ])
2287
Damien Millera8e06ce2003-11-21 23:48:55 +11002288 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002289 if test ! -z "$need_dash_r" ; then
2290 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2291 fi
2292 if test ! -z "$blibpath" ; then
2293 blibpath="$blibpath:${KRB5ROOT}/lib"
2294 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002295 fi
2296
2297 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2298 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2299 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2300
2301 LIBS="$LIBS $K5LIBS"
2302 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002303 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002304 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002305)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002306
Damien Millera22ba012000-03-02 23:09:20 +11002307# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002308
Damien Millerf58c6722002-05-13 13:15:42 +10002309PRIVSEP_PATH=/var/empty
2310AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002311 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002312 [
2313 if test "x$withval" != "$no" ; then
2314 PRIVSEP_PATH=$withval
2315 fi
2316 ]
2317)
2318AC_SUBST(PRIVSEP_PATH)
2319
Damien Millera22ba012000-03-02 23:09:20 +11002320AC_ARG_WITH(xauth,
2321 [ --with-xauth=PATH Specify path to xauth program ],
2322 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002323 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002324 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002325 fi
2326 ],
2327 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002328 TestPath="$PATH"
2329 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2330 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2331 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2332 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2333 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002334 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002335 xauth_path="/usr/openwin/bin/xauth"
2336 fi
2337 ]
2338)
2339
Damien Miller7d901272003-01-13 16:55:22 +11002340STRIP_OPT=-s
2341AC_ARG_ENABLE(strip,
2342 [ --disable-strip Disable calling strip(1) on install],
2343 [
2344 if test "x$enableval" = "xno" ; then
2345 STRIP_OPT=
2346 fi
2347 ]
2348)
2349AC_SUBST(STRIP_OPT)
2350
Damien Millera19cf472000-11-29 13:28:50 +11002351if test -z "$xauth_path" ; then
2352 XAUTH_PATH="undefined"
2353 AC_SUBST(XAUTH_PATH)
2354else
Damien Millera22ba012000-03-02 23:09:20 +11002355 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002356 XAUTH_PATH=$xauth_path
2357 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002358fi
Damien Millera22ba012000-03-02 23:09:20 +11002359
2360# Check for mail directory (last resort if we cannot get it from headers)
2361if test ! -z "$MAIL" ; then
2362 maildir=`dirname $MAIL`
2363 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2364fi
2365
Damien Millera22ba012000-03-02 23:09:20 +11002366if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002367 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002368 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002369 [
2370 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2371 have_dev_ptmx=1
2372 ]
2373 )
2374 fi
Damien Millera22ba012000-03-02 23:09:20 +11002375fi
Damien Millera8e06ce2003-11-21 23:48:55 +11002376AC_CHECK_FILE("/dev/ptc",
Damien Miller204ad072000-03-02 23:56:12 +11002377 [
2378 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2379 have_dev_ptc=1
2380 ]
2381)
2382
Damien Millera22ba012000-03-02 23:09:20 +11002383# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002384AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002385 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002386 [
Damien Miller897741e2001-04-16 10:41:46 +10002387 case "$withval" in
2388 man|cat|doc)
2389 MANTYPE=$withval
2390 ;;
2391 *)
2392 AC_MSG_ERROR(invalid man type: $withval)
2393 ;;
2394 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002395 ]
2396)
Ben Lindstrombc709922001-04-18 18:04:21 +00002397if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002398 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2399 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002400 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2401 MANTYPE=doc
2402 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2403 MANTYPE=man
2404 else
2405 MANTYPE=cat
2406 fi
2407fi
Damien Miller670a4b82000-01-22 13:53:11 +11002408AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002409if test "$MANTYPE" = "doc"; then
2410 mansubdir=man;
2411else
2412 mansubdir=$MANTYPE;
2413fi
2414AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002415
Damien Millera22ba012000-03-02 23:09:20 +11002416# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002417MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002418AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002419 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002420 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002421 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002422 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002423 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002424 fi
2425 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002426)
2427
Damien Millera22ba012000-03-02 23:09:20 +11002428# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002429AC_ARG_WITH(shadow,
2430 [ --without-shadow Disable shadow password support],
2431 [
2432 if test "x$withval" = "xno" ; then
2433 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002434 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002435 fi
2436 ]
2437)
2438
Damien Miller1f335fb2000-06-26 11:31:33 +10002439if test -z "$disable_shadow" ; then
2440 AC_MSG_CHECKING([if the systems has expire shadow information])
2441 AC_TRY_COMPILE(
2442 [
2443#include <sys/types.h>
2444#include <shadow.h>
2445 struct spwd sp;
2446 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2447 [ sp_expire_available=yes ], []
2448 )
2449
2450 if test "x$sp_expire_available" = "xyes" ; then
2451 AC_MSG_RESULT(yes)
2452 AC_DEFINE(HAS_SHADOW_EXPIRE)
2453 else
2454 AC_MSG_RESULT(no)
2455 fi
2456fi
2457
Damien Millera22ba012000-03-02 23:09:20 +11002458# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002459if test ! -z "$IPADDR_IN_DISPLAY" ; then
2460 DISPLAY_HACK_MSG="yes"
2461 AC_DEFINE(IPADDR_IN_DISPLAY)
2462else
Damien Millera8e06ce2003-11-21 23:48:55 +11002463 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002464 AC_ARG_WITH(ipaddr-display,
2465 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2466 [
2467 if test "x$withval" != "xno" ; then
2468 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002469 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002470 fi
2471 ]
2472 )
2473fi
Damien Miller76112de1999-12-21 11:18:08 +11002474
Darren Tuckere1a790d2003-09-16 11:52:19 +10002475# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002476AC_ARG_ENABLE(etc-default-login,
2477 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2478[
Darren Tuckere1a790d2003-09-16 11:52:19 +10002479AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2480
2481if test "x$external_path_file" = "x/etc/default/login"; then
2482 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2483fi
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002484])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002485
Tim Rice43a1c132002-04-17 21:19:14 -07002486dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2487if test $ac_cv_func_login_getcapbool = "yes" -a \
2488 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002489 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002490fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002491
Damien Millera22ba012000-03-02 23:09:20 +11002492# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002493SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002494AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002495 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002496 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002497 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002498 AC_MSG_WARN([
2499--with-default-path=PATH has no effect on this system.
2500Edit /etc/login.conf instead.])
2501 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002502 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002503 AC_MSG_WARN([
2504--with-default-path=PATH will only be used if PATH is not defined in
2505$external_path_file .])
2506 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002507 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002508 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002509 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002510 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002511 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2512 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002513 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002514 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002515 AC_MSG_WARN([
2516If PATH is defined in $external_path_file, ensure the path to scp is included,
2517otherwise scp will not work.])
2518 fi
2519 AC_TRY_RUN(
2520 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002521/* find out what STDPATH is */
2522#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002523#ifdef HAVE_PATHS_H
2524# include <paths.h>
2525#endif
2526#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002527# ifdef _PATH_USERPATH /* Irix */
2528# define _PATH_STDPATH _PATH_USERPATH
2529# else
2530# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2531# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002532#endif
2533#include <sys/types.h>
2534#include <sys/stat.h>
2535#include <fcntl.h>
2536#define DATA "conftest.stdpath"
2537
2538main()
2539{
2540 FILE *fd;
2541 int rc;
2542
2543 fd = fopen(DATA,"w");
2544 if(fd == NULL)
2545 exit(1);
2546
2547 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2548 exit(1);
2549
2550 exit(0);
2551}
2552 ], [ user_path=`cat conftest.stdpath` ],
2553 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2554 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2555 )
2556# make sure $bindir is in USER_PATH so scp will work
2557 t_bindir=`eval echo ${bindir}`
2558 case $t_bindir in
2559 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2560 esac
2561 case $t_bindir in
2562 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2563 esac
2564 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2565 if test $? -ne 0 ; then
2566 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2567 if test $? -ne 0 ; then
2568 user_path=$user_path:$t_bindir
2569 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2570 fi
2571 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002572 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002573)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002574if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002575 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2576 AC_SUBST(user_path)
2577fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002578
Damien Millera18bbd32002-05-13 10:48:57 +10002579# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002580AC_ARG_WITH(superuser-path,
2581 [ --with-superuser-path= Specify different path for super-user],
2582 [
2583 if test "x$withval" != "xno" ; then
2584 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2585 superuser_path=$withval
2586 fi
2587 ]
2588)
2589
2590
Damien Miller61e50f12000-05-08 20:49:37 +10002591AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002592IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002593AC_ARG_WITH(4in6,
2594 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2595 [
2596 if test "x$withval" != "xno" ; then
2597 AC_MSG_RESULT(yes)
2598 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002599 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002600 else
2601 AC_MSG_RESULT(no)
2602 fi
2603 ],[
2604 if test "x$inet6_default_4in6" = "xyes"; then
2605 AC_MSG_RESULT([yes (default)])
2606 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002607 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002608 else
2609 AC_MSG_RESULT([no (default)])
2610 fi
2611 ]
2612)
2613
Damien Miller60396b02001-02-18 17:01:00 +11002614# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002615BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002616AC_ARG_WITH(bsd-auth,
2617 [ --with-bsd-auth Enable BSD auth support],
2618 [
2619 if test "x$withval" != "xno" ; then
2620 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002621 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002622 fi
2623 ]
2624)
2625
Damien Millera22ba012000-03-02 23:09:20 +11002626# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002627piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002628# make sure the directory exists
2629if test ! -d $piddir ; then
2630 piddir=`eval echo ${sysconfdir}`
2631 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002632 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002633 esac
2634fi
2635
Tim Rice88f2ab52002-03-17 12:17:34 -08002636AC_ARG_WITH(pid-dir,
2637 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2638 [
2639 if test "x$withval" != "xno" ; then
2640 piddir=$withval
2641 if test ! -d $piddir ; then
2642 AC_MSG_WARN([** no $piddir directory on this system **])
2643 fi
2644 fi
2645 ]
2646)
2647
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002648AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002649AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002650
andre2ff7b5d2000-06-03 14:57:40 +00002651dnl allow user to disable some login recording features
2652AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002653 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002654 [
2655 if test "x$enableval" = "xno" ; then
2656 AC_DEFINE(DISABLE_LASTLOG)
2657 fi
2658 ]
andre2ff7b5d2000-06-03 14:57:40 +00002659)
2660AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002661 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002662 [
2663 if test "x$enableval" = "xno" ; then
2664 AC_DEFINE(DISABLE_UTMP)
2665 fi
2666 ]
andre2ff7b5d2000-06-03 14:57:40 +00002667)
2668AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002669 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002670 [
2671 if test "x$enableval" = "xno" ; then
2672 AC_DEFINE(DISABLE_UTMPX)
2673 fi
2674 ]
andre2ff7b5d2000-06-03 14:57:40 +00002675)
2676AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002677 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002678 [
2679 if test "x$enableval" = "xno" ; then
2680 AC_DEFINE(DISABLE_WTMP)
2681 fi
2682 ]
andre2ff7b5d2000-06-03 14:57:40 +00002683)
2684AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002685 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002686 [
2687 if test "x$enableval" = "xno" ; then
2688 AC_DEFINE(DISABLE_WTMPX)
2689 fi
2690 ]
andre2ff7b5d2000-06-03 14:57:40 +00002691)
2692AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002693 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002694 [
2695 if test "x$enableval" = "xno" ; then
2696 AC_DEFINE(DISABLE_LOGIN)
2697 fi
2698 ]
andre2ff7b5d2000-06-03 14:57:40 +00002699)
2700AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002701 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002702 [
2703 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002704 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002705 fi
2706 ]
andre2ff7b5d2000-06-03 14:57:40 +00002707)
2708AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002709 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002710 [
2711 if test "x$enableval" = "xno" ; then
2712 AC_DEFINE(DISABLE_PUTUTXLINE)
2713 fi
2714 ]
andre2ff7b5d2000-06-03 14:57:40 +00002715)
2716AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002717 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002718 [
2719 if test "x$withval" = "xno" ; then
2720 AC_DEFINE(DISABLE_LASTLOG)
2721 else
2722 conf_lastlog_location=$withval
2723 fi
2724 ]
2725)
andre2ff7b5d2000-06-03 14:57:40 +00002726
2727dnl lastlog, [uw]tmpx? detection
2728dnl NOTE: set the paths in the platform section to avoid the
2729dnl need for command-line parameters
2730dnl lastlog and [uw]tmp are subject to a file search if all else fails
2731
2732dnl lastlog detection
2733dnl NOTE: the code itself will detect if lastlog is a directory
2734AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2735AC_TRY_COMPILE([
2736#include <sys/types.h>
2737#include <utmp.h>
2738#ifdef HAVE_LASTLOG_H
2739# include <lastlog.h>
2740#endif
Damien Miller2994e082000-06-04 15:51:47 +10002741#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002742# include <paths.h>
2743#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002744#ifdef HAVE_LOGIN_H
2745# include <login.h>
2746#endif
andre2ff7b5d2000-06-03 14:57:40 +00002747 ],
2748 [ char *lastlog = LASTLOG_FILE; ],
2749 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002750 [
2751 AC_MSG_RESULT(no)
2752 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2753 AC_TRY_COMPILE([
2754#include <sys/types.h>
2755#include <utmp.h>
2756#ifdef HAVE_LASTLOG_H
2757# include <lastlog.h>
2758#endif
2759#ifdef HAVE_PATHS_H
2760# include <paths.h>
2761#endif
2762 ],
2763 [ char *lastlog = _PATH_LASTLOG; ],
2764 [ AC_MSG_RESULT(yes) ],
2765 [
andree441aa32000-06-12 22:34:38 +00002766 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002767 system_lastlog_path=no
2768 ])
2769 ]
andre2ff7b5d2000-06-03 14:57:40 +00002770)
Damien Miller2994e082000-06-04 15:51:47 +10002771
andre2ff7b5d2000-06-03 14:57:40 +00002772if test -z "$conf_lastlog_location"; then
2773 if test x"$system_lastlog_path" = x"no" ; then
2774 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002775 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002776 conf_lastlog_location=$f
2777 fi
2778 done
2779 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002780 AC_MSG_WARN([** Cannot find lastlog **])
2781 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002782 fi
2783 fi
2784fi
2785
2786if test -n "$conf_lastlog_location"; then
2787 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2788fi
2789
2790dnl utmp detection
2791AC_MSG_CHECKING([if your system defines UTMP_FILE])
2792AC_TRY_COMPILE([
2793#include <sys/types.h>
2794#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002795#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002796# include <paths.h>
2797#endif
2798 ],
2799 [ char *utmp = UTMP_FILE; ],
2800 [ AC_MSG_RESULT(yes) ],
2801 [ AC_MSG_RESULT(no)
2802 system_utmp_path=no ]
2803)
2804if test -z "$conf_utmp_location"; then
2805 if test x"$system_utmp_path" = x"no" ; then
2806 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2807 if test -f $f ; then
2808 conf_utmp_location=$f
2809 fi
2810 done
2811 if test -z "$conf_utmp_location"; then
2812 AC_DEFINE(DISABLE_UTMP)
2813 fi
2814 fi
2815fi
2816if test -n "$conf_utmp_location"; then
2817 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2818fi
2819
2820dnl wtmp detection
2821AC_MSG_CHECKING([if your system defines WTMP_FILE])
2822AC_TRY_COMPILE([
2823#include <sys/types.h>
2824#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002825#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002826# include <paths.h>
2827#endif
2828 ],
2829 [ char *wtmp = WTMP_FILE; ],
2830 [ AC_MSG_RESULT(yes) ],
2831 [ AC_MSG_RESULT(no)
2832 system_wtmp_path=no ]
2833)
2834if test -z "$conf_wtmp_location"; then
2835 if test x"$system_wtmp_path" = x"no" ; then
2836 for f in /usr/adm/wtmp /var/log/wtmp; do
2837 if test -f $f ; then
2838 conf_wtmp_location=$f
2839 fi
2840 done
2841 if test -z "$conf_wtmp_location"; then
2842 AC_DEFINE(DISABLE_WTMP)
2843 fi
2844 fi
2845fi
2846if test -n "$conf_wtmp_location"; then
2847 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2848fi
2849
2850
2851dnl utmpx detection - I don't know any system so perverse as to require
2852dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2853dnl there, though.
2854AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2855AC_TRY_COMPILE([
2856#include <sys/types.h>
2857#include <utmp.h>
2858#ifdef HAVE_UTMPX_H
2859#include <utmpx.h>
2860#endif
Damien Miller2994e082000-06-04 15:51:47 +10002861#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002862# include <paths.h>
2863#endif
2864 ],
2865 [ char *utmpx = UTMPX_FILE; ],
2866 [ AC_MSG_RESULT(yes) ],
2867 [ AC_MSG_RESULT(no)
2868 system_utmpx_path=no ]
2869)
2870if test -z "$conf_utmpx_location"; then
2871 if test x"$system_utmpx_path" = x"no" ; then
2872 AC_DEFINE(DISABLE_UTMPX)
2873 fi
2874else
2875 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2876fi
2877
2878dnl wtmpx detection
2879AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2880AC_TRY_COMPILE([
2881#include <sys/types.h>
2882#include <utmp.h>
2883#ifdef HAVE_UTMPX_H
2884#include <utmpx.h>
2885#endif
Damien Miller2994e082000-06-04 15:51:47 +10002886#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002887# include <paths.h>
2888#endif
2889 ],
2890 [ char *wtmpx = WTMPX_FILE; ],
2891 [ AC_MSG_RESULT(yes) ],
2892 [ AC_MSG_RESULT(no)
2893 system_wtmpx_path=no ]
2894)
2895if test -z "$conf_wtmpx_location"; then
2896 if test x"$system_wtmpx_path" = x"no" ; then
2897 AC_DEFINE(DISABLE_WTMPX)
2898 fi
2899else
2900 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2901fi
2902
Damien Miller4018c192000-04-30 09:30:44 +10002903
Damien Miller29ea30d2000-03-17 10:54:15 +11002904if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002905 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2906 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002907fi
2908
Tim Rice4cec93f2002-02-26 08:40:48 -08002909dnl remove pam and dl because they are in $LIBPAM
2910if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002911 LIBS=`echo $LIBS | sed 's/-lpam //'`
2912fi
2913if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2914 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002915fi
2916
Damien Millerbac2d8a2000-09-05 16:13:06 +11002917AC_EXEEXT
Tim Rice6f1f7582004-05-30 21:38:51 -07002918AC_CONFIG_FILES([Makefile buildpkg.sh openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
Tim Rice13aae5e2001-10-21 17:53:58 -07002919AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002920
Damien Miller7b22d652000-06-18 14:07:04 +10002921# Print summary of options
2922
Damien Miller7b22d652000-06-18 14:07:04 +10002923# Someone please show me a better way :)
2924A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2925B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2926C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2927D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002928E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002929F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002930G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002931H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2932I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2933J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002934
2935echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002936echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002937echo " User binaries: $B"
2938echo " System binaries: $C"
2939echo " Configuration files: $D"
2940echo " Askpass program: $E"
2941echo " Manual pages: $F"
2942echo " PID file: $G"
2943echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002944if test "x$external_path_file" = "x/etc/login.conf" ; then
2945echo " At runtime, sshd will use the path defined in $external_path_file"
2946echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002947else
Damien Millerf58c6722002-05-13 13:15:42 +10002948echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002949 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002950echo " (If PATH is set in $external_path_file it will be used instead. If"
2951echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2952 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002953fi
Damien Millera18bbd32002-05-13 10:48:57 +10002954if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002955echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002956fi
Damien Millerf58c6722002-05-13 13:15:42 +10002957echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10002958echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002959echo " KerberosV support: $KRB5_MSG"
2960echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002961echo " S/KEY support: $SKEY_MSG"
2962echo " TCP Wrappers support: $TCPW_MSG"
2963echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002964echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002965echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2966echo " BSD Auth support: $BSD_AUTH_MSG"
2967echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002968if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002969echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002970fi
2971
Damien Miller7b22d652000-06-18 14:07:04 +10002972echo ""
2973
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002974echo " Host: ${host}"
2975echo " Compiler: ${CC}"
2976echo " Compiler flags: ${CFLAGS}"
2977echo "Preprocessor flags: ${CPPFLAGS}"
2978echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002979echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002980
2981echo ""
2982
Tim Rice6f1f7582004-05-30 21:38:51 -07002983if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
2984 echo "SVR4 style packages are supported with \"make package\"\n"
2985fi
2986
Damien Miller82cf0ce2000-12-20 13:34:48 +11002987if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002988 echo "PAM is enabled. You may need to install a PAM control file "
2989 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11002990 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11002991 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002992 echo ""
2993fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002994
Damien Miller6c21c512002-01-22 21:57:53 +11002995if test ! -z "$RAND_HELPER_CMDHASH" ; then
2996 echo "WARNING: you are using the builtin random number collection "
2997 echo "service. Please read WARNING.RNG and request that your OS "
2998 echo "vendor includes kernel-based random number collection in "
2999 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003000 echo ""
3001fi
Damien Miller60396b02001-02-18 17:01:00 +11003002
Damien Millerb4097182004-05-23 14:09:40 +10003003if test ! -z "$NO_PEERCHECK" ; then
3004 echo "WARNING: the operating system that you are using does not "
3005 echo "appear to support either the getpeereid() API nor the "
3006 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3007 echo "enforce security checks to prevent unauthorised connections to "
3008 echo "ssh-agent. Their absence increases the risk that a malicious "
3009 echo "user can connect to your agent. "
3010 echo ""
3011fi
3012