]> andersk Git - gssapi-openssh.git/blame - openssh/configure.ac
whitespace change
[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
350391c5 1617AC_CACHE_CHECK([for msg_accrights field in struct msghdr],
1618 ac_cv_have_accrights_in_msghdr, [
1619 AC_TRY_COMPILE(
1620 [
1621#include <sys/types.h>
1622#include <sys/socket.h>
1623#include <sys/uio.h>
1624 ],
1625 [ struct msghdr m; m.msg_accrights = 0; ],
1626 [ ac_cv_have_accrights_in_msghdr="yes" ],
1627 [ ac_cv_have_accrights_in_msghdr="no" ]
1628 )
1629])
1630if test "x$ac_cv_have_accrights_in_msghdr" = "xyes" ; then
1631 AC_DEFINE(HAVE_ACCRIGHTS_IN_MSGHDR)
1632fi
1633
1634AC_CACHE_CHECK([for msg_control field in struct msghdr],
1635 ac_cv_have_control_in_msghdr, [
1636 AC_TRY_COMPILE(
1637 [
1638#include <sys/types.h>
1639#include <sys/socket.h>
1640#include <sys/uio.h>
1641 ],
1642 [ struct msghdr m; m.msg_control = 0; ],
1643 [ ac_cv_have_control_in_msghdr="yes" ],
1644 [ ac_cv_have_control_in_msghdr="no" ]
1645 )
1646])
1647if test "x$ac_cv_have_control_in_msghdr" = "xyes" ; then
1648 AC_DEFINE(HAVE_CONTROL_IN_MSGHDR)
1649fi
1650
3c0ef626 1651AC_CACHE_CHECK([if libc defines __progname], ac_cv_libc_defines___progname, [
1652 AC_TRY_LINK([],
1653 [ extern char *__progname; printf("%s", __progname); ],
1654 [ ac_cv_libc_defines___progname="yes" ],
1655 [ ac_cv_libc_defines___progname="no" ]
1656 )
1657])
1658if test "x$ac_cv_libc_defines___progname" = "xyes" ; then
1659 AC_DEFINE(HAVE___PROGNAME)
1660fi
1661
350391c5 1662AC_CACHE_CHECK([whether $CC implements __FUNCTION__], ac_cv_cc_implements___FUNCTION__, [
1663 AC_TRY_LINK([
1664#include <stdio.h>
1665],
1666 [ printf("%s", __FUNCTION__); ],
1667 [ ac_cv_cc_implements___FUNCTION__="yes" ],
1668 [ ac_cv_cc_implements___FUNCTION__="no" ]
1669 )
1670])
1671if test "x$ac_cv_cc_implements___FUNCTION__" = "xyes" ; then
1672 AC_DEFINE(HAVE___FUNCTION__)
1673fi
1674
1675AC_CACHE_CHECK([whether $CC implements __func__], ac_cv_cc_implements___func__, [
1676 AC_TRY_LINK([
1677#include <stdio.h>
1678],
1679 [ printf("%s", __func__); ],
1680 [ ac_cv_cc_implements___func__="yes" ],
1681 [ ac_cv_cc_implements___func__="no" ]
1682 )
1683])
1684if test "x$ac_cv_cc_implements___func__" = "xyes" ; then
1685 AC_DEFINE(HAVE___func__)
1686fi
1687
3c0ef626 1688AC_CACHE_CHECK([whether getopt has optreset support],
1689 ac_cv_have_getopt_optreset, [
1690 AC_TRY_LINK(
1691 [
1692#include <getopt.h>
1693 ],
1694 [ extern int optreset; optreset = 0; ],
1695 [ ac_cv_have_getopt_optreset="yes" ],
1696 [ ac_cv_have_getopt_optreset="no" ]
1697 )
1698])
1699if test "x$ac_cv_have_getopt_optreset" = "xyes" ; then
1700 AC_DEFINE(HAVE_GETOPT_OPTRESET)
1701fi
1702
1703AC_CACHE_CHECK([if libc defines sys_errlist], ac_cv_libc_defines_sys_errlist, [
1704 AC_TRY_LINK([],
1705 [ extern const char *const sys_errlist[]; printf("%s", sys_errlist[0]);],
1706 [ ac_cv_libc_defines_sys_errlist="yes" ],
1707 [ ac_cv_libc_defines_sys_errlist="no" ]
1708 )
1709])
1710if test "x$ac_cv_libc_defines_sys_errlist" = "xyes" ; then
1711 AC_DEFINE(HAVE_SYS_ERRLIST)
1712fi
1713
1714
1715AC_CACHE_CHECK([if libc defines sys_nerr], ac_cv_libc_defines_sys_nerr, [
1716 AC_TRY_LINK([],
1717 [ extern int sys_nerr; printf("%i", sys_nerr);],
1718 [ ac_cv_libc_defines_sys_nerr="yes" ],
1719 [ ac_cv_libc_defines_sys_nerr="no" ]
1720 )
1721])
1722if test "x$ac_cv_libc_defines_sys_nerr" = "xyes" ; then
1723 AC_DEFINE(HAVE_SYS_NERR)
1724fi
1725
3c0ef626 1726SCARD_MSG="no"
350391c5 1727
1728# Check whether user wants sectok support
1729AC_ARG_WITH(sectok,
1730 [ --with-sectok Enable smartcard support using libsectok],
3c0ef626 1731 [
1732 if test "x$withval" != "xno" ; then
1733 if test "x$withval" != "xyes" ; then
1734 CPPFLAGS="$CPPFLAGS -I${withval}"
1735 LDFLAGS="$LDFLAGS -L${withval}"
1736 if test ! -z "$need_dash_r" ; then
1737 LDFLAGS="$LDFLAGS -R${withval}"
1738 fi
1739 if test ! -z "$blibpath" ; then
1740 blibpath="$blibpath:${withval}"
1741 fi
1742 fi
1743 AC_CHECK_HEADERS(sectok.h)
1744 if test "$ac_cv_header_sectok_h" != yes; then
1745 AC_MSG_ERROR(Can't find sectok.h)
1746 fi
1747 AC_CHECK_LIB(sectok, sectok_open)
1748 if test "$ac_cv_lib_sectok_sectok_open" != yes; then
1749 AC_MSG_ERROR(Can't find libsectok)
1750 fi
1751 AC_DEFINE(SMARTCARD)
350391c5 1752 AC_DEFINE(USE_SECTOK)
1753 SCARD_MSG="yes, using sectok"
3c0ef626 1754 fi
1755 ]
1756)
1757
350391c5 1758# Check whether user wants OpenSC support
1759AC_ARG_WITH(opensc,
1760 AC_HELP_STRING([--with-opensc=PFX],
1761 [Enable smartcard support using OpenSC]),
1762 opensc_config_prefix="$withval", opensc_config_prefix="")
1763if test x$opensc_config_prefix != x ; then
1764 OPENSC_CONFIG=$opensc_config_prefix/bin/opensc-config
1765 AC_PATH_PROG(OPENSC_CONFIG, opensc-config, no)
1766 if test "$OPENSC_CONFIG" != "no"; then
1767 LIBOPENSC_CFLAGS=`$OPENSC_CONFIG --cflags`
1768 LIBOPENSC_LIBS=`$OPENSC_CONFIG --libs`
1769 CPPFLAGS="$CPPFLAGS $LIBOPENSC_CFLAGS"
1770 LDFLAGS="$LDFLAGS $LIBOPENSC_LIBS"
1771 AC_DEFINE(SMARTCARD)
1772 AC_DEFINE(USE_OPENSC)
1773 SCARD_MSG="yes, using OpenSC"
1774 fi
1775fi
1776
63119dd9 1777# Check whether user wants Kerberos 5 support
350391c5 1778KRB5_MSG="no"
63119dd9 1779AC_ARG_WITH(kerberos5,
1780 [ --with-kerberos5=PATH Enable Kerberos 5 support],
1781 [
1782 if test "x$withval" != "xno" ; then
1783 if test "x$withval" = "xyes" ; then
1784 KRB5ROOT="/usr/local"
1785 else
1786 KRB5ROOT=${withval}
1787 fi
1788 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include"
1789 LDFLAGS="$LDFLAGS -L${KRB5ROOT}/lib"
1790 AC_DEFINE(KRB5)
350391c5 1791 KRB5_MSG="yes"
63119dd9 1792 AC_MSG_CHECKING(whether we are using Heimdal)
1793 AC_TRY_COMPILE([ #include <krb5.h> ],
1794 [ char *tmp = heimdal_version; ],
1795 [ AC_MSG_RESULT(yes)
1796 AC_DEFINE(HEIMDAL)
1797 K5LIBS="-lkrb5 -ldes -lcom_err -lasn1 -lroken"
1798 ],
1799 [ AC_MSG_RESULT(no)
1800 K5LIBS="-lkrb5 -lk5crypto -lcom_err"
1801 ]
1802 )
1803 if test ! -z "$need_dash_r" ; then
1804 LDFLAGS="$LDFLAGS -R${KRB5ROOT}/lib"
1805 fi
1806 if test ! -z "$blibpath" ; then
1807 blibpath="$blibpath:${KRB5ROOT}/lib"
1808 fi
1809 AC_CHECK_LIB(resolv, dn_expand, , )
1810
5598e598 1811 AC_CHECK_LIB(gssapi,gss_init_sec_context,
1812 [ AC_DEFINE(GSSAPI)
1813 K5LIBS="-lgssapi $K5LIBS" ],
1814 [ AC_CHECK_LIB(gssapi_krb5,gss_init_sec_context,
1815 [ AC_DEFINE(GSSAPI)
1816 K5LIBS="-lgssapi_krb5 $K5LIBS" ],
1817 AC_MSG_WARN([Cannot find any suitable gss-api library - build may fail]),
1818 $K5LIBS)
1819 ],
1820 $K5LIBS)
1821
1822 AC_CHECK_HEADER(gssapi.h, ,
1823 [ unset ac_cv_header_gssapi_h
1824 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1825 AC_CHECK_HEADERS(gssapi.h, ,
1826 AC_MSG_WARN([Cannot find any suitable gss-api header - build may fail])
1827 )
1828 ]
1829 )
1830
1831 oldCPP="$CPPFLAGS"
1832 CPPFLAGS="$CPPFLAGS -I${KRB5ROOT}/include/gssapi"
1833 AC_CHECK_HEADER(gssapi_krb5.h, ,
1834 [ CPPFLAGS="$oldCPP" ])
1835
63119dd9 1836 KRB5=yes
1837 fi
1838 ]
1839)
1840# Check whether user wants Kerberos 4 support
3c0ef626 1841KRB4_MSG="no"
1842AC_ARG_WITH(kerberos4,
1843 [ --with-kerberos4=PATH Enable Kerberos 4 support],
1844 [
1845 if test "x$withval" != "xno" ; then
1846 if test "x$withval" != "xyes" ; then
1847 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1848 LDFLAGS="$LDFLAGS -L${withval}/lib"
1849 if test ! -z "$need_dash_r" ; then
1850 LDFLAGS="$LDFLAGS -R${withval}/lib"
1851 fi
1852 if test ! -z "$blibpath" ; then
1853 blibpath="$blibpath:${withval}/lib"
1854 fi
1855 else
1856 if test -d /usr/include/kerberosIV ; then
1857 CPPFLAGS="$CPPFLAGS -I/usr/include/kerberosIV"
1858 fi
1859 fi
1860
1861 AC_CHECK_HEADERS(krb.h)
1862 if test "$ac_cv_header_krb_h" != yes; then
1863 AC_MSG_WARN([Cannot find krb.h, build may fail])
1864 fi
1865 AC_CHECK_LIB(krb, main)
1866 if test "$ac_cv_lib_krb_main" != yes; then
1867 AC_CHECK_LIB(krb4, main)
1868 if test "$ac_cv_lib_krb4_main" != yes; then
1869 AC_MSG_WARN([Cannot find libkrb nor libkrb4, build may fail])
1870 else
1871 KLIBS="-lkrb4"
1872 fi
1873 else
1874 KLIBS="-lkrb"
1875 fi
1876 AC_CHECK_LIB(des, des_cbc_encrypt)
1877 if test "$ac_cv_lib_des_des_cbc_encrypt" != yes; then
1878 AC_CHECK_LIB(des425, des_cbc_encrypt)
1879 if test "$ac_cv_lib_des425_des_cbc_encrypt" != yes; then
1880 AC_MSG_WARN([Cannot find libdes nor libdes425, build may fail])
1881 else
1882 KLIBS="-ldes425"
1883 fi
1884 else
1885 KLIBS="-ldes"
1886 fi
1887 AC_CHECK_LIB(resolv, dn_expand, , )
1888 KRB4=yes
1889 KRB4_MSG="yes"
1890 AC_DEFINE(KRB4)
1891 fi
1892 ]
1893)
1894
1895# Check whether user wants AFS support
1896AFS_MSG="no"
1897AC_ARG_WITH(afs,
1898 [ --with-afs=PATH Enable AFS support],
1899 [
1900 if test "x$withval" != "xno" ; then
1901
1902 if test "x$withval" != "xyes" ; then
1903 CPPFLAGS="$CPPFLAGS -I${withval}/include"
1904 LDFLAGS="$LDFLAGS -L${withval}/lib"
1905 fi
1906
1907 if test -z "$KRB4" ; then
1908 AC_MSG_WARN([AFS requires Kerberos IV support, build may fail])
1909 fi
1910
1911 LIBS="-lkafs $LIBS"
1912 if test ! -z "$AFS_LIBS" ; then
1913 LIBS="$LIBS $AFS_LIBS"
1914 fi
1915 AC_DEFINE(AFS)
1916 AFS_MSG="yes"
1917 fi
1918 ]
1919)
63119dd9 1920LIBS="$LIBS $KLIBS $K5LIBS"
3c0ef626 1921
1922# Looking for programs, paths and files
1923AC_ARG_WITH(rsh,
1924 [ --with-rsh=PATH Specify path to remote shell program ],
1925 [
1926 if test "x$withval" != "$no" ; then
1927 rsh_path=$withval
1928 fi
1929 ],
1930 [
1931 AC_PATH_PROG(rsh_path, rsh)
1932 ]
1933)
1934
350391c5 1935PRIVSEP_PATH=/var/empty
1936AC_ARG_WITH(privsep-path,
2de524a0 1937 [ --with-privsep-path=xxx Path for privilege separation chroot ],
350391c5 1938 [
1939 if test "x$withval" != "$no" ; then
1940 PRIVSEP_PATH=$withval
1941 fi
1942 ]
1943)
1944AC_SUBST(PRIVSEP_PATH)
1945
3c0ef626 1946AC_ARG_WITH(xauth,
1947 [ --with-xauth=PATH Specify path to xauth program ],
1948 [
1949 if test "x$withval" != "xno" ; then
1950 xauth_path=$withval
1951 fi
1952 ],
1953 [
1954 AC_PATH_PROG(xauth_path, xauth,,$PATH:/usr/X/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin)
1955 if (test ! -z "$xauth_path" && test -x "/usr/openwin/bin/xauth") ; then
1956 xauth_path="/usr/openwin/bin/xauth"
1957 fi
1958 ]
1959)
1960
1961if test -z "$xauth_path" ; then
1962 XAUTH_PATH="undefined"
1963 AC_SUBST(XAUTH_PATH)
1964else
1965 AC_DEFINE_UNQUOTED(XAUTH_PATH, "$xauth_path")
1966 XAUTH_PATH=$xauth_path
1967 AC_SUBST(XAUTH_PATH)
1968fi
1969if test ! -z "$rsh_path" ; then
1970 AC_DEFINE_UNQUOTED(RSH_PATH, "$rsh_path")
1971fi
1972
1973# Check for mail directory (last resort if we cannot get it from headers)
1974if test ! -z "$MAIL" ; then
1975 maildir=`dirname $MAIL`
1976 AC_DEFINE_UNQUOTED(MAIL_DIRECTORY, "$maildir")
1977fi
1978
1979if test -z "$no_dev_ptmx" ; then
350391c5 1980 if test "x$disable_ptmx_check" != "xyes" ; then
1981 AC_CHECK_FILE("/dev/ptmx",
1982 [
1983 AC_DEFINE_UNQUOTED(HAVE_DEV_PTMX)
1984 have_dev_ptmx=1
1985 ]
1986 )
1987 fi
3c0ef626 1988fi
1989AC_CHECK_FILE("/dev/ptc",
1990 [
1991 AC_DEFINE_UNQUOTED(HAVE_DEV_PTS_AND_PTC)
1992 have_dev_ptc=1
1993 ]
1994)
1995
1996# Options from here on. Some of these are preset by platform above
3c0ef626 1997AC_ARG_WITH(mantype,
1998 [ --with-mantype=man|cat|doc Set man page type],
1999 [
2000 case "$withval" in
2001 man|cat|doc)
2002 MANTYPE=$withval
2003 ;;
2004 *)
2005 AC_MSG_ERROR(invalid man type: $withval)
2006 ;;
2007 esac
2008 ]
2009)
2010if test -z "$MANTYPE"; then
2011 AC_PATH_PROGS(NROFF, nroff awf, /bin/false, /usr/bin:/usr/ucb)
2012 if ${NROFF} -mdoc ${srcdir}/ssh.1 >/dev/null 2>&1; then
2013 MANTYPE=doc
2014 elif ${NROFF} -man ${srcdir}/ssh.1 >/dev/null 2>&1; then
2015 MANTYPE=man
2016 else
2017 MANTYPE=cat
2018 fi
2019fi
2020AC_SUBST(MANTYPE)
2021if test "$MANTYPE" = "doc"; then
2022 mansubdir=man;
2023else
2024 mansubdir=$MANTYPE;
2025fi
2026AC_SUBST(mansubdir)
2027
2028# Check whether to enable MD5 passwords
2029MD5_MSG="no"
2030AC_ARG_WITH(md5-passwords,
2031 [ --with-md5-passwords Enable use of MD5 passwords],
2032 [
2033 if test "x$withval" != "xno" ; then
2034 AC_DEFINE(HAVE_MD5_PASSWORDS)
2035 MD5_MSG="yes"
2036 fi
2037 ]
2038)
2039
2040# Whether to disable shadow password support
2041AC_ARG_WITH(shadow,
2042 [ --without-shadow Disable shadow password support],
2043 [
2044 if test "x$withval" = "xno" ; then
2045 AC_DEFINE(DISABLE_SHADOW)
2046 disable_shadow=yes
2047 fi
2048 ]
2049)
2050
2051if test -z "$disable_shadow" ; then
2052 AC_MSG_CHECKING([if the systems has expire shadow information])
2053 AC_TRY_COMPILE(
2054 [
2055#include <sys/types.h>
2056#include <shadow.h>
2057 struct spwd sp;
2058 ],[ sp.sp_expire = sp.sp_lstchg = sp.sp_inact = 0; ],
2059 [ sp_expire_available=yes ], []
2060 )
2061
2062 if test "x$sp_expire_available" = "xyes" ; then
2063 AC_MSG_RESULT(yes)
2064 AC_DEFINE(HAS_SHADOW_EXPIRE)
2065 else
2066 AC_MSG_RESULT(no)
2067 fi
2068fi
2069
2070# Use ip address instead of hostname in $DISPLAY
2071if test ! -z "$IPADDR_IN_DISPLAY" ; then
2072 DISPLAY_HACK_MSG="yes"
2073 AC_DEFINE(IPADDR_IN_DISPLAY)
2074else
2075 DISPLAY_HACK_MSG="no"
2076 AC_ARG_WITH(ipaddr-display,
2077 [ --with-ipaddr-display Use ip address instead of hostname in \$DISPLAY],
2078 [
2079 if test "x$withval" != "xno" ; then
2080 AC_DEFINE(IPADDR_IN_DISPLAY)
2081 DISPLAY_HACK_MSG="yes"
2082 fi
2083 ]
2084 )
2085fi
2086
350391c5 2087dnl BSD systems use /etc/login.conf so --with-default-path= has no effect
2088if test $ac_cv_func_login_getcapbool = "yes" -a \
2089 $ac_cv_header_login_cap_h = "yes" ; then
2090 USES_LOGIN_CONF=yes
2091fi
3c0ef626 2092# Whether to mess with the default path
2093SERVER_PATH_MSG="(default)"
2094AC_ARG_WITH(default-path,
350391c5 2095 [ --with-default-path= Specify default \$PATH environment for server],
3c0ef626 2096 [
350391c5 2097 if test "$USES_LOGIN_CONF" = "yes" ; then
2098 AC_MSG_WARN([
2099--with-default-path=PATH has no effect on this system.
2100Edit /etc/login.conf instead.])
2101 elif test "x$withval" != "xno" ; then
3c0ef626 2102 user_path="$withval"
2103 SERVER_PATH_MSG="$withval"
2104 fi
2105 ],
350391c5 2106 [ if test "$USES_LOGIN_CONF" = "yes" ; then
2107 AC_MSG_WARN([Make sure the path to scp is in /etc/login.conf])
2108 else
3c0ef626 2109 AC_TRY_RUN(
2110 [
2111/* find out what STDPATH is */
2112#include <stdio.h>
2113#ifdef HAVE_PATHS_H
2114# include <paths.h>
2115#endif
2116#ifndef _PATH_STDPATH
2117# define _PATH_STDPATH "/usr/bin:/bin:/usr/sbin:/sbin"
2118#endif
2119#include <sys/types.h>
2120#include <sys/stat.h>
2121#include <fcntl.h>
2122#define DATA "conftest.stdpath"
2123
2124main()
2125{
2126 FILE *fd;
2127 int rc;
2128
2129 fd = fopen(DATA,"w");
2130 if(fd == NULL)
2131 exit(1);
2132
2133 if ((rc = fprintf(fd,"%s", _PATH_STDPATH)) < 0)
2134 exit(1);
2135
2136 exit(0);
2137}
2138 ], [ user_path=`cat conftest.stdpath` ],
2139 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ],
2140 [ user_path="/usr/bin:/bin:/usr/sbin:/sbin" ]
2141 )
2142# make sure $bindir is in USER_PATH so scp will work
2143 t_bindir=`eval echo ${bindir}`
2144 case $t_bindir in
2145 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$prefix~"` ;;
2146 esac
2147 case $t_bindir in
2148 NONE/*) t_bindir=`echo $t_bindir | sed "s~NONE~$ac_default_prefix~"` ;;
2149 esac
2150 echo $user_path | grep ":$t_bindir" > /dev/null 2>&1
2151 if test $? -ne 0 ; then
2152 echo $user_path | grep "^$t_bindir" > /dev/null 2>&1
2153 if test $? -ne 0 ; then
2154 user_path=$user_path:$t_bindir
2155 AC_MSG_RESULT(Adding $t_bindir to USER_PATH so scp will work)
2156 fi
2157 fi
350391c5 2158 fi ]
2159)
2160if test "$USES_LOGIN_CONF" != "yes" ; then
2161 AC_DEFINE_UNQUOTED(USER_PATH, "$user_path")
2162 AC_SUBST(user_path)
2163fi
2164
2165# Set superuser path separately to user path
350391c5 2166AC_ARG_WITH(superuser-path,
2167 [ --with-superuser-path= Specify different path for super-user],
2168 [
2169 if test "x$withval" != "xno" ; then
2170 AC_DEFINE_UNQUOTED(SUPERUSER_PATH, "$withval")
2171 superuser_path=$withval
2172 fi
3c0ef626 2173 ]
2174)
350391c5 2175
3c0ef626 2176
2177# Whether to force IPv4 by default (needed on broken glibc Linux)
2178IPV4_HACK_MSG="no"
2179AC_ARG_WITH(ipv4-default,
2180 [ --with-ipv4-default Use IPv4 by connections unless '-6' specified],
2181 [
2182 if test "x$withval" != "xno" ; then
2183 AC_DEFINE(IPV4_DEFAULT)
2184 IPV4_HACK_MSG="yes"
2185 fi
2186 ]
2187)
2188
2189AC_MSG_CHECKING([if we need to convert IPv4 in IPv6-mapped addresses])
2190IPV4_IN6_HACK_MSG="no"
2191AC_ARG_WITH(4in6,
2192 [ --with-4in6 Check for and convert IPv4 in IPv6 mapped addresses],
2193 [
2194 if test "x$withval" != "xno" ; then
2195 AC_MSG_RESULT(yes)
2196 AC_DEFINE(IPV4_IN_IPV6)
2197 IPV4_IN6_HACK_MSG="yes"
2198 else
2199 AC_MSG_RESULT(no)
2200 fi
2201 ],[
2202 if test "x$inet6_default_4in6" = "xyes"; then
2203 AC_MSG_RESULT([yes (default)])
2204 AC_DEFINE(IPV4_IN_IPV6)
2205 IPV4_IN6_HACK_MSG="yes"
2206 else
2207 AC_MSG_RESULT([no (default)])
2208 fi
2209 ]
2210)
2211
2212# Whether to enable BSD auth support
e9702f7d 2213BSD_AUTH_MSG=no
3c0ef626 2214AC_ARG_WITH(bsd-auth,
2215 [ --with-bsd-auth Enable BSD auth support],
2216 [
2217 if test "x$withval" != "xno" ; then
2218 AC_DEFINE(BSD_AUTH)
e9702f7d 2219 BSD_AUTH_MSG=yes
3c0ef626 2220 fi
2221 ]
2222)
2223
2224AC_MSG_CHECKING(whether to install ssh as suid root)
2225AC_ARG_ENABLE(suid-ssh,
2226[ --enable-suid-ssh Install ssh as suid root (default)
2227 --disable-suid-ssh Install ssh without suid bit],
2228[ case "$enableval" in
2229 no)
2230 AC_MSG_RESULT(no)
2231 SSHMODE=0711
2232 ;;
2233 *) AC_MSG_RESULT(yes)
2234 SSHMODE=4711
2235 ;;
2236 esac ],
2237 AC_MSG_RESULT(yes)
2238 SSHMODE=4711
2239)
2240AC_SUBST(SSHMODE)
2241
2242
2243# Where to place sshd.pid
2244piddir=/var/run
350391c5 2245# make sure the directory exists
2246if test ! -d $piddir ; then
2247 piddir=`eval echo ${sysconfdir}`
2248 case $piddir in
2249 NONE/*) piddir=`echo $piddir | sed "s~NONE~$ac_default_prefix~"` ;;
2250 esac
2251fi
2252
3c0ef626 2253AC_ARG_WITH(pid-dir,
2254 [ --with-pid-dir=PATH Specify location of ssh.pid file],
2255 [
2256 if test "x$withval" != "xno" ; then
2257 piddir=$withval
350391c5 2258 if test ! -d $piddir ; then
2259 AC_MSG_WARN([** no $piddir directory on this system **])
2260 fi
3c0ef626 2261 fi
2262 ]
2263)
2264
3c0ef626 2265AC_DEFINE_UNQUOTED(_PATH_SSH_PIDDIR, "$piddir")
2266AC_SUBST(piddir)
2267
2268dnl allow user to disable some login recording features
2269AC_ARG_ENABLE(lastlog,
2270 [ --disable-lastlog disable use of lastlog even if detected [no]],
2271 [ AC_DEFINE(DISABLE_LASTLOG) ]
2272)
2273AC_ARG_ENABLE(utmp,
2274 [ --disable-utmp disable use of utmp even if detected [no]],
2275 [ AC_DEFINE(DISABLE_UTMP) ]
2276)
2277AC_ARG_ENABLE(utmpx,
2278 [ --disable-utmpx disable use of utmpx even if detected [no]],
2279 [ AC_DEFINE(DISABLE_UTMPX) ]
2280)
2281AC_ARG_ENABLE(wtmp,
2282 [ --disable-wtmp disable use of wtmp even if detected [no]],
2283 [ AC_DEFINE(DISABLE_WTMP) ]
2284)
2285AC_ARG_ENABLE(wtmpx,
2286 [ --disable-wtmpx disable use of wtmpx even if detected [no]],
2287 [ AC_DEFINE(DISABLE_WTMPX) ]
2288)
2289AC_ARG_ENABLE(libutil,
2290 [ --disable-libutil disable use of libutil (login() etc.) [no]],
2291 [ AC_DEFINE(DISABLE_LOGIN) ]
2292)
2293AC_ARG_ENABLE(pututline,
2294 [ --disable-pututline disable use of pututline() etc. ([uw]tmp) [no]],
2295 [ AC_DEFINE(DISABLE_PUTUTLINE) ]
2296)
2297AC_ARG_ENABLE(pututxline,
2298 [ --disable-pututxline disable use of pututxline() etc. ([uw]tmpx) [no]],
2299 [ AC_DEFINE(DISABLE_PUTUTXLINE) ]
2300)
2301AC_ARG_WITH(lastlog,
2302 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
2303 [
2304 if test "x$withval" = "xno" ; then
2305 AC_DEFINE(DISABLE_LASTLOG)
2306 else
2307 conf_lastlog_location=$withval
2308 fi
2309 ]
2310)
2311
2312dnl lastlog, [uw]tmpx? detection
2313dnl NOTE: set the paths in the platform section to avoid the
2314dnl need for command-line parameters
2315dnl lastlog and [uw]tmp are subject to a file search if all else fails
2316
2317dnl lastlog detection
2318dnl NOTE: the code itself will detect if lastlog is a directory
2319AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
2320AC_TRY_COMPILE([
2321#include <sys/types.h>
2322#include <utmp.h>
2323#ifdef HAVE_LASTLOG_H
2324# include <lastlog.h>
2325#endif
2326#ifdef HAVE_PATHS_H
2327# include <paths.h>
2328#endif
2329#ifdef HAVE_LOGIN_H
2330# include <login.h>
2331#endif
2332 ],
2333 [ char *lastlog = LASTLOG_FILE; ],
2334 [ AC_MSG_RESULT(yes) ],
2335 [
2336 AC_MSG_RESULT(no)
2337 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
2338 AC_TRY_COMPILE([
2339#include <sys/types.h>
2340#include <utmp.h>
2341#ifdef HAVE_LASTLOG_H
2342# include <lastlog.h>
2343#endif
2344#ifdef HAVE_PATHS_H
2345# include <paths.h>
2346#endif
2347 ],
2348 [ char *lastlog = _PATH_LASTLOG; ],
2349 [ AC_MSG_RESULT(yes) ],
2350 [
2351 AC_MSG_RESULT(no)
2352 system_lastlog_path=no
2353 ])
2354 ]
2355)
2356
2357if test -z "$conf_lastlog_location"; then
2358 if test x"$system_lastlog_path" = x"no" ; then
2359 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
2360 if (test -d "$f" || test -f "$f") ; then
2361 conf_lastlog_location=$f
2362 fi
2363 done
2364 if test -z "$conf_lastlog_location"; then
2365 AC_MSG_WARN([** Cannot find lastlog **])
2366 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
2367 fi
2368 fi
2369fi
2370
2371if test -n "$conf_lastlog_location"; then
2372 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location")
2373fi
2374
2375dnl utmp detection
2376AC_MSG_CHECKING([if your system defines UTMP_FILE])
2377AC_TRY_COMPILE([
2378#include <sys/types.h>
2379#include <utmp.h>
2380#ifdef HAVE_PATHS_H
2381# include <paths.h>
2382#endif
2383 ],
2384 [ char *utmp = UTMP_FILE; ],
2385 [ AC_MSG_RESULT(yes) ],
2386 [ AC_MSG_RESULT(no)
2387 system_utmp_path=no ]
2388)
2389if test -z "$conf_utmp_location"; then
2390 if test x"$system_utmp_path" = x"no" ; then
2391 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
2392 if test -f $f ; then
2393 conf_utmp_location=$f
2394 fi
2395 done
2396 if test -z "$conf_utmp_location"; then
2397 AC_DEFINE(DISABLE_UTMP)
2398 fi
2399 fi
2400fi
2401if test -n "$conf_utmp_location"; then
2402 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location")
2403fi
2404
2405dnl wtmp detection
2406AC_MSG_CHECKING([if your system defines WTMP_FILE])
2407AC_TRY_COMPILE([
2408#include <sys/types.h>
2409#include <utmp.h>
2410#ifdef HAVE_PATHS_H
2411# include <paths.h>
2412#endif
2413 ],
2414 [ char *wtmp = WTMP_FILE; ],
2415 [ AC_MSG_RESULT(yes) ],
2416 [ AC_MSG_RESULT(no)
2417 system_wtmp_path=no ]
2418)
2419if test -z "$conf_wtmp_location"; then
2420 if test x"$system_wtmp_path" = x"no" ; then
2421 for f in /usr/adm/wtmp /var/log/wtmp; do
2422 if test -f $f ; then
2423 conf_wtmp_location=$f
2424 fi
2425 done
2426 if test -z "$conf_wtmp_location"; then
2427 AC_DEFINE(DISABLE_WTMP)
2428 fi
2429 fi
2430fi
2431if test -n "$conf_wtmp_location"; then
2432 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location")
2433fi
2434
2435
2436dnl utmpx detection - I don't know any system so perverse as to require
2437dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
2438dnl there, though.
2439AC_MSG_CHECKING([if your system defines UTMPX_FILE])
2440AC_TRY_COMPILE([
2441#include <sys/types.h>
2442#include <utmp.h>
2443#ifdef HAVE_UTMPX_H
2444#include <utmpx.h>
2445#endif
2446#ifdef HAVE_PATHS_H
2447# include <paths.h>
2448#endif
2449 ],
2450 [ char *utmpx = UTMPX_FILE; ],
2451 [ AC_MSG_RESULT(yes) ],
2452 [ AC_MSG_RESULT(no)
2453 system_utmpx_path=no ]
2454)
2455if test -z "$conf_utmpx_location"; then
2456 if test x"$system_utmpx_path" = x"no" ; then
2457 AC_DEFINE(DISABLE_UTMPX)
2458 fi
2459else
2460 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location")
2461fi
2462
2463dnl wtmpx detection
2464AC_MSG_CHECKING([if your system defines WTMPX_FILE])
2465AC_TRY_COMPILE([
2466#include <sys/types.h>
2467#include <utmp.h>
2468#ifdef HAVE_UTMPX_H
2469#include <utmpx.h>
2470#endif
2471#ifdef HAVE_PATHS_H
2472# include <paths.h>
2473#endif
2474 ],
2475 [ char *wtmpx = WTMPX_FILE; ],
2476 [ AC_MSG_RESULT(yes) ],
2477 [ AC_MSG_RESULT(no)
2478 system_wtmpx_path=no ]
2479)
2480if test -z "$conf_wtmpx_location"; then
2481 if test x"$system_wtmpx_path" = x"no" ; then
2482 AC_DEFINE(DISABLE_WTMPX)
2483 fi
2484else
2485 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location")
2486fi
2487
2488
3c0ef626 2489if test ! -z "$blibpath" ; then
2490 LDFLAGS="$LDFLAGS -blibpath:$blibpath"
2491 AC_MSG_WARN([Please check and edit -blibpath in LDFLAGS in Makefile])
2492fi
2493
e9702f7d 2494dnl remove pam and dl because they are in $LIBPAM
2495if test "$PAM_MSG" = yes ; then
2496 LIBS=`echo $LIBS | sed 's/-lpam //'`
2497fi
2498if test "$ac_cv_lib_pam_pam_set_item" = yes ; then
2499 LIBS=`echo $LIBS | sed 's/-ldl //'`
2500fi
3c0ef626 2501
e9702f7d 2502AC_EXEEXT
3c0ef626 2503AC_CONFIG_FILES([Makefile openbsd-compat/Makefile scard/Makefile ssh_prng_cmds])
2504AC_OUTPUT
2505
2506# Print summary of options
2507
3c0ef626 2508# Someone please show me a better way :)
2509A=`eval echo ${prefix}` ; A=`eval echo ${A}`
2510B=`eval echo ${bindir}` ; B=`eval echo ${B}`
2511C=`eval echo ${sbindir}` ; C=`eval echo ${C}`
2512D=`eval echo ${sysconfdir}` ; D=`eval echo ${D}`
2513E=`eval echo ${libexecdir}/ssh-askpass` ; E=`eval echo ${E}`
2514F=`eval echo ${mandir}/${mansubdir}X` ; F=`eval echo ${F}`
2515G=`eval echo ${piddir}` ; G=`eval echo ${G}`
350391c5 2516H=`eval echo ${PRIVSEP_PATH}` ; H=`eval echo ${H}`
2517I=`eval echo ${user_path}` ; I=`eval echo ${I}`
2518J=`eval echo ${superuser_path}` ; J=`eval echo ${J}`
3c0ef626 2519
2520echo ""
2521echo "OpenSSH has been configured with the following options:"
350391c5 2522echo " User binaries: $B"
2523echo " System binaries: $C"
2524echo " Configuration files: $D"
2525echo " Askpass program: $E"
2526echo " Manual pages: $F"
2527echo " PID file: $G"
2528echo " Privilege separation chroot path: $H"
2529if test "$USES_LOGIN_CONF" = "yes" ; then
2530echo " At runtime, sshd will use the path defined in /etc/login.conf"
2531else
2532echo " sshd default user PATH: $I"
2533fi
2534if test ! -z "$superuser_path" ; then
2535echo " sshd superuser user PATH: $J"
2536fi
2537echo " Manpage format: $MANTYPE"
2538echo " PAM support: ${PAM_MSG}"
2539echo " KerberosIV support: $KRB4_MSG"
2540echo " KerberosV support: $KRB5_MSG"
2541echo " Smartcard support: $SCARD_MSG"
2542echo " AFS support: $AFS_MSG"
2543echo " S/KEY support: $SKEY_MSG"
2544echo " TCP Wrappers support: $TCPW_MSG"
2545echo " MD5 password support: $MD5_MSG"
2546echo " IP address in \$DISPLAY hack: $DISPLAY_HACK_MSG"
2547echo " Use IPv4 by default hack: $IPV4_HACK_MSG"
2548echo " Translate v4 in v6 hack: $IPV4_IN6_HACK_MSG"
2549echo " BSD Auth support: $BSD_AUTH_MSG"
2550echo " Random number source: $RAND_MSG"
e9702f7d 2551if test ! -z "$USE_RAND_HELPER" ; then
350391c5 2552echo " ssh-rand-helper collects from: $RAND_HELPER_MSG"
3c0ef626 2553fi
2554
2555echo ""
2556
2557echo " Host: ${host}"
2558echo " Compiler: ${CC}"
2559echo " Compiler flags: ${CFLAGS}"
2560echo "Preprocessor flags: ${CPPFLAGS}"
2561echo " Linker flags: ${LDFLAGS}"
e9702f7d 2562echo " Libraries: ${LIBWRAP} ${LIBPAM} ${LIBS}"
3c0ef626 2563
2564echo ""
2565
2566if test "x$PAM_MSG" = "xyes" ; then
e9702f7d 2567 echo "PAM is enabled. You may need to install a PAM control file "
2568 echo "for sshd, otherwise password authentication may fail. "
2569 echo "Example PAM control files can be found in the contrib/ "
2570 echo "subdirectory"
3c0ef626 2571 echo ""
2572fi
2573
e9702f7d 2574if test ! -z "$NO_SFTP"; then
2575 echo "sftp-server will be disabled. Your compiler does not "
2576 echo "support 64bit integers."
3c0ef626 2577 echo ""
2578fi
2579
e9702f7d 2580if test ! -z "$RAND_HELPER_CMDHASH" ; then
2581 echo "WARNING: you are using the builtin random number collection "
2582 echo "service. Please read WARNING.RNG and request that your OS "
2583 echo "vendor includes kernel-based random number collection in "
2584 echo "future versions of your OS."
3c0ef626 2585 echo ""
2586fi
2587
This page took 0.438937 seconds and 5 git commands to generate.