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