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