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