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