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