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