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