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