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