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