blob: 858aeaf4258ce525aa2298997d5f7d829fafe6e9 [file] [log] [blame]
Damien Millera7058ec2008-05-20 08:57:06 +10001# $Id: configure.ac,v 1.399 2008/05/19 22:57:06 djm 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)
Damien Millera7058ec2008-05-20 08:57:06 +100018AC_REVISION($Revision: 1.399 $)
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
Darren Tuckerb7918af2008-03-09 11:34:23 +110093use_stack_protector=1
94AC_ARG_WITH(stackprotect,
Damien Millerda3155e2008-03-27 12:30:18 +110095 [ --without-stackprotect Don't use compiler's stack protection], [
Darren Tuckerb7918af2008-03-09 11:34:23 +110096 if test "x$withval" = "xno"; then
97 use_stack_protector=0
98 fi ])
99
Damien Millera8e06ce2003-11-21 23:48:55 +1100100if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +1000101 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Darren Tucker3f9545e2005-11-12 15:20:52 +1100102 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700103 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000104 1.*) no_attrib_nonnull=1 ;;
105 2.8* | 2.9*)
106 CFLAGS="$CFLAGS -Wsign-compare"
107 no_attrib_nonnull=1
108 ;;
109 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerb0288092005-11-10 14:46:48 +1100110 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100111 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
112 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700113 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +1000114
Darren Tuckerb7918af2008-03-09 11:34:23 +1100115 # -fstack-protector-all doesn't always work for some GCC versions
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100116 # and/or platforms, so we test if we can. If it's not supported
117 # on a give platform gcc will emit a warning so we use -Werror.
Darren Tuckerb7918af2008-03-09 11:34:23 +1100118 if test "x$use_stack_protector" = "x1"; then
119 for t in -fstack-protector-all -fstack-protector; do
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100120 AC_MSG_CHECKING(if $CC supports $t)
Darren Tuckerb7918af2008-03-09 11:34:23 +1100121 saved_CFLAGS="$CFLAGS"
122 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100123 CFLAGS="$CFLAGS $t -Werror"
124 LDFLAGS="$LDFLAGS $t -Werror"
125 AC_LINK_IFELSE(
126 [AC_LANG_SOURCE([
127#include <stdlib.h>
128int main(void){return 0;}
129 ])],
Darren Tuckerb7918af2008-03-09 11:34:23 +1100130 [ AC_MSG_RESULT(yes)
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100131 CFLAGS="$saved_CFLAGS $t"
132 LDFLAGS="$saved_LDFLAGS $t"
Darren Tuckerb7918af2008-03-09 11:34:23 +1100133 AC_MSG_CHECKING(if $t works)
134 AC_RUN_IFELSE(
135 [AC_LANG_SOURCE([
136#include <stdlib.h>
137int main(void){exit(0);}
138 ])],
139 [ AC_MSG_RESULT(yes)
140 break ],
141 [ AC_MSG_RESULT(no) ],
142 [ AC_MSG_WARN([cross compiling: cannot test])
143 break ]
Darren Tuckerfe1cf972008-03-09 22:50:50 +1100144 )
Darren Tuckerb7918af2008-03-09 11:34:23 +1100145 ],
146 [ AC_MSG_RESULT(no) ]
147 )
148 CFLAGS="$saved_CFLAGS"
149 LDFLAGS="$saved_LDFLAGS"
150 done
151 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100152
Darren Tucker67b37032005-06-03 17:58:31 +1000153 if test -z "$have_llong_max"; then
154 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
155 unset ac_cv_have_decl_LLONG_MAX
156 saved_CFLAGS="$CFLAGS"
157 CFLAGS="$CFLAGS -std=gnu99"
158 AC_CHECK_DECL(LLONG_MAX,
159 [have_llong_max=1],
160 [CFLAGS="$saved_CFLAGS"],
161 [#include <limits.h>]
162 )
163 fi
Damien Miller166bd442000-03-16 10:48:25 +1100164fi
165
Darren Tucker391de5c2007-04-29 14:49:21 +1000166if test "x$no_attrib_nonnull" != "x1" ; then
167 AC_DEFINE(HAVE_ATTRIBUTE__NONNULL__, 1, [Have attribute nonnull])
168fi
169
Tim Rice88368a32003-12-08 12:35:59 -0800170AC_ARG_WITH(rpath,
171 [ --without-rpath Disable auto-added -R linker paths],
172 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800173 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800174 need_dash_r=""
175 fi
176 if test "x$withval" = "xyes" ; then
177 need_dash_r=1
178 fi
179 ]
180)
181
Tim Rice1cfab232006-10-03 09:34:35 -0700182# Allow user to specify flags
183AC_ARG_WITH(cflags,
184 [ --with-cflags Specify additional flags to pass to compiler],
185 [
186 if test -n "$withval" && test "x$withval" != "xno" && \
187 test "x${withval}" != "xyes"; then
188 CFLAGS="$CFLAGS $withval"
189 fi
190 ]
191)
192AC_ARG_WITH(cppflags,
193 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
194 [
195 if test -n "$withval" && test "x$withval" != "xno" && \
196 test "x${withval}" != "xyes"; then
197 CPPFLAGS="$CPPFLAGS $withval"
198 fi
199 ]
200)
201AC_ARG_WITH(ldflags,
202 [ --with-ldflags Specify additional flags to pass to linker],
203 [
204 if test -n "$withval" && test "x$withval" != "xno" && \
205 test "x${withval}" != "xyes"; then
206 LDFLAGS="$LDFLAGS $withval"
207 fi
208 ]
209)
210AC_ARG_WITH(libs,
211 [ --with-libs Specify additional libraries to link with],
212 [
213 if test -n "$withval" && test "x$withval" != "xno" && \
214 test "x${withval}" != "xyes"; then
215 LIBS="$LIBS $withval"
216 fi
217 ]
218)
219AC_ARG_WITH(Werror,
220 [ --with-Werror Build main code with -Werror],
221 [
222 if test -n "$withval" && test "x$withval" != "xno"; then
223 werror_flags="-Werror"
224 if test "x${withval}" != "xyes"; then
225 werror_flags="$withval"
226 fi
227 fi
228 ]
229)
230
231AC_CHECK_HEADERS( \
232 bstring.h \
233 crypt.h \
234 crypto/sha2.h \
235 dirent.h \
236 endian.h \
237 features.h \
238 fcntl.h \
239 floatingpoint.h \
240 getopt.h \
241 glob.h \
242 ia.h \
243 iaf.h \
244 limits.h \
245 login.h \
246 maillock.h \
247 ndir.h \
248 net/if_tun.h \
249 netdb.h \
250 netgroup.h \
251 pam/pam_appl.h \
252 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000253 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700254 pty.h \
255 readpassphrase.h \
256 rpc/types.h \
257 security/pam_appl.h \
258 sha2.h \
259 shadow.h \
260 stddef.h \
261 stdint.h \
262 string.h \
263 strings.h \
264 sys/audit.h \
265 sys/bitypes.h \
266 sys/bsdtty.h \
267 sys/cdefs.h \
268 sys/dir.h \
269 sys/mman.h \
270 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000271 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700272 sys/prctl.h \
273 sys/pstat.h \
274 sys/select.h \
275 sys/stat.h \
276 sys/stream.h \
277 sys/stropts.h \
278 sys/strtio.h \
279 sys/sysmacros.h \
280 sys/time.h \
281 sys/timers.h \
282 sys/un.h \
283 time.h \
284 tmpdir.h \
285 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700286 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700287 unistd.h \
288 usersec.h \
289 util.h \
290 utime.h \
291 utmp.h \
292 utmpx.h \
293 vis.h \
294)
295
296# lastlog.h requires sys/time.h to be included first on Solaris
297AC_CHECK_HEADERS(lastlog.h, [], [], [
298#ifdef HAVE_SYS_TIME_H
299# include <sys/time.h>
300#endif
301])
302
303# sys/ptms.h requires sys/stream.h to be included first on Solaris
304AC_CHECK_HEADERS(sys/ptms.h, [], [], [
305#ifdef HAVE_SYS_STREAM_H
306# include <sys/stream.h>
307#endif
308])
309
310# login_cap.h requires sys/types.h on NetBSD
311AC_CHECK_HEADERS(login_cap.h, [], [], [
312#include <sys/types.h>
313])
314
Damien Miller1b06dc32006-08-31 03:24:41 +1000315# Messages for features tested for in target-specific section
316SIA_MSG="no"
317SPC_MSG="no"
318
Damien Millera22ba012000-03-02 23:09:20 +1100319# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100320case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100321*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000322 # Some versions of VAC won't allow macro redefinitions at
323 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
324 # particularly with older versions of vac or xlc.
325 # It also throws errors about null macro argments, but these are
326 # not fatal.
327 AC_MSG_CHECKING(if compiler allows macro redefinitions)
328 AC_COMPILE_IFELSE(
329 [AC_LANG_SOURCE([[
330#define testmacro foo
331#define testmacro bar
332int main(void) { exit(0); }
333 ]])],
334 [ AC_MSG_RESULT(yes) ],
335 [ AC_MSG_RESULT(no)
336 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
337 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
338 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
339 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
340 ]
341 )
342
Damien Millera8e06ce2003-11-21 23:48:55 +1100343 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000344 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800345 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100346 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000347 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000348 if test "$GCC" = "yes"; then
349 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
350 else
351 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
352 fi
353 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000354 if (test -z "$blibflags"); then
355 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
356 AC_TRY_LINK([], [], [blibflags=$tryflags])
357 fi
358 done
359 if (test -z "$blibflags"); then
360 AC_MSG_RESULT(not found)
361 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
362 else
363 AC_MSG_RESULT($blibflags)
364 fi
365 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000366 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700367 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
368 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700369 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000370 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700371 LIBS="$LIBS -ls"
372 ])
373 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100374 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100375 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100376 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000377 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100378 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000379 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
380 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000381 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000382 [(void)loginfailed("user","host","tty",0);],
383 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700384 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
385 [Define if your AIX loginfailed() function
386 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000387 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000388 )],
389 [],
390 [#include <usersec.h>]
391 )
Darren Tucker0f26b132008-02-28 23:16:04 +1100392 AC_CHECK_FUNCS(getgrset setauthdb)
Darren Tucker3083bc22006-08-17 19:35:49 +1000393 AC_CHECK_DECL(F_CLOSEM,
Darren Tuckerd018b2e2006-08-18 18:51:20 +1000394 AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000395 [],
396 [ #include <limits.h>
397 #include <fcntl.h> ]
398 )
Darren Tucker691d5232005-02-15 21:45:57 +1100399 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700400 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
401 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
402 [Define if your platform breaks doing a seteuid before a setuid])
403 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
404 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000405 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700406 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
407 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
408 [Some systems need a utmpx entry for /bin/login to work])
409 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
410 [Define to a Set Process Title type if your system is
411 supported by bsd-setproctitle.c])
Darren Tucker91d25a02005-11-26 22:24:09 +1100412 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
413 [AIX 5.2 and 5.3 (and presumably newer) require this])
Darren Tucker9afe1152006-06-23 21:24:12 +1000414 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
Damien Miller75b1d102000-01-07 14:01:41 +1100415 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100416*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100417 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100418 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700419 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
420 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
421 AC_DEFINE(DISABLE_SHADOW, 1,
422 [Define if you want to disable shadow passwords])
423 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
424 [Define if your system choked on IP TOS setting])
425 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
426 [Define if X11 doesn't support AF_UNIX sockets on that system])
427 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
428 [Define if the concept of ports only accessible to
429 superusers isn't known])
430 AC_DEFINE(DISABLE_FD_PASSING, 1,
431 [Define if your platform needs to skip post auth
432 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100433 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000434*-*-dgux*)
435 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100436 AC_DEFINE(SETEUID_BREAKS_SETUID)
437 AC_DEFINE(BROKEN_SETREUID)
438 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000439 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000440*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000441 AC_MSG_CHECKING(if we have working getaddrinfo)
442 AC_TRY_RUN([#include <mach-o/dyld.h>
443main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
444 exit(0);
445 else
446 exit(1);
447}], [AC_MSG_RESULT(working)],
448 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700449 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700450 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000451 AC_DEFINE(SETEUID_BREAKS_SETUID)
452 AC_DEFINE(BROKEN_SETREUID)
453 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker528d6fa2007-12-31 21:29:26 +1100454 AC_DEFINE(BROKEN_GLOB, 1, [OS X glob does not do what we expect])
Tim Rice7df8d392005-09-19 09:33:39 -0700455 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
456 [Define if your resolver libs need this for getrrsetbyname])
Darren Tucker3eb48342006-06-23 21:05:12 +1000457 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
458 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
459 [Use tunnel device compatibility to OpenBSD])
460 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
461 [Prepend the address family to IP tunnel traffic])
Darren Tuckeracada072008-02-25 21:05:04 +1100462 m4_pattern_allow(AU_IPv)
463 AC_CHECK_DECL(AU_IPv4, [],
464 AC_DEFINE(AU_IPv4, 0, [System only supports IPv4 audit records])
465 [#include <bsm/audit.h>]
466 )
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000467 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000468*-*-dragonfly*)
469 SSHDLIBS="$SSHDLIBS -lcrypt"
470 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000471*-*-hpux*)
472 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000473 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100474 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000475 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700476 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
477 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000478 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700479 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
480 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000481 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000482 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700483 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000484 AC_CHECK_LIB(xnet, t_error, ,
485 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
486
487 # next, we define all of the options specific to major releases
488 case "$host" in
489 *-*-hpux10*)
490 if test -z "$GCC"; then
491 CFLAGS="$CFLAGS -Ae"
492 fi
493 ;;
494 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700495 AC_DEFINE(PAM_SUN_CODEBASE, 1,
496 [Define if you are using Solaris-derived PAM which
497 passes pam_messages to the conversation function
498 with an extra level of indirection])
499 AC_DEFINE(DISABLE_UTMP, 1,
500 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000501 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
502 check_for_hpux_broken_getaddrinfo=1
503 check_for_conflicting_getspnam=1
504 ;;
505 esac
506
507 # lastly, we define options specific to minor releases
508 case "$host" in
509 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700510 AC_DEFINE(HAVE_SECUREWARE, 1,
511 [Define if you have SecureWare-based
512 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000513 disable_ptmx_check=yes
514 LIBS="$LIBS -lsecpw"
515 ;;
516 esac
Damien Miller1bead332000-04-30 00:47:29 +1000517 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100518*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100519 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700520 AC_DEFINE(BROKEN_INET_NTOA, 1,
521 [Define if you system's inet_ntoa is busted
522 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000523 AC_DEFINE(SETEUID_BREAKS_SETUID)
524 AC_DEFINE(BROKEN_SETREUID)
525 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700526 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
527 [Define if you shouldn't strip 'tty' from your
528 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000529 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100530 ;;
531*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100532 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700533 AC_DEFINE(WITH_IRIX_ARRAY, 1,
534 [Define if you have/want arrays
535 (cluster-wide session managment, not C arrays)])
536 AC_DEFINE(WITH_IRIX_PROJECT, 1,
537 [Define if you want IRIX project management])
538 AC_DEFINE(WITH_IRIX_AUDIT, 1,
539 [Define if you want IRIX audit trails])
540 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
541 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000542 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000543 AC_DEFINE(SETEUID_BREAKS_SETUID)
544 AC_DEFINE(BROKEN_SETREUID)
545 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700546 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000547 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000548 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100549 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100550*-*-linux*)
551 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100552 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000553 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700554 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
555 AC_DEFINE(PAM_TTY_KLUDGE, 1,
556 [Work around problematic Linux PAM modules handling of PAM_TTY])
557 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
558 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000559 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700560 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
561 [Define to whatever link() returns for "not supported"
562 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100563 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700564 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100565 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000566 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000567 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700568 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
569 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000570 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000571 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100572 # tun(4) forwarding compat code
Damien Millerc4bcc912005-12-31 17:05:58 +1100573 AC_CHECK_HEADERS(linux/if_tun.h)
Damien Millerbd4e4102006-01-01 21:03:30 +1100574 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Damien Miller89e03ba2005-12-31 16:42:03 +1100575 AC_DEFINE(SSH_TUN_LINUX, 1,
576 [Open tunnel devices the Linux tun/tap way])
577 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
578 [Use tunnel device compatibility to OpenBSD])
579 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
580 [Prepend the address family to IP tunnel traffic])
581 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100582 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000583mips-sony-bsd|mips-sony-newsos4)
Darren Tucker988b3fd2006-02-08 22:11:27 +1100584 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000585 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000586 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100587*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000588 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800589 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800590 need_dash_r=1
591 fi
Damien Miller2dcddbf2006-01-01 19:47:05 +1100592 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
593 AC_CHECK_HEADER([net/if_tap.h], ,
594 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
595 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
596 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100597 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100598*-*-freebsd*)
599 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000600 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100601 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
602 AC_CHECK_HEADER([net/if_tap.h], ,
603 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
Darren Tucker54e859f2008-03-02 21:52:27 +1100604 AC_DEFINE(BROKEN_GLOB, 1, [FreeBSD glob does not do what we need])
Damien Millerfbd884a2001-02-27 08:39:07 +1100605 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000606*-*-bsdi*)
607 AC_DEFINE(SETEUID_BREAKS_SETUID)
608 AC_DEFINE(BROKEN_SETREUID)
609 AC_DEFINE(BROKEN_SETREGID)
610 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000611*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000612 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100613 conf_utmp_location=/etc/utmp
614 conf_wtmp_location=/usr/adm/wtmp
615 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700616 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000617 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000618 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700619 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000620 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000621*-*-openbsd*)
622 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000623 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100624 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
Damien Millerbb598142006-08-19 08:38:23 +1000625 AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1,
626 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000627 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100628*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800629 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800630 need_dash_r=1
631 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100632 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000633 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700634 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
635 [Some versions of /bin/login need the TERM supplied
636 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000637 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700638 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
639 [Define if pam_chauthtok wants real uid set
640 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000641 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000642 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700643 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
644 [Define if sshd somehow reacquires a controlling TTY
645 after setsid()])
Darren Tucker0249f932006-06-24 12:10:07 +1000646 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
647 in case the name is longer than 8 chars])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000648 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000649 # hardwire lastlog location (can't detect it on some versions)
650 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000651 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
652 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
653 if test "$sol2ver" -ge 8; then
654 AC_MSG_RESULT(yes)
655 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700656 AC_DEFINE(DISABLE_WTMP, 1,
657 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000658 else
659 AC_MSG_RESULT(no)
660 fi
Damien Miller1b06dc32006-08-31 03:24:41 +1000661 AC_ARG_WITH(solaris-contracts,
662 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
663 [
664 AC_CHECK_LIB(contract, ct_tmpl_activate,
665 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
666 [Define if you have Solaris process contracts])
667 SSHDLIBS="$SSHDLIBS -lcontract"
668 AC_SUBST(SSHDLIBS)
669 SPC_MSG="yes" ], )
670 ],
671 )
Damien Miller75b1d102000-01-07 14:01:41 +1100672 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000673*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000674 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000675 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100676 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000677 conf_utmp_location=/etc/utmp
678 conf_wtmp_location=/var/adm/wtmp
679 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000680 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000681 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000682*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700683 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000684 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000685 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000686 AC_DEFINE(SETEUID_BREAKS_SETUID)
687 AC_DEFINE(BROKEN_SETREUID)
688 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000689 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000690*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700691 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000692 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100693 # -lresolv needs to be at the end of LIBS or DNS lookups break
694 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100695 IPADDR_IN_DISPLAY=yes
696 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000697 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000698 AC_DEFINE(SETEUID_BREAKS_SETUID)
699 AC_DEFINE(BROKEN_SETREUID)
700 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000701 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000702 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700703 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
704 # Attention: always take care to bind libsocket and libnsl before libc,
705 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000706 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800707# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100708*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100709 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700710 AC_DEFINE(SETEUID_BREAKS_SETUID)
711 AC_DEFINE(BROKEN_SETREUID)
712 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700713 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice46259d82005-11-28 18:40:34 -0800714 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller78315eb2000-09-29 23:01:36 +1100715 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800716# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100717*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700718 check_for_libcrypt_later=1
719 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100720 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700721 AC_DEFINE(SETEUID_BREAKS_SETUID)
722 AC_DEFINE(BROKEN_SETREUID)
723 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700724 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700725 case "$host" in
726 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
727 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700728 AC_DEFINE(BROKEN_LIBIAF, 1,
729 [ia_uinfo routines not supported by OS yet])
Tim Riceb8f00192006-09-06 18:11:29 -0700730 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice4dbacff2005-06-01 20:09:28 -0700731 ;;
Tim Rice46259d82005-11-28 18:40:34 -0800732 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
733 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700734 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100735 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100736*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100737 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800738# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100739*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800740 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100741 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800742# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100743*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800744 if test -z "$GCC"; then
745 CFLAGS="$CFLAGS -belf"
746 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100747 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000748 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100749 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000750 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000751 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700752 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700753 AC_DEFINE(SETEUID_BREAKS_SETUID)
754 AC_DEFINE(BROKEN_SETREUID)
755 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700756 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700757 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700758 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100759 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700760 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700761 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000762 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000763*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700764 AC_DEFINE(NO_SSH_LASTLOG, 1,
765 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100766 AC_DEFINE(SETEUID_BREAKS_SETUID)
767 AC_DEFINE(BROKEN_SETREUID)
768 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000769 AC_DEFINE(USE_PIPES)
770 AC_DEFINE(DISABLE_FD_PASSING)
771 LDFLAGS="$LDFLAGS"
772 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
773 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000774 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000775*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100776 AC_DEFINE(SETEUID_BREAKS_SETUID)
777 AC_DEFINE(BROKEN_SETREUID)
778 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000779 AC_DEFINE(WITH_ABBREV_NO_TTY)
780 AC_DEFINE(USE_PIPES)
781 AC_DEFINE(DISABLE_FD_PASSING)
782 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100783 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000784 MANTYPE=cat
785 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000786*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100787 AC_DEFINE(SETEUID_BREAKS_SETUID)
788 AC_DEFINE(BROKEN_SETREUID)
789 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000790 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700791 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700792 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000793 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
794 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
795 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700796 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000797*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000798 AC_MSG_CHECKING(for Digital Unix SIA)
799 no_osfsia=""
800 AC_ARG_WITH(osfsia,
801 [ --with-osfsia Enable Digital Unix SIA],
802 [
803 if test "x$withval" = "xno" ; then
804 AC_MSG_RESULT(disabled)
805 no_osfsia=1
806 fi
807 ],
808 )
809 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000810 if test -f /etc/sia/matrix.conf; then
811 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700812 AC_DEFINE(HAVE_OSF_SIA, 1,
813 [Define if you have Digital Unix Security
814 Integration Architecture])
815 AC_DEFINE(DISABLE_LOGIN, 1,
816 [Define if you don't want to use your
817 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000818 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000819 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000820 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000821 else
822 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700823 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
824 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000825 fi
826 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000827 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700828 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000829 AC_DEFINE(BROKEN_SETREUID)
830 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000831 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000832
Tim Rice70335a62006-02-04 17:42:58 -0800833*-*-nto-qnx*)
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000834 AC_DEFINE(USE_PIPES)
835 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700836 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
837 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
838 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Tim Rice70335a62006-02-04 17:42:58 -0800839 AC_DEFINE(DISABLE_LASTLOG)
Darren Tucker54b75fe2006-02-26 12:31:48 +1100840 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckerbc1bd9d2007-09-27 07:03:20 +1000841 AC_DEFINE(BROKEN_SHADOW_EXPIRE, 1, [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -0800842 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +1000843 case "$host" in
844 *-*-nto-qnx6*)
845 AC_DEFINE(DISABLE_FD_PASSING)
846 ;;
847 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000848 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000849
850*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700851 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
852 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
Darren Tucker988b3fd2006-02-08 22:11:27 +1100853 AC_DEFINE(NEED_SETPGRP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700854 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
855 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000856
857*-*-lynxos)
858 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700859 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000860 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
861 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100862esac
863
Darren Tucker6eb93042003-06-29 21:30:41 +1000864AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000865AC_RUN_IFELSE(
866 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000867#include <stdio.h>
868int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000869 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000870 [ AC_MSG_RESULT(yes) ],
871 [
872 AC_MSG_RESULT(no)
873 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000874 ],
875 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000876)
877
Darren Tucker0c9653f2005-05-28 15:58:14 +1000878dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +1100879# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700880AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
881AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000882
Tim Rice1e1ef642003-09-11 22:19:31 -0700883dnl IRIX and Solaris 2.5.1 have dirname() in libgen
884AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
885 AC_CHECK_LIB(gen, dirname,[
886 AC_CACHE_CHECK([for broken dirname],
887 ac_cv_have_broken_dirname, [
888 save_LIBS="$LIBS"
889 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000890 AC_RUN_IFELSE(
891 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700892#include <libgen.h>
893#include <string.h>
894
895int main(int argc, char **argv) {
896 char *s, buf[32];
897
898 strncpy(buf,"/etc", 32);
899 s = dirname(buf);
900 if (!s || strncmp(s, "/", 32) != 0) {
901 exit(1);
902 } else {
903 exit(0);
904 }
905}
Darren Tucker314d89e2005-10-17 23:29:23 +1000906 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700907 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000908 [ ac_cv_have_broken_dirname="yes" ],
909 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700910 )
911 LIBS="$save_LIBS"
912 ])
913 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
914 LIBS="$LIBS -lgen"
915 AC_DEFINE(HAVE_DIRNAME)
916 AC_CHECK_HEADERS(libgen.h)
917 fi
918 ])
919])
920
921AC_CHECK_FUNC(getspnam, ,
922 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700923AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
924 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700925
Tim Rice13aae5e2001-10-21 17:53:58 -0700926dnl zlib is required
927AC_ARG_WITH(zlib,
928 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100929 [ if test "x$withval" = "xno" ; then
930 AC_MSG_ERROR([*** zlib is required ***])
931 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700932 if test -d "$withval/lib"; then
933 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700934 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700935 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700936 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700937 fi
938 else
939 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700940 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700941 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700942 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700943 fi
944 fi
945 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700946 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700947 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700948 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700949 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100950 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700951)
952
Tim Ricefcb62202004-01-23 18:35:16 -0800953AC_CHECK_LIB(z, deflate, ,
954 [
955 saved_CPPFLAGS="$CPPFLAGS"
956 saved_LDFLAGS="$LDFLAGS"
957 save_LIBS="$LIBS"
958 dnl Check default zlib install dir
959 if test -n "${need_dash_r}"; then
960 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
961 else
962 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
963 fi
964 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
965 LIBS="$LIBS -lz"
966 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
967 [
968 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
969 ]
970 )
971 ]
972)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100973AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100974
975AC_ARG_WITH(zlib-version-check,
976 [ --without-zlib-version-check Disable zlib version check],
977 [ if test "x$withval" = "xno" ; then
978 zlib_check_nonfatal=1
979 fi
980 ]
981)
982
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000983AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000984AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000985#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100986#include <zlib.h>
987int main()
988{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000989 int a=0, b=0, c=0, d=0, n, v;
990 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
991 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100992 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000993 v = a*1000000 + b*10000 + c*100 + d;
994 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
995
996 /* 1.1.4 is OK */
997 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100998 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000999
Darren Tucker41097ed2005-07-25 15:24:21 +10001000 /* 1.2.3 and up are OK */
1001 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001002 exit(0);
1003
Darren Tucker2dcd2392004-01-23 17:13:33 +11001004 exit(2);
1005}
Darren Tucker623d92f2004-09-12 22:36:15 +10001006 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001007 AC_MSG_RESULT(no),
1008 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001009 if test -z "$zlib_check_nonfatal" ; then
1010 AC_MSG_ERROR([*** zlib too old - check config.log ***
1011Your reported zlib version has known security problems. It's possible your
1012vendor has fixed these problems without changing the version number. If you
1013are sure this is the case, you can disable the check by running
1014"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001015If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001016See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001017 else
1018 AC_MSG_WARN([zlib version may have security problems])
1019 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001020 ],
1021 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001022)
Damien Miller6f9c3372000-10-25 10:06:04 +11001023
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001024dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +11001025AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001026 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
1027)
Darren Tucker5bfe1682005-11-12 18:42:36 +11001028AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -07001029 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
1030 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001031)
Damien Millerab18c411999-11-11 10:40:23 +11001032
Tim Ricee589a292001-11-03 11:09:32 -08001033dnl Checks for libutil functions
1034AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -07001035AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
1036 [Define if your libraries define login()])])
Damien Millera7058ec2008-05-20 08:57:06 +10001037AC_CHECK_FUNCS(fmt_scaled logout updwtmp logwtmp)
Tim Ricee589a292001-11-03 11:09:32 -08001038
Ben Lindstrom8697e082001-02-24 21:41:10 +00001039AC_FUNC_STRFTIME
1040
Damien Miller3c027682001-03-14 11:39:45 +11001041# Check for ALTDIRFUNC glob() extension
1042AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
1043AC_EGREP_CPP(FOUNDIT,
1044 [
1045 #include <glob.h>
1046 #ifdef GLOB_ALTDIRFUNC
1047 FOUNDIT
1048 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001049 ],
Damien Miller3c027682001-03-14 11:39:45 +11001050 [
Tim Rice7df8d392005-09-19 09:33:39 -07001051 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
1052 [Define if your system glob() function has
1053 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +11001054 AC_MSG_RESULT(yes)
1055 ],
1056 [
1057 AC_MSG_RESULT(no)
1058 ]
1059)
Damien Millerab18c411999-11-11 10:40:23 +11001060
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001061# Check for g.gl_matchc glob() extension
1062AC_MSG_CHECKING(for gl_matchc field in glob_t)
Darren Tucker486d95e2006-03-15 21:31:39 +11001063AC_TRY_COMPILE(
Damien Milleraf87af12006-03-15 13:02:28 +11001064 [ #include <glob.h> ],
1065 [glob_t g; g.gl_matchc = 1;],
Damien Millera8e06ce2003-11-21 23:48:55 +11001066 [
Tim Rice7df8d392005-09-19 09:33:39 -07001067 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1068 [Define if your system glob() function has
1069 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +11001070 AC_MSG_RESULT(yes)
1071 ],
1072 [
1073 AC_MSG_RESULT(no)
1074 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001075)
1076
Darren Tucker096faec2006-09-01 20:29:10 +10001077AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1078
Damien Miller18bb4732001-03-28 14:35:30 +10001079AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001080AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001081 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +10001082#include <sys/types.h>
1083#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001084int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +10001085 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001086 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +10001087 [
1088 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001089 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +11001090 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001091 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001092 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001093 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001094 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1095 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +10001096 ]
1097)
1098
Damien Miller36f49652004-08-15 18:40:59 +10001099AC_MSG_CHECKING([for /proc/pid/fd directory])
1100if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07001101 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +10001102 AC_MSG_RESULT(yes)
1103else
1104 AC_MSG_RESULT(no)
1105fi
1106
Damien Millerc547bf12001-02-16 10:18:12 +11001107# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001108SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001109AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001110 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001111 [
1112 if test "x$withval" != "xno" ; then
1113
1114 if test "x$withval" != "xyes" ; then
1115 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1116 LDFLAGS="$LDFLAGS -L${withval}/lib"
1117 fi
1118
Tim Rice7df8d392005-09-19 09:33:39 -07001119 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001120 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001121 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001122
Tim Rice4cec93f2002-02-26 08:40:48 -08001123 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001124 AC_LINK_IFELSE(
1125 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001126#include <stdio.h>
1127#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001128int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +10001129 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001130 [AC_MSG_RESULT(yes)],
1131 [
1132 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +11001133 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1134 ])
Darren Tucker3b908f62004-04-14 15:26:39 +10001135 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1136 AC_TRY_COMPILE(
1137 [#include <stdio.h>
1138 #include <skey.h>],
1139 [(void)skeychallenge(NULL,"name","",0);],
1140 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001141 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1142 [Define if your skeychallenge()
1143 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +10001144 [AC_MSG_RESULT(no)]
1145 )
Damien Millerc547bf12001-02-16 10:18:12 +11001146 fi
1147 ]
1148)
1149
1150# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001151TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001152AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001153 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001154 [
1155 if test "x$withval" != "xno" ; then
1156 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001157 saved_LDFLAGS="$LDFLAGS"
1158 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001159 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001160 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001161 if test -d "${withval}/lib"; then
1162 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001163 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001164 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001165 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001166 fi
1167 else
1168 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001169 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001170 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001171 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001172 fi
1173 fi
1174 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001175 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001176 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001177 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001178 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001179 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001180 LIBS="-lwrap $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001181 AC_MSG_CHECKING(for libwrap)
1182 AC_TRY_LINK(
1183 [
Damien Miller0ac45002004-04-14 20:14:26 +10001184#include <sys/types.h>
1185#include <sys/socket.h>
1186#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001187#include <tcpd.h>
1188 int deny_severity = 0, allow_severity = 0;
1189 ],
1190 [hosts_access(0);],
1191 [
1192 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001193 AC_DEFINE(LIBWRAP, 1,
1194 [Define if you want
1195 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001196 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001197 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001198 ],
1199 [
1200 AC_MSG_ERROR([*** libwrap missing])
1201 ]
1202 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001203 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001204 fi
1205 ]
1206)
1207
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001208# Check whether user wants libedit support
1209LIBEDIT_MSG="no"
1210AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001211 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001212 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001213 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001214 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1215 if test -n "${need_dash_r}"; then
1216 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1217 else
1218 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1219 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001220 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001221 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001222 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001223 LIBEDIT="-ledit -lcurses"
1224 LIBEDIT_MSG="yes"
1225 AC_SUBST(LIBEDIT)
1226 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001227 [ AC_MSG_ERROR(libedit not found) ],
1228 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001229 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001230 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001231 AC_COMPILE_IFELSE(
1232 [AC_LANG_SOURCE([[
1233#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001234int main(void)
1235{
1236 int i = H_SETSIZE;
1237 el_init("", NULL, NULL, NULL);
1238 exit(0);
1239}
Tim Ricec1819c82005-08-15 17:48:40 -07001240 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001241 [ AC_MSG_RESULT(yes) ],
1242 [ AC_MSG_RESULT(no)
1243 AC_MSG_ERROR(libedit version is not compatible) ]
1244 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001245 fi ]
1246)
1247
Darren Tuckerd9f88912005-02-20 21:01:48 +11001248AUDIT_MODULE=none
1249AC_ARG_WITH(audit,
1250 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1251 [
1252 AC_MSG_CHECKING(for supported audit module)
1253 case "$withval" in
1254 bsm)
1255 AC_MSG_RESULT(bsm)
1256 AUDIT_MODULE=bsm
1257 dnl Checks for headers, libs and functions
1258 AC_CHECK_HEADERS(bsm/audit.h, [],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001259 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1260 [
1261#ifdef HAVE_TIME_H
1262# include <time.h>
1263#endif
1264 ]
1265)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001266 AC_CHECK_LIB(bsm, getaudit, [],
1267 [AC_MSG_ERROR(BSM enabled and required library not found)])
1268 AC_CHECK_FUNCS(getaudit, [],
1269 [AC_MSG_ERROR(BSM enabled and required function not found)])
1270 # These are optional
Darren Tuckeracada072008-02-25 21:05:04 +11001271 AC_CHECK_FUNCS(getaudit_addr aug_get_machine)
Tim Rice7df8d392005-09-19 09:33:39 -07001272 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001273 ;;
1274 debug)
1275 AUDIT_MODULE=debug
1276 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001277 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001278 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001279 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001280 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001281 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001282 *)
1283 AC_MSG_ERROR([Unknown audit module $withval])
1284 ;;
1285 esac ]
1286)
1287
Damien Millerfe1f1432003-02-24 15:45:42 +11001288dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001289AC_CHECK_FUNCS( \
1290 arc4random \
Damien Millera4be7c22008-05-19 14:47:37 +10001291 arc4random_buf \
1292 arc4random_uniform \
Damien Miller57f39152005-11-24 19:58:19 +11001293 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001294 b64_ntop \
1295 __b64_ntop \
1296 b64_pton \
1297 __b64_pton \
1298 bcopy \
1299 bindresvport_sa \
1300 clock \
1301 closefrom \
1302 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001303 fchmod \
1304 fchown \
1305 freeaddrinfo \
1306 futimes \
1307 getaddrinfo \
1308 getcwd \
1309 getgrouplist \
1310 getnameinfo \
1311 getopt \
1312 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001313 getpeerucred \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001314 _getpty \
1315 getrlimit \
1316 getttyent \
1317 glob \
1318 inet_aton \
1319 inet_ntoa \
1320 inet_ntop \
1321 innetgr \
1322 login_getcapbool \
1323 md5_crypt \
1324 memmove \
1325 mkdtemp \
1326 mmap \
1327 ngetaddrinfo \
1328 nsleep \
1329 ogetaddrinfo \
1330 openlog_r \
1331 openpty \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001332 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001333 prctl \
1334 pstat \
1335 readpassphrase \
1336 realpath \
1337 recvmsg \
1338 rresvport_af \
1339 sendmsg \
1340 setdtablesize \
1341 setegid \
1342 setenv \
1343 seteuid \
1344 setgroups \
1345 setlogin \
1346 setpcred \
1347 setproctitle \
1348 setregid \
1349 setreuid \
1350 setrlimit \
1351 setsid \
1352 setvbuf \
1353 sigaction \
1354 sigvec \
1355 snprintf \
1356 socketpair \
1357 strdup \
1358 strerror \
1359 strlcat \
1360 strlcpy \
1361 strmode \
1362 strnvis \
1363 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001364 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001365 strtoul \
Damien Miller34a17692007-06-11 14:15:42 +10001366 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001367 sysconf \
1368 tcgetpgrp \
1369 truncate \
1370 unsetenv \
1371 updwtmpx \
Damien Miller57f39152005-11-24 19:58:19 +11001372 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001373 vhangup \
1374 vsnprintf \
1375 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001376)
Tim Rice13aae5e2001-10-21 17:53:58 -07001377
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001378# IRIX has a const char return value for gai_strerror()
1379AC_CHECK_FUNCS(gai_strerror,[
1380 AC_DEFINE(HAVE_GAI_STRERROR)
1381 AC_TRY_COMPILE([
1382#include <sys/types.h>
1383#include <sys/socket.h>
1384#include <netdb.h>
1385
1386const char *gai_strerror(int);],[
1387char *str;
1388
1389str = gai_strerror(0);],[
1390 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1391 [Define if gai_strerror() returns const char *])])])
1392
Tim Rice7df8d392005-09-19 09:33:39 -07001393AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1394 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001395
Darren Tuckerf1159b52003-07-07 19:44:01 +10001396dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001397AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001398AC_CHECK_DECL(strsep,
1399 [AC_CHECK_FUNCS(strsep)],
1400 [],
1401 [
1402#ifdef HAVE_STRING_H
1403# include <string.h>
1404#endif
1405 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001406
Darren Tuckerb2427c82003-09-10 15:22:44 +10001407dnl tcsendbreak might be a macro
1408AC_CHECK_DECL(tcsendbreak,
1409 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001410 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001411 [#include <termios.h>]
1412)
1413
Darren Tucker5bb14002004-04-23 18:53:10 +10001414AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1415
Darren Tucker128a0892006-07-12 19:02:56 +10001416AC_CHECK_DECLS(SHUT_RD, , ,
1417 [
1418#include <sys/types.h>
1419#include <sys/socket.h>
1420 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001421
1422AC_CHECK_DECLS(O_NONBLOCK, , ,
1423 [
1424#include <sys/types.h>
1425#ifdef HAVE_SYS_STAT_H
1426# include <sys/stat.h>
1427#endif
1428#ifdef HAVE_FCNTL_H
1429# include <fcntl.h>
1430#endif
1431 ])
1432
Darren Tuckered0b5922006-09-03 22:44:49 +10001433AC_CHECK_DECLS(writev, , , [
1434#include <sys/types.h>
1435#include <sys/uio.h>
1436#include <unistd.h>
1437 ])
1438
Darren Tucker6d862a52007-04-29 14:39:02 +10001439AC_CHECK_DECLS(MAXSYMLINKS, , , [
1440#include <sys/param.h>
1441 ])
1442
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001443AC_CHECK_DECLS(offsetof, , , [
1444#include <stddef.h>
1445 ])
1446
Darren Tucker2a6b0292003-12-31 14:59:17 +11001447AC_CHECK_FUNCS(setresuid, [
1448 dnl Some platorms have setresuid that isn't implemented, test for this
1449 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001450 AC_RUN_IFELSE(
1451 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001452#include <stdlib.h>
1453#include <errno.h>
1454int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001455 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001456 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001457 [AC_DEFINE(BROKEN_SETRESUID, 1,
1458 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001459 AC_MSG_RESULT(not implemented)],
1460 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001461 )
1462])
Darren Tuckere937be32003-12-17 18:53:26 +11001463
Darren Tucker2a6b0292003-12-31 14:59:17 +11001464AC_CHECK_FUNCS(setresgid, [
1465 dnl Some platorms have setresgid that isn't implemented, test for this
1466 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001467 AC_RUN_IFELSE(
1468 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001469#include <stdlib.h>
1470#include <errno.h>
1471int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001472 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001473 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001474 [AC_DEFINE(BROKEN_SETRESGID, 1,
1475 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001476 AC_MSG_RESULT(not implemented)],
1477 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001478 )
1479])
Darren Tuckere937be32003-12-17 18:53:26 +11001480
Damien Millerad833b32000-08-23 10:46:23 +10001481dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001482AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001483dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001484AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001485AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001486dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001487AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001488AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001489
Damien Millera8e06ce2003-11-21 23:48:55 +11001490AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001491 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1492 [AC_CHECK_LIB(bsd, daemon,
1493 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001494)
1495
Damien Millera8e06ce2003-11-21 23:48:55 +11001496AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001497 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1498 [Define if your libraries define getpagesize()])],
1499 [AC_CHECK_LIB(ucb, getpagesize,
1500 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001501)
1502
Damien Millercb170cb2000-07-01 16:52:55 +10001503# Check for broken snprintf
1504if test "x$ac_cv_func_snprintf" = "xyes" ; then
1505 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001506 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001507 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001508#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001509int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001510 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001511 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001512 [
1513 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001514 AC_DEFINE(BROKEN_SNPRINTF, 1,
1515 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001516 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001517 ],
1518 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001519 )
1520fi
1521
Damien Miller57f39152005-11-24 19:58:19 +11001522# If we don't have a working asprintf, then we strongly depend on vsnprintf
1523# returning the right thing on overflow: the number of characters it tried to
1524# create (as per SUSv3)
1525if test "x$ac_cv_func_asprintf" != "xyes" && \
1526 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1527 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1528 AC_RUN_IFELSE(
1529 [AC_LANG_SOURCE([[
1530#include <sys/types.h>
1531#include <stdio.h>
1532#include <stdarg.h>
1533
1534int x_snprintf(char *str,size_t count,const char *fmt,...)
1535{
1536 size_t ret; va_list ap;
1537 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1538 return ret;
1539}
1540int main(void)
1541{
1542 char x[1];
1543 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1544} ]])],
1545 [AC_MSG_RESULT(yes)],
1546 [
1547 AC_MSG_RESULT(no)
1548 AC_DEFINE(BROKEN_SNPRINTF, 1,
1549 [Define if your snprintf is busted])
1550 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1551 ],
1552 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1553 )
1554fi
1555
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001556# On systems where [v]snprintf is broken, but is declared in stdio,
1557# check that the fmt argument is const char * or just char *.
1558# This is only useful for when BROKEN_SNPRINTF
1559AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1560AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1561 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1562 int main(void) { snprintf(0, 0, 0); }
1563 ]])],
1564 [AC_MSG_RESULT(yes)
1565 AC_DEFINE(SNPRINTF_CONST, [const],
1566 [Define as const if snprintf() can declare const char *fmt])],
1567 [AC_MSG_RESULT(no)
1568 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1569
Damien Millerb4097182004-05-23 14:09:40 +10001570# Check for missing getpeereid (or equiv) support
1571NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001572if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001573 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1574 AC_TRY_COMPILE(
1575 [#include <sys/types.h>
1576 #include <sys/socket.h>],
1577 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001578 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001579 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001580 ],
Damien Millerb4097182004-05-23 14:09:40 +10001581 [AC_MSG_RESULT(no)
1582 NO_PEERCHECK=1]
1583 )
1584fi
1585
Damien Millere8328192003-01-07 15:18:32 +11001586dnl see whether mkstemp() requires XXXXXX
1587if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1588AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001589AC_RUN_IFELSE(
1590 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001591#include <stdlib.h>
1592main() { char template[]="conftest.mkstemp-test";
1593if (mkstemp(template) == -1)
1594 exit(1);
1595unlink(template); exit(0);
1596}
Darren Tucker314d89e2005-10-17 23:29:23 +10001597 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001598 [
1599 AC_MSG_RESULT(no)
1600 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001601 [
Damien Millere8328192003-01-07 15:18:32 +11001602 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001603 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001604 ],
1605 [
1606 AC_MSG_RESULT(yes)
1607 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001608 ]
Damien Millere8328192003-01-07 15:18:32 +11001609)
1610fi
1611
Darren Tucker70a3d552003-08-21 17:58:29 +10001612dnl make sure that openpty does not reacquire controlling terminal
1613if test ! -z "$check_for_openpty_ctty_bug"; then
1614 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001615 AC_RUN_IFELSE(
1616 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001617#include <stdio.h>
1618#include <sys/fcntl.h>
1619#include <sys/types.h>
1620#include <sys/wait.h>
1621
1622int
1623main()
1624{
1625 pid_t pid;
1626 int fd, ptyfd, ttyfd, status;
1627
1628 pid = fork();
1629 if (pid < 0) { /* failed */
1630 exit(1);
1631 } else if (pid > 0) { /* parent */
1632 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001633 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001634 exit(WEXITSTATUS(status));
1635 else
1636 exit(2);
1637 } else { /* child */
1638 close(0); close(1); close(2);
1639 setsid();
1640 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1641 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1642 if (fd >= 0)
1643 exit(3); /* Acquired ctty: broken */
1644 else
1645 exit(0); /* Did not acquire ctty: OK */
1646 }
1647}
Darren Tucker314d89e2005-10-17 23:29:23 +10001648 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001649 [
1650 AC_MSG_RESULT(yes)
1651 ],
1652 [
1653 AC_MSG_RESULT(no)
1654 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001655 ],
1656 [
1657 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001658 ]
1659 )
1660fi
1661
Tim Rice8bb561b2005-03-17 16:23:19 -08001662if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1663 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001664 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001665 AC_RUN_IFELSE(
1666 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001667#include <stdio.h>
1668#include <sys/socket.h>
1669#include <netdb.h>
1670#include <errno.h>
1671#include <netinet/in.h>
1672
1673#define TEST_PORT "2222"
1674
1675int
1676main(void)
1677{
1678 int err, sock;
1679 struct addrinfo *gai_ai, *ai, hints;
1680 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1681
1682 memset(&hints, 0, sizeof(hints));
1683 hints.ai_family = PF_UNSPEC;
1684 hints.ai_socktype = SOCK_STREAM;
1685 hints.ai_flags = AI_PASSIVE;
1686
1687 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1688 if (err != 0) {
1689 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1690 exit(1);
1691 }
1692
1693 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1694 if (ai->ai_family != AF_INET6)
1695 continue;
1696
1697 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1698 sizeof(ntop), strport, sizeof(strport),
1699 NI_NUMERICHOST|NI_NUMERICSERV);
1700
1701 if (err != 0) {
1702 if (err == EAI_SYSTEM)
1703 perror("getnameinfo EAI_SYSTEM");
1704 else
1705 fprintf(stderr, "getnameinfo failed: %s\n",
1706 gai_strerror(err));
1707 exit(2);
1708 }
1709
1710 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1711 if (sock < 0)
1712 perror("socket");
1713 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1714 if (errno == EBADF)
1715 exit(3);
1716 }
1717 }
1718 exit(0);
1719}
Darren Tucker314d89e2005-10-17 23:29:23 +10001720 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001721 [
1722 AC_MSG_RESULT(yes)
1723 ],
1724 [
1725 AC_MSG_RESULT(no)
1726 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001727 ],
1728 [
1729 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001730 ]
1731 )
1732fi
1733
Tim Rice8bb561b2005-03-17 16:23:19 -08001734if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1735 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001736 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001737 AC_RUN_IFELSE(
1738 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001739#include <stdio.h>
1740#include <sys/socket.h>
1741#include <netdb.h>
1742#include <errno.h>
1743#include <netinet/in.h>
1744
1745#define TEST_PORT "2222"
1746
1747int
1748main(void)
1749{
1750 int err, sock;
1751 struct addrinfo *gai_ai, *ai, hints;
1752 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1753
1754 memset(&hints, 0, sizeof(hints));
1755 hints.ai_family = PF_UNSPEC;
1756 hints.ai_socktype = SOCK_STREAM;
1757 hints.ai_flags = AI_PASSIVE;
1758
1759 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1760 if (err != 0) {
1761 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1762 exit(1);
1763 }
1764
1765 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1766 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1767 continue;
1768
1769 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1770 sizeof(ntop), strport, sizeof(strport),
1771 NI_NUMERICHOST|NI_NUMERICSERV);
1772
1773 if (ai->ai_family == AF_INET && err != 0) {
1774 perror("getnameinfo");
1775 exit(2);
1776 }
1777 }
1778 exit(0);
1779}
Darren Tucker314d89e2005-10-17 23:29:23 +10001780 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001781 [
1782 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001783 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1784 [Define if you have a getaddrinfo that fails
1785 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001786 ],
1787 [
1788 AC_MSG_RESULT(no)
1789 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001790 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10001791 [
Darren Tucker314d89e2005-10-17 23:29:23 +10001792 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001793 ]
1794 )
1795fi
1796
Darren Tuckera56f1912004-11-02 20:30:54 +11001797if test "x$check_for_conflicting_getspnam" = "x1"; then
1798 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1799 AC_COMPILE_IFELSE(
1800 [
1801#include <shadow.h>
1802int main(void) {exit(0);}
1803 ],
1804 [
1805 AC_MSG_RESULT(no)
1806 ],
1807 [
1808 AC_MSG_RESULT(yes)
1809 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1810 [Conflicting defs for getspnam])
1811 ]
1812 )
1813fi
1814
Damien Miller606f8802000-09-16 15:39:56 +11001815AC_FUNC_GETPGRP
1816
Tim Riceaef73712002-05-11 13:17:42 -07001817# Search for OpenSSL
1818saved_CPPFLAGS="$CPPFLAGS"
1819saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001820AC_ARG_WITH(ssl-dir,
1821 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1822 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001823 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001824 case "$withval" in
1825 # Relative paths
1826 ./*|../*) withval="`pwd`/$withval"
1827 esac
Tim Riceaef73712002-05-11 13:17:42 -07001828 if test -d "$withval/lib"; then
1829 if test -n "${need_dash_r}"; then
1830 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1831 else
1832 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1833 fi
1834 else
1835 if test -n "${need_dash_r}"; then
1836 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1837 else
1838 LDFLAGS="-L${withval} ${LDFLAGS}"
1839 fi
1840 fi
1841 if test -d "$withval/include"; then
1842 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1843 else
1844 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1845 fi
Damien Millera22ba012000-03-02 23:09:20 +11001846 fi
1847 ]
1848)
Tim Rice3d5352e2004-02-12 09:27:21 -08001849LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001850AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1851 [Define if your ssl headers are included
1852 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001853 [
Tim Riceaef73712002-05-11 13:17:42 -07001854 dnl Check default openssl install dir
1855 if test -n "${need_dash_r}"; then
1856 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001857 else
Tim Riceaef73712002-05-11 13:17:42 -07001858 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001859 fi
Tim Riceaef73712002-05-11 13:17:42 -07001860 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1861 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1862 [
1863 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1864 ]
1865 )
1866 ]
1867)
1868
Tim Riced730b782002-08-13 18:52:10 -07001869# Determine OpenSSL header version
1870AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001871AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001872 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001873#include <stdio.h>
1874#include <string.h>
1875#include <openssl/opensslv.h>
1876#define DATA "conftest.sslincver"
1877int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001878 FILE *fd;
1879 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001880
Damien Millera8e06ce2003-11-21 23:48:55 +11001881 fd = fopen(DATA,"w");
1882 if(fd == NULL)
1883 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001884
1885 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1886 exit(1);
1887
1888 exit(0);
1889}
Darren Tucker623d92f2004-09-12 22:36:15 +10001890 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001891 [
1892 ssl_header_ver=`cat conftest.sslincver`
1893 AC_MSG_RESULT($ssl_header_ver)
1894 ],
1895 [
1896 AC_MSG_RESULT(not found)
1897 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001898 ],
1899 [
1900 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001901 ]
1902)
1903
1904# Determine OpenSSL library version
1905AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001906AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001907 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001908#include <stdio.h>
1909#include <string.h>
1910#include <openssl/opensslv.h>
1911#include <openssl/crypto.h>
1912#define DATA "conftest.ssllibver"
1913int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001914 FILE *fd;
1915 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001916
Damien Millera8e06ce2003-11-21 23:48:55 +11001917 fd = fopen(DATA,"w");
1918 if(fd == NULL)
1919 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001920
1921 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1922 exit(1);
1923
1924 exit(0);
1925}
Darren Tucker623d92f2004-09-12 22:36:15 +10001926 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001927 [
1928 ssl_library_ver=`cat conftest.ssllibver`
1929 AC_MSG_RESULT($ssl_library_ver)
1930 ],
1931 [
1932 AC_MSG_RESULT(not found)
1933 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001934 ],
1935 [
1936 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001937 ]
1938)
Damien Millera22ba012000-03-02 23:09:20 +11001939
Damien Miller9975e482007-03-05 11:51:27 +11001940AC_ARG_WITH(openssl-header-check,
1941 [ --without-openssl-header-check Disable OpenSSL version consistency check],
1942 [ if test "x$withval" = "xno" ; then
1943 openssl_check_nonfatal=1
1944 fi
1945 ]
1946)
1947
Damien Millerec932372002-01-22 22:16:03 +11001948# Sanity check OpenSSL headers
1949AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001950AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001951 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001952#include <string.h>
1953#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001954int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001955 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001956 [
1957 AC_MSG_RESULT(yes)
1958 ],
1959 [
1960 AC_MSG_RESULT(no)
Damien Miller9975e482007-03-05 11:51:27 +11001961 if test "x$openssl_check_nonfatal" = "x"; then
1962 AC_MSG_ERROR([Your OpenSSL headers do not match your
1963library. Check config.log for details.
1964If you are sure your installation is consistent, you can disable the check
1965by running "./configure --without-openssl-header-check".
1966Also see contrib/findssl.sh for help identifying header/library mismatches.
1967])
1968 else
1969 AC_MSG_WARN([Your OpenSSL headers do not match your
1970library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10001971Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11001972 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001973 ],
1974 [
1975 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001976 ]
1977)
1978
Darren Tucker639bbe82006-08-20 20:17:53 +10001979AC_MSG_CHECKING([if programs using OpenSSL functions will link])
1980AC_LINK_IFELSE(
1981 [AC_LANG_SOURCE([[
1982#include <openssl/evp.h>
1983int main(void) { SSLeay_add_all_algorithms(); }
1984 ]])],
1985 [
1986 AC_MSG_RESULT(yes)
1987 ],
1988 [
1989 AC_MSG_RESULT(no)
1990 saved_LIBS="$LIBS"
1991 LIBS="$LIBS -ldl"
1992 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
1993 AC_LINK_IFELSE(
1994 [AC_LANG_SOURCE([[
1995#include <openssl/evp.h>
1996int main(void) { SSLeay_add_all_algorithms(); }
1997 ]])],
1998 [
1999 AC_MSG_RESULT(yes)
2000 ],
2001 [
2002 AC_MSG_RESULT(no)
2003 LIBS="$saved_LIBS"
2004 ]
2005 )
2006 ]
2007)
2008
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002009AC_ARG_WITH(ssl-engine,
2010 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2011 [ if test "x$withval" != "xno" ; then
2012 AC_MSG_CHECKING(for OpenSSL ENGINE support)
2013 AC_TRY_COMPILE(
2014 [ #include <openssl/engine.h>],
2015 [
Darren Tucker5e8381e2006-09-29 20:16:51 +10002016ENGINE_load_builtin_engines();ENGINE_register_all_complete();
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002017 ],
2018 [ AC_MSG_RESULT(yes)
2019 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
2020 [Enable OpenSSL engine support])
2021 ],
2022 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
2023 )
2024 fi ]
2025)
2026
Darren Tucker129d0bb2005-12-19 17:40:40 +11002027# Check for OpenSSL without EVP_aes_{192,256}_cbc
2028AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002029AC_LINK_IFELSE(
Darren Tucker129d0bb2005-12-19 17:40:40 +11002030 [AC_LANG_SOURCE([[
2031#include <string.h>
2032#include <openssl/evp.h>
Darren Tuckercc7c2122006-02-02 18:44:19 +11002033int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
Darren Tucker129d0bb2005-12-19 17:40:40 +11002034 ]])],
2035 [
2036 AC_MSG_RESULT(no)
2037 ],
2038 [
2039 AC_MSG_RESULT(yes)
2040 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2041 [libcrypto is missing AES 192 and 256 bit functions])
2042 ]
2043)
2044
Tim Rice3d5352e2004-02-12 09:27:21 -08002045# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2046# because the system crypt() is more featureful.
2047if test "x$check_for_libcrypt_before" = "x1"; then
2048 AC_CHECK_LIB(crypt, crypt)
2049fi
2050
Damien Millera8e06ce2003-11-21 23:48:55 +11002051# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002052# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002053if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11002054 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11002055fi
2056
Damien Milleraf87af12006-03-15 13:02:28 +11002057# Search for SHA256 support in libc and/or OpenSSL
2058AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
2059
Tim Rice99203ec2007-03-26 09:35:28 -07002060saved_LIBS="$LIBS"
2061AC_CHECK_LIB(iaf, ia_openinfo, [
2062 LIBS="$LIBS -liaf"
Tim Rice0eeaf122007-09-10 16:24:17 -07002063 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
2064 AC_DEFINE(HAVE_LIBIAF, 1,
2065 [Define if system has libiaf that supports set_id])
2066 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002067])
2068LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002069
2070### Configure cryptographic random number support
2071
2072# Check wheter OpenSSL seeds itself
2073AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002074AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002075 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11002076#include <string.h>
2077#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07002078int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10002079 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002080 [
2081 OPENSSL_SEEDS_ITSELF=yes
2082 AC_MSG_RESULT(yes)
2083 ],
2084 [
2085 AC_MSG_RESULT(no)
2086 # Default to use of the rand helper if OpenSSL doesn't
2087 # seed itself
2088 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10002089 ],
2090 [
2091 AC_MSG_WARN([cross compiling: assuming yes])
2092 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08002093 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002094 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002095 ]
2096)
2097
Darren Tucker3e6bde42006-08-20 20:03:50 +10002098# Check for PAM libs
2099PAM_MSG="no"
2100AC_ARG_WITH(pam,
2101 [ --with-pam Enable PAM support ],
2102 [
2103 if test "x$withval" != "xno" ; then
2104 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2105 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2106 AC_MSG_ERROR([PAM headers not found])
2107 fi
2108
2109 saved_LIBS="$LIBS"
2110 AC_CHECK_LIB(dl, dlopen, , )
2111 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2112 AC_CHECK_FUNCS(pam_getenvlist)
2113 AC_CHECK_FUNCS(pam_putenv)
2114 LIBS="$saved_LIBS"
2115
2116 PAM_MSG="yes"
2117
Darren Tucker20e9f972007-03-25 18:26:01 +10002118 SSHDLIBS="$SSHDLIBS -lpam"
Darren Tucker3e6bde42006-08-20 20:03:50 +10002119 AC_DEFINE(USE_PAM, 1,
2120 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002121
Darren Tucker3e6bde42006-08-20 20:03:50 +10002122 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002123 case "$LIBS" in
2124 *-ldl*)
2125 # libdl already in LIBS
2126 ;;
2127 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002128 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002129 ;;
2130 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002131 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002132 fi
2133 ]
2134)
2135
2136# Check for older PAM
2137if test "x$PAM_MSG" = "xyes" ; then
2138 # Check PAM strerror arguments (old PAM)
2139 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2140 AC_TRY_COMPILE(
2141 [
2142#include <stdlib.h>
2143#if defined(HAVE_SECURITY_PAM_APPL_H)
2144#include <security/pam_appl.h>
2145#elif defined (HAVE_PAM_PAM_APPL_H)
2146#include <pam/pam_appl.h>
2147#endif
2148 ],
2149 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2150 [AC_MSG_RESULT(no)],
2151 [
2152 AC_DEFINE(HAVE_OLD_PAM, 1,
2153 [Define if you have an old version of PAM
2154 which takes only one argument to pam_strerror])
2155 AC_MSG_RESULT(yes)
2156 PAM_MSG="yes (old library)"
2157 ]
2158 )
2159fi
Damien Miller6c21c512002-01-22 21:57:53 +11002160
2161# Do we want to force the use of the rand helper?
2162AC_ARG_WITH(rand-helper,
2163 [ --with-rand-helper Use subprocess to gather strong randomness ],
2164 [
2165 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002166 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11002167 # the previous test showed it to be unseeded.
2168 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2169 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2170 OPENSSL_SEEDS_ITSELF=yes
2171 USE_RAND_HELPER=""
2172 fi
2173 else
2174 USE_RAND_HELPER=yes
2175 fi
2176 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08002177)
Damien Miller6c21c512002-01-22 21:57:53 +11002178
2179# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08002180if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002181 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07002182 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2183 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11002184 RAND_MSG="OpenSSL internal ONLY"
2185 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08002186elif test ! -z "$USE_RAND_HELPER" ; then
2187 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11002188 RAND_MSG="ssh-rand-helper"
2189 INSTALL_SSH_RAND_HELPER="yes"
2190fi
2191AC_SUBST(INSTALL_SSH_RAND_HELPER)
2192
2193### Configuration of ssh-rand-helper
2194
2195# PRNGD TCP socket
2196AC_ARG_WITH(prngd-port,
2197 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2198 [
Damien Millere996d722002-01-23 11:20:59 +11002199 case "$withval" in
2200 no)
2201 withval=""
2202 ;;
2203 [[0-9]]*)
2204 ;;
2205 *)
2206 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2207 ;;
2208 esac
2209 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002210 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002211 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2212 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002213 fi
2214 ]
2215)
2216
2217# PRNGD Unix domain socket
2218AC_ARG_WITH(prngd-socket,
2219 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2220 [
Damien Millere996d722002-01-23 11:20:59 +11002221 case "$withval" in
2222 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11002223 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11002224 ;;
2225 no)
2226 withval=""
2227 ;;
2228 /*)
2229 ;;
2230 *)
2231 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2232 ;;
2233 esac
2234
2235 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002236 if test ! -z "$PRNGD_PORT" ; then
2237 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2238 fi
Damien Miller6385ba02002-01-23 08:12:36 +11002239 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002240 AC_MSG_WARN(Entropy socket is not readable)
2241 fi
2242 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002243 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2244 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002245 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08002246 ],
2247 [
2248 # Check for existing socket only if we don't have a random device already
2249 if test "$USE_RAND_HELPER" = yes ; then
2250 AC_MSG_CHECKING(for PRNGD/EGD socket)
2251 # Insert other locations here
2252 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2253 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2254 PRNGD_SOCKET="$sock"
2255 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2256 break;
2257 fi
2258 done
2259 if test ! -z "$PRNGD_SOCKET" ; then
2260 AC_MSG_RESULT($PRNGD_SOCKET)
2261 else
2262 AC_MSG_RESULT(not found)
2263 fi
2264 fi
Damien Miller6c21c512002-01-22 21:57:53 +11002265 ]
2266)
2267
2268# Change default command timeout for hashing entropy source
2269entropy_timeout=200
2270AC_ARG_WITH(entropy-timeout,
2271 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2272 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002273 if test -n "$withval" && test "x$withval" != "xno" && \
2274 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002275 entropy_timeout=$withval
2276 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002277 ]
Damien Miller6c21c512002-01-22 21:57:53 +11002278)
Tim Rice7df8d392005-09-19 09:33:39 -07002279AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2280 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11002281
Damien Millerd3f6ad22002-06-25 10:24:47 +10002282SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00002283AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00002284 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002285 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002286 if test -n "$withval" && test "x$withval" != "xno" && \
2287 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002288 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002289 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002290 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002291)
Tim Rice7df8d392005-09-19 09:33:39 -07002292AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2293 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10002294AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00002295
Tim Rice88f2ab52002-03-17 12:17:34 -08002296# We do this little dance with the search path to insure
2297# that programs that we select for use by installed programs
2298# (which may be run by the super-user) come from trusted
2299# locations before they come from the user's private area.
2300# This should help avoid accidentally configuring some
2301# random version of a program in someone's personal bin.
2302
2303OPATH=$PATH
2304PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07002305test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08002306test -d /sbin && PATH=$PATH:/sbin
2307test -d /usr/sbin && PATH=$PATH:/usr/sbin
2308PATH=$PATH:/etc:$OPATH
2309
Damien Millera8e06ce2003-11-21 23:48:55 +11002310# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11002311OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2312OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2313OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2314OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2315OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2316OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2317OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2318OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2319OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2320OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2321OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2322OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2323OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2324OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2325OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2326OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002327# restore PATH
2328PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002329
2330# Where does ssh-rand-helper get its randomness from?
2331INSTALL_SSH_PRNG_CMDS=""
2332if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2333 if test ! -z "$PRNGD_PORT" ; then
2334 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2335 elif test ! -z "$PRNGD_SOCKET" ; then
2336 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2337 else
2338 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2339 RAND_HELPER_CMDHASH=yes
2340 INSTALL_SSH_PRNG_CMDS="yes"
2341 fi
2342fi
2343AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2344
2345
Ben Lindstromb5628642000-10-18 00:02:25 +00002346# Cheap hack to ensure NEWS-OS libraries are arranged right.
2347if test ! -z "$SONY" ; then
2348 LIBS="$LIBS -liberty";
2349fi
2350
Damien Miller57f39152005-11-24 19:58:19 +11002351# Check for long long datatypes
2352AC_CHECK_TYPES([long long, unsigned long long, long double])
2353
2354# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002355AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002356AC_CHECK_SIZEOF(short int, 2)
2357AC_CHECK_SIZEOF(int, 4)
2358AC_CHECK_SIZEOF(long int, 4)
2359AC_CHECK_SIZEOF(long long int, 8)
2360
Damien Millerfa2bb692002-04-23 23:22:25 +10002361# Sanity check long long for some platforms (AIX)
2362if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2363 ac_cv_sizeof_long_long_int=0
2364fi
2365
Darren Tucker537f1ed2005-10-25 18:38:33 +10002366# compute LLONG_MIN and LLONG_MAX if we don't know them.
2367if test -z "$have_llong_max"; then
2368 AC_MSG_CHECKING([for max value of long long])
2369 AC_RUN_IFELSE(
2370 [AC_LANG_SOURCE([[
2371#include <stdio.h>
2372/* Why is this so damn hard? */
2373#ifdef __GNUC__
2374# undef __GNUC__
2375#endif
2376#define __USE_ISOC99
2377#include <limits.h>
2378#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002379#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2380
2381/*
2382 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2383 * we do this the hard way.
2384 */
2385static int
2386fprint_ll(FILE *f, long long n)
2387{
2388 unsigned int i;
2389 int l[sizeof(long long) * 8];
2390
2391 if (n < 0)
2392 if (fprintf(f, "-") < 0)
2393 return -1;
2394 for (i = 0; n != 0; i++) {
2395 l[i] = my_abs(n % 10);
2396 n /= 10;
2397 }
2398 do {
2399 if (fprintf(f, "%d", l[--i]) < 0)
2400 return -1;
2401 } while (i != 0);
2402 if (fprintf(f, " ") < 0)
2403 return -1;
2404 return 0;
2405}
2406
Darren Tucker537f1ed2005-10-25 18:38:33 +10002407int main(void) {
2408 FILE *f;
2409 long long i, llmin, llmax = 0;
2410
2411 if((f = fopen(DATA,"w")) == NULL)
2412 exit(1);
2413
2414#if defined(LLONG_MIN) && defined(LLONG_MAX)
2415 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2416 llmin = LLONG_MIN;
2417 llmax = LLONG_MAX;
2418#else
2419 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2420 /* This will work on one's complement and two's complement */
2421 for (i = 1; i > llmax; i <<= 1, i++)
2422 llmax = i;
2423 llmin = llmax + 1LL; /* wrap */
2424#endif
2425
2426 /* Sanity check */
2427 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002428 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2429 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002430 fprintf(f, "unknown unknown\n");
2431 exit(2);
2432 }
2433
Darren Tuckerd1450db2006-03-13 19:06:51 +11002434 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002435 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002436 if (fprint_ll(f, llmax) < 0)
2437 exit(4);
2438 if (fclose(f) < 0)
2439 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002440 exit(0);
2441}
2442 ]])],
2443 [
2444 llong_min=`$AWK '{print $1}' conftest.llminmax`
2445 llong_max=`$AWK '{print $2}' conftest.llminmax`
2446
Darren Tucker537f1ed2005-10-25 18:38:33 +10002447 AC_MSG_RESULT($llong_max)
2448 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2449 [max value of long long calculated by configure])
2450 AC_MSG_CHECKING([for min value of long long])
2451 AC_MSG_RESULT($llong_min)
2452 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2453 [min value of long long calculated by configure])
2454 ],
2455 [
2456 AC_MSG_RESULT(not found)
2457 ],
2458 [
2459 AC_MSG_WARN([cross compiling: not checking])
2460 ]
2461 )
2462fi
2463
2464
Damien Millera22ba012000-03-02 23:09:20 +11002465# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002466AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2467 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002468 [ #include <sys/types.h> ],
2469 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002470 [ ac_cv_have_u_int="yes" ],
2471 [ ac_cv_have_u_int="no" ]
2472 )
2473])
2474if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002475 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002476 have_u_int=1
2477fi
2478
Damien Miller61e50f12000-05-08 20:49:37 +10002479AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2480 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002481 [ #include <sys/types.h> ],
2482 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002483 [ ac_cv_have_intxx_t="yes" ],
2484 [ ac_cv_have_intxx_t="no" ]
2485 )
2486])
2487if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002488 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002489 have_intxx_t=1
2490fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002491
2492if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002493 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002494then
2495 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2496 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002497 [ #include <stdint.h> ],
2498 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002499 [
2500 AC_DEFINE(HAVE_INTXX_T)
2501 AC_MSG_RESULT(yes)
2502 ],
2503 [ AC_MSG_RESULT(no) ]
2504 )
2505fi
2506
Damien Miller578783e2000-09-23 14:12:24 +11002507AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2508 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002509 [
2510#include <sys/types.h>
2511#ifdef HAVE_STDINT_H
2512# include <stdint.h>
2513#endif
2514#include <sys/socket.h>
2515#ifdef HAVE_SYS_BITYPES_H
2516# include <sys/bitypes.h>
2517#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002518 ],
2519 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002520 [ ac_cv_have_int64_t="yes" ],
2521 [ ac_cv_have_int64_t="no" ]
2522 )
2523])
2524if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002525 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002526fi
2527
Damien Miller61e50f12000-05-08 20:49:37 +10002528AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2529 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002530 [ #include <sys/types.h> ],
2531 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002532 [ ac_cv_have_u_intxx_t="yes" ],
2533 [ ac_cv_have_u_intxx_t="no" ]
2534 )
2535])
2536if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002537 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002538 have_u_intxx_t=1
2539fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002540
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002541if test -z "$have_u_intxx_t" ; then
2542 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2543 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002544 [ #include <sys/socket.h> ],
2545 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002546 [
2547 AC_DEFINE(HAVE_U_INTXX_T)
2548 AC_MSG_RESULT(yes)
2549 ],
2550 [ AC_MSG_RESULT(no) ]
2551 )
2552fi
2553
Damien Miller578783e2000-09-23 14:12:24 +11002554AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2555 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002556 [ #include <sys/types.h> ],
2557 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002558 [ ac_cv_have_u_int64_t="yes" ],
2559 [ ac_cv_have_u_int64_t="no" ]
2560 )
2561])
2562if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002563 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002564 have_u_int64_t=1
2565fi
2566
Tim Rice4cec93f2002-02-26 08:40:48 -08002567if test -z "$have_u_int64_t" ; then
2568 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2569 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002570 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002571 [ u_int64_t a; a = 1],
2572 [
2573 AC_DEFINE(HAVE_U_INT64_T)
2574 AC_MSG_RESULT(yes)
2575 ],
2576 [ AC_MSG_RESULT(no) ]
2577 )
2578fi
2579
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002580if test -z "$have_u_intxx_t" ; then
2581 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2582 AC_TRY_COMPILE(
2583 [
2584#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002585 ],
2586 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002587 [ ac_cv_have_uintxx_t="yes" ],
2588 [ ac_cv_have_uintxx_t="no" ]
2589 )
2590 ])
2591 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002592 AC_DEFINE(HAVE_UINTXX_T, 1,
2593 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002594 fi
2595fi
2596
2597if test -z "$have_uintxx_t" ; then
2598 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2599 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002600 [ #include <stdint.h> ],
2601 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002602 [
2603 AC_DEFINE(HAVE_UINTXX_T)
2604 AC_MSG_RESULT(yes)
2605 ],
2606 [ AC_MSG_RESULT(no) ]
2607 )
2608fi
2609
Damien Milleredb82922000-06-20 13:25:52 +10002610if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002611 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002612then
2613 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2614 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002615 [
2616#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002617 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002618 [
Damien Miller70494d12000-04-03 15:57:06 +10002619 int8_t a; int16_t b; int32_t c;
2620 u_int8_t e; u_int16_t f; u_int32_t g;
2621 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002622 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002623 [
2624 AC_DEFINE(HAVE_U_INTXX_T)
2625 AC_DEFINE(HAVE_INTXX_T)
2626 AC_MSG_RESULT(yes)
2627 ],
2628 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002629 )
Damien Millerb29ea912000-01-15 14:12:03 +11002630fi
2631
Damien Miller58be7382001-09-15 21:31:54 +10002632
2633AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2634 AC_TRY_COMPILE(
2635 [
2636#include <sys/types.h>
2637 ],
2638 [ u_char foo; foo = 125; ],
2639 [ ac_cv_have_u_char="yes" ],
2640 [ ac_cv_have_u_char="no" ]
2641 )
2642])
2643if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002644 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002645fi
2646
Tim Rice13aae5e2001-10-21 17:53:58 -07002647TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002648
Tim Rice200a5c02002-02-26 22:12:34 -08002649AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002650
Damien Miller848b9932005-02-24 12:12:34 +11002651AC_CHECK_TYPES(in_addr_t,,,
2652[#include <sys/types.h>
2653#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002654
Damien Miller61e50f12000-05-08 20:49:37 +10002655AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2656 AC_TRY_COMPILE(
2657 [
2658#include <sys/types.h>
2659 ],
2660 [ size_t foo; foo = 1235; ],
2661 [ ac_cv_have_size_t="yes" ],
2662 [ ac_cv_have_size_t="no" ]
2663 )
2664])
2665if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002666 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002667fi
Damien Miller95058511999-12-29 10:36:45 +11002668
Damien Miller615f9392000-05-17 22:53:33 +10002669AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2670 AC_TRY_COMPILE(
2671 [
2672#include <sys/types.h>
2673 ],
2674 [ ssize_t foo; foo = 1235; ],
2675 [ ac_cv_have_ssize_t="yes" ],
2676 [ ac_cv_have_ssize_t="no" ]
2677 )
2678])
2679if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002680 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002681fi
2682
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002683AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2684 AC_TRY_COMPILE(
2685 [
2686#include <time.h>
2687 ],
2688 [ clock_t foo; foo = 1235; ],
2689 [ ac_cv_have_clock_t="yes" ],
2690 [ ac_cv_have_clock_t="no" ]
2691 )
2692])
2693if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002694 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002695fi
2696
Damien Millerb54b40e2000-06-23 08:23:34 +10002697AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2698 AC_TRY_COMPILE(
2699 [
2700#include <sys/types.h>
2701#include <sys/socket.h>
2702 ],
2703 [ sa_family_t foo; foo = 1235; ],
2704 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002705 [ AC_TRY_COMPILE(
2706 [
2707#include <sys/types.h>
2708#include <sys/socket.h>
2709#include <netinet/in.h>
2710 ],
2711 [ sa_family_t foo; foo = 1235; ],
2712 [ ac_cv_have_sa_family_t="yes" ],
2713
Damien Millerb54b40e2000-06-23 08:23:34 +10002714 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002715 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002716 )
2717])
2718if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002719 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2720 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002721fi
2722
Damien Miller0f91b4e2000-06-18 15:43:25 +10002723AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2724 AC_TRY_COMPILE(
2725 [
2726#include <sys/types.h>
2727 ],
2728 [ pid_t foo; foo = 1235; ],
2729 [ ac_cv_have_pid_t="yes" ],
2730 [ ac_cv_have_pid_t="no" ]
2731 )
2732])
2733if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002734 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002735fi
2736
2737AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2738 AC_TRY_COMPILE(
2739 [
2740#include <sys/types.h>
2741 ],
2742 [ mode_t foo; foo = 1235; ],
2743 [ ac_cv_have_mode_t="yes" ],
2744 [ ac_cv_have_mode_t="no" ]
2745 )
2746])
2747if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002748 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002749fi
2750
Damien Miller61e50f12000-05-08 20:49:37 +10002751
2752AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2753 AC_TRY_COMPILE(
2754 [
Damien Miller81171112000-04-23 11:14:01 +10002755#include <sys/types.h>
2756#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002757 ],
2758 [ struct sockaddr_storage s; ],
2759 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2760 [ ac_cv_have_struct_sockaddr_storage="no" ]
2761 )
2762])
2763if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002764 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2765 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002766fi
Damien Miller34132e52000-01-14 15:45:46 +11002767
Damien Miller61e50f12000-05-08 20:49:37 +10002768AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2769 AC_TRY_COMPILE(
2770 [
Damien Miller7b22d652000-06-18 14:07:04 +10002771#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002772#include <netinet/in.h>
2773 ],
2774 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2775 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2776 [ ac_cv_have_struct_sockaddr_in6="no" ]
2777 )
2778])
2779if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002780 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2781 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002782fi
Damien Miller34132e52000-01-14 15:45:46 +11002783
Damien Miller61e50f12000-05-08 20:49:37 +10002784AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2785 AC_TRY_COMPILE(
2786 [
Damien Miller7b22d652000-06-18 14:07:04 +10002787#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002788#include <netinet/in.h>
2789 ],
2790 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2791 [ ac_cv_have_struct_in6_addr="yes" ],
2792 [ ac_cv_have_struct_in6_addr="no" ]
2793 )
2794])
2795if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002796 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2797 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002798fi
Damien Miller34132e52000-01-14 15:45:46 +11002799
Damien Miller61e50f12000-05-08 20:49:37 +10002800AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2801 AC_TRY_COMPILE(
2802 [
Damien Miller81171112000-04-23 11:14:01 +10002803#include <sys/types.h>
2804#include <sys/socket.h>
2805#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002806 ],
2807 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2808 [ ac_cv_have_struct_addrinfo="yes" ],
2809 [ ac_cv_have_struct_addrinfo="no" ]
2810 )
2811])
2812if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002813 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2814 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002815fi
2816
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002817AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2818 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002819 [ #include <sys/time.h> ],
2820 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002821 [ ac_cv_have_struct_timeval="yes" ],
2822 [ ac_cv_have_struct_timeval="no" ]
2823 )
2824])
2825if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002826 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002827 have_struct_timeval=1
2828fi
2829
Tim Rice4e4dc562003-03-18 10:21:40 -08002830AC_CHECK_TYPES(struct timespec)
2831
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002832# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002833if test "x$ac_cv_have_int64_t" = "xno" && \
2834 test "x$ac_cv_sizeof_long_int" != "x8" && \
2835 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002836 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2837 echo "an alternative compiler (I.E., GCC) before continuing."
2838 echo ""
2839 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002840else
2841dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002842 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002843 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002844#include <stdio.h>
2845#include <string.h>
2846#ifdef HAVE_SNPRINTF
2847main()
2848{
2849 char buf[50];
2850 char expected_out[50];
2851 int mazsize = 50 ;
2852#if (SIZEOF_LONG_INT == 8)
2853 long int num = 0x7fffffffffffffff;
2854#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002855 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002856#endif
2857 strcpy(expected_out, "9223372036854775807");
2858 snprintf(buf, mazsize, "%lld", num);
2859 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002860 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002861 exit(0);
2862}
2863#else
2864main() { exit(0); }
2865#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002866 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002867 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002868 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002869fi
2870
Damien Miller78315eb2000-09-29 23:01:36 +11002871dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002872OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2873OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2874OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2875OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2876OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002877OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002878OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2879OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002880OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002881OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2882OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2883OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2884OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002885OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2886OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2887OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2888OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002889
2890AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11002891AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2892 [Define if we don't have struct __res_state in resolv.h])],
2893[
2894#include <stdio.h>
2895#if HAVE_SYS_TYPES_H
2896# include <sys/types.h>
2897#endif
2898#include <netinet/in.h>
2899#include <arpa/nameser.h>
2900#include <resolv.h>
2901])
andre2ff7b5d2000-06-03 14:57:40 +00002902
Damien Miller61e50f12000-05-08 20:49:37 +10002903AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2904 ac_cv_have_ss_family_in_struct_ss, [
2905 AC_TRY_COMPILE(
2906 [
Damien Miller81171112000-04-23 11:14:01 +10002907#include <sys/types.h>
2908#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002909 ],
2910 [ struct sockaddr_storage s; s.ss_family = 1; ],
2911 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2912 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2913 )
2914])
2915if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002916 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002917fi
2918
Damien Miller61e50f12000-05-08 20:49:37 +10002919AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2920 ac_cv_have___ss_family_in_struct_ss, [
2921 AC_TRY_COMPILE(
2922 [
Damien Miller81171112000-04-23 11:14:01 +10002923#include <sys/types.h>
2924#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002925 ],
2926 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2927 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2928 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2929 )
2930])
2931if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002932 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2933 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002934fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002935
Damien Millerad833b32000-08-23 10:46:23 +10002936AC_CACHE_CHECK([for pw_class field in struct passwd],
2937 ac_cv_have_pw_class_in_struct_passwd, [
2938 AC_TRY_COMPILE(
2939 [
Damien Millerad833b32000-08-23 10:46:23 +10002940#include <pwd.h>
2941 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002942 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002943 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2944 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2945 )
2946])
2947if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002948 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2949 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002950fi
2951
Kevin Steves82456952001-06-22 21:14:18 +00002952AC_CACHE_CHECK([for pw_expire field in struct passwd],
2953 ac_cv_have_pw_expire_in_struct_passwd, [
2954 AC_TRY_COMPILE(
2955 [
2956#include <pwd.h>
2957 ],
2958 [ struct passwd p; p.pw_expire = 0; ],
2959 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2960 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2961 )
2962])
2963if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002964 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2965 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002966fi
2967
2968AC_CACHE_CHECK([for pw_change field in struct passwd],
2969 ac_cv_have_pw_change_in_struct_passwd, [
2970 AC_TRY_COMPILE(
2971 [
2972#include <pwd.h>
2973 ],
2974 [ struct passwd p; p.pw_change = 0; ],
2975 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2976 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2977 )
2978])
2979if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002980 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2981 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002982fi
Damien Miller61e50f12000-05-08 20:49:37 +10002983
Tim Rice28bbb0c2002-05-27 17:37:32 -07002984dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002985AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2986 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002987 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002988 [
Tim Riceae49fe62002-04-12 10:26:21 -07002989#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002990#include <sys/socket.h>
2991#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002992int main() {
2993#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002994#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002995exit(1);
2996#endif
2997struct msghdr m;
2998m.msg_accrights = 0;
2999exit(0);
3000}
Kevin Steves939c9db2002-03-22 17:23:25 +00003001 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00003002 [ ac_cv_have_accrights_in_msghdr="yes" ],
3003 [ ac_cv_have_accrights_in_msghdr="no" ]
3004 )
3005])
3006if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003007 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
3008 [Define if your system uses access rights style
3009 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003010fi
3011
Kevin Stevesa44e0352002-04-07 16:18:03 +00003012AC_CACHE_CHECK([for msg_control field in struct msghdr],
3013 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10003014 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00003015 [
Tim Riceae49fe62002-04-12 10:26:21 -07003016#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003017#include <sys/socket.h>
3018#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07003019int main() {
3020#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003021#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003022exit(1);
3023#endif
3024struct msghdr m;
3025m.msg_control = 0;
3026exit(0);
3027}
Kevin Stevesa44e0352002-04-07 16:18:03 +00003028 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003029 [ ac_cv_have_control_in_msghdr="yes" ],
3030 [ ac_cv_have_control_in_msghdr="no" ]
3031 )
3032])
3033if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003034 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
3035 [Define if your system uses ancillary data style
3036 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003037fi
3038
Damien Miller61e50f12000-05-08 20:49:37 +10003039AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003040 AC_TRY_LINK([],
3041 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10003042 [ ac_cv_libc_defines___progname="yes" ],
3043 [ ac_cv_libc_defines___progname="no" ]
3044 )
3045])
3046if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003047 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003048fi
3049
Kevin Steves4846f4a2002-03-22 18:19:53 +00003050AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
3051 AC_TRY_LINK([
3052#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11003053],
3054 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00003055 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3056 [ ac_cv_cc_implements___FUNCTION__="no" ]
3057 )
3058])
3059if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003060 AC_DEFINE(HAVE___FUNCTION__, 1,
3061 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003062fi
3063
3064AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3065 AC_TRY_LINK([
3066#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11003067],
3068 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00003069 [ ac_cv_cc_implements___func__="yes" ],
3070 [ ac_cv_cc_implements___func__="no" ]
3071 )
3072])
3073if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003074 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003075fi
3076
Damien Miller57f39152005-11-24 19:58:19 +11003077AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3078 AC_TRY_LINK(
3079 [#include <stdarg.h>
3080 va_list x,y;],
3081 [va_copy(x,y);],
3082 [ ac_cv_have_va_copy="yes" ],
3083 [ ac_cv_have_va_copy="no" ]
3084 )
3085])
3086if test "x$ac_cv_have_va_copy" = "xyes" ; then
3087 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3088fi
3089
3090AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3091 AC_TRY_LINK(
3092 [#include <stdarg.h>
3093 va_list x,y;],
3094 [__va_copy(x,y);],
3095 [ ac_cv_have___va_copy="yes" ],
3096 [ ac_cv_have___va_copy="no" ]
3097 )
3098])
3099if test "x$ac_cv_have___va_copy" = "xyes" ; then
3100 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3101fi
3102
Damien Miller4f8e6692001-07-14 13:22:53 +10003103AC_CACHE_CHECK([whether getopt has optreset support],
3104 ac_cv_have_getopt_optreset, [
3105 AC_TRY_LINK(
3106 [
3107#include <getopt.h>
3108 ],
3109 [ extern int optreset; optreset = 0; ],
3110 [ ac_cv_have_getopt_optreset="yes" ],
3111 [ ac_cv_have_getopt_optreset="no" ]
3112 )
3113])
3114if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003115 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3116 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003117fi
Damien Millera22ba012000-03-02 23:09:20 +11003118
Damien Millerecbb26d2000-07-15 14:59:14 +10003119AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003120 AC_TRY_LINK([],
3121 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10003122 [ ac_cv_libc_defines_sys_errlist="yes" ],
3123 [ ac_cv_libc_defines_sys_errlist="no" ]
3124 )
3125])
3126if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003127 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3128 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003129fi
3130
3131
Damien Miller11fa2cc2000-08-16 10:35:58 +10003132AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003133 AC_TRY_LINK([],
3134 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10003135 [ ac_cv_libc_defines_sys_nerr="yes" ],
3136 [ ac_cv_libc_defines_sys_nerr="no" ]
3137 )
3138])
3139if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003140 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003141fi
3142
Damien Millera8e06ce2003-11-21 23:48:55 +11003143SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003144# Check whether user wants sectok support
3145AC_ARG_WITH(sectok,
3146 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10003147 [
3148 if test "x$withval" != "xno" ; then
3149 if test "x$withval" != "xyes" ; then
3150 CPPFLAGS="$CPPFLAGS -I${withval}"
3151 LDFLAGS="$LDFLAGS -L${withval}"
3152 if test ! -z "$need_dash_r" ; then
3153 LDFLAGS="$LDFLAGS -R${withval}"
3154 fi
3155 if test ! -z "$blibpath" ; then
3156 blibpath="$blibpath:${withval}"
3157 fi
3158 fi
3159 AC_CHECK_HEADERS(sectok.h)
3160 if test "$ac_cv_header_sectok_h" != yes; then
3161 AC_MSG_ERROR(Can't find sectok.h)
3162 fi
3163 AC_CHECK_LIB(sectok, sectok_open)
3164 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3165 AC_MSG_ERROR(Can't find libsectok)
3166 fi
Tim Rice7df8d392005-09-19 09:33:39 -07003167 AC_DEFINE(SMARTCARD, 1,
3168 [Define if you want smartcard support])
3169 AC_DEFINE(USE_SECTOK, 1,
3170 [Define if you want smartcard support
3171 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11003172 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003173 fi
3174 ]
3175)
3176
3177# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08003178OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003179AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10003180 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08003181 [
3182 if test "x$withval" != "xno" ; then
3183 if test "x$withval" != "xyes" ; then
3184 OPENSC_CONFIG=$withval/bin/opensc-config
3185 else
3186 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3187 fi
3188 if test "$OPENSC_CONFIG" != "no"; then
3189 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3190 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3191 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
Darren Tucker0ee3cbf2006-09-23 16:25:19 +10003192 LIBS="$LIBS $LIBOPENSC_LIBS"
Tim Rice12ee8e22005-03-17 13:37:04 -08003193 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07003194 AC_DEFINE(USE_OPENSC, 1,
3195 [Define if you want smartcard support
3196 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08003197 SCARD_MSG="yes, using OpenSC"
3198 fi
3199 fi
3200 ]
3201)
Damien Miller85de5802001-09-18 14:01:11 +10003202
Darren Tucker5f88d342003-10-15 16:57:57 +10003203# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11003204AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07003205 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3206 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003207 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003208 # Needed by our getrrsetbyname()
3209 AC_SEARCH_LIBS(res_query, resolv)
3210 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10003211 AC_MSG_CHECKING(if res_query will link)
3212 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
3213 [AC_MSG_RESULT(no)
3214 saved_LIBS="$LIBS"
3215 LIBS="$LIBS -lresolv"
3216 AC_MSG_CHECKING(for res_query in -lresolv)
3217 AC_LINK_IFELSE([
3218#include <resolv.h>
3219int main()
3220{
3221 res_query (0, 0, 0, 0, 0);
3222 return 0;
3223}
3224 ],
3225 [LIBS="$LIBS -lresolv"
3226 AC_MSG_RESULT(yes)],
3227 [LIBS="$saved_LIBS"
3228 AC_MSG_RESULT(no)])
3229 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10003230 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003231 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003232 [#include <sys/types.h>
3233 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10003234 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07003235 [AC_DEFINE(HAVE_HEADER_AD, 1,
3236 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10003237 [#include <arpa/nameser.h>])
3238 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003239
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003240AC_MSG_CHECKING(if struct __res_state _res is an extern)
3241AC_LINK_IFELSE([
3242#include <stdio.h>
3243#if HAVE_SYS_TYPES_H
3244# include <sys/types.h>
3245#endif
3246#include <netinet/in.h>
3247#include <arpa/nameser.h>
3248#include <resolv.h>
3249extern struct __res_state _res;
3250int main() { return 0; }
3251 ],
3252 [AC_MSG_RESULT(yes)
3253 AC_DEFINE(HAVE__RES_EXTERN, 1,
3254 [Define if you have struct __res_state _res as an extern])
3255 ],
3256 [ AC_MSG_RESULT(no) ]
3257)
3258
Damien Miller73b42d22006-04-22 21:26:08 +10003259# Check whether user wants SELinux support
3260SELINUX_MSG="no"
3261LIBSELINUX=""
3262AC_ARG_WITH(selinux,
Damien Miller5b1c8b32008-03-27 12:33:07 +11003263 [ --with-selinux Enable SELinux support],
Damien Miller73b42d22006-04-22 21:26:08 +10003264 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003265 save_LIBS="$LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003266 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3267 SELINUX_MSG="yes"
3268 AC_CHECK_HEADER([selinux/selinux.h], ,
3269 AC_MSG_ERROR(SELinux support requires selinux.h header))
3270 AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
3271 AC_MSG_ERROR(SELinux support requires libselinux library))
Darren Tucker20e9f972007-03-25 18:26:01 +10003272 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Damien Miller73b42d22006-04-22 21:26:08 +10003273 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
Darren Tuckeradc947d2006-10-07 09:07:20 +10003274 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003275 fi ]
3276)
Damien Miller73b42d22006-04-22 21:26:08 +10003277
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003278# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003279KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003280AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11003281 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003282 [ if test "x$withval" != "xno" ; then
3283 if test "x$withval" = "xyes" ; then
3284 KRB5ROOT="/usr/local"
3285 else
3286 KRB5ROOT=${withval}
3287 fi
3288
Tim Rice7df8d392005-09-19 09:33:39 -07003289 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003290 KRB5_MSG="yes"
3291
3292 AC_MSG_CHECKING(for krb5-config)
3293 if test -x $KRB5ROOT/bin/krb5-config ; then
3294 KRB5CONF=$KRB5ROOT/bin/krb5-config
3295 AC_MSG_RESULT($KRB5CONF)
3296
3297 AC_MSG_CHECKING(for gssapi support)
3298 if $KRB5CONF | grep gssapi >/dev/null ; then
3299 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003300 AC_DEFINE(GSSAPI, 1,
3301 [Define this if you want GSSAPI
3302 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003303 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003304 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11003305 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11003306 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003307 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003308 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3309 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003310 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003311 AC_MSG_CHECKING(whether we are using Heimdal)
3312 AC_TRY_COMPILE([ #include <krb5.h> ],
3313 [ char *tmp = heimdal_version; ],
3314 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003315 AC_DEFINE(HEIMDAL, 1,
3316 [Define this if you are using the
3317 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003318 AC_MSG_RESULT(no)
3319 )
3320 else
3321 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003322 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003323 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11003324 AC_MSG_CHECKING(whether we are using Heimdal)
3325 AC_TRY_COMPILE([ #include <krb5.h> ],
3326 [ char *tmp = heimdal_version; ],
3327 [ AC_MSG_RESULT(yes)
3328 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10003329 K5LIBS="-lkrb5 -ldes"
3330 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08003331 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10003332 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11003333 ],
3334 [ AC_MSG_RESULT(no)
3335 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3336 ]
3337 )
Damien Miller200d0a72003-06-30 19:21:36 +10003338 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003339
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003340 AC_CHECK_LIB(gssapi,gss_init_sec_context,
3341 [ AC_DEFINE(GSSAPI)
3342 K5LIBS="-lgssapi $K5LIBS" ],
3343 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3344 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11003345 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003346 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3347 $K5LIBS)
3348 ],
3349 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003350
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003351 AC_CHECK_HEADER(gssapi.h, ,
3352 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003353 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003354 AC_CHECK_HEADERS(gssapi.h, ,
3355 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003356 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003357 ]
3358 )
3359
3360 oldCPP="$CPPFLAGS"
3361 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3362 AC_CHECK_HEADER(gssapi_krb5.h, ,
3363 [ CPPFLAGS="$oldCPP" ])
3364
Damien Millera8e06ce2003-11-21 23:48:55 +11003365 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003366 if test ! -z "$need_dash_r" ; then
3367 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3368 fi
3369 if test ! -z "$blibpath" ; then
3370 blibpath="$blibpath:${KRB5ROOT}/lib"
3371 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003372
3373 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3374 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3375 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3376
3377 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07003378 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3379 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11003380 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003381 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003382)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003383
Damien Millera22ba012000-03-02 23:09:20 +11003384# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003385
Damien Millerf58c6722002-05-13 13:15:42 +10003386PRIVSEP_PATH=/var/empty
3387AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07003388 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003389 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003390 if test -n "$withval" && test "x$withval" != "xno" && \
3391 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003392 PRIVSEP_PATH=$withval
3393 fi
3394 ]
3395)
3396AC_SUBST(PRIVSEP_PATH)
3397
Damien Millera22ba012000-03-02 23:09:20 +11003398AC_ARG_WITH(xauth,
3399 [ --with-xauth=PATH Specify path to xauth program ],
3400 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003401 if test -n "$withval" && test "x$withval" != "xno" && \
3402 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003403 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003404 fi
3405 ],
3406 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003407 TestPath="$PATH"
3408 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3409 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3410 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3411 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3412 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003413 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003414 xauth_path="/usr/openwin/bin/xauth"
3415 fi
3416 ]
3417)
3418
Damien Miller7d901272003-01-13 16:55:22 +11003419STRIP_OPT=-s
3420AC_ARG_ENABLE(strip,
3421 [ --disable-strip Disable calling strip(1) on install],
3422 [
3423 if test "x$enableval" = "xno" ; then
3424 STRIP_OPT=
3425 fi
3426 ]
3427)
3428AC_SUBST(STRIP_OPT)
3429
Damien Millera19cf472000-11-29 13:28:50 +11003430if test -z "$xauth_path" ; then
3431 XAUTH_PATH="undefined"
3432 AC_SUBST(XAUTH_PATH)
3433else
Tim Rice7df8d392005-09-19 09:33:39 -07003434 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3435 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003436 XAUTH_PATH=$xauth_path
3437 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003438fi
Damien Millera22ba012000-03-02 23:09:20 +11003439
3440# Check for mail directory (last resort if we cannot get it from headers)
3441if test ! -z "$MAIL" ; then
3442 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003443 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3444 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003445fi
3446
Darren Tucker623d92f2004-09-12 22:36:15 +10003447if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003448 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3449 disable_ptmx_check=yes
3450fi
Damien Millera22ba012000-03-02 23:09:20 +11003451if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003452 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003453 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003454 [
Tim Rice7df8d392005-09-19 09:33:39 -07003455 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3456 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003457 have_dev_ptmx=1
3458 ]
3459 )
3460 fi
Damien Millera22ba012000-03-02 23:09:20 +11003461fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003462
Darren Tucker623d92f2004-09-12 22:36:15 +10003463if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003464 AC_CHECK_FILE("/dev/ptc",
3465 [
Tim Rice7df8d392005-09-19 09:33:39 -07003466 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3467 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003468 have_dev_ptc=1
3469 ]
3470 )
3471else
3472 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3473fi
Damien Miller204ad072000-03-02 23:56:12 +11003474
Damien Millera22ba012000-03-02 23:09:20 +11003475# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003476AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003477 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003478 [
Damien Miller897741e2001-04-16 10:41:46 +10003479 case "$withval" in
3480 man|cat|doc)
3481 MANTYPE=$withval
3482 ;;
3483 *)
3484 AC_MSG_ERROR(invalid man type: $withval)
3485 ;;
3486 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003487 ]
3488)
Ben Lindstrombc709922001-04-18 18:04:21 +00003489if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003490 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3491 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003492 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3493 MANTYPE=doc
3494 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3495 MANTYPE=man
3496 else
3497 MANTYPE=cat
3498 fi
3499fi
Damien Miller670a4b82000-01-22 13:53:11 +11003500AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003501if test "$MANTYPE" = "doc"; then
3502 mansubdir=man;
3503else
3504 mansubdir=$MANTYPE;
3505fi
3506AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003507
Damien Millera22ba012000-03-02 23:09:20 +11003508# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003509MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003510AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003511 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003512 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003513 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003514 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3515 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003516 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003517 fi
3518 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003519)
3520
Damien Millera22ba012000-03-02 23:09:20 +11003521# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003522AC_ARG_WITH(shadow,
3523 [ --without-shadow Disable shadow password support],
3524 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003525 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003526 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003527 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003528 fi
3529 ]
3530)
3531
Damien Miller1f335fb2000-06-26 11:31:33 +10003532if test -z "$disable_shadow" ; then
3533 AC_MSG_CHECKING([if the systems has expire shadow information])
3534 AC_TRY_COMPILE(
3535 [
3536#include <sys/types.h>
3537#include <shadow.h>
3538 struct spwd sp;
3539 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3540 [ sp_expire_available=yes ], []
3541 )
3542
3543 if test "x$sp_expire_available" = "xyes" ; then
3544 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003545 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3546 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003547 else
3548 AC_MSG_RESULT(no)
3549 fi
3550fi
3551
Damien Millera22ba012000-03-02 23:09:20 +11003552# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003553if test ! -z "$IPADDR_IN_DISPLAY" ; then
3554 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003555 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3556 [Define if you need to use IP address
3557 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003558else
Damien Millera8e06ce2003-11-21 23:48:55 +11003559 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003560 AC_ARG_WITH(ipaddr-display,
3561 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3562 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003563 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003564 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003565 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003566 fi
3567 ]
3568 )
3569fi
Damien Miller76112de1999-12-21 11:18:08 +11003570
Darren Tuckere1a790d2003-09-16 11:52:19 +10003571# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003572AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003573 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003574 [ if test "x$enableval" = "xno"; then
3575 AC_MSG_NOTICE([/etc/default/login handling disabled])
3576 etc_default_login=no
3577 else
3578 etc_default_login=yes
3579 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003580 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3581 then
3582 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3583 etc_default_login=no
3584 else
3585 etc_default_login=yes
3586 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003587)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003588
Darren Tucker2f9573d2005-02-10 22:28:54 +11003589if test "x$etc_default_login" != "xno"; then
3590 AC_CHECK_FILE("/etc/default/login",
3591 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003592 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003593 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3594 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003595 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003596fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003597
Tim Rice43a1c132002-04-17 21:19:14 -07003598dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003599if test $ac_cv_func_login_getcapbool = "yes" && \
3600 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003601 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003602fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003603
Damien Millera22ba012000-03-02 23:09:20 +11003604# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003605SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003606AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003607 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003608 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003609 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003610 AC_MSG_WARN([
3611--with-default-path=PATH has no effect on this system.
3612Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003613 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003614 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003615 AC_MSG_WARN([
3616--with-default-path=PATH will only be used if PATH is not defined in
3617$external_path_file .])
3618 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003619 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003620 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003621 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003622 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003623 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3624 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003625 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003626 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003627 AC_MSG_WARN([
3628If PATH is defined in $external_path_file, ensure the path to scp is included,
3629otherwise scp will not work.])
3630 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003631 AC_RUN_IFELSE(
3632 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003633/* find out what STDPATH is */
3634#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003635#ifdef HAVE_PATHS_H
3636# include <paths.h>
3637#endif
3638#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003639# ifdef _PATH_USERPATH /* Irix */
3640# define _PATH_STDPATH _PATH_USERPATH
3641# else
3642# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3643# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003644#endif
3645#include <sys/types.h>
3646#include <sys/stat.h>
3647#include <fcntl.h>
3648#define DATA "conftest.stdpath"
3649
3650main()
3651{
3652 FILE *fd;
3653 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003654
Tim Rice59ea0a02001-03-10 13:50:45 -08003655 fd = fopen(DATA,"w");
3656 if(fd == NULL)
3657 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003658
Tim Rice59ea0a02001-03-10 13:50:45 -08003659 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3660 exit(1);
3661
3662 exit(0);
3663}
Darren Tucker314d89e2005-10-17 23:29:23 +10003664 ]])],
3665 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003666 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3667 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3668 )
3669# make sure $bindir is in USER_PATH so scp will work
3670 t_bindir=`eval echo ${bindir}`
3671 case $t_bindir in
3672 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3673 esac
3674 case $t_bindir in
3675 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3676 esac
3677 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3678 if test $? -ne 0 ; then
3679 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3680 if test $? -ne 0 ; then
3681 user_path=$user_path:$t_bindir
3682 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3683 fi
3684 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003685 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003686)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003687if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003688 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003689 AC_SUBST(user_path)
3690fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003691
Damien Millera18bbd32002-05-13 10:48:57 +10003692# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003693AC_ARG_WITH(superuser-path,
3694 [ --with-superuser-path= Specify different path for super-user],
3695 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003696 if test -n "$withval" && test "x$withval" != "xno" && \
3697 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003698 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3699 [Define if you want a different $PATH
3700 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003701 superuser_path=$withval
3702 fi
3703 ]
3704)
3705
3706
Damien Miller61e50f12000-05-08 20:49:37 +10003707AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003708IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003709AC_ARG_WITH(4in6,
3710 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3711 [
3712 if test "x$withval" != "xno" ; then
3713 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003714 AC_DEFINE(IPV4_IN_IPV6, 1,
3715 [Detect IPv4 in IPv6 mapped addresses
3716 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003717 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003718 else
3719 AC_MSG_RESULT(no)
3720 fi
3721 ],[
3722 if test "x$inet6_default_4in6" = "xyes"; then
3723 AC_MSG_RESULT([yes (default)])
3724 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003725 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003726 else
3727 AC_MSG_RESULT([no (default)])
3728 fi
3729 ]
3730)
3731
Damien Miller60396b02001-02-18 17:01:00 +11003732# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003733BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003734AC_ARG_WITH(bsd-auth,
3735 [ --with-bsd-auth Enable BSD auth support],
3736 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003737 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003738 AC_DEFINE(BSD_AUTH, 1,
3739 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003740 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003741 fi
3742 ]
3743)
3744
Damien Millera22ba012000-03-02 23:09:20 +11003745# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003746piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003747# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003748if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003749 piddir=`eval echo ${sysconfdir}`
3750 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003751 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003752 esac
3753fi
3754
Tim Rice88f2ab52002-03-17 12:17:34 -08003755AC_ARG_WITH(pid-dir,
3756 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3757 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003758 if test -n "$withval" && test "x$withval" != "xno" && \
3759 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003760 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003761 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003762 AC_MSG_WARN([** no $piddir directory on this system **])
3763 fi
3764 fi
3765 ]
3766)
3767
Tim Rice7df8d392005-09-19 09:33:39 -07003768AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003769AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003770
andre2ff7b5d2000-06-03 14:57:40 +00003771dnl allow user to disable some login recording features
3772AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003773 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003774 [
3775 if test "x$enableval" = "xno" ; then
3776 AC_DEFINE(DISABLE_LASTLOG)
3777 fi
3778 ]
andre2ff7b5d2000-06-03 14:57:40 +00003779)
3780AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003781 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003782 [
3783 if test "x$enableval" = "xno" ; then
3784 AC_DEFINE(DISABLE_UTMP)
3785 fi
3786 ]
andre2ff7b5d2000-06-03 14:57:40 +00003787)
3788AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003789 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003790 [
3791 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003792 AC_DEFINE(DISABLE_UTMPX, 1,
3793 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003794 fi
3795 ]
andre2ff7b5d2000-06-03 14:57:40 +00003796)
3797AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003798 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003799 [
3800 if test "x$enableval" = "xno" ; then
3801 AC_DEFINE(DISABLE_WTMP)
3802 fi
3803 ]
andre2ff7b5d2000-06-03 14:57:40 +00003804)
3805AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003806 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003807 [
3808 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003809 AC_DEFINE(DISABLE_WTMPX, 1,
3810 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003811 fi
3812 ]
andre2ff7b5d2000-06-03 14:57:40 +00003813)
3814AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003815 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003816 [
3817 if test "x$enableval" = "xno" ; then
3818 AC_DEFINE(DISABLE_LOGIN)
3819 fi
3820 ]
andre2ff7b5d2000-06-03 14:57:40 +00003821)
3822AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003823 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003824 [
3825 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003826 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3827 [Define if you don't want to use pututline()
3828 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003829 fi
3830 ]
andre2ff7b5d2000-06-03 14:57:40 +00003831)
3832AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003833 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003834 [
3835 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003836 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3837 [Define if you don't want to use pututxline()
3838 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003839 fi
3840 ]
andre2ff7b5d2000-06-03 14:57:40 +00003841)
3842AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003843 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003844 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003845 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003846 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003847 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003848 conf_lastlog_location=$withval
3849 fi
3850 ]
3851)
andre2ff7b5d2000-06-03 14:57:40 +00003852
3853dnl lastlog, [uw]tmpx? detection
3854dnl NOTE: set the paths in the platform section to avoid the
3855dnl need for command-line parameters
3856dnl lastlog and [uw]tmp are subject to a file search if all else fails
3857
3858dnl lastlog detection
3859dnl NOTE: the code itself will detect if lastlog is a directory
3860AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3861AC_TRY_COMPILE([
3862#include <sys/types.h>
3863#include <utmp.h>
3864#ifdef HAVE_LASTLOG_H
3865# include <lastlog.h>
3866#endif
Damien Miller2994e082000-06-04 15:51:47 +10003867#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003868# include <paths.h>
3869#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003870#ifdef HAVE_LOGIN_H
3871# include <login.h>
3872#endif
andre2ff7b5d2000-06-03 14:57:40 +00003873 ],
3874 [ char *lastlog = LASTLOG_FILE; ],
3875 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003876 [
3877 AC_MSG_RESULT(no)
3878 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3879 AC_TRY_COMPILE([
3880#include <sys/types.h>
3881#include <utmp.h>
3882#ifdef HAVE_LASTLOG_H
3883# include <lastlog.h>
3884#endif
3885#ifdef HAVE_PATHS_H
3886# include <paths.h>
3887#endif
3888 ],
3889 [ char *lastlog = _PATH_LASTLOG; ],
3890 [ AC_MSG_RESULT(yes) ],
3891 [
andree441aa32000-06-12 22:34:38 +00003892 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003893 system_lastlog_path=no
3894 ])
3895 ]
andre2ff7b5d2000-06-03 14:57:40 +00003896)
Damien Miller2994e082000-06-04 15:51:47 +10003897
andre2ff7b5d2000-06-03 14:57:40 +00003898if test -z "$conf_lastlog_location"; then
3899 if test x"$system_lastlog_path" = x"no" ; then
3900 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003901 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003902 conf_lastlog_location=$f
3903 fi
3904 done
3905 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003906 AC_MSG_WARN([** Cannot find lastlog **])
3907 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003908 fi
3909 fi
3910fi
3911
3912if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003913 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3914 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003915fi
andre2ff7b5d2000-06-03 14:57:40 +00003916
3917dnl utmp detection
3918AC_MSG_CHECKING([if your system defines UTMP_FILE])
3919AC_TRY_COMPILE([
3920#include <sys/types.h>
3921#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003922#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003923# include <paths.h>
3924#endif
3925 ],
3926 [ char *utmp = UTMP_FILE; ],
3927 [ AC_MSG_RESULT(yes) ],
3928 [ AC_MSG_RESULT(no)
3929 system_utmp_path=no ]
3930)
3931if test -z "$conf_utmp_location"; then
3932 if test x"$system_utmp_path" = x"no" ; then
3933 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3934 if test -f $f ; then
3935 conf_utmp_location=$f
3936 fi
3937 done
3938 if test -z "$conf_utmp_location"; then
3939 AC_DEFINE(DISABLE_UTMP)
3940 fi
3941 fi
3942fi
3943if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003944 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3945 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003946fi
andre2ff7b5d2000-06-03 14:57:40 +00003947
3948dnl wtmp detection
3949AC_MSG_CHECKING([if your system defines WTMP_FILE])
3950AC_TRY_COMPILE([
3951#include <sys/types.h>
3952#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003953#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003954# include <paths.h>
3955#endif
3956 ],
3957 [ char *wtmp = WTMP_FILE; ],
3958 [ AC_MSG_RESULT(yes) ],
3959 [ AC_MSG_RESULT(no)
3960 system_wtmp_path=no ]
3961)
3962if test -z "$conf_wtmp_location"; then
3963 if test x"$system_wtmp_path" = x"no" ; then
3964 for f in /usr/adm/wtmp /var/log/wtmp; do
3965 if test -f $f ; then
3966 conf_wtmp_location=$f
3967 fi
3968 done
3969 if test -z "$conf_wtmp_location"; then
3970 AC_DEFINE(DISABLE_WTMP)
3971 fi
3972 fi
3973fi
3974if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003975 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3976 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003977fi
andre2ff7b5d2000-06-03 14:57:40 +00003978
3979
3980dnl utmpx detection - I don't know any system so perverse as to require
3981dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3982dnl there, though.
3983AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3984AC_TRY_COMPILE([
3985#include <sys/types.h>
3986#include <utmp.h>
3987#ifdef HAVE_UTMPX_H
3988#include <utmpx.h>
3989#endif
Damien Miller2994e082000-06-04 15:51:47 +10003990#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003991# include <paths.h>
3992#endif
3993 ],
3994 [ char *utmpx = UTMPX_FILE; ],
3995 [ AC_MSG_RESULT(yes) ],
3996 [ AC_MSG_RESULT(no)
3997 system_utmpx_path=no ]
3998)
3999if test -z "$conf_utmpx_location"; then
4000 if test x"$system_utmpx_path" = x"no" ; then
4001 AC_DEFINE(DISABLE_UTMPX)
4002 fi
4003else
Tim Rice7df8d392005-09-19 09:33:39 -07004004 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
4005 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004006fi
andre2ff7b5d2000-06-03 14:57:40 +00004007
4008dnl wtmpx detection
4009AC_MSG_CHECKING([if your system defines WTMPX_FILE])
4010AC_TRY_COMPILE([
4011#include <sys/types.h>
4012#include <utmp.h>
4013#ifdef HAVE_UTMPX_H
4014#include <utmpx.h>
4015#endif
Damien Miller2994e082000-06-04 15:51:47 +10004016#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004017# include <paths.h>
4018#endif
4019 ],
4020 [ char *wtmpx = WTMPX_FILE; ],
4021 [ AC_MSG_RESULT(yes) ],
4022 [ AC_MSG_RESULT(no)
4023 system_wtmpx_path=no ]
4024)
4025if test -z "$conf_wtmpx_location"; then
4026 if test x"$system_wtmpx_path" = x"no" ; then
4027 AC_DEFINE(DISABLE_WTMPX)
4028 fi
4029else
Tim Rice7df8d392005-09-19 09:33:39 -07004030 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
4031 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004032fi
andre2ff7b5d2000-06-03 14:57:40 +00004033
Damien Miller4018c192000-04-30 09:30:44 +10004034
Damien Miller29ea30d2000-03-17 10:54:15 +11004035if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004036 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4037 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004038fi
4039
Darren Tucker7da23cb2005-08-03 00:20:15 +10004040dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4041dnl Add now.
4042CFLAGS="$CFLAGS $werror_flags"
4043
Damien Millerbac2d8a2000-09-05 16:13:06 +11004044AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004045AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4046 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
4047 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004048AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004049
Damien Miller7b22d652000-06-18 14:07:04 +10004050# Print summary of options
4051
Damien Miller7b22d652000-06-18 14:07:04 +10004052# Someone please show me a better way :)
4053A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4054B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4055C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4056D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004057E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004058F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004059G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004060H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4061I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4062J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004063
4064echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004065echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004066echo " User binaries: $B"
4067echo " System binaries: $C"
4068echo " Configuration files: $D"
4069echo " Askpass program: $E"
4070echo " Manual pages: $F"
4071echo " PID file: $G"
4072echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004073if test "x$external_path_file" = "x/etc/login.conf" ; then
4074echo " At runtime, sshd will use the path defined in $external_path_file"
4075echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004076else
Damien Millerf58c6722002-05-13 13:15:42 +10004077echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004078 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004079echo " (If PATH is set in $external_path_file it will be used instead. If"
4080echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4081 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004082fi
Damien Millera18bbd32002-05-13 10:48:57 +10004083if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004084echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004085fi
Damien Millerf58c6722002-05-13 13:15:42 +10004086echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004087echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004088echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004089echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004090echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004091echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004092echo " S/KEY support: $SKEY_MSG"
4093echo " TCP Wrappers support: $TCPW_MSG"
4094echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004095echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004096echo " Solaris process contract support: $SPC_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004097echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004098echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4099echo " BSD Auth support: $BSD_AUTH_MSG"
4100echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11004101if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004102echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11004103fi
4104
Damien Miller7b22d652000-06-18 14:07:04 +10004105echo ""
4106
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004107echo " Host: ${host}"
4108echo " Compiler: ${CC}"
4109echo " Compiler flags: ${CFLAGS}"
4110echo "Preprocessor flags: ${CPPFLAGS}"
4111echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004112echo " Libraries: ${LIBS}"
4113if test ! -z "${SSHDLIBS}"; then
4114echo " +for sshd: ${SSHDLIBS}"
4115fi
Damien Miller7b22d652000-06-18 14:07:04 +10004116
4117echo ""
4118
Tim Rice6f1f7582004-05-30 21:38:51 -07004119if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004120 echo "SVR4 style packages are supported with \"make package\""
4121 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004122fi
4123
Damien Miller82cf0ce2000-12-20 13:34:48 +11004124if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004125 echo "PAM is enabled. You may need to install a PAM control file "
4126 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004127 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004128 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004129 echo ""
4130fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004131
Damien Miller6c21c512002-01-22 21:57:53 +11004132if test ! -z "$RAND_HELPER_CMDHASH" ; then
4133 echo "WARNING: you are using the builtin random number collection "
4134 echo "service. Please read WARNING.RNG and request that your OS "
4135 echo "vendor includes kernel-based random number collection in "
4136 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004137 echo ""
4138fi
Damien Miller60396b02001-02-18 17:01:00 +11004139
Damien Millerb4097182004-05-23 14:09:40 +10004140if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004141 echo "WARNING: the operating system that you are using does not"
4142 echo "appear to support getpeereid(), getpeerucred() or the"
4143 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4144 echo "enforce security checks to prevent unauthorised connections to"
4145 echo "ssh-agent. Their absence increases the risk that a malicious"
4146 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004147 echo ""
4148fi
4149
Darren Tuckerd9f88912005-02-20 21:01:48 +11004150if test "$AUDIT_MODULE" = "bsm" ; then
4151 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4152 echo "See the Solaris section in README.platform for details."
4153fi