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