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