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