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