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