blob: f9e2d8b342c65d6a4429275823a7716f6219d423 [file] [log] [blame]
Darren Tuckeracada072008-02-25 21:05:04 +11001# $Id: configure.ac,v 1.390 2008/02/25 10:05:04 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 Tuckeracada072008-02-25 21:05:04 +110018AC_REVISION($Revision: 1.390 $)
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 Tuckerd4827ab2008-01-02 18:08:45 +1100108 AC_MSG_CHECKING(if $CC understands -fstack-protector-all)
Darren Tucker319b3d92007-12-02 21:02:22 +1100109 saved_CFLAGS="$CFLAGS"
110 CFLAGS="$CFLAGS -fstack-protector-all"
111 AC_TRY_COMPILE([], [ int main(void){return 0;} ],
112 [ AC_MSG_RESULT(yes) ],
113 [ AC_MSG_RESULT(no)
114 CFLAGS="$saved_CFLAGS" ]
115 )
116
Darren Tucker67b37032005-06-03 17:58:31 +1000117 if test -z "$have_llong_max"; then
118 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
119 unset ac_cv_have_decl_LLONG_MAX
120 saved_CFLAGS="$CFLAGS"
121 CFLAGS="$CFLAGS -std=gnu99"
122 AC_CHECK_DECL(LLONG_MAX,
123 [have_llong_max=1],
124 [CFLAGS="$saved_CFLAGS"],
125 [#include <limits.h>]
126 )
127 fi
Damien Miller166bd442000-03-16 10:48:25 +1100128fi
129
Darren Tucker391de5c2007-04-29 14:49:21 +1000130if test "x$no_attrib_nonnull" != "x1" ; then
131 AC_DEFINE(HAVE_ATTRIBUTE__NONNULL__, 1, [Have attribute nonnull])
132fi
133
Tim Rice88368a32003-12-08 12:35:59 -0800134AC_ARG_WITH(rpath,
135 [ --without-rpath Disable auto-added -R linker paths],
136 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800137 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800138 need_dash_r=""
139 fi
140 if test "x$withval" = "xyes" ; then
141 need_dash_r=1
142 fi
143 ]
144)
145
Tim Rice1cfab232006-10-03 09:34:35 -0700146# Allow user to specify flags
147AC_ARG_WITH(cflags,
148 [ --with-cflags Specify additional flags to pass to compiler],
149 [
150 if test -n "$withval" && test "x$withval" != "xno" && \
151 test "x${withval}" != "xyes"; then
152 CFLAGS="$CFLAGS $withval"
153 fi
154 ]
155)
156AC_ARG_WITH(cppflags,
157 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
158 [
159 if test -n "$withval" && test "x$withval" != "xno" && \
160 test "x${withval}" != "xyes"; then
161 CPPFLAGS="$CPPFLAGS $withval"
162 fi
163 ]
164)
165AC_ARG_WITH(ldflags,
166 [ --with-ldflags Specify additional flags to pass to linker],
167 [
168 if test -n "$withval" && test "x$withval" != "xno" && \
169 test "x${withval}" != "xyes"; then
170 LDFLAGS="$LDFLAGS $withval"
171 fi
172 ]
173)
174AC_ARG_WITH(libs,
175 [ --with-libs Specify additional libraries to link with],
176 [
177 if test -n "$withval" && test "x$withval" != "xno" && \
178 test "x${withval}" != "xyes"; then
179 LIBS="$LIBS $withval"
180 fi
181 ]
182)
183AC_ARG_WITH(Werror,
184 [ --with-Werror Build main code with -Werror],
185 [
186 if test -n "$withval" && test "x$withval" != "xno"; then
187 werror_flags="-Werror"
188 if test "x${withval}" != "xyes"; then
189 werror_flags="$withval"
190 fi
191 fi
192 ]
193)
194
195AC_CHECK_HEADERS( \
196 bstring.h \
197 crypt.h \
198 crypto/sha2.h \
199 dirent.h \
200 endian.h \
201 features.h \
202 fcntl.h \
203 floatingpoint.h \
204 getopt.h \
205 glob.h \
206 ia.h \
207 iaf.h \
208 limits.h \
209 login.h \
210 maillock.h \
211 ndir.h \
212 net/if_tun.h \
213 netdb.h \
214 netgroup.h \
215 pam/pam_appl.h \
216 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000217 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700218 pty.h \
219 readpassphrase.h \
220 rpc/types.h \
221 security/pam_appl.h \
222 sha2.h \
223 shadow.h \
224 stddef.h \
225 stdint.h \
226 string.h \
227 strings.h \
228 sys/audit.h \
229 sys/bitypes.h \
230 sys/bsdtty.h \
231 sys/cdefs.h \
232 sys/dir.h \
233 sys/mman.h \
234 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000235 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700236 sys/prctl.h \
237 sys/pstat.h \
238 sys/select.h \
239 sys/stat.h \
240 sys/stream.h \
241 sys/stropts.h \
242 sys/strtio.h \
243 sys/sysmacros.h \
244 sys/time.h \
245 sys/timers.h \
246 sys/un.h \
247 time.h \
248 tmpdir.h \
249 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700250 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700251 unistd.h \
252 usersec.h \
253 util.h \
254 utime.h \
255 utmp.h \
256 utmpx.h \
257 vis.h \
258)
259
260# lastlog.h requires sys/time.h to be included first on Solaris
261AC_CHECK_HEADERS(lastlog.h, [], [], [
262#ifdef HAVE_SYS_TIME_H
263# include <sys/time.h>
264#endif
265])
266
267# sys/ptms.h requires sys/stream.h to be included first on Solaris
268AC_CHECK_HEADERS(sys/ptms.h, [], [], [
269#ifdef HAVE_SYS_STREAM_H
270# include <sys/stream.h>
271#endif
272])
273
274# login_cap.h requires sys/types.h on NetBSD
275AC_CHECK_HEADERS(login_cap.h, [], [], [
276#include <sys/types.h>
277])
278
Damien Miller1b06dc32006-08-31 03:24:41 +1000279# Messages for features tested for in target-specific section
280SIA_MSG="no"
281SPC_MSG="no"
282
Damien Millera22ba012000-03-02 23:09:20 +1100283# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100284case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100285*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000286 # Some versions of VAC won't allow macro redefinitions at
287 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
288 # particularly with older versions of vac or xlc.
289 # It also throws errors about null macro argments, but these are
290 # not fatal.
291 AC_MSG_CHECKING(if compiler allows macro redefinitions)
292 AC_COMPILE_IFELSE(
293 [AC_LANG_SOURCE([[
294#define testmacro foo
295#define testmacro bar
296int main(void) { exit(0); }
297 ]])],
298 [ AC_MSG_RESULT(yes) ],
299 [ AC_MSG_RESULT(no)
300 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
301 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
302 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
303 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
304 ]
305 )
306
Damien Millera8e06ce2003-11-21 23:48:55 +1100307 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000308 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800309 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100310 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000311 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000312 if test "$GCC" = "yes"; then
313 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
314 else
315 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
316 fi
317 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000318 if (test -z "$blibflags"); then
319 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
320 AC_TRY_LINK([], [], [blibflags=$tryflags])
321 fi
322 done
323 if (test -z "$blibflags"); then
324 AC_MSG_RESULT(not found)
325 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
326 else
327 AC_MSG_RESULT($blibflags)
328 fi
329 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000330 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700331 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
332 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700333 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000334 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700335 LIBS="$LIBS -ls"
336 ])
337 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100338 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100339 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100340 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000341 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100342 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000343 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
344 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000345 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000346 [(void)loginfailed("user","host","tty",0);],
347 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700348 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
349 [Define if your AIX loginfailed() function
350 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000351 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000352 )],
353 [],
354 [#include <usersec.h>]
355 )
Darren Tuckerfc3454e2003-07-14 16:41:55 +1000356 AC_CHECK_FUNCS(setauthdb)
Darren Tucker3083bc22006-08-17 19:35:49 +1000357 AC_CHECK_DECL(F_CLOSEM,
Darren Tuckerd018b2e2006-08-18 18:51:20 +1000358 AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000359 [],
360 [ #include <limits.h>
361 #include <fcntl.h> ]
362 )
Darren Tucker691d5232005-02-15 21:45:57 +1100363 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700364 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
365 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
366 [Define if your platform breaks doing a seteuid before a setuid])
367 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
368 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000369 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700370 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
371 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
372 [Some systems need a utmpx entry for /bin/login to work])
373 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
374 [Define to a Set Process Title type if your system is
375 supported by bsd-setproctitle.c])
Darren Tucker91d25a02005-11-26 22:24:09 +1100376 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
377 [AIX 5.2 and 5.3 (and presumably newer) require this])
Darren Tucker9afe1152006-06-23 21:24:12 +1000378 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
Damien Miller75b1d102000-01-07 14:01:41 +1100379 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100380*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100381 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100382 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700383 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
384 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
385 AC_DEFINE(DISABLE_SHADOW, 1,
386 [Define if you want to disable shadow passwords])
387 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
388 [Define if your system choked on IP TOS setting])
389 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
390 [Define if X11 doesn't support AF_UNIX sockets on that system])
391 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
392 [Define if the concept of ports only accessible to
393 superusers isn't known])
394 AC_DEFINE(DISABLE_FD_PASSING, 1,
395 [Define if your platform needs to skip post auth
396 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100397 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000398*-*-dgux*)
399 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100400 AC_DEFINE(SETEUID_BREAKS_SETUID)
401 AC_DEFINE(BROKEN_SETREUID)
402 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000403 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000404*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000405 AC_MSG_CHECKING(if we have working getaddrinfo)
406 AC_TRY_RUN([#include <mach-o/dyld.h>
407main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
408 exit(0);
409 else
410 exit(1);
411}], [AC_MSG_RESULT(working)],
412 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700413 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700414 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000415 AC_DEFINE(SETEUID_BREAKS_SETUID)
416 AC_DEFINE(BROKEN_SETREUID)
417 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker528d6fa2007-12-31 21:29:26 +1100418 AC_DEFINE(BROKEN_GLOB, 1, [OS X glob does not do what we expect])
Tim Rice7df8d392005-09-19 09:33:39 -0700419 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
420 [Define if your resolver libs need this for getrrsetbyname])
Darren Tucker3eb48342006-06-23 21:05:12 +1000421 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
422 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
423 [Use tunnel device compatibility to OpenBSD])
424 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
425 [Prepend the address family to IP tunnel traffic])
Darren Tuckeracada072008-02-25 21:05:04 +1100426 m4_pattern_allow(AU_IPv)
427 AC_CHECK_DECL(AU_IPv4, [],
428 AC_DEFINE(AU_IPv4, 0, [System only supports IPv4 audit records])
429 [#include <bsm/audit.h>]
430 )
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000431 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000432*-*-dragonfly*)
433 SSHDLIBS="$SSHDLIBS -lcrypt"
434 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000435*-*-hpux*)
436 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000437 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100438 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000439 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700440 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
441 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000442 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700443 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
444 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000445 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000446 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700447 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000448 AC_CHECK_LIB(xnet, t_error, ,
449 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
450
451 # next, we define all of the options specific to major releases
452 case "$host" in
453 *-*-hpux10*)
454 if test -z "$GCC"; then
455 CFLAGS="$CFLAGS -Ae"
456 fi
457 ;;
458 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700459 AC_DEFINE(PAM_SUN_CODEBASE, 1,
460 [Define if you are using Solaris-derived PAM which
461 passes pam_messages to the conversation function
462 with an extra level of indirection])
463 AC_DEFINE(DISABLE_UTMP, 1,
464 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000465 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
466 check_for_hpux_broken_getaddrinfo=1
467 check_for_conflicting_getspnam=1
468 ;;
469 esac
470
471 # lastly, we define options specific to minor releases
472 case "$host" in
473 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700474 AC_DEFINE(HAVE_SECUREWARE, 1,
475 [Define if you have SecureWare-based
476 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000477 disable_ptmx_check=yes
478 LIBS="$LIBS -lsecpw"
479 ;;
480 esac
Damien Miller1bead332000-04-30 00:47:29 +1000481 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100482*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100483 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700484 AC_DEFINE(BROKEN_INET_NTOA, 1,
485 [Define if you system's inet_ntoa is busted
486 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000487 AC_DEFINE(SETEUID_BREAKS_SETUID)
488 AC_DEFINE(BROKEN_SETREUID)
489 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700490 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
491 [Define if you shouldn't strip 'tty' from your
492 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000493 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100494 ;;
495*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100496 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700497 AC_DEFINE(WITH_IRIX_ARRAY, 1,
498 [Define if you have/want arrays
499 (cluster-wide session managment, not C arrays)])
500 AC_DEFINE(WITH_IRIX_PROJECT, 1,
501 [Define if you want IRIX project management])
502 AC_DEFINE(WITH_IRIX_AUDIT, 1,
503 [Define if you want IRIX audit trails])
504 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
505 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000506 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000507 AC_DEFINE(SETEUID_BREAKS_SETUID)
508 AC_DEFINE(BROKEN_SETREUID)
509 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700510 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000511 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000512 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100513 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100514*-*-linux*)
515 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100516 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000517 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700518 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
519 AC_DEFINE(PAM_TTY_KLUDGE, 1,
520 [Work around problematic Linux PAM modules handling of PAM_TTY])
521 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
522 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000523 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700524 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
525 [Define to whatever link() returns for "not supported"
526 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100527 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700528 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100529 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000530 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000531 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700532 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
533 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000534 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000535 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100536 # tun(4) forwarding compat code
Damien Millerc4bcc912005-12-31 17:05:58 +1100537 AC_CHECK_HEADERS(linux/if_tun.h)
Damien Millerbd4e4102006-01-01 21:03:30 +1100538 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Damien Miller89e03ba2005-12-31 16:42:03 +1100539 AC_DEFINE(SSH_TUN_LINUX, 1,
540 [Open tunnel devices the Linux tun/tap way])
541 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
542 [Use tunnel device compatibility to OpenBSD])
543 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
544 [Prepend the address family to IP tunnel traffic])
545 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100546 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000547mips-sony-bsd|mips-sony-newsos4)
Darren Tucker988b3fd2006-02-08 22:11:27 +1100548 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000549 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000550 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100551*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000552 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800553 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800554 need_dash_r=1
555 fi
Damien Miller2dcddbf2006-01-01 19:47:05 +1100556 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
557 AC_CHECK_HEADER([net/if_tap.h], ,
558 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
559 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
560 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100561 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100562*-*-freebsd*)
563 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000564 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100565 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
566 AC_CHECK_HEADER([net/if_tap.h], ,
567 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
Damien Millerfbd884a2001-02-27 08:39:07 +1100568 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000569*-*-bsdi*)
570 AC_DEFINE(SETEUID_BREAKS_SETUID)
571 AC_DEFINE(BROKEN_SETREUID)
572 AC_DEFINE(BROKEN_SETREGID)
573 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000574*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000575 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100576 conf_utmp_location=/etc/utmp
577 conf_wtmp_location=/usr/adm/wtmp
578 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700579 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000580 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000581 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700582 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000583 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000584*-*-openbsd*)
585 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000586 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100587 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
Damien Millerbb598142006-08-19 08:38:23 +1000588 AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1,
589 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000590 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100591*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800592 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800593 need_dash_r=1
594 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100595 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000596 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700597 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
598 [Some versions of /bin/login need the TERM supplied
599 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000600 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700601 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
602 [Define if pam_chauthtok wants real uid set
603 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000604 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000605 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700606 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
607 [Define if sshd somehow reacquires a controlling TTY
608 after setsid()])
Darren Tucker0249f932006-06-24 12:10:07 +1000609 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
610 in case the name is longer than 8 chars])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000611 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000612 # hardwire lastlog location (can't detect it on some versions)
613 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000614 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
615 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
616 if test "$sol2ver" -ge 8; then
617 AC_MSG_RESULT(yes)
618 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700619 AC_DEFINE(DISABLE_WTMP, 1,
620 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000621 else
622 AC_MSG_RESULT(no)
623 fi
Damien Miller1b06dc32006-08-31 03:24:41 +1000624 AC_ARG_WITH(solaris-contracts,
625 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
626 [
627 AC_CHECK_LIB(contract, ct_tmpl_activate,
628 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
629 [Define if you have Solaris process contracts])
630 SSHDLIBS="$SSHDLIBS -lcontract"
631 AC_SUBST(SSHDLIBS)
632 SPC_MSG="yes" ], )
633 ],
634 )
Damien Miller75b1d102000-01-07 14:01:41 +1100635 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000636*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000637 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000638 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100639 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000640 conf_utmp_location=/etc/utmp
641 conf_wtmp_location=/var/adm/wtmp
642 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000643 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000644 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000645*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700646 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000647 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000648 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000649 AC_DEFINE(SETEUID_BREAKS_SETUID)
650 AC_DEFINE(BROKEN_SETREUID)
651 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000652 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000653*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700654 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000655 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100656 # -lresolv needs to be at the end of LIBS or DNS lookups break
657 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100658 IPADDR_IN_DISPLAY=yes
659 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000660 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000661 AC_DEFINE(SETEUID_BREAKS_SETUID)
662 AC_DEFINE(BROKEN_SETREUID)
663 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000664 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000665 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700666 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
667 # Attention: always take care to bind libsocket and libnsl before libc,
668 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000669 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800670# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100671*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100672 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700673 AC_DEFINE(SETEUID_BREAKS_SETUID)
674 AC_DEFINE(BROKEN_SETREUID)
675 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700676 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice46259d82005-11-28 18:40:34 -0800677 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller78315eb2000-09-29 23:01:36 +1100678 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800679# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100680*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700681 check_for_libcrypt_later=1
682 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100683 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700684 AC_DEFINE(SETEUID_BREAKS_SETUID)
685 AC_DEFINE(BROKEN_SETREUID)
686 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700687 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700688 case "$host" in
689 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
690 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700691 AC_DEFINE(BROKEN_LIBIAF, 1,
692 [ia_uinfo routines not supported by OS yet])
Tim Riceb8f00192006-09-06 18:11:29 -0700693 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice4dbacff2005-06-01 20:09:28 -0700694 ;;
Tim Rice46259d82005-11-28 18:40:34 -0800695 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
696 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700697 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100698 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100699*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100700 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800701# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100702*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800703 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100704 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800705# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100706*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800707 if test -z "$GCC"; then
708 CFLAGS="$CFLAGS -belf"
709 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100710 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000711 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100712 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000713 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000714 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700715 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700716 AC_DEFINE(SETEUID_BREAKS_SETUID)
717 AC_DEFINE(BROKEN_SETREUID)
718 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700719 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700720 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700721 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100722 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700723 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700724 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000725 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000726*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700727 AC_DEFINE(NO_SSH_LASTLOG, 1,
728 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100729 AC_DEFINE(SETEUID_BREAKS_SETUID)
730 AC_DEFINE(BROKEN_SETREUID)
731 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000732 AC_DEFINE(USE_PIPES)
733 AC_DEFINE(DISABLE_FD_PASSING)
734 LDFLAGS="$LDFLAGS"
735 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
736 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000737 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000738*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100739 AC_DEFINE(SETEUID_BREAKS_SETUID)
740 AC_DEFINE(BROKEN_SETREUID)
741 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000742 AC_DEFINE(WITH_ABBREV_NO_TTY)
743 AC_DEFINE(USE_PIPES)
744 AC_DEFINE(DISABLE_FD_PASSING)
745 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100746 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000747 MANTYPE=cat
748 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000749*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100750 AC_DEFINE(SETEUID_BREAKS_SETUID)
751 AC_DEFINE(BROKEN_SETREUID)
752 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000753 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700754 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700755 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000756 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
757 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
758 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700759 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000760*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000761 AC_MSG_CHECKING(for Digital Unix SIA)
762 no_osfsia=""
763 AC_ARG_WITH(osfsia,
764 [ --with-osfsia Enable Digital Unix SIA],
765 [
766 if test "x$withval" = "xno" ; then
767 AC_MSG_RESULT(disabled)
768 no_osfsia=1
769 fi
770 ],
771 )
772 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000773 if test -f /etc/sia/matrix.conf; then
774 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700775 AC_DEFINE(HAVE_OSF_SIA, 1,
776 [Define if you have Digital Unix Security
777 Integration Architecture])
778 AC_DEFINE(DISABLE_LOGIN, 1,
779 [Define if you don't want to use your
780 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000781 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000782 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000783 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000784 else
785 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700786 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
787 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000788 fi
789 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000790 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700791 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000792 AC_DEFINE(BROKEN_SETREUID)
793 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000794 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000795
Tim Rice70335a62006-02-04 17:42:58 -0800796*-*-nto-qnx*)
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000797 AC_DEFINE(USE_PIPES)
798 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700799 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
800 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
801 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Tim Rice70335a62006-02-04 17:42:58 -0800802 AC_DEFINE(DISABLE_LASTLOG)
Darren Tucker54b75fe2006-02-26 12:31:48 +1100803 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckerbc1bd9d2007-09-27 07:03:20 +1000804 AC_DEFINE(BROKEN_SHADOW_EXPIRE, 1, [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -0800805 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +1000806 case "$host" in
807 *-*-nto-qnx6*)
808 AC_DEFINE(DISABLE_FD_PASSING)
809 ;;
810 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000811 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000812
813*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700814 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
815 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
Darren Tucker988b3fd2006-02-08 22:11:27 +1100816 AC_DEFINE(NEED_SETPGRP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700817 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
818 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000819
820*-*-lynxos)
821 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700822 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000823 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
824 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100825esac
826
Darren Tucker6eb93042003-06-29 21:30:41 +1000827AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000828AC_RUN_IFELSE(
829 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000830#include <stdio.h>
831int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000832 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000833 [ AC_MSG_RESULT(yes) ],
834 [
835 AC_MSG_RESULT(no)
836 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000837 ],
838 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000839)
840
Darren Tucker0c9653f2005-05-28 15:58:14 +1000841dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +1100842# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700843AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
844AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000845
Tim Rice1e1ef642003-09-11 22:19:31 -0700846dnl IRIX and Solaris 2.5.1 have dirname() in libgen
847AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
848 AC_CHECK_LIB(gen, dirname,[
849 AC_CACHE_CHECK([for broken dirname],
850 ac_cv_have_broken_dirname, [
851 save_LIBS="$LIBS"
852 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000853 AC_RUN_IFELSE(
854 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700855#include <libgen.h>
856#include <string.h>
857
858int main(int argc, char **argv) {
859 char *s, buf[32];
860
861 strncpy(buf,"/etc", 32);
862 s = dirname(buf);
863 if (!s || strncmp(s, "/", 32) != 0) {
864 exit(1);
865 } else {
866 exit(0);
867 }
868}
Darren Tucker314d89e2005-10-17 23:29:23 +1000869 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700870 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000871 [ ac_cv_have_broken_dirname="yes" ],
872 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700873 )
874 LIBS="$save_LIBS"
875 ])
876 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
877 LIBS="$LIBS -lgen"
878 AC_DEFINE(HAVE_DIRNAME)
879 AC_CHECK_HEADERS(libgen.h)
880 fi
881 ])
882])
883
884AC_CHECK_FUNC(getspnam, ,
885 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700886AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
887 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700888
Tim Rice13aae5e2001-10-21 17:53:58 -0700889dnl zlib is required
890AC_ARG_WITH(zlib,
891 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100892 [ if test "x$withval" = "xno" ; then
893 AC_MSG_ERROR([*** zlib is required ***])
894 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700895 if test -d "$withval/lib"; then
896 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700897 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700898 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700899 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700900 fi
901 else
902 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700903 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700904 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700905 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700906 fi
907 fi
908 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700909 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700910 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700911 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700912 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100913 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700914)
915
Tim Ricefcb62202004-01-23 18:35:16 -0800916AC_CHECK_LIB(z, deflate, ,
917 [
918 saved_CPPFLAGS="$CPPFLAGS"
919 saved_LDFLAGS="$LDFLAGS"
920 save_LIBS="$LIBS"
921 dnl Check default zlib install dir
922 if test -n "${need_dash_r}"; then
923 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
924 else
925 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
926 fi
927 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
928 LIBS="$LIBS -lz"
929 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
930 [
931 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
932 ]
933 )
934 ]
935)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100936AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100937
938AC_ARG_WITH(zlib-version-check,
939 [ --without-zlib-version-check Disable zlib version check],
940 [ if test "x$withval" = "xno" ; then
941 zlib_check_nonfatal=1
942 fi
943 ]
944)
945
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000946AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000947AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000948#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100949#include <zlib.h>
950int main()
951{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000952 int a=0, b=0, c=0, d=0, n, v;
953 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
954 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100955 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000956 v = a*1000000 + b*10000 + c*100 + d;
957 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
958
959 /* 1.1.4 is OK */
960 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100961 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000962
Darren Tucker41097ed2005-07-25 15:24:21 +1000963 /* 1.2.3 and up are OK */
964 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000965 exit(0);
966
Darren Tucker2dcd2392004-01-23 17:13:33 +1100967 exit(2);
968}
Darren Tucker623d92f2004-09-12 22:36:15 +1000969 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000970 AC_MSG_RESULT(no),
971 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100972 if test -z "$zlib_check_nonfatal" ; then
973 AC_MSG_ERROR([*** zlib too old - check config.log ***
974Your reported zlib version has known security problems. It's possible your
975vendor has fixed these problems without changing the version number. If you
976are sure this is the case, you can disable the check by running
977"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000978If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000979See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100980 else
981 AC_MSG_WARN([zlib version may have security problems])
982 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000983 ],
984 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100985)
Damien Miller6f9c3372000-10-25 10:06:04 +1100986
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000987dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100988AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000989 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
990)
Darren Tucker5bfe1682005-11-12 18:42:36 +1100991AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700992 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
993 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000994)
Damien Millerab18c411999-11-11 10:40:23 +1100995
Tim Ricee589a292001-11-03 11:09:32 -0800996dnl Checks for libutil functions
997AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -0700998AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
999 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -08001000AC_CHECK_FUNCS(logout updwtmp logwtmp)
1001
Ben Lindstrom8697e082001-02-24 21:41:10 +00001002AC_FUNC_STRFTIME
1003
Damien Miller3c027682001-03-14 11:39:45 +11001004# Check for ALTDIRFUNC glob() extension
1005AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
1006AC_EGREP_CPP(FOUNDIT,
1007 [
1008 #include <glob.h>
1009 #ifdef GLOB_ALTDIRFUNC
1010 FOUNDIT
1011 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001012 ],
Damien Miller3c027682001-03-14 11:39:45 +11001013 [
Tim Rice7df8d392005-09-19 09:33:39 -07001014 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
1015 [Define if your system glob() function has
1016 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +11001017 AC_MSG_RESULT(yes)
1018 ],
1019 [
1020 AC_MSG_RESULT(no)
1021 ]
1022)
Damien Millerab18c411999-11-11 10:40:23 +11001023
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001024# Check for g.gl_matchc glob() extension
1025AC_MSG_CHECKING(for gl_matchc field in glob_t)
Darren Tucker486d95e2006-03-15 21:31:39 +11001026AC_TRY_COMPILE(
Damien Milleraf87af12006-03-15 13:02:28 +11001027 [ #include <glob.h> ],
1028 [glob_t g; g.gl_matchc = 1;],
Damien Millera8e06ce2003-11-21 23:48:55 +11001029 [
Tim Rice7df8d392005-09-19 09:33:39 -07001030 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1031 [Define if your system glob() function has
1032 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +11001033 AC_MSG_RESULT(yes)
1034 ],
1035 [
1036 AC_MSG_RESULT(no)
1037 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001038)
1039
Darren Tucker096faec2006-09-01 20:29:10 +10001040AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1041
Damien Miller18bb4732001-03-28 14:35:30 +10001042AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001043AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001044 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +10001045#include <sys/types.h>
1046#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001047int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +10001048 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001049 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +10001050 [
1051 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001052 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +11001053 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001054 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001055 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001056 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001057 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1058 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +10001059 ]
1060)
1061
Damien Miller36f49652004-08-15 18:40:59 +10001062AC_MSG_CHECKING([for /proc/pid/fd directory])
1063if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07001064 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +10001065 AC_MSG_RESULT(yes)
1066else
1067 AC_MSG_RESULT(no)
1068fi
1069
Damien Millerc547bf12001-02-16 10:18:12 +11001070# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001071SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001072AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001073 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001074 [
1075 if test "x$withval" != "xno" ; then
1076
1077 if test "x$withval" != "xyes" ; then
1078 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1079 LDFLAGS="$LDFLAGS -L${withval}/lib"
1080 fi
1081
Tim Rice7df8d392005-09-19 09:33:39 -07001082 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001083 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001084 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001085
Tim Rice4cec93f2002-02-26 08:40:48 -08001086 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001087 AC_LINK_IFELSE(
1088 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001089#include <stdio.h>
1090#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001091int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +10001092 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001093 [AC_MSG_RESULT(yes)],
1094 [
1095 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +11001096 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1097 ])
Darren Tucker3b908f62004-04-14 15:26:39 +10001098 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1099 AC_TRY_COMPILE(
1100 [#include <stdio.h>
1101 #include <skey.h>],
1102 [(void)skeychallenge(NULL,"name","",0);],
1103 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001104 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1105 [Define if your skeychallenge()
1106 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +10001107 [AC_MSG_RESULT(no)]
1108 )
Damien Millerc547bf12001-02-16 10:18:12 +11001109 fi
1110 ]
1111)
1112
1113# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001114TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001115AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001116 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001117 [
1118 if test "x$withval" != "xno" ; then
1119 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001120 saved_LDFLAGS="$LDFLAGS"
1121 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001122 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001123 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001124 if test -d "${withval}/lib"; then
1125 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001126 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001127 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001128 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001129 fi
1130 else
1131 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001132 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001133 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001134 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001135 fi
1136 fi
1137 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001138 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001139 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001140 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001141 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001142 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001143 LIBS="-lwrap $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001144 AC_MSG_CHECKING(for libwrap)
1145 AC_TRY_LINK(
1146 [
Damien Miller0ac45002004-04-14 20:14:26 +10001147#include <sys/types.h>
1148#include <sys/socket.h>
1149#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001150#include <tcpd.h>
1151 int deny_severity = 0, allow_severity = 0;
1152 ],
1153 [hosts_access(0);],
1154 [
1155 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001156 AC_DEFINE(LIBWRAP, 1,
1157 [Define if you want
1158 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001159 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001160 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001161 ],
1162 [
1163 AC_MSG_ERROR([*** libwrap missing])
1164 ]
1165 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001166 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001167 fi
1168 ]
1169)
1170
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001171# Check whether user wants libedit support
1172LIBEDIT_MSG="no"
1173AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001174 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001175 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001176 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001177 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1178 if test -n "${need_dash_r}"; then
1179 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1180 else
1181 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1182 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001183 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001184 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001185 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001186 LIBEDIT="-ledit -lcurses"
1187 LIBEDIT_MSG="yes"
1188 AC_SUBST(LIBEDIT)
1189 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001190 [ AC_MSG_ERROR(libedit not found) ],
1191 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001192 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001193 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001194 AC_COMPILE_IFELSE(
1195 [AC_LANG_SOURCE([[
1196#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001197int main(void)
1198{
1199 int i = H_SETSIZE;
1200 el_init("", NULL, NULL, NULL);
1201 exit(0);
1202}
Tim Ricec1819c82005-08-15 17:48:40 -07001203 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001204 [ AC_MSG_RESULT(yes) ],
1205 [ AC_MSG_RESULT(no)
1206 AC_MSG_ERROR(libedit version is not compatible) ]
1207 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001208 fi ]
1209)
1210
Darren Tuckerd9f88912005-02-20 21:01:48 +11001211AUDIT_MODULE=none
1212AC_ARG_WITH(audit,
1213 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1214 [
1215 AC_MSG_CHECKING(for supported audit module)
1216 case "$withval" in
1217 bsm)
1218 AC_MSG_RESULT(bsm)
1219 AUDIT_MODULE=bsm
1220 dnl Checks for headers, libs and functions
1221 AC_CHECK_HEADERS(bsm/audit.h, [],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001222 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1223 [
1224#ifdef HAVE_TIME_H
1225# include <time.h>
1226#endif
1227 ]
1228)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001229 AC_CHECK_LIB(bsm, getaudit, [],
1230 [AC_MSG_ERROR(BSM enabled and required library not found)])
1231 AC_CHECK_FUNCS(getaudit, [],
1232 [AC_MSG_ERROR(BSM enabled and required function not found)])
1233 # These are optional
Darren Tuckeracada072008-02-25 21:05:04 +11001234 AC_CHECK_FUNCS(getaudit_addr aug_get_machine)
Tim Rice7df8d392005-09-19 09:33:39 -07001235 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001236 ;;
1237 debug)
1238 AUDIT_MODULE=debug
1239 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001240 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001241 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001242 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001243 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001244 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001245 *)
1246 AC_MSG_ERROR([Unknown audit module $withval])
1247 ;;
1248 esac ]
1249)
1250
Damien Millerfe1f1432003-02-24 15:45:42 +11001251dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001252AC_CHECK_FUNCS( \
1253 arc4random \
Damien Miller57f39152005-11-24 19:58:19 +11001254 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001255 b64_ntop \
1256 __b64_ntop \
1257 b64_pton \
1258 __b64_pton \
1259 bcopy \
1260 bindresvport_sa \
1261 clock \
1262 closefrom \
1263 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001264 fchmod \
1265 fchown \
1266 freeaddrinfo \
1267 futimes \
1268 getaddrinfo \
1269 getcwd \
1270 getgrouplist \
1271 getnameinfo \
1272 getopt \
1273 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001274 getpeerucred \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001275 _getpty \
1276 getrlimit \
1277 getttyent \
1278 glob \
1279 inet_aton \
1280 inet_ntoa \
1281 inet_ntop \
1282 innetgr \
1283 login_getcapbool \
1284 md5_crypt \
1285 memmove \
1286 mkdtemp \
1287 mmap \
1288 ngetaddrinfo \
1289 nsleep \
1290 ogetaddrinfo \
1291 openlog_r \
1292 openpty \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001293 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001294 prctl \
1295 pstat \
1296 readpassphrase \
1297 realpath \
1298 recvmsg \
1299 rresvport_af \
1300 sendmsg \
1301 setdtablesize \
1302 setegid \
1303 setenv \
1304 seteuid \
1305 setgroups \
1306 setlogin \
1307 setpcred \
1308 setproctitle \
1309 setregid \
1310 setreuid \
1311 setrlimit \
1312 setsid \
1313 setvbuf \
1314 sigaction \
1315 sigvec \
1316 snprintf \
1317 socketpair \
1318 strdup \
1319 strerror \
1320 strlcat \
1321 strlcpy \
1322 strmode \
1323 strnvis \
1324 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001325 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001326 strtoul \
Damien Miller34a17692007-06-11 14:15:42 +10001327 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001328 sysconf \
1329 tcgetpgrp \
1330 truncate \
1331 unsetenv \
1332 updwtmpx \
Damien Miller57f39152005-11-24 19:58:19 +11001333 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001334 vhangup \
1335 vsnprintf \
1336 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001337)
Tim Rice13aae5e2001-10-21 17:53:58 -07001338
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001339# IRIX has a const char return value for gai_strerror()
1340AC_CHECK_FUNCS(gai_strerror,[
1341 AC_DEFINE(HAVE_GAI_STRERROR)
1342 AC_TRY_COMPILE([
1343#include <sys/types.h>
1344#include <sys/socket.h>
1345#include <netdb.h>
1346
1347const char *gai_strerror(int);],[
1348char *str;
1349
1350str = gai_strerror(0);],[
1351 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1352 [Define if gai_strerror() returns const char *])])])
1353
Tim Rice7df8d392005-09-19 09:33:39 -07001354AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1355 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001356
Darren Tuckerf1159b52003-07-07 19:44:01 +10001357dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001358AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001359AC_CHECK_DECL(strsep,
1360 [AC_CHECK_FUNCS(strsep)],
1361 [],
1362 [
1363#ifdef HAVE_STRING_H
1364# include <string.h>
1365#endif
1366 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001367
Darren Tuckerb2427c82003-09-10 15:22:44 +10001368dnl tcsendbreak might be a macro
1369AC_CHECK_DECL(tcsendbreak,
1370 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001371 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001372 [#include <termios.h>]
1373)
1374
Darren Tucker5bb14002004-04-23 18:53:10 +10001375AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1376
Darren Tucker128a0892006-07-12 19:02:56 +10001377AC_CHECK_DECLS(SHUT_RD, , ,
1378 [
1379#include <sys/types.h>
1380#include <sys/socket.h>
1381 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001382
1383AC_CHECK_DECLS(O_NONBLOCK, , ,
1384 [
1385#include <sys/types.h>
1386#ifdef HAVE_SYS_STAT_H
1387# include <sys/stat.h>
1388#endif
1389#ifdef HAVE_FCNTL_H
1390# include <fcntl.h>
1391#endif
1392 ])
1393
Darren Tuckered0b5922006-09-03 22:44:49 +10001394AC_CHECK_DECLS(writev, , , [
1395#include <sys/types.h>
1396#include <sys/uio.h>
1397#include <unistd.h>
1398 ])
1399
Darren Tucker6d862a52007-04-29 14:39:02 +10001400AC_CHECK_DECLS(MAXSYMLINKS, , , [
1401#include <sys/param.h>
1402 ])
1403
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001404AC_CHECK_DECLS(offsetof, , , [
1405#include <stddef.h>
1406 ])
1407
Darren Tucker2a6b0292003-12-31 14:59:17 +11001408AC_CHECK_FUNCS(setresuid, [
1409 dnl Some platorms have setresuid that isn't implemented, test for this
1410 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001411 AC_RUN_IFELSE(
1412 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001413#include <stdlib.h>
1414#include <errno.h>
1415int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001416 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001417 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001418 [AC_DEFINE(BROKEN_SETRESUID, 1,
1419 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001420 AC_MSG_RESULT(not implemented)],
1421 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001422 )
1423])
Darren Tuckere937be32003-12-17 18:53:26 +11001424
Darren Tucker2a6b0292003-12-31 14:59:17 +11001425AC_CHECK_FUNCS(setresgid, [
1426 dnl Some platorms have setresgid that isn't implemented, test for this
1427 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001428 AC_RUN_IFELSE(
1429 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001430#include <stdlib.h>
1431#include <errno.h>
1432int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001433 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001434 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001435 [AC_DEFINE(BROKEN_SETRESGID, 1,
1436 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001437 AC_MSG_RESULT(not implemented)],
1438 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001439 )
1440])
Darren Tuckere937be32003-12-17 18:53:26 +11001441
Damien Millerad833b32000-08-23 10:46:23 +10001442dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001443AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001444dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001445AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001446AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001447dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001448AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001449AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001450
Damien Millera8e06ce2003-11-21 23:48:55 +11001451AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001452 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1453 [AC_CHECK_LIB(bsd, daemon,
1454 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001455)
1456
Damien Millera8e06ce2003-11-21 23:48:55 +11001457AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001458 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1459 [Define if your libraries define getpagesize()])],
1460 [AC_CHECK_LIB(ucb, getpagesize,
1461 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001462)
1463
Damien Millercb170cb2000-07-01 16:52:55 +10001464# Check for broken snprintf
1465if test "x$ac_cv_func_snprintf" = "xyes" ; then
1466 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001467 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001468 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001469#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001470int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001471 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001472 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001473 [
1474 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001475 AC_DEFINE(BROKEN_SNPRINTF, 1,
1476 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001477 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001478 ],
1479 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001480 )
1481fi
1482
Damien Miller57f39152005-11-24 19:58:19 +11001483# If we don't have a working asprintf, then we strongly depend on vsnprintf
1484# returning the right thing on overflow: the number of characters it tried to
1485# create (as per SUSv3)
1486if test "x$ac_cv_func_asprintf" != "xyes" && \
1487 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1488 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1489 AC_RUN_IFELSE(
1490 [AC_LANG_SOURCE([[
1491#include <sys/types.h>
1492#include <stdio.h>
1493#include <stdarg.h>
1494
1495int x_snprintf(char *str,size_t count,const char *fmt,...)
1496{
1497 size_t ret; va_list ap;
1498 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1499 return ret;
1500}
1501int main(void)
1502{
1503 char x[1];
1504 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1505} ]])],
1506 [AC_MSG_RESULT(yes)],
1507 [
1508 AC_MSG_RESULT(no)
1509 AC_DEFINE(BROKEN_SNPRINTF, 1,
1510 [Define if your snprintf is busted])
1511 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1512 ],
1513 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1514 )
1515fi
1516
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001517# On systems where [v]snprintf is broken, but is declared in stdio,
1518# check that the fmt argument is const char * or just char *.
1519# This is only useful for when BROKEN_SNPRINTF
1520AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1521AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1522 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1523 int main(void) { snprintf(0, 0, 0); }
1524 ]])],
1525 [AC_MSG_RESULT(yes)
1526 AC_DEFINE(SNPRINTF_CONST, [const],
1527 [Define as const if snprintf() can declare const char *fmt])],
1528 [AC_MSG_RESULT(no)
1529 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1530
Damien Millerb4097182004-05-23 14:09:40 +10001531# Check for missing getpeereid (or equiv) support
1532NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001533if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001534 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1535 AC_TRY_COMPILE(
1536 [#include <sys/types.h>
1537 #include <sys/socket.h>],
1538 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001539 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001540 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001541 ],
Damien Millerb4097182004-05-23 14:09:40 +10001542 [AC_MSG_RESULT(no)
1543 NO_PEERCHECK=1]
1544 )
1545fi
1546
Damien Millere8328192003-01-07 15:18:32 +11001547dnl see whether mkstemp() requires XXXXXX
1548if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1549AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001550AC_RUN_IFELSE(
1551 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001552#include <stdlib.h>
1553main() { char template[]="conftest.mkstemp-test";
1554if (mkstemp(template) == -1)
1555 exit(1);
1556unlink(template); exit(0);
1557}
Darren Tucker314d89e2005-10-17 23:29:23 +10001558 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001559 [
1560 AC_MSG_RESULT(no)
1561 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001562 [
Damien Millere8328192003-01-07 15:18:32 +11001563 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001564 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001565 ],
1566 [
1567 AC_MSG_RESULT(yes)
1568 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001569 ]
Damien Millere8328192003-01-07 15:18:32 +11001570)
1571fi
1572
Darren Tucker70a3d552003-08-21 17:58:29 +10001573dnl make sure that openpty does not reacquire controlling terminal
1574if test ! -z "$check_for_openpty_ctty_bug"; then
1575 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001576 AC_RUN_IFELSE(
1577 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001578#include <stdio.h>
1579#include <sys/fcntl.h>
1580#include <sys/types.h>
1581#include <sys/wait.h>
1582
1583int
1584main()
1585{
1586 pid_t pid;
1587 int fd, ptyfd, ttyfd, status;
1588
1589 pid = fork();
1590 if (pid < 0) { /* failed */
1591 exit(1);
1592 } else if (pid > 0) { /* parent */
1593 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001594 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001595 exit(WEXITSTATUS(status));
1596 else
1597 exit(2);
1598 } else { /* child */
1599 close(0); close(1); close(2);
1600 setsid();
1601 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1602 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1603 if (fd >= 0)
1604 exit(3); /* Acquired ctty: broken */
1605 else
1606 exit(0); /* Did not acquire ctty: OK */
1607 }
1608}
Darren Tucker314d89e2005-10-17 23:29:23 +10001609 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001610 [
1611 AC_MSG_RESULT(yes)
1612 ],
1613 [
1614 AC_MSG_RESULT(no)
1615 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001616 ],
1617 [
1618 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001619 ]
1620 )
1621fi
1622
Tim Rice8bb561b2005-03-17 16:23:19 -08001623if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1624 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001625 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001626 AC_RUN_IFELSE(
1627 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001628#include <stdio.h>
1629#include <sys/socket.h>
1630#include <netdb.h>
1631#include <errno.h>
1632#include <netinet/in.h>
1633
1634#define TEST_PORT "2222"
1635
1636int
1637main(void)
1638{
1639 int err, sock;
1640 struct addrinfo *gai_ai, *ai, hints;
1641 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1642
1643 memset(&hints, 0, sizeof(hints));
1644 hints.ai_family = PF_UNSPEC;
1645 hints.ai_socktype = SOCK_STREAM;
1646 hints.ai_flags = AI_PASSIVE;
1647
1648 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1649 if (err != 0) {
1650 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1651 exit(1);
1652 }
1653
1654 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1655 if (ai->ai_family != AF_INET6)
1656 continue;
1657
1658 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1659 sizeof(ntop), strport, sizeof(strport),
1660 NI_NUMERICHOST|NI_NUMERICSERV);
1661
1662 if (err != 0) {
1663 if (err == EAI_SYSTEM)
1664 perror("getnameinfo EAI_SYSTEM");
1665 else
1666 fprintf(stderr, "getnameinfo failed: %s\n",
1667 gai_strerror(err));
1668 exit(2);
1669 }
1670
1671 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1672 if (sock < 0)
1673 perror("socket");
1674 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1675 if (errno == EBADF)
1676 exit(3);
1677 }
1678 }
1679 exit(0);
1680}
Darren Tucker314d89e2005-10-17 23:29:23 +10001681 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001682 [
1683 AC_MSG_RESULT(yes)
1684 ],
1685 [
1686 AC_MSG_RESULT(no)
1687 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001688 ],
1689 [
1690 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001691 ]
1692 )
1693fi
1694
Tim Rice8bb561b2005-03-17 16:23:19 -08001695if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1696 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001697 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001698 AC_RUN_IFELSE(
1699 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001700#include <stdio.h>
1701#include <sys/socket.h>
1702#include <netdb.h>
1703#include <errno.h>
1704#include <netinet/in.h>
1705
1706#define TEST_PORT "2222"
1707
1708int
1709main(void)
1710{
1711 int err, sock;
1712 struct addrinfo *gai_ai, *ai, hints;
1713 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1714
1715 memset(&hints, 0, sizeof(hints));
1716 hints.ai_family = PF_UNSPEC;
1717 hints.ai_socktype = SOCK_STREAM;
1718 hints.ai_flags = AI_PASSIVE;
1719
1720 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1721 if (err != 0) {
1722 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1723 exit(1);
1724 }
1725
1726 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1727 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1728 continue;
1729
1730 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1731 sizeof(ntop), strport, sizeof(strport),
1732 NI_NUMERICHOST|NI_NUMERICSERV);
1733
1734 if (ai->ai_family == AF_INET && err != 0) {
1735 perror("getnameinfo");
1736 exit(2);
1737 }
1738 }
1739 exit(0);
1740}
Darren Tucker314d89e2005-10-17 23:29:23 +10001741 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001742 [
1743 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001744 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1745 [Define if you have a getaddrinfo that fails
1746 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001747 ],
1748 [
1749 AC_MSG_RESULT(no)
1750 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001751 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10001752 [
Darren Tucker314d89e2005-10-17 23:29:23 +10001753 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001754 ]
1755 )
1756fi
1757
Darren Tuckera56f1912004-11-02 20:30:54 +11001758if test "x$check_for_conflicting_getspnam" = "x1"; then
1759 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1760 AC_COMPILE_IFELSE(
1761 [
1762#include <shadow.h>
1763int main(void) {exit(0);}
1764 ],
1765 [
1766 AC_MSG_RESULT(no)
1767 ],
1768 [
1769 AC_MSG_RESULT(yes)
1770 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1771 [Conflicting defs for getspnam])
1772 ]
1773 )
1774fi
1775
Damien Miller606f8802000-09-16 15:39:56 +11001776AC_FUNC_GETPGRP
1777
Tim Riceaef73712002-05-11 13:17:42 -07001778# Search for OpenSSL
1779saved_CPPFLAGS="$CPPFLAGS"
1780saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001781AC_ARG_WITH(ssl-dir,
1782 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1783 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001784 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001785 case "$withval" in
1786 # Relative paths
1787 ./*|../*) withval="`pwd`/$withval"
1788 esac
Tim Riceaef73712002-05-11 13:17:42 -07001789 if test -d "$withval/lib"; then
1790 if test -n "${need_dash_r}"; then
1791 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1792 else
1793 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1794 fi
1795 else
1796 if test -n "${need_dash_r}"; then
1797 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1798 else
1799 LDFLAGS="-L${withval} ${LDFLAGS}"
1800 fi
1801 fi
1802 if test -d "$withval/include"; then
1803 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1804 else
1805 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1806 fi
Damien Millera22ba012000-03-02 23:09:20 +11001807 fi
1808 ]
1809)
Tim Rice3d5352e2004-02-12 09:27:21 -08001810LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001811AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1812 [Define if your ssl headers are included
1813 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001814 [
Tim Riceaef73712002-05-11 13:17:42 -07001815 dnl Check default openssl install dir
1816 if test -n "${need_dash_r}"; then
1817 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001818 else
Tim Riceaef73712002-05-11 13:17:42 -07001819 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001820 fi
Tim Riceaef73712002-05-11 13:17:42 -07001821 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1822 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1823 [
1824 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1825 ]
1826 )
1827 ]
1828)
1829
Tim Riced730b782002-08-13 18:52:10 -07001830# Determine OpenSSL header version
1831AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001832AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001833 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001834#include <stdio.h>
1835#include <string.h>
1836#include <openssl/opensslv.h>
1837#define DATA "conftest.sslincver"
1838int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001839 FILE *fd;
1840 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001841
Damien Millera8e06ce2003-11-21 23:48:55 +11001842 fd = fopen(DATA,"w");
1843 if(fd == NULL)
1844 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001845
1846 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1847 exit(1);
1848
1849 exit(0);
1850}
Darren Tucker623d92f2004-09-12 22:36:15 +10001851 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001852 [
1853 ssl_header_ver=`cat conftest.sslincver`
1854 AC_MSG_RESULT($ssl_header_ver)
1855 ],
1856 [
1857 AC_MSG_RESULT(not found)
1858 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001859 ],
1860 [
1861 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001862 ]
1863)
1864
1865# Determine OpenSSL library version
1866AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001867AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001868 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001869#include <stdio.h>
1870#include <string.h>
1871#include <openssl/opensslv.h>
1872#include <openssl/crypto.h>
1873#define DATA "conftest.ssllibver"
1874int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001875 FILE *fd;
1876 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001877
Damien Millera8e06ce2003-11-21 23:48:55 +11001878 fd = fopen(DATA,"w");
1879 if(fd == NULL)
1880 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001881
1882 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1883 exit(1);
1884
1885 exit(0);
1886}
Darren Tucker623d92f2004-09-12 22:36:15 +10001887 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001888 [
1889 ssl_library_ver=`cat conftest.ssllibver`
1890 AC_MSG_RESULT($ssl_library_ver)
1891 ],
1892 [
1893 AC_MSG_RESULT(not found)
1894 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001895 ],
1896 [
1897 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001898 ]
1899)
Damien Millera22ba012000-03-02 23:09:20 +11001900
Damien Miller9975e482007-03-05 11:51:27 +11001901AC_ARG_WITH(openssl-header-check,
1902 [ --without-openssl-header-check Disable OpenSSL version consistency check],
1903 [ if test "x$withval" = "xno" ; then
1904 openssl_check_nonfatal=1
1905 fi
1906 ]
1907)
1908
Damien Millerec932372002-01-22 22:16:03 +11001909# Sanity check OpenSSL headers
1910AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001911AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001912 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001913#include <string.h>
1914#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001915int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001916 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001917 [
1918 AC_MSG_RESULT(yes)
1919 ],
1920 [
1921 AC_MSG_RESULT(no)
Damien Miller9975e482007-03-05 11:51:27 +11001922 if test "x$openssl_check_nonfatal" = "x"; then
1923 AC_MSG_ERROR([Your OpenSSL headers do not match your
1924library. Check config.log for details.
1925If you are sure your installation is consistent, you can disable the check
1926by running "./configure --without-openssl-header-check".
1927Also see contrib/findssl.sh for help identifying header/library mismatches.
1928])
1929 else
1930 AC_MSG_WARN([Your OpenSSL headers do not match your
1931library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10001932Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11001933 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001934 ],
1935 [
1936 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001937 ]
1938)
1939
Darren Tucker639bbe82006-08-20 20:17:53 +10001940AC_MSG_CHECKING([if programs using OpenSSL functions will link])
1941AC_LINK_IFELSE(
1942 [AC_LANG_SOURCE([[
1943#include <openssl/evp.h>
1944int main(void) { SSLeay_add_all_algorithms(); }
1945 ]])],
1946 [
1947 AC_MSG_RESULT(yes)
1948 ],
1949 [
1950 AC_MSG_RESULT(no)
1951 saved_LIBS="$LIBS"
1952 LIBS="$LIBS -ldl"
1953 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
1954 AC_LINK_IFELSE(
1955 [AC_LANG_SOURCE([[
1956#include <openssl/evp.h>
1957int main(void) { SSLeay_add_all_algorithms(); }
1958 ]])],
1959 [
1960 AC_MSG_RESULT(yes)
1961 ],
1962 [
1963 AC_MSG_RESULT(no)
1964 LIBS="$saved_LIBS"
1965 ]
1966 )
1967 ]
1968)
1969
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11001970AC_ARG_WITH(ssl-engine,
1971 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
1972 [ if test "x$withval" != "xno" ; then
1973 AC_MSG_CHECKING(for OpenSSL ENGINE support)
1974 AC_TRY_COMPILE(
1975 [ #include <openssl/engine.h>],
1976 [
Darren Tucker5e8381e2006-09-29 20:16:51 +10001977ENGINE_load_builtin_engines();ENGINE_register_all_complete();
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11001978 ],
1979 [ AC_MSG_RESULT(yes)
1980 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
1981 [Enable OpenSSL engine support])
1982 ],
1983 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
1984 )
1985 fi ]
1986)
1987
Darren Tucker129d0bb2005-12-19 17:40:40 +11001988# Check for OpenSSL without EVP_aes_{192,256}_cbc
1989AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10001990AC_LINK_IFELSE(
Darren Tucker129d0bb2005-12-19 17:40:40 +11001991 [AC_LANG_SOURCE([[
1992#include <string.h>
1993#include <openssl/evp.h>
Darren Tuckercc7c2122006-02-02 18:44:19 +11001994int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
Darren Tucker129d0bb2005-12-19 17:40:40 +11001995 ]])],
1996 [
1997 AC_MSG_RESULT(no)
1998 ],
1999 [
2000 AC_MSG_RESULT(yes)
2001 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2002 [libcrypto is missing AES 192 and 256 bit functions])
2003 ]
2004)
2005
Tim Rice3d5352e2004-02-12 09:27:21 -08002006# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2007# because the system crypt() is more featureful.
2008if test "x$check_for_libcrypt_before" = "x1"; then
2009 AC_CHECK_LIB(crypt, crypt)
2010fi
2011
Damien Millera8e06ce2003-11-21 23:48:55 +11002012# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002013# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002014if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11002015 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11002016fi
2017
Damien Milleraf87af12006-03-15 13:02:28 +11002018# Search for SHA256 support in libc and/or OpenSSL
2019AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
2020
Tim Rice99203ec2007-03-26 09:35:28 -07002021saved_LIBS="$LIBS"
2022AC_CHECK_LIB(iaf, ia_openinfo, [
2023 LIBS="$LIBS -liaf"
Tim Rice0eeaf122007-09-10 16:24:17 -07002024 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
2025 AC_DEFINE(HAVE_LIBIAF, 1,
2026 [Define if system has libiaf that supports set_id])
2027 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002028])
2029LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002030
2031### Configure cryptographic random number support
2032
2033# Check wheter OpenSSL seeds itself
2034AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002035AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002036 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11002037#include <string.h>
2038#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07002039int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10002040 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002041 [
2042 OPENSSL_SEEDS_ITSELF=yes
2043 AC_MSG_RESULT(yes)
2044 ],
2045 [
2046 AC_MSG_RESULT(no)
2047 # Default to use of the rand helper if OpenSSL doesn't
2048 # seed itself
2049 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10002050 ],
2051 [
2052 AC_MSG_WARN([cross compiling: assuming yes])
2053 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08002054 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002055 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002056 ]
2057)
2058
Darren Tucker3e6bde42006-08-20 20:03:50 +10002059# Check for PAM libs
2060PAM_MSG="no"
2061AC_ARG_WITH(pam,
2062 [ --with-pam Enable PAM support ],
2063 [
2064 if test "x$withval" != "xno" ; then
2065 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2066 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2067 AC_MSG_ERROR([PAM headers not found])
2068 fi
2069
2070 saved_LIBS="$LIBS"
2071 AC_CHECK_LIB(dl, dlopen, , )
2072 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2073 AC_CHECK_FUNCS(pam_getenvlist)
2074 AC_CHECK_FUNCS(pam_putenv)
2075 LIBS="$saved_LIBS"
2076
2077 PAM_MSG="yes"
2078
Darren Tucker20e9f972007-03-25 18:26:01 +10002079 SSHDLIBS="$SSHDLIBS -lpam"
Darren Tucker3e6bde42006-08-20 20:03:50 +10002080 AC_DEFINE(USE_PAM, 1,
2081 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002082
Darren Tucker3e6bde42006-08-20 20:03:50 +10002083 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002084 case "$LIBS" in
2085 *-ldl*)
2086 # libdl already in LIBS
2087 ;;
2088 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002089 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002090 ;;
2091 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002092 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002093 fi
2094 ]
2095)
2096
2097# Check for older PAM
2098if test "x$PAM_MSG" = "xyes" ; then
2099 # Check PAM strerror arguments (old PAM)
2100 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2101 AC_TRY_COMPILE(
2102 [
2103#include <stdlib.h>
2104#if defined(HAVE_SECURITY_PAM_APPL_H)
2105#include <security/pam_appl.h>
2106#elif defined (HAVE_PAM_PAM_APPL_H)
2107#include <pam/pam_appl.h>
2108#endif
2109 ],
2110 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2111 [AC_MSG_RESULT(no)],
2112 [
2113 AC_DEFINE(HAVE_OLD_PAM, 1,
2114 [Define if you have an old version of PAM
2115 which takes only one argument to pam_strerror])
2116 AC_MSG_RESULT(yes)
2117 PAM_MSG="yes (old library)"
2118 ]
2119 )
2120fi
Damien Miller6c21c512002-01-22 21:57:53 +11002121
2122# Do we want to force the use of the rand helper?
2123AC_ARG_WITH(rand-helper,
2124 [ --with-rand-helper Use subprocess to gather strong randomness ],
2125 [
2126 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002127 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11002128 # the previous test showed it to be unseeded.
2129 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2130 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2131 OPENSSL_SEEDS_ITSELF=yes
2132 USE_RAND_HELPER=""
2133 fi
2134 else
2135 USE_RAND_HELPER=yes
2136 fi
2137 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08002138)
Damien Miller6c21c512002-01-22 21:57:53 +11002139
2140# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08002141if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002142 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07002143 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2144 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11002145 RAND_MSG="OpenSSL internal ONLY"
2146 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08002147elif test ! -z "$USE_RAND_HELPER" ; then
2148 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11002149 RAND_MSG="ssh-rand-helper"
2150 INSTALL_SSH_RAND_HELPER="yes"
2151fi
2152AC_SUBST(INSTALL_SSH_RAND_HELPER)
2153
2154### Configuration of ssh-rand-helper
2155
2156# PRNGD TCP socket
2157AC_ARG_WITH(prngd-port,
2158 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2159 [
Damien Millere996d722002-01-23 11:20:59 +11002160 case "$withval" in
2161 no)
2162 withval=""
2163 ;;
2164 [[0-9]]*)
2165 ;;
2166 *)
2167 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2168 ;;
2169 esac
2170 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002171 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002172 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2173 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002174 fi
2175 ]
2176)
2177
2178# PRNGD Unix domain socket
2179AC_ARG_WITH(prngd-socket,
2180 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2181 [
Damien Millere996d722002-01-23 11:20:59 +11002182 case "$withval" in
2183 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11002184 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11002185 ;;
2186 no)
2187 withval=""
2188 ;;
2189 /*)
2190 ;;
2191 *)
2192 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2193 ;;
2194 esac
2195
2196 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002197 if test ! -z "$PRNGD_PORT" ; then
2198 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2199 fi
Damien Miller6385ba02002-01-23 08:12:36 +11002200 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002201 AC_MSG_WARN(Entropy socket is not readable)
2202 fi
2203 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002204 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2205 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002206 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08002207 ],
2208 [
2209 # Check for existing socket only if we don't have a random device already
2210 if test "$USE_RAND_HELPER" = yes ; then
2211 AC_MSG_CHECKING(for PRNGD/EGD socket)
2212 # Insert other locations here
2213 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2214 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2215 PRNGD_SOCKET="$sock"
2216 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2217 break;
2218 fi
2219 done
2220 if test ! -z "$PRNGD_SOCKET" ; then
2221 AC_MSG_RESULT($PRNGD_SOCKET)
2222 else
2223 AC_MSG_RESULT(not found)
2224 fi
2225 fi
Damien Miller6c21c512002-01-22 21:57:53 +11002226 ]
2227)
2228
2229# Change default command timeout for hashing entropy source
2230entropy_timeout=200
2231AC_ARG_WITH(entropy-timeout,
2232 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2233 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002234 if test -n "$withval" && test "x$withval" != "xno" && \
2235 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002236 entropy_timeout=$withval
2237 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002238 ]
Damien Miller6c21c512002-01-22 21:57:53 +11002239)
Tim Rice7df8d392005-09-19 09:33:39 -07002240AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2241 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11002242
Damien Millerd3f6ad22002-06-25 10:24:47 +10002243SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00002244AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00002245 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002246 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002247 if test -n "$withval" && test "x$withval" != "xno" && \
2248 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002249 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002250 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002251 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002252)
Tim Rice7df8d392005-09-19 09:33:39 -07002253AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2254 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10002255AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00002256
Tim Rice88f2ab52002-03-17 12:17:34 -08002257# We do this little dance with the search path to insure
2258# that programs that we select for use by installed programs
2259# (which may be run by the super-user) come from trusted
2260# locations before they come from the user's private area.
2261# This should help avoid accidentally configuring some
2262# random version of a program in someone's personal bin.
2263
2264OPATH=$PATH
2265PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07002266test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08002267test -d /sbin && PATH=$PATH:/sbin
2268test -d /usr/sbin && PATH=$PATH:/usr/sbin
2269PATH=$PATH:/etc:$OPATH
2270
Damien Millera8e06ce2003-11-21 23:48:55 +11002271# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11002272OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2273OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2274OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2275OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2276OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2277OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2278OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2279OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2280OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2281OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2282OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2283OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2284OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2285OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2286OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2287OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002288# restore PATH
2289PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002290
2291# Where does ssh-rand-helper get its randomness from?
2292INSTALL_SSH_PRNG_CMDS=""
2293if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2294 if test ! -z "$PRNGD_PORT" ; then
2295 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2296 elif test ! -z "$PRNGD_SOCKET" ; then
2297 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2298 else
2299 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2300 RAND_HELPER_CMDHASH=yes
2301 INSTALL_SSH_PRNG_CMDS="yes"
2302 fi
2303fi
2304AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2305
2306
Ben Lindstromb5628642000-10-18 00:02:25 +00002307# Cheap hack to ensure NEWS-OS libraries are arranged right.
2308if test ! -z "$SONY" ; then
2309 LIBS="$LIBS -liberty";
2310fi
2311
Damien Miller57f39152005-11-24 19:58:19 +11002312# Check for long long datatypes
2313AC_CHECK_TYPES([long long, unsigned long long, long double])
2314
2315# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002316AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002317AC_CHECK_SIZEOF(short int, 2)
2318AC_CHECK_SIZEOF(int, 4)
2319AC_CHECK_SIZEOF(long int, 4)
2320AC_CHECK_SIZEOF(long long int, 8)
2321
Damien Millerfa2bb692002-04-23 23:22:25 +10002322# Sanity check long long for some platforms (AIX)
2323if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2324 ac_cv_sizeof_long_long_int=0
2325fi
2326
Darren Tucker537f1ed2005-10-25 18:38:33 +10002327# compute LLONG_MIN and LLONG_MAX if we don't know them.
2328if test -z "$have_llong_max"; then
2329 AC_MSG_CHECKING([for max value of long long])
2330 AC_RUN_IFELSE(
2331 [AC_LANG_SOURCE([[
2332#include <stdio.h>
2333/* Why is this so damn hard? */
2334#ifdef __GNUC__
2335# undef __GNUC__
2336#endif
2337#define __USE_ISOC99
2338#include <limits.h>
2339#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002340#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2341
2342/*
2343 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2344 * we do this the hard way.
2345 */
2346static int
2347fprint_ll(FILE *f, long long n)
2348{
2349 unsigned int i;
2350 int l[sizeof(long long) * 8];
2351
2352 if (n < 0)
2353 if (fprintf(f, "-") < 0)
2354 return -1;
2355 for (i = 0; n != 0; i++) {
2356 l[i] = my_abs(n % 10);
2357 n /= 10;
2358 }
2359 do {
2360 if (fprintf(f, "%d", l[--i]) < 0)
2361 return -1;
2362 } while (i != 0);
2363 if (fprintf(f, " ") < 0)
2364 return -1;
2365 return 0;
2366}
2367
Darren Tucker537f1ed2005-10-25 18:38:33 +10002368int main(void) {
2369 FILE *f;
2370 long long i, llmin, llmax = 0;
2371
2372 if((f = fopen(DATA,"w")) == NULL)
2373 exit(1);
2374
2375#if defined(LLONG_MIN) && defined(LLONG_MAX)
2376 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2377 llmin = LLONG_MIN;
2378 llmax = LLONG_MAX;
2379#else
2380 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2381 /* This will work on one's complement and two's complement */
2382 for (i = 1; i > llmax; i <<= 1, i++)
2383 llmax = i;
2384 llmin = llmax + 1LL; /* wrap */
2385#endif
2386
2387 /* Sanity check */
2388 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002389 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2390 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002391 fprintf(f, "unknown unknown\n");
2392 exit(2);
2393 }
2394
Darren Tuckerd1450db2006-03-13 19:06:51 +11002395 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002396 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002397 if (fprint_ll(f, llmax) < 0)
2398 exit(4);
2399 if (fclose(f) < 0)
2400 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002401 exit(0);
2402}
2403 ]])],
2404 [
2405 llong_min=`$AWK '{print $1}' conftest.llminmax`
2406 llong_max=`$AWK '{print $2}' conftest.llminmax`
2407
Darren Tucker537f1ed2005-10-25 18:38:33 +10002408 AC_MSG_RESULT($llong_max)
2409 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2410 [max value of long long calculated by configure])
2411 AC_MSG_CHECKING([for min value of long long])
2412 AC_MSG_RESULT($llong_min)
2413 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2414 [min value of long long calculated by configure])
2415 ],
2416 [
2417 AC_MSG_RESULT(not found)
2418 ],
2419 [
2420 AC_MSG_WARN([cross compiling: not checking])
2421 ]
2422 )
2423fi
2424
2425
Damien Millera22ba012000-03-02 23:09:20 +11002426# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002427AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2428 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002429 [ #include <sys/types.h> ],
2430 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002431 [ ac_cv_have_u_int="yes" ],
2432 [ ac_cv_have_u_int="no" ]
2433 )
2434])
2435if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002436 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002437 have_u_int=1
2438fi
2439
Damien Miller61e50f12000-05-08 20:49:37 +10002440AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2441 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002442 [ #include <sys/types.h> ],
2443 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002444 [ ac_cv_have_intxx_t="yes" ],
2445 [ ac_cv_have_intxx_t="no" ]
2446 )
2447])
2448if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002449 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002450 have_intxx_t=1
2451fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002452
2453if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002454 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002455then
2456 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2457 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002458 [ #include <stdint.h> ],
2459 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002460 [
2461 AC_DEFINE(HAVE_INTXX_T)
2462 AC_MSG_RESULT(yes)
2463 ],
2464 [ AC_MSG_RESULT(no) ]
2465 )
2466fi
2467
Damien Miller578783e2000-09-23 14:12:24 +11002468AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2469 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002470 [
2471#include <sys/types.h>
2472#ifdef HAVE_STDINT_H
2473# include <stdint.h>
2474#endif
2475#include <sys/socket.h>
2476#ifdef HAVE_SYS_BITYPES_H
2477# include <sys/bitypes.h>
2478#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002479 ],
2480 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002481 [ ac_cv_have_int64_t="yes" ],
2482 [ ac_cv_have_int64_t="no" ]
2483 )
2484])
2485if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002486 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002487fi
2488
Damien Miller61e50f12000-05-08 20:49:37 +10002489AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2490 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002491 [ #include <sys/types.h> ],
2492 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002493 [ ac_cv_have_u_intxx_t="yes" ],
2494 [ ac_cv_have_u_intxx_t="no" ]
2495 )
2496])
2497if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002498 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002499 have_u_intxx_t=1
2500fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002501
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002502if test -z "$have_u_intxx_t" ; then
2503 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2504 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002505 [ #include <sys/socket.h> ],
2506 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002507 [
2508 AC_DEFINE(HAVE_U_INTXX_T)
2509 AC_MSG_RESULT(yes)
2510 ],
2511 [ AC_MSG_RESULT(no) ]
2512 )
2513fi
2514
Damien Miller578783e2000-09-23 14:12:24 +11002515AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2516 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002517 [ #include <sys/types.h> ],
2518 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002519 [ ac_cv_have_u_int64_t="yes" ],
2520 [ ac_cv_have_u_int64_t="no" ]
2521 )
2522])
2523if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002524 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002525 have_u_int64_t=1
2526fi
2527
Tim Rice4cec93f2002-02-26 08:40:48 -08002528if test -z "$have_u_int64_t" ; then
2529 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2530 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002531 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002532 [ u_int64_t a; a = 1],
2533 [
2534 AC_DEFINE(HAVE_U_INT64_T)
2535 AC_MSG_RESULT(yes)
2536 ],
2537 [ AC_MSG_RESULT(no) ]
2538 )
2539fi
2540
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002541if test -z "$have_u_intxx_t" ; then
2542 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2543 AC_TRY_COMPILE(
2544 [
2545#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002546 ],
2547 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002548 [ ac_cv_have_uintxx_t="yes" ],
2549 [ ac_cv_have_uintxx_t="no" ]
2550 )
2551 ])
2552 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002553 AC_DEFINE(HAVE_UINTXX_T, 1,
2554 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002555 fi
2556fi
2557
2558if test -z "$have_uintxx_t" ; then
2559 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2560 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002561 [ #include <stdint.h> ],
2562 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002563 [
2564 AC_DEFINE(HAVE_UINTXX_T)
2565 AC_MSG_RESULT(yes)
2566 ],
2567 [ AC_MSG_RESULT(no) ]
2568 )
2569fi
2570
Damien Milleredb82922000-06-20 13:25:52 +10002571if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002572 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002573then
2574 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2575 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002576 [
2577#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002578 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002579 [
Damien Miller70494d12000-04-03 15:57:06 +10002580 int8_t a; int16_t b; int32_t c;
2581 u_int8_t e; u_int16_t f; u_int32_t g;
2582 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002583 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002584 [
2585 AC_DEFINE(HAVE_U_INTXX_T)
2586 AC_DEFINE(HAVE_INTXX_T)
2587 AC_MSG_RESULT(yes)
2588 ],
2589 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002590 )
Damien Millerb29ea912000-01-15 14:12:03 +11002591fi
2592
Damien Miller58be7382001-09-15 21:31:54 +10002593
2594AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2595 AC_TRY_COMPILE(
2596 [
2597#include <sys/types.h>
2598 ],
2599 [ u_char foo; foo = 125; ],
2600 [ ac_cv_have_u_char="yes" ],
2601 [ ac_cv_have_u_char="no" ]
2602 )
2603])
2604if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002605 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002606fi
2607
Tim Rice13aae5e2001-10-21 17:53:58 -07002608TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002609
Tim Rice200a5c02002-02-26 22:12:34 -08002610AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002611
Damien Miller848b9932005-02-24 12:12:34 +11002612AC_CHECK_TYPES(in_addr_t,,,
2613[#include <sys/types.h>
2614#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002615
Damien Miller61e50f12000-05-08 20:49:37 +10002616AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2617 AC_TRY_COMPILE(
2618 [
2619#include <sys/types.h>
2620 ],
2621 [ size_t foo; foo = 1235; ],
2622 [ ac_cv_have_size_t="yes" ],
2623 [ ac_cv_have_size_t="no" ]
2624 )
2625])
2626if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002627 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002628fi
Damien Miller95058511999-12-29 10:36:45 +11002629
Damien Miller615f9392000-05-17 22:53:33 +10002630AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2631 AC_TRY_COMPILE(
2632 [
2633#include <sys/types.h>
2634 ],
2635 [ ssize_t foo; foo = 1235; ],
2636 [ ac_cv_have_ssize_t="yes" ],
2637 [ ac_cv_have_ssize_t="no" ]
2638 )
2639])
2640if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002641 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002642fi
2643
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002644AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2645 AC_TRY_COMPILE(
2646 [
2647#include <time.h>
2648 ],
2649 [ clock_t foo; foo = 1235; ],
2650 [ ac_cv_have_clock_t="yes" ],
2651 [ ac_cv_have_clock_t="no" ]
2652 )
2653])
2654if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002655 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002656fi
2657
Damien Millerb54b40e2000-06-23 08:23:34 +10002658AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2659 AC_TRY_COMPILE(
2660 [
2661#include <sys/types.h>
2662#include <sys/socket.h>
2663 ],
2664 [ sa_family_t foo; foo = 1235; ],
2665 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002666 [ AC_TRY_COMPILE(
2667 [
2668#include <sys/types.h>
2669#include <sys/socket.h>
2670#include <netinet/in.h>
2671 ],
2672 [ sa_family_t foo; foo = 1235; ],
2673 [ ac_cv_have_sa_family_t="yes" ],
2674
Damien Millerb54b40e2000-06-23 08:23:34 +10002675 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002676 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002677 )
2678])
2679if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002680 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2681 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002682fi
2683
Damien Miller0f91b4e2000-06-18 15:43:25 +10002684AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2685 AC_TRY_COMPILE(
2686 [
2687#include <sys/types.h>
2688 ],
2689 [ pid_t foo; foo = 1235; ],
2690 [ ac_cv_have_pid_t="yes" ],
2691 [ ac_cv_have_pid_t="no" ]
2692 )
2693])
2694if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002695 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002696fi
2697
2698AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2699 AC_TRY_COMPILE(
2700 [
2701#include <sys/types.h>
2702 ],
2703 [ mode_t foo; foo = 1235; ],
2704 [ ac_cv_have_mode_t="yes" ],
2705 [ ac_cv_have_mode_t="no" ]
2706 )
2707])
2708if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002709 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002710fi
2711
Damien Miller61e50f12000-05-08 20:49:37 +10002712
2713AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2714 AC_TRY_COMPILE(
2715 [
Damien Miller81171112000-04-23 11:14:01 +10002716#include <sys/types.h>
2717#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002718 ],
2719 [ struct sockaddr_storage s; ],
2720 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2721 [ ac_cv_have_struct_sockaddr_storage="no" ]
2722 )
2723])
2724if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002725 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2726 [define if you have struct sockaddr_storage 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 sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
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 sockaddr_in6 s; s.sin6_family = 0; ],
2736 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2737 [ ac_cv_have_struct_sockaddr_in6="no" ]
2738 )
2739])
2740if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002741 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2742 [define if you have struct sockaddr_in6 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 in6_addr], ac_cv_have_struct_in6_addr, [
2746 AC_TRY_COMPILE(
2747 [
Damien Miller7b22d652000-06-18 14:07:04 +10002748#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002749#include <netinet/in.h>
2750 ],
2751 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2752 [ ac_cv_have_struct_in6_addr="yes" ],
2753 [ ac_cv_have_struct_in6_addr="no" ]
2754 )
2755])
2756if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002757 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2758 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002759fi
Damien Miller34132e52000-01-14 15:45:46 +11002760
Damien Miller61e50f12000-05-08 20:49:37 +10002761AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2762 AC_TRY_COMPILE(
2763 [
Damien Miller81171112000-04-23 11:14:01 +10002764#include <sys/types.h>
2765#include <sys/socket.h>
2766#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002767 ],
2768 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2769 [ ac_cv_have_struct_addrinfo="yes" ],
2770 [ ac_cv_have_struct_addrinfo="no" ]
2771 )
2772])
2773if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002774 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2775 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002776fi
2777
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002778AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2779 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002780 [ #include <sys/time.h> ],
2781 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002782 [ ac_cv_have_struct_timeval="yes" ],
2783 [ ac_cv_have_struct_timeval="no" ]
2784 )
2785])
2786if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002787 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002788 have_struct_timeval=1
2789fi
2790
Tim Rice4e4dc562003-03-18 10:21:40 -08002791AC_CHECK_TYPES(struct timespec)
2792
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002793# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002794if test "x$ac_cv_have_int64_t" = "xno" && \
2795 test "x$ac_cv_sizeof_long_int" != "x8" && \
2796 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002797 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2798 echo "an alternative compiler (I.E., GCC) before continuing."
2799 echo ""
2800 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002801else
2802dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002803 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002804 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002805#include <stdio.h>
2806#include <string.h>
2807#ifdef HAVE_SNPRINTF
2808main()
2809{
2810 char buf[50];
2811 char expected_out[50];
2812 int mazsize = 50 ;
2813#if (SIZEOF_LONG_INT == 8)
2814 long int num = 0x7fffffffffffffff;
2815#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002816 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002817#endif
2818 strcpy(expected_out, "9223372036854775807");
2819 snprintf(buf, mazsize, "%lld", num);
2820 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002821 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002822 exit(0);
2823}
2824#else
2825main() { exit(0); }
2826#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002827 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002828 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002829 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002830fi
2831
Damien Miller78315eb2000-09-29 23:01:36 +11002832dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002833OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2834OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2835OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2836OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2837OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002838OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002839OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2840OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002841OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002842OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2843OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2844OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2845OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002846OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2847OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2848OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2849OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002850
2851AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11002852AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2853 [Define if we don't have struct __res_state in resolv.h])],
2854[
2855#include <stdio.h>
2856#if HAVE_SYS_TYPES_H
2857# include <sys/types.h>
2858#endif
2859#include <netinet/in.h>
2860#include <arpa/nameser.h>
2861#include <resolv.h>
2862])
andre2ff7b5d2000-06-03 14:57:40 +00002863
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, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002878fi
2879
Damien Miller61e50f12000-05-08 20:49:37 +10002880AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2881 ac_cv_have___ss_family_in_struct_ss, [
2882 AC_TRY_COMPILE(
2883 [
Damien Miller81171112000-04-23 11:14:01 +10002884#include <sys/types.h>
2885#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002886 ],
2887 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2888 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2889 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2890 )
2891])
2892if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002893 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2894 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002895fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002896
Damien Millerad833b32000-08-23 10:46:23 +10002897AC_CACHE_CHECK([for pw_class field in struct passwd],
2898 ac_cv_have_pw_class_in_struct_passwd, [
2899 AC_TRY_COMPILE(
2900 [
Damien Millerad833b32000-08-23 10:46:23 +10002901#include <pwd.h>
2902 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002903 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002904 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2905 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2906 )
2907])
2908if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002909 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2910 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002911fi
2912
Kevin Steves82456952001-06-22 21:14:18 +00002913AC_CACHE_CHECK([for pw_expire field in struct passwd],
2914 ac_cv_have_pw_expire_in_struct_passwd, [
2915 AC_TRY_COMPILE(
2916 [
2917#include <pwd.h>
2918 ],
2919 [ struct passwd p; p.pw_expire = 0; ],
2920 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2921 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2922 )
2923])
2924if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002925 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2926 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002927fi
2928
2929AC_CACHE_CHECK([for pw_change field in struct passwd],
2930 ac_cv_have_pw_change_in_struct_passwd, [
2931 AC_TRY_COMPILE(
2932 [
2933#include <pwd.h>
2934 ],
2935 [ struct passwd p; p.pw_change = 0; ],
2936 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2937 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2938 )
2939])
2940if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002941 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2942 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002943fi
Damien Miller61e50f12000-05-08 20:49:37 +10002944
Tim Rice28bbb0c2002-05-27 17:37:32 -07002945dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002946AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2947 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002948 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002949 [
Tim Riceae49fe62002-04-12 10:26:21 -07002950#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002951#include <sys/socket.h>
2952#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002953int main() {
2954#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002955#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002956exit(1);
2957#endif
2958struct msghdr m;
2959m.msg_accrights = 0;
2960exit(0);
2961}
Kevin Steves939c9db2002-03-22 17:23:25 +00002962 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002963 [ ac_cv_have_accrights_in_msghdr="yes" ],
2964 [ ac_cv_have_accrights_in_msghdr="no" ]
2965 )
2966])
2967if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002968 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2969 [Define if your system uses access rights style
2970 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002971fi
2972
Kevin Stevesa44e0352002-04-07 16:18:03 +00002973AC_CACHE_CHECK([for msg_control field in struct msghdr],
2974 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002975 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002976 [
Tim Riceae49fe62002-04-12 10:26:21 -07002977#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002978#include <sys/socket.h>
2979#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002980int main() {
2981#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002982#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002983exit(1);
2984#endif
2985struct msghdr m;
2986m.msg_control = 0;
2987exit(0);
2988}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002989 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002990 [ ac_cv_have_control_in_msghdr="yes" ],
2991 [ ac_cv_have_control_in_msghdr="no" ]
2992 )
2993])
2994if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002995 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2996 [Define if your system uses ancillary data style
2997 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00002998fi
2999
Damien Miller61e50f12000-05-08 20:49:37 +10003000AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003001 AC_TRY_LINK([],
3002 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10003003 [ ac_cv_libc_defines___progname="yes" ],
3004 [ ac_cv_libc_defines___progname="no" ]
3005 )
3006])
3007if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003008 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003009fi
3010
Kevin Steves4846f4a2002-03-22 18:19:53 +00003011AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
3012 AC_TRY_LINK([
3013#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11003014],
3015 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00003016 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3017 [ ac_cv_cc_implements___FUNCTION__="no" ]
3018 )
3019])
3020if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003021 AC_DEFINE(HAVE___FUNCTION__, 1,
3022 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003023fi
3024
3025AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3026 AC_TRY_LINK([
3027#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11003028],
3029 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00003030 [ ac_cv_cc_implements___func__="yes" ],
3031 [ ac_cv_cc_implements___func__="no" ]
3032 )
3033])
3034if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003035 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003036fi
3037
Damien Miller57f39152005-11-24 19:58:19 +11003038AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3039 AC_TRY_LINK(
3040 [#include <stdarg.h>
3041 va_list x,y;],
3042 [va_copy(x,y);],
3043 [ ac_cv_have_va_copy="yes" ],
3044 [ ac_cv_have_va_copy="no" ]
3045 )
3046])
3047if test "x$ac_cv_have_va_copy" = "xyes" ; then
3048 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3049fi
3050
3051AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3052 AC_TRY_LINK(
3053 [#include <stdarg.h>
3054 va_list x,y;],
3055 [__va_copy(x,y);],
3056 [ ac_cv_have___va_copy="yes" ],
3057 [ ac_cv_have___va_copy="no" ]
3058 )
3059])
3060if test "x$ac_cv_have___va_copy" = "xyes" ; then
3061 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3062fi
3063
Damien Miller4f8e6692001-07-14 13:22:53 +10003064AC_CACHE_CHECK([whether getopt has optreset support],
3065 ac_cv_have_getopt_optreset, [
3066 AC_TRY_LINK(
3067 [
3068#include <getopt.h>
3069 ],
3070 [ extern int optreset; optreset = 0; ],
3071 [ ac_cv_have_getopt_optreset="yes" ],
3072 [ ac_cv_have_getopt_optreset="no" ]
3073 )
3074])
3075if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003076 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3077 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003078fi
Damien Millera22ba012000-03-02 23:09:20 +11003079
Damien Millerecbb26d2000-07-15 14:59:14 +10003080AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003081 AC_TRY_LINK([],
3082 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10003083 [ ac_cv_libc_defines_sys_errlist="yes" ],
3084 [ ac_cv_libc_defines_sys_errlist="no" ]
3085 )
3086])
3087if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003088 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3089 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003090fi
3091
3092
Damien Miller11fa2cc2000-08-16 10:35:58 +10003093AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003094 AC_TRY_LINK([],
3095 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10003096 [ ac_cv_libc_defines_sys_nerr="yes" ],
3097 [ ac_cv_libc_defines_sys_nerr="no" ]
3098 )
3099])
3100if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003101 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003102fi
3103
Damien Millera8e06ce2003-11-21 23:48:55 +11003104SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003105# Check whether user wants sectok support
3106AC_ARG_WITH(sectok,
3107 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10003108 [
3109 if test "x$withval" != "xno" ; then
3110 if test "x$withval" != "xyes" ; then
3111 CPPFLAGS="$CPPFLAGS -I${withval}"
3112 LDFLAGS="$LDFLAGS -L${withval}"
3113 if test ! -z "$need_dash_r" ; then
3114 LDFLAGS="$LDFLAGS -R${withval}"
3115 fi
3116 if test ! -z "$blibpath" ; then
3117 blibpath="$blibpath:${withval}"
3118 fi
3119 fi
3120 AC_CHECK_HEADERS(sectok.h)
3121 if test "$ac_cv_header_sectok_h" != yes; then
3122 AC_MSG_ERROR(Can't find sectok.h)
3123 fi
3124 AC_CHECK_LIB(sectok, sectok_open)
3125 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3126 AC_MSG_ERROR(Can't find libsectok)
3127 fi
Tim Rice7df8d392005-09-19 09:33:39 -07003128 AC_DEFINE(SMARTCARD, 1,
3129 [Define if you want smartcard support])
3130 AC_DEFINE(USE_SECTOK, 1,
3131 [Define if you want smartcard support
3132 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11003133 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003134 fi
3135 ]
3136)
3137
3138# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08003139OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003140AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10003141 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08003142 [
3143 if test "x$withval" != "xno" ; then
3144 if test "x$withval" != "xyes" ; then
3145 OPENSC_CONFIG=$withval/bin/opensc-config
3146 else
3147 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3148 fi
3149 if test "$OPENSC_CONFIG" != "no"; then
3150 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3151 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3152 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
Darren Tucker0ee3cbf2006-09-23 16:25:19 +10003153 LIBS="$LIBS $LIBOPENSC_LIBS"
Tim Rice12ee8e22005-03-17 13:37:04 -08003154 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07003155 AC_DEFINE(USE_OPENSC, 1,
3156 [Define if you want smartcard support
3157 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08003158 SCARD_MSG="yes, using OpenSC"
3159 fi
3160 fi
3161 ]
3162)
Damien Miller85de5802001-09-18 14:01:11 +10003163
Darren Tucker5f88d342003-10-15 16:57:57 +10003164# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11003165AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07003166 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3167 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003168 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003169 # Needed by our getrrsetbyname()
3170 AC_SEARCH_LIBS(res_query, resolv)
3171 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10003172 AC_MSG_CHECKING(if res_query will link)
3173 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
3174 [AC_MSG_RESULT(no)
3175 saved_LIBS="$LIBS"
3176 LIBS="$LIBS -lresolv"
3177 AC_MSG_CHECKING(for res_query in -lresolv)
3178 AC_LINK_IFELSE([
3179#include <resolv.h>
3180int main()
3181{
3182 res_query (0, 0, 0, 0, 0);
3183 return 0;
3184}
3185 ],
3186 [LIBS="$LIBS -lresolv"
3187 AC_MSG_RESULT(yes)],
3188 [LIBS="$saved_LIBS"
3189 AC_MSG_RESULT(no)])
3190 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10003191 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003192 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003193 [#include <sys/types.h>
3194 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10003195 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07003196 [AC_DEFINE(HAVE_HEADER_AD, 1,
3197 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10003198 [#include <arpa/nameser.h>])
3199 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003200
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003201AC_MSG_CHECKING(if struct __res_state _res is an extern)
3202AC_LINK_IFELSE([
3203#include <stdio.h>
3204#if HAVE_SYS_TYPES_H
3205# include <sys/types.h>
3206#endif
3207#include <netinet/in.h>
3208#include <arpa/nameser.h>
3209#include <resolv.h>
3210extern struct __res_state _res;
3211int main() { return 0; }
3212 ],
3213 [AC_MSG_RESULT(yes)
3214 AC_DEFINE(HAVE__RES_EXTERN, 1,
3215 [Define if you have struct __res_state _res as an extern])
3216 ],
3217 [ AC_MSG_RESULT(no) ]
3218)
3219
Damien Miller73b42d22006-04-22 21:26:08 +10003220# Check whether user wants SELinux support
3221SELINUX_MSG="no"
3222LIBSELINUX=""
3223AC_ARG_WITH(selinux,
3224 [ --with-selinux Enable SELinux support],
3225 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003226 save_LIBS="$LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003227 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3228 SELINUX_MSG="yes"
3229 AC_CHECK_HEADER([selinux/selinux.h], ,
3230 AC_MSG_ERROR(SELinux support requires selinux.h header))
3231 AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
3232 AC_MSG_ERROR(SELinux support requires libselinux library))
Darren Tucker20e9f972007-03-25 18:26:01 +10003233 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Damien Miller73b42d22006-04-22 21:26:08 +10003234 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
Darren Tuckeradc947d2006-10-07 09:07:20 +10003235 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003236 fi ]
3237)
Damien Miller73b42d22006-04-22 21:26:08 +10003238
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003239# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003240KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003241AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11003242 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003243 [ if test "x$withval" != "xno" ; then
3244 if test "x$withval" = "xyes" ; then
3245 KRB5ROOT="/usr/local"
3246 else
3247 KRB5ROOT=${withval}
3248 fi
3249
Tim Rice7df8d392005-09-19 09:33:39 -07003250 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003251 KRB5_MSG="yes"
3252
3253 AC_MSG_CHECKING(for krb5-config)
3254 if test -x $KRB5ROOT/bin/krb5-config ; then
3255 KRB5CONF=$KRB5ROOT/bin/krb5-config
3256 AC_MSG_RESULT($KRB5CONF)
3257
3258 AC_MSG_CHECKING(for gssapi support)
3259 if $KRB5CONF | grep gssapi >/dev/null ; then
3260 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003261 AC_DEFINE(GSSAPI, 1,
3262 [Define this if you want GSSAPI
3263 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003264 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003265 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11003266 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11003267 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003268 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003269 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3270 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003271 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003272 AC_MSG_CHECKING(whether we are using Heimdal)
3273 AC_TRY_COMPILE([ #include <krb5.h> ],
3274 [ char *tmp = heimdal_version; ],
3275 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003276 AC_DEFINE(HEIMDAL, 1,
3277 [Define this if you are using the
3278 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003279 AC_MSG_RESULT(no)
3280 )
3281 else
3282 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003283 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003284 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11003285 AC_MSG_CHECKING(whether we are using Heimdal)
3286 AC_TRY_COMPILE([ #include <krb5.h> ],
3287 [ char *tmp = heimdal_version; ],
3288 [ AC_MSG_RESULT(yes)
3289 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10003290 K5LIBS="-lkrb5 -ldes"
3291 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08003292 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10003293 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11003294 ],
3295 [ AC_MSG_RESULT(no)
3296 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3297 ]
3298 )
Damien Miller200d0a72003-06-30 19:21:36 +10003299 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003300
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003301 AC_CHECK_LIB(gssapi,gss_init_sec_context,
3302 [ AC_DEFINE(GSSAPI)
3303 K5LIBS="-lgssapi $K5LIBS" ],
3304 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3305 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11003306 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003307 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3308 $K5LIBS)
3309 ],
3310 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003311
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003312 AC_CHECK_HEADER(gssapi.h, ,
3313 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003314 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003315 AC_CHECK_HEADERS(gssapi.h, ,
3316 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003317 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003318 ]
3319 )
3320
3321 oldCPP="$CPPFLAGS"
3322 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3323 AC_CHECK_HEADER(gssapi_krb5.h, ,
3324 [ CPPFLAGS="$oldCPP" ])
3325
Damien Millera8e06ce2003-11-21 23:48:55 +11003326 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003327 if test ! -z "$need_dash_r" ; then
3328 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3329 fi
3330 if test ! -z "$blibpath" ; then
3331 blibpath="$blibpath:${KRB5ROOT}/lib"
3332 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003333
3334 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3335 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3336 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3337
3338 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07003339 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3340 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11003341 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003342 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003343)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003344
Damien Millera22ba012000-03-02 23:09:20 +11003345# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003346
Damien Millerf58c6722002-05-13 13:15:42 +10003347PRIVSEP_PATH=/var/empty
3348AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07003349 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003350 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003351 if test -n "$withval" && test "x$withval" != "xno" && \
3352 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003353 PRIVSEP_PATH=$withval
3354 fi
3355 ]
3356)
3357AC_SUBST(PRIVSEP_PATH)
3358
Damien Millera22ba012000-03-02 23:09:20 +11003359AC_ARG_WITH(xauth,
3360 [ --with-xauth=PATH Specify path to xauth program ],
3361 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003362 if test -n "$withval" && test "x$withval" != "xno" && \
3363 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003364 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003365 fi
3366 ],
3367 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003368 TestPath="$PATH"
3369 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3370 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3371 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3372 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3373 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003374 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003375 xauth_path="/usr/openwin/bin/xauth"
3376 fi
3377 ]
3378)
3379
Damien Miller7d901272003-01-13 16:55:22 +11003380STRIP_OPT=-s
3381AC_ARG_ENABLE(strip,
3382 [ --disable-strip Disable calling strip(1) on install],
3383 [
3384 if test "x$enableval" = "xno" ; then
3385 STRIP_OPT=
3386 fi
3387 ]
3388)
3389AC_SUBST(STRIP_OPT)
3390
Damien Millera19cf472000-11-29 13:28:50 +11003391if test -z "$xauth_path" ; then
3392 XAUTH_PATH="undefined"
3393 AC_SUBST(XAUTH_PATH)
3394else
Tim Rice7df8d392005-09-19 09:33:39 -07003395 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3396 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003397 XAUTH_PATH=$xauth_path
3398 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003399fi
Damien Millera22ba012000-03-02 23:09:20 +11003400
3401# Check for mail directory (last resort if we cannot get it from headers)
3402if test ! -z "$MAIL" ; then
3403 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003404 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3405 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003406fi
3407
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_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3410 disable_ptmx_check=yes
3411fi
Damien Millera22ba012000-03-02 23:09:20 +11003412if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003413 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003414 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003415 [
Tim Rice7df8d392005-09-19 09:33:39 -07003416 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3417 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003418 have_dev_ptmx=1
3419 ]
3420 )
3421 fi
Damien Millera22ba012000-03-02 23:09:20 +11003422fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003423
Darren Tucker623d92f2004-09-12 22:36:15 +10003424if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003425 AC_CHECK_FILE("/dev/ptc",
3426 [
Tim Rice7df8d392005-09-19 09:33:39 -07003427 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3428 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003429 have_dev_ptc=1
3430 ]
3431 )
3432else
3433 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3434fi
Damien Miller204ad072000-03-02 23:56:12 +11003435
Damien Millera22ba012000-03-02 23:09:20 +11003436# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003437AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003438 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003439 [
Damien Miller897741e2001-04-16 10:41:46 +10003440 case "$withval" in
3441 man|cat|doc)
3442 MANTYPE=$withval
3443 ;;
3444 *)
3445 AC_MSG_ERROR(invalid man type: $withval)
3446 ;;
3447 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003448 ]
3449)
Ben Lindstrombc709922001-04-18 18:04:21 +00003450if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003451 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3452 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003453 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3454 MANTYPE=doc
3455 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3456 MANTYPE=man
3457 else
3458 MANTYPE=cat
3459 fi
3460fi
Damien Miller670a4b82000-01-22 13:53:11 +11003461AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003462if test "$MANTYPE" = "doc"; then
3463 mansubdir=man;
3464else
3465 mansubdir=$MANTYPE;
3466fi
3467AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003468
Damien Millera22ba012000-03-02 23:09:20 +11003469# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003470MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003471AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003472 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003473 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003474 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003475 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3476 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003477 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003478 fi
3479 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003480)
3481
Damien Millera22ba012000-03-02 23:09:20 +11003482# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003483AC_ARG_WITH(shadow,
3484 [ --without-shadow Disable shadow password support],
3485 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003486 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003487 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003488 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003489 fi
3490 ]
3491)
3492
Damien Miller1f335fb2000-06-26 11:31:33 +10003493if test -z "$disable_shadow" ; then
3494 AC_MSG_CHECKING([if the systems has expire shadow information])
3495 AC_TRY_COMPILE(
3496 [
3497#include <sys/types.h>
3498#include <shadow.h>
3499 struct spwd sp;
3500 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3501 [ sp_expire_available=yes ], []
3502 )
3503
3504 if test "x$sp_expire_available" = "xyes" ; then
3505 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003506 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3507 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003508 else
3509 AC_MSG_RESULT(no)
3510 fi
3511fi
3512
Damien Millera22ba012000-03-02 23:09:20 +11003513# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003514if test ! -z "$IPADDR_IN_DISPLAY" ; then
3515 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003516 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3517 [Define if you need to use IP address
3518 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003519else
Damien Millera8e06ce2003-11-21 23:48:55 +11003520 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003521 AC_ARG_WITH(ipaddr-display,
3522 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3523 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003524 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003525 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003526 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003527 fi
3528 ]
3529 )
3530fi
Damien Miller76112de1999-12-21 11:18:08 +11003531
Darren Tuckere1a790d2003-09-16 11:52:19 +10003532# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003533AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003534 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003535 [ if test "x$enableval" = "xno"; then
3536 AC_MSG_NOTICE([/etc/default/login handling disabled])
3537 etc_default_login=no
3538 else
3539 etc_default_login=yes
3540 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003541 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3542 then
3543 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3544 etc_default_login=no
3545 else
3546 etc_default_login=yes
3547 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003548)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003549
Darren Tucker2f9573d2005-02-10 22:28:54 +11003550if test "x$etc_default_login" != "xno"; then
3551 AC_CHECK_FILE("/etc/default/login",
3552 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003553 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003554 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3555 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003556 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003557fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003558
Tim Rice43a1c132002-04-17 21:19:14 -07003559dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003560if test $ac_cv_func_login_getcapbool = "yes" && \
3561 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003562 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003563fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003564
Damien Millera22ba012000-03-02 23:09:20 +11003565# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003566SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003567AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003568 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003569 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003570 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003571 AC_MSG_WARN([
3572--with-default-path=PATH has no effect on this system.
3573Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003574 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003575 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003576 AC_MSG_WARN([
3577--with-default-path=PATH will only be used if PATH is not defined in
3578$external_path_file .])
3579 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003580 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003581 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003582 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003583 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003584 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3585 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003586 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003587 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003588 AC_MSG_WARN([
3589If PATH is defined in $external_path_file, ensure the path to scp is included,
3590otherwise scp will not work.])
3591 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003592 AC_RUN_IFELSE(
3593 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003594/* find out what STDPATH is */
3595#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003596#ifdef HAVE_PATHS_H
3597# include <paths.h>
3598#endif
3599#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003600# ifdef _PATH_USERPATH /* Irix */
3601# define _PATH_STDPATH _PATH_USERPATH
3602# else
3603# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3604# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003605#endif
3606#include <sys/types.h>
3607#include <sys/stat.h>
3608#include <fcntl.h>
3609#define DATA "conftest.stdpath"
3610
3611main()
3612{
3613 FILE *fd;
3614 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003615
Tim Rice59ea0a02001-03-10 13:50:45 -08003616 fd = fopen(DATA,"w");
3617 if(fd == NULL)
3618 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003619
Tim Rice59ea0a02001-03-10 13:50:45 -08003620 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3621 exit(1);
3622
3623 exit(0);
3624}
Darren Tucker314d89e2005-10-17 23:29:23 +10003625 ]])],
3626 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003627 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3628 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3629 )
3630# make sure $bindir is in USER_PATH so scp will work
3631 t_bindir=`eval echo ${bindir}`
3632 case $t_bindir in
3633 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3634 esac
3635 case $t_bindir in
3636 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3637 esac
3638 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3639 if test $? -ne 0 ; then
3640 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3641 if test $? -ne 0 ; then
3642 user_path=$user_path:$t_bindir
3643 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3644 fi
3645 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003646 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003647)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003648if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003649 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003650 AC_SUBST(user_path)
3651fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003652
Damien Millera18bbd32002-05-13 10:48:57 +10003653# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003654AC_ARG_WITH(superuser-path,
3655 [ --with-superuser-path= Specify different path for super-user],
3656 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003657 if test -n "$withval" && test "x$withval" != "xno" && \
3658 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003659 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3660 [Define if you want a different $PATH
3661 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003662 superuser_path=$withval
3663 fi
3664 ]
3665)
3666
3667
Damien Miller61e50f12000-05-08 20:49:37 +10003668AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003669IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003670AC_ARG_WITH(4in6,
3671 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3672 [
3673 if test "x$withval" != "xno" ; then
3674 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003675 AC_DEFINE(IPV4_IN_IPV6, 1,
3676 [Detect IPv4 in IPv6 mapped addresses
3677 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003678 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003679 else
3680 AC_MSG_RESULT(no)
3681 fi
3682 ],[
3683 if test "x$inet6_default_4in6" = "xyes"; then
3684 AC_MSG_RESULT([yes (default)])
3685 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003686 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003687 else
3688 AC_MSG_RESULT([no (default)])
3689 fi
3690 ]
3691)
3692
Damien Miller60396b02001-02-18 17:01:00 +11003693# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003694BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003695AC_ARG_WITH(bsd-auth,
3696 [ --with-bsd-auth Enable BSD auth support],
3697 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003698 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003699 AC_DEFINE(BSD_AUTH, 1,
3700 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003701 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003702 fi
3703 ]
3704)
3705
Damien Millera22ba012000-03-02 23:09:20 +11003706# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003707piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003708# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003709if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003710 piddir=`eval echo ${sysconfdir}`
3711 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003712 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003713 esac
3714fi
3715
Tim Rice88f2ab52002-03-17 12:17:34 -08003716AC_ARG_WITH(pid-dir,
3717 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3718 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003719 if test -n "$withval" && test "x$withval" != "xno" && \
3720 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003721 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003722 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003723 AC_MSG_WARN([** no $piddir directory on this system **])
3724 fi
3725 fi
3726 ]
3727)
3728
Tim Rice7df8d392005-09-19 09:33:39 -07003729AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003730AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003731
andre2ff7b5d2000-06-03 14:57:40 +00003732dnl allow user to disable some login recording features
3733AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003734 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003735 [
3736 if test "x$enableval" = "xno" ; then
3737 AC_DEFINE(DISABLE_LASTLOG)
3738 fi
3739 ]
andre2ff7b5d2000-06-03 14:57:40 +00003740)
3741AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003742 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003743 [
3744 if test "x$enableval" = "xno" ; then
3745 AC_DEFINE(DISABLE_UTMP)
3746 fi
3747 ]
andre2ff7b5d2000-06-03 14:57:40 +00003748)
3749AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003750 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003751 [
3752 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003753 AC_DEFINE(DISABLE_UTMPX, 1,
3754 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003755 fi
3756 ]
andre2ff7b5d2000-06-03 14:57:40 +00003757)
3758AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003759 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003760 [
3761 if test "x$enableval" = "xno" ; then
3762 AC_DEFINE(DISABLE_WTMP)
3763 fi
3764 ]
andre2ff7b5d2000-06-03 14:57:40 +00003765)
3766AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003767 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003768 [
3769 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003770 AC_DEFINE(DISABLE_WTMPX, 1,
3771 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003772 fi
3773 ]
andre2ff7b5d2000-06-03 14:57:40 +00003774)
3775AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003776 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003777 [
3778 if test "x$enableval" = "xno" ; then
3779 AC_DEFINE(DISABLE_LOGIN)
3780 fi
3781 ]
andre2ff7b5d2000-06-03 14:57:40 +00003782)
3783AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003784 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003785 [
3786 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003787 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3788 [Define if you don't want to use pututline()
3789 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003790 fi
3791 ]
andre2ff7b5d2000-06-03 14:57:40 +00003792)
3793AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003794 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003795 [
3796 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003797 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3798 [Define if you don't want to use pututxline()
3799 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003800 fi
3801 ]
andre2ff7b5d2000-06-03 14:57:40 +00003802)
3803AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003804 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003805 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003806 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003807 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003808 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003809 conf_lastlog_location=$withval
3810 fi
3811 ]
3812)
andre2ff7b5d2000-06-03 14:57:40 +00003813
3814dnl lastlog, [uw]tmpx? detection
3815dnl NOTE: set the paths in the platform section to avoid the
3816dnl need for command-line parameters
3817dnl lastlog and [uw]tmp are subject to a file search if all else fails
3818
3819dnl lastlog detection
3820dnl NOTE: the code itself will detect if lastlog is a directory
3821AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3822AC_TRY_COMPILE([
3823#include <sys/types.h>
3824#include <utmp.h>
3825#ifdef HAVE_LASTLOG_H
3826# include <lastlog.h>
3827#endif
Damien Miller2994e082000-06-04 15:51:47 +10003828#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003829# include <paths.h>
3830#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003831#ifdef HAVE_LOGIN_H
3832# include <login.h>
3833#endif
andre2ff7b5d2000-06-03 14:57:40 +00003834 ],
3835 [ char *lastlog = LASTLOG_FILE; ],
3836 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003837 [
3838 AC_MSG_RESULT(no)
3839 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3840 AC_TRY_COMPILE([
3841#include <sys/types.h>
3842#include <utmp.h>
3843#ifdef HAVE_LASTLOG_H
3844# include <lastlog.h>
3845#endif
3846#ifdef HAVE_PATHS_H
3847# include <paths.h>
3848#endif
3849 ],
3850 [ char *lastlog = _PATH_LASTLOG; ],
3851 [ AC_MSG_RESULT(yes) ],
3852 [
andree441aa32000-06-12 22:34:38 +00003853 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003854 system_lastlog_path=no
3855 ])
3856 ]
andre2ff7b5d2000-06-03 14:57:40 +00003857)
Damien Miller2994e082000-06-04 15:51:47 +10003858
andre2ff7b5d2000-06-03 14:57:40 +00003859if test -z "$conf_lastlog_location"; then
3860 if test x"$system_lastlog_path" = x"no" ; then
3861 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003862 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003863 conf_lastlog_location=$f
3864 fi
3865 done
3866 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003867 AC_MSG_WARN([** Cannot find lastlog **])
3868 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003869 fi
3870 fi
3871fi
3872
3873if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003874 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3875 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003876fi
andre2ff7b5d2000-06-03 14:57:40 +00003877
3878dnl utmp detection
3879AC_MSG_CHECKING([if your system defines UTMP_FILE])
3880AC_TRY_COMPILE([
3881#include <sys/types.h>
3882#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003883#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003884# include <paths.h>
3885#endif
3886 ],
3887 [ char *utmp = UTMP_FILE; ],
3888 [ AC_MSG_RESULT(yes) ],
3889 [ AC_MSG_RESULT(no)
3890 system_utmp_path=no ]
3891)
3892if test -z "$conf_utmp_location"; then
3893 if test x"$system_utmp_path" = x"no" ; then
3894 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3895 if test -f $f ; then
3896 conf_utmp_location=$f
3897 fi
3898 done
3899 if test -z "$conf_utmp_location"; then
3900 AC_DEFINE(DISABLE_UTMP)
3901 fi
3902 fi
3903fi
3904if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003905 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3906 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003907fi
andre2ff7b5d2000-06-03 14:57:40 +00003908
3909dnl wtmp detection
3910AC_MSG_CHECKING([if your system defines WTMP_FILE])
3911AC_TRY_COMPILE([
3912#include <sys/types.h>
3913#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003914#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003915# include <paths.h>
3916#endif
3917 ],
3918 [ char *wtmp = WTMP_FILE; ],
3919 [ AC_MSG_RESULT(yes) ],
3920 [ AC_MSG_RESULT(no)
3921 system_wtmp_path=no ]
3922)
3923if test -z "$conf_wtmp_location"; then
3924 if test x"$system_wtmp_path" = x"no" ; then
3925 for f in /usr/adm/wtmp /var/log/wtmp; do
3926 if test -f $f ; then
3927 conf_wtmp_location=$f
3928 fi
3929 done
3930 if test -z "$conf_wtmp_location"; then
3931 AC_DEFINE(DISABLE_WTMP)
3932 fi
3933 fi
3934fi
3935if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003936 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3937 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003938fi
andre2ff7b5d2000-06-03 14:57:40 +00003939
3940
3941dnl utmpx detection - I don't know any system so perverse as to require
3942dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3943dnl there, though.
3944AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3945AC_TRY_COMPILE([
3946#include <sys/types.h>
3947#include <utmp.h>
3948#ifdef HAVE_UTMPX_H
3949#include <utmpx.h>
3950#endif
Damien Miller2994e082000-06-04 15:51:47 +10003951#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003952# include <paths.h>
3953#endif
3954 ],
3955 [ char *utmpx = UTMPX_FILE; ],
3956 [ AC_MSG_RESULT(yes) ],
3957 [ AC_MSG_RESULT(no)
3958 system_utmpx_path=no ]
3959)
3960if test -z "$conf_utmpx_location"; then
3961 if test x"$system_utmpx_path" = x"no" ; then
3962 AC_DEFINE(DISABLE_UTMPX)
3963 fi
3964else
Tim Rice7df8d392005-09-19 09:33:39 -07003965 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3966 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003967fi
andre2ff7b5d2000-06-03 14:57:40 +00003968
3969dnl wtmpx detection
3970AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3971AC_TRY_COMPILE([
3972#include <sys/types.h>
3973#include <utmp.h>
3974#ifdef HAVE_UTMPX_H
3975#include <utmpx.h>
3976#endif
Damien Miller2994e082000-06-04 15:51:47 +10003977#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003978# include <paths.h>
3979#endif
3980 ],
3981 [ char *wtmpx = WTMPX_FILE; ],
3982 [ AC_MSG_RESULT(yes) ],
3983 [ AC_MSG_RESULT(no)
3984 system_wtmpx_path=no ]
3985)
3986if test -z "$conf_wtmpx_location"; then
3987 if test x"$system_wtmpx_path" = x"no" ; then
3988 AC_DEFINE(DISABLE_WTMPX)
3989 fi
3990else
Tim Rice7df8d392005-09-19 09:33:39 -07003991 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3992 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003993fi
andre2ff7b5d2000-06-03 14:57:40 +00003994
Damien Miller4018c192000-04-30 09:30:44 +10003995
Damien Miller29ea30d2000-03-17 10:54:15 +11003996if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10003997 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3998 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11003999fi
4000
Darren Tucker7da23cb2005-08-03 00:20:15 +10004001dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4002dnl Add now.
4003CFLAGS="$CFLAGS $werror_flags"
4004
Damien Millerbac2d8a2000-09-05 16:13:06 +11004005AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004006AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4007 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
4008 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004009AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004010
Damien Miller7b22d652000-06-18 14:07:04 +10004011# Print summary of options
4012
Damien Miller7b22d652000-06-18 14:07:04 +10004013# Someone please show me a better way :)
4014A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4015B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4016C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4017D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004018E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004019F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004020G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004021H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4022I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4023J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004024
4025echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004026echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004027echo " User binaries: $B"
4028echo " System binaries: $C"
4029echo " Configuration files: $D"
4030echo " Askpass program: $E"
4031echo " Manual pages: $F"
4032echo " PID file: $G"
4033echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004034if test "x$external_path_file" = "x/etc/login.conf" ; then
4035echo " At runtime, sshd will use the path defined in $external_path_file"
4036echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004037else
Damien Millerf58c6722002-05-13 13:15:42 +10004038echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004039 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004040echo " (If PATH is set in $external_path_file it will be used instead. If"
4041echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4042 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004043fi
Damien Millera18bbd32002-05-13 10:48:57 +10004044if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004045echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004046fi
Damien Millerf58c6722002-05-13 13:15:42 +10004047echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004048echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004049echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004050echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004051echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004052echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004053echo " S/KEY support: $SKEY_MSG"
4054echo " TCP Wrappers support: $TCPW_MSG"
4055echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004056echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004057echo " Solaris process contract support: $SPC_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004058echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004059echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4060echo " BSD Auth support: $BSD_AUTH_MSG"
4061echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11004062if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004063echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11004064fi
4065
Damien Miller7b22d652000-06-18 14:07:04 +10004066echo ""
4067
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004068echo " Host: ${host}"
4069echo " Compiler: ${CC}"
4070echo " Compiler flags: ${CFLAGS}"
4071echo "Preprocessor flags: ${CPPFLAGS}"
4072echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004073echo " Libraries: ${LIBS}"
4074if test ! -z "${SSHDLIBS}"; then
4075echo " +for sshd: ${SSHDLIBS}"
4076fi
Damien Miller7b22d652000-06-18 14:07:04 +10004077
4078echo ""
4079
Tim Rice6f1f7582004-05-30 21:38:51 -07004080if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004081 echo "SVR4 style packages are supported with \"make package\""
4082 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004083fi
4084
Damien Miller82cf0ce2000-12-20 13:34:48 +11004085if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004086 echo "PAM is enabled. You may need to install a PAM control file "
4087 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004088 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004089 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004090 echo ""
4091fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004092
Damien Miller6c21c512002-01-22 21:57:53 +11004093if test ! -z "$RAND_HELPER_CMDHASH" ; then
4094 echo "WARNING: you are using the builtin random number collection "
4095 echo "service. Please read WARNING.RNG and request that your OS "
4096 echo "vendor includes kernel-based random number collection in "
4097 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004098 echo ""
4099fi
Damien Miller60396b02001-02-18 17:01:00 +11004100
Damien Millerb4097182004-05-23 14:09:40 +10004101if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004102 echo "WARNING: the operating system that you are using does not"
4103 echo "appear to support getpeereid(), getpeerucred() or the"
4104 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4105 echo "enforce security checks to prevent unauthorised connections to"
4106 echo "ssh-agent. Their absence increases the risk that a malicious"
4107 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004108 echo ""
4109fi
4110
Darren Tuckerd9f88912005-02-20 21:01:48 +11004111if test "$AUDIT_MODULE" = "bsm" ; then
4112 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4113 echo "See the Solaris section in README.platform for details."
4114fi