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