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