]> andersk Git - openssh.git/blame - configure.ac
- (stevesk) [INSTALL acconfig.h configure.ac defines.h] remove --with-rsh
[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
9a0fbcb3 909ssh_privsep_user=sshd
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
914 ssh_privsep_user=$withval
915 fi
916 ]
917)
d6aea288 918AC_DEFINE_UNQUOTED(SSH_PRIVSEP_USER, "$ssh_privsep_user")
9a0fbcb3 919
81dadca3 920# We do this little dance with the search path to insure
921# that programs that we select for use by installed programs
922# (which may be run by the super-user) come from trusted
923# locations before they come from the user's private area.
924# This should help avoid accidentally configuring some
925# random version of a program in someone's personal bin.
926
927OPATH=$PATH
928PATH=/bin:/usr/bin
f95c8ce8 929test -h /bin 2> /dev/null && PATH=/usr/bin
81dadca3 930test -d /sbin && PATH=$PATH:/sbin
931test -d /usr/sbin && PATH=$PATH:/usr/sbin
932PATH=$PATH:/etc:$OPATH
933
f1b0ecc3 934# These programs are used by the command hashing source to gather entropy
935OSSH_PATH_ENTROPY_PROG(PROG_LS, ls)
936OSSH_PATH_ENTROPY_PROG(PROG_NETSTAT, netstat)
937OSSH_PATH_ENTROPY_PROG(PROG_ARP, arp)
938OSSH_PATH_ENTROPY_PROG(PROG_IFCONFIG, ifconfig)
939OSSH_PATH_ENTROPY_PROG(PROG_JSTAT, jstat)
940OSSH_PATH_ENTROPY_PROG(PROG_PS, ps)
941OSSH_PATH_ENTROPY_PROG(PROG_SAR, sar)
942OSSH_PATH_ENTROPY_PROG(PROG_W, w)
943OSSH_PATH_ENTROPY_PROG(PROG_WHO, who)
944OSSH_PATH_ENTROPY_PROG(PROG_LAST, last)
945OSSH_PATH_ENTROPY_PROG(PROG_LASTLOG, lastlog)
946OSSH_PATH_ENTROPY_PROG(PROG_DF, df)
947OSSH_PATH_ENTROPY_PROG(PROG_VMSTAT, vmstat)
948OSSH_PATH_ENTROPY_PROG(PROG_UPTIME, uptime)
949OSSH_PATH_ENTROPY_PROG(PROG_IPCS, ipcs)
950OSSH_PATH_ENTROPY_PROG(PROG_TAIL, tail)
81dadca3 951# restore PATH
952PATH=$OPATH
f1b0ecc3 953
954# Where does ssh-rand-helper get its randomness from?
955INSTALL_SSH_PRNG_CMDS=""
956if test ! -z "$INSTALL_SSH_RAND_HELPER" ; then
957 if test ! -z "$PRNGD_PORT" ; then
958 RAND_HELPER_MSG="TCP localhost:$PRNGD_PORT"
959 elif test ! -z "$PRNGD_SOCKET" ; then
960 RAND_HELPER_MSG="Unix domain socket \"$PRNGD_SOCKET\""
961 else
962 RAND_HELPER_MSG="Command hashing (timeout $entropy_timeout)"
963 RAND_HELPER_CMDHASH=yes
964 INSTALL_SSH_PRNG_CMDS="yes"
965 fi
966fi
967AC_SUBST(INSTALL_SSH_PRNG_CMDS)
968
969
66d6c27e 970# Cheap hack to ensure NEWS-OS libraries are arranged right.
971if test ! -z "$SONY" ; then
972 LIBS="$LIBS -liberty";
973fi
974
a0391976 975# Checks for data types
976f7e19 976AC_CHECK_SIZEOF(char, 1)
2b942fe0 977AC_CHECK_SIZEOF(short int, 2)
978AC_CHECK_SIZEOF(int, 4)
979AC_CHECK_SIZEOF(long int, 4)
980AC_CHECK_SIZEOF(long long int, 8)
981
52f1ccb2 982# Sanity check long long for some platforms (AIX)
983if test "x$ac_cv_sizeof_long_long_int" = "x4" ; then
984 ac_cv_sizeof_long_long_int=0
985fi
986
a0391976 987# More checks for data types
14a9a859 988AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
989 AC_TRY_COMPILE(
990 [ #include <sys/types.h> ],
991 [ u_int a; a = 1;],
992 [ ac_cv_have_u_int="yes" ],
993 [ ac_cv_have_u_int="no" ]
994 )
995])
996if test "x$ac_cv_have_u_int" = "xyes" ; then
997 AC_DEFINE(HAVE_U_INT)
998 have_u_int=1
999fi
1000
58d100bf 1001AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
1002 AC_TRY_COMPILE(
1003 [ #include <sys/types.h> ],
1004 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1005 [ ac_cv_have_intxx_t="yes" ],
1006 [ ac_cv_have_intxx_t="no" ]
1007 )
1008])
1009if test "x$ac_cv_have_intxx_t" = "xyes" ; then
1010 AC_DEFINE(HAVE_INTXX_T)
1011 have_intxx_t=1
1012fi
41cb4569 1013
1014if (test -z "$have_intxx_t" && \
1015 test "x$ac_cv_header_stdint_h" = "xyes")
1016then
1017 AC_MSG_CHECKING([for intXX_t types in stdint.h])
1018 AC_TRY_COMPILE(
1019 [ #include <stdint.h> ],
1020 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
1021 [
1022 AC_DEFINE(HAVE_INTXX_T)
1023 AC_MSG_RESULT(yes)
1024 ],
1025 [ AC_MSG_RESULT(no) ]
1026 )
1027fi
1028
bd590612 1029AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
1030 AC_TRY_COMPILE(
1031 [ #include <sys/types.h> ],
1032 [ int64_t a; a = 1;],
1033 [ ac_cv_have_int64_t="yes" ],
1034 [ ac_cv_have_int64_t="no" ]
1035 )
1036])
1037if test "x$ac_cv_have_int64_t" = "xyes" ; then
1038 AC_DEFINE(HAVE_INT64_T)
1039 have_int64_t=1
1040fi
1041
41cb4569 1042if test -z "$have_int64_t" ; then
1043 AC_MSG_CHECKING([for int64_t type in sys/socket.h])
1044 AC_TRY_COMPILE(
1045 [ #include <sys/socket.h> ],
1046 [ int64_t a; a = 1],
1047 [
1048 AC_DEFINE(HAVE_INT64_T)
1049 AC_MSG_RESULT(yes)
1050 ],
1051 [ AC_MSG_RESULT(no) ]
1052 )
1053fi
1054
ddceb1c8 1055if test -z "$have_int64_t" ; then
1056 AC_MSG_CHECKING([for int64_t type in sys/bitypes.h])
1057 AC_TRY_COMPILE(
1058 [ #include <sys/bitypes.h> ],
1059 [ int64_t a; a = 1],
1060 [
1061 AC_DEFINE(HAVE_INT64_T)
1062 AC_MSG_RESULT(yes)
1063 ],
1064 [ AC_MSG_RESULT(no) ]
1065 )
1066fi
1067
58d100bf 1068AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
1069 AC_TRY_COMPILE(
1070 [ #include <sys/types.h> ],
1071 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1072 [ ac_cv_have_u_intxx_t="yes" ],
1073 [ ac_cv_have_u_intxx_t="no" ]
1074 )
1075])
1076if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
1077 AC_DEFINE(HAVE_U_INTXX_T)
1078 have_u_intxx_t=1
1079fi
2b942fe0 1080
41cb4569 1081if test -z "$have_u_intxx_t" ; then
1082 AC_MSG_CHECKING([for u_intXX_t types in sys/socket.h])
1083 AC_TRY_COMPILE(
1084 [ #include <sys/socket.h> ],
1085 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
1086 [
1087 AC_DEFINE(HAVE_U_INTXX_T)
1088 AC_MSG_RESULT(yes)
1089 ],
1090 [ AC_MSG_RESULT(no) ]
1091 )
1092fi
1093
bd590612 1094AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
1095 AC_TRY_COMPILE(
1096 [ #include <sys/types.h> ],
1097 [ u_int64_t a; a = 1;],
1098 [ ac_cv_have_u_int64_t="yes" ],
1099 [ ac_cv_have_u_int64_t="no" ]
1100 )
1101])
1102if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
1103 AC_DEFINE(HAVE_U_INT64_T)
1104 have_u_int64_t=1
1105fi
1106
ddceb1c8 1107if test -z "$have_u_int64_t" ; then
1108 AC_MSG_CHECKING([for u_int64_t type in sys/bitypes.h])
1109 AC_TRY_COMPILE(
1110 [ #include <sys/bitypes.h> ],
1111 [ u_int64_t a; a = 1],
1112 [
1113 AC_DEFINE(HAVE_U_INT64_T)
1114 AC_MSG_RESULT(yes)
1115 ],
1116 [ AC_MSG_RESULT(no) ]
1117 )
1118fi
1119
41cb4569 1120if test -z "$have_u_intxx_t" ; then
1121 AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
1122 AC_TRY_COMPILE(
1123 [
1124#include <sys/types.h>
1125 ],
1126 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
1127 [ ac_cv_have_uintxx_t="yes" ],
1128 [ ac_cv_have_uintxx_t="no" ]
1129 )
1130 ])
1131 if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
1132 AC_DEFINE(HAVE_UINTXX_T)
1133 fi
1134fi
1135
1136if test -z "$have_uintxx_t" ; then
1137 AC_MSG_CHECKING([for uintXX_t types in stdint.h])
1138 AC_TRY_COMPILE(
1139 [ #include <stdint.h> ],
1140 [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1;],
1141 [
1142 AC_DEFINE(HAVE_UINTXX_T)
1143 AC_MSG_RESULT(yes)
1144 ],
1145 [ AC_MSG_RESULT(no) ]
1146 )
1147fi
1148
e5fe9a1f 1149if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
1150 test "x$ac_cv_header_sys_bitypes_h" = "xyes")
5cdfe03f 1151then
1152 AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
1153 AC_TRY_COMPILE(
58d100bf 1154 [
1155#include <sys/bitypes.h>
1156 ],
5cdfe03f 1157 [
837c30b8 1158 int8_t a; int16_t b; int32_t c;
1159 u_int8_t e; u_int16_t f; u_int32_t g;
1160 a = b = c = e = f = g = 1;
5cdfe03f 1161 ],
1162 [
1163 AC_DEFINE(HAVE_U_INTXX_T)
1164 AC_DEFINE(HAVE_INTXX_T)
1165 AC_MSG_RESULT(yes)
1166 ],
1167 [AC_MSG_RESULT(no)]
1168 )
1169fi
1170
0362750e 1171
1172AC_CACHE_CHECK([for u_char], ac_cv_have_u_char, [
1173 AC_TRY_COMPILE(
1174 [
1175#include <sys/types.h>
1176 ],
1177 [ u_char foo; foo = 125; ],
1178 [ ac_cv_have_u_char="yes" ],
1179 [ ac_cv_have_u_char="no" ]
1180 )
1181])
1182if test "x$ac_cv_have_u_char" = "xyes" ; then
1183 AC_DEFINE(HAVE_U_CHAR)
1184fi
1185
98a7c37b 1186TYPE_SOCKLEN_T
2b942fe0 1187
2d16d9a3 1188AC_CHECK_TYPES(sig_atomic_t,,,[#include <signal.h>])
ddceb1c8 1189
58d100bf 1190AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
1191 AC_TRY_COMPILE(
1192 [
18ba2aab 1193#include <sys/types.h>
58d100bf 1194 ],
1195 [ size_t foo; foo = 1235; ],
1196 [ ac_cv_have_size_t="yes" ],
1197 [ ac_cv_have_size_t="no" ]
1198 )
1199])
1200if test "x$ac_cv_have_size_t" = "xyes" ; then
1201 AC_DEFINE(HAVE_SIZE_T)
1202fi
ea1970a3 1203
c04f75f1 1204AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
1205 AC_TRY_COMPILE(
1206 [
1207#include <sys/types.h>
1208 ],
1209 [ ssize_t foo; foo = 1235; ],
1210 [ ac_cv_have_ssize_t="yes" ],
1211 [ ac_cv_have_ssize_t="no" ]
1212 )
1213])
1214if test "x$ac_cv_have_ssize_t" = "xyes" ; then
1215 AC_DEFINE(HAVE_SSIZE_T)
1216fi
1217
f1c4659d 1218AC_CACHE_CHECK([for clock_t], ac_cv_have_clock_t, [
1219 AC_TRY_COMPILE(
1220 [
1221#include <time.h>
1222 ],
1223 [ clock_t foo; foo = 1235; ],
1224 [ ac_cv_have_clock_t="yes" ],
1225 [ ac_cv_have_clock_t="no" ]
1226 )
1227])
1228if test "x$ac_cv_have_clock_t" = "xyes" ; then
1229 AC_DEFINE(HAVE_CLOCK_T)
1230fi
1231
1c04b088 1232AC_CACHE_CHECK([for sa_family_t], ac_cv_have_sa_family_t, [
1233 AC_TRY_COMPILE(
1234 [
1235#include <sys/types.h>
1236#include <sys/socket.h>
1237 ],
1238 [ sa_family_t foo; foo = 1235; ],
1239 [ ac_cv_have_sa_family_t="yes" ],
77bb0bca 1240 [ AC_TRY_COMPILE(
1241 [
1242#include <sys/types.h>
1243#include <sys/socket.h>
1244#include <netinet/in.h>
1245 ],
1246 [ sa_family_t foo; foo = 1235; ],
1247 [ ac_cv_have_sa_family_t="yes" ],
1248
1c04b088 1249 [ ac_cv_have_sa_family_t="no" ]
77bb0bca 1250 )]
1c04b088 1251 )
1252])
1253if test "x$ac_cv_have_sa_family_t" = "xyes" ; then
1254 AC_DEFINE(HAVE_SA_FAMILY_T)
1255fi
1256
729bfe59 1257AC_CACHE_CHECK([for pid_t], ac_cv_have_pid_t, [
1258 AC_TRY_COMPILE(
1259 [
1260#include <sys/types.h>
1261 ],
1262 [ pid_t foo; foo = 1235; ],
1263 [ ac_cv_have_pid_t="yes" ],
1264 [ ac_cv_have_pid_t="no" ]
1265 )
1266])
1267if test "x$ac_cv_have_pid_t" = "xyes" ; then
1268 AC_DEFINE(HAVE_PID_T)
1269fi
1270
1271AC_CACHE_CHECK([for mode_t], ac_cv_have_mode_t, [
1272 AC_TRY_COMPILE(
1273 [
1274#include <sys/types.h>
1275 ],
1276 [ mode_t foo; foo = 1235; ],
1277 [ ac_cv_have_mode_t="yes" ],
1278 [ ac_cv_have_mode_t="no" ]
1279 )
1280])
1281if test "x$ac_cv_have_mode_t" = "xyes" ; then
1282 AC_DEFINE(HAVE_MODE_T)
1283fi
1284
e3a93db0 1285
58d100bf 1286AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
1287 AC_TRY_COMPILE(
1288 [
18ba2aab 1289#include <sys/types.h>
1290#include <sys/socket.h>
58d100bf 1291 ],
1292 [ struct sockaddr_storage s; ],
1293 [ ac_cv_have_struct_sockaddr_storage="yes" ],
1294 [ ac_cv_have_struct_sockaddr_storage="no" ]
1295 )
1296])
1297if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
1298 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
1299fi
48e671d5 1300
58d100bf 1301AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
1302 AC_TRY_COMPILE(
1303 [
cbd7492e 1304#include <sys/types.h>
58d100bf 1305#include <netinet/in.h>
1306 ],
1307 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
1308 [ ac_cv_have_struct_sockaddr_in6="yes" ],
1309 [ ac_cv_have_struct_sockaddr_in6="no" ]
1310 )
1311])
1312if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
1313 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6)
1314fi
48e671d5 1315
58d100bf 1316AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
1317 AC_TRY_COMPILE(
1318 [
cbd7492e 1319#include <sys/types.h>
58d100bf 1320#include <netinet/in.h>
1321 ],
1322 [ struct in6_addr s; s.s6_addr[0] = 0; ],
1323 [ ac_cv_have_struct_in6_addr="yes" ],
1324 [ ac_cv_have_struct_in6_addr="no" ]
1325 )
1326])
1327if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
1328 AC_DEFINE(HAVE_STRUCT_IN6_ADDR)
1329fi
48e671d5 1330
58d100bf 1331AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
1332 AC_TRY_COMPILE(
1333 [
18ba2aab 1334#include <sys/types.h>
1335#include <sys/socket.h>
1336#include <netdb.h>
58d100bf 1337 ],
1338 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
1339 [ ac_cv_have_struct_addrinfo="yes" ],
1340 [ ac_cv_have_struct_addrinfo="no" ]
1341 )
1342])
1343if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
1344 AC_DEFINE(HAVE_STRUCT_ADDRINFO)
1345fi
1346
89c7e31c 1347AC_CACHE_CHECK([for struct timeval], ac_cv_have_struct_timeval, [
1348 AC_TRY_COMPILE(
1349 [ #include <sys/time.h> ],
1350 [ struct timeval tv; tv.tv_sec = 1;],
1351 [ ac_cv_have_struct_timeval="yes" ],
1352 [ ac_cv_have_struct_timeval="no" ]
1353 )
1354])
1355if test "x$ac_cv_have_struct_timeval" = "xyes" ; then
1356 AC_DEFINE(HAVE_STRUCT_TIMEVAL)
1357 have_struct_timeval=1
1358fi
1359
2c523de9 1360# If we don't have int64_t then we can't compile sftp-server. So don't
1361# even attempt to do it.
1362if test "x$ac_cv_have_int64_t" = "xno" -a \
1363 "x$ac_cv_sizeof_long_int" != "x8" -a \
1364 "x$ac_cv_sizeof_long_long_int" = "x0" ; then
1365 NO_SFTP='#'
733cf7f4 1366else
1367dnl test snprintf (broken on SCO w/gcc)
1368 AC_TRY_RUN(
1369 [
1370#include <stdio.h>
1371#include <string.h>
1372#ifdef HAVE_SNPRINTF
1373main()
1374{
1375 char buf[50];
1376 char expected_out[50];
1377 int mazsize = 50 ;
1378#if (SIZEOF_LONG_INT == 8)
1379 long int num = 0x7fffffffffffffff;
1380#else
763a1a18 1381 long long num = 0x7fffffffffffffffll;
733cf7f4 1382#endif
1383 strcpy(expected_out, "9223372036854775807");
1384 snprintf(buf, mazsize, "%lld", num);
1385 if(strcmp(buf, expected_out) != 0)
1386 exit(1);
1387 exit(0);
1388}
1389#else
1390main() { exit(0); }
1391#endif
1392 ], [ true ], [ AC_DEFINE(BROKEN_SNPRINTF) ]
1393 )
2c523de9 1394fi
89c7e31c 1395AC_SUBST(NO_SFTP)
2c523de9 1396
77bb0bca 1397dnl Checks for structure members
58d100bf 1398OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmp.h, HAVE_HOST_IN_UTMP)
1399OSSH_CHECK_HEADER_FOR_FIELD(ut_host, utmpx.h, HAVE_HOST_IN_UTMPX)
1400OSSH_CHECK_HEADER_FOR_FIELD(syslen, utmpx.h, HAVE_SYSLEN_IN_UTMPX)
1401OSSH_CHECK_HEADER_FOR_FIELD(ut_pid, utmp.h, HAVE_PID_IN_UTMP)
1402OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmp.h, HAVE_TYPE_IN_UTMP)
25422c70 1403OSSH_CHECK_HEADER_FOR_FIELD(ut_type, utmpx.h, HAVE_TYPE_IN_UTMPX)
58d100bf 1404OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmp.h, HAVE_TV_IN_UTMP)
1405OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmp.h, HAVE_ID_IN_UTMP)
daaff4d5 1406OSSH_CHECK_HEADER_FOR_FIELD(ut_id, utmpx.h, HAVE_ID_IN_UTMPX)
58d100bf 1407OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmp.h, HAVE_ADDR_IN_UTMP)
1408OSSH_CHECK_HEADER_FOR_FIELD(ut_addr, utmpx.h, HAVE_ADDR_IN_UTMPX)
1409OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmp.h, HAVE_ADDR_V6_IN_UTMP)
1410OSSH_CHECK_HEADER_FOR_FIELD(ut_addr_v6, utmpx.h, HAVE_ADDR_V6_IN_UTMPX)
1d7b9b20 1411OSSH_CHECK_HEADER_FOR_FIELD(ut_exit, utmp.h, HAVE_EXIT_IN_UTMP)
1412OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmp.h, HAVE_TIME_IN_UTMP)
1413OSSH_CHECK_HEADER_FOR_FIELD(ut_time, utmpx.h, HAVE_TIME_IN_UTMPX)
1414OSSH_CHECK_HEADER_FOR_FIELD(ut_tv, utmpx.h, HAVE_TV_IN_UTMPX)
98a7c37b 1415
1416AC_CHECK_MEMBERS([struct stat.st_blksize])
1d7b9b20 1417
58d100bf 1418AC_CACHE_CHECK([for ss_family field in struct sockaddr_storage],
1419 ac_cv_have_ss_family_in_struct_ss, [
1420 AC_TRY_COMPILE(
1421 [
18ba2aab 1422#include <sys/types.h>
1423#include <sys/socket.h>
58d100bf 1424 ],
1425 [ struct sockaddr_storage s; s.ss_family = 1; ],
1426 [ ac_cv_have_ss_family_in_struct_ss="yes" ],
1427 [ ac_cv_have_ss_family_in_struct_ss="no" ],
1428 )
1429])
1430if test "x$ac_cv_have_ss_family_in_struct_ss" = "xyes" ; then
1431 AC_DEFINE(HAVE_SS_FAMILY_IN_SS)
1432fi
1433
58d100bf 1434AC_CACHE_CHECK([for __ss_family field in struct sockaddr_storage],
1435 ac_cv_have___ss_family_in_struct_ss, [
1436 AC_TRY_COMPILE(
1437 [
18ba2aab 1438#include <sys/types.h>
1439#include <sys/socket.h>
58d100bf 1440 ],
1441 [ struct sockaddr_storage s; s.__ss_family = 1; ],
1442 [ ac_cv_have___ss_family_in_struct_ss="yes" ],
1443 [ ac_cv_have___ss_family_in_struct_ss="no" ]
1444 )
1445])
1446if test "x$ac_cv_have___ss_family_in_struct_ss" = "xyes" ; then
1447 AC_DEFINE(HAVE___SS_FAMILY_IN_SS)
1448fi
1449
2e73a022 1450AC_CACHE_CHECK([for pw_class field in struct passwd],
1451 ac_cv_have_pw_class_in_struct_passwd, [
1452 AC_TRY_COMPILE(
1453 [
2e73a022 1454#include <pwd.h>
1455 ],
97994d32 1456 [ struct passwd p; p.pw_class = 0; ],
2e73a022 1457 [ ac_cv_have_pw_class_in_struct_passwd="yes" ],
1458 [ ac_cv_have_pw_class_in_struct_passwd="no" ]
1459 )
1460])
1461if test "x$ac_cv_have_pw_class_in_struct_passwd" = "xyes" ; then
1462 AC_DEFINE(HAVE_PW_CLASS_IN_PASSWD)
1463fi
1464
7751d4eb 1465AC_CACHE_CHECK([for pw_expire field in struct passwd],
1466 ac_cv_have_pw_expire_in_struct_passwd, [
1467 AC_TRY_COMPILE(
1468 [
1469#include <pwd.h>
1470 ],
1471 [ struct passwd p; p.pw_expire = 0; ],
1472 [ ac_cv_have_pw_expire_in_struct_passwd="yes" ],
1473 [ ac_cv_have_pw_expire_in_struct_passwd="no" ]
1474 )
1475])
1476if test "x$ac_cv_have_pw_expire_in_struct_passwd" = "xyes" ; then
1477 AC_DEFINE(HAVE_PW_EXPIRE_IN_PASSWD)
1478fi
1479
1480AC_CACHE_CHECK([for pw_change field in struct passwd],
1481 ac_cv_have_pw_change_in_struct_passwd, [
1482 AC_TRY_COMPILE(
1483 [
1484#include <pwd.h>
1485 ],
1486 [ struct passwd p; p.pw_change = 0; ],
1487 [ ac_cv_have_pw_change_in_struct_passwd="yes" ],
1488 [ ac_cv_have_pw_change_in_struct_passwd="no" ]
1489 )
1490])
1491if test "x$ac_cv_have_pw_change_in_struct_passwd" = "xyes" ; then
1492 AC_DEFINE(HAVE_PW_CHANGE_IN_PASSWD)
1493fi
58d100bf 1494
637f9177 1495dnl make sure we're using the real structure members and not defines
6f34652e 1496AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1497 ac_cv_have_accrights_in_msghdr, [
637f9177 1498 AC_TRY_RUN(
6f34652e 1499 [
f95c8ce8 1500#include <sys/types.h>
6f34652e 1501#include <sys/socket.h>
1502#include <sys/uio.h>
637f9177 1503int main() {
1504#ifdef msg_accrights
1505exit(1);
1506#endif
1507struct msghdr m;
1508m.msg_accrights = 0;
1509exit(0);
1510}
6f34652e 1511 ],
6f34652e 1512 [ ac_cv_have_accrights_in_msghdr="yes" ],
1513 [ ac_cv_have_accrights_in_msghdr="no" ]
1514 )
1515])
1516if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1517 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1518fi
1519
7176df4f 1520AC_CACHE_CHECK([for msg_control field in struct msghdr],
1521 ac_cv_have_control_in_msghdr, [
637f9177 1522 AC_TRY_RUN(
7176df4f 1523 [
f95c8ce8 1524#include <sys/types.h>
7176df4f 1525#include <sys/socket.h>
1526#include <sys/uio.h>
637f9177 1527int main() {
1528#ifdef msg_control
1529exit(1);
1530#endif
1531struct msghdr m;
1532m.msg_control = 0;
1533exit(0);
1534}
7176df4f 1535 ],
7176df4f 1536 [ ac_cv_have_control_in_msghdr="yes" ],
1537 [ ac_cv_have_control_in_msghdr="no" ]
1538 )
1539])
1540if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1541 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1542fi
1543
58d100bf 1544AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1545 AC_TRY_LINK([],
1546 [ extern char *__progname; printf("%s", __progname); ],
1547 [ ac_cv_libc_defines___progname="yes" ],
1548 [ ac_cv_libc_defines___progname="no" ]
1549 )
1550])
1551if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1552 AC_DEFINE(HAVE___PROGNAME)
1553fi
8946db53 1554
c921ee00 1555AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1556 AC_TRY_LINK([
1557#include <stdio.h>
1558],
1559 [ printf("%s", __FUNCTION__); ],
1560 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1561 [ ac_cv_cc_implements___FUNCTION__="no" ]
1562 )
1563])
1564if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1565 AC_DEFINE(HAVE___FUNCTION__)
1566fi
1567
1568AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1569 AC_TRY_LINK([
1570#include <stdio.h>
1571],
1572 [ printf("%s", __func__); ],
1573 [ ac_cv_cc_implements___func__="yes" ],
1574 [ ac_cv_cc_implements___func__="no" ]
1575 )
1576])
1577if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1578 AC_DEFINE(HAVE___func__)
1579fi
1580
1812a662 1581AC_CACHE_CHECK([whether getopt has optreset support],
1582 ac_cv_have_getopt_optreset, [
1583 AC_TRY_LINK(
1584 [
1585#include <getopt.h>
1586 ],
1587 [ extern int optreset; optreset = 0; ],
1588 [ ac_cv_have_getopt_optreset="yes" ],
1589 [ ac_cv_have_getopt_optreset="no" ]
1590 )
1591])
1592if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1593 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1594fi
a0391976 1595
819b676f 1596AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1597 AC_TRY_LINK([],
1598 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1599 [ ac_cv_libc_defines_sys_errlist="yes" ],
1600 [ ac_cv_libc_defines_sys_errlist="no" ]
1601 )
1602])
1603if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1604 AC_DEFINE(HAVE_SYS_ERRLIST)
1605fi
1606
1607
416ed5a7 1608AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1609 AC_TRY_LINK([],
1610 [ extern int sys_nerr; printf("%i", sys_nerr);],
1611 [ ac_cv_libc_defines_sys_nerr="yes" ],
1612 [ ac_cv_libc_defines_sys_nerr="no" ]
1613 )
1614])
1615if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1616 AC_DEFINE(HAVE_SYS_NERR)
1617fi
1618
d0b19c95 1619SCARD_MSG="no"
295c8801 1620
1621# Check whether user wants sectok support
1622AC_ARG_WITH(sectok,
1623 [ --with-sectok Enable smartcard support using libsectok],
d0b19c95 1624 [
1625 if test "x$withval" != "xno" ; then
1626 if test "x$withval" != "xyes" ; then
1627 CPPFLAGS="$CPPFLAGS -I${withval}"
1628 LDFLAGS="$LDFLAGS -L${withval}"
1629 if test ! -z "$need_dash_r" ; then
1630 LDFLAGS="$LDFLAGS -R${withval}"
1631 fi
1632 if test ! -z "$blibpath" ; then
1633 blibpath="$blibpath:${withval}"
1634 fi
1635 fi
1636 AC_CHECK_HEADERS(sectok.h)
1637 if test "$ac_cv_header_sectok_h" != yes; then
1638 AC_MSG_ERROR(Can't find sectok.h)
1639 fi
1640 AC_CHECK_LIB(sectok, sectok_open)
1641 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1642 AC_MSG_ERROR(Can't find libsectok)
1643 fi
1644 AC_DEFINE(SMARTCARD)
295c8801 1645 AC_DEFINE(USE_SECTOK)
1646 SCARD_MSG="yes, using sectok"
1647 fi
1648 ]
1649)
1650
1651# Check whether user wants OpenSC support
1652AC_ARG_WITH(opensc,
49ef62db 1653 AC_HELP_STRING([--with-opensc=PFX],
1654 [Enable smartcard support using OpenSC]),
1655 opensc_config_prefix="$withval", opensc_config_prefix="")
1656if test x$opensc_config_prefix != x ; then
1657 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1658 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1659 if test "$OPENSC_CONFIG" != "no"; then
1660 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1661 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1662 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1663 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1664 AC_DEFINE(SMARTCARD)
1665 AC_DEFINE(USE_OPENSC)
1666 SCARD_MSG="yes, using OpenSC"
1667 fi
1668fi
d0b19c95 1669
12928e80 1670# Check whether user wants Kerberos 5 support
1671KRB5_MSG="no"
1672AC_ARG_WITH(kerberos5,
1673 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1674 [
1675 if test "x$withval" != "xno" ; then
1676 if test "x$withval" = "xyes" ; then
1677 KRB5ROOT="/usr/local"
1678 else
1679 KRB5ROOT=${withval}
1680 fi
1681 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1682 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1683 AC_DEFINE(KRB5)
1684 KRB5_MSG="yes"
1685 AC_MSG_CHECKING(whether we are using Heimdal)
1686 AC_TRY_COMPILE([ #include <krb5.h> ],
1687 [ char *tmp = heimdal_version; ],
1688 [ AC_MSG_RESULT(yes)
1689 AC_DEFINE(HEIMDAL)
1690 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1691 ],
1692 [ AC_MSG_RESULT(no)
1693 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1694 ]
1695 )
1696 if test ! -z "$need_dash_r" ; then
1697 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1698 fi
1699 if test ! -z "$blibpath" ; then
1700 blibpath="$blibpath:${KRB5ROOT}/lib"
1701 fi
1702 AC_CHECK_LIB(resolv, dn_expand, , )
1703
1704 KRB5=yes
1705 fi
1706 ]
1707)
1708# Check whether user wants Kerberos 4 support
b5b68128 1709KRB4_MSG="no"
1710AC_ARG_WITH(kerberos4,
1711 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1712 [
1713 if test "x$withval" != "xno" ; then
b5b68128 1714 if test "x$withval" != "xyes" ; then
1715 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1716 LDFLAGS="$LDFLAGS -L${withval}/lib"
1717 if test ! -z "$need_dash_r" ; then
1718 LDFLAGS="$LDFLAGS -R${withval}/lib"
1719 fi
1720 if test ! -z "$blibpath" ; then
1721 blibpath="$blibpath:${withval}/lib"
1722 fi
1723 else
1724 if test -d /usr/include/kerberosIV ; then
1725 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1726 fi
1727 fi
1728
1729 AC_CHECK_HEADERS(krb.h)
b5b68128 1730 if test "$ac_cv_header_krb_h" != yes; then
1731 AC_MSG_WARN([Cannot find krb.h, build may fail])
1732 fi
cccfea16 1733 AC_CHECK_LIB(krb, main)
b5b68128 1734 if test "$ac_cv_lib_krb_main" != yes; then
cccfea16 1735 AC_CHECK_LIB(krb4, main)
1736 if test "$ac_cv_lib_krb4_main" != yes; then
1737 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1738 else
1739 KLIBS="-lkrb4"
1740 fi
1741 else
1742 KLIBS="-lkrb"
1743 fi
1744 AC_CHECK_LIB(des, des_cbc_encrypt)
1745 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1746 AC_CHECK_LIB(des425, des_cbc_encrypt)
1747 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1748 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1749 else
1750 KLIBS="-ldes425"
1751 fi
1752 else
1753 KLIBS="-ldes"
b5b68128 1754 fi
b5b68128 1755 AC_CHECK_LIB(resolv, dn_expand, , )
1756 KRB4=yes
1757 KRB4_MSG="yes"
1758 AC_DEFINE(KRB4)
1759 fi
1760 ]
1761)
1762
1763# Check whether user wants AFS support
1764AFS_MSG="no"
1765AC_ARG_WITH(afs,
1766 [ --with-afs=PATH Enable AFS support],
1767 [
1768 if test "x$withval" != "xno" ; then
1769
1770 if test "x$withval" != "xyes" ; then
1771 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1772 LDFLAGS="$LDFLAGS -L${withval}/lib"
1773 fi
1774
1775 if test -z "$KRB4" ; then
1776 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1777 fi
1778
1779 LIBS="-lkafs $LIBS"
1780 if test ! -z "$AFS_LIBS" ; then
1781 LIBS="$LIBS $AFS_LIBS"
1782 fi
1783 AC_DEFINE(AFS)
1784 AFS_MSG="yes"
1785 fi
1786 ]
1787)
12928e80 1788LIBS="$LIBS $KLIBS $K5LIBS"
b5b68128 1789
a0391976 1790# Looking for programs, paths and files
a0391976 1791
ecac8ee5 1792PRIVSEP_PATH=/var/empty
1793AC_ARG_WITH(privsep-path,
a23a769d 1794 [ --with-privsep-path=xxx Path for privilege separation chroot ],
ecac8ee5 1795 [
1796 if test "x$withval" != "$no" ; then
1797 PRIVSEP_PATH=$withval
1798 fi
1799 ]
1800)
1801AC_SUBST(PRIVSEP_PATH)
1802
a0391976 1803AC_ARG_WITH(xauth,
1804 [ --with-xauth=PATH Specify path to xauth program ],
1805 [
00937921 1806 if test "x$withval" != "xno" ; then
cbd7492e 1807 xauth_path=$withval
a0391976 1808 fi
1809 ],
1810 [
77bb0bca 1811 AC_PATH_PROG(xauth_path, xauth,,$PATH:/usr/X/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin)
e5fe9a1f 1812 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
a0391976 1813 xauth_path="/usr/openwin/bin/xauth"
1814 fi
1815 ]
1816)
1817
b3ec54b4 1818if test -z "$xauth_path" ; then
1819 XAUTH_PATH="undefined"
1820 AC_SUBST(XAUTH_PATH)
1821else
a0391976 1822 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
b3ec54b4 1823 XAUTH_PATH=$xauth_path
1824 AC_SUBST(XAUTH_PATH)
a0391976 1825fi
a0391976 1826
1827# Check for mail directory (last resort if we cannot get it from headers)
1828if test ! -z "$MAIL" ; then
1829 maildir=`dirname $MAIL`
1830 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1831fi
1832
a0391976 1833if test -z "$no_dev_ptmx" ; then
6e879cb4 1834 if test "x$disable_ptmx_check" != "xyes" ; then
1835 AC_CHECK_FILE("/dev/ptmx",
1836 [
1837 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1838 have_dev_ptmx=1
1839 ]
1840 )
1841 fi
3276571c 1842fi
1843AC_CHECK_FILE("/dev/ptc",
1844 [
1845 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1846 have_dev_ptc=1
1847 ]
1848)
1849
a0391976 1850# Options from here on. Some of these are preset by platform above
fdf6b7aa 1851AC_ARG_WITH(mantype,
5d97cfbf 1852 [ --with-mantype=man|cat|doc Set man page type],
c54a6257 1853 [
5d97cfbf 1854 case "$withval" in
1855 man|cat|doc)
1856 MANTYPE=$withval
1857 ;;
1858 *)
1859 AC_MSG_ERROR(invalid man type: $withval)
1860 ;;
1861 esac
c54a6257 1862 ]
1863)
e0c4d3ac 1864if test -z "$MANTYPE"; then
533875af 1865 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
e0c4d3ac 1866 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
1867 MANTYPE=doc
1868 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
1869 MANTYPE=man
1870 else
1871 MANTYPE=cat
1872 fi
1873fi
c54a6257 1874AC_SUBST(MANTYPE)
e0c4d3ac 1875if test "$MANTYPE" = "doc"; then
1876 mansubdir=man;
1877else
1878 mansubdir=$MANTYPE;
1879fi
1880AC_SUBST(mansubdir)
0bc5b6fb 1881
a0391976 1882# Check whether to enable MD5 passwords
cbd7492e 1883MD5_MSG="no"
2ddcfdf3 1884AC_ARG_WITH(md5-passwords,
caf3bc51 1885 [ --with-md5-passwords Enable use of MD5 passwords],
0bc5b6fb 1886 [
bcf36c78 1887 if test "x$withval" != "xno" ; then
0bc5b6fb 1888 AC_DEFINE(HAVE_MD5_PASSWORDS)
cbd7492e 1889 MD5_MSG="yes"
0bc5b6fb 1890 fi
1891 ]
caf3bc51 1892)
1893
a0391976 1894# Whether to disable shadow password support
a7effaac 1895AC_ARG_WITH(shadow,
1896 [ --without-shadow Disable shadow password support],
1897 [
1898 if test "x$withval" = "xno" ; then
1899 AC_DEFINE(DISABLE_SHADOW)
4cb5ffa0 1900 disable_shadow=yes
a7effaac 1901 fi
1902 ]
1903)
1904
4cb5ffa0 1905if test -z "$disable_shadow" ; then
1906 AC_MSG_CHECKING([if the systems has expire shadow information])
1907 AC_TRY_COMPILE(
1908 [
1909#include <sys/types.h>
1910#include <shadow.h>
1911 struct spwd sp;
1912 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
1913 [ sp_expire_available=yes ], []
1914 )
1915
1916 if test "x$sp_expire_available" = "xyes" ; then
1917 AC_MSG_RESULT(yes)
1918 AC_DEFINE(HAS_SHADOW_EXPIRE)
1919 else
1920 AC_MSG_RESULT(no)
1921 fi
1922fi
1923
a0391976 1924# Use ip address instead of hostname in $DISPLAY
44839801 1925if test ! -z "$IPADDR_IN_DISPLAY" ; then
1926 DISPLAY_HACK_MSG="yes"
1927 AC_DEFINE(IPADDR_IN_DISPLAY)
1928else
1929 DISPLAY_HACK_MSG="no"
1930 AC_ARG_WITH(ipaddr-display,
1931 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
1932 [
1933 if test "x$withval" != "xno" ; then
1934 AC_DEFINE(IPADDR_IN_DISPLAY)
1935 DISPLAY_HACK_MSG="yes"
1936 fi
1937 ]
1938 )
1939fi
a7effaac 1940
8d184c09 1941dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
1942if test $ac_cv_func_login_getcapbool = "yes" -a \
1943 $ac_cv_header_login_cap_h = "yes" ; then
1944 USES_LOGIN_CONF=yes
1945fi
a0391976 1946# Whether to mess with the default path
cbd7492e 1947SERVER_PATH_MSG="(default)"
c43d69a9 1948AC_ARG_WITH(default-path,
75817f90 1949 [ --with-default-path= Specify default \$PATH environment for server],
cb807f40 1950 [
8d184c09 1951 if test "$USES_LOGIN_CONF" = "yes" ; then
1952 AC_MSG_WARN([
1953--with-default-path=PATH has no effect on this system.
1954Edit /etc/login.conf instead.])
1955 elif test "x$withval" != "xno" ; then
b2d818e6 1956 user_path="$withval"
cbd7492e 1957 SERVER_PATH_MSG="$withval"
cb807f40 1958 fi
b2d818e6 1959 ],
8d184c09 1960 [ if test "$USES_LOGIN_CONF" = "yes" ; then
1961 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
1962 else
b2d818e6 1963 AC_TRY_RUN(
1964 [
1965/* find out what STDPATH is */
1966#include <stdio.h>
b2d818e6 1967#ifdef HAVE_PATHS_H
1968# include <paths.h>
1969#endif
1970#ifndef _PATH_STDPATH
1971# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
1972#endif
1973#include <sys/types.h>
1974#include <sys/stat.h>
1975#include <fcntl.h>
1976#define DATA "conftest.stdpath"
1977
1978main()
1979{
1980 FILE *fd;
1981 int rc;
1982
1983 fd = fopen(DATA,"w");
1984 if(fd == NULL)
1985 exit(1);
1986
1987 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
1988 exit(1);
1989
1990 exit(0);
1991}
1992 ], [ user_path=`cat conftest.stdpath` ],
1993 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
1994 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
1995 )
1996# make sure $bindir is in USER_PATH so scp will work
1997 t_bindir=`eval echo ${bindir}`
1998 case $t_bindir in
1999 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2000 esac
2001 case $t_bindir in
2002 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2003 esac
2004 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2005 if test $? -ne 0 ; then
2006 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2007 if test $? -ne 0 ; then
2008 user_path=$user_path:$t_bindir
2009 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2010 fi
2011 fi
8d184c09 2012 fi ]
cb807f40 2013)
8d184c09 2014if test "$USES_LOGIN_CONF" != "yes" ; then
2015 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2016 AC_SUBST(user_path)
2017fi
cb807f40 2018
06617857 2019# Set superuser path separately to user path
06617857 2020AC_ARG_WITH(superuser-path,
2021 [ --with-superuser-path= Specify different path for super-user],
2022 [
2023 if test "x$withval" != "xno" ; then
2024 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2025 superuser_path=$withval
2026 fi
2027 ]
2028)
2029
2030
a0391976 2031# Whether to force IPv4 by default (needed on broken glibc Linux)
cbd7492e 2032IPV4_HACK_MSG="no"
59e76f33 2033AC_ARG_WITH(ipv4-default,
2034 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2035 [
2036 if test "x$withval" != "xno" ; then
2037 AC_DEFINE(IPV4_DEFAULT)
cbd7492e 2038 IPV4_HACK_MSG="yes"
59e76f33 2039 fi
2040 ]
2041)
2042
58d100bf 2043AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
cbd7492e 2044IPV4_IN6_HACK_MSG="no"
80faa19f 2045AC_ARG_WITH(4in6,
2046 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2047 [
2048 if test "x$withval" != "xno" ; then
2049 AC_MSG_RESULT(yes)
2050 AC_DEFINE(IPV4_IN_IPV6)
cbd7492e 2051 IPV4_IN6_HACK_MSG="yes"
80faa19f 2052 else
2053 AC_MSG_RESULT(no)
2054 fi
2055 ],[
2056 if test "x$inet6_default_4in6" = "xyes"; then
2057 AC_MSG_RESULT([yes (default)])
2058 AC_DEFINE(IPV4_IN_IPV6)
cbd7492e 2059 IPV4_IN6_HACK_MSG="yes"
80faa19f 2060 else
2061 AC_MSG_RESULT([no (default)])
2062 fi
2063 ]
2064)
2065
af774732 2066# Whether to enable BSD auth support
f1b0ecc3 2067BSD_AUTH_MSG=no
af774732 2068AC_ARG_WITH(bsd-auth,
2069 [ --with-bsd-auth Enable BSD auth support],
2070 [
2071 if test "x$withval" != "xno" ; then
2072 AC_DEFINE(BSD_AUTH)
f1b0ecc3 2073 BSD_AUTH_MSG=yes
af774732 2074 fi
2075 ]
2076)
2077
a0391976 2078# Where to place sshd.pid
19d9ac2a 2079piddir=/var/run
81dadca3 2080# make sure the directory exists
2081if test ! -d $piddir ; then
2082 piddir=`eval echo ${sysconfdir}`
2083 case $piddir in
2084 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2085 esac
2086fi
2087
47e45e44 2088AC_ARG_WITH(pid-dir,
2089 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2090 [
2091 if test "x$withval" != "xno" ; then
19d9ac2a 2092 piddir=$withval
81dadca3 2093 if test ! -d $piddir ; then
2094 AC_MSG_WARN([** no $piddir directory on this system **])
2095 fi
47e45e44 2096 fi
2097 ]
2098)
b7a87eea 2099
42f11eb2 2100AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
19d9ac2a 2101AC_SUBST(piddir)
47e45e44 2102
1d7b9b20 2103dnl allow user to disable some login recording features
2104AC_ARG_ENABLE(lastlog,
bfd550a2 2105 [ --disable-lastlog disable use of lastlog even if detected [no]],
1d7b9b20 2106 [ AC_DEFINE(DISABLE_LASTLOG) ]
2107)
2108AC_ARG_ENABLE(utmp,
bfd550a2 2109 [ --disable-utmp disable use of utmp even if detected [no]],
1d7b9b20 2110 [ AC_DEFINE(DISABLE_UTMP) ]
2111)
2112AC_ARG_ENABLE(utmpx,
bfd550a2 2113 [ --disable-utmpx disable use of utmpx even if detected [no]],
1d7b9b20 2114 [ AC_DEFINE(DISABLE_UTMPX) ]
2115)
2116AC_ARG_ENABLE(wtmp,
bfd550a2 2117 [ --disable-wtmp disable use of wtmp even if detected [no]],
1d7b9b20 2118 [ AC_DEFINE(DISABLE_WTMP) ]
2119)
2120AC_ARG_ENABLE(wtmpx,
bfd550a2 2121 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
1d7b9b20 2122 [ AC_DEFINE(DISABLE_WTMPX) ]
2123)
2124AC_ARG_ENABLE(libutil,
bfd550a2 2125 [ --disable-libutil disable use of libutil (login() etc.) [no]],
1d7b9b20 2126 [ AC_DEFINE(DISABLE_LOGIN) ]
2127)
2128AC_ARG_ENABLE(pututline,
bfd550a2 2129 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
1d7b9b20 2130 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2131)
2132AC_ARG_ENABLE(pututxline,
bfd550a2 2133 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
1d7b9b20 2134 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2135)
2136AC_ARG_WITH(lastlog,
bfd550a2 2137 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
8c89dd2b 2138 [
2139 if test "x$withval" = "xno" ; then
2140 AC_DEFINE(DISABLE_LASTLOG)
2141 else
2142 conf_lastlog_location=$withval
2143 fi
2144 ]
2145)
1d7b9b20 2146
2147dnl lastlog, [uw]tmpx? detection
2148dnl NOTE: set the paths in the platform section to avoid the
2149dnl need for command-line parameters
2150dnl lastlog and [uw]tmp are subject to a file search if all else fails
2151
2152dnl lastlog detection
2153dnl NOTE: the code itself will detect if lastlog is a directory
2154AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2155AC_TRY_COMPILE([
2156#include <sys/types.h>
2157#include <utmp.h>
2158#ifdef HAVE_LASTLOG_H
2159# include <lastlog.h>
2160#endif
d7c0f3d5 2161#ifdef HAVE_PATHS_H
1d7b9b20 2162# include <paths.h>
41cb4569 2163#endif
2164#ifdef HAVE_LOGIN_H
2165# include <login.h>
1d7b9b20 2166#endif
2167 ],
2168 [ char *lastlog = LASTLOG_FILE; ],
2169 [ AC_MSG_RESULT(yes) ],
d7c0f3d5 2170 [
2171 AC_MSG_RESULT(no)
2172 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2173 AC_TRY_COMPILE([
2174#include <sys/types.h>
2175#include <utmp.h>
2176#ifdef HAVE_LASTLOG_H
2177# include <lastlog.h>
2178#endif
2179#ifdef HAVE_PATHS_H
2180# include <paths.h>
2181#endif
2182 ],
2183 [ char *lastlog = _PATH_LASTLOG; ],
2184 [ AC_MSG_RESULT(yes) ],
2185 [
f282b668 2186 AC_MSG_RESULT(no)
d7c0f3d5 2187 system_lastlog_path=no
2188 ])
2189 ]
1d7b9b20 2190)
d7c0f3d5 2191
1d7b9b20 2192if test -z "$conf_lastlog_location"; then
2193 if test x"$system_lastlog_path" = x"no" ; then
2194 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
e5fe9a1f 2195 if (test -d "$f" || test -f "$f") ; then
1d7b9b20 2196 conf_lastlog_location=$f
2197 fi
2198 done
2199 if test -z "$conf_lastlog_location"; then
f8119cef 2200 AC_MSG_WARN([** Cannot find lastlog **])
2201 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
1d7b9b20 2202 fi
2203 fi
2204fi
2205
2206if test -n "$conf_lastlog_location"; then
2207 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2208fi
2209
2210dnl utmp detection
2211AC_MSG_CHECKING([if your system defines UTMP_FILE])
2212AC_TRY_COMPILE([
2213#include <sys/types.h>
2214#include <utmp.h>
d7c0f3d5 2215#ifdef HAVE_PATHS_H
1d7b9b20 2216# include <paths.h>
2217#endif
2218 ],
2219 [ char *utmp = UTMP_FILE; ],
2220 [ AC_MSG_RESULT(yes) ],
2221 [ AC_MSG_RESULT(no)
2222 system_utmp_path=no ]
2223)
2224if test -z "$conf_utmp_location"; then
2225 if test x"$system_utmp_path" = x"no" ; then
2226 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2227 if test -f $f ; then
2228 conf_utmp_location=$f
2229 fi
2230 done
2231 if test -z "$conf_utmp_location"; then
2232 AC_DEFINE(DISABLE_UTMP)
2233 fi
2234 fi
2235fi
2236if test -n "$conf_utmp_location"; then
2237 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2238fi
2239
2240dnl wtmp detection
2241AC_MSG_CHECKING([if your system defines WTMP_FILE])
2242AC_TRY_COMPILE([
2243#include <sys/types.h>
2244#include <utmp.h>
d7c0f3d5 2245#ifdef HAVE_PATHS_H
1d7b9b20 2246# include <paths.h>
2247#endif
2248 ],
2249 [ char *wtmp = WTMP_FILE; ],
2250 [ AC_MSG_RESULT(yes) ],
2251 [ AC_MSG_RESULT(no)
2252 system_wtmp_path=no ]
2253)
2254if test -z "$conf_wtmp_location"; then
2255 if test x"$system_wtmp_path" = x"no" ; then
2256 for f in /usr/adm/wtmp /var/log/wtmp; do
2257 if test -f $f ; then
2258 conf_wtmp_location=$f
2259 fi
2260 done
2261 if test -z "$conf_wtmp_location"; then
2262 AC_DEFINE(DISABLE_WTMP)
2263 fi
2264 fi
2265fi
2266if test -n "$conf_wtmp_location"; then
2267 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2268fi
2269
2270
2271dnl utmpx detection - I don't know any system so perverse as to require
2272dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2273dnl there, though.
2274AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2275AC_TRY_COMPILE([
2276#include <sys/types.h>
2277#include <utmp.h>
2278#ifdef HAVE_UTMPX_H
2279#include <utmpx.h>
2280#endif
d7c0f3d5 2281#ifdef HAVE_PATHS_H
1d7b9b20 2282# include <paths.h>
2283#endif
2284 ],
2285 [ char *utmpx = UTMPX_FILE; ],
2286 [ AC_MSG_RESULT(yes) ],
2287 [ AC_MSG_RESULT(no)
2288 system_utmpx_path=no ]
2289)
2290if test -z "$conf_utmpx_location"; then
2291 if test x"$system_utmpx_path" = x"no" ; then
2292 AC_DEFINE(DISABLE_UTMPX)
2293 fi
2294else
2295 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2296fi
2297
2298dnl wtmpx detection
2299AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2300AC_TRY_COMPILE([
2301#include <sys/types.h>
2302#include <utmp.h>
2303#ifdef HAVE_UTMPX_H
2304#include <utmpx.h>
2305#endif
d7c0f3d5 2306#ifdef HAVE_PATHS_H
1d7b9b20 2307# include <paths.h>
2308#endif
2309 ],
2310 [ char *wtmpx = WTMPX_FILE; ],
2311 [ AC_MSG_RESULT(yes) ],
2312 [ AC_MSG_RESULT(no)
2313 system_wtmpx_path=no ]
2314)
2315if test -z "$conf_wtmpx_location"; then
2316 if test x"$system_wtmpx_path" = x"no" ; then
2317 AC_DEFINE(DISABLE_WTMPX)
2318 fi
2319else
2320 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2321fi
2322
b7a87eea 2323
bd499f9e 2324if test ! -z "$blibpath" ; then
2325 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2326 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2327fi
2328
ddceb1c8 2329dnl remove pam and dl because they are in $LIBPAM
2330if test "$PAM_MSG" = yes ; then
98f2d9d5 2331 LIBS=`echo $LIBS | sed 's/-lpam //'`
2332fi
2333if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2334 LIBS=`echo $LIBS | sed 's/-ldl //'`
ddceb1c8 2335fi
2336
3c62e7eb 2337AC_EXEEXT
98a7c37b 2338AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2339AC_OUTPUT
d3083fbd 2340
cbd7492e 2341# Print summary of options
2342
cbd7492e 2343# Someone please show me a better way :)
2344A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2345B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2346C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2347D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
f5665f6f 2348E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
e0c4d3ac 2349F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
cbd7492e 2350G=`eval echo ${piddir}` ; G=`eval echo ${G}`
ecac8ee5 2351H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2352I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2353J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
cbd7492e 2354
2355echo ""
26de7942 2356echo "OpenSSH has been configured with the following options:"
ecac8ee5 2357echo " User binaries: $B"
2358echo " System binaries: $C"
2359echo " Configuration files: $D"
2360echo " Askpass program: $E"
2361echo " Manual pages: $F"
2362echo " PID file: $G"
2363echo " Privilege separation chroot path: $H"
8d184c09 2364if test "$USES_LOGIN_CONF" = "yes" ; then
ecac8ee5 2365echo " At runtime, sshd will use the path defined in /etc/login.conf"
8d184c09 2366else
ecac8ee5 2367echo " sshd default user PATH: $I"
8d184c09 2368fi
06617857 2369if test ! -z "$superuser_path" ; then
ecac8ee5 2370echo " sshd superuser user PATH: $J"
2371fi
2372echo " Manpage format: $MANTYPE"
2373echo " PAM support: ${PAM_MSG}"
2374echo " KerberosIV support: $KRB4_MSG"
2375echo " KerberosV support: $KRB5_MSG"
2376echo " Smartcard support: $SCARD_MSG"
2377echo " AFS support: $AFS_MSG"
2378echo " S/KEY support: $SKEY_MSG"
2379echo " TCP Wrappers support: $TCPW_MSG"
2380echo " MD5 password support: $MD5_MSG"
3deb1408 2381echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
ecac8ee5 2382echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2383echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2384echo " BSD Auth support: $BSD_AUTH_MSG"
2385echo " Random number source: $RAND_MSG"
f1b0ecc3 2386if test ! -z "$USE_RAND_HELPER" ; then
ecac8ee5 2387echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
af774732 2388fi
2389
cbd7492e 2390echo ""
2391
0c2fb82f 2392echo " Host: ${host}"
2393echo " Compiler: ${CC}"
2394echo " Compiler flags: ${CFLAGS}"
2395echo "Preprocessor flags: ${CPPFLAGS}"
2396echo " Linker flags: ${LDFLAGS}"
ddceb1c8 2397echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
cbd7492e 2398
2399echo ""
2400
adeebd37 2401if test "x$PAM_MSG" = "xyes" ; then
f1b0ecc3 2402 echo "PAM is enabled. You may need to install a PAM control file "
2403 echo "for sshd, otherwise password authentication may fail. "
2404 echo "Example PAM control files can be found in the contrib/ "
2405 echo "subdirectory"
adeebd37 2406 echo ""
2407fi
2408
f1b0ecc3 2409if test ! -z "$NO_SFTP"; then
2410 echo "sftp-server will be disabled. Your compiler does not "
2411 echo "support 64bit integers."
48e7916f 2412 echo ""
2413fi
2c523de9 2414
f1b0ecc3 2415if test ! -z "$RAND_HELPER_CMDHASH" ; then
2416 echo "WARNING: you are using the builtin random number collection "
2417 echo "service. Please read WARNING.RNG and request that your OS "
2418 echo "vendor includes kernel-based random number collection in "
2419 echo "future versions of your OS."
2c523de9 2420 echo ""
2421fi
af774732 2422
This page took 0.654889 seconds and 5 git commands to generate.