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