blob: b71f6832ae5db6c7239a48adf2f57f90bdda4420 [file] [log] [blame]
Darren Tuckerb7918af2008-03-09 11:34:23 +11001# $Id: configure.ac,v 1.394 2008/03/09 00:34:23 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 Tuckerb7918af2008-03-09 11:34:23 +110018AC_REVISION($Revision: 1.394 $)
Tim Rice13aae5e2001-10-21 17:53:58 -070019AC_CONFIG_SRCDIR([ssh.c])
Damien Miller7f6ea021999-10-28 13:25:17 +100020
21AC_CONFIG_HEADER(config.h)
Damien Miller856799b2000-03-15 21:18:10 +110022AC_PROG_CC
Damien Miller76112de1999-12-21 11:18:08 +110023AC_CANONICAL_HOST
Damien Miller4df5c762001-02-28 08:14:22 +110024AC_C_BIGENDIAN
Damien Miller7f6ea021999-10-28 13:25:17 +100025
Damien Millera22ba012000-03-02 23:09:20 +110026# Checks for programs.
Darren Tucker167bd9c2003-09-07 12:34:54 +100027AC_PROG_AWK
Damien Millerab18c411999-11-11 10:40:23 +110028AC_PROG_CPP
Damien Miller7f6ea021999-10-28 13:25:17 +100029AC_PROG_RANLIB
Damien Millerd8087f61999-11-25 12:31:26 +110030AC_PROG_INSTALL
Tim Ricefd80ddc2006-02-02 19:11:56 -080031AC_PROG_EGREP
Ben Lindstrom582d3982001-02-06 22:54:30 +000032AC_PATH_PROG(AR, ar)
Tim Rice5af9db92004-06-19 19:31:06 -070033AC_PATH_PROG(CAT, cat)
34AC_PATH_PROG(KILL, kill)
Tim Riceb8fbb8e2001-04-21 14:31:52 -070035AC_PATH_PROGS(PERL, perl5 perl)
Tim Riced0d7a8b2003-01-08 17:22:59 -080036AC_PATH_PROG(SED, sed)
Damien Millere79334a1999-12-29 10:03:37 +110037AC_SUBST(PERL)
Damien Miller8d1fd572000-05-17 21:34:07 +100038AC_PATH_PROG(ENT, ent)
39AC_SUBST(ENT)
Damien Miller4864e8f2001-02-08 10:07:08 +110040AC_PATH_PROG(TEST_MINUS_S_SH, bash)
41AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
42AC_PATH_PROG(TEST_MINUS_S_SH, sh)
Tim Rice0502a472002-05-08 16:04:14 -070043AC_PATH_PROG(SH, sh)
Tim Ricef7ba8f62004-06-20 10:37:32 -070044AC_SUBST(TEST_SHELL,sh)
Damien Miller2e1b0821999-12-25 10:11:29 +110045
Tim Rice6f1f7582004-05-30 21:38:51 -070046dnl for buildpkg.sh
47AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
48 [/usr/sbin${PATH_SEPARATOR}/etc])
49AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
50 [/usr/sbin${PATH_SEPARATOR}/etc])
51AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
Darren Tuckerfbea7642006-01-30 00:22:39 +110052if test -x /sbin/sh; then
53 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
54else
55 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
56fi
Tim Rice6f1f7582004-05-30 21:38:51 -070057
Damien Millere8bb4502001-09-25 16:39:35 +100058# System features
59AC_SYS_LARGEFILE
60
Damien Miller3f62aba2000-11-29 11:56:35 +110061if test -z "$AR" ; then
62 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
63fi
64
Damien Millerad833b32000-08-23 10:46:23 +100065# Use LOGIN_PROGRAM from environment if possible
66if test ! -z "$LOGIN_PROGRAM" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070067 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
68 [If your header files don't define LOGIN_PROGRAM,
69 then use this (detected) from environment and PATH])
Damien Millerad833b32000-08-23 10:46:23 +100070else
71 # Search for login
72 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
73 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
74 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
75 fi
76fi
77
Darren Tucker23bc8d02004-02-06 16:24:31 +110078AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
79if test ! -z "$PATH_PASSWD_PROG" ; then
Tim Rice7df8d392005-09-19 09:33:39 -070080 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
81 [Full path of your "passwd" program])
Darren Tucker23bc8d02004-02-06 16:24:31 +110082fi
83
Damien Miller166bd442000-03-16 10:48:25 +110084if test -z "$LD" ; then
85 LD=$CC
86fi
87AC_SUBST(LD)
Tim Riceeae17cc2005-03-17 16:52:20 -080088
Damien Miller166bd442000-03-16 10:48:25 +110089AC_C_INLINE
Darren Tucker67b37032005-06-03 17:58:31 +100090
91AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
92
Darren Tuckerb7918af2008-03-09 11:34:23 +110093use_stack_protector=1
94AC_ARG_WITH(stackprotect,
95 [ --without-stackprotect Don't use compiler's stack protection], [
96 if test "x$withval" = "xno"; then
97 use_stack_protector=0
98 fi ])
99
Damien Millera8e06ce2003-11-21 23:48:55 +1100100if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
Darren Tuckerdd352b62005-08-02 17:21:29 +1000101 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
Darren Tucker3f9545e2005-11-12 15:20:52 +1100102 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
Tim Rice3db1e3f2005-08-23 17:11:26 -0700103 case $GCC_VER in
Darren Tucker391de5c2007-04-29 14:49:21 +1000104 1.*) no_attrib_nonnull=1 ;;
105 2.8* | 2.9*)
106 CFLAGS="$CFLAGS -Wsign-compare"
107 no_attrib_nonnull=1
108 ;;
109 2.*) no_attrib_nonnull=1 ;;
Darren Tuckerb0288092005-11-10 14:46:48 +1100110 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
Darren Tuckerf0324352005-11-10 21:30:36 +1100111 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
112 *) ;;
Tim Rice3db1e3f2005-08-23 17:11:26 -0700113 esac
Damien Millerde3cb0a2005-05-26 20:48:25 +1000114
Darren Tuckerb7918af2008-03-09 11:34:23 +1100115 # -fstack-protector-all doesn't always work for some GCC versions
116 # and/or platforms, so we test if we can.
117 if test "x$use_stack_protector" = "x1"; then
118 for t in -fstack-protector-all -fstack-protector; do
119 AC_MSG_CHECKING(if $CC understands $t)
120 saved_CFLAGS="$CFLAGS"
121 saved_LDFLAGS="$LDFLAGS"
122 CFLAGS="$CFLAGS $t"
123 LDFLAGS="$LDFLAGS $t"
124 AC_TRY_LINK([], [ int main(void){return 0;} ],
125 [ AC_MSG_RESULT(yes)
126 AC_MSG_CHECKING(if $t works)
127 AC_RUN_IFELSE(
128 [AC_LANG_SOURCE([
129#include <stdlib.h>
130int main(void){exit(0);}
131 ])],
132 [ AC_MSG_RESULT(yes)
133 break ],
134 [ AC_MSG_RESULT(no) ],
135 [ AC_MSG_WARN([cross compiling: cannot test])
136 break ]
137 )
138 ],
139 [ AC_MSG_RESULT(no) ]
140 )
141 CFLAGS="$saved_CFLAGS"
142 LDFLAGS="$saved_LDFLAGS"
143 done
144 fi
Darren Tucker319b3d92007-12-02 21:02:22 +1100145
Darren Tucker67b37032005-06-03 17:58:31 +1000146 if test -z "$have_llong_max"; then
147 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
148 unset ac_cv_have_decl_LLONG_MAX
149 saved_CFLAGS="$CFLAGS"
150 CFLAGS="$CFLAGS -std=gnu99"
151 AC_CHECK_DECL(LLONG_MAX,
152 [have_llong_max=1],
153 [CFLAGS="$saved_CFLAGS"],
154 [#include <limits.h>]
155 )
156 fi
Damien Miller166bd442000-03-16 10:48:25 +1100157fi
158
Darren Tucker391de5c2007-04-29 14:49:21 +1000159if test "x$no_attrib_nonnull" != "x1" ; then
160 AC_DEFINE(HAVE_ATTRIBUTE__NONNULL__, 1, [Have attribute nonnull])
161fi
162
Tim Rice88368a32003-12-08 12:35:59 -0800163AC_ARG_WITH(rpath,
164 [ --without-rpath Disable auto-added -R linker paths],
165 [
Tim Riceeae17cc2005-03-17 16:52:20 -0800166 if test "x$withval" = "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800167 need_dash_r=""
168 fi
169 if test "x$withval" = "xyes" ; then
170 need_dash_r=1
171 fi
172 ]
173)
174
Tim Rice1cfab232006-10-03 09:34:35 -0700175# Allow user to specify flags
176AC_ARG_WITH(cflags,
177 [ --with-cflags Specify additional flags to pass to compiler],
178 [
179 if test -n "$withval" && test "x$withval" != "xno" && \
180 test "x${withval}" != "xyes"; then
181 CFLAGS="$CFLAGS $withval"
182 fi
183 ]
184)
185AC_ARG_WITH(cppflags,
186 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
187 [
188 if test -n "$withval" && test "x$withval" != "xno" && \
189 test "x${withval}" != "xyes"; then
190 CPPFLAGS="$CPPFLAGS $withval"
191 fi
192 ]
193)
194AC_ARG_WITH(ldflags,
195 [ --with-ldflags Specify additional flags to pass to linker],
196 [
197 if test -n "$withval" && test "x$withval" != "xno" && \
198 test "x${withval}" != "xyes"; then
199 LDFLAGS="$LDFLAGS $withval"
200 fi
201 ]
202)
203AC_ARG_WITH(libs,
204 [ --with-libs Specify additional libraries to link with],
205 [
206 if test -n "$withval" && test "x$withval" != "xno" && \
207 test "x${withval}" != "xyes"; then
208 LIBS="$LIBS $withval"
209 fi
210 ]
211)
212AC_ARG_WITH(Werror,
213 [ --with-Werror Build main code with -Werror],
214 [
215 if test -n "$withval" && test "x$withval" != "xno"; then
216 werror_flags="-Werror"
217 if test "x${withval}" != "xyes"; then
218 werror_flags="$withval"
219 fi
220 fi
221 ]
222)
223
224AC_CHECK_HEADERS( \
225 bstring.h \
226 crypt.h \
227 crypto/sha2.h \
228 dirent.h \
229 endian.h \
230 features.h \
231 fcntl.h \
232 floatingpoint.h \
233 getopt.h \
234 glob.h \
235 ia.h \
236 iaf.h \
237 limits.h \
238 login.h \
239 maillock.h \
240 ndir.h \
241 net/if_tun.h \
242 netdb.h \
243 netgroup.h \
244 pam/pam_appl.h \
245 paths.h \
Darren Tuckerfebf0f52007-06-25 22:15:12 +1000246 poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700247 pty.h \
248 readpassphrase.h \
249 rpc/types.h \
250 security/pam_appl.h \
251 sha2.h \
252 shadow.h \
253 stddef.h \
254 stdint.h \
255 string.h \
256 strings.h \
257 sys/audit.h \
258 sys/bitypes.h \
259 sys/bsdtty.h \
260 sys/cdefs.h \
261 sys/dir.h \
262 sys/mman.h \
263 sys/ndir.h \
Darren Tucker7c92a652007-09-27 07:00:09 +1000264 sys/poll.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700265 sys/prctl.h \
266 sys/pstat.h \
267 sys/select.h \
268 sys/stat.h \
269 sys/stream.h \
270 sys/stropts.h \
271 sys/strtio.h \
272 sys/sysmacros.h \
273 sys/time.h \
274 sys/timers.h \
275 sys/un.h \
276 time.h \
277 tmpdir.h \
278 ttyent.h \
Tim Riceaa8954f2007-05-09 15:57:43 -0700279 ucred.h \
Tim Rice1cfab232006-10-03 09:34:35 -0700280 unistd.h \
281 usersec.h \
282 util.h \
283 utime.h \
284 utmp.h \
285 utmpx.h \
286 vis.h \
287)
288
289# lastlog.h requires sys/time.h to be included first on Solaris
290AC_CHECK_HEADERS(lastlog.h, [], [], [
291#ifdef HAVE_SYS_TIME_H
292# include <sys/time.h>
293#endif
294])
295
296# sys/ptms.h requires sys/stream.h to be included first on Solaris
297AC_CHECK_HEADERS(sys/ptms.h, [], [], [
298#ifdef HAVE_SYS_STREAM_H
299# include <sys/stream.h>
300#endif
301])
302
303# login_cap.h requires sys/types.h on NetBSD
304AC_CHECK_HEADERS(login_cap.h, [], [], [
305#include <sys/types.h>
306])
307
Damien Miller1b06dc32006-08-31 03:24:41 +1000308# Messages for features tested for in target-specific section
309SIA_MSG="no"
310SPC_MSG="no"
311
Damien Millera22ba012000-03-02 23:09:20 +1100312# Check for some target-specific stuff
Damien Miller76112de1999-12-21 11:18:08 +1100313case "$host" in
Damien Miller75b1d102000-01-07 14:01:41 +1100314*-*-aix*)
Darren Tucker9216c372006-09-18 23:17:40 +1000315 # Some versions of VAC won't allow macro redefinitions at
316 # -qlanglevel=ansi, and autoconf 2.60 sometimes insists on using that
317 # particularly with older versions of vac or xlc.
318 # It also throws errors about null macro argments, but these are
319 # not fatal.
320 AC_MSG_CHECKING(if compiler allows macro redefinitions)
321 AC_COMPILE_IFELSE(
322 [AC_LANG_SOURCE([[
323#define testmacro foo
324#define testmacro bar
325int main(void) { exit(0); }
326 ]])],
327 [ AC_MSG_RESULT(yes) ],
328 [ AC_MSG_RESULT(no)
329 CC="`echo $CC | sed 's/-qlanglvl\=ansi//g'`"
330 LD="`echo $LD | sed 's/-qlanglvl\=ansi//g'`"
331 CFLAGS="`echo $CFLAGS | sed 's/-qlanglvl\=ansi//g'`"
332 CPPFLAGS="`echo $CPPFLAGS | sed 's/-qlanglvl\=ansi//g'`"
333 ]
334 )
335
Damien Millera8e06ce2003-11-21 23:48:55 +1100336 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
Damien Millereab4bae2003-04-29 23:22:40 +1000337 if (test -z "$blibpath"); then
Tim Ricefcb62202004-01-23 18:35:16 -0800338 blibpath="/usr/lib:/lib"
Damien Miller29ea30d2000-03-17 10:54:15 +1100339 fi
Damien Millereab4bae2003-04-29 23:22:40 +1000340 saved_LDFLAGS="$LDFLAGS"
Darren Tuckerbdc12122006-07-06 11:56:25 +1000341 if test "$GCC" = "yes"; then
342 flags="-Wl,-blibpath: -Wl,-rpath, -blibpath:"
343 else
344 flags="-blibpath: -Wl,-blibpath: -Wl,-rpath,"
345 fi
346 for tryflags in $flags ;do
Damien Millereab4bae2003-04-29 23:22:40 +1000347 if (test -z "$blibflags"); then
348 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
349 AC_TRY_LINK([], [], [blibflags=$tryflags])
350 fi
351 done
352 if (test -z "$blibflags"); then
353 AC_MSG_RESULT(not found)
354 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
355 else
356 AC_MSG_RESULT($blibflags)
357 fi
358 LDFLAGS="$saved_LDFLAGS"
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000359 dnl Check for authenticate. Might be in libs.a on older AIXes
Tim Rice7df8d392005-09-19 09:33:39 -0700360 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
361 [Define if you want to enable AIX4's authenticate function])],
Tim Ricee958ed32002-07-05 07:12:33 -0700362 [AC_CHECK_LIB(s,authenticate,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000363 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
Tim Ricee958ed32002-07-05 07:12:33 -0700364 LIBS="$LIBS -ls"
365 ])
366 ])
Darren Tucker3c774c52005-02-16 22:49:31 +1100367 dnl Check for various auth function declarations in headers.
Darren Tucker04cfbe02005-02-20 23:27:11 +1100368 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
Darren Tuckere66519d2005-03-21 22:46:34 +1100369 passwdexpired, setauthdb], , , [#include <usersec.h>])
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000370 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
Darren Tucker3c774c52005-02-16 22:49:31 +1100371 AC_CHECK_DECLS(loginfailed,
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000372 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
373 AC_TRY_COMPILE(
Darren Tuckera0c0b632003-07-08 20:52:12 +1000374 [#include <usersec.h>],
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000375 [(void)loginfailed("user","host","tty",0);],
376 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700377 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
378 [Define if your AIX loginfailed() function
379 takes 4 arguments (AIX >= 5.2)])],
Darren Tuckera0c0b632003-07-08 20:52:12 +1000380 [AC_MSG_RESULT(no)]
Darren Tucker5c6a91a2003-07-14 16:21:44 +1000381 )],
382 [],
383 [#include <usersec.h>]
384 )
Darren Tucker0f26b132008-02-28 23:16:04 +1100385 AC_CHECK_FUNCS(getgrset setauthdb)
Darren Tucker3083bc22006-08-17 19:35:49 +1000386 AC_CHECK_DECL(F_CLOSEM,
Darren Tuckerd018b2e2006-08-18 18:51:20 +1000387 AC_DEFINE(HAVE_FCNTL_CLOSEM, 1, [Use F_CLOSEM fcntl for closefrom]),
Darren Tucker3083bc22006-08-17 19:35:49 +1000388 [],
389 [ #include <limits.h>
390 #include <fcntl.h> ]
391 )
Darren Tucker691d5232005-02-15 21:45:57 +1100392 check_for_aix_broken_getaddrinfo=1
Tim Rice7df8d392005-09-19 09:33:39 -0700393 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
394 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
395 [Define if your platform breaks doing a seteuid before a setuid])
396 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
397 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
andre60f3c982000-06-03 16:18:19 +0000398 dnl AIX handles lastlog as part of its login message
Tim Rice7df8d392005-09-19 09:33:39 -0700399 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
400 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
401 [Some systems need a utmpx entry for /bin/login to work])
402 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
403 [Define to a Set Process Title type if your system is
404 supported by bsd-setproctitle.c])
Darren Tucker91d25a02005-11-26 22:24:09 +1100405 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
406 [AIX 5.2 and 5.3 (and presumably newer) require this])
Darren Tucker9afe1152006-06-23 21:24:12 +1000407 AC_DEFINE(PTY_ZEROREAD, 1, [read(1) can return 0 for a non-closed fd])
Damien Miller75b1d102000-01-07 14:01:41 +1100408 ;;
Damien Millerbac2d8a2000-09-05 16:13:06 +1100409*-*-cygwin*)
Damien Millerc8936ac2003-02-11 10:04:03 +1100410 check_for_libcrypt_later=1
Darren Tucker573e3872007-03-02 17:50:03 +1100411 LIBS="$LIBS /usr/lib/textreadmode.o"
Tim Rice7df8d392005-09-19 09:33:39 -0700412 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
413 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
414 AC_DEFINE(DISABLE_SHADOW, 1,
415 [Define if you want to disable shadow passwords])
416 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
417 [Define if your system choked on IP TOS setting])
418 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
419 [Define if X11 doesn't support AF_UNIX sockets on that system])
420 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
421 [Define if the concept of ports only accessible to
422 superusers isn't known])
423 AC_DEFINE(DISABLE_FD_PASSING, 1,
424 [Define if your platform needs to skip post auth
425 file descriptor passing])
Damien Millerbac2d8a2000-09-05 16:13:06 +1100426 ;;
Ben Lindstrom58055132001-02-15 18:34:29 +0000427*-*-dgux*)
428 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker454da0b2003-12-18 12:52:19 +1100429 AC_DEFINE(SETEUID_BREAKS_SETUID)
430 AC_DEFINE(BROKEN_SETREUID)
431 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom58055132001-02-15 18:34:29 +0000432 ;;
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000433*-*-darwin*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000434 AC_MSG_CHECKING(if we have working getaddrinfo)
435 AC_TRY_RUN([#include <mach-o/dyld.h>
436main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
437 exit(0);
438 else
439 exit(1);
440}], [AC_MSG_RESULT(working)],
441 [AC_MSG_RESULT(buggy)
Tim Rice7df8d392005-09-19 09:33:39 -0700442 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
Tim Rice480ef8d2003-09-21 21:38:11 -0700443 [AC_MSG_RESULT(assume it is working)])
Darren Tucker20379a32003-09-22 11:07:40 +1000444 AC_DEFINE(SETEUID_BREAKS_SETUID)
445 AC_DEFINE(BROKEN_SETREUID)
446 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker528d6fa2007-12-31 21:29:26 +1100447 AC_DEFINE(BROKEN_GLOB, 1, [OS X glob does not do what we expect])
Tim Rice7df8d392005-09-19 09:33:39 -0700448 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
449 [Define if your resolver libs need this for getrrsetbyname])
Darren Tucker3eb48342006-06-23 21:05:12 +1000450 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
451 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
452 [Use tunnel device compatibility to OpenBSD])
453 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
454 [Prepend the address family to IP tunnel traffic])
Darren Tuckeracada072008-02-25 21:05:04 +1100455 m4_pattern_allow(AU_IPv)
456 AC_CHECK_DECL(AU_IPv4, [],
457 AC_DEFINE(AU_IPv4, 0, [System only supports IPv4 audit records])
458 [#include <bsm/audit.h>]
459 )
Ben Lindstromfed7bb42001-07-15 18:30:42 +0000460 ;;
Darren Tucker57b29202006-09-10 20:25:51 +1000461*-*-dragonfly*)
462 SSHDLIBS="$SSHDLIBS -lcrypt"
463 ;;
Darren Tuckerfd333282005-05-28 18:31:42 +1000464*-*-hpux*)
465 # first we define all of the options common to all HP-UX releases
Kevin Steves315f8b72001-06-28 00:24:41 +0000466 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
Damien Miller9a947342000-08-30 10:03:33 +1100467 IPADDR_IN_DISPLAY=yes
Damien Millerb0785672000-08-23 09:10:39 +1000468 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700469 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
470 [Define if your login program cannot handle end of options ("--")])
Kevin Steves5feaaef2002-04-23 20:45:55 +0000471 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700472 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
473 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000474 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
Darren Tucker1e6616b2005-10-08 12:07:01 +1000475 MAIL="/var/mail/username"
Tim Ricef028f1e2002-07-19 12:41:10 -0700476 LIBS="$LIBS -lsec"
Darren Tuckerfd333282005-05-28 18:31:42 +1000477 AC_CHECK_LIB(xnet, t_error, ,
478 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
479
480 # next, we define all of the options specific to major releases
481 case "$host" in
482 *-*-hpux10*)
483 if test -z "$GCC"; then
484 CFLAGS="$CFLAGS -Ae"
485 fi
486 ;;
487 *-*-hpux11*)
Tim Rice7df8d392005-09-19 09:33:39 -0700488 AC_DEFINE(PAM_SUN_CODEBASE, 1,
489 [Define if you are using Solaris-derived PAM which
490 passes pam_messages to the conversation function
491 with an extra level of indirection])
492 AC_DEFINE(DISABLE_UTMP, 1,
493 [Define if you don't want to use utmp])
Darren Tuckerfd333282005-05-28 18:31:42 +1000494 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
495 check_for_hpux_broken_getaddrinfo=1
496 check_for_conflicting_getspnam=1
497 ;;
498 esac
499
500 # lastly, we define options specific to minor releases
501 case "$host" in
502 *-*-hpux10.26)
Tim Rice7df8d392005-09-19 09:33:39 -0700503 AC_DEFINE(HAVE_SECUREWARE, 1,
504 [Define if you have SecureWare-based
505 protected password database])
Darren Tuckerfd333282005-05-28 18:31:42 +1000506 disable_ptmx_check=yes
507 LIBS="$LIBS -lsecpw"
508 ;;
509 esac
Damien Miller1bead332000-04-30 00:47:29 +1000510 ;;
Damien Millerbeb4ba51999-12-28 15:09:35 +1100511*-*-irix5*)
Damien Miller190d5a82000-09-30 09:43:19 +1100512 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700513 AC_DEFINE(BROKEN_INET_NTOA, 1,
514 [Define if you system's inet_ntoa is busted
515 (e.g. Irix gcc issue)])
Darren Tuckerbeaf6792003-09-24 20:03:48 +1000516 AC_DEFINE(SETEUID_BREAKS_SETUID)
517 AC_DEFINE(BROKEN_SETREUID)
518 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700519 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
520 [Define if you shouldn't strip 'tty' from your
521 ttyname in [uw]tmp])
Darren Tuckere41bba52003-08-25 11:51:19 +1000522 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller1808f382000-01-06 12:03:12 +1100523 ;;
524*-*-irix6*)
Damien Miller190d5a82000-09-30 09:43:19 +1100525 PATH="$PATH:/usr/etc"
Tim Rice7df8d392005-09-19 09:33:39 -0700526 AC_DEFINE(WITH_IRIX_ARRAY, 1,
527 [Define if you have/want arrays
528 (cluster-wide session managment, not C arrays)])
529 AC_DEFINE(WITH_IRIX_PROJECT, 1,
530 [Define if you want IRIX project management])
531 AC_DEFINE(WITH_IRIX_AUDIT, 1,
532 [Define if you want IRIX audit trails])
533 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
534 [Define if you want IRIX kernel jobs])])
Damien Miller11fa2cc2000-08-16 10:35:58 +1000535 AC_DEFINE(BROKEN_INET_NTOA)
Darren Tuckerbe79af12003-09-22 11:58:21 +1000536 AC_DEFINE(SETEUID_BREAKS_SETUID)
537 AC_DEFINE(BROKEN_SETREUID)
538 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700539 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
Damien Millerf1b9d112002-04-23 23:09:19 +1000540 AC_DEFINE(WITH_ABBREV_NO_TTY)
Darren Tuckere41bba52003-08-25 11:51:19 +1000541 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Millerbeb4ba51999-12-28 15:09:35 +1100542 ;;
Damien Millerb29ea912000-01-15 14:12:03 +1100543*-*-linux*)
544 no_dev_ptmx=1
Damien Millera64b57a2001-01-17 10:44:13 +1100545 check_for_libcrypt_later=1
Darren Tucker70a3d552003-08-21 17:58:29 +1000546 check_for_openpty_ctty_bug=1
Tim Rice7df8d392005-09-19 09:33:39 -0700547 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
548 AC_DEFINE(PAM_TTY_KLUDGE, 1,
549 [Work around problematic Linux PAM modules handling of PAM_TTY])
550 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
551 [String used in /etc/passwd to denote locked account])
Damien Miller35276252003-06-03 10:14:28 +1000552 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
Tim Rice7df8d392005-09-19 09:33:39 -0700553 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
554 [Define to whatever link() returns for "not supported"
555 if it doesn't return EOPNOTSUPP.])
Darren Tucker2fba9932005-02-02 23:30:24 +1100556 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
Tim Rice7df8d392005-09-19 09:33:39 -0700557 AC_DEFINE(USE_BTMP)
Damien Miller7bcb0892000-03-11 20:45:40 +1100558 inet6_default_4in6=yes
Darren Tucker3c016542003-05-02 20:48:21 +1000559 case `uname -r` in
Darren Tuckerc437cda2003-05-10 17:05:46 +1000560 1.*|2.0.*)
Tim Rice7df8d392005-09-19 09:33:39 -0700561 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
562 [Define if cmsg_type is not passed correctly])
Darren Tucker3c016542003-05-02 20:48:21 +1000563 ;;
Darren Tucker3c016542003-05-02 20:48:21 +1000564 esac
Damien Miller89e03ba2005-12-31 16:42:03 +1100565 # tun(4) forwarding compat code
Damien Millerc4bcc912005-12-31 17:05:58 +1100566 AC_CHECK_HEADERS(linux/if_tun.h)
Damien Millerbd4e4102006-01-01 21:03:30 +1100567 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
Damien Miller89e03ba2005-12-31 16:42:03 +1100568 AC_DEFINE(SSH_TUN_LINUX, 1,
569 [Open tunnel devices the Linux tun/tap way])
570 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
571 [Use tunnel device compatibility to OpenBSD])
572 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
573 [Prepend the address family to IP tunnel traffic])
574 fi
Damien Millerb29ea912000-01-15 14:12:03 +1100575 ;;
Ben Lindstromb5628642000-10-18 00:02:25 +0000576mips-sony-bsd|mips-sony-newsos4)
Darren Tucker988b3fd2006-02-08 22:11:27 +1100577 AC_DEFINE(NEED_SETPGRP, 1, [Need setpgrp to acquire controlling tty])
Ben Lindstromb5628642000-10-18 00:02:25 +0000578 SONY=1
Ben Lindstromb5628642000-10-18 00:02:25 +0000579 ;;
Damien Milleree1c0b32000-01-21 00:18:15 +1100580*-*-netbsd*)
Damien Millerfc93d4b2002-09-04 23:26:29 +1000581 check_for_libcrypt_before=1
Tim Riceeae17cc2005-03-17 16:52:20 -0800582 if test "x$withval" != "xno" ; then
Tim Rice88368a32003-12-08 12:35:59 -0800583 need_dash_r=1
584 fi
Damien Miller2dcddbf2006-01-01 19:47:05 +1100585 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
586 AC_CHECK_HEADER([net/if_tap.h], ,
587 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
588 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
589 [Prepend the address family to IP tunnel traffic])
Damien Milleree1c0b32000-01-21 00:18:15 +1100590 ;;
Damien Millerfbd884a2001-02-27 08:39:07 +1100591*-*-freebsd*)
592 check_for_libcrypt_later=1
Darren Tuckerac7e6302005-10-06 01:39:58 +1000593 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100594 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
595 AC_CHECK_HEADER([net/if_tap.h], ,
596 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
Darren Tucker54e859f2008-03-02 21:52:27 +1100597 AC_DEFINE(BROKEN_GLOB, 1, [FreeBSD glob does not do what we need])
Damien Millerfbd884a2001-02-27 08:39:07 +1100598 ;;
Darren Tuckered9eb022003-09-22 11:18:47 +1000599*-*-bsdi*)
600 AC_DEFINE(SETEUID_BREAKS_SETUID)
601 AC_DEFINE(BROKEN_SETREUID)
602 AC_DEFINE(BROKEN_SETREGID)
603 ;;
Damien Miller0f91b4e2000-06-18 15:43:25 +1000604*-next-*)
Damien Miller0f91b4e2000-06-18 15:43:25 +1000605 conf_lastlog_location="/usr/adm/lastlog"
Damien Millere5192fa2000-08-29 14:30:37 +1100606 conf_utmp_location=/etc/utmp
607 conf_wtmp_location=/usr/adm/wtmp
608 MAIL=/usr/spool/mail
Tim Rice7df8d392005-09-19 09:33:39 -0700609 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
Ben Lindstromb4df15d2000-10-15 00:17:36 +0000610 AC_DEFINE(BROKEN_REALPATH)
Ben Lindstrom76020ba2000-10-25 16:55:00 +0000611 AC_DEFINE(USE_PIPES)
Tim Rice7df8d392005-09-19 09:33:39 -0700612 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
Damien Miller0f91b4e2000-06-18 15:43:25 +1000613 ;;
Darren Tucker4a422572005-07-14 17:22:11 +1000614*-*-openbsd*)
615 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
Darren Tucker9ac1a652005-10-09 11:40:03 +1000616 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
Damien Miller2dcddbf2006-01-01 19:47:05 +1100617 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
Damien Millerbb598142006-08-19 08:38:23 +1000618 AC_DEFINE(SYSLOG_R_SAFE_IN_SIGHAND, 1,
619 [syslog_r function is safe to use in in a signal handler])
Darren Tucker4a422572005-07-14 17:22:11 +1000620 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100621*-*-solaris*)
Tim Riceeae17cc2005-03-17 16:52:20 -0800622 if test "x$withval" != "xno" ; then
Tim Ricead4a1882004-02-29 15:53:37 -0800623 need_dash_r=1
624 fi
Damien Miller82cf0ce2000-12-20 13:34:48 +1100625 AC_DEFINE(PAM_SUN_CODEBASE)
Ben Lindstrom97c677d2001-05-08 20:33:05 +0000626 AC_DEFINE(LOGIN_NEEDS_UTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700627 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
628 [Some versions of /bin/login need the TERM supplied
629 on the commandline])
Ben Lindstrom95276712001-10-23 17:14:00 +0000630 AC_DEFINE(PAM_TTY_KLUDGE)
Tim Rice7df8d392005-09-19 09:33:39 -0700631 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
632 [Define if pam_chauthtok wants real uid set
633 to the unpriv'ed user])
Darren Tuckere41bba52003-08-25 11:51:19 +1000634 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Darren Tuckerc437cda2003-05-10 17:05:46 +1000635 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
Tim Rice7df8d392005-09-19 09:33:39 -0700636 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
637 [Define if sshd somehow reacquires a controlling TTY
638 after setsid()])
Darren Tucker0249f932006-06-24 12:10:07 +1000639 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd
640 in case the name is longer than 8 chars])
Darren Tuckere1a790d2003-09-16 11:52:19 +1000641 external_path_file=/etc/default/login
andre2ff7b5d2000-06-03 14:57:40 +0000642 # hardwire lastlog location (can't detect it on some versions)
643 conf_lastlog_location="/var/adm/lastlog"
Damien Millera1cb6442000-06-09 11:58:35 +1000644 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
645 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
646 if test "$sol2ver" -ge 8; then
647 AC_MSG_RESULT(yes)
648 AC_DEFINE(DISABLE_UTMP)
Tim Rice7df8d392005-09-19 09:33:39 -0700649 AC_DEFINE(DISABLE_WTMP, 1,
650 [Define if you don't want to use wtmp])
Damien Millera1cb6442000-06-09 11:58:35 +1000651 else
652 AC_MSG_RESULT(no)
653 fi
Damien Miller1b06dc32006-08-31 03:24:41 +1000654 AC_ARG_WITH(solaris-contracts,
655 [ --with-solaris-contracts Enable Solaris process contracts (experimental)],
656 [
657 AC_CHECK_LIB(contract, ct_tmpl_activate,
658 [ AC_DEFINE(USE_SOLARIS_PROCESS_CONTRACTS, 1,
659 [Define if you have Solaris process contracts])
660 SSHDLIBS="$SSHDLIBS -lcontract"
661 AC_SUBST(SSHDLIBS)
662 SPC_MSG="yes" ], )
663 ],
664 )
Damien Miller75b1d102000-01-07 14:01:41 +1100665 ;;
Damien Millerdfc83f42000-05-20 15:02:59 +1000666*-*-sunos4*)
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +0000667 CPPFLAGS="$CPPFLAGS -DSUNOS4"
Damien Millerdfc83f42000-05-20 15:02:59 +1000668 AC_CHECK_FUNCS(getpwanam)
Damien Miller82cf0ce2000-12-20 13:34:48 +1100669 AC_DEFINE(PAM_SUN_CODEBASE)
Damien Miller36ccb5c2000-08-09 16:34:27 +1000670 conf_utmp_location=/etc/utmp
671 conf_wtmp_location=/var/adm/wtmp
672 conf_lastlog_location=/var/adm/lastlog
Damien Millerb0785672000-08-23 09:10:39 +1000673 AC_DEFINE(USE_PIPES)
Damien Millerdfc83f42000-05-20 15:02:59 +1000674 ;;
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000675*-ncr-sysv*)
Tim Rice13aae5e2001-10-21 17:53:58 -0700676 LIBS="$LIBS -lc89"
Kevin Steves0bd4b342002-01-05 23:24:27 +0000677 AC_DEFINE(USE_PIPES)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000678 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker00130112003-09-22 11:40:24 +1000679 AC_DEFINE(SETEUID_BREAKS_SETUID)
680 AC_DEFINE(BROKEN_SETREUID)
681 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom603bdfd2001-02-12 07:29:45 +0000682 ;;
Damien Miller2ae714f2000-07-11 09:29:50 +1000683*-sni-sysv*)
Tim Riceffdf4aa2001-10-27 10:45:36 -0700684 # /usr/ucblib MUST NOT be searched on ReliantUNIX
Darren Tucker89df7a32003-10-07 20:35:57 +1000685 AC_CHECK_LIB(dl, dlsym, ,)
Darren Tucker79d09fa2005-11-24 22:34:54 +1100686 # -lresolv needs to be at the end of LIBS or DNS lookups break
687 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
Damien Millerfd9885e2001-01-10 08:16:53 +1100688 IPADDR_IN_DISPLAY=yes
689 AC_DEFINE(USE_PIPES)
Damien Miller2ae714f2000-07-11 09:29:50 +1000690 AC_DEFINE(IP_TOS_IS_BROKEN)
Darren Tucker3b2a06c2003-10-07 18:37:11 +1000691 AC_DEFINE(SETEUID_BREAKS_SETUID)
692 AC_DEFINE(BROKEN_SETREUID)
693 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker2972d6c2003-05-30 17:43:42 +1000694 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckere1a790d2003-09-16 11:52:19 +1000695 external_path_file=/etc/default/login
Tim Riceffdf4aa2001-10-27 10:45:36 -0700696 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
697 # Attention: always take care to bind libsocket and libnsl before libc,
698 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
Damien Miller2ae714f2000-07-11 09:29:50 +1000699 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800700# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
Damien Miller78315eb2000-09-29 23:01:36 +1100701*-*-sysv4.2*)
Damien Miller5dfe9762001-02-16 12:05:39 +1100702 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700703 AC_DEFINE(SETEUID_BREAKS_SETUID)
704 AC_DEFINE(BROKEN_SETREUID)
705 AC_DEFINE(BROKEN_SETREGID)
Tim Rice2f97b8b2005-04-11 19:00:18 -0700706 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
Tim Rice46259d82005-11-28 18:40:34 -0800707 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
Damien Miller78315eb2000-09-29 23:01:36 +1100708 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800709# UnixWare 7.x, OpenUNIX 8
Damien Miller78315eb2000-09-29 23:01:36 +1100710*-*-sysv5*)
Tim Riceeb456542005-08-30 07:12:02 -0700711 check_for_libcrypt_later=1
712 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
Damien Miller5dfe9762001-02-16 12:05:39 +1100713 AC_DEFINE(USE_PIPES)
Tim Riced546a842003-09-11 22:24:36 -0700714 AC_DEFINE(SETEUID_BREAKS_SETUID)
715 AC_DEFINE(BROKEN_SETREUID)
716 AC_DEFINE(BROKEN_SETREGID)
Tim Rice7df8d392005-09-19 09:33:39 -0700717 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Tim Rice4dbacff2005-06-01 20:09:28 -0700718 case "$host" in
719 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
720 TEST_SHELL=/u95/bin/sh
Tim Rice7df8d392005-09-19 09:33:39 -0700721 AC_DEFINE(BROKEN_LIBIAF, 1,
722 [ia_uinfo routines not supported by OS yet])
Tim Riceb8f00192006-09-06 18:11:29 -0700723 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice4dbacff2005-06-01 20:09:28 -0700724 ;;
Tim Rice46259d82005-11-28 18:40:34 -0800725 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
726 ;;
Tim Rice4dbacff2005-06-01 20:09:28 -0700727 esac
Damien Miller78315eb2000-09-29 23:01:36 +1100728 ;;
Damien Miller75b1d102000-01-07 14:01:41 +1100729*-*-sysv*)
Damien Miller75b1d102000-01-07 14:01:41 +1100730 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800731# SCO UNIX and OEM versions of SCO UNIX
Damien Miller78315eb2000-09-29 23:01:36 +1100732*-*-sco3.2v4*)
Tim Ricec390c8d2005-03-07 01:21:37 -0800733 AC_MSG_ERROR("This Platform is no longer supported.")
Damien Miller78315eb2000-09-29 23:01:36 +1100734 ;;
Tim Rice0f83d292004-12-08 18:29:58 -0800735# SCO OpenServer 5.x
Damien Miller78315eb2000-09-29 23:01:36 +1100736*-*-sco3.2v5*)
Tim Rice89fe3f32003-01-19 20:20:24 -0800737 if test -z "$GCC"; then
738 CFLAGS="$CFLAGS -belf"
739 fi
Damien Miller5dfe9762001-02-16 12:05:39 +1100740 LIBS="$LIBS -lprot -lx -ltinfo -lm"
Damien Millera66626b2000-06-13 18:57:53 +1000741 no_dev_ptmx=1
Damien Miller5dfe9762001-02-16 12:05:39 +1100742 AC_DEFINE(USE_PIPES)
Kevin Steves0ea1d9d2002-04-25 18:17:04 +0000743 AC_DEFINE(HAVE_SECUREWARE)
Ben Lindstrom980754c2000-11-12 00:04:24 +0000744 AC_DEFINE(DISABLE_SHADOW)
Tim Rice9dd30812002-07-07 13:43:36 -0700745 AC_DEFINE(DISABLE_FD_PASSING)
Tim Riced546a842003-09-11 22:24:36 -0700746 AC_DEFINE(SETEUID_BREAKS_SETUID)
747 AC_DEFINE(BROKEN_SETREUID)
748 AC_DEFINE(BROKEN_SETREGID)
Tim Riceae477e92003-09-12 18:15:15 -0700749 AC_DEFINE(WITH_ABBREV_NO_TTY)
Tim Rice816bd0d2004-07-19 10:19:26 -0700750 AC_DEFINE(BROKEN_UPDWTMPX)
Tim Rice7df8d392005-09-19 09:33:39 -0700751 AC_DEFINE(PASSWD_NEEDS_USERNAME)
Damien Miller217f5672001-02-16 12:12:41 +1100752 AC_CHECK_FUNCS(getluid setluid)
Tim Rice07183b82001-04-25 21:40:28 -0700753 MANTYPE=man
Tim Ricef7ba8f62004-06-20 10:37:32 -0700754 TEST_SHELL=ksh
Damien Millera66626b2000-06-13 18:57:53 +1000755 ;;
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000756*-*-unicosmk*)
Tim Rice7df8d392005-09-19 09:33:39 -0700757 AC_DEFINE(NO_SSH_LASTLOG, 1,
758 [Define if you don't want to use lastlog in session.c])
Darren Tucker2df33432004-01-30 14:34:21 +1100759 AC_DEFINE(SETEUID_BREAKS_SETUID)
760 AC_DEFINE(BROKEN_SETREUID)
761 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000762 AC_DEFINE(USE_PIPES)
763 AC_DEFINE(DISABLE_FD_PASSING)
764 LDFLAGS="$LDFLAGS"
765 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
766 MANTYPE=cat
Ben Lindstrom762104e2002-07-23 00:00:05 +0000767 ;;
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000768*-*-unicosmp*)
Darren Tucker2df33432004-01-30 14:34:21 +1100769 AC_DEFINE(SETEUID_BREAKS_SETUID)
770 AC_DEFINE(BROKEN_SETREUID)
771 AC_DEFINE(BROKEN_SETREGID)
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000772 AC_DEFINE(WITH_ABBREV_NO_TTY)
773 AC_DEFINE(USE_PIPES)
774 AC_DEFINE(DISABLE_FD_PASSING)
775 LDFLAGS="$LDFLAGS"
Darren Tucker2df33432004-01-30 14:34:21 +1100776 LIBS="$LIBS -lgen -lacid -ldb"
Darren Tucker9f7ffc52003-09-10 11:39:05 +1000777 MANTYPE=cat
778 ;;
Ben Lindstromd9e08242001-07-22 19:32:00 +0000779*-*-unicos*)
Darren Tucker2df33432004-01-30 14:34:21 +1100780 AC_DEFINE(SETEUID_BREAKS_SETUID)
781 AC_DEFINE(BROKEN_SETREUID)
782 AC_DEFINE(BROKEN_SETREGID)
Ben Lindstromd9e08242001-07-22 19:32:00 +0000783 AC_DEFINE(USE_PIPES)
Tim Rice9dd30812002-07-07 13:43:36 -0700784 AC_DEFINE(DISABLE_FD_PASSING)
Tim Rice81ed5182002-09-25 17:38:46 -0700785 AC_DEFINE(NO_SSH_LASTLOG)
Ben Lindstrom232ccf72002-07-22 23:34:25 +0000786 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
787 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
788 MANTYPE=cat
Tim Ricee991e3c2001-08-07 15:29:07 -0700789 ;;
Damien Millerb8c656e2000-06-28 15:22:41 +1000790*-dec-osf*)
Ben Lindstrom72af2ef2001-05-08 20:42:28 +0000791 AC_MSG_CHECKING(for Digital Unix SIA)
792 no_osfsia=""
793 AC_ARG_WITH(osfsia,
794 [ --with-osfsia Enable Digital Unix SIA],
795 [
796 if test "x$withval" = "xno" ; then
797 AC_MSG_RESULT(disabled)
798 no_osfsia=1
799 fi
800 ],
801 )
802 if test -z "$no_osfsia" ; then
Damien Millerb8c656e2000-06-28 15:22:41 +1000803 if test -f /etc/sia/matrix.conf; then
804 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -0700805 AC_DEFINE(HAVE_OSF_SIA, 1,
806 [Define if you have Digital Unix Security
807 Integration Architecture])
808 AC_DEFINE(DISABLE_LOGIN, 1,
809 [Define if you don't want to use your
810 system's login() call])
Ben Lindstromc8c548d2003-03-21 01:18:09 +0000811 AC_DEFINE(DISABLE_FD_PASSING)
Damien Millerb8c656e2000-06-28 15:22:41 +1000812 LIBS="$LIBS -lsecurity -ldb -lm -laud"
Damien Miller1b06dc32006-08-31 03:24:41 +1000813 SIA_MSG="yes"
Damien Millerb8c656e2000-06-28 15:22:41 +1000814 else
815 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -0700816 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
817 [String used in /etc/passwd to denote locked account])
Damien Millerb8c656e2000-06-28 15:22:41 +1000818 fi
819 fi
Darren Tucker3c8e1e12003-08-25 13:27:40 +1000820 AC_DEFINE(BROKEN_GETADDRINFO)
Tim Rice7a74c6b2003-09-21 21:00:59 -0700821 AC_DEFINE(SETEUID_BREAKS_SETUID)
Darren Tuckered92b212003-09-22 11:26:16 +1000822 AC_DEFINE(BROKEN_SETREUID)
823 AC_DEFINE(BROKEN_SETREGID)
Damien Millerb8c656e2000-06-28 15:22:41 +1000824 ;;
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000825
Tim Rice70335a62006-02-04 17:42:58 -0800826*-*-nto-qnx*)
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000827 AC_DEFINE(USE_PIPES)
828 AC_DEFINE(NO_X11_UNIX_SOCKETS)
Tim Rice7df8d392005-09-19 09:33:39 -0700829 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
830 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
831 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
Tim Rice70335a62006-02-04 17:42:58 -0800832 AC_DEFINE(DISABLE_LASTLOG)
Darren Tucker54b75fe2006-02-26 12:31:48 +1100833 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tuckerbc1bd9d2007-09-27 07:03:20 +1000834 AC_DEFINE(BROKEN_SHADOW_EXPIRE, 1, [QNX shadow support is broken])
Tim Rice2f993462006-02-11 18:37:48 -0800835 enable_etc_default_login=no # has incompatible /etc/default/login
Darren Tucker8acb3b62007-08-10 14:36:12 +1000836 case "$host" in
837 *-*-nto-qnx6*)
838 AC_DEFINE(DISABLE_FD_PASSING)
839 ;;
840 esac
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +0000841 ;;
Darren Tucker2be1cbb2005-05-27 21:13:40 +1000842
843*-*-ultrix*)
Tim Rice7df8d392005-09-19 09:33:39 -0700844 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
845 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
Darren Tucker988b3fd2006-02-08 22:11:27 +1100846 AC_DEFINE(NEED_SETPGRP)
Tim Ricefcc7ff12005-06-02 20:28:29 -0700847 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
848 ;;
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000849
850*-*-lynxos)
851 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
Tim Rice7df8d392005-09-19 09:33:39 -0700852 AC_DEFINE(MISSING_HOWMANY)
Darren Tucker93e7e8f2005-08-23 08:06:55 +1000853 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
854 ;;
Damien Miller76112de1999-12-21 11:18:08 +1100855esac
856
Darren Tucker6eb93042003-06-29 21:30:41 +1000857AC_MSG_CHECKING(compiler and flags for sanity)
Darren Tucker623d92f2004-09-12 22:36:15 +1000858AC_RUN_IFELSE(
859 [AC_LANG_SOURCE([
Darren Tucker6eb93042003-06-29 21:30:41 +1000860#include <stdio.h>
861int main(){exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +1000862 ])],
Darren Tucker6eb93042003-06-29 21:30:41 +1000863 [ AC_MSG_RESULT(yes) ],
864 [
865 AC_MSG_RESULT(no)
866 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
Darren Tuckera0c2b392004-09-11 23:26:37 +1000867 ],
868 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
Darren Tucker6eb93042003-06-29 21:30:41 +1000869)
870
Darren Tucker0c9653f2005-05-28 15:58:14 +1000871dnl Checks for header files.
Damien Millera22ba012000-03-02 23:09:20 +1100872# Checks for libraries.
Tim Rice13aae5e2001-10-21 17:53:58 -0700873AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
874AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
Ben Lindstrom3ad650a2001-01-03 06:02:51 +0000875
Tim Rice1e1ef642003-09-11 22:19:31 -0700876dnl IRIX and Solaris 2.5.1 have dirname() in libgen
877AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
878 AC_CHECK_LIB(gen, dirname,[
879 AC_CACHE_CHECK([for broken dirname],
880 ac_cv_have_broken_dirname, [
881 save_LIBS="$LIBS"
882 LIBS="$LIBS -lgen"
Darren Tucker314d89e2005-10-17 23:29:23 +1000883 AC_RUN_IFELSE(
884 [AC_LANG_SOURCE([[
Tim Rice1e1ef642003-09-11 22:19:31 -0700885#include <libgen.h>
886#include <string.h>
887
888int main(int argc, char **argv) {
889 char *s, buf[32];
890
891 strncpy(buf,"/etc", 32);
892 s = dirname(buf);
893 if (!s || strncmp(s, "/", 32) != 0) {
894 exit(1);
895 } else {
896 exit(0);
897 }
898}
Darren Tucker314d89e2005-10-17 23:29:23 +1000899 ]])],
Tim Rice1e1ef642003-09-11 22:19:31 -0700900 [ ac_cv_have_broken_dirname="no" ],
Darren Tucker314d89e2005-10-17 23:29:23 +1000901 [ ac_cv_have_broken_dirname="yes" ],
902 [ ac_cv_have_broken_dirname="no" ],
Tim Rice1e1ef642003-09-11 22:19:31 -0700903 )
904 LIBS="$save_LIBS"
905 ])
906 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
907 LIBS="$LIBS -lgen"
908 AC_DEFINE(HAVE_DIRNAME)
909 AC_CHECK_HEADERS(libgen.h)
910 fi
911 ])
912])
913
914AC_CHECK_FUNC(getspnam, ,
915 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
Tim Rice7df8d392005-09-19 09:33:39 -0700916AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
917 [Define if you have the basename function.]))
Tim Rice1e1ef642003-09-11 22:19:31 -0700918
Tim Rice13aae5e2001-10-21 17:53:58 -0700919dnl zlib is required
920AC_ARG_WITH(zlib,
921 [ --with-zlib=PATH Use zlib in PATH],
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100922 [ if test "x$withval" = "xno" ; then
923 AC_MSG_ERROR([*** zlib is required ***])
924 elif test "x$withval" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -0700925 if test -d "$withval/lib"; then
926 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700927 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700928 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700929 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700930 fi
931 else
932 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700933 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700934 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700935 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700936 fi
937 fi
938 if test -d "$withval/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -0700939 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700940 else
Tim Rice02cebcd2001-10-25 10:01:30 -0700941 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -0700942 fi
Darren Tucker86a5f8d2005-03-21 09:55:17 +1100943 fi ]
Tim Rice13aae5e2001-10-21 17:53:58 -0700944)
945
Tim Ricefcb62202004-01-23 18:35:16 -0800946AC_CHECK_LIB(z, deflate, ,
947 [
948 saved_CPPFLAGS="$CPPFLAGS"
949 saved_LDFLAGS="$LDFLAGS"
950 save_LIBS="$LIBS"
951 dnl Check default zlib install dir
952 if test -n "${need_dash_r}"; then
953 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
954 else
955 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
956 fi
957 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
958 LIBS="$LIBS -lz"
959 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
960 [
961 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
962 ]
963 )
964 ]
965)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100966AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
Darren Tuckerdcc736b2004-01-30 14:20:59 +1100967
968AC_ARG_WITH(zlib-version-check,
969 [ --without-zlib-version-check Disable zlib version check],
970 [ if test "x$withval" = "xno" ; then
971 zlib_check_nonfatal=1
972 fi
973 ]
974)
975
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000976AC_MSG_CHECKING(for possibly buggy zlib)
Darren Tucker623d92f2004-09-12 22:36:15 +1000977AC_RUN_IFELSE([AC_LANG_SOURCE([[
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000978#include <stdio.h>
Darren Tucker2dcd2392004-01-23 17:13:33 +1100979#include <zlib.h>
980int main()
981{
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000982 int a=0, b=0, c=0, d=0, n, v;
983 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
984 if (n != 3 && n != 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100985 exit(1);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000986 v = a*1000000 + b*10000 + c*100 + d;
987 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
988
989 /* 1.1.4 is OK */
990 if (a == 1 && b == 1 && c >= 4)
Darren Tucker2dcd2392004-01-23 17:13:33 +1100991 exit(0);
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000992
Darren Tucker41097ed2005-07-25 15:24:21 +1000993 /* 1.2.3 and up are OK */
994 if (v >= 1020300)
Darren Tucker2f0b5c42005-04-24 17:52:22 +1000995 exit(0);
996
Darren Tucker2dcd2392004-01-23 17:13:33 +1100997 exit(2);
998}
Darren Tucker623d92f2004-09-12 22:36:15 +1000999 ]])],
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001000 AC_MSG_RESULT(no),
1001 [ AC_MSG_RESULT(yes)
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001002 if test -z "$zlib_check_nonfatal" ; then
1003 AC_MSG_ERROR([*** zlib too old - check config.log ***
1004Your reported zlib version has known security problems. It's possible your
1005vendor has fixed these problems without changing the version number. If you
1006are sure this is the case, you can disable the check by running
1007"./configure --without-zlib-version-check".
Darren Tuckerac1910f2005-07-26 12:00:42 +10001008If you are in doubt, upgrade zlib to version 1.2.3 or greater.
Darren Tucker2f0b5c42005-04-24 17:52:22 +10001009See http://www.gzip.org/zlib/ for details.])
Darren Tuckerdcc736b2004-01-30 14:20:59 +11001010 else
1011 AC_MSG_WARN([zlib version may have security problems])
1012 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001013 ],
1014 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
Darren Tucker2dcd2392004-01-23 17:13:33 +11001015)
Damien Miller6f9c3372000-10-25 10:06:04 +11001016
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001017dnl UnixWare 2.x
Damien Millera8e06ce2003-11-21 23:48:55 +11001018AC_CHECK_FUNC(strcasecmp,
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001019 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
1020)
Darren Tucker5bfe1682005-11-12 18:42:36 +11001021AC_CHECK_FUNCS(utimes,
Tim Ricecbb90662002-07-08 19:17:10 -07001022 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
1023 LIBS="$LIBS -lc89"]) ]
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00001024)
Damien Millerab18c411999-11-11 10:40:23 +11001025
Tim Ricee589a292001-11-03 11:09:32 -08001026dnl Checks for libutil functions
1027AC_CHECK_HEADERS(libutil.h)
Tim Rice7df8d392005-09-19 09:33:39 -07001028AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
1029 [Define if your libraries define login()])])
Tim Ricee589a292001-11-03 11:09:32 -08001030AC_CHECK_FUNCS(logout updwtmp logwtmp)
1031
Ben Lindstrom8697e082001-02-24 21:41:10 +00001032AC_FUNC_STRFTIME
1033
Damien Miller3c027682001-03-14 11:39:45 +11001034# Check for ALTDIRFUNC glob() extension
1035AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
1036AC_EGREP_CPP(FOUNDIT,
1037 [
1038 #include <glob.h>
1039 #ifdef GLOB_ALTDIRFUNC
1040 FOUNDIT
1041 #endif
Damien Millera8e06ce2003-11-21 23:48:55 +11001042 ],
Damien Miller3c027682001-03-14 11:39:45 +11001043 [
Tim Rice7df8d392005-09-19 09:33:39 -07001044 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
1045 [Define if your system glob() function has
1046 the GLOB_ALTDIRFUNC extension])
Damien Miller3c027682001-03-14 11:39:45 +11001047 AC_MSG_RESULT(yes)
1048 ],
1049 [
1050 AC_MSG_RESULT(no)
1051 ]
1052)
Damien Millerab18c411999-11-11 10:40:23 +11001053
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001054# Check for g.gl_matchc glob() extension
1055AC_MSG_CHECKING(for gl_matchc field in glob_t)
Darren Tucker486d95e2006-03-15 21:31:39 +11001056AC_TRY_COMPILE(
Damien Milleraf87af12006-03-15 13:02:28 +11001057 [ #include <glob.h> ],
1058 [glob_t g; g.gl_matchc = 1;],
Damien Millera8e06ce2003-11-21 23:48:55 +11001059 [
Tim Rice7df8d392005-09-19 09:33:39 -07001060 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
1061 [Define if your system glob() function has
1062 gl_matchc options in glob_t])
Damien Millera8e06ce2003-11-21 23:48:55 +11001063 AC_MSG_RESULT(yes)
1064 ],
1065 [
1066 AC_MSG_RESULT(no)
1067 ]
Ben Lindstrom45b14db2001-03-17 01:15:38 +00001068)
1069
Darren Tucker096faec2006-09-01 20:29:10 +10001070AC_CHECK_DECLS(GLOB_NOMATCH, , , [#include <glob.h>])
1071
Damien Miller18bb4732001-03-28 14:35:30 +10001072AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001073AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001074 [AC_LANG_SOURCE([[
Damien Miller18bb4732001-03-28 14:35:30 +10001075#include <sys/types.h>
1076#include <dirent.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001077int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
Darren Tucker623d92f2004-09-12 22:36:15 +10001078 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001079 [AC_MSG_RESULT(yes)],
Damien Miller18bb4732001-03-28 14:35:30 +10001080 [
1081 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001082 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
Darren Tucker79d09fa2005-11-24 22:34:54 +11001083 [Define if your struct dirent expects you to
Tim Rice7df8d392005-09-19 09:33:39 -07001084 allocate extra space for d_name])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001085 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08001086 [
Darren Tuckera0c2b392004-09-11 23:26:37 +10001087 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
1088 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
Damien Miller18bb4732001-03-28 14:35:30 +10001089 ]
1090)
1091
Damien Miller36f49652004-08-15 18:40:59 +10001092AC_MSG_CHECKING([for /proc/pid/fd directory])
1093if test -d "/proc/$$/fd" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07001094 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
Damien Miller36f49652004-08-15 18:40:59 +10001095 AC_MSG_RESULT(yes)
1096else
1097 AC_MSG_RESULT(no)
1098fi
1099
Damien Millerc547bf12001-02-16 10:18:12 +11001100# Check whether user wants S/Key support
Damien Millera8e06ce2003-11-21 23:48:55 +11001101SKEY_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001102AC_ARG_WITH(skey,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001103 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001104 [
1105 if test "x$withval" != "xno" ; then
1106
1107 if test "x$withval" != "xyes" ; then
1108 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1109 LDFLAGS="$LDFLAGS -L${withval}/lib"
1110 fi
1111
Tim Rice7df8d392005-09-19 09:33:39 -07001112 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
Damien Millerc547bf12001-02-16 10:18:12 +11001113 LIBS="-lskey $LIBS"
Damien Millera8e06ce2003-11-21 23:48:55 +11001114 SKEY_MSG="yes"
Tim Riceeae17cc2005-03-17 16:52:20 -08001115
Tim Rice4cec93f2002-02-26 08:40:48 -08001116 AC_MSG_CHECKING([for s/key support])
Darren Tucker314d89e2005-10-17 23:29:23 +10001117 AC_LINK_IFELSE(
1118 [AC_LANG_SOURCE([[
Tim Rice4cec93f2002-02-26 08:40:48 -08001119#include <stdio.h>
1120#include <skey.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001121int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
Darren Tucker314d89e2005-10-17 23:29:23 +10001122 ]])],
Tim Rice4cec93f2002-02-26 08:40:48 -08001123 [AC_MSG_RESULT(yes)],
1124 [
1125 AC_MSG_RESULT(no)
Damien Millerc547bf12001-02-16 10:18:12 +11001126 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
1127 ])
Darren Tucker3b908f62004-04-14 15:26:39 +10001128 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
1129 AC_TRY_COMPILE(
1130 [#include <stdio.h>
1131 #include <skey.h>],
1132 [(void)skeychallenge(NULL,"name","",0);],
1133 [AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001134 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
1135 [Define if your skeychallenge()
1136 function takes 4 arguments (NetBSD)])],
Darren Tucker3b908f62004-04-14 15:26:39 +10001137 [AC_MSG_RESULT(no)]
1138 )
Damien Millerc547bf12001-02-16 10:18:12 +11001139 fi
1140 ]
1141)
1142
1143# Check whether user wants TCP wrappers support
Tim Rice13aae5e2001-10-21 17:53:58 -07001144TCPW_MSG="no"
Damien Millerc547bf12001-02-16 10:18:12 +11001145AC_ARG_WITH(tcp-wrappers,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001146 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
Damien Millerc547bf12001-02-16 10:18:12 +11001147 [
1148 if test "x$withval" != "xno" ; then
1149 saved_LIBS="$LIBS"
Tim Rice13aae5e2001-10-21 17:53:58 -07001150 saved_LDFLAGS="$LDFLAGS"
1151 saved_CPPFLAGS="$CPPFLAGS"
Tim Rice8bb561b2005-03-17 16:23:19 -08001152 if test -n "${withval}" && \
Tim Rice35cc69d2005-03-17 16:44:25 -08001153 test "x${withval}" != "xyes"; then
Tim Rice13aae5e2001-10-21 17:53:58 -07001154 if test -d "${withval}/lib"; then
1155 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001156 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001157 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001158 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001159 fi
1160 else
1161 if test -n "${need_dash_r}"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001162 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001163 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001164 LDFLAGS="-L${withval} ${LDFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001165 fi
1166 fi
1167 if test -d "${withval}/include"; then
Tim Rice02cebcd2001-10-25 10:01:30 -07001168 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001169 else
Tim Rice02cebcd2001-10-25 10:01:30 -07001170 CPPFLAGS="-I${withval} ${CPPFLAGS}"
Tim Rice13aae5e2001-10-21 17:53:58 -07001171 fi
Tim Rice13aae5e2001-10-21 17:53:58 -07001172 fi
Darren Tucker20e9f972007-03-25 18:26:01 +10001173 LIBS="-lwrap $LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001174 AC_MSG_CHECKING(for libwrap)
1175 AC_TRY_LINK(
1176 [
Damien Miller0ac45002004-04-14 20:14:26 +10001177#include <sys/types.h>
1178#include <sys/socket.h>
1179#include <netinet/in.h>
Damien Millerc547bf12001-02-16 10:18:12 +11001180#include <tcpd.h>
1181 int deny_severity = 0, allow_severity = 0;
1182 ],
1183 [hosts_access(0);],
1184 [
1185 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001186 AC_DEFINE(LIBWRAP, 1,
1187 [Define if you want
1188 TCP Wrappers support])
Darren Tucker20e9f972007-03-25 18:26:01 +10001189 SSHDLIBS="$SSHDLIBS -lwrap"
Tim Rice13aae5e2001-10-21 17:53:58 -07001190 TCPW_MSG="yes"
Damien Millerc547bf12001-02-16 10:18:12 +11001191 ],
1192 [
1193 AC_MSG_ERROR([*** libwrap missing])
1194 ]
1195 )
Tim Rice4cec93f2002-02-26 08:40:48 -08001196 LIBS="$saved_LIBS"
Damien Millerc547bf12001-02-16 10:18:12 +11001197 fi
1198 ]
1199)
1200
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001201# Check whether user wants libedit support
1202LIBEDIT_MSG="no"
1203AC_ARG_WITH(libedit,
Darren Tucker1b6f2292005-02-11 16:11:49 +11001204 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001205 [ if test "x$withval" != "xno" ; then
Darren Tucker1df61452005-03-21 09:58:07 +11001206 if test "x$withval" != "xyes"; then
Darren Tuckerc373a562005-09-22 20:15:08 +10001207 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1208 if test -n "${need_dash_r}"; then
1209 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1210 else
1211 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1212 fi
Darren Tucker1df61452005-03-21 09:58:07 +11001213 fi
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001214 AC_CHECK_LIB(edit, el_init,
Tim Rice7df8d392005-09-19 09:33:39 -07001215 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001216 LIBEDIT="-ledit -lcurses"
1217 LIBEDIT_MSG="yes"
1218 AC_SUBST(LIBEDIT)
1219 ],
Darren Tucker1df61452005-03-21 09:58:07 +11001220 [ AC_MSG_ERROR(libedit not found) ],
1221 [ -lcurses ]
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001222 )
Darren Tuckerc7572b22005-08-10 20:34:15 +10001223 AC_MSG_CHECKING(if libedit version is compatible)
Tim Ricec1819c82005-08-15 17:48:40 -07001224 AC_COMPILE_IFELSE(
1225 [AC_LANG_SOURCE([[
1226#include <histedit.h>
Darren Tuckerc7572b22005-08-10 20:34:15 +10001227int main(void)
1228{
1229 int i = H_SETSIZE;
1230 el_init("", NULL, NULL, NULL);
1231 exit(0);
1232}
Tim Ricec1819c82005-08-15 17:48:40 -07001233 ]])],
Darren Tuckerc7572b22005-08-10 20:34:15 +10001234 [ AC_MSG_RESULT(yes) ],
1235 [ AC_MSG_RESULT(no)
1236 AC_MSG_ERROR(libedit version is not compatible) ]
1237 )
Darren Tucker16bcc1c2004-11-07 20:14:34 +11001238 fi ]
1239)
1240
Darren Tuckerd9f88912005-02-20 21:01:48 +11001241AUDIT_MODULE=none
1242AC_ARG_WITH(audit,
1243 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1244 [
1245 AC_MSG_CHECKING(for supported audit module)
1246 case "$withval" in
1247 bsm)
1248 AC_MSG_RESULT(bsm)
1249 AUDIT_MODULE=bsm
1250 dnl Checks for headers, libs and functions
1251 AC_CHECK_HEADERS(bsm/audit.h, [],
Darren Tucker6d0d6fb2006-09-09 01:05:21 +10001252 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)],
1253 [
1254#ifdef HAVE_TIME_H
1255# include <time.h>
1256#endif
1257 ]
1258)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001259 AC_CHECK_LIB(bsm, getaudit, [],
1260 [AC_MSG_ERROR(BSM enabled and required library not found)])
1261 AC_CHECK_FUNCS(getaudit, [],
1262 [AC_MSG_ERROR(BSM enabled and required function not found)])
1263 # These are optional
Darren Tuckeracada072008-02-25 21:05:04 +11001264 AC_CHECK_FUNCS(getaudit_addr aug_get_machine)
Tim Rice7df8d392005-09-19 09:33:39 -07001265 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
Darren Tuckerd9f88912005-02-20 21:01:48 +11001266 ;;
1267 debug)
1268 AUDIT_MODULE=debug
1269 AC_MSG_RESULT(debug)
Tim Rice7df8d392005-09-19 09:33:39 -07001270 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
Darren Tuckerd9f88912005-02-20 21:01:48 +11001271 ;;
Tim Rice8bc6b902005-08-09 10:09:53 -07001272 no)
Tim Ricec1819c82005-08-15 17:48:40 -07001273 AC_MSG_RESULT(no)
Tim Rice8bc6b902005-08-09 10:09:53 -07001274 ;;
Darren Tuckerd9f88912005-02-20 21:01:48 +11001275 *)
1276 AC_MSG_ERROR([Unknown audit module $withval])
1277 ;;
1278 esac ]
1279)
1280
Damien Millerfe1f1432003-02-24 15:45:42 +11001281dnl Checks for library functions. Please keep in alphabetical order
Darren Tucker0c9653f2005-05-28 15:58:14 +10001282AC_CHECK_FUNCS( \
1283 arc4random \
Damien Miller57f39152005-11-24 19:58:19 +11001284 asprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001285 b64_ntop \
1286 __b64_ntop \
1287 b64_pton \
1288 __b64_pton \
1289 bcopy \
1290 bindresvport_sa \
1291 clock \
1292 closefrom \
1293 dirfd \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001294 fchmod \
1295 fchown \
1296 freeaddrinfo \
1297 futimes \
1298 getaddrinfo \
1299 getcwd \
1300 getgrouplist \
1301 getnameinfo \
1302 getopt \
1303 getpeereid \
Darren Tucker164aa302007-03-21 21:39:57 +11001304 getpeerucred \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001305 _getpty \
1306 getrlimit \
1307 getttyent \
1308 glob \
1309 inet_aton \
1310 inet_ntoa \
1311 inet_ntop \
1312 innetgr \
1313 login_getcapbool \
1314 md5_crypt \
1315 memmove \
1316 mkdtemp \
1317 mmap \
1318 ngetaddrinfo \
1319 nsleep \
1320 ogetaddrinfo \
1321 openlog_r \
1322 openpty \
Darren Tuckerfebf0f52007-06-25 22:15:12 +10001323 poll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001324 prctl \
1325 pstat \
1326 readpassphrase \
1327 realpath \
1328 recvmsg \
1329 rresvport_af \
1330 sendmsg \
1331 setdtablesize \
1332 setegid \
1333 setenv \
1334 seteuid \
1335 setgroups \
1336 setlogin \
1337 setpcred \
1338 setproctitle \
1339 setregid \
1340 setreuid \
1341 setrlimit \
1342 setsid \
1343 setvbuf \
1344 sigaction \
1345 sigvec \
1346 snprintf \
1347 socketpair \
1348 strdup \
1349 strerror \
1350 strlcat \
1351 strlcpy \
1352 strmode \
1353 strnvis \
1354 strtonum \
Darren Tucker81eb5d52005-06-01 21:39:33 +10001355 strtoll \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001356 strtoul \
Damien Miller34a17692007-06-11 14:15:42 +10001357 swap32 \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001358 sysconf \
1359 tcgetpgrp \
1360 truncate \
1361 unsetenv \
1362 updwtmpx \
Damien Miller57f39152005-11-24 19:58:19 +11001363 vasprintf \
Darren Tucker0c9653f2005-05-28 15:58:14 +10001364 vhangup \
1365 vsnprintf \
1366 waitpid \
Damien Millerfe1f1432003-02-24 15:45:42 +11001367)
Tim Rice13aae5e2001-10-21 17:53:58 -07001368
Darren Tuckerd5e082f2003-09-22 12:08:23 +10001369# IRIX has a const char return value for gai_strerror()
1370AC_CHECK_FUNCS(gai_strerror,[
1371 AC_DEFINE(HAVE_GAI_STRERROR)
1372 AC_TRY_COMPILE([
1373#include <sys/types.h>
1374#include <sys/socket.h>
1375#include <netdb.h>
1376
1377const char *gai_strerror(int);],[
1378char *str;
1379
1380str = gai_strerror(0);],[
1381 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1382 [Define if gai_strerror() returns const char *])])])
1383
Tim Rice7df8d392005-09-19 09:33:39 -07001384AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1385 [Some systems put nanosleep outside of libc]))
Damien Millercd6853c2003-01-28 11:33:42 +11001386
Darren Tuckerf1159b52003-07-07 19:44:01 +10001387dnl Make sure prototypes are defined for these before using them.
Darren Tuckerf1159b52003-07-07 19:44:01 +10001388AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
Darren Tucker390b6d52005-05-28 16:54:36 +10001389AC_CHECK_DECL(strsep,
1390 [AC_CHECK_FUNCS(strsep)],
1391 [],
1392 [
1393#ifdef HAVE_STRING_H
1394# include <string.h>
1395#endif
1396 ])
Ben Lindstrom3e006472002-10-16 00:24:03 +00001397
Darren Tuckerb2427c82003-09-10 15:22:44 +10001398dnl tcsendbreak might be a macro
1399AC_CHECK_DECL(tcsendbreak,
1400 [AC_DEFINE(HAVE_TCSENDBREAK)],
Damien Millera8e06ce2003-11-21 23:48:55 +11001401 [AC_CHECK_FUNCS(tcsendbreak)],
Darren Tuckerb2427c82003-09-10 15:22:44 +10001402 [#include <termios.h>]
1403)
1404
Darren Tucker5bb14002004-04-23 18:53:10 +10001405AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1406
Darren Tucker128a0892006-07-12 19:02:56 +10001407AC_CHECK_DECLS(SHUT_RD, , ,
1408 [
1409#include <sys/types.h>
1410#include <sys/socket.h>
1411 ])
Darren Tucker248469b2006-07-12 14:14:31 +10001412
1413AC_CHECK_DECLS(O_NONBLOCK, , ,
1414 [
1415#include <sys/types.h>
1416#ifdef HAVE_SYS_STAT_H
1417# include <sys/stat.h>
1418#endif
1419#ifdef HAVE_FCNTL_H
1420# include <fcntl.h>
1421#endif
1422 ])
1423
Darren Tuckered0b5922006-09-03 22:44:49 +10001424AC_CHECK_DECLS(writev, , , [
1425#include <sys/types.h>
1426#include <sys/uio.h>
1427#include <unistd.h>
1428 ])
1429
Darren Tucker6d862a52007-04-29 14:39:02 +10001430AC_CHECK_DECLS(MAXSYMLINKS, , , [
1431#include <sys/param.h>
1432 ])
1433
Darren Tuckerdca0edf2007-04-29 15:06:44 +10001434AC_CHECK_DECLS(offsetof, , , [
1435#include <stddef.h>
1436 ])
1437
Darren Tucker2a6b0292003-12-31 14:59:17 +11001438AC_CHECK_FUNCS(setresuid, [
1439 dnl Some platorms have setresuid that isn't implemented, test for this
1440 AC_MSG_CHECKING(if setresuid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001441 AC_RUN_IFELSE(
1442 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001443#include <stdlib.h>
1444#include <errno.h>
1445int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001446 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001447 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001448 [AC_DEFINE(BROKEN_SETRESUID, 1,
1449 [Define if your setresuid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001450 AC_MSG_RESULT(not implemented)],
1451 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001452 )
1453])
Darren Tuckere937be32003-12-17 18:53:26 +11001454
Darren Tucker2a6b0292003-12-31 14:59:17 +11001455AC_CHECK_FUNCS(setresgid, [
1456 dnl Some platorms have setresgid that isn't implemented, test for this
1457 AC_MSG_CHECKING(if setresgid seems to work)
Darren Tucker623d92f2004-09-12 22:36:15 +10001458 AC_RUN_IFELSE(
1459 [AC_LANG_SOURCE([[
Darren Tuckere937be32003-12-17 18:53:26 +11001460#include <stdlib.h>
1461#include <errno.h>
1462int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
Darren Tucker623d92f2004-09-12 22:36:15 +10001463 ]])],
Darren Tucker2a6b0292003-12-31 14:59:17 +11001464 [AC_MSG_RESULT(yes)],
Tim Rice7df8d392005-09-19 09:33:39 -07001465 [AC_DEFINE(BROKEN_SETRESGID, 1,
1466 [Define if your setresgid() is broken])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001467 AC_MSG_RESULT(not implemented)],
1468 [AC_MSG_WARN([cross compiling: not checking setresuid])]
Darren Tucker2a6b0292003-12-31 14:59:17 +11001469 )
1470])
Darren Tuckere937be32003-12-17 18:53:26 +11001471
Damien Millerad833b32000-08-23 10:46:23 +10001472dnl Checks for time functions
andre2ff7b5d2000-06-03 14:57:40 +00001473AC_CHECK_FUNCS(gettimeofday time)
Damien Millerad833b32000-08-23 10:46:23 +10001474dnl Checks for utmp functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001475AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
andre2ff7b5d2000-06-03 14:57:40 +00001476AC_CHECK_FUNCS(utmpname)
Damien Millerad833b32000-08-23 10:46:23 +10001477dnl Checks for utmpx functions
Ben Lindstrom2c467a22000-12-27 04:57:41 +00001478AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
andre2ff7b5d2000-06-03 14:57:40 +00001479AC_CHECK_FUNCS(setutxent utmpxname)
Damien Millercedfecc1999-11-15 14:36:53 +11001480
Damien Millera8e06ce2003-11-21 23:48:55 +11001481AC_CHECK_FUNC(daemon,
Tim Rice7df8d392005-09-19 09:33:39 -07001482 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1483 [AC_CHECK_LIB(bsd, daemon,
1484 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
Damien Miller04f80141999-11-19 15:32:34 +11001485)
1486
Damien Millera8e06ce2003-11-21 23:48:55 +11001487AC_CHECK_FUNC(getpagesize,
Tim Rice7df8d392005-09-19 09:33:39 -07001488 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1489 [Define if your libraries define getpagesize()])],
1490 [AC_CHECK_LIB(ucb, getpagesize,
1491 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
Damien Miller9fb07e42000-03-05 16:22:59 +11001492)
1493
Damien Millercb170cb2000-07-01 16:52:55 +10001494# Check for broken snprintf
1495if test "x$ac_cv_func_snprintf" = "xyes" ; then
1496 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001497 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001498 [AC_LANG_SOURCE([[
Damien Millercb170cb2000-07-01 16:52:55 +10001499#include <stdio.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001500int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
Darren Tucker623d92f2004-09-12 22:36:15 +10001501 ]])],
Damien Millera8e06ce2003-11-21 23:48:55 +11001502 [AC_MSG_RESULT(yes)],
Damien Millercb170cb2000-07-01 16:52:55 +10001503 [
1504 AC_MSG_RESULT(no)
Tim Rice7df8d392005-09-19 09:33:39 -07001505 AC_DEFINE(BROKEN_SNPRINTF, 1,
1506 [Define if your snprintf is busted])
Damien Millercb170cb2000-07-01 16:52:55 +10001507 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001508 ],
1509 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
Damien Millercb170cb2000-07-01 16:52:55 +10001510 )
1511fi
1512
Damien Miller57f39152005-11-24 19:58:19 +11001513# If we don't have a working asprintf, then we strongly depend on vsnprintf
1514# returning the right thing on overflow: the number of characters it tried to
1515# create (as per SUSv3)
1516if test "x$ac_cv_func_asprintf" != "xyes" && \
1517 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1518 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1519 AC_RUN_IFELSE(
1520 [AC_LANG_SOURCE([[
1521#include <sys/types.h>
1522#include <stdio.h>
1523#include <stdarg.h>
1524
1525int x_snprintf(char *str,size_t count,const char *fmt,...)
1526{
1527 size_t ret; va_list ap;
1528 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1529 return ret;
1530}
1531int main(void)
1532{
1533 char x[1];
1534 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1535} ]])],
1536 [AC_MSG_RESULT(yes)],
1537 [
1538 AC_MSG_RESULT(no)
1539 AC_DEFINE(BROKEN_SNPRINTF, 1,
1540 [Define if your snprintf is busted])
1541 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1542 ],
1543 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1544 )
1545fi
1546
Darren Tuckerd40c66c2005-12-17 22:32:03 +11001547# On systems where [v]snprintf is broken, but is declared in stdio,
1548# check that the fmt argument is const char * or just char *.
1549# This is only useful for when BROKEN_SNPRINTF
1550AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1551AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1552 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1553 int main(void) { snprintf(0, 0, 0); }
1554 ]])],
1555 [AC_MSG_RESULT(yes)
1556 AC_DEFINE(SNPRINTF_CONST, [const],
1557 [Define as const if snprintf() can declare const char *fmt])],
1558 [AC_MSG_RESULT(no)
1559 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1560
Damien Millerb4097182004-05-23 14:09:40 +10001561# Check for missing getpeereid (or equiv) support
1562NO_PEERCHECK=""
Darren Tucker164aa302007-03-21 21:39:57 +11001563if test "x$ac_cv_func_getpeereid" != "xyes" -a "x$ac_cv_func_getpeerucred" != "xyes"; then
Damien Millerb4097182004-05-23 14:09:40 +10001564 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1565 AC_TRY_COMPILE(
1566 [#include <sys/types.h>
1567 #include <sys/socket.h>],
1568 [int i = SO_PEERCRED;],
Darren Tucker9d2562c2005-04-05 19:22:45 +10001569 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001570 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
Darren Tucker9d2562c2005-04-05 19:22:45 +10001571 ],
Damien Millerb4097182004-05-23 14:09:40 +10001572 [AC_MSG_RESULT(no)
1573 NO_PEERCHECK=1]
1574 )
1575fi
1576
Damien Millere8328192003-01-07 15:18:32 +11001577dnl see whether mkstemp() requires XXXXXX
1578if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1579AC_MSG_CHECKING([for (overly) strict mkstemp])
Darren Tucker314d89e2005-10-17 23:29:23 +10001580AC_RUN_IFELSE(
1581 [AC_LANG_SOURCE([[
Damien Millere8328192003-01-07 15:18:32 +11001582#include <stdlib.h>
1583main() { char template[]="conftest.mkstemp-test";
1584if (mkstemp(template) == -1)
1585 exit(1);
1586unlink(template); exit(0);
1587}
Darren Tucker314d89e2005-10-17 23:29:23 +10001588 ]])],
Damien Millere8328192003-01-07 15:18:32 +11001589 [
1590 AC_MSG_RESULT(no)
1591 ],
Damien Millera8e06ce2003-11-21 23:48:55 +11001592 [
Damien Millere8328192003-01-07 15:18:32 +11001593 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001594 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
Damien Millere8328192003-01-07 15:18:32 +11001595 ],
1596 [
1597 AC_MSG_RESULT(yes)
1598 AC_DEFINE(HAVE_STRICT_MKSTEMP)
Damien Millera8e06ce2003-11-21 23:48:55 +11001599 ]
Damien Millere8328192003-01-07 15:18:32 +11001600)
1601fi
1602
Darren Tucker70a3d552003-08-21 17:58:29 +10001603dnl make sure that openpty does not reacquire controlling terminal
1604if test ! -z "$check_for_openpty_ctty_bug"; then
1605 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
Darren Tucker314d89e2005-10-17 23:29:23 +10001606 AC_RUN_IFELSE(
1607 [AC_LANG_SOURCE([[
Darren Tucker70a3d552003-08-21 17:58:29 +10001608#include <stdio.h>
1609#include <sys/fcntl.h>
1610#include <sys/types.h>
1611#include <sys/wait.h>
1612
1613int
1614main()
1615{
1616 pid_t pid;
1617 int fd, ptyfd, ttyfd, status;
1618
1619 pid = fork();
1620 if (pid < 0) { /* failed */
1621 exit(1);
1622 } else if (pid > 0) { /* parent */
1623 waitpid(pid, &status, 0);
Damien Millera8e06ce2003-11-21 23:48:55 +11001624 if (WIFEXITED(status))
Darren Tucker70a3d552003-08-21 17:58:29 +10001625 exit(WEXITSTATUS(status));
1626 else
1627 exit(2);
1628 } else { /* child */
1629 close(0); close(1); close(2);
1630 setsid();
1631 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1632 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1633 if (fd >= 0)
1634 exit(3); /* Acquired ctty: broken */
1635 else
1636 exit(0); /* Did not acquire ctty: OK */
1637 }
1638}
Darren Tucker314d89e2005-10-17 23:29:23 +10001639 ]])],
Darren Tucker70a3d552003-08-21 17:58:29 +10001640 [
1641 AC_MSG_RESULT(yes)
1642 ],
1643 [
1644 AC_MSG_RESULT(no)
1645 AC_DEFINE(SSHD_ACQUIRES_CTTY)
Darren Tucker314d89e2005-10-17 23:29:23 +10001646 ],
1647 [
1648 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker70a3d552003-08-21 17:58:29 +10001649 ]
1650 )
1651fi
1652
Tim Rice8bb561b2005-03-17 16:23:19 -08001653if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1654 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
Darren Tucker4398cf52004-04-06 21:39:02 +10001655 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001656 AC_RUN_IFELSE(
1657 [AC_LANG_SOURCE([[
Darren Tucker4398cf52004-04-06 21:39:02 +10001658#include <stdio.h>
1659#include <sys/socket.h>
1660#include <netdb.h>
1661#include <errno.h>
1662#include <netinet/in.h>
1663
1664#define TEST_PORT "2222"
1665
1666int
1667main(void)
1668{
1669 int err, sock;
1670 struct addrinfo *gai_ai, *ai, hints;
1671 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1672
1673 memset(&hints, 0, sizeof(hints));
1674 hints.ai_family = PF_UNSPEC;
1675 hints.ai_socktype = SOCK_STREAM;
1676 hints.ai_flags = AI_PASSIVE;
1677
1678 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1679 if (err != 0) {
1680 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1681 exit(1);
1682 }
1683
1684 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1685 if (ai->ai_family != AF_INET6)
1686 continue;
1687
1688 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1689 sizeof(ntop), strport, sizeof(strport),
1690 NI_NUMERICHOST|NI_NUMERICSERV);
1691
1692 if (err != 0) {
1693 if (err == EAI_SYSTEM)
1694 perror("getnameinfo EAI_SYSTEM");
1695 else
1696 fprintf(stderr, "getnameinfo failed: %s\n",
1697 gai_strerror(err));
1698 exit(2);
1699 }
1700
1701 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1702 if (sock < 0)
1703 perror("socket");
1704 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1705 if (errno == EBADF)
1706 exit(3);
1707 }
1708 }
1709 exit(0);
1710}
Darren Tucker314d89e2005-10-17 23:29:23 +10001711 ]])],
Darren Tucker4398cf52004-04-06 21:39:02 +10001712 [
1713 AC_MSG_RESULT(yes)
1714 ],
1715 [
1716 AC_MSG_RESULT(no)
1717 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001718 ],
1719 [
1720 AC_MSG_RESULT(cross-compiling, assuming yes)
Darren Tucker4398cf52004-04-06 21:39:02 +10001721 ]
1722 )
1723fi
1724
Tim Rice8bb561b2005-03-17 16:23:19 -08001725if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1726 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
Darren Tucker691d5232005-02-15 21:45:57 +11001727 AC_MSG_CHECKING(if getaddrinfo seems to work)
Darren Tucker314d89e2005-10-17 23:29:23 +10001728 AC_RUN_IFELSE(
1729 [AC_LANG_SOURCE([[
Darren Tucker691d5232005-02-15 21:45:57 +11001730#include <stdio.h>
1731#include <sys/socket.h>
1732#include <netdb.h>
1733#include <errno.h>
1734#include <netinet/in.h>
1735
1736#define TEST_PORT "2222"
1737
1738int
1739main(void)
1740{
1741 int err, sock;
1742 struct addrinfo *gai_ai, *ai, hints;
1743 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1744
1745 memset(&hints, 0, sizeof(hints));
1746 hints.ai_family = PF_UNSPEC;
1747 hints.ai_socktype = SOCK_STREAM;
1748 hints.ai_flags = AI_PASSIVE;
1749
1750 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1751 if (err != 0) {
1752 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1753 exit(1);
1754 }
1755
1756 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1757 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1758 continue;
1759
1760 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1761 sizeof(ntop), strport, sizeof(strport),
1762 NI_NUMERICHOST|NI_NUMERICSERV);
1763
1764 if (ai->ai_family == AF_INET && err != 0) {
1765 perror("getnameinfo");
1766 exit(2);
1767 }
1768 }
1769 exit(0);
1770}
Darren Tucker314d89e2005-10-17 23:29:23 +10001771 ]])],
Darren Tucker691d5232005-02-15 21:45:57 +11001772 [
1773 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07001774 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1775 [Define if you have a getaddrinfo that fails
1776 for the all-zeros IPv6 address])
Darren Tucker691d5232005-02-15 21:45:57 +11001777 ],
1778 [
1779 AC_MSG_RESULT(no)
1780 AC_DEFINE(BROKEN_GETADDRINFO)
Darren Tucker314d89e2005-10-17 23:29:23 +10001781 ],
Darren Tucker8b272ab2006-06-27 11:20:28 +10001782 [
Darren Tucker314d89e2005-10-17 23:29:23 +10001783 AC_MSG_RESULT(cross-compiling, assuming no)
Darren Tucker691d5232005-02-15 21:45:57 +11001784 ]
1785 )
1786fi
1787
Darren Tuckera56f1912004-11-02 20:30:54 +11001788if test "x$check_for_conflicting_getspnam" = "x1"; then
1789 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1790 AC_COMPILE_IFELSE(
1791 [
1792#include <shadow.h>
1793int main(void) {exit(0);}
1794 ],
1795 [
1796 AC_MSG_RESULT(no)
1797 ],
1798 [
1799 AC_MSG_RESULT(yes)
1800 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1801 [Conflicting defs for getspnam])
1802 ]
1803 )
1804fi
1805
Damien Miller606f8802000-09-16 15:39:56 +11001806AC_FUNC_GETPGRP
1807
Tim Riceaef73712002-05-11 13:17:42 -07001808# Search for OpenSSL
1809saved_CPPFLAGS="$CPPFLAGS"
1810saved_LDFLAGS="$LDFLAGS"
Damien Millera22ba012000-03-02 23:09:20 +11001811AC_ARG_WITH(ssl-dir,
1812 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1813 [
Ben Lindstrom23e13712000-10-29 22:49:19 +00001814 if test "x$withval" != "xno" ; then
Darren Tuckerc7e38d52005-02-09 22:12:30 +11001815 case "$withval" in
1816 # Relative paths
1817 ./*|../*) withval="`pwd`/$withval"
1818 esac
Tim Riceaef73712002-05-11 13:17:42 -07001819 if test -d "$withval/lib"; then
1820 if test -n "${need_dash_r}"; then
1821 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1822 else
1823 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1824 fi
1825 else
1826 if test -n "${need_dash_r}"; then
1827 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1828 else
1829 LDFLAGS="-L${withval} ${LDFLAGS}"
1830 fi
1831 fi
1832 if test -d "$withval/include"; then
1833 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1834 else
1835 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1836 fi
Damien Millera22ba012000-03-02 23:09:20 +11001837 fi
1838 ]
1839)
Tim Rice3d5352e2004-02-12 09:27:21 -08001840LIBS="-lcrypto $LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07001841AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1842 [Define if your ssl headers are included
1843 with #include <openssl/header.h>]),
Damien Miller3b512e12000-05-17 23:29:18 +10001844 [
Tim Riceaef73712002-05-11 13:17:42 -07001845 dnl Check default openssl install dir
1846 if test -n "${need_dash_r}"; then
1847 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001848 else
Tim Riceaef73712002-05-11 13:17:42 -07001849 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
Damien Miller3b512e12000-05-17 23:29:18 +10001850 fi
Tim Riceaef73712002-05-11 13:17:42 -07001851 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1852 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1853 [
1854 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1855 ]
1856 )
1857 ]
1858)
1859
Tim Riced730b782002-08-13 18:52:10 -07001860# Determine OpenSSL header version
1861AC_MSG_CHECKING([OpenSSL header version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001862AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001863 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001864#include <stdio.h>
1865#include <string.h>
1866#include <openssl/opensslv.h>
1867#define DATA "conftest.sslincver"
1868int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001869 FILE *fd;
1870 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001871
Damien Millera8e06ce2003-11-21 23:48:55 +11001872 fd = fopen(DATA,"w");
1873 if(fd == NULL)
1874 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001875
1876 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1877 exit(1);
1878
1879 exit(0);
1880}
Darren Tucker623d92f2004-09-12 22:36:15 +10001881 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001882 [
1883 ssl_header_ver=`cat conftest.sslincver`
1884 AC_MSG_RESULT($ssl_header_ver)
1885 ],
1886 [
1887 AC_MSG_RESULT(not found)
1888 AC_MSG_ERROR(OpenSSL version header not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001889 ],
1890 [
1891 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001892 ]
1893)
1894
1895# Determine OpenSSL library version
1896AC_MSG_CHECKING([OpenSSL library version])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001897AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001898 [AC_LANG_SOURCE([[
Tim Riced730b782002-08-13 18:52:10 -07001899#include <stdio.h>
1900#include <string.h>
1901#include <openssl/opensslv.h>
1902#include <openssl/crypto.h>
1903#define DATA "conftest.ssllibver"
1904int main(void) {
Damien Millera8e06ce2003-11-21 23:48:55 +11001905 FILE *fd;
1906 int rc;
Tim Riced730b782002-08-13 18:52:10 -07001907
Damien Millera8e06ce2003-11-21 23:48:55 +11001908 fd = fopen(DATA,"w");
1909 if(fd == NULL)
1910 exit(1);
Tim Riced730b782002-08-13 18:52:10 -07001911
1912 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1913 exit(1);
1914
1915 exit(0);
1916}
Darren Tucker623d92f2004-09-12 22:36:15 +10001917 ]])],
Tim Riced730b782002-08-13 18:52:10 -07001918 [
1919 ssl_library_ver=`cat conftest.ssllibver`
1920 AC_MSG_RESULT($ssl_library_ver)
1921 ],
1922 [
1923 AC_MSG_RESULT(not found)
1924 AC_MSG_ERROR(OpenSSL library not found.)
Darren Tuckera0c2b392004-09-11 23:26:37 +10001925 ],
1926 [
1927 AC_MSG_WARN([cross compiling: not checking])
Tim Riced730b782002-08-13 18:52:10 -07001928 ]
1929)
Damien Millera22ba012000-03-02 23:09:20 +11001930
Damien Miller9975e482007-03-05 11:51:27 +11001931AC_ARG_WITH(openssl-header-check,
1932 [ --without-openssl-header-check Disable OpenSSL version consistency check],
1933 [ if test "x$withval" = "xno" ; then
1934 openssl_check_nonfatal=1
1935 fi
1936 ]
1937)
1938
Damien Millerec932372002-01-22 22:16:03 +11001939# Sanity check OpenSSL headers
1940AC_MSG_CHECKING([whether OpenSSL's headers match the library])
Darren Tuckera0c2b392004-09-11 23:26:37 +10001941AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10001942 [AC_LANG_SOURCE([[
Damien Millerec932372002-01-22 22:16:03 +11001943#include <string.h>
1944#include <openssl/opensslv.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07001945int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10001946 ]])],
Damien Millerec932372002-01-22 22:16:03 +11001947 [
1948 AC_MSG_RESULT(yes)
1949 ],
1950 [
1951 AC_MSG_RESULT(no)
Damien Miller9975e482007-03-05 11:51:27 +11001952 if test "x$openssl_check_nonfatal" = "x"; then
1953 AC_MSG_ERROR([Your OpenSSL headers do not match your
1954library. Check config.log for details.
1955If you are sure your installation is consistent, you can disable the check
1956by running "./configure --without-openssl-header-check".
1957Also see contrib/findssl.sh for help identifying header/library mismatches.
1958])
1959 else
1960 AC_MSG_WARN([Your OpenSSL headers do not match your
1961library. Check config.log for details.
Darren Tuckera0472e02003-06-24 20:22:09 +10001962Also see contrib/findssl.sh for help identifying header/library mismatches.])
Damien Miller9975e482007-03-05 11:51:27 +11001963 fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10001964 ],
1965 [
1966 AC_MSG_WARN([cross compiling: not checking])
Damien Millerec932372002-01-22 22:16:03 +11001967 ]
1968)
1969
Darren Tucker639bbe82006-08-20 20:17:53 +10001970AC_MSG_CHECKING([if programs using OpenSSL functions will link])
1971AC_LINK_IFELSE(
1972 [AC_LANG_SOURCE([[
1973#include <openssl/evp.h>
1974int main(void) { SSLeay_add_all_algorithms(); }
1975 ]])],
1976 [
1977 AC_MSG_RESULT(yes)
1978 ],
1979 [
1980 AC_MSG_RESULT(no)
1981 saved_LIBS="$LIBS"
1982 LIBS="$LIBS -ldl"
1983 AC_MSG_CHECKING([if programs using OpenSSL need -ldl])
1984 AC_LINK_IFELSE(
1985 [AC_LANG_SOURCE([[
1986#include <openssl/evp.h>
1987int main(void) { SSLeay_add_all_algorithms(); }
1988 ]])],
1989 [
1990 AC_MSG_RESULT(yes)
1991 ],
1992 [
1993 AC_MSG_RESULT(no)
1994 LIBS="$saved_LIBS"
1995 ]
1996 )
1997 ]
1998)
1999
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002000AC_ARG_WITH(ssl-engine,
2001 [ --with-ssl-engine Enable OpenSSL (hardware) ENGINE support ],
2002 [ if test "x$withval" != "xno" ; then
2003 AC_MSG_CHECKING(for OpenSSL ENGINE support)
2004 AC_TRY_COMPILE(
2005 [ #include <openssl/engine.h>],
2006 [
Darren Tucker5e8381e2006-09-29 20:16:51 +10002007ENGINE_load_builtin_engines();ENGINE_register_all_complete();
Darren Tuckerfabdb6c2006-02-20 20:17:35 +11002008 ],
2009 [ AC_MSG_RESULT(yes)
2010 AC_DEFINE(USE_OPENSSL_ENGINE, 1,
2011 [Enable OpenSSL engine support])
2012 ],
2013 [ AC_MSG_ERROR(OpenSSL ENGINE support not found)]
2014 )
2015 fi ]
2016)
2017
Darren Tucker129d0bb2005-12-19 17:40:40 +11002018# Check for OpenSSL without EVP_aes_{192,256}_cbc
2019AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
Darren Tuckerf1f4bdd2006-08-04 19:44:23 +10002020AC_LINK_IFELSE(
Darren Tucker129d0bb2005-12-19 17:40:40 +11002021 [AC_LANG_SOURCE([[
2022#include <string.h>
2023#include <openssl/evp.h>
Darren Tuckercc7c2122006-02-02 18:44:19 +11002024int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
Darren Tucker129d0bb2005-12-19 17:40:40 +11002025 ]])],
2026 [
2027 AC_MSG_RESULT(no)
2028 ],
2029 [
2030 AC_MSG_RESULT(yes)
2031 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
2032 [libcrypto is missing AES 192 and 256 bit functions])
2033 ]
2034)
2035
Tim Rice3d5352e2004-02-12 09:27:21 -08002036# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
2037# because the system crypt() is more featureful.
2038if test "x$check_for_libcrypt_before" = "x1"; then
2039 AC_CHECK_LIB(crypt, crypt)
2040fi
2041
Damien Millera8e06ce2003-11-21 23:48:55 +11002042# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
Tim Rice43fa5572004-02-11 14:46:40 -08002043# version in OpenSSL.
Damien Miller4f9f42a2003-05-10 19:28:02 +10002044if test "x$check_for_libcrypt_later" = "x1"; then
Damien Miller95aa2d62001-03-01 09:16:11 +11002045 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
Damien Millera64b57a2001-01-17 10:44:13 +11002046fi
2047
Damien Milleraf87af12006-03-15 13:02:28 +11002048# Search for SHA256 support in libc and/or OpenSSL
2049AC_CHECK_FUNCS(SHA256_Update EVP_sha256)
2050
Tim Rice99203ec2007-03-26 09:35:28 -07002051saved_LIBS="$LIBS"
2052AC_CHECK_LIB(iaf, ia_openinfo, [
2053 LIBS="$LIBS -liaf"
Tim Rice0eeaf122007-09-10 16:24:17 -07002054 AC_CHECK_FUNCS(set_id, [SSHDLIBS="$SSHDLIBS -liaf"
2055 AC_DEFINE(HAVE_LIBIAF, 1,
2056 [Define if system has libiaf that supports set_id])
2057 ])
Tim Rice99203ec2007-03-26 09:35:28 -07002058])
2059LIBS="$saved_LIBS"
Damien Miller6c21c512002-01-22 21:57:53 +11002060
2061### Configure cryptographic random number support
2062
2063# Check wheter OpenSSL seeds itself
2064AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
Darren Tuckera0c2b392004-09-11 23:26:37 +10002065AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002066 [AC_LANG_SOURCE([[
Damien Miller6c21c512002-01-22 21:57:53 +11002067#include <string.h>
2068#include <openssl/rand.h>
Tim Rice2c961ce2002-09-23 16:54:10 -07002069int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
Darren Tucker623d92f2004-09-12 22:36:15 +10002070 ]])],
Damien Miller6c21c512002-01-22 21:57:53 +11002071 [
2072 OPENSSL_SEEDS_ITSELF=yes
2073 AC_MSG_RESULT(yes)
2074 ],
2075 [
2076 AC_MSG_RESULT(no)
2077 # Default to use of the rand helper if OpenSSL doesn't
2078 # seed itself
2079 USE_RAND_HELPER=yes
Darren Tuckera0c2b392004-09-11 23:26:37 +10002080 ],
2081 [
2082 AC_MSG_WARN([cross compiling: assuming yes])
2083 # This is safe, since all recent OpenSSL versions will
Tim Riceeae17cc2005-03-17 16:52:20 -08002084 # complain at runtime if not seeded correctly.
Darren Tuckera0c2b392004-09-11 23:26:37 +10002085 OPENSSL_SEEDS_ITSELF=yes
Damien Miller6c21c512002-01-22 21:57:53 +11002086 ]
2087)
2088
Darren Tucker3e6bde42006-08-20 20:03:50 +10002089# Check for PAM libs
2090PAM_MSG="no"
2091AC_ARG_WITH(pam,
2092 [ --with-pam Enable PAM support ],
2093 [
2094 if test "x$withval" != "xno" ; then
2095 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
2096 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
2097 AC_MSG_ERROR([PAM headers not found])
2098 fi
2099
2100 saved_LIBS="$LIBS"
2101 AC_CHECK_LIB(dl, dlopen, , )
2102 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
2103 AC_CHECK_FUNCS(pam_getenvlist)
2104 AC_CHECK_FUNCS(pam_putenv)
2105 LIBS="$saved_LIBS"
2106
2107 PAM_MSG="yes"
2108
Darren Tucker20e9f972007-03-25 18:26:01 +10002109 SSHDLIBS="$SSHDLIBS -lpam"
Darren Tucker3e6bde42006-08-20 20:03:50 +10002110 AC_DEFINE(USE_PAM, 1,
2111 [Define if you want to enable PAM support])
Darren Tucker639bbe82006-08-20 20:17:53 +10002112
Darren Tucker3e6bde42006-08-20 20:03:50 +10002113 if test $ac_cv_lib_dl_dlopen = yes; then
Darren Tucker639bbe82006-08-20 20:17:53 +10002114 case "$LIBS" in
2115 *-ldl*)
2116 # libdl already in LIBS
2117 ;;
2118 *)
Darren Tucker20e9f972007-03-25 18:26:01 +10002119 SSHDLIBS="$SSHDLIBS -ldl"
Darren Tucker639bbe82006-08-20 20:17:53 +10002120 ;;
2121 esac
Darren Tucker3e6bde42006-08-20 20:03:50 +10002122 fi
Darren Tucker3e6bde42006-08-20 20:03:50 +10002123 fi
2124 ]
2125)
2126
2127# Check for older PAM
2128if test "x$PAM_MSG" = "xyes" ; then
2129 # Check PAM strerror arguments (old PAM)
2130 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
2131 AC_TRY_COMPILE(
2132 [
2133#include <stdlib.h>
2134#if defined(HAVE_SECURITY_PAM_APPL_H)
2135#include <security/pam_appl.h>
2136#elif defined (HAVE_PAM_PAM_APPL_H)
2137#include <pam/pam_appl.h>
2138#endif
2139 ],
2140 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
2141 [AC_MSG_RESULT(no)],
2142 [
2143 AC_DEFINE(HAVE_OLD_PAM, 1,
2144 [Define if you have an old version of PAM
2145 which takes only one argument to pam_strerror])
2146 AC_MSG_RESULT(yes)
2147 PAM_MSG="yes (old library)"
2148 ]
2149 )
2150fi
Damien Miller6c21c512002-01-22 21:57:53 +11002151
2152# Do we want to force the use of the rand helper?
2153AC_ARG_WITH(rand-helper,
2154 [ --with-rand-helper Use subprocess to gather strong randomness ],
2155 [
2156 if test "x$withval" = "xno" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11002157 # Force use of OpenSSL's internal RNG, even if
Damien Miller6c21c512002-01-22 21:57:53 +11002158 # the previous test showed it to be unseeded.
2159 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
2160 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
2161 OPENSSL_SEEDS_ITSELF=yes
2162 USE_RAND_HELPER=""
2163 fi
2164 else
2165 USE_RAND_HELPER=yes
2166 fi
2167 ],
Tim Riceeae17cc2005-03-17 16:52:20 -08002168)
Damien Miller6c21c512002-01-22 21:57:53 +11002169
2170# Which randomness source do we use?
Tim Rice8bb561b2005-03-17 16:23:19 -08002171if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002172 # OpenSSL only
Tim Rice7df8d392005-09-19 09:33:39 -07002173 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
2174 [Define if you want OpenSSL's internally seeded PRNG only])
Damien Miller6c21c512002-01-22 21:57:53 +11002175 RAND_MSG="OpenSSL internal ONLY"
2176 INSTALL_SSH_RAND_HELPER=""
Tim Rice1e2c6002002-01-30 22:14:03 -08002177elif test ! -z "$USE_RAND_HELPER" ; then
2178 # install rand helper
Damien Miller6c21c512002-01-22 21:57:53 +11002179 RAND_MSG="ssh-rand-helper"
2180 INSTALL_SSH_RAND_HELPER="yes"
2181fi
2182AC_SUBST(INSTALL_SSH_RAND_HELPER)
2183
2184### Configuration of ssh-rand-helper
2185
2186# PRNGD TCP socket
2187AC_ARG_WITH(prngd-port,
2188 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
2189 [
Damien Millere996d722002-01-23 11:20:59 +11002190 case "$withval" in
2191 no)
2192 withval=""
2193 ;;
2194 [[0-9]]*)
2195 ;;
2196 *)
2197 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
2198 ;;
2199 esac
2200 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002201 PRNGD_PORT="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002202 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
2203 [Port number of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002204 fi
2205 ]
2206)
2207
2208# PRNGD Unix domain socket
2209AC_ARG_WITH(prngd-socket,
2210 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
2211 [
Damien Millere996d722002-01-23 11:20:59 +11002212 case "$withval" in
2213 yes)
Damien Miller6c21c512002-01-22 21:57:53 +11002214 withval="/var/run/egd-pool"
Damien Millere996d722002-01-23 11:20:59 +11002215 ;;
2216 no)
2217 withval=""
2218 ;;
2219 /*)
2220 ;;
2221 *)
2222 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
2223 ;;
2224 esac
2225
2226 if test ! -z "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002227 if test ! -z "$PRNGD_PORT" ; then
2228 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
2229 fi
Damien Miller6385ba02002-01-23 08:12:36 +11002230 if test ! -r "$withval" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11002231 AC_MSG_WARN(Entropy socket is not readable)
2232 fi
2233 PRNGD_SOCKET="$withval"
Tim Rice7df8d392005-09-19 09:33:39 -07002234 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
2235 [Location of PRNGD/EGD random number socket])
Damien Miller6c21c512002-01-22 21:57:53 +11002236 fi
Tim Rice4cec93f2002-02-26 08:40:48 -08002237 ],
2238 [
2239 # Check for existing socket only if we don't have a random device already
2240 if test "$USE_RAND_HELPER" = yes ; then
2241 AC_MSG_CHECKING(for PRNGD/EGD socket)
2242 # Insert other locations here
2243 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
2244 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
2245 PRNGD_SOCKET="$sock"
2246 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
2247 break;
2248 fi
2249 done
2250 if test ! -z "$PRNGD_SOCKET" ; then
2251 AC_MSG_RESULT($PRNGD_SOCKET)
2252 else
2253 AC_MSG_RESULT(not found)
2254 fi
2255 fi
Damien Miller6c21c512002-01-22 21:57:53 +11002256 ]
2257)
2258
2259# Change default command timeout for hashing entropy source
2260entropy_timeout=200
2261AC_ARG_WITH(entropy-timeout,
2262 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2263 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002264 if test -n "$withval" && test "x$withval" != "xno" && \
2265 test "x${withval}" != "xyes"; then
Damien Miller6c21c512002-01-22 21:57:53 +11002266 entropy_timeout=$withval
2267 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002268 ]
Damien Miller6c21c512002-01-22 21:57:53 +11002269)
Tim Rice7df8d392005-09-19 09:33:39 -07002270AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2271 [Builtin PRNG command timeout])
Damien Miller6c21c512002-01-22 21:57:53 +11002272
Damien Millerd3f6ad22002-06-25 10:24:47 +10002273SSH_PRIVSEP_USER=sshd
Kevin Steves7ff91122002-04-07 19:22:54 +00002274AC_ARG_WITH(privsep-user,
Kevin Stevesc81e1292002-05-13 03:51:40 +00002275 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
Kevin Steves7ff91122002-04-07 19:22:54 +00002276 [
Tim Rice35cc69d2005-03-17 16:44:25 -08002277 if test -n "$withval" && test "x$withval" != "xno" && \
2278 test "x${withval}" != "xyes"; then
Damien Millerd3f6ad22002-06-25 10:24:47 +10002279 SSH_PRIVSEP_USER=$withval
Kevin Steves7ff91122002-04-07 19:22:54 +00002280 fi
Tim Riceeae17cc2005-03-17 16:52:20 -08002281 ]
Kevin Steves7ff91122002-04-07 19:22:54 +00002282)
Tim Rice7df8d392005-09-19 09:33:39 -07002283AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2284 [non-privileged user for privilege separation])
Damien Millerd3f6ad22002-06-25 10:24:47 +10002285AC_SUBST(SSH_PRIVSEP_USER)
Kevin Steves7ff91122002-04-07 19:22:54 +00002286
Tim Rice88f2ab52002-03-17 12:17:34 -08002287# We do this little dance with the search path to insure
2288# that programs that we select for use by installed programs
2289# (which may be run by the super-user) come from trusted
2290# locations before they come from the user's private area.
2291# This should help avoid accidentally configuring some
2292# random version of a program in someone's personal bin.
2293
2294OPATH=$PATH
2295PATH=/bin:/usr/bin
Tim Riceae49fe62002-04-12 10:26:21 -07002296test -h /bin 2> /dev/null && PATH=/usr/bin
Tim Rice88f2ab52002-03-17 12:17:34 -08002297test -d /sbin && PATH=$PATH:/sbin
2298test -d /usr/sbin && PATH=$PATH:/usr/sbin
2299PATH=$PATH:/etc:$OPATH
2300
Damien Millera8e06ce2003-11-21 23:48:55 +11002301# These programs are used by the command hashing source to gather entropy
Damien Miller6c21c512002-01-22 21:57:53 +11002302OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2303OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2304OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2305OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2306OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2307OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2308OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2309OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2310OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2311OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2312OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2313OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2314OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2315OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2316OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2317OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
Tim Rice88f2ab52002-03-17 12:17:34 -08002318# restore PATH
2319PATH=$OPATH
Damien Miller6c21c512002-01-22 21:57:53 +11002320
2321# Where does ssh-rand-helper get its randomness from?
2322INSTALL_SSH_PRNG_CMDS=""
2323if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2324 if test ! -z "$PRNGD_PORT" ; then
2325 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2326 elif test ! -z "$PRNGD_SOCKET" ; then
2327 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2328 else
2329 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2330 RAND_HELPER_CMDHASH=yes
2331 INSTALL_SSH_PRNG_CMDS="yes"
2332 fi
2333fi
2334AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2335
2336
Ben Lindstromb5628642000-10-18 00:02:25 +00002337# Cheap hack to ensure NEWS-OS libraries are arranged right.
2338if test ! -z "$SONY" ; then
2339 LIBS="$LIBS -liberty";
2340fi
2341
Damien Miller57f39152005-11-24 19:58:19 +11002342# Check for long long datatypes
2343AC_CHECK_TYPES([long long, unsigned long long, long double])
2344
2345# Check datatype sizes
Damien Millere0f45742000-01-18 09:12:06 +11002346AC_CHECK_SIZEOF(char, 1)
Damien Millerc6398ef1999-11-20 12:18:40 +11002347AC_CHECK_SIZEOF(short int, 2)
2348AC_CHECK_SIZEOF(int, 4)
2349AC_CHECK_SIZEOF(long int, 4)
2350AC_CHECK_SIZEOF(long long int, 8)
2351
Damien Millerfa2bb692002-04-23 23:22:25 +10002352# Sanity check long long for some platforms (AIX)
2353if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2354 ac_cv_sizeof_long_long_int=0
2355fi
2356
Darren Tucker537f1ed2005-10-25 18:38:33 +10002357# compute LLONG_MIN and LLONG_MAX if we don't know them.
2358if test -z "$have_llong_max"; then
2359 AC_MSG_CHECKING([for max value of long long])
2360 AC_RUN_IFELSE(
2361 [AC_LANG_SOURCE([[
2362#include <stdio.h>
2363/* Why is this so damn hard? */
2364#ifdef __GNUC__
2365# undef __GNUC__
2366#endif
2367#define __USE_ISOC99
2368#include <limits.h>
2369#define DATA "conftest.llminmax"
Darren Tuckerd1450db2006-03-13 19:06:51 +11002370#define my_abs(a) ((a) < 0 ? ((a) * -1) : (a))
2371
2372/*
2373 * printf in libc on some platforms (eg old Tru64) does not understand %lld so
2374 * we do this the hard way.
2375 */
2376static int
2377fprint_ll(FILE *f, long long n)
2378{
2379 unsigned int i;
2380 int l[sizeof(long long) * 8];
2381
2382 if (n < 0)
2383 if (fprintf(f, "-") < 0)
2384 return -1;
2385 for (i = 0; n != 0; i++) {
2386 l[i] = my_abs(n % 10);
2387 n /= 10;
2388 }
2389 do {
2390 if (fprintf(f, "%d", l[--i]) < 0)
2391 return -1;
2392 } while (i != 0);
2393 if (fprintf(f, " ") < 0)
2394 return -1;
2395 return 0;
2396}
2397
Darren Tucker537f1ed2005-10-25 18:38:33 +10002398int main(void) {
2399 FILE *f;
2400 long long i, llmin, llmax = 0;
2401
2402 if((f = fopen(DATA,"w")) == NULL)
2403 exit(1);
2404
2405#if defined(LLONG_MIN) && defined(LLONG_MAX)
2406 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2407 llmin = LLONG_MIN;
2408 llmax = LLONG_MAX;
2409#else
2410 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2411 /* This will work on one's complement and two's complement */
2412 for (i = 1; i > llmax; i <<= 1, i++)
2413 llmax = i;
2414 llmin = llmax + 1LL; /* wrap */
2415#endif
2416
2417 /* Sanity check */
2418 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
Darren Tuckerd1450db2006-03-13 19:06:51 +11002419 || llmax - 1 > llmax || llmin == llmax || llmin == 0
2420 || llmax == 0 || llmax < LONG_MAX || llmin > LONG_MIN) {
Darren Tucker537f1ed2005-10-25 18:38:33 +10002421 fprintf(f, "unknown unknown\n");
2422 exit(2);
2423 }
2424
Darren Tuckerd1450db2006-03-13 19:06:51 +11002425 if (fprint_ll(f, llmin) < 0)
Darren Tucker537f1ed2005-10-25 18:38:33 +10002426 exit(3);
Darren Tuckerd1450db2006-03-13 19:06:51 +11002427 if (fprint_ll(f, llmax) < 0)
2428 exit(4);
2429 if (fclose(f) < 0)
2430 exit(5);
Darren Tucker537f1ed2005-10-25 18:38:33 +10002431 exit(0);
2432}
2433 ]])],
2434 [
2435 llong_min=`$AWK '{print $1}' conftest.llminmax`
2436 llong_max=`$AWK '{print $2}' conftest.llminmax`
2437
Darren Tucker537f1ed2005-10-25 18:38:33 +10002438 AC_MSG_RESULT($llong_max)
2439 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2440 [max value of long long calculated by configure])
2441 AC_MSG_CHECKING([for min value of long long])
2442 AC_MSG_RESULT($llong_min)
2443 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2444 [min value of long long calculated by configure])
2445 ],
2446 [
2447 AC_MSG_RESULT(not found)
2448 ],
2449 [
2450 AC_MSG_WARN([cross compiling: not checking])
2451 ]
2452 )
2453fi
2454
2455
Damien Millera22ba012000-03-02 23:09:20 +11002456# More checks for data types
Damien Millercaf6dd62000-08-29 11:33:50 +11002457AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2458 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002459 [ #include <sys/types.h> ],
2460 [ u_int a; a = 1;],
Damien Millercaf6dd62000-08-29 11:33:50 +11002461 [ ac_cv_have_u_int="yes" ],
2462 [ ac_cv_have_u_int="no" ]
2463 )
2464])
2465if test "x$ac_cv_have_u_int" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002466 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
Damien Millercaf6dd62000-08-29 11:33:50 +11002467 have_u_int=1
2468fi
2469
Damien Miller61e50f12000-05-08 20:49:37 +10002470AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2471 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002472 [ #include <sys/types.h> ],
2473 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002474 [ ac_cv_have_intxx_t="yes" ],
2475 [ ac_cv_have_intxx_t="no" ]
2476 )
2477])
2478if test "x$ac_cv_have_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002479 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002480 have_intxx_t=1
2481fi
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002482
2483if (test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002484 test "x$ac_cv_header_stdint_h" = "xyes")
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002485then
2486 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2487 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002488 [ #include <stdint.h> ],
2489 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002490 [
2491 AC_DEFINE(HAVE_INTXX_T)
2492 AC_MSG_RESULT(yes)
2493 ],
2494 [ AC_MSG_RESULT(no) ]
2495 )
2496fi
2497
Damien Miller578783e2000-09-23 14:12:24 +11002498AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2499 AC_TRY_COMPILE(
Tim Rice907881e2002-07-18 11:44:50 -07002500 [
2501#include <sys/types.h>
2502#ifdef HAVE_STDINT_H
2503# include <stdint.h>
2504#endif
2505#include <sys/socket.h>
2506#ifdef HAVE_SYS_BITYPES_H
2507# include <sys/bitypes.h>
2508#endif
Damien Millera8e06ce2003-11-21 23:48:55 +11002509 ],
2510 [ int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002511 [ ac_cv_have_int64_t="yes" ],
2512 [ ac_cv_have_int64_t="no" ]
2513 )
2514])
2515if test "x$ac_cv_have_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002516 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
Tim Rice4cec93f2002-02-26 08:40:48 -08002517fi
2518
Damien Miller61e50f12000-05-08 20:49:37 +10002519AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2520 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002521 [ #include <sys/types.h> ],
2522 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Damien Miller61e50f12000-05-08 20:49:37 +10002523 [ ac_cv_have_u_intxx_t="yes" ],
2524 [ ac_cv_have_u_intxx_t="no" ]
2525 )
2526])
2527if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002528 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002529 have_u_intxx_t=1
2530fi
Damien Millerc6398ef1999-11-20 12:18:40 +11002531
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002532if test -z "$have_u_intxx_t" ; then
2533 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2534 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002535 [ #include <sys/socket.h> ],
2536 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002537 [
2538 AC_DEFINE(HAVE_U_INTXX_T)
2539 AC_MSG_RESULT(yes)
2540 ],
2541 [ AC_MSG_RESULT(no) ]
2542 )
2543fi
2544
Damien Miller578783e2000-09-23 14:12:24 +11002545AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2546 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002547 [ #include <sys/types.h> ],
2548 [ u_int64_t a; a = 1;],
Damien Miller578783e2000-09-23 14:12:24 +11002549 [ ac_cv_have_u_int64_t="yes" ],
2550 [ ac_cv_have_u_int64_t="no" ]
2551 )
2552])
2553if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002554 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
Damien Miller578783e2000-09-23 14:12:24 +11002555 have_u_int64_t=1
2556fi
2557
Tim Rice4cec93f2002-02-26 08:40:48 -08002558if test -z "$have_u_int64_t" ; then
2559 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2560 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002561 [ #include <sys/bitypes.h> ],
Tim Rice4cec93f2002-02-26 08:40:48 -08002562 [ u_int64_t a; a = 1],
2563 [
2564 AC_DEFINE(HAVE_U_INT64_T)
2565 AC_MSG_RESULT(yes)
2566 ],
2567 [ AC_MSG_RESULT(no) ]
2568 )
2569fi
2570
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002571if test -z "$have_u_intxx_t" ; then
2572 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2573 AC_TRY_COMPILE(
2574 [
2575#include <sys/types.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002576 ],
2577 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002578 [ ac_cv_have_uintxx_t="yes" ],
2579 [ ac_cv_have_uintxx_t="no" ]
2580 )
2581 ])
2582 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002583 AC_DEFINE(HAVE_UINTXX_T, 1,
2584 [define if you have uintxx_t data type])
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002585 fi
2586fi
2587
2588if test -z "$have_uintxx_t" ; then
2589 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2590 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002591 [ #include <stdint.h> ],
2592 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00002593 [
2594 AC_DEFINE(HAVE_UINTXX_T)
2595 AC_MSG_RESULT(yes)
2596 ],
2597 [ AC_MSG_RESULT(no) ]
2598 )
2599fi
2600
Damien Milleredb82922000-06-20 13:25:52 +10002601if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
Damien Millera8e06ce2003-11-21 23:48:55 +11002602 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
Damien Millerb29ea912000-01-15 14:12:03 +11002603then
2604 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2605 AC_TRY_COMPILE(
Damien Miller61e50f12000-05-08 20:49:37 +10002606 [
2607#include <sys/bitypes.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11002608 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002609 [
Damien Miller70494d12000-04-03 15:57:06 +10002610 int8_t a; int16_t b; int32_t c;
2611 u_int8_t e; u_int16_t f; u_int32_t g;
2612 a = b = c = e = f = g = 1;
Damien Millera8e06ce2003-11-21 23:48:55 +11002613 ],
Damien Millerb29ea912000-01-15 14:12:03 +11002614 [
2615 AC_DEFINE(HAVE_U_INTXX_T)
2616 AC_DEFINE(HAVE_INTXX_T)
2617 AC_MSG_RESULT(yes)
2618 ],
2619 [AC_MSG_RESULT(no)]
Damien Millera8e06ce2003-11-21 23:48:55 +11002620 )
Damien Millerb29ea912000-01-15 14:12:03 +11002621fi
2622
Damien Miller58be7382001-09-15 21:31:54 +10002623
2624AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2625 AC_TRY_COMPILE(
2626 [
2627#include <sys/types.h>
2628 ],
2629 [ u_char foo; foo = 125; ],
2630 [ ac_cv_have_u_char="yes" ],
2631 [ ac_cv_have_u_char="no" ]
2632 )
2633])
2634if test "x$ac_cv_have_u_char" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002635 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
Damien Miller58be7382001-09-15 21:31:54 +10002636fi
2637
Tim Rice13aae5e2001-10-21 17:53:58 -07002638TYPE_SOCKLEN_T
Damien Miller74d0d4a1999-12-29 02:24:35 +11002639
Tim Rice200a5c02002-02-26 22:12:34 -08002640AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
Tim Rice4cec93f2002-02-26 08:40:48 -08002641
Damien Miller848b9932005-02-24 12:12:34 +11002642AC_CHECK_TYPES(in_addr_t,,,
2643[#include <sys/types.h>
2644#include <netinet/in.h>])
Darren Tuckerd9f88912005-02-20 21:01:48 +11002645
Damien Miller61e50f12000-05-08 20:49:37 +10002646AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2647 AC_TRY_COMPILE(
2648 [
2649#include <sys/types.h>
2650 ],
2651 [ size_t foo; foo = 1235; ],
2652 [ ac_cv_have_size_t="yes" ],
2653 [ ac_cv_have_size_t="no" ]
2654 )
2655])
2656if test "x$ac_cv_have_size_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002657 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002658fi
Damien Miller95058511999-12-29 10:36:45 +11002659
Damien Miller615f9392000-05-17 22:53:33 +10002660AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2661 AC_TRY_COMPILE(
2662 [
2663#include <sys/types.h>
2664 ],
2665 [ ssize_t foo; foo = 1235; ],
2666 [ ac_cv_have_ssize_t="yes" ],
2667 [ ac_cv_have_ssize_t="no" ]
2668 )
2669])
2670if test "x$ac_cv_have_ssize_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002671 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
Damien Miller615f9392000-05-17 22:53:33 +10002672fi
2673
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002674AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2675 AC_TRY_COMPILE(
2676 [
2677#include <time.h>
2678 ],
2679 [ clock_t foo; foo = 1235; ],
2680 [ ac_cv_have_clock_t="yes" ],
2681 [ ac_cv_have_clock_t="no" ]
2682 )
2683])
2684if test "x$ac_cv_have_clock_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002685 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
Ben Lindstrom0d5af602001-01-09 00:50:29 +00002686fi
2687
Damien Millerb54b40e2000-06-23 08:23:34 +10002688AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2689 AC_TRY_COMPILE(
2690 [
2691#include <sys/types.h>
2692#include <sys/socket.h>
2693 ],
2694 [ sa_family_t foo; foo = 1235; ],
2695 [ ac_cv_have_sa_family_t="yes" ],
Damien Miller78315eb2000-09-29 23:01:36 +11002696 [ AC_TRY_COMPILE(
2697 [
2698#include <sys/types.h>
2699#include <sys/socket.h>
2700#include <netinet/in.h>
2701 ],
2702 [ sa_family_t foo; foo = 1235; ],
2703 [ ac_cv_have_sa_family_t="yes" ],
2704
Damien Millerb54b40e2000-06-23 08:23:34 +10002705 [ ac_cv_have_sa_family_t="no" ]
Damien Miller78315eb2000-09-29 23:01:36 +11002706 )]
Damien Millerb54b40e2000-06-23 08:23:34 +10002707 )
2708])
2709if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002710 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2711 [define if you have sa_family_t data type])
Damien Millerb54b40e2000-06-23 08:23:34 +10002712fi
2713
Damien Miller0f91b4e2000-06-18 15:43:25 +10002714AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2715 AC_TRY_COMPILE(
2716 [
2717#include <sys/types.h>
2718 ],
2719 [ pid_t foo; foo = 1235; ],
2720 [ ac_cv_have_pid_t="yes" ],
2721 [ ac_cv_have_pid_t="no" ]
2722 )
2723])
2724if test "x$ac_cv_have_pid_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002725 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002726fi
2727
2728AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2729 AC_TRY_COMPILE(
2730 [
2731#include <sys/types.h>
2732 ],
2733 [ mode_t foo; foo = 1235; ],
2734 [ ac_cv_have_mode_t="yes" ],
2735 [ ac_cv_have_mode_t="no" ]
2736 )
2737])
2738if test "x$ac_cv_have_mode_t" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002739 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
Damien Miller0f91b4e2000-06-18 15:43:25 +10002740fi
2741
Damien Miller61e50f12000-05-08 20:49:37 +10002742
2743AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2744 AC_TRY_COMPILE(
2745 [
Damien Miller81171112000-04-23 11:14:01 +10002746#include <sys/types.h>
2747#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002748 ],
2749 [ struct sockaddr_storage s; ],
2750 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2751 [ ac_cv_have_struct_sockaddr_storage="no" ]
2752 )
2753])
2754if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002755 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2756 [define if you have struct sockaddr_storage data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002757fi
Damien Miller34132e52000-01-14 15:45:46 +11002758
Damien Miller61e50f12000-05-08 20:49:37 +10002759AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2760 AC_TRY_COMPILE(
2761 [
Damien Miller7b22d652000-06-18 14:07:04 +10002762#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002763#include <netinet/in.h>
2764 ],
2765 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2766 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2767 [ ac_cv_have_struct_sockaddr_in6="no" ]
2768 )
2769])
2770if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002771 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2772 [define if you have struct sockaddr_in6 data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002773fi
Damien Miller34132e52000-01-14 15:45:46 +11002774
Damien Miller61e50f12000-05-08 20:49:37 +10002775AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2776 AC_TRY_COMPILE(
2777 [
Damien Miller7b22d652000-06-18 14:07:04 +10002778#include <sys/types.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002779#include <netinet/in.h>
2780 ],
2781 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2782 [ ac_cv_have_struct_in6_addr="yes" ],
2783 [ ac_cv_have_struct_in6_addr="no" ]
2784 )
2785])
2786if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002787 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2788 [define if you have struct in6_addr data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002789fi
Damien Miller34132e52000-01-14 15:45:46 +11002790
Damien Miller61e50f12000-05-08 20:49:37 +10002791AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2792 AC_TRY_COMPILE(
2793 [
Damien Miller81171112000-04-23 11:14:01 +10002794#include <sys/types.h>
2795#include <sys/socket.h>
2796#include <netdb.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002797 ],
2798 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2799 [ ac_cv_have_struct_addrinfo="yes" ],
2800 [ ac_cv_have_struct_addrinfo="no" ]
2801 )
2802])
2803if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002804 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2805 [define if you have struct addrinfo data type])
Damien Miller61e50f12000-05-08 20:49:37 +10002806fi
2807
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002808AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2809 AC_TRY_COMPILE(
Damien Millera8e06ce2003-11-21 23:48:55 +11002810 [ #include <sys/time.h> ],
2811 [ struct timeval tv; tv.tv_sec = 1;],
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002812 [ ac_cv_have_struct_timeval="yes" ],
2813 [ ac_cv_have_struct_timeval="no" ]
2814 )
2815])
2816if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002817 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
Ben Lindstrom42202bc2001-01-15 02:34:37 +00002818 have_struct_timeval=1
2819fi
2820
Tim Rice4e4dc562003-03-18 10:21:40 -08002821AC_CHECK_TYPES(struct timespec)
2822
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002823# We need int64_t or else certian parts of the compile will fail.
Tim Rice8bb561b2005-03-17 16:23:19 -08002824if test "x$ac_cv_have_int64_t" = "xno" && \
2825 test "x$ac_cv_sizeof_long_int" != "x8" && \
2826 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
Ben Lindstrom5bd6eb72003-03-21 00:34:34 +00002827 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2828 echo "an alternative compiler (I.E., GCC) before continuing."
2829 echo ""
2830 exit 1;
Tim Ricebee3f222001-03-11 17:32:12 -08002831else
2832dnl test snprintf (broken on SCO w/gcc)
Darren Tuckera0c2b392004-09-11 23:26:37 +10002833 AC_RUN_IFELSE(
Darren Tucker623d92f2004-09-12 22:36:15 +10002834 [AC_LANG_SOURCE([[
Tim Ricebee3f222001-03-11 17:32:12 -08002835#include <stdio.h>
2836#include <string.h>
2837#ifdef HAVE_SNPRINTF
2838main()
2839{
2840 char buf[50];
2841 char expected_out[50];
2842 int mazsize = 50 ;
2843#if (SIZEOF_LONG_INT == 8)
2844 long int num = 0x7fffffffffffffff;
2845#else
Kevin Steves6482ec82001-07-15 02:09:28 +00002846 long long num = 0x7fffffffffffffffll;
Tim Ricebee3f222001-03-11 17:32:12 -08002847#endif
2848 strcpy(expected_out, "9223372036854775807");
2849 snprintf(buf, mazsize, "%lld", num);
2850 if(strcmp(buf, expected_out) != 0)
Damien Millera8e06ce2003-11-21 23:48:55 +11002851 exit(1);
Tim Ricebee3f222001-03-11 17:32:12 -08002852 exit(0);
2853}
2854#else
2855main() { exit(0); }
2856#endif
Darren Tucker623d92f2004-09-12 22:36:15 +10002857 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
Darren Tuckera0c2b392004-09-11 23:26:37 +10002858 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
Tim Ricebee3f222001-03-11 17:32:12 -08002859 )
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00002860fi
2861
Damien Miller78315eb2000-09-29 23:01:36 +11002862dnl Checks for structure members
Damien Miller61e50f12000-05-08 20:49:37 +10002863OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2864OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2865OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2866OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2867OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
Damien Millerad1bc5f2000-05-20 14:53:09 +10002868OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002869OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2870OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
Damien Miller8e81ed32000-07-01 13:17:42 +10002871OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
Damien Miller61e50f12000-05-08 20:49:37 +10002872OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2873OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2874OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2875OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
andre2ff7b5d2000-06-03 14:57:40 +00002876OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2877OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2878OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2879OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
Tim Rice13aae5e2001-10-21 17:53:58 -07002880
2881AC_CHECK_MEMBERS([struct stat.st_blksize])
Darren Tucker58e298d2005-11-25 13:14:58 +11002882AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2883 [Define if we don't have struct __res_state in resolv.h])],
2884[
2885#include <stdio.h>
2886#if HAVE_SYS_TYPES_H
2887# include <sys/types.h>
2888#endif
2889#include <netinet/in.h>
2890#include <arpa/nameser.h>
2891#include <resolv.h>
2892])
andre2ff7b5d2000-06-03 14:57:40 +00002893
Damien Miller61e50f12000-05-08 20:49:37 +10002894AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2895 ac_cv_have_ss_family_in_struct_ss, [
2896 AC_TRY_COMPILE(
2897 [
Damien Miller81171112000-04-23 11:14:01 +10002898#include <sys/types.h>
2899#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002900 ],
2901 [ struct sockaddr_storage s; s.ss_family = 1; ],
2902 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2903 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2904 )
2905])
2906if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002907 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002908fi
2909
Damien Miller61e50f12000-05-08 20:49:37 +10002910AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2911 ac_cv_have___ss_family_in_struct_ss, [
2912 AC_TRY_COMPILE(
2913 [
Damien Miller81171112000-04-23 11:14:01 +10002914#include <sys/types.h>
2915#include <sys/socket.h>
Damien Miller61e50f12000-05-08 20:49:37 +10002916 ],
2917 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2918 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2919 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2920 )
2921])
2922if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002923 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2924 [Fields in struct sockaddr_storage])
Damien Miller61e50f12000-05-08 20:49:37 +10002925fi
Damien Millerbf1c9b21999-12-09 10:16:54 +11002926
Damien Millerad833b32000-08-23 10:46:23 +10002927AC_CACHE_CHECK([for pw_class field in struct passwd],
2928 ac_cv_have_pw_class_in_struct_passwd, [
2929 AC_TRY_COMPILE(
2930 [
Damien Millerad833b32000-08-23 10:46:23 +10002931#include <pwd.h>
2932 ],
Kevin Steves48b7cc02000-10-07 13:24:00 +00002933 [ struct passwd p; p.pw_class = 0; ],
Damien Millerad833b32000-08-23 10:46:23 +10002934 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2935 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2936 )
2937])
2938if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002939 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2940 [Define if your password has a pw_class field])
Damien Millerad833b32000-08-23 10:46:23 +10002941fi
2942
Kevin Steves82456952001-06-22 21:14:18 +00002943AC_CACHE_CHECK([for pw_expire field in struct passwd],
2944 ac_cv_have_pw_expire_in_struct_passwd, [
2945 AC_TRY_COMPILE(
2946 [
2947#include <pwd.h>
2948 ],
2949 [ struct passwd p; p.pw_expire = 0; ],
2950 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2951 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2952 )
2953])
2954if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002955 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2956 [Define if your password has a pw_expire field])
Kevin Steves82456952001-06-22 21:14:18 +00002957fi
2958
2959AC_CACHE_CHECK([for pw_change field in struct passwd],
2960 ac_cv_have_pw_change_in_struct_passwd, [
2961 AC_TRY_COMPILE(
2962 [
2963#include <pwd.h>
2964 ],
2965 [ struct passwd p; p.pw_change = 0; ],
2966 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2967 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2968 )
2969])
2970if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002971 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2972 [Define if your password has a pw_change field])
Kevin Steves82456952001-06-22 21:14:18 +00002973fi
Damien Miller61e50f12000-05-08 20:49:37 +10002974
Tim Rice28bbb0c2002-05-27 17:37:32 -07002975dnl make sure we're using the real structure members and not defines
Kevin Steves939c9db2002-03-22 17:23:25 +00002976AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2977 ac_cv_have_accrights_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10002978 AC_COMPILE_IFELSE(
Kevin Steves939c9db2002-03-22 17:23:25 +00002979 [
Tim Riceae49fe62002-04-12 10:26:21 -07002980#include <sys/types.h>
Kevin Steves939c9db2002-03-22 17:23:25 +00002981#include <sys/socket.h>
2982#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07002983int main() {
2984#ifdef msg_accrights
Darren Tuckera0c2b392004-09-11 23:26:37 +10002985#error "msg_accrights is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07002986exit(1);
2987#endif
2988struct msghdr m;
2989m.msg_accrights = 0;
2990exit(0);
2991}
Kevin Steves939c9db2002-03-22 17:23:25 +00002992 ],
Kevin Steves939c9db2002-03-22 17:23:25 +00002993 [ ac_cv_have_accrights_in_msghdr="yes" ],
2994 [ ac_cv_have_accrights_in_msghdr="no" ]
2995 )
2996])
2997if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07002998 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2999 [Define if your system uses access rights style
3000 file descriptor passing])
Kevin Steves939c9db2002-03-22 17:23:25 +00003001fi
3002
Kevin Stevesa44e0352002-04-07 16:18:03 +00003003AC_CACHE_CHECK([for msg_control field in struct msghdr],
3004 ac_cv_have_control_in_msghdr, [
Darren Tuckera0c2b392004-09-11 23:26:37 +10003005 AC_COMPILE_IFELSE(
Kevin Stevesa44e0352002-04-07 16:18:03 +00003006 [
Tim Riceae49fe62002-04-12 10:26:21 -07003007#include <sys/types.h>
Kevin Stevesa44e0352002-04-07 16:18:03 +00003008#include <sys/socket.h>
3009#include <sys/uio.h>
Tim Rice28bbb0c2002-05-27 17:37:32 -07003010int main() {
3011#ifdef msg_control
Darren Tuckera0c2b392004-09-11 23:26:37 +10003012#error "msg_control is a macro"
Tim Rice28bbb0c2002-05-27 17:37:32 -07003013exit(1);
3014#endif
3015struct msghdr m;
3016m.msg_control = 0;
3017exit(0);
3018}
Kevin Stevesa44e0352002-04-07 16:18:03 +00003019 ],
Kevin Stevesa44e0352002-04-07 16:18:03 +00003020 [ ac_cv_have_control_in_msghdr="yes" ],
3021 [ ac_cv_have_control_in_msghdr="no" ]
3022 )
3023])
3024if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003025 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
3026 [Define if your system uses ancillary data style
3027 file descriptor passing])
Kevin Stevesa44e0352002-04-07 16:18:03 +00003028fi
3029
Damien Miller61e50f12000-05-08 20:49:37 +10003030AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003031 AC_TRY_LINK([],
3032 [ extern char *__progname; printf("%s", __progname); ],
Damien Miller61e50f12000-05-08 20:49:37 +10003033 [ ac_cv_libc_defines___progname="yes" ],
3034 [ ac_cv_libc_defines___progname="no" ]
3035 )
3036])
3037if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003038 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
Damien Miller61e50f12000-05-08 20:49:37 +10003039fi
3040
Kevin Steves4846f4a2002-03-22 18:19:53 +00003041AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
3042 AC_TRY_LINK([
3043#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11003044],
3045 [ printf("%s", __FUNCTION__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00003046 [ ac_cv_cc_implements___FUNCTION__="yes" ],
3047 [ ac_cv_cc_implements___FUNCTION__="no" ]
3048 )
3049])
3050if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003051 AC_DEFINE(HAVE___FUNCTION__, 1,
3052 [Define if compiler implements __FUNCTION__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003053fi
3054
3055AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
3056 AC_TRY_LINK([
3057#include <stdio.h>
Damien Millera8e06ce2003-11-21 23:48:55 +11003058],
3059 [ printf("%s", __func__); ],
Kevin Steves4846f4a2002-03-22 18:19:53 +00003060 [ ac_cv_cc_implements___func__="yes" ],
3061 [ ac_cv_cc_implements___func__="no" ]
3062 )
3063])
3064if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003065 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
Kevin Steves4846f4a2002-03-22 18:19:53 +00003066fi
3067
Damien Miller57f39152005-11-24 19:58:19 +11003068AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
3069 AC_TRY_LINK(
3070 [#include <stdarg.h>
3071 va_list x,y;],
3072 [va_copy(x,y);],
3073 [ ac_cv_have_va_copy="yes" ],
3074 [ ac_cv_have_va_copy="no" ]
3075 )
3076])
3077if test "x$ac_cv_have_va_copy" = "xyes" ; then
3078 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
3079fi
3080
3081AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
3082 AC_TRY_LINK(
3083 [#include <stdarg.h>
3084 va_list x,y;],
3085 [__va_copy(x,y);],
3086 [ ac_cv_have___va_copy="yes" ],
3087 [ ac_cv_have___va_copy="no" ]
3088 )
3089])
3090if test "x$ac_cv_have___va_copy" = "xyes" ; then
3091 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
3092fi
3093
Damien Miller4f8e6692001-07-14 13:22:53 +10003094AC_CACHE_CHECK([whether getopt has optreset support],
3095 ac_cv_have_getopt_optreset, [
3096 AC_TRY_LINK(
3097 [
3098#include <getopt.h>
3099 ],
3100 [ extern int optreset; optreset = 0; ],
3101 [ ac_cv_have_getopt_optreset="yes" ],
3102 [ ac_cv_have_getopt_optreset="no" ]
3103 )
3104])
3105if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003106 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
3107 [Define if your getopt(3) defines and uses optreset])
Damien Miller4f8e6692001-07-14 13:22:53 +10003108fi
Damien Millera22ba012000-03-02 23:09:20 +11003109
Damien Millerecbb26d2000-07-15 14:59:14 +10003110AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003111 AC_TRY_LINK([],
3112 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
Damien Millerecbb26d2000-07-15 14:59:14 +10003113 [ ac_cv_libc_defines_sys_errlist="yes" ],
3114 [ ac_cv_libc_defines_sys_errlist="no" ]
3115 )
3116])
3117if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003118 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
3119 [Define if your system defines sys_errlist[]])
Damien Millerecbb26d2000-07-15 14:59:14 +10003120fi
3121
3122
Damien Miller11fa2cc2000-08-16 10:35:58 +10003123AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
Damien Millera8e06ce2003-11-21 23:48:55 +11003124 AC_TRY_LINK([],
3125 [ extern int sys_nerr; printf("%i", sys_nerr);],
Damien Miller11fa2cc2000-08-16 10:35:58 +10003126 [ ac_cv_libc_defines_sys_nerr="yes" ],
3127 [ ac_cv_libc_defines_sys_nerr="no" ]
3128 )
3129])
3130if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003131 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
Damien Miller11fa2cc2000-08-16 10:35:58 +10003132fi
3133
Damien Millera8e06ce2003-11-21 23:48:55 +11003134SCARD_MSG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003135# Check whether user wants sectok support
3136AC_ARG_WITH(sectok,
3137 [ --with-sectok Enable smartcard support using libsectok],
Damien Miller85de5802001-09-18 14:01:11 +10003138 [
3139 if test "x$withval" != "xno" ; then
3140 if test "x$withval" != "xyes" ; then
3141 CPPFLAGS="$CPPFLAGS -I${withval}"
3142 LDFLAGS="$LDFLAGS -L${withval}"
3143 if test ! -z "$need_dash_r" ; then
3144 LDFLAGS="$LDFLAGS -R${withval}"
3145 fi
3146 if test ! -z "$blibpath" ; then
3147 blibpath="$blibpath:${withval}"
3148 fi
3149 fi
3150 AC_CHECK_HEADERS(sectok.h)
3151 if test "$ac_cv_header_sectok_h" != yes; then
3152 AC_MSG_ERROR(Can't find sectok.h)
3153 fi
3154 AC_CHECK_LIB(sectok, sectok_open)
3155 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
3156 AC_MSG_ERROR(Can't find libsectok)
3157 fi
Tim Rice7df8d392005-09-19 09:33:39 -07003158 AC_DEFINE(SMARTCARD, 1,
3159 [Define if you want smartcard support])
3160 AC_DEFINE(USE_SECTOK, 1,
3161 [Define if you want smartcard support
3162 using sectok])
Damien Millera8e06ce2003-11-21 23:48:55 +11003163 SCARD_MSG="yes, using sectok"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003164 fi
3165 ]
3166)
3167
3168# Check whether user wants OpenSC support
Tim Rice12ee8e22005-03-17 13:37:04 -08003169OPENSC_CONFIG="no"
Ben Lindstroma42694f2002-04-05 16:11:45 +00003170AC_ARG_WITH(opensc,
Darren Tucker82171c62005-09-22 20:19:54 +10003171 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
Tim Rice12ee8e22005-03-17 13:37:04 -08003172 [
3173 if test "x$withval" != "xno" ; then
3174 if test "x$withval" != "xyes" ; then
3175 OPENSC_CONFIG=$withval/bin/opensc-config
3176 else
3177 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
3178 fi
3179 if test "$OPENSC_CONFIG" != "no"; then
3180 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
3181 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
3182 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
Darren Tucker0ee3cbf2006-09-23 16:25:19 +10003183 LIBS="$LIBS $LIBOPENSC_LIBS"
Tim Rice12ee8e22005-03-17 13:37:04 -08003184 AC_DEFINE(SMARTCARD)
Tim Rice7df8d392005-09-19 09:33:39 -07003185 AC_DEFINE(USE_OPENSC, 1,
3186 [Define if you want smartcard support
3187 using OpenSC])
Tim Rice12ee8e22005-03-17 13:37:04 -08003188 SCARD_MSG="yes, using OpenSC"
3189 fi
3190 fi
3191 ]
3192)
Damien Miller85de5802001-09-18 14:01:11 +10003193
Darren Tucker5f88d342003-10-15 16:57:57 +10003194# Check libraries needed by DNS fingerprint support
Damien Millera8e06ce2003-11-21 23:48:55 +11003195AC_SEARCH_LIBS(getrrsetbyname, resolv,
Tim Rice7df8d392005-09-19 09:33:39 -07003196 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
3197 [Define if getrrsetbyname() exists])],
Damien Miller7abe09b2003-05-15 10:53:49 +10003198 [
Darren Tucker5f88d342003-10-15 16:57:57 +10003199 # Needed by our getrrsetbyname()
3200 AC_SEARCH_LIBS(res_query, resolv)
3201 AC_SEARCH_LIBS(dn_expand, resolv)
Darren Tucker8e968a52004-05-13 11:56:16 +10003202 AC_MSG_CHECKING(if res_query will link)
3203 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
3204 [AC_MSG_RESULT(no)
3205 saved_LIBS="$LIBS"
3206 LIBS="$LIBS -lresolv"
3207 AC_MSG_CHECKING(for res_query in -lresolv)
3208 AC_LINK_IFELSE([
3209#include <resolv.h>
3210int main()
3211{
3212 res_query (0, 0, 0, 0, 0);
3213 return 0;
3214}
3215 ],
3216 [LIBS="$LIBS -lresolv"
3217 AC_MSG_RESULT(yes)],
3218 [LIBS="$saved_LIBS"
3219 AC_MSG_RESULT(no)])
3220 ])
Darren Tucker5f88d342003-10-15 16:57:57 +10003221 AC_CHECK_FUNCS(_getshort _getlong)
Darren Tuckerd886e1c2005-06-01 18:57:45 +10003222 AC_CHECK_DECLS([_getshort, _getlong], , ,
Tim Ricefcc7ff12005-06-02 20:28:29 -07003223 [#include <sys/types.h>
3224 #include <arpa/nameser.h>])
Darren Tucker5f88d342003-10-15 16:57:57 +10003225 AC_CHECK_MEMBER(HEADER.ad,
Tim Rice7df8d392005-09-19 09:33:39 -07003226 [AC_DEFINE(HAVE_HEADER_AD, 1,
3227 [Define if HEADER.ad exists in arpa/nameser.h])],,
Darren Tucker5f88d342003-10-15 16:57:57 +10003228 [#include <arpa/nameser.h>])
3229 ])
Damien Miller7abe09b2003-05-15 10:53:49 +10003230
Darren Tuckercc40d5e2007-04-29 13:58:06 +10003231AC_MSG_CHECKING(if struct __res_state _res is an extern)
3232AC_LINK_IFELSE([
3233#include <stdio.h>
3234#if HAVE_SYS_TYPES_H
3235# include <sys/types.h>
3236#endif
3237#include <netinet/in.h>
3238#include <arpa/nameser.h>
3239#include <resolv.h>
3240extern struct __res_state _res;
3241int main() { return 0; }
3242 ],
3243 [AC_MSG_RESULT(yes)
3244 AC_DEFINE(HAVE__RES_EXTERN, 1,
3245 [Define if you have struct __res_state _res as an extern])
3246 ],
3247 [ AC_MSG_RESULT(no) ]
3248)
3249
Damien Miller73b42d22006-04-22 21:26:08 +10003250# Check whether user wants SELinux support
3251SELINUX_MSG="no"
3252LIBSELINUX=""
3253AC_ARG_WITH(selinux,
3254 [ --with-selinux Enable SELinux support],
3255 [ if test "x$withval" != "xno" ; then
Darren Tucker20e9f972007-03-25 18:26:01 +10003256 save_LIBS="$LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003257 AC_DEFINE(WITH_SELINUX,1,[Define if you want SELinux support.])
3258 SELINUX_MSG="yes"
3259 AC_CHECK_HEADER([selinux/selinux.h], ,
3260 AC_MSG_ERROR(SELinux support requires selinux.h header))
3261 AC_CHECK_LIB(selinux, setexeccon, [ LIBSELINUX="-lselinux" ],
3262 AC_MSG_ERROR(SELinux support requires libselinux library))
Darren Tucker20e9f972007-03-25 18:26:01 +10003263 SSHDLIBS="$SSHDLIBS $LIBSELINUX"
Damien Miller73b42d22006-04-22 21:26:08 +10003264 AC_CHECK_FUNCS(getseuserbyname get_default_context_with_level)
Darren Tuckeradc947d2006-10-07 09:07:20 +10003265 LIBS="$save_LIBS"
Damien Miller73b42d22006-04-22 21:26:08 +10003266 fi ]
3267)
Damien Miller73b42d22006-04-22 21:26:08 +10003268
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003269# Check whether user wants Kerberos 5 support
Damien Millera8e06ce2003-11-21 23:48:55 +11003270KRB5_MSG="no"
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003271AC_ARG_WITH(kerberos5,
Damien Millera8e06ce2003-11-21 23:48:55 +11003272 [ --with-kerberos5=PATH Enable Kerberos 5 support],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003273 [ if test "x$withval" != "xno" ; then
3274 if test "x$withval" = "xyes" ; then
3275 KRB5ROOT="/usr/local"
3276 else
3277 KRB5ROOT=${withval}
3278 fi
3279
Tim Rice7df8d392005-09-19 09:33:39 -07003280 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
Darren Tucker1d3ca582004-01-22 12:05:34 +11003281 KRB5_MSG="yes"
3282
3283 AC_MSG_CHECKING(for krb5-config)
3284 if test -x $KRB5ROOT/bin/krb5-config ; then
3285 KRB5CONF=$KRB5ROOT/bin/krb5-config
3286 AC_MSG_RESULT($KRB5CONF)
3287
3288 AC_MSG_CHECKING(for gssapi support)
3289 if $KRB5CONF | grep gssapi >/dev/null ; then
3290 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003291 AC_DEFINE(GSSAPI, 1,
3292 [Define this if you want GSSAPI
3293 support in the version 2 protocol])
Darren Tucker0d27ed12004-02-24 10:37:33 +11003294 k5confopts=gssapi
Damien Millera8e06ce2003-11-21 23:48:55 +11003295 else
Darren Tucker1d3ca582004-01-22 12:05:34 +11003296 AC_MSG_RESULT(no)
Darren Tucker0d27ed12004-02-24 10:37:33 +11003297 k5confopts=""
Damien Millera8e06ce2003-11-21 23:48:55 +11003298 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003299 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
3300 K5LIBS="`$KRB5CONF --libs $k5confopts`"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003301 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
Darren Tucker1d3ca582004-01-22 12:05:34 +11003302 AC_MSG_CHECKING(whether we are using Heimdal)
3303 AC_TRY_COMPILE([ #include <krb5.h> ],
3304 [ char *tmp = heimdal_version; ],
3305 [ AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003306 AC_DEFINE(HEIMDAL, 1,
3307 [Define this if you are using the
3308 Heimdal version of Kerberos V5]) ],
Darren Tucker1d3ca582004-01-22 12:05:34 +11003309 AC_MSG_RESULT(no)
3310 )
3311 else
3312 AC_MSG_RESULT(no)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003313 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
Damien Millera8e06ce2003-11-21 23:48:55 +11003314 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
Damien Millera8e06ce2003-11-21 23:48:55 +11003315 AC_MSG_CHECKING(whether we are using Heimdal)
3316 AC_TRY_COMPILE([ #include <krb5.h> ],
3317 [ char *tmp = heimdal_version; ],
3318 [ AC_MSG_RESULT(yes)
3319 AC_DEFINE(HEIMDAL)
Damien Miller5561e0b2004-04-20 20:28:55 +10003320 K5LIBS="-lkrb5 -ldes"
3321 K5LIBS="$K5LIBS -lcom_err -lasn1"
Tim Riceeae17cc2005-03-17 16:52:20 -08003322 AC_CHECK_LIB(roken, net_write,
Damien Miller5561e0b2004-04-20 20:28:55 +10003323 [K5LIBS="$K5LIBS -lroken"])
Damien Millera8e06ce2003-11-21 23:48:55 +11003324 ],
3325 [ AC_MSG_RESULT(no)
3326 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3327 ]
3328 )
Damien Miller200d0a72003-06-30 19:21:36 +10003329 AC_SEARCH_LIBS(dn_expand, resolv)
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003330
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003331 AC_CHECK_LIB(gssapi,gss_init_sec_context,
3332 [ AC_DEFINE(GSSAPI)
3333 K5LIBS="-lgssapi $K5LIBS" ],
3334 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3335 [ AC_DEFINE(GSSAPI)
Damien Millera8e06ce2003-11-21 23:48:55 +11003336 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003337 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3338 $K5LIBS)
3339 ],
3340 $K5LIBS)
Tim Riceeae17cc2005-03-17 16:52:20 -08003341
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003342 AC_CHECK_HEADER(gssapi.h, ,
3343 [ unset ac_cv_header_gssapi_h
Damien Millera8e06ce2003-11-21 23:48:55 +11003344 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003345 AC_CHECK_HEADERS(gssapi.h, ,
3346 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
Damien Millera8e06ce2003-11-21 23:48:55 +11003347 )
Darren Tucker49aaf4a2003-08-26 11:58:16 +10003348 ]
3349 )
3350
3351 oldCPP="$CPPFLAGS"
3352 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3353 AC_CHECK_HEADER(gssapi_krb5.h, ,
3354 [ CPPFLAGS="$oldCPP" ])
3355
Damien Millera8e06ce2003-11-21 23:48:55 +11003356 fi
Darren Tucker1d3ca582004-01-22 12:05:34 +11003357 if test ! -z "$need_dash_r" ; then
3358 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3359 fi
3360 if test ! -z "$blibpath" ; then
3361 blibpath="$blibpath:${KRB5ROOT}/lib"
3362 fi
Tim Ricefd9e9e32005-09-12 17:36:10 -07003363
3364 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3365 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3366 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3367
3368 LIBS="$LIBS $K5LIBS"
Tim Rice7df8d392005-09-19 09:33:39 -07003369 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3370 [Define this if you want to use libkafs' AFS support]))
Darren Tucker0d27ed12004-02-24 10:37:33 +11003371 fi
Darren Tucker0d27ed12004-02-24 10:37:33 +11003372 ]
Damien Millerfd4c9ee2002-04-13 11:04:40 +10003373)
Damien Millerc79bc0d2001-03-28 13:03:42 +10003374
Damien Millera22ba012000-03-02 23:09:20 +11003375# Looking for programs, paths and files
Damien Millera22ba012000-03-02 23:09:20 +11003376
Damien Millerf58c6722002-05-13 13:15:42 +10003377PRIVSEP_PATH=/var/empty
3378AC_ARG_WITH(privsep-path,
Tim Ricecbb90662002-07-08 19:17:10 -07003379 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
Damien Millerf58c6722002-05-13 13:15:42 +10003380 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003381 if test -n "$withval" && test "x$withval" != "xno" && \
3382 test "x${withval}" != "xyes"; then
Damien Millerf58c6722002-05-13 13:15:42 +10003383 PRIVSEP_PATH=$withval
3384 fi
3385 ]
3386)
3387AC_SUBST(PRIVSEP_PATH)
3388
Damien Millera22ba012000-03-02 23:09:20 +11003389AC_ARG_WITH(xauth,
3390 [ --with-xauth=PATH Specify path to xauth program ],
3391 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003392 if test -n "$withval" && test "x$withval" != "xno" && \
3393 test "x${withval}" != "xyes"; then
Damien Miller7b22d652000-06-18 14:07:04 +10003394 xauth_path=$withval
Damien Millera22ba012000-03-02 23:09:20 +11003395 fi
3396 ],
3397 [
Tim Ricee22be3b2002-07-17 19:20:07 -07003398 TestPath="$PATH"
3399 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3400 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3401 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3402 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3403 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
Damien Milleredb82922000-06-20 13:25:52 +10003404 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
Damien Millera22ba012000-03-02 23:09:20 +11003405 xauth_path="/usr/openwin/bin/xauth"
3406 fi
3407 ]
3408)
3409
Damien Miller7d901272003-01-13 16:55:22 +11003410STRIP_OPT=-s
3411AC_ARG_ENABLE(strip,
3412 [ --disable-strip Disable calling strip(1) on install],
3413 [
3414 if test "x$enableval" = "xno" ; then
3415 STRIP_OPT=
3416 fi
3417 ]
3418)
3419AC_SUBST(STRIP_OPT)
3420
Damien Millera19cf472000-11-29 13:28:50 +11003421if test -z "$xauth_path" ; then
3422 XAUTH_PATH="undefined"
3423 AC_SUBST(XAUTH_PATH)
3424else
Tim Rice7df8d392005-09-19 09:33:39 -07003425 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3426 [Define if xauth is found in your path])
Damien Millera19cf472000-11-29 13:28:50 +11003427 XAUTH_PATH=$xauth_path
3428 AC_SUBST(XAUTH_PATH)
Damien Millera22ba012000-03-02 23:09:20 +11003429fi
Damien Millera22ba012000-03-02 23:09:20 +11003430
3431# Check for mail directory (last resort if we cannot get it from headers)
3432if test ! -z "$MAIL" ; then
3433 maildir=`dirname $MAIL`
Tim Rice7df8d392005-09-19 09:33:39 -07003434 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3435 [Set this to your mail directory if you don't have maillock.h])
Damien Millera22ba012000-03-02 23:09:20 +11003436fi
3437
Darren Tucker623d92f2004-09-12 22:36:15 +10003438if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003439 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3440 disable_ptmx_check=yes
3441fi
Damien Millera22ba012000-03-02 23:09:20 +11003442if test -z "$no_dev_ptmx" ; then
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003443 if test "x$disable_ptmx_check" != "xyes" ; then
Damien Millera8e06ce2003-11-21 23:48:55 +11003444 AC_CHECK_FILE("/dev/ptmx",
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003445 [
Tim Rice7df8d392005-09-19 09:33:39 -07003446 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3447 [Define if you have /dev/ptmx])
Kevin Steves0ea1d9d2002-04-25 18:17:04 +00003448 have_dev_ptmx=1
3449 ]
3450 )
3451 fi
Damien Millera22ba012000-03-02 23:09:20 +11003452fi
Darren Tuckera0c2b392004-09-11 23:26:37 +10003453
Darren Tucker623d92f2004-09-12 22:36:15 +10003454if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
Darren Tuckera0c2b392004-09-11 23:26:37 +10003455 AC_CHECK_FILE("/dev/ptc",
3456 [
Tim Rice7df8d392005-09-19 09:33:39 -07003457 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3458 [Define if you have /dev/ptc])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003459 have_dev_ptc=1
3460 ]
3461 )
3462else
3463 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3464fi
Damien Miller204ad072000-03-02 23:56:12 +11003465
Damien Millera22ba012000-03-02 23:09:20 +11003466# Options from here on. Some of these are preset by platform above
Ben Lindstrom9841b0a2001-06-09 02:26:58 +00003467AC_ARG_WITH(mantype,
Damien Miller897741e2001-04-16 10:41:46 +10003468 [ --with-mantype=man|cat|doc Set man page type],
Damien Miller670a4b82000-01-22 13:53:11 +11003469 [
Damien Miller897741e2001-04-16 10:41:46 +10003470 case "$withval" in
3471 man|cat|doc)
3472 MANTYPE=$withval
3473 ;;
3474 *)
3475 AC_MSG_ERROR(invalid man type: $withval)
3476 ;;
3477 esac
Damien Miller670a4b82000-01-22 13:53:11 +11003478 ]
3479)
Ben Lindstrombc709922001-04-18 18:04:21 +00003480if test -z "$MANTYPE"; then
Tim Ricee22be3b2002-07-17 19:20:07 -07003481 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3482 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
Ben Lindstrombc709922001-04-18 18:04:21 +00003483 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3484 MANTYPE=doc
3485 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3486 MANTYPE=man
3487 else
3488 MANTYPE=cat
3489 fi
3490fi
Damien Miller670a4b82000-01-22 13:53:11 +11003491AC_SUBST(MANTYPE)
Ben Lindstrombc709922001-04-18 18:04:21 +00003492if test "$MANTYPE" = "doc"; then
3493 mansubdir=man;
3494else
3495 mansubdir=$MANTYPE;
3496fi
3497AC_SUBST(mansubdir)
Damien Miller8bdeee21999-12-30 15:50:54 +11003498
Damien Millera22ba012000-03-02 23:09:20 +11003499# Check whether to enable MD5 passwords
Damien Millera8e06ce2003-11-21 23:48:55 +11003500MD5_MSG="no"
Damien Millerf7c0f821999-11-22 22:31:49 +11003501AC_ARG_WITH(md5-passwords,
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003502 [ --with-md5-passwords Enable use of MD5 passwords],
Damien Miller8bdeee21999-12-30 15:50:54 +11003503 [
Damien Millerb85dcad2000-03-11 11:37:00 +11003504 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003505 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3506 [Define if you want to allow MD5 passwords])
Damien Millera8e06ce2003-11-21 23:48:55 +11003507 MD5_MSG="yes"
Damien Miller8bdeee21999-12-30 15:50:54 +11003508 fi
3509 ]
Damien Millerdd1c7ba1999-11-19 15:53:20 +11003510)
3511
Damien Millera22ba012000-03-02 23:09:20 +11003512# Whether to disable shadow password support
Damien Miller76112de1999-12-21 11:18:08 +11003513AC_ARG_WITH(shadow,
3514 [ --without-shadow Disable shadow password support],
3515 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003516 if test "x$withval" = "xno" ; then
Damien Miller76112de1999-12-21 11:18:08 +11003517 AC_DEFINE(DISABLE_SHADOW)
Damien Miller1f335fb2000-06-26 11:31:33 +10003518 disable_shadow=yes
Damien Miller76112de1999-12-21 11:18:08 +11003519 fi
3520 ]
3521)
3522
Damien Miller1f335fb2000-06-26 11:31:33 +10003523if test -z "$disable_shadow" ; then
3524 AC_MSG_CHECKING([if the systems has expire shadow information])
3525 AC_TRY_COMPILE(
3526 [
3527#include <sys/types.h>
3528#include <shadow.h>
3529 struct spwd sp;
3530 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3531 [ sp_expire_available=yes ], []
3532 )
3533
3534 if test "x$sp_expire_available" = "xyes" ; then
3535 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003536 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3537 [Define if you want to use shadow password expire field])
Damien Miller1f335fb2000-06-26 11:31:33 +10003538 else
3539 AC_MSG_RESULT(no)
3540 fi
3541fi
3542
Damien Millera22ba012000-03-02 23:09:20 +11003543# Use ip address instead of hostname in $DISPLAY
Damien Miller9a947342000-08-30 10:03:33 +11003544if test ! -z "$IPADDR_IN_DISPLAY" ; then
3545 DISPLAY_HACK_MSG="yes"
Tim Rice7df8d392005-09-19 09:33:39 -07003546 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3547 [Define if you need to use IP address
3548 instead of hostname in $DISPLAY])
Damien Miller9a947342000-08-30 10:03:33 +11003549else
Damien Millera8e06ce2003-11-21 23:48:55 +11003550 DISPLAY_HACK_MSG="no"
Damien Miller9a947342000-08-30 10:03:33 +11003551 AC_ARG_WITH(ipaddr-display,
3552 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3553 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003554 if test "x$withval" != "xno" ; then
Damien Miller9a947342000-08-30 10:03:33 +11003555 AC_DEFINE(IPADDR_IN_DISPLAY)
Damien Millera8e06ce2003-11-21 23:48:55 +11003556 DISPLAY_HACK_MSG="yes"
Damien Miller9a947342000-08-30 10:03:33 +11003557 fi
3558 ]
3559 )
3560fi
Damien Miller76112de1999-12-21 11:18:08 +11003561
Darren Tuckere1a790d2003-09-16 11:52:19 +10003562# check for /etc/default/login and use it if present.
Tim Rice7ff4e6d2003-09-22 19:50:14 -07003563AC_ARG_ENABLE(etc-default-login,
Darren Tucker1b6f2292005-02-11 16:11:49 +11003564 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
Darren Tucker2f9573d2005-02-10 22:28:54 +11003565 [ if test "x$enableval" = "xno"; then
3566 AC_MSG_NOTICE([/etc/default/login handling disabled])
3567 etc_default_login=no
3568 else
3569 etc_default_login=yes
3570 fi ],
Darren Tucker314d89e2005-10-17 23:29:23 +10003571 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3572 then
3573 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3574 etc_default_login=no
3575 else
3576 etc_default_login=yes
3577 fi ]
Darren Tucker2f9573d2005-02-10 22:28:54 +11003578)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003579
Darren Tucker2f9573d2005-02-10 22:28:54 +11003580if test "x$etc_default_login" != "xno"; then
3581 AC_CHECK_FILE("/etc/default/login",
3582 [ external_path_file=/etc/default/login ])
Darren Tucker314d89e2005-10-17 23:29:23 +10003583 if test "x$external_path_file" = "x/etc/default/login"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003584 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3585 [Define if your system has /etc/default/login])
Darren Tuckera0c2b392004-09-11 23:26:37 +10003586 fi
Darren Tucker2f9573d2005-02-10 22:28:54 +11003587fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003588
Tim Rice43a1c132002-04-17 21:19:14 -07003589dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
Tim Rice8bb561b2005-03-17 16:23:19 -08003590if test $ac_cv_func_login_getcapbool = "yes" && \
3591 test $ac_cv_header_login_cap_h = "yes" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003592 external_path_file=/etc/login.conf
Tim Rice43a1c132002-04-17 21:19:14 -07003593fi
Darren Tuckere1a790d2003-09-16 11:52:19 +10003594
Damien Millera22ba012000-03-02 23:09:20 +11003595# Whether to mess with the default path
Damien Millera8e06ce2003-11-21 23:48:55 +11003596SERVER_PATH_MSG="(default)"
Damien Millere7f626c1999-12-31 09:49:44 +11003597AC_ARG_WITH(default-path,
Damien Millerf71d2a52002-05-13 15:14:08 +10003598 [ --with-default-path= Specify default \$PATH environment for server],
Damien Miller5a3e6831999-12-27 09:48:56 +11003599 [
Darren Tuckere1a790d2003-09-16 11:52:19 +10003600 if test "x$external_path_file" = "x/etc/login.conf" ; then
Tim Rice43a1c132002-04-17 21:19:14 -07003601 AC_MSG_WARN([
3602--with-default-path=PATH has no effect on this system.
3603Edit /etc/login.conf instead.])
Tim Riceeae17cc2005-03-17 16:52:20 -08003604 elif test "x$withval" != "xno" ; then
Tim Riceb925b4b2003-09-15 22:40:49 -07003605 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003606 AC_MSG_WARN([
3607--with-default-path=PATH will only be used if PATH is not defined in
3608$external_path_file .])
3609 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003610 user_path="$withval"
Damien Millera8e06ce2003-11-21 23:48:55 +11003611 SERVER_PATH_MSG="$withval"
Damien Miller5a3e6831999-12-27 09:48:56 +11003612 fi
Tim Rice59ea0a02001-03-10 13:50:45 -08003613 ],
Darren Tuckere1a790d2003-09-16 11:52:19 +10003614 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3615 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
Tim Rice43a1c132002-04-17 21:19:14 -07003616 else
Tim Riceb925b4b2003-09-15 22:40:49 -07003617 if test ! -z "$external_path_file" ; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10003618 AC_MSG_WARN([
3619If PATH is defined in $external_path_file, ensure the path to scp is included,
3620otherwise scp will not work.])
3621 fi
Darren Tucker314d89e2005-10-17 23:29:23 +10003622 AC_RUN_IFELSE(
3623 [AC_LANG_SOURCE([[
Tim Rice59ea0a02001-03-10 13:50:45 -08003624/* find out what STDPATH is */
3625#include <stdio.h>
Tim Rice59ea0a02001-03-10 13:50:45 -08003626#ifdef HAVE_PATHS_H
3627# include <paths.h>
3628#endif
3629#ifndef _PATH_STDPATH
Tim Rice1c9e6882002-11-22 13:29:01 -08003630# ifdef _PATH_USERPATH /* Irix */
3631# define _PATH_STDPATH _PATH_USERPATH
3632# else
3633# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3634# endif
Tim Rice59ea0a02001-03-10 13:50:45 -08003635#endif
3636#include <sys/types.h>
3637#include <sys/stat.h>
3638#include <fcntl.h>
3639#define DATA "conftest.stdpath"
3640
3641main()
3642{
3643 FILE *fd;
3644 int rc;
Tim Riceeae17cc2005-03-17 16:52:20 -08003645
Tim Rice59ea0a02001-03-10 13:50:45 -08003646 fd = fopen(DATA,"w");
3647 if(fd == NULL)
3648 exit(1);
Tim Riceeae17cc2005-03-17 16:52:20 -08003649
Tim Rice59ea0a02001-03-10 13:50:45 -08003650 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3651 exit(1);
3652
3653 exit(0);
3654}
Darren Tucker314d89e2005-10-17 23:29:23 +10003655 ]])],
3656 [ user_path=`cat conftest.stdpath` ],
Tim Rice59ea0a02001-03-10 13:50:45 -08003657 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3658 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3659 )
3660# make sure $bindir is in USER_PATH so scp will work
3661 t_bindir=`eval echo ${bindir}`
3662 case $t_bindir in
3663 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3664 esac
3665 case $t_bindir in
3666 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3667 esac
3668 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3669 if test $? -ne 0 ; then
3670 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3671 if test $? -ne 0 ; then
3672 user_path=$user_path:$t_bindir
3673 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3674 fi
3675 fi
Tim Rice43a1c132002-04-17 21:19:14 -07003676 fi ]
Damien Miller5a3e6831999-12-27 09:48:56 +11003677)
Darren Tuckere1a790d2003-09-16 11:52:19 +10003678if test "x$external_path_file" != "x/etc/login.conf" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003679 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
Tim Rice43a1c132002-04-17 21:19:14 -07003680 AC_SUBST(user_path)
3681fi
Damien Miller5a3e6831999-12-27 09:48:56 +11003682
Damien Millera18bbd32002-05-13 10:48:57 +10003683# Set superuser path separately to user path
Damien Millera18bbd32002-05-13 10:48:57 +10003684AC_ARG_WITH(superuser-path,
3685 [ --with-superuser-path= Specify different path for super-user],
3686 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003687 if test -n "$withval" && test "x$withval" != "xno" && \
3688 test "x${withval}" != "xyes"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003689 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3690 [Define if you want a different $PATH
3691 for the superuser])
Damien Millera18bbd32002-05-13 10:48:57 +10003692 superuser_path=$withval
3693 fi
3694 ]
3695)
3696
3697
Damien Miller61e50f12000-05-08 20:49:37 +10003698AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
Damien Millera8e06ce2003-11-21 23:48:55 +11003699IPV4_IN6_HACK_MSG="no"
Damien Miller7bcb0892000-03-11 20:45:40 +11003700AC_ARG_WITH(4in6,
3701 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3702 [
3703 if test "x$withval" != "xno" ; then
3704 AC_MSG_RESULT(yes)
Tim Rice7df8d392005-09-19 09:33:39 -07003705 AC_DEFINE(IPV4_IN_IPV6, 1,
3706 [Detect IPv4 in IPv6 mapped addresses
3707 and treat as IPv4])
Damien Millera8e06ce2003-11-21 23:48:55 +11003708 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003709 else
3710 AC_MSG_RESULT(no)
3711 fi
3712 ],[
3713 if test "x$inet6_default_4in6" = "xyes"; then
3714 AC_MSG_RESULT([yes (default)])
3715 AC_DEFINE(IPV4_IN_IPV6)
Damien Millera8e06ce2003-11-21 23:48:55 +11003716 IPV4_IN6_HACK_MSG="yes"
Damien Miller7bcb0892000-03-11 20:45:40 +11003717 else
3718 AC_MSG_RESULT([no (default)])
3719 fi
3720 ]
3721)
3722
Damien Miller60396b02001-02-18 17:01:00 +11003723# Whether to enable BSD auth support
Damien Miller6c21c512002-01-22 21:57:53 +11003724BSD_AUTH_MSG=no
Damien Miller60396b02001-02-18 17:01:00 +11003725AC_ARG_WITH(bsd-auth,
3726 [ --with-bsd-auth Enable BSD auth support],
3727 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003728 if test "x$withval" != "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003729 AC_DEFINE(BSD_AUTH, 1,
3730 [Define if you have BSD auth support])
Damien Miller6c21c512002-01-22 21:57:53 +11003731 BSD_AUTH_MSG=yes
Damien Miller60396b02001-02-18 17:01:00 +11003732 fi
3733 ]
3734)
3735
Damien Millera22ba012000-03-02 23:09:20 +11003736# Where to place sshd.pid
Damien Millerb13c73e2000-01-17 22:02:17 +11003737piddir=/var/run
Damien Miller78315eb2000-09-29 23:01:36 +11003738# make sure the directory exists
Tim Riceeae17cc2005-03-17 16:52:20 -08003739if test ! -d $piddir ; then
Damien Miller78315eb2000-09-29 23:01:36 +11003740 piddir=`eval echo ${sysconfdir}`
3741 case $piddir in
Damien Millera8e06ce2003-11-21 23:48:55 +11003742 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
Damien Miller78315eb2000-09-29 23:01:36 +11003743 esac
3744fi
3745
Tim Rice88f2ab52002-03-17 12:17:34 -08003746AC_ARG_WITH(pid-dir,
3747 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3748 [
Tim Rice35cc69d2005-03-17 16:44:25 -08003749 if test -n "$withval" && test "x$withval" != "xno" && \
3750 test "x${withval}" != "xyes"; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003751 piddir=$withval
Tim Riceeae17cc2005-03-17 16:52:20 -08003752 if test ! -d $piddir ; then
Tim Rice88f2ab52002-03-17 12:17:34 -08003753 AC_MSG_WARN([** no $piddir directory on this system **])
3754 fi
3755 fi
3756 ]
3757)
3758
Tim Rice7df8d392005-09-19 09:33:39 -07003759AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
Damien Millerb13c73e2000-01-17 22:02:17 +11003760AC_SUBST(piddir)
Damien Miller5eed6a22000-01-16 12:05:18 +11003761
andre2ff7b5d2000-06-03 14:57:40 +00003762dnl allow user to disable some login recording features
3763AC_ARG_ENABLE(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003764 [ --disable-lastlog disable use of lastlog even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003765 [
3766 if test "x$enableval" = "xno" ; then
3767 AC_DEFINE(DISABLE_LASTLOG)
3768 fi
3769 ]
andre2ff7b5d2000-06-03 14:57:40 +00003770)
3771AC_ARG_ENABLE(utmp,
andre43ca7e22000-06-19 08:23:46 +00003772 [ --disable-utmp disable use of utmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003773 [
3774 if test "x$enableval" = "xno" ; then
3775 AC_DEFINE(DISABLE_UTMP)
3776 fi
3777 ]
andre2ff7b5d2000-06-03 14:57:40 +00003778)
3779AC_ARG_ENABLE(utmpx,
andre43ca7e22000-06-19 08:23:46 +00003780 [ --disable-utmpx disable use of utmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003781 [
3782 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003783 AC_DEFINE(DISABLE_UTMPX, 1,
3784 [Define if you don't want to use utmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003785 fi
3786 ]
andre2ff7b5d2000-06-03 14:57:40 +00003787)
3788AC_ARG_ENABLE(wtmp,
andre43ca7e22000-06-19 08:23:46 +00003789 [ --disable-wtmp disable use of wtmp even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003790 [
3791 if test "x$enableval" = "xno" ; then
3792 AC_DEFINE(DISABLE_WTMP)
3793 fi
3794 ]
andre2ff7b5d2000-06-03 14:57:40 +00003795)
3796AC_ARG_ENABLE(wtmpx,
andre43ca7e22000-06-19 08:23:46 +00003797 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003798 [
3799 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003800 AC_DEFINE(DISABLE_WTMPX, 1,
3801 [Define if you don't want to use wtmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003802 fi
3803 ]
andre2ff7b5d2000-06-03 14:57:40 +00003804)
3805AC_ARG_ENABLE(libutil,
andre43ca7e22000-06-19 08:23:46 +00003806 [ --disable-libutil disable use of libutil (login() etc.) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003807 [
3808 if test "x$enableval" = "xno" ; then
3809 AC_DEFINE(DISABLE_LOGIN)
3810 fi
3811 ]
andre2ff7b5d2000-06-03 14:57:40 +00003812)
3813AC_ARG_ENABLE(pututline,
andre43ca7e22000-06-19 08:23:46 +00003814 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003815 [
3816 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003817 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3818 [Define if you don't want to use pututline()
3819 etc. to write [uw]tmp])
Darren Tuckera3020db2003-06-28 12:54:33 +10003820 fi
3821 ]
andre2ff7b5d2000-06-03 14:57:40 +00003822)
3823AC_ARG_ENABLE(pututxline,
andre43ca7e22000-06-19 08:23:46 +00003824 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
Darren Tuckera3020db2003-06-28 12:54:33 +10003825 [
3826 if test "x$enableval" = "xno" ; then
Tim Rice7df8d392005-09-19 09:33:39 -07003827 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3828 [Define if you don't want to use pututxline()
3829 etc. to write [uw]tmpx])
Darren Tuckera3020db2003-06-28 12:54:33 +10003830 fi
3831 ]
andre2ff7b5d2000-06-03 14:57:40 +00003832)
3833AC_ARG_WITH(lastlog,
andre43ca7e22000-06-19 08:23:46 +00003834 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
Damien Miller709528a2001-01-31 09:57:55 +11003835 [
Tim Riceeae17cc2005-03-17 16:52:20 -08003836 if test "x$withval" = "xno" ; then
Damien Miller709528a2001-01-31 09:57:55 +11003837 AC_DEFINE(DISABLE_LASTLOG)
Tim Rice35cc69d2005-03-17 16:44:25 -08003838 elif test -n "$withval" && test "x${withval}" != "xyes"; then
Damien Miller709528a2001-01-31 09:57:55 +11003839 conf_lastlog_location=$withval
3840 fi
3841 ]
3842)
andre2ff7b5d2000-06-03 14:57:40 +00003843
3844dnl lastlog, [uw]tmpx? detection
3845dnl NOTE: set the paths in the platform section to avoid the
3846dnl need for command-line parameters
3847dnl lastlog and [uw]tmp are subject to a file search if all else fails
3848
3849dnl lastlog detection
3850dnl NOTE: the code itself will detect if lastlog is a directory
3851AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3852AC_TRY_COMPILE([
3853#include <sys/types.h>
3854#include <utmp.h>
3855#ifdef HAVE_LASTLOG_H
3856# include <lastlog.h>
3857#endif
Damien Miller2994e082000-06-04 15:51:47 +10003858#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003859# include <paths.h>
3860#endif
Ben Lindstrom19d7b8d2001-08-16 00:09:49 +00003861#ifdef HAVE_LOGIN_H
3862# include <login.h>
3863#endif
andre2ff7b5d2000-06-03 14:57:40 +00003864 ],
3865 [ char *lastlog = LASTLOG_FILE; ],
3866 [ AC_MSG_RESULT(yes) ],
Damien Miller2994e082000-06-04 15:51:47 +10003867 [
3868 AC_MSG_RESULT(no)
3869 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3870 AC_TRY_COMPILE([
3871#include <sys/types.h>
3872#include <utmp.h>
3873#ifdef HAVE_LASTLOG_H
3874# include <lastlog.h>
3875#endif
3876#ifdef HAVE_PATHS_H
3877# include <paths.h>
3878#endif
3879 ],
3880 [ char *lastlog = _PATH_LASTLOG; ],
3881 [ AC_MSG_RESULT(yes) ],
3882 [
andree441aa32000-06-12 22:34:38 +00003883 AC_MSG_RESULT(no)
Damien Miller2994e082000-06-04 15:51:47 +10003884 system_lastlog_path=no
3885 ])
3886 ]
andre2ff7b5d2000-06-03 14:57:40 +00003887)
Damien Miller2994e082000-06-04 15:51:47 +10003888
andre2ff7b5d2000-06-03 14:57:40 +00003889if test -z "$conf_lastlog_location"; then
3890 if test x"$system_lastlog_path" = x"no" ; then
3891 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
Damien Milleredb82922000-06-20 13:25:52 +10003892 if (test -d "$f" || test -f "$f") ; then
andre2ff7b5d2000-06-03 14:57:40 +00003893 conf_lastlog_location=$f
3894 fi
3895 done
3896 if test -z "$conf_lastlog_location"; then
andre45cad512000-06-12 23:27:31 +00003897 AC_MSG_WARN([** Cannot find lastlog **])
3898 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
andre2ff7b5d2000-06-03 14:57:40 +00003899 fi
3900 fi
3901fi
3902
3903if test -n "$conf_lastlog_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003904 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3905 [Define if you want to specify the path to your lastlog file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003906fi
andre2ff7b5d2000-06-03 14:57:40 +00003907
3908dnl utmp detection
3909AC_MSG_CHECKING([if your system defines UTMP_FILE])
3910AC_TRY_COMPILE([
3911#include <sys/types.h>
3912#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003913#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003914# include <paths.h>
3915#endif
3916 ],
3917 [ char *utmp = UTMP_FILE; ],
3918 [ AC_MSG_RESULT(yes) ],
3919 [ AC_MSG_RESULT(no)
3920 system_utmp_path=no ]
3921)
3922if test -z "$conf_utmp_location"; then
3923 if test x"$system_utmp_path" = x"no" ; then
3924 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3925 if test -f $f ; then
3926 conf_utmp_location=$f
3927 fi
3928 done
3929 if test -z "$conf_utmp_location"; then
3930 AC_DEFINE(DISABLE_UTMP)
3931 fi
3932 fi
3933fi
3934if test -n "$conf_utmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003935 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3936 [Define if you want to specify the path to your utmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003937fi
andre2ff7b5d2000-06-03 14:57:40 +00003938
3939dnl wtmp detection
3940AC_MSG_CHECKING([if your system defines WTMP_FILE])
3941AC_TRY_COMPILE([
3942#include <sys/types.h>
3943#include <utmp.h>
Damien Miller2994e082000-06-04 15:51:47 +10003944#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003945# include <paths.h>
3946#endif
3947 ],
3948 [ char *wtmp = WTMP_FILE; ],
3949 [ AC_MSG_RESULT(yes) ],
3950 [ AC_MSG_RESULT(no)
3951 system_wtmp_path=no ]
3952)
3953if test -z "$conf_wtmp_location"; then
3954 if test x"$system_wtmp_path" = x"no" ; then
3955 for f in /usr/adm/wtmp /var/log/wtmp; do
3956 if test -f $f ; then
3957 conf_wtmp_location=$f
3958 fi
3959 done
3960 if test -z "$conf_wtmp_location"; then
3961 AC_DEFINE(DISABLE_WTMP)
3962 fi
3963 fi
3964fi
3965if test -n "$conf_wtmp_location"; then
Tim Rice7df8d392005-09-19 09:33:39 -07003966 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3967 [Define if you want to specify the path to your wtmp file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003968fi
andre2ff7b5d2000-06-03 14:57:40 +00003969
3970
3971dnl utmpx detection - I don't know any system so perverse as to require
3972dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3973dnl there, though.
3974AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3975AC_TRY_COMPILE([
3976#include <sys/types.h>
3977#include <utmp.h>
3978#ifdef HAVE_UTMPX_H
3979#include <utmpx.h>
3980#endif
Damien Miller2994e082000-06-04 15:51:47 +10003981#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00003982# include <paths.h>
3983#endif
3984 ],
3985 [ char *utmpx = UTMPX_FILE; ],
3986 [ AC_MSG_RESULT(yes) ],
3987 [ AC_MSG_RESULT(no)
3988 system_utmpx_path=no ]
3989)
3990if test -z "$conf_utmpx_location"; then
3991 if test x"$system_utmpx_path" = x"no" ; then
3992 AC_DEFINE(DISABLE_UTMPX)
3993 fi
3994else
Tim Rice7df8d392005-09-19 09:33:39 -07003995 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3996 [Define if you want to specify the path to your utmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08003997fi
andre2ff7b5d2000-06-03 14:57:40 +00003998
3999dnl wtmpx detection
4000AC_MSG_CHECKING([if your system defines WTMPX_FILE])
4001AC_TRY_COMPILE([
4002#include <sys/types.h>
4003#include <utmp.h>
4004#ifdef HAVE_UTMPX_H
4005#include <utmpx.h>
4006#endif
Damien Miller2994e082000-06-04 15:51:47 +10004007#ifdef HAVE_PATHS_H
andre2ff7b5d2000-06-03 14:57:40 +00004008# include <paths.h>
4009#endif
4010 ],
4011 [ char *wtmpx = WTMPX_FILE; ],
4012 [ AC_MSG_RESULT(yes) ],
4013 [ AC_MSG_RESULT(no)
4014 system_wtmpx_path=no ]
4015)
4016if test -z "$conf_wtmpx_location"; then
4017 if test x"$system_wtmpx_path" = x"no" ; then
4018 AC_DEFINE(DISABLE_WTMPX)
4019 fi
4020else
Tim Rice7df8d392005-09-19 09:33:39 -07004021 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
4022 [Define if you want to specify the path to your wtmpx file])
Tim Riceeae17cc2005-03-17 16:52:20 -08004023fi
andre2ff7b5d2000-06-03 14:57:40 +00004024
Damien Miller4018c192000-04-30 09:30:44 +10004025
Damien Miller29ea30d2000-03-17 10:54:15 +11004026if test ! -z "$blibpath" ; then
Damien Millereab4bae2003-04-29 23:22:40 +10004027 LDFLAGS="$LDFLAGS $blibflags$blibpath"
4028 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
Damien Miller29ea30d2000-03-17 10:54:15 +11004029fi
4030
Darren Tucker7da23cb2005-08-03 00:20:15 +10004031dnl Adding -Werror to CFLAGS early prevents configure tests from running.
4032dnl Add now.
4033CFLAGS="$CFLAGS $werror_flags"
4034
Damien Millerbac2d8a2000-09-05 16:13:06 +11004035AC_EXEEXT
Damien Miller223897a2006-09-12 21:54:10 +10004036AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openssh.xml \
4037 openbsd-compat/Makefile openbsd-compat/regress/Makefile \
4038 scard/Makefile ssh_prng_cmds survey.sh])
Tim Rice13aae5e2001-10-21 17:53:58 -07004039AC_OUTPUT
Damien Miller0437b332000-05-02 09:56:41 +10004040
Damien Miller7b22d652000-06-18 14:07:04 +10004041# Print summary of options
4042
Damien Miller7b22d652000-06-18 14:07:04 +10004043# Someone please show me a better way :)
4044A=`eval echo ${prefix}` ; A=`eval echo ${A}`
4045B=`eval echo ${bindir}` ; B=`eval echo ${B}`
4046C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
4047D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
Kevin Stevese0f49142000-10-14 17:51:48 +00004048E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
Ben Lindstrombc709922001-04-18 18:04:21 +00004049F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
Damien Miller7b22d652000-06-18 14:07:04 +10004050G=`eval echo ${piddir}` ; G=`eval echo ${G}`
Damien Millerf58c6722002-05-13 13:15:42 +10004051H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
4052I=`eval echo ${user_path}` ; I=`eval echo ${I}`
4053J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
Damien Miller7b22d652000-06-18 14:07:04 +10004054
4055echo ""
Kevin Steves393d2f72001-04-08 22:50:43 +00004056echo "OpenSSH has been configured with the following options:"
Damien Millerf58c6722002-05-13 13:15:42 +10004057echo " User binaries: $B"
4058echo " System binaries: $C"
4059echo " Configuration files: $D"
4060echo " Askpass program: $E"
4061echo " Manual pages: $F"
4062echo " PID file: $G"
4063echo " Privilege separation chroot path: $H"
Darren Tuckere1a790d2003-09-16 11:52:19 +10004064if test "x$external_path_file" = "x/etc/login.conf" ; then
4065echo " At runtime, sshd will use the path defined in $external_path_file"
4066echo " Make sure the path to scp is present, otherwise scp will not work"
Tim Rice43a1c132002-04-17 21:19:14 -07004067else
Damien Millerf58c6722002-05-13 13:15:42 +10004068echo " sshd default user PATH: $I"
Tim Riceb925b4b2003-09-15 22:40:49 -07004069 if test ! -z "$external_path_file"; then
Darren Tuckere1a790d2003-09-16 11:52:19 +10004070echo " (If PATH is set in $external_path_file it will be used instead. If"
4071echo " used, ensure the path to scp is present, otherwise scp will not work.)"
4072 fi
Tim Rice43a1c132002-04-17 21:19:14 -07004073fi
Damien Millera18bbd32002-05-13 10:48:57 +10004074if test ! -z "$superuser_path" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004075echo " sshd superuser user PATH: $J"
Damien Millera18bbd32002-05-13 10:48:57 +10004076fi
Damien Millerf58c6722002-05-13 13:15:42 +10004077echo " Manpage format: $MANTYPE"
Damien Miller7abe09b2003-05-15 10:53:49 +10004078echo " PAM support: $PAM_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004079echo " OSF SIA support: $SIA_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004080echo " KerberosV support: $KRB5_MSG"
Damien Miller73b42d22006-04-22 21:26:08 +10004081echo " SELinux support: $SELINUX_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004082echo " Smartcard support: $SCARD_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004083echo " S/KEY support: $SKEY_MSG"
4084echo " TCP Wrappers support: $TCPW_MSG"
4085echo " MD5 password support: $MD5_MSG"
Darren Tucker16bcc1c2004-11-07 20:14:34 +11004086echo " libedit support: $LIBEDIT_MSG"
Damien Miller1b06dc32006-08-31 03:24:41 +10004087echo " Solaris process contract support: $SPC_MSG"
Damien Miller903e1152002-05-13 14:41:31 +10004088echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
Damien Millerf58c6722002-05-13 13:15:42 +10004089echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
4090echo " BSD Auth support: $BSD_AUTH_MSG"
4091echo " Random number source: $RAND_MSG"
Damien Miller6c21c512002-01-22 21:57:53 +11004092if test ! -z "$USE_RAND_HELPER" ; then
Damien Millerf58c6722002-05-13 13:15:42 +10004093echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
Damien Miller60396b02001-02-18 17:01:00 +11004094fi
4095
Damien Miller7b22d652000-06-18 14:07:04 +10004096echo ""
4097
Ben Lindstrom28bfc0d2000-12-18 19:58:57 +00004098echo " Host: ${host}"
4099echo " Compiler: ${CC}"
4100echo " Compiler flags: ${CFLAGS}"
4101echo "Preprocessor flags: ${CPPFLAGS}"
4102echo " Linker flags: ${LDFLAGS}"
Darren Tucker20e9f972007-03-25 18:26:01 +10004103echo " Libraries: ${LIBS}"
4104if test ! -z "${SSHDLIBS}"; then
4105echo " +for sshd: ${SSHDLIBS}"
4106fi
Damien Miller7b22d652000-06-18 14:07:04 +10004107
4108echo ""
4109
Tim Rice6f1f7582004-05-30 21:38:51 -07004110if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
Darren Tuckercf59d312004-08-29 21:18:09 +10004111 echo "SVR4 style packages are supported with \"make package\""
4112 echo ""
Tim Rice6f1f7582004-05-30 21:38:51 -07004113fi
4114
Damien Miller82cf0ce2000-12-20 13:34:48 +11004115if test "x$PAM_MSG" = "xyes" ; then
Damien Miller6c21c512002-01-22 21:57:53 +11004116 echo "PAM is enabled. You may need to install a PAM control file "
4117 echo "for sshd, otherwise password authentication may fail. "
Damien Millera8e06ce2003-11-21 23:48:55 +11004118 echo "Example PAM control files can be found in the contrib/ "
Damien Miller6c21c512002-01-22 21:57:53 +11004119 echo "subdirectory"
Damien Miller6f9c3372000-10-25 10:06:04 +11004120 echo ""
4121fi
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004122
Damien Miller6c21c512002-01-22 21:57:53 +11004123if test ! -z "$RAND_HELPER_CMDHASH" ; then
4124 echo "WARNING: you are using the builtin random number collection "
4125 echo "service. Please read WARNING.RNG and request that your OS "
4126 echo "vendor includes kernel-based random number collection in "
4127 echo "future versions of your OS."
Ben Lindstrom3ad650a2001-01-03 06:02:51 +00004128 echo ""
4129fi
Damien Miller60396b02001-02-18 17:01:00 +11004130
Damien Millerb4097182004-05-23 14:09:40 +10004131if test ! -z "$NO_PEERCHECK" ; then
Darren Tucker164aa302007-03-21 21:39:57 +11004132 echo "WARNING: the operating system that you are using does not"
4133 echo "appear to support getpeereid(), getpeerucred() or the"
4134 echo "SO_PEERCRED getsockopt() option. These facilities are used to"
4135 echo "enforce security checks to prevent unauthorised connections to"
4136 echo "ssh-agent. Their absence increases the risk that a malicious"
4137 echo "user can connect to your agent."
Damien Millerb4097182004-05-23 14:09:40 +10004138 echo ""
4139fi
4140
Darren Tuckerd9f88912005-02-20 21:01:48 +11004141if test "$AUDIT_MODULE" = "bsm" ; then
4142 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
4143 echo "See the Solaris section in README.platform for details."
4144fi