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