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