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