blob: 2149f5af6af63980c7d1f31930de18bd46ffe28d [file] [log] [blame]
Darren Tucker58e298d2005-11-25 13:14:58 +11001# $Id: configure.ac,v 1.310 2005/11/25 02:14:58 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)
Tim Rice13aae5e2001-10-21 17:53:58 -070018AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100019
20AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110021AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110022AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110023AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100024
Damien Millera22ba012000-03-02 23:09:20 +110025# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100026AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110027AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100028AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110029AC_PROG_INSTALL
Ben Lindstrom582d3982001-02-06 22:54:30 +000030AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070031AC_PATH_PROG(CAT, cat)
32AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070033AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080034AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110035AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100036AC_PATH_PROG(ENT, ent)
37AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110038AC_PATH_PROG(TEST_MINUS_S_SH, bash)
39AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
40AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070041AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070042AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110043
Tim Rice6f1f7582004-05-30 21:38:51 -070044dnl for buildpkg.sh
45AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
46 [/usr/sbin${PATH_SEPARATOR}/etc])
47AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
50
Damien Millere8bb4502001-09-25 16:39:35 +100051# System features
52AC_SYS_LARGEFILE
53
Damien Miller3f62aba2000-11-29 11:56:35 +110054if test -z "$AR" ; then
55 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
56fi
57
Damien Millerad833b32000-08-23 10:46:23 +100058# Use LOGIN_PROGRAM from environment if possible
59if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070060 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
61 [If your header files don't define LOGIN_PROGRAM,
62 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100063else
64 # Search for login
65 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
66 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
67 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
68 fi
69fi
70
Darren Tucker23bc8d02004-02-06 16:24:31 +110071AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
72if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070073 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
74 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110075fi
76
Damien Miller166bd442000-03-16 10:48:25 +110077if test -z "$LD" ; then
78 LD=$CC
79fi
80AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080081
Damien Miller166bd442000-03-16 10:48:25 +110082AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100083
84AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
85
Damien Millera8e06ce2003-11-21 23:48:55 +110086if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100087 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Darren Tucker3f9545e2005-11-12 15:20:52 +110088 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -070089 case $GCC_VER in
90 1.*) ;;
91 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
92 2.*) ;;
Darren Tuckerb0288092005-11-10 14:46:48 +110093 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
Darren Tuckerf0324352005-11-10 21:30:36 +110094 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
95 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -070096 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +100097
Darren Tucker67b37032005-06-03 17:58:31 +100098 if test -z "$have_llong_max"; then
99 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
100 unset ac_cv_have_decl_LLONG_MAX
101 saved_CFLAGS="$CFLAGS"
102 CFLAGS="$CFLAGS -std=gnu99"
103 AC_CHECK_DECL(LLONG_MAX,
104 [have_llong_max=1],
105 [CFLAGS="$saved_CFLAGS"],
106 [#include <limits.h>]
107 )
108 fi
Damien Miller166bd442000-03-16 10:48:25 +1100109fi
110
Tim Rice88368a32003-12-08 12:35:59 -0800111AC_ARG_WITH(rpath,
112 [ --without-rpath Disable auto-added -R linker paths],
113 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800114 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800115 need_dash_r=""
116 fi
117 if test "x$withval" = "xyes" ; then
118 need_dash_r=1
119 fi
120 ]
121)
122
Damien Millera22ba012000-03-02 23:09:20 +1100123# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100124case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100125*-*-aix*)
Damien Millera8e06ce2003-11-21 23:48:55 +1100126 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000127 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800128 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100129 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000130 saved_LDFLAGS="$LDFLAGS"
131 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
132 if (test -z "$blibflags"); then
133 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
134 AC_TRY_LINK([], [], [blibflags=$tryflags])
135 fi
136 done
137 if (test -z "$blibflags"); then
138 AC_MSG_RESULT(not found)
139 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
140 else
141 AC_MSG_RESULT($blibflags)
142 fi
143 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000144 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700145 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
146 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700147 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000148 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700149 LIBS="$LIBS -ls"
150 ])
151 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100152 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100153 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100154 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000155 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100156 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000157 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
158 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000159 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000160 [(void)loginfailed("user","host","tty",0);],
161 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700162 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
163 [Define if your AIX loginfailed() function
164 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000165 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000166 )],
167 [],
168 [#include <usersec.h>]
169 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000170 AC_CHECK_FUNCS(setauthdb)
Darren Tucker691d5232005-02-15 21:45:57 +1100171 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700172 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
173 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
174 [Define if your platform breaks doing a seteuid before a setuid])
175 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
176 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000177 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700178 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
179 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
180 [Some systems need a utmpx entry for /bin/login to work])
181 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
182 [Define to a Set Process Title type if your system is
183 supported by bsd-setproctitle.c])
Damien Miller75b1d102000-01-07 14:01:41 +1100184 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100185*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100186 check_for_libcrypt_later=1
Tim Ricefe1d1002001-11-26 17:19:43 -0800187 LIBS="$LIBS /usr/lib/textmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700188 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
189 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
190 AC_DEFINE(DISABLE_SHADOW, 1,
191 [Define if you want to disable shadow passwords])
192 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
193 [Define if your system choked on IP TOS setting])
194 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
195 [Define if X11 doesn't support AF_UNIX sockets on that system])
196 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
197 [Define if the concept of ports only accessible to
198 superusers isn't known])
199 AC_DEFINE(DISABLE_FD_PASSING, 1,
200 [Define if your platform needs to skip post auth
201 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100202 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000203*-*-dgux*)
204 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100205 AC_DEFINE(SETEUID_BREAKS_SETUID)
206 AC_DEFINE(BROKEN_SETREUID)
207 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000208 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000209*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000210 AC_MSG_CHECKING(if we have working getaddrinfo)
211 AC_TRY_RUN([#include <mach-o/dyld.h>
212main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
213 exit(0);
214 else
215 exit(1);
216}], [AC_MSG_RESULT(working)],
217 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700218 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700219 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000220 AC_DEFINE(SETEUID_BREAKS_SETUID)
221 AC_DEFINE(BROKEN_SETREUID)
222 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700223 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
224 [Define if your resolver libs need this for getrrsetbyname])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000225 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000226*-*-hpux*)
227 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000228 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100229 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000230 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700231 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
232 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000233 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700234 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
235 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000236 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000237 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700238 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000239 AC_CHECK_LIB(xnet, t_error, ,
240 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
241
242 # next, we define all of the options specific to major releases
243 case "$host" in
244 *-*-hpux10*)
245 if test -z "$GCC"; then
246 CFLAGS="$CFLAGS -Ae"
247 fi
248 ;;
249 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700250 AC_DEFINE(PAM_SUN_CODEBASE, 1,
251 [Define if you are using Solaris-derived PAM which
252 passes pam_messages to the conversation function
253 with an extra level of indirection])
254 AC_DEFINE(DISABLE_UTMP, 1,
255 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000256 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
257 check_for_hpux_broken_getaddrinfo=1
258 check_for_conflicting_getspnam=1
259 ;;
260 esac
261
262 # lastly, we define options specific to minor releases
263 case "$host" in
264 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700265 AC_DEFINE(HAVE_SECUREWARE, 1,
266 [Define if you have SecureWare-based
267 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000268 disable_ptmx_check=yes
269 LIBS="$LIBS -lsecpw"
270 ;;
271 esac
Damien Miller1bead332000-04-30 00:47:29 +1000272 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100273*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100274 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700275 AC_DEFINE(BROKEN_INET_NTOA, 1,
276 [Define if you system's inet_ntoa is busted
277 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000278 AC_DEFINE(SETEUID_BREAKS_SETUID)
279 AC_DEFINE(BROKEN_SETREUID)
280 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700281 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
282 [Define if you shouldn't strip 'tty' from your
283 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000284 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100285 ;;
286*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100287 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700288 AC_DEFINE(WITH_IRIX_ARRAY, 1,
289 [Define if you have/want arrays
290 (cluster-wide session managment, not C arrays)])
291 AC_DEFINE(WITH_IRIX_PROJECT, 1,
292 [Define if you want IRIX project management])
293 AC_DEFINE(WITH_IRIX_AUDIT, 1,
294 [Define if you want IRIX audit trails])
295 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
296 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000297 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000298 AC_DEFINE(SETEUID_BREAKS_SETUID)
299 AC_DEFINE(BROKEN_SETREUID)
300 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700301 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000302 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000303 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100304 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100305*-*-linux*)
306 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100307 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000308 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700309 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
310 AC_DEFINE(PAM_TTY_KLUDGE, 1,
311 [Work around problematic Linux PAM modules handling of PAM_TTY])
312 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
313 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000314 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700315 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
316 [Define to whatever link() returns for "not supported"
317 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100318 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700319 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100320 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000321 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000322 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700323 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
324 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000325 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000326 esac
Damien Millerb29ea912000-01-15 14:12:03 +1100327 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000328mips-sony-bsd|mips-sony-newsos4)
Tim Rice7df8d392005-09-19 09:33:39 -0700329 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000330 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000331 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100332*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000333 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800334 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800335 need_dash_r=1
336 fi
Damien Milleree1c0b32000-01-21 00:18:15 +1100337 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100338*-*-freebsd*)
339 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000340 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Millerfbd884a2001-02-27 08:39:07 +1100341 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000342*-*-bsdi*)
343 AC_DEFINE(SETEUID_BREAKS_SETUID)
344 AC_DEFINE(BROKEN_SETREUID)
345 AC_DEFINE(BROKEN_SETREGID)
346 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000347*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000348 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100349 conf_utmp_location=/etc/utmp
350 conf_wtmp_location=/usr/adm/wtmp
351 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700352 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000353 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000354 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700355 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000356 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000357*-*-openbsd*)
358 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000359 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Darren Tucker4a422572005-07-14 17:22:11 +1000360 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100361*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800362 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800363 need_dash_r=1
364 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100365 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000366 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700367 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
368 [Some versions of /bin/login need the TERM supplied
369 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000370 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700371 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
372 [Define if pam_chauthtok wants real uid set
373 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000374 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000375 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700376 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
377 [Define if sshd somehow reacquires a controlling TTY
378 after setsid()])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000379 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000380 # hardwire lastlog location (can't detect it on some versions)
381 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000382 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
383 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
384 if test "$sol2ver" -ge 8; then
385 AC_MSG_RESULT(yes)
386 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700387 AC_DEFINE(DISABLE_WTMP, 1,
388 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000389 else
390 AC_MSG_RESULT(no)
391 fi
Damien Miller75b1d102000-01-07 14:01:41 +1100392 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000393*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000394 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000395 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100396 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000397 conf_utmp_location=/etc/utmp
398 conf_wtmp_location=/var/adm/wtmp
399 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000400 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000401 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000402*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700403 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000404 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000405 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000406 AC_DEFINE(SETEUID_BREAKS_SETUID)
407 AC_DEFINE(BROKEN_SETREUID)
408 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000409 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000410*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700411 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000412 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100413 # -lresolv needs to be at the end of LIBS or DNS lookups break
414 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100415 IPADDR_IN_DISPLAY=yes
416 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000417 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000418 AC_DEFINE(SETEUID_BREAKS_SETUID)
419 AC_DEFINE(BROKEN_SETREUID)
420 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000421 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000422 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700423 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
424 # Attention: always take care to bind libsocket and libnsl before libc,
425 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000426 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800427# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100428*-*-sysv4.2*)
Damien Miller57f39152005-11-24 19:58:19 +1100429 CFLAGS="$CFLAGS -Dva_list=_VA_LIST"
Damien Miller5dfe9762001-02-16 12:05:39 +1100430 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700431 AC_DEFINE(SETEUID_BREAKS_SETUID)
432 AC_DEFINE(BROKEN_SETREUID)
433 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700434 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Damien Miller78315eb2000-09-29 23:01:36 +1100435 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800436# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100437*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700438 check_for_libcrypt_later=1
439 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100440 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700441 AC_DEFINE(SETEUID_BREAKS_SETUID)
442 AC_DEFINE(BROKEN_SETREUID)
443 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700444 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700445 case "$host" in
446 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
447 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700448 AC_DEFINE(BROKEN_LIBIAF, 1,
449 [ia_uinfo routines not supported by OS yet])
Tim Rice4dbacff2005-06-01 20:09:28 -0700450 ;;
451 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100452 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100453*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100454 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800455# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100456*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800457 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100458 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800459# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100460*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800461 if test -z "$GCC"; then
462 CFLAGS="$CFLAGS -belf"
463 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100464 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000465 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100466 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000467 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000468 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700469 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700470 AC_DEFINE(SETEUID_BREAKS_SETUID)
471 AC_DEFINE(BROKEN_SETREUID)
472 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700473 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700474 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700475 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100476 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700477 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700478 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000479 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000480*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700481 AC_DEFINE(NO_SSH_LASTLOG, 1,
482 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100483 AC_DEFINE(SETEUID_BREAKS_SETUID)
484 AC_DEFINE(BROKEN_SETREUID)
485 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000486 AC_DEFINE(USE_PIPES)
487 AC_DEFINE(DISABLE_FD_PASSING)
488 LDFLAGS="$LDFLAGS"
489 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
490 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000491 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000492*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100493 AC_DEFINE(SETEUID_BREAKS_SETUID)
494 AC_DEFINE(BROKEN_SETREUID)
495 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000496 AC_DEFINE(WITH_ABBREV_NO_TTY)
497 AC_DEFINE(USE_PIPES)
498 AC_DEFINE(DISABLE_FD_PASSING)
499 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100500 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000501 MANTYPE=cat
502 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000503*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100504 AC_DEFINE(SETEUID_BREAKS_SETUID)
505 AC_DEFINE(BROKEN_SETREUID)
506 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000507 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700508 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700509 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000510 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
511 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
512 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700513 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000514*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000515 AC_MSG_CHECKING(for Digital Unix SIA)
516 no_osfsia=""
517 AC_ARG_WITH(osfsia,
518 [ --with-osfsia Enable Digital Unix SIA],
519 [
520 if test "x$withval" = "xno" ; then
521 AC_MSG_RESULT(disabled)
522 no_osfsia=1
523 fi
524 ],
525 )
526 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000527 if test -f /etc/sia/matrix.conf; then
528 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700529 AC_DEFINE(HAVE_OSF_SIA, 1,
530 [Define if you have Digital Unix Security
531 Integration Architecture])
532 AC_DEFINE(DISABLE_LOGIN, 1,
533 [Define if you don't want to use your
534 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000535 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000536 LIBS="$LIBS -lsecurity -ldb -lm -laud"
537 else
538 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700539 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
540 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000541 fi
542 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000543 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700544 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000545 AC_DEFINE(BROKEN_SETREUID)
546 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000547 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000548
549*-*-nto-qnx)
550 AC_DEFINE(USE_PIPES)
551 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700552 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
553 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
554 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000555 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000556
557*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700558 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
559 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
560 AC_DEFINE(NEED_SETPRGP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700561 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
562 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000563
564*-*-lynxos)
565 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700566 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000567 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
568 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100569esac
570
Damien Millere37bfc12000-06-05 09:37:43 +1000571# Allow user to specify flags
572AC_ARG_WITH(cflags,
573 [ --with-cflags Specify additional flags to pass to compiler],
574 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800575 if test -n "$withval" && test "x$withval" != "xno" && \
576 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000577 CFLAGS="$CFLAGS $withval"
578 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800579 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000580)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000581AC_ARG_WITH(cppflags,
582 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
583 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800584 if test -n "$withval" && test "x$withval" != "xno" && \
585 test "x${withval}" != "xyes"; then
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000586 CPPFLAGS="$CPPFLAGS $withval"
587 fi
588 ]
589)
Damien Millere37bfc12000-06-05 09:37:43 +1000590AC_ARG_WITH(ldflags,
Ben Lindstrom2ed98182000-11-06 07:15:43 +0000591 [ --with-ldflags Specify additional flags to pass to linker],
Damien Millere37bfc12000-06-05 09:37:43 +1000592 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800593 if test -n "$withval" && test "x$withval" != "xno" && \
594 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000595 LDFLAGS="$LDFLAGS $withval"
596 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800597 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000598)
599AC_ARG_WITH(libs,
600 [ --with-libs Specify additional libraries to link with],
601 [
Tim Rice35cc69d2005-03-17 16:44:25 -0800602 if test -n "$withval" && test "x$withval" != "xno" && \
603 test "x${withval}" != "xyes"; then
Damien Millere37bfc12000-06-05 09:37:43 +1000604 LIBS="$LIBS $withval"
605 fi
Tim Riceeae17cc2005-03-17 16:52:20 -0800606 ]
Damien Millere37bfc12000-06-05 09:37:43 +1000607)
Darren Tucker7da23cb2005-08-03 00:20:15 +1000608AC_ARG_WITH(Werror,
609 [ --with-Werror Build main code with -Werror],
610 [
611 if test -n "$withval" && test "x$withval" != "xno"; then
612 werror_flags="-Werror"
Damien Millere04ec6f2005-10-08 16:21:19 +1000613 if test "x${withval}" != "xyes"; then
Darren Tucker7da23cb2005-08-03 00:20:15 +1000614 werror_flags="$withval"
615 fi
616 fi
617 ]
618)
Damien Millere37bfc12000-06-05 09:37:43 +1000619
Darren Tucker6eb93042003-06-29 21:30:41 +1000620AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000621AC_RUN_IFELSE(
622 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000623#include <stdio.h>
624int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000625 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000626 [ AC_MSG_RESULT(yes) ],
627 [
628 AC_MSG_RESULT(no)
629 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000630 ],
631 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000632)
633
Darren Tucker0c9653f2005-05-28 15:58:14 +1000634dnl Checks for header files.
635AC_CHECK_HEADERS( \
636 bstring.h \
637 crypt.h \
638 dirent.h \
639 endian.h \
640 features.h \
641 floatingpoint.h \
642 getopt.h \
643 glob.h \
644 ia.h \
Tim Rice2291c002005-08-26 13:15:19 -0700645 iaf.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000646 lastlog.h \
647 limits.h \
648 login.h \
649 login_cap.h \
650 maillock.h \
651 ndir.h \
652 netdb.h \
653 netgroup.h \
654 netinet/in_systm.h \
655 pam/pam_appl.h \
656 paths.h \
657 pty.h \
658 readpassphrase.h \
659 rpc/types.h \
660 security/pam_appl.h \
661 shadow.h \
662 stddef.h \
663 stdint.h \
Darren Tucker390b6d52005-05-28 16:54:36 +1000664 string.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000665 strings.h \
666 sys/audit.h \
667 sys/bitypes.h \
668 sys/bsdtty.h \
669 sys/cdefs.h \
670 sys/dir.h \
671 sys/mman.h \
672 sys/ndir.h \
673 sys/prctl.h \
674 sys/pstat.h \
675 sys/select.h \
676 sys/stat.h \
677 sys/stream.h \
678 sys/stropts.h \
679 sys/strtio.h \
680 sys/sysmacros.h \
681 sys/time.h \
682 sys/timers.h \
683 sys/un.h \
684 time.h \
685 tmpdir.h \
686 ttyent.h \
Darren Tucker7d2171b2005-05-28 16:57:00 +1000687 unistd.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000688 usersec.h \
689 util.h \
690 utime.h \
691 utmp.h \
692 utmpx.h \
Darren Tuckere910be12005-05-28 16:01:18 +1000693 vis.h \
Darren Tucker0c9653f2005-05-28 15:58:14 +1000694)
Tim Rice4cec93f2002-02-26 08:40:48 -0800695
Darren Tucker48d99d32004-08-29 17:04:50 +1000696# sys/ptms.h requires sys/stream.h to be included first on Solaris
697AC_CHECK_HEADERS(sys/ptms.h, [], [], [
698#ifdef HAVE_SYS_STREAM_H
699# include <sys/stream.h>
700#endif
701])
702
Damien Millera22ba012000-03-02 23:09:20 +1100703# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700704AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
705AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000706
Tim Rice1e1ef642003-09-11 22:19:31 -0700707dnl IRIX and Solaris 2.5.1 have dirname() in libgen
708AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
709 AC_CHECK_LIB(gen, dirname,[
710 AC_CACHE_CHECK([for broken dirname],
711 ac_cv_have_broken_dirname, [
712 save_LIBS="$LIBS"
713 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000714 AC_RUN_IFELSE(
715 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700716#include <libgen.h>
717#include <string.h>
718
719int main(int argc, char **argv) {
720 char *s, buf[32];
721
722 strncpy(buf,"/etc", 32);
723 s = dirname(buf);
724 if (!s || strncmp(s, "/", 32) != 0) {
725 exit(1);
726 } else {
727 exit(0);
728 }
729}
Darren Tucker314d89e2005-10-17 23:29:23 +1000730 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700731 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000732 [ ac_cv_have_broken_dirname="yes" ],
733 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700734 )
735 LIBS="$save_LIBS"
736 ])
737 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
738 LIBS="$LIBS -lgen"
739 AC_DEFINE(HAVE_DIRNAME)
740 AC_CHECK_HEADERS(libgen.h)
741 fi
742 ])
743])
744
745AC_CHECK_FUNC(getspnam, ,
746 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700747AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
748 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700749
Tim Rice13aae5e2001-10-21 17:53:58 -0700750dnl zlib is required
751AC_ARG_WITH(zlib,
752 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100753 [ if test "x$withval" = "xno" ; then
754 AC_MSG_ERROR([*** zlib is required ***])
755 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700756 if test -d "$withval/lib"; then
757 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700758 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700759 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700760 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700761 fi
762 else
763 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700764 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700765 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700766 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700767 fi
768 fi
769 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700770 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700771 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700772 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700773 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100774 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700775)
776
Tim Ricefcb62202004-01-23 18:35:16 -0800777AC_CHECK_LIB(z, deflate, ,
778 [
779 saved_CPPFLAGS="$CPPFLAGS"
780 saved_LDFLAGS="$LDFLAGS"
781 save_LIBS="$LIBS"
782 dnl Check default zlib install dir
783 if test -n "${need_dash_r}"; then
784 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
785 else
786 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
787 fi
788 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
789 LIBS="$LIBS -lz"
790 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
791 [
792 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
793 ]
794 )
795 ]
796)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100797AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100798
799AC_ARG_WITH(zlib-version-check,
800 [ --without-zlib-version-check Disable zlib version check],
801 [ if test "x$withval" = "xno" ; then
802 zlib_check_nonfatal=1
803 fi
804 ]
805)
806
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000807AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000808AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000809#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100810#include <zlib.h>
811int main()
812{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000813 int a=0, b=0, c=0, d=0, n, v;
814 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
815 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100816 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000817 v = a*1000000 + b*10000 + c*100 + d;
818 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
819
820 /* 1.1.4 is OK */
821 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100822 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000823
Darren Tucker41097ed2005-07-25 15:24:21 +1000824 /* 1.2.3 and up are OK */
825 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000826 exit(0);
827
Darren Tucker2dcd2392004-01-23 17:13:33 +1100828 exit(2);
829}
Darren Tucker623d92f2004-09-12 22:36:15 +1000830 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000831 AC_MSG_RESULT(no),
832 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100833 if test -z "$zlib_check_nonfatal" ; then
834 AC_MSG_ERROR([*** zlib too old - check config.log ***
835Your reported zlib version has known security problems. It's possible your
836vendor has fixed these problems without changing the version number. If you
837are sure this is the case, you can disable the check by running
838"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000839If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000840See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100841 else
842 AC_MSG_WARN([zlib version may have security problems])
843 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000844 ],
845 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100846)
Damien Miller6f9c3372000-10-25 10:06:04 +1100847
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000848dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100849AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000850 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
851)
Darren Tucker5bfe1682005-11-12 18:42:36 +1100852AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700853 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
854 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000855)
Damien Millerab18c411999-11-11 10:40:23 +1100856
Tim Ricee589a292001-11-03 11:09:32 -0800857dnl Checks for libutil functions
858AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700859AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
860 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800861AC_CHECK_FUNCS(logout updwtmp logwtmp)
862
Ben Lindstrom8697e082001-02-24 21:41:10 +0000863AC_FUNC_STRFTIME
864
Damien Miller3c027682001-03-14 11:39:45 +1100865# Check for ALTDIRFUNC glob() extension
866AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
867AC_EGREP_CPP(FOUNDIT,
868 [
869 #include <glob.h>
870 #ifdef GLOB_ALTDIRFUNC
871 FOUNDIT
872 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100873 ],
Damien Miller3c027682001-03-14 11:39:45 +1100874 [
Tim Rice7df8d392005-09-19 09:33:39 -0700875 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
876 [Define if your system glob() function has
877 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +1100878 AC_MSG_RESULT(yes)
879 ],
880 [
881 AC_MSG_RESULT(no)
882 ]
883)
Damien Millerab18c411999-11-11 10:40:23 +1100884
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000885# Check for g.gl_matchc glob() extension
886AC_MSG_CHECKING(for gl_matchc field in glob_t)
887AC_EGREP_CPP(FOUNDIT,
Damien Millera8e06ce2003-11-21 23:48:55 +1100888 [
889 #include <glob.h>
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000890 int main(void){glob_t g; g.gl_matchc = 1;}
Damien Millera8e06ce2003-11-21 23:48:55 +1100891 ],
892 [
Tim Rice7df8d392005-09-19 09:33:39 -0700893 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
894 [Define if your system glob() function has
895 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +1100896 AC_MSG_RESULT(yes)
897 ],
898 [
899 AC_MSG_RESULT(no)
900 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +0000901)
902
Damien Miller18bb4732001-03-28 14:35:30 +1000903AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000904AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +1000905 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +1000906#include <sys/types.h>
907#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700908int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +1000909 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +1100910 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +1000911 [
912 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700913 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +1100914 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -0700915 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000916 ],
Tim Riceeae17cc2005-03-17 16:52:20 -0800917 [
Darren Tuckera0c2b392004-09-11 23:26:37 +1000918 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
919 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +1000920 ]
921)
922
Damien Miller36f49652004-08-15 18:40:59 +1000923AC_MSG_CHECKING([for /proc/pid/fd directory])
924if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -0700925 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +1000926 AC_MSG_RESULT(yes)
927else
928 AC_MSG_RESULT(no)
929fi
930
Damien Millerc547bf12001-02-16 10:18:12 +1100931# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +1100932SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100933AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100934 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100935 [
936 if test "x$withval" != "xno" ; then
937
938 if test "x$withval" != "xyes" ; then
939 CPPFLAGS="$CPPFLAGS -I${withval}/include"
940 LDFLAGS="$LDFLAGS -L${withval}/lib"
941 fi
942
Tim Rice7df8d392005-09-19 09:33:39 -0700943 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +1100944 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +1100945 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -0800946
Tim Rice4cec93f2002-02-26 08:40:48 -0800947 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +1000948 AC_LINK_IFELSE(
949 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -0800950#include <stdio.h>
951#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -0700952int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +1000953 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -0800954 [AC_MSG_RESULT(yes)],
955 [
956 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +1100957 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
958 ])
Darren Tucker3b908f62004-04-14 15:26:39 +1000959 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
960 AC_TRY_COMPILE(
961 [#include <stdio.h>
962 #include <skey.h>],
963 [(void)skeychallenge(NULL,"name","",0);],
964 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700965 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
966 [Define if your skeychallenge()
967 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +1000968 [AC_MSG_RESULT(no)]
969 )
Damien Millerc547bf12001-02-16 10:18:12 +1100970 fi
971 ]
972)
973
974# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -0700975TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +1100976AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +1100977 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +1100978 [
979 if test "x$withval" != "xno" ; then
980 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -0700981 saved_LDFLAGS="$LDFLAGS"
982 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -0800983 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -0800984 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700985 if test -d "${withval}/lib"; then
986 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700987 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700988 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700989 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700990 fi
991 else
992 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700993 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700994 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700995 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700996 fi
997 fi
998 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700999 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001000 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001001 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001002 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001003 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001004 LIBWRAP="-lwrap"
1005 LIBS="$LIBWRAP $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001006 AC_MSG_CHECKING(for libwrap)
1007 AC_TRY_LINK(
1008 [
Damien Miller0ac45002004-04-14 20:14:26 +10001009#include <sys/types.h>
1010#include <sys/socket.h>
1011#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001012#include <tcpd.h>
1013 int deny_severity = 0, allow_severity = 0;
1014 ],
1015 [hosts_access(0);],
1016 [
1017 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001018 AC_DEFINE(LIBWRAP, 1,
1019 [Define if you want
1020 TCP Wrappers support])
Tim Rice4cec93f2002-02-26 08:40:48 -08001021 AC_SUBST(LIBWRAP)
Tim Rice13aae5e2001-10-21 17:53:58 -07001022 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001023 ],
1024 [
1025 AC_MSG_ERROR([*** libwrap missing])
1026 ]
1027 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001028 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001029 fi
1030 ]
1031)
1032
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001033# Check whether user wants libedit support
1034LIBEDIT_MSG="no"
1035AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001036 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001037 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001038 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001039 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1040 if test -n "${need_dash_r}"; then
1041 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1042 else
1043 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1044 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001045 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001046 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001047 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001048 LIBEDIT="-ledit -lcurses"
1049 LIBEDIT_MSG="yes"
1050 AC_SUBST(LIBEDIT)
1051 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001052 [ AC_MSG_ERROR(libedit not found) ],
1053 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001054 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001055 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001056 AC_COMPILE_IFELSE(
1057 [AC_LANG_SOURCE([[
1058#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001059int main(void)
1060{
1061 int i = H_SETSIZE;
1062 el_init("", NULL, NULL, NULL);
1063 exit(0);
1064}
Tim Ricec1819c82005-08-15 17:48:40 -07001065 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001066 [ AC_MSG_RESULT(yes) ],
1067 [ AC_MSG_RESULT(no)
1068 AC_MSG_ERROR(libedit version is not compatible) ]
1069 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001070 fi ]
1071)
1072
Darren Tuckerd9f88912005-02-20 21:01:48 +11001073AUDIT_MODULE=none
1074AC_ARG_WITH(audit,
1075 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1076 [
1077 AC_MSG_CHECKING(for supported audit module)
1078 case "$withval" in
1079 bsm)
1080 AC_MSG_RESULT(bsm)
1081 AUDIT_MODULE=bsm
1082 dnl Checks for headers, libs and functions
1083 AC_CHECK_HEADERS(bsm/audit.h, [],
1084 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1085 AC_CHECK_LIB(bsm, getaudit, [],
1086 [AC_MSG_ERROR(BSM enabled and required library not found)])
1087 AC_CHECK_FUNCS(getaudit, [],
1088 [AC_MSG_ERROR(BSM enabled and required function not found)])
1089 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001090 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001091 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001092 ;;
1093 debug)
1094 AUDIT_MODULE=debug
1095 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001096 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001097 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001098 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001099 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001100 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001101 *)
1102 AC_MSG_ERROR([Unknown audit module $withval])
1103 ;;
1104 esac ]
1105)
1106
Damien Millerfe1f1432003-02-24 15:45:42 +11001107dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001108AC_CHECK_FUNCS( \
1109 arc4random \
Damien Miller57f39152005-11-24 19:58:19 +11001110 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001111 b64_ntop \
1112 __b64_ntop \
1113 b64_pton \
1114 __b64_pton \
1115 bcopy \
1116 bindresvport_sa \
1117 clock \
1118 closefrom \
1119 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001120 fchmod \
1121 fchown \
1122 freeaddrinfo \
1123 futimes \
1124 getaddrinfo \
1125 getcwd \
1126 getgrouplist \
1127 getnameinfo \
1128 getopt \
1129 getpeereid \
1130 _getpty \
1131 getrlimit \
1132 getttyent \
1133 glob \
1134 inet_aton \
1135 inet_ntoa \
1136 inet_ntop \
1137 innetgr \
1138 login_getcapbool \
1139 md5_crypt \
1140 memmove \
1141 mkdtemp \
1142 mmap \
1143 ngetaddrinfo \
1144 nsleep \
1145 ogetaddrinfo \
1146 openlog_r \
1147 openpty \
1148 prctl \
1149 pstat \
1150 readpassphrase \
1151 realpath \
1152 recvmsg \
1153 rresvport_af \
1154 sendmsg \
1155 setdtablesize \
1156 setegid \
1157 setenv \
1158 seteuid \
1159 setgroups \
1160 setlogin \
1161 setpcred \
1162 setproctitle \
1163 setregid \
1164 setreuid \
1165 setrlimit \
1166 setsid \
1167 setvbuf \
1168 sigaction \
1169 sigvec \
1170 snprintf \
1171 socketpair \
1172 strdup \
1173 strerror \
1174 strlcat \
1175 strlcpy \
1176 strmode \
1177 strnvis \
1178 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001179 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001180 strtoul \
1181 sysconf \
1182 tcgetpgrp \
1183 truncate \
1184 unsetenv \
1185 updwtmpx \
Damien Miller57f39152005-11-24 19:58:19 +11001186 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001187 vhangup \
1188 vsnprintf \
1189 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001190)
Tim Rice13aae5e2001-10-21 17:53:58 -07001191
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001192# IRIX has a const char return value for gai_strerror()
1193AC_CHECK_FUNCS(gai_strerror,[
1194 AC_DEFINE(HAVE_GAI_STRERROR)
1195 AC_TRY_COMPILE([
1196#include <sys/types.h>
1197#include <sys/socket.h>
1198#include <netdb.h>
1199
1200const char *gai_strerror(int);],[
1201char *str;
1202
1203str = gai_strerror(0);],[
1204 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1205 [Define if gai_strerror() returns const char *])])])
1206
Tim Rice7df8d392005-09-19 09:33:39 -07001207AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1208 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001209
Darren Tuckerf1159b52003-07-07 19:44:01 +10001210dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001211AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001212AC_CHECK_DECL(strsep,
1213 [AC_CHECK_FUNCS(strsep)],
1214 [],
1215 [
1216#ifdef HAVE_STRING_H
1217# include <string.h>
1218#endif
1219 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001220
Darren Tuckerb2427c82003-09-10 15:22:44 +10001221dnl tcsendbreak might be a macro
1222AC_CHECK_DECL(tcsendbreak,
1223 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001224 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001225 [#include <termios.h>]
1226)
1227
Darren Tucker5bb14002004-04-23 18:53:10 +10001228AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1229
Darren Tucker2a6b0292003-12-31 14:59:17 +11001230AC_CHECK_FUNCS(setresuid, [
1231 dnl Some platorms have setresuid that isn't implemented, test for this
1232 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001233 AC_RUN_IFELSE(
1234 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001235#include <stdlib.h>
1236#include <errno.h>
1237int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001238 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001239 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001240 [AC_DEFINE(BROKEN_SETRESUID, 1,
1241 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001242 AC_MSG_RESULT(not implemented)],
1243 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001244 )
1245])
Darren Tuckere937be32003-12-17 18:53:26 +11001246
Darren Tucker2a6b0292003-12-31 14:59:17 +11001247AC_CHECK_FUNCS(setresgid, [
1248 dnl Some platorms have setresgid that isn't implemented, test for this
1249 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001250 AC_RUN_IFELSE(
1251 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001252#include <stdlib.h>
1253#include <errno.h>
1254int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001255 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001256 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001257 [AC_DEFINE(BROKEN_SETRESGID, 1,
1258 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001259 AC_MSG_RESULT(not implemented)],
1260 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001261 )
1262])
Darren Tuckere937be32003-12-17 18:53:26 +11001263
Damien Millerad833b32000-08-23 10:46:23 +10001264dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001265AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001266dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001267AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001268AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001269dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001270AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001271AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001272
Damien Millera8e06ce2003-11-21 23:48:55 +11001273AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001274 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1275 [AC_CHECK_LIB(bsd, daemon,
1276 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001277)
1278
Damien Millera8e06ce2003-11-21 23:48:55 +11001279AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001280 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1281 [Define if your libraries define getpagesize()])],
1282 [AC_CHECK_LIB(ucb, getpagesize,
1283 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001284)
1285
Damien Millercb170cb2000-07-01 16:52:55 +10001286# Check for broken snprintf
1287if test "x$ac_cv_func_snprintf" = "xyes" ; then
1288 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001289 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001290 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001291#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001292int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001293 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001294 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001295 [
1296 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001297 AC_DEFINE(BROKEN_SNPRINTF, 1,
1298 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001299 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001300 ],
1301 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001302 )
1303fi
1304
Damien Miller57f39152005-11-24 19:58:19 +11001305# If we don't have a working asprintf, then we strongly depend on vsnprintf
1306# returning the right thing on overflow: the number of characters it tried to
1307# create (as per SUSv3)
1308if test "x$ac_cv_func_asprintf" != "xyes" && \
1309 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1310 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1311 AC_RUN_IFELSE(
1312 [AC_LANG_SOURCE([[
1313#include <sys/types.h>
1314#include <stdio.h>
1315#include <stdarg.h>
1316
1317int x_snprintf(char *str,size_t count,const char *fmt,...)
1318{
1319 size_t ret; va_list ap;
1320 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1321 return ret;
1322}
1323int main(void)
1324{
1325 char x[1];
1326 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1327} ]])],
1328 [AC_MSG_RESULT(yes)],
1329 [
1330 AC_MSG_RESULT(no)
1331 AC_DEFINE(BROKEN_SNPRINTF, 1,
1332 [Define if your snprintf is busted])
1333 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1334 ],
1335 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1336 )
1337fi
1338
Damien Millerb4097182004-05-23 14:09:40 +10001339# Check for missing getpeereid (or equiv) support
1340NO_PEERCHECK=""
1341if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1342 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1343 AC_TRY_COMPILE(
1344 [#include <sys/types.h>
1345 #include <sys/socket.h>],
1346 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001347 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001348 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001349 ],
Damien Millerb4097182004-05-23 14:09:40 +10001350 [AC_MSG_RESULT(no)
1351 NO_PEERCHECK=1]
1352 )
1353fi
1354
Damien Millere8328192003-01-07 15:18:32 +11001355dnl see whether mkstemp() requires XXXXXX
1356if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1357AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001358AC_RUN_IFELSE(
1359 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001360#include <stdlib.h>
1361main() { char template[]="conftest.mkstemp-test";
1362if (mkstemp(template) == -1)
1363 exit(1);
1364unlink(template); exit(0);
1365}
Darren Tucker314d89e2005-10-17 23:29:23 +10001366 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001367 [
1368 AC_MSG_RESULT(no)
1369 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001370 [
Damien Millere8328192003-01-07 15:18:32 +11001371 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001372 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001373 ],
1374 [
1375 AC_MSG_RESULT(yes)
1376 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001377 ]
Damien Millere8328192003-01-07 15:18:32 +11001378)
1379fi
1380
Darren Tucker70a3d552003-08-21 17:58:29 +10001381dnl make sure that openpty does not reacquire controlling terminal
1382if test ! -z "$check_for_openpty_ctty_bug"; then
1383 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001384 AC_RUN_IFELSE(
1385 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001386#include <stdio.h>
1387#include <sys/fcntl.h>
1388#include <sys/types.h>
1389#include <sys/wait.h>
1390
1391int
1392main()
1393{
1394 pid_t pid;
1395 int fd, ptyfd, ttyfd, status;
1396
1397 pid = fork();
1398 if (pid < 0) { /* failed */
1399 exit(1);
1400 } else if (pid > 0) { /* parent */
1401 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001402 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001403 exit(WEXITSTATUS(status));
1404 else
1405 exit(2);
1406 } else { /* child */
1407 close(0); close(1); close(2);
1408 setsid();
1409 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1410 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1411 if (fd >= 0)
1412 exit(3); /* Acquired ctty: broken */
1413 else
1414 exit(0); /* Did not acquire ctty: OK */
1415 }
1416}
Darren Tucker314d89e2005-10-17 23:29:23 +10001417 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001418 [
1419 AC_MSG_RESULT(yes)
1420 ],
1421 [
1422 AC_MSG_RESULT(no)
1423 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001424 ],
1425 [
1426 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001427 ]
1428 )
1429fi
1430
Tim Rice8bb561b2005-03-17 16:23:19 -08001431if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1432 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001433 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001434 AC_RUN_IFELSE(
1435 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001436#include <stdio.h>
1437#include <sys/socket.h>
1438#include <netdb.h>
1439#include <errno.h>
1440#include <netinet/in.h>
1441
1442#define TEST_PORT "2222"
1443
1444int
1445main(void)
1446{
1447 int err, sock;
1448 struct addrinfo *gai_ai, *ai, hints;
1449 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1450
1451 memset(&hints, 0, sizeof(hints));
1452 hints.ai_family = PF_UNSPEC;
1453 hints.ai_socktype = SOCK_STREAM;
1454 hints.ai_flags = AI_PASSIVE;
1455
1456 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1457 if (err != 0) {
1458 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1459 exit(1);
1460 }
1461
1462 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1463 if (ai->ai_family != AF_INET6)
1464 continue;
1465
1466 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1467 sizeof(ntop), strport, sizeof(strport),
1468 NI_NUMERICHOST|NI_NUMERICSERV);
1469
1470 if (err != 0) {
1471 if (err == EAI_SYSTEM)
1472 perror("getnameinfo EAI_SYSTEM");
1473 else
1474 fprintf(stderr, "getnameinfo failed: %s\n",
1475 gai_strerror(err));
1476 exit(2);
1477 }
1478
1479 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1480 if (sock < 0)
1481 perror("socket");
1482 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1483 if (errno == EBADF)
1484 exit(3);
1485 }
1486 }
1487 exit(0);
1488}
Darren Tucker314d89e2005-10-17 23:29:23 +10001489 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001490 [
1491 AC_MSG_RESULT(yes)
1492 ],
1493 [
1494 AC_MSG_RESULT(no)
1495 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001496 ],
1497 [
1498 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001499 ]
1500 )
1501fi
1502
Tim Rice8bb561b2005-03-17 16:23:19 -08001503if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1504 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001505 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001506 AC_RUN_IFELSE(
1507 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001508#include <stdio.h>
1509#include <sys/socket.h>
1510#include <netdb.h>
1511#include <errno.h>
1512#include <netinet/in.h>
1513
1514#define TEST_PORT "2222"
1515
1516int
1517main(void)
1518{
1519 int err, sock;
1520 struct addrinfo *gai_ai, *ai, hints;
1521 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1522
1523 memset(&hints, 0, sizeof(hints));
1524 hints.ai_family = PF_UNSPEC;
1525 hints.ai_socktype = SOCK_STREAM;
1526 hints.ai_flags = AI_PASSIVE;
1527
1528 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1529 if (err != 0) {
1530 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1531 exit(1);
1532 }
1533
1534 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1535 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1536 continue;
1537
1538 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1539 sizeof(ntop), strport, sizeof(strport),
1540 NI_NUMERICHOST|NI_NUMERICSERV);
1541
1542 if (ai->ai_family == AF_INET && err != 0) {
1543 perror("getnameinfo");
1544 exit(2);
1545 }
1546 }
1547 exit(0);
1548}
Darren Tucker314d89e2005-10-17 23:29:23 +10001549 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001550 [
1551 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001552 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1553 [Define if you have a getaddrinfo that fails
1554 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001555 ],
1556 [
1557 AC_MSG_RESULT(no)
1558 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001559 ],
1560 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001561 ]
1562 )
1563fi
1564
Darren Tuckera56f1912004-11-02 20:30:54 +11001565if test "x$check_for_conflicting_getspnam" = "x1"; then
1566 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1567 AC_COMPILE_IFELSE(
1568 [
1569#include <shadow.h>
1570int main(void) {exit(0);}
1571 ],
1572 [
1573 AC_MSG_RESULT(no)
1574 ],
1575 [
1576 AC_MSG_RESULT(yes)
1577 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1578 [Conflicting defs for getspnam])
1579 ]
1580 )
1581fi
1582
Damien Miller606f8802000-09-16 15:39:56 +11001583AC_FUNC_GETPGRP
1584
Damien Millera64b57a2001-01-17 10:44:13 +11001585# Check for PAM libs
Damien Miller7b22d652000-06-18 14:07:04 +10001586PAM_MSG="no"
Damien Millera22ba012000-03-02 23:09:20 +11001587AC_ARG_WITH(pam,
Damien Millera64b57a2001-01-17 10:44:13 +11001588 [ --with-pam Enable PAM support ],
Damien Millera22ba012000-03-02 23:09:20 +11001589 [
Damien Millera64b57a2001-01-17 10:44:13 +11001590 if test "x$withval" != "xno" ; then
Damien Miller0f47c532004-01-02 18:01:30 +11001591 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1592 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
Damien Millera64b57a2001-01-17 10:44:13 +11001593 AC_MSG_ERROR([PAM headers not found])
1594 fi
1595
1596 AC_CHECK_LIB(dl, dlopen, , )
1597 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1598 AC_CHECK_FUNCS(pam_getenvlist)
Darren Tucker49aaf4a2003-08-26 11:58:16 +10001599 AC_CHECK_FUNCS(pam_putenv)
Damien Millera64b57a2001-01-17 10:44:13 +11001600
Damien Millera64b57a2001-01-17 10:44:13 +11001601 PAM_MSG="yes"
1602
Tim Rice7df8d392005-09-19 09:33:39 -07001603 AC_DEFINE(USE_PAM, 1,
1604 [Define if you want to enable PAM support])
Tim Rice7d2d1f12002-02-26 22:05:11 -08001605 if test $ac_cv_lib_dl_dlopen = yes; then
1606 LIBPAM="-lpam -ldl"
1607 else
1608 LIBPAM="-lpam"
1609 fi
1610 AC_SUBST(LIBPAM)
Damien Millera22ba012000-03-02 23:09:20 +11001611 fi
1612 ]
1613)
Damien Millera22ba012000-03-02 23:09:20 +11001614
Damien Millera64b57a2001-01-17 10:44:13 +11001615# Check for older PAM
1616if test "x$PAM_MSG" = "xyes" ; then
Damien Millera22ba012000-03-02 23:09:20 +11001617 # Check PAM strerror arguments (old PAM)
1618 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1619 AC_TRY_COMPILE(
1620 [
Damien Miller81171112000-04-23 11:14:01 +10001621#include <stdlib.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001622#if defined(HAVE_SECURITY_PAM_APPL_H)
Damien Miller81171112000-04-23 11:14:01 +10001623#include <security/pam_appl.h>
Damien Miller0f47c532004-01-02 18:01:30 +11001624#elif defined (HAVE_PAM_PAM_APPL_H)
1625#include <pam/pam_appl.h>
1626#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001627 ],
1628 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
Damien Millera22ba012000-03-02 23:09:20 +11001629 [AC_MSG_RESULT(no)],
1630 [
Tim Rice7df8d392005-09-19 09:33:39 -07001631 AC_DEFINE(HAVE_OLD_PAM, 1,
1632 [Define if you have an old version of PAM
1633 which takes only one argument to pam_strerror])
Damien Millera22ba012000-03-02 23:09:20 +11001634 AC_MSG_RESULT(yes)
Damien Miller7b22d652000-06-18 14:07:04 +10001635 PAM_MSG="yes (old library)"
Damien Millera22ba012000-03-02 23:09:20 +11001636 ]
Damien Millera64b57a2001-01-17 10:44:13 +11001637 )
Damien Millera22ba012000-03-02 23:09:20 +11001638fi
1639
Tim Riceaef73712002-05-11 13:17:42 -07001640# Search for OpenSSL
1641saved_CPPFLAGS="$CPPFLAGS"
1642saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001643AC_ARG_WITH(ssl-dir,
1644 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1645 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001646 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001647 case "$withval" in
1648 # Relative paths
1649 ./*|../*) withval="`pwd`/$withval"
1650 esac
Tim Riceaef73712002-05-11 13:17:42 -07001651 if test -d "$withval/lib"; then
1652 if test -n "${need_dash_r}"; then
1653 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1654 else
1655 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1656 fi
1657 else
1658 if test -n "${need_dash_r}"; then
1659 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1660 else
1661 LDFLAGS="-L${withval} ${LDFLAGS}"
1662 fi
1663 fi
1664 if test -d "$withval/include"; then
1665 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1666 else
1667 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1668 fi
Damien Millera22ba012000-03-02 23:09:20 +11001669 fi
1670 ]
1671)
Tim Rice3d5352e2004-02-12 09:27:21 -08001672LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001673AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1674 [Define if your ssl headers are included
1675 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001676 [
Tim Riceaef73712002-05-11 13:17:42 -07001677 dnl Check default openssl install dir
1678 if test -n "${need_dash_r}"; then
1679 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001680 else
Tim Riceaef73712002-05-11 13:17:42 -07001681 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001682 fi
Tim Riceaef73712002-05-11 13:17:42 -07001683 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1684 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1685 [
1686 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1687 ]
1688 )
1689 ]
1690)
1691
Tim Riced730b782002-08-13 18:52:10 -07001692# Determine OpenSSL header version
1693AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001694AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001695 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001696#include <stdio.h>
1697#include <string.h>
1698#include <openssl/opensslv.h>
1699#define DATA "conftest.sslincver"
1700int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001701 FILE *fd;
1702 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001703
Damien Millera8e06ce2003-11-21 23:48:55 +11001704 fd = fopen(DATA,"w");
1705 if(fd == NULL)
1706 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001707
1708 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1709 exit(1);
1710
1711 exit(0);
1712}
Darren Tucker623d92f2004-09-12 22:36:15 +10001713 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001714 [
1715 ssl_header_ver=`cat conftest.sslincver`
1716 AC_MSG_RESULT($ssl_header_ver)
1717 ],
1718 [
1719 AC_MSG_RESULT(not found)
1720 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001721 ],
1722 [
1723 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001724 ]
1725)
1726
1727# Determine OpenSSL library version
1728AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001729AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001730 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001731#include <stdio.h>
1732#include <string.h>
1733#include <openssl/opensslv.h>
1734#include <openssl/crypto.h>
1735#define DATA "conftest.ssllibver"
1736int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001737 FILE *fd;
1738 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001739
Damien Millera8e06ce2003-11-21 23:48:55 +11001740 fd = fopen(DATA,"w");
1741 if(fd == NULL)
1742 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001743
1744 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1745 exit(1);
1746
1747 exit(0);
1748}
Darren Tucker623d92f2004-09-12 22:36:15 +10001749 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001750 [
1751 ssl_library_ver=`cat conftest.ssllibver`
1752 AC_MSG_RESULT($ssl_library_ver)
1753 ],
1754 [
1755 AC_MSG_RESULT(not found)
1756 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001757 ],
1758 [
1759 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001760 ]
1761)
Damien Millera22ba012000-03-02 23:09:20 +11001762
Damien Millerec932372002-01-22 22:16:03 +11001763# Sanity check OpenSSL headers
1764AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001765AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001766 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001767#include <string.h>
1768#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001769int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001770 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001771 [
1772 AC_MSG_RESULT(yes)
1773 ],
1774 [
1775 AC_MSG_RESULT(no)
Darren Tuckera0472e02003-06-24 20:22:09 +10001776 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1777Check config.log for details.
1778Also see contrib/findssl.sh for help identifying header/library mismatches.])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001779 ],
1780 [
1781 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001782 ]
1783)
1784
Tim Rice3d5352e2004-02-12 09:27:21 -08001785# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1786# because the system crypt() is more featureful.
1787if test "x$check_for_libcrypt_before" = "x1"; then
1788 AC_CHECK_LIB(crypt, crypt)
1789fi
1790
Damien Millera8e06ce2003-11-21 23:48:55 +11001791# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001792# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001793if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001794 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11001795fi
1796
Tim Rice2291c002005-08-26 13:15:19 -07001797AC_CHECK_LIB(iaf, ia_openinfo)
Damien Miller6c21c512002-01-22 21:57:53 +11001798
1799### Configure cryptographic random number support
1800
1801# Check wheter OpenSSL seeds itself
1802AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001803AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001804 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11001805#include <string.h>
1806#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001807int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001808 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11001809 [
1810 OPENSSL_SEEDS_ITSELF=yes
1811 AC_MSG_RESULT(yes)
1812 ],
1813 [
1814 AC_MSG_RESULT(no)
1815 # Default to use of the rand helper if OpenSSL doesn't
1816 # seed itself
1817 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10001818 ],
1819 [
1820 AC_MSG_WARN([cross compiling: assuming yes])
1821 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08001822 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10001823 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11001824 ]
1825)
1826
1827
1828# Do we want to force the use of the rand helper?
1829AC_ARG_WITH(rand-helper,
1830 [ --with-rand-helper Use subprocess to gather strong randomness ],
1831 [
1832 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11001833 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11001834 # the previous test showed it to be unseeded.
1835 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1836 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1837 OPENSSL_SEEDS_ITSELF=yes
1838 USE_RAND_HELPER=""
1839 fi
1840 else
1841 USE_RAND_HELPER=yes
1842 fi
1843 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001844)
Damien Miller6c21c512002-01-22 21:57:53 +11001845
1846# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08001847if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001848 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07001849 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1850 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11001851 RAND_MSG="OpenSSL internal ONLY"
1852 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08001853elif test ! -z "$USE_RAND_HELPER" ; then
1854 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11001855 RAND_MSG="ssh-rand-helper"
1856 INSTALL_SSH_RAND_HELPER="yes"
1857fi
1858AC_SUBST(INSTALL_SSH_RAND_HELPER)
1859
1860### Configuration of ssh-rand-helper
1861
1862# PRNGD TCP socket
1863AC_ARG_WITH(prngd-port,
1864 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1865 [
Damien Millere996d722002-01-23 11:20:59 +11001866 case "$withval" in
1867 no)
1868 withval=""
1869 ;;
1870 [[0-9]]*)
1871 ;;
1872 *)
1873 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1874 ;;
1875 esac
1876 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001877 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001878 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1879 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001880 fi
1881 ]
1882)
1883
1884# PRNGD Unix domain socket
1885AC_ARG_WITH(prngd-socket,
1886 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1887 [
Damien Millere996d722002-01-23 11:20:59 +11001888 case "$withval" in
1889 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11001890 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11001891 ;;
1892 no)
1893 withval=""
1894 ;;
1895 /*)
1896 ;;
1897 *)
1898 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1899 ;;
1900 esac
1901
1902 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001903 if test ! -z "$PRNGD_PORT" ; then
1904 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1905 fi
Damien Miller6385ba02002-01-23 08:12:36 +11001906 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11001907 AC_MSG_WARN(Entropy socket is not readable)
1908 fi
1909 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07001910 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1911 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11001912 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08001913 ],
1914 [
1915 # Check for existing socket only if we don't have a random device already
1916 if test "$USE_RAND_HELPER" = yes ; then
1917 AC_MSG_CHECKING(for PRNGD/EGD socket)
1918 # Insert other locations here
1919 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1920 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1921 PRNGD_SOCKET="$sock"
1922 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1923 break;
1924 fi
1925 done
1926 if test ! -z "$PRNGD_SOCKET" ; then
1927 AC_MSG_RESULT($PRNGD_SOCKET)
1928 else
1929 AC_MSG_RESULT(not found)
1930 fi
1931 fi
Damien Miller6c21c512002-01-22 21:57:53 +11001932 ]
1933)
1934
1935# Change default command timeout for hashing entropy source
1936entropy_timeout=200
1937AC_ARG_WITH(entropy-timeout,
1938 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1939 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001940 if test -n "$withval" && test "x$withval" != "xno" && \
1941 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11001942 entropy_timeout=$withval
1943 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001944 ]
Damien Miller6c21c512002-01-22 21:57:53 +11001945)
Tim Rice7df8d392005-09-19 09:33:39 -07001946AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
1947 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11001948
Damien Millerd3f6ad22002-06-25 10:24:47 +10001949SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00001950AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00001951 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00001952 [
Tim Rice35cc69d2005-03-17 16:44:25 -08001953 if test -n "$withval" && test "x$withval" != "xno" && \
1954 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10001955 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00001956 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08001957 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00001958)
Tim Rice7df8d392005-09-19 09:33:39 -07001959AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
1960 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10001961AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00001962
Tim Rice88f2ab52002-03-17 12:17:34 -08001963# We do this little dance with the search path to insure
1964# that programs that we select for use by installed programs
1965# (which may be run by the super-user) come from trusted
1966# locations before they come from the user's private area.
1967# This should help avoid accidentally configuring some
1968# random version of a program in someone's personal bin.
1969
1970OPATH=$PATH
1971PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07001972test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08001973test -d /sbin && PATH=$PATH:/sbin
1974test -d /usr/sbin && PATH=$PATH:/usr/sbin
1975PATH=$PATH:/etc:$OPATH
1976
Damien Millera8e06ce2003-11-21 23:48:55 +11001977# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11001978OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1979OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1980OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1981OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1982OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1983OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1984OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1985OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1986OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1987OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1988OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1989OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1990OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1991OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1992OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1993OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08001994# restore PATH
1995PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11001996
1997# Where does ssh-rand-helper get its randomness from?
1998INSTALL_SSH_PRNG_CMDS=""
1999if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2000 if test ! -z "$PRNGD_PORT" ; then
2001 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2002 elif test ! -z "$PRNGD_SOCKET" ; then
2003 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2004 else
2005 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2006 RAND_HELPER_CMDHASH=yes
2007 INSTALL_SSH_PRNG_CMDS="yes"
2008 fi
2009fi
2010AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2011
2012
Ben Lindstromb5628642000-10-18 00:02:25 +00002013# Cheap hack to ensure NEWS-OS libraries are arranged right.
2014if test ! -z "$SONY" ; then
2015 LIBS="$LIBS -liberty";
2016fi
2017
Damien Miller57f39152005-11-24 19:58:19 +11002018# Check for long long datatypes
2019AC_CHECK_TYPES([long long, unsigned long long, long double])
2020
2021# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002022AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002023AC_CHECK_SIZEOF(short int, 2)
2024AC_CHECK_SIZEOF(int, 4)
2025AC_CHECK_SIZEOF(long int, 4)
2026AC_CHECK_SIZEOF(long long int, 8)
2027
Damien Millerfa2bb692002-04-23 23:22:25 +10002028# Sanity check long long for some platforms (AIX)
2029if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2030 ac_cv_sizeof_long_long_int=0
2031fi
2032
Darren Tucker537f1ed2005-10-25 18:38:33 +10002033# compute LLONG_MIN and LLONG_MAX if we don't know them.
2034if test -z "$have_llong_max"; then
2035 AC_MSG_CHECKING([for max value of long long])
2036 AC_RUN_IFELSE(
2037 [AC_LANG_SOURCE([[
2038#include <stdio.h>
2039/* Why is this so damn hard? */
2040#ifdef __GNUC__
2041# undef __GNUC__
2042#endif
2043#define __USE_ISOC99
2044#include <limits.h>
2045#define DATA "conftest.llminmax"
2046int main(void) {
2047 FILE *f;
2048 long long i, llmin, llmax = 0;
2049
2050 if((f = fopen(DATA,"w")) == NULL)
2051 exit(1);
2052
2053#if defined(LLONG_MIN) && defined(LLONG_MAX)
2054 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2055 llmin = LLONG_MIN;
2056 llmax = LLONG_MAX;
2057#else
2058 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2059 /* This will work on one's complement and two's complement */
2060 for (i = 1; i > llmax; i <<= 1, i++)
2061 llmax = i;
2062 llmin = llmax + 1LL; /* wrap */
2063#endif
2064
2065 /* Sanity check */
2066 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2067 || llmax - 1 > llmax) {
2068 fprintf(f, "unknown unknown\n");
2069 exit(2);
2070 }
2071
2072 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
2073 exit(3);
2074
2075 exit(0);
2076}
2077 ]])],
2078 [
2079 llong_min=`$AWK '{print $1}' conftest.llminmax`
2080 llong_max=`$AWK '{print $2}' conftest.llminmax`
2081
2082 # snprintf on some Tru64s doesn't understand "%lld"
2083 case "$host" in
2084 alpha-dec-osf*)
2085 if test "x$ac_cv_sizeof_long_long_int" = "x8" &&
2086 test "x$llong_max" = "xld"; then
2087 llong_min="-9223372036854775808"
2088 llong_max="9223372036854775807"
2089 fi
2090 ;;
2091 esac
2092
2093 AC_MSG_RESULT($llong_max)
2094 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2095 [max value of long long calculated by configure])
2096 AC_MSG_CHECKING([for min value of long long])
2097 AC_MSG_RESULT($llong_min)
2098 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2099 [min value of long long calculated by configure])
2100 ],
2101 [
2102 AC_MSG_RESULT(not found)
2103 ],
2104 [
2105 AC_MSG_WARN([cross compiling: not checking])
2106 ]
2107 )
2108fi
2109
2110
Damien Millera22ba012000-03-02 23:09:20 +11002111# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002112AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2113 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002114 [ #include <sys/types.h> ],
2115 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002116 [ ac_cv_have_u_int="yes" ],
2117 [ ac_cv_have_u_int="no" ]
2118 )
2119])
2120if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002121 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002122 have_u_int=1
2123fi
2124
Damien Miller61e50f12000-05-08 20:49:37 +10002125AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2126 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002127 [ #include <sys/types.h> ],
2128 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002129 [ ac_cv_have_intxx_t="yes" ],
2130 [ ac_cv_have_intxx_t="no" ]
2131 )
2132])
2133if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002134 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002135 have_intxx_t=1
2136fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002137
2138if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002139 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002140then
2141 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2142 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002143 [ #include <stdint.h> ],
2144 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002145 [
2146 AC_DEFINE(HAVE_INTXX_T)
2147 AC_MSG_RESULT(yes)
2148 ],
2149 [ AC_MSG_RESULT(no) ]
2150 )
2151fi
2152
Damien Miller578783e2000-09-23 14:12:24 +11002153AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2154 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002155 [
2156#include <sys/types.h>
2157#ifdef HAVE_STDINT_H
2158# include <stdint.h>
2159#endif
2160#include <sys/socket.h>
2161#ifdef HAVE_SYS_BITYPES_H
2162# include <sys/bitypes.h>
2163#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002164 ],
2165 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002166 [ ac_cv_have_int64_t="yes" ],
2167 [ ac_cv_have_int64_t="no" ]
2168 )
2169])
2170if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002171 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002172fi
2173
Damien Miller61e50f12000-05-08 20:49:37 +10002174AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2175 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002176 [ #include <sys/types.h> ],
2177 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002178 [ ac_cv_have_u_intxx_t="yes" ],
2179 [ ac_cv_have_u_intxx_t="no" ]
2180 )
2181])
2182if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002183 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002184 have_u_intxx_t=1
2185fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002186
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002187if test -z "$have_u_intxx_t" ; then
2188 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2189 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002190 [ #include <sys/socket.h> ],
2191 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002192 [
2193 AC_DEFINE(HAVE_U_INTXX_T)
2194 AC_MSG_RESULT(yes)
2195 ],
2196 [ AC_MSG_RESULT(no) ]
2197 )
2198fi
2199
Damien Miller578783e2000-09-23 14:12:24 +11002200AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2201 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002202 [ #include <sys/types.h> ],
2203 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002204 [ ac_cv_have_u_int64_t="yes" ],
2205 [ ac_cv_have_u_int64_t="no" ]
2206 )
2207])
2208if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002209 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002210 have_u_int64_t=1
2211fi
2212
Tim Rice4cec93f2002-02-26 08:40:48 -08002213if test -z "$have_u_int64_t" ; then
2214 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2215 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002216 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002217 [ u_int64_t a; a = 1],
2218 [
2219 AC_DEFINE(HAVE_U_INT64_T)
2220 AC_MSG_RESULT(yes)
2221 ],
2222 [ AC_MSG_RESULT(no) ]
2223 )
2224fi
2225
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002226if test -z "$have_u_intxx_t" ; then
2227 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2228 AC_TRY_COMPILE(
2229 [
2230#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002231 ],
2232 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002233 [ ac_cv_have_uintxx_t="yes" ],
2234 [ ac_cv_have_uintxx_t="no" ]
2235 )
2236 ])
2237 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002238 AC_DEFINE(HAVE_UINTXX_T, 1,
2239 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002240 fi
2241fi
2242
2243if test -z "$have_uintxx_t" ; then
2244 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2245 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002246 [ #include <stdint.h> ],
2247 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002248 [
2249 AC_DEFINE(HAVE_UINTXX_T)
2250 AC_MSG_RESULT(yes)
2251 ],
2252 [ AC_MSG_RESULT(no) ]
2253 )
2254fi
2255
Damien Milleredb82922000-06-20 13:25:52 +10002256if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002257 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002258then
2259 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2260 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002261 [
2262#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002263 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002264 [
Damien Miller70494d12000-04-03 15:57:06 +10002265 int8_t a; int16_t b; int32_t c;
2266 u_int8_t e; u_int16_t f; u_int32_t g;
2267 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002268 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002269 [
2270 AC_DEFINE(HAVE_U_INTXX_T)
2271 AC_DEFINE(HAVE_INTXX_T)
2272 AC_MSG_RESULT(yes)
2273 ],
2274 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002275 )
Damien Millerb29ea912000-01-15 14:12:03 +11002276fi
2277
Damien Miller58be7382001-09-15 21:31:54 +10002278
2279AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2280 AC_TRY_COMPILE(
2281 [
2282#include <sys/types.h>
2283 ],
2284 [ u_char foo; foo = 125; ],
2285 [ ac_cv_have_u_char="yes" ],
2286 [ ac_cv_have_u_char="no" ]
2287 )
2288])
2289if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002290 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002291fi
2292
Tim Rice13aae5e2001-10-21 17:53:58 -07002293TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002294
Tim Rice200a5c02002-02-26 22:12:34 -08002295AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002296
Damien Miller848b9932005-02-24 12:12:34 +11002297AC_CHECK_TYPES(in_addr_t,,,
2298[#include <sys/types.h>
2299#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002300
Damien Miller61e50f12000-05-08 20:49:37 +10002301AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2302 AC_TRY_COMPILE(
2303 [
2304#include <sys/types.h>
2305 ],
2306 [ size_t foo; foo = 1235; ],
2307 [ ac_cv_have_size_t="yes" ],
2308 [ ac_cv_have_size_t="no" ]
2309 )
2310])
2311if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002312 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002313fi
Damien Miller95058511999-12-29 10:36:45 +11002314
Damien Miller615f9392000-05-17 22:53:33 +10002315AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2316 AC_TRY_COMPILE(
2317 [
2318#include <sys/types.h>
2319 ],
2320 [ ssize_t foo; foo = 1235; ],
2321 [ ac_cv_have_ssize_t="yes" ],
2322 [ ac_cv_have_ssize_t="no" ]
2323 )
2324])
2325if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002326 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002327fi
2328
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002329AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2330 AC_TRY_COMPILE(
2331 [
2332#include <time.h>
2333 ],
2334 [ clock_t foo; foo = 1235; ],
2335 [ ac_cv_have_clock_t="yes" ],
2336 [ ac_cv_have_clock_t="no" ]
2337 )
2338])
2339if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002340 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002341fi
2342
Damien Millerb54b40e2000-06-23 08:23:34 +10002343AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2344 AC_TRY_COMPILE(
2345 [
2346#include <sys/types.h>
2347#include <sys/socket.h>
2348 ],
2349 [ sa_family_t foo; foo = 1235; ],
2350 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002351 [ AC_TRY_COMPILE(
2352 [
2353#include <sys/types.h>
2354#include <sys/socket.h>
2355#include <netinet/in.h>
2356 ],
2357 [ sa_family_t foo; foo = 1235; ],
2358 [ ac_cv_have_sa_family_t="yes" ],
2359
Damien Millerb54b40e2000-06-23 08:23:34 +10002360 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002361 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002362 )
2363])
2364if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002365 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2366 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002367fi
2368
Damien Miller0f91b4e2000-06-18 15:43:25 +10002369AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2370 AC_TRY_COMPILE(
2371 [
2372#include <sys/types.h>
2373 ],
2374 [ pid_t foo; foo = 1235; ],
2375 [ ac_cv_have_pid_t="yes" ],
2376 [ ac_cv_have_pid_t="no" ]
2377 )
2378])
2379if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002380 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002381fi
2382
2383AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2384 AC_TRY_COMPILE(
2385 [
2386#include <sys/types.h>
2387 ],
2388 [ mode_t foo; foo = 1235; ],
2389 [ ac_cv_have_mode_t="yes" ],
2390 [ ac_cv_have_mode_t="no" ]
2391 )
2392])
2393if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002394 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002395fi
2396
Damien Miller61e50f12000-05-08 20:49:37 +10002397
2398AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2399 AC_TRY_COMPILE(
2400 [
Damien Miller81171112000-04-23 11:14:01 +10002401#include <sys/types.h>
2402#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002403 ],
2404 [ struct sockaddr_storage s; ],
2405 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2406 [ ac_cv_have_struct_sockaddr_storage="no" ]
2407 )
2408])
2409if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002410 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2411 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002412fi
Damien Miller34132e52000-01-14 15:45:46 +11002413
Damien Miller61e50f12000-05-08 20:49:37 +10002414AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2415 AC_TRY_COMPILE(
2416 [
Damien Miller7b22d652000-06-18 14:07:04 +10002417#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002418#include <netinet/in.h>
2419 ],
2420 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2421 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2422 [ ac_cv_have_struct_sockaddr_in6="no" ]
2423 )
2424])
2425if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002426 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2427 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002428fi
Damien Miller34132e52000-01-14 15:45:46 +11002429
Damien Miller61e50f12000-05-08 20:49:37 +10002430AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2431 AC_TRY_COMPILE(
2432 [
Damien Miller7b22d652000-06-18 14:07:04 +10002433#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002434#include <netinet/in.h>
2435 ],
2436 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2437 [ ac_cv_have_struct_in6_addr="yes" ],
2438 [ ac_cv_have_struct_in6_addr="no" ]
2439 )
2440])
2441if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002442 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2443 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002444fi
Damien Miller34132e52000-01-14 15:45:46 +11002445
Damien Miller61e50f12000-05-08 20:49:37 +10002446AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2447 AC_TRY_COMPILE(
2448 [
Damien Miller81171112000-04-23 11:14:01 +10002449#include <sys/types.h>
2450#include <sys/socket.h>
2451#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002452 ],
2453 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2454 [ ac_cv_have_struct_addrinfo="yes" ],
2455 [ ac_cv_have_struct_addrinfo="no" ]
2456 )
2457])
2458if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002459 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2460 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002461fi
2462
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002463AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2464 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002465 [ #include <sys/time.h> ],
2466 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002467 [ ac_cv_have_struct_timeval="yes" ],
2468 [ ac_cv_have_struct_timeval="no" ]
2469 )
2470])
2471if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002472 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002473 have_struct_timeval=1
2474fi
2475
Tim Rice4e4dc562003-03-18 10:21:40 -08002476AC_CHECK_TYPES(struct timespec)
2477
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002478# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002479if test "x$ac_cv_have_int64_t" = "xno" && \
2480 test "x$ac_cv_sizeof_long_int" != "x8" && \
2481 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002482 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2483 echo "an alternative compiler (I.E., GCC) before continuing."
2484 echo ""
2485 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002486else
2487dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002488 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002489 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002490#include <stdio.h>
2491#include <string.h>
2492#ifdef HAVE_SNPRINTF
2493main()
2494{
2495 char buf[50];
2496 char expected_out[50];
2497 int mazsize = 50 ;
2498#if (SIZEOF_LONG_INT == 8)
2499 long int num = 0x7fffffffffffffff;
2500#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002501 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002502#endif
2503 strcpy(expected_out, "9223372036854775807");
2504 snprintf(buf, mazsize, "%lld", num);
2505 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002506 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002507 exit(0);
2508}
2509#else
2510main() { exit(0); }
2511#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002512 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002513 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002514 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002515fi
2516
Damien Miller78315eb2000-09-29 23:01:36 +11002517dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002518OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2519OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2520OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2521OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2522OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002523OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002524OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2525OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002526OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002527OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2528OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2529OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2530OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002531OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2532OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2533OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2534OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002535
2536AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11002537AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2538 [Define if we don't have struct __res_state in resolv.h])],
2539[
2540#include <stdio.h>
2541#if HAVE_SYS_TYPES_H
2542# include <sys/types.h>
2543#endif
2544#include <netinet/in.h>
2545#include <arpa/nameser.h>
2546#include <resolv.h>
2547])
andre2ff7b5d2000-06-03 14:57:40 +00002548
Damien Miller61e50f12000-05-08 20:49:37 +10002549AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2550 ac_cv_have_ss_family_in_struct_ss, [
2551 AC_TRY_COMPILE(
2552 [
Damien Miller81171112000-04-23 11:14:01 +10002553#include <sys/types.h>
2554#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002555 ],
2556 [ struct sockaddr_storage s; s.ss_family = 1; ],
2557 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2558 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2559 )
2560])
2561if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002562 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002563fi
2564
Damien Miller61e50f12000-05-08 20:49:37 +10002565AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2566 ac_cv_have___ss_family_in_struct_ss, [
2567 AC_TRY_COMPILE(
2568 [
Damien Miller81171112000-04-23 11:14:01 +10002569#include <sys/types.h>
2570#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002571 ],
2572 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2573 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2574 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2575 )
2576])
2577if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002578 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2579 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002580fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002581
Damien Millerad833b32000-08-23 10:46:23 +10002582AC_CACHE_CHECK([for pw_class field in struct passwd],
2583 ac_cv_have_pw_class_in_struct_passwd, [
2584 AC_TRY_COMPILE(
2585 [
Damien Millerad833b32000-08-23 10:46:23 +10002586#include <pwd.h>
2587 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002588 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002589 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2590 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2591 )
2592])
2593if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002594 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2595 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002596fi
2597
Kevin Steves82456952001-06-22 21:14:18 +00002598AC_CACHE_CHECK([for pw_expire field in struct passwd],
2599 ac_cv_have_pw_expire_in_struct_passwd, [
2600 AC_TRY_COMPILE(
2601 [
2602#include <pwd.h>
2603 ],
2604 [ struct passwd p; p.pw_expire = 0; ],
2605 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2606 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2607 )
2608])
2609if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002610 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2611 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002612fi
2613
2614AC_CACHE_CHECK([for pw_change field in struct passwd],
2615 ac_cv_have_pw_change_in_struct_passwd, [
2616 AC_TRY_COMPILE(
2617 [
2618#include <pwd.h>
2619 ],
2620 [ struct passwd p; p.pw_change = 0; ],
2621 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2622 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2623 )
2624])
2625if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002626 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2627 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002628fi
Damien Miller61e50f12000-05-08 20:49:37 +10002629
Tim Rice28bbb0c2002-05-27 17:37:32 -07002630dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002631AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2632 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002633 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002634 [
Tim Riceae49fe62002-04-12 10:26:21 -07002635#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002636#include <sys/socket.h>
2637#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002638int main() {
2639#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002640#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002641exit(1);
2642#endif
2643struct msghdr m;
2644m.msg_accrights = 0;
2645exit(0);
2646}
Kevin Steves939c9db2002-03-22 17:23:25 +00002647 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002648 [ ac_cv_have_accrights_in_msghdr="yes" ],
2649 [ ac_cv_have_accrights_in_msghdr="no" ]
2650 )
2651])
2652if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002653 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2654 [Define if your system uses access rights style
2655 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002656fi
2657
Kevin Stevesa44e0352002-04-07 16:18:03 +00002658AC_CACHE_CHECK([for msg_control field in struct msghdr],
2659 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002660 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002661 [
Tim Riceae49fe62002-04-12 10:26:21 -07002662#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002663#include <sys/socket.h>
2664#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002665int main() {
2666#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002667#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002668exit(1);
2669#endif
2670struct msghdr m;
2671m.msg_control = 0;
2672exit(0);
2673}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002674 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002675 [ ac_cv_have_control_in_msghdr="yes" ],
2676 [ ac_cv_have_control_in_msghdr="no" ]
2677 )
2678])
2679if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002680 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2681 [Define if your system uses ancillary data style
2682 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002683fi
2684
Damien Miller61e50f12000-05-08 20:49:37 +10002685AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002686 AC_TRY_LINK([],
2687 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002688 [ ac_cv_libc_defines___progname="yes" ],
2689 [ ac_cv_libc_defines___progname="no" ]
2690 )
2691])
2692if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002693 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002694fi
2695
Kevin Steves4846f4a2002-03-22 18:19:53 +00002696AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2697 AC_TRY_LINK([
2698#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002699],
2700 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002701 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2702 [ ac_cv_cc_implements___FUNCTION__="no" ]
2703 )
2704])
2705if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002706 AC_DEFINE(HAVE___FUNCTION__, 1,
2707 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002708fi
2709
2710AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2711 AC_TRY_LINK([
2712#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002713],
2714 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00002715 [ ac_cv_cc_implements___func__="yes" ],
2716 [ ac_cv_cc_implements___func__="no" ]
2717 )
2718])
2719if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002720 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00002721fi
2722
Damien Miller57f39152005-11-24 19:58:19 +11002723AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
2724 AC_TRY_LINK(
2725 [#include <stdarg.h>
2726 va_list x,y;],
2727 [va_copy(x,y);],
2728 [ ac_cv_have_va_copy="yes" ],
2729 [ ac_cv_have_va_copy="no" ]
2730 )
2731])
2732if test "x$ac_cv_have_va_copy" = "xyes" ; then
2733 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
2734fi
2735
2736AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
2737 AC_TRY_LINK(
2738 [#include <stdarg.h>
2739 va_list x,y;],
2740 [__va_copy(x,y);],
2741 [ ac_cv_have___va_copy="yes" ],
2742 [ ac_cv_have___va_copy="no" ]
2743 )
2744])
2745if test "x$ac_cv_have___va_copy" = "xyes" ; then
2746 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
2747fi
2748
Damien Miller4f8e6692001-07-14 13:22:53 +10002749AC_CACHE_CHECK([whether getopt has optreset support],
2750 ac_cv_have_getopt_optreset, [
2751 AC_TRY_LINK(
2752 [
2753#include <getopt.h>
2754 ],
2755 [ extern int optreset; optreset = 0; ],
2756 [ ac_cv_have_getopt_optreset="yes" ],
2757 [ ac_cv_have_getopt_optreset="no" ]
2758 )
2759])
2760if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002761 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2762 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10002763fi
Damien Millera22ba012000-03-02 23:09:20 +11002764
Damien Millerecbb26d2000-07-15 14:59:14 +10002765AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002766 AC_TRY_LINK([],
2767 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10002768 [ ac_cv_libc_defines_sys_errlist="yes" ],
2769 [ ac_cv_libc_defines_sys_errlist="no" ]
2770 )
2771])
2772if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002773 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2774 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10002775fi
2776
2777
Damien Miller11fa2cc2000-08-16 10:35:58 +10002778AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002779 AC_TRY_LINK([],
2780 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10002781 [ ac_cv_libc_defines_sys_nerr="yes" ],
2782 [ ac_cv_libc_defines_sys_nerr="no" ]
2783 )
2784])
2785if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002786 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10002787fi
2788
Damien Millera8e06ce2003-11-21 23:48:55 +11002789SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002790# Check whether user wants sectok support
2791AC_ARG_WITH(sectok,
2792 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10002793 [
2794 if test "x$withval" != "xno" ; then
2795 if test "x$withval" != "xyes" ; then
2796 CPPFLAGS="$CPPFLAGS -I${withval}"
2797 LDFLAGS="$LDFLAGS -L${withval}"
2798 if test ! -z "$need_dash_r" ; then
2799 LDFLAGS="$LDFLAGS -R${withval}"
2800 fi
2801 if test ! -z "$blibpath" ; then
2802 blibpath="$blibpath:${withval}"
2803 fi
2804 fi
2805 AC_CHECK_HEADERS(sectok.h)
2806 if test "$ac_cv_header_sectok_h" != yes; then
2807 AC_MSG_ERROR(Can't find sectok.h)
2808 fi
2809 AC_CHECK_LIB(sectok, sectok_open)
2810 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2811 AC_MSG_ERROR(Can't find libsectok)
2812 fi
Tim Rice7df8d392005-09-19 09:33:39 -07002813 AC_DEFINE(SMARTCARD, 1,
2814 [Define if you want smartcard support])
2815 AC_DEFINE(USE_SECTOK, 1,
2816 [Define if you want smartcard support
2817 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11002818 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002819 fi
2820 ]
2821)
2822
2823# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08002824OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00002825AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10002826 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08002827 [
2828 if test "x$withval" != "xno" ; then
2829 if test "x$withval" != "xyes" ; then
2830 OPENSC_CONFIG=$withval/bin/opensc-config
2831 else
2832 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2833 fi
2834 if test "$OPENSC_CONFIG" != "no"; then
2835 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2836 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2837 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2838 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2839 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07002840 AC_DEFINE(USE_OPENSC, 1,
2841 [Define if you want smartcard support
2842 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08002843 SCARD_MSG="yes, using OpenSC"
2844 fi
2845 fi
2846 ]
2847)
Damien Miller85de5802001-09-18 14:01:11 +10002848
Darren Tucker5f88d342003-10-15 16:57:57 +10002849# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11002850AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07002851 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2852 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10002853 [
Darren Tucker5f88d342003-10-15 16:57:57 +10002854 # Needed by our getrrsetbyname()
2855 AC_SEARCH_LIBS(res_query, resolv)
2856 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10002857 AC_MSG_CHECKING(if res_query will link)
2858 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2859 [AC_MSG_RESULT(no)
2860 saved_LIBS="$LIBS"
2861 LIBS="$LIBS -lresolv"
2862 AC_MSG_CHECKING(for res_query in -lresolv)
2863 AC_LINK_IFELSE([
2864#include <resolv.h>
2865int main()
2866{
2867 res_query (0, 0, 0, 0, 0);
2868 return 0;
2869}
2870 ],
2871 [LIBS="$LIBS -lresolv"
2872 AC_MSG_RESULT(yes)],
2873 [LIBS="$saved_LIBS"
2874 AC_MSG_RESULT(no)])
2875 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10002876 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10002877 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07002878 [#include <sys/types.h>
2879 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10002880 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07002881 [AC_DEFINE(HAVE_HEADER_AD, 1,
2882 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10002883 [#include <arpa/nameser.h>])
2884 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10002885
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002886# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11002887KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002888AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11002889 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002890 [ if test "x$withval" != "xno" ; then
2891 if test "x$withval" = "xyes" ; then
2892 KRB5ROOT="/usr/local"
2893 else
2894 KRB5ROOT=${withval}
2895 fi
2896
Tim Rice7df8d392005-09-19 09:33:39 -07002897 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11002898 KRB5_MSG="yes"
2899
2900 AC_MSG_CHECKING(for krb5-config)
2901 if test -x $KRB5ROOT/bin/krb5-config ; then
2902 KRB5CONF=$KRB5ROOT/bin/krb5-config
2903 AC_MSG_RESULT($KRB5CONF)
2904
2905 AC_MSG_CHECKING(for gssapi support)
2906 if $KRB5CONF | grep gssapi >/dev/null ; then
2907 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002908 AC_DEFINE(GSSAPI, 1,
2909 [Define this if you want GSSAPI
2910 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11002911 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11002912 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11002913 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11002914 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11002915 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002916 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2917 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002918 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11002919 AC_MSG_CHECKING(whether we are using Heimdal)
2920 AC_TRY_COMPILE([ #include <krb5.h> ],
2921 [ char *tmp = heimdal_version; ],
2922 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07002923 AC_DEFINE(HEIMDAL, 1,
2924 [Define this if you are using the
2925 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11002926 AC_MSG_RESULT(no)
2927 )
2928 else
2929 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002930 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11002931 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11002932 AC_MSG_CHECKING(whether we are using Heimdal)
2933 AC_TRY_COMPILE([ #include <krb5.h> ],
2934 [ char *tmp = heimdal_version; ],
2935 [ AC_MSG_RESULT(yes)
2936 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10002937 K5LIBS="-lkrb5 -ldes"
2938 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08002939 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10002940 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11002941 ],
2942 [ AC_MSG_RESULT(no)
2943 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
2944 ]
2945 )
Damien Miller200d0a72003-06-30 19:21:36 +10002946 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002947
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002948 AC_CHECK_LIB(gssapi,gss_init_sec_context,
2949 [ AC_DEFINE(GSSAPI)
2950 K5LIBS="-lgssapi $K5LIBS" ],
2951 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
2952 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11002953 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002954 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
2955 $K5LIBS)
2956 ],
2957 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08002958
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002959 AC_CHECK_HEADER(gssapi.h, ,
2960 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11002961 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002962 AC_CHECK_HEADERS(gssapi.h, ,
2963 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11002964 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10002965 ]
2966 )
2967
2968 oldCPP="$CPPFLAGS"
2969 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
2970 AC_CHECK_HEADER(gssapi_krb5.h, ,
2971 [ CPPFLAGS="$oldCPP" ])
2972
Damien Millera8e06ce2003-11-21 23:48:55 +11002973 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11002974 if test ! -z "$need_dash_r" ; then
2975 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
2976 fi
2977 if test ! -z "$blibpath" ; then
2978 blibpath="$blibpath:${KRB5ROOT}/lib"
2979 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07002980
2981 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
2982 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
2983 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
2984
2985 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07002986 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
2987 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11002988 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11002989 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10002990)
Damien Millerc79bc0d2001-03-28 13:03:42 +10002991
Damien Millera22ba012000-03-02 23:09:20 +11002992# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11002993
Damien Millerf58c6722002-05-13 13:15:42 +10002994PRIVSEP_PATH=/var/empty
2995AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07002996 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10002997 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002998 if test -n "$withval" && test "x$withval" != "xno" && \
2999 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003000 PRIVSEP_PATH=$withval
3001 fi
3002 ]
3003)
3004AC_SUBST(PRIVSEP_PATH)
3005
Damien Millera22ba012000-03-02 23:09:20 +11003006AC_ARG_WITH(xauth,
3007 [ --with-xauth=PATH Specify path to xauth program ],
3008 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003009 if test -n "$withval" && test "x$withval" != "xno" && \
3010 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003011 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003012 fi
3013 ],
3014 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003015 TestPath="$PATH"
3016 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3017 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3018 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3019 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3020 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003021 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003022 xauth_path="/usr/openwin/bin/xauth"
3023 fi
3024 ]
3025)
3026
Damien Miller7d901272003-01-13 16:55:22 +11003027STRIP_OPT=-s
3028AC_ARG_ENABLE(strip,
3029 [ --disable-strip Disable calling strip(1) on install],
3030 [
3031 if test "x$enableval" = "xno" ; then
3032 STRIP_OPT=
3033 fi
3034 ]
3035)
3036AC_SUBST(STRIP_OPT)
3037
Damien Millera19cf472000-11-29 13:28:50 +11003038if test -z "$xauth_path" ; then
3039 XAUTH_PATH="undefined"
3040 AC_SUBST(XAUTH_PATH)
3041else
Tim Rice7df8d392005-09-19 09:33:39 -07003042 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3043 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003044 XAUTH_PATH=$xauth_path
3045 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003046fi
Damien Millera22ba012000-03-02 23:09:20 +11003047
3048# Check for mail directory (last resort if we cannot get it from headers)
3049if test ! -z "$MAIL" ; then
3050 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003051 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3052 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003053fi
3054
Darren Tucker623d92f2004-09-12 22:36:15 +10003055if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003056 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3057 disable_ptmx_check=yes
3058fi
Damien Millera22ba012000-03-02 23:09:20 +11003059if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003060 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003061 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003062 [
Tim Rice7df8d392005-09-19 09:33:39 -07003063 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3064 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003065 have_dev_ptmx=1
3066 ]
3067 )
3068 fi
Damien Millera22ba012000-03-02 23:09:20 +11003069fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003070
Darren Tucker623d92f2004-09-12 22:36:15 +10003071if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003072 AC_CHECK_FILE("/dev/ptc",
3073 [
Tim Rice7df8d392005-09-19 09:33:39 -07003074 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3075 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003076 have_dev_ptc=1
3077 ]
3078 )
3079else
3080 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3081fi
Damien Miller204ad072000-03-02 23:56:12 +11003082
Damien Millera22ba012000-03-02 23:09:20 +11003083# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003084AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003085 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003086 [
Damien Miller897741e2001-04-16 10:41:46 +10003087 case "$withval" in
3088 man|cat|doc)
3089 MANTYPE=$withval
3090 ;;
3091 *)
3092 AC_MSG_ERROR(invalid man type: $withval)
3093 ;;
3094 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003095 ]
3096)
Ben Lindstrombc709922001-04-18 18:04:21 +00003097if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003098 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3099 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003100 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3101 MANTYPE=doc
3102 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3103 MANTYPE=man
3104 else
3105 MANTYPE=cat
3106 fi
3107fi
Damien Miller670a4b82000-01-22 13:53:11 +11003108AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003109if test "$MANTYPE" = "doc"; then
3110 mansubdir=man;
3111else
3112 mansubdir=$MANTYPE;
3113fi
3114AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003115
Damien Millera22ba012000-03-02 23:09:20 +11003116# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003117MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003118AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003119 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003120 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003121 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003122 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3123 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003124 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003125 fi
3126 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003127)
3128
Damien Millera22ba012000-03-02 23:09:20 +11003129# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003130AC_ARG_WITH(shadow,
3131 [ --without-shadow Disable shadow password support],
3132 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003133 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003134 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003135 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003136 fi
3137 ]
3138)
3139
Damien Miller1f335fb2000-06-26 11:31:33 +10003140if test -z "$disable_shadow" ; then
3141 AC_MSG_CHECKING([if the systems has expire shadow information])
3142 AC_TRY_COMPILE(
3143 [
3144#include <sys/types.h>
3145#include <shadow.h>
3146 struct spwd sp;
3147 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3148 [ sp_expire_available=yes ], []
3149 )
3150
3151 if test "x$sp_expire_available" = "xyes" ; then
3152 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003153 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3154 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003155 else
3156 AC_MSG_RESULT(no)
3157 fi
3158fi
3159
Damien Millera22ba012000-03-02 23:09:20 +11003160# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003161if test ! -z "$IPADDR_IN_DISPLAY" ; then
3162 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003163 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3164 [Define if you need to use IP address
3165 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003166else
Damien Millera8e06ce2003-11-21 23:48:55 +11003167 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003168 AC_ARG_WITH(ipaddr-display,
3169 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3170 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003171 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003172 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003173 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003174 fi
3175 ]
3176 )
3177fi
Damien Miller76112de1999-12-21 11:18:08 +11003178
Darren Tuckere1a790d2003-09-16 11:52:19 +10003179# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003180AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003181 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003182 [ if test "x$enableval" = "xno"; then
3183 AC_MSG_NOTICE([/etc/default/login handling disabled])
3184 etc_default_login=no
3185 else
3186 etc_default_login=yes
3187 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003188 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3189 then
3190 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3191 etc_default_login=no
3192 else
3193 etc_default_login=yes
3194 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003195)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003196
Darren Tucker2f9573d2005-02-10 22:28:54 +11003197if test "x$etc_default_login" != "xno"; then
3198 AC_CHECK_FILE("/etc/default/login",
3199 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003200 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003201 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3202 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003203 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003204fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003205
Tim Rice43a1c132002-04-17 21:19:14 -07003206dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003207if test $ac_cv_func_login_getcapbool = "yes" && \
3208 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003209 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003210fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003211
Damien Millera22ba012000-03-02 23:09:20 +11003212# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003213SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003214AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003215 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003216 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003217 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003218 AC_MSG_WARN([
3219--with-default-path=PATH has no effect on this system.
3220Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003221 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003222 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003223 AC_MSG_WARN([
3224--with-default-path=PATH will only be used if PATH is not defined in
3225$external_path_file .])
3226 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003227 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003228 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003229 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003230 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003231 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3232 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003233 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003234 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003235 AC_MSG_WARN([
3236If PATH is defined in $external_path_file, ensure the path to scp is included,
3237otherwise scp will not work.])
3238 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003239 AC_RUN_IFELSE(
3240 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003241/* find out what STDPATH is */
3242#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003243#ifdef HAVE_PATHS_H
3244# include <paths.h>
3245#endif
3246#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003247# ifdef _PATH_USERPATH /* Irix */
3248# define _PATH_STDPATH _PATH_USERPATH
3249# else
3250# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3251# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003252#endif
3253#include <sys/types.h>
3254#include <sys/stat.h>
3255#include <fcntl.h>
3256#define DATA "conftest.stdpath"
3257
3258main()
3259{
3260 FILE *fd;
3261 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003262
Tim Rice59ea0a02001-03-10 13:50:45 -08003263 fd = fopen(DATA,"w");
3264 if(fd == NULL)
3265 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003266
Tim Rice59ea0a02001-03-10 13:50:45 -08003267 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3268 exit(1);
3269
3270 exit(0);
3271}
Darren Tucker314d89e2005-10-17 23:29:23 +10003272 ]])],
3273 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003274 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3275 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3276 )
3277# make sure $bindir is in USER_PATH so scp will work
3278 t_bindir=`eval echo ${bindir}`
3279 case $t_bindir in
3280 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3281 esac
3282 case $t_bindir in
3283 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3284 esac
3285 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3286 if test $? -ne 0 ; then
3287 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3288 if test $? -ne 0 ; then
3289 user_path=$user_path:$t_bindir
3290 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3291 fi
3292 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003293 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003294)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003295if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003296 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003297 AC_SUBST(user_path)
3298fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003299
Damien Millera18bbd32002-05-13 10:48:57 +10003300# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003301AC_ARG_WITH(superuser-path,
3302 [ --with-superuser-path= Specify different path for super-user],
3303 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003304 if test -n "$withval" && test "x$withval" != "xno" && \
3305 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003306 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3307 [Define if you want a different $PATH
3308 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003309 superuser_path=$withval
3310 fi
3311 ]
3312)
3313
3314
Damien Miller61e50f12000-05-08 20:49:37 +10003315AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003316IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003317AC_ARG_WITH(4in6,
3318 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3319 [
3320 if test "x$withval" != "xno" ; then
3321 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003322 AC_DEFINE(IPV4_IN_IPV6, 1,
3323 [Detect IPv4 in IPv6 mapped addresses
3324 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003325 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003326 else
3327 AC_MSG_RESULT(no)
3328 fi
3329 ],[
3330 if test "x$inet6_default_4in6" = "xyes"; then
3331 AC_MSG_RESULT([yes (default)])
3332 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003333 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003334 else
3335 AC_MSG_RESULT([no (default)])
3336 fi
3337 ]
3338)
3339
Damien Miller60396b02001-02-18 17:01:00 +11003340# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003341BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003342AC_ARG_WITH(bsd-auth,
3343 [ --with-bsd-auth Enable BSD auth support],
3344 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003345 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003346 AC_DEFINE(BSD_AUTH, 1,
3347 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003348 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003349 fi
3350 ]
3351)
3352
Damien Millera22ba012000-03-02 23:09:20 +11003353# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003354piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003355# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003356if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003357 piddir=`eval echo ${sysconfdir}`
3358 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003359 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003360 esac
3361fi
3362
Tim Rice88f2ab52002-03-17 12:17:34 -08003363AC_ARG_WITH(pid-dir,
3364 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3365 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003366 if test -n "$withval" && test "x$withval" != "xno" && \
3367 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003368 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003369 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003370 AC_MSG_WARN([** no $piddir directory on this system **])
3371 fi
3372 fi
3373 ]
3374)
3375
Tim Rice7df8d392005-09-19 09:33:39 -07003376AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003377AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003378
andre2ff7b5d2000-06-03 14:57:40 +00003379dnl allow user to disable some login recording features
3380AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003381 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003382 [
3383 if test "x$enableval" = "xno" ; then
3384 AC_DEFINE(DISABLE_LASTLOG)
3385 fi
3386 ]
andre2ff7b5d2000-06-03 14:57:40 +00003387)
3388AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003389 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003390 [
3391 if test "x$enableval" = "xno" ; then
3392 AC_DEFINE(DISABLE_UTMP)
3393 fi
3394 ]
andre2ff7b5d2000-06-03 14:57:40 +00003395)
3396AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003397 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003398 [
3399 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003400 AC_DEFINE(DISABLE_UTMPX, 1,
3401 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003402 fi
3403 ]
andre2ff7b5d2000-06-03 14:57:40 +00003404)
3405AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003406 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003407 [
3408 if test "x$enableval" = "xno" ; then
3409 AC_DEFINE(DISABLE_WTMP)
3410 fi
3411 ]
andre2ff7b5d2000-06-03 14:57:40 +00003412)
3413AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003414 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003415 [
3416 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003417 AC_DEFINE(DISABLE_WTMPX, 1,
3418 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003419 fi
3420 ]
andre2ff7b5d2000-06-03 14:57:40 +00003421)
3422AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003423 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003424 [
3425 if test "x$enableval" = "xno" ; then
3426 AC_DEFINE(DISABLE_LOGIN)
3427 fi
3428 ]
andre2ff7b5d2000-06-03 14:57:40 +00003429)
3430AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003431 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003432 [
3433 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003434 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3435 [Define if you don't want to use pututline()
3436 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003437 fi
3438 ]
andre2ff7b5d2000-06-03 14:57:40 +00003439)
3440AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003441 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003442 [
3443 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003444 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3445 [Define if you don't want to use pututxline()
3446 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003447 fi
3448 ]
andre2ff7b5d2000-06-03 14:57:40 +00003449)
3450AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003451 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003452 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003453 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003454 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003455 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003456 conf_lastlog_location=$withval
3457 fi
3458 ]
3459)
andre2ff7b5d2000-06-03 14:57:40 +00003460
3461dnl lastlog, [uw]tmpx? detection
3462dnl NOTE: set the paths in the platform section to avoid the
3463dnl need for command-line parameters
3464dnl lastlog and [uw]tmp are subject to a file search if all else fails
3465
3466dnl lastlog detection
3467dnl NOTE: the code itself will detect if lastlog is a directory
3468AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3469AC_TRY_COMPILE([
3470#include <sys/types.h>
3471#include <utmp.h>
3472#ifdef HAVE_LASTLOG_H
3473# include <lastlog.h>
3474#endif
Damien Miller2994e082000-06-04 15:51:47 +10003475#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003476# include <paths.h>
3477#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003478#ifdef HAVE_LOGIN_H
3479# include <login.h>
3480#endif
andre2ff7b5d2000-06-03 14:57:40 +00003481 ],
3482 [ char *lastlog = LASTLOG_FILE; ],
3483 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003484 [
3485 AC_MSG_RESULT(no)
3486 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3487 AC_TRY_COMPILE([
3488#include <sys/types.h>
3489#include <utmp.h>
3490#ifdef HAVE_LASTLOG_H
3491# include <lastlog.h>
3492#endif
3493#ifdef HAVE_PATHS_H
3494# include <paths.h>
3495#endif
3496 ],
3497 [ char *lastlog = _PATH_LASTLOG; ],
3498 [ AC_MSG_RESULT(yes) ],
3499 [
andree441aa32000-06-12 22:34:38 +00003500 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003501 system_lastlog_path=no
3502 ])
3503 ]
andre2ff7b5d2000-06-03 14:57:40 +00003504)
Damien Miller2994e082000-06-04 15:51:47 +10003505
andre2ff7b5d2000-06-03 14:57:40 +00003506if test -z "$conf_lastlog_location"; then
3507 if test x"$system_lastlog_path" = x"no" ; then
3508 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003509 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003510 conf_lastlog_location=$f
3511 fi
3512 done
3513 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003514 AC_MSG_WARN([** Cannot find lastlog **])
3515 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003516 fi
3517 fi
3518fi
3519
3520if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003521 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3522 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003523fi
andre2ff7b5d2000-06-03 14:57:40 +00003524
3525dnl utmp detection
3526AC_MSG_CHECKING([if your system defines UTMP_FILE])
3527AC_TRY_COMPILE([
3528#include <sys/types.h>
3529#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003530#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003531# include <paths.h>
3532#endif
3533 ],
3534 [ char *utmp = UTMP_FILE; ],
3535 [ AC_MSG_RESULT(yes) ],
3536 [ AC_MSG_RESULT(no)
3537 system_utmp_path=no ]
3538)
3539if test -z "$conf_utmp_location"; then
3540 if test x"$system_utmp_path" = x"no" ; then
3541 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3542 if test -f $f ; then
3543 conf_utmp_location=$f
3544 fi
3545 done
3546 if test -z "$conf_utmp_location"; then
3547 AC_DEFINE(DISABLE_UTMP)
3548 fi
3549 fi
3550fi
3551if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003552 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3553 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003554fi
andre2ff7b5d2000-06-03 14:57:40 +00003555
3556dnl wtmp detection
3557AC_MSG_CHECKING([if your system defines WTMP_FILE])
3558AC_TRY_COMPILE([
3559#include <sys/types.h>
3560#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003561#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003562# include <paths.h>
3563#endif
3564 ],
3565 [ char *wtmp = WTMP_FILE; ],
3566 [ AC_MSG_RESULT(yes) ],
3567 [ AC_MSG_RESULT(no)
3568 system_wtmp_path=no ]
3569)
3570if test -z "$conf_wtmp_location"; then
3571 if test x"$system_wtmp_path" = x"no" ; then
3572 for f in /usr/adm/wtmp /var/log/wtmp; do
3573 if test -f $f ; then
3574 conf_wtmp_location=$f
3575 fi
3576 done
3577 if test -z "$conf_wtmp_location"; then
3578 AC_DEFINE(DISABLE_WTMP)
3579 fi
3580 fi
3581fi
3582if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003583 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3584 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003585fi
andre2ff7b5d2000-06-03 14:57:40 +00003586
3587
3588dnl utmpx detection - I don't know any system so perverse as to require
3589dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3590dnl there, though.
3591AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3592AC_TRY_COMPILE([
3593#include <sys/types.h>
3594#include <utmp.h>
3595#ifdef HAVE_UTMPX_H
3596#include <utmpx.h>
3597#endif
Damien Miller2994e082000-06-04 15:51:47 +10003598#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003599# include <paths.h>
3600#endif
3601 ],
3602 [ char *utmpx = UTMPX_FILE; ],
3603 [ AC_MSG_RESULT(yes) ],
3604 [ AC_MSG_RESULT(no)
3605 system_utmpx_path=no ]
3606)
3607if test -z "$conf_utmpx_location"; then
3608 if test x"$system_utmpx_path" = x"no" ; then
3609 AC_DEFINE(DISABLE_UTMPX)
3610 fi
3611else
Tim Rice7df8d392005-09-19 09:33:39 -07003612 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3613 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003614fi
andre2ff7b5d2000-06-03 14:57:40 +00003615
3616dnl wtmpx detection
3617AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3618AC_TRY_COMPILE([
3619#include <sys/types.h>
3620#include <utmp.h>
3621#ifdef HAVE_UTMPX_H
3622#include <utmpx.h>
3623#endif
Damien Miller2994e082000-06-04 15:51:47 +10003624#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003625# include <paths.h>
3626#endif
3627 ],
3628 [ char *wtmpx = WTMPX_FILE; ],
3629 [ AC_MSG_RESULT(yes) ],
3630 [ AC_MSG_RESULT(no)
3631 system_wtmpx_path=no ]
3632)
3633if test -z "$conf_wtmpx_location"; then
3634 if test x"$system_wtmpx_path" = x"no" ; then
3635 AC_DEFINE(DISABLE_WTMPX)
3636 fi
3637else
Tim Rice7df8d392005-09-19 09:33:39 -07003638 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3639 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003640fi
andre2ff7b5d2000-06-03 14:57:40 +00003641
Damien Miller4018c192000-04-30 09:30:44 +10003642
Damien Miller29ea30d2000-03-17 10:54:15 +11003643if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003644 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3645 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003646fi
3647
Tim Rice4cec93f2002-02-26 08:40:48 -08003648dnl remove pam and dl because they are in $LIBPAM
3649if test "$PAM_MSG" = yes ; then
Tim Rice7d2d1f12002-02-26 22:05:11 -08003650 LIBS=`echo $LIBS | sed 's/-lpam //'`
3651fi
3652if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3653 LIBS=`echo $LIBS | sed 's/-ldl //'`
Tim Rice4cec93f2002-02-26 08:40:48 -08003654fi
3655
Darren Tucker7da23cb2005-08-03 00:20:15 +10003656dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3657dnl Add now.
3658CFLAGS="$CFLAGS $werror_flags"
3659
Damien Millerbac2d8a2000-09-05 16:13:06 +11003660AC_EXEEXT
Darren Tucker72c025d2005-01-18 12:05:18 +11003661AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3662 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003663AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003664
Damien Miller7b22d652000-06-18 14:07:04 +10003665# Print summary of options
3666
Damien Miller7b22d652000-06-18 14:07:04 +10003667# Someone please show me a better way :)
3668A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3669B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3670C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3671D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00003672E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00003673F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10003674G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10003675H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3676I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3677J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10003678
3679echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00003680echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10003681echo " User binaries: $B"
3682echo " System binaries: $C"
3683echo " Configuration files: $D"
3684echo " Askpass program: $E"
3685echo " Manual pages: $F"
3686echo " PID file: $G"
3687echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10003688if test "x$external_path_file" = "x/etc/login.conf" ; then
3689echo " At runtime, sshd will use the path defined in $external_path_file"
3690echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07003691else
Damien Millerf58c6722002-05-13 13:15:42 +10003692echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07003693 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003694echo " (If PATH is set in $external_path_file it will be used instead. If"
3695echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3696 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003697fi
Damien Millera18bbd32002-05-13 10:48:57 +10003698if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003699echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10003700fi
Damien Millerf58c6722002-05-13 13:15:42 +10003701echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10003702echo " PAM support: $PAM_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003703echo " KerberosV support: $KRB5_MSG"
3704echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003705echo " S/KEY support: $SKEY_MSG"
3706echo " TCP Wrappers support: $TCPW_MSG"
3707echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11003708echo " libedit support: $LIBEDIT_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10003709echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10003710echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3711echo " BSD Auth support: $BSD_AUTH_MSG"
3712echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11003713if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10003714echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11003715fi
3716
Damien Miller7b22d652000-06-18 14:07:04 +10003717echo ""
3718
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00003719echo " Host: ${host}"
3720echo " Compiler: ${CC}"
3721echo " Compiler flags: ${CFLAGS}"
3722echo "Preprocessor flags: ${CPPFLAGS}"
3723echo " Linker flags: ${LDFLAGS}"
Tim Rice4cec93f2002-02-26 08:40:48 -08003724echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
Damien Miller7b22d652000-06-18 14:07:04 +10003725
3726echo ""
3727
Tim Rice6f1f7582004-05-30 21:38:51 -07003728if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10003729 echo "SVR4 style packages are supported with \"make package\""
3730 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07003731fi
3732
Damien Miller82cf0ce2000-12-20 13:34:48 +11003733if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11003734 echo "PAM is enabled. You may need to install a PAM control file "
3735 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11003736 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11003737 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11003738 echo ""
3739fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003740
Damien Miller6c21c512002-01-22 21:57:53 +11003741if test ! -z "$RAND_HELPER_CMDHASH" ; then
3742 echo "WARNING: you are using the builtin random number collection "
3743 echo "service. Please read WARNING.RNG and request that your OS "
3744 echo "vendor includes kernel-based random number collection in "
3745 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00003746 echo ""
3747fi
Damien Miller60396b02001-02-18 17:01:00 +11003748
Damien Millerb4097182004-05-23 14:09:40 +10003749if test ! -z "$NO_PEERCHECK" ; then
3750 echo "WARNING: the operating system that you are using does not "
3751 echo "appear to support either the getpeereid() API nor the "
3752 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3753 echo "enforce security checks to prevent unauthorised connections to "
3754 echo "ssh-agent. Their absence increases the risk that a malicious "
3755 echo "user can connect to your agent. "
3756 echo ""
3757fi
3758
Darren Tuckerd9f88912005-02-20 21:01:48 +11003759if test "$AUDIT_MODULE" = "bsm" ; then
3760 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3761 echo "See the Solaris section in README.platform for details."
3762fi