blob: 4b49c935bfd526b2087d2e621bf4b547dff88fbf [file] [log] [blame]
Tim Rice5af9db92004-06-19 19:31:06 -07001# $Id: configure.ac,v 1.220 2004/06/20 02:31:06 tim Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Tim Rice13aae5e2001-10-21 17:53:58 -070017AC_INIT
18AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim 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)
Damien Miller2e1b0821999-12-25 10:11:29 +110042
Tim Rice6f1f7582004-05-30 21:38:51 -070043dnl for buildpkg.sh
44AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
45 [/usr/sbin${PATH_SEPARATOR}/etc])
46AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
47 [/usr/sbin${PATH_SEPARATOR}/etc])
48AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
49
Damien Millere8bb4502001-09-25 16:39:35 +100050# System features
51AC_SYS_LARGEFILE
52
Damien Miller3f62aba2000-11-29 11:56:35 +110053if test -z "$AR" ; then
54 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
55fi
56
Damien Millerad833b32000-08-23 10:46:23 +100057# Use LOGIN_PROGRAM from environment if possible
58if test ! -z "$LOGIN_PROGRAM" ; then
59 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
60else
61 # Search for login
62 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
63 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
64 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
65 fi
66fi
67
Darren Tucker23bc8d02004-02-06 16:24:31 +110068AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
69if test ! -z "$PATH_PASSWD_PROG" ; then
70 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
71fi
72
Damien Miller166bd442000-03-16 10:48:25 +110073if test -z "$LD" ; then
74 LD=$CC
75fi
76AC_SUBST(LD)
77
Damien Miller166bd442000-03-16 10:48:25 +110078AC_C_INLINE
Damien Millera8e06ce2003-11-21 23:48:55 +110079if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Miller649d9992001-06-27 23:35:51 +100080 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110081fi
82
Tim Rice88368a32003-12-08 12:35:59 -080083AC_ARG_WITH(rpath,
84 [ --without-rpath Disable auto-added -R linker paths],
85 [
86 if test "x$withval" = "xno" ; then
87 need_dash_r=""
88 fi
89 if test "x$withval" = "xyes" ; then
90 need_dash_r=1
91 fi
92 ]
93)
94
Damien Millera22ba012000-03-02 23:09:20 +110095# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110096case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110097*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +110098 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +100099 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800100 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100101 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000102 saved_LDFLAGS="$LDFLAGS"
103 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
104 if (test -z "$blibflags"); then
105 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
106 AC_TRY_LINK([], [], [blibflags=$tryflags])
107 fi
108 done
109 if (test -z "$blibflags"); then
110 AC_MSG_RESULT(not found)
111 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
112 else
113 AC_MSG_RESULT($blibflags)
114 fi
115 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000116 dnl Check for authenticate. Might be in libs.a on older AIXes
117 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -0700118 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000119 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700120 LIBS="$LIBS -ls"
121 ])
122 ])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000123 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
124 AC_CHECK_DECL(loginfailed,
125 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
126 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000127 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000128 [(void)loginfailed("user","host","tty",0);],
129 [AC_MSG_RESULT(yes)
130 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000131 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000132 )],
133 [],
134 [#include <usersec.h>]
135 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000136 AC_CHECK_FUNCS(setauthdb)
Damien Millereca71f82000-01-20 22:38:27 +1100137 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +1000138 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000139 AC_DEFINE(SETEUID_BREAKS_SETUID)
140 AC_DEFINE(BROKEN_SETREUID)
141 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000142 dnl AIX handles lastlog as part of its login message
143 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000144 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000145 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100146 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100147*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100148 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800149 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100150 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000151 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100152 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100153 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000154 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000155 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700156 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +0000157 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100158 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000159*-*-dgux*)
160 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100161 AC_DEFINE(SETEUID_BREAKS_SETUID)
162 AC_DEFINE(BROKEN_SETREUID)
163 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000164 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000165*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000166 AC_MSG_CHECKING(if we have working getaddrinfo)
167 AC_TRY_RUN([#include <mach-o/dyld.h>
168main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
169 exit(0);
170 else
171 exit(1);
172}], [AC_MSG_RESULT(working)],
173 [AC_MSG_RESULT(buggy)
174 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700175 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000176 AC_DEFINE(SETEUID_BREAKS_SETUID)
177 AC_DEFINE(BROKEN_SETREUID)
178 AC_DEFINE(BROKEN_SETREGID)
Damien Miller7a2ea782004-01-02 17:52:10 +1100179 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000180 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000181*-*-hpux10.26)
182 if test -z "$GCC"; then
183 CFLAGS="$CFLAGS -Ae"
184 fi
185 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
186 IPADDR_IN_DISPLAY=yes
187 AC_DEFINE(HAVE_SECUREWARE)
188 AC_DEFINE(USE_PIPES)
189 AC_DEFINE(LOGIN_NO_ENDOPT)
190 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000191 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000192 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700193 LIBS="$LIBS -lsec -lsecpw"
194 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000195 disable_ptmx_check=yes
196 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100197*-*-hpux10*)
198 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000199 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100200 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000201 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100202 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000203 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000204 AC_DEFINE(LOGIN_NO_ENDOPT)
205 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000206 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000207 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700208 LIBS="$LIBS -lsec"
209 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100210 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000211*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000212 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100213 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100214 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100215 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000216 AC_DEFINE(LOGIN_NO_ENDOPT)
217 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100218 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000219 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000220 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker4398cf52004-04-06 21:39:02 +1000221 check_for_hpux_broken_getaddrinfo=1
Tim Ricef028f1e2002-07-19 12:41:10 -0700222 LIBS="$LIBS -lsec"
223 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000224 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100225*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100226 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000227 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000228 AC_DEFINE(SETEUID_BREAKS_SETUID)
229 AC_DEFINE(BROKEN_SETREUID)
230 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000231 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000232 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100233 ;;
234*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100235 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000236 AC_DEFINE(WITH_IRIX_ARRAY)
237 AC_DEFINE(WITH_IRIX_PROJECT)
238 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000239 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000240 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000241 AC_DEFINE(SETEUID_BREAKS_SETUID)
242 AC_DEFINE(BROKEN_SETREUID)
243 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000244 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000245 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000246 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100247 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100248*-*-linux*)
249 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100250 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000251 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100252 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000253 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000254 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000255 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller7bcb0892000-03-11 20:45:40 +1100256 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000257 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000258 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000259 AC_DEFINE(BROKEN_CMSG_TYPE)
260 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000261 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100262 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000263mips-sony-bsd|mips-sony-newsos4)
264 AC_DEFINE(HAVE_NEWS4)
265 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000266 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100267*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000268 check_for_libcrypt_before=1
Tim Rice88368a32003-12-08 12:35:59 -0800269 if test "x$withval" != "xno" ; then
270 need_dash_r=1
271 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100272 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100273*-*-freebsd*)
274 check_for_libcrypt_later=1
275 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000276*-*-bsdi*)
277 AC_DEFINE(SETEUID_BREAKS_SETUID)
278 AC_DEFINE(BROKEN_SETREUID)
279 AC_DEFINE(BROKEN_SETREGID)
280 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000281*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000282 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100283 conf_utmp_location=/etc/utmp
284 conf_wtmp_location=/usr/adm/wtmp
285 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000286 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000287 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000288 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100289 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000290 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100291*-*-solaris*)
Tim Ricead4a1882004-02-29 15:53:37 -0800292 if test "x$withval" != "xno" ; then
293 need_dash_r=1
294 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100295 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000296 AC_DEFINE(LOGIN_NEEDS_UTMPX)
297 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000298 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000299 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000300 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
301 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000302 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000303 # hardwire lastlog location (can't detect it on some versions)
304 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000305 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
306 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
307 if test "$sol2ver" -ge 8; then
308 AC_MSG_RESULT(yes)
309 AC_DEFINE(DISABLE_UTMP)
310 AC_DEFINE(DISABLE_WTMP)
311 else
312 AC_MSG_RESULT(no)
313 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100314 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000315*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000316 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000317 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100318 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000319 conf_utmp_location=/etc/utmp
320 conf_wtmp_location=/var/adm/wtmp
321 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000322 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000323 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000324*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700325 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000326 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000327 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000328 AC_DEFINE(SETEUID_BREAKS_SETUID)
329 AC_DEFINE(BROKEN_SETREUID)
330 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000331 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000332*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700333 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000334 AC_CHECK_LIB(dl, dlsym, ,)
Damien Millerfd9885e2001-01-10 08:16:53 +1100335 IPADDR_IN_DISPLAY=yes
336 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000337 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000338 AC_DEFINE(SETEUID_BREAKS_SETUID)
339 AC_DEFINE(BROKEN_SETREUID)
340 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000341 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000342 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700343 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
344 # Attention: always take care to bind libsocket and libnsl before libc,
345 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000346 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100347*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100348 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700349 AC_DEFINE(SETEUID_BREAKS_SETUID)
350 AC_DEFINE(BROKEN_SETREUID)
351 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100352 ;;
353*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100354 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700355 AC_DEFINE(SETEUID_BREAKS_SETUID)
356 AC_DEFINE(BROKEN_SETREUID)
357 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100358 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100359*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100360 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100361*-*-sco3.2v4*)
Tim Ricefcb62202004-01-23 18:35:16 -0800362 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize"
Tim Ricee8c898a2004-02-23 21:47:04 -0800363 LIBS="$LIBS -los -lprot -lcrypt_i -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100364 RANLIB=true
365 no_dev_ptmx=1
366 AC_DEFINE(BROKEN_SYS_TERMIO_H)
367 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000368 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000369 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100370 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Ricefe6d5aa2004-04-16 20:03:07 -0700371 AC_DEFINE(SETEUID_BREAKS_SETUID)
372 AC_DEFINE(BROKEN_SETREUID)
373 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700374 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100375 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700376 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700377 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100378 ;;
379*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800380 if test -z "$GCC"; then
381 CFLAGS="$CFLAGS -belf"
382 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100383 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000384 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100385 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000386 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000387 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700388 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700389 AC_DEFINE(SETEUID_BREAKS_SETUID)
390 AC_DEFINE(BROKEN_SETREUID)
391 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700392 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100393 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700394 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000395 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000396*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100397 AC_DEFINE(NO_SSH_LASTLOG)
398 AC_DEFINE(SETEUID_BREAKS_SETUID)
399 AC_DEFINE(BROKEN_SETREUID)
400 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000401 AC_DEFINE(USE_PIPES)
402 AC_DEFINE(DISABLE_FD_PASSING)
403 LDFLAGS="$LDFLAGS"
404 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
405 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000406 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000407*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100408 AC_DEFINE(SETEUID_BREAKS_SETUID)
409 AC_DEFINE(BROKEN_SETREUID)
410 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000411 AC_DEFINE(WITH_ABBREV_NO_TTY)
412 AC_DEFINE(USE_PIPES)
413 AC_DEFINE(DISABLE_FD_PASSING)
414 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100415 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000416 MANTYPE=cat
417 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000418*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100419 AC_DEFINE(SETEUID_BREAKS_SETUID)
420 AC_DEFINE(BROKEN_SETREUID)
421 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000422 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700423 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700424 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000425 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
426 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
427 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700428 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000429*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000430 AC_MSG_CHECKING(for Digital Unix SIA)
431 no_osfsia=""
432 AC_ARG_WITH(osfsia,
433 [ --with-osfsia Enable Digital Unix SIA],
434 [
435 if test "x$withval" = "xno" ; then
436 AC_MSG_RESULT(disabled)
437 no_osfsia=1
438 fi
439 ],
440 )
441 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000442 if test -f /etc/sia/matrix.conf; then
443 AC_MSG_RESULT(yes)
444 AC_DEFINE(HAVE_OSF_SIA)
445 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000446 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000447 LIBS="$LIBS -lsecurity -ldb -lm -laud"
448 else
449 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100450 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000451 fi
452 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000453 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700454 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000455 AC_DEFINE(BROKEN_SETREUID)
456 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000457 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000458
459*-*-nto-qnx)
460 AC_DEFINE(USE_PIPES)
461 AC_DEFINE(NO_X11_UNIX_SOCKETS)
462 AC_DEFINE(MISSING_NFDBITS)
463 AC_DEFINE(MISSING_HOWMANY)
464 AC_DEFINE(MISSING_FD_MASK)
465 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100466esac
467
Damien Millere37bfc12000-06-05 09:37:43 +1000468# Allow user to specify flags
469AC_ARG_WITH(cflags,
470 [ --with-cflags Specify additional flags to pass to compiler],
471 [
472 if test "x$withval" != "xno" ; then
473 CFLAGS="$CFLAGS $withval"
474 fi
475 ]
476)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000477AC_ARG_WITH(cppflags,
478 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
479 [
480 if test "x$withval" != "xno"; then
481 CPPFLAGS="$CPPFLAGS $withval"
482 fi
483 ]
484)
Damien Millere37bfc12000-06-05 09:37:43 +1000485AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000486 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000487 [
488 if test "x$withval" != "xno" ; then
489 LDFLAGS="$LDFLAGS $withval"
490 fi
491 ]
492)
493AC_ARG_WITH(libs,
494 [ --with-libs Specify additional libraries to link with],
495 [
496 if test "x$withval" != "xno" ; then
497 LIBS="$LIBS $withval"
498 fi
499 ]
500)
501
Darren Tucker6eb93042003-06-29 21:30:41 +1000502AC_MSG_CHECKING(compiler and flags for sanity)
503AC_TRY_RUN([
504#include <stdio.h>
505int main(){exit(0);}
506 ],
507 [ AC_MSG_RESULT(yes) ],
508 [
509 AC_MSG_RESULT(no)
510 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
511 ]
512)
513
Tim Rice4cec93f2002-02-26 08:40:48 -0800514# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000515AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000516 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800517 login_cap.h maillock.h netdb.h netgroup.h \
Damien Miller0f47c532004-01-02 18:01:30 +1100518 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000519 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000520 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
Damien Miller6c4914a2004-03-03 11:08:59 +1100521 sys/cdefs.h sys/mman.h sys/prctl.h sys/pstat.h sys/ptms.h \
522 sys/select.h sys/stat.h sys/stream.h sys/stropts.h \
523 sys/sysmacros.h sys/time.h sys/timers.h sys/un.h time.h tmpdir.h \
524 ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
Tim Rice4cec93f2002-02-26 08:40:48 -0800525
Damien Millera22ba012000-03-02 23:09:20 +1100526# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700527AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
528AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000529
Damien Millerdf288022001-02-18 13:07:07 +1100530dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700531if test "x$with_tcp_wrappers" != "xno" ; then
532 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
533 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
534 fi
535fi
Damien Millerdf288022001-02-18 13:07:07 +1100536
Tim Rice1e1ef642003-09-11 22:19:31 -0700537dnl IRIX and Solaris 2.5.1 have dirname() in libgen
538AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
539 AC_CHECK_LIB(gen, dirname,[
540 AC_CACHE_CHECK([for broken dirname],
541 ac_cv_have_broken_dirname, [
542 save_LIBS="$LIBS"
543 LIBS="$LIBS -lgen"
544 AC_TRY_RUN(
545 [
546#include <libgen.h>
547#include <string.h>
548
549int main(int argc, char **argv) {
550 char *s, buf[32];
551
552 strncpy(buf,"/etc", 32);
553 s = dirname(buf);
554 if (!s || strncmp(s, "/", 32) != 0) {
555 exit(1);
556 } else {
557 exit(0);
558 }
559}
560 ],
561 [ ac_cv_have_broken_dirname="no" ],
562 [ ac_cv_have_broken_dirname="yes" ]
563 )
564 LIBS="$save_LIBS"
565 ])
566 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
567 LIBS="$LIBS -lgen"
568 AC_DEFINE(HAVE_DIRNAME)
569 AC_CHECK_HEADERS(libgen.h)
570 fi
571 ])
572])
573
574AC_CHECK_FUNC(getspnam, ,
575 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
576AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
577
Tim Rice13aae5e2001-10-21 17:53:58 -0700578dnl zlib is required
579AC_ARG_WITH(zlib,
580 [ --with-zlib=PATH Use zlib in PATH],
581 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000582 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100583 AC_MSG_ERROR([*** zlib is required ***])
584 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700585 if test -d "$withval/lib"; then
586 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700587 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700588 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700589 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700590 fi
591 else
592 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700593 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700594 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700595 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700596 fi
597 fi
598 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700599 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700600 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700601 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700602 fi
603 ]
604)
605
Tim Ricefcb62202004-01-23 18:35:16 -0800606AC_CHECK_LIB(z, deflate, ,
607 [
608 saved_CPPFLAGS="$CPPFLAGS"
609 saved_LDFLAGS="$LDFLAGS"
610 save_LIBS="$LIBS"
611 dnl Check default zlib install dir
612 if test -n "${need_dash_r}"; then
613 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
614 else
615 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
616 fi
617 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
618 LIBS="$LIBS -lz"
619 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
620 [
621 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
622 ]
623 )
624 ]
625)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100626AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100627
628AC_ARG_WITH(zlib-version-check,
629 [ --without-zlib-version-check Disable zlib version check],
630 [ if test "x$withval" = "xno" ; then
631 zlib_check_nonfatal=1
632 fi
633 ]
634)
635
Darren Tucker2dcd2392004-01-23 17:13:33 +1100636AC_MSG_CHECKING(for zlib 1.1.4 or greater)
637AC_TRY_RUN([
638#include <zlib.h>
639int main()
640{
641 int a, b, c, v;
642 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
643 exit(1);
644 v = a*1000000 + b*1000 + c;
645 if (v >= 1001004)
646 exit(0);
647 exit(2);
648}
649 ],
650 AC_MSG_RESULT(yes),
651 [ AC_MSG_RESULT(no)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100652 if test -z "$zlib_check_nonfatal" ; then
653 AC_MSG_ERROR([*** zlib too old - check config.log ***
654Your reported zlib version has known security problems. It's possible your
655vendor has fixed these problems without changing the version number. If you
656are sure this is the case, you can disable the check by running
657"./configure --without-zlib-version-check".
658If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
659 else
660 AC_MSG_WARN([zlib version may have security problems])
661 fi
662 ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100663)
Damien Miller6f9c3372000-10-25 10:06:04 +1100664
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000665dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100666AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000667 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
668)
Damien Millera8e06ce2003-11-21 23:48:55 +1100669AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700670 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
671 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000672)
Damien Millerab18c411999-11-11 10:40:23 +1100673
Tim Ricee589a292001-11-03 11:09:32 -0800674dnl Checks for libutil functions
675AC_CHECK_HEADERS(libutil.h)
676AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
677AC_CHECK_FUNCS(logout updwtmp logwtmp)
678
Ben Lindstrom8697e082001-02-24 21:41:10 +0000679AC_FUNC_STRFTIME
680
Damien Miller3c027682001-03-14 11:39:45 +1100681# Check for ALTDIRFUNC glob() extension
682AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
683AC_EGREP_CPP(FOUNDIT,
684 [
685 #include <glob.h>
686 #ifdef GLOB_ALTDIRFUNC
687 FOUNDIT
688 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100689 ],
Damien Miller3c027682001-03-14 11:39:45 +1100690 [
691 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
692 AC_MSG_RESULT(yes)
693 ],
694 [
695 AC_MSG_RESULT(no)
696 ]
697)
Damien Millerab18c411999-11-11 10:40:23 +1100698
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000699# Check for g.gl_matchc glob() extension
700AC_MSG_CHECKING(for gl_matchc field in glob_t)
701AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100702 [
703 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000704 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100705 ],
706 [
707 AC_DEFINE(GLOB_HAS_GL_MATCHC)
708 AC_MSG_RESULT(yes)
709 ],
710 [
711 AC_MSG_RESULT(no)
712 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000713)
714
Damien Miller18bb4732001-03-28 14:35:30 +1000715AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
716AC_TRY_RUN(
717 [
718#include <sys/types.h>
719#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700720int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000721 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100722 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000723 [
724 AC_MSG_RESULT(no)
725 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
726 ]
727)
728
Damien Millerc547bf12001-02-16 10:18:12 +1100729# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100730SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100731AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700732 [ --with-skey[[=PATH]] Enable S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100733 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100734 [
735 if test "x$withval" != "xno" ; then
736
737 if test "x$withval" != "xyes" ; then
738 CPPFLAGS="$CPPFLAGS -I${withval}/include"
739 LDFLAGS="$LDFLAGS -L${withval}/lib"
740 fi
741
742 AC_DEFINE(SKEY)
743 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100744 SKEY_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100745
Tim Rice4cec93f2002-02-26 08:40:48 -0800746 AC_MSG_CHECKING([for s/key support])
747 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100748 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800749#include <stdio.h>
750#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700751int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800752 ],
753 [AC_MSG_RESULT(yes)],
754 [
755 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100756 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
757 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000758 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
759 AC_TRY_COMPILE(
760 [#include <stdio.h>
761 #include <skey.h>],
762 [(void)skeychallenge(NULL,"name","",0);],
763 [AC_MSG_RESULT(yes)
764 AC_DEFINE(SKEYCHALLENGE_4ARG)],
765 [AC_MSG_RESULT(no)]
766 )
Damien Millerc547bf12001-02-16 10:18:12 +1100767 fi
768 ]
769)
770
771# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700772TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100773AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700774 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
Damien Millera8e06ce2003-11-21 23:48:55 +1100775 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100776 [
777 if test "x$withval" != "xno" ; then
778 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700779 saved_LDFLAGS="$LDFLAGS"
780 saved_CPPFLAGS="$CPPFLAGS"
781 if test -n "${withval}" -a "${withval}" != "yes"; then
782 if test -d "${withval}/lib"; then
783 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700784 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700785 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700786 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700787 fi
788 else
789 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700790 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700791 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700792 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700793 fi
794 fi
795 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700796 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700797 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700798 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700799 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700800 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800801 LIBWRAP="-lwrap"
802 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100803 AC_MSG_CHECKING(for libwrap)
804 AC_TRY_LINK(
805 [
Damien Miller0ac45002004-04-14 20:14:26 +1000806#include <sys/types.h>
807#include <sys/socket.h>
808#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100809#include <tcpd.h>
810 int deny_severity = 0, allow_severity = 0;
811 ],
812 [hosts_access(0);],
813 [
814 AC_MSG_RESULT(yes)
815 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800816 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700817 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100818 ],
819 [
820 AC_MSG_ERROR([*** libwrap missing])
821 ]
822 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800823 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100824 fi
825 ]
826)
827
Damien Millerfe1f1432003-02-24 15:45:42 +1100828dnl Checks for library functions. Please keep in alphabetical order
829AC_CHECK_FUNCS(\
Damien Millerf09ad862003-09-19 16:41:01 +1000830 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
Damien Miller5fe46a42003-06-05 09:53:31 +1000831 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000832 getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000833 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100834 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000835 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100836 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000837 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100838 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000839 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000840 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100841 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100842)
Tim Rice13aae5e2001-10-21 17:53:58 -0700843
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000844# IRIX has a const char return value for gai_strerror()
845AC_CHECK_FUNCS(gai_strerror,[
846 AC_DEFINE(HAVE_GAI_STRERROR)
847 AC_TRY_COMPILE([
848#include <sys/types.h>
849#include <sys/socket.h>
850#include <netdb.h>
851
852const char *gai_strerror(int);],[
853char *str;
854
855str = gai_strerror(0);],[
856 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
857 [Define if gai_strerror() returns const char *])])])
858
Damien Millercd6853c2003-01-28 11:33:42 +1100859AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
860
Darren Tuckerf1159b52003-07-07 19:44:01 +1000861dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000862AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000863AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000864
Darren Tuckerb2427c82003-09-10 15:22:44 +1000865dnl tcsendbreak might be a macro
866AC_CHECK_DECL(tcsendbreak,
867 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100868 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000869 [#include <termios.h>]
870)
871
Darren Tucker5bb14002004-04-23 18:53:10 +1000872AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
873
Darren Tucker2a6b0292003-12-31 14:59:17 +1100874AC_CHECK_FUNCS(setresuid, [
875 dnl Some platorms have setresuid that isn't implemented, test for this
876 AC_MSG_CHECKING(if setresuid seems to work)
877 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100878#include <stdlib.h>
879#include <errno.h>
880int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100881 ],
882 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100883 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tucker2a6b0292003-12-31 14:59:17 +1100884 AC_MSG_RESULT(not implemented)]
885 )
886])
Darren Tuckere937be32003-12-17 18:53:26 +1100887
Darren Tucker2a6b0292003-12-31 14:59:17 +1100888AC_CHECK_FUNCS(setresgid, [
889 dnl Some platorms have setresgid that isn't implemented, test for this
890 AC_MSG_CHECKING(if setresgid seems to work)
891 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100892#include <stdlib.h>
893#include <errno.h>
894int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100895 ],
896 [AC_MSG_RESULT(yes)],
897 [AC_DEFINE(BROKEN_SETRESGID)
898 AC_MSG_RESULT(not implemented)]
899 )
900])
Darren Tuckere937be32003-12-17 18:53:26 +1100901
Damien Millerad833b32000-08-23 10:46:23 +1000902dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000903AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000904dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000905AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000906AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000907dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000908AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000909AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100910
Damien Millera8e06ce2003-11-21 23:48:55 +1100911AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100912 [AC_DEFINE(HAVE_DAEMON)],
913 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
914)
915
Damien Millera8e06ce2003-11-21 23:48:55 +1100916AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100917 [AC_DEFINE(HAVE_GETPAGESIZE)],
918 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
919)
920
Damien Millercb170cb2000-07-01 16:52:55 +1000921# Check for broken snprintf
922if test "x$ac_cv_func_snprintf" = "xyes" ; then
923 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
924 AC_TRY_RUN(
925 [
926#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700927int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000928 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100929 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000930 [
931 AC_MSG_RESULT(no)
932 AC_DEFINE(BROKEN_SNPRINTF)
933 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
934 ]
935 )
936fi
937
Damien Millerb4097182004-05-23 14:09:40 +1000938# Check for missing getpeereid (or equiv) support
939NO_PEERCHECK=""
940if test "x$ac_cv_func_getpeereid" != "xyes" ; then
941 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
942 AC_TRY_COMPILE(
943 [#include <sys/types.h>
944 #include <sys/socket.h>],
945 [int i = SO_PEERCRED;],
946 [AC_MSG_RESULT(yes)],
947 [AC_MSG_RESULT(no)
948 NO_PEERCHECK=1]
949 )
950fi
951
Damien Millere8328192003-01-07 15:18:32 +1100952dnl see whether mkstemp() requires XXXXXX
953if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
954AC_MSG_CHECKING([for (overly) strict mkstemp])
955AC_TRY_RUN(
956 [
957#include <stdlib.h>
958main() { char template[]="conftest.mkstemp-test";
959if (mkstemp(template) == -1)
960 exit(1);
961unlink(template); exit(0);
962}
963 ],
964 [
965 AC_MSG_RESULT(no)
966 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100967 [
Damien Millere8328192003-01-07 15:18:32 +1100968 AC_MSG_RESULT(yes)
969 AC_DEFINE(HAVE_STRICT_MKSTEMP)
970 ],
971 [
972 AC_MSG_RESULT(yes)
973 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +1100974 ]
Damien Millere8328192003-01-07 15:18:32 +1100975)
976fi
977
Darren Tucker70a3d552003-08-21 17:58:29 +1000978dnl make sure that openpty does not reacquire controlling terminal
979if test ! -z "$check_for_openpty_ctty_bug"; then
980 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
981 AC_TRY_RUN(
982 [
983#include <stdio.h>
984#include <sys/fcntl.h>
985#include <sys/types.h>
986#include <sys/wait.h>
987
988int
989main()
990{
991 pid_t pid;
992 int fd, ptyfd, ttyfd, status;
993
994 pid = fork();
995 if (pid < 0) { /* failed */
996 exit(1);
997 } else if (pid > 0) { /* parent */
998 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +1100999 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001000 exit(WEXITSTATUS(status));
1001 else
1002 exit(2);
1003 } else { /* child */
1004 close(0); close(1); close(2);
1005 setsid();
1006 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1007 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1008 if (fd >= 0)
1009 exit(3); /* Acquired ctty: broken */
1010 else
1011 exit(0); /* Did not acquire ctty: OK */
1012 }
1013}
1014 ],
1015 [
1016 AC_MSG_RESULT(yes)
1017 ],
1018 [
1019 AC_MSG_RESULT(no)
1020 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1021 ]
1022 )
1023fi
1024
Darren Tucker4398cf52004-04-06 21:39:02 +10001025if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1026 AC_MSG_CHECKING(if getaddrinfo seems to work)
1027 AC_TRY_RUN(
1028 [
1029#include <stdio.h>
1030#include <sys/socket.h>
1031#include <netdb.h>
1032#include <errno.h>
1033#include <netinet/in.h>
1034
1035#define TEST_PORT "2222"
1036
1037int
1038main(void)
1039{
1040 int err, sock;
1041 struct addrinfo *gai_ai, *ai, hints;
1042 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1043
1044 memset(&hints, 0, sizeof(hints));
1045 hints.ai_family = PF_UNSPEC;
1046 hints.ai_socktype = SOCK_STREAM;
1047 hints.ai_flags = AI_PASSIVE;
1048
1049 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1050 if (err != 0) {
1051 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1052 exit(1);
1053 }
1054
1055 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1056 if (ai->ai_family != AF_INET6)
1057 continue;
1058
1059 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1060 sizeof(ntop), strport, sizeof(strport),
1061 NI_NUMERICHOST|NI_NUMERICSERV);
1062
1063 if (err != 0) {
1064 if (err == EAI_SYSTEM)
1065 perror("getnameinfo EAI_SYSTEM");
1066 else
1067 fprintf(stderr, "getnameinfo failed: %s\n",
1068 gai_strerror(err));
1069 exit(2);
1070 }
1071
1072 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1073 if (sock < 0)
1074 perror("socket");
1075 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1076 if (errno == EBADF)
1077 exit(3);
1078 }
1079 }
1080 exit(0);
1081}
1082 ],
1083 [
1084 AC_MSG_RESULT(yes)
1085 ],
1086 [
1087 AC_MSG_RESULT(no)
1088 AC_DEFINE(BROKEN_GETADDRINFO)
1089 ]
1090 )
1091fi
1092
Damien Miller606f8802000-09-16 15:39:56 +11001093AC_FUNC_GETPGRP
1094
Damien Millera64b57a2001-01-17 10:44:13 +11001095# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001096PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001097AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001098 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001099 [
Damien Millera64b57a2001-01-17 10:44:13 +11001100 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001101 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1102 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001103 AC_MSG_ERROR([PAM headers not found])
1104 fi
1105
1106 AC_CHECK_LIB(dl, dlopen, , )
1107 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1108 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001109 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001110
Damien Millera64b57a2001-01-17 10:44:13 +11001111 PAM_MSG="yes"
1112
1113 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001114 if test $ac_cv_lib_dl_dlopen = yes; then
1115 LIBPAM="-lpam -ldl"
1116 else
1117 LIBPAM="-lpam"
1118 fi
1119 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001120 fi
1121 ]
1122)
Damien Millera22ba012000-03-02 23:09:20 +11001123
Damien Millera64b57a2001-01-17 10:44:13 +11001124# Check for older PAM
1125if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001126 # Check PAM strerror arguments (old PAM)
1127 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1128 AC_TRY_COMPILE(
1129 [
Damien Miller81171112000-04-23 11:14:01 +10001130#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001131#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001132#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001133#elif defined (HAVE_PAM_PAM_APPL_H)
1134#include <pam/pam_appl.h>
1135#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001136 ],
1137 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001138 [AC_MSG_RESULT(no)],
1139 [
1140 AC_DEFINE(HAVE_OLD_PAM)
1141 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001142 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001143 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001144 )
Damien Millera22ba012000-03-02 23:09:20 +11001145fi
1146
Tim Riceaef73712002-05-11 13:17:42 -07001147# Search for OpenSSL
1148saved_CPPFLAGS="$CPPFLAGS"
1149saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001150AC_ARG_WITH(ssl-dir,
1151 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1152 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001153 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -07001154 if test -d "$withval/lib"; then
1155 if test -n "${need_dash_r}"; then
1156 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1157 else
1158 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1159 fi
1160 else
1161 if test -n "${need_dash_r}"; then
1162 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1163 else
1164 LDFLAGS="-L${withval} ${LDFLAGS}"
1165 fi
1166 fi
1167 if test -d "$withval/include"; then
1168 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1169 else
1170 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1171 fi
Damien Millera22ba012000-03-02 23:09:20 +11001172 fi
1173 ]
1174)
Tim Rice3d5352e2004-02-12 09:27:21 -08001175LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001176AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001177 [
Tim Riceaef73712002-05-11 13:17:42 -07001178 dnl Check default openssl install dir
1179 if test -n "${need_dash_r}"; then
1180 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001181 else
Tim Riceaef73712002-05-11 13:17:42 -07001182 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001183 fi
Tim Riceaef73712002-05-11 13:17:42 -07001184 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1185 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1186 [
1187 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1188 ]
1189 )
1190 ]
1191)
1192
Tim Riced730b782002-08-13 18:52:10 -07001193# Determine OpenSSL header version
1194AC_MSG_CHECKING([OpenSSL header version])
1195AC_TRY_RUN(
1196 [
1197#include <stdio.h>
1198#include <string.h>
1199#include <openssl/opensslv.h>
1200#define DATA "conftest.sslincver"
1201int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001202 FILE *fd;
1203 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001204
Damien Millera8e06ce2003-11-21 23:48:55 +11001205 fd = fopen(DATA,"w");
1206 if(fd == NULL)
1207 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001208
1209 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1210 exit(1);
1211
1212 exit(0);
1213}
1214 ],
1215 [
1216 ssl_header_ver=`cat conftest.sslincver`
1217 AC_MSG_RESULT($ssl_header_ver)
1218 ],
1219 [
1220 AC_MSG_RESULT(not found)
1221 AC_MSG_ERROR(OpenSSL version header not found.)
1222 ]
1223)
1224
1225# Determine OpenSSL library version
1226AC_MSG_CHECKING([OpenSSL library version])
1227AC_TRY_RUN(
1228 [
1229#include <stdio.h>
1230#include <string.h>
1231#include <openssl/opensslv.h>
1232#include <openssl/crypto.h>
1233#define DATA "conftest.ssllibver"
1234int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001235 FILE *fd;
1236 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001237
Damien Millera8e06ce2003-11-21 23:48:55 +11001238 fd = fopen(DATA,"w");
1239 if(fd == NULL)
1240 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001241
1242 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1243 exit(1);
1244
1245 exit(0);
1246}
1247 ],
1248 [
1249 ssl_library_ver=`cat conftest.ssllibver`
1250 AC_MSG_RESULT($ssl_library_ver)
1251 ],
1252 [
1253 AC_MSG_RESULT(not found)
1254 AC_MSG_ERROR(OpenSSL library not found.)
1255 ]
1256)
Damien Millera22ba012000-03-02 23:09:20 +11001257
Damien Millerec932372002-01-22 22:16:03 +11001258# Sanity check OpenSSL headers
1259AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1260AC_TRY_RUN(
1261 [
1262#include <string.h>
1263#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001264int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001265 ],
1266 [
1267 AC_MSG_RESULT(yes)
1268 ],
1269 [
1270 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001271 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1272Check config.log for details.
1273Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001274 ]
1275)
1276
Tim Rice3d5352e2004-02-12 09:27:21 -08001277# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1278# because the system crypt() is more featureful.
1279if test "x$check_for_libcrypt_before" = "x1"; then
1280 AC_CHECK_LIB(crypt, crypt)
1281fi
1282
Damien Millera8e06ce2003-11-21 23:48:55 +11001283# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001284# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001285if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001286 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001287fi
1288
Damien Miller6c21c512002-01-22 21:57:53 +11001289
1290### Configure cryptographic random number support
1291
1292# Check wheter OpenSSL seeds itself
1293AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1294AC_TRY_RUN(
1295 [
1296#include <string.h>
1297#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001298int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001299 ],
1300 [
1301 OPENSSL_SEEDS_ITSELF=yes
1302 AC_MSG_RESULT(yes)
1303 ],
1304 [
1305 AC_MSG_RESULT(no)
1306 # Default to use of the rand helper if OpenSSL doesn't
1307 # seed itself
1308 USE_RAND_HELPER=yes
1309 ]
1310)
1311
1312
1313# Do we want to force the use of the rand helper?
1314AC_ARG_WITH(rand-helper,
1315 [ --with-rand-helper Use subprocess to gather strong randomness ],
1316 [
1317 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001318 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001319 # the previous test showed it to be unseeded.
1320 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1321 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1322 OPENSSL_SEEDS_ITSELF=yes
1323 USE_RAND_HELPER=""
1324 fi
1325 else
1326 USE_RAND_HELPER=yes
1327 fi
1328 ],
1329)
1330
1331# Which randomness source do we use?
1332if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1333 # OpenSSL only
1334 AC_DEFINE(OPENSSL_PRNG_ONLY)
1335 RAND_MSG="OpenSSL internal ONLY"
1336 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001337elif test ! -z "$USE_RAND_HELPER" ; then
1338 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001339 RAND_MSG="ssh-rand-helper"
1340 INSTALL_SSH_RAND_HELPER="yes"
1341fi
1342AC_SUBST(INSTALL_SSH_RAND_HELPER)
1343
1344### Configuration of ssh-rand-helper
1345
1346# PRNGD TCP socket
1347AC_ARG_WITH(prngd-port,
1348 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1349 [
Damien Millere996d722002-01-23 11:20:59 +11001350 case "$withval" in
1351 no)
1352 withval=""
1353 ;;
1354 [[0-9]]*)
1355 ;;
1356 *)
1357 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1358 ;;
1359 esac
1360 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001361 PRNGD_PORT="$withval"
1362 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1363 fi
1364 ]
1365)
1366
1367# PRNGD Unix domain socket
1368AC_ARG_WITH(prngd-socket,
1369 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1370 [
Damien Millere996d722002-01-23 11:20:59 +11001371 case "$withval" in
1372 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001373 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001374 ;;
1375 no)
1376 withval=""
1377 ;;
1378 /*)
1379 ;;
1380 *)
1381 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1382 ;;
1383 esac
1384
1385 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001386 if test ! -z "$PRNGD_PORT" ; then
1387 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1388 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001389 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001390 AC_MSG_WARN(Entropy socket is not readable)
1391 fi
1392 PRNGD_SOCKET="$withval"
1393 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1394 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001395 ],
1396 [
1397 # Check for existing socket only if we don't have a random device already
1398 if test "$USE_RAND_HELPER" = yes ; then
1399 AC_MSG_CHECKING(for PRNGD/EGD socket)
1400 # Insert other locations here
1401 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1402 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1403 PRNGD_SOCKET="$sock"
1404 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1405 break;
1406 fi
1407 done
1408 if test ! -z "$PRNGD_SOCKET" ; then
1409 AC_MSG_RESULT($PRNGD_SOCKET)
1410 else
1411 AC_MSG_RESULT(not found)
1412 fi
1413 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001414 ]
1415)
1416
1417# Change default command timeout for hashing entropy source
1418entropy_timeout=200
1419AC_ARG_WITH(entropy-timeout,
1420 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1421 [
1422 if test "x$withval" != "xno" ; then
1423 entropy_timeout=$withval
1424 fi
1425 ]
1426)
Damien Miller6c21c512002-01-22 21:57:53 +11001427AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1428
Damien Millerd3f6ad22002-06-25 10:24:47 +10001429SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001430AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001431 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001432 [
1433 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001434 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001435 fi
1436 ]
1437)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001438AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1439AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001440
Tim Rice88f2ab52002-03-17 12:17:34 -08001441# We do this little dance with the search path to insure
1442# that programs that we select for use by installed programs
1443# (which may be run by the super-user) come from trusted
1444# locations before they come from the user's private area.
1445# This should help avoid accidentally configuring some
1446# random version of a program in someone's personal bin.
1447
1448OPATH=$PATH
1449PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001450test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001451test -d /sbin && PATH=$PATH:/sbin
1452test -d /usr/sbin && PATH=$PATH:/usr/sbin
1453PATH=$PATH:/etc:$OPATH
1454
Damien Millera8e06ce2003-11-21 23:48:55 +11001455# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001456OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1457OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1458OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1459OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1460OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1461OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1462OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1463OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1464OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1465OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1466OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1467OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1468OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1469OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1470OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1471OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001472# restore PATH
1473PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001474
1475# Where does ssh-rand-helper get its randomness from?
1476INSTALL_SSH_PRNG_CMDS=""
1477if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1478 if test ! -z "$PRNGD_PORT" ; then
1479 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1480 elif test ! -z "$PRNGD_SOCKET" ; then
1481 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1482 else
1483 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1484 RAND_HELPER_CMDHASH=yes
1485 INSTALL_SSH_PRNG_CMDS="yes"
1486 fi
1487fi
1488AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1489
1490
Ben Lindstromb5628642000-10-18 00:02:25 +00001491# Cheap hack to ensure NEWS-OS libraries are arranged right.
1492if test ! -z "$SONY" ; then
1493 LIBS="$LIBS -liberty";
1494fi
1495
Damien Millera22ba012000-03-02 23:09:20 +11001496# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001497AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001498AC_CHECK_SIZEOF(short int, 2)
1499AC_CHECK_SIZEOF(int, 4)
1500AC_CHECK_SIZEOF(long int, 4)
1501AC_CHECK_SIZEOF(long long int, 8)
1502
Damien Millerfa2bb692002-04-23 23:22:25 +10001503# Sanity check long long for some platforms (AIX)
1504if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1505 ac_cv_sizeof_long_long_int=0
1506fi
1507
Damien Millera22ba012000-03-02 23:09:20 +11001508# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001509AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1510 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001511 [ #include <sys/types.h> ],
1512 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001513 [ ac_cv_have_u_int="yes" ],
1514 [ ac_cv_have_u_int="no" ]
1515 )
1516])
1517if test "x$ac_cv_have_u_int" = "xyes" ; then
1518 AC_DEFINE(HAVE_U_INT)
1519 have_u_int=1
1520fi
1521
Damien Miller61e50f12000-05-08 20:49:37 +10001522AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1523 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001524 [ #include <sys/types.h> ],
1525 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001526 [ ac_cv_have_intxx_t="yes" ],
1527 [ ac_cv_have_intxx_t="no" ]
1528 )
1529])
1530if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1531 AC_DEFINE(HAVE_INTXX_T)
1532 have_intxx_t=1
1533fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001534
1535if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001536 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001537then
1538 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1539 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001540 [ #include <stdint.h> ],
1541 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001542 [
1543 AC_DEFINE(HAVE_INTXX_T)
1544 AC_MSG_RESULT(yes)
1545 ],
1546 [ AC_MSG_RESULT(no) ]
1547 )
1548fi
1549
Damien Miller578783e2000-09-23 14:12:24 +11001550AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1551 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001552 [
1553#include <sys/types.h>
1554#ifdef HAVE_STDINT_H
1555# include <stdint.h>
1556#endif
1557#include <sys/socket.h>
1558#ifdef HAVE_SYS_BITYPES_H
1559# include <sys/bitypes.h>
1560#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001561 ],
1562 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001563 [ ac_cv_have_int64_t="yes" ],
1564 [ ac_cv_have_int64_t="no" ]
1565 )
1566])
1567if test "x$ac_cv_have_int64_t" = "xyes" ; then
1568 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001569fi
1570
Damien Miller61e50f12000-05-08 20:49:37 +10001571AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1572 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001573 [ #include <sys/types.h> ],
1574 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001575 [ ac_cv_have_u_intxx_t="yes" ],
1576 [ ac_cv_have_u_intxx_t="no" ]
1577 )
1578])
1579if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1580 AC_DEFINE(HAVE_U_INTXX_T)
1581 have_u_intxx_t=1
1582fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001583
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001584if test -z "$have_u_intxx_t" ; then
1585 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1586 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001587 [ #include <sys/socket.h> ],
1588 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001589 [
1590 AC_DEFINE(HAVE_U_INTXX_T)
1591 AC_MSG_RESULT(yes)
1592 ],
1593 [ AC_MSG_RESULT(no) ]
1594 )
1595fi
1596
Damien Miller578783e2000-09-23 14:12:24 +11001597AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1598 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001599 [ #include <sys/types.h> ],
1600 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001601 [ ac_cv_have_u_int64_t="yes" ],
1602 [ ac_cv_have_u_int64_t="no" ]
1603 )
1604])
1605if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1606 AC_DEFINE(HAVE_U_INT64_T)
1607 have_u_int64_t=1
1608fi
1609
Tim Rice4cec93f2002-02-26 08:40:48 -08001610if test -z "$have_u_int64_t" ; then
1611 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1612 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001613 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001614 [ u_int64_t a; a = 1],
1615 [
1616 AC_DEFINE(HAVE_U_INT64_T)
1617 AC_MSG_RESULT(yes)
1618 ],
1619 [ AC_MSG_RESULT(no) ]
1620 )
1621fi
1622
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001623if test -z "$have_u_intxx_t" ; then
1624 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1625 AC_TRY_COMPILE(
1626 [
1627#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001628 ],
1629 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001630 [ ac_cv_have_uintxx_t="yes" ],
1631 [ ac_cv_have_uintxx_t="no" ]
1632 )
1633 ])
1634 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1635 AC_DEFINE(HAVE_UINTXX_T)
1636 fi
1637fi
1638
1639if test -z "$have_uintxx_t" ; then
1640 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1641 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001642 [ #include <stdint.h> ],
1643 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001644 [
1645 AC_DEFINE(HAVE_UINTXX_T)
1646 AC_MSG_RESULT(yes)
1647 ],
1648 [ AC_MSG_RESULT(no) ]
1649 )
1650fi
1651
Damien Milleredb82922000-06-20 13:25:52 +10001652if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001653 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001654then
1655 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1656 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001657 [
1658#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001659 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001660 [
Damien Miller70494d12000-04-03 15:57:06 +10001661 int8_t a; int16_t b; int32_t c;
1662 u_int8_t e; u_int16_t f; u_int32_t g;
1663 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001664 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001665 [
1666 AC_DEFINE(HAVE_U_INTXX_T)
1667 AC_DEFINE(HAVE_INTXX_T)
1668 AC_MSG_RESULT(yes)
1669 ],
1670 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001671 )
Damien Millerb29ea912000-01-15 14:12:03 +11001672fi
1673
Damien Miller58be7382001-09-15 21:31:54 +10001674
1675AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1676 AC_TRY_COMPILE(
1677 [
1678#include <sys/types.h>
1679 ],
1680 [ u_char foo; foo = 125; ],
1681 [ ac_cv_have_u_char="yes" ],
1682 [ ac_cv_have_u_char="no" ]
1683 )
1684])
1685if test "x$ac_cv_have_u_char" = "xyes" ; then
1686 AC_DEFINE(HAVE_U_CHAR)
1687fi
1688
Tim Rice13aae5e2001-10-21 17:53:58 -07001689TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001690
Tim Rice200a5c02002-02-26 22:12:34 -08001691AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001692
Damien Miller61e50f12000-05-08 20:49:37 +10001693AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1694 AC_TRY_COMPILE(
1695 [
1696#include <sys/types.h>
1697 ],
1698 [ size_t foo; foo = 1235; ],
1699 [ ac_cv_have_size_t="yes" ],
1700 [ ac_cv_have_size_t="no" ]
1701 )
1702])
1703if test "x$ac_cv_have_size_t" = "xyes" ; then
1704 AC_DEFINE(HAVE_SIZE_T)
1705fi
Damien Miller95058511999-12-29 10:36:45 +11001706
Damien Miller615f9392000-05-17 22:53:33 +10001707AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1708 AC_TRY_COMPILE(
1709 [
1710#include <sys/types.h>
1711 ],
1712 [ ssize_t foo; foo = 1235; ],
1713 [ ac_cv_have_ssize_t="yes" ],
1714 [ ac_cv_have_ssize_t="no" ]
1715 )
1716])
1717if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1718 AC_DEFINE(HAVE_SSIZE_T)
1719fi
1720
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001721AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1722 AC_TRY_COMPILE(
1723 [
1724#include <time.h>
1725 ],
1726 [ clock_t foo; foo = 1235; ],
1727 [ ac_cv_have_clock_t="yes" ],
1728 [ ac_cv_have_clock_t="no" ]
1729 )
1730])
1731if test "x$ac_cv_have_clock_t" = "xyes" ; then
1732 AC_DEFINE(HAVE_CLOCK_T)
1733fi
1734
Damien Millerb54b40e2000-06-23 08:23:34 +10001735AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1736 AC_TRY_COMPILE(
1737 [
1738#include <sys/types.h>
1739#include <sys/socket.h>
1740 ],
1741 [ sa_family_t foo; foo = 1235; ],
1742 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001743 [ AC_TRY_COMPILE(
1744 [
1745#include <sys/types.h>
1746#include <sys/socket.h>
1747#include <netinet/in.h>
1748 ],
1749 [ sa_family_t foo; foo = 1235; ],
1750 [ ac_cv_have_sa_family_t="yes" ],
1751
Damien Millerb54b40e2000-06-23 08:23:34 +10001752 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001753 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001754 )
1755])
1756if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1757 AC_DEFINE(HAVE_SA_FAMILY_T)
1758fi
1759
Damien Miller0f91b4e2000-06-18 15:43:25 +10001760AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1761 AC_TRY_COMPILE(
1762 [
1763#include <sys/types.h>
1764 ],
1765 [ pid_t foo; foo = 1235; ],
1766 [ ac_cv_have_pid_t="yes" ],
1767 [ ac_cv_have_pid_t="no" ]
1768 )
1769])
1770if test "x$ac_cv_have_pid_t" = "xyes" ; then
1771 AC_DEFINE(HAVE_PID_T)
1772fi
1773
1774AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1775 AC_TRY_COMPILE(
1776 [
1777#include <sys/types.h>
1778 ],
1779 [ mode_t foo; foo = 1235; ],
1780 [ ac_cv_have_mode_t="yes" ],
1781 [ ac_cv_have_mode_t="no" ]
1782 )
1783])
1784if test "x$ac_cv_have_mode_t" = "xyes" ; then
1785 AC_DEFINE(HAVE_MODE_T)
1786fi
1787
Damien Miller61e50f12000-05-08 20:49:37 +10001788
1789AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1790 AC_TRY_COMPILE(
1791 [
Damien Miller81171112000-04-23 11:14:01 +10001792#include <sys/types.h>
1793#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001794 ],
1795 [ struct sockaddr_storage s; ],
1796 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1797 [ ac_cv_have_struct_sockaddr_storage="no" ]
1798 )
1799])
1800if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1801 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1802fi
Damien Miller34132e52000-01-14 15:45:46 +11001803
Damien Miller61e50f12000-05-08 20:49:37 +10001804AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1805 AC_TRY_COMPILE(
1806 [
Damien Miller7b22d652000-06-18 14:07:04 +10001807#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001808#include <netinet/in.h>
1809 ],
1810 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1811 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1812 [ ac_cv_have_struct_sockaddr_in6="no" ]
1813 )
1814])
1815if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1816 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1817fi
Damien Miller34132e52000-01-14 15:45:46 +11001818
Damien Miller61e50f12000-05-08 20:49:37 +10001819AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1820 AC_TRY_COMPILE(
1821 [
Damien Miller7b22d652000-06-18 14:07:04 +10001822#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001823#include <netinet/in.h>
1824 ],
1825 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1826 [ ac_cv_have_struct_in6_addr="yes" ],
1827 [ ac_cv_have_struct_in6_addr="no" ]
1828 )
1829])
1830if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1831 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1832fi
Damien Miller34132e52000-01-14 15:45:46 +11001833
Damien Miller61e50f12000-05-08 20:49:37 +10001834AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1835 AC_TRY_COMPILE(
1836 [
Damien Miller81171112000-04-23 11:14:01 +10001837#include <sys/types.h>
1838#include <sys/socket.h>
1839#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001840 ],
1841 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1842 [ ac_cv_have_struct_addrinfo="yes" ],
1843 [ ac_cv_have_struct_addrinfo="no" ]
1844 )
1845])
1846if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1847 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1848fi
1849
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001850AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1851 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001852 [ #include <sys/time.h> ],
1853 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001854 [ ac_cv_have_struct_timeval="yes" ],
1855 [ ac_cv_have_struct_timeval="no" ]
1856 )
1857])
1858if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1859 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1860 have_struct_timeval=1
1861fi
1862
Tim Rice4e4dc562003-03-18 10:21:40 -08001863AC_CHECK_TYPES(struct timespec)
1864
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001865# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001866if test "x$ac_cv_have_int64_t" = "xno" -a \
1867 "x$ac_cv_sizeof_long_int" != "x8" -a \
1868 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001869 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1870 echo "an alternative compiler (I.E., GCC) before continuing."
1871 echo ""
1872 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001873else
1874dnl test snprintf (broken on SCO w/gcc)
1875 AC_TRY_RUN(
1876 [
1877#include <stdio.h>
1878#include <string.h>
1879#ifdef HAVE_SNPRINTF
1880main()
1881{
1882 char buf[50];
1883 char expected_out[50];
1884 int mazsize = 50 ;
1885#if (SIZEOF_LONG_INT == 8)
1886 long int num = 0x7fffffffffffffff;
1887#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001888 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001889#endif
1890 strcpy(expected_out, "9223372036854775807");
1891 snprintf(buf, mazsize, "%lld", num);
1892 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001893 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001894 exit(0);
1895}
1896#else
1897main() { exit(0); }
1898#endif
1899 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1900 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001901fi
1902
Damien Miller78315eb2000-09-29 23:01:36 +11001903dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001904OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1905OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1906OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1907OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1908OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001909OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001910OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1911OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001912OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001913OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1914OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1915OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1916OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001917OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1918OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1919OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1920OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001921
1922AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001923
Damien Miller61e50f12000-05-08 20:49:37 +10001924AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1925 ac_cv_have_ss_family_in_struct_ss, [
1926 AC_TRY_COMPILE(
1927 [
Damien Miller81171112000-04-23 11:14:01 +10001928#include <sys/types.h>
1929#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001930 ],
1931 [ struct sockaddr_storage s; s.ss_family = 1; ],
1932 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1933 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1934 )
1935])
1936if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1937 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1938fi
1939
Damien Miller61e50f12000-05-08 20:49:37 +10001940AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1941 ac_cv_have___ss_family_in_struct_ss, [
1942 AC_TRY_COMPILE(
1943 [
Damien Miller81171112000-04-23 11:14:01 +10001944#include <sys/types.h>
1945#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001946 ],
1947 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1948 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1949 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1950 )
1951])
1952if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1953 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1954fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001955
Damien Millerad833b32000-08-23 10:46:23 +10001956AC_CACHE_CHECK([for pw_class field in struct passwd],
1957 ac_cv_have_pw_class_in_struct_passwd, [
1958 AC_TRY_COMPILE(
1959 [
Damien Millerad833b32000-08-23 10:46:23 +10001960#include <pwd.h>
1961 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001962 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001963 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1964 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1965 )
1966])
1967if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1968 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1969fi
1970
Kevin Steves82456952001-06-22 21:14:18 +00001971AC_CACHE_CHECK([for pw_expire field in struct passwd],
1972 ac_cv_have_pw_expire_in_struct_passwd, [
1973 AC_TRY_COMPILE(
1974 [
1975#include <pwd.h>
1976 ],
1977 [ struct passwd p; p.pw_expire = 0; ],
1978 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1979 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1980 )
1981])
1982if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1983 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1984fi
1985
1986AC_CACHE_CHECK([for pw_change field in struct passwd],
1987 ac_cv_have_pw_change_in_struct_passwd, [
1988 AC_TRY_COMPILE(
1989 [
1990#include <pwd.h>
1991 ],
1992 [ struct passwd p; p.pw_change = 0; ],
1993 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1994 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1995 )
1996])
1997if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1998 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1999fi
Damien Miller61e50f12000-05-08 20:49:37 +10002000
Tim Rice28bbb0c2002-05-27 17:37:32 -07002001dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002002AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2003 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07002004 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00002005 [
Tim Riceae49fe62002-04-12 10:26:21 -07002006#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002007#include <sys/socket.h>
2008#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002009int main() {
2010#ifdef msg_accrights
2011exit(1);
2012#endif
2013struct msghdr m;
2014m.msg_accrights = 0;
2015exit(0);
2016}
Kevin Steves939c9db2002-03-22 17:23:25 +00002017 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002018 [ ac_cv_have_accrights_in_msghdr="yes" ],
2019 [ ac_cv_have_accrights_in_msghdr="no" ]
2020 )
2021])
2022if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2023 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2024fi
2025
Kevin Stevesa44e0352002-04-07 16:18:03 +00002026AC_CACHE_CHECK([for msg_control field in struct msghdr],
2027 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07002028 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002029 [
Tim Riceae49fe62002-04-12 10:26:21 -07002030#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002031#include <sys/socket.h>
2032#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002033int main() {
2034#ifdef msg_control
2035exit(1);
2036#endif
2037struct msghdr m;
2038m.msg_control = 0;
2039exit(0);
2040}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002041 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002042 [ ac_cv_have_control_in_msghdr="yes" ],
2043 [ ac_cv_have_control_in_msghdr="no" ]
2044 )
2045])
2046if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2047 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2048fi
2049
Damien Miller61e50f12000-05-08 20:49:37 +10002050AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002051 AC_TRY_LINK([],
2052 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002053 [ ac_cv_libc_defines___progname="yes" ],
2054 [ ac_cv_libc_defines___progname="no" ]
2055 )
2056])
2057if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2058 AC_DEFINE(HAVE___PROGNAME)
2059fi
2060
Kevin Steves4846f4a2002-03-22 18:19:53 +00002061AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2062 AC_TRY_LINK([
2063#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002064],
2065 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002066 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2067 [ ac_cv_cc_implements___FUNCTION__="no" ]
2068 )
2069])
2070if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2071 AC_DEFINE(HAVE___FUNCTION__)
2072fi
2073
2074AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2075 AC_TRY_LINK([
2076#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002077],
2078 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002079 [ ac_cv_cc_implements___func__="yes" ],
2080 [ ac_cv_cc_implements___func__="no" ]
2081 )
2082])
2083if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2084 AC_DEFINE(HAVE___func__)
2085fi
2086
Damien Miller4f8e6692001-07-14 13:22:53 +10002087AC_CACHE_CHECK([whether getopt has optreset support],
2088 ac_cv_have_getopt_optreset, [
2089 AC_TRY_LINK(
2090 [
2091#include <getopt.h>
2092 ],
2093 [ extern int optreset; optreset = 0; ],
2094 [ ac_cv_have_getopt_optreset="yes" ],
2095 [ ac_cv_have_getopt_optreset="no" ]
2096 )
2097])
2098if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2099 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2100fi
Damien Millera22ba012000-03-02 23:09:20 +11002101
Damien Millerecbb26d2000-07-15 14:59:14 +10002102AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002103 AC_TRY_LINK([],
2104 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002105 [ ac_cv_libc_defines_sys_errlist="yes" ],
2106 [ ac_cv_libc_defines_sys_errlist="no" ]
2107 )
2108])
2109if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2110 AC_DEFINE(HAVE_SYS_ERRLIST)
2111fi
2112
2113
Damien Miller11fa2cc2000-08-16 10:35:58 +10002114AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002115 AC_TRY_LINK([],
2116 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002117 [ ac_cv_libc_defines_sys_nerr="yes" ],
2118 [ ac_cv_libc_defines_sys_nerr="no" ]
2119 )
2120])
2121if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2122 AC_DEFINE(HAVE_SYS_NERR)
2123fi
2124
Damien Millera8e06ce2003-11-21 23:48:55 +11002125SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002126# Check whether user wants sectok support
2127AC_ARG_WITH(sectok,
2128 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002129 [
2130 if test "x$withval" != "xno" ; then
2131 if test "x$withval" != "xyes" ; then
2132 CPPFLAGS="$CPPFLAGS -I${withval}"
2133 LDFLAGS="$LDFLAGS -L${withval}"
2134 if test ! -z "$need_dash_r" ; then
2135 LDFLAGS="$LDFLAGS -R${withval}"
2136 fi
2137 if test ! -z "$blibpath" ; then
2138 blibpath="$blibpath:${withval}"
2139 fi
2140 fi
2141 AC_CHECK_HEADERS(sectok.h)
2142 if test "$ac_cv_header_sectok_h" != yes; then
2143 AC_MSG_ERROR(Can't find sectok.h)
2144 fi
2145 AC_CHECK_LIB(sectok, sectok_open)
2146 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2147 AC_MSG_ERROR(Can't find libsectok)
2148 fi
2149 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002150 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002151 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002152 fi
2153 ]
2154)
2155
2156# Check whether user wants OpenSC support
2157AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10002158 AC_HELP_STRING([--with-opensc=PFX],
2159 [Enable smartcard support using OpenSC]),
2160 opensc_config_prefix="$withval", opensc_config_prefix="")
2161if test x$opensc_config_prefix != x ; then
2162 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2163 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2164 if test "$OPENSC_CONFIG" != "no"; then
2165 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2166 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2167 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2168 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2169 AC_DEFINE(SMARTCARD)
2170 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11002171 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10002172 fi
2173fi
Damien Miller85de5802001-09-18 14:01:11 +10002174
Darren Tucker5f88d342003-10-15 16:57:57 +10002175# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002176AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002177 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002178 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002179 # Needed by our getrrsetbyname()
2180 AC_SEARCH_LIBS(res_query, resolv)
2181 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002182 AC_MSG_CHECKING(if res_query will link)
2183 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2184 [AC_MSG_RESULT(no)
2185 saved_LIBS="$LIBS"
2186 LIBS="$LIBS -lresolv"
2187 AC_MSG_CHECKING(for res_query in -lresolv)
2188 AC_LINK_IFELSE([
2189#include <resolv.h>
2190int main()
2191{
2192 res_query (0, 0, 0, 0, 0);
2193 return 0;
2194}
2195 ],
2196 [LIBS="$LIBS -lresolv"
2197 AC_MSG_RESULT(yes)],
2198 [LIBS="$saved_LIBS"
2199 AC_MSG_RESULT(no)])
2200 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002201 AC_CHECK_FUNCS(_getshort _getlong)
2202 AC_CHECK_MEMBER(HEADER.ad,
2203 [AC_DEFINE(HAVE_HEADER_AD)],,
2204 [#include <arpa/nameser.h>])
2205 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002206
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002207# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002208KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002209AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002210 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002211 [ if test "x$withval" != "xno" ; then
2212 if test "x$withval" = "xyes" ; then
2213 KRB5ROOT="/usr/local"
2214 else
2215 KRB5ROOT=${withval}
2216 fi
2217
2218 AC_DEFINE(KRB5)
2219 KRB5_MSG="yes"
2220
2221 AC_MSG_CHECKING(for krb5-config)
2222 if test -x $KRB5ROOT/bin/krb5-config ; then
2223 KRB5CONF=$KRB5ROOT/bin/krb5-config
2224 AC_MSG_RESULT($KRB5CONF)
2225
2226 AC_MSG_CHECKING(for gssapi support)
2227 if $KRB5CONF | grep gssapi >/dev/null ; then
2228 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002229 AC_DEFINE(GSSAPI)
2230 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002231 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002232 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002233 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002234 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002235 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2236 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002237 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002238 AC_MSG_CHECKING(whether we are using Heimdal)
2239 AC_TRY_COMPILE([ #include <krb5.h> ],
2240 [ char *tmp = heimdal_version; ],
2241 [ AC_MSG_RESULT(yes)
2242 AC_DEFINE(HEIMDAL) ],
2243 AC_MSG_RESULT(no)
2244 )
2245 else
2246 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002247 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002248 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002249 AC_MSG_CHECKING(whether we are using Heimdal)
2250 AC_TRY_COMPILE([ #include <krb5.h> ],
2251 [ char *tmp = heimdal_version; ],
2252 [ AC_MSG_RESULT(yes)
2253 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002254 K5LIBS="-lkrb5 -ldes"
2255 K5LIBS="$K5LIBS -lcom_err -lasn1"
2256 AC_CHECK_LIB(roken, net_write,
2257 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002258 ],
2259 [ AC_MSG_RESULT(no)
2260 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2261 ]
2262 )
Damien Miller200d0a72003-06-30 19:21:36 +10002263 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002264
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002265 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2266 [ AC_DEFINE(GSSAPI)
2267 K5LIBS="-lgssapi $K5LIBS" ],
2268 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2269 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002270 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002271 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2272 $K5LIBS)
2273 ],
2274 $K5LIBS)
2275
2276 AC_CHECK_HEADER(gssapi.h, ,
2277 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002278 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002279 AC_CHECK_HEADERS(gssapi.h, ,
2280 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002281 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002282 ]
2283 )
2284
2285 oldCPP="$CPPFLAGS"
2286 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2287 AC_CHECK_HEADER(gssapi_krb5.h, ,
2288 [ CPPFLAGS="$oldCPP" ])
2289
Damien Millera8e06ce2003-11-21 23:48:55 +11002290 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002291 if test ! -z "$need_dash_r" ; then
2292 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2293 fi
2294 if test ! -z "$blibpath" ; then
2295 blibpath="$blibpath:${KRB5ROOT}/lib"
2296 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002297 fi
2298
2299 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2300 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2301 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2302
2303 LIBS="$LIBS $K5LIBS"
2304 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002305 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002306 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002307)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002308
Damien Millera22ba012000-03-02 23:09:20 +11002309# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002310
Damien Millerf58c6722002-05-13 13:15:42 +10002311PRIVSEP_PATH=/var/empty
2312AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002313 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002314 [
2315 if test "x$withval" != "$no" ; then
2316 PRIVSEP_PATH=$withval
2317 fi
2318 ]
2319)
2320AC_SUBST(PRIVSEP_PATH)
2321
Damien Millera22ba012000-03-02 23:09:20 +11002322AC_ARG_WITH(xauth,
2323 [ --with-xauth=PATH Specify path to xauth program ],
2324 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002325 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002326 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002327 fi
2328 ],
2329 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002330 TestPath="$PATH"
2331 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2332 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2333 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2334 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2335 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002336 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002337 xauth_path="/usr/openwin/bin/xauth"
2338 fi
2339 ]
2340)
2341
Damien Miller7d901272003-01-13 16:55:22 +11002342STRIP_OPT=-s
2343AC_ARG_ENABLE(strip,
2344 [ --disable-strip Disable calling strip(1) on install],
2345 [
2346 if test "x$enableval" = "xno" ; then
2347 STRIP_OPT=
2348 fi
2349 ]
2350)
2351AC_SUBST(STRIP_OPT)
2352
Damien Millera19cf472000-11-29 13:28:50 +11002353if test -z "$xauth_path" ; then
2354 XAUTH_PATH="undefined"
2355 AC_SUBST(XAUTH_PATH)
2356else
Damien Millera22ba012000-03-02 23:09:20 +11002357 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002358 XAUTH_PATH=$xauth_path
2359 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002360fi
Damien Millera22ba012000-03-02 23:09:20 +11002361
2362# Check for mail directory (last resort if we cannot get it from headers)
2363if test ! -z "$MAIL" ; then
2364 maildir=`dirname $MAIL`
2365 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2366fi
2367
Damien Millera22ba012000-03-02 23:09:20 +11002368if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002369 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002370 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002371 [
2372 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2373 have_dev_ptmx=1
2374 ]
2375 )
2376 fi
Damien Millera22ba012000-03-02 23:09:20 +11002377fi
Damien Millera8e06ce2003-11-21 23:48:55 +11002378AC_CHECK_FILE("/dev/ptc",
Damien Miller204ad072000-03-02 23:56:12 +11002379 [
2380 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2381 have_dev_ptc=1
2382 ]
2383)
2384
Damien Millera22ba012000-03-02 23:09:20 +11002385# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002386AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002387 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002388 [
Damien Miller897741e2001-04-16 10:41:46 +10002389 case "$withval" in
2390 man|cat|doc)
2391 MANTYPE=$withval
2392 ;;
2393 *)
2394 AC_MSG_ERROR(invalid man type: $withval)
2395 ;;
2396 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002397 ]
2398)
Ben Lindstrombc709922001-04-18 18:04:21 +00002399if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002400 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2401 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002402 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2403 MANTYPE=doc
2404 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2405 MANTYPE=man
2406 else
2407 MANTYPE=cat
2408 fi
2409fi
Damien Miller670a4b82000-01-22 13:53:11 +11002410AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002411if test "$MANTYPE" = "doc"; then
2412 mansubdir=man;
2413else
2414 mansubdir=$MANTYPE;
2415fi
2416AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002417
Damien Millera22ba012000-03-02 23:09:20 +11002418# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002419MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002420AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002421 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002422 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002423 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002424 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002425 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002426 fi
2427 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002428)
2429
Damien Millera22ba012000-03-02 23:09:20 +11002430# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002431AC_ARG_WITH(shadow,
2432 [ --without-shadow Disable shadow password support],
2433 [
2434 if test "x$withval" = "xno" ; then
2435 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002436 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002437 fi
2438 ]
2439)
2440
Damien Miller1f335fb2000-06-26 11:31:33 +10002441if test -z "$disable_shadow" ; then
2442 AC_MSG_CHECKING([if the systems has expire shadow information])
2443 AC_TRY_COMPILE(
2444 [
2445#include <sys/types.h>
2446#include <shadow.h>
2447 struct spwd sp;
2448 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2449 [ sp_expire_available=yes ], []
2450 )
2451
2452 if test "x$sp_expire_available" = "xyes" ; then
2453 AC_MSG_RESULT(yes)
2454 AC_DEFINE(HAS_SHADOW_EXPIRE)
2455 else
2456 AC_MSG_RESULT(no)
2457 fi
2458fi
2459
Damien Millera22ba012000-03-02 23:09:20 +11002460# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002461if test ! -z "$IPADDR_IN_DISPLAY" ; then
2462 DISPLAY_HACK_MSG="yes"
2463 AC_DEFINE(IPADDR_IN_DISPLAY)
2464else
Damien Millera8e06ce2003-11-21 23:48:55 +11002465 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002466 AC_ARG_WITH(ipaddr-display,
2467 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2468 [
2469 if test "x$withval" != "xno" ; then
2470 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002471 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002472 fi
2473 ]
2474 )
2475fi
Damien Miller76112de1999-12-21 11:18:08 +11002476
Darren Tuckere1a790d2003-09-16 11:52:19 +10002477# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002478AC_ARG_ENABLE(etc-default-login,
2479 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2480[
Darren Tuckere1a790d2003-09-16 11:52:19 +10002481AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2482
2483if test "x$external_path_file" = "x/etc/default/login"; then
2484 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2485fi
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002486])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002487
Tim Rice43a1c132002-04-17 21:19:14 -07002488dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2489if test $ac_cv_func_login_getcapbool = "yes" -a \
2490 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002491 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002492fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002493
Damien Millera22ba012000-03-02 23:09:20 +11002494# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002495SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002496AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002497 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002498 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002499 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002500 AC_MSG_WARN([
2501--with-default-path=PATH has no effect on this system.
2502Edit /etc/login.conf instead.])
2503 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002504 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002505 AC_MSG_WARN([
2506--with-default-path=PATH will only be used if PATH is not defined in
2507$external_path_file .])
2508 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002509 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002510 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002511 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002512 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002513 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2514 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002515 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002516 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002517 AC_MSG_WARN([
2518If PATH is defined in $external_path_file, ensure the path to scp is included,
2519otherwise scp will not work.])
2520 fi
2521 AC_TRY_RUN(
2522 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002523/* find out what STDPATH is */
2524#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002525#ifdef HAVE_PATHS_H
2526# include <paths.h>
2527#endif
2528#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002529# ifdef _PATH_USERPATH /* Irix */
2530# define _PATH_STDPATH _PATH_USERPATH
2531# else
2532# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2533# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002534#endif
2535#include <sys/types.h>
2536#include <sys/stat.h>
2537#include <fcntl.h>
2538#define DATA "conftest.stdpath"
2539
2540main()
2541{
2542 FILE *fd;
2543 int rc;
2544
2545 fd = fopen(DATA,"w");
2546 if(fd == NULL)
2547 exit(1);
2548
2549 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2550 exit(1);
2551
2552 exit(0);
2553}
2554 ], [ user_path=`cat conftest.stdpath` ],
2555 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2556 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2557 )
2558# make sure $bindir is in USER_PATH so scp will work
2559 t_bindir=`eval echo ${bindir}`
2560 case $t_bindir in
2561 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2562 esac
2563 case $t_bindir in
2564 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2565 esac
2566 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2567 if test $? -ne 0 ; then
2568 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2569 if test $? -ne 0 ; then
2570 user_path=$user_path:$t_bindir
2571 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2572 fi
2573 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002574 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002575)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002576if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002577 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2578 AC_SUBST(user_path)
2579fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002580
Damien Millera18bbd32002-05-13 10:48:57 +10002581# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002582AC_ARG_WITH(superuser-path,
2583 [ --with-superuser-path= Specify different path for super-user],
2584 [
2585 if test "x$withval" != "xno" ; then
2586 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2587 superuser_path=$withval
2588 fi
2589 ]
2590)
2591
2592
Damien Miller61e50f12000-05-08 20:49:37 +10002593AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002594IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002595AC_ARG_WITH(4in6,
2596 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2597 [
2598 if test "x$withval" != "xno" ; then
2599 AC_MSG_RESULT(yes)
2600 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002601 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002602 else
2603 AC_MSG_RESULT(no)
2604 fi
2605 ],[
2606 if test "x$inet6_default_4in6" = "xyes"; then
2607 AC_MSG_RESULT([yes (default)])
2608 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002609 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002610 else
2611 AC_MSG_RESULT([no (default)])
2612 fi
2613 ]
2614)
2615
Damien Miller60396b02001-02-18 17:01:00 +11002616# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002617BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002618AC_ARG_WITH(bsd-auth,
2619 [ --with-bsd-auth Enable BSD auth support],
2620 [
2621 if test "x$withval" != "xno" ; then
2622 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002623 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002624 fi
2625 ]
2626)
2627
Damien Millera22ba012000-03-02 23:09:20 +11002628# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002629piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002630# make sure the directory exists
2631if test ! -d $piddir ; then
2632 piddir=`eval echo ${sysconfdir}`
2633 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002634 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002635 esac
2636fi
2637
Tim Rice88f2ab52002-03-17 12:17:34 -08002638AC_ARG_WITH(pid-dir,
2639 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2640 [
2641 if test "x$withval" != "xno" ; then
2642 piddir=$withval
2643 if test ! -d $piddir ; then
2644 AC_MSG_WARN([** no $piddir directory on this system **])
2645 fi
2646 fi
2647 ]
2648)
2649
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002650AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002651AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002652
andre2ff7b5d2000-06-03 14:57:40 +00002653dnl allow user to disable some login recording features
2654AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002655 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002656 [
2657 if test "x$enableval" = "xno" ; then
2658 AC_DEFINE(DISABLE_LASTLOG)
2659 fi
2660 ]
andre2ff7b5d2000-06-03 14:57:40 +00002661)
2662AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002663 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002664 [
2665 if test "x$enableval" = "xno" ; then
2666 AC_DEFINE(DISABLE_UTMP)
2667 fi
2668 ]
andre2ff7b5d2000-06-03 14:57:40 +00002669)
2670AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002671 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002672 [
2673 if test "x$enableval" = "xno" ; then
2674 AC_DEFINE(DISABLE_UTMPX)
2675 fi
2676 ]
andre2ff7b5d2000-06-03 14:57:40 +00002677)
2678AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002679 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002680 [
2681 if test "x$enableval" = "xno" ; then
2682 AC_DEFINE(DISABLE_WTMP)
2683 fi
2684 ]
andre2ff7b5d2000-06-03 14:57:40 +00002685)
2686AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002687 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002688 [
2689 if test "x$enableval" = "xno" ; then
2690 AC_DEFINE(DISABLE_WTMPX)
2691 fi
2692 ]
andre2ff7b5d2000-06-03 14:57:40 +00002693)
2694AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002695 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002696 [
2697 if test "x$enableval" = "xno" ; then
2698 AC_DEFINE(DISABLE_LOGIN)
2699 fi
2700 ]
andre2ff7b5d2000-06-03 14:57:40 +00002701)
2702AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002703 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002704 [
2705 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002706 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002707 fi
2708 ]
andre2ff7b5d2000-06-03 14:57:40 +00002709)
2710AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002711 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002712 [
2713 if test "x$enableval" = "xno" ; then
2714 AC_DEFINE(DISABLE_PUTUTXLINE)
2715 fi
2716 ]
andre2ff7b5d2000-06-03 14:57:40 +00002717)
2718AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002719 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002720 [
2721 if test "x$withval" = "xno" ; then
2722 AC_DEFINE(DISABLE_LASTLOG)
2723 else
2724 conf_lastlog_location=$withval
2725 fi
2726 ]
2727)
andre2ff7b5d2000-06-03 14:57:40 +00002728
2729dnl lastlog, [uw]tmpx? detection
2730dnl NOTE: set the paths in the platform section to avoid the
2731dnl need for command-line parameters
2732dnl lastlog and [uw]tmp are subject to a file search if all else fails
2733
2734dnl lastlog detection
2735dnl NOTE: the code itself will detect if lastlog is a directory
2736AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2737AC_TRY_COMPILE([
2738#include <sys/types.h>
2739#include <utmp.h>
2740#ifdef HAVE_LASTLOG_H
2741# include <lastlog.h>
2742#endif
Damien Miller2994e082000-06-04 15:51:47 +10002743#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002744# include <paths.h>
2745#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002746#ifdef HAVE_LOGIN_H
2747# include <login.h>
2748#endif
andre2ff7b5d2000-06-03 14:57:40 +00002749 ],
2750 [ char *lastlog = LASTLOG_FILE; ],
2751 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002752 [
2753 AC_MSG_RESULT(no)
2754 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2755 AC_TRY_COMPILE([
2756#include <sys/types.h>
2757#include <utmp.h>
2758#ifdef HAVE_LASTLOG_H
2759# include <lastlog.h>
2760#endif
2761#ifdef HAVE_PATHS_H
2762# include <paths.h>
2763#endif
2764 ],
2765 [ char *lastlog = _PATH_LASTLOG; ],
2766 [ AC_MSG_RESULT(yes) ],
2767 [
andree441aa32000-06-12 22:34:38 +00002768 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002769 system_lastlog_path=no
2770 ])
2771 ]
andre2ff7b5d2000-06-03 14:57:40 +00002772)
Damien Miller2994e082000-06-04 15:51:47 +10002773
andre2ff7b5d2000-06-03 14:57:40 +00002774if test -z "$conf_lastlog_location"; then
2775 if test x"$system_lastlog_path" = x"no" ; then
2776 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002777 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002778 conf_lastlog_location=$f
2779 fi
2780 done
2781 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002782 AC_MSG_WARN([** Cannot find lastlog **])
2783 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002784 fi
2785 fi
2786fi
2787
2788if test -n "$conf_lastlog_location"; then
2789 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2790fi
2791
2792dnl utmp detection
2793AC_MSG_CHECKING([if your system defines UTMP_FILE])
2794AC_TRY_COMPILE([
2795#include <sys/types.h>
2796#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002797#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002798# include <paths.h>
2799#endif
2800 ],
2801 [ char *utmp = UTMP_FILE; ],
2802 [ AC_MSG_RESULT(yes) ],
2803 [ AC_MSG_RESULT(no)
2804 system_utmp_path=no ]
2805)
2806if test -z "$conf_utmp_location"; then
2807 if test x"$system_utmp_path" = x"no" ; then
2808 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2809 if test -f $f ; then
2810 conf_utmp_location=$f
2811 fi
2812 done
2813 if test -z "$conf_utmp_location"; then
2814 AC_DEFINE(DISABLE_UTMP)
2815 fi
2816 fi
2817fi
2818if test -n "$conf_utmp_location"; then
2819 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2820fi
2821
2822dnl wtmp detection
2823AC_MSG_CHECKING([if your system defines WTMP_FILE])
2824AC_TRY_COMPILE([
2825#include <sys/types.h>
2826#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002827#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002828# include <paths.h>
2829#endif
2830 ],
2831 [ char *wtmp = WTMP_FILE; ],
2832 [ AC_MSG_RESULT(yes) ],
2833 [ AC_MSG_RESULT(no)
2834 system_wtmp_path=no ]
2835)
2836if test -z "$conf_wtmp_location"; then
2837 if test x"$system_wtmp_path" = x"no" ; then
2838 for f in /usr/adm/wtmp /var/log/wtmp; do
2839 if test -f $f ; then
2840 conf_wtmp_location=$f
2841 fi
2842 done
2843 if test -z "$conf_wtmp_location"; then
2844 AC_DEFINE(DISABLE_WTMP)
2845 fi
2846 fi
2847fi
2848if test -n "$conf_wtmp_location"; then
2849 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2850fi
2851
2852
2853dnl utmpx detection - I don't know any system so perverse as to require
2854dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2855dnl there, though.
2856AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2857AC_TRY_COMPILE([
2858#include <sys/types.h>
2859#include <utmp.h>
2860#ifdef HAVE_UTMPX_H
2861#include <utmpx.h>
2862#endif
Damien Miller2994e082000-06-04 15:51:47 +10002863#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002864# include <paths.h>
2865#endif
2866 ],
2867 [ char *utmpx = UTMPX_FILE; ],
2868 [ AC_MSG_RESULT(yes) ],
2869 [ AC_MSG_RESULT(no)
2870 system_utmpx_path=no ]
2871)
2872if test -z "$conf_utmpx_location"; then
2873 if test x"$system_utmpx_path" = x"no" ; then
2874 AC_DEFINE(DISABLE_UTMPX)
2875 fi
2876else
2877 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2878fi
2879
2880dnl wtmpx detection
2881AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2882AC_TRY_COMPILE([
2883#include <sys/types.h>
2884#include <utmp.h>
2885#ifdef HAVE_UTMPX_H
2886#include <utmpx.h>
2887#endif
Damien Miller2994e082000-06-04 15:51:47 +10002888#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002889# include <paths.h>
2890#endif
2891 ],
2892 [ char *wtmpx = WTMPX_FILE; ],
2893 [ AC_MSG_RESULT(yes) ],
2894 [ AC_MSG_RESULT(no)
2895 system_wtmpx_path=no ]
2896)
2897if test -z "$conf_wtmpx_location"; then
2898 if test x"$system_wtmpx_path" = x"no" ; then
2899 AC_DEFINE(DISABLE_WTMPX)
2900 fi
2901else
2902 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2903fi
2904
Damien Miller4018c192000-04-30 09:30:44 +10002905
Damien Miller29ea30d2000-03-17 10:54:15 +11002906if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002907 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2908 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002909fi
2910
Tim Rice4cec93f2002-02-26 08:40:48 -08002911dnl remove pam and dl because they are in $LIBPAM
2912if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002913 LIBS=`echo $LIBS | sed 's/-lpam //'`
2914fi
2915if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2916 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002917fi
2918
Damien Millerbac2d8a2000-09-05 16:13:06 +11002919AC_EXEEXT
Tim Rice5af9db92004-06-19 19:31:06 -07002920AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
Tim Rice13aae5e2001-10-21 17:53:58 -07002921AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002922
Damien Miller7b22d652000-06-18 14:07:04 +10002923# Print summary of options
2924
Damien Miller7b22d652000-06-18 14:07:04 +10002925# Someone please show me a better way :)
2926A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2927B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2928C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2929D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002930E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002931F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002932G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002933H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2934I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2935J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002936
2937echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002938echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002939echo " User binaries: $B"
2940echo " System binaries: $C"
2941echo " Configuration files: $D"
2942echo " Askpass program: $E"
2943echo " Manual pages: $F"
2944echo " PID file: $G"
2945echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002946if test "x$external_path_file" = "x/etc/login.conf" ; then
2947echo " At runtime, sshd will use the path defined in $external_path_file"
2948echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002949else
Damien Millerf58c6722002-05-13 13:15:42 +10002950echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002951 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002952echo " (If PATH is set in $external_path_file it will be used instead. If"
2953echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2954 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002955fi
Damien Millera18bbd32002-05-13 10:48:57 +10002956if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002957echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002958fi
Damien Millerf58c6722002-05-13 13:15:42 +10002959echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10002960echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002961echo " KerberosV support: $KRB5_MSG"
2962echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002963echo " S/KEY support: $SKEY_MSG"
2964echo " TCP Wrappers support: $TCPW_MSG"
2965echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002966echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002967echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2968echo " BSD Auth support: $BSD_AUTH_MSG"
2969echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002970if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002971echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002972fi
2973
Damien Miller7b22d652000-06-18 14:07:04 +10002974echo ""
2975
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002976echo " Host: ${host}"
2977echo " Compiler: ${CC}"
2978echo " Compiler flags: ${CFLAGS}"
2979echo "Preprocessor flags: ${CPPFLAGS}"
2980echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002981echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002982
2983echo ""
2984
Tim Rice6f1f7582004-05-30 21:38:51 -07002985if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
2986 echo "SVR4 style packages are supported with \"make package\"\n"
2987fi
2988
Damien Miller82cf0ce2000-12-20 13:34:48 +11002989if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002990 echo "PAM is enabled. You may need to install a PAM control file "
2991 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11002992 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11002993 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002994 echo ""
2995fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002996
Damien Miller6c21c512002-01-22 21:57:53 +11002997if test ! -z "$RAND_HELPER_CMDHASH" ; then
2998 echo "WARNING: you are using the builtin random number collection "
2999 echo "service. Please read WARNING.RNG and request that your OS "
3000 echo "vendor includes kernel-based random number collection in "
3001 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003002 echo ""
3003fi
Damien Miller60396b02001-02-18 17:01:00 +11003004
Damien Millerb4097182004-05-23 14:09:40 +10003005if test ! -z "$NO_PEERCHECK" ; then
3006 echo "WARNING: the operating system that you are using does not "
3007 echo "appear to support either the getpeereid() API nor the "
3008 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3009 echo "enforce security checks to prevent unauthorised connections to "
3010 echo "ssh-agent. Their absence increases the risk that a malicious "
3011 echo "user can connect to your agent. "
3012 echo ""
3013fi
3014