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