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