blob: 763c26275c9d8b598b27fc5c388e715c4a2b6647 [file] [log] [blame]
Darren Tucker3b908f62004-04-14 15:26:39 +10001# $Id: configure.ac,v 1.212 2004/04/14 05:26:39 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Tim Rice13aae5e2001-10-21 17:53:58 -070017AC_INIT
18AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim 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 Riceae477e92003-09-12 18:15:15 -0700362 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100363 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700364 MANTYPE=man
Tim Rice13aae5e2001-10-21 17:53:58 -0700365 do_sco3_extra_lib_check=yes
Damien Miller78315eb2000-09-29 23:01:36 +1100366 ;;
367*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800368 if test -z "$GCC"; then
369 CFLAGS="$CFLAGS -belf"
370 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100371 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000372 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100373 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000374 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000375 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700376 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700377 AC_DEFINE(SETEUID_BREAKS_SETUID)
378 AC_DEFINE(BROKEN_SETREUID)
379 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700380 AC_DEFINE(WITH_ABBREV_NO_TTY)
Damien Miller217f5672001-02-16 12:12:41 +1100381 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700382 MANTYPE=man
Damien Millera66626b2000-06-13 18:57:53 +1000383 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000384*-*-unicosmk*)
Darren Tucker2df33432004-01-30 14:34:21 +1100385 AC_DEFINE(NO_SSH_LASTLOG)
386 AC_DEFINE(SETEUID_BREAKS_SETUID)
387 AC_DEFINE(BROKEN_SETREUID)
388 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000389 AC_DEFINE(USE_PIPES)
390 AC_DEFINE(DISABLE_FD_PASSING)
391 LDFLAGS="$LDFLAGS"
392 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
393 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000394 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000395*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100396 AC_DEFINE(SETEUID_BREAKS_SETUID)
397 AC_DEFINE(BROKEN_SETREUID)
398 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000399 AC_DEFINE(WITH_ABBREV_NO_TTY)
400 AC_DEFINE(USE_PIPES)
401 AC_DEFINE(DISABLE_FD_PASSING)
402 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100403 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000404 MANTYPE=cat
405 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000406*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100407 AC_DEFINE(SETEUID_BREAKS_SETUID)
408 AC_DEFINE(BROKEN_SETREUID)
409 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000410 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700411 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700412 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000413 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
414 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
415 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700416 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000417*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000418 AC_MSG_CHECKING(for Digital Unix SIA)
419 no_osfsia=""
420 AC_ARG_WITH(osfsia,
421 [ --with-osfsia Enable Digital Unix SIA],
422 [
423 if test "x$withval" = "xno" ; then
424 AC_MSG_RESULT(disabled)
425 no_osfsia=1
426 fi
427 ],
428 )
429 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000430 if test -f /etc/sia/matrix.conf; then
431 AC_MSG_RESULT(yes)
432 AC_DEFINE(HAVE_OSF_SIA)
433 AC_DEFINE(DISABLE_LOGIN)
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000434 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000435 LIBS="$LIBS -lsecurity -ldb -lm -laud"
436 else
437 AC_MSG_RESULT(no)
Darren Tucker4e06a1d2003-11-22 14:25:15 +1100438 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin")
Damien Millerb8c656e2000-06-28 15:22:41 +1000439 fi
440 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000441 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700442 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000443 AC_DEFINE(BROKEN_SETREUID)
444 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000445 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000446
447*-*-nto-qnx)
448 AC_DEFINE(USE_PIPES)
449 AC_DEFINE(NO_X11_UNIX_SOCKETS)
450 AC_DEFINE(MISSING_NFDBITS)
451 AC_DEFINE(MISSING_HOWMANY)
452 AC_DEFINE(MISSING_FD_MASK)
453 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100454esac
455
Damien Millere37bfc12000-06-05 09:37:43 +1000456# Allow user to specify flags
457AC_ARG_WITH(cflags,
458 [ --with-cflags Specify additional flags to pass to compiler],
459 [
460 if test "x$withval" != "xno" ; then
461 CFLAGS="$CFLAGS $withval"
462 fi
463 ]
464)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000465AC_ARG_WITH(cppflags,
466 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
467 [
468 if test "x$withval" != "xno"; then
469 CPPFLAGS="$CPPFLAGS $withval"
470 fi
471 ]
472)
Damien Millere37bfc12000-06-05 09:37:43 +1000473AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000474 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000475 [
476 if test "x$withval" != "xno" ; then
477 LDFLAGS="$LDFLAGS $withval"
478 fi
479 ]
480)
481AC_ARG_WITH(libs,
482 [ --with-libs Specify additional libraries to link with],
483 [
484 if test "x$withval" != "xno" ; then
485 LIBS="$LIBS $withval"
486 fi
487 ]
488)
489
Darren Tucker6eb93042003-06-29 21:30:41 +1000490AC_MSG_CHECKING(compiler and flags for sanity)
491AC_TRY_RUN([
492#include <stdio.h>
493int main(){exit(0);}
494 ],
495 [ AC_MSG_RESULT(yes) ],
496 [
497 AC_MSG_RESULT(no)
498 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
499 ]
500)
501
Tim Rice4cec93f2002-02-26 08:40:48 -0800502# Checks for header files.
Damien Miller5fe46a42003-06-05 09:53:31 +1000503AC_CHECK_HEADERS(bstring.h crypt.h endian.h features.h floatingpoint.h \
Darren Tuckerc82afd52003-09-11 14:42:55 +1000504 getopt.h glob.h ia.h lastlog.h limits.h login.h \
Tim Rice4cec93f2002-02-26 08:40:48 -0800505 login_cap.h maillock.h netdb.h netgroup.h \
Damien Miller0f47c532004-01-02 18:01:30 +1100506 netinet/in_systm.h pam/pam_appl.h paths.h pty.h readpassphrase.h \
Ben Lindstrom7577fd82002-03-08 03:11:07 +0000507 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
Darren Tuckera0c0b632003-07-08 20:52:12 +1000508 strings.h sys/strtio.h sys/audit.h sys/bitypes.h sys/bsdtty.h \
Damien Miller6c4914a2004-03-03 11:08:59 +1100509 sys/cdefs.h sys/mman.h sys/prctl.h sys/pstat.h sys/ptms.h \
510 sys/select.h sys/stat.h sys/stream.h sys/stropts.h \
511 sys/sysmacros.h sys/time.h sys/timers.h sys/un.h time.h tmpdir.h \
512 ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
Tim Rice4cec93f2002-02-26 08:40:48 -0800513
Damien Millera22ba012000-03-02 23:09:20 +1100514# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700515AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
516AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000517
Damien Millerdf288022001-02-18 13:07:07 +1100518dnl SCO OS3 needs this for libwrap
Tim Rice13aae5e2001-10-21 17:53:58 -0700519if test "x$with_tcp_wrappers" != "xno" ; then
520 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
521 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
522 fi
523fi
Damien Millerdf288022001-02-18 13:07:07 +1100524
Tim Rice1e1ef642003-09-11 22:19:31 -0700525dnl IRIX and Solaris 2.5.1 have dirname() in libgen
526AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
527 AC_CHECK_LIB(gen, dirname,[
528 AC_CACHE_CHECK([for broken dirname],
529 ac_cv_have_broken_dirname, [
530 save_LIBS="$LIBS"
531 LIBS="$LIBS -lgen"
532 AC_TRY_RUN(
533 [
534#include <libgen.h>
535#include <string.h>
536
537int main(int argc, char **argv) {
538 char *s, buf[32];
539
540 strncpy(buf,"/etc", 32);
541 s = dirname(buf);
542 if (!s || strncmp(s, "/", 32) != 0) {
543 exit(1);
544 } else {
545 exit(0);
546 }
547}
548 ],
549 [ ac_cv_have_broken_dirname="no" ],
550 [ ac_cv_have_broken_dirname="yes" ]
551 )
552 LIBS="$save_LIBS"
553 ])
554 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
555 LIBS="$LIBS -lgen"
556 AC_DEFINE(HAVE_DIRNAME)
557 AC_CHECK_HEADERS(libgen.h)
558 fi
559 ])
560])
561
562AC_CHECK_FUNC(getspnam, ,
563 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
564AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
565
Tim Rice13aae5e2001-10-21 17:53:58 -0700566dnl zlib is required
567AC_ARG_WITH(zlib,
568 [ --with-zlib=PATH Use zlib in PATH],
569 [
Kevin Steves7dc81972002-01-22 21:59:31 +0000570 if test "x$withval" = "xno" ; then
Damien Miller6c21c512002-01-22 21:57:53 +1100571 AC_MSG_ERROR([*** zlib is required ***])
572 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700573 if test -d "$withval/lib"; then
574 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700575 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700576 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700577 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700578 fi
579 else
580 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700581 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700582 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700583 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700584 fi
585 fi
586 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700587 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700588 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700589 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700590 fi
591 ]
592)
593
Tim Ricefcb62202004-01-23 18:35:16 -0800594AC_CHECK_LIB(z, deflate, ,
595 [
596 saved_CPPFLAGS="$CPPFLAGS"
597 saved_LDFLAGS="$LDFLAGS"
598 save_LIBS="$LIBS"
599 dnl Check default zlib install dir
600 if test -n "${need_dash_r}"; then
601 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
602 else
603 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
604 fi
605 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
606 LIBS="$LIBS -lz"
607 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
608 [
609 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
610 ]
611 )
612 ]
613)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100614AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100615
616AC_ARG_WITH(zlib-version-check,
617 [ --without-zlib-version-check Disable zlib version check],
618 [ if test "x$withval" = "xno" ; then
619 zlib_check_nonfatal=1
620 fi
621 ]
622)
623
Darren Tucker2dcd2392004-01-23 17:13:33 +1100624AC_MSG_CHECKING(for zlib 1.1.4 or greater)
625AC_TRY_RUN([
626#include <zlib.h>
627int main()
628{
629 int a, b, c, v;
630 if (sscanf(ZLIB_VERSION, "%d.%d.%d", &a, &b, &c) != 3)
631 exit(1);
632 v = a*1000000 + b*1000 + c;
633 if (v >= 1001004)
634 exit(0);
635 exit(2);
636}
637 ],
638 AC_MSG_RESULT(yes),
639 [ AC_MSG_RESULT(no)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100640 if test -z "$zlib_check_nonfatal" ; then
641 AC_MSG_ERROR([*** zlib too old - check config.log ***
642Your reported zlib version has known security problems. It's possible your
643vendor has fixed these problems without changing the version number. If you
644are sure this is the case, you can disable the check by running
645"./configure --without-zlib-version-check".
646If you are in doubt, upgrade zlib to version 1.1.4 or greater.])
647 else
648 AC_MSG_WARN([zlib version may have security problems])
649 fi
650 ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100651)
Damien Miller6f9c3372000-10-25 10:06:04 +1100652
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000653dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100654AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000655 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
656)
Damien Millera8e06ce2003-11-21 23:48:55 +1100657AC_CHECK_FUNC(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700658 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
659 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000660)
Damien Millerab18c411999-11-11 10:40:23 +1100661
Tim Ricee589a292001-11-03 11:09:32 -0800662dnl Checks for libutil functions
663AC_CHECK_HEADERS(libutil.h)
664AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
665AC_CHECK_FUNCS(logout updwtmp logwtmp)
666
Ben Lindstrom8697e082001-02-24 21:41:10 +0000667AC_FUNC_STRFTIME
668
Damien Miller3c027682001-03-14 11:39:45 +1100669# Check for ALTDIRFUNC glob() extension
670AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
671AC_EGREP_CPP(FOUNDIT,
672 [
673 #include <glob.h>
674 #ifdef GLOB_ALTDIRFUNC
675 FOUNDIT
676 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100677 ],
Damien Miller3c027682001-03-14 11:39:45 +1100678 [
679 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
680 AC_MSG_RESULT(yes)
681 ],
682 [
683 AC_MSG_RESULT(no)
684 ]
685)
Damien Millerab18c411999-11-11 10:40:23 +1100686
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000687# Check for g.gl_matchc glob() extension
688AC_MSG_CHECKING(for gl_matchc field in glob_t)
689AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100690 [
691 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000692 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100693 ],
694 [
695 AC_DEFINE(GLOB_HAS_GL_MATCHC)
696 AC_MSG_RESULT(yes)
697 ],
698 [
699 AC_MSG_RESULT(no)
700 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000701)
702
Damien Miller18bb4732001-03-28 14:35:30 +1000703AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
704AC_TRY_RUN(
705 [
706#include <sys/types.h>
707#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700708int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Damien Miller18bb4732001-03-28 14:35:30 +1000709 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100710 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000711 [
712 AC_MSG_RESULT(no)
713 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
714 ]
715)
716
Damien Millerc547bf12001-02-16 10:18:12 +1100717# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100718SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100719AC_ARG_WITH(skey,
Tim Rice13aae5e2001-10-21 17:53:58 -0700720 [ --with-skey[[=PATH]] Enable S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100721 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100722 [
723 if test "x$withval" != "xno" ; then
724
725 if test "x$withval" != "xyes" ; then
726 CPPFLAGS="$CPPFLAGS -I${withval}/include"
727 LDFLAGS="$LDFLAGS -L${withval}/lib"
728 fi
729
730 AC_DEFINE(SKEY)
731 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100732 SKEY_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100733
Tim Rice4cec93f2002-02-26 08:40:48 -0800734 AC_MSG_CHECKING([for s/key support])
735 AC_TRY_RUN(
Damien Millerc547bf12001-02-16 10:18:12 +1100736 [
Tim Rice4cec93f2002-02-26 08:40:48 -0800737#include <stdio.h>
738#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700739int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Tim Rice4cec93f2002-02-26 08:40:48 -0800740 ],
741 [AC_MSG_RESULT(yes)],
742 [
743 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100744 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
745 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000746 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
747 AC_TRY_COMPILE(
748 [#include <stdio.h>
749 #include <skey.h>],
750 [(void)skeychallenge(NULL,"name","",0);],
751 [AC_MSG_RESULT(yes)
752 AC_DEFINE(SKEYCHALLENGE_4ARG)],
753 [AC_MSG_RESULT(no)]
754 )
Damien Millerc547bf12001-02-16 10:18:12 +1100755 fi
756 ]
757)
758
759# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700760TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100761AC_ARG_WITH(tcp-wrappers,
Tim Rice13aae5e2001-10-21 17:53:58 -0700762 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
Damien Millera8e06ce2003-11-21 23:48:55 +1100763 (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100764 [
765 if test "x$withval" != "xno" ; then
766 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700767 saved_LDFLAGS="$LDFLAGS"
768 saved_CPPFLAGS="$CPPFLAGS"
769 if test -n "${withval}" -a "${withval}" != "yes"; then
770 if test -d "${withval}/lib"; then
771 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700772 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700773 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700774 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700775 fi
776 else
777 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700778 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700779 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700780 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700781 fi
782 fi
783 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700784 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700785 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700786 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700787 fi
Tim Rice13aae5e2001-10-21 17:53:58 -0700788 fi
Tim Rice4cec93f2002-02-26 08:40:48 -0800789 LIBWRAP="-lwrap"
790 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100791 AC_MSG_CHECKING(for libwrap)
792 AC_TRY_LINK(
793 [
794#include <tcpd.h>
795 int deny_severity = 0, allow_severity = 0;
796 ],
797 [hosts_access(0);],
798 [
799 AC_MSG_RESULT(yes)
800 AC_DEFINE(LIBWRAP)
Tim Rice4cec93f2002-02-26 08:40:48 -0800801 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -0700802 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +1100803 ],
804 [
805 AC_MSG_ERROR([*** libwrap missing])
806 ]
807 )
Tim Rice4cec93f2002-02-26 08:40:48 -0800808 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +1100809 fi
810 ]
811)
812
Damien Millerfe1f1432003-02-24 15:45:42 +1100813dnl Checks for library functions. Please keep in alphabetical order
814AC_CHECK_FUNCS(\
Damien Millerf09ad862003-09-19 16:41:01 +1000815 arc4random __b64_ntop b64_ntop __b64_pton b64_pton \
Damien Miller5fe46a42003-06-05 09:53:31 +1000816 bcopy bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000817 getaddrinfo getcwd getgrouplist getnameinfo getopt \
Darren Tuckerf1159b52003-07-07 19:44:01 +1000818 getpeereid _getpty getrlimit getttyent glob inet_aton \
Damien Millerfe1f1432003-02-24 15:45:42 +1100819 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
Damien Miller1340ec22003-05-20 09:24:42 +1000820 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openlog_r openpty \
Damien Miller6c4914a2004-03-03 11:08:59 +1100821 pstat prctl readpassphrase realpath recvmsg rresvport_af sendmsg \
Damien Miller1340ec22003-05-20 09:24:42 +1000822 setdtablesize setegid setenv seteuid setgroups setlogin setpcred \
Darren Tucker2a6b0292003-12-31 14:59:17 +1100823 setproctitle setregid setreuid setrlimit \
Damien Miller5fe46a42003-06-05 09:53:31 +1000824 setsid setvbuf sigaction sigvec snprintf socketpair strerror \
Darren Tucker2e8c0cc2003-10-07 17:49:56 +1000825 strlcat strlcpy strmode strnvis strtoul sysconf tcgetpgrp \
Darren Tucker86c093d2004-03-08 22:59:03 +1100826 truncate unsetenv updwtmpx utimes vhangup vsnprintf waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +1100827)
Tim Rice13aae5e2001-10-21 17:53:58 -0700828
Darren Tuckerd5e082f2003-09-22 12:08:23 +1000829# IRIX has a const char return value for gai_strerror()
830AC_CHECK_FUNCS(gai_strerror,[
831 AC_DEFINE(HAVE_GAI_STRERROR)
832 AC_TRY_COMPILE([
833#include <sys/types.h>
834#include <sys/socket.h>
835#include <netdb.h>
836
837const char *gai_strerror(int);],[
838char *str;
839
840str = gai_strerror(0);],[
841 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
842 [Define if gai_strerror() returns const char *])])])
843
Damien Millercd6853c2003-01-28 11:33:42 +1100844AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
845
Darren Tuckerf1159b52003-07-07 19:44:01 +1000846dnl Make sure prototypes are defined for these before using them.
Ben Lindstrom3e006472002-10-16 00:24:03 +0000847AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
Darren Tuckerf1159b52003-07-07 19:44:01 +1000848AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Ben Lindstrom3e006472002-10-16 00:24:03 +0000849
Darren Tuckerb2427c82003-09-10 15:22:44 +1000850dnl tcsendbreak might be a macro
851AC_CHECK_DECL(tcsendbreak,
852 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +1100853 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +1000854 [#include <termios.h>]
855)
856
Darren Tucker2a6b0292003-12-31 14:59:17 +1100857AC_CHECK_FUNCS(setresuid, [
858 dnl Some platorms have setresuid that isn't implemented, test for this
859 AC_MSG_CHECKING(if setresuid seems to work)
860 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100861#include <stdlib.h>
862#include <errno.h>
863int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100864 ],
865 [AC_MSG_RESULT(yes)],
Darren Tuckerfd0894a2004-01-09 00:19:25 +1100866 [AC_DEFINE(BROKEN_SETRESUID)
Darren Tucker2a6b0292003-12-31 14:59:17 +1100867 AC_MSG_RESULT(not implemented)]
868 )
869])
Darren Tuckere937be32003-12-17 18:53:26 +1100870
Darren Tucker2a6b0292003-12-31 14:59:17 +1100871AC_CHECK_FUNCS(setresgid, [
872 dnl Some platorms have setresgid that isn't implemented, test for this
873 AC_MSG_CHECKING(if setresgid seems to work)
874 AC_TRY_RUN([
Darren Tuckere937be32003-12-17 18:53:26 +1100875#include <stdlib.h>
876#include <errno.h>
877int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker2a6b0292003-12-31 14:59:17 +1100878 ],
879 [AC_MSG_RESULT(yes)],
880 [AC_DEFINE(BROKEN_SETRESGID)
881 AC_MSG_RESULT(not implemented)]
882 )
883])
Darren Tuckere937be32003-12-17 18:53:26 +1100884
Damien Millerad833b32000-08-23 10:46:23 +1000885dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +0000886AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +1000887dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000888AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +0000889AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +1000890dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +0000891AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +0000892AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +1100893
Damien Millera8e06ce2003-11-21 23:48:55 +1100894AC_CHECK_FUNC(daemon,
Damien Miller04f80141999-11-19 15:32:34 +1100895 [AC_DEFINE(HAVE_DAEMON)],
896 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
897)
898
Damien Millera8e06ce2003-11-21 23:48:55 +1100899AC_CHECK_FUNC(getpagesize,
Damien Miller9fb07e42000-03-05 16:22:59 +1100900 [AC_DEFINE(HAVE_GETPAGESIZE)],
901 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
902)
903
Damien Millercb170cb2000-07-01 16:52:55 +1000904# Check for broken snprintf
905if test "x$ac_cv_func_snprintf" = "xyes" ; then
906 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
907 AC_TRY_RUN(
908 [
909#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700910int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Damien Millercb170cb2000-07-01 16:52:55 +1000911 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100912 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +1000913 [
914 AC_MSG_RESULT(no)
915 AC_DEFINE(BROKEN_SNPRINTF)
916 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
917 ]
918 )
919fi
920
Damien Millere8328192003-01-07 15:18:32 +1100921dnl see whether mkstemp() requires XXXXXX
922if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
923AC_MSG_CHECKING([for (overly) strict mkstemp])
924AC_TRY_RUN(
925 [
926#include <stdlib.h>
927main() { char template[]="conftest.mkstemp-test";
928if (mkstemp(template) == -1)
929 exit(1);
930unlink(template); exit(0);
931}
932 ],
933 [
934 AC_MSG_RESULT(no)
935 ],
Damien Millera8e06ce2003-11-21 23:48:55 +1100936 [
Damien Millere8328192003-01-07 15:18:32 +1100937 AC_MSG_RESULT(yes)
938 AC_DEFINE(HAVE_STRICT_MKSTEMP)
939 ],
940 [
941 AC_MSG_RESULT(yes)
942 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +1100943 ]
Damien Millere8328192003-01-07 15:18:32 +1100944)
945fi
946
Darren Tucker70a3d552003-08-21 17:58:29 +1000947dnl make sure that openpty does not reacquire controlling terminal
948if test ! -z "$check_for_openpty_ctty_bug"; then
949 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
950 AC_TRY_RUN(
951 [
952#include <stdio.h>
953#include <sys/fcntl.h>
954#include <sys/types.h>
955#include <sys/wait.h>
956
957int
958main()
959{
960 pid_t pid;
961 int fd, ptyfd, ttyfd, status;
962
963 pid = fork();
964 if (pid < 0) { /* failed */
965 exit(1);
966 } else if (pid > 0) { /* parent */
967 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +1100968 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +1000969 exit(WEXITSTATUS(status));
970 else
971 exit(2);
972 } else { /* child */
973 close(0); close(1); close(2);
974 setsid();
975 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
976 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
977 if (fd >= 0)
978 exit(3); /* Acquired ctty: broken */
979 else
980 exit(0); /* Did not acquire ctty: OK */
981 }
982}
983 ],
984 [
985 AC_MSG_RESULT(yes)
986 ],
987 [
988 AC_MSG_RESULT(no)
989 AC_DEFINE(SSHD_ACQUIRES_CTTY)
990 ]
991 )
992fi
993
Darren Tucker4398cf52004-04-06 21:39:02 +1000994if test "x$ac_cv_func_getaddrinfo" = "xyes" -a "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
995 AC_MSG_CHECKING(if getaddrinfo seems to work)
996 AC_TRY_RUN(
997 [
998#include <stdio.h>
999#include <sys/socket.h>
1000#include <netdb.h>
1001#include <errno.h>
1002#include <netinet/in.h>
1003
1004#define TEST_PORT "2222"
1005
1006int
1007main(void)
1008{
1009 int err, sock;
1010 struct addrinfo *gai_ai, *ai, hints;
1011 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1012
1013 memset(&hints, 0, sizeof(hints));
1014 hints.ai_family = PF_UNSPEC;
1015 hints.ai_socktype = SOCK_STREAM;
1016 hints.ai_flags = AI_PASSIVE;
1017
1018 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1019 if (err != 0) {
1020 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1021 exit(1);
1022 }
1023
1024 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1025 if (ai->ai_family != AF_INET6)
1026 continue;
1027
1028 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1029 sizeof(ntop), strport, sizeof(strport),
1030 NI_NUMERICHOST|NI_NUMERICSERV);
1031
1032 if (err != 0) {
1033 if (err == EAI_SYSTEM)
1034 perror("getnameinfo EAI_SYSTEM");
1035 else
1036 fprintf(stderr, "getnameinfo failed: %s\n",
1037 gai_strerror(err));
1038 exit(2);
1039 }
1040
1041 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1042 if (sock < 0)
1043 perror("socket");
1044 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1045 if (errno == EBADF)
1046 exit(3);
1047 }
1048 }
1049 exit(0);
1050}
1051 ],
1052 [
1053 AC_MSG_RESULT(yes)
1054 ],
1055 [
1056 AC_MSG_RESULT(no)
1057 AC_DEFINE(BROKEN_GETADDRINFO)
1058 ]
1059 )
1060fi
1061
Damien Miller606f8802000-09-16 15:39:56 +11001062AC_FUNC_GETPGRP
1063
Damien Millera64b57a2001-01-17 10:44:13 +11001064# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001065PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001066AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001067 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001068 [
Damien Millera64b57a2001-01-17 10:44:13 +11001069 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001070 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1071 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001072 AC_MSG_ERROR([PAM headers not found])
1073 fi
1074
1075 AC_CHECK_LIB(dl, dlopen, , )
1076 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1077 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001078 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001079
Damien Millera64b57a2001-01-17 10:44:13 +11001080 PAM_MSG="yes"
1081
1082 AC_DEFINE(USE_PAM)
Tim Rice7d2d1f12002-02-26 22:05:11 -08001083 if test $ac_cv_lib_dl_dlopen = yes; then
1084 LIBPAM="-lpam -ldl"
1085 else
1086 LIBPAM="-lpam"
1087 fi
1088 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001089 fi
1090 ]
1091)
Damien Millera22ba012000-03-02 23:09:20 +11001092
Damien Millera64b57a2001-01-17 10:44:13 +11001093# Check for older PAM
1094if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001095 # Check PAM strerror arguments (old PAM)
1096 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1097 AC_TRY_COMPILE(
1098 [
Damien Miller81171112000-04-23 11:14:01 +10001099#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001100#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001101#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001102#elif defined (HAVE_PAM_PAM_APPL_H)
1103#include <pam/pam_appl.h>
1104#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001105 ],
1106 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001107 [AC_MSG_RESULT(no)],
1108 [
1109 AC_DEFINE(HAVE_OLD_PAM)
1110 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001111 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001112 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001113 )
Damien Millera22ba012000-03-02 23:09:20 +11001114fi
1115
Tim Riceaef73712002-05-11 13:17:42 -07001116# Search for OpenSSL
1117saved_CPPFLAGS="$CPPFLAGS"
1118saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001119AC_ARG_WITH(ssl-dir,
1120 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1121 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001122 if test "x$withval" != "xno" ; then
Tim Riceaef73712002-05-11 13:17:42 -07001123 if test -d "$withval/lib"; then
1124 if test -n "${need_dash_r}"; then
1125 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1126 else
1127 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1128 fi
1129 else
1130 if test -n "${need_dash_r}"; then
1131 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1132 else
1133 LDFLAGS="-L${withval} ${LDFLAGS}"
1134 fi
1135 fi
1136 if test -d "$withval/include"; then
1137 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1138 else
1139 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1140 fi
Damien Millera22ba012000-03-02 23:09:20 +11001141 fi
1142 ]
1143)
Tim Rice3d5352e2004-02-12 09:27:21 -08001144LIBS="-lcrypto $LIBS"
Tim Riceaef73712002-05-11 13:17:42 -07001145AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
Damien Miller3b512e12000-05-17 23:29:18 +10001146 [
Tim Riceaef73712002-05-11 13:17:42 -07001147 dnl Check default openssl install dir
1148 if test -n "${need_dash_r}"; then
1149 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001150 else
Tim Riceaef73712002-05-11 13:17:42 -07001151 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001152 fi
Tim Riceaef73712002-05-11 13:17:42 -07001153 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1154 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1155 [
1156 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1157 ]
1158 )
1159 ]
1160)
1161
Tim Riced730b782002-08-13 18:52:10 -07001162# Determine OpenSSL header version
1163AC_MSG_CHECKING([OpenSSL header version])
1164AC_TRY_RUN(
1165 [
1166#include <stdio.h>
1167#include <string.h>
1168#include <openssl/opensslv.h>
1169#define DATA "conftest.sslincver"
1170int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001171 FILE *fd;
1172 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001173
Damien Millera8e06ce2003-11-21 23:48:55 +11001174 fd = fopen(DATA,"w");
1175 if(fd == NULL)
1176 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001177
1178 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1179 exit(1);
1180
1181 exit(0);
1182}
1183 ],
1184 [
1185 ssl_header_ver=`cat conftest.sslincver`
1186 AC_MSG_RESULT($ssl_header_ver)
1187 ],
1188 [
1189 AC_MSG_RESULT(not found)
1190 AC_MSG_ERROR(OpenSSL version header not found.)
1191 ]
1192)
1193
1194# Determine OpenSSL library version
1195AC_MSG_CHECKING([OpenSSL library version])
1196AC_TRY_RUN(
1197 [
1198#include <stdio.h>
1199#include <string.h>
1200#include <openssl/opensslv.h>
1201#include <openssl/crypto.h>
1202#define DATA "conftest.ssllibver"
1203int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001204 FILE *fd;
1205 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001206
Damien Millera8e06ce2003-11-21 23:48:55 +11001207 fd = fopen(DATA,"w");
1208 if(fd == NULL)
1209 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001210
1211 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1212 exit(1);
1213
1214 exit(0);
1215}
1216 ],
1217 [
1218 ssl_library_ver=`cat conftest.ssllibver`
1219 AC_MSG_RESULT($ssl_library_ver)
1220 ],
1221 [
1222 AC_MSG_RESULT(not found)
1223 AC_MSG_ERROR(OpenSSL library not found.)
1224 ]
1225)
Damien Millera22ba012000-03-02 23:09:20 +11001226
Damien Millerec932372002-01-22 22:16:03 +11001227# Sanity check OpenSSL headers
1228AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1229AC_TRY_RUN(
1230 [
1231#include <string.h>
1232#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001233int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Damien Millerec932372002-01-22 22:16:03 +11001234 ],
1235 [
1236 AC_MSG_RESULT(yes)
1237 ],
1238 [
1239 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001240 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1241Check config.log for details.
1242Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Millerec932372002-01-22 22:16:03 +11001243 ]
1244)
1245
Tim Rice3d5352e2004-02-12 09:27:21 -08001246# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1247# because the system crypt() is more featureful.
1248if test "x$check_for_libcrypt_before" = "x1"; then
1249 AC_CHECK_LIB(crypt, crypt)
1250fi
1251
Damien Millera8e06ce2003-11-21 23:48:55 +11001252# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001253# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001254if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001255 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001256fi
1257
Damien Miller6c21c512002-01-22 21:57:53 +11001258
1259### Configure cryptographic random number support
1260
1261# Check wheter OpenSSL seeds itself
1262AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1263AC_TRY_RUN(
1264 [
1265#include <string.h>
1266#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001267int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Damien Miller6c21c512002-01-22 21:57:53 +11001268 ],
1269 [
1270 OPENSSL_SEEDS_ITSELF=yes
1271 AC_MSG_RESULT(yes)
1272 ],
1273 [
1274 AC_MSG_RESULT(no)
1275 # Default to use of the rand helper if OpenSSL doesn't
1276 # seed itself
1277 USE_RAND_HELPER=yes
1278 ]
1279)
1280
1281
1282# Do we want to force the use of the rand helper?
1283AC_ARG_WITH(rand-helper,
1284 [ --with-rand-helper Use subprocess to gather strong randomness ],
1285 [
1286 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001287 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001288 # the previous test showed it to be unseeded.
1289 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1290 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1291 OPENSSL_SEEDS_ITSELF=yes
1292 USE_RAND_HELPER=""
1293 fi
1294 else
1295 USE_RAND_HELPER=yes
1296 fi
1297 ],
1298)
1299
1300# Which randomness source do we use?
1301if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
1302 # OpenSSL only
1303 AC_DEFINE(OPENSSL_PRNG_ONLY)
1304 RAND_MSG="OpenSSL internal ONLY"
1305 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001306elif test ! -z "$USE_RAND_HELPER" ; then
1307 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001308 RAND_MSG="ssh-rand-helper"
1309 INSTALL_SSH_RAND_HELPER="yes"
1310fi
1311AC_SUBST(INSTALL_SSH_RAND_HELPER)
1312
1313### Configuration of ssh-rand-helper
1314
1315# PRNGD TCP socket
1316AC_ARG_WITH(prngd-port,
1317 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1318 [
Damien Millere996d722002-01-23 11:20:59 +11001319 case "$withval" in
1320 no)
1321 withval=""
1322 ;;
1323 [[0-9]]*)
1324 ;;
1325 *)
1326 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1327 ;;
1328 esac
1329 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001330 PRNGD_PORT="$withval"
1331 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
1332 fi
1333 ]
1334)
1335
1336# PRNGD Unix domain socket
1337AC_ARG_WITH(prngd-socket,
1338 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1339 [
Damien Millere996d722002-01-23 11:20:59 +11001340 case "$withval" in
1341 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001342 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001343 ;;
1344 no)
1345 withval=""
1346 ;;
1347 /*)
1348 ;;
1349 *)
1350 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1351 ;;
1352 esac
1353
1354 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001355 if test ! -z "$PRNGD_PORT" ; then
1356 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1357 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001358 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001359 AC_MSG_WARN(Entropy socket is not readable)
1360 fi
1361 PRNGD_SOCKET="$withval"
1362 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1363 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001364 ],
1365 [
1366 # Check for existing socket only if we don't have a random device already
1367 if test "$USE_RAND_HELPER" = yes ; then
1368 AC_MSG_CHECKING(for PRNGD/EGD socket)
1369 # Insert other locations here
1370 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1371 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1372 PRNGD_SOCKET="$sock"
1373 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1374 break;
1375 fi
1376 done
1377 if test ! -z "$PRNGD_SOCKET" ; then
1378 AC_MSG_RESULT($PRNGD_SOCKET)
1379 else
1380 AC_MSG_RESULT(not found)
1381 fi
1382 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001383 ]
1384)
1385
1386# Change default command timeout for hashing entropy source
1387entropy_timeout=200
1388AC_ARG_WITH(entropy-timeout,
1389 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1390 [
1391 if test "x$withval" != "xno" ; then
1392 entropy_timeout=$withval
1393 fi
1394 ]
1395)
Damien Miller6c21c512002-01-22 21:57:53 +11001396AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1397
Damien Millerd3f6ad22002-06-25 10:24:47 +10001398SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001399AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001400 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001401 [
1402 if test -n "$withval"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001403 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001404 fi
1405 ]
1406)
Damien Millerd3f6ad22002-06-25 10:24:47 +10001407AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1408AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001409
Tim Rice88f2ab52002-03-17 12:17:34 -08001410# We do this little dance with the search path to insure
1411# that programs that we select for use by installed programs
1412# (which may be run by the super-user) come from trusted
1413# locations before they come from the user's private area.
1414# This should help avoid accidentally configuring some
1415# random version of a program in someone's personal bin.
1416
1417OPATH=$PATH
1418PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001419test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001420test -d /sbin && PATH=$PATH:/sbin
1421test -d /usr/sbin && PATH=$PATH:/usr/sbin
1422PATH=$PATH:/etc:$OPATH
1423
Damien Millera8e06ce2003-11-21 23:48:55 +11001424# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001425OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1426OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1427OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1428OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1429OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1430OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1431OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1432OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1433OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1434OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1435OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1436OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1437OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1438OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1439OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1440OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001441# restore PATH
1442PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001443
1444# Where does ssh-rand-helper get its randomness from?
1445INSTALL_SSH_PRNG_CMDS=""
1446if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1447 if test ! -z "$PRNGD_PORT" ; then
1448 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1449 elif test ! -z "$PRNGD_SOCKET" ; then
1450 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1451 else
1452 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1453 RAND_HELPER_CMDHASH=yes
1454 INSTALL_SSH_PRNG_CMDS="yes"
1455 fi
1456fi
1457AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1458
1459
Ben Lindstromb5628642000-10-18 00:02:25 +00001460# Cheap hack to ensure NEWS-OS libraries are arranged right.
1461if test ! -z "$SONY" ; then
1462 LIBS="$LIBS -liberty";
1463fi
1464
Damien Millera22ba012000-03-02 23:09:20 +11001465# Checks for data types
Damien Millere0f45742000-01-18 09:12:06 +11001466AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11001467AC_CHECK_SIZEOF(short int, 2)
1468AC_CHECK_SIZEOF(int, 4)
1469AC_CHECK_SIZEOF(long int, 4)
1470AC_CHECK_SIZEOF(long long int, 8)
1471
Damien Millerfa2bb692002-04-23 23:22:25 +10001472# Sanity check long long for some platforms (AIX)
1473if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1474 ac_cv_sizeof_long_long_int=0
1475fi
1476
Damien Millera22ba012000-03-02 23:09:20 +11001477# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11001478AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1479 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001480 [ #include <sys/types.h> ],
1481 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11001482 [ ac_cv_have_u_int="yes" ],
1483 [ ac_cv_have_u_int="no" ]
1484 )
1485])
1486if test "x$ac_cv_have_u_int" = "xyes" ; then
1487 AC_DEFINE(HAVE_U_INT)
1488 have_u_int=1
1489fi
1490
Damien Miller61e50f12000-05-08 20:49:37 +10001491AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1492 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001493 [ #include <sys/types.h> ],
1494 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001495 [ ac_cv_have_intxx_t="yes" ],
1496 [ ac_cv_have_intxx_t="no" ]
1497 )
1498])
1499if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1500 AC_DEFINE(HAVE_INTXX_T)
1501 have_intxx_t=1
1502fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001503
1504if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001505 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001506then
1507 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1508 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001509 [ #include <stdint.h> ],
1510 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001511 [
1512 AC_DEFINE(HAVE_INTXX_T)
1513 AC_MSG_RESULT(yes)
1514 ],
1515 [ AC_MSG_RESULT(no) ]
1516 )
1517fi
1518
Damien Miller578783e2000-09-23 14:12:24 +11001519AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1520 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07001521 [
1522#include <sys/types.h>
1523#ifdef HAVE_STDINT_H
1524# include <stdint.h>
1525#endif
1526#include <sys/socket.h>
1527#ifdef HAVE_SYS_BITYPES_H
1528# include <sys/bitypes.h>
1529#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001530 ],
1531 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001532 [ ac_cv_have_int64_t="yes" ],
1533 [ ac_cv_have_int64_t="no" ]
1534 )
1535])
1536if test "x$ac_cv_have_int64_t" = "xyes" ; then
1537 AC_DEFINE(HAVE_INT64_T)
Tim Rice4cec93f2002-02-26 08:40:48 -08001538fi
1539
Damien Miller61e50f12000-05-08 20:49:37 +10001540AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1541 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001542 [ #include <sys/types.h> ],
1543 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10001544 [ ac_cv_have_u_intxx_t="yes" ],
1545 [ ac_cv_have_u_intxx_t="no" ]
1546 )
1547])
1548if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1549 AC_DEFINE(HAVE_U_INTXX_T)
1550 have_u_intxx_t=1
1551fi
Damien Millerc6398ef1999-11-20 12:18:40 +11001552
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001553if test -z "$have_u_intxx_t" ; then
1554 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1555 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001556 [ #include <sys/socket.h> ],
1557 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001558 [
1559 AC_DEFINE(HAVE_U_INTXX_T)
1560 AC_MSG_RESULT(yes)
1561 ],
1562 [ AC_MSG_RESULT(no) ]
1563 )
1564fi
1565
Damien Miller578783e2000-09-23 14:12:24 +11001566AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1567 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001568 [ #include <sys/types.h> ],
1569 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11001570 [ ac_cv_have_u_int64_t="yes" ],
1571 [ ac_cv_have_u_int64_t="no" ]
1572 )
1573])
1574if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1575 AC_DEFINE(HAVE_U_INT64_T)
1576 have_u_int64_t=1
1577fi
1578
Tim Rice4cec93f2002-02-26 08:40:48 -08001579if test -z "$have_u_int64_t" ; then
1580 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1581 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001582 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08001583 [ u_int64_t a; a = 1],
1584 [
1585 AC_DEFINE(HAVE_U_INT64_T)
1586 AC_MSG_RESULT(yes)
1587 ],
1588 [ AC_MSG_RESULT(no) ]
1589 )
1590fi
1591
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001592if test -z "$have_u_intxx_t" ; then
1593 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1594 AC_TRY_COMPILE(
1595 [
1596#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001597 ],
1598 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001599 [ ac_cv_have_uintxx_t="yes" ],
1600 [ ac_cv_have_uintxx_t="no" ]
1601 )
1602 ])
1603 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1604 AC_DEFINE(HAVE_UINTXX_T)
1605 fi
1606fi
1607
1608if test -z "$have_uintxx_t" ; then
1609 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1610 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001611 [ #include <stdint.h> ],
1612 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00001613 [
1614 AC_DEFINE(HAVE_UINTXX_T)
1615 AC_MSG_RESULT(yes)
1616 ],
1617 [ AC_MSG_RESULT(no) ]
1618 )
1619fi
1620
Damien Milleredb82922000-06-20 13:25:52 +10001621if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11001622 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11001623then
1624 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1625 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10001626 [
1627#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11001628 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001629 [
Damien Miller70494d12000-04-03 15:57:06 +10001630 int8_t a; int16_t b; int32_t c;
1631 u_int8_t e; u_int16_t f; u_int32_t g;
1632 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11001633 ],
Damien Millerb29ea912000-01-15 14:12:03 +11001634 [
1635 AC_DEFINE(HAVE_U_INTXX_T)
1636 AC_DEFINE(HAVE_INTXX_T)
1637 AC_MSG_RESULT(yes)
1638 ],
1639 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11001640 )
Damien Millerb29ea912000-01-15 14:12:03 +11001641fi
1642
Damien Miller58be7382001-09-15 21:31:54 +10001643
1644AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1645 AC_TRY_COMPILE(
1646 [
1647#include <sys/types.h>
1648 ],
1649 [ u_char foo; foo = 125; ],
1650 [ ac_cv_have_u_char="yes" ],
1651 [ ac_cv_have_u_char="no" ]
1652 )
1653])
1654if test "x$ac_cv_have_u_char" = "xyes" ; then
1655 AC_DEFINE(HAVE_U_CHAR)
1656fi
1657
Tim Rice13aae5e2001-10-21 17:53:58 -07001658TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11001659
Tim Rice200a5c02002-02-26 22:12:34 -08001660AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08001661
Damien Miller61e50f12000-05-08 20:49:37 +10001662AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1663 AC_TRY_COMPILE(
1664 [
1665#include <sys/types.h>
1666 ],
1667 [ size_t foo; foo = 1235; ],
1668 [ ac_cv_have_size_t="yes" ],
1669 [ ac_cv_have_size_t="no" ]
1670 )
1671])
1672if test "x$ac_cv_have_size_t" = "xyes" ; then
1673 AC_DEFINE(HAVE_SIZE_T)
1674fi
Damien Miller95058511999-12-29 10:36:45 +11001675
Damien Miller615f9392000-05-17 22:53:33 +10001676AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1677 AC_TRY_COMPILE(
1678 [
1679#include <sys/types.h>
1680 ],
1681 [ ssize_t foo; foo = 1235; ],
1682 [ ac_cv_have_ssize_t="yes" ],
1683 [ ac_cv_have_ssize_t="no" ]
1684 )
1685])
1686if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1687 AC_DEFINE(HAVE_SSIZE_T)
1688fi
1689
Ben Lindstrom0d5af602001-01-09 00:50:29 +00001690AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1691 AC_TRY_COMPILE(
1692 [
1693#include <time.h>
1694 ],
1695 [ clock_t foo; foo = 1235; ],
1696 [ ac_cv_have_clock_t="yes" ],
1697 [ ac_cv_have_clock_t="no" ]
1698 )
1699])
1700if test "x$ac_cv_have_clock_t" = "xyes" ; then
1701 AC_DEFINE(HAVE_CLOCK_T)
1702fi
1703
Damien Millerb54b40e2000-06-23 08:23:34 +10001704AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1705 AC_TRY_COMPILE(
1706 [
1707#include <sys/types.h>
1708#include <sys/socket.h>
1709 ],
1710 [ sa_family_t foo; foo = 1235; ],
1711 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11001712 [ AC_TRY_COMPILE(
1713 [
1714#include <sys/types.h>
1715#include <sys/socket.h>
1716#include <netinet/in.h>
1717 ],
1718 [ sa_family_t foo; foo = 1235; ],
1719 [ ac_cv_have_sa_family_t="yes" ],
1720
Damien Millerb54b40e2000-06-23 08:23:34 +10001721 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11001722 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10001723 )
1724])
1725if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1726 AC_DEFINE(HAVE_SA_FAMILY_T)
1727fi
1728
Damien Miller0f91b4e2000-06-18 15:43:25 +10001729AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1730 AC_TRY_COMPILE(
1731 [
1732#include <sys/types.h>
1733 ],
1734 [ pid_t foo; foo = 1235; ],
1735 [ ac_cv_have_pid_t="yes" ],
1736 [ ac_cv_have_pid_t="no" ]
1737 )
1738])
1739if test "x$ac_cv_have_pid_t" = "xyes" ; then
1740 AC_DEFINE(HAVE_PID_T)
1741fi
1742
1743AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1744 AC_TRY_COMPILE(
1745 [
1746#include <sys/types.h>
1747 ],
1748 [ mode_t foo; foo = 1235; ],
1749 [ ac_cv_have_mode_t="yes" ],
1750 [ ac_cv_have_mode_t="no" ]
1751 )
1752])
1753if test "x$ac_cv_have_mode_t" = "xyes" ; then
1754 AC_DEFINE(HAVE_MODE_T)
1755fi
1756
Damien Miller61e50f12000-05-08 20:49:37 +10001757
1758AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1759 AC_TRY_COMPILE(
1760 [
Damien Miller81171112000-04-23 11:14:01 +10001761#include <sys/types.h>
1762#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001763 ],
1764 [ struct sockaddr_storage s; ],
1765 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1766 [ ac_cv_have_struct_sockaddr_storage="no" ]
1767 )
1768])
1769if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1770 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1771fi
Damien Miller34132e52000-01-14 15:45:46 +11001772
Damien Miller61e50f12000-05-08 20:49:37 +10001773AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1774 AC_TRY_COMPILE(
1775 [
Damien Miller7b22d652000-06-18 14:07:04 +10001776#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001777#include <netinet/in.h>
1778 ],
1779 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1780 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1781 [ ac_cv_have_struct_sockaddr_in6="no" ]
1782 )
1783])
1784if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1785 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1786fi
Damien Miller34132e52000-01-14 15:45:46 +11001787
Damien Miller61e50f12000-05-08 20:49:37 +10001788AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1789 AC_TRY_COMPILE(
1790 [
Damien Miller7b22d652000-06-18 14:07:04 +10001791#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001792#include <netinet/in.h>
1793 ],
1794 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1795 [ ac_cv_have_struct_in6_addr="yes" ],
1796 [ ac_cv_have_struct_in6_addr="no" ]
1797 )
1798])
1799if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1800 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1801fi
Damien Miller34132e52000-01-14 15:45:46 +11001802
Damien Miller61e50f12000-05-08 20:49:37 +10001803AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1804 AC_TRY_COMPILE(
1805 [
Damien Miller81171112000-04-23 11:14:01 +10001806#include <sys/types.h>
1807#include <sys/socket.h>
1808#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001809 ],
1810 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1811 [ ac_cv_have_struct_addrinfo="yes" ],
1812 [ ac_cv_have_struct_addrinfo="no" ]
1813 )
1814])
1815if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1816 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1817fi
1818
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001819AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1820 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11001821 [ #include <sys/time.h> ],
1822 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00001823 [ ac_cv_have_struct_timeval="yes" ],
1824 [ ac_cv_have_struct_timeval="no" ]
1825 )
1826])
1827if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1828 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1829 have_struct_timeval=1
1830fi
1831
Tim Rice4e4dc562003-03-18 10:21:40 -08001832AC_CHECK_TYPES(struct timespec)
1833
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001834# We need int64_t or else certian parts of the compile will fail.
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001835if test "x$ac_cv_have_int64_t" = "xno" -a \
1836 "x$ac_cv_sizeof_long_int" != "x8" -a \
1837 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00001838 echo "OpenSSH requires int64_t support. Contact your vendor or install"
1839 echo "an alternative compiler (I.E., GCC) before continuing."
1840 echo ""
1841 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08001842else
1843dnl test snprintf (broken on SCO w/gcc)
1844 AC_TRY_RUN(
1845 [
1846#include <stdio.h>
1847#include <string.h>
1848#ifdef HAVE_SNPRINTF
1849main()
1850{
1851 char buf[50];
1852 char expected_out[50];
1853 int mazsize = 50 ;
1854#if (SIZEOF_LONG_INT == 8)
1855 long int num = 0x7fffffffffffffff;
1856#else
Kevin Steves6482ec82001-07-15 02:09:28 +00001857 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08001858#endif
1859 strcpy(expected_out, "9223372036854775807");
1860 snprintf(buf, mazsize, "%lld", num);
1861 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11001862 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08001863 exit(0);
1864}
1865#else
1866main() { exit(0); }
1867#endif
1868 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1869 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001870fi
1871
Damien Miller78315eb2000-09-29 23:01:36 +11001872dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10001873OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1874OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1875OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1876OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1877OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10001878OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001879OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1880OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10001881OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10001882OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1883OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1884OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1885OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00001886OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1887OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1888OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1889OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07001890
1891AC_CHECK_MEMBERS([struct stat.st_blksize])
andre2ff7b5d2000-06-03 14:57:40 +00001892
Damien Miller61e50f12000-05-08 20:49:37 +10001893AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1894 ac_cv_have_ss_family_in_struct_ss, [
1895 AC_TRY_COMPILE(
1896 [
Damien Miller81171112000-04-23 11:14:01 +10001897#include <sys/types.h>
1898#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001899 ],
1900 [ struct sockaddr_storage s; s.ss_family = 1; ],
1901 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1902 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1903 )
1904])
1905if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1906 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1907fi
1908
Damien Miller61e50f12000-05-08 20:49:37 +10001909AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1910 ac_cv_have___ss_family_in_struct_ss, [
1911 AC_TRY_COMPILE(
1912 [
Damien Miller81171112000-04-23 11:14:01 +10001913#include <sys/types.h>
1914#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10001915 ],
1916 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1917 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1918 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1919 )
1920])
1921if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1922 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1923fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11001924
Damien Millerad833b32000-08-23 10:46:23 +10001925AC_CACHE_CHECK([for pw_class field in struct passwd],
1926 ac_cv_have_pw_class_in_struct_passwd, [
1927 AC_TRY_COMPILE(
1928 [
Damien Millerad833b32000-08-23 10:46:23 +10001929#include <pwd.h>
1930 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00001931 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10001932 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1933 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1934 )
1935])
1936if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1937 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1938fi
1939
Kevin Steves82456952001-06-22 21:14:18 +00001940AC_CACHE_CHECK([for pw_expire field in struct passwd],
1941 ac_cv_have_pw_expire_in_struct_passwd, [
1942 AC_TRY_COMPILE(
1943 [
1944#include <pwd.h>
1945 ],
1946 [ struct passwd p; p.pw_expire = 0; ],
1947 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1948 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1949 )
1950])
1951if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1952 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1953fi
1954
1955AC_CACHE_CHECK([for pw_change field in struct passwd],
1956 ac_cv_have_pw_change_in_struct_passwd, [
1957 AC_TRY_COMPILE(
1958 [
1959#include <pwd.h>
1960 ],
1961 [ struct passwd p; p.pw_change = 0; ],
1962 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1963 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1964 )
1965])
1966if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1967 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1968fi
Damien Miller61e50f12000-05-08 20:49:37 +10001969
Tim Rice28bbb0c2002-05-27 17:37:32 -07001970dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00001971AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1972 ac_cv_have_accrights_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001973 AC_TRY_RUN(
Kevin Steves939c9db2002-03-22 17:23:25 +00001974 [
Tim Riceae49fe62002-04-12 10:26:21 -07001975#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00001976#include <sys/socket.h>
1977#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07001978int main() {
1979#ifdef msg_accrights
1980exit(1);
1981#endif
1982struct msghdr m;
1983m.msg_accrights = 0;
1984exit(0);
1985}
Kevin Steves939c9db2002-03-22 17:23:25 +00001986 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00001987 [ ac_cv_have_accrights_in_msghdr="yes" ],
1988 [ ac_cv_have_accrights_in_msghdr="no" ]
1989 )
1990])
1991if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1992 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1993fi
1994
Kevin Stevesa44e0352002-04-07 16:18:03 +00001995AC_CACHE_CHECK([for msg_control field in struct msghdr],
1996 ac_cv_have_control_in_msghdr, [
Tim Rice28bbb0c2002-05-27 17:37:32 -07001997 AC_TRY_RUN(
Kevin Stevesa44e0352002-04-07 16:18:03 +00001998 [
Tim Riceae49fe62002-04-12 10:26:21 -07001999#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002000#include <sys/socket.h>
2001#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002002int main() {
2003#ifdef msg_control
2004exit(1);
2005#endif
2006struct msghdr m;
2007m.msg_control = 0;
2008exit(0);
2009}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002010 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002011 [ ac_cv_have_control_in_msghdr="yes" ],
2012 [ ac_cv_have_control_in_msghdr="no" ]
2013 )
2014])
2015if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2016 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
2017fi
2018
Damien Miller61e50f12000-05-08 20:49:37 +10002019AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002020 AC_TRY_LINK([],
2021 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002022 [ ac_cv_libc_defines___progname="yes" ],
2023 [ ac_cv_libc_defines___progname="no" ]
2024 )
2025])
2026if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2027 AC_DEFINE(HAVE___PROGNAME)
2028fi
2029
Kevin Steves4846f4a2002-03-22 18:19:53 +00002030AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2031 AC_TRY_LINK([
2032#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002033],
2034 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002035 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2036 [ ac_cv_cc_implements___FUNCTION__="no" ]
2037 )
2038])
2039if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2040 AC_DEFINE(HAVE___FUNCTION__)
2041fi
2042
2043AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2044 AC_TRY_LINK([
2045#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002046],
2047 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002048 [ ac_cv_cc_implements___func__="yes" ],
2049 [ ac_cv_cc_implements___func__="no" ]
2050 )
2051])
2052if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2053 AC_DEFINE(HAVE___func__)
2054fi
2055
Damien Miller4f8e6692001-07-14 13:22:53 +10002056AC_CACHE_CHECK([whether getopt has optreset support],
2057 ac_cv_have_getopt_optreset, [
2058 AC_TRY_LINK(
2059 [
2060#include <getopt.h>
2061 ],
2062 [ extern int optreset; optreset = 0; ],
2063 [ ac_cv_have_getopt_optreset="yes" ],
2064 [ ac_cv_have_getopt_optreset="no" ]
2065 )
2066])
2067if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2068 AC_DEFINE(HAVE_GETOPT_OPTRESET)
2069fi
Damien Millera22ba012000-03-02 23:09:20 +11002070
Damien Millerecbb26d2000-07-15 14:59:14 +10002071AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002072 AC_TRY_LINK([],
2073 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002074 [ ac_cv_libc_defines_sys_errlist="yes" ],
2075 [ ac_cv_libc_defines_sys_errlist="no" ]
2076 )
2077])
2078if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2079 AC_DEFINE(HAVE_SYS_ERRLIST)
2080fi
2081
2082
Damien Miller11fa2cc2000-08-16 10:35:58 +10002083AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002084 AC_TRY_LINK([],
2085 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002086 [ ac_cv_libc_defines_sys_nerr="yes" ],
2087 [ ac_cv_libc_defines_sys_nerr="no" ]
2088 )
2089])
2090if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2091 AC_DEFINE(HAVE_SYS_NERR)
2092fi
2093
Damien Millera8e06ce2003-11-21 23:48:55 +11002094SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002095# Check whether user wants sectok support
2096AC_ARG_WITH(sectok,
2097 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002098 [
2099 if test "x$withval" != "xno" ; then
2100 if test "x$withval" != "xyes" ; then
2101 CPPFLAGS="$CPPFLAGS -I${withval}"
2102 LDFLAGS="$LDFLAGS -L${withval}"
2103 if test ! -z "$need_dash_r" ; then
2104 LDFLAGS="$LDFLAGS -R${withval}"
2105 fi
2106 if test ! -z "$blibpath" ; then
2107 blibpath="$blibpath:${withval}"
2108 fi
2109 fi
2110 AC_CHECK_HEADERS(sectok.h)
2111 if test "$ac_cv_header_sectok_h" != yes; then
2112 AC_MSG_ERROR(Can't find sectok.h)
2113 fi
2114 AC_CHECK_LIB(sectok, sectok_open)
2115 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2116 AC_MSG_ERROR(Can't find libsectok)
2117 fi
2118 AC_DEFINE(SMARTCARD)
Ben Lindstroma42694f2002-04-05 16:11:45 +00002119 AC_DEFINE(USE_SECTOK)
Damien Millera8e06ce2003-11-21 23:48:55 +11002120 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002121 fi
2122 ]
2123)
2124
2125# Check whether user wants OpenSC support
2126AC_ARG_WITH(opensc,
Damien Millerf6195f22002-04-23 22:48:46 +10002127 AC_HELP_STRING([--with-opensc=PFX],
2128 [Enable smartcard support using OpenSC]),
2129 opensc_config_prefix="$withval", opensc_config_prefix="")
2130if test x$opensc_config_prefix != x ; then
2131 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
2132 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2133 if test "$OPENSC_CONFIG" != "no"; then
2134 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2135 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2136 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2137 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2138 AC_DEFINE(SMARTCARD)
2139 AC_DEFINE(USE_OPENSC)
Damien Millera8e06ce2003-11-21 23:48:55 +11002140 SCARD_MSG="yes, using OpenSC"
Damien Millerf6195f22002-04-23 22:48:46 +10002141 fi
2142fi
Damien Miller85de5802001-09-18 14:01:11 +10002143
Darren Tucker5f88d342003-10-15 16:57:57 +10002144# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002145AC_SEARCH_LIBS(getrrsetbyname, resolv,
Darren Tucker5f88d342003-10-15 16:57:57 +10002146 [AC_DEFINE(HAVE_GETRRSETBYNAME)],
Damien Miller7abe09b2003-05-15 10:53:49 +10002147 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002148 # Needed by our getrrsetbyname()
2149 AC_SEARCH_LIBS(res_query, resolv)
2150 AC_SEARCH_LIBS(dn_expand, resolv)
2151 AC_CHECK_FUNCS(_getshort _getlong)
2152 AC_CHECK_MEMBER(HEADER.ad,
2153 [AC_DEFINE(HAVE_HEADER_AD)],,
2154 [#include <arpa/nameser.h>])
2155 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002156
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002157# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002158KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002159AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002160 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002161 [ if test "x$withval" != "xno" ; then
2162 if test "x$withval" = "xyes" ; then
2163 KRB5ROOT="/usr/local"
2164 else
2165 KRB5ROOT=${withval}
2166 fi
2167
2168 AC_DEFINE(KRB5)
2169 KRB5_MSG="yes"
2170
2171 AC_MSG_CHECKING(for krb5-config)
2172 if test -x $KRB5ROOT/bin/krb5-config ; then
2173 KRB5CONF=$KRB5ROOT/bin/krb5-config
2174 AC_MSG_RESULT($KRB5CONF)
2175
2176 AC_MSG_CHECKING(for gssapi support)
2177 if $KRB5CONF | grep gssapi >/dev/null ; then
2178 AC_MSG_RESULT(yes)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002179 AC_DEFINE(GSSAPI)
2180 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002181 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002182 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002183 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002184 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002185 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2186 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002187 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002188 AC_MSG_CHECKING(whether we are using Heimdal)
2189 AC_TRY_COMPILE([ #include <krb5.h> ],
2190 [ char *tmp = heimdal_version; ],
2191 [ AC_MSG_RESULT(yes)
2192 AC_DEFINE(HEIMDAL) ],
2193 AC_MSG_RESULT(no)
2194 )
2195 else
2196 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002197 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002198 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002199 AC_MSG_CHECKING(whether we are using Heimdal)
2200 AC_TRY_COMPILE([ #include <krb5.h> ],
2201 [ char *tmp = heimdal_version; ],
2202 [ AC_MSG_RESULT(yes)
2203 AC_DEFINE(HEIMDAL)
2204 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
2205 ],
2206 [ AC_MSG_RESULT(no)
2207 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2208 ]
2209 )
Damien Miller200d0a72003-06-30 19:21:36 +10002210 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002211
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002212 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2213 [ AC_DEFINE(GSSAPI)
2214 K5LIBS="-lgssapi $K5LIBS" ],
2215 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2216 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002217 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002218 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2219 $K5LIBS)
2220 ],
2221 $K5LIBS)
2222
2223 AC_CHECK_HEADER(gssapi.h, ,
2224 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002225 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002226 AC_CHECK_HEADERS(gssapi.h, ,
2227 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002228 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002229 ]
2230 )
2231
2232 oldCPP="$CPPFLAGS"
2233 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2234 AC_CHECK_HEADER(gssapi_krb5.h, ,
2235 [ CPPFLAGS="$oldCPP" ])
2236
Damien Millera8e06ce2003-11-21 23:48:55 +11002237 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002238 if test ! -z "$need_dash_r" ; then
2239 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2240 fi
2241 if test ! -z "$blibpath" ; then
2242 blibpath="$blibpath:${KRB5ROOT}/lib"
2243 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002244 fi
2245
2246 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2247 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2248 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2249
2250 LIBS="$LIBS $K5LIBS"
2251 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS))
Ben Lindstroma8104b52004-04-07 04:16:11 +00002252 AC_SEARCH_LIBS(krb5_init_ets, $K5LIBS, AC_DEFINE(KRB5_INIT_ETS))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002253 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002254)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002255
Damien Millera22ba012000-03-02 23:09:20 +11002256# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002257
Damien Millerf58c6722002-05-13 13:15:42 +10002258PRIVSEP_PATH=/var/empty
2259AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002260 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002261 [
2262 if test "x$withval" != "$no" ; then
2263 PRIVSEP_PATH=$withval
2264 fi
2265 ]
2266)
2267AC_SUBST(PRIVSEP_PATH)
2268
Damien Millera22ba012000-03-02 23:09:20 +11002269AC_ARG_WITH(xauth,
2270 [ --with-xauth=PATH Specify path to xauth program ],
2271 [
Ben Lindstrom76020ba2000-10-25 16:55:00 +00002272 if test "x$withval" != "xno" ; then
Damien Miller7b22d652000-06-18 14:07:04 +10002273 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11002274 fi
2275 ],
2276 [
Tim Ricee22be3b2002-07-17 19:20:07 -07002277 TestPath="$PATH"
2278 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
2279 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
2280 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
2281 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
2282 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10002283 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11002284 xauth_path="/usr/openwin/bin/xauth"
2285 fi
2286 ]
2287)
2288
Damien Miller7d901272003-01-13 16:55:22 +11002289STRIP_OPT=-s
2290AC_ARG_ENABLE(strip,
2291 [ --disable-strip Disable calling strip(1) on install],
2292 [
2293 if test "x$enableval" = "xno" ; then
2294 STRIP_OPT=
2295 fi
2296 ]
2297)
2298AC_SUBST(STRIP_OPT)
2299
Damien Millera19cf472000-11-29 13:28:50 +11002300if test -z "$xauth_path" ; then
2301 XAUTH_PATH="undefined"
2302 AC_SUBST(XAUTH_PATH)
2303else
Damien Millera22ba012000-03-02 23:09:20 +11002304 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
Damien Millera19cf472000-11-29 13:28:50 +11002305 XAUTH_PATH=$xauth_path
2306 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11002307fi
Damien Millera22ba012000-03-02 23:09:20 +11002308
2309# Check for mail directory (last resort if we cannot get it from headers)
2310if test ! -z "$MAIL" ; then
2311 maildir=`dirname $MAIL`
2312 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
2313fi
2314
Damien Millera22ba012000-03-02 23:09:20 +11002315if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002316 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002317 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00002318 [
2319 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
2320 have_dev_ptmx=1
2321 ]
2322 )
2323 fi
Damien Millera22ba012000-03-02 23:09:20 +11002324fi
Damien Millera8e06ce2003-11-21 23:48:55 +11002325AC_CHECK_FILE("/dev/ptc",
Damien Miller204ad072000-03-02 23:56:12 +11002326 [
2327 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
2328 have_dev_ptc=1
2329 ]
2330)
2331
Damien Millera22ba012000-03-02 23:09:20 +11002332# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00002333AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10002334 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11002335 [
Damien Miller897741e2001-04-16 10:41:46 +10002336 case "$withval" in
2337 man|cat|doc)
2338 MANTYPE=$withval
2339 ;;
2340 *)
2341 AC_MSG_ERROR(invalid man type: $withval)
2342 ;;
2343 esac
Damien Miller670a4b82000-01-22 13:53:11 +11002344 ]
2345)
Ben Lindstrombc709922001-04-18 18:04:21 +00002346if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07002347 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2348 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00002349 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2350 MANTYPE=doc
2351 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2352 MANTYPE=man
2353 else
2354 MANTYPE=cat
2355 fi
2356fi
Damien Miller670a4b82000-01-22 13:53:11 +11002357AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00002358if test "$MANTYPE" = "doc"; then
2359 mansubdir=man;
2360else
2361 mansubdir=$MANTYPE;
2362fi
2363AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11002364
Damien Millera22ba012000-03-02 23:09:20 +11002365# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11002366MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11002367AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002368 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11002369 [
Damien Millerb85dcad2000-03-11 11:37:00 +11002370 if test "x$withval" != "xno" ; then
Damien Miller8bdeee21999-12-30 15:50:54 +11002371 AC_DEFINE(HAVE_MD5_PASSWORDS)
Damien Millera8e06ce2003-11-21 23:48:55 +11002372 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11002373 fi
2374 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11002375)
2376
Damien Millera22ba012000-03-02 23:09:20 +11002377# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11002378AC_ARG_WITH(shadow,
2379 [ --without-shadow Disable shadow password support],
2380 [
2381 if test "x$withval" = "xno" ; then
2382 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10002383 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11002384 fi
2385 ]
2386)
2387
Damien Miller1f335fb2000-06-26 11:31:33 +10002388if test -z "$disable_shadow" ; then
2389 AC_MSG_CHECKING([if the systems has expire shadow information])
2390 AC_TRY_COMPILE(
2391 [
2392#include <sys/types.h>
2393#include <shadow.h>
2394 struct spwd sp;
2395 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2396 [ sp_expire_available=yes ], []
2397 )
2398
2399 if test "x$sp_expire_available" = "xyes" ; then
2400 AC_MSG_RESULT(yes)
2401 AC_DEFINE(HAS_SHADOW_EXPIRE)
2402 else
2403 AC_MSG_RESULT(no)
2404 fi
2405fi
2406
Damien Millera22ba012000-03-02 23:09:20 +11002407# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11002408if test ! -z "$IPADDR_IN_DISPLAY" ; then
2409 DISPLAY_HACK_MSG="yes"
2410 AC_DEFINE(IPADDR_IN_DISPLAY)
2411else
Damien Millera8e06ce2003-11-21 23:48:55 +11002412 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11002413 AC_ARG_WITH(ipaddr-display,
2414 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2415 [
2416 if test "x$withval" != "xno" ; then
2417 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11002418 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11002419 fi
2420 ]
2421 )
2422fi
Damien Miller76112de1999-12-21 11:18:08 +11002423
Darren Tuckere1a790d2003-09-16 11:52:19 +10002424# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002425AC_ARG_ENABLE(etc-default-login,
2426 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],,
2427[
Darren Tuckere1a790d2003-09-16 11:52:19 +10002428AC_CHECK_FILE("/etc/default/login", [ external_path_file=/etc/default/login ])
2429
2430if test "x$external_path_file" = "x/etc/default/login"; then
2431 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN)
2432fi
Tim Rice7ff4e6d2003-09-22 19:50:14 -07002433])
Darren Tuckere1a790d2003-09-16 11:52:19 +10002434
Tim Rice43a1c132002-04-17 21:19:14 -07002435dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2436if test $ac_cv_func_login_getcapbool = "yes" -a \
2437 $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002438 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07002439fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10002440
Damien Millera22ba012000-03-02 23:09:20 +11002441# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11002442SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11002443AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10002444 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11002445 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10002446 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002447 AC_MSG_WARN([
2448--with-default-path=PATH has no effect on this system.
2449Edit /etc/login.conf instead.])
2450 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07002451 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002452 AC_MSG_WARN([
2453--with-default-path=PATH will only be used if PATH is not defined in
2454$external_path_file .])
2455 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002456 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11002457 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11002458 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08002459 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10002460 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
2461 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07002462 else
Tim Riceb925b4b2003-09-15 22:40:49 -07002463 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002464 AC_MSG_WARN([
2465If PATH is defined in $external_path_file, ensure the path to scp is included,
2466otherwise scp will not work.])
2467 fi
2468 AC_TRY_RUN(
2469 [
Tim Rice59ea0a02001-03-10 13:50:45 -08002470/* find out what STDPATH is */
2471#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08002472#ifdef HAVE_PATHS_H
2473# include <paths.h>
2474#endif
2475#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08002476# ifdef _PATH_USERPATH /* Irix */
2477# define _PATH_STDPATH _PATH_USERPATH
2478# else
2479# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2480# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08002481#endif
2482#include <sys/types.h>
2483#include <sys/stat.h>
2484#include <fcntl.h>
2485#define DATA "conftest.stdpath"
2486
2487main()
2488{
2489 FILE *fd;
2490 int rc;
2491
2492 fd = fopen(DATA,"w");
2493 if(fd == NULL)
2494 exit(1);
2495
2496 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2497 exit(1);
2498
2499 exit(0);
2500}
2501 ], [ user_path=`cat conftest.stdpath` ],
2502 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2503 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2504 )
2505# make sure $bindir is in USER_PATH so scp will work
2506 t_bindir=`eval echo ${bindir}`
2507 case $t_bindir in
2508 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2509 esac
2510 case $t_bindir in
2511 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2512 esac
2513 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2514 if test $? -ne 0 ; then
2515 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2516 if test $? -ne 0 ; then
2517 user_path=$user_path:$t_bindir
2518 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2519 fi
2520 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002521 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11002522)
Darren Tuckere1a790d2003-09-16 11:52:19 +10002523if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07002524 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2525 AC_SUBST(user_path)
2526fi
Damien Miller5a3e6831999-12-27 09:48:56 +11002527
Damien Millera18bbd32002-05-13 10:48:57 +10002528# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10002529AC_ARG_WITH(superuser-path,
2530 [ --with-superuser-path= Specify different path for super-user],
2531 [
2532 if test "x$withval" != "xno" ; then
2533 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2534 superuser_path=$withval
2535 fi
2536 ]
2537)
2538
2539
Damien Miller61e50f12000-05-08 20:49:37 +10002540AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11002541IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11002542AC_ARG_WITH(4in6,
2543 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2544 [
2545 if test "x$withval" != "xno" ; then
2546 AC_MSG_RESULT(yes)
2547 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002548 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002549 else
2550 AC_MSG_RESULT(no)
2551 fi
2552 ],[
2553 if test "x$inet6_default_4in6" = "xyes"; then
2554 AC_MSG_RESULT([yes (default)])
2555 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11002556 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11002557 else
2558 AC_MSG_RESULT([no (default)])
2559 fi
2560 ]
2561)
2562
Damien Miller60396b02001-02-18 17:01:00 +11002563# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11002564BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11002565AC_ARG_WITH(bsd-auth,
2566 [ --with-bsd-auth Enable BSD auth support],
2567 [
2568 if test "x$withval" != "xno" ; then
2569 AC_DEFINE(BSD_AUTH)
Damien Miller6c21c512002-01-22 21:57:53 +11002570 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11002571 fi
2572 ]
2573)
2574
Damien Millera22ba012000-03-02 23:09:20 +11002575# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11002576piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11002577# make sure the directory exists
2578if test ! -d $piddir ; then
2579 piddir=`eval echo ${sysconfdir}`
2580 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11002581 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11002582 esac
2583fi
2584
Tim Rice88f2ab52002-03-17 12:17:34 -08002585AC_ARG_WITH(pid-dir,
2586 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2587 [
2588 if test "x$withval" != "xno" ; then
2589 piddir=$withval
2590 if test ! -d $piddir ; then
2591 AC_MSG_WARN([** no $piddir directory on this system **])
2592 fi
2593 fi
2594 ]
2595)
2596
Ben Lindstrom226cfa02001-01-22 05:34:40 +00002597AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
Damien Millerb13c73e2000-01-17 22:02:17 +11002598AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11002599
andre2ff7b5d2000-06-03 14:57:40 +00002600dnl allow user to disable some login recording features
2601AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002602 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002603 [
2604 if test "x$enableval" = "xno" ; then
2605 AC_DEFINE(DISABLE_LASTLOG)
2606 fi
2607 ]
andre2ff7b5d2000-06-03 14:57:40 +00002608)
2609AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00002610 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002611 [
2612 if test "x$enableval" = "xno" ; then
2613 AC_DEFINE(DISABLE_UTMP)
2614 fi
2615 ]
andre2ff7b5d2000-06-03 14:57:40 +00002616)
2617AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00002618 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002619 [
2620 if test "x$enableval" = "xno" ; then
2621 AC_DEFINE(DISABLE_UTMPX)
2622 fi
2623 ]
andre2ff7b5d2000-06-03 14:57:40 +00002624)
2625AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00002626 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002627 [
2628 if test "x$enableval" = "xno" ; then
2629 AC_DEFINE(DISABLE_WTMP)
2630 fi
2631 ]
andre2ff7b5d2000-06-03 14:57:40 +00002632)
2633AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00002634 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002635 [
2636 if test "x$enableval" = "xno" ; then
2637 AC_DEFINE(DISABLE_WTMPX)
2638 fi
2639 ]
andre2ff7b5d2000-06-03 14:57:40 +00002640)
2641AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00002642 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002643 [
2644 if test "x$enableval" = "xno" ; then
2645 AC_DEFINE(DISABLE_LOGIN)
2646 fi
2647 ]
andre2ff7b5d2000-06-03 14:57:40 +00002648)
2649AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00002650 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002651 [
2652 if test "x$enableval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002653 AC_DEFINE(DISABLE_PUTUTLINE)
Darren Tuckera3020db2003-06-28 12:54:33 +10002654 fi
2655 ]
andre2ff7b5d2000-06-03 14:57:40 +00002656)
2657AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00002658 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10002659 [
2660 if test "x$enableval" = "xno" ; then
2661 AC_DEFINE(DISABLE_PUTUTXLINE)
2662 fi
2663 ]
andre2ff7b5d2000-06-03 14:57:40 +00002664)
2665AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00002666 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11002667 [
2668 if test "x$withval" = "xno" ; then
2669 AC_DEFINE(DISABLE_LASTLOG)
2670 else
2671 conf_lastlog_location=$withval
2672 fi
2673 ]
2674)
andre2ff7b5d2000-06-03 14:57:40 +00002675
2676dnl lastlog, [uw]tmpx? detection
2677dnl NOTE: set the paths in the platform section to avoid the
2678dnl need for command-line parameters
2679dnl lastlog and [uw]tmp are subject to a file search if all else fails
2680
2681dnl lastlog detection
2682dnl NOTE: the code itself will detect if lastlog is a directory
2683AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2684AC_TRY_COMPILE([
2685#include <sys/types.h>
2686#include <utmp.h>
2687#ifdef HAVE_LASTLOG_H
2688# include <lastlog.h>
2689#endif
Damien Miller2994e082000-06-04 15:51:47 +10002690#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002691# include <paths.h>
2692#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002693#ifdef HAVE_LOGIN_H
2694# include <login.h>
2695#endif
andre2ff7b5d2000-06-03 14:57:40 +00002696 ],
2697 [ char *lastlog = LASTLOG_FILE; ],
2698 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10002699 [
2700 AC_MSG_RESULT(no)
2701 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2702 AC_TRY_COMPILE([
2703#include <sys/types.h>
2704#include <utmp.h>
2705#ifdef HAVE_LASTLOG_H
2706# include <lastlog.h>
2707#endif
2708#ifdef HAVE_PATHS_H
2709# include <paths.h>
2710#endif
2711 ],
2712 [ char *lastlog = _PATH_LASTLOG; ],
2713 [ AC_MSG_RESULT(yes) ],
2714 [
andree441aa32000-06-12 22:34:38 +00002715 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10002716 system_lastlog_path=no
2717 ])
2718 ]
andre2ff7b5d2000-06-03 14:57:40 +00002719)
Damien Miller2994e082000-06-04 15:51:47 +10002720
andre2ff7b5d2000-06-03 14:57:40 +00002721if test -z "$conf_lastlog_location"; then
2722 if test x"$system_lastlog_path" = x"no" ; then
2723 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10002724 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00002725 conf_lastlog_location=$f
2726 fi
2727 done
2728 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00002729 AC_MSG_WARN([** Cannot find lastlog **])
2730 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00002731 fi
2732 fi
2733fi
2734
2735if test -n "$conf_lastlog_location"; then
2736 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2737fi
2738
2739dnl utmp detection
2740AC_MSG_CHECKING([if your system defines UTMP_FILE])
2741AC_TRY_COMPILE([
2742#include <sys/types.h>
2743#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002744#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002745# include <paths.h>
2746#endif
2747 ],
2748 [ char *utmp = UTMP_FILE; ],
2749 [ AC_MSG_RESULT(yes) ],
2750 [ AC_MSG_RESULT(no)
2751 system_utmp_path=no ]
2752)
2753if test -z "$conf_utmp_location"; then
2754 if test x"$system_utmp_path" = x"no" ; then
2755 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2756 if test -f $f ; then
2757 conf_utmp_location=$f
2758 fi
2759 done
2760 if test -z "$conf_utmp_location"; then
2761 AC_DEFINE(DISABLE_UTMP)
2762 fi
2763 fi
2764fi
2765if test -n "$conf_utmp_location"; then
2766 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2767fi
2768
2769dnl wtmp detection
2770AC_MSG_CHECKING([if your system defines WTMP_FILE])
2771AC_TRY_COMPILE([
2772#include <sys/types.h>
2773#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10002774#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002775# include <paths.h>
2776#endif
2777 ],
2778 [ char *wtmp = WTMP_FILE; ],
2779 [ AC_MSG_RESULT(yes) ],
2780 [ AC_MSG_RESULT(no)
2781 system_wtmp_path=no ]
2782)
2783if test -z "$conf_wtmp_location"; then
2784 if test x"$system_wtmp_path" = x"no" ; then
2785 for f in /usr/adm/wtmp /var/log/wtmp; do
2786 if test -f $f ; then
2787 conf_wtmp_location=$f
2788 fi
2789 done
2790 if test -z "$conf_wtmp_location"; then
2791 AC_DEFINE(DISABLE_WTMP)
2792 fi
2793 fi
2794fi
2795if test -n "$conf_wtmp_location"; then
2796 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2797fi
2798
2799
2800dnl utmpx detection - I don't know any system so perverse as to require
2801dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2802dnl there, though.
2803AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2804AC_TRY_COMPILE([
2805#include <sys/types.h>
2806#include <utmp.h>
2807#ifdef HAVE_UTMPX_H
2808#include <utmpx.h>
2809#endif
Damien Miller2994e082000-06-04 15:51:47 +10002810#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002811# include <paths.h>
2812#endif
2813 ],
2814 [ char *utmpx = UTMPX_FILE; ],
2815 [ AC_MSG_RESULT(yes) ],
2816 [ AC_MSG_RESULT(no)
2817 system_utmpx_path=no ]
2818)
2819if test -z "$conf_utmpx_location"; then
2820 if test x"$system_utmpx_path" = x"no" ; then
2821 AC_DEFINE(DISABLE_UTMPX)
2822 fi
2823else
2824 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2825fi
2826
2827dnl wtmpx detection
2828AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2829AC_TRY_COMPILE([
2830#include <sys/types.h>
2831#include <utmp.h>
2832#ifdef HAVE_UTMPX_H
2833#include <utmpx.h>
2834#endif
Damien Miller2994e082000-06-04 15:51:47 +10002835#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00002836# include <paths.h>
2837#endif
2838 ],
2839 [ char *wtmpx = WTMPX_FILE; ],
2840 [ AC_MSG_RESULT(yes) ],
2841 [ AC_MSG_RESULT(no)
2842 system_wtmpx_path=no ]
2843)
2844if test -z "$conf_wtmpx_location"; then
2845 if test x"$system_wtmpx_path" = x"no" ; then
2846 AC_DEFINE(DISABLE_WTMPX)
2847 fi
2848else
2849 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2850fi
2851
Damien Miller4018c192000-04-30 09:30:44 +10002852
Damien Miller29ea30d2000-03-17 10:54:15 +11002853if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10002854 LDFLAGS="$LDFLAGS $blibflags$blibpath"
2855 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11002856fi
2857
Tim Rice4cec93f2002-02-26 08:40:48 -08002858dnl remove pam and dl because they are in $LIBPAM
2859if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08002860 LIBS=`echo $LIBS | sed 's/-lpam //'`
2861fi
2862if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2863 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08002864fi
2865
Damien Millerbac2d8a2000-09-05 16:13:06 +11002866AC_EXEEXT
Tim Rice13aae5e2001-10-21 17:53:58 -07002867AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2868AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10002869
Damien Miller7b22d652000-06-18 14:07:04 +10002870# Print summary of options
2871
Damien Miller7b22d652000-06-18 14:07:04 +10002872# Someone please show me a better way :)
2873A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2874B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2875C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2876D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00002877E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00002878F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10002879G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10002880H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2881I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2882J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10002883
2884echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00002885echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10002886echo " User binaries: $B"
2887echo " System binaries: $C"
2888echo " Configuration files: $D"
2889echo " Askpass program: $E"
2890echo " Manual pages: $F"
2891echo " PID file: $G"
2892echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10002893if test "x$external_path_file" = "x/etc/login.conf" ; then
2894echo " At runtime, sshd will use the path defined in $external_path_file"
2895echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07002896else
Damien Millerf58c6722002-05-13 13:15:42 +10002897echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07002898 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10002899echo " (If PATH is set in $external_path_file it will be used instead. If"
2900echo " used, ensure the path to scp is present, otherwise scp will not work.)"
2901 fi
Tim Rice43a1c132002-04-17 21:19:14 -07002902fi
Damien Millera18bbd32002-05-13 10:48:57 +10002903if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002904echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10002905fi
Damien Millerf58c6722002-05-13 13:15:42 +10002906echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10002907echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002908echo " KerberosV support: $KRB5_MSG"
2909echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002910echo " S/KEY support: $SKEY_MSG"
2911echo " TCP Wrappers support: $TCPW_MSG"
2912echo " MD5 password support: $MD5_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10002913echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10002914echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2915echo " BSD Auth support: $BSD_AUTH_MSG"
2916echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11002917if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10002918echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11002919fi
2920
Damien Miller7b22d652000-06-18 14:07:04 +10002921echo ""
2922
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00002923echo " Host: ${host}"
2924echo " Compiler: ${CC}"
2925echo " Compiler flags: ${CFLAGS}"
2926echo "Preprocessor flags: ${CPPFLAGS}"
2927echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08002928echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10002929
2930echo ""
2931
Damien Miller82cf0ce2000-12-20 13:34:48 +11002932if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002933 echo "PAM is enabled. You may need to install a PAM control file "
2934 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11002935 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11002936 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11002937 echo ""
2938fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002939
Damien Miller6c21c512002-01-22 21:57:53 +11002940if test ! -z "$RAND_HELPER_CMDHASH" ; then
2941 echo "WARNING: you are using the builtin random number collection "
2942 echo "service. Please read WARNING.RNG and request that your OS "
2943 echo "vendor includes kernel-based random number collection in "
2944 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002945 echo ""
2946fi
Damien Miller60396b02001-02-18 17:01:00 +11002947