blob: 76ac0e06ccf2d55524ff81d00a348b5e8af0004b [file] [log] [blame]
Damien Millerb4097182004-05-23 14:09:40 +10001# $Id: configure.ac,v 1.218 2004/05/23 04:09:40 djm Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Tim Rice13aae5e2001-10-21 17:53:58 -070017AC_INIT
18AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070031AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080032AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110033AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100034AC_PATH_PROG(ENT, ent)
35AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110036AC_PATH_PROG(TEST_MINUS_S_SH, bash)
37AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
38AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070039AC_PATH_PROG(SH, sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110040
Damien Millere8bb4502001-09-25 16:39:35 +100041# System features
42AC_SYS_LARGEFILE
43
Damien Miller3f62aba2000-11-29 11:56:35 +110044if test -z "$AR" ; then
45 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
46fi
47
Damien Millerad833b32000-08-23 10:46:23 +100048# Use LOGIN_PROGRAM from environment if possible
49if test ! -z "$LOGIN_PROGRAM" ; then
50 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
51else
52 # Search for login
53 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
54 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
55 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
56 fi
57fi
58
Darren Tucker23bc8d02004-02-06 16:24:31 +110059AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
60if test ! -z "$PATH_PASSWD_PROG" ; then
61 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG")
62fi
63
Damien Miller166bd442000-03-16 10:48:25 +110064if test -z "$LD" ; then
65 LD=$CC
66fi
67AC_SUBST(LD)
68
Damien Miller166bd442000-03-16 10:48:25 +110069AC_C_INLINE
Damien Millera8e06ce2003-11-21 23:48:55 +110070if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Damien Miller649d9992001-06-27 23:35:51 +100071 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
Damien Miller166bd442000-03-16 10:48:25 +110072fi
73
Tim Rice88368a32003-12-08 12:35:59 -080074AC_ARG_WITH(rpath,
75 [ --without-rpath Disable auto-added -R linker paths],
76 [
77 if test "x$withval" = "xno" ; then
78 need_dash_r=""
79 fi
80 if test "x$withval" = "xyes" ; then
81 need_dash_r=1
82 fi
83 ]
84)
85
Damien Millera22ba012000-03-02 23:09:20 +110086# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +110087case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +110088*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +110089 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +100090 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -080091 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +110092 fi
Damien Millereab4bae2003-04-29 23:22:40 +100093 saved_LDFLAGS="$LDFLAGS"
94 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
95 if (test -z "$blibflags"); then
96 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
97 AC_TRY_LINK([], [], [blibflags=$tryflags])
98 fi
99 done
100 if (test -z "$blibflags"); then
101 AC_MSG_RESULT(not found)
102 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
103 else
104 AC_MSG_RESULT($blibflags)
105 fi
106 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000107 dnl Check for authenticate. Might be in libs.a on older AIXes
108 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
Tim Ricee958ed32002-07-05 07:12:33 -0700109 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000110 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700111 LIBS="$LIBS -ls"
112 ])
113 ])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000114 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
115 AC_CHECK_DECL(loginfailed,
116 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
117 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000118 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000119 [(void)loginfailed("user","host","tty",0);],
120 [AC_MSG_RESULT(yes)
121 AC_DEFINE(AIX_LOGINFAILED_4ARG)],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000122 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000123 )],
124 [],
125 [#include <usersec.h>]
126 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000127 AC_CHECK_FUNCS(setauthdb)
Damien Millereca71f82000-01-20 22:38:27 +1100128 AC_DEFINE(BROKEN_GETADDRINFO)
Damien Millerf5fea442002-04-23 22:52:45 +1000129 AC_DEFINE(BROKEN_REALPATH)
Darren Tucker9f18be62003-09-06 16:44:39 +1000130 AC_DEFINE(SETEUID_BREAKS_SETUID)
131 AC_DEFINE(BROKEN_SETREUID)
132 AC_DEFINE(BROKEN_SETREGID)
andre60f3c982000-06-03 16:18:19 +0000133 dnl AIX handles lastlog as part of its login message
134 AC_DEFINE(DISABLE_LASTLOG)
Kevin Steves90d5de72002-06-22 18:51:48 +0000135 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Miller35276252003-06-03 10:14:28 +1000136 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller75b1d102000-01-07 14:01:41 +1100137 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100138*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100139 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800140 LIBS="$LIBS /usr/lib/textmode.o"
Damien Millerbac2d8a2000-09-05 16:13:06 +1100141 AC_DEFINE(HAVE_CYGWIN)
Ben Lindstromca60a9b2001-05-17 03:32:50 +0000142 AC_DEFINE(USE_PIPES)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100143 AC_DEFINE(DISABLE_SHADOW)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100144 AC_DEFINE(IP_TOS_IS_BROKEN)
Ben Lindstrom38e60932001-02-24 00:55:04 +0000145 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Ben Lindstrom99a4e142002-07-09 14:06:40 +0000146 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
Tim Rice9dd30812002-07-07 13:43:36 -0700147 AC_DEFINE(DISABLE_FD_PASSING)
Ben Lindstrom837461b2002-06-12 16:57:14 +0000148 AC_DEFINE(SETGROUPS_NOOP)
Damien Millerbac2d8a2000-09-05 16:13:06 +1100149 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000150*-*-dgux*)
151 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100152 AC_DEFINE(SETEUID_BREAKS_SETUID)
153 AC_DEFINE(BROKEN_SETREUID)
154 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000155 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000156*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000157 AC_MSG_CHECKING(if we have working getaddrinfo)
158 AC_TRY_RUN([#include <mach-o/dyld.h>
159main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
160 exit(0);
161 else
162 exit(1);
163}], [AC_MSG_RESULT(working)],
164 [AC_MSG_RESULT(buggy)
165 AC_DEFINE(BROKEN_GETADDRINFO)],
Tim Rice480ef8d2003-09-21 21:38:11 -0700166 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000167 AC_DEFINE(SETEUID_BREAKS_SETUID)
168 AC_DEFINE(BROKEN_SETREUID)
169 AC_DEFINE(BROKEN_SETREGID)
Damien Miller7a2ea782004-01-02 17:52:10 +1100170 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1)
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000171 ;;
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000172*-*-hpux10.26)
173 if test -z "$GCC"; then
174 CFLAGS="$CFLAGS -Ae"
175 fi
176 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
177 IPADDR_IN_DISPLAY=yes
178 AC_DEFINE(HAVE_SECUREWARE)
179 AC_DEFINE(USE_PIPES)
180 AC_DEFINE(LOGIN_NO_ENDOPT)
181 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000182 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000183 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700184 LIBS="$LIBS -lsec -lsecpw"
185 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000186 disable_ptmx_check=yes
187 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100188*-*-hpux10*)
189 if test -z "$GCC"; then
Damien Millerfda78d92000-05-20 15:33:44 +1000190 CFLAGS="$CFLAGS -Ae"
Damien Miller76112de1999-12-21 11:18:08 +1100191 fi
Kevin Steves315f8b72001-06-28 00:24:41 +0000192 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100193 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000194 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000195 AC_DEFINE(LOGIN_NO_ENDOPT)
196 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Darren Tuckere41bba52003-08-25 11:51:19 +1000197 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000198 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Tim Ricef028f1e2002-07-19 12:41:10 -0700199 LIBS="$LIBS -lsec"
200 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller76112de1999-12-21 11:18:08 +1100201 ;;
Damien Miller1bead332000-04-30 00:47:29 +1000202*-*-hpux11*)
Kevin Steves6a7b0de2001-06-27 16:32:24 +0000203 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100204 IPADDR_IN_DISPLAY=yes
Damien Miller82cf0ce2000-12-20 13:34:48 +1100205 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller5552d7a2000-08-30 09:53:24 +1100206 AC_DEFINE(USE_PIPES)
Kevin Steves5feaaef2002-04-23 20:45:55 +0000207 AC_DEFINE(LOGIN_NO_ENDOPT)
208 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Damien Millerd6f204d2000-09-23 13:57:27 +1100209 AC_DEFINE(DISABLE_UTMP)
Darren Tuckere41bba52003-08-25 11:51:19 +1000210 AC_DEFINE(LOCKED_PASSWD_STRING, "*")
Damien Miller35276252003-06-03 10:14:28 +1000211 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker4398cf52004-04-06 21:39:02 +1000212 check_for_hpux_broken_getaddrinfo=1
Tim Ricef028f1e2002-07-19 12:41:10 -0700213 LIBS="$LIBS -lsec"
214 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
Damien Miller1bead332000-04-30 00:47:29 +1000215 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100216*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100217 PATH="$PATH:/usr/etc"
Damien Miller11fa2cc2000-08-16 10:35:58 +1000218 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000219 AC_DEFINE(SETEUID_BREAKS_SETUID)
220 AC_DEFINE(BROKEN_SETREUID)
221 AC_DEFINE(BROKEN_SETREGID)
Damien Millerf1b9d112002-04-23 23:09:19 +1000222 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000223 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100224 ;;
225*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100226 PATH="$PATH:/usr/etc"
Damien Miller91606b12000-06-28 08:22:29 +1000227 AC_DEFINE(WITH_IRIX_ARRAY)
228 AC_DEFINE(WITH_IRIX_PROJECT)
229 AC_DEFINE(WITH_IRIX_AUDIT)
Ben Lindstrom8ff2a8d2002-04-06 18:58:31 +0000230 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000231 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000232 AC_DEFINE(SETEUID_BREAKS_SETUID)
233 AC_DEFINE(BROKEN_SETREUID)
234 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker8db9a0f2004-04-06 21:31:12 +1000235 AC_DEFINE(BROKEN_UPDWTMPX)
Damien Millerf1b9d112002-04-23 23:09:19 +1000236 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000237 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100238 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100239*-*-linux*)
240 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100241 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000242 check_for_openpty_ctty_bug=1
Damien Miller7bcb0892000-03-11 20:45:40 +1100243 AC_DEFINE(DONT_TRY_OTHER_AF)
Damien Miller4e997202000-07-09 21:21:52 +1000244 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tucker809031f2004-03-30 14:03:45 +1000245 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!")
Damien Miller35276252003-06-03 10:14:28 +1000246 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Damien Miller7bcb0892000-03-11 20:45:40 +1100247 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000248 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000249 1.*|2.0.*)
Darren Tucker3c016542003-05-02 20:48:21 +1000250 AC_DEFINE(BROKEN_CMSG_TYPE)
251 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000252 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100253 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000254mips-sony-bsd|mips-sony-newsos4)
255 AC_DEFINE(HAVE_NEWS4)
256 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000257 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100258*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000259 check_for_libcrypt_before=1
Tim Rice88368a32003-12-08 12:35:59 -0800260 if test "x$withval" != "xno" ; then
261 need_dash_r=1
262 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100263 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100264*-*-freebsd*)
265 check_for_libcrypt_later=1
266 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000267*-*-bsdi*)
268 AC_DEFINE(SETEUID_BREAKS_SETUID)
269 AC_DEFINE(BROKEN_SETREUID)
270 AC_DEFINE(BROKEN_SETREGID)
271 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000272*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000273 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100274 conf_utmp_location=/etc/utmp
275 conf_wtmp_location=/usr/adm/wtmp
276 MAIL=/usr/spool/mail
Damien Miller0f91b4e2000-06-18 15:43:25 +1000277 AC_DEFINE(HAVE_NEXT)
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000278 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000279 AC_DEFINE(USE_PIPES)
Damien Millerfbd884a2001-02-27 08:39:07 +1100280 AC_DEFINE(BROKEN_SAVED_UIDS)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000281 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100282*-*-solaris*)
Tim Ricead4a1882004-02-29 15:53:37 -0800283 if test "x$withval" != "xno" ; then
284 need_dash_r=1
285 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100286 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000287 AC_DEFINE(LOGIN_NEEDS_UTMPX)
288 AC_DEFINE(LOGIN_NEEDS_TERM)
Ben Lindstrom95276712001-10-23 17:14:00 +0000289 AC_DEFINE(PAM_TTY_KLUDGE)
Darren Tuckere41bba52003-08-25 11:51:19 +1000290 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000291 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
292 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000293 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000294 # hardwire lastlog location (can't detect it on some versions)
295 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000296 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
297 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
298 if test "$sol2ver" -ge 8; then
299 AC_MSG_RESULT(yes)
300 AC_DEFINE(DISABLE_UTMP)
301 AC_DEFINE(DISABLE_WTMP)
302 else
303 AC_MSG_RESULT(no)
304 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100305 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000306*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000307 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000308 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100309 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000310 conf_utmp_location=/etc/utmp
311 conf_wtmp_location=/var/adm/wtmp
312 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000313 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000314 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000315*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700316 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000317 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000318 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000319 AC_DEFINE(SETEUID_BREAKS_SETUID)
320 AC_DEFINE(BROKEN_SETREUID)
321 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000322 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000323*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700324 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000325 AC_CHECK_LIB(dl, dlsym, ,)
Damien Millerfd9885e2001-01-10 08:16:53 +1100326 IPADDR_IN_DISPLAY=yes
327 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000328 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000329 AC_DEFINE(SETEUID_BREAKS_SETUID)
330 AC_DEFINE(BROKEN_SETREUID)
331 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000332 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000333 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700334 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
335 # Attention: always take care to bind libsocket and libnsl before libc,
336 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000337 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100338*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100339 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700340 AC_DEFINE(SETEUID_BREAKS_SETUID)
341 AC_DEFINE(BROKEN_SETREUID)
342 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100343 ;;
344*-*-sysv5*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100345 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700346 AC_DEFINE(SETEUID_BREAKS_SETUID)
347 AC_DEFINE(BROKEN_SETREUID)
348 AC_DEFINE(BROKEN_SETREGID)
Damien Miller78315eb2000-09-29 23:01:36 +1100349 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100350*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100351 ;;
Damien Miller78315eb2000-09-29 23:01:36 +1100352*-*-sco3.2v4*)
Tim Ricefcb62202004-01-23 18:35:16 -0800353 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize"
Tim Ricee8c898a2004-02-23 21:47:04 -0800354 LIBS="$LIBS -los -lprot -lcrypt_i -lx -ltinfo -lm"
Damien Miller5dfe9762001-02-16 12:05:39 +1100355 RANLIB=true
356 no_dev_ptmx=1
357 AC_DEFINE(BROKEN_SYS_TERMIO_H)
358 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000359 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000360 AC_DEFINE(DISABLE_SHADOW)
Damien Millerfbd884a2001-02-27 08:39:07 +1100361 AC_DEFINE(BROKEN_SAVED_UIDS)
Tim Ricefe6d5aa2004-04-16 20:03:07 -0700362 AC_DEFINE(SETEUID_BREAKS_SETUID)
363 AC_DEFINE(BROKEN_SETREUID)
364 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700365 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100366 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700367 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700368 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100369 ;;
370*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800371 if test -z "$GCC"; then
372 CFLAGS="$CFLAGS -belf"
373 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100374 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000375 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100376 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000377 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000378 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700379 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700380 AC_DEFINE(SETEUID_BREAKS_SETUID)
381 AC_DEFINE(BROKEN_SETREUID)
382 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700383 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100384 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700385 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000386 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000387*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100388 AC_DEFINE(NO_SSH_LASTLOG)
389 AC_DEFINE(SETEUID_BREAKS_SETUID)
390 AC_DEFINE(BROKEN_SETREUID)
391 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000392 AC_DEFINE(USE_PIPES)
393 AC_DEFINE(DISABLE_FD_PASSING)
394 LDFLAGS="$LDFLAGS"
395 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
396 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000397 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000398*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100399 AC_DEFINE(SETEUID_BREAKS_SETUID)
400 AC_DEFINE(BROKEN_SETREUID)
401 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000402 AC_DEFINE(WITH_ABBREV_NO_TTY)
403 AC_DEFINE(USE_PIPES)
404 AC_DEFINE(DISABLE_FD_PASSING)
405 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100406 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000407 MANTYPE=cat
408 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000409*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100410 AC_DEFINE(SETEUID_BREAKS_SETUID)
411 AC_DEFINE(BROKEN_SETREUID)
412 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000413 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700414 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700415 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000416 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
417 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
418 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700419 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000420*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000421 AC_MSG_CHECKING(for Digital Unix SIA)
422 no_osfsia=""
423 AC_ARG_WITH(osfsia,
424 [ --with-osfsia Enable Digital Unix SIA],
425 [
426 if test "x$withval" = "xno" ; then
427 AC_MSG_RESULT(disabled)
428 no_osfsia=1
429 fi
430 ],
431 )
432 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000433 if test -f /etc/sia/matrix.conf; then
434 AC_MSG_RESULT(yes)
435 AC_DEFINE(HAVE_OSF_SIA)
436 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000437 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000438 LIBS="$LIBS -lsecurity -ldb -lm -laud"
439 else
440 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100441 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000442 fi
443 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000444 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700445 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000446 AC_DEFINE(BROKEN_SETREUID)
447 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000448 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000449
450*-*-nto-qnx)
451 AC_DEFINE(USE_PIPES)
452 AC_DEFINE(NO_X11_UNIX_SOCKETS)
453 AC_DEFINE(MISSING_NFDBITS)
454 AC_DEFINE(MISSING_HOWMANY)
455 AC_DEFINE(MISSING_FD_MASK)
456 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100457esac
458
Damien Millere37bfc12000-06-05 09:37:43 +1000459# Allow user to specify flags
460AC_ARG_WITH(cflags,
461 [ --with-cflags Specify additional flags to pass to compiler],
462 [
463 if test "x$withval" != "xno" ; then
464 CFLAGS="$CFLAGS $withval"
465 fi
466 ]
467)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000468AC_ARG_WITH(cppflags,
469 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
470 [
471 if test "x$withval" != "xno"; then
472 CPPFLAGS="$CPPFLAGS $withval"
473 fi
474 ]
475)
Damien Millere37bfc12000-06-05 09:37:43 +1000476AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000477 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000478 [
479 if test "x$withval" != "xno" ; then
480 LDFLAGS="$LDFLAGS $withval"
481 fi
482 ]
483)
484AC_ARG_WITH(libs,
485 [ --with-libs Specify additional libraries to link with],
486 [
487 if test "x$withval" != "xno" ; then
488 LIBS="$LIBS $withval"
489 fi
490 ]
491)
492
Darren Tucker6eb93042003-06-29 21:30:41 +1000493AC_MSG_CHECKING(compiler and flags for sanity)
494AC_TRY_RUN([
495#include <stdio.h>
496int main(){exit(0);}
497 ],
498 [ AC_MSG_RESULT(yes) ],
499 [
500 AC_MSG_RESULT(no)
501 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
502 ]
503)
504
Tim Rice4cec93f2002-02-26 08:40:48 -0800505# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000506AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000507 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800508 login_cap.h maillock.h netdb.h netgroup.h \
Damien Miller0f47c532004-01-02 18:01:30 +1100509 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000510 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000511 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
Damien Miller6c4914a2004-03-03 11:08:59 +1100512 sys/cdefs.h sys/mman.h sys/prctl.h sys/pstat.h sys/ptms.h \
513 sys/select.h sys/stat.h sys/stream.h sys/stropts.h \
514 sys/sysmacros.h sys/time.h sys/timers.h sys/un.h time.h tmpdir.h \
515 ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
Tim Rice4cec93f2002-02-26 08:40:48 -0800516
Damien Millera22ba012000-03-02 23:09:20 +1100517# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700518AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
519AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000520
Damien Millerdf288022001-02-18 13:07:07 +1100521dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700522if test "x$with_tcp_wrappers" != "xno" ; then
523 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
524 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
525 fi
526fi
Damien Millerdf288022001-02-18 13:07:07 +1100527
Tim Rice1e1ef642003-09-11 22:19:31 -0700528dnl IRIX and Solaris 2.5.1 have dirname() in libgen
529AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
530 AC_CHECK_LIB(gen, dirname,[
531 AC_CACHE_CHECK([for broken dirname],
532 ac_cv_have_broken_dirname, [
533 save_LIBS="$LIBS"
534 LIBS="$LIBS -lgen"
535 AC_TRY_RUN(
536 [
537#include <libgen.h>
538#include <string.h>
539
540int main(int argc, char **argv) {
541 char *s, buf[32];
542
543 strncpy(buf,"/etc", 32);
544 s = dirname(buf);
545 if (!s || strncmp(s, "/", 32) != 0) {
546 exit(1);
547 } else {
548 exit(0);
549 }
550}
551 ],
552 [ ac_cv_have_broken_dirname="no" ],
553 [ ac_cv_have_broken_dirname="yes" ]
554 )
555 LIBS="$save_LIBS"
556 ])
557 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
558 LIBS="$LIBS -lgen"
559 AC_DEFINE(HAVE_DIRNAME)
560 AC_CHECK_HEADERS(libgen.h)
561 fi
562 ])
563])
564
565AC_CHECK_FUNC(getspnam, ,
566 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
567AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
568
Tim Rice13aae5e2001-10-21 17:53:58 -0700569dnl zlib is required
570AC_ARG_WITH(zlib,
571 [ --with-zlib=PATH Use zlib in PATH],
572 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000573 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100574 AC_MSG_ERROR([*** zlib is required ***])
575 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700576 if test -d "$withval/lib"; then
577 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700578 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700579 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700580 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700581 fi
582 else
583 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700584 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700585 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700586 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700587 fi
588 fi
589 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700590 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700591 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700592 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700593 fi
594 ]
595)
596
Tim Ricefcb62202004-01-23 18:35:16 -0800597AC_CHECK_LIB(z, deflate, ,
598 [
599 saved_CPPFLAGS="$CPPFLAGS"
600 saved_LDFLAGS="$LDFLAGS"
601 save_LIBS="$LIBS"
602 dnl Check default zlib install dir
603 if test -n "${need_dash_r}"; then
604 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
605 else
606 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
607 fi
608 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
609 LIBS="$LIBS -lz"
610 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
611 [
612 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
613 ]
614 )
615 ]
616)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100617AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100618
619AC_ARG_WITH(zlib-version-check,
620 [ --without-zlib-version-check Disable zlib version check],
621 [ if test "x$withval" = "xno" ; then
622 zlib_check_nonfatal=1
623 fi
624 ]
625)
626
Darren Tucker2dcd2392004-01-23 17:13:33 +1100627AC_MSG_CHECKING(for zlib 1.1.4 or greater)
628AC_TRY_RUN([
629#include <zlib.h>
630int main()
631{
632 int a, b, c, v;
633 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
634 exit(1);
635 v = a*1000000 + b*1000 + c;
636 if (v >= 1001004)
637 exit(0);
638 exit(2);
639}
640 ],
641 AC_MSG_RESULT(yes),
642 [ AC_MSG_RESULT(no)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100643 if test -z "$zlib_check_nonfatal" ; then
644 AC_MSG_ERROR([*** zlib too old - check config.log ***
645Your reported zlib version has known security problems. It's possible your
646vendor has fixed these problems without changing the version number. If you
647are sure this is the case, you can disable the check by running
648"./configure --without-zlib-version-check".
649If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
650 else
651 AC_MSG_WARN([zlib version may have security problems])
652 fi
653 ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100654)
Damien Miller6f9c3372000-10-25 10:06:04 +1100655
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000656dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100657AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000658 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
659)
Damien Millera8e06ce2003-11-21 23:48:55 +1100660AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700661 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
662 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000663)
Damien Millerab18c411999-11-11 10:40:23 +1100664
Tim Ricee589a292001-11-03 11:09:32 -0800665dnl Checks for libutil functions
666AC_CHECK_HEADERS(libutil.h)
667AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
668AC_CHECK_FUNCS(logout updwtmp logwtmp)
669
Ben Lindstrom8697e082001-02-24 21:41:10 +0000670AC_FUNC_STRFTIME
671
Damien Miller3c027682001-03-14 11:39:45 +1100672# Check for ALTDIRFUNC glob() extension
673AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
674AC_EGREP_CPP(FOUNDIT,
675 [
676 #include <glob.h>
677 #ifdef GLOB_ALTDIRFUNC
678 FOUNDIT
679 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100680 ],
Damien Miller3c027682001-03-14 11:39:45 +1100681 [
682 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
683 AC_MSG_RESULT(yes)
684 ],
685 [
686 AC_MSG_RESULT(no)
687 ]
688)
Damien Millerab18c411999-11-11 10:40:23 +1100689
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000690# Check for g.gl_matchc glob() extension
691AC_MSG_CHECKING(for gl_matchc field in glob_t)
692AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100693 [
694 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000695 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100696 ],
697 [
698 AC_DEFINE(GLOB_HAS_GL_MATCHC)
699 AC_MSG_RESULT(yes)
700 ],
701 [
702 AC_MSG_RESULT(no)
703 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000704)
705
Damien Miller18bb4732001-03-28 14:35:30 +1000706AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
707AC_TRY_RUN(
708 [
709#include <sys/types.h>
710#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700711int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000712 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100713 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000714 [
715 AC_MSG_RESULT(no)
716 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
717 ]
718)
719
Damien Millerc547bf12001-02-16 10:18:12 +1100720# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100721SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100722AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700723 [ --with-skey[[=PATH]] Enable S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100724 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100725 [
726 if test "x$withval" != "xno" ; then
727
728 if test "x$withval" != "xyes" ; then
729 CPPFLAGS="$CPPFLAGS -I${withval}/include"
730 LDFLAGS="$LDFLAGS -L${withval}/lib"
731 fi
732
733 AC_DEFINE(SKEY)
734 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100735 SKEY_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100736
Tim Rice4cec93f2002-02-26 08:40:48 -0800737 AC_MSG_CHECKING([for s/key support])
738 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100739 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800740#include <stdio.h>
741#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700742int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800743 ],
744 [AC_MSG_RESULT(yes)],
745 [
746 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100747 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
748 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000749 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
750 AC_TRY_COMPILE(
751 [#include <stdio.h>
752 #include <skey.h>],
753 [(void)skeychallenge(NULL,"name","",0);],
754 [AC_MSG_RESULT(yes)
755 AC_DEFINE(SKEYCHALLENGE_4ARG)],
756 [AC_MSG_RESULT(no)]
757 )
Damien Millerc547bf12001-02-16 10:18:12 +1100758 fi
759 ]
760)
761
762# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700763TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100764AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700765 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
Damien Millera8e06ce2003-11-21 23:48:55 +1100766 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100767 [
768 if test "x$withval" != "xno" ; then
769 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700770 saved_LDFLAGS="$LDFLAGS"
771 saved_CPPFLAGS="$CPPFLAGS"
772 if test -n "${withval}" -a "${withval}" != "yes"; then
773 if test -d "${withval}/lib"; then
774 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700775 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700776 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700777 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700778 fi
779 else
780 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700781 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700782 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700783 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700784 fi
785 fi
786 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700787 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700788 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700789 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700790 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700791 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800792 LIBWRAP="-lwrap"
793 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100794 AC_MSG_CHECKING(for libwrap)
795 AC_TRY_LINK(
796 [
Damien Miller0ac45002004-04-14 20:14:26 +1000797#include <sys/types.h>
798#include <sys/socket.h>
799#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +1100800#include <tcpd.h>
801 int deny_severity = 0, allow_severity = 0;
802 ],
803 [hosts_access(0);],
804 [
805 AC_MSG_RESULT(yes)
806 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800807 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700808 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100809 ],
810 [
811 AC_MSG_ERROR([*** libwrap missing])
812 ]
813 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800814 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100815 fi
816 ]
817)
818
Damien Millerfe1f1432003-02-24 15:45:42 +1100819dnl Checks for library functions. Please keep in alphabetical order
820AC_CHECK_FUNCS(\
Damien Millerf09ad862003-09-19 16:41:01 +1000821 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
Damien Miller5fe46a42003-06-05 09:53:31 +1000822 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000823 getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000824 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100825 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000826 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100827 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000828 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100829 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000830 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000831 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100832 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100833)
Tim Rice13aae5e2001-10-21 17:53:58 -0700834
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000835# IRIX has a const char return value for gai_strerror()
836AC_CHECK_FUNCS(gai_strerror,[
837 AC_DEFINE(HAVE_GAI_STRERROR)
838 AC_TRY_COMPILE([
839#include <sys/types.h>
840#include <sys/socket.h>
841#include <netdb.h>
842
843const char *gai_strerror(int);],[
844char *str;
845
846str = gai_strerror(0);],[
847 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
848 [Define if gai_strerror() returns const char *])])])
849
Damien Millercd6853c2003-01-28 11:33:42 +1100850AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
851
Darren Tuckerf1159b52003-07-07 19:44:01 +1000852dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000853AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000854AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000855
Darren Tuckerb2427c82003-09-10 15:22:44 +1000856dnl tcsendbreak might be a macro
857AC_CHECK_DECL(tcsendbreak,
858 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100859 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000860 [#include <termios.h>]
861)
862
Darren Tucker5bb14002004-04-23 18:53:10 +1000863AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
864
Darren Tucker2a6b0292003-12-31 14:59:17 +1100865AC_CHECK_FUNCS(setresuid, [
866 dnl Some platorms have setresuid that isn't implemented, test for this
867 AC_MSG_CHECKING(if setresuid seems to work)
868 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100869#include <stdlib.h>
870#include <errno.h>
871int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100872 ],
873 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100874 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tucker2a6b0292003-12-31 14:59:17 +1100875 AC_MSG_RESULT(not implemented)]
876 )
877])
Darren Tuckere937be32003-12-17 18:53:26 +1100878
Darren Tucker2a6b0292003-12-31 14:59:17 +1100879AC_CHECK_FUNCS(setresgid, [
880 dnl Some platorms have setresgid that isn't implemented, test for this
881 AC_MSG_CHECKING(if setresgid seems to work)
882 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100883#include <stdlib.h>
884#include <errno.h>
885int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100886 ],
887 [AC_MSG_RESULT(yes)],
888 [AC_DEFINE(BROKEN_SETRESGID)
889 AC_MSG_RESULT(not implemented)]
890 )
891])
Darren Tuckere937be32003-12-17 18:53:26 +1100892
Damien Millerad833b32000-08-23 10:46:23 +1000893dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000894AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000895dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000896AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000897AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000898dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000899AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000900AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100901
Damien Millera8e06ce2003-11-21 23:48:55 +1100902AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100903 [AC_DEFINE(HAVE_DAEMON)],
904 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
905)
906
Damien Millera8e06ce2003-11-21 23:48:55 +1100907AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100908 [AC_DEFINE(HAVE_GETPAGESIZE)],
909 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
910)
911
Damien Millercb170cb2000-07-01 16:52:55 +1000912# Check for broken snprintf
913if test "x$ac_cv_func_snprintf" = "xyes" ; then
914 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
915 AC_TRY_RUN(
916 [
917#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700918int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000919 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100920 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000921 [
922 AC_MSG_RESULT(no)
923 AC_DEFINE(BROKEN_SNPRINTF)
924 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
925 ]
926 )
927fi
928
Damien Millerb4097182004-05-23 14:09:40 +1000929# Check for missing getpeereid (or equiv) support
930NO_PEERCHECK=""
931if test "x$ac_cv_func_getpeereid" != "xyes" ; then
932 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
933 AC_TRY_COMPILE(
934 [#include <sys/types.h>
935 #include <sys/socket.h>],
936 [int i = SO_PEERCRED;],
937 [AC_MSG_RESULT(yes)],
938 [AC_MSG_RESULT(no)
939 NO_PEERCHECK=1]
940 )
941fi
942
Damien Millere8328192003-01-07 15:18:32 +1100943dnl see whether mkstemp() requires XXXXXX
944if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
945AC_MSG_CHECKING([for (overly) strict mkstemp])
946AC_TRY_RUN(
947 [
948#include <stdlib.h>
949main() { char template[]="conftest.mkstemp-test";
950if (mkstemp(template) == -1)
951 exit(1);
952unlink(template); exit(0);
953}
954 ],
955 [
956 AC_MSG_RESULT(no)
957 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100958 [
Damien Millere8328192003-01-07 15:18:32 +1100959 AC_MSG_RESULT(yes)
960 AC_DEFINE(HAVE_STRICT_MKSTEMP)
961 ],
962 [
963 AC_MSG_RESULT(yes)
964 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +1100965 ]
Damien Millere8328192003-01-07 15:18:32 +1100966)
967fi
968
Darren Tucker70a3d552003-08-21 17:58:29 +1000969dnl make sure that openpty does not reacquire controlling terminal
970if test ! -z "$check_for_openpty_ctty_bug"; then
971 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
972 AC_TRY_RUN(
973 [
974#include <stdio.h>
975#include <sys/fcntl.h>
976#include <sys/types.h>
977#include <sys/wait.h>
978
979int
980main()
981{
982 pid_t pid;
983 int fd, ptyfd, ttyfd, status;
984
985 pid = fork();
986 if (pid < 0) { /* failed */
987 exit(1);
988 } else if (pid > 0) { /* parent */
989 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +1100990 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +1000991 exit(WEXITSTATUS(status));
992 else
993 exit(2);
994 } else { /* child */
995 close(0); close(1); close(2);
996 setsid();
997 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
998 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
999 if (fd >= 0)
1000 exit(3); /* Acquired ctty: broken */
1001 else
1002 exit(0); /* Did not acquire ctty: OK */
1003 }
1004}
1005 ],
1006 [
1007 AC_MSG_RESULT(yes)
1008 ],
1009 [
1010 AC_MSG_RESULT(no)
1011 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1012 ]
1013 )
1014fi
1015
Darren Tucker4398cf52004-04-06 21:39:02 +10001016if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1017 AC_MSG_CHECKING(if getaddrinfo seems to work)
1018 AC_TRY_RUN(
1019 [
1020#include <stdio.h>
1021#include <sys/socket.h>
1022#include <netdb.h>
1023#include <errno.h>
1024#include <netinet/in.h>
1025
1026#define TEST_PORT "2222"
1027
1028int
1029main(void)
1030{
1031 int err, sock;
1032 struct addrinfo *gai_ai, *ai, hints;
1033 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1034
1035 memset(&hints, 0, sizeof(hints));
1036 hints.ai_family = PF_UNSPEC;
1037 hints.ai_socktype = SOCK_STREAM;
1038 hints.ai_flags = AI_PASSIVE;
1039
1040 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1041 if (err != 0) {
1042 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1043 exit(1);
1044 }
1045
1046 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1047 if (ai->ai_family != AF_INET6)
1048 continue;
1049
1050 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1051 sizeof(ntop), strport, sizeof(strport),
1052 NI_NUMERICHOST|NI_NUMERICSERV);
1053
1054 if (err != 0) {
1055 if (err == EAI_SYSTEM)
1056 perror("getnameinfo EAI_SYSTEM");
1057 else
1058 fprintf(stderr, "getnameinfo failed: %s\n",
1059 gai_strerror(err));
1060 exit(2);
1061 }
1062
1063 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1064 if (sock < 0)
1065 perror("socket");
1066 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1067 if (errno == EBADF)
1068 exit(3);
1069 }
1070 }
1071 exit(0);
1072}
1073 ],
1074 [
1075 AC_MSG_RESULT(yes)
1076 ],
1077 [
1078 AC_MSG_RESULT(no)
1079 AC_DEFINE(BROKEN_GETADDRINFO)
1080 ]
1081 )
1082fi
1083
Damien Miller606f8802000-09-16 15:39:56 +11001084AC_FUNC_GETPGRP
1085
Damien Millera64b57a2001-01-17 10:44:13 +11001086# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001087PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001088AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001089 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001090 [
Damien Millera64b57a2001-01-17 10:44:13 +11001091 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001092 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1093 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001094 AC_MSG_ERROR([PAM headers not found])
1095 fi
1096
1097 AC_CHECK_LIB(dl, dlopen, , )
1098 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1099 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001100 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001101
Damien Millera64b57a2001-01-17 10:44:13 +11001102 PAM_MSG="yes"
1103
1104 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001105 if test $ac_cv_lib_dl_dlopen = yes; then
1106 LIBPAM="-lpam -ldl"
1107 else
1108 LIBPAM="-lpam"
1109 fi
1110 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001111 fi
1112 ]
1113)
Damien Millera22ba012000-03-02 23:09:20 +11001114
Damien Millera64b57a2001-01-17 10:44:13 +11001115# Check for older PAM
1116if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001117 # Check PAM strerror arguments (old PAM)
1118 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1119 AC_TRY_COMPILE(
1120 [
Damien Miller81171112000-04-23 11:14:01 +10001121#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001122#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001123#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001124#elif defined (HAVE_PAM_PAM_APPL_H)
1125#include <pam/pam_appl.h>
1126#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001127 ],
1128 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001129 [AC_MSG_RESULT(no)],
1130 [
1131 AC_DEFINE(HAVE_OLD_PAM)
1132 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001133 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001134 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001135 )
Damien Millera22ba012000-03-02 23:09:20 +11001136fi
1137
Tim Riceaef73712002-05-11 13:17:42 -07001138# Search for OpenSSL
1139saved_CPPFLAGS="$CPPFLAGS"
1140saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001141AC_ARG_WITH(ssl-dir,
1142 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1143 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001144 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -07001145 if test -d "$withval/lib"; then
1146 if test -n "${need_dash_r}"; then
1147 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1148 else
1149 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1150 fi
1151 else
1152 if test -n "${need_dash_r}"; then
1153 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1154 else
1155 LDFLAGS="-L${withval} ${LDFLAGS}"
1156 fi
1157 fi
1158 if test -d "$withval/include"; then
1159 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1160 else
1161 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1162 fi
Damien Millera22ba012000-03-02 23:09:20 +11001163 fi
1164 ]
1165)
Tim Rice3d5352e2004-02-12 09:27:21 -08001166LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001167AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001168 [
Tim Riceaef73712002-05-11 13:17:42 -07001169 dnl Check default openssl install dir
1170 if test -n "${need_dash_r}"; then
1171 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001172 else
Tim Riceaef73712002-05-11 13:17:42 -07001173 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001174 fi
Tim Riceaef73712002-05-11 13:17:42 -07001175 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1176 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1177 [
1178 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1179 ]
1180 )
1181 ]
1182)
1183
Tim Riced730b782002-08-13 18:52:10 -07001184# Determine OpenSSL header version
1185AC_MSG_CHECKING([OpenSSL header version])
1186AC_TRY_RUN(
1187 [
1188#include <stdio.h>
1189#include <string.h>
1190#include <openssl/opensslv.h>
1191#define DATA "conftest.sslincver"
1192int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001193 FILE *fd;
1194 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001195
Damien Millera8e06ce2003-11-21 23:48:55 +11001196 fd = fopen(DATA,"w");
1197 if(fd == NULL)
1198 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001199
1200 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1201 exit(1);
1202
1203 exit(0);
1204}
1205 ],
1206 [
1207 ssl_header_ver=`cat conftest.sslincver`
1208 AC_MSG_RESULT($ssl_header_ver)
1209 ],
1210 [
1211 AC_MSG_RESULT(not found)
1212 AC_MSG_ERROR(OpenSSL version header not found.)
1213 ]
1214)
1215
1216# Determine OpenSSL library version
1217AC_MSG_CHECKING([OpenSSL library version])
1218AC_TRY_RUN(
1219 [
1220#include <stdio.h>
1221#include <string.h>
1222#include <openssl/opensslv.h>
1223#include <openssl/crypto.h>
1224#define DATA "conftest.ssllibver"
1225int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001226 FILE *fd;
1227 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001228
Damien Millera8e06ce2003-11-21 23:48:55 +11001229 fd = fopen(DATA,"w");
1230 if(fd == NULL)
1231 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001232
1233 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1234 exit(1);
1235
1236 exit(0);
1237}
1238 ],
1239 [
1240 ssl_library_ver=`cat conftest.ssllibver`
1241 AC_MSG_RESULT($ssl_library_ver)
1242 ],
1243 [
1244 AC_MSG_RESULT(not found)
1245 AC_MSG_ERROR(OpenSSL library not found.)
1246 ]
1247)
Damien Millera22ba012000-03-02 23:09:20 +11001248
Damien Millerec932372002-01-22 22:16:03 +11001249# Sanity check OpenSSL headers
1250AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1251AC_TRY_RUN(
1252 [
1253#include <string.h>
1254#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001255int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001256 ],
1257 [
1258 AC_MSG_RESULT(yes)
1259 ],
1260 [
1261 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001262 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1263Check config.log for details.
1264Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001265 ]
1266)
1267
Tim Rice3d5352e2004-02-12 09:27:21 -08001268# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1269# because the system crypt() is more featureful.
1270if test "x$check_for_libcrypt_before" = "x1"; then
1271 AC_CHECK_LIB(crypt, crypt)
1272fi
1273
Damien Millera8e06ce2003-11-21 23:48:55 +11001274# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001275# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001276if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001277 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001278fi
1279
Damien Miller6c21c512002-01-22 21:57:53 +11001280
1281### Configure cryptographic random number support
1282
1283# Check wheter OpenSSL seeds itself
1284AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1285AC_TRY_RUN(
1286 [
1287#include <string.h>
1288#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001289int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001290 ],
1291 [
1292 OPENSSL_SEEDS_ITSELF=yes
1293 AC_MSG_RESULT(yes)
1294 ],
1295 [
1296 AC_MSG_RESULT(no)
1297 # Default to use of the rand helper if OpenSSL doesn't
1298 # seed itself
1299 USE_RAND_HELPER=yes
1300 ]
1301)
1302
1303
1304# Do we want to force the use of the rand helper?
1305AC_ARG_WITH(rand-helper,
1306 [ --with-rand-helper Use subprocess to gather strong randomness ],
1307 [
1308 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001309 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001310 # the previous test showed it to be unseeded.
1311 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1312 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1313 OPENSSL_SEEDS_ITSELF=yes
1314 USE_RAND_HELPER=""
1315 fi
1316 else
1317 USE_RAND_HELPER=yes
1318 fi
1319 ],
1320)
1321
1322# Which randomness source do we use?
1323if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1324 # OpenSSL only
1325 AC_DEFINE(OPENSSL_PRNG_ONLY)
1326 RAND_MSG="OpenSSL internal ONLY"
1327 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001328elif test ! -z "$USE_RAND_HELPER" ; then
1329 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001330 RAND_MSG="ssh-rand-helper"
1331 INSTALL_SSH_RAND_HELPER="yes"
1332fi
1333AC_SUBST(INSTALL_SSH_RAND_HELPER)
1334
1335### Configuration of ssh-rand-helper
1336
1337# PRNGD TCP socket
1338AC_ARG_WITH(prngd-port,
1339 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1340 [
Damien Millere996d722002-01-23 11:20:59 +11001341 case "$withval" in
1342 no)
1343 withval=""
1344 ;;
1345 [[0-9]]*)
1346 ;;
1347 *)
1348 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1349 ;;
1350 esac
1351 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001352 PRNGD_PORT="$withval"
1353 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1354 fi
1355 ]
1356)
1357
1358# PRNGD Unix domain socket
1359AC_ARG_WITH(prngd-socket,
1360 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1361 [
Damien Millere996d722002-01-23 11:20:59 +11001362 case "$withval" in
1363 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001364 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001365 ;;
1366 no)
1367 withval=""
1368 ;;
1369 /*)
1370 ;;
1371 *)
1372 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1373 ;;
1374 esac
1375
1376 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001377 if test ! -z "$PRNGD_PORT" ; then
1378 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1379 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001380 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001381 AC_MSG_WARN(Entropy socket is not readable)
1382 fi
1383 PRNGD_SOCKET="$withval"
1384 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1385 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001386 ],
1387 [
1388 # Check for existing socket only if we don't have a random device already
1389 if test "$USE_RAND_HELPER" = yes ; then
1390 AC_MSG_CHECKING(for PRNGD/EGD socket)
1391 # Insert other locations here
1392 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1393 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1394 PRNGD_SOCKET="$sock"
1395 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1396 break;
1397 fi
1398 done
1399 if test ! -z "$PRNGD_SOCKET" ; then
1400 AC_MSG_RESULT($PRNGD_SOCKET)
1401 else
1402 AC_MSG_RESULT(not found)
1403 fi
1404 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001405 ]
1406)
1407
1408# Change default command timeout for hashing entropy source
1409entropy_timeout=200
1410AC_ARG_WITH(entropy-timeout,
1411 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1412 [
1413 if test "x$withval" != "xno" ; then
1414 entropy_timeout=$withval
1415 fi
1416 ]
1417)
Damien Miller6c21c512002-01-22 21:57:53 +11001418AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1419
Damien Millerd3f6ad22002-06-25 10:24:47 +10001420SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001421AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001422 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001423 [
1424 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001425 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001426 fi
1427 ]
1428)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001429AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1430AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001431
Tim Rice88f2ab52002-03-17 12:17:34 -08001432# We do this little dance with the search path to insure
1433# that programs that we select for use by installed programs
1434# (which may be run by the super-user) come from trusted
1435# locations before they come from the user's private area.
1436# This should help avoid accidentally configuring some
1437# random version of a program in someone's personal bin.
1438
1439OPATH=$PATH
1440PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001441test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001442test -d /sbin && PATH=$PATH:/sbin
1443test -d /usr/sbin && PATH=$PATH:/usr/sbin
1444PATH=$PATH:/etc:$OPATH
1445
Damien Millera8e06ce2003-11-21 23:48:55 +11001446# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001447OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1448OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1449OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1450OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1451OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1452OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1453OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1454OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1455OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1456OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1457OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1458OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1459OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1460OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1461OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1462OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001463# restore PATH
1464PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001465
1466# Where does ssh-rand-helper get its randomness from?
1467INSTALL_SSH_PRNG_CMDS=""
1468if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1469 if test ! -z "$PRNGD_PORT" ; then
1470 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1471 elif test ! -z "$PRNGD_SOCKET" ; then
1472 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1473 else
1474 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1475 RAND_HELPER_CMDHASH=yes
1476 INSTALL_SSH_PRNG_CMDS="yes"
1477 fi
1478fi
1479AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1480
1481
Ben Lindstromb5628642000-10-18 00:02:25 +00001482# Cheap hack to ensure NEWS-OS libraries are arranged right.
1483if test ! -z "$SONY" ; then
1484 LIBS="$LIBS -liberty";
1485fi
1486
Damien Millera22ba012000-03-02 23:09:20 +11001487# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001488AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001489AC_CHECK_SIZEOF(short int, 2)
1490AC_CHECK_SIZEOF(int, 4)
1491AC_CHECK_SIZEOF(long int, 4)
1492AC_CHECK_SIZEOF(long long int, 8)
1493
Damien Millerfa2bb692002-04-23 23:22:25 +10001494# Sanity check long long for some platforms (AIX)
1495if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1496 ac_cv_sizeof_long_long_int=0
1497fi
1498
Damien Millera22ba012000-03-02 23:09:20 +11001499# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001500AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1501 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001502 [ #include <sys/types.h> ],
1503 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001504 [ ac_cv_have_u_int="yes" ],
1505 [ ac_cv_have_u_int="no" ]
1506 )
1507])
1508if test "x$ac_cv_have_u_int" = "xyes" ; then
1509 AC_DEFINE(HAVE_U_INT)
1510 have_u_int=1
1511fi
1512
Damien Miller61e50f12000-05-08 20:49:37 +10001513AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1514 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001515 [ #include <sys/types.h> ],
1516 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001517 [ ac_cv_have_intxx_t="yes" ],
1518 [ ac_cv_have_intxx_t="no" ]
1519 )
1520])
1521if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1522 AC_DEFINE(HAVE_INTXX_T)
1523 have_intxx_t=1
1524fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001525
1526if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001527 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001528then
1529 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1530 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001531 [ #include <stdint.h> ],
1532 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001533 [
1534 AC_DEFINE(HAVE_INTXX_T)
1535 AC_MSG_RESULT(yes)
1536 ],
1537 [ AC_MSG_RESULT(no) ]
1538 )
1539fi
1540
Damien Miller578783e2000-09-23 14:12:24 +11001541AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1542 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001543 [
1544#include <sys/types.h>
1545#ifdef HAVE_STDINT_H
1546# include <stdint.h>
1547#endif
1548#include <sys/socket.h>
1549#ifdef HAVE_SYS_BITYPES_H
1550# include <sys/bitypes.h>
1551#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001552 ],
1553 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001554 [ ac_cv_have_int64_t="yes" ],
1555 [ ac_cv_have_int64_t="no" ]
1556 )
1557])
1558if test "x$ac_cv_have_int64_t" = "xyes" ; then
1559 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001560fi
1561
Damien Miller61e50f12000-05-08 20:49:37 +10001562AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1563 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001564 [ #include <sys/types.h> ],
1565 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001566 [ ac_cv_have_u_intxx_t="yes" ],
1567 [ ac_cv_have_u_intxx_t="no" ]
1568 )
1569])
1570if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1571 AC_DEFINE(HAVE_U_INTXX_T)
1572 have_u_intxx_t=1
1573fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001574
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001575if test -z "$have_u_intxx_t" ; then
1576 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1577 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001578 [ #include <sys/socket.h> ],
1579 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001580 [
1581 AC_DEFINE(HAVE_U_INTXX_T)
1582 AC_MSG_RESULT(yes)
1583 ],
1584 [ AC_MSG_RESULT(no) ]
1585 )
1586fi
1587
Damien Miller578783e2000-09-23 14:12:24 +11001588AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1589 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001590 [ #include <sys/types.h> ],
1591 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001592 [ ac_cv_have_u_int64_t="yes" ],
1593 [ ac_cv_have_u_int64_t="no" ]
1594 )
1595])
1596if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1597 AC_DEFINE(HAVE_U_INT64_T)
1598 have_u_int64_t=1
1599fi
1600
Tim Rice4cec93f2002-02-26 08:40:48 -08001601if test -z "$have_u_int64_t" ; then
1602 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1603 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001604 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001605 [ u_int64_t a; a = 1],
1606 [
1607 AC_DEFINE(HAVE_U_INT64_T)
1608 AC_MSG_RESULT(yes)
1609 ],
1610 [ AC_MSG_RESULT(no) ]
1611 )
1612fi
1613
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001614if test -z "$have_u_intxx_t" ; then
1615 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1616 AC_TRY_COMPILE(
1617 [
1618#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001619 ],
1620 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001621 [ ac_cv_have_uintxx_t="yes" ],
1622 [ ac_cv_have_uintxx_t="no" ]
1623 )
1624 ])
1625 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1626 AC_DEFINE(HAVE_UINTXX_T)
1627 fi
1628fi
1629
1630if test -z "$have_uintxx_t" ; then
1631 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1632 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001633 [ #include <stdint.h> ],
1634 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001635 [
1636 AC_DEFINE(HAVE_UINTXX_T)
1637 AC_MSG_RESULT(yes)
1638 ],
1639 [ AC_MSG_RESULT(no) ]
1640 )
1641fi
1642
Damien Milleredb82922000-06-20 13:25:52 +10001643if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001644 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001645then
1646 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1647 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001648 [
1649#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001650 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001651 [
Damien Miller70494d12000-04-03 15:57:06 +10001652 int8_t a; int16_t b; int32_t c;
1653 u_int8_t e; u_int16_t f; u_int32_t g;
1654 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001655 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001656 [
1657 AC_DEFINE(HAVE_U_INTXX_T)
1658 AC_DEFINE(HAVE_INTXX_T)
1659 AC_MSG_RESULT(yes)
1660 ],
1661 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001662 )
Damien Millerb29ea912000-01-15 14:12:03 +11001663fi
1664
Damien Miller58be7382001-09-15 21:31:54 +10001665
1666AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1667 AC_TRY_COMPILE(
1668 [
1669#include <sys/types.h>
1670 ],
1671 [ u_char foo; foo = 125; ],
1672 [ ac_cv_have_u_char="yes" ],
1673 [ ac_cv_have_u_char="no" ]
1674 )
1675])
1676if test "x$ac_cv_have_u_char" = "xyes" ; then
1677 AC_DEFINE(HAVE_U_CHAR)
1678fi
1679
Tim Rice13aae5e2001-10-21 17:53:58 -07001680TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001681
Tim Rice200a5c02002-02-26 22:12:34 -08001682AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001683
Damien Miller61e50f12000-05-08 20:49:37 +10001684AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1685 AC_TRY_COMPILE(
1686 [
1687#include <sys/types.h>
1688 ],
1689 [ size_t foo; foo = 1235; ],
1690 [ ac_cv_have_size_t="yes" ],
1691 [ ac_cv_have_size_t="no" ]
1692 )
1693])
1694if test "x$ac_cv_have_size_t" = "xyes" ; then
1695 AC_DEFINE(HAVE_SIZE_T)
1696fi
Damien Miller95058511999-12-29 10:36:45 +11001697
Damien Miller615f9392000-05-17 22:53:33 +10001698AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1699 AC_TRY_COMPILE(
1700 [
1701#include <sys/types.h>
1702 ],
1703 [ ssize_t foo; foo = 1235; ],
1704 [ ac_cv_have_ssize_t="yes" ],
1705 [ ac_cv_have_ssize_t="no" ]
1706 )
1707])
1708if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1709 AC_DEFINE(HAVE_SSIZE_T)
1710fi
1711
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001712AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1713 AC_TRY_COMPILE(
1714 [
1715#include <time.h>
1716 ],
1717 [ clock_t foo; foo = 1235; ],
1718 [ ac_cv_have_clock_t="yes" ],
1719 [ ac_cv_have_clock_t="no" ]
1720 )
1721])
1722if test "x$ac_cv_have_clock_t" = "xyes" ; then
1723 AC_DEFINE(HAVE_CLOCK_T)
1724fi
1725
Damien Millerb54b40e2000-06-23 08:23:34 +10001726AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1727 AC_TRY_COMPILE(
1728 [
1729#include <sys/types.h>
1730#include <sys/socket.h>
1731 ],
1732 [ sa_family_t foo; foo = 1235; ],
1733 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001734 [ AC_TRY_COMPILE(
1735 [
1736#include <sys/types.h>
1737#include <sys/socket.h>
1738#include <netinet/in.h>
1739 ],
1740 [ sa_family_t foo; foo = 1235; ],
1741 [ ac_cv_have_sa_family_t="yes" ],
1742
Damien Millerb54b40e2000-06-23 08:23:34 +10001743 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001744 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001745 )
1746])
1747if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1748 AC_DEFINE(HAVE_SA_FAMILY_T)
1749fi
1750
Damien Miller0f91b4e2000-06-18 15:43:25 +10001751AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1752 AC_TRY_COMPILE(
1753 [
1754#include <sys/types.h>
1755 ],
1756 [ pid_t foo; foo = 1235; ],
1757 [ ac_cv_have_pid_t="yes" ],
1758 [ ac_cv_have_pid_t="no" ]
1759 )
1760])
1761if test "x$ac_cv_have_pid_t" = "xyes" ; then
1762 AC_DEFINE(HAVE_PID_T)
1763fi
1764
1765AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1766 AC_TRY_COMPILE(
1767 [
1768#include <sys/types.h>
1769 ],
1770 [ mode_t foo; foo = 1235; ],
1771 [ ac_cv_have_mode_t="yes" ],
1772 [ ac_cv_have_mode_t="no" ]
1773 )
1774])
1775if test "x$ac_cv_have_mode_t" = "xyes" ; then
1776 AC_DEFINE(HAVE_MODE_T)
1777fi
1778
Damien Miller61e50f12000-05-08 20:49:37 +10001779
1780AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1781 AC_TRY_COMPILE(
1782 [
Damien Miller81171112000-04-23 11:14:01 +10001783#include <sys/types.h>
1784#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001785 ],
1786 [ struct sockaddr_storage s; ],
1787 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1788 [ ac_cv_have_struct_sockaddr_storage="no" ]
1789 )
1790])
1791if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1792 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1793fi
Damien Miller34132e52000-01-14 15:45:46 +11001794
Damien Miller61e50f12000-05-08 20:49:37 +10001795AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1796 AC_TRY_COMPILE(
1797 [
Damien Miller7b22d652000-06-18 14:07:04 +10001798#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001799#include <netinet/in.h>
1800 ],
1801 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1802 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1803 [ ac_cv_have_struct_sockaddr_in6="no" ]
1804 )
1805])
1806if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1807 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1808fi
Damien Miller34132e52000-01-14 15:45:46 +11001809
Damien Miller61e50f12000-05-08 20:49:37 +10001810AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1811 AC_TRY_COMPILE(
1812 [
Damien Miller7b22d652000-06-18 14:07:04 +10001813#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001814#include <netinet/in.h>
1815 ],
1816 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1817 [ ac_cv_have_struct_in6_addr="yes" ],
1818 [ ac_cv_have_struct_in6_addr="no" ]
1819 )
1820])
1821if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1822 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1823fi
Damien Miller34132e52000-01-14 15:45:46 +11001824
Damien Miller61e50f12000-05-08 20:49:37 +10001825AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1826 AC_TRY_COMPILE(
1827 [
Damien Miller81171112000-04-23 11:14:01 +10001828#include <sys/types.h>
1829#include <sys/socket.h>
1830#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001831 ],
1832 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1833 [ ac_cv_have_struct_addrinfo="yes" ],
1834 [ ac_cv_have_struct_addrinfo="no" ]
1835 )
1836])
1837if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1838 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1839fi
1840
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001841AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1842 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001843 [ #include <sys/time.h> ],
1844 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001845 [ ac_cv_have_struct_timeval="yes" ],
1846 [ ac_cv_have_struct_timeval="no" ]
1847 )
1848])
1849if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1850 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1851 have_struct_timeval=1
1852fi
1853
Tim Rice4e4dc562003-03-18 10:21:40 -08001854AC_CHECK_TYPES(struct timespec)
1855
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001856# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001857if test "x$ac_cv_have_int64_t" = "xno" -a \
1858 "x$ac_cv_sizeof_long_int" != "x8" -a \
1859 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001860 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1861 echo "an alternative compiler (I.E., GCC) before continuing."
1862 echo ""
1863 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001864else
1865dnl test snprintf (broken on SCO w/gcc)
1866 AC_TRY_RUN(
1867 [
1868#include <stdio.h>
1869#include <string.h>
1870#ifdef HAVE_SNPRINTF
1871main()
1872{
1873 char buf[50];
1874 char expected_out[50];
1875 int mazsize = 50 ;
1876#if (SIZEOF_LONG_INT == 8)
1877 long int num = 0x7fffffffffffffff;
1878#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001879 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001880#endif
1881 strcpy(expected_out, "9223372036854775807");
1882 snprintf(buf, mazsize, "%lld", num);
1883 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001884 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001885 exit(0);
1886}
1887#else
1888main() { exit(0); }
1889#endif
1890 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1891 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001892fi
1893
Damien Miller78315eb2000-09-29 23:01:36 +11001894dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001895OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1896OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1897OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1898OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1899OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001900OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001901OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1902OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001903OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001904OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1905OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1906OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1907OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001908OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1909OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1910OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1911OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001912
1913AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001914
Damien Miller61e50f12000-05-08 20:49:37 +10001915AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1916 ac_cv_have_ss_family_in_struct_ss, [
1917 AC_TRY_COMPILE(
1918 [
Damien Miller81171112000-04-23 11:14:01 +10001919#include <sys/types.h>
1920#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001921 ],
1922 [ struct sockaddr_storage s; s.ss_family = 1; ],
1923 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1924 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1925 )
1926])
1927if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1928 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1929fi
1930
Damien Miller61e50f12000-05-08 20:49:37 +10001931AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1932 ac_cv_have___ss_family_in_struct_ss, [
1933 AC_TRY_COMPILE(
1934 [
Damien Miller81171112000-04-23 11:14:01 +10001935#include <sys/types.h>
1936#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001937 ],
1938 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1939 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1940 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1941 )
1942])
1943if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1944 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1945fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001946
Damien Millerad833b32000-08-23 10:46:23 +10001947AC_CACHE_CHECK([for pw_class field in struct passwd],
1948 ac_cv_have_pw_class_in_struct_passwd, [
1949 AC_TRY_COMPILE(
1950 [
Damien Millerad833b32000-08-23 10:46:23 +10001951#include <pwd.h>
1952 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001953 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001954 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1955 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1956 )
1957])
1958if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1959 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1960fi
1961
Kevin Steves82456952001-06-22 21:14:18 +00001962AC_CACHE_CHECK([for pw_expire field in struct passwd],
1963 ac_cv_have_pw_expire_in_struct_passwd, [
1964 AC_TRY_COMPILE(
1965 [
1966#include <pwd.h>
1967 ],
1968 [ struct passwd p; p.pw_expire = 0; ],
1969 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1970 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1971 )
1972])
1973if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1974 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1975fi
1976
1977AC_CACHE_CHECK([for pw_change field in struct passwd],
1978 ac_cv_have_pw_change_in_struct_passwd, [
1979 AC_TRY_COMPILE(
1980 [
1981#include <pwd.h>
1982 ],
1983 [ struct passwd p; p.pw_change = 0; ],
1984 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1985 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1986 )
1987])
1988if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1989 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1990fi
Damien Miller61e50f12000-05-08 20:49:37 +10001991
Tim Rice28bbb0c2002-05-27 17:37:32 -07001992dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001993AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1994 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001995 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001996 [
Tim Riceae49fe62002-04-12 10:26:21 -07001997#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001998#include <sys/socket.h>
1999#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002000int main() {
2001#ifdef msg_accrights
2002exit(1);
2003#endif
2004struct msghdr m;
2005m.msg_accrights = 0;
2006exit(0);
2007}
Kevin Steves939c9db2002-03-22 17:23:25 +00002008 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002009 [ ac_cv_have_accrights_in_msghdr="yes" ],
2010 [ ac_cv_have_accrights_in_msghdr="no" ]
2011 )
2012])
2013if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2014 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
2015fi
2016
Kevin Stevesa44e0352002-04-07 16:18:03 +00002017AC_CACHE_CHECK([for msg_control field in struct msghdr],
2018 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07002019 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002020 [
Tim Riceae49fe62002-04-12 10:26:21 -07002021#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002022#include <sys/socket.h>
2023#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002024int main() {
2025#ifdef msg_control
2026exit(1);
2027#endif
2028struct msghdr m;
2029m.msg_control = 0;
2030exit(0);
2031}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002032 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002033 [ ac_cv_have_control_in_msghdr="yes" ],
2034 [ ac_cv_have_control_in_msghdr="no" ]
2035 )
2036])
2037if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2038 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2039fi
2040
Damien Miller61e50f12000-05-08 20:49:37 +10002041AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002042 AC_TRY_LINK([],
2043 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002044 [ ac_cv_libc_defines___progname="yes" ],
2045 [ ac_cv_libc_defines___progname="no" ]
2046 )
2047])
2048if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2049 AC_DEFINE(HAVE___PROGNAME)
2050fi
2051
Kevin Steves4846f4a2002-03-22 18:19:53 +00002052AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2053 AC_TRY_LINK([
2054#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002055],
2056 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002057 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2058 [ ac_cv_cc_implements___FUNCTION__="no" ]
2059 )
2060])
2061if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2062 AC_DEFINE(HAVE___FUNCTION__)
2063fi
2064
2065AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2066 AC_TRY_LINK([
2067#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002068],
2069 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002070 [ ac_cv_cc_implements___func__="yes" ],
2071 [ ac_cv_cc_implements___func__="no" ]
2072 )
2073])
2074if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2075 AC_DEFINE(HAVE___func__)
2076fi
2077
Damien Miller4f8e6692001-07-14 13:22:53 +10002078AC_CACHE_CHECK([whether getopt has optreset support],
2079 ac_cv_have_getopt_optreset, [
2080 AC_TRY_LINK(
2081 [
2082#include <getopt.h>
2083 ],
2084 [ extern int optreset; optreset = 0; ],
2085 [ ac_cv_have_getopt_optreset="yes" ],
2086 [ ac_cv_have_getopt_optreset="no" ]
2087 )
2088])
2089if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2090 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2091fi
Damien Millera22ba012000-03-02 23:09:20 +11002092
Damien Millerecbb26d2000-07-15 14:59:14 +10002093AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002094 AC_TRY_LINK([],
2095 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002096 [ ac_cv_libc_defines_sys_errlist="yes" ],
2097 [ ac_cv_libc_defines_sys_errlist="no" ]
2098 )
2099])
2100if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2101 AC_DEFINE(HAVE_SYS_ERRLIST)
2102fi
2103
2104
Damien Miller11fa2cc2000-08-16 10:35:58 +10002105AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002106 AC_TRY_LINK([],
2107 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002108 [ ac_cv_libc_defines_sys_nerr="yes" ],
2109 [ ac_cv_libc_defines_sys_nerr="no" ]
2110 )
2111])
2112if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2113 AC_DEFINE(HAVE_SYS_NERR)
2114fi
2115
Damien Millera8e06ce2003-11-21 23:48:55 +11002116SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002117# Check whether user wants sectok support
2118AC_ARG_WITH(sectok,
2119 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002120 [
2121 if test "x$withval" != "xno" ; then
2122 if test "x$withval" != "xyes" ; then
2123 CPPFLAGS="$CPPFLAGS -I${withval}"
2124 LDFLAGS="$LDFLAGS -L${withval}"
2125 if test ! -z "$need_dash_r" ; then
2126 LDFLAGS="$LDFLAGS -R${withval}"
2127 fi
2128 if test ! -z "$blibpath" ; then
2129 blibpath="$blibpath:${withval}"
2130 fi
2131 fi
2132 AC_CHECK_HEADERS(sectok.h)
2133 if test "$ac_cv_header_sectok_h" != yes; then
2134 AC_MSG_ERROR(Can't find sectok.h)
2135 fi
2136 AC_CHECK_LIB(sectok, sectok_open)
2137 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2138 AC_MSG_ERROR(Can't find libsectok)
2139 fi
2140 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002141 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002142 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002143 fi
2144 ]
2145)
2146
2147# Check whether user wants OpenSC support
2148AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10002149 AC_HELP_STRING([--with-opensc=PFX],
2150 [Enable smartcard support using OpenSC]),
2151 opensc_config_prefix="$withval", opensc_config_prefix="")
2152if test x$opensc_config_prefix != x ; then
2153 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2154 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2155 if test "$OPENSC_CONFIG" != "no"; then
2156 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2157 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2158 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2159 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2160 AC_DEFINE(SMARTCARD)
2161 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11002162 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10002163 fi
2164fi
Damien Miller85de5802001-09-18 14:01:11 +10002165
Darren Tucker5f88d342003-10-15 16:57:57 +10002166# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002167AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002168 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002169 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002170 # Needed by our getrrsetbyname()
2171 AC_SEARCH_LIBS(res_query, resolv)
2172 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002173 AC_MSG_CHECKING(if res_query will link)
2174 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2175 [AC_MSG_RESULT(no)
2176 saved_LIBS="$LIBS"
2177 LIBS="$LIBS -lresolv"
2178 AC_MSG_CHECKING(for res_query in -lresolv)
2179 AC_LINK_IFELSE([
2180#include <resolv.h>
2181int main()
2182{
2183 res_query (0, 0, 0, 0, 0);
2184 return 0;
2185}
2186 ],
2187 [LIBS="$LIBS -lresolv"
2188 AC_MSG_RESULT(yes)],
2189 [LIBS="$saved_LIBS"
2190 AC_MSG_RESULT(no)])
2191 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002192 AC_CHECK_FUNCS(_getshort _getlong)
2193 AC_CHECK_MEMBER(HEADER.ad,
2194 [AC_DEFINE(HAVE_HEADER_AD)],,
2195 [#include <arpa/nameser.h>])
2196 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002197
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002198# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002199KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002200AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002201 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002202 [ if test "x$withval" != "xno" ; then
2203 if test "x$withval" = "xyes" ; then
2204 KRB5ROOT="/usr/local"
2205 else
2206 KRB5ROOT=${withval}
2207 fi
2208
2209 AC_DEFINE(KRB5)
2210 KRB5_MSG="yes"
2211
2212 AC_MSG_CHECKING(for krb5-config)
2213 if test -x $KRB5ROOT/bin/krb5-config ; then
2214 KRB5CONF=$KRB5ROOT/bin/krb5-config
2215 AC_MSG_RESULT($KRB5CONF)
2216
2217 AC_MSG_CHECKING(for gssapi support)
2218 if $KRB5CONF | grep gssapi >/dev/null ; then
2219 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002220 AC_DEFINE(GSSAPI)
2221 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002222 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002223 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002224 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002225 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002226 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2227 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002228 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002229 AC_MSG_CHECKING(whether we are using Heimdal)
2230 AC_TRY_COMPILE([ #include <krb5.h> ],
2231 [ char *tmp = heimdal_version; ],
2232 [ AC_MSG_RESULT(yes)
2233 AC_DEFINE(HEIMDAL) ],
2234 AC_MSG_RESULT(no)
2235 )
2236 else
2237 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002238 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002239 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002240 AC_MSG_CHECKING(whether we are using Heimdal)
2241 AC_TRY_COMPILE([ #include <krb5.h> ],
2242 [ char *tmp = heimdal_version; ],
2243 [ AC_MSG_RESULT(yes)
2244 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002245 K5LIBS="-lkrb5 -ldes"
2246 K5LIBS="$K5LIBS -lcom_err -lasn1"
2247 AC_CHECK_LIB(roken, net_write,
2248 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002249 ],
2250 [ AC_MSG_RESULT(no)
2251 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2252 ]
2253 )
Damien Miller200d0a72003-06-30 19:21:36 +10002254 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002255
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002256 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2257 [ AC_DEFINE(GSSAPI)
2258 K5LIBS="-lgssapi $K5LIBS" ],
2259 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2260 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002261 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002262 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2263 $K5LIBS)
2264 ],
2265 $K5LIBS)
2266
2267 AC_CHECK_HEADER(gssapi.h, ,
2268 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002269 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002270 AC_CHECK_HEADERS(gssapi.h, ,
2271 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002272 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002273 ]
2274 )
2275
2276 oldCPP="$CPPFLAGS"
2277 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2278 AC_CHECK_HEADER(gssapi_krb5.h, ,
2279 [ CPPFLAGS="$oldCPP" ])
2280
Damien Millera8e06ce2003-11-21 23:48:55 +11002281 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002282 if test ! -z "$need_dash_r" ; then
2283 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2284 fi
2285 if test ! -z "$blibpath" ; then
2286 blibpath="$blibpath:${KRB5ROOT}/lib"
2287 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002288 fi
2289
2290 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2291 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2292 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2293
2294 LIBS="$LIBS $K5LIBS"
2295 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002296 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002297 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002298)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002299
Damien Millera22ba012000-03-02 23:09:20 +11002300# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002301
Damien Millerf58c6722002-05-13 13:15:42 +10002302PRIVSEP_PATH=/var/empty
2303AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002304 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002305 [
2306 if test "x$withval" != "$no" ; then
2307 PRIVSEP_PATH=$withval
2308 fi
2309 ]
2310)
2311AC_SUBST(PRIVSEP_PATH)
2312
Damien Millera22ba012000-03-02 23:09:20 +11002313AC_ARG_WITH(xauth,
2314 [ --with-xauth=PATH Specify path to xauth program ],
2315 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002316 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002317 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002318 fi
2319 ],
2320 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002321 TestPath="$PATH"
2322 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2323 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2324 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2325 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2326 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002327 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002328 xauth_path="/usr/openwin/bin/xauth"
2329 fi
2330 ]
2331)
2332
Damien Miller7d901272003-01-13 16:55:22 +11002333STRIP_OPT=-s
2334AC_ARG_ENABLE(strip,
2335 [ --disable-strip Disable calling strip(1) on install],
2336 [
2337 if test "x$enableval" = "xno" ; then
2338 STRIP_OPT=
2339 fi
2340 ]
2341)
2342AC_SUBST(STRIP_OPT)
2343
Damien Millera19cf472000-11-29 13:28:50 +11002344if test -z "$xauth_path" ; then
2345 XAUTH_PATH="undefined"
2346 AC_SUBST(XAUTH_PATH)
2347else
Damien Millera22ba012000-03-02 23:09:20 +11002348 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002349 XAUTH_PATH=$xauth_path
2350 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002351fi
Damien Millera22ba012000-03-02 23:09:20 +11002352
2353# Check for mail directory (last resort if we cannot get it from headers)
2354if test ! -z "$MAIL" ; then
2355 maildir=`dirname $MAIL`
2356 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2357fi
2358
Damien Millera22ba012000-03-02 23:09:20 +11002359if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002360 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002361 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002362 [
2363 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2364 have_dev_ptmx=1
2365 ]
2366 )
2367 fi
Damien Millera22ba012000-03-02 23:09:20 +11002368fi
Damien Millera8e06ce2003-11-21 23:48:55 +11002369AC_CHECK_FILE("/dev/ptc",
Damien Miller204ad072000-03-02 23:56:12 +11002370 [
2371 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2372 have_dev_ptc=1
2373 ]
2374)
2375
Damien Millera22ba012000-03-02 23:09:20 +11002376# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002377AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002378 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002379 [
Damien Miller897741e2001-04-16 10:41:46 +10002380 case "$withval" in
2381 man|cat|doc)
2382 MANTYPE=$withval
2383 ;;
2384 *)
2385 AC_MSG_ERROR(invalid man type: $withval)
2386 ;;
2387 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002388 ]
2389)
Ben Lindstrombc709922001-04-18 18:04:21 +00002390if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002391 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2392 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002393 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2394 MANTYPE=doc
2395 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2396 MANTYPE=man
2397 else
2398 MANTYPE=cat
2399 fi
2400fi
Damien Miller670a4b82000-01-22 13:53:11 +11002401AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002402if test "$MANTYPE" = "doc"; then
2403 mansubdir=man;
2404else
2405 mansubdir=$MANTYPE;
2406fi
2407AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002408
Damien Millera22ba012000-03-02 23:09:20 +11002409# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002410MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002411AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002412 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002413 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002414 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002415 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002416 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002417 fi
2418 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002419)
2420
Damien Millera22ba012000-03-02 23:09:20 +11002421# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002422AC_ARG_WITH(shadow,
2423 [ --without-shadow Disable shadow password support],
2424 [
2425 if test "x$withval" = "xno" ; then
2426 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002427 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002428 fi
2429 ]
2430)
2431
Damien Miller1f335fb2000-06-26 11:31:33 +10002432if test -z "$disable_shadow" ; then
2433 AC_MSG_CHECKING([if the systems has expire shadow information])
2434 AC_TRY_COMPILE(
2435 [
2436#include <sys/types.h>
2437#include <shadow.h>
2438 struct spwd sp;
2439 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2440 [ sp_expire_available=yes ], []
2441 )
2442
2443 if test "x$sp_expire_available" = "xyes" ; then
2444 AC_MSG_RESULT(yes)
2445 AC_DEFINE(HAS_SHADOW_EXPIRE)
2446 else
2447 AC_MSG_RESULT(no)
2448 fi
2449fi
2450
Damien Millera22ba012000-03-02 23:09:20 +11002451# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002452if test ! -z "$IPADDR_IN_DISPLAY" ; then
2453 DISPLAY_HACK_MSG="yes"
2454 AC_DEFINE(IPADDR_IN_DISPLAY)
2455else
Damien Millera8e06ce2003-11-21 23:48:55 +11002456 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002457 AC_ARG_WITH(ipaddr-display,
2458 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2459 [
2460 if test "x$withval" != "xno" ; then
2461 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002462 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002463 fi
2464 ]
2465 )
2466fi
Damien Miller76112de1999-12-21 11:18:08 +11002467
Darren Tuckere1a790d2003-09-16 11:52:19 +10002468# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002469AC_ARG_ENABLE(etc-default-login,
2470 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2471[
Darren Tuckere1a790d2003-09-16 11:52:19 +10002472AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2473
2474if test "x$external_path_file" = "x/etc/default/login"; then
2475 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2476fi
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002477])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002478
Tim Rice43a1c132002-04-17 21:19:14 -07002479dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2480if test $ac_cv_func_login_getcapbool = "yes" -a \
2481 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002482 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002483fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002484
Damien Millera22ba012000-03-02 23:09:20 +11002485# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002486SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002487AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002488 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002489 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002490 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002491 AC_MSG_WARN([
2492--with-default-path=PATH has no effect on this system.
2493Edit /etc/login.conf instead.])
2494 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002495 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002496 AC_MSG_WARN([
2497--with-default-path=PATH will only be used if PATH is not defined in
2498$external_path_file .])
2499 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002500 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002501 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002502 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002503 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002504 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2505 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002506 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002507 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002508 AC_MSG_WARN([
2509If PATH is defined in $external_path_file, ensure the path to scp is included,
2510otherwise scp will not work.])
2511 fi
2512 AC_TRY_RUN(
2513 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002514/* find out what STDPATH is */
2515#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002516#ifdef HAVE_PATHS_H
2517# include <paths.h>
2518#endif
2519#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002520# ifdef _PATH_USERPATH /* Irix */
2521# define _PATH_STDPATH _PATH_USERPATH
2522# else
2523# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2524# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002525#endif
2526#include <sys/types.h>
2527#include <sys/stat.h>
2528#include <fcntl.h>
2529#define DATA "conftest.stdpath"
2530
2531main()
2532{
2533 FILE *fd;
2534 int rc;
2535
2536 fd = fopen(DATA,"w");
2537 if(fd == NULL)
2538 exit(1);
2539
2540 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2541 exit(1);
2542
2543 exit(0);
2544}
2545 ], [ user_path=`cat conftest.stdpath` ],
2546 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2547 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2548 )
2549# make sure $bindir is in USER_PATH so scp will work
2550 t_bindir=`eval echo ${bindir}`
2551 case $t_bindir in
2552 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2553 esac
2554 case $t_bindir in
2555 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2556 esac
2557 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2558 if test $? -ne 0 ; then
2559 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2560 if test $? -ne 0 ; then
2561 user_path=$user_path:$t_bindir
2562 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2563 fi
2564 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002565 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002566)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002567if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002568 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2569 AC_SUBST(user_path)
2570fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002571
Damien Millera18bbd32002-05-13 10:48:57 +10002572# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002573AC_ARG_WITH(superuser-path,
2574 [ --with-superuser-path= Specify different path for super-user],
2575 [
2576 if test "x$withval" != "xno" ; then
2577 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2578 superuser_path=$withval
2579 fi
2580 ]
2581)
2582
2583
Damien Miller61e50f12000-05-08 20:49:37 +10002584AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002585IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002586AC_ARG_WITH(4in6,
2587 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2588 [
2589 if test "x$withval" != "xno" ; then
2590 AC_MSG_RESULT(yes)
2591 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002592 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002593 else
2594 AC_MSG_RESULT(no)
2595 fi
2596 ],[
2597 if test "x$inet6_default_4in6" = "xyes"; then
2598 AC_MSG_RESULT([yes (default)])
2599 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002600 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002601 else
2602 AC_MSG_RESULT([no (default)])
2603 fi
2604 ]
2605)
2606
Damien Miller60396b02001-02-18 17:01:00 +11002607# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002608BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002609AC_ARG_WITH(bsd-auth,
2610 [ --with-bsd-auth Enable BSD auth support],
2611 [
2612 if test "x$withval" != "xno" ; then
2613 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002614 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002615 fi
2616 ]
2617)
2618
Damien Millera22ba012000-03-02 23:09:20 +11002619# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002620piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002621# make sure the directory exists
2622if test ! -d $piddir ; then
2623 piddir=`eval echo ${sysconfdir}`
2624 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002625 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002626 esac
2627fi
2628
Tim Rice88f2ab52002-03-17 12:17:34 -08002629AC_ARG_WITH(pid-dir,
2630 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2631 [
2632 if test "x$withval" != "xno" ; then
2633 piddir=$withval
2634 if test ! -d $piddir ; then
2635 AC_MSG_WARN([** no $piddir directory on this system **])
2636 fi
2637 fi
2638 ]
2639)
2640
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002641AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002642AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002643
andre2ff7b5d2000-06-03 14:57:40 +00002644dnl allow user to disable some login recording features
2645AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002646 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002647 [
2648 if test "x$enableval" = "xno" ; then
2649 AC_DEFINE(DISABLE_LASTLOG)
2650 fi
2651 ]
andre2ff7b5d2000-06-03 14:57:40 +00002652)
2653AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002654 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002655 [
2656 if test "x$enableval" = "xno" ; then
2657 AC_DEFINE(DISABLE_UTMP)
2658 fi
2659 ]
andre2ff7b5d2000-06-03 14:57:40 +00002660)
2661AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002662 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002663 [
2664 if test "x$enableval" = "xno" ; then
2665 AC_DEFINE(DISABLE_UTMPX)
2666 fi
2667 ]
andre2ff7b5d2000-06-03 14:57:40 +00002668)
2669AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002670 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002671 [
2672 if test "x$enableval" = "xno" ; then
2673 AC_DEFINE(DISABLE_WTMP)
2674 fi
2675 ]
andre2ff7b5d2000-06-03 14:57:40 +00002676)
2677AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002678 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002679 [
2680 if test "x$enableval" = "xno" ; then
2681 AC_DEFINE(DISABLE_WTMPX)
2682 fi
2683 ]
andre2ff7b5d2000-06-03 14:57:40 +00002684)
2685AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002686 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002687 [
2688 if test "x$enableval" = "xno" ; then
2689 AC_DEFINE(DISABLE_LOGIN)
2690 fi
2691 ]
andre2ff7b5d2000-06-03 14:57:40 +00002692)
2693AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002694 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002695 [
2696 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002697 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002698 fi
2699 ]
andre2ff7b5d2000-06-03 14:57:40 +00002700)
2701AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002702 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002703 [
2704 if test "x$enableval" = "xno" ; then
2705 AC_DEFINE(DISABLE_PUTUTXLINE)
2706 fi
2707 ]
andre2ff7b5d2000-06-03 14:57:40 +00002708)
2709AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002710 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002711 [
2712 if test "x$withval" = "xno" ; then
2713 AC_DEFINE(DISABLE_LASTLOG)
2714 else
2715 conf_lastlog_location=$withval
2716 fi
2717 ]
2718)
andre2ff7b5d2000-06-03 14:57:40 +00002719
2720dnl lastlog, [uw]tmpx? detection
2721dnl NOTE: set the paths in the platform section to avoid the
2722dnl need for command-line parameters
2723dnl lastlog and [uw]tmp are subject to a file search if all else fails
2724
2725dnl lastlog detection
2726dnl NOTE: the code itself will detect if lastlog is a directory
2727AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2728AC_TRY_COMPILE([
2729#include <sys/types.h>
2730#include <utmp.h>
2731#ifdef HAVE_LASTLOG_H
2732# include <lastlog.h>
2733#endif
Damien Miller2994e082000-06-04 15:51:47 +10002734#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002735# include <paths.h>
2736#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002737#ifdef HAVE_LOGIN_H
2738# include <login.h>
2739#endif
andre2ff7b5d2000-06-03 14:57:40 +00002740 ],
2741 [ char *lastlog = LASTLOG_FILE; ],
2742 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002743 [
2744 AC_MSG_RESULT(no)
2745 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2746 AC_TRY_COMPILE([
2747#include <sys/types.h>
2748#include <utmp.h>
2749#ifdef HAVE_LASTLOG_H
2750# include <lastlog.h>
2751#endif
2752#ifdef HAVE_PATHS_H
2753# include <paths.h>
2754#endif
2755 ],
2756 [ char *lastlog = _PATH_LASTLOG; ],
2757 [ AC_MSG_RESULT(yes) ],
2758 [
andree441aa32000-06-12 22:34:38 +00002759 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002760 system_lastlog_path=no
2761 ])
2762 ]
andre2ff7b5d2000-06-03 14:57:40 +00002763)
Damien Miller2994e082000-06-04 15:51:47 +10002764
andre2ff7b5d2000-06-03 14:57:40 +00002765if test -z "$conf_lastlog_location"; then
2766 if test x"$system_lastlog_path" = x"no" ; then
2767 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002768 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002769 conf_lastlog_location=$f
2770 fi
2771 done
2772 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002773 AC_MSG_WARN([** Cannot find lastlog **])
2774 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002775 fi
2776 fi
2777fi
2778
2779if test -n "$conf_lastlog_location"; then
2780 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2781fi
2782
2783dnl utmp detection
2784AC_MSG_CHECKING([if your system defines UTMP_FILE])
2785AC_TRY_COMPILE([
2786#include <sys/types.h>
2787#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002788#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002789# include <paths.h>
2790#endif
2791 ],
2792 [ char *utmp = UTMP_FILE; ],
2793 [ AC_MSG_RESULT(yes) ],
2794 [ AC_MSG_RESULT(no)
2795 system_utmp_path=no ]
2796)
2797if test -z "$conf_utmp_location"; then
2798 if test x"$system_utmp_path" = x"no" ; then
2799 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2800 if test -f $f ; then
2801 conf_utmp_location=$f
2802 fi
2803 done
2804 if test -z "$conf_utmp_location"; then
2805 AC_DEFINE(DISABLE_UTMP)
2806 fi
2807 fi
2808fi
2809if test -n "$conf_utmp_location"; then
2810 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2811fi
2812
2813dnl wtmp detection
2814AC_MSG_CHECKING([if your system defines WTMP_FILE])
2815AC_TRY_COMPILE([
2816#include <sys/types.h>
2817#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002818#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002819# include <paths.h>
2820#endif
2821 ],
2822 [ char *wtmp = WTMP_FILE; ],
2823 [ AC_MSG_RESULT(yes) ],
2824 [ AC_MSG_RESULT(no)
2825 system_wtmp_path=no ]
2826)
2827if test -z "$conf_wtmp_location"; then
2828 if test x"$system_wtmp_path" = x"no" ; then
2829 for f in /usr/adm/wtmp /var/log/wtmp; do
2830 if test -f $f ; then
2831 conf_wtmp_location=$f
2832 fi
2833 done
2834 if test -z "$conf_wtmp_location"; then
2835 AC_DEFINE(DISABLE_WTMP)
2836 fi
2837 fi
2838fi
2839if test -n "$conf_wtmp_location"; then
2840 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2841fi
2842
2843
2844dnl utmpx detection - I don't know any system so perverse as to require
2845dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2846dnl there, though.
2847AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2848AC_TRY_COMPILE([
2849#include <sys/types.h>
2850#include <utmp.h>
2851#ifdef HAVE_UTMPX_H
2852#include <utmpx.h>
2853#endif
Damien Miller2994e082000-06-04 15:51:47 +10002854#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002855# include <paths.h>
2856#endif
2857 ],
2858 [ char *utmpx = UTMPX_FILE; ],
2859 [ AC_MSG_RESULT(yes) ],
2860 [ AC_MSG_RESULT(no)
2861 system_utmpx_path=no ]
2862)
2863if test -z "$conf_utmpx_location"; then
2864 if test x"$system_utmpx_path" = x"no" ; then
2865 AC_DEFINE(DISABLE_UTMPX)
2866 fi
2867else
2868 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2869fi
2870
2871dnl wtmpx detection
2872AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2873AC_TRY_COMPILE([
2874#include <sys/types.h>
2875#include <utmp.h>
2876#ifdef HAVE_UTMPX_H
2877#include <utmpx.h>
2878#endif
Damien Miller2994e082000-06-04 15:51:47 +10002879#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002880# include <paths.h>
2881#endif
2882 ],
2883 [ char *wtmpx = WTMPX_FILE; ],
2884 [ AC_MSG_RESULT(yes) ],
2885 [ AC_MSG_RESULT(no)
2886 system_wtmpx_path=no ]
2887)
2888if test -z "$conf_wtmpx_location"; then
2889 if test x"$system_wtmpx_path" = x"no" ; then
2890 AC_DEFINE(DISABLE_WTMPX)
2891 fi
2892else
2893 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2894fi
2895
Damien Miller4018c192000-04-30 09:30:44 +10002896
Damien Miller29ea30d2000-03-17 10:54:15 +11002897if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002898 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2899 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002900fi
2901
Tim Rice4cec93f2002-02-26 08:40:48 -08002902dnl remove pam and dl because they are in $LIBPAM
2903if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002904 LIBS=`echo $LIBS | sed 's/-lpam //'`
2905fi
2906if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2907 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002908fi
2909
Damien Millerbac2d8a2000-09-05 16:13:06 +11002910AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002911AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2912AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002913
Damien Miller7b22d652000-06-18 14:07:04 +10002914# Print summary of options
2915
Damien Miller7b22d652000-06-18 14:07:04 +10002916# Someone please show me a better way :)
2917A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2918B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2919C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2920D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002921E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002922F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002923G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002924H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2925I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2926J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002927
2928echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002929echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002930echo " User binaries: $B"
2931echo " System binaries: $C"
2932echo " Configuration files: $D"
2933echo " Askpass program: $E"
2934echo " Manual pages: $F"
2935echo " PID file: $G"
2936echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002937if test "x$external_path_file" = "x/etc/login.conf" ; then
2938echo " At runtime, sshd will use the path defined in $external_path_file"
2939echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002940else
Damien Millerf58c6722002-05-13 13:15:42 +10002941echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002942 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002943echo " (If PATH is set in $external_path_file it will be used instead. If"
2944echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2945 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002946fi
Damien Millera18bbd32002-05-13 10:48:57 +10002947if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002948echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002949fi
Damien Millerf58c6722002-05-13 13:15:42 +10002950echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10002951echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002952echo " KerberosV support: $KRB5_MSG"
2953echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002954echo " S/KEY support: $SKEY_MSG"
2955echo " TCP Wrappers support: $TCPW_MSG"
2956echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002957echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002958echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2959echo " BSD Auth support: $BSD_AUTH_MSG"
2960echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002961if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002962echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002963fi
2964
Damien Miller7b22d652000-06-18 14:07:04 +10002965echo ""
2966
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002967echo " Host: ${host}"
2968echo " Compiler: ${CC}"
2969echo " Compiler flags: ${CFLAGS}"
2970echo "Preprocessor flags: ${CPPFLAGS}"
2971echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002972echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002973
2974echo ""
2975
Damien Miller82cf0ce2000-12-20 13:34:48 +11002976if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002977 echo "PAM is enabled. You may need to install a PAM control file "
2978 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11002979 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11002980 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002981 echo ""
2982fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002983
Damien Miller6c21c512002-01-22 21:57:53 +11002984if test ! -z "$RAND_HELPER_CMDHASH" ; then
2985 echo "WARNING: you are using the builtin random number collection "
2986 echo "service. Please read WARNING.RNG and request that your OS "
2987 echo "vendor includes kernel-based random number collection in "
2988 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002989 echo ""
2990fi
Damien Miller60396b02001-02-18 17:01:00 +11002991
Damien Millerb4097182004-05-23 14:09:40 +10002992if test ! -z "$NO_PEERCHECK" ; then
2993 echo "WARNING: the operating system that you are using does not "
2994 echo "appear to support either the getpeereid() API nor the "
2995 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
2996 echo "enforce security checks to prevent unauthorised connections to "
2997 echo "ssh-agent. Their absence increases the risk that a malicious "
2998 echo "user can connect to your agent. "
2999 echo ""
3000fi
3001