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