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