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