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