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