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