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