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