blob: 017fd7e3da15ea169e24f5c9a9408b8d97ed8845 [file] [log] [blame]
Darren Tucker54e859f2008-03-02 21:52:27 +11001# $Id: configure.ac,v 1.393 2008/03/02 10:52:28 dtucker Exp $
Damien Miller4fefe242004-03-11 14:20:10 +11002#
3# Copyright (c) 1999-2004 Damien Miller
4#
5# Permission to use, copy, modify, and distribute this software for any
6# purpose with or without fee is hereby granted, provided that the above
7# copyright notice and this permission notice appear in all copies.
8#
9# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Damien Millere9cf3572001-02-09 12:55:35 +110016
Darren Tucker6a45f3d2005-06-03 19:33:10 +100017AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
Darren Tucker54e859f2008-03-02 21:52:27 +110018AC_REVISION($Revision: 1.393 $)
Tim Rice13aae5e2001-10-21 17:53:58 -070019AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100020
21AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110022AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110023AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110024AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100025
Damien Millera22ba012000-03-02 23:09:20 +110026# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100027AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110028AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100029AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110030AC_PROG_INSTALL
Tim Ricefd80ddc2006-02-02 19:11:56 -080031AC_PROG_EGREP
Ben Lindstrom582d3982001-02-06 22:54:30 +000032AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070033AC_PATH_PROG(CAT, cat)
34AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070035AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080036AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110037AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100038AC_PATH_PROG(ENT, ent)
39AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110040AC_PATH_PROG(TEST_MINUS_S_SH, bash)
41AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
42AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070043AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070044AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110045
Tim Rice6f1f7582004-05-30 21:38:51 -070046dnl for buildpkg.sh
47AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
50 [/usr/sbin${PATH_SEPARATOR}/etc])
51AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
Darren Tuckerfbea7642006-01-30 00:22:39 +110052if test -x /sbin/sh; then
53 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
54else
55 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
56fi
Tim Rice6f1f7582004-05-30 21:38:51 -070057
Damien Millere8bb4502001-09-25 16:39:35 +100058# System features
59AC_SYS_LARGEFILE
60
Damien Miller3f62aba2000-11-29 11:56:35 +110061if test -z "$AR" ; then
62 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
63fi
64
Damien Millerad833b32000-08-23 10:46:23 +100065# Use LOGIN_PROGRAM from environment if possible
66if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070067 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
68 [If your header files don't define LOGIN_PROGRAM,
69 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100070else
71 # Search for login
72 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
73 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
74 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
75 fi
76fi
77
Darren Tucker23bc8d02004-02-06 16:24:31 +110078AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
79if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070080 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
81 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110082fi
83
Damien Miller166bd442000-03-16 10:48:25 +110084if test -z "$LD" ; then
85 LD=$CC
86fi
87AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080088
Damien Miller166bd442000-03-16 10:48:25 +110089AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100090
91AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
92
Damien Millera8e06ce2003-11-21 23:48:55 +110093if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +100094 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Darren Tucker3f9545e2005-11-12 15:20:52 +110095 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -070096 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +100097 1.*) no_attrib_nonnull=1 ;;
98 2.8* | 2.9*)
99 CFLAGS="$CFLAGS -Wsign-compare"
100 no_attrib_nonnull=1
101 ;;
102 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerb0288092005-11-10 14:46:48 +1100103 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100104 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
105 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700106 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +1000107
Darren Tuckerd4827ab2008-01-02 18:08:45 +1100108 AC_MSG_CHECKING(if $CC understands -fstack-protector-all)
Darren Tucker319b3d92007-12-02 21:02:22 +1100109 saved_CFLAGS="$CFLAGS"
Darren Tuckere1c4c542008-02-28 15:01:13 +1100110 saved_LDFLAGS="$LDFLAGS"
Darren Tucker319b3d92007-12-02 21:02:22 +1100111 CFLAGS="$CFLAGS -fstack-protector-all"
Darren Tuckere1c4c542008-02-28 15:01:13 +1100112 LDFLAGS="$LDFLAGS -fstack-protector-all"
113 AC_TRY_LINK([], [ int main(void){return 0;} ],
Darren Tucker319b3d92007-12-02 21:02:22 +1100114 [ AC_MSG_RESULT(yes) ],
115 [ AC_MSG_RESULT(no)
Darren Tuckere1c4c542008-02-28 15:01:13 +1100116 CFLAGS="$saved_CFLAGS"
117 LDFLAGS="$saved_LDFLAGS"
118 ]
Darren Tucker319b3d92007-12-02 21:02:22 +1100119 )
120
Darren Tucker67b37032005-06-03 17:58:31 +1000121 if test -z "$have_llong_max"; then
122 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
123 unset ac_cv_have_decl_LLONG_MAX
124 saved_CFLAGS="$CFLAGS"
125 CFLAGS="$CFLAGS -std=gnu99"
126 AC_CHECK_DECL(LLONG_MAX,
127 [have_llong_max=1],
128 [CFLAGS="$saved_CFLAGS"],
129 [#include <limits.h>]
130 )
131 fi
Damien Miller166bd442000-03-16 10:48:25 +1100132fi
133
Darren Tucker391de5c2007-04-29 14:49:21 +1000134if test "x$no_attrib_nonnull" != "x1" ; then
135 AC_DEFINE(HAVE_ATTRIBUTE__NONNULL__, 1, [Have attribute nonnull])
136fi
137
Tim Rice88368a32003-12-08 12:35:59 -0800138AC_ARG_WITH(rpath,
139 [ --without-rpath Disable auto-added -R linker paths],
140 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800141 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800142 need_dash_r=""
143 fi
144 if test "x$withval" = "xyes" ; then
145 need_dash_r=1
146 fi
147 ]
148)
149
Tim Rice1cfab232006-10-03 09:34:35 -0700150# Allow user to specify flags
151AC_ARG_WITH(cflags,
152 [ --with-cflags Specify additional flags to pass to compiler],
153 [
154 if test -n "$withval" && test "x$withval" != "xno" && \
155 test "x${withval}" != "xyes"; then
156 CFLAGS="$CFLAGS $withval"
157 fi
158 ]
159)
160AC_ARG_WITH(cppflags,
161 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
162 [
163 if test -n "$withval" && test "x$withval" != "xno" && \
164 test "x${withval}" != "xyes"; then
165 CPPFLAGS="$CPPFLAGS $withval"
166 fi
167 ]
168)
169AC_ARG_WITH(ldflags,
170 [ --with-ldflags Specify additional flags to pass to linker],
171 [
172 if test -n "$withval" && test "x$withval" != "xno" && \
173 test "x${withval}" != "xyes"; then
174 LDFLAGS="$LDFLAGS $withval"
175 fi
176 ]
177)
178AC_ARG_WITH(libs,
179 [ --with-libs Specify additional libraries to link with],
180 [
181 if test -n "$withval" && test "x$withval" != "xno" && \
182 test "x${withval}" != "xyes"; then
183 LIBS="$LIBS $withval"
184 fi
185 ]
186)
187AC_ARG_WITH(Werror,
188 [ --with-Werror Build main code with -Werror],
189 [
190 if test -n "$withval" && test "x$withval" != "xno"; then
191 werror_flags="-Werror"
192 if test "x${withval}" != "xyes"; then
193 werror_flags="$withval"
194 fi
195 fi
196 ]
197)
198
199AC_CHECK_HEADERS( \
200 bstring.h \
201 crypt.h \
202 crypto/sha2.h \
203 dirent.h \
204 endian.h \
205 features.h \
206 fcntl.h \
207 floatingpoint.h \
208 getopt.h \
209 glob.h \
210 ia.h \
211 iaf.h \
212 limits.h \
213 login.h \
214 maillock.h \
215 ndir.h \
216 net/if_tun.h \
217 netdb.h \
218 netgroup.h \
219 pam/pam_appl.h \
220 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000221 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700222 pty.h \
223 readpassphrase.h \
224 rpc/types.h \
225 security/pam_appl.h \
226 sha2.h \
227 shadow.h \
228 stddef.h \
229 stdint.h \
230 string.h \
231 strings.h \
232 sys/audit.h \
233 sys/bitypes.h \
234 sys/bsdtty.h \
235 sys/cdefs.h \
236 sys/dir.h \
237 sys/mman.h \
238 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000239 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700240 sys/prctl.h \
241 sys/pstat.h \
242 sys/select.h \
243 sys/stat.h \
244 sys/stream.h \
245 sys/stropts.h \
246 sys/strtio.h \
247 sys/sysmacros.h \
248 sys/time.h \
249 sys/timers.h \
250 sys/un.h \
251 time.h \
252 tmpdir.h \
253 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700254 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700255 unistd.h \
256 usersec.h \
257 util.h \
258 utime.h \
259 utmp.h \
260 utmpx.h \
261 vis.h \
262)
263
264# lastlog.h requires sys/time.h to be included first on Solaris
265AC_CHECK_HEADERS(lastlog.h, [], [], [
266#ifdef HAVE_SYS_TIME_H
267# include <sys/time.h>
268#endif
269])
270
271# sys/ptms.h requires sys/stream.h to be included first on Solaris
272AC_CHECK_HEADERS(sys/ptms.h, [], [], [
273#ifdef HAVE_SYS_STREAM_H
274# include <sys/stream.h>
275#endif
276])
277
278# login_cap.h requires sys/types.h on NetBSD
279AC_CHECK_HEADERS(login_cap.h, [], [], [
280#include <sys/types.h>
281])
282
Damien Miller1b06dc32006-08-31 03:24:41 +1000283# Messages for features tested for in target-specific section
284SIA_MSG="no"
285SPC_MSG="no"
286
Damien Millera22ba012000-03-02 23:09:20 +1100287# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100288case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100289*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000290 # Some versions of VAC won't allow macro redefinitions at
291 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
292 # particularly with older versions of vac or xlc.
293 # It also throws errors about null macro argments, but these are
294 # not fatal.
295 AC_MSG_CHECKING(if compiler allows macro redefinitions)
296 AC_COMPILE_IFELSE(
297 [AC_LANG_SOURCE([[
298#define testmacro foo
299#define testmacro bar
300int main(void) { exit(0); }
301 ]])],
302 [ AC_MSG_RESULT(yes) ],
303 [ AC_MSG_RESULT(no)
304 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
305 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
306 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
307 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
308 ]
309 )
310
Damien Millera8e06ce2003-11-21 23:48:55 +1100311 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000312 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800313 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100314 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000315 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000316 if test "$GCC" = "yes"; then
317 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
318 else
319 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
320 fi
321 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000322 if (test -z "$blibflags"); then
323 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
324 AC_TRY_LINK([], [], [blibflags=$tryflags])
325 fi
326 done
327 if (test -z "$blibflags"); then
328 AC_MSG_RESULT(not found)
329 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
330 else
331 AC_MSG_RESULT($blibflags)
332 fi
333 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000334 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700335 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
336 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700337 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000338 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700339 LIBS="$LIBS -ls"
340 ])
341 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100342 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100343 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100344 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000345 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100346 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000347 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
348 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000349 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000350 [(void)loginfailed("user","host","tty",0);],
351 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700352 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
353 [Define if your AIX loginfailed() function
354 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000355 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000356 )],
357 [],
358 [#include <usersec.h>]
359 )
Darren Tucker0f26b132008-02-28 23:16:04 +1100360 AC_CHECK_FUNCS(getgrset setauthdb)
Darren Tucker3083bc22006-08-17 19:35:49 +1000361 AC_CHECK_DECL(F_CLOSEM,
Darren Tuckerd018b2e2006-08-18 18:51:20 +1000362 AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000363 [],
364 [ #include <limits.h>
365 #include <fcntl.h> ]
366 )
Darren Tucker691d5232005-02-15 21:45:57 +1100367 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700368 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
369 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
370 [Define if your platform breaks doing a seteuid before a setuid])
371 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
372 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000373 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700374 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
375 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
376 [Some systems need a utmpx entry for /bin/login to work])
377 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
378 [Define to a Set Process Title type if your system is
379 supported by bsd-setproctitle.c])
Darren Tucker91d25a02005-11-26 22:24:09 +1100380 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
381 [AIX 5.2 and 5.3 (and presumably newer) require this])
Darren Tucker9afe1152006-06-23 21:24:12 +1000382 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
Damien Miller75b1d102000-01-07 14:01:41 +1100383 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100384*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100385 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100386 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700387 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
388 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
389 AC_DEFINE(DISABLE_SHADOW, 1,
390 [Define if you want to disable shadow passwords])
391 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
392 [Define if your system choked on IP TOS setting])
393 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
394 [Define if X11 doesn't support AF_UNIX sockets on that system])
395 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
396 [Define if the concept of ports only accessible to
397 superusers isn't known])
398 AC_DEFINE(DISABLE_FD_PASSING, 1,
399 [Define if your platform needs to skip post auth
400 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100401 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000402*-*-dgux*)
403 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100404 AC_DEFINE(SETEUID_BREAKS_SETUID)
405 AC_DEFINE(BROKEN_SETREUID)
406 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000407 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000408*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000409 AC_MSG_CHECKING(if we have working getaddrinfo)
410 AC_TRY_RUN([#include <mach-o/dyld.h>
411main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
412 exit(0);
413 else
414 exit(1);
415}], [AC_MSG_RESULT(working)],
416 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700417 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700418 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000419 AC_DEFINE(SETEUID_BREAKS_SETUID)
420 AC_DEFINE(BROKEN_SETREUID)
421 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker528d6fa2007-12-31 21:29:26 +1100422 AC_DEFINE(BROKEN_GLOB, 1, [OS X glob does not do what we expect])
Tim Rice7df8d392005-09-19 09:33:39 -0700423 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
424 [Define if your resolver libs need this for getrrsetbyname])
Darren Tucker3eb48342006-06-23 21:05:12 +1000425 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
426 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
427 [Use tunnel device compatibility to OpenBSD])
428 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
429 [Prepend the address family to IP tunnel traffic])
Darren Tuckeracada072008-02-25 21:05:04 +1100430 m4_pattern_allow(AU_IPv)
431 AC_CHECK_DECL(AU_IPv4, [],
432 AC_DEFINE(AU_IPv4, 0, [System only supports IPv4 audit records])
433 [#include <bsm/audit.h>]
434 )
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000435 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000436*-*-dragonfly*)
437 SSHDLIBS="$SSHDLIBS -lcrypt"
438 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000439*-*-hpux*)
440 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000441 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100442 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000443 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700444 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
445 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000446 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700447 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
448 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000449 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000450 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700451 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000452 AC_CHECK_LIB(xnet, t_error, ,
453 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
454
455 # next, we define all of the options specific to major releases
456 case "$host" in
457 *-*-hpux10*)
458 if test -z "$GCC"; then
459 CFLAGS="$CFLAGS -Ae"
460 fi
461 ;;
462 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700463 AC_DEFINE(PAM_SUN_CODEBASE, 1,
464 [Define if you are using Solaris-derived PAM which
465 passes pam_messages to the conversation function
466 with an extra level of indirection])
467 AC_DEFINE(DISABLE_UTMP, 1,
468 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000469 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
470 check_for_hpux_broken_getaddrinfo=1
471 check_for_conflicting_getspnam=1
472 ;;
473 esac
474
475 # lastly, we define options specific to minor releases
476 case "$host" in
477 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700478 AC_DEFINE(HAVE_SECUREWARE, 1,
479 [Define if you have SecureWare-based
480 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000481 disable_ptmx_check=yes
482 LIBS="$LIBS -lsecpw"
483 ;;
484 esac
Damien Miller1bead332000-04-30 00:47:29 +1000485 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100486*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100487 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700488 AC_DEFINE(BROKEN_INET_NTOA, 1,
489 [Define if you system's inet_ntoa is busted
490 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000491 AC_DEFINE(SETEUID_BREAKS_SETUID)
492 AC_DEFINE(BROKEN_SETREUID)
493 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700494 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
495 [Define if you shouldn't strip 'tty' from your
496 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000497 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100498 ;;
499*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100500 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700501 AC_DEFINE(WITH_IRIX_ARRAY, 1,
502 [Define if you have/want arrays
503 (cluster-wide session managment, not C arrays)])
504 AC_DEFINE(WITH_IRIX_PROJECT, 1,
505 [Define if you want IRIX project management])
506 AC_DEFINE(WITH_IRIX_AUDIT, 1,
507 [Define if you want IRIX audit trails])
508 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
509 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000510 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000511 AC_DEFINE(SETEUID_BREAKS_SETUID)
512 AC_DEFINE(BROKEN_SETREUID)
513 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700514 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000515 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000516 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100517 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100518*-*-linux*)
519 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100520 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000521 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700522 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
523 AC_DEFINE(PAM_TTY_KLUDGE, 1,
524 [Work around problematic Linux PAM modules handling of PAM_TTY])
525 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
526 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000527 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700528 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
529 [Define to whatever link() returns for "not supported"
530 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100531 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700532 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100533 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000534 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000535 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700536 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
537 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000538 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000539 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100540 # tun(4) forwarding compat code
Damien Millerc4bcc912005-12-31 17:05:58 +1100541 AC_CHECK_HEADERS(linux/if_tun.h)
Damien Millerbd4e4102006-01-01 21:03:30 +1100542 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Damien Miller89e03ba2005-12-31 16:42:03 +1100543 AC_DEFINE(SSH_TUN_LINUX, 1,
544 [Open tunnel devices the Linux tun/tap way])
545 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
546 [Use tunnel device compatibility to OpenBSD])
547 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
548 [Prepend the address family to IP tunnel traffic])
549 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100550 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000551mips-sony-bsd|mips-sony-newsos4)
Darren Tucker988b3fd2006-02-08 22:11:27 +1100552 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000553 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000554 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100555*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000556 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800557 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800558 need_dash_r=1
559 fi
Damien Miller2dcddbf2006-01-01 19:47:05 +1100560 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
561 AC_CHECK_HEADER([net/if_tap.h], ,
562 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
563 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
564 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100565 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100566*-*-freebsd*)
567 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000568 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100569 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
570 AC_CHECK_HEADER([net/if_tap.h], ,
571 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
Darren Tucker54e859f2008-03-02 21:52:27 +1100572 AC_DEFINE(BROKEN_GLOB, 1, [FreeBSD glob does not do what we need])
Damien Millerfbd884a2001-02-27 08:39:07 +1100573 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000574*-*-bsdi*)
575 AC_DEFINE(SETEUID_BREAKS_SETUID)
576 AC_DEFINE(BROKEN_SETREUID)
577 AC_DEFINE(BROKEN_SETREGID)
578 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000579*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000580 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100581 conf_utmp_location=/etc/utmp
582 conf_wtmp_location=/usr/adm/wtmp
583 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700584 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000585 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000586 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700587 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000588 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000589*-*-openbsd*)
590 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000591 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100592 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
Damien Millerbb598142006-08-19 08:38:23 +1000593 AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1,
594 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000595 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100596*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800597 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800598 need_dash_r=1
599 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100600 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000601 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700602 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
603 [Some versions of /bin/login need the TERM supplied
604 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000605 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700606 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
607 [Define if pam_chauthtok wants real uid set
608 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000609 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000610 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700611 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
612 [Define if sshd somehow reacquires a controlling TTY
613 after setsid()])
Darren Tucker0249f932006-06-24 12:10:07 +1000614 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
615 in case the name is longer than 8 chars])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000616 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000617 # hardwire lastlog location (can't detect it on some versions)
618 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000619 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
620 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
621 if test "$sol2ver" -ge 8; then
622 AC_MSG_RESULT(yes)
623 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700624 AC_DEFINE(DISABLE_WTMP, 1,
625 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000626 else
627 AC_MSG_RESULT(no)
628 fi
Damien Miller1b06dc32006-08-31 03:24:41 +1000629 AC_ARG_WITH(solaris-contracts,
630 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
631 [
632 AC_CHECK_LIB(contract, ct_tmpl_activate,
633 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
634 [Define if you have Solaris process contracts])
635 SSHDLIBS="$SSHDLIBS -lcontract"
636 AC_SUBST(SSHDLIBS)
637 SPC_MSG="yes" ], )
638 ],
639 )
Damien Miller75b1d102000-01-07 14:01:41 +1100640 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000641*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000642 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000643 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100644 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000645 conf_utmp_location=/etc/utmp
646 conf_wtmp_location=/var/adm/wtmp
647 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000648 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000649 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000650*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700651 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000652 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000653 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000654 AC_DEFINE(SETEUID_BREAKS_SETUID)
655 AC_DEFINE(BROKEN_SETREUID)
656 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000657 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000658*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700659 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000660 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100661 # -lresolv needs to be at the end of LIBS or DNS lookups break
662 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100663 IPADDR_IN_DISPLAY=yes
664 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000665 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000666 AC_DEFINE(SETEUID_BREAKS_SETUID)
667 AC_DEFINE(BROKEN_SETREUID)
668 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000669 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000670 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700671 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
672 # Attention: always take care to bind libsocket and libnsl before libc,
673 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000674 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800675# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100676*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100677 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700678 AC_DEFINE(SETEUID_BREAKS_SETUID)
679 AC_DEFINE(BROKEN_SETREUID)
680 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700681 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice46259d82005-11-28 18:40:34 -0800682 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller78315eb2000-09-29 23:01:36 +1100683 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800684# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100685*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700686 check_for_libcrypt_later=1
687 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100688 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700689 AC_DEFINE(SETEUID_BREAKS_SETUID)
690 AC_DEFINE(BROKEN_SETREUID)
691 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700692 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700693 case "$host" in
694 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
695 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700696 AC_DEFINE(BROKEN_LIBIAF, 1,
697 [ia_uinfo routines not supported by OS yet])
Tim Riceb8f00192006-09-06 18:11:29 -0700698 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice4dbacff2005-06-01 20:09:28 -0700699 ;;
Tim Rice46259d82005-11-28 18:40:34 -0800700 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
701 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700702 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100703 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100704*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100705 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800706# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100707*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800708 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100709 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800710# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100711*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800712 if test -z "$GCC"; then
713 CFLAGS="$CFLAGS -belf"
714 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100715 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000716 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100717 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000718 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000719 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700720 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700721 AC_DEFINE(SETEUID_BREAKS_SETUID)
722 AC_DEFINE(BROKEN_SETREUID)
723 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700724 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700725 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700726 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100727 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700728 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700729 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000730 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000731*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700732 AC_DEFINE(NO_SSH_LASTLOG, 1,
733 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100734 AC_DEFINE(SETEUID_BREAKS_SETUID)
735 AC_DEFINE(BROKEN_SETREUID)
736 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000737 AC_DEFINE(USE_PIPES)
738 AC_DEFINE(DISABLE_FD_PASSING)
739 LDFLAGS="$LDFLAGS"
740 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
741 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000742 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000743*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100744 AC_DEFINE(SETEUID_BREAKS_SETUID)
745 AC_DEFINE(BROKEN_SETREUID)
746 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000747 AC_DEFINE(WITH_ABBREV_NO_TTY)
748 AC_DEFINE(USE_PIPES)
749 AC_DEFINE(DISABLE_FD_PASSING)
750 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100751 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000752 MANTYPE=cat
753 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000754*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100755 AC_DEFINE(SETEUID_BREAKS_SETUID)
756 AC_DEFINE(BROKEN_SETREUID)
757 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000758 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700759 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700760 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000761 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
762 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
763 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700764 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000765*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000766 AC_MSG_CHECKING(for Digital Unix SIA)
767 no_osfsia=""
768 AC_ARG_WITH(osfsia,
769 [ --with-osfsia Enable Digital Unix SIA],
770 [
771 if test "x$withval" = "xno" ; then
772 AC_MSG_RESULT(disabled)
773 no_osfsia=1
774 fi
775 ],
776 )
777 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000778 if test -f /etc/sia/matrix.conf; then
779 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700780 AC_DEFINE(HAVE_OSF_SIA, 1,
781 [Define if you have Digital Unix Security
782 Integration Architecture])
783 AC_DEFINE(DISABLE_LOGIN, 1,
784 [Define if you don't want to use your
785 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000786 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000787 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000788 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000789 else
790 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700791 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
792 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000793 fi
794 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000795 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700796 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000797 AC_DEFINE(BROKEN_SETREUID)
798 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000799 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000800
Tim Rice70335a62006-02-04 17:42:58 -0800801*-*-nto-qnx*)
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000802 AC_DEFINE(USE_PIPES)
803 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700804 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
805 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
806 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Tim Rice70335a62006-02-04 17:42:58 -0800807 AC_DEFINE(DISABLE_LASTLOG)
Darren Tucker54b75fe2006-02-26 12:31:48 +1100808 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckerbc1bd9d2007-09-27 07:03:20 +1000809 AC_DEFINE(BROKEN_SHADOW_EXPIRE, 1, [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -0800810 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +1000811 case "$host" in
812 *-*-nto-qnx6*)
813 AC_DEFINE(DISABLE_FD_PASSING)
814 ;;
815 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000816 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000817
818*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700819 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
820 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
Darren Tucker988b3fd2006-02-08 22:11:27 +1100821 AC_DEFINE(NEED_SETPGRP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700822 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
823 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000824
825*-*-lynxos)
826 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700827 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000828 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
829 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100830esac
831
Darren Tucker6eb93042003-06-29 21:30:41 +1000832AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000833AC_RUN_IFELSE(
834 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000835#include <stdio.h>
836int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000837 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000838 [ AC_MSG_RESULT(yes) ],
839 [
840 AC_MSG_RESULT(no)
841 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000842 ],
843 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000844)
845
Darren Tucker0c9653f2005-05-28 15:58:14 +1000846dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +1100847# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700848AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
849AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000850
Tim Rice1e1ef642003-09-11 22:19:31 -0700851dnl IRIX and Solaris 2.5.1 have dirname() in libgen
852AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
853 AC_CHECK_LIB(gen, dirname,[
854 AC_CACHE_CHECK([for broken dirname],
855 ac_cv_have_broken_dirname, [
856 save_LIBS="$LIBS"
857 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000858 AC_RUN_IFELSE(
859 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700860#include <libgen.h>
861#include <string.h>
862
863int main(int argc, char **argv) {
864 char *s, buf[32];
865
866 strncpy(buf,"/etc", 32);
867 s = dirname(buf);
868 if (!s || strncmp(s, "/", 32) != 0) {
869 exit(1);
870 } else {
871 exit(0);
872 }
873}
Darren Tucker314d89e2005-10-17 23:29:23 +1000874 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700875 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000876 [ ac_cv_have_broken_dirname="yes" ],
877 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700878 )
879 LIBS="$save_LIBS"
880 ])
881 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
882 LIBS="$LIBS -lgen"
883 AC_DEFINE(HAVE_DIRNAME)
884 AC_CHECK_HEADERS(libgen.h)
885 fi
886 ])
887])
888
889AC_CHECK_FUNC(getspnam, ,
890 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700891AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
892 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700893
Tim Rice13aae5e2001-10-21 17:53:58 -0700894dnl zlib is required
895AC_ARG_WITH(zlib,
896 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100897 [ if test "x$withval" = "xno" ; then
898 AC_MSG_ERROR([*** zlib is required ***])
899 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700900 if test -d "$withval/lib"; then
901 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700902 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700903 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700904 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700905 fi
906 else
907 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700908 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700909 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700910 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700911 fi
912 fi
913 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700914 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700915 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700916 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700917 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100918 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700919)
920
Tim Ricefcb62202004-01-23 18:35:16 -0800921AC_CHECK_LIB(z, deflate, ,
922 [
923 saved_CPPFLAGS="$CPPFLAGS"
924 saved_LDFLAGS="$LDFLAGS"
925 save_LIBS="$LIBS"
926 dnl Check default zlib install dir
927 if test -n "${need_dash_r}"; then
928 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
929 else
930 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
931 fi
932 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
933 LIBS="$LIBS -lz"
934 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
935 [
936 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
937 ]
938 )
939 ]
940)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100941AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100942
943AC_ARG_WITH(zlib-version-check,
944 [ --without-zlib-version-check Disable zlib version check],
945 [ if test "x$withval" = "xno" ; then
946 zlib_check_nonfatal=1
947 fi
948 ]
949)
950
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000951AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000952AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000953#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100954#include <zlib.h>
955int main()
956{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000957 int a=0, b=0, c=0, d=0, n, v;
958 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
959 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100960 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000961 v = a*1000000 + b*10000 + c*100 + d;
962 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
963
964 /* 1.1.4 is OK */
965 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100966 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000967
Darren Tucker41097ed2005-07-25 15:24:21 +1000968 /* 1.2.3 and up are OK */
969 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000970 exit(0);
971
Darren Tucker2dcd2392004-01-23 17:13:33 +1100972 exit(2);
973}
Darren Tucker623d92f2004-09-12 22:36:15 +1000974 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000975 AC_MSG_RESULT(no),
976 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100977 if test -z "$zlib_check_nonfatal" ; then
978 AC_MSG_ERROR([*** zlib too old - check config.log ***
979Your reported zlib version has known security problems. It's possible your
980vendor has fixed these problems without changing the version number. If you
981are sure this is the case, you can disable the check by running
982"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +1000983If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000984See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100985 else
986 AC_MSG_WARN([zlib version may have security problems])
987 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +1000988 ],
989 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +1100990)
Damien Miller6f9c3372000-10-25 10:06:04 +1100991
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000992dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +1100993AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000994 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
995)
Darren Tucker5bfe1682005-11-12 18:42:36 +1100996AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -0700997 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
998 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000999)
Damien Millerab18c411999-11-11 10:40:23 +11001000
Tim Ricee589a292001-11-03 11:09:32 -08001001dnl Checks for libutil functions
1002AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -07001003AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
1004 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -08001005AC_CHECK_FUNCS(logout updwtmp logwtmp)
1006
Ben Lindstrom8697e082001-02-24 21:41:10 +00001007AC_FUNC_STRFTIME
1008
Damien Miller3c027682001-03-14 11:39:45 +11001009# Check for ALTDIRFUNC glob() extension
1010AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
1011AC_EGREP_CPP(FOUNDIT,
1012 [
1013 #include <glob.h>
1014 #ifdef GLOB_ALTDIRFUNC
1015 FOUNDIT
1016 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001017 ],
Damien Miller3c027682001-03-14 11:39:45 +11001018 [
Tim Rice7df8d392005-09-19 09:33:39 -07001019 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
1020 [Define if your system glob() function has
1021 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +11001022 AC_MSG_RESULT(yes)
1023 ],
1024 [
1025 AC_MSG_RESULT(no)
1026 ]
1027)
Damien Millerab18c411999-11-11 10:40:23 +11001028
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001029# Check for g.gl_matchc glob() extension
1030AC_MSG_CHECKING(for gl_matchc field in glob_t)
Darren Tucker486d95e2006-03-15 21:31:39 +11001031AC_TRY_COMPILE(
Damien Milleraf87af12006-03-15 13:02:28 +11001032 [ #include <glob.h> ],
1033 [glob_t g; g.gl_matchc = 1;],
Damien Millera8e06ce2003-11-21 23:48:55 +11001034 [
Tim Rice7df8d392005-09-19 09:33:39 -07001035 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1036 [Define if your system glob() function has
1037 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +11001038 AC_MSG_RESULT(yes)
1039 ],
1040 [
1041 AC_MSG_RESULT(no)
1042 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001043)
1044
Darren Tucker096faec2006-09-01 20:29:10 +10001045AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1046
Damien Miller18bb4732001-03-28 14:35:30 +10001047AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001048AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001049 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +10001050#include <sys/types.h>
1051#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001052int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +10001053 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001054 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +10001055 [
1056 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001057 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +11001058 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001059 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001060 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001061 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001062 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1063 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +10001064 ]
1065)
1066
Damien Miller36f49652004-08-15 18:40:59 +10001067AC_MSG_CHECKING([for /proc/pid/fd directory])
1068if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07001069 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +10001070 AC_MSG_RESULT(yes)
1071else
1072 AC_MSG_RESULT(no)
1073fi
1074
Damien Millerc547bf12001-02-16 10:18:12 +11001075# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001076SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001077AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001078 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001079 [
1080 if test "x$withval" != "xno" ; then
1081
1082 if test "x$withval" != "xyes" ; then
1083 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1084 LDFLAGS="$LDFLAGS -L${withval}/lib"
1085 fi
1086
Tim Rice7df8d392005-09-19 09:33:39 -07001087 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001088 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001089 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001090
Tim Rice4cec93f2002-02-26 08:40:48 -08001091 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001092 AC_LINK_IFELSE(
1093 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001094#include <stdio.h>
1095#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001096int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +10001097 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001098 [AC_MSG_RESULT(yes)],
1099 [
1100 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +11001101 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1102 ])
Darren Tucker3b908f62004-04-14 15:26:39 +10001103 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1104 AC_TRY_COMPILE(
1105 [#include <stdio.h>
1106 #include <skey.h>],
1107 [(void)skeychallenge(NULL,"name","",0);],
1108 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001109 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1110 [Define if your skeychallenge()
1111 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +10001112 [AC_MSG_RESULT(no)]
1113 )
Damien Millerc547bf12001-02-16 10:18:12 +11001114 fi
1115 ]
1116)
1117
1118# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001119TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001120AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001121 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001122 [
1123 if test "x$withval" != "xno" ; then
1124 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001125 saved_LDFLAGS="$LDFLAGS"
1126 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001127 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001128 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001129 if test -d "${withval}/lib"; then
1130 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001131 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001132 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001133 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001134 fi
1135 else
1136 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001137 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001138 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001139 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001140 fi
1141 fi
1142 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001143 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001144 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001145 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001146 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001147 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001148 LIBS="-lwrap $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001149 AC_MSG_CHECKING(for libwrap)
1150 AC_TRY_LINK(
1151 [
Damien Miller0ac45002004-04-14 20:14:26 +10001152#include <sys/types.h>
1153#include <sys/socket.h>
1154#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001155#include <tcpd.h>
1156 int deny_severity = 0, allow_severity = 0;
1157 ],
1158 [hosts_access(0);],
1159 [
1160 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001161 AC_DEFINE(LIBWRAP, 1,
1162 [Define if you want
1163 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001164 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001165 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001166 ],
1167 [
1168 AC_MSG_ERROR([*** libwrap missing])
1169 ]
1170 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001171 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001172 fi
1173 ]
1174)
1175
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001176# Check whether user wants libedit support
1177LIBEDIT_MSG="no"
1178AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001179 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001180 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001181 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001182 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1183 if test -n "${need_dash_r}"; then
1184 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1185 else
1186 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1187 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001188 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001189 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001190 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001191 LIBEDIT="-ledit -lcurses"
1192 LIBEDIT_MSG="yes"
1193 AC_SUBST(LIBEDIT)
1194 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001195 [ AC_MSG_ERROR(libedit not found) ],
1196 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001197 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001198 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001199 AC_COMPILE_IFELSE(
1200 [AC_LANG_SOURCE([[
1201#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001202int main(void)
1203{
1204 int i = H_SETSIZE;
1205 el_init("", NULL, NULL, NULL);
1206 exit(0);
1207}
Tim Ricec1819c82005-08-15 17:48:40 -07001208 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001209 [ AC_MSG_RESULT(yes) ],
1210 [ AC_MSG_RESULT(no)
1211 AC_MSG_ERROR(libedit version is not compatible) ]
1212 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001213 fi ]
1214)
1215
Darren Tuckerd9f88912005-02-20 21:01:48 +11001216AUDIT_MODULE=none
1217AC_ARG_WITH(audit,
1218 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1219 [
1220 AC_MSG_CHECKING(for supported audit module)
1221 case "$withval" in
1222 bsm)
1223 AC_MSG_RESULT(bsm)
1224 AUDIT_MODULE=bsm
1225 dnl Checks for headers, libs and functions
1226 AC_CHECK_HEADERS(bsm/audit.h, [],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001227 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1228 [
1229#ifdef HAVE_TIME_H
1230# include <time.h>
1231#endif
1232 ]
1233)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001234 AC_CHECK_LIB(bsm, getaudit, [],
1235 [AC_MSG_ERROR(BSM enabled and required library not found)])
1236 AC_CHECK_FUNCS(getaudit, [],
1237 [AC_MSG_ERROR(BSM enabled and required function not found)])
1238 # These are optional
Darren Tuckeracada072008-02-25 21:05:04 +11001239 AC_CHECK_FUNCS(getaudit_addr aug_get_machine)
Tim Rice7df8d392005-09-19 09:33:39 -07001240 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001241 ;;
1242 debug)
1243 AUDIT_MODULE=debug
1244 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001245 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001246 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001247 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001248 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001249 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001250 *)
1251 AC_MSG_ERROR([Unknown audit module $withval])
1252 ;;
1253 esac ]
1254)
1255
Damien Millerfe1f1432003-02-24 15:45:42 +11001256dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001257AC_CHECK_FUNCS( \
1258 arc4random \
Damien Miller57f39152005-11-24 19:58:19 +11001259 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001260 b64_ntop \
1261 __b64_ntop \
1262 b64_pton \
1263 __b64_pton \
1264 bcopy \
1265 bindresvport_sa \
1266 clock \
1267 closefrom \
1268 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001269 fchmod \
1270 fchown \
1271 freeaddrinfo \
1272 futimes \
1273 getaddrinfo \
1274 getcwd \
1275 getgrouplist \
1276 getnameinfo \
1277 getopt \
1278 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001279 getpeerucred \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001280 _getpty \
1281 getrlimit \
1282 getttyent \
1283 glob \
1284 inet_aton \
1285 inet_ntoa \
1286 inet_ntop \
1287 innetgr \
1288 login_getcapbool \
1289 md5_crypt \
1290 memmove \
1291 mkdtemp \
1292 mmap \
1293 ngetaddrinfo \
1294 nsleep \
1295 ogetaddrinfo \
1296 openlog_r \
1297 openpty \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001298 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001299 prctl \
1300 pstat \
1301 readpassphrase \
1302 realpath \
1303 recvmsg \
1304 rresvport_af \
1305 sendmsg \
1306 setdtablesize \
1307 setegid \
1308 setenv \
1309 seteuid \
1310 setgroups \
1311 setlogin \
1312 setpcred \
1313 setproctitle \
1314 setregid \
1315 setreuid \
1316 setrlimit \
1317 setsid \
1318 setvbuf \
1319 sigaction \
1320 sigvec \
1321 snprintf \
1322 socketpair \
1323 strdup \
1324 strerror \
1325 strlcat \
1326 strlcpy \
1327 strmode \
1328 strnvis \
1329 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001330 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001331 strtoul \
Damien Miller34a17692007-06-11 14:15:42 +10001332 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001333 sysconf \
1334 tcgetpgrp \
1335 truncate \
1336 unsetenv \
1337 updwtmpx \
Damien Miller57f39152005-11-24 19:58:19 +11001338 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001339 vhangup \
1340 vsnprintf \
1341 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001342)
Tim Rice13aae5e2001-10-21 17:53:58 -07001343
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001344# IRIX has a const char return value for gai_strerror()
1345AC_CHECK_FUNCS(gai_strerror,[
1346 AC_DEFINE(HAVE_GAI_STRERROR)
1347 AC_TRY_COMPILE([
1348#include <sys/types.h>
1349#include <sys/socket.h>
1350#include <netdb.h>
1351
1352const char *gai_strerror(int);],[
1353char *str;
1354
1355str = gai_strerror(0);],[
1356 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1357 [Define if gai_strerror() returns const char *])])])
1358
Tim Rice7df8d392005-09-19 09:33:39 -07001359AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1360 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001361
Darren Tuckerf1159b52003-07-07 19:44:01 +10001362dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001363AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001364AC_CHECK_DECL(strsep,
1365 [AC_CHECK_FUNCS(strsep)],
1366 [],
1367 [
1368#ifdef HAVE_STRING_H
1369# include <string.h>
1370#endif
1371 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001372
Darren Tuckerb2427c82003-09-10 15:22:44 +10001373dnl tcsendbreak might be a macro
1374AC_CHECK_DECL(tcsendbreak,
1375 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001376 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001377 [#include <termios.h>]
1378)
1379
Darren Tucker5bb14002004-04-23 18:53:10 +10001380AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1381
Darren Tucker128a0892006-07-12 19:02:56 +10001382AC_CHECK_DECLS(SHUT_RD, , ,
1383 [
1384#include <sys/types.h>
1385#include <sys/socket.h>
1386 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001387
1388AC_CHECK_DECLS(O_NONBLOCK, , ,
1389 [
1390#include <sys/types.h>
1391#ifdef HAVE_SYS_STAT_H
1392# include <sys/stat.h>
1393#endif
1394#ifdef HAVE_FCNTL_H
1395# include <fcntl.h>
1396#endif
1397 ])
1398
Darren Tuckered0b5922006-09-03 22:44:49 +10001399AC_CHECK_DECLS(writev, , , [
1400#include <sys/types.h>
1401#include <sys/uio.h>
1402#include <unistd.h>
1403 ])
1404
Darren Tucker6d862a52007-04-29 14:39:02 +10001405AC_CHECK_DECLS(MAXSYMLINKS, , , [
1406#include <sys/param.h>
1407 ])
1408
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001409AC_CHECK_DECLS(offsetof, , , [
1410#include <stddef.h>
1411 ])
1412
Darren Tucker2a6b0292003-12-31 14:59:17 +11001413AC_CHECK_FUNCS(setresuid, [
1414 dnl Some platorms have setresuid that isn't implemented, test for this
1415 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001416 AC_RUN_IFELSE(
1417 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001418#include <stdlib.h>
1419#include <errno.h>
1420int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001421 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001422 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001423 [AC_DEFINE(BROKEN_SETRESUID, 1,
1424 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001425 AC_MSG_RESULT(not implemented)],
1426 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001427 )
1428])
Darren Tuckere937be32003-12-17 18:53:26 +11001429
Darren Tucker2a6b0292003-12-31 14:59:17 +11001430AC_CHECK_FUNCS(setresgid, [
1431 dnl Some platorms have setresgid that isn't implemented, test for this
1432 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001433 AC_RUN_IFELSE(
1434 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001435#include <stdlib.h>
1436#include <errno.h>
1437int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001438 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001439 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001440 [AC_DEFINE(BROKEN_SETRESGID, 1,
1441 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001442 AC_MSG_RESULT(not implemented)],
1443 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001444 )
1445])
Darren Tuckere937be32003-12-17 18:53:26 +11001446
Damien Millerad833b32000-08-23 10:46:23 +10001447dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001448AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001449dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001450AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001451AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001452dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001453AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001454AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001455
Damien Millera8e06ce2003-11-21 23:48:55 +11001456AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001457 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1458 [AC_CHECK_LIB(bsd, daemon,
1459 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001460)
1461
Damien Millera8e06ce2003-11-21 23:48:55 +11001462AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001463 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1464 [Define if your libraries define getpagesize()])],
1465 [AC_CHECK_LIB(ucb, getpagesize,
1466 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001467)
1468
Damien Millercb170cb2000-07-01 16:52:55 +10001469# Check for broken snprintf
1470if test "x$ac_cv_func_snprintf" = "xyes" ; then
1471 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001472 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001473 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001474#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001475int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001476 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001477 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001478 [
1479 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001480 AC_DEFINE(BROKEN_SNPRINTF, 1,
1481 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001482 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001483 ],
1484 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001485 )
1486fi
1487
Damien Miller57f39152005-11-24 19:58:19 +11001488# If we don't have a working asprintf, then we strongly depend on vsnprintf
1489# returning the right thing on overflow: the number of characters it tried to
1490# create (as per SUSv3)
1491if test "x$ac_cv_func_asprintf" != "xyes" && \
1492 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1493 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1494 AC_RUN_IFELSE(
1495 [AC_LANG_SOURCE([[
1496#include <sys/types.h>
1497#include <stdio.h>
1498#include <stdarg.h>
1499
1500int x_snprintf(char *str,size_t count,const char *fmt,...)
1501{
1502 size_t ret; va_list ap;
1503 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1504 return ret;
1505}
1506int main(void)
1507{
1508 char x[1];
1509 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1510} ]])],
1511 [AC_MSG_RESULT(yes)],
1512 [
1513 AC_MSG_RESULT(no)
1514 AC_DEFINE(BROKEN_SNPRINTF, 1,
1515 [Define if your snprintf is busted])
1516 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1517 ],
1518 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1519 )
1520fi
1521
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001522# On systems where [v]snprintf is broken, but is declared in stdio,
1523# check that the fmt argument is const char * or just char *.
1524# This is only useful for when BROKEN_SNPRINTF
1525AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1526AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1527 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1528 int main(void) { snprintf(0, 0, 0); }
1529 ]])],
1530 [AC_MSG_RESULT(yes)
1531 AC_DEFINE(SNPRINTF_CONST, [const],
1532 [Define as const if snprintf() can declare const char *fmt])],
1533 [AC_MSG_RESULT(no)
1534 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1535
Damien Millerb4097182004-05-23 14:09:40 +10001536# Check for missing getpeereid (or equiv) support
1537NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001538if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001539 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1540 AC_TRY_COMPILE(
1541 [#include <sys/types.h>
1542 #include <sys/socket.h>],
1543 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001544 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001545 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001546 ],
Damien Millerb4097182004-05-23 14:09:40 +10001547 [AC_MSG_RESULT(no)
1548 NO_PEERCHECK=1]
1549 )
1550fi
1551
Damien Millere8328192003-01-07 15:18:32 +11001552dnl see whether mkstemp() requires XXXXXX
1553if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1554AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001555AC_RUN_IFELSE(
1556 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001557#include <stdlib.h>
1558main() { char template[]="conftest.mkstemp-test";
1559if (mkstemp(template) == -1)
1560 exit(1);
1561unlink(template); exit(0);
1562}
Darren Tucker314d89e2005-10-17 23:29:23 +10001563 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001564 [
1565 AC_MSG_RESULT(no)
1566 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001567 [
Damien Millere8328192003-01-07 15:18:32 +11001568 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001569 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001570 ],
1571 [
1572 AC_MSG_RESULT(yes)
1573 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001574 ]
Damien Millere8328192003-01-07 15:18:32 +11001575)
1576fi
1577
Darren Tucker70a3d552003-08-21 17:58:29 +10001578dnl make sure that openpty does not reacquire controlling terminal
1579if test ! -z "$check_for_openpty_ctty_bug"; then
1580 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001581 AC_RUN_IFELSE(
1582 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001583#include <stdio.h>
1584#include <sys/fcntl.h>
1585#include <sys/types.h>
1586#include <sys/wait.h>
1587
1588int
1589main()
1590{
1591 pid_t pid;
1592 int fd, ptyfd, ttyfd, status;
1593
1594 pid = fork();
1595 if (pid < 0) { /* failed */
1596 exit(1);
1597 } else if (pid > 0) { /* parent */
1598 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001599 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001600 exit(WEXITSTATUS(status));
1601 else
1602 exit(2);
1603 } else { /* child */
1604 close(0); close(1); close(2);
1605 setsid();
1606 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1607 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1608 if (fd >= 0)
1609 exit(3); /* Acquired ctty: broken */
1610 else
1611 exit(0); /* Did not acquire ctty: OK */
1612 }
1613}
Darren Tucker314d89e2005-10-17 23:29:23 +10001614 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001615 [
1616 AC_MSG_RESULT(yes)
1617 ],
1618 [
1619 AC_MSG_RESULT(no)
1620 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001621 ],
1622 [
1623 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001624 ]
1625 )
1626fi
1627
Tim Rice8bb561b2005-03-17 16:23:19 -08001628if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1629 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001630 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001631 AC_RUN_IFELSE(
1632 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001633#include <stdio.h>
1634#include <sys/socket.h>
1635#include <netdb.h>
1636#include <errno.h>
1637#include <netinet/in.h>
1638
1639#define TEST_PORT "2222"
1640
1641int
1642main(void)
1643{
1644 int err, sock;
1645 struct addrinfo *gai_ai, *ai, hints;
1646 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1647
1648 memset(&hints, 0, sizeof(hints));
1649 hints.ai_family = PF_UNSPEC;
1650 hints.ai_socktype = SOCK_STREAM;
1651 hints.ai_flags = AI_PASSIVE;
1652
1653 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1654 if (err != 0) {
1655 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1656 exit(1);
1657 }
1658
1659 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1660 if (ai->ai_family != AF_INET6)
1661 continue;
1662
1663 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1664 sizeof(ntop), strport, sizeof(strport),
1665 NI_NUMERICHOST|NI_NUMERICSERV);
1666
1667 if (err != 0) {
1668 if (err == EAI_SYSTEM)
1669 perror("getnameinfo EAI_SYSTEM");
1670 else
1671 fprintf(stderr, "getnameinfo failed: %s\n",
1672 gai_strerror(err));
1673 exit(2);
1674 }
1675
1676 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1677 if (sock < 0)
1678 perror("socket");
1679 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1680 if (errno == EBADF)
1681 exit(3);
1682 }
1683 }
1684 exit(0);
1685}
Darren Tucker314d89e2005-10-17 23:29:23 +10001686 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001687 [
1688 AC_MSG_RESULT(yes)
1689 ],
1690 [
1691 AC_MSG_RESULT(no)
1692 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001693 ],
1694 [
1695 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001696 ]
1697 )
1698fi
1699
Tim Rice8bb561b2005-03-17 16:23:19 -08001700if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1701 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001702 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001703 AC_RUN_IFELSE(
1704 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001705#include <stdio.h>
1706#include <sys/socket.h>
1707#include <netdb.h>
1708#include <errno.h>
1709#include <netinet/in.h>
1710
1711#define TEST_PORT "2222"
1712
1713int
1714main(void)
1715{
1716 int err, sock;
1717 struct addrinfo *gai_ai, *ai, hints;
1718 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1719
1720 memset(&hints, 0, sizeof(hints));
1721 hints.ai_family = PF_UNSPEC;
1722 hints.ai_socktype = SOCK_STREAM;
1723 hints.ai_flags = AI_PASSIVE;
1724
1725 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1726 if (err != 0) {
1727 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1728 exit(1);
1729 }
1730
1731 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1732 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1733 continue;
1734
1735 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1736 sizeof(ntop), strport, sizeof(strport),
1737 NI_NUMERICHOST|NI_NUMERICSERV);
1738
1739 if (ai->ai_family == AF_INET && err != 0) {
1740 perror("getnameinfo");
1741 exit(2);
1742 }
1743 }
1744 exit(0);
1745}
Darren Tucker314d89e2005-10-17 23:29:23 +10001746 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001747 [
1748 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001749 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1750 [Define if you have a getaddrinfo that fails
1751 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001752 ],
1753 [
1754 AC_MSG_RESULT(no)
1755 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001756 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10001757 [
Darren Tucker314d89e2005-10-17 23:29:23 +10001758 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001759 ]
1760 )
1761fi
1762
Darren Tuckera56f1912004-11-02 20:30:54 +11001763if test "x$check_for_conflicting_getspnam" = "x1"; then
1764 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1765 AC_COMPILE_IFELSE(
1766 [
1767#include <shadow.h>
1768int main(void) {exit(0);}
1769 ],
1770 [
1771 AC_MSG_RESULT(no)
1772 ],
1773 [
1774 AC_MSG_RESULT(yes)
1775 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1776 [Conflicting defs for getspnam])
1777 ]
1778 )
1779fi
1780
Damien Miller606f8802000-09-16 15:39:56 +11001781AC_FUNC_GETPGRP
1782
Tim Riceaef73712002-05-11 13:17:42 -07001783# Search for OpenSSL
1784saved_CPPFLAGS="$CPPFLAGS"
1785saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001786AC_ARG_WITH(ssl-dir,
1787 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1788 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001789 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001790 case "$withval" in
1791 # Relative paths
1792 ./*|../*) withval="`pwd`/$withval"
1793 esac
Tim Riceaef73712002-05-11 13:17:42 -07001794 if test -d "$withval/lib"; then
1795 if test -n "${need_dash_r}"; then
1796 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1797 else
1798 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1799 fi
1800 else
1801 if test -n "${need_dash_r}"; then
1802 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1803 else
1804 LDFLAGS="-L${withval} ${LDFLAGS}"
1805 fi
1806 fi
1807 if test -d "$withval/include"; then
1808 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1809 else
1810 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1811 fi
Damien Millera22ba012000-03-02 23:09:20 +11001812 fi
1813 ]
1814)
Tim Rice3d5352e2004-02-12 09:27:21 -08001815LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001816AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1817 [Define if your ssl headers are included
1818 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001819 [
Tim Riceaef73712002-05-11 13:17:42 -07001820 dnl Check default openssl install dir
1821 if test -n "${need_dash_r}"; then
1822 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001823 else
Tim Riceaef73712002-05-11 13:17:42 -07001824 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001825 fi
Tim Riceaef73712002-05-11 13:17:42 -07001826 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1827 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1828 [
1829 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1830 ]
1831 )
1832 ]
1833)
1834
Tim Riced730b782002-08-13 18:52:10 -07001835# Determine OpenSSL header version
1836AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001837AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001838 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001839#include <stdio.h>
1840#include <string.h>
1841#include <openssl/opensslv.h>
1842#define DATA "conftest.sslincver"
1843int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001844 FILE *fd;
1845 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001846
Damien Millera8e06ce2003-11-21 23:48:55 +11001847 fd = fopen(DATA,"w");
1848 if(fd == NULL)
1849 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001850
1851 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1852 exit(1);
1853
1854 exit(0);
1855}
Darren Tucker623d92f2004-09-12 22:36:15 +10001856 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001857 [
1858 ssl_header_ver=`cat conftest.sslincver`
1859 AC_MSG_RESULT($ssl_header_ver)
1860 ],
1861 [
1862 AC_MSG_RESULT(not found)
1863 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001864 ],
1865 [
1866 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001867 ]
1868)
1869
1870# Determine OpenSSL library version
1871AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001872AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001873 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001874#include <stdio.h>
1875#include <string.h>
1876#include <openssl/opensslv.h>
1877#include <openssl/crypto.h>
1878#define DATA "conftest.ssllibver"
1879int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001880 FILE *fd;
1881 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001882
Damien Millera8e06ce2003-11-21 23:48:55 +11001883 fd = fopen(DATA,"w");
1884 if(fd == NULL)
1885 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001886
1887 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1888 exit(1);
1889
1890 exit(0);
1891}
Darren Tucker623d92f2004-09-12 22:36:15 +10001892 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001893 [
1894 ssl_library_ver=`cat conftest.ssllibver`
1895 AC_MSG_RESULT($ssl_library_ver)
1896 ],
1897 [
1898 AC_MSG_RESULT(not found)
1899 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001900 ],
1901 [
1902 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001903 ]
1904)
Damien Millera22ba012000-03-02 23:09:20 +11001905
Damien Miller9975e482007-03-05 11:51:27 +11001906AC_ARG_WITH(openssl-header-check,
1907 [ --without-openssl-header-check Disable OpenSSL version consistency check],
1908 [ if test "x$withval" = "xno" ; then
1909 openssl_check_nonfatal=1
1910 fi
1911 ]
1912)
1913
Damien Millerec932372002-01-22 22:16:03 +11001914# Sanity check OpenSSL headers
1915AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001916AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001917 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001918#include <string.h>
1919#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001920int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001921 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001922 [
1923 AC_MSG_RESULT(yes)
1924 ],
1925 [
1926 AC_MSG_RESULT(no)
Damien Miller9975e482007-03-05 11:51:27 +11001927 if test "x$openssl_check_nonfatal" = "x"; then
1928 AC_MSG_ERROR([Your OpenSSL headers do not match your
1929library. Check config.log for details.
1930If you are sure your installation is consistent, you can disable the check
1931by running "./configure --without-openssl-header-check".
1932Also see contrib/findssl.sh for help identifying header/library mismatches.
1933])
1934 else
1935 AC_MSG_WARN([Your OpenSSL headers do not match your
1936library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10001937Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11001938 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001939 ],
1940 [
1941 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001942 ]
1943)
1944
Darren Tucker639bbe82006-08-20 20:17:53 +10001945AC_MSG_CHECKING([if programs using OpenSSL functions will link])
1946AC_LINK_IFELSE(
1947 [AC_LANG_SOURCE([[
1948#include <openssl/evp.h>
1949int main(void) { SSLeay_add_all_algorithms(); }
1950 ]])],
1951 [
1952 AC_MSG_RESULT(yes)
1953 ],
1954 [
1955 AC_MSG_RESULT(no)
1956 saved_LIBS="$LIBS"
1957 LIBS="$LIBS -ldl"
1958 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
1959 AC_LINK_IFELSE(
1960 [AC_LANG_SOURCE([[
1961#include <openssl/evp.h>
1962int main(void) { SSLeay_add_all_algorithms(); }
1963 ]])],
1964 [
1965 AC_MSG_RESULT(yes)
1966 ],
1967 [
1968 AC_MSG_RESULT(no)
1969 LIBS="$saved_LIBS"
1970 ]
1971 )
1972 ]
1973)
1974
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11001975AC_ARG_WITH(ssl-engine,
1976 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
1977 [ if test "x$withval" != "xno" ; then
1978 AC_MSG_CHECKING(for OpenSSL ENGINE support)
1979 AC_TRY_COMPILE(
1980 [ #include <openssl/engine.h>],
1981 [
Darren Tucker5e8381e2006-09-29 20:16:51 +10001982ENGINE_load_builtin_engines();ENGINE_register_all_complete();
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11001983 ],
1984 [ AC_MSG_RESULT(yes)
1985 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
1986 [Enable OpenSSL engine support])
1987 ],
1988 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
1989 )
1990 fi ]
1991)
1992
Darren Tucker129d0bb2005-12-19 17:40:40 +11001993# Check for OpenSSL without EVP_aes_{192,256}_cbc
1994AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10001995AC_LINK_IFELSE(
Darren Tucker129d0bb2005-12-19 17:40:40 +11001996 [AC_LANG_SOURCE([[
1997#include <string.h>
1998#include <openssl/evp.h>
Darren Tuckercc7c2122006-02-02 18:44:19 +11001999int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
Darren Tucker129d0bb2005-12-19 17:40:40 +11002000 ]])],
2001 [
2002 AC_MSG_RESULT(no)
2003 ],
2004 [
2005 AC_MSG_RESULT(yes)
2006 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2007 [libcrypto is missing AES 192 and 256 bit functions])
2008 ]
2009)
2010
Tim Rice3d5352e2004-02-12 09:27:21 -08002011# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2012# because the system crypt() is more featureful.
2013if test "x$check_for_libcrypt_before" = "x1"; then
2014 AC_CHECK_LIB(crypt, crypt)
2015fi
2016
Damien Millera8e06ce2003-11-21 23:48:55 +11002017# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002018# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002019if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11002020 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11002021fi
2022
Damien Milleraf87af12006-03-15 13:02:28 +11002023# Search for SHA256 support in libc and/or OpenSSL
2024AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
2025
Tim Rice99203ec2007-03-26 09:35:28 -07002026saved_LIBS="$LIBS"
2027AC_CHECK_LIB(iaf, ia_openinfo, [
2028 LIBS="$LIBS -liaf"
Tim Rice0eeaf122007-09-10 16:24:17 -07002029 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
2030 AC_DEFINE(HAVE_LIBIAF, 1,
2031 [Define if system has libiaf that supports set_id])
2032 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002033])
2034LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002035
2036### Configure cryptographic random number support
2037
2038# Check wheter OpenSSL seeds itself
2039AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002040AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002041 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11002042#include <string.h>
2043#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07002044int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10002045 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002046 [
2047 OPENSSL_SEEDS_ITSELF=yes
2048 AC_MSG_RESULT(yes)
2049 ],
2050 [
2051 AC_MSG_RESULT(no)
2052 # Default to use of the rand helper if OpenSSL doesn't
2053 # seed itself
2054 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10002055 ],
2056 [
2057 AC_MSG_WARN([cross compiling: assuming yes])
2058 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08002059 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002060 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002061 ]
2062)
2063
Darren Tucker3e6bde42006-08-20 20:03:50 +10002064# Check for PAM libs
2065PAM_MSG="no"
2066AC_ARG_WITH(pam,
2067 [ --with-pam Enable PAM support ],
2068 [
2069 if test "x$withval" != "xno" ; then
2070 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2071 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2072 AC_MSG_ERROR([PAM headers not found])
2073 fi
2074
2075 saved_LIBS="$LIBS"
2076 AC_CHECK_LIB(dl, dlopen, , )
2077 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2078 AC_CHECK_FUNCS(pam_getenvlist)
2079 AC_CHECK_FUNCS(pam_putenv)
2080 LIBS="$saved_LIBS"
2081
2082 PAM_MSG="yes"
2083
Darren Tucker20e9f972007-03-25 18:26:01 +10002084 SSHDLIBS="$SSHDLIBS -lpam"
Darren Tucker3e6bde42006-08-20 20:03:50 +10002085 AC_DEFINE(USE_PAM, 1,
2086 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002087
Darren Tucker3e6bde42006-08-20 20:03:50 +10002088 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002089 case "$LIBS" in
2090 *-ldl*)
2091 # libdl already in LIBS
2092 ;;
2093 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002094 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002095 ;;
2096 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002097 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002098 fi
2099 ]
2100)
2101
2102# Check for older PAM
2103if test "x$PAM_MSG" = "xyes" ; then
2104 # Check PAM strerror arguments (old PAM)
2105 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2106 AC_TRY_COMPILE(
2107 [
2108#include <stdlib.h>
2109#if defined(HAVE_SECURITY_PAM_APPL_H)
2110#include <security/pam_appl.h>
2111#elif defined (HAVE_PAM_PAM_APPL_H)
2112#include <pam/pam_appl.h>
2113#endif
2114 ],
2115 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2116 [AC_MSG_RESULT(no)],
2117 [
2118 AC_DEFINE(HAVE_OLD_PAM, 1,
2119 [Define if you have an old version of PAM
2120 which takes only one argument to pam_strerror])
2121 AC_MSG_RESULT(yes)
2122 PAM_MSG="yes (old library)"
2123 ]
2124 )
2125fi
Damien Miller6c21c512002-01-22 21:57:53 +11002126
2127# Do we want to force the use of the rand helper?
2128AC_ARG_WITH(rand-helper,
2129 [ --with-rand-helper Use subprocess to gather strong randomness ],
2130 [
2131 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002132 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11002133 # the previous test showed it to be unseeded.
2134 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2135 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2136 OPENSSL_SEEDS_ITSELF=yes
2137 USE_RAND_HELPER=""
2138 fi
2139 else
2140 USE_RAND_HELPER=yes
2141 fi
2142 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08002143)
Damien Miller6c21c512002-01-22 21:57:53 +11002144
2145# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08002146if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002147 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07002148 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2149 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11002150 RAND_MSG="OpenSSL internal ONLY"
2151 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08002152elif test ! -z "$USE_RAND_HELPER" ; then
2153 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11002154 RAND_MSG="ssh-rand-helper"
2155 INSTALL_SSH_RAND_HELPER="yes"
2156fi
2157AC_SUBST(INSTALL_SSH_RAND_HELPER)
2158
2159### Configuration of ssh-rand-helper
2160
2161# PRNGD TCP socket
2162AC_ARG_WITH(prngd-port,
2163 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2164 [
Damien Millere996d722002-01-23 11:20:59 +11002165 case "$withval" in
2166 no)
2167 withval=""
2168 ;;
2169 [[0-9]]*)
2170 ;;
2171 *)
2172 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2173 ;;
2174 esac
2175 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002176 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002177 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2178 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002179 fi
2180 ]
2181)
2182
2183# PRNGD Unix domain socket
2184AC_ARG_WITH(prngd-socket,
2185 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2186 [
Damien Millere996d722002-01-23 11:20:59 +11002187 case "$withval" in
2188 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11002189 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11002190 ;;
2191 no)
2192 withval=""
2193 ;;
2194 /*)
2195 ;;
2196 *)
2197 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2198 ;;
2199 esac
2200
2201 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002202 if test ! -z "$PRNGD_PORT" ; then
2203 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2204 fi
Damien Miller6385ba02002-01-23 08:12:36 +11002205 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002206 AC_MSG_WARN(Entropy socket is not readable)
2207 fi
2208 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002209 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2210 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002211 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08002212 ],
2213 [
2214 # Check for existing socket only if we don't have a random device already
2215 if test "$USE_RAND_HELPER" = yes ; then
2216 AC_MSG_CHECKING(for PRNGD/EGD socket)
2217 # Insert other locations here
2218 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2219 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2220 PRNGD_SOCKET="$sock"
2221 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2222 break;
2223 fi
2224 done
2225 if test ! -z "$PRNGD_SOCKET" ; then
2226 AC_MSG_RESULT($PRNGD_SOCKET)
2227 else
2228 AC_MSG_RESULT(not found)
2229 fi
2230 fi
Damien Miller6c21c512002-01-22 21:57:53 +11002231 ]
2232)
2233
2234# Change default command timeout for hashing entropy source
2235entropy_timeout=200
2236AC_ARG_WITH(entropy-timeout,
2237 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2238 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002239 if test -n "$withval" && test "x$withval" != "xno" && \
2240 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002241 entropy_timeout=$withval
2242 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002243 ]
Damien Miller6c21c512002-01-22 21:57:53 +11002244)
Tim Rice7df8d392005-09-19 09:33:39 -07002245AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2246 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11002247
Damien Millerd3f6ad22002-06-25 10:24:47 +10002248SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00002249AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00002250 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002251 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002252 if test -n "$withval" && test "x$withval" != "xno" && \
2253 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002254 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002255 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002256 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002257)
Tim Rice7df8d392005-09-19 09:33:39 -07002258AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2259 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10002260AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00002261
Tim Rice88f2ab52002-03-17 12:17:34 -08002262# We do this little dance with the search path to insure
2263# that programs that we select for use by installed programs
2264# (which may be run by the super-user) come from trusted
2265# locations before they come from the user's private area.
2266# This should help avoid accidentally configuring some
2267# random version of a program in someone's personal bin.
2268
2269OPATH=$PATH
2270PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07002271test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08002272test -d /sbin && PATH=$PATH:/sbin
2273test -d /usr/sbin && PATH=$PATH:/usr/sbin
2274PATH=$PATH:/etc:$OPATH
2275
Damien Millera8e06ce2003-11-21 23:48:55 +11002276# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11002277OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2278OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2279OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2280OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2281OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2282OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2283OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2284OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2285OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2286OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2287OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2288OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2289OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2290OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2291OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2292OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002293# restore PATH
2294PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002295
2296# Where does ssh-rand-helper get its randomness from?
2297INSTALL_SSH_PRNG_CMDS=""
2298if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2299 if test ! -z "$PRNGD_PORT" ; then
2300 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2301 elif test ! -z "$PRNGD_SOCKET" ; then
2302 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2303 else
2304 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2305 RAND_HELPER_CMDHASH=yes
2306 INSTALL_SSH_PRNG_CMDS="yes"
2307 fi
2308fi
2309AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2310
2311
Ben Lindstromb5628642000-10-18 00:02:25 +00002312# Cheap hack to ensure NEWS-OS libraries are arranged right.
2313if test ! -z "$SONY" ; then
2314 LIBS="$LIBS -liberty";
2315fi
2316
Damien Miller57f39152005-11-24 19:58:19 +11002317# Check for long long datatypes
2318AC_CHECK_TYPES([long long, unsigned long long, long double])
2319
2320# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002321AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002322AC_CHECK_SIZEOF(short int, 2)
2323AC_CHECK_SIZEOF(int, 4)
2324AC_CHECK_SIZEOF(long int, 4)
2325AC_CHECK_SIZEOF(long long int, 8)
2326
Damien Millerfa2bb692002-04-23 23:22:25 +10002327# Sanity check long long for some platforms (AIX)
2328if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2329 ac_cv_sizeof_long_long_int=0
2330fi
2331
Darren Tucker537f1ed2005-10-25 18:38:33 +10002332# compute LLONG_MIN and LLONG_MAX if we don't know them.
2333if test -z "$have_llong_max"; then
2334 AC_MSG_CHECKING([for max value of long long])
2335 AC_RUN_IFELSE(
2336 [AC_LANG_SOURCE([[
2337#include <stdio.h>
2338/* Why is this so damn hard? */
2339#ifdef __GNUC__
2340# undef __GNUC__
2341#endif
2342#define __USE_ISOC99
2343#include <limits.h>
2344#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002345#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2346
2347/*
2348 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2349 * we do this the hard way.
2350 */
2351static int
2352fprint_ll(FILE *f, long long n)
2353{
2354 unsigned int i;
2355 int l[sizeof(long long) * 8];
2356
2357 if (n < 0)
2358 if (fprintf(f, "-") < 0)
2359 return -1;
2360 for (i = 0; n != 0; i++) {
2361 l[i] = my_abs(n % 10);
2362 n /= 10;
2363 }
2364 do {
2365 if (fprintf(f, "%d", l[--i]) < 0)
2366 return -1;
2367 } while (i != 0);
2368 if (fprintf(f, " ") < 0)
2369 return -1;
2370 return 0;
2371}
2372
Darren Tucker537f1ed2005-10-25 18:38:33 +10002373int main(void) {
2374 FILE *f;
2375 long long i, llmin, llmax = 0;
2376
2377 if((f = fopen(DATA,"w")) == NULL)
2378 exit(1);
2379
2380#if defined(LLONG_MIN) && defined(LLONG_MAX)
2381 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2382 llmin = LLONG_MIN;
2383 llmax = LLONG_MAX;
2384#else
2385 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2386 /* This will work on one's complement and two's complement */
2387 for (i = 1; i > llmax; i <<= 1, i++)
2388 llmax = i;
2389 llmin = llmax + 1LL; /* wrap */
2390#endif
2391
2392 /* Sanity check */
2393 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002394 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2395 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002396 fprintf(f, "unknown unknown\n");
2397 exit(2);
2398 }
2399
Darren Tuckerd1450db2006-03-13 19:06:51 +11002400 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002401 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002402 if (fprint_ll(f, llmax) < 0)
2403 exit(4);
2404 if (fclose(f) < 0)
2405 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002406 exit(0);
2407}
2408 ]])],
2409 [
2410 llong_min=`$AWK '{print $1}' conftest.llminmax`
2411 llong_max=`$AWK '{print $2}' conftest.llminmax`
2412
Darren Tucker537f1ed2005-10-25 18:38:33 +10002413 AC_MSG_RESULT($llong_max)
2414 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2415 [max value of long long calculated by configure])
2416 AC_MSG_CHECKING([for min value of long long])
2417 AC_MSG_RESULT($llong_min)
2418 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2419 [min value of long long calculated by configure])
2420 ],
2421 [
2422 AC_MSG_RESULT(not found)
2423 ],
2424 [
2425 AC_MSG_WARN([cross compiling: not checking])
2426 ]
2427 )
2428fi
2429
2430
Damien Millera22ba012000-03-02 23:09:20 +11002431# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002432AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2433 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002434 [ #include <sys/types.h> ],
2435 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002436 [ ac_cv_have_u_int="yes" ],
2437 [ ac_cv_have_u_int="no" ]
2438 )
2439])
2440if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002441 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002442 have_u_int=1
2443fi
2444
Damien Miller61e50f12000-05-08 20:49:37 +10002445AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2446 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002447 [ #include <sys/types.h> ],
2448 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002449 [ ac_cv_have_intxx_t="yes" ],
2450 [ ac_cv_have_intxx_t="no" ]
2451 )
2452])
2453if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002454 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002455 have_intxx_t=1
2456fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002457
2458if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002459 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002460then
2461 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2462 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002463 [ #include <stdint.h> ],
2464 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002465 [
2466 AC_DEFINE(HAVE_INTXX_T)
2467 AC_MSG_RESULT(yes)
2468 ],
2469 [ AC_MSG_RESULT(no) ]
2470 )
2471fi
2472
Damien Miller578783e2000-09-23 14:12:24 +11002473AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2474 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002475 [
2476#include <sys/types.h>
2477#ifdef HAVE_STDINT_H
2478# include <stdint.h>
2479#endif
2480#include <sys/socket.h>
2481#ifdef HAVE_SYS_BITYPES_H
2482# include <sys/bitypes.h>
2483#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002484 ],
2485 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002486 [ ac_cv_have_int64_t="yes" ],
2487 [ ac_cv_have_int64_t="no" ]
2488 )
2489])
2490if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002491 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002492fi
2493
Damien Miller61e50f12000-05-08 20:49:37 +10002494AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2495 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002496 [ #include <sys/types.h> ],
2497 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002498 [ ac_cv_have_u_intxx_t="yes" ],
2499 [ ac_cv_have_u_intxx_t="no" ]
2500 )
2501])
2502if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002503 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002504 have_u_intxx_t=1
2505fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002506
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002507if test -z "$have_u_intxx_t" ; then
2508 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2509 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002510 [ #include <sys/socket.h> ],
2511 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002512 [
2513 AC_DEFINE(HAVE_U_INTXX_T)
2514 AC_MSG_RESULT(yes)
2515 ],
2516 [ AC_MSG_RESULT(no) ]
2517 )
2518fi
2519
Damien Miller578783e2000-09-23 14:12:24 +11002520AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2521 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002522 [ #include <sys/types.h> ],
2523 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002524 [ ac_cv_have_u_int64_t="yes" ],
2525 [ ac_cv_have_u_int64_t="no" ]
2526 )
2527])
2528if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002529 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002530 have_u_int64_t=1
2531fi
2532
Tim Rice4cec93f2002-02-26 08:40:48 -08002533if test -z "$have_u_int64_t" ; then
2534 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2535 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002536 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002537 [ u_int64_t a; a = 1],
2538 [
2539 AC_DEFINE(HAVE_U_INT64_T)
2540 AC_MSG_RESULT(yes)
2541 ],
2542 [ AC_MSG_RESULT(no) ]
2543 )
2544fi
2545
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002546if test -z "$have_u_intxx_t" ; then
2547 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2548 AC_TRY_COMPILE(
2549 [
2550#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002551 ],
2552 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002553 [ ac_cv_have_uintxx_t="yes" ],
2554 [ ac_cv_have_uintxx_t="no" ]
2555 )
2556 ])
2557 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002558 AC_DEFINE(HAVE_UINTXX_T, 1,
2559 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002560 fi
2561fi
2562
2563if test -z "$have_uintxx_t" ; then
2564 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2565 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002566 [ #include <stdint.h> ],
2567 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002568 [
2569 AC_DEFINE(HAVE_UINTXX_T)
2570 AC_MSG_RESULT(yes)
2571 ],
2572 [ AC_MSG_RESULT(no) ]
2573 )
2574fi
2575
Damien Milleredb82922000-06-20 13:25:52 +10002576if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002577 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002578then
2579 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2580 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002581 [
2582#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002583 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002584 [
Damien Miller70494d12000-04-03 15:57:06 +10002585 int8_t a; int16_t b; int32_t c;
2586 u_int8_t e; u_int16_t f; u_int32_t g;
2587 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002588 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002589 [
2590 AC_DEFINE(HAVE_U_INTXX_T)
2591 AC_DEFINE(HAVE_INTXX_T)
2592 AC_MSG_RESULT(yes)
2593 ],
2594 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002595 )
Damien Millerb29ea912000-01-15 14:12:03 +11002596fi
2597
Damien Miller58be7382001-09-15 21:31:54 +10002598
2599AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2600 AC_TRY_COMPILE(
2601 [
2602#include <sys/types.h>
2603 ],
2604 [ u_char foo; foo = 125; ],
2605 [ ac_cv_have_u_char="yes" ],
2606 [ ac_cv_have_u_char="no" ]
2607 )
2608])
2609if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002610 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002611fi
2612
Tim Rice13aae5e2001-10-21 17:53:58 -07002613TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002614
Tim Rice200a5c02002-02-26 22:12:34 -08002615AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002616
Damien Miller848b9932005-02-24 12:12:34 +11002617AC_CHECK_TYPES(in_addr_t,,,
2618[#include <sys/types.h>
2619#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002620
Damien Miller61e50f12000-05-08 20:49:37 +10002621AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2622 AC_TRY_COMPILE(
2623 [
2624#include <sys/types.h>
2625 ],
2626 [ size_t foo; foo = 1235; ],
2627 [ ac_cv_have_size_t="yes" ],
2628 [ ac_cv_have_size_t="no" ]
2629 )
2630])
2631if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002632 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002633fi
Damien Miller95058511999-12-29 10:36:45 +11002634
Damien Miller615f9392000-05-17 22:53:33 +10002635AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2636 AC_TRY_COMPILE(
2637 [
2638#include <sys/types.h>
2639 ],
2640 [ ssize_t foo; foo = 1235; ],
2641 [ ac_cv_have_ssize_t="yes" ],
2642 [ ac_cv_have_ssize_t="no" ]
2643 )
2644])
2645if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002646 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002647fi
2648
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002649AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2650 AC_TRY_COMPILE(
2651 [
2652#include <time.h>
2653 ],
2654 [ clock_t foo; foo = 1235; ],
2655 [ ac_cv_have_clock_t="yes" ],
2656 [ ac_cv_have_clock_t="no" ]
2657 )
2658])
2659if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002660 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002661fi
2662
Damien Millerb54b40e2000-06-23 08:23:34 +10002663AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2664 AC_TRY_COMPILE(
2665 [
2666#include <sys/types.h>
2667#include <sys/socket.h>
2668 ],
2669 [ sa_family_t foo; foo = 1235; ],
2670 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002671 [ AC_TRY_COMPILE(
2672 [
2673#include <sys/types.h>
2674#include <sys/socket.h>
2675#include <netinet/in.h>
2676 ],
2677 [ sa_family_t foo; foo = 1235; ],
2678 [ ac_cv_have_sa_family_t="yes" ],
2679
Damien Millerb54b40e2000-06-23 08:23:34 +10002680 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002681 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002682 )
2683])
2684if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002685 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2686 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002687fi
2688
Damien Miller0f91b4e2000-06-18 15:43:25 +10002689AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2690 AC_TRY_COMPILE(
2691 [
2692#include <sys/types.h>
2693 ],
2694 [ pid_t foo; foo = 1235; ],
2695 [ ac_cv_have_pid_t="yes" ],
2696 [ ac_cv_have_pid_t="no" ]
2697 )
2698])
2699if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002700 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002701fi
2702
2703AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2704 AC_TRY_COMPILE(
2705 [
2706#include <sys/types.h>
2707 ],
2708 [ mode_t foo; foo = 1235; ],
2709 [ ac_cv_have_mode_t="yes" ],
2710 [ ac_cv_have_mode_t="no" ]
2711 )
2712])
2713if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002714 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002715fi
2716
Damien Miller61e50f12000-05-08 20:49:37 +10002717
2718AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2719 AC_TRY_COMPILE(
2720 [
Damien Miller81171112000-04-23 11:14:01 +10002721#include <sys/types.h>
2722#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002723 ],
2724 [ struct sockaddr_storage s; ],
2725 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2726 [ ac_cv_have_struct_sockaddr_storage="no" ]
2727 )
2728])
2729if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002730 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2731 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002732fi
Damien Miller34132e52000-01-14 15:45:46 +11002733
Damien Miller61e50f12000-05-08 20:49:37 +10002734AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2735 AC_TRY_COMPILE(
2736 [
Damien Miller7b22d652000-06-18 14:07:04 +10002737#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002738#include <netinet/in.h>
2739 ],
2740 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2741 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2742 [ ac_cv_have_struct_sockaddr_in6="no" ]
2743 )
2744])
2745if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002746 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2747 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002748fi
Damien Miller34132e52000-01-14 15:45:46 +11002749
Damien Miller61e50f12000-05-08 20:49:37 +10002750AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2751 AC_TRY_COMPILE(
2752 [
Damien Miller7b22d652000-06-18 14:07:04 +10002753#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002754#include <netinet/in.h>
2755 ],
2756 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2757 [ ac_cv_have_struct_in6_addr="yes" ],
2758 [ ac_cv_have_struct_in6_addr="no" ]
2759 )
2760])
2761if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002762 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2763 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002764fi
Damien Miller34132e52000-01-14 15:45:46 +11002765
Damien Miller61e50f12000-05-08 20:49:37 +10002766AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2767 AC_TRY_COMPILE(
2768 [
Damien Miller81171112000-04-23 11:14:01 +10002769#include <sys/types.h>
2770#include <sys/socket.h>
2771#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002772 ],
2773 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2774 [ ac_cv_have_struct_addrinfo="yes" ],
2775 [ ac_cv_have_struct_addrinfo="no" ]
2776 )
2777])
2778if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002779 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2780 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002781fi
2782
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002783AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2784 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002785 [ #include <sys/time.h> ],
2786 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002787 [ ac_cv_have_struct_timeval="yes" ],
2788 [ ac_cv_have_struct_timeval="no" ]
2789 )
2790])
2791if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002792 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002793 have_struct_timeval=1
2794fi
2795
Tim Rice4e4dc562003-03-18 10:21:40 -08002796AC_CHECK_TYPES(struct timespec)
2797
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002798# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002799if test "x$ac_cv_have_int64_t" = "xno" && \
2800 test "x$ac_cv_sizeof_long_int" != "x8" && \
2801 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002802 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2803 echo "an alternative compiler (I.E., GCC) before continuing."
2804 echo ""
2805 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002806else
2807dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002808 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002809 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002810#include <stdio.h>
2811#include <string.h>
2812#ifdef HAVE_SNPRINTF
2813main()
2814{
2815 char buf[50];
2816 char expected_out[50];
2817 int mazsize = 50 ;
2818#if (SIZEOF_LONG_INT == 8)
2819 long int num = 0x7fffffffffffffff;
2820#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002821 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002822#endif
2823 strcpy(expected_out, "9223372036854775807");
2824 snprintf(buf, mazsize, "%lld", num);
2825 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002826 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002827 exit(0);
2828}
2829#else
2830main() { exit(0); }
2831#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002832 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002833 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002834 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002835fi
2836
Damien Miller78315eb2000-09-29 23:01:36 +11002837dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002838OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2839OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2840OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2841OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2842OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002843OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002844OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2845OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002846OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002847OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2848OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2849OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2850OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002851OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2852OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2853OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2854OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002855
2856AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11002857AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2858 [Define if we don't have struct __res_state in resolv.h])],
2859[
2860#include <stdio.h>
2861#if HAVE_SYS_TYPES_H
2862# include <sys/types.h>
2863#endif
2864#include <netinet/in.h>
2865#include <arpa/nameser.h>
2866#include <resolv.h>
2867])
andre2ff7b5d2000-06-03 14:57:40 +00002868
Damien Miller61e50f12000-05-08 20:49:37 +10002869AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2870 ac_cv_have_ss_family_in_struct_ss, [
2871 AC_TRY_COMPILE(
2872 [
Damien Miller81171112000-04-23 11:14:01 +10002873#include <sys/types.h>
2874#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002875 ],
2876 [ struct sockaddr_storage s; s.ss_family = 1; ],
2877 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2878 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2879 )
2880])
2881if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002882 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002883fi
2884
Damien Miller61e50f12000-05-08 20:49:37 +10002885AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2886 ac_cv_have___ss_family_in_struct_ss, [
2887 AC_TRY_COMPILE(
2888 [
Damien Miller81171112000-04-23 11:14:01 +10002889#include <sys/types.h>
2890#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002891 ],
2892 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2893 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2894 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2895 )
2896])
2897if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002898 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2899 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002900fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002901
Damien Millerad833b32000-08-23 10:46:23 +10002902AC_CACHE_CHECK([for pw_class field in struct passwd],
2903 ac_cv_have_pw_class_in_struct_passwd, [
2904 AC_TRY_COMPILE(
2905 [
Damien Millerad833b32000-08-23 10:46:23 +10002906#include <pwd.h>
2907 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002908 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002909 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2910 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2911 )
2912])
2913if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002914 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2915 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002916fi
2917
Kevin Steves82456952001-06-22 21:14:18 +00002918AC_CACHE_CHECK([for pw_expire field in struct passwd],
2919 ac_cv_have_pw_expire_in_struct_passwd, [
2920 AC_TRY_COMPILE(
2921 [
2922#include <pwd.h>
2923 ],
2924 [ struct passwd p; p.pw_expire = 0; ],
2925 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2926 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2927 )
2928])
2929if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002930 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2931 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002932fi
2933
2934AC_CACHE_CHECK([for pw_change field in struct passwd],
2935 ac_cv_have_pw_change_in_struct_passwd, [
2936 AC_TRY_COMPILE(
2937 [
2938#include <pwd.h>
2939 ],
2940 [ struct passwd p; p.pw_change = 0; ],
2941 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2942 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2943 )
2944])
2945if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002946 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2947 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002948fi
Damien Miller61e50f12000-05-08 20:49:37 +10002949
Tim Rice28bbb0c2002-05-27 17:37:32 -07002950dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002951AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2952 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002953 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002954 [
Tim Riceae49fe62002-04-12 10:26:21 -07002955#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002956#include <sys/socket.h>
2957#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002958int main() {
2959#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002960#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002961exit(1);
2962#endif
2963struct msghdr m;
2964m.msg_accrights = 0;
2965exit(0);
2966}
Kevin Steves939c9db2002-03-22 17:23:25 +00002967 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002968 [ ac_cv_have_accrights_in_msghdr="yes" ],
2969 [ ac_cv_have_accrights_in_msghdr="no" ]
2970 )
2971])
2972if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002973 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2974 [Define if your system uses access rights style
2975 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00002976fi
2977
Kevin Stevesa44e0352002-04-07 16:18:03 +00002978AC_CACHE_CHECK([for msg_control field in struct msghdr],
2979 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002980 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00002981 [
Tim Riceae49fe62002-04-12 10:26:21 -07002982#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00002983#include <sys/socket.h>
2984#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002985int main() {
2986#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10002987#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002988exit(1);
2989#endif
2990struct msghdr m;
2991m.msg_control = 0;
2992exit(0);
2993}
Kevin Stevesa44e0352002-04-07 16:18:03 +00002994 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00002995 [ ac_cv_have_control_in_msghdr="yes" ],
2996 [ ac_cv_have_control_in_msghdr="no" ]
2997 )
2998])
2999if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003000 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
3001 [Define if your system uses ancillary data style
3002 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003003fi
3004
Damien Miller61e50f12000-05-08 20:49:37 +10003005AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003006 AC_TRY_LINK([],
3007 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10003008 [ ac_cv_libc_defines___progname="yes" ],
3009 [ ac_cv_libc_defines___progname="no" ]
3010 )
3011])
3012if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003013 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003014fi
3015
Kevin Steves4846f4a2002-03-22 18:19:53 +00003016AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
3017 AC_TRY_LINK([
3018#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11003019],
3020 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00003021 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3022 [ ac_cv_cc_implements___FUNCTION__="no" ]
3023 )
3024])
3025if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003026 AC_DEFINE(HAVE___FUNCTION__, 1,
3027 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003028fi
3029
3030AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3031 AC_TRY_LINK([
3032#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11003033],
3034 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00003035 [ ac_cv_cc_implements___func__="yes" ],
3036 [ ac_cv_cc_implements___func__="no" ]
3037 )
3038])
3039if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003040 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003041fi
3042
Damien Miller57f39152005-11-24 19:58:19 +11003043AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3044 AC_TRY_LINK(
3045 [#include <stdarg.h>
3046 va_list x,y;],
3047 [va_copy(x,y);],
3048 [ ac_cv_have_va_copy="yes" ],
3049 [ ac_cv_have_va_copy="no" ]
3050 )
3051])
3052if test "x$ac_cv_have_va_copy" = "xyes" ; then
3053 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3054fi
3055
3056AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3057 AC_TRY_LINK(
3058 [#include <stdarg.h>
3059 va_list x,y;],
3060 [__va_copy(x,y);],
3061 [ ac_cv_have___va_copy="yes" ],
3062 [ ac_cv_have___va_copy="no" ]
3063 )
3064])
3065if test "x$ac_cv_have___va_copy" = "xyes" ; then
3066 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3067fi
3068
Damien Miller4f8e6692001-07-14 13:22:53 +10003069AC_CACHE_CHECK([whether getopt has optreset support],
3070 ac_cv_have_getopt_optreset, [
3071 AC_TRY_LINK(
3072 [
3073#include <getopt.h>
3074 ],
3075 [ extern int optreset; optreset = 0; ],
3076 [ ac_cv_have_getopt_optreset="yes" ],
3077 [ ac_cv_have_getopt_optreset="no" ]
3078 )
3079])
3080if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003081 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3082 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003083fi
Damien Millera22ba012000-03-02 23:09:20 +11003084
Damien Millerecbb26d2000-07-15 14:59:14 +10003085AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003086 AC_TRY_LINK([],
3087 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10003088 [ ac_cv_libc_defines_sys_errlist="yes" ],
3089 [ ac_cv_libc_defines_sys_errlist="no" ]
3090 )
3091])
3092if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003093 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3094 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003095fi
3096
3097
Damien Miller11fa2cc2000-08-16 10:35:58 +10003098AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003099 AC_TRY_LINK([],
3100 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10003101 [ ac_cv_libc_defines_sys_nerr="yes" ],
3102 [ ac_cv_libc_defines_sys_nerr="no" ]
3103 )
3104])
3105if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003106 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003107fi
3108
Damien Millera8e06ce2003-11-21 23:48:55 +11003109SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003110# Check whether user wants sectok support
3111AC_ARG_WITH(sectok,
3112 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10003113 [
3114 if test "x$withval" != "xno" ; then
3115 if test "x$withval" != "xyes" ; then
3116 CPPFLAGS="$CPPFLAGS -I${withval}"
3117 LDFLAGS="$LDFLAGS -L${withval}"
3118 if test ! -z "$need_dash_r" ; then
3119 LDFLAGS="$LDFLAGS -R${withval}"
3120 fi
3121 if test ! -z "$blibpath" ; then
3122 blibpath="$blibpath:${withval}"
3123 fi
3124 fi
3125 AC_CHECK_HEADERS(sectok.h)
3126 if test "$ac_cv_header_sectok_h" != yes; then
3127 AC_MSG_ERROR(Can't find sectok.h)
3128 fi
3129 AC_CHECK_LIB(sectok, sectok_open)
3130 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3131 AC_MSG_ERROR(Can't find libsectok)
3132 fi
Tim Rice7df8d392005-09-19 09:33:39 -07003133 AC_DEFINE(SMARTCARD, 1,
3134 [Define if you want smartcard support])
3135 AC_DEFINE(USE_SECTOK, 1,
3136 [Define if you want smartcard support
3137 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11003138 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003139 fi
3140 ]
3141)
3142
3143# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08003144OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003145AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10003146 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08003147 [
3148 if test "x$withval" != "xno" ; then
3149 if test "x$withval" != "xyes" ; then
3150 OPENSC_CONFIG=$withval/bin/opensc-config
3151 else
3152 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3153 fi
3154 if test "$OPENSC_CONFIG" != "no"; then
3155 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3156 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3157 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
Darren Tucker0ee3cbf2006-09-23 16:25:19 +10003158 LIBS="$LIBS $LIBOPENSC_LIBS"
Tim Rice12ee8e22005-03-17 13:37:04 -08003159 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07003160 AC_DEFINE(USE_OPENSC, 1,
3161 [Define if you want smartcard support
3162 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08003163 SCARD_MSG="yes, using OpenSC"
3164 fi
3165 fi
3166 ]
3167)
Damien Miller85de5802001-09-18 14:01:11 +10003168
Darren Tucker5f88d342003-10-15 16:57:57 +10003169# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11003170AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07003171 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3172 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003173 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003174 # Needed by our getrrsetbyname()
3175 AC_SEARCH_LIBS(res_query, resolv)
3176 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10003177 AC_MSG_CHECKING(if res_query will link)
3178 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
3179 [AC_MSG_RESULT(no)
3180 saved_LIBS="$LIBS"
3181 LIBS="$LIBS -lresolv"
3182 AC_MSG_CHECKING(for res_query in -lresolv)
3183 AC_LINK_IFELSE([
3184#include <resolv.h>
3185int main()
3186{
3187 res_query (0, 0, 0, 0, 0);
3188 return 0;
3189}
3190 ],
3191 [LIBS="$LIBS -lresolv"
3192 AC_MSG_RESULT(yes)],
3193 [LIBS="$saved_LIBS"
3194 AC_MSG_RESULT(no)])
3195 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10003196 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003197 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003198 [#include <sys/types.h>
3199 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10003200 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07003201 [AC_DEFINE(HAVE_HEADER_AD, 1,
3202 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10003203 [#include <arpa/nameser.h>])
3204 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003205
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003206AC_MSG_CHECKING(if struct __res_state _res is an extern)
3207AC_LINK_IFELSE([
3208#include <stdio.h>
3209#if HAVE_SYS_TYPES_H
3210# include <sys/types.h>
3211#endif
3212#include <netinet/in.h>
3213#include <arpa/nameser.h>
3214#include <resolv.h>
3215extern struct __res_state _res;
3216int main() { return 0; }
3217 ],
3218 [AC_MSG_RESULT(yes)
3219 AC_DEFINE(HAVE__RES_EXTERN, 1,
3220 [Define if you have struct __res_state _res as an extern])
3221 ],
3222 [ AC_MSG_RESULT(no) ]
3223)
3224
Damien Miller73b42d22006-04-22 21:26:08 +10003225# Check whether user wants SELinux support
3226SELINUX_MSG="no"
3227LIBSELINUX=""
3228AC_ARG_WITH(selinux,
3229 [ --with-selinux Enable SELinux support],
3230 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003231 save_LIBS="$LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003232 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3233 SELINUX_MSG="yes"
3234 AC_CHECK_HEADER([selinux/selinux.h], ,
3235 AC_MSG_ERROR(SELinux support requires selinux.h header))
3236 AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
3237 AC_MSG_ERROR(SELinux support requires libselinux library))
Darren Tucker20e9f972007-03-25 18:26:01 +10003238 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Damien Miller73b42d22006-04-22 21:26:08 +10003239 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
Darren Tuckeradc947d2006-10-07 09:07:20 +10003240 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003241 fi ]
3242)
Damien Miller73b42d22006-04-22 21:26:08 +10003243
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003244# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003245KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003246AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11003247 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003248 [ if test "x$withval" != "xno" ; then
3249 if test "x$withval" = "xyes" ; then
3250 KRB5ROOT="/usr/local"
3251 else
3252 KRB5ROOT=${withval}
3253 fi
3254
Tim Rice7df8d392005-09-19 09:33:39 -07003255 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003256 KRB5_MSG="yes"
3257
3258 AC_MSG_CHECKING(for krb5-config)
3259 if test -x $KRB5ROOT/bin/krb5-config ; then
3260 KRB5CONF=$KRB5ROOT/bin/krb5-config
3261 AC_MSG_RESULT($KRB5CONF)
3262
3263 AC_MSG_CHECKING(for gssapi support)
3264 if $KRB5CONF | grep gssapi >/dev/null ; then
3265 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003266 AC_DEFINE(GSSAPI, 1,
3267 [Define this if you want GSSAPI
3268 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003269 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003270 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11003271 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11003272 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003273 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003274 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3275 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003276 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003277 AC_MSG_CHECKING(whether we are using Heimdal)
3278 AC_TRY_COMPILE([ #include <krb5.h> ],
3279 [ char *tmp = heimdal_version; ],
3280 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003281 AC_DEFINE(HEIMDAL, 1,
3282 [Define this if you are using the
3283 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003284 AC_MSG_RESULT(no)
3285 )
3286 else
3287 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003288 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003289 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11003290 AC_MSG_CHECKING(whether we are using Heimdal)
3291 AC_TRY_COMPILE([ #include <krb5.h> ],
3292 [ char *tmp = heimdal_version; ],
3293 [ AC_MSG_RESULT(yes)
3294 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10003295 K5LIBS="-lkrb5 -ldes"
3296 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08003297 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10003298 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11003299 ],
3300 [ AC_MSG_RESULT(no)
3301 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3302 ]
3303 )
Damien Miller200d0a72003-06-30 19:21:36 +10003304 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003305
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003306 AC_CHECK_LIB(gssapi,gss_init_sec_context,
3307 [ AC_DEFINE(GSSAPI)
3308 K5LIBS="-lgssapi $K5LIBS" ],
3309 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3310 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11003311 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003312 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3313 $K5LIBS)
3314 ],
3315 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003316
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003317 AC_CHECK_HEADER(gssapi.h, ,
3318 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003319 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003320 AC_CHECK_HEADERS(gssapi.h, ,
3321 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003322 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003323 ]
3324 )
3325
3326 oldCPP="$CPPFLAGS"
3327 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3328 AC_CHECK_HEADER(gssapi_krb5.h, ,
3329 [ CPPFLAGS="$oldCPP" ])
3330
Damien Millera8e06ce2003-11-21 23:48:55 +11003331 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003332 if test ! -z "$need_dash_r" ; then
3333 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3334 fi
3335 if test ! -z "$blibpath" ; then
3336 blibpath="$blibpath:${KRB5ROOT}/lib"
3337 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003338
3339 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3340 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3341 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3342
3343 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07003344 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3345 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11003346 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003347 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003348)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003349
Damien Millera22ba012000-03-02 23:09:20 +11003350# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003351
Damien Millerf58c6722002-05-13 13:15:42 +10003352PRIVSEP_PATH=/var/empty
3353AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07003354 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003355 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003356 if test -n "$withval" && test "x$withval" != "xno" && \
3357 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003358 PRIVSEP_PATH=$withval
3359 fi
3360 ]
3361)
3362AC_SUBST(PRIVSEP_PATH)
3363
Damien Millera22ba012000-03-02 23:09:20 +11003364AC_ARG_WITH(xauth,
3365 [ --with-xauth=PATH Specify path to xauth program ],
3366 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003367 if test -n "$withval" && test "x$withval" != "xno" && \
3368 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003369 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003370 fi
3371 ],
3372 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003373 TestPath="$PATH"
3374 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3375 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3376 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3377 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3378 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003379 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003380 xauth_path="/usr/openwin/bin/xauth"
3381 fi
3382 ]
3383)
3384
Damien Miller7d901272003-01-13 16:55:22 +11003385STRIP_OPT=-s
3386AC_ARG_ENABLE(strip,
3387 [ --disable-strip Disable calling strip(1) on install],
3388 [
3389 if test "x$enableval" = "xno" ; then
3390 STRIP_OPT=
3391 fi
3392 ]
3393)
3394AC_SUBST(STRIP_OPT)
3395
Damien Millera19cf472000-11-29 13:28:50 +11003396if test -z "$xauth_path" ; then
3397 XAUTH_PATH="undefined"
3398 AC_SUBST(XAUTH_PATH)
3399else
Tim Rice7df8d392005-09-19 09:33:39 -07003400 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3401 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003402 XAUTH_PATH=$xauth_path
3403 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003404fi
Damien Millera22ba012000-03-02 23:09:20 +11003405
3406# Check for mail directory (last resort if we cannot get it from headers)
3407if test ! -z "$MAIL" ; then
3408 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003409 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3410 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003411fi
3412
Darren Tucker623d92f2004-09-12 22:36:15 +10003413if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003414 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3415 disable_ptmx_check=yes
3416fi
Damien Millera22ba012000-03-02 23:09:20 +11003417if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003418 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003419 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003420 [
Tim Rice7df8d392005-09-19 09:33:39 -07003421 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3422 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003423 have_dev_ptmx=1
3424 ]
3425 )
3426 fi
Damien Millera22ba012000-03-02 23:09:20 +11003427fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003428
Darren Tucker623d92f2004-09-12 22:36:15 +10003429if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003430 AC_CHECK_FILE("/dev/ptc",
3431 [
Tim Rice7df8d392005-09-19 09:33:39 -07003432 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3433 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003434 have_dev_ptc=1
3435 ]
3436 )
3437else
3438 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3439fi
Damien Miller204ad072000-03-02 23:56:12 +11003440
Damien Millera22ba012000-03-02 23:09:20 +11003441# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003442AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003443 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003444 [
Damien Miller897741e2001-04-16 10:41:46 +10003445 case "$withval" in
3446 man|cat|doc)
3447 MANTYPE=$withval
3448 ;;
3449 *)
3450 AC_MSG_ERROR(invalid man type: $withval)
3451 ;;
3452 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003453 ]
3454)
Ben Lindstrombc709922001-04-18 18:04:21 +00003455if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003456 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3457 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003458 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3459 MANTYPE=doc
3460 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3461 MANTYPE=man
3462 else
3463 MANTYPE=cat
3464 fi
3465fi
Damien Miller670a4b82000-01-22 13:53:11 +11003466AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003467if test "$MANTYPE" = "doc"; then
3468 mansubdir=man;
3469else
3470 mansubdir=$MANTYPE;
3471fi
3472AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003473
Damien Millera22ba012000-03-02 23:09:20 +11003474# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003475MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003476AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003477 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003478 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003479 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003480 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3481 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003482 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003483 fi
3484 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003485)
3486
Damien Millera22ba012000-03-02 23:09:20 +11003487# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003488AC_ARG_WITH(shadow,
3489 [ --without-shadow Disable shadow password support],
3490 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003491 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003492 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003493 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003494 fi
3495 ]
3496)
3497
Damien Miller1f335fb2000-06-26 11:31:33 +10003498if test -z "$disable_shadow" ; then
3499 AC_MSG_CHECKING([if the systems has expire shadow information])
3500 AC_TRY_COMPILE(
3501 [
3502#include <sys/types.h>
3503#include <shadow.h>
3504 struct spwd sp;
3505 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3506 [ sp_expire_available=yes ], []
3507 )
3508
3509 if test "x$sp_expire_available" = "xyes" ; then
3510 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003511 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3512 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003513 else
3514 AC_MSG_RESULT(no)
3515 fi
3516fi
3517
Damien Millera22ba012000-03-02 23:09:20 +11003518# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003519if test ! -z "$IPADDR_IN_DISPLAY" ; then
3520 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003521 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3522 [Define if you need to use IP address
3523 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003524else
Damien Millera8e06ce2003-11-21 23:48:55 +11003525 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003526 AC_ARG_WITH(ipaddr-display,
3527 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3528 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003529 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003530 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003531 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003532 fi
3533 ]
3534 )
3535fi
Damien Miller76112de1999-12-21 11:18:08 +11003536
Darren Tuckere1a790d2003-09-16 11:52:19 +10003537# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003538AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003539 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003540 [ if test "x$enableval" = "xno"; then
3541 AC_MSG_NOTICE([/etc/default/login handling disabled])
3542 etc_default_login=no
3543 else
3544 etc_default_login=yes
3545 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003546 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3547 then
3548 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3549 etc_default_login=no
3550 else
3551 etc_default_login=yes
3552 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003553)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003554
Darren Tucker2f9573d2005-02-10 22:28:54 +11003555if test "x$etc_default_login" != "xno"; then
3556 AC_CHECK_FILE("/etc/default/login",
3557 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003558 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003559 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3560 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003561 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003562fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003563
Tim Rice43a1c132002-04-17 21:19:14 -07003564dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003565if test $ac_cv_func_login_getcapbool = "yes" && \
3566 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003567 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003568fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003569
Damien Millera22ba012000-03-02 23:09:20 +11003570# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003571SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003572AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003573 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003574 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003575 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003576 AC_MSG_WARN([
3577--with-default-path=PATH has no effect on this system.
3578Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003579 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003580 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003581 AC_MSG_WARN([
3582--with-default-path=PATH will only be used if PATH is not defined in
3583$external_path_file .])
3584 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003585 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003586 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003587 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003588 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003589 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3590 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003591 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003592 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003593 AC_MSG_WARN([
3594If PATH is defined in $external_path_file, ensure the path to scp is included,
3595otherwise scp will not work.])
3596 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003597 AC_RUN_IFELSE(
3598 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003599/* find out what STDPATH is */
3600#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003601#ifdef HAVE_PATHS_H
3602# include <paths.h>
3603#endif
3604#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003605# ifdef _PATH_USERPATH /* Irix */
3606# define _PATH_STDPATH _PATH_USERPATH
3607# else
3608# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3609# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003610#endif
3611#include <sys/types.h>
3612#include <sys/stat.h>
3613#include <fcntl.h>
3614#define DATA "conftest.stdpath"
3615
3616main()
3617{
3618 FILE *fd;
3619 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003620
Tim Rice59ea0a02001-03-10 13:50:45 -08003621 fd = fopen(DATA,"w");
3622 if(fd == NULL)
3623 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003624
Tim Rice59ea0a02001-03-10 13:50:45 -08003625 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3626 exit(1);
3627
3628 exit(0);
3629}
Darren Tucker314d89e2005-10-17 23:29:23 +10003630 ]])],
3631 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003632 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3633 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3634 )
3635# make sure $bindir is in USER_PATH so scp will work
3636 t_bindir=`eval echo ${bindir}`
3637 case $t_bindir in
3638 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3639 esac
3640 case $t_bindir in
3641 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3642 esac
3643 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3644 if test $? -ne 0 ; then
3645 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3646 if test $? -ne 0 ; then
3647 user_path=$user_path:$t_bindir
3648 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3649 fi
3650 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003651 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003652)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003653if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003654 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003655 AC_SUBST(user_path)
3656fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003657
Damien Millera18bbd32002-05-13 10:48:57 +10003658# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003659AC_ARG_WITH(superuser-path,
3660 [ --with-superuser-path= Specify different path for super-user],
3661 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003662 if test -n "$withval" && test "x$withval" != "xno" && \
3663 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003664 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3665 [Define if you want a different $PATH
3666 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003667 superuser_path=$withval
3668 fi
3669 ]
3670)
3671
3672
Damien Miller61e50f12000-05-08 20:49:37 +10003673AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003674IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003675AC_ARG_WITH(4in6,
3676 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3677 [
3678 if test "x$withval" != "xno" ; then
3679 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003680 AC_DEFINE(IPV4_IN_IPV6, 1,
3681 [Detect IPv4 in IPv6 mapped addresses
3682 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003683 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003684 else
3685 AC_MSG_RESULT(no)
3686 fi
3687 ],[
3688 if test "x$inet6_default_4in6" = "xyes"; then
3689 AC_MSG_RESULT([yes (default)])
3690 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003691 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003692 else
3693 AC_MSG_RESULT([no (default)])
3694 fi
3695 ]
3696)
3697
Damien Miller60396b02001-02-18 17:01:00 +11003698# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003699BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003700AC_ARG_WITH(bsd-auth,
3701 [ --with-bsd-auth Enable BSD auth support],
3702 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003703 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003704 AC_DEFINE(BSD_AUTH, 1,
3705 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003706 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003707 fi
3708 ]
3709)
3710
Damien Millera22ba012000-03-02 23:09:20 +11003711# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003712piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003713# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003714if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003715 piddir=`eval echo ${sysconfdir}`
3716 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003717 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003718 esac
3719fi
3720
Tim Rice88f2ab52002-03-17 12:17:34 -08003721AC_ARG_WITH(pid-dir,
3722 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3723 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003724 if test -n "$withval" && test "x$withval" != "xno" && \
3725 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003726 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003727 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003728 AC_MSG_WARN([** no $piddir directory on this system **])
3729 fi
3730 fi
3731 ]
3732)
3733
Tim Rice7df8d392005-09-19 09:33:39 -07003734AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003735AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003736
andre2ff7b5d2000-06-03 14:57:40 +00003737dnl allow user to disable some login recording features
3738AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003739 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003740 [
3741 if test "x$enableval" = "xno" ; then
3742 AC_DEFINE(DISABLE_LASTLOG)
3743 fi
3744 ]
andre2ff7b5d2000-06-03 14:57:40 +00003745)
3746AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003747 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003748 [
3749 if test "x$enableval" = "xno" ; then
3750 AC_DEFINE(DISABLE_UTMP)
3751 fi
3752 ]
andre2ff7b5d2000-06-03 14:57:40 +00003753)
3754AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003755 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003756 [
3757 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003758 AC_DEFINE(DISABLE_UTMPX, 1,
3759 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003760 fi
3761 ]
andre2ff7b5d2000-06-03 14:57:40 +00003762)
3763AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003764 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003765 [
3766 if test "x$enableval" = "xno" ; then
3767 AC_DEFINE(DISABLE_WTMP)
3768 fi
3769 ]
andre2ff7b5d2000-06-03 14:57:40 +00003770)
3771AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003772 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003773 [
3774 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003775 AC_DEFINE(DISABLE_WTMPX, 1,
3776 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003777 fi
3778 ]
andre2ff7b5d2000-06-03 14:57:40 +00003779)
3780AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003781 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003782 [
3783 if test "x$enableval" = "xno" ; then
3784 AC_DEFINE(DISABLE_LOGIN)
3785 fi
3786 ]
andre2ff7b5d2000-06-03 14:57:40 +00003787)
3788AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003789 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [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_PUTUTLINE, 1,
3793 [Define if you don't want to use pututline()
3794 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003795 fi
3796 ]
andre2ff7b5d2000-06-03 14:57:40 +00003797)
3798AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003799 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003800 [
3801 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003802 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3803 [Define if you don't want to use pututxline()
3804 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003805 fi
3806 ]
andre2ff7b5d2000-06-03 14:57:40 +00003807)
3808AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003809 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003810 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003811 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003812 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003813 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003814 conf_lastlog_location=$withval
3815 fi
3816 ]
3817)
andre2ff7b5d2000-06-03 14:57:40 +00003818
3819dnl lastlog, [uw]tmpx? detection
3820dnl NOTE: set the paths in the platform section to avoid the
3821dnl need for command-line parameters
3822dnl lastlog and [uw]tmp are subject to a file search if all else fails
3823
3824dnl lastlog detection
3825dnl NOTE: the code itself will detect if lastlog is a directory
3826AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3827AC_TRY_COMPILE([
3828#include <sys/types.h>
3829#include <utmp.h>
3830#ifdef HAVE_LASTLOG_H
3831# include <lastlog.h>
3832#endif
Damien Miller2994e082000-06-04 15:51:47 +10003833#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003834# include <paths.h>
3835#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003836#ifdef HAVE_LOGIN_H
3837# include <login.h>
3838#endif
andre2ff7b5d2000-06-03 14:57:40 +00003839 ],
3840 [ char *lastlog = LASTLOG_FILE; ],
3841 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003842 [
3843 AC_MSG_RESULT(no)
3844 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3845 AC_TRY_COMPILE([
3846#include <sys/types.h>
3847#include <utmp.h>
3848#ifdef HAVE_LASTLOG_H
3849# include <lastlog.h>
3850#endif
3851#ifdef HAVE_PATHS_H
3852# include <paths.h>
3853#endif
3854 ],
3855 [ char *lastlog = _PATH_LASTLOG; ],
3856 [ AC_MSG_RESULT(yes) ],
3857 [
andree441aa32000-06-12 22:34:38 +00003858 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003859 system_lastlog_path=no
3860 ])
3861 ]
andre2ff7b5d2000-06-03 14:57:40 +00003862)
Damien Miller2994e082000-06-04 15:51:47 +10003863
andre2ff7b5d2000-06-03 14:57:40 +00003864if test -z "$conf_lastlog_location"; then
3865 if test x"$system_lastlog_path" = x"no" ; then
3866 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003867 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003868 conf_lastlog_location=$f
3869 fi
3870 done
3871 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003872 AC_MSG_WARN([** Cannot find lastlog **])
3873 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003874 fi
3875 fi
3876fi
3877
3878if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003879 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3880 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003881fi
andre2ff7b5d2000-06-03 14:57:40 +00003882
3883dnl utmp detection
3884AC_MSG_CHECKING([if your system defines UTMP_FILE])
3885AC_TRY_COMPILE([
3886#include <sys/types.h>
3887#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003888#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003889# include <paths.h>
3890#endif
3891 ],
3892 [ char *utmp = UTMP_FILE; ],
3893 [ AC_MSG_RESULT(yes) ],
3894 [ AC_MSG_RESULT(no)
3895 system_utmp_path=no ]
3896)
3897if test -z "$conf_utmp_location"; then
3898 if test x"$system_utmp_path" = x"no" ; then
3899 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3900 if test -f $f ; then
3901 conf_utmp_location=$f
3902 fi
3903 done
3904 if test -z "$conf_utmp_location"; then
3905 AC_DEFINE(DISABLE_UTMP)
3906 fi
3907 fi
3908fi
3909if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003910 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3911 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003912fi
andre2ff7b5d2000-06-03 14:57:40 +00003913
3914dnl wtmp detection
3915AC_MSG_CHECKING([if your system defines WTMP_FILE])
3916AC_TRY_COMPILE([
3917#include <sys/types.h>
3918#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003919#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003920# include <paths.h>
3921#endif
3922 ],
3923 [ char *wtmp = WTMP_FILE; ],
3924 [ AC_MSG_RESULT(yes) ],
3925 [ AC_MSG_RESULT(no)
3926 system_wtmp_path=no ]
3927)
3928if test -z "$conf_wtmp_location"; then
3929 if test x"$system_wtmp_path" = x"no" ; then
3930 for f in /usr/adm/wtmp /var/log/wtmp; do
3931 if test -f $f ; then
3932 conf_wtmp_location=$f
3933 fi
3934 done
3935 if test -z "$conf_wtmp_location"; then
3936 AC_DEFINE(DISABLE_WTMP)
3937 fi
3938 fi
3939fi
3940if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003941 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3942 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003943fi
andre2ff7b5d2000-06-03 14:57:40 +00003944
3945
3946dnl utmpx detection - I don't know any system so perverse as to require
3947dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3948dnl there, though.
3949AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3950AC_TRY_COMPILE([
3951#include <sys/types.h>
3952#include <utmp.h>
3953#ifdef HAVE_UTMPX_H
3954#include <utmpx.h>
3955#endif
Damien Miller2994e082000-06-04 15:51:47 +10003956#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003957# include <paths.h>
3958#endif
3959 ],
3960 [ char *utmpx = UTMPX_FILE; ],
3961 [ AC_MSG_RESULT(yes) ],
3962 [ AC_MSG_RESULT(no)
3963 system_utmpx_path=no ]
3964)
3965if test -z "$conf_utmpx_location"; then
3966 if test x"$system_utmpx_path" = x"no" ; then
3967 AC_DEFINE(DISABLE_UTMPX)
3968 fi
3969else
Tim Rice7df8d392005-09-19 09:33:39 -07003970 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3971 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003972fi
andre2ff7b5d2000-06-03 14:57:40 +00003973
3974dnl wtmpx detection
3975AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3976AC_TRY_COMPILE([
3977#include <sys/types.h>
3978#include <utmp.h>
3979#ifdef HAVE_UTMPX_H
3980#include <utmpx.h>
3981#endif
Damien Miller2994e082000-06-04 15:51:47 +10003982#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003983# include <paths.h>
3984#endif
3985 ],
3986 [ char *wtmpx = WTMPX_FILE; ],
3987 [ AC_MSG_RESULT(yes) ],
3988 [ AC_MSG_RESULT(no)
3989 system_wtmpx_path=no ]
3990)
3991if test -z "$conf_wtmpx_location"; then
3992 if test x"$system_wtmpx_path" = x"no" ; then
3993 AC_DEFINE(DISABLE_WTMPX)
3994 fi
3995else
Tim Rice7df8d392005-09-19 09:33:39 -07003996 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3997 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003998fi
andre2ff7b5d2000-06-03 14:57:40 +00003999
Damien Miller4018c192000-04-30 09:30:44 +10004000
Damien Miller29ea30d2000-03-17 10:54:15 +11004001if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004002 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4003 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004004fi
4005
Darren Tucker7da23cb2005-08-03 00:20:15 +10004006dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4007dnl Add now.
4008CFLAGS="$CFLAGS $werror_flags"
4009
Damien Millerbac2d8a2000-09-05 16:13:06 +11004010AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004011AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4012 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
4013 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004014AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004015
Damien Miller7b22d652000-06-18 14:07:04 +10004016# Print summary of options
4017
Damien Miller7b22d652000-06-18 14:07:04 +10004018# Someone please show me a better way :)
4019A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4020B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4021C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4022D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004023E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004024F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004025G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004026H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4027I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4028J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004029
4030echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004031echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004032echo " User binaries: $B"
4033echo " System binaries: $C"
4034echo " Configuration files: $D"
4035echo " Askpass program: $E"
4036echo " Manual pages: $F"
4037echo " PID file: $G"
4038echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004039if test "x$external_path_file" = "x/etc/login.conf" ; then
4040echo " At runtime, sshd will use the path defined in $external_path_file"
4041echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004042else
Damien Millerf58c6722002-05-13 13:15:42 +10004043echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004044 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004045echo " (If PATH is set in $external_path_file it will be used instead. If"
4046echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4047 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004048fi
Damien Millera18bbd32002-05-13 10:48:57 +10004049if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004050echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004051fi
Damien Millerf58c6722002-05-13 13:15:42 +10004052echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004053echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004054echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004055echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004056echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004057echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004058echo " S/KEY support: $SKEY_MSG"
4059echo " TCP Wrappers support: $TCPW_MSG"
4060echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004061echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004062echo " Solaris process contract support: $SPC_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004063echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004064echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4065echo " BSD Auth support: $BSD_AUTH_MSG"
4066echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11004067if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004068echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11004069fi
4070
Damien Miller7b22d652000-06-18 14:07:04 +10004071echo ""
4072
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004073echo " Host: ${host}"
4074echo " Compiler: ${CC}"
4075echo " Compiler flags: ${CFLAGS}"
4076echo "Preprocessor flags: ${CPPFLAGS}"
4077echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004078echo " Libraries: ${LIBS}"
4079if test ! -z "${SSHDLIBS}"; then
4080echo " +for sshd: ${SSHDLIBS}"
4081fi
Damien Miller7b22d652000-06-18 14:07:04 +10004082
4083echo ""
4084
Tim Rice6f1f7582004-05-30 21:38:51 -07004085if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004086 echo "SVR4 style packages are supported with \"make package\""
4087 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004088fi
4089
Damien Miller82cf0ce2000-12-20 13:34:48 +11004090if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004091 echo "PAM is enabled. You may need to install a PAM control file "
4092 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004093 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004094 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004095 echo ""
4096fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004097
Damien Miller6c21c512002-01-22 21:57:53 +11004098if test ! -z "$RAND_HELPER_CMDHASH" ; then
4099 echo "WARNING: you are using the builtin random number collection "
4100 echo "service. Please read WARNING.RNG and request that your OS "
4101 echo "vendor includes kernel-based random number collection in "
4102 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004103 echo ""
4104fi
Damien Miller60396b02001-02-18 17:01:00 +11004105
Damien Millerb4097182004-05-23 14:09:40 +10004106if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004107 echo "WARNING: the operating system that you are using does not"
4108 echo "appear to support getpeereid(), getpeerucred() or the"
4109 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4110 echo "enforce security checks to prevent unauthorised connections to"
4111 echo "ssh-agent. Their absence increases the risk that a malicious"
4112 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004113 echo ""
4114fi
4115
Darren Tuckerd9f88912005-02-20 21:01:48 +11004116if test "$AUDIT_MODULE" = "bsm" ; then
4117 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4118 echo "See the Solaris section in README.platform for details."
4119fi