]> andersk Git - openssh.git/blame - configure.ac
- (djm) Bug #456: Support for NEC SX6 with Unicos; from wendyp@cray.com
[openssh.git] / configure.ac
CommitLineData
eb5d7ff6 1# $Id$
0b202697 2
98a7c37b 3AC_INIT
4AC_CONFIG_SRCDIR([ssh.c])
5881cd60 5
6AC_CONFIG_HEADER(config.h)
b14b2ae7 7AC_PROG_CC
a7effaac 8AC_CANONICAL_HOST
cf0c5df5 9AC_C_BIGENDIAN
5881cd60 10
a0391976 11# Checks for programs.
4cca272e 12AC_PROG_CPP
5881cd60 13AC_PROG_RANLIB
cf8dd513 14AC_PROG_INSTALL
bee0a37e 15AC_PATH_PROG(AR, ar)
13dd877b 16AC_PATH_PROGS(PERL, perl5 perl)
c3690df3 17AC_PATH_PROG(SED, sed)
a0f84251 18AC_SUBST(PERL)
ad85db64 19AC_PATH_PROG(ENT, ent)
20AC_SUBST(ENT)
6958bd37 21AC_PATH_PROG(TEST_MINUS_S_SH, bash)
22AC_PATH_PROG(TEST_MINUS_S_SH, ksh)
23AC_PATH_PROG(TEST_MINUS_S_SH, sh)
6193497b 24AC_PATH_PROG(SH, sh)
f498ed15 25
948fd8b9 26# System features
27AC_SYS_LARGEFILE
28
c193d002 29if test -z "$AR" ; then
30 AC_MSG_ERROR([*** 'ar' missing, please install or fix your \$PATH ***])
31fi
32
2e73a022 33# Use LOGIN_PROGRAM from environment if possible
34if test ! -z "$LOGIN_PROGRAM" ; then
35 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM")
36else
37 # Search for login
38 AC_PATH_PROG(LOGIN_PROGRAM_FALLBACK, login)
39 if test ! -z "$LOGIN_PROGRAM_FALLBACK" ; then
40 AC_DEFINE_UNQUOTED(LOGIN_PROGRAM_FALLBACK, "$LOGIN_PROGRAM_FALLBACK")
41 fi
42fi
43
d423d822 44if test -z "$LD" ; then
45 LD=$CC
46fi
47AC_SUBST(LD)
48
d423d822 49AC_C_INLINE
5ed2bb5b 50if test "$GCC" = "yes" || test "$GCC" = "egcs"; then
51 CFLAGS="$CFLAGS -Wall -Wpointer-arith -Wno-uninitialized"
d423d822 52fi
53
a0391976 54# Check for some target-specific stuff
a7effaac 55case "$host" in
9d6b1b96 56*-*-aix*)
57 AFS_LIBS="-lld"
0c2fb82f 58 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
84afc958 59 LDFLAGS="$LDFLAGS -L/usr/local/lib"
e5fe9a1f 60 if (test "$LD" != "gcc" && test -z "$blibpath"); then
52f1ccb2 61 AC_MSG_CHECKING([if linkage editor ($LD) accepts -blibpath])
62 saved_LDFLAGS="$LDFLAGS"
63 LDFLAGS="$LDFLAGS -blibpath:/usr/lib:/lib:/usr/local/lib"
64 AC_TRY_LINK([],
65 [],
66 [
67 AC_MSG_RESULT(yes)
68 blibpath="/usr/lib:/lib:/usr/local/lib"
69 ],
70 [ AC_MSG_RESULT(no) ]
71 )
72 LDFLAGS="$saved_LDFLAGS"
bd499f9e 73 fi
0764e748 74 AC_CHECK_FUNC(authenticate, [AC_DEFINE(WITH_AIXAUTHENTICATE)],
75 [AC_CHECK_LIB(s,authenticate,
76 [ AC_DEFINE(WITH_AIXAUTHENTICATE)
77 LIBS="$LIBS -ls"
78 ])
79 ])
4c8ef3fb 80 AC_DEFINE(BROKEN_GETADDRINFO)
1352689f 81 AC_DEFINE(BROKEN_REALPATH)
a3cef3ca 82 dnl AIX handles lastlog as part of its login message
83 AC_DEFINE(DISABLE_LASTLOG)
58177c0a 84 AC_DEFINE(LOGIN_NEEDS_UTMPX)
e80fb2a0 85 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_CLOBBER_ARGV)
86 AC_DEFINE(SETPROCTITLE_PS_PADDING, '\0')
9d6b1b96 87 ;;
3c62e7eb 88*-*-cygwin*)
a52997bd 89 check_for_libcrypt_later=1
ffb8d130 90 LIBS="$LIBS /usr/lib/textmode.o"
3c62e7eb 91 AC_DEFINE(HAVE_CYGWIN)
7043a38d 92 AC_DEFINE(USE_PIPES)
3c62e7eb 93 AC_DEFINE(DISABLE_SHADOW)
94 AC_DEFINE(IPV4_DEFAULT)
95 AC_DEFINE(IP_TOS_IS_BROKEN)
3d114925 96 AC_DEFINE(NO_X11_UNIX_SOCKETS)
e6f15ed1 97 AC_DEFINE(NO_IPPORT_RESERVED_CONCEPT)
94d8258b 98 AC_DEFINE(DISABLE_FD_PASSING)
246446cd 99 AC_DEFINE(SETGROUPS_NOOP)
3c62e7eb 100 ;;
d6fdb079 101*-*-dgux*)
102 AC_DEFINE(IP_TOS_IS_BROKEN)
103 ;;
39c98ef7 104*-*-darwin*)
33e2e066 105 AC_MSG_CHECKING(if we have working getaddrinfo)
106 AC_TRY_RUN([#include <mach-o/dyld.h>
107main() { if (NSVersionOfRunTimeLibrary("System") >= (60 << 16))
108 exit(0);
109 else
110 exit(1);
111}], [AC_MSG_RESULT(working)],
112 [AC_MSG_RESULT(buggy)
113 AC_DEFINE(BROKEN_GETADDRINFO)],
114 [AC_MSG_RESULT(assume it is working)])
39c98ef7 115 ;;
6e879cb4 116*-*-hpux10.26)
117 if test -z "$GCC"; then
118 CFLAGS="$CFLAGS -Ae"
119 fi
120 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
121 IPADDR_IN_DISPLAY=yes
122 AC_DEFINE(HAVE_SECUREWARE)
123 AC_DEFINE(USE_PIPES)
124 AC_DEFINE(LOGIN_NO_ENDOPT)
125 AC_DEFINE(LOGIN_NEEDS_UTMPX)
126 AC_DEFINE(DISABLE_SHADOW)
127 AC_DEFINE(DISABLE_UTMP)
e80fb2a0 128 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT)
f75ca46d 129 LIBS="$LIBS -lsec -lsecpw"
130 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
6e879cb4 131 disable_ptmx_check=yes
132 ;;
a7effaac 133*-*-hpux10*)
134 if test -z "$GCC"; then
fc1e8bf4 135 CFLAGS="$CFLAGS -Ae"
a7effaac 136 fi
28564873 137 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
44839801 138 IPADDR_IN_DISPLAY=yes
137d7b6c 139 AC_DEFINE(USE_PIPES)
a2572aa7 140 AC_DEFINE(LOGIN_NO_ENDOPT)
141 AC_DEFINE(LOGIN_NEEDS_UTMPX)
0bbfbdeb 142 AC_DEFINE(DISABLE_SHADOW)
764d4113 143 AC_DEFINE(DISABLE_UTMP)
e80fb2a0 144 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT)
f75ca46d 145 LIBS="$LIBS -lsec"
146 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
a7effaac 147 ;;
2b763e31 148*-*-hpux11*)
b8fea62d 149 CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE -D_XOPEN_SOURCE -D_XOPEN_SOURCE_EXTENDED=1"
44839801 150 IPADDR_IN_DISPLAY=yes
adeebd37 151 AC_DEFINE(PAM_SUN_CODEBASE)
2b10f47a 152 AC_DEFINE(USE_PIPES)
a2572aa7 153 AC_DEFINE(LOGIN_NO_ENDOPT)
154 AC_DEFINE(LOGIN_NEEDS_UTMPX)
0bbfbdeb 155 AC_DEFINE(DISABLE_SHADOW)
764d4113 156 AC_DEFINE(DISABLE_UTMP)
e80fb2a0 157 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_PSTAT)
f75ca46d 158 LIBS="$LIBS -lsec"
159 AC_CHECK_LIB(xnet, t_error, ,AC_MSG_ERROR([*** -lxnet needed on HP-UX - check config.log ***]))
2b763e31 160 ;;
d94aa2ae 161*-*-irix5*)
0c2fb82f 162 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
c5fa2eb0 163 LDFLAGS="$LDFLAGS"
6ac7829a 164 PATH="$PATH:/usr/etc"
416ed5a7 165 AC_DEFINE(BROKEN_INET_NTOA)
0e8f4eba 166 AC_DEFINE(WITH_ABBREV_NO_TTY)
b9795b89 167 ;;
168*-*-irix6*)
0c2fb82f 169 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
c5fa2eb0 170 LDFLAGS="$LDFLAGS"
6ac7829a 171 PATH="$PATH:/usr/etc"
3206bb3b 172 AC_DEFINE(WITH_IRIX_ARRAY)
173 AC_DEFINE(WITH_IRIX_PROJECT)
174 AC_DEFINE(WITH_IRIX_AUDIT)
b5171f93 175 AC_CHECK_FUNC(jlimit_startjob, [AC_DEFINE(WITH_IRIX_JOBS)])
416ed5a7 176 AC_DEFINE(BROKEN_INET_NTOA)
0e8f4eba 177 AC_DEFINE(WITH_ABBREV_NO_TTY)
d94aa2ae 178 ;;
5cdfe03f 179*-*-linux*)
180 no_dev_ptmx=1
717057b6 181 check_for_libcrypt_later=1
80faa19f 182 AC_DEFINE(DONT_TRY_OTHER_AF)
a8545c6c 183 AC_DEFINE(PAM_TTY_KLUDGE)
e80fb2a0 184 AC_DEFINE(SETPROCTITLE_STRATEGY,PS_USE_CLOBBER_ARGV)
185 AC_DEFINE(SETPROCTITLE_PS_PADDING, '\0')
80faa19f 186 inet6_default_4in6=yes
5cdfe03f 187 ;;
66d6c27e 188mips-sony-bsd|mips-sony-newsos4)
189 AC_DEFINE(HAVE_NEWS4)
190 SONY=1
66d6c27e 191 ;;
d468fc76 192*-*-netbsd*)
33e2e066 193 check_for_libcrypt_before=1
a0391976 194 need_dash_r=1
d468fc76 195 ;;
86b416a7 196*-*-freebsd*)
197 check_for_libcrypt_later=1
198 ;;
729bfe59 199*-next-*)
729bfe59 200 conf_lastlog_location="/usr/adm/lastlog"
698d107e 201 conf_utmp_location=/etc/utmp
202 conf_wtmp_location=/usr/adm/wtmp
203 MAIL=/usr/spool/mail
729bfe59 204 AC_DEFINE(HAVE_NEXT)
443172c4 205 AC_DEFINE(BROKEN_REALPATH)
00937921 206 AC_DEFINE(USE_PIPES)
86b416a7 207 AC_DEFINE(BROKEN_SAVED_UIDS)
0c2fb82f 208 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
b1335fdf 209 CFLAGS="$CFLAGS"
729bfe59 210 ;;
9d6b1b96 211*-*-solaris*)
0c2fb82f 212 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
fbf305f1 213 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
a0391976 214 need_dash_r=1
adeebd37 215 AC_DEFINE(PAM_SUN_CODEBASE)
7e2d5fa4 216 AC_DEFINE(LOGIN_NEEDS_UTMPX)
217 AC_DEFINE(LOGIN_NEEDS_TERM)
7f0a4ff1 218 AC_DEFINE(PAM_TTY_KLUDGE)
1d7b9b20 219 # hardwire lastlog location (can't detect it on some versions)
220 conf_lastlog_location="/var/adm/lastlog"
32c80420 221 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
222 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
223 if test "$sol2ver" -ge 8; then
224 AC_MSG_RESULT(yes)
225 AC_DEFINE(DISABLE_UTMP)
226 AC_DEFINE(DISABLE_WTMP)
227 else
228 AC_MSG_RESULT(no)
229 fi
9d6b1b96 230 ;;
a423beaf 231*-*-sunos4*)
0c2fb82f 232 CPPFLAGS="$CPPFLAGS -DSUNOS4"
a423beaf 233 AC_CHECK_FUNCS(getpwanam)
adeebd37 234 AC_DEFINE(PAM_SUN_CODEBASE)
32eec038 235 conf_utmp_location=/etc/utmp
236 conf_wtmp_location=/var/adm/wtmp
237 conf_lastlog_location=/var/adm/lastlog
137d7b6c 238 AC_DEFINE(USE_PIPES)
a423beaf 239 ;;
6f68f28a 240*-ncr-sysv*)
241 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
242 LDFLAGS="$LDFLAGS -L/usr/local/lib"
98a7c37b 243 LIBS="$LIBS -lc89"
29525240 244 AC_DEFINE(USE_PIPES)
6f68f28a 245 ;;
132dd316 246*-sni-sysv*)
0c2fb82f 247 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
c8c15bcb 248 # /usr/ucblib MUST NOT be searched on ReliantUNIX
249 LDFLAGS="$LDFLAGS -L/usr/local/lib"
9548d6c8 250 IPADDR_IN_DISPLAY=yes
251 AC_DEFINE(USE_PIPES)
132dd316 252 AC_DEFINE(IP_TOS_IS_BROKEN)
c8c15bcb 253 # /usr/ucblib/libucb.a no longer needed on ReliantUNIX
254 # Attention: always take care to bind libsocket and libnsl before libc,
255 # otherwise you will find lots of "SIOCGPGRP errno 22" on syslog
132dd316 256 ;;
77bb0bca 257*-*-sysv4.2*)
0c2fb82f 258 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
77bb0bca 259 LDFLAGS="$LDFLAGS -L/usr/local/lib"
ed6553e2 260 AC_DEFINE(USE_PIPES)
77bb0bca 261 ;;
262*-*-sysv5*)
0c2fb82f 263 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
77bb0bca 264 LDFLAGS="$LDFLAGS -L/usr/local/lib"
ed6553e2 265 AC_DEFINE(USE_PIPES)
77bb0bca 266 ;;
9d6b1b96 267*-*-sysv*)
0c2fb82f 268 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
84afc958 269 LDFLAGS="$LDFLAGS -L/usr/local/lib"
9d6b1b96 270 ;;
77bb0bca 271*-*-sco3.2v4*)
0c2fb82f 272 CPPFLAGS="$CPPFLAGS -Dftruncate=chsize -I/usr/local/include"
77bb0bca 273 LDFLAGS="$LDFLAGS -L/usr/local/lib"
98a7c37b 274 LIBS="$LIBS -los -lprot -lx -ltinfo -lm"
77bb0bca 275 RANLIB=true
ed6553e2 276 no_dev_ptmx=1
77bb0bca 277 AC_DEFINE(BROKEN_SYS_TERMIO_H)
ed6553e2 278 AC_DEFINE(USE_PIPES)
6e879cb4 279 AC_DEFINE(HAVE_SECUREWARE)
d287c664 280 AC_DEFINE(DISABLE_SHADOW)
86b416a7 281 AC_DEFINE(BROKEN_SAVED_UIDS)
aca75d94 282 AC_CHECK_FUNCS(getluid setluid)
533875af 283 MANTYPE=man
98a7c37b 284 do_sco3_extra_lib_check=yes
77bb0bca 285 ;;
286*-*-sco3.2v5*)
21710e39 287 if test -z "$GCC"; then
288 CFLAGS="$CFLAGS -belf"
289 fi
0c2fb82f 290 CPPFLAGS="$CPPFLAGS -I/usr/local/include"
509b1f88 291 LDFLAGS="$LDFLAGS -L/usr/local/lib"
ed6553e2 292 LIBS="$LIBS -lprot -lx -ltinfo -lm"
509b1f88 293 no_dev_ptmx=1
ed6553e2 294 AC_DEFINE(USE_PIPES)
6e879cb4 295 AC_DEFINE(HAVE_SECUREWARE)
d287c664 296 AC_DEFINE(DISABLE_SHADOW)
94d8258b 297 AC_DEFINE(DISABLE_FD_PASSING)
aca75d94 298 AC_CHECK_FUNCS(getluid setluid)
533875af 299 MANTYPE=man
509b1f88 300 ;;
ccbb983c 301*-*-unicosmk*)
ccbb983c 302 AC_DEFINE(USE_PIPES)
303 AC_DEFINE(DISABLE_FD_PASSING)
304 LDFLAGS="$LDFLAGS"
305 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
306 MANTYPE=cat
d262b7f2 307 ;;
ca5c7d6a 308*-*-unicos*)
ca5c7d6a 309 AC_DEFINE(USE_PIPES)
94d8258b 310 AC_DEFINE(DISABLE_FD_PASSING)
ef51930f 311 AC_DEFINE(NO_SSH_LASTLOG)
ccbb983c 312 LDFLAGS="$LDFLAGS -Wl,-Dmsglevel=334:fatal"
313 LIBS="$LIBS -lgen -lrsc -lshare -luex -lacm"
314 MANTYPE=cat
a704dd54 315 ;;
4d33e531 316*-dec-osf*)
99c8ddac 317 AC_MSG_CHECKING(for Digital Unix SIA)
318 no_osfsia=""
319 AC_ARG_WITH(osfsia,
320 [ --with-osfsia Enable Digital Unix SIA],
321 [
322 if test "x$withval" = "xno" ; then
323 AC_MSG_RESULT(disabled)
324 no_osfsia=1
325 fi
326 ],
327 )
328 if test -z "$no_osfsia" ; then
4d33e531 329 if test -f /etc/sia/matrix.conf; then
330 AC_MSG_RESULT(yes)
331 AC_DEFINE(HAVE_OSF_SIA)
332 AC_DEFINE(DISABLE_LOGIN)
333 LIBS="$LIBS -lsecurity -ldb -lm -laud"
334 else
335 AC_MSG_RESULT(no)
336 fi
337 fi
6af8f131 338 AC_DEFINE(DISABLE_FD_PASSING)
4d33e531 339 ;;
41cb4569 340
341*-*-nto-qnx)
342 AC_DEFINE(USE_PIPES)
343 AC_DEFINE(NO_X11_UNIX_SOCKETS)
344 AC_DEFINE(MISSING_NFDBITS)
345 AC_DEFINE(MISSING_HOWMANY)
346 AC_DEFINE(MISSING_FD_MASK)
347 ;;
a7effaac 348esac
349
8e7b16f8 350# Allow user to specify flags
351AC_ARG_WITH(cflags,
352 [ --with-cflags Specify additional flags to pass to compiler],
353 [
354 if test "x$withval" != "xno" ; then
355 CFLAGS="$CFLAGS $withval"
356 fi
357 ]
358)
0c2fb82f 359AC_ARG_WITH(cppflags,
360 [ --with-cppflags Specify additional flags to pass to preprocessor] ,
361 [
362 if test "x$withval" != "xno"; then
363 CPPFLAGS="$CPPFLAGS $withval"
364 fi
365 ]
366)
8e7b16f8 367AC_ARG_WITH(ldflags,
97b378bf 368 [ --with-ldflags Specify additional flags to pass to linker],
8e7b16f8 369 [
370 if test "x$withval" != "xno" ; then
371 LDFLAGS="$LDFLAGS $withval"
372 fi
373 ]
374)
375AC_ARG_WITH(libs,
376 [ --with-libs Specify additional libraries to link with],
377 [
378 if test "x$withval" != "xno" ; then
379 LIBS="$LIBS $withval"
380 fi
381 ]
382)
383
ddceb1c8 384# Checks for header files.
385AC_CHECK_HEADERS(bstring.h crypt.h endian.h floatingpoint.h \
7d132853 386 getopt.h glob.h ia.h lastlog.h libgen.h limits.h login.h \
ddceb1c8 387 login_cap.h maillock.h netdb.h netgroup.h \
75817f90 388 netinet/in_systm.h paths.h pty.h readpassphrase.h \
5bbbc661 389 rpc/types.h security/pam_appl.h shadow.h stddef.h stdint.h \
ddceb1c8 390 strings.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h \
d0104542 391 sys/mman.h sys/pstat.h sys/select.h sys/stat.h \
ad137007 392 sys/stropts.h sys/sysmacros.h sys/time.h sys/timers.h \
ef51930f 393 sys/un.h time.h tmpdir.h ttyent.h usersec.h \
ddceb1c8 394 util.h utime.h utmp.h utmpx.h)
395
a0391976 396# Checks for libraries.
98a7c37b 397AC_CHECK_FUNC(yp_match, , AC_CHECK_LIB(nsl, yp_match))
398AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
2c523de9 399
f61d6b17 400dnl SCO OS3 needs this for libwrap
98a7c37b 401if test "x$with_tcp_wrappers" != "xno" ; then
402 if test "x$do_sco3_extra_lib_check" = "xyes" ; then
403 AC_CHECK_LIB(rpc, innetgr, LIBS="-lrpc -lyp -lrpc $LIBS" , , -lyp -lrpc)
404 fi
405fi
406
407AC_CHECK_FUNC(getspnam, ,
408 AC_CHECK_LIB(gen, getspnam, LIBS="$LIBS -lgen"))
98a7c37b 409
9d6b6505 410AC_ARG_WITH(rpath,
411 [ --without-rpath Disable auto-added -R linker paths],
412 [
413 if test "x$withval" = "xno" ; then
414 need_dash_r=""
415 fi
416 if test "x$withval" = "xyes" ; then
417 need_dash_r=1
418 fi
419 ]
420)
421
98a7c37b 422dnl zlib is required
423AC_ARG_WITH(zlib,
424 [ --with-zlib=PATH Use zlib in PATH],
425 [
846f83ab 426 if test "x$withval" = "xno" ; then
f1b0ecc3 427 AC_MSG_ERROR([*** zlib is required ***])
428 fi
98a7c37b 429 if test -d "$withval/lib"; then
430 if test -n "${need_dash_r}"; then
5a162955 431 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
98a7c37b 432 else
5a162955 433 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
98a7c37b 434 fi
435 else
436 if test -n "${need_dash_r}"; then
5a162955 437 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
98a7c37b 438 else
5a162955 439 LDFLAGS="-L${withval} ${LDFLAGS}"
98a7c37b 440 fi
441 fi
442 if test -d "$withval/include"; then
5a162955 443 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
98a7c37b 444 else
5a162955 445 CPPFLAGS="-I${withval} ${CPPFLAGS}"
98a7c37b 446 fi
447 ]
448)
449
051809f6 450AC_CHECK_LIB(z, deflate, ,AC_MSG_ERROR([*** zlib missing - please install first or check config.log ***]))
48e7916f 451
2c523de9 452dnl UnixWare 2.x
453AC_CHECK_FUNC(strcasecmp,
454 [], [ AC_CHECK_LIB(resolv, strcasecmp, LIBS="$LIBS -lresolv") ]
455)
456AC_CHECK_FUNC(utimes,
cda1ebcb 457 [], [ AC_CHECK_LIB(c89, utimes, [AC_DEFINE(HAVE_UTIMES)
458 LIBS="$LIBS -lc89"]) ]
2c523de9 459)
4cca272e 460
7c6d759d 461dnl Checks for libutil functions
462AC_CHECK_HEADERS(libutil.h)
463AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN)])
464AC_CHECK_FUNCS(logout updwtmp logwtmp)
465
a738c3b0 466AC_FUNC_STRFTIME
467
84ceda19 468# Check for ALTDIRFUNC glob() extension
469AC_MSG_CHECKING(for GLOB_ALTDIRFUNC support)
470AC_EGREP_CPP(FOUNDIT,
471 [
472 #include <glob.h>
473 #ifdef GLOB_ALTDIRFUNC
474 FOUNDIT
475 #endif
476 ],
477 [
478 AC_DEFINE(GLOB_HAS_ALTDIRFUNC)
479 AC_MSG_RESULT(yes)
480 ],
481 [
482 AC_MSG_RESULT(no)
483 ]
484)
4cca272e 485
40849fdb 486# Check for g.gl_matchc glob() extension
487AC_MSG_CHECKING(for gl_matchc field in glob_t)
488AC_EGREP_CPP(FOUNDIT,
489 [
490 #include <glob.h>
491 int main(void){glob_t g; g.gl_matchc = 1;}
492 ],
493 [
494 AC_DEFINE(GLOB_HAS_GL_MATCHC)
495 AC_MSG_RESULT(yes)
496 ],
497 [
498 AC_MSG_RESULT(no)
499 ]
500)
501
edbe6722 502AC_MSG_CHECKING([whether struct dirent allocates space for d_name])
503AC_TRY_RUN(
504 [
505#include <sys/types.h>
506#include <dirent.h>
aec4cb4f 507int main(void){struct dirent d;exit(sizeof(d.d_name)<=sizeof(char));}
edbe6722 508 ],
509 [AC_MSG_RESULT(yes)],
510 [
511 AC_MSG_RESULT(no)
512 AC_DEFINE(BROKEN_ONE_BYTE_DIRENT_D_NAME)
513 ]
514)
515
278588d8 516# Check whether user wants S/Key support
517SKEY_MSG="no"
518AC_ARG_WITH(skey,
98a7c37b 519 [ --with-skey[[=PATH]] Enable S/Key support
520 (optionally in PATH)],
278588d8 521 [
522 if test "x$withval" != "xno" ; then
523
524 if test "x$withval" != "xyes" ; then
525 CPPFLAGS="$CPPFLAGS -I${withval}/include"
526 LDFLAGS="$LDFLAGS -L${withval}/lib"
527 fi
528
529 AC_DEFINE(SKEY)
530 LIBS="-lskey $LIBS"
531 SKEY_MSG="yes"
532
ddceb1c8 533 AC_MSG_CHECKING([for s/key support])
534 AC_TRY_RUN(
535 [
536#include <stdio.h>
537#include <skey.h>
aec4cb4f 538int main() { char *ff = skey_keyinfo(""); ff=""; exit(0); }
ddceb1c8 539 ],
540 [AC_MSG_RESULT(yes)],
278588d8 541 [
ddceb1c8 542 AC_MSG_RESULT(no)
278588d8 543 AC_MSG_ERROR([** Incomplete or missing s/key libraries.])
544 ])
545 fi
546 ]
547)
548
549# Check whether user wants TCP wrappers support
98a7c37b 550TCPW_MSG="no"
278588d8 551AC_ARG_WITH(tcp-wrappers,
98a7c37b 552 [ --with-tcp-wrappers[[=PATH]] Enable tcpwrappers support
553 (optionally in PATH)],
278588d8 554 [
555 if test "x$withval" != "xno" ; then
556 saved_LIBS="$LIBS"
98a7c37b 557 saved_LDFLAGS="$LDFLAGS"
558 saved_CPPFLAGS="$CPPFLAGS"
559 if test -n "${withval}" -a "${withval}" != "yes"; then
560 if test -d "${withval}/lib"; then
561 if test -n "${need_dash_r}"; then
5a162955 562 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
98a7c37b 563 else
5a162955 564 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
98a7c37b 565 fi
566 else
567 if test -n "${need_dash_r}"; then
5a162955 568 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
98a7c37b 569 else
5a162955 570 LDFLAGS="-L${withval} ${LDFLAGS}"
98a7c37b 571 fi
572 fi
573 if test -d "${withval}/include"; then
5a162955 574 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
98a7c37b 575 else
5a162955 576 CPPFLAGS="-I${withval} ${CPPFLAGS}"
98a7c37b 577 fi
98a7c37b 578 fi
ddceb1c8 579 LIBWRAP="-lwrap"
580 LIBS="$LIBWRAP $LIBS"
278588d8 581 AC_MSG_CHECKING(for libwrap)
582 AC_TRY_LINK(
583 [
584#include <tcpd.h>
585 int deny_severity = 0, allow_severity = 0;
586 ],
587 [hosts_access(0);],
588 [
589 AC_MSG_RESULT(yes)
590 AC_DEFINE(LIBWRAP)
ddceb1c8 591 AC_SUBST(LIBWRAP)
98a7c37b 592 TCPW_MSG="yes"
278588d8 593 ],
594 [
595 AC_MSG_ERROR([*** libwrap missing])
596 ]
597 )
ddceb1c8 598 LIBS="$saved_LIBS"
278588d8 599 fi
600 ]
601)
602
19160674 603dnl Checks for library functions. Please keep in alphabetical order
604AC_CHECK_FUNCS(\
605 arc4random __b64_ntop b64_ntop __b64_pton b64_pton basename bcopy \
606 bindresvport_sa clock fchmod fchown freeaddrinfo futimes \
607 gai_strerror getaddrinfo getcwd getgrouplist getnameinfo getopt \
608 getpeereid _getpty getrlimit getrusage getttyent glob inet_aton \
609 inet_ntoa inet_ntop innetgr login_getcapbool md5_crypt memmove \
610 mkdtemp mmap ngetaddrinfo nsleep ogetaddrinfo openpty pstat \
611 readpassphrase realpath recvmsg rresvport_af sendmsg setdtablesize \
612 setegid setenv seteuid setgroups setlogin setpcred setproctitle \
613 setresgid setreuid setrlimit setsid setvbuf sigaction sigvec \
614 snprintf socketpair strerror strlcat strlcpy strmode strnvis \
615 sysconf tcgetpgrp truncate utimes vhangup vsnprintf waitpid \
616)
98a7c37b 617
92b1decf 618AC_SEARCH_LIBS(nanosleep, rt posix4, AC_DEFINE(HAVE_NANOSLEEP))
619
08412d26 620dnl Make sure strsep prototype is defined before defining HAVE_STRSEP
621AC_CHECK_DECL(strsep, [AC_CHECK_FUNCS(strsep)])
622
98a7c37b 623dnl IRIX and Solaris 2.5.1 have dirname() in libgen
051809f6 624AC_CHECK_FUNCS(dirname, [AC_CHECK_HEADERS(libgen.h)] ,[
98a7c37b 625 AC_CHECK_LIB(gen, dirname,[
626 AC_CACHE_CHECK([for broken dirname],
627 ac_cv_have_broken_dirname, [
051809f6 628 save_LIBS="$LIBS"
629 LIBS="$LIBS -lgen"
98a7c37b 630 AC_TRY_RUN(
631 [
632#include <libgen.h>
633#include <string.h>
634
635int main(int argc, char **argv) {
636 char *s, buf[32];
637
638 strncpy(buf,"/etc", 32);
639 s = dirname(buf);
051809f6 640 if (!s || strncmp(s, "/", 32) != 0) {
98a7c37b 641 exit(1);
642 } else {
643 exit(0);
644 }
645}
646 ],
647 [ ac_cv_have_broken_dirname="no" ],
648 [ ac_cv_have_broken_dirname="yes" ]
649 )
051809f6 650 LIBS="$save_LIBS"
98a7c37b 651 ])
051809f6 652 if test "x$ac_cv_have_broken_dirname" = "xno" ; then
98a7c37b 653 LIBS="$LIBS -lgen"
654 AC_DEFINE(HAVE_DIRNAME)
051809f6 655 AC_CHECK_HEADERS(libgen.h)
98a7c37b 656 fi
657 ])
658])
659
2e73a022 660dnl Checks for time functions
1d7b9b20 661AC_CHECK_FUNCS(gettimeofday time)
2e73a022 662dnl Checks for utmp functions
b03bd394 663AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
1d7b9b20 664AC_CHECK_FUNCS(utmpname)
2e73a022 665dnl Checks for utmpx functions
b03bd394 666AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
1d7b9b20 667AC_CHECK_FUNCS(setutxent utmpxname)
76cd7316 668
beb43d31 669AC_CHECK_FUNC(daemon,
670 [AC_DEFINE(HAVE_DAEMON)],
671 [AC_CHECK_LIB(bsd, daemon, [LIBS="$LIBS -lbsd"; AC_DEFINE(HAVE_DAEMON)])]
672)
673
aa6bd60a 674AC_CHECK_FUNC(getpagesize,
675 [AC_DEFINE(HAVE_GETPAGESIZE)],
676 [AC_CHECK_LIB(ucb, getpagesize, [LIBS="$LIBS -lucb"; AC_DEFINE(HAVE_GETPAGESIZE)])]
677)
678
2647ae26 679# Check for broken snprintf
680if test "x$ac_cv_func_snprintf" = "xyes" ; then
681 AC_MSG_CHECKING([whether snprintf correctly terminates long strings])
682 AC_TRY_RUN(
683 [
684#include <stdio.h>
aec4cb4f 685int main(void){char b[5];snprintf(b,5,"123456789");exit(b[4]!='\0');}
2647ae26 686 ],
687 [AC_MSG_RESULT(yes)],
688 [
689 AC_MSG_RESULT(no)
690 AC_DEFINE(BROKEN_SNPRINTF)
691 AC_MSG_WARN([****** Your snprintf() function is broken, complain to your vendor])
692 ]
693 )
694fi
695
70e7d0b0 696dnl see whether mkstemp() requires XXXXXX
697if test "x$ac_cv_func_mkdtemp" = "xyes" ; then
698AC_MSG_CHECKING([for (overly) strict mkstemp])
699AC_TRY_RUN(
700 [
701#include <stdlib.h>
702main() { char template[]="conftest.mkstemp-test";
703if (mkstemp(template) == -1)
704 exit(1);
705unlink(template); exit(0);
706}
707 ],
708 [
709 AC_MSG_RESULT(no)
710 ],
711 [
712 AC_MSG_RESULT(yes)
713 AC_DEFINE(HAVE_STRICT_MKSTEMP)
714 ],
715 [
716 AC_MSG_RESULT(yes)
717 AC_DEFINE(HAVE_STRICT_MKSTEMP)
718 ]
719)
720fi
721
7f8f5e00 722AC_FUNC_GETPGRP
723
717057b6 724# Check for PAM libs
cbd7492e 725PAM_MSG="no"
a0391976 726AC_ARG_WITH(pam,
717057b6 727 [ --with-pam Enable PAM support ],
a0391976 728 [
717057b6 729 if test "x$withval" != "xno" ; then
730 if test "x$ac_cv_header_security_pam_appl_h" != "xyes" ; then
731 AC_MSG_ERROR([PAM headers not found])
732 fi
a0391976 733
717057b6 734 AC_CHECK_LIB(dl, dlopen, , )
735 AC_CHECK_LIB(pam, pam_set_item, , AC_MSG_ERROR([*** libpam missing]))
736 AC_CHECK_FUNCS(pam_getenvlist)
2b763e31 737
717057b6 738 disable_shadow=yes
739 PAM_MSG="yes"
4cb5ffa0 740
717057b6 741 AC_DEFINE(USE_PAM)
98f2d9d5 742 if test $ac_cv_lib_dl_dlopen = yes; then
743 LIBPAM="-lpam -ldl"
744 else
745 LIBPAM="-lpam"
746 fi
747 AC_SUBST(LIBPAM)
717057b6 748 fi
749 ]
750)
cbd7492e 751
717057b6 752# Check for older PAM
753if test "x$PAM_MSG" = "xyes" ; then
a0391976 754 # Check PAM strerror arguments (old PAM)
755 AC_MSG_CHECKING([whether pam_strerror takes only one argument])
756 AC_TRY_COMPILE(
757 [
18ba2aab 758#include <stdlib.h>
759#include <security/pam_appl.h>
a0391976 760 ],
761 [(void)pam_strerror((pam_handle_t *)NULL, -1);],
762 [AC_MSG_RESULT(no)],
763 [
764 AC_DEFINE(HAVE_OLD_PAM)
765 AC_MSG_RESULT(yes)
cbd7492e 766 PAM_MSG="yes (old library)"
a0391976 767 ]
717057b6 768 )
a0391976 769fi
770
33e2e066 771# Some systems want crypt() from libcrypt, *not* the version in OpenSSL,
772# because the system crypt() is more featureful.
773if test "x$check_for_libcrypt_before" = "x1"; then
774 AC_CHECK_LIB(crypt, crypt)
775fi
776
5b991353 777# Search for OpenSSL
778saved_CPPFLAGS="$CPPFLAGS"
779saved_LDFLAGS="$LDFLAGS"
a0391976 780AC_ARG_WITH(ssl-dir,
781 [ --with-ssl-dir=PATH Specify path to OpenSSL installation ],
782 [
e9e4a1c7 783 if test "x$withval" != "xno" ; then
5b991353 784 if test -d "$withval/lib"; then
785 if test -n "${need_dash_r}"; then
786 LDFLAGS="-L${withval}/lib -R${withval}/lib ${LDFLAGS}"
787 else
788 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
d6f13fbb 789 fi
790 else
5b991353 791 if test -n "${need_dash_r}"; then
792 LDFLAGS="-L${withval} -R${withval} ${LDFLAGS}"
793 else
794 LDFLAGS="-L${withval} ${LDFLAGS}"
d6f13fbb 795 fi
796 fi
5b991353 797 if test -d "$withval/include"; then
798 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
d6f13fbb 799 else
5b991353 800 CPPFLAGS="-I${withval} ${CPPFLAGS}"
58d100bf 801 fi
a0391976 802 fi
5b991353 803 ]
804)
805LIBS="$LIBS -lcrypto"
806AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
d45e3d76 807 [
5b991353 808 dnl Check default openssl install dir
809 if test -n "${need_dash_r}"; then
810 LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib ${saved_LDFLAGS}"
d45e3d76 811 else
5b991353 812 LDFLAGS="-L/usr/local/ssl/lib ${saved_LDFLAGS}"
d45e3d76 813 fi
5b991353 814 CPPFLAGS="-I/usr/local/ssl/include ${saved_CPPFLAGS}"
815 AC_TRY_LINK_FUNC(RAND_add, AC_DEFINE(HAVE_OPENSSL),
816 [
817 AC_MSG_ERROR([*** Can't find recent OpenSSL libcrypto (see config.log for details) ***])
818 ]
819 )
820 ]
821)
822
cd018561 823# Determine OpenSSL header version
824AC_MSG_CHECKING([OpenSSL header version])
825AC_TRY_RUN(
826 [
827#include <stdio.h>
828#include <string.h>
829#include <openssl/opensslv.h>
830#define DATA "conftest.sslincver"
831int main(void) {
832 FILE *fd;
833 int rc;
834
835 fd = fopen(DATA,"w");
836 if(fd == NULL)
837 exit(1);
838
839 if ((rc = fprintf(fd ,"%x (%s)\n", OPENSSL_VERSION_NUMBER, OPENSSL_VERSION_TEXT)) <0)
840 exit(1);
841
842 exit(0);
843}
844 ],
845 [
846 ssl_header_ver=`cat conftest.sslincver`
847 AC_MSG_RESULT($ssl_header_ver)
848 ],
849 [
850 AC_MSG_RESULT(not found)
851 AC_MSG_ERROR(OpenSSL version header not found.)
852 ]
853)
854
855# Determine OpenSSL library version
856AC_MSG_CHECKING([OpenSSL library version])
857AC_TRY_RUN(
858 [
859#include <stdio.h>
860#include <string.h>
861#include <openssl/opensslv.h>
862#include <openssl/crypto.h>
863#define DATA "conftest.ssllibver"
864int main(void) {
865 FILE *fd;
866 int rc;
867
868 fd = fopen(DATA,"w");
869 if(fd == NULL)
870 exit(1);
871
872 if ((rc = fprintf(fd ,"%x (%s)\n", SSLeay(), SSLeay_version(SSLEAY_VERSION))) <0)
873 exit(1);
874
875 exit(0);
876}
877 ],
878 [
879 ssl_library_ver=`cat conftest.ssllibver`
880 AC_MSG_RESULT($ssl_library_ver)
881 ],
882 [
883 AC_MSG_RESULT(not found)
884 AC_MSG_ERROR(OpenSSL library not found.)
885 ]
886)
58d100bf 887
9780116c 888# Sanity check OpenSSL headers
889AC_MSG_CHECKING([whether OpenSSL's headers match the library])
890AC_TRY_RUN(
891 [
892#include <string.h>
893#include <openssl/opensslv.h>
aec4cb4f 894int main(void) { exit(SSLeay() == OPENSSL_VERSION_NUMBER ? 0 : 1); }
9780116c 895 ],
896 [
897 AC_MSG_RESULT(yes)
898 ],
899 [
900 AC_MSG_RESULT(no)
901 AC_MSG_ERROR(Your OpenSSL headers do not match your library)
902 ]
903)
904
717057b6 905# Some Linux systems (Slackware) need crypt() from libcrypt, *not* the
906# version in OpenSSL. Skip this for PAM
907if test "x$PAM_MSG" = "xno" -a "x$check_for_libcrypt_later" = "x1"; then
20cad736 908 AC_CHECK_LIB(crypt, crypt, LIBS="$LIBS -lcrypt")
717057b6 909fi
910
f1b0ecc3 911
912### Configure cryptographic random number support
913
914# Check wheter OpenSSL seeds itself
915AC_MSG_CHECKING([whether OpenSSL's PRNG is internally seeded])
916AC_TRY_RUN(
917 [
918#include <string.h>
919#include <openssl/rand.h>
aec4cb4f 920int main(void) { exit(RAND_status() == 1 ? 0 : 1); }
f1b0ecc3 921 ],
922 [
923 OPENSSL_SEEDS_ITSELF=yes
924 AC_MSG_RESULT(yes)
925 ],
926 [
927 AC_MSG_RESULT(no)
928 # Default to use of the rand helper if OpenSSL doesn't
929 # seed itself
930 USE_RAND_HELPER=yes
931 ]
932)
933
934
935# Do we want to force the use of the rand helper?
936AC_ARG_WITH(rand-helper,
937 [ --with-rand-helper Use subprocess to gather strong randomness ],
938 [
939 if test "x$withval" = "xno" ; then
940 # Force use of OpenSSL's internal RNG, even if
941 # the previous test showed it to be unseeded.
942 if test -z "$OPENSSL_SEEDS_ITSELF" ; then
943 AC_MSG_WARN([*** Forcing use of OpenSSL's non-self-seeding PRNG])
944 OPENSSL_SEEDS_ITSELF=yes
945 USE_RAND_HELPER=""
946 fi
947 else
948 USE_RAND_HELPER=yes
949 fi
950 ],
951)
952
953# Which randomness source do we use?
954if test ! -z "$OPENSSL_SEEDS_ITSELF" -a -z "$USE_RAND_HELPER" ; then
955 # OpenSSL only
956 AC_DEFINE(OPENSSL_PRNG_ONLY)
957 RAND_MSG="OpenSSL internal ONLY"
958 INSTALL_SSH_RAND_HELPER=""
70e2f2f3 959elif test ! -z "$USE_RAND_HELPER" ; then
960 # install rand helper
f1b0ecc3 961 RAND_MSG="ssh-rand-helper"
962 INSTALL_SSH_RAND_HELPER="yes"
963fi
964AC_SUBST(INSTALL_SSH_RAND_HELPER)
965
966### Configuration of ssh-rand-helper
967
968# PRNGD TCP socket
969AC_ARG_WITH(prngd-port,
970 [ --with-prngd-port=PORT read entropy from PRNGD/EGD TCP localhost:PORT],
971 [
eb5d7ff6 972 case "$withval" in
973 no)
974 withval=""
975 ;;
976 [[0-9]]*)
977 ;;
978 *)
979 AC_MSG_ERROR(You must specify a numeric port number for --with-prngd-port)
980 ;;
981 esac
982 if test ! -z "$withval" ; then
f1b0ecc3 983 PRNGD_PORT="$withval"
984 AC_DEFINE_UNQUOTED(PRNGD_PORT, $PRNGD_PORT)
985 fi
986 ]
987)
988
989# PRNGD Unix domain socket
990AC_ARG_WITH(prngd-socket,
991 [ --with-prngd-socket=FILE read entropy from PRNGD/EGD socket FILE (default=/var/run/egd-pool)],
992 [
eb5d7ff6 993 case "$withval" in
994 yes)
f1b0ecc3 995 withval="/var/run/egd-pool"
eb5d7ff6 996 ;;
997 no)
998 withval=""
999 ;;
1000 /*)
1001 ;;
1002 *)
1003 AC_MSG_ERROR(You must specify an absolute path to the entropy socket)
1004 ;;
1005 esac
1006
1007 if test ! -z "$withval" ; then
f1b0ecc3 1008 if test ! -z "$PRNGD_PORT" ; then
1009 AC_MSG_ERROR(You may not specify both a PRNGD/EGD port and socket)
1010 fi
906e811b 1011 if test ! -r "$withval" ; then
f1b0ecc3 1012 AC_MSG_WARN(Entropy socket is not readable)
1013 fi
1014 PRNGD_SOCKET="$withval"
1015 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1016 fi
ddceb1c8 1017 ],
1018 [
1019 # Check for existing socket only if we don't have a random device already
1020 if test "$USE_RAND_HELPER" = yes ; then
1021 AC_MSG_CHECKING(for PRNGD/EGD socket)
1022 # Insert other locations here
1023 for sock in /var/run/egd-pool /dev/egd-pool /etc/entropy; do
1024 if test -r $sock && $TEST_MINUS_S_SH -c "test -S $sock -o -p $sock" ; then
1025 PRNGD_SOCKET="$sock"
1026 AC_DEFINE_UNQUOTED(PRNGD_SOCKET, "$PRNGD_SOCKET")
1027 break;
1028 fi
1029 done
1030 if test ! -z "$PRNGD_SOCKET" ; then
1031 AC_MSG_RESULT($PRNGD_SOCKET)
1032 else
1033 AC_MSG_RESULT(not found)
1034 fi
1035 fi
f1b0ecc3 1036 ]
1037)
1038
1039# Change default command timeout for hashing entropy source
1040entropy_timeout=200
1041AC_ARG_WITH(entropy-timeout,
1042 [ --with-entropy-timeout Specify entropy gathering command timeout (msec)],
1043 [
1044 if test "x$withval" != "xno" ; then
1045 entropy_timeout=$withval
1046 fi
1047 ]
1048)
f1b0ecc3 1049AC_DEFINE_UNQUOTED(ENTROPY_TIMEOUT_MSEC, $entropy_timeout)
1050
fd3cbf67 1051SSH_PRIVSEP_USER=sshd
9a0fbcb3 1052AC_ARG_WITH(privsep-user,
5222e7ef 1053 [ --with-privsep-user=user Specify non-privileged user for privilege separation],
9a0fbcb3 1054 [
1055 if test -n "$withval"; then
fd3cbf67 1056 SSH_PRIVSEP_USER=$withval
9a0fbcb3 1057 fi
1058 ]
1059)
fd3cbf67 1060AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$SSH_PRIVSEP_USER")
1061AC_SUBST(SSH_PRIVSEP_USER)
9a0fbcb3 1062
81dadca3 1063# We do this little dance with the search path to insure
1064# that programs that we select for use by installed programs
1065# (which may be run by the super-user) come from trusted
1066# locations before they come from the user's private area.
1067# This should help avoid accidentally configuring some
1068# random version of a program in someone's personal bin.
1069
1070OPATH=$PATH
1071PATH=/bin:/usr/bin
f95c8ce8 1072test -h /bin 2> /dev/null && PATH=/usr/bin
81dadca3 1073test -d /sbin && PATH=$PATH:/sbin
1074test -d /usr/sbin && PATH=$PATH:/usr/sbin
1075PATH=$PATH:/etc:$OPATH
1076
f1b0ecc3 1077# These programs are used by the command hashing source to gather entropy
1078OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
1079OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
1080OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
1081OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
1082OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
1083OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
1084OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
1085OSSH_PATH_ENTROPY_PROG(PROG_W, w)
1086OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
1087OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
1088OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
1089OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
1090OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
1091OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
1092OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
1093OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
81dadca3 1094# restore PATH
1095PATH=$OPATH
f1b0ecc3 1096
1097# Where does ssh-rand-helper get its randomness from?
1098INSTALL_SSH_PRNG_CMDS=""
1099if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
1100 if test ! -z "$PRNGD_PORT" ; then
1101 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
1102 elif test ! -z "$PRNGD_SOCKET" ; then
1103 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
1104 else
1105 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
1106 RAND_HELPER_CMDHASH=yes
1107 INSTALL_SSH_PRNG_CMDS="yes"
1108 fi
1109fi
1110AC_SUBST(INSTALL_SSH_PRNG_CMDS)
1111
1112
66d6c27e 1113# Cheap hack to ensure NEWS-OS libraries are arranged right.
1114if test ! -z "$SONY" ; then
1115 LIBS="$LIBS -liberty";
1116fi
1117
a0391976 1118# Checks for data types
976f7e19 1119AC_CHECK_SIZEOF(char, 1)
2b942fe0 1120AC_CHECK_SIZEOF(short int, 2)
1121AC_CHECK_SIZEOF(int, 4)
1122AC_CHECK_SIZEOF(long int, 4)
1123AC_CHECK_SIZEOF(long long int, 8)
1124
52f1ccb2 1125# Sanity check long long for some platforms (AIX)
1126if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
1127 ac_cv_sizeof_long_long_int=0
1128fi
1129
a0391976 1130# More checks for data types
14a9a859 1131AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
1132 AC_TRY_COMPILE(
1133 [ #include <sys/types.h> ],
1134 [ u_int a; a = 1;],
1135 [ ac_cv_have_u_int="yes" ],
1136 [ ac_cv_have_u_int="no" ]
1137 )
1138])
1139if test "x$ac_cv_have_u_int" = "xyes" ; then
1140 AC_DEFINE(HAVE_U_INT)
1141 have_u_int=1
1142fi
1143
58d100bf 1144AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1145 AC_TRY_COMPILE(
1146 [ #include <sys/types.h> ],
1147 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1148 [ ac_cv_have_intxx_t="yes" ],
1149 [ ac_cv_have_intxx_t="no" ]
1150 )
1151])
1152if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1153 AC_DEFINE(HAVE_INTXX_T)
1154 have_intxx_t=1
1155fi
41cb4569 1156
1157if (test -z "$have_intxx_t" && \
1158 test "x$ac_cv_header_stdint_h" = "xyes")
1159then
1160 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1161 AC_TRY_COMPILE(
1162 [ #include <stdint.h> ],
1163 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1164 [
1165 AC_DEFINE(HAVE_INTXX_T)
1166 AC_MSG_RESULT(yes)
1167 ],
1168 [ AC_MSG_RESULT(no) ]
1169 )
1170fi
1171
bd590612 1172AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1173 AC_TRY_COMPILE(
1cbbe6c8 1174 [
1175#include <sys/types.h>
1176#ifdef HAVE_STDINT_H
1177# include <stdint.h>
1178#endif
1179#include <sys/socket.h>
1180#ifdef HAVE_SYS_BITYPES_H
1181# include <sys/bitypes.h>
1182#endif
1183 ],
bd590612 1184 [ int64_t a; a = 1;],
1185 [ ac_cv_have_int64_t="yes" ],
1186 [ ac_cv_have_int64_t="no" ]
1187 )
1188])
1189if test "x$ac_cv_have_int64_t" = "xyes" ; then
1190 AC_DEFINE(HAVE_INT64_T)
ddceb1c8 1191fi
1192
58d100bf 1193AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1194 AC_TRY_COMPILE(
1195 [ #include <sys/types.h> ],
1196 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1197 [ ac_cv_have_u_intxx_t="yes" ],
1198 [ ac_cv_have_u_intxx_t="no" ]
1199 )
1200])
1201if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1202 AC_DEFINE(HAVE_U_INTXX_T)
1203 have_u_intxx_t=1
1204fi
2b942fe0 1205
41cb4569 1206if test -z "$have_u_intxx_t" ; then
1207 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1208 AC_TRY_COMPILE(
1209 [ #include <sys/socket.h> ],
1210 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1211 [
1212 AC_DEFINE(HAVE_U_INTXX_T)
1213 AC_MSG_RESULT(yes)
1214 ],
1215 [ AC_MSG_RESULT(no) ]
1216 )
1217fi
1218
bd590612 1219AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1220 AC_TRY_COMPILE(
1221 [ #include <sys/types.h> ],
1222 [ u_int64_t a; a = 1;],
1223 [ ac_cv_have_u_int64_t="yes" ],
1224 [ ac_cv_have_u_int64_t="no" ]
1225 )
1226])
1227if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1228 AC_DEFINE(HAVE_U_INT64_T)
1229 have_u_int64_t=1
1230fi
1231
ddceb1c8 1232if test -z "$have_u_int64_t" ; then
1233 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1234 AC_TRY_COMPILE(
1235 [ #include <sys/bitypes.h> ],
1236 [ u_int64_t a; a = 1],
1237 [
1238 AC_DEFINE(HAVE_U_INT64_T)
1239 AC_MSG_RESULT(yes)
1240 ],
1241 [ AC_MSG_RESULT(no) ]
1242 )
1243fi
1244
41cb4569 1245if test -z "$have_u_intxx_t" ; then
1246 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1247 AC_TRY_COMPILE(
1248 [
1249#include <sys/types.h>
1250 ],
1251 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1252 [ ac_cv_have_uintxx_t="yes" ],
1253 [ ac_cv_have_uintxx_t="no" ]
1254 )
1255 ])
1256 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1257 AC_DEFINE(HAVE_UINTXX_T)
1258 fi
1259fi
1260
1261if test -z "$have_uintxx_t" ; then
1262 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1263 AC_TRY_COMPILE(
1264 [ #include <stdint.h> ],
1265 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1266 [
1267 AC_DEFINE(HAVE_UINTXX_T)
1268 AC_MSG_RESULT(yes)
1269 ],
1270 [ AC_MSG_RESULT(no) ]
1271 )
1272fi
1273
e5fe9a1f 1274if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1275 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
5cdfe03f 1276then
1277 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1278 AC_TRY_COMPILE(
58d100bf 1279 [
1280#include <sys/bitypes.h>
1281 ],
5cdfe03f 1282 [
837c30b8 1283 int8_t a; int16_t b; int32_t c;
1284 u_int8_t e; u_int16_t f; u_int32_t g;
1285 a = b = c = e = f = g = 1;
5cdfe03f 1286 ],
1287 [
1288 AC_DEFINE(HAVE_U_INTXX_T)
1289 AC_DEFINE(HAVE_INTXX_T)
1290 AC_MSG_RESULT(yes)
1291 ],
1292 [AC_MSG_RESULT(no)]
1293 )
1294fi
1295
0362750e 1296
1297AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1298 AC_TRY_COMPILE(
1299 [
1300#include <sys/types.h>
1301 ],
1302 [ u_char foo; foo = 125; ],
1303 [ ac_cv_have_u_char="yes" ],
1304 [ ac_cv_have_u_char="no" ]
1305 )
1306])
1307if test "x$ac_cv_have_u_char" = "xyes" ; then
1308 AC_DEFINE(HAVE_U_CHAR)
1309fi
1310
98a7c37b 1311TYPE_SOCKLEN_T
2b942fe0 1312
2d16d9a3 1313AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
ddceb1c8 1314
58d100bf 1315AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1316 AC_TRY_COMPILE(
1317 [
18ba2aab 1318#include <sys/types.h>
58d100bf 1319 ],
1320 [ size_t foo; foo = 1235; ],
1321 [ ac_cv_have_size_t="yes" ],
1322 [ ac_cv_have_size_t="no" ]
1323 )
1324])
1325if test "x$ac_cv_have_size_t" = "xyes" ; then
1326 AC_DEFINE(HAVE_SIZE_T)
1327fi
ea1970a3 1328
c04f75f1 1329AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1330 AC_TRY_COMPILE(
1331 [
1332#include <sys/types.h>
1333 ],
1334 [ ssize_t foo; foo = 1235; ],
1335 [ ac_cv_have_ssize_t="yes" ],
1336 [ ac_cv_have_ssize_t="no" ]
1337 )
1338])
1339if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1340 AC_DEFINE(HAVE_SSIZE_T)
1341fi
1342
f1c4659d 1343AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1344 AC_TRY_COMPILE(
1345 [
1346#include <time.h>
1347 ],
1348 [ clock_t foo; foo = 1235; ],
1349 [ ac_cv_have_clock_t="yes" ],
1350 [ ac_cv_have_clock_t="no" ]
1351 )
1352])
1353if test "x$ac_cv_have_clock_t" = "xyes" ; then
1354 AC_DEFINE(HAVE_CLOCK_T)
1355fi
1356
1c04b088 1357AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1358 AC_TRY_COMPILE(
1359 [
1360#include <sys/types.h>
1361#include <sys/socket.h>
1362 ],
1363 [ sa_family_t foo; foo = 1235; ],
1364 [ ac_cv_have_sa_family_t="yes" ],
77bb0bca 1365 [ AC_TRY_COMPILE(
1366 [
1367#include <sys/types.h>
1368#include <sys/socket.h>
1369#include <netinet/in.h>
1370 ],
1371 [ sa_family_t foo; foo = 1235; ],
1372 [ ac_cv_have_sa_family_t="yes" ],
1373
1c04b088 1374 [ ac_cv_have_sa_family_t="no" ]
77bb0bca 1375 )]
1c04b088 1376 )
1377])
1378if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1379 AC_DEFINE(HAVE_SA_FAMILY_T)
1380fi
1381
729bfe59 1382AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1383 AC_TRY_COMPILE(
1384 [
1385#include <sys/types.h>
1386 ],
1387 [ pid_t foo; foo = 1235; ],
1388 [ ac_cv_have_pid_t="yes" ],
1389 [ ac_cv_have_pid_t="no" ]
1390 )
1391])
1392if test "x$ac_cv_have_pid_t" = "xyes" ; then
1393 AC_DEFINE(HAVE_PID_T)
1394fi
1395
1396AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1397 AC_TRY_COMPILE(
1398 [
1399#include <sys/types.h>
1400 ],
1401 [ mode_t foo; foo = 1235; ],
1402 [ ac_cv_have_mode_t="yes" ],
1403 [ ac_cv_have_mode_t="no" ]
1404 )
1405])
1406if test "x$ac_cv_have_mode_t" = "xyes" ; then
1407 AC_DEFINE(HAVE_MODE_T)
1408fi
1409
e3a93db0 1410
58d100bf 1411AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1412 AC_TRY_COMPILE(
1413 [
18ba2aab 1414#include <sys/types.h>
1415#include <sys/socket.h>
58d100bf 1416 ],
1417 [ struct sockaddr_storage s; ],
1418 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1419 [ ac_cv_have_struct_sockaddr_storage="no" ]
1420 )
1421])
1422if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1423 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1424fi
48e671d5 1425
58d100bf 1426AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1427 AC_TRY_COMPILE(
1428 [
cbd7492e 1429#include <sys/types.h>
58d100bf 1430#include <netinet/in.h>
1431 ],
1432 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1433 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1434 [ ac_cv_have_struct_sockaddr_in6="no" ]
1435 )
1436])
1437if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1438 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1439fi
48e671d5 1440
58d100bf 1441AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1442 AC_TRY_COMPILE(
1443 [
cbd7492e 1444#include <sys/types.h>
58d100bf 1445#include <netinet/in.h>
1446 ],
1447 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1448 [ ac_cv_have_struct_in6_addr="yes" ],
1449 [ ac_cv_have_struct_in6_addr="no" ]
1450 )
1451])
1452if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1453 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1454fi
48e671d5 1455
58d100bf 1456AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1457 AC_TRY_COMPILE(
1458 [
18ba2aab 1459#include <sys/types.h>
1460#include <sys/socket.h>
1461#include <netdb.h>
58d100bf 1462 ],
1463 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1464 [ ac_cv_have_struct_addrinfo="yes" ],
1465 [ ac_cv_have_struct_addrinfo="no" ]
1466 )
1467])
1468if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1469 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1470fi
1471
89c7e31c 1472AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1473 AC_TRY_COMPILE(
1474 [ #include <sys/time.h> ],
1475 [ struct timeval tv; tv.tv_sec = 1;],
1476 [ ac_cv_have_struct_timeval="yes" ],
1477 [ ac_cv_have_struct_timeval="no" ]
1478 )
1479])
1480if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1481 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1482 have_struct_timeval=1
1483fi
1484
2c523de9 1485# If we don't have int64_t then we can't compile sftp-server. So don't
1486# even attempt to do it.
1487if test "x$ac_cv_have_int64_t" = "xno" -a \
1488 "x$ac_cv_sizeof_long_int" != "x8" -a \
1489 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1490 NO_SFTP='#'
733cf7f4 1491else
1492dnl test snprintf (broken on SCO w/gcc)
1493 AC_TRY_RUN(
1494 [
1495#include <stdio.h>
1496#include <string.h>
1497#ifdef HAVE_SNPRINTF
1498main()
1499{
1500 char buf[50];
1501 char expected_out[50];
1502 int mazsize = 50 ;
1503#if (SIZEOF_LONG_INT == 8)
1504 long int num = 0x7fffffffffffffff;
1505#else
763a1a18 1506 long long num = 0x7fffffffffffffffll;
733cf7f4 1507#endif
1508 strcpy(expected_out, "9223372036854775807");
1509 snprintf(buf, mazsize, "%lld", num);
1510 if(strcmp(buf, expected_out) != 0)
1511 exit(1);
1512 exit(0);
1513}
1514#else
1515main() { exit(0); }
1516#endif
1517 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1518 )
2c523de9 1519fi
89c7e31c 1520AC_SUBST(NO_SFTP)
2c523de9 1521
77bb0bca 1522dnl Checks for structure members
58d100bf 1523OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1524OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1525OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1526OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1527OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
25422c70 1528OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
58d100bf 1529OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1530OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
daaff4d5 1531OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
58d100bf 1532OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1533OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1534OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1535OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1d7b9b20 1536OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1537OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1538OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1539OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
98a7c37b 1540
1541AC_CHECK_MEMBERS([struct stat.st_blksize])
1d7b9b20 1542
58d100bf 1543AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1544 ac_cv_have_ss_family_in_struct_ss, [
1545 AC_TRY_COMPILE(
1546 [
18ba2aab 1547#include <sys/types.h>
1548#include <sys/socket.h>
58d100bf 1549 ],
1550 [ struct sockaddr_storage s; s.ss_family = 1; ],
1551 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1552 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1553 )
1554])
1555if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1556 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1557fi
1558
58d100bf 1559AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1560 ac_cv_have___ss_family_in_struct_ss, [
1561 AC_TRY_COMPILE(
1562 [
18ba2aab 1563#include <sys/types.h>
1564#include <sys/socket.h>
58d100bf 1565 ],
1566 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1567 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1568 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1569 )
1570])
1571if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1572 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1573fi
1574
2e73a022 1575AC_CACHE_CHECK([for pw_class field in struct passwd],
1576 ac_cv_have_pw_class_in_struct_passwd, [
1577 AC_TRY_COMPILE(
1578 [
2e73a022 1579#include <pwd.h>
1580 ],
97994d32 1581 [ struct passwd p; p.pw_class = 0; ],
2e73a022 1582 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1583 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1584 )
1585])
1586if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1587 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1588fi
1589
7751d4eb 1590AC_CACHE_CHECK([for pw_expire field in struct passwd],
1591 ac_cv_have_pw_expire_in_struct_passwd, [
1592 AC_TRY_COMPILE(
1593 [
1594#include <pwd.h>
1595 ],
1596 [ struct passwd p; p.pw_expire = 0; ],
1597 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1598 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1599 )
1600])
1601if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1602 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1603fi
1604
1605AC_CACHE_CHECK([for pw_change field in struct passwd],
1606 ac_cv_have_pw_change_in_struct_passwd, [
1607 AC_TRY_COMPILE(
1608 [
1609#include <pwd.h>
1610 ],
1611 [ struct passwd p; p.pw_change = 0; ],
1612 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1613 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1614 )
1615])
1616if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1617 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1618fi
58d100bf 1619
637f9177 1620dnl make sure we're using the real structure members and not defines
6f34652e 1621AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1622 ac_cv_have_accrights_in_msghdr, [
637f9177 1623 AC_TRY_RUN(
6f34652e 1624 [
f95c8ce8 1625#include <sys/types.h>
6f34652e 1626#include <sys/socket.h>
1627#include <sys/uio.h>
637f9177 1628int main() {
1629#ifdef msg_accrights
1630exit(1);
1631#endif
1632struct msghdr m;
1633m.msg_accrights = 0;
1634exit(0);
1635}
6f34652e 1636 ],
6f34652e 1637 [ ac_cv_have_accrights_in_msghdr="yes" ],
1638 [ ac_cv_have_accrights_in_msghdr="no" ]
1639 )
1640])
1641if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1642 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1643fi
1644
7176df4f 1645AC_CACHE_CHECK([for msg_control field in struct msghdr],
1646 ac_cv_have_control_in_msghdr, [
637f9177 1647 AC_TRY_RUN(
7176df4f 1648 [
f95c8ce8 1649#include <sys/types.h>
7176df4f 1650#include <sys/socket.h>
1651#include <sys/uio.h>
637f9177 1652int main() {
1653#ifdef msg_control
1654exit(1);
1655#endif
1656struct msghdr m;
1657m.msg_control = 0;
1658exit(0);
1659}
7176df4f 1660 ],
7176df4f 1661 [ ac_cv_have_control_in_msghdr="yes" ],
1662 [ ac_cv_have_control_in_msghdr="no" ]
1663 )
1664])
1665if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1666 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1667fi
1668
58d100bf 1669AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1670 AC_TRY_LINK([],
1671 [ extern char *__progname; printf("%s", __progname); ],
1672 [ ac_cv_libc_defines___progname="yes" ],
1673 [ ac_cv_libc_defines___progname="no" ]
1674 )
1675])
1676if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1677 AC_DEFINE(HAVE___PROGNAME)
1678fi
8946db53 1679
c921ee00 1680AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1681 AC_TRY_LINK([
1682#include <stdio.h>
1683],
1684 [ printf("%s", __FUNCTION__); ],
1685 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1686 [ ac_cv_cc_implements___FUNCTION__="no" ]
1687 )
1688])
1689if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1690 AC_DEFINE(HAVE___FUNCTION__)
1691fi
1692
1693AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1694 AC_TRY_LINK([
1695#include <stdio.h>
1696],
1697 [ printf("%s", __func__); ],
1698 [ ac_cv_cc_implements___func__="yes" ],
1699 [ ac_cv_cc_implements___func__="no" ]
1700 )
1701])
1702if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1703 AC_DEFINE(HAVE___func__)
1704fi
1705
1812a662 1706AC_CACHE_CHECK([whether getopt has optreset support],
1707 ac_cv_have_getopt_optreset, [
1708 AC_TRY_LINK(
1709 [
1710#include <getopt.h>
1711 ],
1712 [ extern int optreset; optreset = 0; ],
1713 [ ac_cv_have_getopt_optreset="yes" ],
1714 [ ac_cv_have_getopt_optreset="no" ]
1715 )
1716])
1717if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1718 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1719fi
a0391976 1720
819b676f 1721AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1722 AC_TRY_LINK([],
1723 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1724 [ ac_cv_libc_defines_sys_errlist="yes" ],
1725 [ ac_cv_libc_defines_sys_errlist="no" ]
1726 )
1727])
1728if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1729 AC_DEFINE(HAVE_SYS_ERRLIST)
1730fi
1731
1732
416ed5a7 1733AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1734 AC_TRY_LINK([],
1735 [ extern int sys_nerr; printf("%i", sys_nerr);],
1736 [ ac_cv_libc_defines_sys_nerr="yes" ],
1737 [ ac_cv_libc_defines_sys_nerr="no" ]
1738 )
1739])
1740if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1741 AC_DEFINE(HAVE_SYS_NERR)
1742fi
1743
d0b19c95 1744SCARD_MSG="no"
295c8801 1745
1746# Check whether user wants sectok support
1747AC_ARG_WITH(sectok,
1748 [ --with-sectok Enable smartcard support using libsectok],
d0b19c95 1749 [
1750 if test "x$withval" != "xno" ; then
1751 if test "x$withval" != "xyes" ; then
1752 CPPFLAGS="$CPPFLAGS -I${withval}"
1753 LDFLAGS="$LDFLAGS -L${withval}"
1754 if test ! -z "$need_dash_r" ; then
1755 LDFLAGS="$LDFLAGS -R${withval}"
1756 fi
1757 if test ! -z "$blibpath" ; then
1758 blibpath="$blibpath:${withval}"
1759 fi
1760 fi
1761 AC_CHECK_HEADERS(sectok.h)
1762 if test "$ac_cv_header_sectok_h" != yes; then
1763 AC_MSG_ERROR(Can't find sectok.h)
1764 fi
1765 AC_CHECK_LIB(sectok, sectok_open)
1766 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1767 AC_MSG_ERROR(Can't find libsectok)
1768 fi
1769 AC_DEFINE(SMARTCARD)
295c8801 1770 AC_DEFINE(USE_SECTOK)
1771 SCARD_MSG="yes, using sectok"
1772 fi
1773 ]
1774)
1775
1776# Check whether user wants OpenSC support
1777AC_ARG_WITH(opensc,
49ef62db 1778 AC_HELP_STRING([--with-opensc=PFX],
1779 [Enable smartcard support using OpenSC]),
1780 opensc_config_prefix="$withval", opensc_config_prefix="")
1781if test x$opensc_config_prefix != x ; then
1782 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1783 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1784 if test "$OPENSC_CONFIG" != "no"; then
1785 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1786 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1787 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1788 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1789 AC_DEFINE(SMARTCARD)
1790 AC_DEFINE(USE_OPENSC)
1791 SCARD_MSG="yes, using OpenSC"
1792 fi
1793fi
d0b19c95 1794
12928e80 1795# Check whether user wants Kerberos 5 support
1796KRB5_MSG="no"
1797AC_ARG_WITH(kerberos5,
1798 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1799 [
1800 if test "x$withval" != "xno" ; then
1801 if test "x$withval" = "xyes" ; then
1802 KRB5ROOT="/usr/local"
1803 else
1804 KRB5ROOT=${withval}
1805 fi
1806 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1807 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1808 AC_DEFINE(KRB5)
1809 KRB5_MSG="yes"
1810 AC_MSG_CHECKING(whether we are using Heimdal)
1811 AC_TRY_COMPILE([ #include <krb5.h> ],
1812 [ char *tmp = heimdal_version; ],
1813 [ AC_MSG_RESULT(yes)
1814 AC_DEFINE(HEIMDAL)
1815 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1816 ],
1817 [ AC_MSG_RESULT(no)
1818 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1819 ]
1820 )
1821 if test ! -z "$need_dash_r" ; then
1822 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1823 fi
1824 if test ! -z "$blibpath" ; then
1825 blibpath="$blibpath:${KRB5ROOT}/lib"
1826 fi
1827 AC_CHECK_LIB(resolv, dn_expand, , )
1828
1829 KRB5=yes
1830 fi
1831 ]
1832)
1833# Check whether user wants Kerberos 4 support
b5b68128 1834KRB4_MSG="no"
1835AC_ARG_WITH(kerberos4,
1836 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1837 [
1838 if test "x$withval" != "xno" ; then
b5b68128 1839 if test "x$withval" != "xyes" ; then
1840 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1841 LDFLAGS="$LDFLAGS -L${withval}/lib"
1842 if test ! -z "$need_dash_r" ; then
1843 LDFLAGS="$LDFLAGS -R${withval}/lib"
1844 fi
1845 if test ! -z "$blibpath" ; then
1846 blibpath="$blibpath:${withval}/lib"
1847 fi
1848 else
1849 if test -d /usr/include/kerberosIV ; then
1850 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1851 fi
1852 fi
1853
1854 AC_CHECK_HEADERS(krb.h)
b5b68128 1855 if test "$ac_cv_header_krb_h" != yes; then
1856 AC_MSG_WARN([Cannot find krb.h, build may fail])
1857 fi
cccfea16 1858 AC_CHECK_LIB(krb, main)
b5b68128 1859 if test "$ac_cv_lib_krb_main" != yes; then
cccfea16 1860 AC_CHECK_LIB(krb4, main)
1861 if test "$ac_cv_lib_krb4_main" != yes; then
1862 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1863 else
1864 KLIBS="-lkrb4"
1865 fi
1866 else
1867 KLIBS="-lkrb"
1868 fi
1869 AC_CHECK_LIB(des, des_cbc_encrypt)
1870 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1871 AC_CHECK_LIB(des425, des_cbc_encrypt)
1872 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1873 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1874 else
1875 KLIBS="-ldes425"
1876 fi
1877 else
1878 KLIBS="-ldes"
b5b68128 1879 fi
b5b68128 1880 AC_CHECK_LIB(resolv, dn_expand, , )
1881 KRB4=yes
1882 KRB4_MSG="yes"
1883 AC_DEFINE(KRB4)
1884 fi
1885 ]
1886)
1887
1888# Check whether user wants AFS support
1889AFS_MSG="no"
1890AC_ARG_WITH(afs,
1891 [ --with-afs=PATH Enable AFS support],
1892 [
1893 if test "x$withval" != "xno" ; then
1894
1895 if test "x$withval" != "xyes" ; then
1896 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1897 LDFLAGS="$LDFLAGS -L${withval}/lib"
1898 fi
1899
1900 if test -z "$KRB4" ; then
1901 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1902 fi
1903
1904 LIBS="-lkafs $LIBS"
1905 if test ! -z "$AFS_LIBS" ; then
1906 LIBS="$LIBS $AFS_LIBS"
1907 fi
1908 AC_DEFINE(AFS)
1909 AFS_MSG="yes"
1910 fi
1911 ]
1912)
12928e80 1913LIBS="$LIBS $KLIBS $K5LIBS"
b5b68128 1914
a0391976 1915# Looking for programs, paths and files
a0391976 1916
ecac8ee5 1917PRIVSEP_PATH=/var/empty
1918AC_ARG_WITH(privsep-path,
cda1ebcb 1919 [ --with-privsep-path=xxx Path for privilege separation chroot (default=/var/empty)],
ecac8ee5 1920 [
1921 if test "x$withval" != "$no" ; then
1922 PRIVSEP_PATH=$withval
1923 fi
1924 ]
1925)
1926AC_SUBST(PRIVSEP_PATH)
1927
a0391976 1928AC_ARG_WITH(xauth,
1929 [ --with-xauth=PATH Specify path to xauth program ],
1930 [
00937921 1931 if test "x$withval" != "xno" ; then
cbd7492e 1932 xauth_path=$withval
a0391976 1933 fi
1934 ],
1935 [
2bf42e4a 1936 TestPath="$PATH"
1937 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X/bin"
1938 TestPath="${TestPath}${PATH_SEPARATOR}/usr/bin/X11"
1939 TestPath="${TestPath}${PATH_SEPARATOR}/usr/X11R6/bin"
1940 TestPath="${TestPath}${PATH_SEPARATOR}/usr/openwin/bin"
1941 AC_PATH_PROG(xauth_path, xauth, , $TestPath)
e5fe9a1f 1942 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
a0391976 1943 xauth_path="/usr/openwin/bin/xauth"
1944 fi
1945 ]
1946)
1947
65a4b4af 1948STRIP_OPT=-s
1949AC_ARG_ENABLE(strip,
1950 [ --disable-strip Disable calling strip(1) on install],
1951 [
1952 if test "x$enableval" = "xno" ; then
1953 STRIP_OPT=
1954 fi
1955 ]
1956)
1957AC_SUBST(STRIP_OPT)
1958
b3ec54b4 1959if test -z "$xauth_path" ; then
1960 XAUTH_PATH="undefined"
1961 AC_SUBST(XAUTH_PATH)
1962else
a0391976 1963 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
b3ec54b4 1964 XAUTH_PATH=$xauth_path
1965 AC_SUBST(XAUTH_PATH)
a0391976 1966fi
a0391976 1967
1968# Check for mail directory (last resort if we cannot get it from headers)
1969if test ! -z "$MAIL" ; then
1970 maildir=`dirname $MAIL`
1971 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1972fi
1973
a0391976 1974if test -z "$no_dev_ptmx" ; then
6e879cb4 1975 if test "x$disable_ptmx_check" != "xyes" ; then
1976 AC_CHECK_FILE("/dev/ptmx",
1977 [
1978 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1979 have_dev_ptmx=1
1980 ]
1981 )
1982 fi
3276571c 1983fi
1984AC_CHECK_FILE("/dev/ptc",
1985 [
1986 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1987 have_dev_ptc=1
1988 ]
1989)
1990
a0391976 1991# Options from here on. Some of these are preset by platform above
fdf6b7aa 1992AC_ARG_WITH(mantype,
5d97cfbf 1993 [ --with-mantype=man|cat|doc Set man page type],
c54a6257 1994 [
5d97cfbf 1995 case "$withval" in
1996 man|cat|doc)
1997 MANTYPE=$withval
1998 ;;
1999 *)
2000 AC_MSG_ERROR(invalid man type: $withval)
2001 ;;
2002 esac
c54a6257 2003 ]
2004)
e0c4d3ac 2005if test -z "$MANTYPE"; then
2bf42e4a 2006 TestPath="/usr/bin${PATH_SEPARATOR}/usr/ucb"
2007 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, $TestPath)
e0c4d3ac 2008 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2009 MANTYPE=doc
2010 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2011 MANTYPE=man
2012 else
2013 MANTYPE=cat
2014 fi
2015fi
c54a6257 2016AC_SUBST(MANTYPE)
e0c4d3ac 2017if test "$MANTYPE" = "doc"; then
2018 mansubdir=man;
2019else
2020 mansubdir=$MANTYPE;
2021fi
2022AC_SUBST(mansubdir)
0bc5b6fb 2023
a0391976 2024# Check whether to enable MD5 passwords
cbd7492e 2025MD5_MSG="no"
2ddcfdf3 2026AC_ARG_WITH(md5-passwords,
caf3bc51 2027 [ --with-md5-passwords Enable use of MD5 passwords],
0bc5b6fb 2028 [
bcf36c78 2029 if test "x$withval" != "xno" ; then
0bc5b6fb 2030 AC_DEFINE(HAVE_MD5_PASSWORDS)
cbd7492e 2031 MD5_MSG="yes"
0bc5b6fb 2032 fi
2033 ]
caf3bc51 2034)
2035
a0391976 2036# Whether to disable shadow password support
a7effaac 2037AC_ARG_WITH(shadow,
2038 [ --without-shadow Disable shadow password support],
2039 [
2040 if test "x$withval" = "xno" ; then
2041 AC_DEFINE(DISABLE_SHADOW)
4cb5ffa0 2042 disable_shadow=yes
a7effaac 2043 fi
2044 ]
2045)
2046
4cb5ffa0 2047if test -z "$disable_shadow" ; then
2048 AC_MSG_CHECKING([if the systems has expire shadow information])
2049 AC_TRY_COMPILE(
2050 [
2051#include <sys/types.h>
2052#include <shadow.h>
2053 struct spwd sp;
2054 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2055 [ sp_expire_available=yes ], []
2056 )
2057
2058 if test "x$sp_expire_available" = "xyes" ; then
2059 AC_MSG_RESULT(yes)
2060 AC_DEFINE(HAS_SHADOW_EXPIRE)
2061 else
2062 AC_MSG_RESULT(no)
2063 fi
2064fi
2065
a0391976 2066# Use ip address instead of hostname in $DISPLAY
44839801 2067if test ! -z "$IPADDR_IN_DISPLAY" ; then
2068 DISPLAY_HACK_MSG="yes"
2069 AC_DEFINE(IPADDR_IN_DISPLAY)
2070else
2071 DISPLAY_HACK_MSG="no"
2072 AC_ARG_WITH(ipaddr-display,
2073 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2074 [
2075 if test "x$withval" != "xno" ; then
2076 AC_DEFINE(IPADDR_IN_DISPLAY)
2077 DISPLAY_HACK_MSG="yes"
2078 fi
2079 ]
2080 )
2081fi
a7effaac 2082
8d184c09 2083dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2084if test $ac_cv_func_login_getcapbool = "yes" -a \
2085 $ac_cv_header_login_cap_h = "yes" ; then
2086 USES_LOGIN_CONF=yes
2087fi
a0391976 2088# Whether to mess with the default path
cbd7492e 2089SERVER_PATH_MSG="(default)"
c43d69a9 2090AC_ARG_WITH(default-path,
75817f90 2091 [ --with-default-path= Specify default \$PATH environment for server],
cb807f40 2092 [
8d184c09 2093 if test "$USES_LOGIN_CONF" = "yes" ; then
2094 AC_MSG_WARN([
2095--with-default-path=PATH has no effect on this system.
2096Edit /etc/login.conf instead.])
2097 elif test "x$withval" != "xno" ; then
b2d818e6 2098 user_path="$withval"
cbd7492e 2099 SERVER_PATH_MSG="$withval"
cb807f40 2100 fi
b2d818e6 2101 ],
8d184c09 2102 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2103 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2104 else
b2d818e6 2105 AC_TRY_RUN(
2106 [
2107/* find out what STDPATH is */
2108#include <stdio.h>
b2d818e6 2109#ifdef HAVE_PATHS_H
2110# include <paths.h>
2111#endif
2112#ifndef _PATH_STDPATH
d9a4e55b 2113# ifdef _PATH_USERPATH /* Irix */
2114# define _PATH_STDPATH _PATH_USERPATH
2115# else
2116# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2117# endif
b2d818e6 2118#endif
2119#include <sys/types.h>
2120#include <sys/stat.h>
2121#include <fcntl.h>
2122#define DATA "conftest.stdpath"
2123
2124main()
2125{
2126 FILE *fd;
2127 int rc;
2128
2129 fd = fopen(DATA,"w");
2130 if(fd == NULL)
2131 exit(1);
2132
2133 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2134 exit(1);
2135
2136 exit(0);
2137}
2138 ], [ user_path=`cat conftest.stdpath` ],
2139 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2140 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2141 )
2142# make sure $bindir is in USER_PATH so scp will work
2143 t_bindir=`eval echo ${bindir}`
2144 case $t_bindir in
2145 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2146 esac
2147 case $t_bindir in
2148 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2149 esac
2150 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2151 if test $? -ne 0 ; then
2152 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2153 if test $? -ne 0 ; then
2154 user_path=$user_path:$t_bindir
2155 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2156 fi
2157 fi
8d184c09 2158 fi ]
cb807f40 2159)
8d184c09 2160if test "$USES_LOGIN_CONF" != "yes" ; then
2161 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2162 AC_SUBST(user_path)
2163fi
cb807f40 2164
06617857 2165# Set superuser path separately to user path
06617857 2166AC_ARG_WITH(superuser-path,
2167 [ --with-superuser-path= Specify different path for super-user],
2168 [
2169 if test "x$withval" != "xno" ; then
2170 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2171 superuser_path=$withval
2172 fi
2173 ]
2174)
2175
2176
a0391976 2177# Whether to force IPv4 by default (needed on broken glibc Linux)
cbd7492e 2178IPV4_HACK_MSG="no"
59e76f33 2179AC_ARG_WITH(ipv4-default,
2180 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2181 [
2182 if test "x$withval" != "xno" ; then
2183 AC_DEFINE(IPV4_DEFAULT)
cbd7492e 2184 IPV4_HACK_MSG="yes"
59e76f33 2185 fi
2186 ]
2187)
2188
58d100bf 2189AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
cbd7492e 2190IPV4_IN6_HACK_MSG="no"
80faa19f 2191AC_ARG_WITH(4in6,
2192 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2193 [
2194 if test "x$withval" != "xno" ; then
2195 AC_MSG_RESULT(yes)
2196 AC_DEFINE(IPV4_IN_IPV6)
cbd7492e 2197 IPV4_IN6_HACK_MSG="yes"
80faa19f 2198 else
2199 AC_MSG_RESULT(no)
2200 fi
2201 ],[
2202 if test "x$inet6_default_4in6" = "xyes"; then
2203 AC_MSG_RESULT([yes (default)])
2204 AC_DEFINE(IPV4_IN_IPV6)
cbd7492e 2205 IPV4_IN6_HACK_MSG="yes"
80faa19f 2206 else
2207 AC_MSG_RESULT([no (default)])
2208 fi
2209 ]
2210)
2211
af774732 2212# Whether to enable BSD auth support
f1b0ecc3 2213BSD_AUTH_MSG=no
af774732 2214AC_ARG_WITH(bsd-auth,
2215 [ --with-bsd-auth Enable BSD auth support],
2216 [
2217 if test "x$withval" != "xno" ; then
2218 AC_DEFINE(BSD_AUTH)
f1b0ecc3 2219 BSD_AUTH_MSG=yes
af774732 2220 fi
2221 ]
2222)
2223
a0391976 2224# Where to place sshd.pid
19d9ac2a 2225piddir=/var/run
81dadca3 2226# make sure the directory exists
2227if test ! -d $piddir ; then
2228 piddir=`eval echo ${sysconfdir}`
2229 case $piddir in
2230 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2231 esac
2232fi
2233
47e45e44 2234AC_ARG_WITH(pid-dir,
2235 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2236 [
2237 if test "x$withval" != "xno" ; then
19d9ac2a 2238 piddir=$withval
81dadca3 2239 if test ! -d $piddir ; then
2240 AC_MSG_WARN([** no $piddir directory on this system **])
2241 fi
47e45e44 2242 fi
2243 ]
2244)
b7a87eea 2245
42f11eb2 2246AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
19d9ac2a 2247AC_SUBST(piddir)
47e45e44 2248
1d7b9b20 2249dnl allow user to disable some login recording features
2250AC_ARG_ENABLE(lastlog,
bfd550a2 2251 [ --disable-lastlog disable use of lastlog even if detected [no]],
1d7b9b20 2252 [ AC_DEFINE(DISABLE_LASTLOG) ]
2253)
2254AC_ARG_ENABLE(utmp,
bfd550a2 2255 [ --disable-utmp disable use of utmp even if detected [no]],
1d7b9b20 2256 [ AC_DEFINE(DISABLE_UTMP) ]
2257)
2258AC_ARG_ENABLE(utmpx,
bfd550a2 2259 [ --disable-utmpx disable use of utmpx even if detected [no]],
1d7b9b20 2260 [ AC_DEFINE(DISABLE_UTMPX) ]
2261)
2262AC_ARG_ENABLE(wtmp,
bfd550a2 2263 [ --disable-wtmp disable use of wtmp even if detected [no]],
1d7b9b20 2264 [ AC_DEFINE(DISABLE_WTMP) ]
2265)
2266AC_ARG_ENABLE(wtmpx,
bfd550a2 2267 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
1d7b9b20 2268 [ AC_DEFINE(DISABLE_WTMPX) ]
2269)
2270AC_ARG_ENABLE(libutil,
bfd550a2 2271 [ --disable-libutil disable use of libutil (login() etc.) [no]],
1d7b9b20 2272 [ AC_DEFINE(DISABLE_LOGIN) ]
2273)
2274AC_ARG_ENABLE(pututline,
bfd550a2 2275 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
1d7b9b20 2276 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2277)
2278AC_ARG_ENABLE(pututxline,
bfd550a2 2279 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
1d7b9b20 2280 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2281)
2282AC_ARG_WITH(lastlog,
bfd550a2 2283 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
8c89dd2b 2284 [
2285 if test "x$withval" = "xno" ; then
2286 AC_DEFINE(DISABLE_LASTLOG)
2287 else
2288 conf_lastlog_location=$withval
2289 fi
2290 ]
2291)
1d7b9b20 2292
2293dnl lastlog, [uw]tmpx? detection
2294dnl NOTE: set the paths in the platform section to avoid the
2295dnl need for command-line parameters
2296dnl lastlog and [uw]tmp are subject to a file search if all else fails
2297
2298dnl lastlog detection
2299dnl NOTE: the code itself will detect if lastlog is a directory
2300AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2301AC_TRY_COMPILE([
2302#include <sys/types.h>
2303#include <utmp.h>
2304#ifdef HAVE_LASTLOG_H
2305# include <lastlog.h>
2306#endif
d7c0f3d5 2307#ifdef HAVE_PATHS_H
1d7b9b20 2308# include <paths.h>
41cb4569 2309#endif
2310#ifdef HAVE_LOGIN_H
2311# include <login.h>
1d7b9b20 2312#endif
2313 ],
2314 [ char *lastlog = LASTLOG_FILE; ],
2315 [ AC_MSG_RESULT(yes) ],
d7c0f3d5 2316 [
2317 AC_MSG_RESULT(no)
2318 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2319 AC_TRY_COMPILE([
2320#include <sys/types.h>
2321#include <utmp.h>
2322#ifdef HAVE_LASTLOG_H
2323# include <lastlog.h>
2324#endif
2325#ifdef HAVE_PATHS_H
2326# include <paths.h>
2327#endif
2328 ],
2329 [ char *lastlog = _PATH_LASTLOG; ],
2330 [ AC_MSG_RESULT(yes) ],
2331 [
f282b668 2332 AC_MSG_RESULT(no)
d7c0f3d5 2333 system_lastlog_path=no
2334 ])
2335 ]
1d7b9b20 2336)
d7c0f3d5 2337
1d7b9b20 2338if test -z "$conf_lastlog_location"; then
2339 if test x"$system_lastlog_path" = x"no" ; then
2340 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
e5fe9a1f 2341 if (test -d "$f" || test -f "$f") ; then
1d7b9b20 2342 conf_lastlog_location=$f
2343 fi
2344 done
2345 if test -z "$conf_lastlog_location"; then
f8119cef 2346 AC_MSG_WARN([** Cannot find lastlog **])
2347 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
1d7b9b20 2348 fi
2349 fi
2350fi
2351
2352if test -n "$conf_lastlog_location"; then
2353 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2354fi
2355
2356dnl utmp detection
2357AC_MSG_CHECKING([if your system defines UTMP_FILE])
2358AC_TRY_COMPILE([
2359#include <sys/types.h>
2360#include <utmp.h>
d7c0f3d5 2361#ifdef HAVE_PATHS_H
1d7b9b20 2362# include <paths.h>
2363#endif
2364 ],
2365 [ char *utmp = UTMP_FILE; ],
2366 [ AC_MSG_RESULT(yes) ],
2367 [ AC_MSG_RESULT(no)
2368 system_utmp_path=no ]
2369)
2370if test -z "$conf_utmp_location"; then
2371 if test x"$system_utmp_path" = x"no" ; then
2372 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2373 if test -f $f ; then
2374 conf_utmp_location=$f
2375 fi
2376 done
2377 if test -z "$conf_utmp_location"; then
2378 AC_DEFINE(DISABLE_UTMP)
2379 fi
2380 fi
2381fi
2382if test -n "$conf_utmp_location"; then
2383 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2384fi
2385
2386dnl wtmp detection
2387AC_MSG_CHECKING([if your system defines WTMP_FILE])
2388AC_TRY_COMPILE([
2389#include <sys/types.h>
2390#include <utmp.h>
d7c0f3d5 2391#ifdef HAVE_PATHS_H
1d7b9b20 2392# include <paths.h>
2393#endif
2394 ],
2395 [ char *wtmp = WTMP_FILE; ],
2396 [ AC_MSG_RESULT(yes) ],
2397 [ AC_MSG_RESULT(no)
2398 system_wtmp_path=no ]
2399)
2400if test -z "$conf_wtmp_location"; then
2401 if test x"$system_wtmp_path" = x"no" ; then
2402 for f in /usr/adm/wtmp /var/log/wtmp; do
2403 if test -f $f ; then
2404 conf_wtmp_location=$f
2405 fi
2406 done
2407 if test -z "$conf_wtmp_location"; then
2408 AC_DEFINE(DISABLE_WTMP)
2409 fi
2410 fi
2411fi
2412if test -n "$conf_wtmp_location"; then
2413 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2414fi
2415
2416
2417dnl utmpx detection - I don't know any system so perverse as to require
2418dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2419dnl there, though.
2420AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2421AC_TRY_COMPILE([
2422#include <sys/types.h>
2423#include <utmp.h>
2424#ifdef HAVE_UTMPX_H
2425#include <utmpx.h>
2426#endif
d7c0f3d5 2427#ifdef HAVE_PATHS_H
1d7b9b20 2428# include <paths.h>
2429#endif
2430 ],
2431 [ char *utmpx = UTMPX_FILE; ],
2432 [ AC_MSG_RESULT(yes) ],
2433 [ AC_MSG_RESULT(no)
2434 system_utmpx_path=no ]
2435)
2436if test -z "$conf_utmpx_location"; then
2437 if test x"$system_utmpx_path" = x"no" ; then
2438 AC_DEFINE(DISABLE_UTMPX)
2439 fi
2440else
2441 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2442fi
2443
2444dnl wtmpx detection
2445AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2446AC_TRY_COMPILE([
2447#include <sys/types.h>
2448#include <utmp.h>
2449#ifdef HAVE_UTMPX_H
2450#include <utmpx.h>
2451#endif
d7c0f3d5 2452#ifdef HAVE_PATHS_H
1d7b9b20 2453# include <paths.h>
2454#endif
2455 ],
2456 [ char *wtmpx = WTMPX_FILE; ],
2457 [ AC_MSG_RESULT(yes) ],
2458 [ AC_MSG_RESULT(no)
2459 system_wtmpx_path=no ]
2460)
2461if test -z "$conf_wtmpx_location"; then
2462 if test x"$system_wtmpx_path" = x"no" ; then
2463 AC_DEFINE(DISABLE_WTMPX)
2464 fi
2465else
2466 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2467fi
2468
b7a87eea 2469
bd499f9e 2470if test ! -z "$blibpath" ; then
2471 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2472 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2473fi
2474
ddceb1c8 2475dnl remove pam and dl because they are in $LIBPAM
2476if test "$PAM_MSG" = yes ; then
98f2d9d5 2477 LIBS=`echo $LIBS | sed 's/-lpam //'`
2478fi
2479if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2480 LIBS=`echo $LIBS | sed 's/-ldl //'`
ddceb1c8 2481fi
2482
3c62e7eb 2483AC_EXEEXT
98a7c37b 2484AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2485AC_OUTPUT
d3083fbd 2486
cbd7492e 2487# Print summary of options
2488
cbd7492e 2489# Someone please show me a better way :)
2490A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2491B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2492C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2493D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
f5665f6f 2494E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
e0c4d3ac 2495F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
cbd7492e 2496G=`eval echo ${piddir}` ; G=`eval echo ${G}`
ecac8ee5 2497H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2498I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2499J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
cbd7492e 2500
2501echo ""
26de7942 2502echo "OpenSSH has been configured with the following options:"
ecac8ee5 2503echo " User binaries: $B"
2504echo " System binaries: $C"
2505echo " Configuration files: $D"
2506echo " Askpass program: $E"
2507echo " Manual pages: $F"
2508echo " PID file: $G"
2509echo " Privilege separation chroot path: $H"
8d184c09 2510if test "$USES_LOGIN_CONF" = "yes" ; then
ecac8ee5 2511echo " At runtime, sshd will use the path defined in /etc/login.conf"
8d184c09 2512else
ecac8ee5 2513echo " sshd default user PATH: $I"
8d184c09 2514fi
06617857 2515if test ! -z "$superuser_path" ; then
ecac8ee5 2516echo " sshd superuser user PATH: $J"
2517fi
2518echo " Manpage format: $MANTYPE"
2519echo " PAM support: ${PAM_MSG}"
2520echo " KerberosIV support: $KRB4_MSG"
2521echo " KerberosV support: $KRB5_MSG"
2522echo " Smartcard support: $SCARD_MSG"
2523echo " AFS support: $AFS_MSG"
2524echo " S/KEY support: $SKEY_MSG"
2525echo " TCP Wrappers support: $TCPW_MSG"
2526echo " MD5 password support: $MD5_MSG"
3deb1408 2527echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
ecac8ee5 2528echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2529echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2530echo " BSD Auth support: $BSD_AUTH_MSG"
2531echo " Random number source: $RAND_MSG"
f1b0ecc3 2532if test ! -z "$USE_RAND_HELPER" ; then
ecac8ee5 2533echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
af774732 2534fi
2535
cbd7492e 2536echo ""
2537
0c2fb82f 2538echo " Host: ${host}"
2539echo " Compiler: ${CC}"
2540echo " Compiler flags: ${CFLAGS}"
2541echo "Preprocessor flags: ${CPPFLAGS}"
2542echo " Linker flags: ${LDFLAGS}"
ddceb1c8 2543echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
cbd7492e 2544
2545echo ""
2546
adeebd37 2547if test "x$PAM_MSG" = "xyes" ; then
f1b0ecc3 2548 echo "PAM is enabled. You may need to install a PAM control file "
2549 echo "for sshd, otherwise password authentication may fail. "
2550 echo "Example PAM control files can be found in the contrib/ "
2551 echo "subdirectory"
adeebd37 2552 echo ""
2553fi
2554
f1b0ecc3 2555if test ! -z "$NO_SFTP"; then
2556 echo "sftp-server will be disabled. Your compiler does not "
2557 echo "support 64bit integers."
48e7916f 2558 echo ""
2559fi
2c523de9 2560
f1b0ecc3 2561if test ! -z "$RAND_HELPER_CMDHASH" ; then
2562 echo "WARNING: you are using the builtin random number collection "
2563 echo "service. Please read WARNING.RNG and request that your OS "
2564 echo "vendor includes kernel-based random number collection in "
2565 echo "future versions of your OS."
2c523de9 2566 echo ""
2567fi
af774732 2568
This page took 1.072859 seconds and 5 git commands to generate.