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