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