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