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