]> andersk Git - openssh.git/blame_incremental - configure.ac
- (tim) [configure.ac] test for egrep (AC_PROG_EGREP) before first
[openssh.git] / configure.ac
... / ...
CommitLineData
1# $Id$
2#
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.
16
17AC_INIT(OpenSSH, Portable, openssh-unix-dev@mindrot.org)
18AC_CONFIG_SRCDIR([ssh.c])
19
20AC_CONFIG_HEADER(config.h)
21AC_PROG_CC
22AC_CANONICAL_HOST
23AC_C_BIGENDIAN
24
25# Checks for programs.
26AC_PROG_AWK
27AC_PROG_CPP
28AC_PROG_RANLIB
29AC_PROG_INSTALL
30AC_PROG_EGREP
31AC_PATH_PROG(AR, ar)
32AC_PATH_PROG(CAT, cat)
33AC_PATH_PROG(KILL, kill)
34AC_PATH_PROGS(PERL, perl5 perl)
35AC_PATH_PROG(SED, sed)
36AC_SUBST(PERL)
37AC_PATH_PROG(ENT, ent)
38AC_SUBST(ENT)
39AC_PATH_PROG(TEST_MINUS_S_SH, bash)
40AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
41AC_PATH_PROG(TEST_MINUS_S_SH, sh)
42AC_PATH_PROG(SH, sh)
43AC_SUBST(TEST_SHELL,sh)
44
45dnl for buildpkg.sh
46AC_PATH_PROG(PATH_GROUPADD_PROG, groupadd, groupadd,
47 [/usr/sbin${PATH_SEPARATOR}/etc])
48AC_PATH_PROG(PATH_USERADD_PROG, useradd, useradd,
49 [/usr/sbin${PATH_SEPARATOR}/etc])
50AC_CHECK_PROG(MAKE_PACKAGE_SUPPORTED, pkgmk, yes, no)
51if test -x /sbin/sh; then
52 AC_SUBST(STARTUP_SCRIPT_SHELL,/sbin/sh)
53else
54 AC_SUBST(STARTUP_SCRIPT_SHELL,/bin/sh)
55fi
56
57# System features
58AC_SYS_LARGEFILE
59
60if test -z "$AR" ; then
61 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
62fi
63
64# Use LOGIN_PROGRAM from environment if possible
65if test ! -z "$LOGIN_PROGRAM" ; then
66 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM",
67 [If your header files don't define LOGIN_PROGRAM,
68 then use this (detected) from environment and PATH])
69else
70 # Search for login
71 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
72 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
73 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
74 fi
75fi
76
77AC_PATH_PROG(PATH_PASSWD_PROG, passwd)
78if test ! -z "$PATH_PASSWD_PROG" ; then
79 AC_DEFINE_UNQUOTED(_PATH_PASSWD_PROG, "$PATH_PASSWD_PROG",
80 [Full path of your "passwd" program])
81fi
82
83if test -z "$LD" ; then
84 LD=$CC
85fi
86AC_SUBST(LD)
87
88AC_C_INLINE
89
90AC_CHECK_DECL(LLONG_MAX, have_llong_max=1, , [#include <limits.h>])
91
92if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
93 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wuninitialized"
94 GCC_VER=`$CC -v 2>&1 | $AWK '/gcc version /{print $3}'`
95 case $GCC_VER in
96 1.*) ;;
97 2.8* | 2.9*) CFLAGS="$CFLAGS -Wsign-compare" ;;
98 2.*) ;;
99 3.*) CFLAGS="$CFLAGS -Wsign-compare" ;;
100 4.*) CFLAGS="$CFLAGS -Wsign-compare -Wno-pointer-sign" ;;
101 *) ;;
102 esac
103
104 if test -z "$have_llong_max"; then
105 # retry LLONG_MAX with -std=gnu99, needed on some Linuxes
106 unset ac_cv_have_decl_LLONG_MAX
107 saved_CFLAGS="$CFLAGS"
108 CFLAGS="$CFLAGS -std=gnu99"
109 AC_CHECK_DECL(LLONG_MAX,
110 [have_llong_max=1],
111 [CFLAGS="$saved_CFLAGS"],
112 [#include <limits.h>]
113 )
114 fi
115fi
116
117AC_ARG_WITH(rpath,
118 [ --without-rpath Disable auto-added -R linker paths],
119 [
120 if test "x$withval" = "xno" ; then
121 need_dash_r=""
122 fi
123 if test "x$withval" = "xyes" ; then
124 need_dash_r=1
125 fi
126 ]
127)
128
129# Check for some target-specific stuff
130case "$host" in
131*-*-aix*)
132 AC_MSG_CHECKING([how to specify blibpath for linker ($LD)])
133 if (test -z "$blibpath"); then
134 blibpath="/usr/lib:/lib"
135 fi
136 saved_LDFLAGS="$LDFLAGS"
137 for tryflags in -blibpath: -Wl,-blibpath: -Wl,-rpath, ;do
138 if (test -z "$blibflags"); then
139 LDFLAGS="$saved_LDFLAGS $tryflags$blibpath"
140 AC_TRY_LINK([], [], [blibflags=$tryflags])
141 fi
142 done
143 if (test -z "$blibflags"); then
144 AC_MSG_RESULT(not found)
145 AC_MSG_ERROR([*** must be able to specify blibpath on AIX - check config.log])
146 else
147 AC_MSG_RESULT($blibflags)
148 fi
149 LDFLAGS="$saved_LDFLAGS"
150 dnl Check for authenticate. Might be in libs.a on older AIXes
151 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE, 1,
152 [Define if you want to enable AIX4's authenticate function])],
153 [AC_CHECK_LIB(s,authenticate,
154 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
155 LIBS="$LIBS -ls"
156 ])
157 ])
158 dnl Check for various auth function declarations in headers.
159 AC_CHECK_DECLS([authenticate, loginrestrictions, loginsuccess,
160 passwdexpired, setauthdb], , , [#include <usersec.h>])
161 dnl Check if loginfailed is declared and takes 4 arguments (AIX >= 5.2)
162 AC_CHECK_DECLS(loginfailed,
163 [AC_MSG_CHECKING(if loginfailed takes 4 arguments)
164 AC_TRY_COMPILE(
165 [#include <usersec.h>],
166 [(void)loginfailed("user","host","tty",0);],
167 [AC_MSG_RESULT(yes)
168 AC_DEFINE(AIX_LOGINFAILED_4ARG, 1,
169 [Define if your AIX loginfailed() function
170 takes 4 arguments (AIX >= 5.2)])],
171 [AC_MSG_RESULT(no)]
172 )],
173 [],
174 [#include <usersec.h>]
175 )
176 AC_CHECK_FUNCS(setauthdb)
177 check_for_aix_broken_getaddrinfo=1
178 AC_DEFINE(BROKEN_REALPATH, 1, [Define if you have a broken realpath.])
179 AC_DEFINE(SETEUID_BREAKS_SETUID, 1,
180 [Define if your platform breaks doing a seteuid before a setuid])
181 AC_DEFINE(BROKEN_SETREUID, 1, [Define if your setreuid() is broken])
182 AC_DEFINE(BROKEN_SETREGID, 1, [Define if your setregid() is broken])
183 dnl AIX handles lastlog as part of its login message
184 AC_DEFINE(DISABLE_LASTLOG, 1, [Define if you don't want to use lastlog])
185 AC_DEFINE(LOGIN_NEEDS_UTMPX, 1,
186 [Some systems need a utmpx entry for /bin/login to work])
187 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV,
188 [Define to a Set Process Title type if your system is
189 supported by bsd-setproctitle.c])
190 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
191 [AIX 5.2 and 5.3 (and presumably newer) require this])
192 ;;
193*-*-cygwin*)
194 check_for_libcrypt_later=1
195 LIBS="$LIBS /usr/lib/textmode.o"
196 AC_DEFINE(HAVE_CYGWIN, 1, [Define if you are on Cygwin])
197 AC_DEFINE(USE_PIPES, 1, [Use PIPES instead of a socketpair()])
198 AC_DEFINE(DISABLE_SHADOW, 1,
199 [Define if you want to disable shadow passwords])
200 AC_DEFINE(IP_TOS_IS_BROKEN, 1,
201 [Define if your system choked on IP TOS setting])
202 AC_DEFINE(NO_X11_UNIX_SOCKETS, 1,
203 [Define if X11 doesn't support AF_UNIX sockets on that system])
204 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT, 1,
205 [Define if the concept of ports only accessible to
206 superusers isn't known])
207 AC_DEFINE(DISABLE_FD_PASSING, 1,
208 [Define if your platform needs to skip post auth
209 file descriptor passing])
210 ;;
211*-*-dgux*)
212 AC_DEFINE(IP_TOS_IS_BROKEN)
213 AC_DEFINE(SETEUID_BREAKS_SETUID)
214 AC_DEFINE(BROKEN_SETREUID)
215 AC_DEFINE(BROKEN_SETREGID)
216 ;;
217*-*-darwin*)
218 AC_MSG_CHECKING(if we have working getaddrinfo)
219 AC_TRY_RUN([#include <mach-o/dyld.h>
220main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
221 exit(0);
222 else
223 exit(1);
224}], [AC_MSG_RESULT(working)],
225 [AC_MSG_RESULT(buggy)
226 AC_DEFINE(BROKEN_GETADDRINFO, 1, [getaddrinfo is broken (if present)])],
227 [AC_MSG_RESULT(assume it is working)])
228 AC_DEFINE(SETEUID_BREAKS_SETUID)
229 AC_DEFINE(BROKEN_SETREUID)
230 AC_DEFINE(BROKEN_SETREGID)
231 AC_DEFINE_UNQUOTED(BIND_8_COMPAT, 1,
232 [Define if your resolver libs need this for getrrsetbyname])
233 ;;
234*-*-hpux*)
235 # first we define all of the options common to all HP-UX releases
236 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
237 IPADDR_IN_DISPLAY=yes
238 AC_DEFINE(USE_PIPES)
239 AC_DEFINE(LOGIN_NO_ENDOPT, 1,
240 [Define if your login program cannot handle end of options ("--")])
241 AC_DEFINE(LOGIN_NEEDS_UTMPX)
242 AC_DEFINE(LOCKED_PASSWD_STRING, "*",
243 [String used in /etc/passwd to denote locked account])
244 AC_DEFINE(SPT_TYPE,SPT_PSTAT)
245 MAIL="/var/mail/username"
246 LIBS="$LIBS -lsec"
247 AC_CHECK_LIB(xnet, t_error, ,
248 AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
249
250 # next, we define all of the options specific to major releases
251 case "$host" in
252 *-*-hpux10*)
253 if test -z "$GCC"; then
254 CFLAGS="$CFLAGS -Ae"
255 fi
256 ;;
257 *-*-hpux11*)
258 AC_DEFINE(PAM_SUN_CODEBASE, 1,
259 [Define if you are using Solaris-derived PAM which
260 passes pam_messages to the conversation function
261 with an extra level of indirection])
262 AC_DEFINE(DISABLE_UTMP, 1,
263 [Define if you don't want to use utmp])
264 AC_DEFINE(USE_BTMP, 1, [Use btmp to log bad logins])
265 check_for_hpux_broken_getaddrinfo=1
266 check_for_conflicting_getspnam=1
267 ;;
268 esac
269
270 # lastly, we define options specific to minor releases
271 case "$host" in
272 *-*-hpux10.26)
273 AC_DEFINE(HAVE_SECUREWARE, 1,
274 [Define if you have SecureWare-based
275 protected password database])
276 disable_ptmx_check=yes
277 LIBS="$LIBS -lsecpw"
278 ;;
279 esac
280 ;;
281*-*-irix5*)
282 PATH="$PATH:/usr/etc"
283 AC_DEFINE(BROKEN_INET_NTOA, 1,
284 [Define if you system's inet_ntoa is busted
285 (e.g. Irix gcc issue)])
286 AC_DEFINE(SETEUID_BREAKS_SETUID)
287 AC_DEFINE(BROKEN_SETREUID)
288 AC_DEFINE(BROKEN_SETREGID)
289 AC_DEFINE(WITH_ABBREV_NO_TTY, 1,
290 [Define if you shouldn't strip 'tty' from your
291 ttyname in [uw]tmp])
292 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
293 ;;
294*-*-irix6*)
295 PATH="$PATH:/usr/etc"
296 AC_DEFINE(WITH_IRIX_ARRAY, 1,
297 [Define if you have/want arrays
298 (cluster-wide session managment, not C arrays)])
299 AC_DEFINE(WITH_IRIX_PROJECT, 1,
300 [Define if you want IRIX project management])
301 AC_DEFINE(WITH_IRIX_AUDIT, 1,
302 [Define if you want IRIX audit trails])
303 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS, 1,
304 [Define if you want IRIX kernel jobs])])
305 AC_DEFINE(BROKEN_INET_NTOA)
306 AC_DEFINE(SETEUID_BREAKS_SETUID)
307 AC_DEFINE(BROKEN_SETREUID)
308 AC_DEFINE(BROKEN_SETREGID)
309 AC_DEFINE(BROKEN_UPDWTMPX, 1, [updwtmpx is broken (if present)])
310 AC_DEFINE(WITH_ABBREV_NO_TTY)
311 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
312 ;;
313*-*-linux*)
314 no_dev_ptmx=1
315 check_for_libcrypt_later=1
316 check_for_openpty_ctty_bug=1
317 AC_DEFINE(DONT_TRY_OTHER_AF, 1, [Workaround more Linux IPv6 quirks])
318 AC_DEFINE(PAM_TTY_KLUDGE, 1,
319 [Work around problematic Linux PAM modules handling of PAM_TTY])
320 AC_DEFINE(LOCKED_PASSWD_PREFIX, "!",
321 [String used in /etc/passwd to denote locked account])
322 AC_DEFINE(SPT_TYPE,SPT_REUSEARGV)
323 AC_DEFINE(LINK_OPNOTSUPP_ERRNO, EPERM,
324 [Define to whatever link() returns for "not supported"
325 if it doesn't return EOPNOTSUPP.])
326 AC_DEFINE(_PATH_BTMP, "/var/log/btmp", [log for bad login attempts])
327 AC_DEFINE(USE_BTMP)
328 inet6_default_4in6=yes
329 case `uname -r` in
330 1.*|2.0.*)
331 AC_DEFINE(BROKEN_CMSG_TYPE, 1,
332 [Define if cmsg_type is not passed correctly])
333 ;;
334 esac
335 # tun(4) forwarding compat code
336 AC_CHECK_HEADERS(linux/if_tun.h)
337 if test "x$ac_cv_header_linux_if_tun_h" = "xyes" ; then
338 AC_DEFINE(SSH_TUN_LINUX, 1,
339 [Open tunnel devices the Linux tun/tap way])
340 AC_DEFINE(SSH_TUN_COMPAT_AF, 1,
341 [Use tunnel device compatibility to OpenBSD])
342 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
343 [Prepend the address family to IP tunnel traffic])
344 fi
345 ;;
346mips-sony-bsd|mips-sony-newsos4)
347 AC_DEFINE(NEED_SETPRGP, 1, [Need setpgrp to acquire controlling tty])
348 SONY=1
349 ;;
350*-*-netbsd*)
351 check_for_libcrypt_before=1
352 if test "x$withval" != "xno" ; then
353 need_dash_r=1
354 fi
355 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
356 AC_CHECK_HEADER([net/if_tap.h], ,
357 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
358 AC_DEFINE(SSH_TUN_PREPEND_AF, 1,
359 [Prepend the address family to IP tunnel traffic])
360 ;;
361*-*-freebsd*)
362 check_for_libcrypt_later=1
363 AC_DEFINE(LOCKED_PASSWD_PREFIX, "*LOCKED*", [Account locked with pw(1)])
364 AC_DEFINE(SSH_TUN_FREEBSD, 1, [Open tunnel devices the FreeBSD way])
365 AC_CHECK_HEADER([net/if_tap.h], ,
366 AC_DEFINE(SSH_TUN_NO_L2, 1, [No layer 2 tunnel support]))
367 ;;
368*-*-bsdi*)
369 AC_DEFINE(SETEUID_BREAKS_SETUID)
370 AC_DEFINE(BROKEN_SETREUID)
371 AC_DEFINE(BROKEN_SETREGID)
372 ;;
373*-next-*)
374 conf_lastlog_location="/usr/adm/lastlog"
375 conf_utmp_location=/etc/utmp
376 conf_wtmp_location=/usr/adm/wtmp
377 MAIL=/usr/spool/mail
378 AC_DEFINE(HAVE_NEXT, 1, [Define if you are on NeXT])
379 AC_DEFINE(BROKEN_REALPATH)
380 AC_DEFINE(USE_PIPES)
381 AC_DEFINE(BROKEN_SAVED_UIDS, 1, [Needed for NeXT])
382 ;;
383*-*-openbsd*)
384 AC_DEFINE(HAVE_ATTRIBUTE__SENTINEL__, 1, [OpenBSD's gcc has sentinel])
385 AC_DEFINE(HAVE_ATTRIBUTE__BOUNDED__, 1, [OpenBSD's gcc has bounded])
386 AC_DEFINE(SSH_TUN_OPENBSD, 1, [Open tunnel devices the OpenBSD way])
387 ;;
388*-*-solaris*)
389 if test "x$withval" != "xno" ; then
390 need_dash_r=1
391 fi
392 AC_DEFINE(PAM_SUN_CODEBASE)
393 AC_DEFINE(LOGIN_NEEDS_UTMPX)
394 AC_DEFINE(LOGIN_NEEDS_TERM, 1,
395 [Some versions of /bin/login need the TERM supplied
396 on the commandline])
397 AC_DEFINE(PAM_TTY_KLUDGE)
398 AC_DEFINE(SSHPAM_CHAUTHTOK_NEEDS_RUID, 1,
399 [Define if pam_chauthtok wants real uid set
400 to the unpriv'ed user])
401 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
402 # Pushing STREAMS modules will cause sshd to acquire a controlling tty.
403 AC_DEFINE(SSHD_ACQUIRES_CTTY, 1,
404 [Define if sshd somehow reacquires a controlling TTY
405 after setsid()])
406 external_path_file=/etc/default/login
407 # hardwire lastlog location (can't detect it on some versions)
408 conf_lastlog_location="/var/adm/lastlog"
409 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
410 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
411 if test "$sol2ver" -ge 8; then
412 AC_MSG_RESULT(yes)
413 AC_DEFINE(DISABLE_UTMP)
414 AC_DEFINE(DISABLE_WTMP, 1,
415 [Define if you don't want to use wtmp])
416 else
417 AC_MSG_RESULT(no)
418 fi
419 ;;
420*-*-sunos4*)
421 CPPFLAGS="$CPPFLAGS -DSUNOS4"
422 AC_CHECK_FUNCS(getpwanam)
423 AC_DEFINE(PAM_SUN_CODEBASE)
424 conf_utmp_location=/etc/utmp
425 conf_wtmp_location=/var/adm/wtmp
426 conf_lastlog_location=/var/adm/lastlog
427 AC_DEFINE(USE_PIPES)
428 ;;
429*-ncr-sysv*)
430 LIBS="$LIBS -lc89"
431 AC_DEFINE(USE_PIPES)
432 AC_DEFINE(SSHD_ACQUIRES_CTTY)
433 AC_DEFINE(SETEUID_BREAKS_SETUID)
434 AC_DEFINE(BROKEN_SETREUID)
435 AC_DEFINE(BROKEN_SETREGID)
436 ;;
437*-sni-sysv*)
438 # /usr/ucblib MUST NOT be searched on ReliantUNIX
439 AC_CHECK_LIB(dl, dlsym, ,)
440 # -lresolv needs to be at the end of LIBS or DNS lookups break
441 AC_CHECK_LIB(resolv, res_query, [ LIBS="$LIBS -lresolv" ])
442 IPADDR_IN_DISPLAY=yes
443 AC_DEFINE(USE_PIPES)
444 AC_DEFINE(IP_TOS_IS_BROKEN)
445 AC_DEFINE(SETEUID_BREAKS_SETUID)
446 AC_DEFINE(BROKEN_SETREUID)
447 AC_DEFINE(BROKEN_SETREGID)
448 AC_DEFINE(SSHD_ACQUIRES_CTTY)
449 external_path_file=/etc/default/login
450 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
451 # Attention: always take care to bind libsocket and libnsl before libc,
452 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
453 ;;
454# UnixWare 1.x, UnixWare 2.x, and others based on code from Univel.
455*-*-sysv4.2*)
456 CFLAGS="$CFLAGS -Dva_list=_VA_LIST"
457 AC_DEFINE(USE_PIPES)
458 AC_DEFINE(SETEUID_BREAKS_SETUID)
459 AC_DEFINE(BROKEN_SETREUID)
460 AC_DEFINE(BROKEN_SETREGID)
461 AC_DEFINE(PASSWD_NEEDS_USERNAME, 1, [must supply username to passwd])
462 AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
463 ;;
464# UnixWare 7.x, OpenUNIX 8
465*-*-sysv5*)
466 check_for_libcrypt_later=1
467 AC_DEFINE(UNIXWARE_LONG_PASSWORDS, 1, [Support passwords > 8 chars])
468 AC_DEFINE(USE_PIPES)
469 AC_DEFINE(SETEUID_BREAKS_SETUID)
470 AC_DEFINE(BROKEN_SETREUID)
471 AC_DEFINE(BROKEN_SETREGID)
472 AC_DEFINE(PASSWD_NEEDS_USERNAME)
473 case "$host" in
474 *-*-sysv5SCO_SV*) # SCO OpenServer 6.x
475 TEST_SHELL=/u95/bin/sh
476 AC_DEFINE(BROKEN_LIBIAF, 1,
477 [ia_uinfo routines not supported by OS yet])
478 ;;
479 *) AC_DEFINE(LOCKED_PASSWD_STRING, "*LK*")
480 ;;
481 esac
482 ;;
483*-*-sysv*)
484 ;;
485# SCO UNIX and OEM versions of SCO UNIX
486*-*-sco3.2v4*)
487 AC_MSG_ERROR("This Platform is no longer supported.")
488 ;;
489# SCO OpenServer 5.x
490*-*-sco3.2v5*)
491 if test -z "$GCC"; then
492 CFLAGS="$CFLAGS -belf"
493 fi
494 LIBS="$LIBS -lprot -lx -ltinfo -lm"
495 no_dev_ptmx=1
496 AC_DEFINE(USE_PIPES)
497 AC_DEFINE(HAVE_SECUREWARE)
498 AC_DEFINE(DISABLE_SHADOW)
499 AC_DEFINE(DISABLE_FD_PASSING)
500 AC_DEFINE(SETEUID_BREAKS_SETUID)
501 AC_DEFINE(BROKEN_SETREUID)
502 AC_DEFINE(BROKEN_SETREGID)
503 AC_DEFINE(WITH_ABBREV_NO_TTY)
504 AC_DEFINE(BROKEN_UPDWTMPX)
505 AC_DEFINE(PASSWD_NEEDS_USERNAME)
506 AC_CHECK_FUNCS(getluid setluid)
507 MANTYPE=man
508 TEST_SHELL=ksh
509 ;;
510*-*-unicosmk*)
511 AC_DEFINE(NO_SSH_LASTLOG, 1,
512 [Define if you don't want to use lastlog in session.c])
513 AC_DEFINE(SETEUID_BREAKS_SETUID)
514 AC_DEFINE(BROKEN_SETREUID)
515 AC_DEFINE(BROKEN_SETREGID)
516 AC_DEFINE(USE_PIPES)
517 AC_DEFINE(DISABLE_FD_PASSING)
518 LDFLAGS="$LDFLAGS"
519 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
520 MANTYPE=cat
521 ;;
522*-*-unicosmp*)
523 AC_DEFINE(SETEUID_BREAKS_SETUID)
524 AC_DEFINE(BROKEN_SETREUID)
525 AC_DEFINE(BROKEN_SETREGID)
526 AC_DEFINE(WITH_ABBREV_NO_TTY)
527 AC_DEFINE(USE_PIPES)
528 AC_DEFINE(DISABLE_FD_PASSING)
529 LDFLAGS="$LDFLAGS"
530 LIBS="$LIBS -lgen -lacid -ldb"
531 MANTYPE=cat
532 ;;
533*-*-unicos*)
534 AC_DEFINE(SETEUID_BREAKS_SETUID)
535 AC_DEFINE(BROKEN_SETREUID)
536 AC_DEFINE(BROKEN_SETREGID)
537 AC_DEFINE(USE_PIPES)
538 AC_DEFINE(DISABLE_FD_PASSING)
539 AC_DEFINE(NO_SSH_LASTLOG)
540 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
541 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
542 MANTYPE=cat
543 ;;
544*-dec-osf*)
545 AC_MSG_CHECKING(for Digital Unix SIA)
546 no_osfsia=""
547 AC_ARG_WITH(osfsia,
548 [ --with-osfsia Enable Digital Unix SIA],
549 [
550 if test "x$withval" = "xno" ; then
551 AC_MSG_RESULT(disabled)
552 no_osfsia=1
553 fi
554 ],
555 )
556 if test -z "$no_osfsia" ; then
557 if test -f /etc/sia/matrix.conf; then
558 AC_MSG_RESULT(yes)
559 AC_DEFINE(HAVE_OSF_SIA, 1,
560 [Define if you have Digital Unix Security
561 Integration Architecture])
562 AC_DEFINE(DISABLE_LOGIN, 1,
563 [Define if you don't want to use your
564 system's login() call])
565 AC_DEFINE(DISABLE_FD_PASSING)
566 LIBS="$LIBS -lsecurity -ldb -lm -laud"
567 else
568 AC_MSG_RESULT(no)
569 AC_DEFINE(LOCKED_PASSWD_SUBSTR, "Nologin",
570 [String used in /etc/passwd to denote locked account])
571 fi
572 fi
573 AC_DEFINE(BROKEN_GETADDRINFO)
574 AC_DEFINE(SETEUID_BREAKS_SETUID)
575 AC_DEFINE(BROKEN_SETREUID)
576 AC_DEFINE(BROKEN_SETREGID)
577 ;;
578
579*-*-nto-qnx)
580 AC_DEFINE(USE_PIPES)
581 AC_DEFINE(NO_X11_UNIX_SOCKETS)
582 AC_DEFINE(MISSING_NFDBITS, 1, [Define on *nto-qnx systems])
583 AC_DEFINE(MISSING_HOWMANY, 1, [Define on *nto-qnx systems])
584 AC_DEFINE(MISSING_FD_MASK, 1, [Define on *nto-qnx systems])
585 ;;
586
587*-*-ultrix*)
588 AC_DEFINE(BROKEN_GETGROUPS, 1, [getgroups(0,NULL) will return -1])
589 AC_DEFINE(BROKEN_MMAP, 1, [Ultrix mmap can't map files])
590 AC_DEFINE(NEED_SETPRGP)
591 AC_DEFINE(HAVE_SYS_SYSLOG_H, 1, [Force use of sys/syslog.h on Ultrix])
592 ;;
593
594*-*-lynxos)
595 CFLAGS="$CFLAGS -D__NO_INCLUDE_WARN__"
596 AC_DEFINE(MISSING_HOWMANY)
597 AC_DEFINE(BROKEN_SETVBUF, 1, [LynxOS has broken setvbuf() implementation])
598 ;;
599esac
600
601# Allow user to specify flags
602AC_ARG_WITH(cflags,
603 [ --with-cflags Specify additional flags to pass to compiler],
604 [
605 if test -n "$withval" && test "x$withval" != "xno" && \
606 test "x${withval}" != "xyes"; then
607 CFLAGS="$CFLAGS $withval"
608 fi
609 ]
610)
611AC_ARG_WITH(cppflags,
612 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
613 [
614 if test -n "$withval" && test "x$withval" != "xno" && \
615 test "x${withval}" != "xyes"; then
616 CPPFLAGS="$CPPFLAGS $withval"
617 fi
618 ]
619)
620AC_ARG_WITH(ldflags,
621 [ --with-ldflags Specify additional flags to pass to linker],
622 [
623 if test -n "$withval" && test "x$withval" != "xno" && \
624 test "x${withval}" != "xyes"; then
625 LDFLAGS="$LDFLAGS $withval"
626 fi
627 ]
628)
629AC_ARG_WITH(libs,
630 [ --with-libs Specify additional libraries to link with],
631 [
632 if test -n "$withval" && test "x$withval" != "xno" && \
633 test "x${withval}" != "xyes"; then
634 LIBS="$LIBS $withval"
635 fi
636 ]
637)
638AC_ARG_WITH(Werror,
639 [ --with-Werror Build main code with -Werror],
640 [
641 if test -n "$withval" && test "x$withval" != "xno"; then
642 werror_flags="-Werror"
643 if test "x${withval}" != "xyes"; then
644 werror_flags="$withval"
645 fi
646 fi
647 ]
648)
649
650AC_MSG_CHECKING(compiler and flags for sanity)
651AC_RUN_IFELSE(
652 [AC_LANG_SOURCE([
653#include <stdio.h>
654int main(){exit(0);}
655 ])],
656 [ AC_MSG_RESULT(yes) ],
657 [
658 AC_MSG_RESULT(no)
659 AC_MSG_ERROR([*** compiler cannot create working executables, check config.log ***])
660 ],
661 [ AC_MSG_WARN([cross compiling: not checking compiler sanity]) ]
662)
663
664dnl Checks for header files.
665AC_CHECK_HEADERS( \
666 bstring.h \
667 crypt.h \
668 dirent.h \
669 endian.h \
670 features.h \
671 floatingpoint.h \
672 getopt.h \
673 glob.h \
674 ia.h \
675 iaf.h \
676 lastlog.h \
677 limits.h \
678 login.h \
679 login_cap.h \
680 maillock.h \
681 ndir.h \
682 net/if.h \
683 netdb.h \
684 netgroup.h \
685 netinet/in_systm.h \
686 pam/pam_appl.h \
687 paths.h \
688 pty.h \
689 readpassphrase.h \
690 rpc/types.h \
691 security/pam_appl.h \
692 shadow.h \
693 stddef.h \
694 stdint.h \
695 string.h \
696 strings.h \
697 sys/audit.h \
698 sys/bitypes.h \
699 sys/bsdtty.h \
700 sys/cdefs.h \
701 sys/dir.h \
702 sys/mman.h \
703 sys/ndir.h \
704 sys/prctl.h \
705 sys/pstat.h \
706 sys/select.h \
707 sys/stat.h \
708 sys/stream.h \
709 sys/stropts.h \
710 sys/strtio.h \
711 sys/sysmacros.h \
712 sys/time.h \
713 sys/timers.h \
714 sys/un.h \
715 time.h \
716 tmpdir.h \
717 ttyent.h \
718 unistd.h \
719 usersec.h \
720 util.h \
721 utime.h \
722 utmp.h \
723 utmpx.h \
724 vis.h \
725)
726
727# sys/ptms.h requires sys/stream.h to be included first on Solaris
728AC_CHECK_HEADERS(sys/ptms.h, [], [], [
729#ifdef HAVE_SYS_STREAM_H
730# include <sys/stream.h>
731#endif
732])
733
734# Checks for libraries.
735AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
736AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
737
738dnl IRIX and Solaris 2.5.1 have dirname() in libgen
739AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
740 AC_CHECK_LIB(gen, dirname,[
741 AC_CACHE_CHECK([for broken dirname],
742 ac_cv_have_broken_dirname, [
743 save_LIBS="$LIBS"
744 LIBS="$LIBS -lgen"
745 AC_RUN_IFELSE(
746 [AC_LANG_SOURCE([[
747#include <libgen.h>
748#include <string.h>
749
750int main(int argc, char **argv) {
751 char *s, buf[32];
752
753 strncpy(buf,"/etc", 32);
754 s = dirname(buf);
755 if (!s || strncmp(s, "/", 32) != 0) {
756 exit(1);
757 } else {
758 exit(0);
759 }
760}
761 ]])],
762 [ ac_cv_have_broken_dirname="no" ],
763 [ ac_cv_have_broken_dirname="yes" ],
764 [ ac_cv_have_broken_dirname="no" ],
765 )
766 LIBS="$save_LIBS"
767 ])
768 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
769 LIBS="$LIBS -lgen"
770 AC_DEFINE(HAVE_DIRNAME)
771 AC_CHECK_HEADERS(libgen.h)
772 fi
773 ])
774])
775
776AC_CHECK_FUNC(getspnam, ,
777 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
778AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME, 1,
779 [Define if you have the basename function.]))
780
781dnl zlib is required
782AC_ARG_WITH(zlib,
783 [ --with-zlib=PATH Use zlib in PATH],
784 [ if test "x$withval" = "xno" ; then
785 AC_MSG_ERROR([*** zlib is required ***])
786 elif test "x$withval" != "xyes"; then
787 if test -d "$withval/lib"; then
788 if test -n "${need_dash_r}"; then
789 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
790 else
791 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
792 fi
793 else
794 if test -n "${need_dash_r}"; then
795 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
796 else
797 LDFLAGS="-L${withval} ${LDFLAGS}"
798 fi
799 fi
800 if test -d "$withval/include"; then
801 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
802 else
803 CPPFLAGS="-I${withval} ${CPPFLAGS}"
804 fi
805 fi ]
806)
807
808AC_CHECK_LIB(z, deflate, ,
809 [
810 saved_CPPFLAGS="$CPPFLAGS"
811 saved_LDFLAGS="$LDFLAGS"
812 save_LIBS="$LIBS"
813 dnl Check default zlib install dir
814 if test -n "${need_dash_r}"; then
815 LDFLAGS="-L/usr/local/lib -R/usr/local/lib ${saved_LDFLAGS}"
816 else
817 LDFLAGS="-L/usr/local/lib ${saved_LDFLAGS}"
818 fi
819 CPPFLAGS="-I/usr/local/include ${saved_CPPFLAGS}"
820 LIBS="$LIBS -lz"
821 AC_TRY_LINK_FUNC(deflate, AC_DEFINE(HAVE_LIBZ),
822 [
823 AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***])
824 ]
825 )
826 ]
827)
828AC_CHECK_HEADER([zlib.h], ,AC_MSG_ERROR([*** zlib.h missing - please install first or check config.log ***]))
829
830AC_ARG_WITH(zlib-version-check,
831 [ --without-zlib-version-check Disable zlib version check],
832 [ if test "x$withval" = "xno" ; then
833 zlib_check_nonfatal=1
834 fi
835 ]
836)
837
838AC_MSG_CHECKING(for possibly buggy zlib)
839AC_RUN_IFELSE([AC_LANG_SOURCE([[
840#include <stdio.h>
841#include <zlib.h>
842int main()
843{
844 int a=0, b=0, c=0, d=0, n, v;
845 n = sscanf(ZLIB_VERSION, "%d.%d.%d.%d", &a, &b, &c, &d);
846 if (n != 3 && n != 4)
847 exit(1);
848 v = a*1000000 + b*10000 + c*100 + d;
849 fprintf(stderr, "found zlib version %s (%d)\n", ZLIB_VERSION, v);
850
851 /* 1.1.4 is OK */
852 if (a == 1 && b == 1 && c >= 4)
853 exit(0);
854
855 /* 1.2.3 and up are OK */
856 if (v >= 1020300)
857 exit(0);
858
859 exit(2);
860}
861 ]])],
862 AC_MSG_RESULT(no),
863 [ AC_MSG_RESULT(yes)
864 if test -z "$zlib_check_nonfatal" ; then
865 AC_MSG_ERROR([*** zlib too old - check config.log ***
866Your reported zlib version has known security problems. It's possible your
867vendor has fixed these problems without changing the version number. If you
868are sure this is the case, you can disable the check by running
869"./configure --without-zlib-version-check".
870If you are in doubt, upgrade zlib to version 1.2.3 or greater.
871See http://www.gzip.org/zlib/ for details.])
872 else
873 AC_MSG_WARN([zlib version may have security problems])
874 fi
875 ],
876 [ AC_MSG_WARN([cross compiling: not checking zlib version]) ]
877)
878
879dnl UnixWare 2.x
880AC_CHECK_FUNC(strcasecmp,
881 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
882)
883AC_CHECK_FUNCS(utimes,
884 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
885 LIBS="$LIBS -lc89"]) ]
886)
887
888dnl Checks for libutil functions
889AC_CHECK_HEADERS(libutil.h)
890AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN, 1,
891 [Define if your libraries define login()])])
892AC_CHECK_FUNCS(logout updwtmp logwtmp)
893
894AC_FUNC_STRFTIME
895
896# Check for ALTDIRFUNC glob() extension
897AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
898AC_EGREP_CPP(FOUNDIT,
899 [
900 #include <glob.h>
901 #ifdef GLOB_ALTDIRFUNC
902 FOUNDIT
903 #endif
904 ],
905 [
906 AC_DEFINE(GLOB_HAS_ALTDIRFUNC, 1,
907 [Define if your system glob() function has
908 the GLOB_ALTDIRFUNC extension])
909 AC_MSG_RESULT(yes)
910 ],
911 [
912 AC_MSG_RESULT(no)
913 ]
914)
915
916# Check for g.gl_matchc glob() extension
917AC_MSG_CHECKING(for gl_matchc field in glob_t)
918AC_EGREP_CPP(FOUNDIT,
919 [
920 #include <glob.h>
921 int main(void){glob_t g; g.gl_matchc = 1;}
922 ],
923 [
924 AC_DEFINE(GLOB_HAS_GL_MATCHC, 1,
925 [Define if your system glob() function has
926 gl_matchc options in glob_t])
927 AC_MSG_RESULT(yes)
928 ],
929 [
930 AC_MSG_RESULT(no)
931 ]
932)
933
934AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
935AC_RUN_IFELSE(
936 [AC_LANG_SOURCE([[
937#include <sys/types.h>
938#include <dirent.h>
939int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
940 ]])],
941 [AC_MSG_RESULT(yes)],
942 [
943 AC_MSG_RESULT(no)
944 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME, 1,
945 [Define if your struct dirent expects you to
946 allocate extra space for d_name])
947 ],
948 [
949 AC_MSG_WARN([cross compiling: assuming BROKEN_ONE_BYTE_DIRENT_D_NAME])
950 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
951 ]
952)
953
954AC_MSG_CHECKING([for /proc/pid/fd directory])
955if test -d "/proc/$$/fd" ; then
956 AC_DEFINE(HAVE_PROC_PID, 1, [Define if you have /proc/$pid/fd])
957 AC_MSG_RESULT(yes)
958else
959 AC_MSG_RESULT(no)
960fi
961
962# Check whether user wants S/Key support
963SKEY_MSG="no"
964AC_ARG_WITH(skey,
965 [ --with-skey[[=PATH]] Enable S/Key support (optionally in PATH)],
966 [
967 if test "x$withval" != "xno" ; then
968
969 if test "x$withval" != "xyes" ; then
970 CPPFLAGS="$CPPFLAGS -I${withval}/include"
971 LDFLAGS="$LDFLAGS -L${withval}/lib"
972 fi
973
974 AC_DEFINE(SKEY, 1, [Define if you want S/Key support])
975 LIBS="-lskey $LIBS"
976 SKEY_MSG="yes"
977
978 AC_MSG_CHECKING([for s/key support])
979 AC_LINK_IFELSE(
980 [AC_LANG_SOURCE([[
981#include <stdio.h>
982#include <skey.h>
983int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
984 ]])],
985 [AC_MSG_RESULT(yes)],
986 [
987 AC_MSG_RESULT(no)
988 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
989 ])
990 AC_MSG_CHECKING(if skeychallenge takes 4 arguments)
991 AC_TRY_COMPILE(
992 [#include <stdio.h>
993 #include <skey.h>],
994 [(void)skeychallenge(NULL,"name","",0);],
995 [AC_MSG_RESULT(yes)
996 AC_DEFINE(SKEYCHALLENGE_4ARG, 1,
997 [Define if your skeychallenge()
998 function takes 4 arguments (NetBSD)])],
999 [AC_MSG_RESULT(no)]
1000 )
1001 fi
1002 ]
1003)
1004
1005# Check whether user wants TCP wrappers support
1006TCPW_MSG="no"
1007AC_ARG_WITH(tcp-wrappers,
1008 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support (optionally in PATH)],
1009 [
1010 if test "x$withval" != "xno" ; then
1011 saved_LIBS="$LIBS"
1012 saved_LDFLAGS="$LDFLAGS"
1013 saved_CPPFLAGS="$CPPFLAGS"
1014 if test -n "${withval}" && \
1015 test "x${withval}" != "xyes"; then
1016 if test -d "${withval}/lib"; then
1017 if test -n "${need_dash_r}"; then
1018 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1019 else
1020 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1021 fi
1022 else
1023 if test -n "${need_dash_r}"; then
1024 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1025 else
1026 LDFLAGS="-L${withval} ${LDFLAGS}"
1027 fi
1028 fi
1029 if test -d "${withval}/include"; then
1030 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1031 else
1032 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1033 fi
1034 fi
1035 LIBWRAP="-lwrap"
1036 LIBS="$LIBWRAP $LIBS"
1037 AC_MSG_CHECKING(for libwrap)
1038 AC_TRY_LINK(
1039 [
1040#include <sys/types.h>
1041#include <sys/socket.h>
1042#include <netinet/in.h>
1043#include <tcpd.h>
1044 int deny_severity = 0, allow_severity = 0;
1045 ],
1046 [hosts_access(0);],
1047 [
1048 AC_MSG_RESULT(yes)
1049 AC_DEFINE(LIBWRAP, 1,
1050 [Define if you want
1051 TCP Wrappers support])
1052 AC_SUBST(LIBWRAP)
1053 TCPW_MSG="yes"
1054 ],
1055 [
1056 AC_MSG_ERROR([*** libwrap missing])
1057 ]
1058 )
1059 LIBS="$saved_LIBS"
1060 fi
1061 ]
1062)
1063
1064# Check whether user wants libedit support
1065LIBEDIT_MSG="no"
1066AC_ARG_WITH(libedit,
1067 [ --with-libedit[[=PATH]] Enable libedit support for sftp],
1068 [ if test "x$withval" != "xno" ; then
1069 if test "x$withval" != "xyes"; then
1070 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1071 if test -n "${need_dash_r}"; then
1072 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1073 else
1074 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1075 fi
1076 fi
1077 AC_CHECK_LIB(edit, el_init,
1078 [ AC_DEFINE(USE_LIBEDIT, 1, [Use libedit for sftp])
1079 LIBEDIT="-ledit -lcurses"
1080 LIBEDIT_MSG="yes"
1081 AC_SUBST(LIBEDIT)
1082 ],
1083 [ AC_MSG_ERROR(libedit not found) ],
1084 [ -lcurses ]
1085 )
1086 AC_MSG_CHECKING(if libedit version is compatible)
1087 AC_COMPILE_IFELSE(
1088 [AC_LANG_SOURCE([[
1089#include <histedit.h>
1090int main(void)
1091{
1092 int i = H_SETSIZE;
1093 el_init("", NULL, NULL, NULL);
1094 exit(0);
1095}
1096 ]])],
1097 [ AC_MSG_RESULT(yes) ],
1098 [ AC_MSG_RESULT(no)
1099 AC_MSG_ERROR(libedit version is not compatible) ]
1100 )
1101 fi ]
1102)
1103
1104AUDIT_MODULE=none
1105AC_ARG_WITH(audit,
1106 [ --with-audit=module Enable EXPERIMENTAL audit support (modules=debug,bsm)],
1107 [
1108 AC_MSG_CHECKING(for supported audit module)
1109 case "$withval" in
1110 bsm)
1111 AC_MSG_RESULT(bsm)
1112 AUDIT_MODULE=bsm
1113 dnl Checks for headers, libs and functions
1114 AC_CHECK_HEADERS(bsm/audit.h, [],
1115 [AC_MSG_ERROR(BSM enabled and bsm/audit.h not found)])
1116 AC_CHECK_LIB(bsm, getaudit, [],
1117 [AC_MSG_ERROR(BSM enabled and required library not found)])
1118 AC_CHECK_FUNCS(getaudit, [],
1119 [AC_MSG_ERROR(BSM enabled and required function not found)])
1120 # These are optional
1121 AC_CHECK_FUNCS(getaudit_addr)
1122 AC_DEFINE(USE_BSM_AUDIT, 1, [Use BSM audit module])
1123 ;;
1124 debug)
1125 AUDIT_MODULE=debug
1126 AC_MSG_RESULT(debug)
1127 AC_DEFINE(SSH_AUDIT_EVENTS, 1, Use audit debugging module)
1128 ;;
1129 no)
1130 AC_MSG_RESULT(no)
1131 ;;
1132 *)
1133 AC_MSG_ERROR([Unknown audit module $withval])
1134 ;;
1135 esac ]
1136)
1137
1138dnl Checks for library functions. Please keep in alphabetical order
1139AC_CHECK_FUNCS( \
1140 arc4random \
1141 asprintf \
1142 b64_ntop \
1143 __b64_ntop \
1144 b64_pton \
1145 __b64_pton \
1146 bcopy \
1147 bindresvport_sa \
1148 clock \
1149 closefrom \
1150 dirfd \
1151 fchmod \
1152 fchown \
1153 freeaddrinfo \
1154 futimes \
1155 getaddrinfo \
1156 getcwd \
1157 getgrouplist \
1158 getnameinfo \
1159 getopt \
1160 getpeereid \
1161 _getpty \
1162 getrlimit \
1163 getttyent \
1164 glob \
1165 inet_aton \
1166 inet_ntoa \
1167 inet_ntop \
1168 innetgr \
1169 login_getcapbool \
1170 md5_crypt \
1171 memmove \
1172 mkdtemp \
1173 mmap \
1174 ngetaddrinfo \
1175 nsleep \
1176 ogetaddrinfo \
1177 openlog_r \
1178 openpty \
1179 prctl \
1180 pstat \
1181 readpassphrase \
1182 realpath \
1183 recvmsg \
1184 rresvport_af \
1185 sendmsg \
1186 setdtablesize \
1187 setegid \
1188 setenv \
1189 seteuid \
1190 setgroups \
1191 setlogin \
1192 setpcred \
1193 setproctitle \
1194 setregid \
1195 setreuid \
1196 setrlimit \
1197 setsid \
1198 setvbuf \
1199 sigaction \
1200 sigvec \
1201 snprintf \
1202 socketpair \
1203 strdup \
1204 strerror \
1205 strlcat \
1206 strlcpy \
1207 strmode \
1208 strnvis \
1209 strtonum \
1210 strtoll \
1211 strtoul \
1212 sysconf \
1213 tcgetpgrp \
1214 truncate \
1215 unsetenv \
1216 updwtmpx \
1217 vasprintf \
1218 vhangup \
1219 vsnprintf \
1220 waitpid \
1221)
1222
1223# IRIX has a const char return value for gai_strerror()
1224AC_CHECK_FUNCS(gai_strerror,[
1225 AC_DEFINE(HAVE_GAI_STRERROR)
1226 AC_TRY_COMPILE([
1227#include <sys/types.h>
1228#include <sys/socket.h>
1229#include <netdb.h>
1230
1231const char *gai_strerror(int);],[
1232char *str;
1233
1234str = gai_strerror(0);],[
1235 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
1236 [Define if gai_strerror() returns const char *])])])
1237
1238AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP, 1,
1239 [Some systems put nanosleep outside of libc]))
1240
1241dnl Make sure prototypes are defined for these before using them.
1242AC_CHECK_DECL(getrusage, [AC_CHECK_FUNCS(getrusage)])
1243AC_CHECK_DECL(strsep,
1244 [AC_CHECK_FUNCS(strsep)],
1245 [],
1246 [
1247#ifdef HAVE_STRING_H
1248# include <string.h>
1249#endif
1250 ])
1251
1252dnl tcsendbreak might be a macro
1253AC_CHECK_DECL(tcsendbreak,
1254 [AC_DEFINE(HAVE_TCSENDBREAK)],
1255 [AC_CHECK_FUNCS(tcsendbreak)],
1256 [#include <termios.h>]
1257)
1258
1259AC_CHECK_DECLS(h_errno, , ,[#include <netdb.h>])
1260
1261AC_CHECK_FUNCS(setresuid, [
1262 dnl Some platorms have setresuid that isn't implemented, test for this
1263 AC_MSG_CHECKING(if setresuid seems to work)
1264 AC_RUN_IFELSE(
1265 [AC_LANG_SOURCE([[
1266#include <stdlib.h>
1267#include <errno.h>
1268int main(){errno=0; setresuid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1269 ]])],
1270 [AC_MSG_RESULT(yes)],
1271 [AC_DEFINE(BROKEN_SETRESUID, 1,
1272 [Define if your setresuid() is broken])
1273 AC_MSG_RESULT(not implemented)],
1274 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1275 )
1276])
1277
1278AC_CHECK_FUNCS(setresgid, [
1279 dnl Some platorms have setresgid that isn't implemented, test for this
1280 AC_MSG_CHECKING(if setresgid seems to work)
1281 AC_RUN_IFELSE(
1282 [AC_LANG_SOURCE([[
1283#include <stdlib.h>
1284#include <errno.h>
1285int main(){errno=0; setresgid(0,0,0); if (errno==ENOSYS) exit(1); else exit(0);}
1286 ]])],
1287 [AC_MSG_RESULT(yes)],
1288 [AC_DEFINE(BROKEN_SETRESGID, 1,
1289 [Define if your setresgid() is broken])
1290 AC_MSG_RESULT(not implemented)],
1291 [AC_MSG_WARN([cross compiling: not checking setresuid])]
1292 )
1293])
1294
1295dnl Checks for time functions
1296AC_CHECK_FUNCS(gettimeofday time)
1297dnl Checks for utmp functions
1298AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1299AC_CHECK_FUNCS(utmpname)
1300dnl Checks for utmpx functions
1301AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1302AC_CHECK_FUNCS(setutxent utmpxname)
1303
1304AC_CHECK_FUNC(daemon,
1305 [AC_DEFINE(HAVE_DAEMON, 1, [Define if your libraries define daemon()])],
1306 [AC_CHECK_LIB(bsd, daemon,
1307 [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
1308)
1309
1310AC_CHECK_FUNC(getpagesize,
1311 [AC_DEFINE(HAVE_GETPAGESIZE, 1,
1312 [Define if your libraries define getpagesize()])],
1313 [AC_CHECK_LIB(ucb, getpagesize,
1314 [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
1315)
1316
1317# Check for broken snprintf
1318if test "x$ac_cv_func_snprintf" = "xyes" ; then
1319 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
1320 AC_RUN_IFELSE(
1321 [AC_LANG_SOURCE([[
1322#include <stdio.h>
1323int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
1324 ]])],
1325 [AC_MSG_RESULT(yes)],
1326 [
1327 AC_MSG_RESULT(no)
1328 AC_DEFINE(BROKEN_SNPRINTF, 1,
1329 [Define if your snprintf is busted])
1330 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
1331 ],
1332 [ AC_MSG_WARN([cross compiling: Assuming working snprintf()]) ]
1333 )
1334fi
1335
1336# If we don't have a working asprintf, then we strongly depend on vsnprintf
1337# returning the right thing on overflow: the number of characters it tried to
1338# create (as per SUSv3)
1339if test "x$ac_cv_func_asprintf" != "xyes" && \
1340 test "x$ac_cv_func_vsnprintf" = "xyes" ; then
1341 AC_MSG_CHECKING([whether vsnprintf returns correct values on overflow])
1342 AC_RUN_IFELSE(
1343 [AC_LANG_SOURCE([[
1344#include <sys/types.h>
1345#include <stdio.h>
1346#include <stdarg.h>
1347
1348int x_snprintf(char *str,size_t count,const char *fmt,...)
1349{
1350 size_t ret; va_list ap;
1351 va_start(ap, fmt); ret = vsnprintf(str, count, fmt, ap); va_end(ap);
1352 return ret;
1353}
1354int main(void)
1355{
1356 char x[1];
1357 exit(x_snprintf(x, 1, "%s %d", "hello", 12345) == 11 ? 0 : 1);
1358} ]])],
1359 [AC_MSG_RESULT(yes)],
1360 [
1361 AC_MSG_RESULT(no)
1362 AC_DEFINE(BROKEN_SNPRINTF, 1,
1363 [Define if your snprintf is busted])
1364 AC_MSG_WARN([****** Your vsnprintf() function is broken, complain to your vendor])
1365 ],
1366 [ AC_MSG_WARN([cross compiling: Assuming working vsnprintf()]) ]
1367 )
1368fi
1369
1370# On systems where [v]snprintf is broken, but is declared in stdio,
1371# check that the fmt argument is const char * or just char *.
1372# This is only useful for when BROKEN_SNPRINTF
1373AC_MSG_CHECKING([whether snprintf can declare const char *fmt])
1374AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdio.h>
1375 int snprintf(char *a, size_t b, const char *c, ...) { return 0; }
1376 int main(void) { snprintf(0, 0, 0); }
1377 ]])],
1378 [AC_MSG_RESULT(yes)
1379 AC_DEFINE(SNPRINTF_CONST, [const],
1380 [Define as const if snprintf() can declare const char *fmt])],
1381 [AC_MSG_RESULT(no)
1382 AC_DEFINE(SNPRINTF_CONST, [/* not const */])])
1383
1384# Check for missing getpeereid (or equiv) support
1385NO_PEERCHECK=""
1386if test "x$ac_cv_func_getpeereid" != "xyes" ; then
1387 AC_MSG_CHECKING([whether system supports SO_PEERCRED getsockopt])
1388 AC_TRY_COMPILE(
1389 [#include <sys/types.h>
1390 #include <sys/socket.h>],
1391 [int i = SO_PEERCRED;],
1392 [ AC_MSG_RESULT(yes)
1393 AC_DEFINE(HAVE_SO_PEERCRED, 1, [Have PEERCRED socket option])
1394 ],
1395 [AC_MSG_RESULT(no)
1396 NO_PEERCHECK=1]
1397 )
1398fi
1399
1400dnl see whether mkstemp() requires XXXXXX
1401if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
1402AC_MSG_CHECKING([for (overly) strict mkstemp])
1403AC_RUN_IFELSE(
1404 [AC_LANG_SOURCE([[
1405#include <stdlib.h>
1406main() { char template[]="conftest.mkstemp-test";
1407if (mkstemp(template) == -1)
1408 exit(1);
1409unlink(template); exit(0);
1410}
1411 ]])],
1412 [
1413 AC_MSG_RESULT(no)
1414 ],
1415 [
1416 AC_MSG_RESULT(yes)
1417 AC_DEFINE(HAVE_STRICT_MKSTEMP, 1, [Silly mkstemp()])
1418 ],
1419 [
1420 AC_MSG_RESULT(yes)
1421 AC_DEFINE(HAVE_STRICT_MKSTEMP)
1422 ]
1423)
1424fi
1425
1426dnl make sure that openpty does not reacquire controlling terminal
1427if test ! -z "$check_for_openpty_ctty_bug"; then
1428 AC_MSG_CHECKING(if openpty correctly handles controlling tty)
1429 AC_RUN_IFELSE(
1430 [AC_LANG_SOURCE([[
1431#include <stdio.h>
1432#include <sys/fcntl.h>
1433#include <sys/types.h>
1434#include <sys/wait.h>
1435
1436int
1437main()
1438{
1439 pid_t pid;
1440 int fd, ptyfd, ttyfd, status;
1441
1442 pid = fork();
1443 if (pid < 0) { /* failed */
1444 exit(1);
1445 } else if (pid > 0) { /* parent */
1446 waitpid(pid, &status, 0);
1447 if (WIFEXITED(status))
1448 exit(WEXITSTATUS(status));
1449 else
1450 exit(2);
1451 } else { /* child */
1452 close(0); close(1); close(2);
1453 setsid();
1454 openpty(&ptyfd, &ttyfd, NULL, NULL, NULL);
1455 fd = open("/dev/tty", O_RDWR | O_NOCTTY);
1456 if (fd >= 0)
1457 exit(3); /* Acquired ctty: broken */
1458 else
1459 exit(0); /* Did not acquire ctty: OK */
1460 }
1461}
1462 ]])],
1463 [
1464 AC_MSG_RESULT(yes)
1465 ],
1466 [
1467 AC_MSG_RESULT(no)
1468 AC_DEFINE(SSHD_ACQUIRES_CTTY)
1469 ],
1470 [
1471 AC_MSG_RESULT(cross-compiling, assuming yes)
1472 ]
1473 )
1474fi
1475
1476if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1477 test "x$check_for_hpux_broken_getaddrinfo" = "x1"; then
1478 AC_MSG_CHECKING(if getaddrinfo seems to work)
1479 AC_RUN_IFELSE(
1480 [AC_LANG_SOURCE([[
1481#include <stdio.h>
1482#include <sys/socket.h>
1483#include <netdb.h>
1484#include <errno.h>
1485#include <netinet/in.h>
1486
1487#define TEST_PORT "2222"
1488
1489int
1490main(void)
1491{
1492 int err, sock;
1493 struct addrinfo *gai_ai, *ai, hints;
1494 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1495
1496 memset(&hints, 0, sizeof(hints));
1497 hints.ai_family = PF_UNSPEC;
1498 hints.ai_socktype = SOCK_STREAM;
1499 hints.ai_flags = AI_PASSIVE;
1500
1501 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1502 if (err != 0) {
1503 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1504 exit(1);
1505 }
1506
1507 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1508 if (ai->ai_family != AF_INET6)
1509 continue;
1510
1511 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1512 sizeof(ntop), strport, sizeof(strport),
1513 NI_NUMERICHOST|NI_NUMERICSERV);
1514
1515 if (err != 0) {
1516 if (err == EAI_SYSTEM)
1517 perror("getnameinfo EAI_SYSTEM");
1518 else
1519 fprintf(stderr, "getnameinfo failed: %s\n",
1520 gai_strerror(err));
1521 exit(2);
1522 }
1523
1524 sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol);
1525 if (sock < 0)
1526 perror("socket");
1527 if (bind(sock, ai->ai_addr, ai->ai_addrlen) < 0) {
1528 if (errno == EBADF)
1529 exit(3);
1530 }
1531 }
1532 exit(0);
1533}
1534 ]])],
1535 [
1536 AC_MSG_RESULT(yes)
1537 ],
1538 [
1539 AC_MSG_RESULT(no)
1540 AC_DEFINE(BROKEN_GETADDRINFO)
1541 ],
1542 [
1543 AC_MSG_RESULT(cross-compiling, assuming yes)
1544 ]
1545 )
1546fi
1547
1548if test "x$ac_cv_func_getaddrinfo" = "xyes" && \
1549 test "x$check_for_aix_broken_getaddrinfo" = "x1"; then
1550 AC_MSG_CHECKING(if getaddrinfo seems to work)
1551 AC_RUN_IFELSE(
1552 [AC_LANG_SOURCE([[
1553#include <stdio.h>
1554#include <sys/socket.h>
1555#include <netdb.h>
1556#include <errno.h>
1557#include <netinet/in.h>
1558
1559#define TEST_PORT "2222"
1560
1561int
1562main(void)
1563{
1564 int err, sock;
1565 struct addrinfo *gai_ai, *ai, hints;
1566 char ntop[NI_MAXHOST], strport[NI_MAXSERV], *name = NULL;
1567
1568 memset(&hints, 0, sizeof(hints));
1569 hints.ai_family = PF_UNSPEC;
1570 hints.ai_socktype = SOCK_STREAM;
1571 hints.ai_flags = AI_PASSIVE;
1572
1573 err = getaddrinfo(name, TEST_PORT, &hints, &gai_ai);
1574 if (err != 0) {
1575 fprintf(stderr, "getaddrinfo failed (%s)", gai_strerror(err));
1576 exit(1);
1577 }
1578
1579 for (ai = gai_ai; ai != NULL; ai = ai->ai_next) {
1580 if (ai->ai_family != AF_INET && ai->ai_family != AF_INET6)
1581 continue;
1582
1583 err = getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop,
1584 sizeof(ntop), strport, sizeof(strport),
1585 NI_NUMERICHOST|NI_NUMERICSERV);
1586
1587 if (ai->ai_family == AF_INET && err != 0) {
1588 perror("getnameinfo");
1589 exit(2);
1590 }
1591 }
1592 exit(0);
1593}
1594 ]])],
1595 [
1596 AC_MSG_RESULT(yes)
1597 AC_DEFINE(AIX_GETNAMEINFO_HACK, 1,
1598 [Define if you have a getaddrinfo that fails
1599 for the all-zeros IPv6 address])
1600 ],
1601 [
1602 AC_MSG_RESULT(no)
1603 AC_DEFINE(BROKEN_GETADDRINFO)
1604 ],
1605 AC_MSG_RESULT(cross-compiling, assuming no)
1606 ]
1607 )
1608fi
1609
1610if test "x$check_for_conflicting_getspnam" = "x1"; then
1611 AC_MSG_CHECKING(for conflicting getspnam in shadow.h)
1612 AC_COMPILE_IFELSE(
1613 [
1614#include <shadow.h>
1615int main(void) {exit(0);}
1616 ],
1617 [
1618 AC_MSG_RESULT(no)
1619 ],
1620 [
1621 AC_MSG_RESULT(yes)
1622 AC_DEFINE(GETSPNAM_CONFLICTING_DEFS, 1,
1623 [Conflicting defs for getspnam])
1624 ]
1625 )
1626fi
1627
1628AC_FUNC_GETPGRP
1629
1630# Check for PAM libs
1631PAM_MSG="no"
1632AC_ARG_WITH(pam,
1633 [ --with-pam Enable PAM support ],
1634 [
1635 if test "x$withval" != "xno" ; then
1636 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" && \
1637 test "x$ac_cv_header_pam_pam_appl_h" != "xyes" ; then
1638 AC_MSG_ERROR([PAM headers not found])
1639 fi
1640
1641 AC_CHECK_LIB(dl, dlopen, , )
1642 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
1643 AC_CHECK_FUNCS(pam_getenvlist)
1644 AC_CHECK_FUNCS(pam_putenv)
1645
1646 PAM_MSG="yes"
1647
1648 AC_DEFINE(USE_PAM, 1,
1649 [Define if you want to enable PAM support])
1650 if test $ac_cv_lib_dl_dlopen = yes; then
1651 LIBPAM="-lpam -ldl"
1652 else
1653 LIBPAM="-lpam"
1654 fi
1655 AC_SUBST(LIBPAM)
1656 fi
1657 ]
1658)
1659
1660# Check for older PAM
1661if test "x$PAM_MSG" = "xyes" ; then
1662 # Check PAM strerror arguments (old PAM)
1663 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
1664 AC_TRY_COMPILE(
1665 [
1666#include <stdlib.h>
1667#if defined(HAVE_SECURITY_PAM_APPL_H)
1668#include <security/pam_appl.h>
1669#elif defined (HAVE_PAM_PAM_APPL_H)
1670#include <pam/pam_appl.h>
1671#endif
1672 ],
1673 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
1674 [AC_MSG_RESULT(no)],
1675 [
1676 AC_DEFINE(HAVE_OLD_PAM, 1,
1677 [Define if you have an old version of PAM
1678 which takes only one argument to pam_strerror])
1679 AC_MSG_RESULT(yes)
1680 PAM_MSG="yes (old library)"
1681 ]
1682 )
1683fi
1684
1685# Search for OpenSSL
1686saved_CPPFLAGS="$CPPFLAGS"
1687saved_LDFLAGS="$LDFLAGS"
1688AC_ARG_WITH(ssl-dir,
1689 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
1690 [
1691 if test "x$withval" != "xno" ; then
1692 case "$withval" in
1693 # Relative paths
1694 ./*|../*) withval="`pwd`/$withval"
1695 esac
1696 if test -d "$withval/lib"; then
1697 if test -n "${need_dash_r}"; then
1698 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
1699 else
1700 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
1701 fi
1702 else
1703 if test -n "${need_dash_r}"; then
1704 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
1705 else
1706 LDFLAGS="-L${withval} ${LDFLAGS}"
1707 fi
1708 fi
1709 if test -d "$withval/include"; then
1710 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
1711 else
1712 CPPFLAGS="-I${withval} ${CPPFLAGS}"
1713 fi
1714 fi
1715 ]
1716)
1717LIBS="-lcrypto $LIBS"
1718AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL, 1,
1719 [Define if your ssl headers are included
1720 with #include <openssl/header.h>]),
1721 [
1722 dnl Check default openssl install dir
1723 if test -n "${need_dash_r}"; then
1724 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
1725 else
1726 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
1727 fi
1728 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
1729 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
1730 [
1731 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
1732 ]
1733 )
1734 ]
1735)
1736
1737# Determine OpenSSL header version
1738AC_MSG_CHECKING([OpenSSL header version])
1739AC_RUN_IFELSE(
1740 [AC_LANG_SOURCE([[
1741#include <stdio.h>
1742#include <string.h>
1743#include <openssl/opensslv.h>
1744#define DATA "conftest.sslincver"
1745int main(void) {
1746 FILE *fd;
1747 int rc;
1748
1749 fd = fopen(DATA,"w");
1750 if(fd == NULL)
1751 exit(1);
1752
1753 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
1754 exit(1);
1755
1756 exit(0);
1757}
1758 ]])],
1759 [
1760 ssl_header_ver=`cat conftest.sslincver`
1761 AC_MSG_RESULT($ssl_header_ver)
1762 ],
1763 [
1764 AC_MSG_RESULT(not found)
1765 AC_MSG_ERROR(OpenSSL version header not found.)
1766 ],
1767 [
1768 AC_MSG_WARN([cross compiling: not checking])
1769 ]
1770)
1771
1772# Determine OpenSSL library version
1773AC_MSG_CHECKING([OpenSSL library version])
1774AC_RUN_IFELSE(
1775 [AC_LANG_SOURCE([[
1776#include <stdio.h>
1777#include <string.h>
1778#include <openssl/opensslv.h>
1779#include <openssl/crypto.h>
1780#define DATA "conftest.ssllibver"
1781int main(void) {
1782 FILE *fd;
1783 int rc;
1784
1785 fd = fopen(DATA,"w");
1786 if(fd == NULL)
1787 exit(1);
1788
1789 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
1790 exit(1);
1791
1792 exit(0);
1793}
1794 ]])],
1795 [
1796 ssl_library_ver=`cat conftest.ssllibver`
1797 AC_MSG_RESULT($ssl_library_ver)
1798 ],
1799 [
1800 AC_MSG_RESULT(not found)
1801 AC_MSG_ERROR(OpenSSL library not found.)
1802 ],
1803 [
1804 AC_MSG_WARN([cross compiling: not checking])
1805 ]
1806)
1807
1808# Sanity check OpenSSL headers
1809AC_MSG_CHECKING([whether OpenSSL's headers match the library])
1810AC_RUN_IFELSE(
1811 [AC_LANG_SOURCE([[
1812#include <string.h>
1813#include <openssl/opensslv.h>
1814int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
1815 ]])],
1816 [
1817 AC_MSG_RESULT(yes)
1818 ],
1819 [
1820 AC_MSG_RESULT(no)
1821 AC_MSG_ERROR([Your OpenSSL headers do not match your library.
1822Check config.log for details.
1823Also see contrib/findssl.sh for help identifying header/library mismatches.])
1824 ],
1825 [
1826 AC_MSG_WARN([cross compiling: not checking])
1827 ]
1828)
1829
1830# Check for OpenSSL without EVP_aes_{192,256}_cbc
1831AC_MSG_CHECKING([whether OpenSSL has crippled AES support])
1832AC_COMPILE_IFELSE(
1833 [AC_LANG_SOURCE([[
1834#include <string.h>
1835#include <openssl/evp.h>
1836int main(void) { exit(EVP_aes_192_cbc() == NULL || EVP_aes_256_cbc() == NULL);}
1837 ]])],
1838 [
1839 AC_MSG_RESULT(no)
1840 ],
1841 [
1842 AC_MSG_RESULT(yes)
1843 AC_DEFINE(OPENSSL_LOBOTOMISED_AES, 1,
1844 [libcrypto is missing AES 192 and 256 bit functions])
1845 ]
1846)
1847
1848# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
1849# because the system crypt() is more featureful.
1850if test "x$check_for_libcrypt_before" = "x1"; then
1851 AC_CHECK_LIB(crypt, crypt)
1852fi
1853
1854# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
1855# version in OpenSSL.
1856if test "x$check_for_libcrypt_later" = "x1"; then
1857 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
1858fi
1859
1860AC_CHECK_LIB(iaf, ia_openinfo)
1861
1862### Configure cryptographic random number support
1863
1864# Check wheter OpenSSL seeds itself
1865AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
1866AC_RUN_IFELSE(
1867 [AC_LANG_SOURCE([[
1868#include <string.h>
1869#include <openssl/rand.h>
1870int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
1871 ]])],
1872 [
1873 OPENSSL_SEEDS_ITSELF=yes
1874 AC_MSG_RESULT(yes)
1875 ],
1876 [
1877 AC_MSG_RESULT(no)
1878 # Default to use of the rand helper if OpenSSL doesn't
1879 # seed itself
1880 USE_RAND_HELPER=yes
1881 ],
1882 [
1883 AC_MSG_WARN([cross compiling: assuming yes])
1884 # This is safe, since all recent OpenSSL versions will
1885 # complain at runtime if not seeded correctly.
1886 OPENSSL_SEEDS_ITSELF=yes
1887 ]
1888)
1889
1890
1891# Do we want to force the use of the rand helper?
1892AC_ARG_WITH(rand-helper,
1893 [ --with-rand-helper Use subprocess to gather strong randomness ],
1894 [
1895 if test "x$withval" = "xno" ; then
1896 # Force use of OpenSSL's internal RNG, even if
1897 # the previous test showed it to be unseeded.
1898 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
1899 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
1900 OPENSSL_SEEDS_ITSELF=yes
1901 USE_RAND_HELPER=""
1902 fi
1903 else
1904 USE_RAND_HELPER=yes
1905 fi
1906 ],
1907)
1908
1909# Which randomness source do we use?
1910if test ! -z "$OPENSSL_SEEDS_ITSELF" && test -z "$USE_RAND_HELPER" ; then
1911 # OpenSSL only
1912 AC_DEFINE(OPENSSL_PRNG_ONLY, 1,
1913 [Define if you want OpenSSL's internally seeded PRNG only])
1914 RAND_MSG="OpenSSL internal ONLY"
1915 INSTALL_SSH_RAND_HELPER=""
1916elif test ! -z "$USE_RAND_HELPER" ; then
1917 # install rand helper
1918 RAND_MSG="ssh-rand-helper"
1919 INSTALL_SSH_RAND_HELPER="yes"
1920fi
1921AC_SUBST(INSTALL_SSH_RAND_HELPER)
1922
1923### Configuration of ssh-rand-helper
1924
1925# PRNGD TCP socket
1926AC_ARG_WITH(prngd-port,
1927 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
1928 [
1929 case "$withval" in
1930 no)
1931 withval=""
1932 ;;
1933 [[0-9]]*)
1934 ;;
1935 *)
1936 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
1937 ;;
1938 esac
1939 if test ! -z "$withval" ; then
1940 PRNGD_PORT="$withval"
1941 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT,
1942 [Port number of PRNGD/EGD random number socket])
1943 fi
1944 ]
1945)
1946
1947# PRNGD Unix domain socket
1948AC_ARG_WITH(prngd-socket,
1949 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
1950 [
1951 case "$withval" in
1952 yes)
1953 withval="/var/run/egd-pool"
1954 ;;
1955 no)
1956 withval=""
1957 ;;
1958 /*)
1959 ;;
1960 *)
1961 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1962 ;;
1963 esac
1964
1965 if test ! -z "$withval" ; then
1966 if test ! -z "$PRNGD_PORT" ; then
1967 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1968 fi
1969 if test ! -r "$withval" ; then
1970 AC_MSG_WARN(Entropy socket is not readable)
1971 fi
1972 PRNGD_SOCKET="$withval"
1973 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET",
1974 [Location of PRNGD/EGD random number socket])
1975 fi
1976 ],
1977 [
1978 # Check for existing socket only if we don't have a random device already
1979 if test "$USE_RAND_HELPER" = yes ; then
1980 AC_MSG_CHECKING(for PRNGD/EGD socket)
1981 # Insert other locations here
1982 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1983 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1984 PRNGD_SOCKET="$sock"
1985 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1986 break;
1987 fi
1988 done
1989 if test ! -z "$PRNGD_SOCKET" ; then
1990 AC_MSG_RESULT($PRNGD_SOCKET)
1991 else
1992 AC_MSG_RESULT(not found)
1993 fi
1994 fi
1995 ]
1996)
1997
1998# Change default command timeout for hashing entropy source
1999entropy_timeout=200
2000AC_ARG_WITH(entropy-timeout,
2001 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
2002 [
2003 if test -n "$withval" && test "x$withval" != "xno" && \
2004 test "x${withval}" != "xyes"; then
2005 entropy_timeout=$withval
2006 fi
2007 ]
2008)
2009AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout,
2010 [Builtin PRNG command timeout])
2011
2012SSH_PRIVSEP_USER=sshd
2013AC_ARG_WITH(privsep-user,
2014 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
2015 [
2016 if test -n "$withval" && test "x$withval" != "xno" && \
2017 test "x${withval}" != "xyes"; then
2018 SSH_PRIVSEP_USER=$withval
2019 fi
2020 ]
2021)
2022AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER",
2023 [non-privileged user for privilege separation])
2024AC_SUBST(SSH_PRIVSEP_USER)
2025
2026# We do this little dance with the search path to insure
2027# that programs that we select for use by installed programs
2028# (which may be run by the super-user) come from trusted
2029# locations before they come from the user's private area.
2030# This should help avoid accidentally configuring some
2031# random version of a program in someone's personal bin.
2032
2033OPATH=$PATH
2034PATH=/bin:/usr/bin
2035test -h /bin 2> /dev/null && PATH=/usr/bin
2036test -d /sbin && PATH=$PATH:/sbin
2037test -d /usr/sbin && PATH=$PATH:/usr/sbin
2038PATH=$PATH:/etc:$OPATH
2039
2040# These programs are used by the command hashing source to gather entropy
2041OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
2042OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
2043OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
2044OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
2045OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
2046OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
2047OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
2048OSSH_PATH_ENTROPY_PROG(PROG_W, w)
2049OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
2050OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
2051OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
2052OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
2053OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
2054OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
2055OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
2056OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
2057# restore PATH
2058PATH=$OPATH
2059
2060# Where does ssh-rand-helper get its randomness from?
2061INSTALL_SSH_PRNG_CMDS=""
2062if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
2063 if test ! -z "$PRNGD_PORT" ; then
2064 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
2065 elif test ! -z "$PRNGD_SOCKET" ; then
2066 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
2067 else
2068 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
2069 RAND_HELPER_CMDHASH=yes
2070 INSTALL_SSH_PRNG_CMDS="yes"
2071 fi
2072fi
2073AC_SUBST(INSTALL_SSH_PRNG_CMDS)
2074
2075
2076# Cheap hack to ensure NEWS-OS libraries are arranged right.
2077if test ! -z "$SONY" ; then
2078 LIBS="$LIBS -liberty";
2079fi
2080
2081# Check for long long datatypes
2082AC_CHECK_TYPES([long long, unsigned long long, long double])
2083
2084# Check datatype sizes
2085AC_CHECK_SIZEOF(char, 1)
2086AC_CHECK_SIZEOF(short int, 2)
2087AC_CHECK_SIZEOF(int, 4)
2088AC_CHECK_SIZEOF(long int, 4)
2089AC_CHECK_SIZEOF(long long int, 8)
2090
2091# Sanity check long long for some platforms (AIX)
2092if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
2093 ac_cv_sizeof_long_long_int=0
2094fi
2095
2096# compute LLONG_MIN and LLONG_MAX if we don't know them.
2097if test -z "$have_llong_max"; then
2098 AC_MSG_CHECKING([for max value of long long])
2099 AC_RUN_IFELSE(
2100 [AC_LANG_SOURCE([[
2101#include <stdio.h>
2102/* Why is this so damn hard? */
2103#ifdef __GNUC__
2104# undef __GNUC__
2105#endif
2106#define __USE_ISOC99
2107#include <limits.h>
2108#define DATA "conftest.llminmax"
2109int main(void) {
2110 FILE *f;
2111 long long i, llmin, llmax = 0;
2112
2113 if((f = fopen(DATA,"w")) == NULL)
2114 exit(1);
2115
2116#if defined(LLONG_MIN) && defined(LLONG_MAX)
2117 fprintf(stderr, "Using system header for LLONG_MIN and LLONG_MAX\n");
2118 llmin = LLONG_MIN;
2119 llmax = LLONG_MAX;
2120#else
2121 fprintf(stderr, "Calculating LLONG_MIN and LLONG_MAX\n");
2122 /* This will work on one's complement and two's complement */
2123 for (i = 1; i > llmax; i <<= 1, i++)
2124 llmax = i;
2125 llmin = llmax + 1LL; /* wrap */
2126#endif
2127
2128 /* Sanity check */
2129 if (llmin + 1 < llmin || llmin - 1 < llmin || llmax + 1 > llmax
2130 || llmax - 1 > llmax) {
2131 fprintf(f, "unknown unknown\n");
2132 exit(2);
2133 }
2134
2135 if (fprintf(f ,"%lld %lld", llmin, llmax) < 0)
2136 exit(3);
2137
2138 exit(0);
2139}
2140 ]])],
2141 [
2142 llong_min=`$AWK '{print $1}' conftest.llminmax`
2143 llong_max=`$AWK '{print $2}' conftest.llminmax`
2144
2145 # snprintf on some Tru64s doesn't understand "%lld"
2146 case "$host" in
2147 alpha-dec-osf*)
2148 if test "x$ac_cv_sizeof_long_long_int" = "x8" &&
2149 test "x$llong_max" = "xld"; then
2150 llong_min="-9223372036854775808"
2151 llong_max="9223372036854775807"
2152 fi
2153 ;;
2154 esac
2155
2156 AC_MSG_RESULT($llong_max)
2157 AC_DEFINE_UNQUOTED(LLONG_MAX, [${llong_max}LL],
2158 [max value of long long calculated by configure])
2159 AC_MSG_CHECKING([for min value of long long])
2160 AC_MSG_RESULT($llong_min)
2161 AC_DEFINE_UNQUOTED(LLONG_MIN, [${llong_min}LL],
2162 [min value of long long calculated by configure])
2163 ],
2164 [
2165 AC_MSG_RESULT(not found)
2166 ],
2167 [
2168 AC_MSG_WARN([cross compiling: not checking])
2169 ]
2170 )
2171fi
2172
2173
2174# More checks for data types
2175AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
2176 AC_TRY_COMPILE(
2177 [ #include <sys/types.h> ],
2178 [ u_int a; a = 1;],
2179 [ ac_cv_have_u_int="yes" ],
2180 [ ac_cv_have_u_int="no" ]
2181 )
2182])
2183if test "x$ac_cv_have_u_int" = "xyes" ; then
2184 AC_DEFINE(HAVE_U_INT, 1, [define if you have u_int data type])
2185 have_u_int=1
2186fi
2187
2188AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
2189 AC_TRY_COMPILE(
2190 [ #include <sys/types.h> ],
2191 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2192 [ ac_cv_have_intxx_t="yes" ],
2193 [ ac_cv_have_intxx_t="no" ]
2194 )
2195])
2196if test "x$ac_cv_have_intxx_t" = "xyes" ; then
2197 AC_DEFINE(HAVE_INTXX_T, 1, [define if you have intxx_t data type])
2198 have_intxx_t=1
2199fi
2200
2201if (test -z "$have_intxx_t" && \
2202 test "x$ac_cv_header_stdint_h" = "xyes")
2203then
2204 AC_MSG_CHECKING([for intXX_t types in stdint.h])
2205 AC_TRY_COMPILE(
2206 [ #include <stdint.h> ],
2207 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
2208 [
2209 AC_DEFINE(HAVE_INTXX_T)
2210 AC_MSG_RESULT(yes)
2211 ],
2212 [ AC_MSG_RESULT(no) ]
2213 )
2214fi
2215
2216AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
2217 AC_TRY_COMPILE(
2218 [
2219#include <sys/types.h>
2220#ifdef HAVE_STDINT_H
2221# include <stdint.h>
2222#endif
2223#include <sys/socket.h>
2224#ifdef HAVE_SYS_BITYPES_H
2225# include <sys/bitypes.h>
2226#endif
2227 ],
2228 [ int64_t a; a = 1;],
2229 [ ac_cv_have_int64_t="yes" ],
2230 [ ac_cv_have_int64_t="no" ]
2231 )
2232])
2233if test "x$ac_cv_have_int64_t" = "xyes" ; then
2234 AC_DEFINE(HAVE_INT64_T, 1, [define if you have int64_t data type])
2235fi
2236
2237AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
2238 AC_TRY_COMPILE(
2239 [ #include <sys/types.h> ],
2240 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2241 [ ac_cv_have_u_intxx_t="yes" ],
2242 [ ac_cv_have_u_intxx_t="no" ]
2243 )
2244])
2245if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
2246 AC_DEFINE(HAVE_U_INTXX_T, 1, [define if you have u_intxx_t data type])
2247 have_u_intxx_t=1
2248fi
2249
2250if test -z "$have_u_intxx_t" ; then
2251 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
2252 AC_TRY_COMPILE(
2253 [ #include <sys/socket.h> ],
2254 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
2255 [
2256 AC_DEFINE(HAVE_U_INTXX_T)
2257 AC_MSG_RESULT(yes)
2258 ],
2259 [ AC_MSG_RESULT(no) ]
2260 )
2261fi
2262
2263AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
2264 AC_TRY_COMPILE(
2265 [ #include <sys/types.h> ],
2266 [ u_int64_t a; a = 1;],
2267 [ ac_cv_have_u_int64_t="yes" ],
2268 [ ac_cv_have_u_int64_t="no" ]
2269 )
2270])
2271if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
2272 AC_DEFINE(HAVE_U_INT64_T, 1, [define if you have u_int64_t data type])
2273 have_u_int64_t=1
2274fi
2275
2276if test -z "$have_u_int64_t" ; then
2277 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
2278 AC_TRY_COMPILE(
2279 [ #include <sys/bitypes.h> ],
2280 [ u_int64_t a; a = 1],
2281 [
2282 AC_DEFINE(HAVE_U_INT64_T)
2283 AC_MSG_RESULT(yes)
2284 ],
2285 [ AC_MSG_RESULT(no) ]
2286 )
2287fi
2288
2289if test -z "$have_u_intxx_t" ; then
2290 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
2291 AC_TRY_COMPILE(
2292 [
2293#include <sys/types.h>
2294 ],
2295 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
2296 [ ac_cv_have_uintxx_t="yes" ],
2297 [ ac_cv_have_uintxx_t="no" ]
2298 )
2299 ])
2300 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
2301 AC_DEFINE(HAVE_UINTXX_T, 1,
2302 [define if you have uintxx_t data type])
2303 fi
2304fi
2305
2306if test -z "$have_uintxx_t" ; then
2307 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
2308 AC_TRY_COMPILE(
2309 [ #include <stdint.h> ],
2310 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
2311 [
2312 AC_DEFINE(HAVE_UINTXX_T)
2313 AC_MSG_RESULT(yes)
2314 ],
2315 [ AC_MSG_RESULT(no) ]
2316 )
2317fi
2318
2319if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
2320 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
2321then
2322 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
2323 AC_TRY_COMPILE(
2324 [
2325#include <sys/bitypes.h>
2326 ],
2327 [
2328 int8_t a; int16_t b; int32_t c;
2329 u_int8_t e; u_int16_t f; u_int32_t g;
2330 a = b = c = e = f = g = 1;
2331 ],
2332 [
2333 AC_DEFINE(HAVE_U_INTXX_T)
2334 AC_DEFINE(HAVE_INTXX_T)
2335 AC_MSG_RESULT(yes)
2336 ],
2337 [AC_MSG_RESULT(no)]
2338 )
2339fi
2340
2341
2342AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
2343 AC_TRY_COMPILE(
2344 [
2345#include <sys/types.h>
2346 ],
2347 [ u_char foo; foo = 125; ],
2348 [ ac_cv_have_u_char="yes" ],
2349 [ ac_cv_have_u_char="no" ]
2350 )
2351])
2352if test "x$ac_cv_have_u_char" = "xyes" ; then
2353 AC_DEFINE(HAVE_U_CHAR, 1, [define if you have u_char data type])
2354fi
2355
2356TYPE_SOCKLEN_T
2357
2358AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
2359
2360AC_CHECK_TYPES(in_addr_t,,,
2361[#include <sys/types.h>
2362#include <netinet/in.h>])
2363
2364AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
2365 AC_TRY_COMPILE(
2366 [
2367#include <sys/types.h>
2368 ],
2369 [ size_t foo; foo = 1235; ],
2370 [ ac_cv_have_size_t="yes" ],
2371 [ ac_cv_have_size_t="no" ]
2372 )
2373])
2374if test "x$ac_cv_have_size_t" = "xyes" ; then
2375 AC_DEFINE(HAVE_SIZE_T, 1, [define if you have size_t data type])
2376fi
2377
2378AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
2379 AC_TRY_COMPILE(
2380 [
2381#include <sys/types.h>
2382 ],
2383 [ ssize_t foo; foo = 1235; ],
2384 [ ac_cv_have_ssize_t="yes" ],
2385 [ ac_cv_have_ssize_t="no" ]
2386 )
2387])
2388if test "x$ac_cv_have_ssize_t" = "xyes" ; then
2389 AC_DEFINE(HAVE_SSIZE_T, 1, [define if you have ssize_t data type])
2390fi
2391
2392AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
2393 AC_TRY_COMPILE(
2394 [
2395#include <time.h>
2396 ],
2397 [ clock_t foo; foo = 1235; ],
2398 [ ac_cv_have_clock_t="yes" ],
2399 [ ac_cv_have_clock_t="no" ]
2400 )
2401])
2402if test "x$ac_cv_have_clock_t" = "xyes" ; then
2403 AC_DEFINE(HAVE_CLOCK_T, 1, [define if you have clock_t data type])
2404fi
2405
2406AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
2407 AC_TRY_COMPILE(
2408 [
2409#include <sys/types.h>
2410#include <sys/socket.h>
2411 ],
2412 [ sa_family_t foo; foo = 1235; ],
2413 [ ac_cv_have_sa_family_t="yes" ],
2414 [ AC_TRY_COMPILE(
2415 [
2416#include <sys/types.h>
2417#include <sys/socket.h>
2418#include <netinet/in.h>
2419 ],
2420 [ sa_family_t foo; foo = 1235; ],
2421 [ ac_cv_have_sa_family_t="yes" ],
2422
2423 [ ac_cv_have_sa_family_t="no" ]
2424 )]
2425 )
2426])
2427if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
2428 AC_DEFINE(HAVE_SA_FAMILY_T, 1,
2429 [define if you have sa_family_t data type])
2430fi
2431
2432AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
2433 AC_TRY_COMPILE(
2434 [
2435#include <sys/types.h>
2436 ],
2437 [ pid_t foo; foo = 1235; ],
2438 [ ac_cv_have_pid_t="yes" ],
2439 [ ac_cv_have_pid_t="no" ]
2440 )
2441])
2442if test "x$ac_cv_have_pid_t" = "xyes" ; then
2443 AC_DEFINE(HAVE_PID_T, 1, [define if you have pid_t data type])
2444fi
2445
2446AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
2447 AC_TRY_COMPILE(
2448 [
2449#include <sys/types.h>
2450 ],
2451 [ mode_t foo; foo = 1235; ],
2452 [ ac_cv_have_mode_t="yes" ],
2453 [ ac_cv_have_mode_t="no" ]
2454 )
2455])
2456if test "x$ac_cv_have_mode_t" = "xyes" ; then
2457 AC_DEFINE(HAVE_MODE_T, 1, [define if you have mode_t data type])
2458fi
2459
2460
2461AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
2462 AC_TRY_COMPILE(
2463 [
2464#include <sys/types.h>
2465#include <sys/socket.h>
2466 ],
2467 [ struct sockaddr_storage s; ],
2468 [ ac_cv_have_struct_sockaddr_storage="yes" ],
2469 [ ac_cv_have_struct_sockaddr_storage="no" ]
2470 )
2471])
2472if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
2473 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE, 1,
2474 [define if you have struct sockaddr_storage data type])
2475fi
2476
2477AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
2478 AC_TRY_COMPILE(
2479 [
2480#include <sys/types.h>
2481#include <netinet/in.h>
2482 ],
2483 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
2484 [ ac_cv_have_struct_sockaddr_in6="yes" ],
2485 [ ac_cv_have_struct_sockaddr_in6="no" ]
2486 )
2487])
2488if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
2489 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6, 1,
2490 [define if you have struct sockaddr_in6 data type])
2491fi
2492
2493AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
2494 AC_TRY_COMPILE(
2495 [
2496#include <sys/types.h>
2497#include <netinet/in.h>
2498 ],
2499 [ struct in6_addr s; s.s6_addr[0] = 0; ],
2500 [ ac_cv_have_struct_in6_addr="yes" ],
2501 [ ac_cv_have_struct_in6_addr="no" ]
2502 )
2503])
2504if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
2505 AC_DEFINE(HAVE_STRUCT_IN6_ADDR, 1,
2506 [define if you have struct in6_addr data type])
2507fi
2508
2509AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
2510 AC_TRY_COMPILE(
2511 [
2512#include <sys/types.h>
2513#include <sys/socket.h>
2514#include <netdb.h>
2515 ],
2516 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
2517 [ ac_cv_have_struct_addrinfo="yes" ],
2518 [ ac_cv_have_struct_addrinfo="no" ]
2519 )
2520])
2521if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
2522 AC_DEFINE(HAVE_STRUCT_ADDRINFO, 1,
2523 [define if you have struct addrinfo data type])
2524fi
2525
2526AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
2527 AC_TRY_COMPILE(
2528 [ #include <sys/time.h> ],
2529 [ struct timeval tv; tv.tv_sec = 1;],
2530 [ ac_cv_have_struct_timeval="yes" ],
2531 [ ac_cv_have_struct_timeval="no" ]
2532 )
2533])
2534if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
2535 AC_DEFINE(HAVE_STRUCT_TIMEVAL, 1, [define if you have struct timeval])
2536 have_struct_timeval=1
2537fi
2538
2539AC_CHECK_TYPES(struct timespec)
2540
2541# We need int64_t or else certian parts of the compile will fail.
2542if test "x$ac_cv_have_int64_t" = "xno" && \
2543 test "x$ac_cv_sizeof_long_int" != "x8" && \
2544 test "x$ac_cv_sizeof_long_long_int" = "x0" ; then
2545 echo "OpenSSH requires int64_t support. Contact your vendor or install"
2546 echo "an alternative compiler (I.E., GCC) before continuing."
2547 echo ""
2548 exit 1;
2549else
2550dnl test snprintf (broken on SCO w/gcc)
2551 AC_RUN_IFELSE(
2552 [AC_LANG_SOURCE([[
2553#include <stdio.h>
2554#include <string.h>
2555#ifdef HAVE_SNPRINTF
2556main()
2557{
2558 char buf[50];
2559 char expected_out[50];
2560 int mazsize = 50 ;
2561#if (SIZEOF_LONG_INT == 8)
2562 long int num = 0x7fffffffffffffff;
2563#else
2564 long long num = 0x7fffffffffffffffll;
2565#endif
2566 strcpy(expected_out, "9223372036854775807");
2567 snprintf(buf, mazsize, "%lld", num);
2568 if(strcmp(buf, expected_out) != 0)
2569 exit(1);
2570 exit(0);
2571}
2572#else
2573main() { exit(0); }
2574#endif
2575 ]])], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ],
2576 AC_MSG_WARN([cross compiling: Assuming working snprintf()])
2577 )
2578fi
2579
2580dnl Checks for structure members
2581OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
2582OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
2583OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
2584OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
2585OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
2586OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
2587OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
2588OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
2589OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
2590OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
2591OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
2592OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
2593OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
2594OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
2595OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
2596OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
2597OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
2598
2599AC_CHECK_MEMBERS([struct stat.st_blksize])
2600AC_CHECK_MEMBER([struct __res_state.retrans], [], [AC_DEFINE(__res_state, state,
2601 [Define if we don't have struct __res_state in resolv.h])],
2602[
2603#include <stdio.h>
2604#if HAVE_SYS_TYPES_H
2605# include <sys/types.h>
2606#endif
2607#include <netinet/in.h>
2608#include <arpa/nameser.h>
2609#include <resolv.h>
2610])
2611
2612AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
2613 ac_cv_have_ss_family_in_struct_ss, [
2614 AC_TRY_COMPILE(
2615 [
2616#include <sys/types.h>
2617#include <sys/socket.h>
2618 ],
2619 [ struct sockaddr_storage s; s.ss_family = 1; ],
2620 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
2621 [ ac_cv_have_ss_family_in_struct_ss="no" ],
2622 )
2623])
2624if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
2625 AC_DEFINE(HAVE_SS_FAMILY_IN_SS, 1, [Fields in struct sockaddr_storage])
2626fi
2627
2628AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
2629 ac_cv_have___ss_family_in_struct_ss, [
2630 AC_TRY_COMPILE(
2631 [
2632#include <sys/types.h>
2633#include <sys/socket.h>
2634 ],
2635 [ struct sockaddr_storage s; s.__ss_family = 1; ],
2636 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
2637 [ ac_cv_have___ss_family_in_struct_ss="no" ]
2638 )
2639])
2640if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
2641 AC_DEFINE(HAVE___SS_FAMILY_IN_SS, 1,
2642 [Fields in struct sockaddr_storage])
2643fi
2644
2645AC_CACHE_CHECK([for pw_class field in struct passwd],
2646 ac_cv_have_pw_class_in_struct_passwd, [
2647 AC_TRY_COMPILE(
2648 [
2649#include <pwd.h>
2650 ],
2651 [ struct passwd p; p.pw_class = 0; ],
2652 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
2653 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
2654 )
2655])
2656if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
2657 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD, 1,
2658 [Define if your password has a pw_class field])
2659fi
2660
2661AC_CACHE_CHECK([for pw_expire field in struct passwd],
2662 ac_cv_have_pw_expire_in_struct_passwd, [
2663 AC_TRY_COMPILE(
2664 [
2665#include <pwd.h>
2666 ],
2667 [ struct passwd p; p.pw_expire = 0; ],
2668 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
2669 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
2670 )
2671])
2672if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
2673 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD, 1,
2674 [Define if your password has a pw_expire field])
2675fi
2676
2677AC_CACHE_CHECK([for pw_change field in struct passwd],
2678 ac_cv_have_pw_change_in_struct_passwd, [
2679 AC_TRY_COMPILE(
2680 [
2681#include <pwd.h>
2682 ],
2683 [ struct passwd p; p.pw_change = 0; ],
2684 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
2685 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
2686 )
2687])
2688if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
2689 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD, 1,
2690 [Define if your password has a pw_change field])
2691fi
2692
2693dnl make sure we're using the real structure members and not defines
2694AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
2695 ac_cv_have_accrights_in_msghdr, [
2696 AC_COMPILE_IFELSE(
2697 [
2698#include <sys/types.h>
2699#include <sys/socket.h>
2700#include <sys/uio.h>
2701int main() {
2702#ifdef msg_accrights
2703#error "msg_accrights is a macro"
2704exit(1);
2705#endif
2706struct msghdr m;
2707m.msg_accrights = 0;
2708exit(0);
2709}
2710 ],
2711 [ ac_cv_have_accrights_in_msghdr="yes" ],
2712 [ ac_cv_have_accrights_in_msghdr="no" ]
2713 )
2714])
2715if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
2716 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR, 1,
2717 [Define if your system uses access rights style
2718 file descriptor passing])
2719fi
2720
2721AC_CACHE_CHECK([for msg_control field in struct msghdr],
2722 ac_cv_have_control_in_msghdr, [
2723 AC_COMPILE_IFELSE(
2724 [
2725#include <sys/types.h>
2726#include <sys/socket.h>
2727#include <sys/uio.h>
2728int main() {
2729#ifdef msg_control
2730#error "msg_control is a macro"
2731exit(1);
2732#endif
2733struct msghdr m;
2734m.msg_control = 0;
2735exit(0);
2736}
2737 ],
2738 [ ac_cv_have_control_in_msghdr="yes" ],
2739 [ ac_cv_have_control_in_msghdr="no" ]
2740 )
2741])
2742if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
2743 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR, 1,
2744 [Define if your system uses ancillary data style
2745 file descriptor passing])
2746fi
2747
2748AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
2749 AC_TRY_LINK([],
2750 [ extern char *__progname; printf("%s", __progname); ],
2751 [ ac_cv_libc_defines___progname="yes" ],
2752 [ ac_cv_libc_defines___progname="no" ]
2753 )
2754])
2755if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
2756 AC_DEFINE(HAVE___PROGNAME, 1, [Define if libc defines __progname])
2757fi
2758
2759AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
2760 AC_TRY_LINK([
2761#include <stdio.h>
2762],
2763 [ printf("%s", __FUNCTION__); ],
2764 [ ac_cv_cc_implements___FUNCTION__="yes" ],
2765 [ ac_cv_cc_implements___FUNCTION__="no" ]
2766 )
2767])
2768if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
2769 AC_DEFINE(HAVE___FUNCTION__, 1,
2770 [Define if compiler implements __FUNCTION__])
2771fi
2772
2773AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
2774 AC_TRY_LINK([
2775#include <stdio.h>
2776],
2777 [ printf("%s", __func__); ],
2778 [ ac_cv_cc_implements___func__="yes" ],
2779 [ ac_cv_cc_implements___func__="no" ]
2780 )
2781])
2782if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
2783 AC_DEFINE(HAVE___func__, 1, [Define if compiler implements __func__])
2784fi
2785
2786AC_CACHE_CHECK([whether va_copy exists], ac_cv_have_va_copy, [
2787 AC_TRY_LINK(
2788 [#include <stdarg.h>
2789 va_list x,y;],
2790 [va_copy(x,y);],
2791 [ ac_cv_have_va_copy="yes" ],
2792 [ ac_cv_have_va_copy="no" ]
2793 )
2794])
2795if test "x$ac_cv_have_va_copy" = "xyes" ; then
2796 AC_DEFINE(HAVE_VA_COPY, 1, [Define if va_copy exists])
2797fi
2798
2799AC_CACHE_CHECK([whether __va_copy exists], ac_cv_have___va_copy, [
2800 AC_TRY_LINK(
2801 [#include <stdarg.h>
2802 va_list x,y;],
2803 [__va_copy(x,y);],
2804 [ ac_cv_have___va_copy="yes" ],
2805 [ ac_cv_have___va_copy="no" ]
2806 )
2807])
2808if test "x$ac_cv_have___va_copy" = "xyes" ; then
2809 AC_DEFINE(HAVE___VA_COPY, 1, [Define if __va_copy exists])
2810fi
2811
2812AC_CACHE_CHECK([whether getopt has optreset support],
2813 ac_cv_have_getopt_optreset, [
2814 AC_TRY_LINK(
2815 [
2816#include <getopt.h>
2817 ],
2818 [ extern int optreset; optreset = 0; ],
2819 [ ac_cv_have_getopt_optreset="yes" ],
2820 [ ac_cv_have_getopt_optreset="no" ]
2821 )
2822])
2823if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
2824 AC_DEFINE(HAVE_GETOPT_OPTRESET, 1,
2825 [Define if your getopt(3) defines and uses optreset])
2826fi
2827
2828AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
2829 AC_TRY_LINK([],
2830 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
2831 [ ac_cv_libc_defines_sys_errlist="yes" ],
2832 [ ac_cv_libc_defines_sys_errlist="no" ]
2833 )
2834])
2835if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
2836 AC_DEFINE(HAVE_SYS_ERRLIST, 1,
2837 [Define if your system defines sys_errlist[]])
2838fi
2839
2840
2841AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
2842 AC_TRY_LINK([],
2843 [ extern int sys_nerr; printf("%i", sys_nerr);],
2844 [ ac_cv_libc_defines_sys_nerr="yes" ],
2845 [ ac_cv_libc_defines_sys_nerr="no" ]
2846 )
2847])
2848if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
2849 AC_DEFINE(HAVE_SYS_NERR, 1, [Define if your system defines sys_nerr])
2850fi
2851
2852SCARD_MSG="no"
2853# Check whether user wants sectok support
2854AC_ARG_WITH(sectok,
2855 [ --with-sectok Enable smartcard support using libsectok],
2856 [
2857 if test "x$withval" != "xno" ; then
2858 if test "x$withval" != "xyes" ; then
2859 CPPFLAGS="$CPPFLAGS -I${withval}"
2860 LDFLAGS="$LDFLAGS -L${withval}"
2861 if test ! -z "$need_dash_r" ; then
2862 LDFLAGS="$LDFLAGS -R${withval}"
2863 fi
2864 if test ! -z "$blibpath" ; then
2865 blibpath="$blibpath:${withval}"
2866 fi
2867 fi
2868 AC_CHECK_HEADERS(sectok.h)
2869 if test "$ac_cv_header_sectok_h" != yes; then
2870 AC_MSG_ERROR(Can't find sectok.h)
2871 fi
2872 AC_CHECK_LIB(sectok, sectok_open)
2873 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
2874 AC_MSG_ERROR(Can't find libsectok)
2875 fi
2876 AC_DEFINE(SMARTCARD, 1,
2877 [Define if you want smartcard support])
2878 AC_DEFINE(USE_SECTOK, 1,
2879 [Define if you want smartcard support
2880 using sectok])
2881 SCARD_MSG="yes, using sectok"
2882 fi
2883 ]
2884)
2885
2886# Check whether user wants OpenSC support
2887OPENSC_CONFIG="no"
2888AC_ARG_WITH(opensc,
2889 [ --with-opensc[[=PFX]] Enable smartcard support using OpenSC (optionally in PATH)],
2890 [
2891 if test "x$withval" != "xno" ; then
2892 if test "x$withval" != "xyes" ; then
2893 OPENSC_CONFIG=$withval/bin/opensc-config
2894 else
2895 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
2896 fi
2897 if test "$OPENSC_CONFIG" != "no"; then
2898 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
2899 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
2900 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
2901 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
2902 AC_DEFINE(SMARTCARD)
2903 AC_DEFINE(USE_OPENSC, 1,
2904 [Define if you want smartcard support
2905 using OpenSC])
2906 SCARD_MSG="yes, using OpenSC"
2907 fi
2908 fi
2909 ]
2910)
2911
2912# Check libraries needed by DNS fingerprint support
2913AC_SEARCH_LIBS(getrrsetbyname, resolv,
2914 [AC_DEFINE(HAVE_GETRRSETBYNAME, 1,
2915 [Define if getrrsetbyname() exists])],
2916 [
2917 # Needed by our getrrsetbyname()
2918 AC_SEARCH_LIBS(res_query, resolv)
2919 AC_SEARCH_LIBS(dn_expand, resolv)
2920 AC_MSG_CHECKING(if res_query will link)
2921 AC_TRY_LINK_FUNC(res_query, AC_MSG_RESULT(yes),
2922 [AC_MSG_RESULT(no)
2923 saved_LIBS="$LIBS"
2924 LIBS="$LIBS -lresolv"
2925 AC_MSG_CHECKING(for res_query in -lresolv)
2926 AC_LINK_IFELSE([
2927#include <resolv.h>
2928int main()
2929{
2930 res_query (0, 0, 0, 0, 0);
2931 return 0;
2932}
2933 ],
2934 [LIBS="$LIBS -lresolv"
2935 AC_MSG_RESULT(yes)],
2936 [LIBS="$saved_LIBS"
2937 AC_MSG_RESULT(no)])
2938 ])
2939 AC_CHECK_FUNCS(_getshort _getlong)
2940 AC_CHECK_DECLS([_getshort, _getlong], , ,
2941 [#include <sys/types.h>
2942 #include <arpa/nameser.h>])
2943 AC_CHECK_MEMBER(HEADER.ad,
2944 [AC_DEFINE(HAVE_HEADER_AD, 1,
2945 [Define if HEADER.ad exists in arpa/nameser.h])],,
2946 [#include <arpa/nameser.h>])
2947 ])
2948
2949# Check whether user wants Kerberos 5 support
2950KRB5_MSG="no"
2951AC_ARG_WITH(kerberos5,
2952 [ --with-kerberos5=PATH Enable Kerberos 5 support],
2953 [ if test "x$withval" != "xno" ; then
2954 if test "x$withval" = "xyes" ; then
2955 KRB5ROOT="/usr/local"
2956 else
2957 KRB5ROOT=${withval}
2958 fi
2959
2960 AC_DEFINE(KRB5, 1, [Define if you want Kerberos 5 support])
2961 KRB5_MSG="yes"
2962
2963 AC_MSG_CHECKING(for krb5-config)
2964 if test -x $KRB5ROOT/bin/krb5-config ; then
2965 KRB5CONF=$KRB5ROOT/bin/krb5-config
2966 AC_MSG_RESULT($KRB5CONF)
2967
2968 AC_MSG_CHECKING(for gssapi support)
2969 if $KRB5CONF | grep gssapi >/dev/null ; then
2970 AC_MSG_RESULT(yes)
2971 AC_DEFINE(GSSAPI, 1,
2972 [Define this if you want GSSAPI
2973 support in the version 2 protocol])
2974 k5confopts=gssapi
2975 else
2976 AC_MSG_RESULT(no)
2977 k5confopts=""
2978 fi
2979 K5CFLAGS="`$KRB5CONF --cflags $k5confopts`"
2980 K5LIBS="`$KRB5CONF --libs $k5confopts`"
2981 CPPFLAGS="$CPPFLAGS $K5CFLAGS"
2982 AC_MSG_CHECKING(whether we are using Heimdal)
2983 AC_TRY_COMPILE([ #include <krb5.h> ],
2984 [ char *tmp = heimdal_version; ],
2985 [ AC_MSG_RESULT(yes)
2986 AC_DEFINE(HEIMDAL, 1,
2987 [Define this if you are using the
2988 Heimdal version of Kerberos V5]) ],
2989 AC_MSG_RESULT(no)
2990 )
2991 else
2992 AC_MSG_RESULT(no)
2993 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
2994 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
2995 AC_MSG_CHECKING(whether we are using Heimdal)
2996 AC_TRY_COMPILE([ #include <krb5.h> ],
2997 [ char *tmp = heimdal_version; ],
2998 [ AC_MSG_RESULT(yes)
2999 AC_DEFINE(HEIMDAL)
3000 K5LIBS="-lkrb5 -ldes"
3001 K5LIBS="$K5LIBS -lcom_err -lasn1"
3002 AC_CHECK_LIB(roken, net_write,
3003 [K5LIBS="$K5LIBS -lroken"])
3004 ],
3005 [ AC_MSG_RESULT(no)
3006 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
3007 ]
3008 )
3009 AC_SEARCH_LIBS(dn_expand, resolv)
3010
3011 AC_CHECK_LIB(gssapi,gss_init_sec_context,
3012 [ AC_DEFINE(GSSAPI)
3013 K5LIBS="-lgssapi $K5LIBS" ],
3014 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
3015 [ AC_DEFINE(GSSAPI)
3016 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
3017 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
3018 $K5LIBS)
3019 ],
3020 $K5LIBS)
3021
3022 AC_CHECK_HEADER(gssapi.h, ,
3023 [ unset ac_cv_header_gssapi_h
3024 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3025 AC_CHECK_HEADERS(gssapi.h, ,
3026 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
3027 )
3028 ]
3029 )
3030
3031 oldCPP="$CPPFLAGS"
3032 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
3033 AC_CHECK_HEADER(gssapi_krb5.h, ,
3034 [ CPPFLAGS="$oldCPP" ])
3035
3036 fi
3037 if test ! -z "$need_dash_r" ; then
3038 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
3039 fi
3040 if test ! -z "$blibpath" ; then
3041 blibpath="$blibpath:${KRB5ROOT}/lib"
3042 fi
3043
3044 AC_CHECK_HEADERS(gssapi.h gssapi/gssapi.h)
3045 AC_CHECK_HEADERS(gssapi_krb5.h gssapi/gssapi_krb5.h)
3046 AC_CHECK_HEADERS(gssapi_generic.h gssapi/gssapi_generic.h)
3047
3048 LIBS="$LIBS $K5LIBS"
3049 AC_SEARCH_LIBS(k_hasafs, kafs, AC_DEFINE(USE_AFS, 1,
3050 [Define this if you want to use libkafs' AFS support]))
3051 fi
3052 ]
3053)
3054
3055# Looking for programs, paths and files
3056
3057PRIVSEP_PATH=/var/empty
3058AC_ARG_WITH(privsep-path,
3059 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
3060 [
3061 if test -n "$withval" && test "x$withval" != "xno" && \
3062 test "x${withval}" != "xyes"; then
3063 PRIVSEP_PATH=$withval
3064 fi
3065 ]
3066)
3067AC_SUBST(PRIVSEP_PATH)
3068
3069AC_ARG_WITH(xauth,
3070 [ --with-xauth=PATH Specify path to xauth program ],
3071 [
3072 if test -n "$withval" && test "x$withval" != "xno" && \
3073 test "x${withval}" != "xyes"; then
3074 xauth_path=$withval
3075 fi
3076 ],
3077 [
3078 TestPath="$PATH"
3079 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
3080 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
3081 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
3082 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
3083 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
3084 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
3085 xauth_path="/usr/openwin/bin/xauth"
3086 fi
3087 ]
3088)
3089
3090STRIP_OPT=-s
3091AC_ARG_ENABLE(strip,
3092 [ --disable-strip Disable calling strip(1) on install],
3093 [
3094 if test "x$enableval" = "xno" ; then
3095 STRIP_OPT=
3096 fi
3097 ]
3098)
3099AC_SUBST(STRIP_OPT)
3100
3101if test -z "$xauth_path" ; then
3102 XAUTH_PATH="undefined"
3103 AC_SUBST(XAUTH_PATH)
3104else
3105 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path",
3106 [Define if xauth is found in your path])
3107 XAUTH_PATH=$xauth_path
3108 AC_SUBST(XAUTH_PATH)
3109fi
3110
3111# Check for mail directory (last resort if we cannot get it from headers)
3112if test ! -z "$MAIL" ; then
3113 maildir=`dirname $MAIL`
3114 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir",
3115 [Set this to your mail directory if you don't have maillock.h])
3116fi
3117
3118if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes"; then
3119 AC_MSG_WARN([cross compiling: Disabling /dev/ptmx test])
3120 disable_ptmx_check=yes
3121fi
3122if test -z "$no_dev_ptmx" ; then
3123 if test "x$disable_ptmx_check" != "xyes" ; then
3124 AC_CHECK_FILE("/dev/ptmx",
3125 [
3126 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX, 1,
3127 [Define if you have /dev/ptmx])
3128 have_dev_ptmx=1
3129 ]
3130 )
3131 fi
3132fi
3133
3134if test ! -z "$cross_compiling" && test "x$cross_compiling" != "xyes"; then
3135 AC_CHECK_FILE("/dev/ptc",
3136 [
3137 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC, 1,
3138 [Define if you have /dev/ptc])
3139 have_dev_ptc=1
3140 ]
3141 )
3142else
3143 AC_MSG_WARN([cross compiling: Disabling /dev/ptc test])
3144fi
3145
3146# Options from here on. Some of these are preset by platform above
3147AC_ARG_WITH(mantype,
3148 [ --with-mantype=man|cat|doc Set man page type],
3149 [
3150 case "$withval" in
3151 man|cat|doc)
3152 MANTYPE=$withval
3153 ;;
3154 *)
3155 AC_MSG_ERROR(invalid man type: $withval)
3156 ;;
3157 esac
3158 ]
3159)
3160if test -z "$MANTYPE"; then
3161 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
3162 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
3163 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
3164 MANTYPE=doc
3165 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
3166 MANTYPE=man
3167 else
3168 MANTYPE=cat
3169 fi
3170fi
3171AC_SUBST(MANTYPE)
3172if test "$MANTYPE" = "doc"; then
3173 mansubdir=man;
3174else
3175 mansubdir=$MANTYPE;
3176fi
3177AC_SUBST(mansubdir)
3178
3179# Check whether to enable MD5 passwords
3180MD5_MSG="no"
3181AC_ARG_WITH(md5-passwords,
3182 [ --with-md5-passwords Enable use of MD5 passwords],
3183 [
3184 if test "x$withval" != "xno" ; then
3185 AC_DEFINE(HAVE_MD5_PASSWORDS, 1,
3186 [Define if you want to allow MD5 passwords])
3187 MD5_MSG="yes"
3188 fi
3189 ]
3190)
3191
3192# Whether to disable shadow password support
3193AC_ARG_WITH(shadow,
3194 [ --without-shadow Disable shadow password support],
3195 [
3196 if test "x$withval" = "xno" ; then
3197 AC_DEFINE(DISABLE_SHADOW)
3198 disable_shadow=yes
3199 fi
3200 ]
3201)
3202
3203if test -z "$disable_shadow" ; then
3204 AC_MSG_CHECKING([if the systems has expire shadow information])
3205 AC_TRY_COMPILE(
3206 [
3207#include <sys/types.h>
3208#include <shadow.h>
3209 struct spwd sp;
3210 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
3211 [ sp_expire_available=yes ], []
3212 )
3213
3214 if test "x$sp_expire_available" = "xyes" ; then
3215 AC_MSG_RESULT(yes)
3216 AC_DEFINE(HAS_SHADOW_EXPIRE, 1,
3217 [Define if you want to use shadow password expire field])
3218 else
3219 AC_MSG_RESULT(no)
3220 fi
3221fi
3222
3223# Use ip address instead of hostname in $DISPLAY
3224if test ! -z "$IPADDR_IN_DISPLAY" ; then
3225 DISPLAY_HACK_MSG="yes"
3226 AC_DEFINE(IPADDR_IN_DISPLAY, 1,
3227 [Define if you need to use IP address
3228 instead of hostname in $DISPLAY])
3229else
3230 DISPLAY_HACK_MSG="no"
3231 AC_ARG_WITH(ipaddr-display,
3232 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
3233 [
3234 if test "x$withval" != "xno" ; then
3235 AC_DEFINE(IPADDR_IN_DISPLAY)
3236 DISPLAY_HACK_MSG="yes"
3237 fi
3238 ]
3239 )
3240fi
3241
3242# check for /etc/default/login and use it if present.
3243AC_ARG_ENABLE(etc-default-login,
3244 [ --disable-etc-default-login Disable using PATH from /etc/default/login [no]],
3245 [ if test "x$enableval" = "xno"; then
3246 AC_MSG_NOTICE([/etc/default/login handling disabled])
3247 etc_default_login=no
3248 else
3249 etc_default_login=yes
3250 fi ],
3251 [ if test ! -z "$cross_compiling" && test "x$cross_compiling" = "xyes";
3252 then
3253 AC_MSG_WARN([cross compiling: not checking /etc/default/login])
3254 etc_default_login=no
3255 else
3256 etc_default_login=yes
3257 fi ]
3258)
3259
3260if test "x$etc_default_login" != "xno"; then
3261 AC_CHECK_FILE("/etc/default/login",
3262 [ external_path_file=/etc/default/login ])
3263 if test "x$external_path_file" = "x/etc/default/login"; then
3264 AC_DEFINE(HAVE_ETC_DEFAULT_LOGIN, 1,
3265 [Define if your system has /etc/default/login])
3266 fi
3267fi
3268
3269dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
3270if test $ac_cv_func_login_getcapbool = "yes" && \
3271 test $ac_cv_header_login_cap_h = "yes" ; then
3272 external_path_file=/etc/login.conf
3273fi
3274
3275# Whether to mess with the default path
3276SERVER_PATH_MSG="(default)"
3277AC_ARG_WITH(default-path,
3278 [ --with-default-path= Specify default \$PATH environment for server],
3279 [
3280 if test "x$external_path_file" = "x/etc/login.conf" ; then
3281 AC_MSG_WARN([
3282--with-default-path=PATH has no effect on this system.
3283Edit /etc/login.conf instead.])
3284 elif test "x$withval" != "xno" ; then
3285 if test ! -z "$external_path_file" ; then
3286 AC_MSG_WARN([
3287--with-default-path=PATH will only be used if PATH is not defined in
3288$external_path_file .])
3289 fi
3290 user_path="$withval"
3291 SERVER_PATH_MSG="$withval"
3292 fi
3293 ],
3294 [ if test "x$external_path_file" = "x/etc/login.conf" ; then
3295 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
3296 else
3297 if test ! -z "$external_path_file" ; then
3298 AC_MSG_WARN([
3299If PATH is defined in $external_path_file, ensure the path to scp is included,
3300otherwise scp will not work.])
3301 fi
3302 AC_RUN_IFELSE(
3303 [AC_LANG_SOURCE([[
3304/* find out what STDPATH is */
3305#include <stdio.h>
3306#ifdef HAVE_PATHS_H
3307# include <paths.h>
3308#endif
3309#ifndef _PATH_STDPATH
3310# ifdef _PATH_USERPATH /* Irix */
3311# define _PATH_STDPATH _PATH_USERPATH
3312# else
3313# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
3314# endif
3315#endif
3316#include <sys/types.h>
3317#include <sys/stat.h>
3318#include <fcntl.h>
3319#define DATA "conftest.stdpath"
3320
3321main()
3322{
3323 FILE *fd;
3324 int rc;
3325
3326 fd = fopen(DATA,"w");
3327 if(fd == NULL)
3328 exit(1);
3329
3330 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
3331 exit(1);
3332
3333 exit(0);
3334}
3335 ]])],
3336 [ user_path=`cat conftest.stdpath` ],
3337 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
3338 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
3339 )
3340# make sure $bindir is in USER_PATH so scp will work
3341 t_bindir=`eval echo ${bindir}`
3342 case $t_bindir in
3343 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
3344 esac
3345 case $t_bindir in
3346 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
3347 esac
3348 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
3349 if test $? -ne 0 ; then
3350 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
3351 if test $? -ne 0 ; then
3352 user_path=$user_path:$t_bindir
3353 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
3354 fi
3355 fi
3356 fi ]
3357)
3358if test "x$external_path_file" != "x/etc/login.conf" ; then
3359 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path", [Specify default $PATH])
3360 AC_SUBST(user_path)
3361fi
3362
3363# Set superuser path separately to user path
3364AC_ARG_WITH(superuser-path,
3365 [ --with-superuser-path= Specify different path for super-user],
3366 [
3367 if test -n "$withval" && test "x$withval" != "xno" && \
3368 test "x${withval}" != "xyes"; then
3369 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval",
3370 [Define if you want a different $PATH
3371 for the superuser])
3372 superuser_path=$withval
3373 fi
3374 ]
3375)
3376
3377
3378AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
3379IPV4_IN6_HACK_MSG="no"
3380AC_ARG_WITH(4in6,
3381 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
3382 [
3383 if test "x$withval" != "xno" ; then
3384 AC_MSG_RESULT(yes)
3385 AC_DEFINE(IPV4_IN_IPV6, 1,
3386 [Detect IPv4 in IPv6 mapped addresses
3387 and treat as IPv4])
3388 IPV4_IN6_HACK_MSG="yes"
3389 else
3390 AC_MSG_RESULT(no)
3391 fi
3392 ],[
3393 if test "x$inet6_default_4in6" = "xyes"; then
3394 AC_MSG_RESULT([yes (default)])
3395 AC_DEFINE(IPV4_IN_IPV6)
3396 IPV4_IN6_HACK_MSG="yes"
3397 else
3398 AC_MSG_RESULT([no (default)])
3399 fi
3400 ]
3401)
3402
3403# Whether to enable BSD auth support
3404BSD_AUTH_MSG=no
3405AC_ARG_WITH(bsd-auth,
3406 [ --with-bsd-auth Enable BSD auth support],
3407 [
3408 if test "x$withval" != "xno" ; then
3409 AC_DEFINE(BSD_AUTH, 1,
3410 [Define if you have BSD auth support])
3411 BSD_AUTH_MSG=yes
3412 fi
3413 ]
3414)
3415
3416# Where to place sshd.pid
3417piddir=/var/run
3418# make sure the directory exists
3419if test ! -d $piddir ; then
3420 piddir=`eval echo ${sysconfdir}`
3421 case $piddir in
3422 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
3423 esac
3424fi
3425
3426AC_ARG_WITH(pid-dir,
3427 [ --with-pid-dir=PATH Specify location of ssh.pid file],
3428 [
3429 if test -n "$withval" && test "x$withval" != "xno" && \
3430 test "x${withval}" != "xyes"; then
3431 piddir=$withval
3432 if test ! -d $piddir ; then
3433 AC_MSG_WARN([** no $piddir directory on this system **])
3434 fi
3435 fi
3436 ]
3437)
3438
3439AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir", [Specify location of ssh.pid])
3440AC_SUBST(piddir)
3441
3442dnl allow user to disable some login recording features
3443AC_ARG_ENABLE(lastlog,
3444 [ --disable-lastlog disable use of lastlog even if detected [no]],
3445 [
3446 if test "x$enableval" = "xno" ; then
3447 AC_DEFINE(DISABLE_LASTLOG)
3448 fi
3449 ]
3450)
3451AC_ARG_ENABLE(utmp,
3452 [ --disable-utmp disable use of utmp even if detected [no]],
3453 [
3454 if test "x$enableval" = "xno" ; then
3455 AC_DEFINE(DISABLE_UTMP)
3456 fi
3457 ]
3458)
3459AC_ARG_ENABLE(utmpx,
3460 [ --disable-utmpx disable use of utmpx even if detected [no]],
3461 [
3462 if test "x$enableval" = "xno" ; then
3463 AC_DEFINE(DISABLE_UTMPX, 1,
3464 [Define if you don't want to use utmpx])
3465 fi
3466 ]
3467)
3468AC_ARG_ENABLE(wtmp,
3469 [ --disable-wtmp disable use of wtmp even if detected [no]],
3470 [
3471 if test "x$enableval" = "xno" ; then
3472 AC_DEFINE(DISABLE_WTMP)
3473 fi
3474 ]
3475)
3476AC_ARG_ENABLE(wtmpx,
3477 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
3478 [
3479 if test "x$enableval" = "xno" ; then
3480 AC_DEFINE(DISABLE_WTMPX, 1,
3481 [Define if you don't want to use wtmpx])
3482 fi
3483 ]
3484)
3485AC_ARG_ENABLE(libutil,
3486 [ --disable-libutil disable use of libutil (login() etc.) [no]],
3487 [
3488 if test "x$enableval" = "xno" ; then
3489 AC_DEFINE(DISABLE_LOGIN)
3490 fi
3491 ]
3492)
3493AC_ARG_ENABLE(pututline,
3494 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
3495 [
3496 if test "x$enableval" = "xno" ; then
3497 AC_DEFINE(DISABLE_PUTUTLINE, 1,
3498 [Define if you don't want to use pututline()
3499 etc. to write [uw]tmp])
3500 fi
3501 ]
3502)
3503AC_ARG_ENABLE(pututxline,
3504 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
3505 [
3506 if test "x$enableval" = "xno" ; then
3507 AC_DEFINE(DISABLE_PUTUTXLINE, 1,
3508 [Define if you don't want to use pututxline()
3509 etc. to write [uw]tmpx])
3510 fi
3511 ]
3512)
3513AC_ARG_WITH(lastlog,
3514 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
3515 [
3516 if test "x$withval" = "xno" ; then
3517 AC_DEFINE(DISABLE_LASTLOG)
3518 elif test -n "$withval" && test "x${withval}" != "xyes"; then
3519 conf_lastlog_location=$withval
3520 fi
3521 ]
3522)
3523
3524dnl lastlog, [uw]tmpx? detection
3525dnl NOTE: set the paths in the platform section to avoid the
3526dnl need for command-line parameters
3527dnl lastlog and [uw]tmp are subject to a file search if all else fails
3528
3529dnl lastlog detection
3530dnl NOTE: the code itself will detect if lastlog is a directory
3531AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
3532AC_TRY_COMPILE([
3533#include <sys/types.h>
3534#include <utmp.h>
3535#ifdef HAVE_LASTLOG_H
3536# include <lastlog.h>
3537#endif
3538#ifdef HAVE_PATHS_H
3539# include <paths.h>
3540#endif
3541#ifdef HAVE_LOGIN_H
3542# include <login.h>
3543#endif
3544 ],
3545 [ char *lastlog = LASTLOG_FILE; ],
3546 [ AC_MSG_RESULT(yes) ],
3547 [
3548 AC_MSG_RESULT(no)
3549 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
3550 AC_TRY_COMPILE([
3551#include <sys/types.h>
3552#include <utmp.h>
3553#ifdef HAVE_LASTLOG_H
3554# include <lastlog.h>
3555#endif
3556#ifdef HAVE_PATHS_H
3557# include <paths.h>
3558#endif
3559 ],
3560 [ char *lastlog = _PATH_LASTLOG; ],
3561 [ AC_MSG_RESULT(yes) ],
3562 [
3563 AC_MSG_RESULT(no)
3564 system_lastlog_path=no
3565 ])
3566 ]
3567)
3568
3569if test -z "$conf_lastlog_location"; then
3570 if test x"$system_lastlog_path" = x"no" ; then
3571 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
3572 if (test -d "$f" || test -f "$f") ; then
3573 conf_lastlog_location=$f
3574 fi
3575 done
3576 if test -z "$conf_lastlog_location"; then
3577 AC_MSG_WARN([** Cannot find lastlog **])
3578 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
3579 fi
3580 fi
3581fi
3582
3583if test -n "$conf_lastlog_location"; then
3584 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location",
3585 [Define if you want to specify the path to your lastlog file])
3586fi
3587
3588dnl utmp detection
3589AC_MSG_CHECKING([if your system defines UTMP_FILE])
3590AC_TRY_COMPILE([
3591#include <sys/types.h>
3592#include <utmp.h>
3593#ifdef HAVE_PATHS_H
3594# include <paths.h>
3595#endif
3596 ],
3597 [ char *utmp = UTMP_FILE; ],
3598 [ AC_MSG_RESULT(yes) ],
3599 [ AC_MSG_RESULT(no)
3600 system_utmp_path=no ]
3601)
3602if test -z "$conf_utmp_location"; then
3603 if test x"$system_utmp_path" = x"no" ; then
3604 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
3605 if test -f $f ; then
3606 conf_utmp_location=$f
3607 fi
3608 done
3609 if test -z "$conf_utmp_location"; then
3610 AC_DEFINE(DISABLE_UTMP)
3611 fi
3612 fi
3613fi
3614if test -n "$conf_utmp_location"; then
3615 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location",
3616 [Define if you want to specify the path to your utmp file])
3617fi
3618
3619dnl wtmp detection
3620AC_MSG_CHECKING([if your system defines WTMP_FILE])
3621AC_TRY_COMPILE([
3622#include <sys/types.h>
3623#include <utmp.h>
3624#ifdef HAVE_PATHS_H
3625# include <paths.h>
3626#endif
3627 ],
3628 [ char *wtmp = WTMP_FILE; ],
3629 [ AC_MSG_RESULT(yes) ],
3630 [ AC_MSG_RESULT(no)
3631 system_wtmp_path=no ]
3632)
3633if test -z "$conf_wtmp_location"; then
3634 if test x"$system_wtmp_path" = x"no" ; then
3635 for f in /usr/adm/wtmp /var/log/wtmp; do
3636 if test -f $f ; then
3637 conf_wtmp_location=$f
3638 fi
3639 done
3640 if test -z "$conf_wtmp_location"; then
3641 AC_DEFINE(DISABLE_WTMP)
3642 fi
3643 fi
3644fi
3645if test -n "$conf_wtmp_location"; then
3646 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location",
3647 [Define if you want to specify the path to your wtmp file])
3648fi
3649
3650
3651dnl utmpx detection - I don't know any system so perverse as to require
3652dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
3653dnl there, though.
3654AC_MSG_CHECKING([if your system defines UTMPX_FILE])
3655AC_TRY_COMPILE([
3656#include <sys/types.h>
3657#include <utmp.h>
3658#ifdef HAVE_UTMPX_H
3659#include <utmpx.h>
3660#endif
3661#ifdef HAVE_PATHS_H
3662# include <paths.h>
3663#endif
3664 ],
3665 [ char *utmpx = UTMPX_FILE; ],
3666 [ AC_MSG_RESULT(yes) ],
3667 [ AC_MSG_RESULT(no)
3668 system_utmpx_path=no ]
3669)
3670if test -z "$conf_utmpx_location"; then
3671 if test x"$system_utmpx_path" = x"no" ; then
3672 AC_DEFINE(DISABLE_UTMPX)
3673 fi
3674else
3675 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location",
3676 [Define if you want to specify the path to your utmpx file])
3677fi
3678
3679dnl wtmpx detection
3680AC_MSG_CHECKING([if your system defines WTMPX_FILE])
3681AC_TRY_COMPILE([
3682#include <sys/types.h>
3683#include <utmp.h>
3684#ifdef HAVE_UTMPX_H
3685#include <utmpx.h>
3686#endif
3687#ifdef HAVE_PATHS_H
3688# include <paths.h>
3689#endif
3690 ],
3691 [ char *wtmpx = WTMPX_FILE; ],
3692 [ AC_MSG_RESULT(yes) ],
3693 [ AC_MSG_RESULT(no)
3694 system_wtmpx_path=no ]
3695)
3696if test -z "$conf_wtmpx_location"; then
3697 if test x"$system_wtmpx_path" = x"no" ; then
3698 AC_DEFINE(DISABLE_WTMPX)
3699 fi
3700else
3701 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location",
3702 [Define if you want to specify the path to your wtmpx file])
3703fi
3704
3705
3706if test ! -z "$blibpath" ; then
3707 LDFLAGS="$LDFLAGS $blibflags$blibpath"
3708 AC_MSG_WARN([Please check and edit blibpath in LDFLAGS in Makefile])
3709fi
3710
3711dnl remove pam and dl because they are in $LIBPAM
3712if test "$PAM_MSG" = yes ; then
3713 LIBS=`echo $LIBS | sed 's/-lpam //'`
3714fi
3715if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
3716 LIBS=`echo $LIBS | sed 's/-ldl //'`
3717fi
3718
3719dnl Adding -Werror to CFLAGS early prevents configure tests from running.
3720dnl Add now.
3721CFLAGS="$CFLAGS $werror_flags"
3722
3723AC_EXEEXT
3724AC_CONFIG_FILES([Makefile buildpkg.sh opensshd.init openbsd-compat/Makefile \
3725 scard/Makefile ssh_prng_cmds survey.sh])
3726AC_OUTPUT
3727
3728# Print summary of options
3729
3730# Someone please show me a better way :)
3731A=`eval echo ${prefix}` ; A=`eval echo ${A}`
3732B=`eval echo ${bindir}` ; B=`eval echo ${B}`
3733C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
3734D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
3735E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
3736F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
3737G=`eval echo ${piddir}` ; G=`eval echo ${G}`
3738H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
3739I=`eval echo ${user_path}` ; I=`eval echo ${I}`
3740J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3741
3742echo ""
3743echo "OpenSSH has been configured with the following options:"
3744echo " User binaries: $B"
3745echo " System binaries: $C"
3746echo " Configuration files: $D"
3747echo " Askpass program: $E"
3748echo " Manual pages: $F"
3749echo " PID file: $G"
3750echo " Privilege separation chroot path: $H"
3751if test "x$external_path_file" = "x/etc/login.conf" ; then
3752echo " At runtime, sshd will use the path defined in $external_path_file"
3753echo " Make sure the path to scp is present, otherwise scp will not work"
3754else
3755echo " sshd default user PATH: $I"
3756 if test ! -z "$external_path_file"; then
3757echo " (If PATH is set in $external_path_file it will be used instead. If"
3758echo " used, ensure the path to scp is present, otherwise scp will not work.)"
3759 fi
3760fi
3761if test ! -z "$superuser_path" ; then
3762echo " sshd superuser user PATH: $J"
3763fi
3764echo " Manpage format: $MANTYPE"
3765echo " PAM support: $PAM_MSG"
3766echo " KerberosV support: $KRB5_MSG"
3767echo " Smartcard support: $SCARD_MSG"
3768echo " S/KEY support: $SKEY_MSG"
3769echo " TCP Wrappers support: $TCPW_MSG"
3770echo " MD5 password support: $MD5_MSG"
3771echo " libedit support: $LIBEDIT_MSG"
3772echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
3773echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
3774echo " BSD Auth support: $BSD_AUTH_MSG"
3775echo " Random number source: $RAND_MSG"
3776if test ! -z "$USE_RAND_HELPER" ; then
3777echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
3778fi
3779
3780echo ""
3781
3782echo " Host: ${host}"
3783echo " Compiler: ${CC}"
3784echo " Compiler flags: ${CFLAGS}"
3785echo "Preprocessor flags: ${CPPFLAGS}"
3786echo " Linker flags: ${LDFLAGS}"
3787echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
3788
3789echo ""
3790
3791if test "x$MAKE_PACKAGE_SUPPORTED" = "xyes" ; then
3792 echo "SVR4 style packages are supported with \"make package\""
3793 echo ""
3794fi
3795
3796if test "x$PAM_MSG" = "xyes" ; then
3797 echo "PAM is enabled. You may need to install a PAM control file "
3798 echo "for sshd, otherwise password authentication may fail. "
3799 echo "Example PAM control files can be found in the contrib/ "
3800 echo "subdirectory"
3801 echo ""
3802fi
3803
3804if test ! -z "$RAND_HELPER_CMDHASH" ; then
3805 echo "WARNING: you are using the builtin random number collection "
3806 echo "service. Please read WARNING.RNG and request that your OS "
3807 echo "vendor includes kernel-based random number collection in "
3808 echo "future versions of your OS."
3809 echo ""
3810fi
3811
3812if test ! -z "$NO_PEERCHECK" ; then
3813 echo "WARNING: the operating system that you are using does not "
3814 echo "appear to support either the getpeereid() API nor the "
3815 echo "SO_PEERCRED getsockopt() option. These facilities are used to "
3816 echo "enforce security checks to prevent unauthorised connections to "
3817 echo "ssh-agent. Their absence increases the risk that a malicious "
3818 echo "user can connect to your agent. "
3819 echo ""
3820fi
3821
3822if test "$AUDIT_MODULE" = "bsm" ; then
3823 echo "WARNING: BSM audit support is currently considered EXPERIMENTAL."
3824 echo "See the Solaris section in README.platform for details."
3825fi
This page took 0.187939 seconds and 5 git commands to generate.