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