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