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