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