blob: 3f27bf9a7b23001a07c64b3ed9b0de46d01f80b7 [file] [log] [blame]
Darren Tuckere59b5082004-06-28 16:01:19 +10001# $Id: configure.ac,v 1.223 2004/06/28 06:01:20 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Tim Rice13aae5e2001-10-21 17:53:58 -070017AC_INIT
18AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
60 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
61else
62 # Search for login
63 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
64 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
65 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
66 fi
67fi
68
Darren Tucker23bc8d02004-02-06 16:24:31 +110069AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
70if test ! -z "$PATH_PASSWD_PROG" ; then
71 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
72fi
73
Damien Miller166bd442000-03-16 10:48:25 +110074if test -z "$LD" ; then
75 LD=$CC
76fi
77AC_SUBST(LD)
78
Damien Miller166bd442000-03-16 10:48:25 +110079AC_C_INLINE
Damien Millera8e06ce2003-11-21 23:48:55 +110080if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Miller649d9992001-06-27 23:35:51 +100081 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110082fi
83
Tim Rice88368a32003-12-08 12:35:59 -080084AC_ARG_WITH(rpath,
85 [ --without-rpath Disable auto-added -R linker paths],
86 [
87 if test "x$withval" = "xno" ; then
88 need_dash_r=""
89 fi
90 if test "x$withval" = "xyes" ; then
91 need_dash_r=1
92 fi
93 ]
94)
95
Damien Millera22ba012000-03-02 23:09:20 +110096# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110097case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110098*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +110099 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000100 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800101 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100102 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000103 saved_LDFLAGS="$LDFLAGS"
104 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
105 if (test -z "$blibflags"); then
106 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
107 AC_TRY_LINK([], [], [blibflags=$tryflags])
108 fi
109 done
110 if (test -z "$blibflags"); then
111 AC_MSG_RESULT(not found)
112 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
113 else
114 AC_MSG_RESULT($blibflags)
115 fi
116 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000117 dnl Check for authenticate. Might be in libs.a on older AIXes
118 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -0700119 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000120 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700121 LIBS="$LIBS -ls"
122 ])
123 ])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000124 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
125 AC_CHECK_DECL(loginfailed,
126 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
127 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000128 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000129 [(void)loginfailed("user","host","tty",0);],
130 [AC_MSG_RESULT(yes)
131 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000132 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000133 )],
134 [],
135 [#include <usersec.h>]
136 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000137 AC_CHECK_FUNCS(setauthdb)
Damien Millereca71f82000-01-20 22:38:27 +1100138 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +1000139 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000140 AC_DEFINE(SETEUID_BREAKS_SETUID)
141 AC_DEFINE(BROKEN_SETREUID)
142 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000143 dnl AIX handles lastlog as part of its login message
144 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000145 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000146 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100147 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100148*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100149 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800150 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100151 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000152 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100153 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100154 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000155 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000156 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700157 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +0000158 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100159 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000160*-*-dgux*)
161 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100162 AC_DEFINE(SETEUID_BREAKS_SETUID)
163 AC_DEFINE(BROKEN_SETREUID)
164 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000165 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000166*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000167 AC_MSG_CHECKING(if we have working getaddrinfo)
168 AC_TRY_RUN([#include <mach-o/dyld.h>
169main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
170 exit(0);
171 else
172 exit(1);
173}], [AC_MSG_RESULT(working)],
174 [AC_MSG_RESULT(buggy)
175 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700176 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000177 AC_DEFINE(SETEUID_BREAKS_SETUID)
178 AC_DEFINE(BROKEN_SETREUID)
179 AC_DEFINE(BROKEN_SETREGID)
Damien Miller7a2ea782004-01-02 17:52:10 +1100180 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000181 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000182*-*-hpux10.26)
183 if test -z "$GCC"; then
184 CFLAGS="$CFLAGS -Ae"
185 fi
186 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
187 IPADDR_IN_DISPLAY=yes
188 AC_DEFINE(HAVE_SECUREWARE)
189 AC_DEFINE(USE_PIPES)
190 AC_DEFINE(LOGIN_NO_ENDOPT)
191 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000192 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000193 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700194 LIBS="$LIBS -lsec -lsecpw"
195 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000196 disable_ptmx_check=yes
197 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100198*-*-hpux10*)
199 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000200 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100201 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000202 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100203 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000204 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000205 AC_DEFINE(LOGIN_NO_ENDOPT)
206 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000207 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000208 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700209 LIBS="$LIBS -lsec"
210 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100211 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000212*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000213 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100214 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100215 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100216 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000217 AC_DEFINE(LOGIN_NO_ENDOPT)
218 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100219 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000220 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000221 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker4398cf52004-04-06 21:39:02 +1000222 check_for_hpux_broken_getaddrinfo=1
Tim Ricef028f1e2002-07-19 12:41:10 -0700223 LIBS="$LIBS -lsec"
224 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000225 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100226*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100227 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000228 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000229 AC_DEFINE(SETEUID_BREAKS_SETUID)
230 AC_DEFINE(BROKEN_SETREUID)
231 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000232 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000233 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100234 ;;
235*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100236 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000237 AC_DEFINE(WITH_IRIX_ARRAY)
238 AC_DEFINE(WITH_IRIX_PROJECT)
239 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000240 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000241 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000242 AC_DEFINE(SETEUID_BREAKS_SETUID)
243 AC_DEFINE(BROKEN_SETREUID)
244 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000245 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000246 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000247 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100248 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100249*-*-linux*)
250 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100251 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000252 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100253 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000254 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000255 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000256 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Darren Tuckere59b5082004-06-28 16:01:19 +1000257 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM)
Damien Miller7bcb0892000-03-11 20:45:40 +1100258 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000259 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000260 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000261 AC_DEFINE(BROKEN_CMSG_TYPE)
262 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000263 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100264 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000265mips-sony-bsd|mips-sony-newsos4)
266 AC_DEFINE(HAVE_NEWS4)
267 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000268 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100269*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000270 check_for_libcrypt_before=1
Tim Rice88368a32003-12-08 12:35:59 -0800271 if test "x$withval" != "xno" ; then
272 need_dash_r=1
273 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100274 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100275*-*-freebsd*)
276 check_for_libcrypt_later=1
277 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000278*-*-bsdi*)
279 AC_DEFINE(SETEUID_BREAKS_SETUID)
280 AC_DEFINE(BROKEN_SETREUID)
281 AC_DEFINE(BROKEN_SETREGID)
282 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000283*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000284 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100285 conf_utmp_location=/etc/utmp
286 conf_wtmp_location=/usr/adm/wtmp
287 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000288 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000289 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000290 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100291 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000292 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100293*-*-solaris*)
Tim Ricead4a1882004-02-29 15:53:37 -0800294 if test "x$withval" != "xno" ; then
295 need_dash_r=1
296 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100297 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000298 AC_DEFINE(LOGIN_NEEDS_UTMPX)
299 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000300 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000301 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000302 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
303 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000304 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000305 # hardwire lastlog location (can't detect it on some versions)
306 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000307 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
308 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
309 if test "$sol2ver" -ge 8; then
310 AC_MSG_RESULT(yes)
311 AC_DEFINE(DISABLE_UTMP)
312 AC_DEFINE(DISABLE_WTMP)
313 else
314 AC_MSG_RESULT(no)
315 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100316 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000317*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000318 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000319 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100320 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000321 conf_utmp_location=/etc/utmp
322 conf_wtmp_location=/var/adm/wtmp
323 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000324 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000325 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000326*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700327 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000328 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000329 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000330 AC_DEFINE(SETEUID_BREAKS_SETUID)
331 AC_DEFINE(BROKEN_SETREUID)
332 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000333 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000334*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700335 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000336 AC_CHECK_LIB(dl, dlsym, ,)
Damien Millerfd9885e2001-01-10 08:16:53 +1100337 IPADDR_IN_DISPLAY=yes
338 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000339 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000340 AC_DEFINE(SETEUID_BREAKS_SETUID)
341 AC_DEFINE(BROKEN_SETREUID)
342 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000343 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000344 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700345 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
346 # Attention: always take care to bind libsocket and libnsl before libc,
347 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000348 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100349*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100350 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700351 AC_DEFINE(SETEUID_BREAKS_SETUID)
352 AC_DEFINE(BROKEN_SETREUID)
353 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100354 ;;
355*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100356 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700357 AC_DEFINE(SETEUID_BREAKS_SETUID)
358 AC_DEFINE(BROKEN_SETREUID)
359 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100360 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100361*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100362 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100363*-*-sco3.2v4*)
Tim Ricefcb62202004-01-23 18:35:16 -0800364 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize"
Tim Ricee8c898a2004-02-23 21:47:04 -0800365 LIBS="$LIBS -los -lprot -lcrypt_i -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100366 RANLIB=true
367 no_dev_ptmx=1
368 AC_DEFINE(BROKEN_SYS_TERMIO_H)
369 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000370 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000371 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100372 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Ricefe6d5aa2004-04-16 20:03:07 -0700373 AC_DEFINE(SETEUID_BREAKS_SETUID)
374 AC_DEFINE(BROKEN_SETREUID)
375 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700376 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100377 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700378 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700379 do_sco3_extra_lib_check=yes
Tim Ricef7ba8f62004-06-20 10:37:32 -0700380 TEST_SHELL=ksh
Damien Miller78315eb2000-09-29 23:01:36 +1100381 ;;
382*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800383 if test -z "$GCC"; then
384 CFLAGS="$CFLAGS -belf"
385 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100386 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000387 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100388 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000389 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000390 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700391 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700392 AC_DEFINE(SETEUID_BREAKS_SETUID)
393 AC_DEFINE(BROKEN_SETREUID)
394 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700395 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100396 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700397 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700398 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000399 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000400*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100401 AC_DEFINE(NO_SSH_LASTLOG)
402 AC_DEFINE(SETEUID_BREAKS_SETUID)
403 AC_DEFINE(BROKEN_SETREUID)
404 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000405 AC_DEFINE(USE_PIPES)
406 AC_DEFINE(DISABLE_FD_PASSING)
407 LDFLAGS="$LDFLAGS"
408 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
409 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000410 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000411*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100412 AC_DEFINE(SETEUID_BREAKS_SETUID)
413 AC_DEFINE(BROKEN_SETREUID)
414 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000415 AC_DEFINE(WITH_ABBREV_NO_TTY)
416 AC_DEFINE(USE_PIPES)
417 AC_DEFINE(DISABLE_FD_PASSING)
418 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100419 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000420 MANTYPE=cat
421 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000422*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100423 AC_DEFINE(SETEUID_BREAKS_SETUID)
424 AC_DEFINE(BROKEN_SETREUID)
425 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000426 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700427 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700428 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000429 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
430 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
431 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700432 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000433*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000434 AC_MSG_CHECKING(for Digital Unix SIA)
435 no_osfsia=""
436 AC_ARG_WITH(osfsia,
437 [ --with-osfsia Enable Digital Unix SIA],
438 [
439 if test "x$withval" = "xno" ; then
440 AC_MSG_RESULT(disabled)
441 no_osfsia=1
442 fi
443 ],
444 )
445 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000446 if test -f /etc/sia/matrix.conf; then
447 AC_MSG_RESULT(yes)
448 AC_DEFINE(HAVE_OSF_SIA)
449 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000450 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000451 LIBS="$LIBS -lsecurity -ldb -lm -laud"
452 else
453 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100454 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000455 fi
456 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000457 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700458 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000459 AC_DEFINE(BROKEN_SETREUID)
460 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000461 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000462
463*-*-nto-qnx)
464 AC_DEFINE(USE_PIPES)
465 AC_DEFINE(NO_X11_UNIX_SOCKETS)
466 AC_DEFINE(MISSING_NFDBITS)
467 AC_DEFINE(MISSING_HOWMANY)
468 AC_DEFINE(MISSING_FD_MASK)
469 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100470esac
471
Damien Millere37bfc12000-06-05 09:37:43 +1000472# Allow user to specify flags
473AC_ARG_WITH(cflags,
474 [ --with-cflags Specify additional flags to pass to compiler],
475 [
476 if test "x$withval" != "xno" ; then
477 CFLAGS="$CFLAGS $withval"
478 fi
479 ]
480)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000481AC_ARG_WITH(cppflags,
482 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
483 [
484 if test "x$withval" != "xno"; then
485 CPPFLAGS="$CPPFLAGS $withval"
486 fi
487 ]
488)
Damien Millere37bfc12000-06-05 09:37:43 +1000489AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000490 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000491 [
492 if test "x$withval" != "xno" ; then
493 LDFLAGS="$LDFLAGS $withval"
494 fi
495 ]
496)
497AC_ARG_WITH(libs,
498 [ --with-libs Specify additional libraries to link with],
499 [
500 if test "x$withval" != "xno" ; then
501 LIBS="$LIBS $withval"
502 fi
503 ]
504)
505
Darren Tucker6eb93042003-06-29 21:30:41 +1000506AC_MSG_CHECKING(compiler and flags for sanity)
507AC_TRY_RUN([
508#include <stdio.h>
509int main(){exit(0);}
510 ],
511 [ AC_MSG_RESULT(yes) ],
512 [
513 AC_MSG_RESULT(no)
514 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
515 ]
516)
517
Tim Rice4cec93f2002-02-26 08:40:48 -0800518# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000519AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000520 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800521 login_cap.h maillock.h netdb.h netgroup.h \
Damien Miller0f47c532004-01-02 18:01:30 +1100522 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000523 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000524 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
Damien Miller6c4914a2004-03-03 11:08:59 +1100525 sys/cdefs.h sys/mman.h sys/prctl.h sys/pstat.h sys/ptms.h \
526 sys/select.h sys/stat.h sys/stream.h sys/stropts.h \
527 sys/sysmacros.h sys/time.h sys/timers.h sys/un.h time.h tmpdir.h \
528 ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
Tim Rice4cec93f2002-02-26 08:40:48 -0800529
Damien Millera22ba012000-03-02 23:09:20 +1100530# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700531AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
532AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000533
Damien Millerdf288022001-02-18 13:07:07 +1100534dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700535if test "x$with_tcp_wrappers" != "xno" ; then
536 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
537 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
538 fi
539fi
Damien Millerdf288022001-02-18 13:07:07 +1100540
Tim Rice1e1ef642003-09-11 22:19:31 -0700541dnl IRIX and Solaris 2.5.1 have dirname() in libgen
542AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
543 AC_CHECK_LIB(gen, dirname,[
544 AC_CACHE_CHECK([for broken dirname],
545 ac_cv_have_broken_dirname, [
546 save_LIBS="$LIBS"
547 LIBS="$LIBS -lgen"
548 AC_TRY_RUN(
549 [
550#include <libgen.h>
551#include <string.h>
552
553int main(int argc, char **argv) {
554 char *s, buf[32];
555
556 strncpy(buf,"/etc", 32);
557 s = dirname(buf);
558 if (!s || strncmp(s, "/", 32) != 0) {
559 exit(1);
560 } else {
561 exit(0);
562 }
563}
564 ],
565 [ ac_cv_have_broken_dirname="no" ],
566 [ ac_cv_have_broken_dirname="yes" ]
567 )
568 LIBS="$save_LIBS"
569 ])
570 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
571 LIBS="$LIBS -lgen"
572 AC_DEFINE(HAVE_DIRNAME)
573 AC_CHECK_HEADERS(libgen.h)
574 fi
575 ])
576])
577
578AC_CHECK_FUNC(getspnam, ,
579 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
580AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
581
Tim Rice13aae5e2001-10-21 17:53:58 -0700582dnl zlib is required
583AC_ARG_WITH(zlib,
584 [ --with-zlib=PATH Use zlib in PATH],
585 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000586 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100587 AC_MSG_ERROR([*** zlib is required ***])
588 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700589 if test -d "$withval/lib"; then
590 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700591 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700592 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700593 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700594 fi
595 else
596 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700597 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700598 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700599 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700600 fi
601 fi
602 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700603 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700604 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700605 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700606 fi
607 ]
608)
609
Tim Ricefcb62202004-01-23 18:35:16 -0800610AC_CHECK_LIB(z, deflate, ,
611 [
612 saved_CPPFLAGS="$CPPFLAGS"
613 saved_LDFLAGS="$LDFLAGS"
614 save_LIBS="$LIBS"
615 dnl Check default zlib install dir
616 if test -n "${need_dash_r}"; then
617 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
618 else
619 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
620 fi
621 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
622 LIBS="$LIBS -lz"
623 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
624 [
625 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
626 ]
627 )
628 ]
629)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100630AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100631
632AC_ARG_WITH(zlib-version-check,
633 [ --without-zlib-version-check Disable zlib version check],
634 [ if test "x$withval" = "xno" ; then
635 zlib_check_nonfatal=1
636 fi
637 ]
638)
639
Darren Tucker2dcd2392004-01-23 17:13:33 +1100640AC_MSG_CHECKING(for zlib 1.1.4 or greater)
641AC_TRY_RUN([
642#include <zlib.h>
643int main()
644{
645 int a, b, c, v;
646 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
647 exit(1);
648 v = a*1000000 + b*1000 + c;
649 if (v >= 1001004)
650 exit(0);
651 exit(2);
652}
653 ],
654 AC_MSG_RESULT(yes),
655 [ AC_MSG_RESULT(no)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100656 if test -z "$zlib_check_nonfatal" ; then
657 AC_MSG_ERROR([*** zlib too old - check config.log ***
658Your reported zlib version has known security problems. It's possible your
659vendor has fixed these problems without changing the version number. If you
660are sure this is the case, you can disable the check by running
661"./configure --without-zlib-version-check".
662If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
663 else
664 AC_MSG_WARN([zlib version may have security problems])
665 fi
666 ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100667)
Damien Miller6f9c3372000-10-25 10:06:04 +1100668
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000669dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100670AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000671 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
672)
Damien Millera8e06ce2003-11-21 23:48:55 +1100673AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700674 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
675 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000676)
Damien Millerab18c411999-11-11 10:40:23 +1100677
Tim Ricee589a292001-11-03 11:09:32 -0800678dnl Checks for libutil functions
679AC_CHECK_HEADERS(libutil.h)
680AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
681AC_CHECK_FUNCS(logout updwtmp logwtmp)
682
Ben Lindstrom8697e082001-02-24 21:41:10 +0000683AC_FUNC_STRFTIME
684
Damien Miller3c027682001-03-14 11:39:45 +1100685# Check for ALTDIRFUNC glob() extension
686AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
687AC_EGREP_CPP(FOUNDIT,
688 [
689 #include <glob.h>
690 #ifdef GLOB_ALTDIRFUNC
691 FOUNDIT
692 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100693 ],
Damien Miller3c027682001-03-14 11:39:45 +1100694 [
695 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
696 AC_MSG_RESULT(yes)
697 ],
698 [
699 AC_MSG_RESULT(no)
700 ]
701)
Damien Millerab18c411999-11-11 10:40:23 +1100702
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000703# Check for g.gl_matchc glob() extension
704AC_MSG_CHECKING(for gl_matchc field in glob_t)
705AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100706 [
707 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000708 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100709 ],
710 [
711 AC_DEFINE(GLOB_HAS_GL_MATCHC)
712 AC_MSG_RESULT(yes)
713 ],
714 [
715 AC_MSG_RESULT(no)
716 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000717)
718
Damien Miller18bb4732001-03-28 14:35:30 +1000719AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
720AC_TRY_RUN(
721 [
722#include <sys/types.h>
723#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700724int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000725 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100726 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000727 [
728 AC_MSG_RESULT(no)
729 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
730 ]
731)
732
Damien Millerc547bf12001-02-16 10:18:12 +1100733# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100734SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100735AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700736 [ --with-skey[[=PATH]] Enable S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100737 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100738 [
739 if test "x$withval" != "xno" ; then
740
741 if test "x$withval" != "xyes" ; then
742 CPPFLAGS="$CPPFLAGS -I${withval}/include"
743 LDFLAGS="$LDFLAGS -L${withval}/lib"
744 fi
745
746 AC_DEFINE(SKEY)
747 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100748 SKEY_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100749
Tim Rice4cec93f2002-02-26 08:40:48 -0800750 AC_MSG_CHECKING([for s/key support])
751 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100752 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800753#include <stdio.h>
754#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700755int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800756 ],
757 [AC_MSG_RESULT(yes)],
758 [
759 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100760 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
761 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000762 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
763 AC_TRY_COMPILE(
764 [#include <stdio.h>
765 #include <skey.h>],
766 [(void)skeychallenge(NULL,"name","",0);],
767 [AC_MSG_RESULT(yes)
768 AC_DEFINE(SKEYCHALLENGE_4ARG)],
769 [AC_MSG_RESULT(no)]
770 )
Damien Millerc547bf12001-02-16 10:18:12 +1100771 fi
772 ]
773)
774
775# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700776TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100777AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700778 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
Damien Millera8e06ce2003-11-21 23:48:55 +1100779 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100780 [
781 if test "x$withval" != "xno" ; then
782 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700783 saved_LDFLAGS="$LDFLAGS"
784 saved_CPPFLAGS="$CPPFLAGS"
785 if test -n "${withval}" -a "${withval}" != "yes"; then
786 if test -d "${withval}/lib"; then
787 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700788 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700789 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700790 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700791 fi
792 else
793 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700794 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700795 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700796 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700797 fi
798 fi
799 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700800 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700801 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700802 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700803 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700804 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800805 LIBWRAP="-lwrap"
806 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100807 AC_MSG_CHECKING(for libwrap)
808 AC_TRY_LINK(
809 [
Damien Miller0ac45002004-04-14 20:14:26 +1000810#include <sys/types.h>
811#include <sys/socket.h>
812#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100813#include <tcpd.h>
814 int deny_severity = 0, allow_severity = 0;
815 ],
816 [hosts_access(0);],
817 [
818 AC_MSG_RESULT(yes)
819 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800820 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700821 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100822 ],
823 [
824 AC_MSG_ERROR([*** libwrap missing])
825 ]
826 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800827 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100828 fi
829 ]
830)
831
Damien Millerfe1f1432003-02-24 15:45:42 +1100832dnl Checks for library functions. Please keep in alphabetical order
833AC_CHECK_FUNCS(\
Darren Tucker60bd4092004-06-25 14:03:34 +1000834 arc4random __b64_ntop b64_ntop __b64_pton b64_pton bcopy \
835 bindresvport_sa clock closefrom fchmod fchown freeaddrinfo futimes \
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000836 getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000837 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100838 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000839 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100840 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000841 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100842 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000843 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000844 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100845 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100846)
Tim Rice13aae5e2001-10-21 17:53:58 -0700847
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000848# IRIX has a const char return value for gai_strerror()
849AC_CHECK_FUNCS(gai_strerror,[
850 AC_DEFINE(HAVE_GAI_STRERROR)
851 AC_TRY_COMPILE([
852#include <sys/types.h>
853#include <sys/socket.h>
854#include <netdb.h>
855
856const char *gai_strerror(int);],[
857char *str;
858
859str = gai_strerror(0);],[
860 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
861 [Define if gai_strerror() returns const char *])])])
862
Damien Millercd6853c2003-01-28 11:33:42 +1100863AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
864
Darren Tuckerf1159b52003-07-07 19:44:01 +1000865dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000866AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000867AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000868
Darren Tuckerb2427c82003-09-10 15:22:44 +1000869dnl tcsendbreak might be a macro
870AC_CHECK_DECL(tcsendbreak,
871 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100872 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000873 [#include <termios.h>]
874)
875
Darren Tucker5bb14002004-04-23 18:53:10 +1000876AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
877
Darren Tucker2a6b0292003-12-31 14:59:17 +1100878AC_CHECK_FUNCS(setresuid, [
879 dnl Some platorms have setresuid that isn't implemented, test for this
880 AC_MSG_CHECKING(if setresuid seems to work)
881 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100882#include <stdlib.h>
883#include <errno.h>
884int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100885 ],
886 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100887 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tucker2a6b0292003-12-31 14:59:17 +1100888 AC_MSG_RESULT(not implemented)]
889 )
890])
Darren Tuckere937be32003-12-17 18:53:26 +1100891
Darren Tucker2a6b0292003-12-31 14:59:17 +1100892AC_CHECK_FUNCS(setresgid, [
893 dnl Some platorms have setresgid that isn't implemented, test for this
894 AC_MSG_CHECKING(if setresgid seems to work)
895 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100896#include <stdlib.h>
897#include <errno.h>
898int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100899 ],
900 [AC_MSG_RESULT(yes)],
901 [AC_DEFINE(BROKEN_SETRESGID)
902 AC_MSG_RESULT(not implemented)]
903 )
904])
Darren Tuckere937be32003-12-17 18:53:26 +1100905
Damien Millerad833b32000-08-23 10:46:23 +1000906dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000907AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000908dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000909AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000910AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000911dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000912AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000913AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100914
Damien Millera8e06ce2003-11-21 23:48:55 +1100915AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100916 [AC_DEFINE(HAVE_DAEMON)],
917 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
918)
919
Damien Millera8e06ce2003-11-21 23:48:55 +1100920AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100921 [AC_DEFINE(HAVE_GETPAGESIZE)],
922 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
923)
924
Damien Millercb170cb2000-07-01 16:52:55 +1000925# Check for broken snprintf
926if test "x$ac_cv_func_snprintf" = "xyes" ; then
927 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
928 AC_TRY_RUN(
929 [
930#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700931int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000932 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100933 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000934 [
935 AC_MSG_RESULT(no)
936 AC_DEFINE(BROKEN_SNPRINTF)
937 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
938 ]
939 )
940fi
941
Damien Millerb4097182004-05-23 14:09:40 +1000942# Check for missing getpeereid (or equiv) support
943NO_PEERCHECK=""
944if test "x$ac_cv_func_getpeereid" != "xyes" ; then
945 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
946 AC_TRY_COMPILE(
947 [#include <sys/types.h>
948 #include <sys/socket.h>],
949 [int i = SO_PEERCRED;],
950 [AC_MSG_RESULT(yes)],
951 [AC_MSG_RESULT(no)
952 NO_PEERCHECK=1]
953 )
954fi
955
Damien Millere8328192003-01-07 15:18:32 +1100956dnl see whether mkstemp() requires XXXXXX
957if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
958AC_MSG_CHECKING([for (overly) strict mkstemp])
959AC_TRY_RUN(
960 [
961#include <stdlib.h>
962main() { char template[]="conftest.mkstemp-test";
963if (mkstemp(template) == -1)
964 exit(1);
965unlink(template); exit(0);
966}
967 ],
968 [
969 AC_MSG_RESULT(no)
970 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100971 [
Damien Millere8328192003-01-07 15:18:32 +1100972 AC_MSG_RESULT(yes)
973 AC_DEFINE(HAVE_STRICT_MKSTEMP)
974 ],
975 [
976 AC_MSG_RESULT(yes)
977 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +1100978 ]
Damien Millere8328192003-01-07 15:18:32 +1100979)
980fi
981
Darren Tucker70a3d552003-08-21 17:58:29 +1000982dnl make sure that openpty does not reacquire controlling terminal
983if test ! -z "$check_for_openpty_ctty_bug"; then
984 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
985 AC_TRY_RUN(
986 [
987#include <stdio.h>
988#include <sys/fcntl.h>
989#include <sys/types.h>
990#include <sys/wait.h>
991
992int
993main()
994{
995 pid_t pid;
996 int fd, ptyfd, ttyfd, status;
997
998 pid = fork();
999 if (pid < 0) { /* failed */
1000 exit(1);
1001 } else if (pid > 0) { /* parent */
1002 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001003 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001004 exit(WEXITSTATUS(status));
1005 else
1006 exit(2);
1007 } else { /* child */
1008 close(0); close(1); close(2);
1009 setsid();
1010 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1011 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1012 if (fd >= 0)
1013 exit(3); /* Acquired ctty: broken */
1014 else
1015 exit(0); /* Did not acquire ctty: OK */
1016 }
1017}
1018 ],
1019 [
1020 AC_MSG_RESULT(yes)
1021 ],
1022 [
1023 AC_MSG_RESULT(no)
1024 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1025 ]
1026 )
1027fi
1028
Darren Tucker4398cf52004-04-06 21:39:02 +10001029if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1030 AC_MSG_CHECKING(if getaddrinfo seems to work)
1031 AC_TRY_RUN(
1032 [
1033#include <stdio.h>
1034#include <sys/socket.h>
1035#include <netdb.h>
1036#include <errno.h>
1037#include <netinet/in.h>
1038
1039#define TEST_PORT "2222"
1040
1041int
1042main(void)
1043{
1044 int err, sock;
1045 struct addrinfo *gai_ai, *ai, hints;
1046 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1047
1048 memset(&hints, 0, sizeof(hints));
1049 hints.ai_family = PF_UNSPEC;
1050 hints.ai_socktype = SOCK_STREAM;
1051 hints.ai_flags = AI_PASSIVE;
1052
1053 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1054 if (err != 0) {
1055 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1056 exit(1);
1057 }
1058
1059 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1060 if (ai->ai_family != AF_INET6)
1061 continue;
1062
1063 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1064 sizeof(ntop), strport, sizeof(strport),
1065 NI_NUMERICHOST|NI_NUMERICSERV);
1066
1067 if (err != 0) {
1068 if (err == EAI_SYSTEM)
1069 perror("getnameinfo EAI_SYSTEM");
1070 else
1071 fprintf(stderr, "getnameinfo failed: %s\n",
1072 gai_strerror(err));
1073 exit(2);
1074 }
1075
1076 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1077 if (sock < 0)
1078 perror("socket");
1079 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1080 if (errno == EBADF)
1081 exit(3);
1082 }
1083 }
1084 exit(0);
1085}
1086 ],
1087 [
1088 AC_MSG_RESULT(yes)
1089 ],
1090 [
1091 AC_MSG_RESULT(no)
1092 AC_DEFINE(BROKEN_GETADDRINFO)
1093 ]
1094 )
1095fi
1096
Damien Miller606f8802000-09-16 15:39:56 +11001097AC_FUNC_GETPGRP
1098
Damien Millera64b57a2001-01-17 10:44:13 +11001099# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001100PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001101AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001102 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001103 [
Damien Millera64b57a2001-01-17 10:44:13 +11001104 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001105 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1106 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001107 AC_MSG_ERROR([PAM headers not found])
1108 fi
1109
1110 AC_CHECK_LIB(dl, dlopen, , )
1111 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1112 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001113 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001114
Damien Millera64b57a2001-01-17 10:44:13 +11001115 PAM_MSG="yes"
1116
1117 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001118 if test $ac_cv_lib_dl_dlopen = yes; then
1119 LIBPAM="-lpam -ldl"
1120 else
1121 LIBPAM="-lpam"
1122 fi
1123 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001124 fi
1125 ]
1126)
Damien Millera22ba012000-03-02 23:09:20 +11001127
Damien Millera64b57a2001-01-17 10:44:13 +11001128# Check for older PAM
1129if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001130 # Check PAM strerror arguments (old PAM)
1131 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1132 AC_TRY_COMPILE(
1133 [
Damien Miller81171112000-04-23 11:14:01 +10001134#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001135#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001136#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001137#elif defined (HAVE_PAM_PAM_APPL_H)
1138#include <pam/pam_appl.h>
1139#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001140 ],
1141 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001142 [AC_MSG_RESULT(no)],
1143 [
1144 AC_DEFINE(HAVE_OLD_PAM)
1145 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001146 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001147 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001148 )
Damien Millera22ba012000-03-02 23:09:20 +11001149fi
1150
Tim Riceaef73712002-05-11 13:17:42 -07001151# Search for OpenSSL
1152saved_CPPFLAGS="$CPPFLAGS"
1153saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001154AC_ARG_WITH(ssl-dir,
1155 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1156 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001157 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -07001158 if test -d "$withval/lib"; then
1159 if test -n "${need_dash_r}"; then
1160 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1161 else
1162 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1163 fi
1164 else
1165 if test -n "${need_dash_r}"; then
1166 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1167 else
1168 LDFLAGS="-L${withval} ${LDFLAGS}"
1169 fi
1170 fi
1171 if test -d "$withval/include"; then
1172 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1173 else
1174 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1175 fi
Damien Millera22ba012000-03-02 23:09:20 +11001176 fi
1177 ]
1178)
Tim Rice3d5352e2004-02-12 09:27:21 -08001179LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001180AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001181 [
Tim Riceaef73712002-05-11 13:17:42 -07001182 dnl Check default openssl install dir
1183 if test -n "${need_dash_r}"; then
1184 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001185 else
Tim Riceaef73712002-05-11 13:17:42 -07001186 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001187 fi
Tim Riceaef73712002-05-11 13:17:42 -07001188 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1189 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1190 [
1191 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1192 ]
1193 )
1194 ]
1195)
1196
Tim Riced730b782002-08-13 18:52:10 -07001197# Determine OpenSSL header version
1198AC_MSG_CHECKING([OpenSSL header version])
1199AC_TRY_RUN(
1200 [
1201#include <stdio.h>
1202#include <string.h>
1203#include <openssl/opensslv.h>
1204#define DATA "conftest.sslincver"
1205int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001206 FILE *fd;
1207 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001208
Damien Millera8e06ce2003-11-21 23:48:55 +11001209 fd = fopen(DATA,"w");
1210 if(fd == NULL)
1211 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001212
1213 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1214 exit(1);
1215
1216 exit(0);
1217}
1218 ],
1219 [
1220 ssl_header_ver=`cat conftest.sslincver`
1221 AC_MSG_RESULT($ssl_header_ver)
1222 ],
1223 [
1224 AC_MSG_RESULT(not found)
1225 AC_MSG_ERROR(OpenSSL version header not found.)
1226 ]
1227)
1228
1229# Determine OpenSSL library version
1230AC_MSG_CHECKING([OpenSSL library version])
1231AC_TRY_RUN(
1232 [
1233#include <stdio.h>
1234#include <string.h>
1235#include <openssl/opensslv.h>
1236#include <openssl/crypto.h>
1237#define DATA "conftest.ssllibver"
1238int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001239 FILE *fd;
1240 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001241
Damien Millera8e06ce2003-11-21 23:48:55 +11001242 fd = fopen(DATA,"w");
1243 if(fd == NULL)
1244 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001245
1246 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1247 exit(1);
1248
1249 exit(0);
1250}
1251 ],
1252 [
1253 ssl_library_ver=`cat conftest.ssllibver`
1254 AC_MSG_RESULT($ssl_library_ver)
1255 ],
1256 [
1257 AC_MSG_RESULT(not found)
1258 AC_MSG_ERROR(OpenSSL library not found.)
1259 ]
1260)
Damien Millera22ba012000-03-02 23:09:20 +11001261
Damien Millerec932372002-01-22 22:16:03 +11001262# Sanity check OpenSSL headers
1263AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1264AC_TRY_RUN(
1265 [
1266#include <string.h>
1267#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001268int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001269 ],
1270 [
1271 AC_MSG_RESULT(yes)
1272 ],
1273 [
1274 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001275 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1276Check config.log for details.
1277Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001278 ]
1279)
1280
Tim Rice3d5352e2004-02-12 09:27:21 -08001281# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1282# because the system crypt() is more featureful.
1283if test "x$check_for_libcrypt_before" = "x1"; then
1284 AC_CHECK_LIB(crypt, crypt)
1285fi
1286
Damien Millera8e06ce2003-11-21 23:48:55 +11001287# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001288# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001289if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001290 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001291fi
1292
Damien Miller6c21c512002-01-22 21:57:53 +11001293
1294### Configure cryptographic random number support
1295
1296# Check wheter OpenSSL seeds itself
1297AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1298AC_TRY_RUN(
1299 [
1300#include <string.h>
1301#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001302int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001303 ],
1304 [
1305 OPENSSL_SEEDS_ITSELF=yes
1306 AC_MSG_RESULT(yes)
1307 ],
1308 [
1309 AC_MSG_RESULT(no)
1310 # Default to use of the rand helper if OpenSSL doesn't
1311 # seed itself
1312 USE_RAND_HELPER=yes
1313 ]
1314)
1315
1316
1317# Do we want to force the use of the rand helper?
1318AC_ARG_WITH(rand-helper,
1319 [ --with-rand-helper Use subprocess to gather strong randomness ],
1320 [
1321 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001322 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001323 # the previous test showed it to be unseeded.
1324 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1325 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1326 OPENSSL_SEEDS_ITSELF=yes
1327 USE_RAND_HELPER=""
1328 fi
1329 else
1330 USE_RAND_HELPER=yes
1331 fi
1332 ],
1333)
1334
1335# Which randomness source do we use?
1336if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1337 # OpenSSL only
1338 AC_DEFINE(OPENSSL_PRNG_ONLY)
1339 RAND_MSG="OpenSSL internal ONLY"
1340 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001341elif test ! -z "$USE_RAND_HELPER" ; then
1342 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001343 RAND_MSG="ssh-rand-helper"
1344 INSTALL_SSH_RAND_HELPER="yes"
1345fi
1346AC_SUBST(INSTALL_SSH_RAND_HELPER)
1347
1348### Configuration of ssh-rand-helper
1349
1350# PRNGD TCP socket
1351AC_ARG_WITH(prngd-port,
1352 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1353 [
Damien Millere996d722002-01-23 11:20:59 +11001354 case "$withval" in
1355 no)
1356 withval=""
1357 ;;
1358 [[0-9]]*)
1359 ;;
1360 *)
1361 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1362 ;;
1363 esac
1364 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001365 PRNGD_PORT="$withval"
1366 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1367 fi
1368 ]
1369)
1370
1371# PRNGD Unix domain socket
1372AC_ARG_WITH(prngd-socket,
1373 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1374 [
Damien Millere996d722002-01-23 11:20:59 +11001375 case "$withval" in
1376 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001377 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001378 ;;
1379 no)
1380 withval=""
1381 ;;
1382 /*)
1383 ;;
1384 *)
1385 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1386 ;;
1387 esac
1388
1389 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001390 if test ! -z "$PRNGD_PORT" ; then
1391 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1392 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001393 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001394 AC_MSG_WARN(Entropy socket is not readable)
1395 fi
1396 PRNGD_SOCKET="$withval"
1397 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1398 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001399 ],
1400 [
1401 # Check for existing socket only if we don't have a random device already
1402 if test "$USE_RAND_HELPER" = yes ; then
1403 AC_MSG_CHECKING(for PRNGD/EGD socket)
1404 # Insert other locations here
1405 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1406 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1407 PRNGD_SOCKET="$sock"
1408 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1409 break;
1410 fi
1411 done
1412 if test ! -z "$PRNGD_SOCKET" ; then
1413 AC_MSG_RESULT($PRNGD_SOCKET)
1414 else
1415 AC_MSG_RESULT(not found)
1416 fi
1417 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001418 ]
1419)
1420
1421# Change default command timeout for hashing entropy source
1422entropy_timeout=200
1423AC_ARG_WITH(entropy-timeout,
1424 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1425 [
1426 if test "x$withval" != "xno" ; then
1427 entropy_timeout=$withval
1428 fi
1429 ]
1430)
Damien Miller6c21c512002-01-22 21:57:53 +11001431AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1432
Damien Millerd3f6ad22002-06-25 10:24:47 +10001433SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001434AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001435 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001436 [
1437 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001438 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001439 fi
1440 ]
1441)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001442AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1443AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001444
Tim Rice88f2ab52002-03-17 12:17:34 -08001445# We do this little dance with the search path to insure
1446# that programs that we select for use by installed programs
1447# (which may be run by the super-user) come from trusted
1448# locations before they come from the user's private area.
1449# This should help avoid accidentally configuring some
1450# random version of a program in someone's personal bin.
1451
1452OPATH=$PATH
1453PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001454test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001455test -d /sbin && PATH=$PATH:/sbin
1456test -d /usr/sbin && PATH=$PATH:/usr/sbin
1457PATH=$PATH:/etc:$OPATH
1458
Damien Millera8e06ce2003-11-21 23:48:55 +11001459# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001460OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1461OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1462OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1463OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1464OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1465OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1466OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1467OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1468OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1469OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1470OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1471OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1472OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1473OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1474OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1475OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001476# restore PATH
1477PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001478
1479# Where does ssh-rand-helper get its randomness from?
1480INSTALL_SSH_PRNG_CMDS=""
1481if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1482 if test ! -z "$PRNGD_PORT" ; then
1483 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1484 elif test ! -z "$PRNGD_SOCKET" ; then
1485 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1486 else
1487 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1488 RAND_HELPER_CMDHASH=yes
1489 INSTALL_SSH_PRNG_CMDS="yes"
1490 fi
1491fi
1492AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1493
1494
Ben Lindstromb5628642000-10-18 00:02:25 +00001495# Cheap hack to ensure NEWS-OS libraries are arranged right.
1496if test ! -z "$SONY" ; then
1497 LIBS="$LIBS -liberty";
1498fi
1499
Damien Millera22ba012000-03-02 23:09:20 +11001500# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001501AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001502AC_CHECK_SIZEOF(short int, 2)
1503AC_CHECK_SIZEOF(int, 4)
1504AC_CHECK_SIZEOF(long int, 4)
1505AC_CHECK_SIZEOF(long long int, 8)
1506
Damien Millerfa2bb692002-04-23 23:22:25 +10001507# Sanity check long long for some platforms (AIX)
1508if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1509 ac_cv_sizeof_long_long_int=0
1510fi
1511
Damien Millera22ba012000-03-02 23:09:20 +11001512# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001513AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1514 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001515 [ #include <sys/types.h> ],
1516 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001517 [ ac_cv_have_u_int="yes" ],
1518 [ ac_cv_have_u_int="no" ]
1519 )
1520])
1521if test "x$ac_cv_have_u_int" = "xyes" ; then
1522 AC_DEFINE(HAVE_U_INT)
1523 have_u_int=1
1524fi
1525
Damien Miller61e50f12000-05-08 20:49:37 +10001526AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1527 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001528 [ #include <sys/types.h> ],
1529 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001530 [ ac_cv_have_intxx_t="yes" ],
1531 [ ac_cv_have_intxx_t="no" ]
1532 )
1533])
1534if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1535 AC_DEFINE(HAVE_INTXX_T)
1536 have_intxx_t=1
1537fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001538
1539if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001540 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001541then
1542 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1543 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001544 [ #include <stdint.h> ],
1545 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001546 [
1547 AC_DEFINE(HAVE_INTXX_T)
1548 AC_MSG_RESULT(yes)
1549 ],
1550 [ AC_MSG_RESULT(no) ]
1551 )
1552fi
1553
Damien Miller578783e2000-09-23 14:12:24 +11001554AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1555 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001556 [
1557#include <sys/types.h>
1558#ifdef HAVE_STDINT_H
1559# include <stdint.h>
1560#endif
1561#include <sys/socket.h>
1562#ifdef HAVE_SYS_BITYPES_H
1563# include <sys/bitypes.h>
1564#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001565 ],
1566 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001567 [ ac_cv_have_int64_t="yes" ],
1568 [ ac_cv_have_int64_t="no" ]
1569 )
1570])
1571if test "x$ac_cv_have_int64_t" = "xyes" ; then
1572 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001573fi
1574
Damien Miller61e50f12000-05-08 20:49:37 +10001575AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1576 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001577 [ #include <sys/types.h> ],
1578 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001579 [ ac_cv_have_u_intxx_t="yes" ],
1580 [ ac_cv_have_u_intxx_t="no" ]
1581 )
1582])
1583if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1584 AC_DEFINE(HAVE_U_INTXX_T)
1585 have_u_intxx_t=1
1586fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001587
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001588if test -z "$have_u_intxx_t" ; then
1589 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1590 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001591 [ #include <sys/socket.h> ],
1592 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001593 [
1594 AC_DEFINE(HAVE_U_INTXX_T)
1595 AC_MSG_RESULT(yes)
1596 ],
1597 [ AC_MSG_RESULT(no) ]
1598 )
1599fi
1600
Damien Miller578783e2000-09-23 14:12:24 +11001601AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1602 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001603 [ #include <sys/types.h> ],
1604 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001605 [ ac_cv_have_u_int64_t="yes" ],
1606 [ ac_cv_have_u_int64_t="no" ]
1607 )
1608])
1609if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1610 AC_DEFINE(HAVE_U_INT64_T)
1611 have_u_int64_t=1
1612fi
1613
Tim Rice4cec93f2002-02-26 08:40:48 -08001614if test -z "$have_u_int64_t" ; then
1615 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1616 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001617 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001618 [ u_int64_t a; a = 1],
1619 [
1620 AC_DEFINE(HAVE_U_INT64_T)
1621 AC_MSG_RESULT(yes)
1622 ],
1623 [ AC_MSG_RESULT(no) ]
1624 )
1625fi
1626
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001627if test -z "$have_u_intxx_t" ; then
1628 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1629 AC_TRY_COMPILE(
1630 [
1631#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001632 ],
1633 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001634 [ ac_cv_have_uintxx_t="yes" ],
1635 [ ac_cv_have_uintxx_t="no" ]
1636 )
1637 ])
1638 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1639 AC_DEFINE(HAVE_UINTXX_T)
1640 fi
1641fi
1642
1643if test -z "$have_uintxx_t" ; then
1644 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1645 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001646 [ #include <stdint.h> ],
1647 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001648 [
1649 AC_DEFINE(HAVE_UINTXX_T)
1650 AC_MSG_RESULT(yes)
1651 ],
1652 [ AC_MSG_RESULT(no) ]
1653 )
1654fi
1655
Damien Milleredb82922000-06-20 13:25:52 +10001656if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001657 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001658then
1659 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1660 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001661 [
1662#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001663 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001664 [
Damien Miller70494d12000-04-03 15:57:06 +10001665 int8_t a; int16_t b; int32_t c;
1666 u_int8_t e; u_int16_t f; u_int32_t g;
1667 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001668 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001669 [
1670 AC_DEFINE(HAVE_U_INTXX_T)
1671 AC_DEFINE(HAVE_INTXX_T)
1672 AC_MSG_RESULT(yes)
1673 ],
1674 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001675 )
Damien Millerb29ea912000-01-15 14:12:03 +11001676fi
1677
Damien Miller58be7382001-09-15 21:31:54 +10001678
1679AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1680 AC_TRY_COMPILE(
1681 [
1682#include <sys/types.h>
1683 ],
1684 [ u_char foo; foo = 125; ],
1685 [ ac_cv_have_u_char="yes" ],
1686 [ ac_cv_have_u_char="no" ]
1687 )
1688])
1689if test "x$ac_cv_have_u_char" = "xyes" ; then
1690 AC_DEFINE(HAVE_U_CHAR)
1691fi
1692
Tim Rice13aae5e2001-10-21 17:53:58 -07001693TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001694
Tim Rice200a5c02002-02-26 22:12:34 -08001695AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001696
Damien Miller61e50f12000-05-08 20:49:37 +10001697AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1698 AC_TRY_COMPILE(
1699 [
1700#include <sys/types.h>
1701 ],
1702 [ size_t foo; foo = 1235; ],
1703 [ ac_cv_have_size_t="yes" ],
1704 [ ac_cv_have_size_t="no" ]
1705 )
1706])
1707if test "x$ac_cv_have_size_t" = "xyes" ; then
1708 AC_DEFINE(HAVE_SIZE_T)
1709fi
Damien Miller95058511999-12-29 10:36:45 +11001710
Damien Miller615f9392000-05-17 22:53:33 +10001711AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1712 AC_TRY_COMPILE(
1713 [
1714#include <sys/types.h>
1715 ],
1716 [ ssize_t foo; foo = 1235; ],
1717 [ ac_cv_have_ssize_t="yes" ],
1718 [ ac_cv_have_ssize_t="no" ]
1719 )
1720])
1721if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1722 AC_DEFINE(HAVE_SSIZE_T)
1723fi
1724
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001725AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1726 AC_TRY_COMPILE(
1727 [
1728#include <time.h>
1729 ],
1730 [ clock_t foo; foo = 1235; ],
1731 [ ac_cv_have_clock_t="yes" ],
1732 [ ac_cv_have_clock_t="no" ]
1733 )
1734])
1735if test "x$ac_cv_have_clock_t" = "xyes" ; then
1736 AC_DEFINE(HAVE_CLOCK_T)
1737fi
1738
Damien Millerb54b40e2000-06-23 08:23:34 +10001739AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1740 AC_TRY_COMPILE(
1741 [
1742#include <sys/types.h>
1743#include <sys/socket.h>
1744 ],
1745 [ sa_family_t foo; foo = 1235; ],
1746 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001747 [ AC_TRY_COMPILE(
1748 [
1749#include <sys/types.h>
1750#include <sys/socket.h>
1751#include <netinet/in.h>
1752 ],
1753 [ sa_family_t foo; foo = 1235; ],
1754 [ ac_cv_have_sa_family_t="yes" ],
1755
Damien Millerb54b40e2000-06-23 08:23:34 +10001756 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001757 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001758 )
1759])
1760if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1761 AC_DEFINE(HAVE_SA_FAMILY_T)
1762fi
1763
Damien Miller0f91b4e2000-06-18 15:43:25 +10001764AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1765 AC_TRY_COMPILE(
1766 [
1767#include <sys/types.h>
1768 ],
1769 [ pid_t foo; foo = 1235; ],
1770 [ ac_cv_have_pid_t="yes" ],
1771 [ ac_cv_have_pid_t="no" ]
1772 )
1773])
1774if test "x$ac_cv_have_pid_t" = "xyes" ; then
1775 AC_DEFINE(HAVE_PID_T)
1776fi
1777
1778AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1779 AC_TRY_COMPILE(
1780 [
1781#include <sys/types.h>
1782 ],
1783 [ mode_t foo; foo = 1235; ],
1784 [ ac_cv_have_mode_t="yes" ],
1785 [ ac_cv_have_mode_t="no" ]
1786 )
1787])
1788if test "x$ac_cv_have_mode_t" = "xyes" ; then
1789 AC_DEFINE(HAVE_MODE_T)
1790fi
1791
Damien Miller61e50f12000-05-08 20:49:37 +10001792
1793AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1794 AC_TRY_COMPILE(
1795 [
Damien Miller81171112000-04-23 11:14:01 +10001796#include <sys/types.h>
1797#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001798 ],
1799 [ struct sockaddr_storage s; ],
1800 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1801 [ ac_cv_have_struct_sockaddr_storage="no" ]
1802 )
1803])
1804if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1805 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1806fi
Damien Miller34132e52000-01-14 15:45:46 +11001807
Damien Miller61e50f12000-05-08 20:49:37 +10001808AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1809 AC_TRY_COMPILE(
1810 [
Damien Miller7b22d652000-06-18 14:07:04 +10001811#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001812#include <netinet/in.h>
1813 ],
1814 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1815 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1816 [ ac_cv_have_struct_sockaddr_in6="no" ]
1817 )
1818])
1819if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1820 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1821fi
Damien Miller34132e52000-01-14 15:45:46 +11001822
Damien Miller61e50f12000-05-08 20:49:37 +10001823AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1824 AC_TRY_COMPILE(
1825 [
Damien Miller7b22d652000-06-18 14:07:04 +10001826#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001827#include <netinet/in.h>
1828 ],
1829 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1830 [ ac_cv_have_struct_in6_addr="yes" ],
1831 [ ac_cv_have_struct_in6_addr="no" ]
1832 )
1833])
1834if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1835 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1836fi
Damien Miller34132e52000-01-14 15:45:46 +11001837
Damien Miller61e50f12000-05-08 20:49:37 +10001838AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1839 AC_TRY_COMPILE(
1840 [
Damien Miller81171112000-04-23 11:14:01 +10001841#include <sys/types.h>
1842#include <sys/socket.h>
1843#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001844 ],
1845 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1846 [ ac_cv_have_struct_addrinfo="yes" ],
1847 [ ac_cv_have_struct_addrinfo="no" ]
1848 )
1849])
1850if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1851 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1852fi
1853
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001854AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1855 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001856 [ #include <sys/time.h> ],
1857 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001858 [ ac_cv_have_struct_timeval="yes" ],
1859 [ ac_cv_have_struct_timeval="no" ]
1860 )
1861])
1862if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1863 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1864 have_struct_timeval=1
1865fi
1866
Tim Rice4e4dc562003-03-18 10:21:40 -08001867AC_CHECK_TYPES(struct timespec)
1868
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001869# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001870if test "x$ac_cv_have_int64_t" = "xno" -a \
1871 "x$ac_cv_sizeof_long_int" != "x8" -a \
1872 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001873 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1874 echo "an alternative compiler (I.E., GCC) before continuing."
1875 echo ""
1876 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001877else
1878dnl test snprintf (broken on SCO w/gcc)
1879 AC_TRY_RUN(
1880 [
1881#include <stdio.h>
1882#include <string.h>
1883#ifdef HAVE_SNPRINTF
1884main()
1885{
1886 char buf[50];
1887 char expected_out[50];
1888 int mazsize = 50 ;
1889#if (SIZEOF_LONG_INT == 8)
1890 long int num = 0x7fffffffffffffff;
1891#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001892 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001893#endif
1894 strcpy(expected_out, "9223372036854775807");
1895 snprintf(buf, mazsize, "%lld", num);
1896 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001897 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001898 exit(0);
1899}
1900#else
1901main() { exit(0); }
1902#endif
1903 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1904 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001905fi
1906
Damien Miller78315eb2000-09-29 23:01:36 +11001907dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001908OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1909OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1910OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1911OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1912OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001913OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001914OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1915OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001916OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001917OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1918OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1919OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1920OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001921OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1922OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1923OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1924OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001925
1926AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001927
Damien Miller61e50f12000-05-08 20:49:37 +10001928AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1929 ac_cv_have_ss_family_in_struct_ss, [
1930 AC_TRY_COMPILE(
1931 [
Damien Miller81171112000-04-23 11:14:01 +10001932#include <sys/types.h>
1933#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001934 ],
1935 [ struct sockaddr_storage s; s.ss_family = 1; ],
1936 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1937 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1938 )
1939])
1940if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1941 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1942fi
1943
Damien Miller61e50f12000-05-08 20:49:37 +10001944AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1945 ac_cv_have___ss_family_in_struct_ss, [
1946 AC_TRY_COMPILE(
1947 [
Damien Miller81171112000-04-23 11:14:01 +10001948#include <sys/types.h>
1949#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001950 ],
1951 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1952 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1953 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1954 )
1955])
1956if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1957 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1958fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001959
Damien Millerad833b32000-08-23 10:46:23 +10001960AC_CACHE_CHECK([for pw_class field in struct passwd],
1961 ac_cv_have_pw_class_in_struct_passwd, [
1962 AC_TRY_COMPILE(
1963 [
Damien Millerad833b32000-08-23 10:46:23 +10001964#include <pwd.h>
1965 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001966 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001967 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1968 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1969 )
1970])
1971if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1972 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1973fi
1974
Kevin Steves82456952001-06-22 21:14:18 +00001975AC_CACHE_CHECK([for pw_expire field in struct passwd],
1976 ac_cv_have_pw_expire_in_struct_passwd, [
1977 AC_TRY_COMPILE(
1978 [
1979#include <pwd.h>
1980 ],
1981 [ struct passwd p; p.pw_expire = 0; ],
1982 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1983 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1984 )
1985])
1986if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1987 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1988fi
1989
1990AC_CACHE_CHECK([for pw_change field in struct passwd],
1991 ac_cv_have_pw_change_in_struct_passwd, [
1992 AC_TRY_COMPILE(
1993 [
1994#include <pwd.h>
1995 ],
1996 [ struct passwd p; p.pw_change = 0; ],
1997 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1998 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1999 )
2000])
2001if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2002 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
2003fi
Damien Miller61e50f12000-05-08 20:49:37 +10002004
Tim Rice28bbb0c2002-05-27 17:37:32 -07002005dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002006AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2007 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07002008 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00002009 [
Tim Riceae49fe62002-04-12 10:26:21 -07002010#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002011#include <sys/socket.h>
2012#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002013int main() {
2014#ifdef msg_accrights
2015exit(1);
2016#endif
2017struct msghdr m;
2018m.msg_accrights = 0;
2019exit(0);
2020}
Kevin Steves939c9db2002-03-22 17:23:25 +00002021 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002022 [ ac_cv_have_accrights_in_msghdr="yes" ],
2023 [ ac_cv_have_accrights_in_msghdr="no" ]
2024 )
2025])
2026if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2027 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2028fi
2029
Kevin Stevesa44e0352002-04-07 16:18:03 +00002030AC_CACHE_CHECK([for msg_control field in struct msghdr],
2031 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07002032 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002033 [
Tim Riceae49fe62002-04-12 10:26:21 -07002034#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002035#include <sys/socket.h>
2036#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002037int main() {
2038#ifdef msg_control
2039exit(1);
2040#endif
2041struct msghdr m;
2042m.msg_control = 0;
2043exit(0);
2044}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002045 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002046 [ ac_cv_have_control_in_msghdr="yes" ],
2047 [ ac_cv_have_control_in_msghdr="no" ]
2048 )
2049])
2050if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2051 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2052fi
2053
Damien Miller61e50f12000-05-08 20:49:37 +10002054AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002055 AC_TRY_LINK([],
2056 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002057 [ ac_cv_libc_defines___progname="yes" ],
2058 [ ac_cv_libc_defines___progname="no" ]
2059 )
2060])
2061if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2062 AC_DEFINE(HAVE___PROGNAME)
2063fi
2064
Kevin Steves4846f4a2002-03-22 18:19:53 +00002065AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2066 AC_TRY_LINK([
2067#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002068],
2069 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002070 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2071 [ ac_cv_cc_implements___FUNCTION__="no" ]
2072 )
2073])
2074if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2075 AC_DEFINE(HAVE___FUNCTION__)
2076fi
2077
2078AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2079 AC_TRY_LINK([
2080#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002081],
2082 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002083 [ ac_cv_cc_implements___func__="yes" ],
2084 [ ac_cv_cc_implements___func__="no" ]
2085 )
2086])
2087if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2088 AC_DEFINE(HAVE___func__)
2089fi
2090
Damien Miller4f8e6692001-07-14 13:22:53 +10002091AC_CACHE_CHECK([whether getopt has optreset support],
2092 ac_cv_have_getopt_optreset, [
2093 AC_TRY_LINK(
2094 [
2095#include <getopt.h>
2096 ],
2097 [ extern int optreset; optreset = 0; ],
2098 [ ac_cv_have_getopt_optreset="yes" ],
2099 [ ac_cv_have_getopt_optreset="no" ]
2100 )
2101])
2102if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2103 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2104fi
Damien Millera22ba012000-03-02 23:09:20 +11002105
Damien Millerecbb26d2000-07-15 14:59:14 +10002106AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002107 AC_TRY_LINK([],
2108 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002109 [ ac_cv_libc_defines_sys_errlist="yes" ],
2110 [ ac_cv_libc_defines_sys_errlist="no" ]
2111 )
2112])
2113if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2114 AC_DEFINE(HAVE_SYS_ERRLIST)
2115fi
2116
2117
Damien Miller11fa2cc2000-08-16 10:35:58 +10002118AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002119 AC_TRY_LINK([],
2120 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002121 [ ac_cv_libc_defines_sys_nerr="yes" ],
2122 [ ac_cv_libc_defines_sys_nerr="no" ]
2123 )
2124])
2125if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2126 AC_DEFINE(HAVE_SYS_NERR)
2127fi
2128
Damien Millera8e06ce2003-11-21 23:48:55 +11002129SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002130# Check whether user wants sectok support
2131AC_ARG_WITH(sectok,
2132 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002133 [
2134 if test "x$withval" != "xno" ; then
2135 if test "x$withval" != "xyes" ; then
2136 CPPFLAGS="$CPPFLAGS -I${withval}"
2137 LDFLAGS="$LDFLAGS -L${withval}"
2138 if test ! -z "$need_dash_r" ; then
2139 LDFLAGS="$LDFLAGS -R${withval}"
2140 fi
2141 if test ! -z "$blibpath" ; then
2142 blibpath="$blibpath:${withval}"
2143 fi
2144 fi
2145 AC_CHECK_HEADERS(sectok.h)
2146 if test "$ac_cv_header_sectok_h" != yes; then
2147 AC_MSG_ERROR(Can't find sectok.h)
2148 fi
2149 AC_CHECK_LIB(sectok, sectok_open)
2150 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2151 AC_MSG_ERROR(Can't find libsectok)
2152 fi
2153 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002154 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002155 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002156 fi
2157 ]
2158)
2159
2160# Check whether user wants OpenSC support
2161AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10002162 AC_HELP_STRING([--with-opensc=PFX],
2163 [Enable smartcard support using OpenSC]),
2164 opensc_config_prefix="$withval", opensc_config_prefix="")
2165if test x$opensc_config_prefix != x ; then
2166 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2167 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2168 if test "$OPENSC_CONFIG" != "no"; then
2169 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2170 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2171 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2172 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2173 AC_DEFINE(SMARTCARD)
2174 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11002175 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10002176 fi
2177fi
Damien Miller85de5802001-09-18 14:01:11 +10002178
Darren Tucker5f88d342003-10-15 16:57:57 +10002179# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002180AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002181 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002182 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002183 # Needed by our getrrsetbyname()
2184 AC_SEARCH_LIBS(res_query, resolv)
2185 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002186 AC_MSG_CHECKING(if res_query will link)
2187 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2188 [AC_MSG_RESULT(no)
2189 saved_LIBS="$LIBS"
2190 LIBS="$LIBS -lresolv"
2191 AC_MSG_CHECKING(for res_query in -lresolv)
2192 AC_LINK_IFELSE([
2193#include <resolv.h>
2194int main()
2195{
2196 res_query (0, 0, 0, 0, 0);
2197 return 0;
2198}
2199 ],
2200 [LIBS="$LIBS -lresolv"
2201 AC_MSG_RESULT(yes)],
2202 [LIBS="$saved_LIBS"
2203 AC_MSG_RESULT(no)])
2204 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002205 AC_CHECK_FUNCS(_getshort _getlong)
2206 AC_CHECK_MEMBER(HEADER.ad,
2207 [AC_DEFINE(HAVE_HEADER_AD)],,
2208 [#include <arpa/nameser.h>])
2209 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002210
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002211# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002212KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002213AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002214 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002215 [ if test "x$withval" != "xno" ; then
2216 if test "x$withval" = "xyes" ; then
2217 KRB5ROOT="/usr/local"
2218 else
2219 KRB5ROOT=${withval}
2220 fi
2221
2222 AC_DEFINE(KRB5)
2223 KRB5_MSG="yes"
2224
2225 AC_MSG_CHECKING(for krb5-config)
2226 if test -x $KRB5ROOT/bin/krb5-config ; then
2227 KRB5CONF=$KRB5ROOT/bin/krb5-config
2228 AC_MSG_RESULT($KRB5CONF)
2229
2230 AC_MSG_CHECKING(for gssapi support)
2231 if $KRB5CONF | grep gssapi >/dev/null ; then
2232 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002233 AC_DEFINE(GSSAPI)
2234 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002235 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002236 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002237 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002238 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002239 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2240 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002241 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002242 AC_MSG_CHECKING(whether we are using Heimdal)
2243 AC_TRY_COMPILE([ #include <krb5.h> ],
2244 [ char *tmp = heimdal_version; ],
2245 [ AC_MSG_RESULT(yes)
2246 AC_DEFINE(HEIMDAL) ],
2247 AC_MSG_RESULT(no)
2248 )
2249 else
2250 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002251 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002252 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002253 AC_MSG_CHECKING(whether we are using Heimdal)
2254 AC_TRY_COMPILE([ #include <krb5.h> ],
2255 [ char *tmp = heimdal_version; ],
2256 [ AC_MSG_RESULT(yes)
2257 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002258 K5LIBS="-lkrb5 -ldes"
2259 K5LIBS="$K5LIBS -lcom_err -lasn1"
2260 AC_CHECK_LIB(roken, net_write,
2261 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002262 ],
2263 [ AC_MSG_RESULT(no)
2264 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2265 ]
2266 )
Damien Miller200d0a72003-06-30 19:21:36 +10002267 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002268
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002269 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2270 [ AC_DEFINE(GSSAPI)
2271 K5LIBS="-lgssapi $K5LIBS" ],
2272 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2273 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002274 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002275 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2276 $K5LIBS)
2277 ],
2278 $K5LIBS)
2279
2280 AC_CHECK_HEADER(gssapi.h, ,
2281 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002282 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002283 AC_CHECK_HEADERS(gssapi.h, ,
2284 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002285 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002286 ]
2287 )
2288
2289 oldCPP="$CPPFLAGS"
2290 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2291 AC_CHECK_HEADER(gssapi_krb5.h, ,
2292 [ CPPFLAGS="$oldCPP" ])
2293
Damien Millera8e06ce2003-11-21 23:48:55 +11002294 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002295 if test ! -z "$need_dash_r" ; then
2296 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2297 fi
2298 if test ! -z "$blibpath" ; then
2299 blibpath="$blibpath:${KRB5ROOT}/lib"
2300 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002301 fi
2302
2303 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2304 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2305 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2306
2307 LIBS="$LIBS $K5LIBS"
2308 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002309 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002310 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002311)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002312
Damien Millera22ba012000-03-02 23:09:20 +11002313# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002314
Damien Millerf58c6722002-05-13 13:15:42 +10002315PRIVSEP_PATH=/var/empty
2316AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002317 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002318 [
2319 if test "x$withval" != "$no" ; then
2320 PRIVSEP_PATH=$withval
2321 fi
2322 ]
2323)
2324AC_SUBST(PRIVSEP_PATH)
2325
Damien Millera22ba012000-03-02 23:09:20 +11002326AC_ARG_WITH(xauth,
2327 [ --with-xauth=PATH Specify path to xauth program ],
2328 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002329 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002330 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002331 fi
2332 ],
2333 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002334 TestPath="$PATH"
2335 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2336 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2337 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2338 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2339 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002340 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002341 xauth_path="/usr/openwin/bin/xauth"
2342 fi
2343 ]
2344)
2345
Damien Miller7d901272003-01-13 16:55:22 +11002346STRIP_OPT=-s
2347AC_ARG_ENABLE(strip,
2348 [ --disable-strip Disable calling strip(1) on install],
2349 [
2350 if test "x$enableval" = "xno" ; then
2351 STRIP_OPT=
2352 fi
2353 ]
2354)
2355AC_SUBST(STRIP_OPT)
2356
Damien Millera19cf472000-11-29 13:28:50 +11002357if test -z "$xauth_path" ; then
2358 XAUTH_PATH="undefined"
2359 AC_SUBST(XAUTH_PATH)
2360else
Damien Millera22ba012000-03-02 23:09:20 +11002361 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002362 XAUTH_PATH=$xauth_path
2363 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002364fi
Damien Millera22ba012000-03-02 23:09:20 +11002365
2366# Check for mail directory (last resort if we cannot get it from headers)
2367if test ! -z "$MAIL" ; then
2368 maildir=`dirname $MAIL`
2369 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2370fi
2371
Damien Millera22ba012000-03-02 23:09:20 +11002372if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002373 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002374 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002375 [
2376 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2377 have_dev_ptmx=1
2378 ]
2379 )
2380 fi
Damien Millera22ba012000-03-02 23:09:20 +11002381fi
Damien Millera8e06ce2003-11-21 23:48:55 +11002382AC_CHECK_FILE("/dev/ptc",
Damien Miller204ad072000-03-02 23:56:12 +11002383 [
2384 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2385 have_dev_ptc=1
2386 ]
2387)
2388
Damien Millera22ba012000-03-02 23:09:20 +11002389# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002390AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002391 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002392 [
Damien Miller897741e2001-04-16 10:41:46 +10002393 case "$withval" in
2394 man|cat|doc)
2395 MANTYPE=$withval
2396 ;;
2397 *)
2398 AC_MSG_ERROR(invalid man type: $withval)
2399 ;;
2400 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002401 ]
2402)
Ben Lindstrombc709922001-04-18 18:04:21 +00002403if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002404 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2405 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002406 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2407 MANTYPE=doc
2408 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2409 MANTYPE=man
2410 else
2411 MANTYPE=cat
2412 fi
2413fi
Damien Miller670a4b82000-01-22 13:53:11 +11002414AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002415if test "$MANTYPE" = "doc"; then
2416 mansubdir=man;
2417else
2418 mansubdir=$MANTYPE;
2419fi
2420AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002421
Damien Millera22ba012000-03-02 23:09:20 +11002422# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002423MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002424AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002425 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002426 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002427 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002428 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002429 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002430 fi
2431 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002432)
2433
Damien Millera22ba012000-03-02 23:09:20 +11002434# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002435AC_ARG_WITH(shadow,
2436 [ --without-shadow Disable shadow password support],
2437 [
2438 if test "x$withval" = "xno" ; then
2439 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002440 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002441 fi
2442 ]
2443)
2444
Damien Miller1f335fb2000-06-26 11:31:33 +10002445if test -z "$disable_shadow" ; then
2446 AC_MSG_CHECKING([if the systems has expire shadow information])
2447 AC_TRY_COMPILE(
2448 [
2449#include <sys/types.h>
2450#include <shadow.h>
2451 struct spwd sp;
2452 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2453 [ sp_expire_available=yes ], []
2454 )
2455
2456 if test "x$sp_expire_available" = "xyes" ; then
2457 AC_MSG_RESULT(yes)
2458 AC_DEFINE(HAS_SHADOW_EXPIRE)
2459 else
2460 AC_MSG_RESULT(no)
2461 fi
2462fi
2463
Damien Millera22ba012000-03-02 23:09:20 +11002464# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002465if test ! -z "$IPADDR_IN_DISPLAY" ; then
2466 DISPLAY_HACK_MSG="yes"
2467 AC_DEFINE(IPADDR_IN_DISPLAY)
2468else
Damien Millera8e06ce2003-11-21 23:48:55 +11002469 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002470 AC_ARG_WITH(ipaddr-display,
2471 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2472 [
2473 if test "x$withval" != "xno" ; then
2474 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002475 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002476 fi
2477 ]
2478 )
2479fi
Damien Miller76112de1999-12-21 11:18:08 +11002480
Darren Tuckere1a790d2003-09-16 11:52:19 +10002481# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002482AC_ARG_ENABLE(etc-default-login,
2483 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2484[
Darren Tuckere1a790d2003-09-16 11:52:19 +10002485AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2486
2487if test "x$external_path_file" = "x/etc/default/login"; then
2488 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2489fi
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002490])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002491
Tim Rice43a1c132002-04-17 21:19:14 -07002492dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2493if test $ac_cv_func_login_getcapbool = "yes" -a \
2494 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002495 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002496fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002497
Damien Millera22ba012000-03-02 23:09:20 +11002498# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002499SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002500AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002501 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002502 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002503 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002504 AC_MSG_WARN([
2505--with-default-path=PATH has no effect on this system.
2506Edit /etc/login.conf instead.])
2507 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002508 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002509 AC_MSG_WARN([
2510--with-default-path=PATH will only be used if PATH is not defined in
2511$external_path_file .])
2512 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002513 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002514 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002515 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002516 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002517 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2518 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002519 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002520 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002521 AC_MSG_WARN([
2522If PATH is defined in $external_path_file, ensure the path to scp is included,
2523otherwise scp will not work.])
2524 fi
2525 AC_TRY_RUN(
2526 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002527/* find out what STDPATH is */
2528#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002529#ifdef HAVE_PATHS_H
2530# include <paths.h>
2531#endif
2532#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002533# ifdef _PATH_USERPATH /* Irix */
2534# define _PATH_STDPATH _PATH_USERPATH
2535# else
2536# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2537# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002538#endif
2539#include <sys/types.h>
2540#include <sys/stat.h>
2541#include <fcntl.h>
2542#define DATA "conftest.stdpath"
2543
2544main()
2545{
2546 FILE *fd;
2547 int rc;
2548
2549 fd = fopen(DATA,"w");
2550 if(fd == NULL)
2551 exit(1);
2552
2553 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2554 exit(1);
2555
2556 exit(0);
2557}
2558 ], [ user_path=`cat conftest.stdpath` ],
2559 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2560 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2561 )
2562# make sure $bindir is in USER_PATH so scp will work
2563 t_bindir=`eval echo ${bindir}`
2564 case $t_bindir in
2565 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2566 esac
2567 case $t_bindir in
2568 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2569 esac
2570 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2571 if test $? -ne 0 ; then
2572 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2573 if test $? -ne 0 ; then
2574 user_path=$user_path:$t_bindir
2575 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2576 fi
2577 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002578 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002579)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002580if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002581 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2582 AC_SUBST(user_path)
2583fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002584
Damien Millera18bbd32002-05-13 10:48:57 +10002585# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002586AC_ARG_WITH(superuser-path,
2587 [ --with-superuser-path= Specify different path for super-user],
2588 [
2589 if test "x$withval" != "xno" ; then
2590 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2591 superuser_path=$withval
2592 fi
2593 ]
2594)
2595
2596
Damien Miller61e50f12000-05-08 20:49:37 +10002597AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002598IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002599AC_ARG_WITH(4in6,
2600 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2601 [
2602 if test "x$withval" != "xno" ; then
2603 AC_MSG_RESULT(yes)
2604 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002605 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002606 else
2607 AC_MSG_RESULT(no)
2608 fi
2609 ],[
2610 if test "x$inet6_default_4in6" = "xyes"; then
2611 AC_MSG_RESULT([yes (default)])
2612 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002613 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002614 else
2615 AC_MSG_RESULT([no (default)])
2616 fi
2617 ]
2618)
2619
Damien Miller60396b02001-02-18 17:01:00 +11002620# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002621BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002622AC_ARG_WITH(bsd-auth,
2623 [ --with-bsd-auth Enable BSD auth support],
2624 [
2625 if test "x$withval" != "xno" ; then
2626 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002627 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002628 fi
2629 ]
2630)
2631
Damien Millera22ba012000-03-02 23:09:20 +11002632# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002633piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002634# make sure the directory exists
2635if test ! -d $piddir ; then
2636 piddir=`eval echo ${sysconfdir}`
2637 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002638 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002639 esac
2640fi
2641
Tim Rice88f2ab52002-03-17 12:17:34 -08002642AC_ARG_WITH(pid-dir,
2643 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2644 [
2645 if test "x$withval" != "xno" ; then
2646 piddir=$withval
2647 if test ! -d $piddir ; then
2648 AC_MSG_WARN([** no $piddir directory on this system **])
2649 fi
2650 fi
2651 ]
2652)
2653
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002654AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002655AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002656
andre2ff7b5d2000-06-03 14:57:40 +00002657dnl allow user to disable some login recording features
2658AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002659 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002660 [
2661 if test "x$enableval" = "xno" ; then
2662 AC_DEFINE(DISABLE_LASTLOG)
2663 fi
2664 ]
andre2ff7b5d2000-06-03 14:57:40 +00002665)
2666AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002667 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002668 [
2669 if test "x$enableval" = "xno" ; then
2670 AC_DEFINE(DISABLE_UTMP)
2671 fi
2672 ]
andre2ff7b5d2000-06-03 14:57:40 +00002673)
2674AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002675 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002676 [
2677 if test "x$enableval" = "xno" ; then
2678 AC_DEFINE(DISABLE_UTMPX)
2679 fi
2680 ]
andre2ff7b5d2000-06-03 14:57:40 +00002681)
2682AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002683 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002684 [
2685 if test "x$enableval" = "xno" ; then
2686 AC_DEFINE(DISABLE_WTMP)
2687 fi
2688 ]
andre2ff7b5d2000-06-03 14:57:40 +00002689)
2690AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002691 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002692 [
2693 if test "x$enableval" = "xno" ; then
2694 AC_DEFINE(DISABLE_WTMPX)
2695 fi
2696 ]
andre2ff7b5d2000-06-03 14:57:40 +00002697)
2698AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002699 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002700 [
2701 if test "x$enableval" = "xno" ; then
2702 AC_DEFINE(DISABLE_LOGIN)
2703 fi
2704 ]
andre2ff7b5d2000-06-03 14:57:40 +00002705)
2706AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002707 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002708 [
2709 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002710 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002711 fi
2712 ]
andre2ff7b5d2000-06-03 14:57:40 +00002713)
2714AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002715 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002716 [
2717 if test "x$enableval" = "xno" ; then
2718 AC_DEFINE(DISABLE_PUTUTXLINE)
2719 fi
2720 ]
andre2ff7b5d2000-06-03 14:57:40 +00002721)
2722AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002723 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002724 [
2725 if test "x$withval" = "xno" ; then
2726 AC_DEFINE(DISABLE_LASTLOG)
2727 else
2728 conf_lastlog_location=$withval
2729 fi
2730 ]
2731)
andre2ff7b5d2000-06-03 14:57:40 +00002732
2733dnl lastlog, [uw]tmpx? detection
2734dnl NOTE: set the paths in the platform section to avoid the
2735dnl need for command-line parameters
2736dnl lastlog and [uw]tmp are subject to a file search if all else fails
2737
2738dnl lastlog detection
2739dnl NOTE: the code itself will detect if lastlog is a directory
2740AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2741AC_TRY_COMPILE([
2742#include <sys/types.h>
2743#include <utmp.h>
2744#ifdef HAVE_LASTLOG_H
2745# include <lastlog.h>
2746#endif
Damien Miller2994e082000-06-04 15:51:47 +10002747#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002748# include <paths.h>
2749#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002750#ifdef HAVE_LOGIN_H
2751# include <login.h>
2752#endif
andre2ff7b5d2000-06-03 14:57:40 +00002753 ],
2754 [ char *lastlog = LASTLOG_FILE; ],
2755 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002756 [
2757 AC_MSG_RESULT(no)
2758 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2759 AC_TRY_COMPILE([
2760#include <sys/types.h>
2761#include <utmp.h>
2762#ifdef HAVE_LASTLOG_H
2763# include <lastlog.h>
2764#endif
2765#ifdef HAVE_PATHS_H
2766# include <paths.h>
2767#endif
2768 ],
2769 [ char *lastlog = _PATH_LASTLOG; ],
2770 [ AC_MSG_RESULT(yes) ],
2771 [
andree441aa32000-06-12 22:34:38 +00002772 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002773 system_lastlog_path=no
2774 ])
2775 ]
andre2ff7b5d2000-06-03 14:57:40 +00002776)
Damien Miller2994e082000-06-04 15:51:47 +10002777
andre2ff7b5d2000-06-03 14:57:40 +00002778if test -z "$conf_lastlog_location"; then
2779 if test x"$system_lastlog_path" = x"no" ; then
2780 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002781 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002782 conf_lastlog_location=$f
2783 fi
2784 done
2785 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002786 AC_MSG_WARN([** Cannot find lastlog **])
2787 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002788 fi
2789 fi
2790fi
2791
2792if test -n "$conf_lastlog_location"; then
2793 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2794fi
2795
2796dnl utmp detection
2797AC_MSG_CHECKING([if your system defines UTMP_FILE])
2798AC_TRY_COMPILE([
2799#include <sys/types.h>
2800#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002801#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002802# include <paths.h>
2803#endif
2804 ],
2805 [ char *utmp = UTMP_FILE; ],
2806 [ AC_MSG_RESULT(yes) ],
2807 [ AC_MSG_RESULT(no)
2808 system_utmp_path=no ]
2809)
2810if test -z "$conf_utmp_location"; then
2811 if test x"$system_utmp_path" = x"no" ; then
2812 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2813 if test -f $f ; then
2814 conf_utmp_location=$f
2815 fi
2816 done
2817 if test -z "$conf_utmp_location"; then
2818 AC_DEFINE(DISABLE_UTMP)
2819 fi
2820 fi
2821fi
2822if test -n "$conf_utmp_location"; then
2823 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2824fi
2825
2826dnl wtmp detection
2827AC_MSG_CHECKING([if your system defines WTMP_FILE])
2828AC_TRY_COMPILE([
2829#include <sys/types.h>
2830#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002831#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002832# include <paths.h>
2833#endif
2834 ],
2835 [ char *wtmp = WTMP_FILE; ],
2836 [ AC_MSG_RESULT(yes) ],
2837 [ AC_MSG_RESULT(no)
2838 system_wtmp_path=no ]
2839)
2840if test -z "$conf_wtmp_location"; then
2841 if test x"$system_wtmp_path" = x"no" ; then
2842 for f in /usr/adm/wtmp /var/log/wtmp; do
2843 if test -f $f ; then
2844 conf_wtmp_location=$f
2845 fi
2846 done
2847 if test -z "$conf_wtmp_location"; then
2848 AC_DEFINE(DISABLE_WTMP)
2849 fi
2850 fi
2851fi
2852if test -n "$conf_wtmp_location"; then
2853 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2854fi
2855
2856
2857dnl utmpx detection - I don't know any system so perverse as to require
2858dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2859dnl there, though.
2860AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2861AC_TRY_COMPILE([
2862#include <sys/types.h>
2863#include <utmp.h>
2864#ifdef HAVE_UTMPX_H
2865#include <utmpx.h>
2866#endif
Damien Miller2994e082000-06-04 15:51:47 +10002867#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002868# include <paths.h>
2869#endif
2870 ],
2871 [ char *utmpx = UTMPX_FILE; ],
2872 [ AC_MSG_RESULT(yes) ],
2873 [ AC_MSG_RESULT(no)
2874 system_utmpx_path=no ]
2875)
2876if test -z "$conf_utmpx_location"; then
2877 if test x"$system_utmpx_path" = x"no" ; then
2878 AC_DEFINE(DISABLE_UTMPX)
2879 fi
2880else
2881 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2882fi
2883
2884dnl wtmpx detection
2885AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2886AC_TRY_COMPILE([
2887#include <sys/types.h>
2888#include <utmp.h>
2889#ifdef HAVE_UTMPX_H
2890#include <utmpx.h>
2891#endif
Damien Miller2994e082000-06-04 15:51:47 +10002892#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002893# include <paths.h>
2894#endif
2895 ],
2896 [ char *wtmpx = WTMPX_FILE; ],
2897 [ AC_MSG_RESULT(yes) ],
2898 [ AC_MSG_RESULT(no)
2899 system_wtmpx_path=no ]
2900)
2901if test -z "$conf_wtmpx_location"; then
2902 if test x"$system_wtmpx_path" = x"no" ; then
2903 AC_DEFINE(DISABLE_WTMPX)
2904 fi
2905else
2906 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2907fi
2908
Damien Miller4018c192000-04-30 09:30:44 +10002909
Damien Miller29ea30d2000-03-17 10:54:15 +11002910if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002911 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2912 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002913fi
2914
Tim Rice4cec93f2002-02-26 08:40:48 -08002915dnl remove pam and dl because they are in $LIBPAM
2916if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002917 LIBS=`echo $LIBS | sed 's/-lpam //'`
2918fi
2919if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2920 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002921fi
2922
Damien Millerbac2d8a2000-09-05 16:13:06 +11002923AC_EXEEXT
Tim Rice5af9db92004-06-19 19:31:06 -07002924AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
Tim Rice13aae5e2001-10-21 17:53:58 -07002925AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002926
Damien Miller7b22d652000-06-18 14:07:04 +10002927# Print summary of options
2928
Damien Miller7b22d652000-06-18 14:07:04 +10002929# Someone please show me a better way :)
2930A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2931B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2932C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2933D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002934E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002935F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002936G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002937H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2938I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2939J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002940
2941echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002942echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002943echo " User binaries: $B"
2944echo " System binaries: $C"
2945echo " Configuration files: $D"
2946echo " Askpass program: $E"
2947echo " Manual pages: $F"
2948echo " PID file: $G"
2949echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002950if test "x$external_path_file" = "x/etc/login.conf" ; then
2951echo " At runtime, sshd will use the path defined in $external_path_file"
2952echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002953else
Damien Millerf58c6722002-05-13 13:15:42 +10002954echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002955 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002956echo " (If PATH is set in $external_path_file it will be used instead. If"
2957echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2958 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002959fi
Damien Millera18bbd32002-05-13 10:48:57 +10002960if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002961echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002962fi
Damien Millerf58c6722002-05-13 13:15:42 +10002963echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10002964echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002965echo " KerberosV support: $KRB5_MSG"
2966echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002967echo " S/KEY support: $SKEY_MSG"
2968echo " TCP Wrappers support: $TCPW_MSG"
2969echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002970echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002971echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2972echo " BSD Auth support: $BSD_AUTH_MSG"
2973echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002974if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002975echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002976fi
2977
Damien Miller7b22d652000-06-18 14:07:04 +10002978echo ""
2979
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002980echo " Host: ${host}"
2981echo " Compiler: ${CC}"
2982echo " Compiler flags: ${CFLAGS}"
2983echo "Preprocessor flags: ${CPPFLAGS}"
2984echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002985echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002986
2987echo ""
2988
Tim Rice6f1f7582004-05-30 21:38:51 -07002989if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
2990 echo "SVR4 style packages are supported with \"make package\"\n"
2991fi
2992
Damien Miller82cf0ce2000-12-20 13:34:48 +11002993if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002994 echo "PAM is enabled. You may need to install a PAM control file "
2995 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11002996 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11002997 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002998 echo ""
2999fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003000
Damien Miller6c21c512002-01-22 21:57:53 +11003001if test ! -z "$RAND_HELPER_CMDHASH" ; then
3002 echo "WARNING: you are using the builtin random number collection "
3003 echo "service. Please read WARNING.RNG and request that your OS "
3004 echo "vendor includes kernel-based random number collection in "
3005 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003006 echo ""
3007fi
Damien Miller60396b02001-02-18 17:01:00 +11003008
Damien Millerb4097182004-05-23 14:09:40 +10003009if test ! -z "$NO_PEERCHECK" ; then
3010 echo "WARNING: the operating system that you are using does not "
3011 echo "appear to support either the getpeereid() API nor the "
3012 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3013 echo "enforce security checks to prevent unauthorised connections to "
3014 echo "ssh-agent. Their absence increases the risk that a malicious "
3015 echo "user can connect to your agent. "
3016 echo ""
3017fi
3018