blob: 259b5c288e18f6dc080c5523cd703fbda821f23b [file] [log] [blame]
Darren Tucker9afe1152006-06-23 21:24:12 +10001# $Id: configure.ac,v 1.341 2006/06/23 11:24:13 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
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Darren Tucker9afe1152006-06-23 21:24:12 +100018AC_REVISION($Revision: 1.341 $)
Tim Rice13aae5e2001-10-21 17:53:58 -070019AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100020
21AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110022AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110023AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110024AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100025
Damien Millera22ba012000-03-02 23:09:20 +110026# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100027AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110028AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100029AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110030AC_PROG_INSTALL
Tim Ricefd80ddc2006-02-02 19:11:56 -080031AC_PROG_EGREP
Ben Lindstrom582d3982001-02-06 22:54:30 +000032AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070033AC_PATH_PROG(CAT, cat)
34AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070035AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080036AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110037AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100038AC_PATH_PROG(ENT, ent)
39AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110040AC_PATH_PROG(TEST_MINUS_S_SH, bash)
41AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
42AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070043AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070044AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110045
Tim Rice6f1f7582004-05-30 21:38:51 -070046dnl for buildpkg.sh
47AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
50 [/usr/sbin${PATH_SEPARATOR}/etc])
51AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
Darren Tuckerfbea7642006-01-30 00:22:39 +110052if test -x /sbin/sh; then
53 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
54else
55 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
56fi
Tim Rice6f1f7582004-05-30 21:38:51 -070057
Damien Millere8bb4502001-09-25 16:39:35 +100058# System features
59AC_SYS_LARGEFILE
60
Damien Miller3f62aba2000-11-29 11:56:35 +110061if test -z "$AR" ; then
62 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
63fi
64
Damien Millerad833b32000-08-23 10:46:23 +100065# Use LOGIN_PROGRAM from environment if possible
66if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070067 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
68 [If your header files don't define LOGIN_PROGRAM,
69 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100070else
71 # Search for login
72 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
73 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
74 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
75 fi
76fi
77
Darren Tucker23bc8d02004-02-06 16:24:31 +110078AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
79if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070080 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
81 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110082fi
83
Damien Miller166bd442000-03-16 10:48:25 +110084if test -z "$LD" ; then
85 LD=$CC
86fi
87AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080088
Damien Miller166bd442000-03-16 10:48:25 +110089AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100090
91AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
92
Damien Millera8e06ce2003-11-21 23:48:55 +110093if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100094 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Darren Tucker3f9545e2005-11-12 15:20:52 +110095 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -070096 case $GCC_VER in
97 1.*) ;;
98 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
99 2.*) ;;
Darren Tuckerb0288092005-11-10 14:46:48 +1100100 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100101 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
102 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700103 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +1000104
Darren Tucker67b37032005-06-03 17:58:31 +1000105 if test -z "$have_llong_max"; then
106 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
107 unset ac_cv_have_decl_LLONG_MAX
108 saved_CFLAGS="$CFLAGS"
109 CFLAGS="$CFLAGS -std=gnu99"
110 AC_CHECK_DECL(LLONG_MAX,
111 [have_llong_max=1],
112 [CFLAGS="$saved_CFLAGS"],
113 [#include <limits.h>]
114 )
115 fi
Damien Miller166bd442000-03-16 10:48:25 +1100116fi
117
Tim Rice88368a32003-12-08 12:35:59 -0800118AC_ARG_WITH(rpath,
119 [ --without-rpath Disable auto-added -R linker paths],
120 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800121 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800122 need_dash_r=""
123 fi
124 if test "x$withval" = "xyes" ; then
125 need_dash_r=1
126 fi
127 ]
128)
129
Damien Millera22ba012000-03-02 23:09:20 +1100130# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100131case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100132*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100133 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000134 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800135 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100136 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000137 saved_LDFLAGS="$LDFLAGS"
138 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
139 if (test -z "$blibflags"); then
140 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
141 AC_TRY_LINK([], [], [blibflags=$tryflags])
142 fi
143 done
144 if (test -z "$blibflags"); then
145 AC_MSG_RESULT(not found)
146 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
147 else
148 AC_MSG_RESULT($blibflags)
149 fi
150 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000151 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700152 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
153 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700154 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000155 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700156 LIBS="$LIBS -ls"
157 ])
158 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100159 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100160 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100161 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000162 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100163 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000164 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
165 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000166 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000167 [(void)loginfailed("user","host","tty",0);],
168 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700169 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
170 [Define if your AIX loginfailed() function
171 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000172 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000173 )],
174 [],
175 [#include <usersec.h>]
176 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000177 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100178 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700179 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
180 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
181 [Define if your platform breaks doing a seteuid before a setuid])
182 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
183 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000184 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700185 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
186 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
187 [Some systems need a utmpx entry for /bin/login to work])
188 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
189 [Define to a Set Process Title type if your system is
190 supported by bsd-setproctitle.c])
Darren Tucker91d25a02005-11-26 22:24:09 +1100191 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
192 [AIX 5.2 and 5.3 (and presumably newer) require this])
Darren Tucker9afe1152006-06-23 21:24:12 +1000193 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
Damien Miller75b1d102000-01-07 14:01:41 +1100194 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100195*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100196 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800197 LIBS="$LIBS /usr/lib/textmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700198 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
199 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
200 AC_DEFINE(DISABLE_SHADOW, 1,
201 [Define if you want to disable shadow passwords])
202 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
203 [Define if your system choked on IP TOS setting])
204 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
205 [Define if X11 doesn't support AF_UNIX sockets on that system])
206 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
207 [Define if the concept of ports only accessible to
208 superusers isn't known])
209 AC_DEFINE(DISABLE_FD_PASSING, 1,
210 [Define if your platform needs to skip post auth
211 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100212 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000213*-*-dgux*)
214 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100215 AC_DEFINE(SETEUID_BREAKS_SETUID)
216 AC_DEFINE(BROKEN_SETREUID)
217 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000218 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000219*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000220 AC_MSG_CHECKING(if we have working getaddrinfo)
221 AC_TRY_RUN([#include <mach-o/dyld.h>
222main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
223 exit(0);
224 else
225 exit(1);
226}], [AC_MSG_RESULT(working)],
227 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700228 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700229 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000230 AC_DEFINE(SETEUID_BREAKS_SETUID)
231 AC_DEFINE(BROKEN_SETREUID)
232 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700233 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
234 [Define if your resolver libs need this for getrrsetbyname])
Darren Tucker3eb48342006-06-23 21:05:12 +1000235 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
236 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
237 [Use tunnel device compatibility to OpenBSD])
238 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
239 [Prepend the address family to IP tunnel traffic])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000240 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000241*-*-hpux*)
242 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000243 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100244 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000245 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700246 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
247 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000248 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700249 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
250 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000251 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000252 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700253 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000254 AC_CHECK_LIB(xnet, t_error, ,
255 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
256
257 # next, we define all of the options specific to major releases
258 case "$host" in
259 *-*-hpux10*)
260 if test -z "$GCC"; then
261 CFLAGS="$CFLAGS -Ae"
262 fi
263 ;;
264 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700265 AC_DEFINE(PAM_SUN_CODEBASE, 1,
266 [Define if you are using Solaris-derived PAM which
267 passes pam_messages to the conversation function
268 with an extra level of indirection])
269 AC_DEFINE(DISABLE_UTMP, 1,
270 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000271 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
272 check_for_hpux_broken_getaddrinfo=1
273 check_for_conflicting_getspnam=1
274 ;;
275 esac
276
277 # lastly, we define options specific to minor releases
278 case "$host" in
279 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700280 AC_DEFINE(HAVE_SECUREWARE, 1,
281 [Define if you have SecureWare-based
282 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000283 disable_ptmx_check=yes
284 LIBS="$LIBS -lsecpw"
285 ;;
286 esac
Damien Miller1bead332000-04-30 00:47:29 +1000287 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100288*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100289 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700290 AC_DEFINE(BROKEN_INET_NTOA, 1,
291 [Define if you system's inet_ntoa is busted
292 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000293 AC_DEFINE(SETEUID_BREAKS_SETUID)
294 AC_DEFINE(BROKEN_SETREUID)
295 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700296 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
297 [Define if you shouldn't strip 'tty' from your
298 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000299 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100300 ;;
301*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100302 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700303 AC_DEFINE(WITH_IRIX_ARRAY, 1,
304 [Define if you have/want arrays
305 (cluster-wide session managment, not C arrays)])
306 AC_DEFINE(WITH_IRIX_PROJECT, 1,
307 [Define if you want IRIX project management])
308 AC_DEFINE(WITH_IRIX_AUDIT, 1,
309 [Define if you want IRIX audit trails])
310 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
311 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000312 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000313 AC_DEFINE(SETEUID_BREAKS_SETUID)
314 AC_DEFINE(BROKEN_SETREUID)
315 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700316 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000317 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000318 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100319 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100320*-*-linux*)
321 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100322 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000323 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700324 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
325 AC_DEFINE(PAM_TTY_KLUDGE, 1,
326 [Work around problematic Linux PAM modules handling of PAM_TTY])
327 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
328 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000329 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700330 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
331 [Define to whatever link() returns for "not supported"
332 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100333 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700334 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100335 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000336 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000337 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700338 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
339 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000340 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000341 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100342 # tun(4) forwarding compat code
Damien Millerc4bcc912005-12-31 17:05:58 +1100343 AC_CHECK_HEADERS(linux/if_tun.h)
Damien Millerbd4e4102006-01-01 21:03:30 +1100344 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Damien Miller89e03ba2005-12-31 16:42:03 +1100345 AC_DEFINE(SSH_TUN_LINUX, 1,
346 [Open tunnel devices the Linux tun/tap way])
347 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
348 [Use tunnel device compatibility to OpenBSD])
349 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
350 [Prepend the address family to IP tunnel traffic])
351 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100352 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000353mips-sony-bsd|mips-sony-newsos4)
Darren Tucker988b3fd2006-02-08 22:11:27 +1100354 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000355 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000356 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100357*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000358 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800359 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800360 need_dash_r=1
361 fi
Damien Miller2dcddbf2006-01-01 19:47:05 +1100362 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
363 AC_CHECK_HEADER([net/if_tap.h], ,
364 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
365 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
366 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100367 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100368*-*-freebsd*)
369 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000370 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100371 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
372 AC_CHECK_HEADER([net/if_tap.h], ,
373 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
Damien Millerfbd884a2001-02-27 08:39:07 +1100374 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000375*-*-bsdi*)
376 AC_DEFINE(SETEUID_BREAKS_SETUID)
377 AC_DEFINE(BROKEN_SETREUID)
378 AC_DEFINE(BROKEN_SETREGID)
379 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000380*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000381 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100382 conf_utmp_location=/etc/utmp
383 conf_wtmp_location=/usr/adm/wtmp
384 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700385 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000386 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000387 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700388 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000389 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000390*-*-openbsd*)
391 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000392 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100393 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
Darren Tucker4a422572005-07-14 17:22:11 +1000394 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100395*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800396 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800397 need_dash_r=1
398 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100399 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000400 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700401 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
402 [Some versions of /bin/login need the TERM supplied
403 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000404 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700405 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
406 [Define if pam_chauthtok wants real uid set
407 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000408 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000409 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700410 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
411 [Define if sshd somehow reacquires a controlling TTY
412 after setsid()])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000413 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000414 # hardwire lastlog location (can't detect it on some versions)
415 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000416 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
417 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
418 if test "$sol2ver" -ge 8; then
419 AC_MSG_RESULT(yes)
420 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700421 AC_DEFINE(DISABLE_WTMP, 1,
422 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000423 else
424 AC_MSG_RESULT(no)
425 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100426 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000427*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000428 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000429 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100430 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000431 conf_utmp_location=/etc/utmp
432 conf_wtmp_location=/var/adm/wtmp
433 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000434 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000435 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000436*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700437 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000438 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000439 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000440 AC_DEFINE(SETEUID_BREAKS_SETUID)
441 AC_DEFINE(BROKEN_SETREUID)
442 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000443 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000444*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700445 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000446 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100447 # -lresolv needs to be at the end of LIBS or DNS lookups break
448 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100449 IPADDR_IN_DISPLAY=yes
450 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000451 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000452 AC_DEFINE(SETEUID_BREAKS_SETUID)
453 AC_DEFINE(BROKEN_SETREUID)
454 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000455 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000456 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700457 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
458 # Attention: always take care to bind libsocket and libnsl before libc,
459 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000460 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800461# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100462*-*-sysv4.2*)
Damien Miller57f39152005-11-24 19:58:19 +1100463 CFLAGS="$CFLAGS -Dva_list=_VA_LIST"
Damien Miller5dfe9762001-02-16 12:05:39 +1100464 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700465 AC_DEFINE(SETEUID_BREAKS_SETUID)
466 AC_DEFINE(BROKEN_SETREUID)
467 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700468 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice46259d82005-11-28 18:40:34 -0800469 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller78315eb2000-09-29 23:01:36 +1100470 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800471# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100472*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700473 check_for_libcrypt_later=1
474 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100475 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700476 AC_DEFINE(SETEUID_BREAKS_SETUID)
477 AC_DEFINE(BROKEN_SETREUID)
478 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700479 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700480 case "$host" in
481 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
482 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700483 AC_DEFINE(BROKEN_LIBIAF, 1,
484 [ia_uinfo routines not supported by OS yet])
Tim Rice4dbacff2005-06-01 20:09:28 -0700485 ;;
Tim Rice46259d82005-11-28 18:40:34 -0800486 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
487 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700488 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100489 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100490*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100491 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800492# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100493*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800494 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100495 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800496# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100497*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800498 if test -z "$GCC"; then
499 CFLAGS="$CFLAGS -belf"
500 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100501 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000502 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100503 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000504 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000505 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700506 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700507 AC_DEFINE(SETEUID_BREAKS_SETUID)
508 AC_DEFINE(BROKEN_SETREUID)
509 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700510 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700511 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700512 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100513 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700514 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700515 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000516 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000517*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700518 AC_DEFINE(NO_SSH_LASTLOG, 1,
519 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100520 AC_DEFINE(SETEUID_BREAKS_SETUID)
521 AC_DEFINE(BROKEN_SETREUID)
522 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000523 AC_DEFINE(USE_PIPES)
524 AC_DEFINE(DISABLE_FD_PASSING)
525 LDFLAGS="$LDFLAGS"
526 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
527 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000528 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000529*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100530 AC_DEFINE(SETEUID_BREAKS_SETUID)
531 AC_DEFINE(BROKEN_SETREUID)
532 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000533 AC_DEFINE(WITH_ABBREV_NO_TTY)
534 AC_DEFINE(USE_PIPES)
535 AC_DEFINE(DISABLE_FD_PASSING)
536 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100537 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000538 MANTYPE=cat
539 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000540*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100541 AC_DEFINE(SETEUID_BREAKS_SETUID)
542 AC_DEFINE(BROKEN_SETREUID)
543 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000544 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700545 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700546 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000547 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
548 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
549 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700550 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000551*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000552 AC_MSG_CHECKING(for Digital Unix SIA)
553 no_osfsia=""
554 AC_ARG_WITH(osfsia,
555 [ --with-osfsia Enable Digital Unix SIA],
556 [
557 if test "x$withval" = "xno" ; then
558 AC_MSG_RESULT(disabled)
559 no_osfsia=1
560 fi
561 ],
562 )
563 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000564 if test -f /etc/sia/matrix.conf; then
565 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700566 AC_DEFINE(HAVE_OSF_SIA, 1,
567 [Define if you have Digital Unix Security
568 Integration Architecture])
569 AC_DEFINE(DISABLE_LOGIN, 1,
570 [Define if you don't want to use your
571 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000572 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000573 LIBS="$LIBS -lsecurity -ldb -lm -laud"
574 else
575 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700576 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
577 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000578 fi
579 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000580 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700581 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000582 AC_DEFINE(BROKEN_SETREUID)
583 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000584 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000585
Tim Rice70335a62006-02-04 17:42:58 -0800586*-*-nto-qnx*)
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000587 AC_DEFINE(USE_PIPES)
588 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700589 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
590 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
591 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Tim Rice70335a62006-02-04 17:42:58 -0800592 AC_DEFINE(DISABLE_LASTLOG)
Darren Tucker54b75fe2006-02-26 12:31:48 +1100593 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Tim Rice2f993462006-02-11 18:37:48 -0800594 enable_etc_default_login=no # has incompatible /etc/default/login
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000595 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000596
597*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700598 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
599 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
Darren Tucker988b3fd2006-02-08 22:11:27 +1100600 AC_DEFINE(NEED_SETPGRP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700601 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
602 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000603
604*-*-lynxos)
605 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700606 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000607 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
608 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100609esac
610
Damien Millere37bfc12000-06-05 09:37:43 +1000611# Allow user to specify flags
612AC_ARG_WITH(cflags,
613 [ --with-cflags Specify additional flags to pass to compiler],
614 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800615 if test -n "$withval" && test "x$withval" != "xno" && \
616 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000617 CFLAGS="$CFLAGS $withval"
618 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800619 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000620)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000621AC_ARG_WITH(cppflags,
622 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
623 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800624 if test -n "$withval" && test "x$withval" != "xno" && \
625 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000626 CPPFLAGS="$CPPFLAGS $withval"
627 fi
628 ]
629)
Damien Millere37bfc12000-06-05 09:37:43 +1000630AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000631 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000632 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800633 if test -n "$withval" && test "x$withval" != "xno" && \
634 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000635 LDFLAGS="$LDFLAGS $withval"
636 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800637 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000638)
639AC_ARG_WITH(libs,
640 [ --with-libs Specify additional libraries to link with],
641 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800642 if test -n "$withval" && test "x$withval" != "xno" && \
643 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000644 LIBS="$LIBS $withval"
645 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800646 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000647)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000648AC_ARG_WITH(Werror,
649 [ --with-Werror Build main code with -Werror],
650 [
651 if test -n "$withval" && test "x$withval" != "xno"; then
652 werror_flags="-Werror"
Damien Millere04ec6f2005-10-08 16:21:19 +1000653 if test "x${withval}" != "xyes"; then
Darren Tucker7da23cb2005-08-03 00:20:15 +1000654 werror_flags="$withval"
655 fi
656 fi
657 ]
658)
Damien Millere37bfc12000-06-05 09:37:43 +1000659
Darren Tucker6eb93042003-06-29 21:30:41 +1000660AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000661AC_RUN_IFELSE(
662 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000663#include <stdio.h>
664int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000665 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000666 [ AC_MSG_RESULT(yes) ],
667 [
668 AC_MSG_RESULT(no)
669 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000670 ],
671 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000672)
673
Darren Tucker0c9653f2005-05-28 15:58:14 +1000674dnl Checks for header files.
675AC_CHECK_HEADERS( \
676 bstring.h \
677 crypt.h \
Darren Tuckerc4953012006-03-16 08:14:34 +1100678 crypto/sha2.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000679 dirent.h \
680 endian.h \
681 features.h \
682 floatingpoint.h \
683 getopt.h \
684 glob.h \
685 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700686 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000687 limits.h \
688 login.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000689 maillock.h \
690 ndir.h \
Darren Tucker3eb48342006-06-23 21:05:12 +1000691 net/if_tun.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000692 netdb.h \
693 netgroup.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000694 pam/pam_appl.h \
695 paths.h \
696 pty.h \
697 readpassphrase.h \
698 rpc/types.h \
699 security/pam_appl.h \
Damien Miller41e364b2006-03-15 13:12:41 +1100700 sha2.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000701 shadow.h \
702 stddef.h \
703 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000704 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000705 strings.h \
706 sys/audit.h \
707 sys/bitypes.h \
708 sys/bsdtty.h \
709 sys/cdefs.h \
710 sys/dir.h \
711 sys/mman.h \
712 sys/ndir.h \
713 sys/prctl.h \
714 sys/pstat.h \
715 sys/select.h \
716 sys/stat.h \
717 sys/stream.h \
718 sys/stropts.h \
719 sys/strtio.h \
720 sys/sysmacros.h \
721 sys/time.h \
722 sys/timers.h \
723 sys/un.h \
724 time.h \
725 tmpdir.h \
726 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000727 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000728 usersec.h \
729 util.h \
730 utime.h \
731 utmp.h \
732 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000733 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000734)
Tim Rice4cec93f2002-02-26 08:40:48 -0800735
Tim Rice0daad782006-02-04 17:33:55 -0800736# lastlog.h requires sys/time.h to be included first on Solaris
737AC_CHECK_HEADERS(lastlog.h, [], [], [
738#ifdef HAVE_SYS_TIME_H
739# include <sys/time.h>
740#endif
741])
742
Darren Tucker48d99d32004-08-29 17:04:50 +1000743# sys/ptms.h requires sys/stream.h to be included first on Solaris
744AC_CHECK_HEADERS(sys/ptms.h, [], [], [
745#ifdef HAVE_SYS_STREAM_H
746# include <sys/stream.h>
747#endif
748])
749
Darren Tucker8bb9e2c2006-03-15 22:28:17 +1100750# login_cap.h requires sys/types.h on NetBSD
751AC_CHECK_HEADERS(login_cap.h, [], [], [
752#include <sys/types.h>
753])
754
Damien Millera22ba012000-03-02 23:09:20 +1100755# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700756AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
757AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000758
Tim Rice1e1ef642003-09-11 22:19:31 -0700759dnl IRIX and Solaris 2.5.1 have dirname() in libgen
760AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
761 AC_CHECK_LIB(gen, dirname,[
762 AC_CACHE_CHECK([for broken dirname],
763 ac_cv_have_broken_dirname, [
764 save_LIBS="$LIBS"
765 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000766 AC_RUN_IFELSE(
767 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700768#include <libgen.h>
769#include <string.h>
770
771int main(int argc, char **argv) {
772 char *s, buf[32];
773
774 strncpy(buf,"/etc", 32);
775 s = dirname(buf);
776 if (!s || strncmp(s, "/", 32) != 0) {
777 exit(1);
778 } else {
779 exit(0);
780 }
781}
Darren Tucker314d89e2005-10-17 23:29:23 +1000782 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700783 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000784 [ ac_cv_have_broken_dirname="yes" ],
785 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700786 )
787 LIBS="$save_LIBS"
788 ])
789 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
790 LIBS="$LIBS -lgen"
791 AC_DEFINE(HAVE_DIRNAME)
792 AC_CHECK_HEADERS(libgen.h)
793 fi
794 ])
795])
796
797AC_CHECK_FUNC(getspnam, ,
798 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700799AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
800 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700801
Tim Rice13aae5e2001-10-21 17:53:58 -0700802dnl zlib is required
803AC_ARG_WITH(zlib,
804 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100805 [ if test "x$withval" = "xno" ; then
806 AC_MSG_ERROR([*** zlib is required ***])
807 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700808 if test -d "$withval/lib"; then
809 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700810 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700811 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700812 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700813 fi
814 else
815 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700816 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700817 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700818 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700819 fi
820 fi
821 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700822 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700823 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700824 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700825 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100826 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700827)
828
Tim Ricefcb62202004-01-23 18:35:16 -0800829AC_CHECK_LIB(z, deflate, ,
830 [
831 saved_CPPFLAGS="$CPPFLAGS"
832 saved_LDFLAGS="$LDFLAGS"
833 save_LIBS="$LIBS"
834 dnl Check default zlib install dir
835 if test -n "${need_dash_r}"; then
836 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
837 else
838 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
839 fi
840 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
841 LIBS="$LIBS -lz"
842 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
843 [
844 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
845 ]
846 )
847 ]
848)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100849AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100850
851AC_ARG_WITH(zlib-version-check,
852 [ --without-zlib-version-check Disable zlib version check],
853 [ if test "x$withval" = "xno" ; then
854 zlib_check_nonfatal=1
855 fi
856 ]
857)
858
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000859AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000860AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000861#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100862#include <zlib.h>
863int main()
864{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000865 int a=0, b=0, c=0, d=0, n, v;
866 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
867 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100868 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000869 v = a*1000000 + b*10000 + c*100 + d;
870 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
871
872 /* 1.1.4 is OK */
873 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100874 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000875
Darren Tucker41097ed2005-07-25 15:24:21 +1000876 /* 1.2.3 and up are OK */
877 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000878 exit(0);
879
Darren Tucker2dcd2392004-01-23 17:13:33 +1100880 exit(2);
881}
Darren Tucker623d92f2004-09-12 22:36:15 +1000882 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000883 AC_MSG_RESULT(no),
884 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100885 if test -z "$zlib_check_nonfatal" ; then
886 AC_MSG_ERROR([*** zlib too old - check config.log ***
887Your reported zlib version has known security problems. It's possible your
888vendor has fixed these problems without changing the version number. If you
889are sure this is the case, you can disable the check by running
890"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000891If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000892See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100893 else
894 AC_MSG_WARN([zlib version may have security problems])
895 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000896 ],
897 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100898)
Damien Miller6f9c3372000-10-25 10:06:04 +1100899
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000900dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100901AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000902 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
903)
Darren Tucker5bfe1682005-11-12 18:42:36 +1100904AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700905 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
906 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000907)
Damien Millerab18c411999-11-11 10:40:23 +1100908
Tim Ricee589a292001-11-03 11:09:32 -0800909dnl Checks for libutil functions
910AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700911AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
912 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800913AC_CHECK_FUNCS(logout updwtmp logwtmp)
914
Ben Lindstrom8697e082001-02-24 21:41:10 +0000915AC_FUNC_STRFTIME
916
Damien Miller3c027682001-03-14 11:39:45 +1100917# Check for ALTDIRFUNC glob() extension
918AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
919AC_EGREP_CPP(FOUNDIT,
920 [
921 #include <glob.h>
922 #ifdef GLOB_ALTDIRFUNC
923 FOUNDIT
924 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100925 ],
Damien Miller3c027682001-03-14 11:39:45 +1100926 [
Tim Rice7df8d392005-09-19 09:33:39 -0700927 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
928 [Define if your system glob() function has
929 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100930 AC_MSG_RESULT(yes)
931 ],
932 [
933 AC_MSG_RESULT(no)
934 ]
935)
Damien Millerab18c411999-11-11 10:40:23 +1100936
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000937# Check for g.gl_matchc glob() extension
938AC_MSG_CHECKING(for gl_matchc field in glob_t)
Darren Tucker486d95e2006-03-15 21:31:39 +1100939AC_TRY_COMPILE(
Damien Milleraf87af12006-03-15 13:02:28 +1100940 [ #include <glob.h> ],
941 [glob_t g; g.gl_matchc = 1;],
Damien Millera8e06ce2003-11-21 23:48:55 +1100942 [
Tim Rice7df8d392005-09-19 09:33:39 -0700943 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
944 [Define if your system glob() function has
945 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +1100946 AC_MSG_RESULT(yes)
947 ],
948 [
949 AC_MSG_RESULT(no)
950 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000951)
952
Damien Miller18bb4732001-03-28 14:35:30 +1000953AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000954AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000955 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000956#include <sys/types.h>
957#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700958int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000959 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100960 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000961 [
962 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700963 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +1100964 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -0700965 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000966 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800967 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000968 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
969 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000970 ]
971)
972
Damien Miller36f49652004-08-15 18:40:59 +1000973AC_MSG_CHECKING([for /proc/pid/fd directory])
974if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -0700975 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +1000976 AC_MSG_RESULT(yes)
977else
978 AC_MSG_RESULT(no)
979fi
980
Damien Millerc547bf12001-02-16 10:18:12 +1100981# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100982SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100983AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100984 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100985 [
986 if test "x$withval" != "xno" ; then
987
988 if test "x$withval" != "xyes" ; then
989 CPPFLAGS="$CPPFLAGS -I${withval}/include"
990 LDFLAGS="$LDFLAGS -L${withval}/lib"
991 fi
992
Tim Rice7df8d392005-09-19 09:33:39 -0700993 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +1100994 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100995 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800996
Tim Rice4cec93f2002-02-26 08:40:48 -0800997 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +1000998 AC_LINK_IFELSE(
999 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001000#include <stdio.h>
1001#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001002int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +10001003 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001004 [AC_MSG_RESULT(yes)],
1005 [
1006 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +11001007 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1008 ])
Darren Tucker3b908f62004-04-14 15:26:39 +10001009 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1010 AC_TRY_COMPILE(
1011 [#include <stdio.h>
1012 #include <skey.h>],
1013 [(void)skeychallenge(NULL,"name","",0);],
1014 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001015 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1016 [Define if your skeychallenge()
1017 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +10001018 [AC_MSG_RESULT(no)]
1019 )
Damien Millerc547bf12001-02-16 10:18:12 +11001020 fi
1021 ]
1022)
1023
1024# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001025TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001026AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001027 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001028 [
1029 if test "x$withval" != "xno" ; then
1030 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001031 saved_LDFLAGS="$LDFLAGS"
1032 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001033 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001034 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001035 if test -d "${withval}/lib"; then
1036 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001037 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001038 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001039 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001040 fi
1041 else
1042 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001043 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001044 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001045 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001046 fi
1047 fi
1048 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001049 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001050 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001051 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001052 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001053 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001054 LIBWRAP="-lwrap"
1055 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001056 AC_MSG_CHECKING(for libwrap)
1057 AC_TRY_LINK(
1058 [
Damien Miller0ac45002004-04-14 20:14:26 +10001059#include <sys/types.h>
1060#include <sys/socket.h>
1061#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001062#include <tcpd.h>
1063 int deny_severity = 0, allow_severity = 0;
1064 ],
1065 [hosts_access(0);],
1066 [
1067 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001068 AC_DEFINE(LIBWRAP, 1,
1069 [Define if you want
1070 TCP Wrappers support])
Tim Rice4cec93f2002-02-26 08:40:48 -08001071 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001072 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001073 ],
1074 [
1075 AC_MSG_ERROR([*** libwrap missing])
1076 ]
1077 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001078 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001079 fi
1080 ]
1081)
1082
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001083# Check whether user wants libedit support
1084LIBEDIT_MSG="no"
1085AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001086 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001087 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001088 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001089 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1090 if test -n "${need_dash_r}"; then
1091 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1092 else
1093 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1094 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001095 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001096 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001097 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001098 LIBEDIT="-ledit -lcurses"
1099 LIBEDIT_MSG="yes"
1100 AC_SUBST(LIBEDIT)
1101 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001102 [ AC_MSG_ERROR(libedit not found) ],
1103 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001104 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001105 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001106 AC_COMPILE_IFELSE(
1107 [AC_LANG_SOURCE([[
1108#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001109int main(void)
1110{
1111 int i = H_SETSIZE;
1112 el_init("", NULL, NULL, NULL);
1113 exit(0);
1114}
Tim Ricec1819c82005-08-15 17:48:40 -07001115 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001116 [ AC_MSG_RESULT(yes) ],
1117 [ AC_MSG_RESULT(no)
1118 AC_MSG_ERROR(libedit version is not compatible) ]
1119 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001120 fi ]
1121)
1122
Darren Tuckerd9f88912005-02-20 21:01:48 +11001123AUDIT_MODULE=none
1124AC_ARG_WITH(audit,
1125 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1126 [
1127 AC_MSG_CHECKING(for supported audit module)
1128 case "$withval" in
1129 bsm)
1130 AC_MSG_RESULT(bsm)
1131 AUDIT_MODULE=bsm
1132 dnl Checks for headers, libs and functions
1133 AC_CHECK_HEADERS(bsm/audit.h, [],
1134 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1135 AC_CHECK_LIB(bsm, getaudit, [],
1136 [AC_MSG_ERROR(BSM enabled and required library not found)])
1137 AC_CHECK_FUNCS(getaudit, [],
1138 [AC_MSG_ERROR(BSM enabled and required function not found)])
1139 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001140 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001141 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001142 ;;
1143 debug)
1144 AUDIT_MODULE=debug
1145 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001146 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001147 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001148 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001149 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001150 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001151 *)
1152 AC_MSG_ERROR([Unknown audit module $withval])
1153 ;;
1154 esac ]
1155)
1156
Damien Millerfe1f1432003-02-24 15:45:42 +11001157dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001158AC_CHECK_FUNCS( \
1159 arc4random \
Damien Miller57f39152005-11-24 19:58:19 +11001160 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001161 b64_ntop \
1162 __b64_ntop \
1163 b64_pton \
1164 __b64_pton \
1165 bcopy \
1166 bindresvport_sa \
1167 clock \
1168 closefrom \
1169 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001170 fchmod \
1171 fchown \
1172 freeaddrinfo \
1173 futimes \
1174 getaddrinfo \
1175 getcwd \
1176 getgrouplist \
1177 getnameinfo \
1178 getopt \
1179 getpeereid \
1180 _getpty \
1181 getrlimit \
1182 getttyent \
1183 glob \
1184 inet_aton \
1185 inet_ntoa \
1186 inet_ntop \
1187 innetgr \
1188 login_getcapbool \
1189 md5_crypt \
1190 memmove \
1191 mkdtemp \
1192 mmap \
1193 ngetaddrinfo \
1194 nsleep \
1195 ogetaddrinfo \
1196 openlog_r \
1197 openpty \
1198 prctl \
1199 pstat \
1200 readpassphrase \
1201 realpath \
1202 recvmsg \
1203 rresvport_af \
1204 sendmsg \
1205 setdtablesize \
1206 setegid \
1207 setenv \
1208 seteuid \
1209 setgroups \
1210 setlogin \
1211 setpcred \
1212 setproctitle \
1213 setregid \
1214 setreuid \
1215 setrlimit \
1216 setsid \
1217 setvbuf \
1218 sigaction \
1219 sigvec \
1220 snprintf \
1221 socketpair \
1222 strdup \
1223 strerror \
1224 strlcat \
1225 strlcpy \
1226 strmode \
1227 strnvis \
1228 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001229 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001230 strtoul \
1231 sysconf \
1232 tcgetpgrp \
1233 truncate \
1234 unsetenv \
1235 updwtmpx \
Damien Miller57f39152005-11-24 19:58:19 +11001236 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001237 vhangup \
1238 vsnprintf \
1239 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001240)
Tim Rice13aae5e2001-10-21 17:53:58 -07001241
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001242# IRIX has a const char return value for gai_strerror()
1243AC_CHECK_FUNCS(gai_strerror,[
1244 AC_DEFINE(HAVE_GAI_STRERROR)
1245 AC_TRY_COMPILE([
1246#include <sys/types.h>
1247#include <sys/socket.h>
1248#include <netdb.h>
1249
1250const char *gai_strerror(int);],[
1251char *str;
1252
1253str = gai_strerror(0);],[
1254 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1255 [Define if gai_strerror() returns const char *])])])
1256
Tim Rice7df8d392005-09-19 09:33:39 -07001257AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1258 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001259
Darren Tuckerf1159b52003-07-07 19:44:01 +10001260dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001261AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001262AC_CHECK_DECL(strsep,
1263 [AC_CHECK_FUNCS(strsep)],
1264 [],
1265 [
1266#ifdef HAVE_STRING_H
1267# include <string.h>
1268#endif
1269 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001270
Darren Tuckerb2427c82003-09-10 15:22:44 +10001271dnl tcsendbreak might be a macro
1272AC_CHECK_DECL(tcsendbreak,
1273 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001274 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001275 [#include <termios.h>]
1276)
1277
Darren Tucker5bb14002004-04-23 18:53:10 +10001278AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1279
Darren Tucker2a6b0292003-12-31 14:59:17 +11001280AC_CHECK_FUNCS(setresuid, [
1281 dnl Some platorms have setresuid that isn't implemented, test for this
1282 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001283 AC_RUN_IFELSE(
1284 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001285#include <stdlib.h>
1286#include <errno.h>
1287int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001288 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001289 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001290 [AC_DEFINE(BROKEN_SETRESUID, 1,
1291 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001292 AC_MSG_RESULT(not implemented)],
1293 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001294 )
1295])
Darren Tuckere937be32003-12-17 18:53:26 +11001296
Darren Tucker2a6b0292003-12-31 14:59:17 +11001297AC_CHECK_FUNCS(setresgid, [
1298 dnl Some platorms have setresgid that isn't implemented, test for this
1299 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001300 AC_RUN_IFELSE(
1301 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001302#include <stdlib.h>
1303#include <errno.h>
1304int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001305 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001306 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001307 [AC_DEFINE(BROKEN_SETRESGID, 1,
1308 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001309 AC_MSG_RESULT(not implemented)],
1310 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001311 )
1312])
Darren Tuckere937be32003-12-17 18:53:26 +11001313
Damien Millerad833b32000-08-23 10:46:23 +10001314dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001315AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001316dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001317AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001318AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001319dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001320AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001321AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001322
Damien Millera8e06ce2003-11-21 23:48:55 +11001323AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001324 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1325 [AC_CHECK_LIB(bsd, daemon,
1326 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001327)
1328
Damien Millera8e06ce2003-11-21 23:48:55 +11001329AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001330 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1331 [Define if your libraries define getpagesize()])],
1332 [AC_CHECK_LIB(ucb, getpagesize,
1333 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001334)
1335
Damien Millercb170cb2000-07-01 16:52:55 +10001336# Check for broken snprintf
1337if test "x$ac_cv_func_snprintf" = "xyes" ; then
1338 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001339 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001340 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001341#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001342int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001343 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001344 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001345 [
1346 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001347 AC_DEFINE(BROKEN_SNPRINTF, 1,
1348 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001349 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001350 ],
1351 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001352 )
1353fi
1354
Damien Miller57f39152005-11-24 19:58:19 +11001355# If we don't have a working asprintf, then we strongly depend on vsnprintf
1356# returning the right thing on overflow: the number of characters it tried to
1357# create (as per SUSv3)
1358if test "x$ac_cv_func_asprintf" != "xyes" && \
1359 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1360 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1361 AC_RUN_IFELSE(
1362 [AC_LANG_SOURCE([[
1363#include <sys/types.h>
1364#include <stdio.h>
1365#include <stdarg.h>
1366
1367int x_snprintf(char *str,size_t count,const char *fmt,...)
1368{
1369 size_t ret; va_list ap;
1370 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1371 return ret;
1372}
1373int main(void)
1374{
1375 char x[1];
1376 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1377} ]])],
1378 [AC_MSG_RESULT(yes)],
1379 [
1380 AC_MSG_RESULT(no)
1381 AC_DEFINE(BROKEN_SNPRINTF, 1,
1382 [Define if your snprintf is busted])
1383 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1384 ],
1385 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1386 )
1387fi
1388
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001389# On systems where [v]snprintf is broken, but is declared in stdio,
1390# check that the fmt argument is const char * or just char *.
1391# This is only useful for when BROKEN_SNPRINTF
1392AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1393AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1394 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1395 int main(void) { snprintf(0, 0, 0); }
1396 ]])],
1397 [AC_MSG_RESULT(yes)
1398 AC_DEFINE(SNPRINTF_CONST, [const],
1399 [Define as const if snprintf() can declare const char *fmt])],
1400 [AC_MSG_RESULT(no)
1401 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1402
Damien Millerb4097182004-05-23 14:09:40 +10001403# Check for missing getpeereid (or equiv) support
1404NO_PEERCHECK=""
1405if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1406 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1407 AC_TRY_COMPILE(
1408 [#include <sys/types.h>
1409 #include <sys/socket.h>],
1410 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001411 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001412 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001413 ],
Damien Millerb4097182004-05-23 14:09:40 +10001414 [AC_MSG_RESULT(no)
1415 NO_PEERCHECK=1]
1416 )
1417fi
1418
Damien Millere8328192003-01-07 15:18:32 +11001419dnl see whether mkstemp() requires XXXXXX
1420if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1421AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001422AC_RUN_IFELSE(
1423 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001424#include <stdlib.h>
1425main() { char template[]="conftest.mkstemp-test";
1426if (mkstemp(template) == -1)
1427 exit(1);
1428unlink(template); exit(0);
1429}
Darren Tucker314d89e2005-10-17 23:29:23 +10001430 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001431 [
1432 AC_MSG_RESULT(no)
1433 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001434 [
Damien Millere8328192003-01-07 15:18:32 +11001435 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001436 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001437 ],
1438 [
1439 AC_MSG_RESULT(yes)
1440 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001441 ]
Damien Millere8328192003-01-07 15:18:32 +11001442)
1443fi
1444
Darren Tucker70a3d552003-08-21 17:58:29 +10001445dnl make sure that openpty does not reacquire controlling terminal
1446if test ! -z "$check_for_openpty_ctty_bug"; then
1447 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001448 AC_RUN_IFELSE(
1449 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001450#include <stdio.h>
1451#include <sys/fcntl.h>
1452#include <sys/types.h>
1453#include <sys/wait.h>
1454
1455int
1456main()
1457{
1458 pid_t pid;
1459 int fd, ptyfd, ttyfd, status;
1460
1461 pid = fork();
1462 if (pid < 0) { /* failed */
1463 exit(1);
1464 } else if (pid > 0) { /* parent */
1465 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001466 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001467 exit(WEXITSTATUS(status));
1468 else
1469 exit(2);
1470 } else { /* child */
1471 close(0); close(1); close(2);
1472 setsid();
1473 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1474 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1475 if (fd >= 0)
1476 exit(3); /* Acquired ctty: broken */
1477 else
1478 exit(0); /* Did not acquire ctty: OK */
1479 }
1480}
Darren Tucker314d89e2005-10-17 23:29:23 +10001481 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001482 [
1483 AC_MSG_RESULT(yes)
1484 ],
1485 [
1486 AC_MSG_RESULT(no)
1487 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001488 ],
1489 [
1490 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001491 ]
1492 )
1493fi
1494
Tim Rice8bb561b2005-03-17 16:23:19 -08001495if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1496 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001497 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001498 AC_RUN_IFELSE(
1499 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001500#include <stdio.h>
1501#include <sys/socket.h>
1502#include <netdb.h>
1503#include <errno.h>
1504#include <netinet/in.h>
1505
1506#define TEST_PORT "2222"
1507
1508int
1509main(void)
1510{
1511 int err, sock;
1512 struct addrinfo *gai_ai, *ai, hints;
1513 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1514
1515 memset(&hints, 0, sizeof(hints));
1516 hints.ai_family = PF_UNSPEC;
1517 hints.ai_socktype = SOCK_STREAM;
1518 hints.ai_flags = AI_PASSIVE;
1519
1520 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1521 if (err != 0) {
1522 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1523 exit(1);
1524 }
1525
1526 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1527 if (ai->ai_family != AF_INET6)
1528 continue;
1529
1530 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1531 sizeof(ntop), strport, sizeof(strport),
1532 NI_NUMERICHOST|NI_NUMERICSERV);
1533
1534 if (err != 0) {
1535 if (err == EAI_SYSTEM)
1536 perror("getnameinfo EAI_SYSTEM");
1537 else
1538 fprintf(stderr, "getnameinfo failed: %s\n",
1539 gai_strerror(err));
1540 exit(2);
1541 }
1542
1543 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1544 if (sock < 0)
1545 perror("socket");
1546 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1547 if (errno == EBADF)
1548 exit(3);
1549 }
1550 }
1551 exit(0);
1552}
Darren Tucker314d89e2005-10-17 23:29:23 +10001553 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001554 [
1555 AC_MSG_RESULT(yes)
1556 ],
1557 [
1558 AC_MSG_RESULT(no)
1559 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001560 ],
1561 [
1562 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001563 ]
1564 )
1565fi
1566
Tim Rice8bb561b2005-03-17 16:23:19 -08001567if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1568 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001569 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001570 AC_RUN_IFELSE(
1571 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001572#include <stdio.h>
1573#include <sys/socket.h>
1574#include <netdb.h>
1575#include <errno.h>
1576#include <netinet/in.h>
1577
1578#define TEST_PORT "2222"
1579
1580int
1581main(void)
1582{
1583 int err, sock;
1584 struct addrinfo *gai_ai, *ai, hints;
1585 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1586
1587 memset(&hints, 0, sizeof(hints));
1588 hints.ai_family = PF_UNSPEC;
1589 hints.ai_socktype = SOCK_STREAM;
1590 hints.ai_flags = AI_PASSIVE;
1591
1592 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1593 if (err != 0) {
1594 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1595 exit(1);
1596 }
1597
1598 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1599 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1600 continue;
1601
1602 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1603 sizeof(ntop), strport, sizeof(strport),
1604 NI_NUMERICHOST|NI_NUMERICSERV);
1605
1606 if (ai->ai_family == AF_INET && err != 0) {
1607 perror("getnameinfo");
1608 exit(2);
1609 }
1610 }
1611 exit(0);
1612}
Darren Tucker314d89e2005-10-17 23:29:23 +10001613 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001614 [
1615 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001616 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1617 [Define if you have a getaddrinfo that fails
1618 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001619 ],
1620 [
1621 AC_MSG_RESULT(no)
1622 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001623 ],
1624 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001625 ]
1626 )
1627fi
1628
Darren Tuckera56f1912004-11-02 20:30:54 +11001629if test "x$check_for_conflicting_getspnam" = "x1"; then
1630 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1631 AC_COMPILE_IFELSE(
1632 [
1633#include <shadow.h>
1634int main(void) {exit(0);}
1635 ],
1636 [
1637 AC_MSG_RESULT(no)
1638 ],
1639 [
1640 AC_MSG_RESULT(yes)
1641 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1642 [Conflicting defs for getspnam])
1643 ]
1644 )
1645fi
1646
Damien Miller606f8802000-09-16 15:39:56 +11001647AC_FUNC_GETPGRP
1648
Damien Millera64b57a2001-01-17 10:44:13 +11001649# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001650PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001651AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001652 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001653 [
Damien Millera64b57a2001-01-17 10:44:13 +11001654 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001655 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1656 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001657 AC_MSG_ERROR([PAM headers not found])
1658 fi
1659
1660 AC_CHECK_LIB(dl, dlopen, , )
1661 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1662 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001663 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001664
Damien Millera64b57a2001-01-17 10:44:13 +11001665 PAM_MSG="yes"
1666
Tim Rice7df8d392005-09-19 09:33:39 -07001667 AC_DEFINE(USE_PAM, 1,
1668 [Define if you want to enable PAM support])
Tim Rice7d2d1f12002-02-26 22:05:11 -08001669 if test $ac_cv_lib_dl_dlopen = yes; then
1670 LIBPAM="-lpam -ldl"
1671 else
1672 LIBPAM="-lpam"
1673 fi
1674 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001675 fi
1676 ]
1677)
Damien Millera22ba012000-03-02 23:09:20 +11001678
Damien Millera64b57a2001-01-17 10:44:13 +11001679# Check for older PAM
1680if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001681 # Check PAM strerror arguments (old PAM)
1682 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1683 AC_TRY_COMPILE(
1684 [
Damien Miller81171112000-04-23 11:14:01 +10001685#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001686#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001687#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001688#elif defined (HAVE_PAM_PAM_APPL_H)
1689#include <pam/pam_appl.h>
1690#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001691 ],
1692 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001693 [AC_MSG_RESULT(no)],
1694 [
Tim Rice7df8d392005-09-19 09:33:39 -07001695 AC_DEFINE(HAVE_OLD_PAM, 1,
1696 [Define if you have an old version of PAM
1697 which takes only one argument to pam_strerror])
Damien Millera22ba012000-03-02 23:09:20 +11001698 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001699 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001700 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001701 )
Damien Millera22ba012000-03-02 23:09:20 +11001702fi
1703
Tim Riceaef73712002-05-11 13:17:42 -07001704# Search for OpenSSL
1705saved_CPPFLAGS="$CPPFLAGS"
1706saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001707AC_ARG_WITH(ssl-dir,
1708 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1709 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001710 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001711 case "$withval" in
1712 # Relative paths
1713 ./*|../*) withval="`pwd`/$withval"
1714 esac
Tim Riceaef73712002-05-11 13:17:42 -07001715 if test -d "$withval/lib"; then
1716 if test -n "${need_dash_r}"; then
1717 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1718 else
1719 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1720 fi
1721 else
1722 if test -n "${need_dash_r}"; then
1723 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1724 else
1725 LDFLAGS="-L${withval} ${LDFLAGS}"
1726 fi
1727 fi
1728 if test -d "$withval/include"; then
1729 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1730 else
1731 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1732 fi
Damien Millera22ba012000-03-02 23:09:20 +11001733 fi
1734 ]
1735)
Tim Rice3d5352e2004-02-12 09:27:21 -08001736LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001737AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1738 [Define if your ssl headers are included
1739 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001740 [
Tim Riceaef73712002-05-11 13:17:42 -07001741 dnl Check default openssl install dir
1742 if test -n "${need_dash_r}"; then
1743 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001744 else
Tim Riceaef73712002-05-11 13:17:42 -07001745 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001746 fi
Tim Riceaef73712002-05-11 13:17:42 -07001747 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1748 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1749 [
1750 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1751 ]
1752 )
1753 ]
1754)
1755
Tim Riced730b782002-08-13 18:52:10 -07001756# Determine OpenSSL header version
1757AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001758AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001759 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001760#include <stdio.h>
1761#include <string.h>
1762#include <openssl/opensslv.h>
1763#define DATA "conftest.sslincver"
1764int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001765 FILE *fd;
1766 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001767
Damien Millera8e06ce2003-11-21 23:48:55 +11001768 fd = fopen(DATA,"w");
1769 if(fd == NULL)
1770 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001771
1772 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1773 exit(1);
1774
1775 exit(0);
1776}
Darren Tucker623d92f2004-09-12 22:36:15 +10001777 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001778 [
1779 ssl_header_ver=`cat conftest.sslincver`
1780 AC_MSG_RESULT($ssl_header_ver)
1781 ],
1782 [
1783 AC_MSG_RESULT(not found)
1784 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001785 ],
1786 [
1787 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001788 ]
1789)
1790
1791# Determine OpenSSL library version
1792AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001793AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001794 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001795#include <stdio.h>
1796#include <string.h>
1797#include <openssl/opensslv.h>
1798#include <openssl/crypto.h>
1799#define DATA "conftest.ssllibver"
1800int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001801 FILE *fd;
1802 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001803
Damien Millera8e06ce2003-11-21 23:48:55 +11001804 fd = fopen(DATA,"w");
1805 if(fd == NULL)
1806 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001807
1808 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1809 exit(1);
1810
1811 exit(0);
1812}
Darren Tucker623d92f2004-09-12 22:36:15 +10001813 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001814 [
1815 ssl_library_ver=`cat conftest.ssllibver`
1816 AC_MSG_RESULT($ssl_library_ver)
1817 ],
1818 [
1819 AC_MSG_RESULT(not found)
1820 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001821 ],
1822 [
1823 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001824 ]
1825)
Damien Millera22ba012000-03-02 23:09:20 +11001826
Damien Millerec932372002-01-22 22:16:03 +11001827# Sanity check OpenSSL headers
1828AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001829AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001830 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001831#include <string.h>
1832#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001833int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001834 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001835 [
1836 AC_MSG_RESULT(yes)
1837 ],
1838 [
1839 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001840 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1841Check config.log for details.
1842Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001843 ],
1844 [
1845 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001846 ]
1847)
1848
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11001849AC_ARG_WITH(ssl-engine,
1850 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
1851 [ if test "x$withval" != "xno" ; then
1852 AC_MSG_CHECKING(for OpenSSL ENGINE support)
1853 AC_TRY_COMPILE(
1854 [ #include <openssl/engine.h>],
1855 [
1856int main(void){ENGINE_load_builtin_engines();ENGINE_register_all_complete();}
1857 ],
1858 [ AC_MSG_RESULT(yes)
1859 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
1860 [Enable OpenSSL engine support])
1861 ],
1862 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
1863 )
1864 fi ]
1865)
1866
Darren Tucker129d0bb2005-12-19 17:40:40 +11001867# Check for OpenSSL without EVP_aes_{192,256}_cbc
1868AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
1869AC_COMPILE_IFELSE(
1870 [AC_LANG_SOURCE([[
1871#include <string.h>
1872#include <openssl/evp.h>
Darren Tuckercc7c2122006-02-02 18:44:19 +11001873int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
Darren Tucker129d0bb2005-12-19 17:40:40 +11001874 ]])],
1875 [
1876 AC_MSG_RESULT(no)
1877 ],
1878 [
1879 AC_MSG_RESULT(yes)
1880 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
1881 [libcrypto is missing AES 192 and 256 bit functions])
1882 ]
1883)
1884
Tim Rice3d5352e2004-02-12 09:27:21 -08001885# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1886# because the system crypt() is more featureful.
1887if test "x$check_for_libcrypt_before" = "x1"; then
1888 AC_CHECK_LIB(crypt, crypt)
1889fi
1890
Damien Millera8e06ce2003-11-21 23:48:55 +11001891# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001892# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001893if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001894 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001895fi
1896
Damien Milleraf87af12006-03-15 13:02:28 +11001897# Search for SHA256 support in libc and/or OpenSSL
1898AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
1899
Tim Rice2291c002005-08-26 13:15:19 -07001900AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001901
1902### Configure cryptographic random number support
1903
1904# Check wheter OpenSSL seeds itself
1905AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001906AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001907 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001908#include <string.h>
1909#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001910int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001911 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001912 [
1913 OPENSSL_SEEDS_ITSELF=yes
1914 AC_MSG_RESULT(yes)
1915 ],
1916 [
1917 AC_MSG_RESULT(no)
1918 # Default to use of the rand helper if OpenSSL doesn't
1919 # seed itself
1920 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001921 ],
1922 [
1923 AC_MSG_WARN([cross compiling: assuming yes])
1924 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001925 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001926 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001927 ]
1928)
1929
1930
1931# Do we want to force the use of the rand helper?
1932AC_ARG_WITH(rand-helper,
1933 [ --with-rand-helper Use subprocess to gather strong randomness ],
1934 [
1935 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001936 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001937 # the previous test showed it to be unseeded.
1938 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1939 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1940 OPENSSL_SEEDS_ITSELF=yes
1941 USE_RAND_HELPER=""
1942 fi
1943 else
1944 USE_RAND_HELPER=yes
1945 fi
1946 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001947)
Damien Miller6c21c512002-01-22 21:57:53 +11001948
1949# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001950if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001951 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07001952 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1953 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11001954 RAND_MSG="OpenSSL internal ONLY"
1955 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001956elif test ! -z "$USE_RAND_HELPER" ; then
1957 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001958 RAND_MSG="ssh-rand-helper"
1959 INSTALL_SSH_RAND_HELPER="yes"
1960fi
1961AC_SUBST(INSTALL_SSH_RAND_HELPER)
1962
1963### Configuration of ssh-rand-helper
1964
1965# PRNGD TCP socket
1966AC_ARG_WITH(prngd-port,
1967 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1968 [
Damien Millere996d722002-01-23 11:20:59 +11001969 case "$withval" in
1970 no)
1971 withval=""
1972 ;;
1973 [[0-9]]*)
1974 ;;
1975 *)
1976 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1977 ;;
1978 esac
1979 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001980 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001981 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1982 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001983 fi
1984 ]
1985)
1986
1987# PRNGD Unix domain socket
1988AC_ARG_WITH(prngd-socket,
1989 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1990 [
Damien Millere996d722002-01-23 11:20:59 +11001991 case "$withval" in
1992 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001993 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001994 ;;
1995 no)
1996 withval=""
1997 ;;
1998 /*)
1999 ;;
2000 *)
2001 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2002 ;;
2003 esac
2004
2005 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002006 if test ! -z "$PRNGD_PORT" ; then
2007 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2008 fi
Damien Miller6385ba02002-01-23 08:12:36 +11002009 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002010 AC_MSG_WARN(Entropy socket is not readable)
2011 fi
2012 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002013 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2014 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002015 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08002016 ],
2017 [
2018 # Check for existing socket only if we don't have a random device already
2019 if test "$USE_RAND_HELPER" = yes ; then
2020 AC_MSG_CHECKING(for PRNGD/EGD socket)
2021 # Insert other locations here
2022 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2023 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2024 PRNGD_SOCKET="$sock"
2025 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2026 break;
2027 fi
2028 done
2029 if test ! -z "$PRNGD_SOCKET" ; then
2030 AC_MSG_RESULT($PRNGD_SOCKET)
2031 else
2032 AC_MSG_RESULT(not found)
2033 fi
2034 fi
Damien Miller6c21c512002-01-22 21:57:53 +11002035 ]
2036)
2037
2038# Change default command timeout for hashing entropy source
2039entropy_timeout=200
2040AC_ARG_WITH(entropy-timeout,
2041 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2042 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002043 if test -n "$withval" && test "x$withval" != "xno" && \
2044 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002045 entropy_timeout=$withval
2046 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002047 ]
Damien Miller6c21c512002-01-22 21:57:53 +11002048)
Tim Rice7df8d392005-09-19 09:33:39 -07002049AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2050 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11002051
Damien Millerd3f6ad22002-06-25 10:24:47 +10002052SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00002053AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00002054 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002055 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002056 if test -n "$withval" && test "x$withval" != "xno" && \
2057 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002058 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002059 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002060 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002061)
Tim Rice7df8d392005-09-19 09:33:39 -07002062AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2063 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10002064AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00002065
Tim Rice88f2ab52002-03-17 12:17:34 -08002066# We do this little dance with the search path to insure
2067# that programs that we select for use by installed programs
2068# (which may be run by the super-user) come from trusted
2069# locations before they come from the user's private area.
2070# This should help avoid accidentally configuring some
2071# random version of a program in someone's personal bin.
2072
2073OPATH=$PATH
2074PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07002075test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08002076test -d /sbin && PATH=$PATH:/sbin
2077test -d /usr/sbin && PATH=$PATH:/usr/sbin
2078PATH=$PATH:/etc:$OPATH
2079
Damien Millera8e06ce2003-11-21 23:48:55 +11002080# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11002081OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2082OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2083OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2084OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2085OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2086OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2087OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2088OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2089OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2090OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2091OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2092OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2093OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2094OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2095OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2096OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002097# restore PATH
2098PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002099
2100# Where does ssh-rand-helper get its randomness from?
2101INSTALL_SSH_PRNG_CMDS=""
2102if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2103 if test ! -z "$PRNGD_PORT" ; then
2104 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2105 elif test ! -z "$PRNGD_SOCKET" ; then
2106 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2107 else
2108 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2109 RAND_HELPER_CMDHASH=yes
2110 INSTALL_SSH_PRNG_CMDS="yes"
2111 fi
2112fi
2113AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2114
2115
Ben Lindstromb5628642000-10-18 00:02:25 +00002116# Cheap hack to ensure NEWS-OS libraries are arranged right.
2117if test ! -z "$SONY" ; then
2118 LIBS="$LIBS -liberty";
2119fi
2120
Damien Miller57f39152005-11-24 19:58:19 +11002121# Check for long long datatypes
2122AC_CHECK_TYPES([long long, unsigned long long, long double])
2123
2124# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002125AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002126AC_CHECK_SIZEOF(short int, 2)
2127AC_CHECK_SIZEOF(int, 4)
2128AC_CHECK_SIZEOF(long int, 4)
2129AC_CHECK_SIZEOF(long long int, 8)
2130
Damien Millerfa2bb692002-04-23 23:22:25 +10002131# Sanity check long long for some platforms (AIX)
2132if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2133 ac_cv_sizeof_long_long_int=0
2134fi
2135
Darren Tucker537f1ed2005-10-25 18:38:33 +10002136# compute LLONG_MIN and LLONG_MAX if we don't know them.
2137if test -z "$have_llong_max"; then
2138 AC_MSG_CHECKING([for max value of long long])
2139 AC_RUN_IFELSE(
2140 [AC_LANG_SOURCE([[
2141#include <stdio.h>
2142/* Why is this so damn hard? */
2143#ifdef __GNUC__
2144# undef __GNUC__
2145#endif
2146#define __USE_ISOC99
2147#include <limits.h>
2148#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002149#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2150
2151/*
2152 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2153 * we do this the hard way.
2154 */
2155static int
2156fprint_ll(FILE *f, long long n)
2157{
2158 unsigned int i;
2159 int l[sizeof(long long) * 8];
2160
2161 if (n < 0)
2162 if (fprintf(f, "-") < 0)
2163 return -1;
2164 for (i = 0; n != 0; i++) {
2165 l[i] = my_abs(n % 10);
2166 n /= 10;
2167 }
2168 do {
2169 if (fprintf(f, "%d", l[--i]) < 0)
2170 return -1;
2171 } while (i != 0);
2172 if (fprintf(f, " ") < 0)
2173 return -1;
2174 return 0;
2175}
2176
Darren Tucker537f1ed2005-10-25 18:38:33 +10002177int main(void) {
2178 FILE *f;
2179 long long i, llmin, llmax = 0;
2180
2181 if((f = fopen(DATA,"w")) == NULL)
2182 exit(1);
2183
2184#if defined(LLONG_MIN) && defined(LLONG_MAX)
2185 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2186 llmin = LLONG_MIN;
2187 llmax = LLONG_MAX;
2188#else
2189 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2190 /* This will work on one's complement and two's complement */
2191 for (i = 1; i > llmax; i <<= 1, i++)
2192 llmax = i;
2193 llmin = llmax + 1LL; /* wrap */
2194#endif
2195
2196 /* Sanity check */
2197 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002198 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2199 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002200 fprintf(f, "unknown unknown\n");
2201 exit(2);
2202 }
2203
Darren Tuckerd1450db2006-03-13 19:06:51 +11002204 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002205 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002206 if (fprint_ll(f, llmax) < 0)
2207 exit(4);
2208 if (fclose(f) < 0)
2209 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002210 exit(0);
2211}
2212 ]])],
2213 [
2214 llong_min=`$AWK '{print $1}' conftest.llminmax`
2215 llong_max=`$AWK '{print $2}' conftest.llminmax`
2216
Darren Tucker537f1ed2005-10-25 18:38:33 +10002217 AC_MSG_RESULT($llong_max)
2218 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2219 [max value of long long calculated by configure])
2220 AC_MSG_CHECKING([for min value of long long])
2221 AC_MSG_RESULT($llong_min)
2222 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2223 [min value of long long calculated by configure])
2224 ],
2225 [
2226 AC_MSG_RESULT(not found)
2227 ],
2228 [
2229 AC_MSG_WARN([cross compiling: not checking])
2230 ]
2231 )
2232fi
2233
2234
Damien Millera22ba012000-03-02 23:09:20 +11002235# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002236AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2237 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002238 [ #include <sys/types.h> ],
2239 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002240 [ ac_cv_have_u_int="yes" ],
2241 [ ac_cv_have_u_int="no" ]
2242 )
2243])
2244if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002245 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002246 have_u_int=1
2247fi
2248
Damien Miller61e50f12000-05-08 20:49:37 +10002249AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2250 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002251 [ #include <sys/types.h> ],
2252 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002253 [ ac_cv_have_intxx_t="yes" ],
2254 [ ac_cv_have_intxx_t="no" ]
2255 )
2256])
2257if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002258 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002259 have_intxx_t=1
2260fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002261
2262if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002263 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002264then
2265 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2266 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002267 [ #include <stdint.h> ],
2268 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002269 [
2270 AC_DEFINE(HAVE_INTXX_T)
2271 AC_MSG_RESULT(yes)
2272 ],
2273 [ AC_MSG_RESULT(no) ]
2274 )
2275fi
2276
Damien Miller578783e2000-09-23 14:12:24 +11002277AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2278 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002279 [
2280#include <sys/types.h>
2281#ifdef HAVE_STDINT_H
2282# include <stdint.h>
2283#endif
2284#include <sys/socket.h>
2285#ifdef HAVE_SYS_BITYPES_H
2286# include <sys/bitypes.h>
2287#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002288 ],
2289 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002290 [ ac_cv_have_int64_t="yes" ],
2291 [ ac_cv_have_int64_t="no" ]
2292 )
2293])
2294if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002295 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002296fi
2297
Damien Miller61e50f12000-05-08 20:49:37 +10002298AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2299 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002300 [ #include <sys/types.h> ],
2301 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002302 [ ac_cv_have_u_intxx_t="yes" ],
2303 [ ac_cv_have_u_intxx_t="no" ]
2304 )
2305])
2306if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002307 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002308 have_u_intxx_t=1
2309fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002310
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002311if test -z "$have_u_intxx_t" ; then
2312 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2313 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002314 [ #include <sys/socket.h> ],
2315 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002316 [
2317 AC_DEFINE(HAVE_U_INTXX_T)
2318 AC_MSG_RESULT(yes)
2319 ],
2320 [ AC_MSG_RESULT(no) ]
2321 )
2322fi
2323
Damien Miller578783e2000-09-23 14:12:24 +11002324AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2325 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002326 [ #include <sys/types.h> ],
2327 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002328 [ ac_cv_have_u_int64_t="yes" ],
2329 [ ac_cv_have_u_int64_t="no" ]
2330 )
2331])
2332if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002333 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002334 have_u_int64_t=1
2335fi
2336
Tim Rice4cec93f2002-02-26 08:40:48 -08002337if test -z "$have_u_int64_t" ; then
2338 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2339 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002340 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002341 [ u_int64_t a; a = 1],
2342 [
2343 AC_DEFINE(HAVE_U_INT64_T)
2344 AC_MSG_RESULT(yes)
2345 ],
2346 [ AC_MSG_RESULT(no) ]
2347 )
2348fi
2349
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002350if test -z "$have_u_intxx_t" ; then
2351 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2352 AC_TRY_COMPILE(
2353 [
2354#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002355 ],
2356 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002357 [ ac_cv_have_uintxx_t="yes" ],
2358 [ ac_cv_have_uintxx_t="no" ]
2359 )
2360 ])
2361 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002362 AC_DEFINE(HAVE_UINTXX_T, 1,
2363 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002364 fi
2365fi
2366
2367if test -z "$have_uintxx_t" ; then
2368 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2369 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002370 [ #include <stdint.h> ],
2371 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002372 [
2373 AC_DEFINE(HAVE_UINTXX_T)
2374 AC_MSG_RESULT(yes)
2375 ],
2376 [ AC_MSG_RESULT(no) ]
2377 )
2378fi
2379
Damien Milleredb82922000-06-20 13:25:52 +10002380if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002381 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002382then
2383 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2384 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002385 [
2386#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002387 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002388 [
Damien Miller70494d12000-04-03 15:57:06 +10002389 int8_t a; int16_t b; int32_t c;
2390 u_int8_t e; u_int16_t f; u_int32_t g;
2391 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002392 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002393 [
2394 AC_DEFINE(HAVE_U_INTXX_T)
2395 AC_DEFINE(HAVE_INTXX_T)
2396 AC_MSG_RESULT(yes)
2397 ],
2398 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002399 )
Damien Millerb29ea912000-01-15 14:12:03 +11002400fi
2401
Damien Miller58be7382001-09-15 21:31:54 +10002402
2403AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2404 AC_TRY_COMPILE(
2405 [
2406#include <sys/types.h>
2407 ],
2408 [ u_char foo; foo = 125; ],
2409 [ ac_cv_have_u_char="yes" ],
2410 [ ac_cv_have_u_char="no" ]
2411 )
2412])
2413if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002414 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002415fi
2416
Tim Rice13aae5e2001-10-21 17:53:58 -07002417TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002418
Tim Rice200a5c02002-02-26 22:12:34 -08002419AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002420
Damien Miller848b9932005-02-24 12:12:34 +11002421AC_CHECK_TYPES(in_addr_t,,,
2422[#include <sys/types.h>
2423#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002424
Damien Miller61e50f12000-05-08 20:49:37 +10002425AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2426 AC_TRY_COMPILE(
2427 [
2428#include <sys/types.h>
2429 ],
2430 [ size_t foo; foo = 1235; ],
2431 [ ac_cv_have_size_t="yes" ],
2432 [ ac_cv_have_size_t="no" ]
2433 )
2434])
2435if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002436 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002437fi
Damien Miller95058511999-12-29 10:36:45 +11002438
Damien Miller615f9392000-05-17 22:53:33 +10002439AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2440 AC_TRY_COMPILE(
2441 [
2442#include <sys/types.h>
2443 ],
2444 [ ssize_t foo; foo = 1235; ],
2445 [ ac_cv_have_ssize_t="yes" ],
2446 [ ac_cv_have_ssize_t="no" ]
2447 )
2448])
2449if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002450 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002451fi
2452
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002453AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2454 AC_TRY_COMPILE(
2455 [
2456#include <time.h>
2457 ],
2458 [ clock_t foo; foo = 1235; ],
2459 [ ac_cv_have_clock_t="yes" ],
2460 [ ac_cv_have_clock_t="no" ]
2461 )
2462])
2463if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002464 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002465fi
2466
Damien Millerb54b40e2000-06-23 08:23:34 +10002467AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2468 AC_TRY_COMPILE(
2469 [
2470#include <sys/types.h>
2471#include <sys/socket.h>
2472 ],
2473 [ sa_family_t foo; foo = 1235; ],
2474 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002475 [ AC_TRY_COMPILE(
2476 [
2477#include <sys/types.h>
2478#include <sys/socket.h>
2479#include <netinet/in.h>
2480 ],
2481 [ sa_family_t foo; foo = 1235; ],
2482 [ ac_cv_have_sa_family_t="yes" ],
2483
Damien Millerb54b40e2000-06-23 08:23:34 +10002484 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002485 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002486 )
2487])
2488if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002489 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2490 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002491fi
2492
Damien Miller0f91b4e2000-06-18 15:43:25 +10002493AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2494 AC_TRY_COMPILE(
2495 [
2496#include <sys/types.h>
2497 ],
2498 [ pid_t foo; foo = 1235; ],
2499 [ ac_cv_have_pid_t="yes" ],
2500 [ ac_cv_have_pid_t="no" ]
2501 )
2502])
2503if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002504 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002505fi
2506
2507AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2508 AC_TRY_COMPILE(
2509 [
2510#include <sys/types.h>
2511 ],
2512 [ mode_t foo; foo = 1235; ],
2513 [ ac_cv_have_mode_t="yes" ],
2514 [ ac_cv_have_mode_t="no" ]
2515 )
2516])
2517if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002518 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002519fi
2520
Damien Miller61e50f12000-05-08 20:49:37 +10002521
2522AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2523 AC_TRY_COMPILE(
2524 [
Damien Miller81171112000-04-23 11:14:01 +10002525#include <sys/types.h>
2526#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002527 ],
2528 [ struct sockaddr_storage s; ],
2529 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2530 [ ac_cv_have_struct_sockaddr_storage="no" ]
2531 )
2532])
2533if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002534 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2535 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002536fi
Damien Miller34132e52000-01-14 15:45:46 +11002537
Damien Miller61e50f12000-05-08 20:49:37 +10002538AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2539 AC_TRY_COMPILE(
2540 [
Damien Miller7b22d652000-06-18 14:07:04 +10002541#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002542#include <netinet/in.h>
2543 ],
2544 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2545 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2546 [ ac_cv_have_struct_sockaddr_in6="no" ]
2547 )
2548])
2549if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002550 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2551 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002552fi
Damien Miller34132e52000-01-14 15:45:46 +11002553
Damien Miller61e50f12000-05-08 20:49:37 +10002554AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2555 AC_TRY_COMPILE(
2556 [
Damien Miller7b22d652000-06-18 14:07:04 +10002557#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002558#include <netinet/in.h>
2559 ],
2560 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2561 [ ac_cv_have_struct_in6_addr="yes" ],
2562 [ ac_cv_have_struct_in6_addr="no" ]
2563 )
2564])
2565if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002566 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2567 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002568fi
Damien Miller34132e52000-01-14 15:45:46 +11002569
Damien Miller61e50f12000-05-08 20:49:37 +10002570AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2571 AC_TRY_COMPILE(
2572 [
Damien Miller81171112000-04-23 11:14:01 +10002573#include <sys/types.h>
2574#include <sys/socket.h>
2575#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002576 ],
2577 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2578 [ ac_cv_have_struct_addrinfo="yes" ],
2579 [ ac_cv_have_struct_addrinfo="no" ]
2580 )
2581])
2582if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002583 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2584 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002585fi
2586
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002587AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2588 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002589 [ #include <sys/time.h> ],
2590 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002591 [ ac_cv_have_struct_timeval="yes" ],
2592 [ ac_cv_have_struct_timeval="no" ]
2593 )
2594])
2595if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002596 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002597 have_struct_timeval=1
2598fi
2599
Tim Rice4e4dc562003-03-18 10:21:40 -08002600AC_CHECK_TYPES(struct timespec)
2601
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002602# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002603if test "x$ac_cv_have_int64_t" = "xno" && \
2604 test "x$ac_cv_sizeof_long_int" != "x8" && \
2605 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002606 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2607 echo "an alternative compiler (I.E., GCC) before continuing."
2608 echo ""
2609 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002610else
2611dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002612 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002613 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002614#include <stdio.h>
2615#include <string.h>
2616#ifdef HAVE_SNPRINTF
2617main()
2618{
2619 char buf[50];
2620 char expected_out[50];
2621 int mazsize = 50 ;
2622#if (SIZEOF_LONG_INT == 8)
2623 long int num = 0x7fffffffffffffff;
2624#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002625 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002626#endif
2627 strcpy(expected_out, "9223372036854775807");
2628 snprintf(buf, mazsize, "%lld", num);
2629 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002630 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002631 exit(0);
2632}
2633#else
2634main() { exit(0); }
2635#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002636 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002637 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002638 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002639fi
2640
Damien Miller78315eb2000-09-29 23:01:36 +11002641dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002642OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2643OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2644OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2645OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2646OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002647OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002648OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2649OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002650OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002651OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2652OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2653OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2654OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002655OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2656OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2657OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2658OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002659
2660AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11002661AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2662 [Define if we don't have struct __res_state in resolv.h])],
2663[
2664#include <stdio.h>
2665#if HAVE_SYS_TYPES_H
2666# include <sys/types.h>
2667#endif
2668#include <netinet/in.h>
2669#include <arpa/nameser.h>
2670#include <resolv.h>
2671])
andre2ff7b5d2000-06-03 14:57:40 +00002672
Damien Miller61e50f12000-05-08 20:49:37 +10002673AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2674 ac_cv_have_ss_family_in_struct_ss, [
2675 AC_TRY_COMPILE(
2676 [
Damien Miller81171112000-04-23 11:14:01 +10002677#include <sys/types.h>
2678#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002679 ],
2680 [ struct sockaddr_storage s; s.ss_family = 1; ],
2681 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2682 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2683 )
2684])
2685if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002686 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002687fi
2688
Damien Miller61e50f12000-05-08 20:49:37 +10002689AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2690 ac_cv_have___ss_family_in_struct_ss, [
2691 AC_TRY_COMPILE(
2692 [
Damien Miller81171112000-04-23 11:14:01 +10002693#include <sys/types.h>
2694#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002695 ],
2696 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2697 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2698 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2699 )
2700])
2701if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002702 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2703 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002704fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002705
Damien Millerad833b32000-08-23 10:46:23 +10002706AC_CACHE_CHECK([for pw_class field in struct passwd],
2707 ac_cv_have_pw_class_in_struct_passwd, [
2708 AC_TRY_COMPILE(
2709 [
Damien Millerad833b32000-08-23 10:46:23 +10002710#include <pwd.h>
2711 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002712 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002713 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2714 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2715 )
2716])
2717if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002718 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2719 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002720fi
2721
Kevin Steves82456952001-06-22 21:14:18 +00002722AC_CACHE_CHECK([for pw_expire field in struct passwd],
2723 ac_cv_have_pw_expire_in_struct_passwd, [
2724 AC_TRY_COMPILE(
2725 [
2726#include <pwd.h>
2727 ],
2728 [ struct passwd p; p.pw_expire = 0; ],
2729 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2730 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2731 )
2732])
2733if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002734 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2735 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002736fi
2737
2738AC_CACHE_CHECK([for pw_change field in struct passwd],
2739 ac_cv_have_pw_change_in_struct_passwd, [
2740 AC_TRY_COMPILE(
2741 [
2742#include <pwd.h>
2743 ],
2744 [ struct passwd p; p.pw_change = 0; ],
2745 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2746 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2747 )
2748])
2749if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002750 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2751 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002752fi
Damien Miller61e50f12000-05-08 20:49:37 +10002753
Tim Rice28bbb0c2002-05-27 17:37:32 -07002754dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002755AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2756 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002757 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002758 [
Tim Riceae49fe62002-04-12 10:26:21 -07002759#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002760#include <sys/socket.h>
2761#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002762int main() {
2763#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002764#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002765exit(1);
2766#endif
2767struct msghdr m;
2768m.msg_accrights = 0;
2769exit(0);
2770}
Kevin Steves939c9db2002-03-22 17:23:25 +00002771 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002772 [ ac_cv_have_accrights_in_msghdr="yes" ],
2773 [ ac_cv_have_accrights_in_msghdr="no" ]
2774 )
2775])
2776if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002777 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2778 [Define if your system uses access rights style
2779 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002780fi
2781
Kevin Stevesa44e0352002-04-07 16:18:03 +00002782AC_CACHE_CHECK([for msg_control field in struct msghdr],
2783 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002784 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002785 [
Tim Riceae49fe62002-04-12 10:26:21 -07002786#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002787#include <sys/socket.h>
2788#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002789int main() {
2790#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002791#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002792exit(1);
2793#endif
2794struct msghdr m;
2795m.msg_control = 0;
2796exit(0);
2797}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002798 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002799 [ ac_cv_have_control_in_msghdr="yes" ],
2800 [ ac_cv_have_control_in_msghdr="no" ]
2801 )
2802])
2803if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002804 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2805 [Define if your system uses ancillary data style
2806 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002807fi
2808
Damien Miller61e50f12000-05-08 20:49:37 +10002809AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002810 AC_TRY_LINK([],
2811 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002812 [ ac_cv_libc_defines___progname="yes" ],
2813 [ ac_cv_libc_defines___progname="no" ]
2814 )
2815])
2816if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002817 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002818fi
2819
Kevin Steves4846f4a2002-03-22 18:19:53 +00002820AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2821 AC_TRY_LINK([
2822#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002823],
2824 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002825 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2826 [ ac_cv_cc_implements___FUNCTION__="no" ]
2827 )
2828])
2829if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002830 AC_DEFINE(HAVE___FUNCTION__, 1,
2831 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002832fi
2833
2834AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2835 AC_TRY_LINK([
2836#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002837],
2838 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002839 [ ac_cv_cc_implements___func__="yes" ],
2840 [ ac_cv_cc_implements___func__="no" ]
2841 )
2842])
2843if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002844 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002845fi
2846
Damien Miller57f39152005-11-24 19:58:19 +11002847AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
2848 AC_TRY_LINK(
2849 [#include <stdarg.h>
2850 va_list x,y;],
2851 [va_copy(x,y);],
2852 [ ac_cv_have_va_copy="yes" ],
2853 [ ac_cv_have_va_copy="no" ]
2854 )
2855])
2856if test "x$ac_cv_have_va_copy" = "xyes" ; then
2857 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
2858fi
2859
2860AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
2861 AC_TRY_LINK(
2862 [#include <stdarg.h>
2863 va_list x,y;],
2864 [__va_copy(x,y);],
2865 [ ac_cv_have___va_copy="yes" ],
2866 [ ac_cv_have___va_copy="no" ]
2867 )
2868])
2869if test "x$ac_cv_have___va_copy" = "xyes" ; then
2870 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
2871fi
2872
Damien Miller4f8e6692001-07-14 13:22:53 +10002873AC_CACHE_CHECK([whether getopt has optreset support],
2874 ac_cv_have_getopt_optreset, [
2875 AC_TRY_LINK(
2876 [
2877#include <getopt.h>
2878 ],
2879 [ extern int optreset; optreset = 0; ],
2880 [ ac_cv_have_getopt_optreset="yes" ],
2881 [ ac_cv_have_getopt_optreset="no" ]
2882 )
2883])
2884if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002885 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2886 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10002887fi
Damien Millera22ba012000-03-02 23:09:20 +11002888
Damien Millerecbb26d2000-07-15 14:59:14 +10002889AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002890 AC_TRY_LINK([],
2891 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002892 [ ac_cv_libc_defines_sys_errlist="yes" ],
2893 [ ac_cv_libc_defines_sys_errlist="no" ]
2894 )
2895])
2896if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002897 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2898 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10002899fi
2900
2901
Damien Miller11fa2cc2000-08-16 10:35:58 +10002902AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002903 AC_TRY_LINK([],
2904 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002905 [ ac_cv_libc_defines_sys_nerr="yes" ],
2906 [ ac_cv_libc_defines_sys_nerr="no" ]
2907 )
2908])
2909if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002910 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10002911fi
2912
Damien Millera8e06ce2003-11-21 23:48:55 +11002913SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002914# Check whether user wants sectok support
2915AC_ARG_WITH(sectok,
2916 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002917 [
2918 if test "x$withval" != "xno" ; then
2919 if test "x$withval" != "xyes" ; then
2920 CPPFLAGS="$CPPFLAGS -I${withval}"
2921 LDFLAGS="$LDFLAGS -L${withval}"
2922 if test ! -z "$need_dash_r" ; then
2923 LDFLAGS="$LDFLAGS -R${withval}"
2924 fi
2925 if test ! -z "$blibpath" ; then
2926 blibpath="$blibpath:${withval}"
2927 fi
2928 fi
2929 AC_CHECK_HEADERS(sectok.h)
2930 if test "$ac_cv_header_sectok_h" != yes; then
2931 AC_MSG_ERROR(Can't find sectok.h)
2932 fi
2933 AC_CHECK_LIB(sectok, sectok_open)
2934 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2935 AC_MSG_ERROR(Can't find libsectok)
2936 fi
Tim Rice7df8d392005-09-19 09:33:39 -07002937 AC_DEFINE(SMARTCARD, 1,
2938 [Define if you want smartcard support])
2939 AC_DEFINE(USE_SECTOK, 1,
2940 [Define if you want smartcard support
2941 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11002942 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002943 fi
2944 ]
2945)
2946
2947# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002948OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002949AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10002950 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08002951 [
2952 if test "x$withval" != "xno" ; then
2953 if test "x$withval" != "xyes" ; then
2954 OPENSC_CONFIG=$withval/bin/opensc-config
2955 else
2956 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2957 fi
2958 if test "$OPENSC_CONFIG" != "no"; then
2959 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2960 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2961 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2962 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2963 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07002964 AC_DEFINE(USE_OPENSC, 1,
2965 [Define if you want smartcard support
2966 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08002967 SCARD_MSG="yes, using OpenSC"
2968 fi
2969 fi
2970 ]
2971)
Damien Miller85de5802001-09-18 14:01:11 +10002972
Darren Tucker5f88d342003-10-15 16:57:57 +10002973# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002974AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07002975 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2976 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10002977 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002978 # Needed by our getrrsetbyname()
2979 AC_SEARCH_LIBS(res_query, resolv)
2980 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002981 AC_MSG_CHECKING(if res_query will link)
2982 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2983 [AC_MSG_RESULT(no)
2984 saved_LIBS="$LIBS"
2985 LIBS="$LIBS -lresolv"
2986 AC_MSG_CHECKING(for res_query in -lresolv)
2987 AC_LINK_IFELSE([
2988#include <resolv.h>
2989int main()
2990{
2991 res_query (0, 0, 0, 0, 0);
2992 return 0;
2993}
2994 ],
2995 [LIBS="$LIBS -lresolv"
2996 AC_MSG_RESULT(yes)],
2997 [LIBS="$saved_LIBS"
2998 AC_MSG_RESULT(no)])
2999 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10003000 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003001 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003002 [#include <sys/types.h>
3003 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10003004 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07003005 [AC_DEFINE(HAVE_HEADER_AD, 1,
3006 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10003007 [#include <arpa/nameser.h>])
3008 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003009
Damien Miller73b42d22006-04-22 21:26:08 +10003010# Check whether user wants SELinux support
3011SELINUX_MSG="no"
3012LIBSELINUX=""
3013AC_ARG_WITH(selinux,
3014 [ --with-selinux Enable SELinux support],
3015 [ if test "x$withval" != "xno" ; then
3016 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3017 SELINUX_MSG="yes"
3018 AC_CHECK_HEADER([selinux/selinux.h], ,
3019 AC_MSG_ERROR(SELinux support requires selinux.h header))
3020 AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
3021 AC_MSG_ERROR(SELinux support requires libselinux library))
3022 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
3023 fi ]
3024)
3025AC_SUBST(LIBSELINUX)
3026
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003027# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003028KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003029AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11003030 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003031 [ if test "x$withval" != "xno" ; then
3032 if test "x$withval" = "xyes" ; then
3033 KRB5ROOT="/usr/local"
3034 else
3035 KRB5ROOT=${withval}
3036 fi
3037
Tim Rice7df8d392005-09-19 09:33:39 -07003038 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003039 KRB5_MSG="yes"
3040
3041 AC_MSG_CHECKING(for krb5-config)
3042 if test -x $KRB5ROOT/bin/krb5-config ; then
3043 KRB5CONF=$KRB5ROOT/bin/krb5-config
3044 AC_MSG_RESULT($KRB5CONF)
3045
3046 AC_MSG_CHECKING(for gssapi support)
3047 if $KRB5CONF | grep gssapi >/dev/null ; then
3048 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003049 AC_DEFINE(GSSAPI, 1,
3050 [Define this if you want GSSAPI
3051 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003052 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003053 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11003054 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11003055 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003056 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003057 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3058 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003059 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003060 AC_MSG_CHECKING(whether we are using Heimdal)
3061 AC_TRY_COMPILE([ #include <krb5.h> ],
3062 [ char *tmp = heimdal_version; ],
3063 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003064 AC_DEFINE(HEIMDAL, 1,
3065 [Define this if you are using the
3066 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003067 AC_MSG_RESULT(no)
3068 )
3069 else
3070 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003071 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003072 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11003073 AC_MSG_CHECKING(whether we are using Heimdal)
3074 AC_TRY_COMPILE([ #include <krb5.h> ],
3075 [ char *tmp = heimdal_version; ],
3076 [ AC_MSG_RESULT(yes)
3077 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10003078 K5LIBS="-lkrb5 -ldes"
3079 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08003080 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10003081 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11003082 ],
3083 [ AC_MSG_RESULT(no)
3084 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3085 ]
3086 )
Damien Miller200d0a72003-06-30 19:21:36 +10003087 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003088
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003089 AC_CHECK_LIB(gssapi,gss_init_sec_context,
3090 [ AC_DEFINE(GSSAPI)
3091 K5LIBS="-lgssapi $K5LIBS" ],
3092 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3093 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11003094 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003095 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3096 $K5LIBS)
3097 ],
3098 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003099
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003100 AC_CHECK_HEADER(gssapi.h, ,
3101 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003102 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003103 AC_CHECK_HEADERS(gssapi.h, ,
3104 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003105 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003106 ]
3107 )
3108
3109 oldCPP="$CPPFLAGS"
3110 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3111 AC_CHECK_HEADER(gssapi_krb5.h, ,
3112 [ CPPFLAGS="$oldCPP" ])
3113
Damien Millera8e06ce2003-11-21 23:48:55 +11003114 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003115 if test ! -z "$need_dash_r" ; then
3116 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3117 fi
3118 if test ! -z "$blibpath" ; then
3119 blibpath="$blibpath:${KRB5ROOT}/lib"
3120 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003121
3122 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3123 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3124 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3125
3126 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07003127 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3128 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11003129 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003130 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003131)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003132
Damien Millera22ba012000-03-02 23:09:20 +11003133# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003134
Damien Millerf58c6722002-05-13 13:15:42 +10003135PRIVSEP_PATH=/var/empty
3136AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07003137 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003138 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003139 if test -n "$withval" && test "x$withval" != "xno" && \
3140 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003141 PRIVSEP_PATH=$withval
3142 fi
3143 ]
3144)
3145AC_SUBST(PRIVSEP_PATH)
3146
Damien Millera22ba012000-03-02 23:09:20 +11003147AC_ARG_WITH(xauth,
3148 [ --with-xauth=PATH Specify path to xauth program ],
3149 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003150 if test -n "$withval" && test "x$withval" != "xno" && \
3151 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003152 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003153 fi
3154 ],
3155 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003156 TestPath="$PATH"
3157 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3158 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3159 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3160 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3161 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003162 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003163 xauth_path="/usr/openwin/bin/xauth"
3164 fi
3165 ]
3166)
3167
Damien Miller7d901272003-01-13 16:55:22 +11003168STRIP_OPT=-s
3169AC_ARG_ENABLE(strip,
3170 [ --disable-strip Disable calling strip(1) on install],
3171 [
3172 if test "x$enableval" = "xno" ; then
3173 STRIP_OPT=
3174 fi
3175 ]
3176)
3177AC_SUBST(STRIP_OPT)
3178
Damien Millera19cf472000-11-29 13:28:50 +11003179if test -z "$xauth_path" ; then
3180 XAUTH_PATH="undefined"
3181 AC_SUBST(XAUTH_PATH)
3182else
Tim Rice7df8d392005-09-19 09:33:39 -07003183 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3184 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003185 XAUTH_PATH=$xauth_path
3186 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003187fi
Damien Millera22ba012000-03-02 23:09:20 +11003188
3189# Check for mail directory (last resort if we cannot get it from headers)
3190if test ! -z "$MAIL" ; then
3191 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003192 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3193 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003194fi
3195
Darren Tucker623d92f2004-09-12 22:36:15 +10003196if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003197 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3198 disable_ptmx_check=yes
3199fi
Damien Millera22ba012000-03-02 23:09:20 +11003200if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003201 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003202 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003203 [
Tim Rice7df8d392005-09-19 09:33:39 -07003204 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3205 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003206 have_dev_ptmx=1
3207 ]
3208 )
3209 fi
Damien Millera22ba012000-03-02 23:09:20 +11003210fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003211
Darren Tucker623d92f2004-09-12 22:36:15 +10003212if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003213 AC_CHECK_FILE("/dev/ptc",
3214 [
Tim Rice7df8d392005-09-19 09:33:39 -07003215 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3216 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003217 have_dev_ptc=1
3218 ]
3219 )
3220else
3221 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3222fi
Damien Miller204ad072000-03-02 23:56:12 +11003223
Damien Millera22ba012000-03-02 23:09:20 +11003224# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003225AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003226 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003227 [
Damien Miller897741e2001-04-16 10:41:46 +10003228 case "$withval" in
3229 man|cat|doc)
3230 MANTYPE=$withval
3231 ;;
3232 *)
3233 AC_MSG_ERROR(invalid man type: $withval)
3234 ;;
3235 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003236 ]
3237)
Ben Lindstrombc709922001-04-18 18:04:21 +00003238if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003239 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3240 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003241 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3242 MANTYPE=doc
3243 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3244 MANTYPE=man
3245 else
3246 MANTYPE=cat
3247 fi
3248fi
Damien Miller670a4b82000-01-22 13:53:11 +11003249AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003250if test "$MANTYPE" = "doc"; then
3251 mansubdir=man;
3252else
3253 mansubdir=$MANTYPE;
3254fi
3255AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003256
Damien Millera22ba012000-03-02 23:09:20 +11003257# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003258MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003259AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003260 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003261 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003262 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003263 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3264 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003265 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003266 fi
3267 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003268)
3269
Damien Millera22ba012000-03-02 23:09:20 +11003270# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003271AC_ARG_WITH(shadow,
3272 [ --without-shadow Disable shadow password support],
3273 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003274 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003275 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003276 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003277 fi
3278 ]
3279)
3280
Damien Miller1f335fb2000-06-26 11:31:33 +10003281if test -z "$disable_shadow" ; then
3282 AC_MSG_CHECKING([if the systems has expire shadow information])
3283 AC_TRY_COMPILE(
3284 [
3285#include <sys/types.h>
3286#include <shadow.h>
3287 struct spwd sp;
3288 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3289 [ sp_expire_available=yes ], []
3290 )
3291
3292 if test "x$sp_expire_available" = "xyes" ; then
3293 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003294 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3295 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003296 else
3297 AC_MSG_RESULT(no)
3298 fi
3299fi
3300
Damien Millera22ba012000-03-02 23:09:20 +11003301# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003302if test ! -z "$IPADDR_IN_DISPLAY" ; then
3303 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003304 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3305 [Define if you need to use IP address
3306 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003307else
Damien Millera8e06ce2003-11-21 23:48:55 +11003308 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003309 AC_ARG_WITH(ipaddr-display,
3310 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3311 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003312 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003313 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003314 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003315 fi
3316 ]
3317 )
3318fi
Damien Miller76112de1999-12-21 11:18:08 +11003319
Darren Tuckere1a790d2003-09-16 11:52:19 +10003320# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003321AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003322 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003323 [ if test "x$enableval" = "xno"; then
3324 AC_MSG_NOTICE([/etc/default/login handling disabled])
3325 etc_default_login=no
3326 else
3327 etc_default_login=yes
3328 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003329 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3330 then
3331 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3332 etc_default_login=no
3333 else
3334 etc_default_login=yes
3335 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003336)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003337
Darren Tucker2f9573d2005-02-10 22:28:54 +11003338if test "x$etc_default_login" != "xno"; then
3339 AC_CHECK_FILE("/etc/default/login",
3340 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003341 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003342 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3343 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003344 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003345fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003346
Tim Rice43a1c132002-04-17 21:19:14 -07003347dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003348if test $ac_cv_func_login_getcapbool = "yes" && \
3349 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003350 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003351fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003352
Damien Millera22ba012000-03-02 23:09:20 +11003353# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003354SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003355AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003356 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003357 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003358 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003359 AC_MSG_WARN([
3360--with-default-path=PATH has no effect on this system.
3361Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003362 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003363 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003364 AC_MSG_WARN([
3365--with-default-path=PATH will only be used if PATH is not defined in
3366$external_path_file .])
3367 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003368 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003369 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003370 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003371 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003372 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3373 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003374 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003375 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003376 AC_MSG_WARN([
3377If PATH is defined in $external_path_file, ensure the path to scp is included,
3378otherwise scp will not work.])
3379 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003380 AC_RUN_IFELSE(
3381 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003382/* find out what STDPATH is */
3383#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003384#ifdef HAVE_PATHS_H
3385# include <paths.h>
3386#endif
3387#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003388# ifdef _PATH_USERPATH /* Irix */
3389# define _PATH_STDPATH _PATH_USERPATH
3390# else
3391# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3392# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003393#endif
3394#include <sys/types.h>
3395#include <sys/stat.h>
3396#include <fcntl.h>
3397#define DATA "conftest.stdpath"
3398
3399main()
3400{
3401 FILE *fd;
3402 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003403
Tim Rice59ea0a02001-03-10 13:50:45 -08003404 fd = fopen(DATA,"w");
3405 if(fd == NULL)
3406 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003407
Tim Rice59ea0a02001-03-10 13:50:45 -08003408 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3409 exit(1);
3410
3411 exit(0);
3412}
Darren Tucker314d89e2005-10-17 23:29:23 +10003413 ]])],
3414 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003415 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3416 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3417 )
3418# make sure $bindir is in USER_PATH so scp will work
3419 t_bindir=`eval echo ${bindir}`
3420 case $t_bindir in
3421 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3422 esac
3423 case $t_bindir in
3424 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3425 esac
3426 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3427 if test $? -ne 0 ; then
3428 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3429 if test $? -ne 0 ; then
3430 user_path=$user_path:$t_bindir
3431 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3432 fi
3433 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003434 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003435)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003436if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003437 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003438 AC_SUBST(user_path)
3439fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003440
Damien Millera18bbd32002-05-13 10:48:57 +10003441# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003442AC_ARG_WITH(superuser-path,
3443 [ --with-superuser-path= Specify different path for super-user],
3444 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003445 if test -n "$withval" && test "x$withval" != "xno" && \
3446 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003447 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3448 [Define if you want a different $PATH
3449 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003450 superuser_path=$withval
3451 fi
3452 ]
3453)
3454
3455
Damien Miller61e50f12000-05-08 20:49:37 +10003456AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003457IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003458AC_ARG_WITH(4in6,
3459 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3460 [
3461 if test "x$withval" != "xno" ; then
3462 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003463 AC_DEFINE(IPV4_IN_IPV6, 1,
3464 [Detect IPv4 in IPv6 mapped addresses
3465 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003466 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003467 else
3468 AC_MSG_RESULT(no)
3469 fi
3470 ],[
3471 if test "x$inet6_default_4in6" = "xyes"; then
3472 AC_MSG_RESULT([yes (default)])
3473 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003474 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003475 else
3476 AC_MSG_RESULT([no (default)])
3477 fi
3478 ]
3479)
3480
Damien Miller60396b02001-02-18 17:01:00 +11003481# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003482BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003483AC_ARG_WITH(bsd-auth,
3484 [ --with-bsd-auth Enable BSD auth support],
3485 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003486 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003487 AC_DEFINE(BSD_AUTH, 1,
3488 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003489 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003490 fi
3491 ]
3492)
3493
Damien Millera22ba012000-03-02 23:09:20 +11003494# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003495piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003496# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003497if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003498 piddir=`eval echo ${sysconfdir}`
3499 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003500 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003501 esac
3502fi
3503
Tim Rice88f2ab52002-03-17 12:17:34 -08003504AC_ARG_WITH(pid-dir,
3505 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3506 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003507 if test -n "$withval" && test "x$withval" != "xno" && \
3508 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003509 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003510 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003511 AC_MSG_WARN([** no $piddir directory on this system **])
3512 fi
3513 fi
3514 ]
3515)
3516
Tim Rice7df8d392005-09-19 09:33:39 -07003517AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003518AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003519
andre2ff7b5d2000-06-03 14:57:40 +00003520dnl allow user to disable some login recording features
3521AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003522 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003523 [
3524 if test "x$enableval" = "xno" ; then
3525 AC_DEFINE(DISABLE_LASTLOG)
3526 fi
3527 ]
andre2ff7b5d2000-06-03 14:57:40 +00003528)
3529AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003530 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003531 [
3532 if test "x$enableval" = "xno" ; then
3533 AC_DEFINE(DISABLE_UTMP)
3534 fi
3535 ]
andre2ff7b5d2000-06-03 14:57:40 +00003536)
3537AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003538 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003539 [
3540 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003541 AC_DEFINE(DISABLE_UTMPX, 1,
3542 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003543 fi
3544 ]
andre2ff7b5d2000-06-03 14:57:40 +00003545)
3546AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003547 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003548 [
3549 if test "x$enableval" = "xno" ; then
3550 AC_DEFINE(DISABLE_WTMP)
3551 fi
3552 ]
andre2ff7b5d2000-06-03 14:57:40 +00003553)
3554AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003555 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003556 [
3557 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003558 AC_DEFINE(DISABLE_WTMPX, 1,
3559 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003560 fi
3561 ]
andre2ff7b5d2000-06-03 14:57:40 +00003562)
3563AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003564 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003565 [
3566 if test "x$enableval" = "xno" ; then
3567 AC_DEFINE(DISABLE_LOGIN)
3568 fi
3569 ]
andre2ff7b5d2000-06-03 14:57:40 +00003570)
3571AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003572 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003573 [
3574 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003575 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3576 [Define if you don't want to use pututline()
3577 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003578 fi
3579 ]
andre2ff7b5d2000-06-03 14:57:40 +00003580)
3581AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003582 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003583 [
3584 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003585 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3586 [Define if you don't want to use pututxline()
3587 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003588 fi
3589 ]
andre2ff7b5d2000-06-03 14:57:40 +00003590)
3591AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003592 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003593 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003594 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003595 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003596 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003597 conf_lastlog_location=$withval
3598 fi
3599 ]
3600)
andre2ff7b5d2000-06-03 14:57:40 +00003601
3602dnl lastlog, [uw]tmpx? detection
3603dnl NOTE: set the paths in the platform section to avoid the
3604dnl need for command-line parameters
3605dnl lastlog and [uw]tmp are subject to a file search if all else fails
3606
3607dnl lastlog detection
3608dnl NOTE: the code itself will detect if lastlog is a directory
3609AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3610AC_TRY_COMPILE([
3611#include <sys/types.h>
3612#include <utmp.h>
3613#ifdef HAVE_LASTLOG_H
3614# include <lastlog.h>
3615#endif
Damien Miller2994e082000-06-04 15:51:47 +10003616#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003617# include <paths.h>
3618#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003619#ifdef HAVE_LOGIN_H
3620# include <login.h>
3621#endif
andre2ff7b5d2000-06-03 14:57:40 +00003622 ],
3623 [ char *lastlog = LASTLOG_FILE; ],
3624 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003625 [
3626 AC_MSG_RESULT(no)
3627 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3628 AC_TRY_COMPILE([
3629#include <sys/types.h>
3630#include <utmp.h>
3631#ifdef HAVE_LASTLOG_H
3632# include <lastlog.h>
3633#endif
3634#ifdef HAVE_PATHS_H
3635# include <paths.h>
3636#endif
3637 ],
3638 [ char *lastlog = _PATH_LASTLOG; ],
3639 [ AC_MSG_RESULT(yes) ],
3640 [
andree441aa32000-06-12 22:34:38 +00003641 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003642 system_lastlog_path=no
3643 ])
3644 ]
andre2ff7b5d2000-06-03 14:57:40 +00003645)
Damien Miller2994e082000-06-04 15:51:47 +10003646
andre2ff7b5d2000-06-03 14:57:40 +00003647if test -z "$conf_lastlog_location"; then
3648 if test x"$system_lastlog_path" = x"no" ; then
3649 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003650 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003651 conf_lastlog_location=$f
3652 fi
3653 done
3654 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003655 AC_MSG_WARN([** Cannot find lastlog **])
3656 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003657 fi
3658 fi
3659fi
3660
3661if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003662 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3663 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003664fi
andre2ff7b5d2000-06-03 14:57:40 +00003665
3666dnl utmp detection
3667AC_MSG_CHECKING([if your system defines UTMP_FILE])
3668AC_TRY_COMPILE([
3669#include <sys/types.h>
3670#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003671#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003672# include <paths.h>
3673#endif
3674 ],
3675 [ char *utmp = UTMP_FILE; ],
3676 [ AC_MSG_RESULT(yes) ],
3677 [ AC_MSG_RESULT(no)
3678 system_utmp_path=no ]
3679)
3680if test -z "$conf_utmp_location"; then
3681 if test x"$system_utmp_path" = x"no" ; then
3682 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3683 if test -f $f ; then
3684 conf_utmp_location=$f
3685 fi
3686 done
3687 if test -z "$conf_utmp_location"; then
3688 AC_DEFINE(DISABLE_UTMP)
3689 fi
3690 fi
3691fi
3692if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003693 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3694 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003695fi
andre2ff7b5d2000-06-03 14:57:40 +00003696
3697dnl wtmp detection
3698AC_MSG_CHECKING([if your system defines WTMP_FILE])
3699AC_TRY_COMPILE([
3700#include <sys/types.h>
3701#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003702#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003703# include <paths.h>
3704#endif
3705 ],
3706 [ char *wtmp = WTMP_FILE; ],
3707 [ AC_MSG_RESULT(yes) ],
3708 [ AC_MSG_RESULT(no)
3709 system_wtmp_path=no ]
3710)
3711if test -z "$conf_wtmp_location"; then
3712 if test x"$system_wtmp_path" = x"no" ; then
3713 for f in /usr/adm/wtmp /var/log/wtmp; do
3714 if test -f $f ; then
3715 conf_wtmp_location=$f
3716 fi
3717 done
3718 if test -z "$conf_wtmp_location"; then
3719 AC_DEFINE(DISABLE_WTMP)
3720 fi
3721 fi
3722fi
3723if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003724 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3725 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003726fi
andre2ff7b5d2000-06-03 14:57:40 +00003727
3728
3729dnl utmpx detection - I don't know any system so perverse as to require
3730dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3731dnl there, though.
3732AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3733AC_TRY_COMPILE([
3734#include <sys/types.h>
3735#include <utmp.h>
3736#ifdef HAVE_UTMPX_H
3737#include <utmpx.h>
3738#endif
Damien Miller2994e082000-06-04 15:51:47 +10003739#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003740# include <paths.h>
3741#endif
3742 ],
3743 [ char *utmpx = UTMPX_FILE; ],
3744 [ AC_MSG_RESULT(yes) ],
3745 [ AC_MSG_RESULT(no)
3746 system_utmpx_path=no ]
3747)
3748if test -z "$conf_utmpx_location"; then
3749 if test x"$system_utmpx_path" = x"no" ; then
3750 AC_DEFINE(DISABLE_UTMPX)
3751 fi
3752else
Tim Rice7df8d392005-09-19 09:33:39 -07003753 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3754 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003755fi
andre2ff7b5d2000-06-03 14:57:40 +00003756
3757dnl wtmpx detection
3758AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3759AC_TRY_COMPILE([
3760#include <sys/types.h>
3761#include <utmp.h>
3762#ifdef HAVE_UTMPX_H
3763#include <utmpx.h>
3764#endif
Damien Miller2994e082000-06-04 15:51:47 +10003765#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003766# include <paths.h>
3767#endif
3768 ],
3769 [ char *wtmpx = WTMPX_FILE; ],
3770 [ AC_MSG_RESULT(yes) ],
3771 [ AC_MSG_RESULT(no)
3772 system_wtmpx_path=no ]
3773)
3774if test -z "$conf_wtmpx_location"; then
3775 if test x"$system_wtmpx_path" = x"no" ; then
3776 AC_DEFINE(DISABLE_WTMPX)
3777 fi
3778else
Tim Rice7df8d392005-09-19 09:33:39 -07003779 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3780 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003781fi
andre2ff7b5d2000-06-03 14:57:40 +00003782
Damien Miller4018c192000-04-30 09:30:44 +10003783
Damien Miller29ea30d2000-03-17 10:54:15 +11003784if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003785 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3786 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003787fi
3788
Tim Rice4cec93f2002-02-26 08:40:48 -08003789dnl remove pam and dl because they are in $LIBPAM
3790if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003791 LIBS=`echo $LIBS | sed 's/-lpam //'`
3792fi
3793if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3794 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003795fi
3796
Darren Tucker7da23cb2005-08-03 00:20:15 +10003797dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3798dnl Add now.
3799CFLAGS="$CFLAGS $werror_flags"
3800
Damien Millerbac2d8a2000-09-05 16:13:06 +11003801AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003802AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
Darren Tucker4881c372006-02-19 22:50:20 +11003803 openbsd-compat/regress/Makefile scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003804AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003805
Damien Miller7b22d652000-06-18 14:07:04 +10003806# Print summary of options
3807
Damien Miller7b22d652000-06-18 14:07:04 +10003808# Someone please show me a better way :)
3809A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3810B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3811C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3812D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003813E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003814F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003815G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003816H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3817I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3818J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003819
3820echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003821echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003822echo " User binaries: $B"
3823echo " System binaries: $C"
3824echo " Configuration files: $D"
3825echo " Askpass program: $E"
3826echo " Manual pages: $F"
3827echo " PID file: $G"
3828echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003829if test "x$external_path_file" = "x/etc/login.conf" ; then
3830echo " At runtime, sshd will use the path defined in $external_path_file"
3831echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003832else
Damien Millerf58c6722002-05-13 13:15:42 +10003833echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003834 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003835echo " (If PATH is set in $external_path_file it will be used instead. If"
3836echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3837 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003838fi
Damien Millera18bbd32002-05-13 10:48:57 +10003839if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003840echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003841fi
Damien Millerf58c6722002-05-13 13:15:42 +10003842echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003843echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003844echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10003845echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003846echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003847echo " S/KEY support: $SKEY_MSG"
3848echo " TCP Wrappers support: $TCPW_MSG"
3849echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003850echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003851echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003852echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3853echo " BSD Auth support: $BSD_AUTH_MSG"
3854echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003855if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003856echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003857fi
3858
Damien Miller7b22d652000-06-18 14:07:04 +10003859echo ""
3860
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003861echo " Host: ${host}"
3862echo " Compiler: ${CC}"
3863echo " Compiler flags: ${CFLAGS}"
3864echo "Preprocessor flags: ${CPPFLAGS}"
3865echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003866echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003867
3868echo ""
3869
Tim Rice6f1f7582004-05-30 21:38:51 -07003870if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003871 echo "SVR4 style packages are supported with \"make package\""
3872 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003873fi
3874
Damien Miller82cf0ce2000-12-20 13:34:48 +11003875if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003876 echo "PAM is enabled. You may need to install a PAM control file "
3877 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003878 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003879 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003880 echo ""
3881fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003882
Damien Miller6c21c512002-01-22 21:57:53 +11003883if test ! -z "$RAND_HELPER_CMDHASH" ; then
3884 echo "WARNING: you are using the builtin random number collection "
3885 echo "service. Please read WARNING.RNG and request that your OS "
3886 echo "vendor includes kernel-based random number collection in "
3887 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003888 echo ""
3889fi
Damien Miller60396b02001-02-18 17:01:00 +11003890
Damien Millerb4097182004-05-23 14:09:40 +10003891if test ! -z "$NO_PEERCHECK" ; then
3892 echo "WARNING: the operating system that you are using does not "
3893 echo "appear to support either the getpeereid() API nor the "
3894 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3895 echo "enforce security checks to prevent unauthorised connections to "
3896 echo "ssh-agent. Their absence increases the risk that a malicious "
3897 echo "user can connect to your agent. "
3898 echo ""
3899fi
3900
Darren Tuckerd9f88912005-02-20 21:01:48 +11003901if test "$AUDIT_MODULE" = "bsm" ; then
3902 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3903 echo "See the Solaris section in README.platform for details."
3904fi