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