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