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