blob: 7ef93c7d0c076f30a7af5c812c88cfb05796bab5 [file] [log] [blame]
Darren Tucker7c92a652007-09-27 07:00:09 +10001# $Id: configure.ac,v 1.385 2007/09/26 21:00:09 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Darren Tucker7c92a652007-09-27 07:00:09 +100018AC_REVISION($Revision: 1.385 $)
Tim Rice13aae5e2001-10-21 17:53:58 -070019AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100020
21AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110022AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110023AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110024AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100025
Damien Millera22ba012000-03-02 23:09:20 +110026# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100027AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110028AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100029AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110030AC_PROG_INSTALL
Tim Ricefd80ddc2006-02-02 19:11:56 -080031AC_PROG_EGREP
Ben Lindstrom582d3982001-02-06 22:54:30 +000032AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070033AC_PATH_PROG(CAT, cat)
34AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070035AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080036AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110037AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100038AC_PATH_PROG(ENT, ent)
39AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110040AC_PATH_PROG(TEST_MINUS_S_SH, bash)
41AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
42AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070043AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070044AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110045
Tim Rice6f1f7582004-05-30 21:38:51 -070046dnl for buildpkg.sh
47AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
50 [/usr/sbin${PATH_SEPARATOR}/etc])
51AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
Darren Tuckerfbea7642006-01-30 00:22:39 +110052if test -x /sbin/sh; then
53 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
54else
55 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
56fi
Tim Rice6f1f7582004-05-30 21:38:51 -070057
Damien Millere8bb4502001-09-25 16:39:35 +100058# System features
59AC_SYS_LARGEFILE
60
Damien Miller3f62aba2000-11-29 11:56:35 +110061if test -z "$AR" ; then
62 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
63fi
64
Damien Millerad833b32000-08-23 10:46:23 +100065# Use LOGIN_PROGRAM from environment if possible
66if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070067 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
68 [If your header files don't define LOGIN_PROGRAM,
69 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100070else
71 # Search for login
72 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
73 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
74 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
75 fi
76fi
77
Darren Tucker23bc8d02004-02-06 16:24:31 +110078AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
79if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070080 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
81 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110082fi
83
Damien Miller166bd442000-03-16 10:48:25 +110084if test -z "$LD" ; then
85 LD=$CC
86fi
87AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080088
Damien Miller166bd442000-03-16 10:48:25 +110089AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100090
91AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
92
Damien Millera8e06ce2003-11-21 23:48:55 +110093if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100094 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Darren Tucker3f9545e2005-11-12 15:20:52 +110095 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -070096 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +100097 1.*) no_attrib_nonnull=1 ;;
98 2.8* | 2.9*)
99 CFLAGS="$CFLAGS -Wsign-compare"
100 no_attrib_nonnull=1
101 ;;
102 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerb0288092005-11-10 14:46:48 +1100103 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100104 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
105 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700106 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +1000107
Darren Tucker67b37032005-06-03 17:58:31 +1000108 if test -z "$have_llong_max"; then
109 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
110 unset ac_cv_have_decl_LLONG_MAX
111 saved_CFLAGS="$CFLAGS"
112 CFLAGS="$CFLAGS -std=gnu99"
113 AC_CHECK_DECL(LLONG_MAX,
114 [have_llong_max=1],
115 [CFLAGS="$saved_CFLAGS"],
116 [#include <limits.h>]
117 )
118 fi
Damien Miller166bd442000-03-16 10:48:25 +1100119fi
120
Darren Tucker391de5c2007-04-29 14:49:21 +1000121if test "x$no_attrib_nonnull" != "x1" ; then
122 AC_DEFINE(HAVE_ATTRIBUTE__NONNULL__, 1, [Have attribute nonnull])
123fi
124
Tim Rice88368a32003-12-08 12:35:59 -0800125AC_ARG_WITH(rpath,
126 [ --without-rpath Disable auto-added -R linker paths],
127 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800128 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800129 need_dash_r=""
130 fi
131 if test "x$withval" = "xyes" ; then
132 need_dash_r=1
133 fi
134 ]
135)
136
Tim Rice1cfab232006-10-03 09:34:35 -0700137# Allow user to specify flags
138AC_ARG_WITH(cflags,
139 [ --with-cflags Specify additional flags to pass to compiler],
140 [
141 if test -n "$withval" && test "x$withval" != "xno" && \
142 test "x${withval}" != "xyes"; then
143 CFLAGS="$CFLAGS $withval"
144 fi
145 ]
146)
147AC_ARG_WITH(cppflags,
148 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
149 [
150 if test -n "$withval" && test "x$withval" != "xno" && \
151 test "x${withval}" != "xyes"; then
152 CPPFLAGS="$CPPFLAGS $withval"
153 fi
154 ]
155)
156AC_ARG_WITH(ldflags,
157 [ --with-ldflags Specify additional flags to pass to linker],
158 [
159 if test -n "$withval" && test "x$withval" != "xno" && \
160 test "x${withval}" != "xyes"; then
161 LDFLAGS="$LDFLAGS $withval"
162 fi
163 ]
164)
165AC_ARG_WITH(libs,
166 [ --with-libs Specify additional libraries to link with],
167 [
168 if test -n "$withval" && test "x$withval" != "xno" && \
169 test "x${withval}" != "xyes"; then
170 LIBS="$LIBS $withval"
171 fi
172 ]
173)
174AC_ARG_WITH(Werror,
175 [ --with-Werror Build main code with -Werror],
176 [
177 if test -n "$withval" && test "x$withval" != "xno"; then
178 werror_flags="-Werror"
179 if test "x${withval}" != "xyes"; then
180 werror_flags="$withval"
181 fi
182 fi
183 ]
184)
185
186AC_CHECK_HEADERS( \
187 bstring.h \
188 crypt.h \
189 crypto/sha2.h \
190 dirent.h \
191 endian.h \
192 features.h \
193 fcntl.h \
194 floatingpoint.h \
195 getopt.h \
196 glob.h \
197 ia.h \
198 iaf.h \
199 limits.h \
200 login.h \
201 maillock.h \
202 ndir.h \
203 net/if_tun.h \
204 netdb.h \
205 netgroup.h \
206 pam/pam_appl.h \
207 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000208 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700209 pty.h \
210 readpassphrase.h \
211 rpc/types.h \
212 security/pam_appl.h \
213 sha2.h \
214 shadow.h \
215 stddef.h \
216 stdint.h \
217 string.h \
218 strings.h \
219 sys/audit.h \
220 sys/bitypes.h \
221 sys/bsdtty.h \
222 sys/cdefs.h \
223 sys/dir.h \
224 sys/mman.h \
225 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000226 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700227 sys/prctl.h \
228 sys/pstat.h \
229 sys/select.h \
230 sys/stat.h \
231 sys/stream.h \
232 sys/stropts.h \
233 sys/strtio.h \
234 sys/sysmacros.h \
235 sys/time.h \
236 sys/timers.h \
237 sys/un.h \
238 time.h \
239 tmpdir.h \
240 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700241 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700242 unistd.h \
243 usersec.h \
244 util.h \
245 utime.h \
246 utmp.h \
247 utmpx.h \
248 vis.h \
249)
250
251# lastlog.h requires sys/time.h to be included first on Solaris
252AC_CHECK_HEADERS(lastlog.h, [], [], [
253#ifdef HAVE_SYS_TIME_H
254# include <sys/time.h>
255#endif
256])
257
258# sys/ptms.h requires sys/stream.h to be included first on Solaris
259AC_CHECK_HEADERS(sys/ptms.h, [], [], [
260#ifdef HAVE_SYS_STREAM_H
261# include <sys/stream.h>
262#endif
263])
264
265# login_cap.h requires sys/types.h on NetBSD
266AC_CHECK_HEADERS(login_cap.h, [], [], [
267#include <sys/types.h>
268])
269
Damien Miller1b06dc32006-08-31 03:24:41 +1000270# Messages for features tested for in target-specific section
271SIA_MSG="no"
272SPC_MSG="no"
273
Damien Millera22ba012000-03-02 23:09:20 +1100274# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100275case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100276*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000277 # Some versions of VAC won't allow macro redefinitions at
278 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
279 # particularly with older versions of vac or xlc.
280 # It also throws errors about null macro argments, but these are
281 # not fatal.
282 AC_MSG_CHECKING(if compiler allows macro redefinitions)
283 AC_COMPILE_IFELSE(
284 [AC_LANG_SOURCE([[
285#define testmacro foo
286#define testmacro bar
287int main(void) { exit(0); }
288 ]])],
289 [ AC_MSG_RESULT(yes) ],
290 [ AC_MSG_RESULT(no)
291 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
292 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
293 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
294 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
295 ]
296 )
297
Damien Millera8e06ce2003-11-21 23:48:55 +1100298 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000299 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800300 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100301 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000302 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000303 if test "$GCC" = "yes"; then
304 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
305 else
306 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
307 fi
308 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000309 if (test -z "$blibflags"); then
310 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
311 AC_TRY_LINK([], [], [blibflags=$tryflags])
312 fi
313 done
314 if (test -z "$blibflags"); then
315 AC_MSG_RESULT(not found)
316 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
317 else
318 AC_MSG_RESULT($blibflags)
319 fi
320 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000321 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700322 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
323 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700324 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000325 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700326 LIBS="$LIBS -ls"
327 ])
328 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100329 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100330 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100331 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000332 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100333 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000334 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
335 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000336 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000337 [(void)loginfailed("user","host","tty",0);],
338 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700339 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
340 [Define if your AIX loginfailed() function
341 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000342 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000343 )],
344 [],
345 [#include <usersec.h>]
346 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000347 AC_CHECK_FUNCS(setauthdb)
Darren Tucker3083bc22006-08-17 19:35:49 +1000348 AC_CHECK_DECL(F_CLOSEM,
Darren Tuckerd018b2e2006-08-18 18:51:20 +1000349 AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000350 [],
351 [ #include <limits.h>
352 #include <fcntl.h> ]
353 )
Darren Tucker691d5232005-02-15 21:45:57 +1100354 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700355 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
356 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
357 [Define if your platform breaks doing a seteuid before a setuid])
358 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
359 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000360 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700361 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
362 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
363 [Some systems need a utmpx entry for /bin/login to work])
364 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
365 [Define to a Set Process Title type if your system is
366 supported by bsd-setproctitle.c])
Darren Tucker91d25a02005-11-26 22:24:09 +1100367 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
368 [AIX 5.2 and 5.3 (and presumably newer) require this])
Darren Tucker9afe1152006-06-23 21:24:12 +1000369 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
Damien Miller75b1d102000-01-07 14:01:41 +1100370 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100371*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100372 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100373 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700374 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
375 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
376 AC_DEFINE(DISABLE_SHADOW, 1,
377 [Define if you want to disable shadow passwords])
378 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
379 [Define if your system choked on IP TOS setting])
380 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
381 [Define if X11 doesn't support AF_UNIX sockets on that system])
382 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
383 [Define if the concept of ports only accessible to
384 superusers isn't known])
385 AC_DEFINE(DISABLE_FD_PASSING, 1,
386 [Define if your platform needs to skip post auth
387 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100388 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000389*-*-dgux*)
390 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100391 AC_DEFINE(SETEUID_BREAKS_SETUID)
392 AC_DEFINE(BROKEN_SETREUID)
393 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000394 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000395*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000396 AC_MSG_CHECKING(if we have working getaddrinfo)
397 AC_TRY_RUN([#include <mach-o/dyld.h>
398main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
399 exit(0);
400 else
401 exit(1);
402}], [AC_MSG_RESULT(working)],
403 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700404 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700405 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000406 AC_DEFINE(SETEUID_BREAKS_SETUID)
407 AC_DEFINE(BROKEN_SETREUID)
408 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700409 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
410 [Define if your resolver libs need this for getrrsetbyname])
Darren Tucker3eb48342006-06-23 21:05:12 +1000411 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
412 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
413 [Use tunnel device compatibility to OpenBSD])
414 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
415 [Prepend the address family to IP tunnel traffic])
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000416 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000417*-*-dragonfly*)
418 SSHDLIBS="$SSHDLIBS -lcrypt"
419 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000420*-*-hpux*)
421 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000422 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100423 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000424 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700425 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
426 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000427 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700428 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
429 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000430 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000431 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700432 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000433 AC_CHECK_LIB(xnet, t_error, ,
434 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
435
436 # next, we define all of the options specific to major releases
437 case "$host" in
438 *-*-hpux10*)
439 if test -z "$GCC"; then
440 CFLAGS="$CFLAGS -Ae"
441 fi
442 ;;
443 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700444 AC_DEFINE(PAM_SUN_CODEBASE, 1,
445 [Define if you are using Solaris-derived PAM which
446 passes pam_messages to the conversation function
447 with an extra level of indirection])
448 AC_DEFINE(DISABLE_UTMP, 1,
449 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000450 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
451 check_for_hpux_broken_getaddrinfo=1
452 check_for_conflicting_getspnam=1
453 ;;
454 esac
455
456 # lastly, we define options specific to minor releases
457 case "$host" in
458 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700459 AC_DEFINE(HAVE_SECUREWARE, 1,
460 [Define if you have SecureWare-based
461 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000462 disable_ptmx_check=yes
463 LIBS="$LIBS -lsecpw"
464 ;;
465 esac
Damien Miller1bead332000-04-30 00:47:29 +1000466 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100467*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100468 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700469 AC_DEFINE(BROKEN_INET_NTOA, 1,
470 [Define if you system's inet_ntoa is busted
471 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000472 AC_DEFINE(SETEUID_BREAKS_SETUID)
473 AC_DEFINE(BROKEN_SETREUID)
474 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700475 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
476 [Define if you shouldn't strip 'tty' from your
477 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000478 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100479 ;;
480*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100481 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700482 AC_DEFINE(WITH_IRIX_ARRAY, 1,
483 [Define if you have/want arrays
484 (cluster-wide session managment, not C arrays)])
485 AC_DEFINE(WITH_IRIX_PROJECT, 1,
486 [Define if you want IRIX project management])
487 AC_DEFINE(WITH_IRIX_AUDIT, 1,
488 [Define if you want IRIX audit trails])
489 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
490 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000491 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000492 AC_DEFINE(SETEUID_BREAKS_SETUID)
493 AC_DEFINE(BROKEN_SETREUID)
494 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700495 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000496 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000497 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100498 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100499*-*-linux*)
500 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100501 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000502 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700503 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
504 AC_DEFINE(PAM_TTY_KLUDGE, 1,
505 [Work around problematic Linux PAM modules handling of PAM_TTY])
506 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
507 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000508 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700509 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
510 [Define to whatever link() returns for "not supported"
511 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100512 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700513 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100514 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000515 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000516 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700517 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
518 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000519 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000520 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100521 # tun(4) forwarding compat code
Damien Millerc4bcc912005-12-31 17:05:58 +1100522 AC_CHECK_HEADERS(linux/if_tun.h)
Damien Millerbd4e4102006-01-01 21:03:30 +1100523 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Damien Miller89e03ba2005-12-31 16:42:03 +1100524 AC_DEFINE(SSH_TUN_LINUX, 1,
525 [Open tunnel devices the Linux tun/tap way])
526 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
527 [Use tunnel device compatibility to OpenBSD])
528 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
529 [Prepend the address family to IP tunnel traffic])
530 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100531 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000532mips-sony-bsd|mips-sony-newsos4)
Darren Tucker988b3fd2006-02-08 22:11:27 +1100533 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000534 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000535 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100536*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000537 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800538 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800539 need_dash_r=1
540 fi
Damien Miller2dcddbf2006-01-01 19:47:05 +1100541 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
542 AC_CHECK_HEADER([net/if_tap.h], ,
543 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
544 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
545 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100546 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100547*-*-freebsd*)
548 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000549 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100550 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
551 AC_CHECK_HEADER([net/if_tap.h], ,
552 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
Damien Millerfbd884a2001-02-27 08:39:07 +1100553 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000554*-*-bsdi*)
555 AC_DEFINE(SETEUID_BREAKS_SETUID)
556 AC_DEFINE(BROKEN_SETREUID)
557 AC_DEFINE(BROKEN_SETREGID)
558 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000559*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000560 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100561 conf_utmp_location=/etc/utmp
562 conf_wtmp_location=/usr/adm/wtmp
563 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700564 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000565 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000566 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700567 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000568 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000569*-*-openbsd*)
570 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000571 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100572 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
Damien Millerbb598142006-08-19 08:38:23 +1000573 AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1,
574 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000575 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100576*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800577 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800578 need_dash_r=1
579 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100580 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000581 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700582 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
583 [Some versions of /bin/login need the TERM supplied
584 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000585 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700586 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
587 [Define if pam_chauthtok wants real uid set
588 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000589 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000590 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700591 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
592 [Define if sshd somehow reacquires a controlling TTY
593 after setsid()])
Darren Tucker0249f932006-06-24 12:10:07 +1000594 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
595 in case the name is longer than 8 chars])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000596 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000597 # hardwire lastlog location (can't detect it on some versions)
598 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000599 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
600 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
601 if test "$sol2ver" -ge 8; then
602 AC_MSG_RESULT(yes)
603 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700604 AC_DEFINE(DISABLE_WTMP, 1,
605 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000606 else
607 AC_MSG_RESULT(no)
608 fi
Damien Miller1b06dc32006-08-31 03:24:41 +1000609 AC_ARG_WITH(solaris-contracts,
610 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
611 [
612 AC_CHECK_LIB(contract, ct_tmpl_activate,
613 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
614 [Define if you have Solaris process contracts])
615 SSHDLIBS="$SSHDLIBS -lcontract"
616 AC_SUBST(SSHDLIBS)
617 SPC_MSG="yes" ], )
618 ],
619 )
Damien Miller75b1d102000-01-07 14:01:41 +1100620 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000621*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000622 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000623 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100624 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000625 conf_utmp_location=/etc/utmp
626 conf_wtmp_location=/var/adm/wtmp
627 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000628 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000629 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000630*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700631 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000632 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000633 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000634 AC_DEFINE(SETEUID_BREAKS_SETUID)
635 AC_DEFINE(BROKEN_SETREUID)
636 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000637 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000638*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700639 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000640 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100641 # -lresolv needs to be at the end of LIBS or DNS lookups break
642 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100643 IPADDR_IN_DISPLAY=yes
644 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000645 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000646 AC_DEFINE(SETEUID_BREAKS_SETUID)
647 AC_DEFINE(BROKEN_SETREUID)
648 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000649 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000650 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700651 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
652 # Attention: always take care to bind libsocket and libnsl before libc,
653 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000654 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800655# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100656*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100657 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700658 AC_DEFINE(SETEUID_BREAKS_SETUID)
659 AC_DEFINE(BROKEN_SETREUID)
660 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700661 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice46259d82005-11-28 18:40:34 -0800662 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller78315eb2000-09-29 23:01:36 +1100663 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800664# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100665*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700666 check_for_libcrypt_later=1
667 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100668 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700669 AC_DEFINE(SETEUID_BREAKS_SETUID)
670 AC_DEFINE(BROKEN_SETREUID)
671 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700672 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700673 case "$host" in
674 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
675 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700676 AC_DEFINE(BROKEN_LIBIAF, 1,
677 [ia_uinfo routines not supported by OS yet])
Tim Riceb8f00192006-09-06 18:11:29 -0700678 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice4dbacff2005-06-01 20:09:28 -0700679 ;;
Tim Rice46259d82005-11-28 18:40:34 -0800680 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
681 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700682 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100683 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100684*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100685 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800686# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100687*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800688 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100689 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800690# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100691*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800692 if test -z "$GCC"; then
693 CFLAGS="$CFLAGS -belf"
694 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100695 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000696 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100697 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000698 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000699 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700700 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700701 AC_DEFINE(SETEUID_BREAKS_SETUID)
702 AC_DEFINE(BROKEN_SETREUID)
703 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700704 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700705 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700706 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100707 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700708 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700709 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000710 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000711*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700712 AC_DEFINE(NO_SSH_LASTLOG, 1,
713 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100714 AC_DEFINE(SETEUID_BREAKS_SETUID)
715 AC_DEFINE(BROKEN_SETREUID)
716 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000717 AC_DEFINE(USE_PIPES)
718 AC_DEFINE(DISABLE_FD_PASSING)
719 LDFLAGS="$LDFLAGS"
720 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
721 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000722 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000723*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100724 AC_DEFINE(SETEUID_BREAKS_SETUID)
725 AC_DEFINE(BROKEN_SETREUID)
726 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000727 AC_DEFINE(WITH_ABBREV_NO_TTY)
728 AC_DEFINE(USE_PIPES)
729 AC_DEFINE(DISABLE_FD_PASSING)
730 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100731 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000732 MANTYPE=cat
733 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000734*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100735 AC_DEFINE(SETEUID_BREAKS_SETUID)
736 AC_DEFINE(BROKEN_SETREUID)
737 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000738 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700739 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700740 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000741 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
742 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
743 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700744 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000745*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000746 AC_MSG_CHECKING(for Digital Unix SIA)
747 no_osfsia=""
748 AC_ARG_WITH(osfsia,
749 [ --with-osfsia Enable Digital Unix SIA],
750 [
751 if test "x$withval" = "xno" ; then
752 AC_MSG_RESULT(disabled)
753 no_osfsia=1
754 fi
755 ],
756 )
757 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000758 if test -f /etc/sia/matrix.conf; then
759 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700760 AC_DEFINE(HAVE_OSF_SIA, 1,
761 [Define if you have Digital Unix Security
762 Integration Architecture])
763 AC_DEFINE(DISABLE_LOGIN, 1,
764 [Define if you don't want to use your
765 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000766 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000767 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000768 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000769 else
770 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700771 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
772 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000773 fi
774 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000775 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700776 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000777 AC_DEFINE(BROKEN_SETREUID)
778 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000779 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000780
Tim Rice70335a62006-02-04 17:42:58 -0800781*-*-nto-qnx*)
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000782 AC_DEFINE(USE_PIPES)
783 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700784 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
785 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
786 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Tim Rice70335a62006-02-04 17:42:58 -0800787 AC_DEFINE(DISABLE_LASTLOG)
Darren Tucker54b75fe2006-02-26 12:31:48 +1100788 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Tim Rice2f993462006-02-11 18:37:48 -0800789 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +1000790 case "$host" in
791 *-*-nto-qnx6*)
792 AC_DEFINE(DISABLE_FD_PASSING)
793 ;;
794 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000795 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000796
797*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700798 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
799 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
Darren Tucker988b3fd2006-02-08 22:11:27 +1100800 AC_DEFINE(NEED_SETPGRP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700801 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
802 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000803
804*-*-lynxos)
805 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700806 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000807 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
808 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100809esac
810
Darren Tucker6eb93042003-06-29 21:30:41 +1000811AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000812AC_RUN_IFELSE(
813 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000814#include <stdio.h>
815int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000816 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000817 [ AC_MSG_RESULT(yes) ],
818 [
819 AC_MSG_RESULT(no)
820 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000821 ],
822 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000823)
824
Darren Tucker0c9653f2005-05-28 15:58:14 +1000825dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +1100826# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700827AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
828AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000829
Tim Rice1e1ef642003-09-11 22:19:31 -0700830dnl IRIX and Solaris 2.5.1 have dirname() in libgen
831AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
832 AC_CHECK_LIB(gen, dirname,[
833 AC_CACHE_CHECK([for broken dirname],
834 ac_cv_have_broken_dirname, [
835 save_LIBS="$LIBS"
836 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000837 AC_RUN_IFELSE(
838 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700839#include <libgen.h>
840#include <string.h>
841
842int main(int argc, char **argv) {
843 char *s, buf[32];
844
845 strncpy(buf,"/etc", 32);
846 s = dirname(buf);
847 if (!s || strncmp(s, "/", 32) != 0) {
848 exit(1);
849 } else {
850 exit(0);
851 }
852}
Darren Tucker314d89e2005-10-17 23:29:23 +1000853 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700854 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000855 [ ac_cv_have_broken_dirname="yes" ],
856 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700857 )
858 LIBS="$save_LIBS"
859 ])
860 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
861 LIBS="$LIBS -lgen"
862 AC_DEFINE(HAVE_DIRNAME)
863 AC_CHECK_HEADERS(libgen.h)
864 fi
865 ])
866])
867
868AC_CHECK_FUNC(getspnam, ,
869 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700870AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
871 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700872
Tim Rice13aae5e2001-10-21 17:53:58 -0700873dnl zlib is required
874AC_ARG_WITH(zlib,
875 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100876 [ if test "x$withval" = "xno" ; then
877 AC_MSG_ERROR([*** zlib is required ***])
878 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700879 if test -d "$withval/lib"; then
880 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700881 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700882 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700883 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700884 fi
885 else
886 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700887 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700888 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700889 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700890 fi
891 fi
892 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700893 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700894 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700895 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700896 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100897 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700898)
899
Tim Ricefcb62202004-01-23 18:35:16 -0800900AC_CHECK_LIB(z, deflate, ,
901 [
902 saved_CPPFLAGS="$CPPFLAGS"
903 saved_LDFLAGS="$LDFLAGS"
904 save_LIBS="$LIBS"
905 dnl Check default zlib install dir
906 if test -n "${need_dash_r}"; then
907 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
908 else
909 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
910 fi
911 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
912 LIBS="$LIBS -lz"
913 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
914 [
915 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
916 ]
917 )
918 ]
919)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100920AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100921
922AC_ARG_WITH(zlib-version-check,
923 [ --without-zlib-version-check Disable zlib version check],
924 [ if test "x$withval" = "xno" ; then
925 zlib_check_nonfatal=1
926 fi
927 ]
928)
929
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000930AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000931AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000932#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100933#include <zlib.h>
934int main()
935{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000936 int a=0, b=0, c=0, d=0, n, v;
937 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
938 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100939 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000940 v = a*1000000 + b*10000 + c*100 + d;
941 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
942
943 /* 1.1.4 is OK */
944 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100945 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000946
Darren Tucker41097ed2005-07-25 15:24:21 +1000947 /* 1.2.3 and up are OK */
948 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000949 exit(0);
950
Darren Tucker2dcd2392004-01-23 17:13:33 +1100951 exit(2);
952}
Darren Tucker623d92f2004-09-12 22:36:15 +1000953 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000954 AC_MSG_RESULT(no),
955 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100956 if test -z "$zlib_check_nonfatal" ; then
957 AC_MSG_ERROR([*** zlib too old - check config.log ***
958Your reported zlib version has known security problems. It's possible your
959vendor has fixed these problems without changing the version number. If you
960are sure this is the case, you can disable the check by running
961"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000962If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000963See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100964 else
965 AC_MSG_WARN([zlib version may have security problems])
966 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000967 ],
968 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100969)
Damien Miller6f9c3372000-10-25 10:06:04 +1100970
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000971dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100972AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000973 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
974)
Darren Tucker5bfe1682005-11-12 18:42:36 +1100975AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700976 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
977 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000978)
Damien Millerab18c411999-11-11 10:40:23 +1100979
Tim Ricee589a292001-11-03 11:09:32 -0800980dnl Checks for libutil functions
981AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700982AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
983 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -0800984AC_CHECK_FUNCS(logout updwtmp logwtmp)
985
Ben Lindstrom8697e082001-02-24 21:41:10 +0000986AC_FUNC_STRFTIME
987
Damien Miller3c027682001-03-14 11:39:45 +1100988# Check for ALTDIRFUNC glob() extension
989AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
990AC_EGREP_CPP(FOUNDIT,
991 [
992 #include <glob.h>
993 #ifdef GLOB_ALTDIRFUNC
994 FOUNDIT
995 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +1100996 ],
Damien Miller3c027682001-03-14 11:39:45 +1100997 [
Tim Rice7df8d392005-09-19 09:33:39 -0700998 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
999 [Define if your system glob() function has
1000 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +11001001 AC_MSG_RESULT(yes)
1002 ],
1003 [
1004 AC_MSG_RESULT(no)
1005 ]
1006)
Damien Millerab18c411999-11-11 10:40:23 +11001007
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001008# Check for g.gl_matchc glob() extension
1009AC_MSG_CHECKING(for gl_matchc field in glob_t)
Darren Tucker486d95e2006-03-15 21:31:39 +11001010AC_TRY_COMPILE(
Damien Milleraf87af12006-03-15 13:02:28 +11001011 [ #include <glob.h> ],
1012 [glob_t g; g.gl_matchc = 1;],
Damien Millera8e06ce2003-11-21 23:48:55 +11001013 [
Tim Rice7df8d392005-09-19 09:33:39 -07001014 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1015 [Define if your system glob() function has
1016 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +11001017 AC_MSG_RESULT(yes)
1018 ],
1019 [
1020 AC_MSG_RESULT(no)
1021 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001022)
1023
Darren Tucker096faec2006-09-01 20:29:10 +10001024AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1025
Damien Miller18bb4732001-03-28 14:35:30 +10001026AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001027AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001028 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +10001029#include <sys/types.h>
1030#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001031int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +10001032 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001033 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +10001034 [
1035 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001036 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +11001037 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001038 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001039 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001040 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001041 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1042 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +10001043 ]
1044)
1045
Damien Miller36f49652004-08-15 18:40:59 +10001046AC_MSG_CHECKING([for /proc/pid/fd directory])
1047if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07001048 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +10001049 AC_MSG_RESULT(yes)
1050else
1051 AC_MSG_RESULT(no)
1052fi
1053
Damien Millerc547bf12001-02-16 10:18:12 +11001054# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001055SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001056AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001057 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001058 [
1059 if test "x$withval" != "xno" ; then
1060
1061 if test "x$withval" != "xyes" ; then
1062 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1063 LDFLAGS="$LDFLAGS -L${withval}/lib"
1064 fi
1065
Tim Rice7df8d392005-09-19 09:33:39 -07001066 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001067 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001068 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001069
Tim Rice4cec93f2002-02-26 08:40:48 -08001070 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001071 AC_LINK_IFELSE(
1072 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001073#include <stdio.h>
1074#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001075int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +10001076 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001077 [AC_MSG_RESULT(yes)],
1078 [
1079 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +11001080 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1081 ])
Darren Tucker3b908f62004-04-14 15:26:39 +10001082 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1083 AC_TRY_COMPILE(
1084 [#include <stdio.h>
1085 #include <skey.h>],
1086 [(void)skeychallenge(NULL,"name","",0);],
1087 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001088 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1089 [Define if your skeychallenge()
1090 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +10001091 [AC_MSG_RESULT(no)]
1092 )
Damien Millerc547bf12001-02-16 10:18:12 +11001093 fi
1094 ]
1095)
1096
1097# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001098TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001099AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001100 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001101 [
1102 if test "x$withval" != "xno" ; then
1103 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001104 saved_LDFLAGS="$LDFLAGS"
1105 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001106 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001107 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001108 if test -d "${withval}/lib"; then
1109 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001110 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001111 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001112 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001113 fi
1114 else
1115 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001116 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001117 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001118 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001119 fi
1120 fi
1121 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001122 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001123 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001124 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001125 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001126 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001127 LIBS="-lwrap $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001128 AC_MSG_CHECKING(for libwrap)
1129 AC_TRY_LINK(
1130 [
Damien Miller0ac45002004-04-14 20:14:26 +10001131#include <sys/types.h>
1132#include <sys/socket.h>
1133#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001134#include <tcpd.h>
1135 int deny_severity = 0, allow_severity = 0;
1136 ],
1137 [hosts_access(0);],
1138 [
1139 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001140 AC_DEFINE(LIBWRAP, 1,
1141 [Define if you want
1142 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001143 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001144 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001145 ],
1146 [
1147 AC_MSG_ERROR([*** libwrap missing])
1148 ]
1149 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001150 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001151 fi
1152 ]
1153)
1154
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001155# Check whether user wants libedit support
1156LIBEDIT_MSG="no"
1157AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001158 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001159 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001160 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001161 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1162 if test -n "${need_dash_r}"; then
1163 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1164 else
1165 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1166 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001167 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001168 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001169 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001170 LIBEDIT="-ledit -lcurses"
1171 LIBEDIT_MSG="yes"
1172 AC_SUBST(LIBEDIT)
1173 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001174 [ AC_MSG_ERROR(libedit not found) ],
1175 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001176 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001177 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001178 AC_COMPILE_IFELSE(
1179 [AC_LANG_SOURCE([[
1180#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001181int main(void)
1182{
1183 int i = H_SETSIZE;
1184 el_init("", NULL, NULL, NULL);
1185 exit(0);
1186}
Tim Ricec1819c82005-08-15 17:48:40 -07001187 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001188 [ AC_MSG_RESULT(yes) ],
1189 [ AC_MSG_RESULT(no)
1190 AC_MSG_ERROR(libedit version is not compatible) ]
1191 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001192 fi ]
1193)
1194
Darren Tuckerd9f88912005-02-20 21:01:48 +11001195AUDIT_MODULE=none
1196AC_ARG_WITH(audit,
1197 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1198 [
1199 AC_MSG_CHECKING(for supported audit module)
1200 case "$withval" in
1201 bsm)
1202 AC_MSG_RESULT(bsm)
1203 AUDIT_MODULE=bsm
1204 dnl Checks for headers, libs and functions
1205 AC_CHECK_HEADERS(bsm/audit.h, [],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001206 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1207 [
1208#ifdef HAVE_TIME_H
1209# include <time.h>
1210#endif
1211 ]
1212)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001213 AC_CHECK_LIB(bsm, getaudit, [],
1214 [AC_MSG_ERROR(BSM enabled and required library not found)])
1215 AC_CHECK_FUNCS(getaudit, [],
1216 [AC_MSG_ERROR(BSM enabled and required function not found)])
1217 # These are optional
Darren Tucker0d096692005-03-07 17:34:45 +11001218 AC_CHECK_FUNCS(getaudit_addr)
Tim Rice7df8d392005-09-19 09:33:39 -07001219 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001220 ;;
1221 debug)
1222 AUDIT_MODULE=debug
1223 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001224 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001225 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001226 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001227 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001228 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001229 *)
1230 AC_MSG_ERROR([Unknown audit module $withval])
1231 ;;
1232 esac ]
1233)
1234
Damien Millerfe1f1432003-02-24 15:45:42 +11001235dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001236AC_CHECK_FUNCS( \
1237 arc4random \
Damien Miller57f39152005-11-24 19:58:19 +11001238 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001239 b64_ntop \
1240 __b64_ntop \
1241 b64_pton \
1242 __b64_pton \
1243 bcopy \
1244 bindresvport_sa \
1245 clock \
1246 closefrom \
1247 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001248 fchmod \
1249 fchown \
1250 freeaddrinfo \
1251 futimes \
1252 getaddrinfo \
1253 getcwd \
1254 getgrouplist \
1255 getnameinfo \
1256 getopt \
1257 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001258 getpeerucred \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001259 _getpty \
1260 getrlimit \
1261 getttyent \
1262 glob \
1263 inet_aton \
1264 inet_ntoa \
1265 inet_ntop \
1266 innetgr \
1267 login_getcapbool \
1268 md5_crypt \
1269 memmove \
1270 mkdtemp \
1271 mmap \
1272 ngetaddrinfo \
1273 nsleep \
1274 ogetaddrinfo \
1275 openlog_r \
1276 openpty \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001277 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001278 prctl \
1279 pstat \
1280 readpassphrase \
1281 realpath \
1282 recvmsg \
1283 rresvport_af \
1284 sendmsg \
1285 setdtablesize \
1286 setegid \
1287 setenv \
1288 seteuid \
1289 setgroups \
1290 setlogin \
1291 setpcred \
1292 setproctitle \
1293 setregid \
1294 setreuid \
1295 setrlimit \
1296 setsid \
1297 setvbuf \
1298 sigaction \
1299 sigvec \
1300 snprintf \
1301 socketpair \
1302 strdup \
1303 strerror \
1304 strlcat \
1305 strlcpy \
1306 strmode \
1307 strnvis \
1308 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001309 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001310 strtoul \
Damien Miller34a17692007-06-11 14:15:42 +10001311 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001312 sysconf \
1313 tcgetpgrp \
1314 truncate \
1315 unsetenv \
1316 updwtmpx \
Damien Miller57f39152005-11-24 19:58:19 +11001317 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001318 vhangup \
1319 vsnprintf \
1320 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001321)
Tim Rice13aae5e2001-10-21 17:53:58 -07001322
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001323# IRIX has a const char return value for gai_strerror()
1324AC_CHECK_FUNCS(gai_strerror,[
1325 AC_DEFINE(HAVE_GAI_STRERROR)
1326 AC_TRY_COMPILE([
1327#include <sys/types.h>
1328#include <sys/socket.h>
1329#include <netdb.h>
1330
1331const char *gai_strerror(int);],[
1332char *str;
1333
1334str = gai_strerror(0);],[
1335 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1336 [Define if gai_strerror() returns const char *])])])
1337
Tim Rice7df8d392005-09-19 09:33:39 -07001338AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1339 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001340
Darren Tuckerf1159b52003-07-07 19:44:01 +10001341dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001342AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001343AC_CHECK_DECL(strsep,
1344 [AC_CHECK_FUNCS(strsep)],
1345 [],
1346 [
1347#ifdef HAVE_STRING_H
1348# include <string.h>
1349#endif
1350 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001351
Darren Tuckerb2427c82003-09-10 15:22:44 +10001352dnl tcsendbreak might be a macro
1353AC_CHECK_DECL(tcsendbreak,
1354 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001355 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001356 [#include <termios.h>]
1357)
1358
Darren Tucker5bb14002004-04-23 18:53:10 +10001359AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1360
Darren Tucker128a0892006-07-12 19:02:56 +10001361AC_CHECK_DECLS(SHUT_RD, , ,
1362 [
1363#include <sys/types.h>
1364#include <sys/socket.h>
1365 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001366
1367AC_CHECK_DECLS(O_NONBLOCK, , ,
1368 [
1369#include <sys/types.h>
1370#ifdef HAVE_SYS_STAT_H
1371# include <sys/stat.h>
1372#endif
1373#ifdef HAVE_FCNTL_H
1374# include <fcntl.h>
1375#endif
1376 ])
1377
Darren Tuckered0b5922006-09-03 22:44:49 +10001378AC_CHECK_DECLS(writev, , , [
1379#include <sys/types.h>
1380#include <sys/uio.h>
1381#include <unistd.h>
1382 ])
1383
Darren Tucker6d862a52007-04-29 14:39:02 +10001384AC_CHECK_DECLS(MAXSYMLINKS, , , [
1385#include <sys/param.h>
1386 ])
1387
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001388AC_CHECK_DECLS(offsetof, , , [
1389#include <stddef.h>
1390 ])
1391
Darren Tucker2a6b0292003-12-31 14:59:17 +11001392AC_CHECK_FUNCS(setresuid, [
1393 dnl Some platorms have setresuid that isn't implemented, test for this
1394 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001395 AC_RUN_IFELSE(
1396 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001397#include <stdlib.h>
1398#include <errno.h>
1399int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001400 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001401 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001402 [AC_DEFINE(BROKEN_SETRESUID, 1,
1403 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001404 AC_MSG_RESULT(not implemented)],
1405 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001406 )
1407])
Darren Tuckere937be32003-12-17 18:53:26 +11001408
Darren Tucker2a6b0292003-12-31 14:59:17 +11001409AC_CHECK_FUNCS(setresgid, [
1410 dnl Some platorms have setresgid that isn't implemented, test for this
1411 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001412 AC_RUN_IFELSE(
1413 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001414#include <stdlib.h>
1415#include <errno.h>
1416int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001417 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001418 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001419 [AC_DEFINE(BROKEN_SETRESGID, 1,
1420 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001421 AC_MSG_RESULT(not implemented)],
1422 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001423 )
1424])
Darren Tuckere937be32003-12-17 18:53:26 +11001425
Damien Millerad833b32000-08-23 10:46:23 +10001426dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001427AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001428dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001429AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001430AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001431dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001432AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001433AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001434
Damien Millera8e06ce2003-11-21 23:48:55 +11001435AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001436 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1437 [AC_CHECK_LIB(bsd, daemon,
1438 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001439)
1440
Damien Millera8e06ce2003-11-21 23:48:55 +11001441AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001442 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1443 [Define if your libraries define getpagesize()])],
1444 [AC_CHECK_LIB(ucb, getpagesize,
1445 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001446)
1447
Damien Millercb170cb2000-07-01 16:52:55 +10001448# Check for broken snprintf
1449if test "x$ac_cv_func_snprintf" = "xyes" ; then
1450 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001451 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001452 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001453#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001454int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001455 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001456 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001457 [
1458 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001459 AC_DEFINE(BROKEN_SNPRINTF, 1,
1460 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001461 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001462 ],
1463 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001464 )
1465fi
1466
Damien Miller57f39152005-11-24 19:58:19 +11001467# If we don't have a working asprintf, then we strongly depend on vsnprintf
1468# returning the right thing on overflow: the number of characters it tried to
1469# create (as per SUSv3)
1470if test "x$ac_cv_func_asprintf" != "xyes" && \
1471 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1472 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1473 AC_RUN_IFELSE(
1474 [AC_LANG_SOURCE([[
1475#include <sys/types.h>
1476#include <stdio.h>
1477#include <stdarg.h>
1478
1479int x_snprintf(char *str,size_t count,const char *fmt,...)
1480{
1481 size_t ret; va_list ap;
1482 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1483 return ret;
1484}
1485int main(void)
1486{
1487 char x[1];
1488 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1489} ]])],
1490 [AC_MSG_RESULT(yes)],
1491 [
1492 AC_MSG_RESULT(no)
1493 AC_DEFINE(BROKEN_SNPRINTF, 1,
1494 [Define if your snprintf is busted])
1495 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1496 ],
1497 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1498 )
1499fi
1500
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001501# On systems where [v]snprintf is broken, but is declared in stdio,
1502# check that the fmt argument is const char * or just char *.
1503# This is only useful for when BROKEN_SNPRINTF
1504AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1505AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1506 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1507 int main(void) { snprintf(0, 0, 0); }
1508 ]])],
1509 [AC_MSG_RESULT(yes)
1510 AC_DEFINE(SNPRINTF_CONST, [const],
1511 [Define as const if snprintf() can declare const char *fmt])],
1512 [AC_MSG_RESULT(no)
1513 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1514
Damien Millerb4097182004-05-23 14:09:40 +10001515# Check for missing getpeereid (or equiv) support
1516NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001517if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001518 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1519 AC_TRY_COMPILE(
1520 [#include <sys/types.h>
1521 #include <sys/socket.h>],
1522 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001523 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001524 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001525 ],
Damien Millerb4097182004-05-23 14:09:40 +10001526 [AC_MSG_RESULT(no)
1527 NO_PEERCHECK=1]
1528 )
1529fi
1530
Damien Millere8328192003-01-07 15:18:32 +11001531dnl see whether mkstemp() requires XXXXXX
1532if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1533AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001534AC_RUN_IFELSE(
1535 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001536#include <stdlib.h>
1537main() { char template[]="conftest.mkstemp-test";
1538if (mkstemp(template) == -1)
1539 exit(1);
1540unlink(template); exit(0);
1541}
Darren Tucker314d89e2005-10-17 23:29:23 +10001542 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001543 [
1544 AC_MSG_RESULT(no)
1545 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001546 [
Damien Millere8328192003-01-07 15:18:32 +11001547 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001548 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001549 ],
1550 [
1551 AC_MSG_RESULT(yes)
1552 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001553 ]
Damien Millere8328192003-01-07 15:18:32 +11001554)
1555fi
1556
Darren Tucker70a3d552003-08-21 17:58:29 +10001557dnl make sure that openpty does not reacquire controlling terminal
1558if test ! -z "$check_for_openpty_ctty_bug"; then
1559 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001560 AC_RUN_IFELSE(
1561 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001562#include <stdio.h>
1563#include <sys/fcntl.h>
1564#include <sys/types.h>
1565#include <sys/wait.h>
1566
1567int
1568main()
1569{
1570 pid_t pid;
1571 int fd, ptyfd, ttyfd, status;
1572
1573 pid = fork();
1574 if (pid < 0) { /* failed */
1575 exit(1);
1576 } else if (pid > 0) { /* parent */
1577 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001578 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001579 exit(WEXITSTATUS(status));
1580 else
1581 exit(2);
1582 } else { /* child */
1583 close(0); close(1); close(2);
1584 setsid();
1585 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1586 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1587 if (fd >= 0)
1588 exit(3); /* Acquired ctty: broken */
1589 else
1590 exit(0); /* Did not acquire ctty: OK */
1591 }
1592}
Darren Tucker314d89e2005-10-17 23:29:23 +10001593 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001594 [
1595 AC_MSG_RESULT(yes)
1596 ],
1597 [
1598 AC_MSG_RESULT(no)
1599 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001600 ],
1601 [
1602 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001603 ]
1604 )
1605fi
1606
Tim Rice8bb561b2005-03-17 16:23:19 -08001607if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1608 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001609 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001610 AC_RUN_IFELSE(
1611 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001612#include <stdio.h>
1613#include <sys/socket.h>
1614#include <netdb.h>
1615#include <errno.h>
1616#include <netinet/in.h>
1617
1618#define TEST_PORT "2222"
1619
1620int
1621main(void)
1622{
1623 int err, sock;
1624 struct addrinfo *gai_ai, *ai, hints;
1625 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1626
1627 memset(&hints, 0, sizeof(hints));
1628 hints.ai_family = PF_UNSPEC;
1629 hints.ai_socktype = SOCK_STREAM;
1630 hints.ai_flags = AI_PASSIVE;
1631
1632 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1633 if (err != 0) {
1634 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1635 exit(1);
1636 }
1637
1638 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1639 if (ai->ai_family != AF_INET6)
1640 continue;
1641
1642 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1643 sizeof(ntop), strport, sizeof(strport),
1644 NI_NUMERICHOST|NI_NUMERICSERV);
1645
1646 if (err != 0) {
1647 if (err == EAI_SYSTEM)
1648 perror("getnameinfo EAI_SYSTEM");
1649 else
1650 fprintf(stderr, "getnameinfo failed: %s\n",
1651 gai_strerror(err));
1652 exit(2);
1653 }
1654
1655 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1656 if (sock < 0)
1657 perror("socket");
1658 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1659 if (errno == EBADF)
1660 exit(3);
1661 }
1662 }
1663 exit(0);
1664}
Darren Tucker314d89e2005-10-17 23:29:23 +10001665 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001666 [
1667 AC_MSG_RESULT(yes)
1668 ],
1669 [
1670 AC_MSG_RESULT(no)
1671 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001672 ],
1673 [
1674 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001675 ]
1676 )
1677fi
1678
Tim Rice8bb561b2005-03-17 16:23:19 -08001679if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1680 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001681 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001682 AC_RUN_IFELSE(
1683 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001684#include <stdio.h>
1685#include <sys/socket.h>
1686#include <netdb.h>
1687#include <errno.h>
1688#include <netinet/in.h>
1689
1690#define TEST_PORT "2222"
1691
1692int
1693main(void)
1694{
1695 int err, sock;
1696 struct addrinfo *gai_ai, *ai, hints;
1697 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1698
1699 memset(&hints, 0, sizeof(hints));
1700 hints.ai_family = PF_UNSPEC;
1701 hints.ai_socktype = SOCK_STREAM;
1702 hints.ai_flags = AI_PASSIVE;
1703
1704 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1705 if (err != 0) {
1706 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1707 exit(1);
1708 }
1709
1710 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1711 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1712 continue;
1713
1714 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1715 sizeof(ntop), strport, sizeof(strport),
1716 NI_NUMERICHOST|NI_NUMERICSERV);
1717
1718 if (ai->ai_family == AF_INET && err != 0) {
1719 perror("getnameinfo");
1720 exit(2);
1721 }
1722 }
1723 exit(0);
1724}
Darren Tucker314d89e2005-10-17 23:29:23 +10001725 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001726 [
1727 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001728 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1729 [Define if you have a getaddrinfo that fails
1730 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001731 ],
1732 [
1733 AC_MSG_RESULT(no)
1734 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001735 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10001736 [
Darren Tucker314d89e2005-10-17 23:29:23 +10001737 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001738 ]
1739 )
1740fi
1741
Darren Tuckera56f1912004-11-02 20:30:54 +11001742if test "x$check_for_conflicting_getspnam" = "x1"; then
1743 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1744 AC_COMPILE_IFELSE(
1745 [
1746#include <shadow.h>
1747int main(void) {exit(0);}
1748 ],
1749 [
1750 AC_MSG_RESULT(no)
1751 ],
1752 [
1753 AC_MSG_RESULT(yes)
1754 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1755 [Conflicting defs for getspnam])
1756 ]
1757 )
1758fi
1759
Damien Miller606f8802000-09-16 15:39:56 +11001760AC_FUNC_GETPGRP
1761
Tim Riceaef73712002-05-11 13:17:42 -07001762# Search for OpenSSL
1763saved_CPPFLAGS="$CPPFLAGS"
1764saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001765AC_ARG_WITH(ssl-dir,
1766 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1767 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001768 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001769 case "$withval" in
1770 # Relative paths
1771 ./*|../*) withval="`pwd`/$withval"
1772 esac
Tim Riceaef73712002-05-11 13:17:42 -07001773 if test -d "$withval/lib"; then
1774 if test -n "${need_dash_r}"; then
1775 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1776 else
1777 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1778 fi
1779 else
1780 if test -n "${need_dash_r}"; then
1781 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1782 else
1783 LDFLAGS="-L${withval} ${LDFLAGS}"
1784 fi
1785 fi
1786 if test -d "$withval/include"; then
1787 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1788 else
1789 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1790 fi
Damien Millera22ba012000-03-02 23:09:20 +11001791 fi
1792 ]
1793)
Tim Rice3d5352e2004-02-12 09:27:21 -08001794LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001795AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1796 [Define if your ssl headers are included
1797 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001798 [
Tim Riceaef73712002-05-11 13:17:42 -07001799 dnl Check default openssl install dir
1800 if test -n "${need_dash_r}"; then
1801 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001802 else
Tim Riceaef73712002-05-11 13:17:42 -07001803 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001804 fi
Tim Riceaef73712002-05-11 13:17:42 -07001805 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1806 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1807 [
1808 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1809 ]
1810 )
1811 ]
1812)
1813
Tim Riced730b782002-08-13 18:52:10 -07001814# Determine OpenSSL header version
1815AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001816AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001817 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001818#include <stdio.h>
1819#include <string.h>
1820#include <openssl/opensslv.h>
1821#define DATA "conftest.sslincver"
1822int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001823 FILE *fd;
1824 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001825
Damien Millera8e06ce2003-11-21 23:48:55 +11001826 fd = fopen(DATA,"w");
1827 if(fd == NULL)
1828 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001829
1830 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1831 exit(1);
1832
1833 exit(0);
1834}
Darren Tucker623d92f2004-09-12 22:36:15 +10001835 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001836 [
1837 ssl_header_ver=`cat conftest.sslincver`
1838 AC_MSG_RESULT($ssl_header_ver)
1839 ],
1840 [
1841 AC_MSG_RESULT(not found)
1842 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001843 ],
1844 [
1845 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001846 ]
1847)
1848
1849# Determine OpenSSL library version
1850AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001851AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001852 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001853#include <stdio.h>
1854#include <string.h>
1855#include <openssl/opensslv.h>
1856#include <openssl/crypto.h>
1857#define DATA "conftest.ssllibver"
1858int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001859 FILE *fd;
1860 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001861
Damien Millera8e06ce2003-11-21 23:48:55 +11001862 fd = fopen(DATA,"w");
1863 if(fd == NULL)
1864 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001865
1866 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1867 exit(1);
1868
1869 exit(0);
1870}
Darren Tucker623d92f2004-09-12 22:36:15 +10001871 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001872 [
1873 ssl_library_ver=`cat conftest.ssllibver`
1874 AC_MSG_RESULT($ssl_library_ver)
1875 ],
1876 [
1877 AC_MSG_RESULT(not found)
1878 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001879 ],
1880 [
1881 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001882 ]
1883)
Damien Millera22ba012000-03-02 23:09:20 +11001884
Damien Miller9975e482007-03-05 11:51:27 +11001885AC_ARG_WITH(openssl-header-check,
1886 [ --without-openssl-header-check Disable OpenSSL version consistency check],
1887 [ if test "x$withval" = "xno" ; then
1888 openssl_check_nonfatal=1
1889 fi
1890 ]
1891)
1892
Damien Millerec932372002-01-22 22:16:03 +11001893# Sanity check OpenSSL headers
1894AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001895AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001896 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001897#include <string.h>
1898#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001899int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001900 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001901 [
1902 AC_MSG_RESULT(yes)
1903 ],
1904 [
1905 AC_MSG_RESULT(no)
Damien Miller9975e482007-03-05 11:51:27 +11001906 if test "x$openssl_check_nonfatal" = "x"; then
1907 AC_MSG_ERROR([Your OpenSSL headers do not match your
1908library. Check config.log for details.
1909If you are sure your installation is consistent, you can disable the check
1910by running "./configure --without-openssl-header-check".
1911Also see contrib/findssl.sh for help identifying header/library mismatches.
1912])
1913 else
1914 AC_MSG_WARN([Your OpenSSL headers do not match your
1915library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10001916Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11001917 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001918 ],
1919 [
1920 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001921 ]
1922)
1923
Darren Tucker639bbe82006-08-20 20:17:53 +10001924AC_MSG_CHECKING([if programs using OpenSSL functions will link])
1925AC_LINK_IFELSE(
1926 [AC_LANG_SOURCE([[
1927#include <openssl/evp.h>
1928int main(void) { SSLeay_add_all_algorithms(); }
1929 ]])],
1930 [
1931 AC_MSG_RESULT(yes)
1932 ],
1933 [
1934 AC_MSG_RESULT(no)
1935 saved_LIBS="$LIBS"
1936 LIBS="$LIBS -ldl"
1937 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
1938 AC_LINK_IFELSE(
1939 [AC_LANG_SOURCE([[
1940#include <openssl/evp.h>
1941int main(void) { SSLeay_add_all_algorithms(); }
1942 ]])],
1943 [
1944 AC_MSG_RESULT(yes)
1945 ],
1946 [
1947 AC_MSG_RESULT(no)
1948 LIBS="$saved_LIBS"
1949 ]
1950 )
1951 ]
1952)
1953
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11001954AC_ARG_WITH(ssl-engine,
1955 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
1956 [ if test "x$withval" != "xno" ; then
1957 AC_MSG_CHECKING(for OpenSSL ENGINE support)
1958 AC_TRY_COMPILE(
1959 [ #include <openssl/engine.h>],
1960 [
Darren Tucker5e8381e2006-09-29 20:16:51 +10001961ENGINE_load_builtin_engines();ENGINE_register_all_complete();
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11001962 ],
1963 [ AC_MSG_RESULT(yes)
1964 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
1965 [Enable OpenSSL engine support])
1966 ],
1967 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
1968 )
1969 fi ]
1970)
1971
Darren Tucker129d0bb2005-12-19 17:40:40 +11001972# Check for OpenSSL without EVP_aes_{192,256}_cbc
1973AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10001974AC_LINK_IFELSE(
Darren Tucker129d0bb2005-12-19 17:40:40 +11001975 [AC_LANG_SOURCE([[
1976#include <string.h>
1977#include <openssl/evp.h>
Darren Tuckercc7c2122006-02-02 18:44:19 +11001978int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
Darren Tucker129d0bb2005-12-19 17:40:40 +11001979 ]])],
1980 [
1981 AC_MSG_RESULT(no)
1982 ],
1983 [
1984 AC_MSG_RESULT(yes)
1985 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
1986 [libcrypto is missing AES 192 and 256 bit functions])
1987 ]
1988)
1989
Tim Rice3d5352e2004-02-12 09:27:21 -08001990# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1991# because the system crypt() is more featureful.
1992if test "x$check_for_libcrypt_before" = "x1"; then
1993 AC_CHECK_LIB(crypt, crypt)
1994fi
1995
Damien Millera8e06ce2003-11-21 23:48:55 +11001996# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08001997# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10001998if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11001999 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11002000fi
2001
Damien Milleraf87af12006-03-15 13:02:28 +11002002# Search for SHA256 support in libc and/or OpenSSL
2003AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
2004
Tim Rice99203ec2007-03-26 09:35:28 -07002005saved_LIBS="$LIBS"
2006AC_CHECK_LIB(iaf, ia_openinfo, [
2007 LIBS="$LIBS -liaf"
Tim Rice0eeaf122007-09-10 16:24:17 -07002008 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
2009 AC_DEFINE(HAVE_LIBIAF, 1,
2010 [Define if system has libiaf that supports set_id])
2011 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002012])
2013LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002014
2015### Configure cryptographic random number support
2016
2017# Check wheter OpenSSL seeds itself
2018AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002019AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002020 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11002021#include <string.h>
2022#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07002023int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10002024 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002025 [
2026 OPENSSL_SEEDS_ITSELF=yes
2027 AC_MSG_RESULT(yes)
2028 ],
2029 [
2030 AC_MSG_RESULT(no)
2031 # Default to use of the rand helper if OpenSSL doesn't
2032 # seed itself
2033 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10002034 ],
2035 [
2036 AC_MSG_WARN([cross compiling: assuming yes])
2037 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08002038 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002039 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002040 ]
2041)
2042
Darren Tucker3e6bde42006-08-20 20:03:50 +10002043# Check for PAM libs
2044PAM_MSG="no"
2045AC_ARG_WITH(pam,
2046 [ --with-pam Enable PAM support ],
2047 [
2048 if test "x$withval" != "xno" ; then
2049 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2050 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2051 AC_MSG_ERROR([PAM headers not found])
2052 fi
2053
2054 saved_LIBS="$LIBS"
2055 AC_CHECK_LIB(dl, dlopen, , )
2056 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2057 AC_CHECK_FUNCS(pam_getenvlist)
2058 AC_CHECK_FUNCS(pam_putenv)
2059 LIBS="$saved_LIBS"
2060
2061 PAM_MSG="yes"
2062
Darren Tucker20e9f972007-03-25 18:26:01 +10002063 SSHDLIBS="$SSHDLIBS -lpam"
Darren Tucker3e6bde42006-08-20 20:03:50 +10002064 AC_DEFINE(USE_PAM, 1,
2065 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002066
Darren Tucker3e6bde42006-08-20 20:03:50 +10002067 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002068 case "$LIBS" in
2069 *-ldl*)
2070 # libdl already in LIBS
2071 ;;
2072 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002073 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002074 ;;
2075 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002076 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002077 fi
2078 ]
2079)
2080
2081# Check for older PAM
2082if test "x$PAM_MSG" = "xyes" ; then
2083 # Check PAM strerror arguments (old PAM)
2084 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2085 AC_TRY_COMPILE(
2086 [
2087#include <stdlib.h>
2088#if defined(HAVE_SECURITY_PAM_APPL_H)
2089#include <security/pam_appl.h>
2090#elif defined (HAVE_PAM_PAM_APPL_H)
2091#include <pam/pam_appl.h>
2092#endif
2093 ],
2094 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2095 [AC_MSG_RESULT(no)],
2096 [
2097 AC_DEFINE(HAVE_OLD_PAM, 1,
2098 [Define if you have an old version of PAM
2099 which takes only one argument to pam_strerror])
2100 AC_MSG_RESULT(yes)
2101 PAM_MSG="yes (old library)"
2102 ]
2103 )
2104fi
Damien Miller6c21c512002-01-22 21:57:53 +11002105
2106# Do we want to force the use of the rand helper?
2107AC_ARG_WITH(rand-helper,
2108 [ --with-rand-helper Use subprocess to gather strong randomness ],
2109 [
2110 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002111 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11002112 # the previous test showed it to be unseeded.
2113 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2114 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2115 OPENSSL_SEEDS_ITSELF=yes
2116 USE_RAND_HELPER=""
2117 fi
2118 else
2119 USE_RAND_HELPER=yes
2120 fi
2121 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08002122)
Damien Miller6c21c512002-01-22 21:57:53 +11002123
2124# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08002125if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002126 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07002127 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2128 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11002129 RAND_MSG="OpenSSL internal ONLY"
2130 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08002131elif test ! -z "$USE_RAND_HELPER" ; then
2132 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11002133 RAND_MSG="ssh-rand-helper"
2134 INSTALL_SSH_RAND_HELPER="yes"
2135fi
2136AC_SUBST(INSTALL_SSH_RAND_HELPER)
2137
2138### Configuration of ssh-rand-helper
2139
2140# PRNGD TCP socket
2141AC_ARG_WITH(prngd-port,
2142 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2143 [
Damien Millere996d722002-01-23 11:20:59 +11002144 case "$withval" in
2145 no)
2146 withval=""
2147 ;;
2148 [[0-9]]*)
2149 ;;
2150 *)
2151 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2152 ;;
2153 esac
2154 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002155 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002156 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2157 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002158 fi
2159 ]
2160)
2161
2162# PRNGD Unix domain socket
2163AC_ARG_WITH(prngd-socket,
2164 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2165 [
Damien Millere996d722002-01-23 11:20:59 +11002166 case "$withval" in
2167 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11002168 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11002169 ;;
2170 no)
2171 withval=""
2172 ;;
2173 /*)
2174 ;;
2175 *)
2176 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2177 ;;
2178 esac
2179
2180 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002181 if test ! -z "$PRNGD_PORT" ; then
2182 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2183 fi
Damien Miller6385ba02002-01-23 08:12:36 +11002184 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002185 AC_MSG_WARN(Entropy socket is not readable)
2186 fi
2187 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002188 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2189 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002190 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08002191 ],
2192 [
2193 # Check for existing socket only if we don't have a random device already
2194 if test "$USE_RAND_HELPER" = yes ; then
2195 AC_MSG_CHECKING(for PRNGD/EGD socket)
2196 # Insert other locations here
2197 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2198 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2199 PRNGD_SOCKET="$sock"
2200 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2201 break;
2202 fi
2203 done
2204 if test ! -z "$PRNGD_SOCKET" ; then
2205 AC_MSG_RESULT($PRNGD_SOCKET)
2206 else
2207 AC_MSG_RESULT(not found)
2208 fi
2209 fi
Damien Miller6c21c512002-01-22 21:57:53 +11002210 ]
2211)
2212
2213# Change default command timeout for hashing entropy source
2214entropy_timeout=200
2215AC_ARG_WITH(entropy-timeout,
2216 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2217 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002218 if test -n "$withval" && test "x$withval" != "xno" && \
2219 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002220 entropy_timeout=$withval
2221 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002222 ]
Damien Miller6c21c512002-01-22 21:57:53 +11002223)
Tim Rice7df8d392005-09-19 09:33:39 -07002224AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2225 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11002226
Damien Millerd3f6ad22002-06-25 10:24:47 +10002227SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00002228AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00002229 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002230 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002231 if test -n "$withval" && test "x$withval" != "xno" && \
2232 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002233 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002234 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002235 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002236)
Tim Rice7df8d392005-09-19 09:33:39 -07002237AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2238 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10002239AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00002240
Tim Rice88f2ab52002-03-17 12:17:34 -08002241# We do this little dance with the search path to insure
2242# that programs that we select for use by installed programs
2243# (which may be run by the super-user) come from trusted
2244# locations before they come from the user's private area.
2245# This should help avoid accidentally configuring some
2246# random version of a program in someone's personal bin.
2247
2248OPATH=$PATH
2249PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07002250test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08002251test -d /sbin && PATH=$PATH:/sbin
2252test -d /usr/sbin && PATH=$PATH:/usr/sbin
2253PATH=$PATH:/etc:$OPATH
2254
Damien Millera8e06ce2003-11-21 23:48:55 +11002255# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11002256OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2257OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2258OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2259OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2260OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2261OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2262OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2263OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2264OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2265OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2266OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2267OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2268OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2269OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2270OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2271OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002272# restore PATH
2273PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002274
2275# Where does ssh-rand-helper get its randomness from?
2276INSTALL_SSH_PRNG_CMDS=""
2277if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2278 if test ! -z "$PRNGD_PORT" ; then
2279 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2280 elif test ! -z "$PRNGD_SOCKET" ; then
2281 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2282 else
2283 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2284 RAND_HELPER_CMDHASH=yes
2285 INSTALL_SSH_PRNG_CMDS="yes"
2286 fi
2287fi
2288AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2289
2290
Ben Lindstromb5628642000-10-18 00:02:25 +00002291# Cheap hack to ensure NEWS-OS libraries are arranged right.
2292if test ! -z "$SONY" ; then
2293 LIBS="$LIBS -liberty";
2294fi
2295
Damien Miller57f39152005-11-24 19:58:19 +11002296# Check for long long datatypes
2297AC_CHECK_TYPES([long long, unsigned long long, long double])
2298
2299# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002300AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002301AC_CHECK_SIZEOF(short int, 2)
2302AC_CHECK_SIZEOF(int, 4)
2303AC_CHECK_SIZEOF(long int, 4)
2304AC_CHECK_SIZEOF(long long int, 8)
2305
Damien Millerfa2bb692002-04-23 23:22:25 +10002306# Sanity check long long for some platforms (AIX)
2307if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2308 ac_cv_sizeof_long_long_int=0
2309fi
2310
Darren Tucker537f1ed2005-10-25 18:38:33 +10002311# compute LLONG_MIN and LLONG_MAX if we don't know them.
2312if test -z "$have_llong_max"; then
2313 AC_MSG_CHECKING([for max value of long long])
2314 AC_RUN_IFELSE(
2315 [AC_LANG_SOURCE([[
2316#include <stdio.h>
2317/* Why is this so damn hard? */
2318#ifdef __GNUC__
2319# undef __GNUC__
2320#endif
2321#define __USE_ISOC99
2322#include <limits.h>
2323#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002324#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2325
2326/*
2327 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2328 * we do this the hard way.
2329 */
2330static int
2331fprint_ll(FILE *f, long long n)
2332{
2333 unsigned int i;
2334 int l[sizeof(long long) * 8];
2335
2336 if (n < 0)
2337 if (fprintf(f, "-") < 0)
2338 return -1;
2339 for (i = 0; n != 0; i++) {
2340 l[i] = my_abs(n % 10);
2341 n /= 10;
2342 }
2343 do {
2344 if (fprintf(f, "%d", l[--i]) < 0)
2345 return -1;
2346 } while (i != 0);
2347 if (fprintf(f, " ") < 0)
2348 return -1;
2349 return 0;
2350}
2351
Darren Tucker537f1ed2005-10-25 18:38:33 +10002352int main(void) {
2353 FILE *f;
2354 long long i, llmin, llmax = 0;
2355
2356 if((f = fopen(DATA,"w")) == NULL)
2357 exit(1);
2358
2359#if defined(LLONG_MIN) && defined(LLONG_MAX)
2360 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2361 llmin = LLONG_MIN;
2362 llmax = LLONG_MAX;
2363#else
2364 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2365 /* This will work on one's complement and two's complement */
2366 for (i = 1; i > llmax; i <<= 1, i++)
2367 llmax = i;
2368 llmin = llmax + 1LL; /* wrap */
2369#endif
2370
2371 /* Sanity check */
2372 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002373 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2374 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002375 fprintf(f, "unknown unknown\n");
2376 exit(2);
2377 }
2378
Darren Tuckerd1450db2006-03-13 19:06:51 +11002379 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002380 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002381 if (fprint_ll(f, llmax) < 0)
2382 exit(4);
2383 if (fclose(f) < 0)
2384 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002385 exit(0);
2386}
2387 ]])],
2388 [
2389 llong_min=`$AWK '{print $1}' conftest.llminmax`
2390 llong_max=`$AWK '{print $2}' conftest.llminmax`
2391
Darren Tucker537f1ed2005-10-25 18:38:33 +10002392 AC_MSG_RESULT($llong_max)
2393 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2394 [max value of long long calculated by configure])
2395 AC_MSG_CHECKING([for min value of long long])
2396 AC_MSG_RESULT($llong_min)
2397 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2398 [min value of long long calculated by configure])
2399 ],
2400 [
2401 AC_MSG_RESULT(not found)
2402 ],
2403 [
2404 AC_MSG_WARN([cross compiling: not checking])
2405 ]
2406 )
2407fi
2408
2409
Damien Millera22ba012000-03-02 23:09:20 +11002410# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002411AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2412 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002413 [ #include <sys/types.h> ],
2414 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002415 [ ac_cv_have_u_int="yes" ],
2416 [ ac_cv_have_u_int="no" ]
2417 )
2418])
2419if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002420 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002421 have_u_int=1
2422fi
2423
Damien Miller61e50f12000-05-08 20:49:37 +10002424AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2425 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002426 [ #include <sys/types.h> ],
2427 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002428 [ ac_cv_have_intxx_t="yes" ],
2429 [ ac_cv_have_intxx_t="no" ]
2430 )
2431])
2432if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002433 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002434 have_intxx_t=1
2435fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002436
2437if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002438 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002439then
2440 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2441 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002442 [ #include <stdint.h> ],
2443 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002444 [
2445 AC_DEFINE(HAVE_INTXX_T)
2446 AC_MSG_RESULT(yes)
2447 ],
2448 [ AC_MSG_RESULT(no) ]
2449 )
2450fi
2451
Damien Miller578783e2000-09-23 14:12:24 +11002452AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2453 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002454 [
2455#include <sys/types.h>
2456#ifdef HAVE_STDINT_H
2457# include <stdint.h>
2458#endif
2459#include <sys/socket.h>
2460#ifdef HAVE_SYS_BITYPES_H
2461# include <sys/bitypes.h>
2462#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002463 ],
2464 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002465 [ ac_cv_have_int64_t="yes" ],
2466 [ ac_cv_have_int64_t="no" ]
2467 )
2468])
2469if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002470 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002471fi
2472
Damien Miller61e50f12000-05-08 20:49:37 +10002473AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2474 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002475 [ #include <sys/types.h> ],
2476 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002477 [ ac_cv_have_u_intxx_t="yes" ],
2478 [ ac_cv_have_u_intxx_t="no" ]
2479 )
2480])
2481if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002482 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002483 have_u_intxx_t=1
2484fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002485
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002486if test -z "$have_u_intxx_t" ; then
2487 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2488 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002489 [ #include <sys/socket.h> ],
2490 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002491 [
2492 AC_DEFINE(HAVE_U_INTXX_T)
2493 AC_MSG_RESULT(yes)
2494 ],
2495 [ AC_MSG_RESULT(no) ]
2496 )
2497fi
2498
Damien Miller578783e2000-09-23 14:12:24 +11002499AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2500 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002501 [ #include <sys/types.h> ],
2502 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002503 [ ac_cv_have_u_int64_t="yes" ],
2504 [ ac_cv_have_u_int64_t="no" ]
2505 )
2506])
2507if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002508 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002509 have_u_int64_t=1
2510fi
2511
Tim Rice4cec93f2002-02-26 08:40:48 -08002512if test -z "$have_u_int64_t" ; then
2513 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2514 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002515 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002516 [ u_int64_t a; a = 1],
2517 [
2518 AC_DEFINE(HAVE_U_INT64_T)
2519 AC_MSG_RESULT(yes)
2520 ],
2521 [ AC_MSG_RESULT(no) ]
2522 )
2523fi
2524
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002525if test -z "$have_u_intxx_t" ; then
2526 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2527 AC_TRY_COMPILE(
2528 [
2529#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002530 ],
2531 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002532 [ ac_cv_have_uintxx_t="yes" ],
2533 [ ac_cv_have_uintxx_t="no" ]
2534 )
2535 ])
2536 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002537 AC_DEFINE(HAVE_UINTXX_T, 1,
2538 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002539 fi
2540fi
2541
2542if test -z "$have_uintxx_t" ; then
2543 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2544 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002545 [ #include <stdint.h> ],
2546 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002547 [
2548 AC_DEFINE(HAVE_UINTXX_T)
2549 AC_MSG_RESULT(yes)
2550 ],
2551 [ AC_MSG_RESULT(no) ]
2552 )
2553fi
2554
Damien Milleredb82922000-06-20 13:25:52 +10002555if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002556 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002557then
2558 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2559 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002560 [
2561#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002562 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002563 [
Damien Miller70494d12000-04-03 15:57:06 +10002564 int8_t a; int16_t b; int32_t c;
2565 u_int8_t e; u_int16_t f; u_int32_t g;
2566 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002567 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002568 [
2569 AC_DEFINE(HAVE_U_INTXX_T)
2570 AC_DEFINE(HAVE_INTXX_T)
2571 AC_MSG_RESULT(yes)
2572 ],
2573 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002574 )
Damien Millerb29ea912000-01-15 14:12:03 +11002575fi
2576
Damien Miller58be7382001-09-15 21:31:54 +10002577
2578AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2579 AC_TRY_COMPILE(
2580 [
2581#include <sys/types.h>
2582 ],
2583 [ u_char foo; foo = 125; ],
2584 [ ac_cv_have_u_char="yes" ],
2585 [ ac_cv_have_u_char="no" ]
2586 )
2587])
2588if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002589 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002590fi
2591
Tim Rice13aae5e2001-10-21 17:53:58 -07002592TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002593
Tim Rice200a5c02002-02-26 22:12:34 -08002594AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002595
Damien Miller848b9932005-02-24 12:12:34 +11002596AC_CHECK_TYPES(in_addr_t,,,
2597[#include <sys/types.h>
2598#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002599
Damien Miller61e50f12000-05-08 20:49:37 +10002600AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2601 AC_TRY_COMPILE(
2602 [
2603#include <sys/types.h>
2604 ],
2605 [ size_t foo; foo = 1235; ],
2606 [ ac_cv_have_size_t="yes" ],
2607 [ ac_cv_have_size_t="no" ]
2608 )
2609])
2610if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002611 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002612fi
Damien Miller95058511999-12-29 10:36:45 +11002613
Damien Miller615f9392000-05-17 22:53:33 +10002614AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2615 AC_TRY_COMPILE(
2616 [
2617#include <sys/types.h>
2618 ],
2619 [ ssize_t foo; foo = 1235; ],
2620 [ ac_cv_have_ssize_t="yes" ],
2621 [ ac_cv_have_ssize_t="no" ]
2622 )
2623])
2624if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002625 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002626fi
2627
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002628AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2629 AC_TRY_COMPILE(
2630 [
2631#include <time.h>
2632 ],
2633 [ clock_t foo; foo = 1235; ],
2634 [ ac_cv_have_clock_t="yes" ],
2635 [ ac_cv_have_clock_t="no" ]
2636 )
2637])
2638if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002639 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002640fi
2641
Damien Millerb54b40e2000-06-23 08:23:34 +10002642AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2643 AC_TRY_COMPILE(
2644 [
2645#include <sys/types.h>
2646#include <sys/socket.h>
2647 ],
2648 [ sa_family_t foo; foo = 1235; ],
2649 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002650 [ AC_TRY_COMPILE(
2651 [
2652#include <sys/types.h>
2653#include <sys/socket.h>
2654#include <netinet/in.h>
2655 ],
2656 [ sa_family_t foo; foo = 1235; ],
2657 [ ac_cv_have_sa_family_t="yes" ],
2658
Damien Millerb54b40e2000-06-23 08:23:34 +10002659 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002660 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002661 )
2662])
2663if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002664 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2665 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002666fi
2667
Damien Miller0f91b4e2000-06-18 15:43:25 +10002668AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2669 AC_TRY_COMPILE(
2670 [
2671#include <sys/types.h>
2672 ],
2673 [ pid_t foo; foo = 1235; ],
2674 [ ac_cv_have_pid_t="yes" ],
2675 [ ac_cv_have_pid_t="no" ]
2676 )
2677])
2678if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002679 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002680fi
2681
2682AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2683 AC_TRY_COMPILE(
2684 [
2685#include <sys/types.h>
2686 ],
2687 [ mode_t foo; foo = 1235; ],
2688 [ ac_cv_have_mode_t="yes" ],
2689 [ ac_cv_have_mode_t="no" ]
2690 )
2691])
2692if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002693 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002694fi
2695
Damien Miller61e50f12000-05-08 20:49:37 +10002696
2697AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2698 AC_TRY_COMPILE(
2699 [
Damien Miller81171112000-04-23 11:14:01 +10002700#include <sys/types.h>
2701#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002702 ],
2703 [ struct sockaddr_storage s; ],
2704 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2705 [ ac_cv_have_struct_sockaddr_storage="no" ]
2706 )
2707])
2708if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002709 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2710 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002711fi
Damien Miller34132e52000-01-14 15:45:46 +11002712
Damien Miller61e50f12000-05-08 20:49:37 +10002713AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2714 AC_TRY_COMPILE(
2715 [
Damien Miller7b22d652000-06-18 14:07:04 +10002716#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002717#include <netinet/in.h>
2718 ],
2719 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2720 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2721 [ ac_cv_have_struct_sockaddr_in6="no" ]
2722 )
2723])
2724if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002725 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2726 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002727fi
Damien Miller34132e52000-01-14 15:45:46 +11002728
Damien Miller61e50f12000-05-08 20:49:37 +10002729AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2730 AC_TRY_COMPILE(
2731 [
Damien Miller7b22d652000-06-18 14:07:04 +10002732#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002733#include <netinet/in.h>
2734 ],
2735 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2736 [ ac_cv_have_struct_in6_addr="yes" ],
2737 [ ac_cv_have_struct_in6_addr="no" ]
2738 )
2739])
2740if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002741 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2742 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002743fi
Damien Miller34132e52000-01-14 15:45:46 +11002744
Damien Miller61e50f12000-05-08 20:49:37 +10002745AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2746 AC_TRY_COMPILE(
2747 [
Damien Miller81171112000-04-23 11:14:01 +10002748#include <sys/types.h>
2749#include <sys/socket.h>
2750#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002751 ],
2752 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2753 [ ac_cv_have_struct_addrinfo="yes" ],
2754 [ ac_cv_have_struct_addrinfo="no" ]
2755 )
2756])
2757if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002758 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2759 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002760fi
2761
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002762AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2763 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002764 [ #include <sys/time.h> ],
2765 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002766 [ ac_cv_have_struct_timeval="yes" ],
2767 [ ac_cv_have_struct_timeval="no" ]
2768 )
2769])
2770if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002771 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002772 have_struct_timeval=1
2773fi
2774
Tim Rice4e4dc562003-03-18 10:21:40 -08002775AC_CHECK_TYPES(struct timespec)
2776
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002777# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002778if test "x$ac_cv_have_int64_t" = "xno" && \
2779 test "x$ac_cv_sizeof_long_int" != "x8" && \
2780 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002781 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2782 echo "an alternative compiler (I.E., GCC) before continuing."
2783 echo ""
2784 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002785else
2786dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002787 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002788 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002789#include <stdio.h>
2790#include <string.h>
2791#ifdef HAVE_SNPRINTF
2792main()
2793{
2794 char buf[50];
2795 char expected_out[50];
2796 int mazsize = 50 ;
2797#if (SIZEOF_LONG_INT == 8)
2798 long int num = 0x7fffffffffffffff;
2799#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002800 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002801#endif
2802 strcpy(expected_out, "9223372036854775807");
2803 snprintf(buf, mazsize, "%lld", num);
2804 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002805 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002806 exit(0);
2807}
2808#else
2809main() { exit(0); }
2810#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002811 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002812 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002813 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002814fi
2815
Damien Miller78315eb2000-09-29 23:01:36 +11002816dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002817OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2818OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2819OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2820OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2821OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002822OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002823OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2824OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002825OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002826OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2827OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2828OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2829OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002830OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2831OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2832OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2833OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002834
2835AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11002836AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2837 [Define if we don't have struct __res_state in resolv.h])],
2838[
2839#include <stdio.h>
2840#if HAVE_SYS_TYPES_H
2841# include <sys/types.h>
2842#endif
2843#include <netinet/in.h>
2844#include <arpa/nameser.h>
2845#include <resolv.h>
2846])
andre2ff7b5d2000-06-03 14:57:40 +00002847
Damien Miller61e50f12000-05-08 20:49:37 +10002848AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2849 ac_cv_have_ss_family_in_struct_ss, [
2850 AC_TRY_COMPILE(
2851 [
Damien Miller81171112000-04-23 11:14:01 +10002852#include <sys/types.h>
2853#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002854 ],
2855 [ struct sockaddr_storage s; s.ss_family = 1; ],
2856 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2857 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2858 )
2859])
2860if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002861 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002862fi
2863
Damien Miller61e50f12000-05-08 20:49:37 +10002864AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2865 ac_cv_have___ss_family_in_struct_ss, [
2866 AC_TRY_COMPILE(
2867 [
Damien Miller81171112000-04-23 11:14:01 +10002868#include <sys/types.h>
2869#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002870 ],
2871 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2872 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2873 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2874 )
2875])
2876if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002877 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2878 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002879fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002880
Damien Millerad833b32000-08-23 10:46:23 +10002881AC_CACHE_CHECK([for pw_class field in struct passwd],
2882 ac_cv_have_pw_class_in_struct_passwd, [
2883 AC_TRY_COMPILE(
2884 [
Damien Millerad833b32000-08-23 10:46:23 +10002885#include <pwd.h>
2886 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002887 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002888 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2889 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2890 )
2891])
2892if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002893 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2894 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002895fi
2896
Kevin Steves82456952001-06-22 21:14:18 +00002897AC_CACHE_CHECK([for pw_expire field in struct passwd],
2898 ac_cv_have_pw_expire_in_struct_passwd, [
2899 AC_TRY_COMPILE(
2900 [
2901#include <pwd.h>
2902 ],
2903 [ struct passwd p; p.pw_expire = 0; ],
2904 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2905 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2906 )
2907])
2908if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002909 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2910 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002911fi
2912
2913AC_CACHE_CHECK([for pw_change field in struct passwd],
2914 ac_cv_have_pw_change_in_struct_passwd, [
2915 AC_TRY_COMPILE(
2916 [
2917#include <pwd.h>
2918 ],
2919 [ struct passwd p; p.pw_change = 0; ],
2920 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2921 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2922 )
2923])
2924if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002925 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2926 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002927fi
Damien Miller61e50f12000-05-08 20:49:37 +10002928
Tim Rice28bbb0c2002-05-27 17:37:32 -07002929dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002930AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2931 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002932 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002933 [
Tim Riceae49fe62002-04-12 10:26:21 -07002934#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002935#include <sys/socket.h>
2936#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002937int main() {
2938#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002939#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002940exit(1);
2941#endif
2942struct msghdr m;
2943m.msg_accrights = 0;
2944exit(0);
2945}
Kevin Steves939c9db2002-03-22 17:23:25 +00002946 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002947 [ ac_cv_have_accrights_in_msghdr="yes" ],
2948 [ ac_cv_have_accrights_in_msghdr="no" ]
2949 )
2950])
2951if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002952 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2953 [Define if your system uses access rights style
2954 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002955fi
2956
Kevin Stevesa44e0352002-04-07 16:18:03 +00002957AC_CACHE_CHECK([for msg_control field in struct msghdr],
2958 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002959 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002960 [
Tim Riceae49fe62002-04-12 10:26:21 -07002961#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002962#include <sys/socket.h>
2963#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002964int main() {
2965#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002966#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002967exit(1);
2968#endif
2969struct msghdr m;
2970m.msg_control = 0;
2971exit(0);
2972}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002973 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002974 [ ac_cv_have_control_in_msghdr="yes" ],
2975 [ ac_cv_have_control_in_msghdr="no" ]
2976 )
2977])
2978if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002979 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2980 [Define if your system uses ancillary data style
2981 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002982fi
2983
Damien Miller61e50f12000-05-08 20:49:37 +10002984AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11002985 AC_TRY_LINK([],
2986 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10002987 [ ac_cv_libc_defines___progname="yes" ],
2988 [ ac_cv_libc_defines___progname="no" ]
2989 )
2990])
2991if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002992 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10002993fi
2994
Kevin Steves4846f4a2002-03-22 18:19:53 +00002995AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2996 AC_TRY_LINK([
2997#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002998],
2999 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00003000 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3001 [ ac_cv_cc_implements___FUNCTION__="no" ]
3002 )
3003])
3004if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003005 AC_DEFINE(HAVE___FUNCTION__, 1,
3006 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003007fi
3008
3009AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3010 AC_TRY_LINK([
3011#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11003012],
3013 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00003014 [ ac_cv_cc_implements___func__="yes" ],
3015 [ ac_cv_cc_implements___func__="no" ]
3016 )
3017])
3018if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003019 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003020fi
3021
Damien Miller57f39152005-11-24 19:58:19 +11003022AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3023 AC_TRY_LINK(
3024 [#include <stdarg.h>
3025 va_list x,y;],
3026 [va_copy(x,y);],
3027 [ ac_cv_have_va_copy="yes" ],
3028 [ ac_cv_have_va_copy="no" ]
3029 )
3030])
3031if test "x$ac_cv_have_va_copy" = "xyes" ; then
3032 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3033fi
3034
3035AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3036 AC_TRY_LINK(
3037 [#include <stdarg.h>
3038 va_list x,y;],
3039 [__va_copy(x,y);],
3040 [ ac_cv_have___va_copy="yes" ],
3041 [ ac_cv_have___va_copy="no" ]
3042 )
3043])
3044if test "x$ac_cv_have___va_copy" = "xyes" ; then
3045 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3046fi
3047
Damien Miller4f8e6692001-07-14 13:22:53 +10003048AC_CACHE_CHECK([whether getopt has optreset support],
3049 ac_cv_have_getopt_optreset, [
3050 AC_TRY_LINK(
3051 [
3052#include <getopt.h>
3053 ],
3054 [ extern int optreset; optreset = 0; ],
3055 [ ac_cv_have_getopt_optreset="yes" ],
3056 [ ac_cv_have_getopt_optreset="no" ]
3057 )
3058])
3059if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003060 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3061 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003062fi
Damien Millera22ba012000-03-02 23:09:20 +11003063
Damien Millerecbb26d2000-07-15 14:59:14 +10003064AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003065 AC_TRY_LINK([],
3066 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10003067 [ ac_cv_libc_defines_sys_errlist="yes" ],
3068 [ ac_cv_libc_defines_sys_errlist="no" ]
3069 )
3070])
3071if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003072 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3073 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003074fi
3075
3076
Damien Miller11fa2cc2000-08-16 10:35:58 +10003077AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003078 AC_TRY_LINK([],
3079 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10003080 [ ac_cv_libc_defines_sys_nerr="yes" ],
3081 [ ac_cv_libc_defines_sys_nerr="no" ]
3082 )
3083])
3084if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003085 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003086fi
3087
Damien Millera8e06ce2003-11-21 23:48:55 +11003088SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003089# Check whether user wants sectok support
3090AC_ARG_WITH(sectok,
3091 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10003092 [
3093 if test "x$withval" != "xno" ; then
3094 if test "x$withval" != "xyes" ; then
3095 CPPFLAGS="$CPPFLAGS -I${withval}"
3096 LDFLAGS="$LDFLAGS -L${withval}"
3097 if test ! -z "$need_dash_r" ; then
3098 LDFLAGS="$LDFLAGS -R${withval}"
3099 fi
3100 if test ! -z "$blibpath" ; then
3101 blibpath="$blibpath:${withval}"
3102 fi
3103 fi
3104 AC_CHECK_HEADERS(sectok.h)
3105 if test "$ac_cv_header_sectok_h" != yes; then
3106 AC_MSG_ERROR(Can't find sectok.h)
3107 fi
3108 AC_CHECK_LIB(sectok, sectok_open)
3109 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3110 AC_MSG_ERROR(Can't find libsectok)
3111 fi
Tim Rice7df8d392005-09-19 09:33:39 -07003112 AC_DEFINE(SMARTCARD, 1,
3113 [Define if you want smartcard support])
3114 AC_DEFINE(USE_SECTOK, 1,
3115 [Define if you want smartcard support
3116 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11003117 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003118 fi
3119 ]
3120)
3121
3122# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08003123OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003124AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10003125 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08003126 [
3127 if test "x$withval" != "xno" ; then
3128 if test "x$withval" != "xyes" ; then
3129 OPENSC_CONFIG=$withval/bin/opensc-config
3130 else
3131 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3132 fi
3133 if test "$OPENSC_CONFIG" != "no"; then
3134 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3135 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3136 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
Darren Tucker0ee3cbf2006-09-23 16:25:19 +10003137 LIBS="$LIBS $LIBOPENSC_LIBS"
Tim Rice12ee8e22005-03-17 13:37:04 -08003138 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07003139 AC_DEFINE(USE_OPENSC, 1,
3140 [Define if you want smartcard support
3141 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08003142 SCARD_MSG="yes, using OpenSC"
3143 fi
3144 fi
3145 ]
3146)
Damien Miller85de5802001-09-18 14:01:11 +10003147
Darren Tucker5f88d342003-10-15 16:57:57 +10003148# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11003149AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07003150 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3151 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003152 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003153 # Needed by our getrrsetbyname()
3154 AC_SEARCH_LIBS(res_query, resolv)
3155 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10003156 AC_MSG_CHECKING(if res_query will link)
3157 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
3158 [AC_MSG_RESULT(no)
3159 saved_LIBS="$LIBS"
3160 LIBS="$LIBS -lresolv"
3161 AC_MSG_CHECKING(for res_query in -lresolv)
3162 AC_LINK_IFELSE([
3163#include <resolv.h>
3164int main()
3165{
3166 res_query (0, 0, 0, 0, 0);
3167 return 0;
3168}
3169 ],
3170 [LIBS="$LIBS -lresolv"
3171 AC_MSG_RESULT(yes)],
3172 [LIBS="$saved_LIBS"
3173 AC_MSG_RESULT(no)])
3174 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10003175 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003176 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003177 [#include <sys/types.h>
3178 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10003179 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07003180 [AC_DEFINE(HAVE_HEADER_AD, 1,
3181 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10003182 [#include <arpa/nameser.h>])
3183 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003184
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003185AC_MSG_CHECKING(if struct __res_state _res is an extern)
3186AC_LINK_IFELSE([
3187#include <stdio.h>
3188#if HAVE_SYS_TYPES_H
3189# include <sys/types.h>
3190#endif
3191#include <netinet/in.h>
3192#include <arpa/nameser.h>
3193#include <resolv.h>
3194extern struct __res_state _res;
3195int main() { return 0; }
3196 ],
3197 [AC_MSG_RESULT(yes)
3198 AC_DEFINE(HAVE__RES_EXTERN, 1,
3199 [Define if you have struct __res_state _res as an extern])
3200 ],
3201 [ AC_MSG_RESULT(no) ]
3202)
3203
Damien Miller73b42d22006-04-22 21:26:08 +10003204# Check whether user wants SELinux support
3205SELINUX_MSG="no"
3206LIBSELINUX=""
3207AC_ARG_WITH(selinux,
3208 [ --with-selinux Enable SELinux support],
3209 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003210 save_LIBS="$LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003211 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3212 SELINUX_MSG="yes"
3213 AC_CHECK_HEADER([selinux/selinux.h], ,
3214 AC_MSG_ERROR(SELinux support requires selinux.h header))
3215 AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
3216 AC_MSG_ERROR(SELinux support requires libselinux library))
Darren Tucker20e9f972007-03-25 18:26:01 +10003217 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Damien Miller73b42d22006-04-22 21:26:08 +10003218 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
Darren Tuckeradc947d2006-10-07 09:07:20 +10003219 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003220 fi ]
3221)
Damien Miller73b42d22006-04-22 21:26:08 +10003222
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003223# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003224KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003225AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11003226 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003227 [ if test "x$withval" != "xno" ; then
3228 if test "x$withval" = "xyes" ; then
3229 KRB5ROOT="/usr/local"
3230 else
3231 KRB5ROOT=${withval}
3232 fi
3233
Tim Rice7df8d392005-09-19 09:33:39 -07003234 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003235 KRB5_MSG="yes"
3236
3237 AC_MSG_CHECKING(for krb5-config)
3238 if test -x $KRB5ROOT/bin/krb5-config ; then
3239 KRB5CONF=$KRB5ROOT/bin/krb5-config
3240 AC_MSG_RESULT($KRB5CONF)
3241
3242 AC_MSG_CHECKING(for gssapi support)
3243 if $KRB5CONF | grep gssapi >/dev/null ; then
3244 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003245 AC_DEFINE(GSSAPI, 1,
3246 [Define this if you want GSSAPI
3247 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003248 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003249 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11003250 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11003251 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003252 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003253 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3254 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003255 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003256 AC_MSG_CHECKING(whether we are using Heimdal)
3257 AC_TRY_COMPILE([ #include <krb5.h> ],
3258 [ char *tmp = heimdal_version; ],
3259 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003260 AC_DEFINE(HEIMDAL, 1,
3261 [Define this if you are using the
3262 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003263 AC_MSG_RESULT(no)
3264 )
3265 else
3266 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003267 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003268 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11003269 AC_MSG_CHECKING(whether we are using Heimdal)
3270 AC_TRY_COMPILE([ #include <krb5.h> ],
3271 [ char *tmp = heimdal_version; ],
3272 [ AC_MSG_RESULT(yes)
3273 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10003274 K5LIBS="-lkrb5 -ldes"
3275 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08003276 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10003277 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11003278 ],
3279 [ AC_MSG_RESULT(no)
3280 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3281 ]
3282 )
Damien Miller200d0a72003-06-30 19:21:36 +10003283 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003284
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003285 AC_CHECK_LIB(gssapi,gss_init_sec_context,
3286 [ AC_DEFINE(GSSAPI)
3287 K5LIBS="-lgssapi $K5LIBS" ],
3288 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3289 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11003290 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003291 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3292 $K5LIBS)
3293 ],
3294 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003295
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003296 AC_CHECK_HEADER(gssapi.h, ,
3297 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003298 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003299 AC_CHECK_HEADERS(gssapi.h, ,
3300 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003301 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003302 ]
3303 )
3304
3305 oldCPP="$CPPFLAGS"
3306 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3307 AC_CHECK_HEADER(gssapi_krb5.h, ,
3308 [ CPPFLAGS="$oldCPP" ])
3309
Damien Millera8e06ce2003-11-21 23:48:55 +11003310 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003311 if test ! -z "$need_dash_r" ; then
3312 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3313 fi
3314 if test ! -z "$blibpath" ; then
3315 blibpath="$blibpath:${KRB5ROOT}/lib"
3316 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003317
3318 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3319 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3320 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3321
3322 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07003323 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3324 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11003325 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003326 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003327)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003328
Damien Millera22ba012000-03-02 23:09:20 +11003329# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003330
Damien Millerf58c6722002-05-13 13:15:42 +10003331PRIVSEP_PATH=/var/empty
3332AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07003333 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003334 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003335 if test -n "$withval" && test "x$withval" != "xno" && \
3336 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003337 PRIVSEP_PATH=$withval
3338 fi
3339 ]
3340)
3341AC_SUBST(PRIVSEP_PATH)
3342
Damien Millera22ba012000-03-02 23:09:20 +11003343AC_ARG_WITH(xauth,
3344 [ --with-xauth=PATH Specify path to xauth program ],
3345 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003346 if test -n "$withval" && test "x$withval" != "xno" && \
3347 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003348 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003349 fi
3350 ],
3351 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003352 TestPath="$PATH"
3353 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3354 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3355 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3356 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3357 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003358 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003359 xauth_path="/usr/openwin/bin/xauth"
3360 fi
3361 ]
3362)
3363
Damien Miller7d901272003-01-13 16:55:22 +11003364STRIP_OPT=-s
3365AC_ARG_ENABLE(strip,
3366 [ --disable-strip Disable calling strip(1) on install],
3367 [
3368 if test "x$enableval" = "xno" ; then
3369 STRIP_OPT=
3370 fi
3371 ]
3372)
3373AC_SUBST(STRIP_OPT)
3374
Damien Millera19cf472000-11-29 13:28:50 +11003375if test -z "$xauth_path" ; then
3376 XAUTH_PATH="undefined"
3377 AC_SUBST(XAUTH_PATH)
3378else
Tim Rice7df8d392005-09-19 09:33:39 -07003379 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3380 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003381 XAUTH_PATH=$xauth_path
3382 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003383fi
Damien Millera22ba012000-03-02 23:09:20 +11003384
3385# Check for mail directory (last resort if we cannot get it from headers)
3386if test ! -z "$MAIL" ; then
3387 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003388 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3389 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003390fi
3391
Darren Tucker623d92f2004-09-12 22:36:15 +10003392if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003393 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3394 disable_ptmx_check=yes
3395fi
Damien Millera22ba012000-03-02 23:09:20 +11003396if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003397 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003398 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003399 [
Tim Rice7df8d392005-09-19 09:33:39 -07003400 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3401 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003402 have_dev_ptmx=1
3403 ]
3404 )
3405 fi
Damien Millera22ba012000-03-02 23:09:20 +11003406fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003407
Darren Tucker623d92f2004-09-12 22:36:15 +10003408if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003409 AC_CHECK_FILE("/dev/ptc",
3410 [
Tim Rice7df8d392005-09-19 09:33:39 -07003411 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3412 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003413 have_dev_ptc=1
3414 ]
3415 )
3416else
3417 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3418fi
Damien Miller204ad072000-03-02 23:56:12 +11003419
Damien Millera22ba012000-03-02 23:09:20 +11003420# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003421AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003422 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003423 [
Damien Miller897741e2001-04-16 10:41:46 +10003424 case "$withval" in
3425 man|cat|doc)
3426 MANTYPE=$withval
3427 ;;
3428 *)
3429 AC_MSG_ERROR(invalid man type: $withval)
3430 ;;
3431 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003432 ]
3433)
Ben Lindstrombc709922001-04-18 18:04:21 +00003434if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003435 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3436 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003437 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3438 MANTYPE=doc
3439 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3440 MANTYPE=man
3441 else
3442 MANTYPE=cat
3443 fi
3444fi
Damien Miller670a4b82000-01-22 13:53:11 +11003445AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003446if test "$MANTYPE" = "doc"; then
3447 mansubdir=man;
3448else
3449 mansubdir=$MANTYPE;
3450fi
3451AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003452
Damien Millera22ba012000-03-02 23:09:20 +11003453# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003454MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003455AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003456 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003457 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003458 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003459 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3460 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003461 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003462 fi
3463 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003464)
3465
Damien Millera22ba012000-03-02 23:09:20 +11003466# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003467AC_ARG_WITH(shadow,
3468 [ --without-shadow Disable shadow password support],
3469 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003470 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003471 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003472 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003473 fi
3474 ]
3475)
3476
Damien Miller1f335fb2000-06-26 11:31:33 +10003477if test -z "$disable_shadow" ; then
3478 AC_MSG_CHECKING([if the systems has expire shadow information])
3479 AC_TRY_COMPILE(
3480 [
3481#include <sys/types.h>
3482#include <shadow.h>
3483 struct spwd sp;
3484 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3485 [ sp_expire_available=yes ], []
3486 )
3487
3488 if test "x$sp_expire_available" = "xyes" ; then
3489 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003490 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3491 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003492 else
3493 AC_MSG_RESULT(no)
3494 fi
3495fi
3496
Damien Millera22ba012000-03-02 23:09:20 +11003497# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003498if test ! -z "$IPADDR_IN_DISPLAY" ; then
3499 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003500 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3501 [Define if you need to use IP address
3502 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003503else
Damien Millera8e06ce2003-11-21 23:48:55 +11003504 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003505 AC_ARG_WITH(ipaddr-display,
3506 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3507 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003508 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003509 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003510 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003511 fi
3512 ]
3513 )
3514fi
Damien Miller76112de1999-12-21 11:18:08 +11003515
Darren Tuckere1a790d2003-09-16 11:52:19 +10003516# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003517AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003518 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003519 [ if test "x$enableval" = "xno"; then
3520 AC_MSG_NOTICE([/etc/default/login handling disabled])
3521 etc_default_login=no
3522 else
3523 etc_default_login=yes
3524 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003525 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3526 then
3527 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3528 etc_default_login=no
3529 else
3530 etc_default_login=yes
3531 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003532)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003533
Darren Tucker2f9573d2005-02-10 22:28:54 +11003534if test "x$etc_default_login" != "xno"; then
3535 AC_CHECK_FILE("/etc/default/login",
3536 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003537 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003538 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3539 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003540 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003541fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003542
Tim Rice43a1c132002-04-17 21:19:14 -07003543dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003544if test $ac_cv_func_login_getcapbool = "yes" && \
3545 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003546 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003547fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003548
Damien Millera22ba012000-03-02 23:09:20 +11003549# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003550SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003551AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003552 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003553 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003554 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003555 AC_MSG_WARN([
3556--with-default-path=PATH has no effect on this system.
3557Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003558 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003559 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003560 AC_MSG_WARN([
3561--with-default-path=PATH will only be used if PATH is not defined in
3562$external_path_file .])
3563 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003564 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003565 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003566 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003567 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003568 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3569 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003570 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003571 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003572 AC_MSG_WARN([
3573If PATH is defined in $external_path_file, ensure the path to scp is included,
3574otherwise scp will not work.])
3575 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003576 AC_RUN_IFELSE(
3577 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003578/* find out what STDPATH is */
3579#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003580#ifdef HAVE_PATHS_H
3581# include <paths.h>
3582#endif
3583#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003584# ifdef _PATH_USERPATH /* Irix */
3585# define _PATH_STDPATH _PATH_USERPATH
3586# else
3587# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3588# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003589#endif
3590#include <sys/types.h>
3591#include <sys/stat.h>
3592#include <fcntl.h>
3593#define DATA "conftest.stdpath"
3594
3595main()
3596{
3597 FILE *fd;
3598 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003599
Tim Rice59ea0a02001-03-10 13:50:45 -08003600 fd = fopen(DATA,"w");
3601 if(fd == NULL)
3602 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003603
Tim Rice59ea0a02001-03-10 13:50:45 -08003604 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3605 exit(1);
3606
3607 exit(0);
3608}
Darren Tucker314d89e2005-10-17 23:29:23 +10003609 ]])],
3610 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003611 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3612 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3613 )
3614# make sure $bindir is in USER_PATH so scp will work
3615 t_bindir=`eval echo ${bindir}`
3616 case $t_bindir in
3617 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3618 esac
3619 case $t_bindir in
3620 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3621 esac
3622 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3623 if test $? -ne 0 ; then
3624 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3625 if test $? -ne 0 ; then
3626 user_path=$user_path:$t_bindir
3627 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3628 fi
3629 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003630 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003631)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003632if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003633 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003634 AC_SUBST(user_path)
3635fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003636
Damien Millera18bbd32002-05-13 10:48:57 +10003637# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003638AC_ARG_WITH(superuser-path,
3639 [ --with-superuser-path= Specify different path for super-user],
3640 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003641 if test -n "$withval" && test "x$withval" != "xno" && \
3642 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003643 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3644 [Define if you want a different $PATH
3645 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003646 superuser_path=$withval
3647 fi
3648 ]
3649)
3650
3651
Damien Miller61e50f12000-05-08 20:49:37 +10003652AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003653IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003654AC_ARG_WITH(4in6,
3655 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3656 [
3657 if test "x$withval" != "xno" ; then
3658 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003659 AC_DEFINE(IPV4_IN_IPV6, 1,
3660 [Detect IPv4 in IPv6 mapped addresses
3661 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003662 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003663 else
3664 AC_MSG_RESULT(no)
3665 fi
3666 ],[
3667 if test "x$inet6_default_4in6" = "xyes"; then
3668 AC_MSG_RESULT([yes (default)])
3669 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003670 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003671 else
3672 AC_MSG_RESULT([no (default)])
3673 fi
3674 ]
3675)
3676
Damien Miller60396b02001-02-18 17:01:00 +11003677# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003678BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003679AC_ARG_WITH(bsd-auth,
3680 [ --with-bsd-auth Enable BSD auth support],
3681 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003682 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003683 AC_DEFINE(BSD_AUTH, 1,
3684 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003685 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003686 fi
3687 ]
3688)
3689
Damien Millera22ba012000-03-02 23:09:20 +11003690# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003691piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003692# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003693if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003694 piddir=`eval echo ${sysconfdir}`
3695 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003696 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003697 esac
3698fi
3699
Tim Rice88f2ab52002-03-17 12:17:34 -08003700AC_ARG_WITH(pid-dir,
3701 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3702 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003703 if test -n "$withval" && test "x$withval" != "xno" && \
3704 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003705 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003706 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003707 AC_MSG_WARN([** no $piddir directory on this system **])
3708 fi
3709 fi
3710 ]
3711)
3712
Tim Rice7df8d392005-09-19 09:33:39 -07003713AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003714AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003715
andre2ff7b5d2000-06-03 14:57:40 +00003716dnl allow user to disable some login recording features
3717AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003718 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003719 [
3720 if test "x$enableval" = "xno" ; then
3721 AC_DEFINE(DISABLE_LASTLOG)
3722 fi
3723 ]
andre2ff7b5d2000-06-03 14:57:40 +00003724)
3725AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003726 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003727 [
3728 if test "x$enableval" = "xno" ; then
3729 AC_DEFINE(DISABLE_UTMP)
3730 fi
3731 ]
andre2ff7b5d2000-06-03 14:57:40 +00003732)
3733AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003734 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003735 [
3736 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003737 AC_DEFINE(DISABLE_UTMPX, 1,
3738 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003739 fi
3740 ]
andre2ff7b5d2000-06-03 14:57:40 +00003741)
3742AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003743 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003744 [
3745 if test "x$enableval" = "xno" ; then
3746 AC_DEFINE(DISABLE_WTMP)
3747 fi
3748 ]
andre2ff7b5d2000-06-03 14:57:40 +00003749)
3750AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003751 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003752 [
3753 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003754 AC_DEFINE(DISABLE_WTMPX, 1,
3755 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003756 fi
3757 ]
andre2ff7b5d2000-06-03 14:57:40 +00003758)
3759AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003760 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003761 [
3762 if test "x$enableval" = "xno" ; then
3763 AC_DEFINE(DISABLE_LOGIN)
3764 fi
3765 ]
andre2ff7b5d2000-06-03 14:57:40 +00003766)
3767AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003768 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003769 [
3770 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003771 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3772 [Define if you don't want to use pututline()
3773 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003774 fi
3775 ]
andre2ff7b5d2000-06-03 14:57:40 +00003776)
3777AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003778 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003779 [
3780 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003781 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3782 [Define if you don't want to use pututxline()
3783 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003784 fi
3785 ]
andre2ff7b5d2000-06-03 14:57:40 +00003786)
3787AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003788 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003789 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003790 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003791 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003792 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003793 conf_lastlog_location=$withval
3794 fi
3795 ]
3796)
andre2ff7b5d2000-06-03 14:57:40 +00003797
3798dnl lastlog, [uw]tmpx? detection
3799dnl NOTE: set the paths in the platform section to avoid the
3800dnl need for command-line parameters
3801dnl lastlog and [uw]tmp are subject to a file search if all else fails
3802
3803dnl lastlog detection
3804dnl NOTE: the code itself will detect if lastlog is a directory
3805AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3806AC_TRY_COMPILE([
3807#include <sys/types.h>
3808#include <utmp.h>
3809#ifdef HAVE_LASTLOG_H
3810# include <lastlog.h>
3811#endif
Damien Miller2994e082000-06-04 15:51:47 +10003812#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003813# include <paths.h>
3814#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003815#ifdef HAVE_LOGIN_H
3816# include <login.h>
3817#endif
andre2ff7b5d2000-06-03 14:57:40 +00003818 ],
3819 [ char *lastlog = LASTLOG_FILE; ],
3820 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003821 [
3822 AC_MSG_RESULT(no)
3823 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3824 AC_TRY_COMPILE([
3825#include <sys/types.h>
3826#include <utmp.h>
3827#ifdef HAVE_LASTLOG_H
3828# include <lastlog.h>
3829#endif
3830#ifdef HAVE_PATHS_H
3831# include <paths.h>
3832#endif
3833 ],
3834 [ char *lastlog = _PATH_LASTLOG; ],
3835 [ AC_MSG_RESULT(yes) ],
3836 [
andree441aa32000-06-12 22:34:38 +00003837 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003838 system_lastlog_path=no
3839 ])
3840 ]
andre2ff7b5d2000-06-03 14:57:40 +00003841)
Damien Miller2994e082000-06-04 15:51:47 +10003842
andre2ff7b5d2000-06-03 14:57:40 +00003843if test -z "$conf_lastlog_location"; then
3844 if test x"$system_lastlog_path" = x"no" ; then
3845 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003846 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003847 conf_lastlog_location=$f
3848 fi
3849 done
3850 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003851 AC_MSG_WARN([** Cannot find lastlog **])
3852 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003853 fi
3854 fi
3855fi
3856
3857if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003858 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3859 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003860fi
andre2ff7b5d2000-06-03 14:57:40 +00003861
3862dnl utmp detection
3863AC_MSG_CHECKING([if your system defines UTMP_FILE])
3864AC_TRY_COMPILE([
3865#include <sys/types.h>
3866#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003867#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003868# include <paths.h>
3869#endif
3870 ],
3871 [ char *utmp = UTMP_FILE; ],
3872 [ AC_MSG_RESULT(yes) ],
3873 [ AC_MSG_RESULT(no)
3874 system_utmp_path=no ]
3875)
3876if test -z "$conf_utmp_location"; then
3877 if test x"$system_utmp_path" = x"no" ; then
3878 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3879 if test -f $f ; then
3880 conf_utmp_location=$f
3881 fi
3882 done
3883 if test -z "$conf_utmp_location"; then
3884 AC_DEFINE(DISABLE_UTMP)
3885 fi
3886 fi
3887fi
3888if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003889 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3890 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003891fi
andre2ff7b5d2000-06-03 14:57:40 +00003892
3893dnl wtmp detection
3894AC_MSG_CHECKING([if your system defines WTMP_FILE])
3895AC_TRY_COMPILE([
3896#include <sys/types.h>
3897#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003898#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003899# include <paths.h>
3900#endif
3901 ],
3902 [ char *wtmp = WTMP_FILE; ],
3903 [ AC_MSG_RESULT(yes) ],
3904 [ AC_MSG_RESULT(no)
3905 system_wtmp_path=no ]
3906)
3907if test -z "$conf_wtmp_location"; then
3908 if test x"$system_wtmp_path" = x"no" ; then
3909 for f in /usr/adm/wtmp /var/log/wtmp; do
3910 if test -f $f ; then
3911 conf_wtmp_location=$f
3912 fi
3913 done
3914 if test -z "$conf_wtmp_location"; then
3915 AC_DEFINE(DISABLE_WTMP)
3916 fi
3917 fi
3918fi
3919if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003920 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3921 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003922fi
andre2ff7b5d2000-06-03 14:57:40 +00003923
3924
3925dnl utmpx detection - I don't know any system so perverse as to require
3926dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3927dnl there, though.
3928AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3929AC_TRY_COMPILE([
3930#include <sys/types.h>
3931#include <utmp.h>
3932#ifdef HAVE_UTMPX_H
3933#include <utmpx.h>
3934#endif
Damien Miller2994e082000-06-04 15:51:47 +10003935#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003936# include <paths.h>
3937#endif
3938 ],
3939 [ char *utmpx = UTMPX_FILE; ],
3940 [ AC_MSG_RESULT(yes) ],
3941 [ AC_MSG_RESULT(no)
3942 system_utmpx_path=no ]
3943)
3944if test -z "$conf_utmpx_location"; then
3945 if test x"$system_utmpx_path" = x"no" ; then
3946 AC_DEFINE(DISABLE_UTMPX)
3947 fi
3948else
Tim Rice7df8d392005-09-19 09:33:39 -07003949 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3950 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003951fi
andre2ff7b5d2000-06-03 14:57:40 +00003952
3953dnl wtmpx detection
3954AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3955AC_TRY_COMPILE([
3956#include <sys/types.h>
3957#include <utmp.h>
3958#ifdef HAVE_UTMPX_H
3959#include <utmpx.h>
3960#endif
Damien Miller2994e082000-06-04 15:51:47 +10003961#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003962# include <paths.h>
3963#endif
3964 ],
3965 [ char *wtmpx = WTMPX_FILE; ],
3966 [ AC_MSG_RESULT(yes) ],
3967 [ AC_MSG_RESULT(no)
3968 system_wtmpx_path=no ]
3969)
3970if test -z "$conf_wtmpx_location"; then
3971 if test x"$system_wtmpx_path" = x"no" ; then
3972 AC_DEFINE(DISABLE_WTMPX)
3973 fi
3974else
Tim Rice7df8d392005-09-19 09:33:39 -07003975 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3976 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003977fi
andre2ff7b5d2000-06-03 14:57:40 +00003978
Damien Miller4018c192000-04-30 09:30:44 +10003979
Damien Miller29ea30d2000-03-17 10:54:15 +11003980if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003981 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3982 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003983fi
3984
Darren Tucker7da23cb2005-08-03 00:20:15 +10003985dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3986dnl Add now.
3987CFLAGS="$CFLAGS $werror_flags"
3988
Damien Millerbac2d8a2000-09-05 16:13:06 +11003989AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10003990AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
3991 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
3992 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07003993AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10003994
Damien Miller7b22d652000-06-18 14:07:04 +10003995# Print summary of options
3996
Damien Miller7b22d652000-06-18 14:07:04 +10003997# Someone please show me a better way :)
3998A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3999B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4000C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4001D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004002E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004003F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004004G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004005H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4006I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4007J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004008
4009echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004010echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004011echo " User binaries: $B"
4012echo " System binaries: $C"
4013echo " Configuration files: $D"
4014echo " Askpass program: $E"
4015echo " Manual pages: $F"
4016echo " PID file: $G"
4017echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004018if test "x$external_path_file" = "x/etc/login.conf" ; then
4019echo " At runtime, sshd will use the path defined in $external_path_file"
4020echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004021else
Damien Millerf58c6722002-05-13 13:15:42 +10004022echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004023 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004024echo " (If PATH is set in $external_path_file it will be used instead. If"
4025echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4026 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004027fi
Damien Millera18bbd32002-05-13 10:48:57 +10004028if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004029echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004030fi
Damien Millerf58c6722002-05-13 13:15:42 +10004031echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004032echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004033echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004034echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004035echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004036echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004037echo " S/KEY support: $SKEY_MSG"
4038echo " TCP Wrappers support: $TCPW_MSG"
4039echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004040echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004041echo " Solaris process contract support: $SPC_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004042echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004043echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4044echo " BSD Auth support: $BSD_AUTH_MSG"
4045echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11004046if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004047echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11004048fi
4049
Damien Miller7b22d652000-06-18 14:07:04 +10004050echo ""
4051
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004052echo " Host: ${host}"
4053echo " Compiler: ${CC}"
4054echo " Compiler flags: ${CFLAGS}"
4055echo "Preprocessor flags: ${CPPFLAGS}"
4056echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004057echo " Libraries: ${LIBS}"
4058if test ! -z "${SSHDLIBS}"; then
4059echo " +for sshd: ${SSHDLIBS}"
4060fi
Damien Miller7b22d652000-06-18 14:07:04 +10004061
4062echo ""
4063
Tim Rice6f1f7582004-05-30 21:38:51 -07004064if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004065 echo "SVR4 style packages are supported with \"make package\""
4066 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004067fi
4068
Damien Miller82cf0ce2000-12-20 13:34:48 +11004069if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004070 echo "PAM is enabled. You may need to install a PAM control file "
4071 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004072 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004073 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004074 echo ""
4075fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004076
Damien Miller6c21c512002-01-22 21:57:53 +11004077if test ! -z "$RAND_HELPER_CMDHASH" ; then
4078 echo "WARNING: you are using the builtin random number collection "
4079 echo "service. Please read WARNING.RNG and request that your OS "
4080 echo "vendor includes kernel-based random number collection in "
4081 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004082 echo ""
4083fi
Damien Miller60396b02001-02-18 17:01:00 +11004084
Damien Millerb4097182004-05-23 14:09:40 +10004085if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004086 echo "WARNING: the operating system that you are using does not"
4087 echo "appear to support getpeereid(), getpeerucred() or the"
4088 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4089 echo "enforce security checks to prevent unauthorised connections to"
4090 echo "ssh-agent. Their absence increases the risk that a malicious"
4091 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004092 echo ""
4093fi
4094
Darren Tuckerd9f88912005-02-20 21:01:48 +11004095if test "$AUDIT_MODULE" = "bsm" ; then
4096 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4097 echo "See the Solaris section in README.platform for details."
4098fi