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