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