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