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