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