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