dropbear 2015.71
[tomato.git] / release / src / router / dropbear / configure.ac
blob9fd8ef20596ce34ec3bec0871a1f4e9c47a35f58
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf and autoheader to produce a configure script.
4 # This Autoconf file was cobbled from various locations. In particular, a bunch
5 # of the platform checks have been taken straight from OpenSSH's configure.ac
6 # Huge thanks to them for dealing with the horrible platform-specifics :)
8 AC_PREREQ(2.59)
9 AC_INIT
10 AC_CONFIG_SRCDIR(buffer.c)
12 OLDCFLAGS=$CFLAGS
13 # Checks for programs.
14 AC_PROG_CC
15 AC_PROG_MAKE_SET
17 if test -z "$LD" ; then
18         LD=$CC
20 AC_SUBST(LD)    
22 if test -z "$OLDCFLAGS" && test "$GCC" = "yes"; then
23         AC_MSG_NOTICE(No \$CFLAGS set... using "-Os -W -Wall" for GCC)
24         CFLAGS="-Os -W -Wall -Wno-pointer-sign"
27 # large file support is useful for scp
28 AC_SYS_LARGEFILE
30 # Host specific options
31 # this isn't a definitive list of hosts, they are just added as required
32 AC_CANONICAL_HOST
34 case "$host" in
36 *-*-linux*)
37         no_ptmx_check=1
38         ;;
40 *-*-solaris*)
41         CFLAGS="$CFLAGS -I/usr/local/include"
42         LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
43         conf_lastlog_location="/var/adm/lastlog"
44         AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
45         sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
46         if test "$sol2ver" -ge 8; then
47                 AC_MSG_RESULT(yes)
48                 AC_DEFINE(DISABLE_UTMP,,Disable utmp)
49                 AC_DEFINE(DISABLE_WTMP,,Disable wtmp)
50         else
51                 AC_MSG_RESULT(no)
52         fi
53         AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
54         AC_CHECK_LIB(nsl, yp_match, LIBS="$LIBS -lnsl")
55         ;;
57 *-*-aix*)
58         AC_DEFINE(AIX,,Using AIX)
59         # OpenSSH thinks it's broken. If it isn't, let me know.
60         AC_DEFINE(BROKEN_GETADDRINFO,,Broken getaddrinfo)
61         ;;
62         
63 *-*-hpux*)
64         LIBS="$LIBS -lsec"
65         # It's probably broken.
66         AC_DEFINE(BROKEN_GETADDRINFO,,Broken getaddrinfo)
67         ;;
68 *-dec-osf*)
69         AC_DEFINE(BROKEN_GETADDRINFO,,Broken getaddrinfo)
70         ;;
71 esac
73 AC_CHECK_TOOL(AR, ar, :)
74 AC_CHECK_TOOL(RANLIB, ranlib, :)
75 AC_CHECK_TOOL(STRIP, strip, :)
76 AC_CHECK_TOOL(INSTALL, install, :)
78 dnl Can't use login() or logout() with uclibc
79 AC_CHECK_DECL(__UCLIBC__, 
80         [
81         no_loginfunc_check=1
82         AC_MSG_NOTICE([Using uClibc - login() and logout() probably don't work, so we won't use them.])
83         ],,,)
85 dnl We test for crypt() specially. On Linux (and others?) it resides in libcrypt
86 dnl but we don't want link all binaries to -lcrypt, just dropbear server.
87 dnl OS X doesn't need -lcrypt 
88 AC_CHECK_FUNC(crypt, found_crypt_func=here)
89 AC_CHECK_LIB(crypt, crypt, 
90         [
91         CRYPTLIB="-lcrypt"
92         found_crypt_func=here
93         ])
94 AC_SUBST(CRYPTLIB)      
95 if test "t$found_crypt_func" = there; then
96 AC_DEFINE(HAVE_CRYPT, 1, [crypt() function])
99 # Check if zlib is needed
100 AC_ARG_WITH(zlib,
101         [  --with-zlib=PATH        Use zlib in PATH],
102         [
103                 # option is given
104                 if test -d "$withval/lib"; then
105                         LDFLAGS="-L${withval}/lib ${LDFLAGS}"
106                 else
107                         LDFLAGS="-L${withval} ${LDFLAGS}"
108                 fi
109                 if test -d "$withval/include"; then
110                         CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
111                 else
112                         CPPFLAGS="-I${withval} ${CPPFLAGS}"
113                 fi
114         ]
117 AC_ARG_ENABLE(zlib,
118         [  --disable-zlib          Don't include zlib support],
119         [
120                 if test "x$enableval" = "xno"; then
121                         AC_DEFINE(DISABLE_ZLIB,, Use zlib)
122                         AC_MSG_NOTICE(Disabling zlib)
123                 else
124                         AC_CHECK_LIB(z, deflate, , AC_MSG_ERROR([*** zlib missing - install first or check config.log ***]))
125                         AC_MSG_NOTICE(Enabling zlib)
126                 fi
127         ],
128         [
129                 # if not disabled, check for zlib
130                 AC_CHECK_LIB(z, deflate, , AC_MSG_ERROR([*** zlib missing - install first or check config.log ***]))
131                 AC_MSG_NOTICE(Enabling zlib)
132         ]
135 # Check if pam is needed
136 AC_ARG_WITH(pam,
137         [  --with-pam=PATH        Use pam in PATH],
138         [
139                 # option is given
140                 if test -d "$withval/lib"; then
141                         LDFLAGS="-L${withval}/lib ${LDFLAGS}"
142                 else
143                         LDFLAGS="-L${withval} ${LDFLAGS}"
144                 fi
145                 if test -d "$withval/include"; then
146                         CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
147                 else
148                         CPPFLAGS="-I${withval} ${CPPFLAGS}"
149                 fi
150         ]
154 AC_ARG_ENABLE(pam,
155         [  --enable-pam          Try to include PAM support],
156         [
157                 if test "x$enableval" = "xyes"; then
158                         AC_CHECK_LIB(pam, pam_authenticate, , AC_MSG_ERROR([*** PAM missing - install first or check config.log ***]))
159                         AC_MSG_NOTICE(Enabling PAM)
160                         AC_CHECK_FUNCS(pam_fail_delay)
161                 else
162                         AC_DEFINE(DISABLE_PAM,, Use PAM)
163                         AC_MSG_NOTICE(Disabling PAM)
164                 fi
165         ],
166         [
167                 # disable it by default
168                 AC_DEFINE(DISABLE_PAM,, Use PAM)
169                 AC_MSG_NOTICE(Disabling PAM)
170         ]
173 AC_ARG_ENABLE(openpty,
174         [  --disable-openpty       Don't use openpty, use alternative method],
175         [
176                 if test "x$enableval" = "xno"; then
177                         AC_MSG_NOTICE(Not using openpty)
178                 else
179                         AC_MSG_NOTICE(Using openpty if available)
180                         AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY,,Have openpty() function)])
181                 fi
182         ],
183         [
184                 AC_MSG_NOTICE(Using openpty if available)
185                 AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY)])
186         ]
188                 
190 AC_ARG_ENABLE(syslog,
191         [  --disable-syslog        Don't include syslog support],
192         [
193                 if test "x$enableval" = "xno"; then
194                         AC_DEFINE(DISABLE_SYSLOG,, Using syslog)
195                         AC_MSG_NOTICE(Disabling syslog)
196                 else
197                         AC_MSG_NOTICE(Enabling syslog)
198                 fi
199         ],
200         [
201                 AC_MSG_NOTICE(Enabling syslog)
202         ]
205 AC_ARG_ENABLE(shadow,
206         [  --disable-shadow        Don't use shadow passwords (if available)],
207         [
208                 if test "x$enableval" = "xno"; then
209                         AC_MSG_NOTICE(Not using shadow passwords)
210                 else
211                         AC_CHECK_HEADERS([shadow.h])
212                         AC_MSG_NOTICE(Using shadow passwords if available)
213                 fi
214         ],
215         [
216                 AC_CHECK_HEADERS([shadow.h])
217                 AC_MSG_NOTICE(Using shadow passwords if available)
218         ]
220                         
222 # Checks for header files.
223 AC_HEADER_STDC
224 AC_HEADER_SYS_WAIT
225 AC_CHECK_HEADERS([fcntl.h limits.h netinet/in.h netinet/tcp.h stdlib.h string.h sys/socket.h sys/time.h termios.h unistd.h crypt.h pty.h ioctl.h libutil.h libgen.h inttypes.h stropts.h utmp.h utmpx.h lastlog.h paths.h util.h netdb.h security/pam_appl.h pam/pam_appl.h netinet/in_systm.h sys/uio.h])
227 # Checks for typedefs, structures, and compiler characteristics.
228 AC_C_CONST
229 AC_TYPE_UID_T
230 AC_TYPE_MODE_T
231 AC_TYPE_PID_T
232 AC_TYPE_SIZE_T
233 AC_HEADER_TIME
235 AC_CHECK_TYPES([uint8_t, u_int8_t, uint16_t, u_int16_t, uint32_t, u_int32_t])
236 AC_CHECK_TYPES([struct sockaddr_storage])
237 AC_CHECK_TYPE([socklen_t], ,[
238         AC_MSG_CHECKING([for socklen_t equivalent])
239         AC_CACHE_VAL([curl_cv_socklen_t_equiv],
240         [
241         # Systems have either "struct sockaddr *" or
242         # "void *" as the second argument to getpeername
243         curl_cv_socklen_t_equiv=
244         for arg2 in "struct sockaddr" void; do
245                 for t in int size_t unsigned long "unsigned long"; do
246                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
247 #include <sys/types.h>
248 #include <sys/socket.h>
250                         int getpeername (int, $arg2 *, $t *);
251                 ]],[[
252                         $t len;
253                         getpeername(0,0,&len);
254                 ]])],[
255                         curl_cv_socklen_t_equiv="$t"
256                         break
257                 ])
258                 done
259         done
261         if test "x$curl_cv_socklen_t_equiv" = x; then
262                 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
263         fi
264         ])
265         AC_MSG_RESULT($curl_cv_socklen_t_equiv)
266         AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
267                         [type to use in place of socklen_t if not defined])],
268         [#include <sys/types.h>
269         #include <sys/socket.h>])
271 # for the fake-rfc2553 stuff - straight from OpenSSH
273 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
274         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
275 #include <sys/types.h>
276 #include <sys/socket.h>
277                 ]],
278                 [[ if (sizeof(struct sockaddr_storage)) return 0 ]])],
279                 [ ac_cv_have_struct_sockaddr_storage="yes" ],
280                 [ ac_cv_have_struct_sockaddr_storage="no" ]
281         )
283 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
284         AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
287 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
288         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
289 #include <sys/types.h>
290 #include <netinet/in.h>
291                 ]],
292                 [[ if (sizeof(struct sockaddr_in6)) return 0 ]])],
293                 [ ac_cv_have_struct_sockaddr_in6="yes" ],
294                 [ ac_cv_have_struct_sockaddr_in6="no" ]
295         )
297 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
298         AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6,,Have struct sockaddr_in6)
301 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
302         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
303 #include <sys/types.h>
304 #include <netinet/in.h>
305                 ]],
306                 [[ if (sizeof(struct in6_addr)) return 0 ]])],
307                 [ ac_cv_have_struct_in6_addr="yes" ],
308                 [ ac_cv_have_struct_in6_addr="no" ]
309         )
311 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
312         AC_DEFINE(HAVE_STRUCT_IN6_ADDR,,Have struct in6_addr)
315 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
316         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
317 #include <sys/types.h>
318 #include <sys/socket.h>
319 #include <netdb.h>
320                 ]],
321                 [[ if (sizeof(struct addrinfo)) return 0 ]])],
322                 [ ac_cv_have_struct_addrinfo="yes" ],
323                 [ ac_cv_have_struct_addrinfo="no" ]
324         )
326 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
327         AC_DEFINE(HAVE_STRUCT_ADDRINFO,,Have struct addrinfo)
331 # IRIX has a const char return value for gai_strerror()
332 AC_CHECK_FUNCS(gai_strerror,[
333         AC_DEFINE(HAVE_GAI_STRERROR)
334         AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
335 #include <sys/types.h>
336 #include <sys/socket.h>
337 #include <netdb.h>
339 const char *gai_strerror(int);]],[[
340 char *str;
342 str = gai_strerror(0);]])],[
343                 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
344                 [Define if gai_strerror() returns const char *])])])
346 # for loginrec.c
348 AC_CHECK_MEMBERS([struct utmp.ut_host, struct utmp.ut_pid, struct utmp.ut_type, struct utmp.ut_tv, struct utmp.ut_id, struct utmp.ut_addr, struct utmp.ut_addr_v6, struct utmp.ut_exit, struct utmp.ut_time],,,[
349 #include <sys/types.h>
350 #if HAVE_UTMP_H
351 #include <utmp.h>
352 #endif
355 AC_CHECK_MEMBERS([struct utmpx.ut_host, struct utmpx.ut_syslen, struct utmpx.ut_type, struct utmpx.ut_id, struct utmpx.ut_addr, struct utmpx.ut_addr_v6, struct utmpx.ut_time, struct utmpx.ut_tv],,,[
356 #include <sys/types.h>
357 #include <sys/socket.h>
358 #if HAVE_UTMPX_H
359 #include <utmpx.h>
360 #endif
363 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],,,[
364 #include <sys/types.h>
365 #include <sys/socket.h>
368 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
369 AC_CHECK_FUNCS(utmpname)
370 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
371 AC_CHECK_FUNCS(setutxent utmpxname)
372 AC_CHECK_FUNCS(logout updwtmp logwtmp)
374 # OS X monotonic time
375 AC_CHECK_HEADERS([mach/mach_time.h])
376 AC_CHECK_FUNCS(mach_absolute_time)
378 AC_ARG_ENABLE(bundled-libtom,
379 [  --enable-bundled-libtom       Force using bundled libtomcrypt/libtommath even if a system version exists.
380   --disable-bundled-libtom      Force using system libtomcrypt/libtommath, fail if it does not exist.
381                                 Default is to use system if available, otherwise bundled.],
382         [
383                 if test "x$enableval" = "xyes"; then
384                         BUNDLED_LIBTOM=1
385                         AC_MSG_NOTICE(Forcing bundled libtom*)
386                 else
387                         BUNDLED_LIBTOM=0
388                         AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="$LIBTOM_LIBS -ltommath", 
389                                 [AC_MSG_ERROR([Missing system libtommath and --disable-bundled-libtom was specified])] )
390                         AC_CHECK_LIB(tomcrypt, register_cipher, LIBTOM_LIBS="$LIBTOM_LIBS -ltomcrypt", 
391                                 [AC_MSG_ERROR([Missing system libtomcrypt and --disable-bundled-libtom was specified])] )
392                 fi
393         ],
394         [
395                 BUNDLED_LIBTOM=0
396                 AC_CHECK_LIB(tommath, mp_exptmod, LIBTOM_LIBS="$LIBTOM_LIBS -ltommath", BUNDLED_LIBTOM=1)
397                 AC_CHECK_LIB(tomcrypt, register_cipher, LIBTOM_LIBS="$LIBTOM_LIBS -ltomcrypt", BUNDLED_LIBTOM=1)
398         ]
401 if test $BUNDLED_LIBTOM = 1 ; then
402         AC_DEFINE(BUNDLED_LIBTOM,,Use bundled libtom) 
405 AC_SUBST(LIBTOM_LIBS)
406 AC_SUBST(BUNDLED_LIBTOM)
408 dnl Added from OpenSSH 3.6.1p2's configure.ac
410 dnl allow user to disable some login recording features
411 AC_ARG_ENABLE(lastlog,
412         [  --disable-lastlog       Disable use of lastlog even if detected [no]],
413         [ AC_DEFINE(DISABLE_LASTLOG,,Disable use of lastlog()) ]
415 AC_ARG_ENABLE(utmp,
416         [  --disable-utmp          Disable use of utmp even if detected [no]],
417         [ AC_DEFINE(DISABLE_UTMP,,Disable use of utmp) ]
419 AC_ARG_ENABLE(utmpx,
420         [  --disable-utmpx         Disable use of utmpx even if detected [no]],
421         [ AC_DEFINE(DISABLE_UTMPX,,Disable use of utmpx) ]
423 AC_ARG_ENABLE(wtmp,
424         [  --disable-wtmp          Disable use of wtmp even if detected [no]],
425         [ AC_DEFINE(DISABLE_WTMP,,Disable use of wtmp) ]
427 AC_ARG_ENABLE(wtmpx,
428         [  --disable-wtmpx         Disable use of wtmpx even if detected [no]],
429         [ AC_DEFINE(DISABLE_WTMPX,,Disable use of wtmpx) ]
431 AC_ARG_ENABLE(loginfunc,
432         [  --disable-loginfunc     Disable use of login() etc. [no]],
433         [ no_loginfunc_check=1
434         AC_MSG_NOTICE(Not using login() etc) ]
436 AC_ARG_ENABLE(pututline,
437         [  --disable-pututline     Disable use of pututline() etc. ([uw]tmp) [no]],
438         [ AC_DEFINE(DISABLE_PUTUTLINE,,Disable use of pututline()) ]
440 AC_ARG_ENABLE(pututxline,
441         [  --disable-pututxline    Disable use of pututxline() etc. ([uw]tmpx) [no]],
442         [ AC_DEFINE(DISABLE_PUTUTXLINE,,Disable use of pututxline()) ]
444 AC_ARG_WITH(lastlog,
445   [  --with-lastlog=FILE|DIR specify lastlog location [common locations]],
446         [
447                 if test "x$withval" = "xno" ; then      
448                         AC_DEFINE(DISABLE_LASTLOG)
449                 else
450                         conf_lastlog_location=$withval
451                 fi
452         ]
455 if test -z "$no_loginfunc_check"; then
456         dnl    Checks for libutil functions (login(), logout() etc, not openpty() )
457         AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN,,Have login() function)])
458         AC_CHECK_FUNCS(logout updwtmp logwtmp)
461 dnl lastlog, [uw]tmpx? detection
462 dnl  NOTE: set the paths in the platform section to avoid the
463 dnl   need for command-line parameters
464 dnl lastlog and [uw]tmp are subject to a file search if all else fails
466 dnl lastlog detection
467 dnl  NOTE: the code itself will detect if lastlog is a directory
468 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
469 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
470 #include <sys/types.h>
471 #include <utmp.h>
472 #ifdef HAVE_LASTLOG_H
473 #  include <lastlog.h>
474 #endif
475 #ifdef HAVE_PATHS_H
476 #  include <paths.h>
477 #endif
478 #ifdef HAVE_LOGIN_H
479 # include <login.h>
480 #endif
481         ]],
482         [[ char *lastlog = LASTLOG_FILE; ]])],
483         [ AC_MSG_RESULT(yes) ],
484         [
485                 AC_MSG_RESULT(no)
486                 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
487                 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
488 #include <sys/types.h>
489 #include <utmp.h>
490 #ifdef HAVE_LASTLOG_H
491 #  include <lastlog.h>
492 #endif
493 #ifdef HAVE_PATHS_H
494 #  include <paths.h>
495 #endif
496                 ]],
497                 [[ char *lastlog = _PATH_LASTLOG; ]])],
498                 [ AC_MSG_RESULT(yes) ],
499                 [
500                         AC_MSG_RESULT(no)
501                         system_lastlog_path=no
502                 ])
503         ]
506 if test -z "$conf_lastlog_location"; then
507         if test x"$system_lastlog_path" = x"no" ; then
508                 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
509                                 if (test -d "$f" || test -f "$f") ; then
510                                         conf_lastlog_location=$f
511                                 fi
512                 done
513                 if test -z "$conf_lastlog_location"; then
514                         AC_MSG_WARN([** Cannot find lastlog **])
515                         dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
516                 fi
517         fi
520 if test -n "$conf_lastlog_location"; then
521         AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location", lastlog file location)
522 fi      
524 dnl utmp detection
525 AC_MSG_CHECKING([if your system defines UTMP_FILE])
526 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
527 #include <sys/types.h>
528 #include <utmp.h>
529 #ifdef HAVE_PATHS_H
530 #  include <paths.h>
531 #endif
532         ]],
533         [[ char *utmp = UTMP_FILE; ]])],
534         [ AC_MSG_RESULT(yes) ],
535         [ AC_MSG_RESULT(no)
536           system_utmp_path=no ]
538 if test -z "$conf_utmp_location"; then
539         if test x"$system_utmp_path" = x"no" ; then
540                 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
541                         if test -f $f ; then
542                                 conf_utmp_location=$f
543                         fi
544                 done
545                 if test -z "$conf_utmp_location"; then
546                         AC_DEFINE(DISABLE_UTMP)
547                 fi
548         fi
550 if test -n "$conf_utmp_location"; then
551         AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location", utmp file location)
552 fi      
554 dnl wtmp detection
555 AC_MSG_CHECKING([if your system defines WTMP_FILE])
556 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
557 #include <sys/types.h>
558 #ifdef HAVE_UTMP_H
559 #  include <utmp.h>
560 #endif
561 #ifdef HAVE_PATHS_H
562 #  include <paths.h>
563 #endif
564         ]],
565         [[ char *wtmp = WTMP_FILE; ]])],
566         [ AC_MSG_RESULT(yes) ],
567         [ AC_MSG_RESULT(no)
568           system_wtmp_path=no ]
570 if test -z "$conf_wtmp_location"; then
571         if test x"$system_wtmp_path" = x"no" ; then
572                 for f in /usr/adm/wtmp /var/log/wtmp; do
573                         if test -f $f ; then
574                                 conf_wtmp_location=$f
575                         fi
576                 done
577                 if test -z "$conf_wtmp_location"; then
578                         AC_DEFINE(DISABLE_WTMP)
579                 fi
580         fi
582 if test -n "$conf_wtmp_location"; then
583         AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location", wtmp file location)
584 fi      
587 dnl utmpx detection - I don't know any system so perverse as to require
588 dnl  utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
589 dnl  there, though.
590 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
591 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
592 #include <sys/types.h>
593 #include <utmp.h>
594 #ifdef HAVE_UTMPX_H
595 #include <utmpx.h>
596 #endif
597 #ifdef HAVE_PATHS_H
598 #  include <paths.h>
599 #endif
600         ]],
601         [[ char *utmpx = UTMPX_FILE; ]])],
602         [ AC_MSG_RESULT(yes) ],
603         [ AC_MSG_RESULT(no)
604           system_utmpx_path=no ]
606 if test -z "$conf_utmpx_location"; then
607         if test x"$system_utmpx_path" = x"no" ; then
608                 AC_DEFINE(DISABLE_UTMPX)
609         fi
610 else
611         AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location", utmpx file location)
612 fi      
614 dnl wtmpx detection
615 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
616 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
617 #include <sys/types.h>
618 #ifdef HAVE_UTMP_H
619 #  include <utmp.h>
620 #endif
621 #ifdef HAVE_UTMPX_H
622 #  include <utmpx.h>
623 #endif
624 #ifdef HAVE_PATHS_H
625 #  include <paths.h>
626 #endif
627         ]],
628         [[ char *wtmpx = WTMPX_FILE; ]])],
629         [ AC_MSG_RESULT(yes) ],
630         [ AC_MSG_RESULT(no)
631           system_wtmpx_path=no ]
633 if test -z "$conf_wtmpx_location"; then
634         if test x"$system_wtmpx_path" = x"no" ; then
635                 AC_DEFINE(DISABLE_WTMPX)
636         fi
637 else
638         AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location", wtmpx file location)
639 fi      
641 # Checks for library functions.
642 AC_PROG_GCC_TRADITIONAL
643 AC_FUNC_MEMCMP
644 AC_FUNC_SELECT_ARGTYPES
645 AC_CHECK_FUNCS([dup2 getpass getspnam getusershell memset putenv select socket strdup clearenv strlcpy strlcat daemon basename _getpty getaddrinfo freeaddrinfo getnameinfo fork writev])
647 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
649 # Solaris needs ptmx
650 if test -z "$no_ptmx_check" ; then
651         if test x"$cross_compiling" = x"no" ; then
652                 if test -e /dev/ptmx ; then
653                         AC_DEFINE(USE_DEV_PTMX,,Use /dev/ptmx)
654                 fi
655         else
656                 AC_MSG_NOTICE([Not checking for /dev/ptmx, we're cross-compiling])
657         fi
660 if test -z "$no_ptc_check" ; then
661         if test x"$cross_compiling" = x"no" ; then
662                 if test -e /dev/ptc ; then
663                         AC_DEFINE(HAVE_DEV_PTS_AND_PTC,,Use /dev/ptc & /dev/pts)
664                 fi
665         else
666                 AC_MSG_NOTICE([Not checking for /dev/ptc & /dev/pts since we're cross-compiling])
667         fi
670 AC_EXEEXT
672 # XXX there must be a nicer way to do this
673 if test $BUNDLED_LIBTOM = 1 ; then
674 AS_MKDIR_P(libtomcrypt/src/ciphers/aes)
675 AS_MKDIR_P(libtomcrypt/src/ciphers/safer)
676 AS_MKDIR_P(libtomcrypt/src/ciphers/twofish)
677 AS_MKDIR_P(libtomcrypt/src/encauth/ccm)
678 AS_MKDIR_P(libtomcrypt/src/encauth/eax)
679 AS_MKDIR_P(libtomcrypt/src/encauth/gcm)
680 AS_MKDIR_P(libtomcrypt/src/encauth/ocb)
681 AS_MKDIR_P(libtomcrypt/src/hashes)
682 AS_MKDIR_P(libtomcrypt/src/hashes/chc)
683 AS_MKDIR_P(libtomcrypt/src/hashes/helper)
684 AS_MKDIR_P(libtomcrypt/src/hashes/sha2)
685 AS_MKDIR_P(libtomcrypt/src/hashes/whirl)
686 AS_MKDIR_P(libtomcrypt/src/mac/hmac)
687 AS_MKDIR_P(libtomcrypt/src/mac/omac)
688 AS_MKDIR_P(libtomcrypt/src/mac/pelican)
689 AS_MKDIR_P(libtomcrypt/src/mac/pmac)
690 AS_MKDIR_P(libtomcrypt/src/mac/f9)
691 AS_MKDIR_P(libtomcrypt/src/mac/xcbc)
692 AS_MKDIR_P(libtomcrypt/src/math/fp)
693 AS_MKDIR_P(libtomcrypt/src/misc/base64)
694 AS_MKDIR_P(libtomcrypt/src/misc/crypt)
695 AS_MKDIR_P(libtomcrypt/src/misc/mpi)
696 AS_MKDIR_P(libtomcrypt/src/misc/pkcs5)
697 AS_MKDIR_P(libtomcrypt/src/modes/cbc)
698 AS_MKDIR_P(libtomcrypt/src/modes/cfb)
699 AS_MKDIR_P(libtomcrypt/src/modes/ctr)
700 AS_MKDIR_P(libtomcrypt/src/modes/ecb)
701 AS_MKDIR_P(libtomcrypt/src/modes/ofb)
702 AS_MKDIR_P(libtomcrypt/src/modes/f8)
703 AS_MKDIR_P(libtomcrypt/src/modes/lrw)
704 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/bit)
705 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/boolean)
706 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/choice)
707 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/ia5)
708 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/integer)
709 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/object_identifier)
710 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/octet)
711 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/printable_string)
712 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/sequence)
713 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/set)
714 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/short_integer)
715 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/utctime)
716 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/utf8)
717 AS_MKDIR_P(libtomcrypt/src/pk/dh)
718 AS_MKDIR_P(libtomcrypt/src/pk/dsa)
719 AS_MKDIR_P(libtomcrypt/src/pk/ecc)
720 AS_MKDIR_P(libtomcrypt/src/pk/katja)
721 AS_MKDIR_P(libtomcrypt/src/pk/pkcs1)
722 AS_MKDIR_P(libtomcrypt/src/pk/rsa)
723 AS_MKDIR_P(libtomcrypt/src/prngs)
724 LIBTOM_FILES="libtomcrypt/Makefile libtommath/Makefile"
726 AC_CONFIG_HEADER(config.h)
727 AC_CONFIG_FILES(Makefile $LIBTOM_FILES)
728 AC_OUTPUT
730 AC_MSG_NOTICE()
731 if test $BUNDLED_LIBTOM = 1 ; then
732 AC_MSG_NOTICE([Using bundled libtomcrypt and libtommath])
733 else
734 AC_MSG_NOTICE([Using system libtomcrypt and libtommath])
738 if test "x$ac_cv_func_getpass" != xyes; then
739 AC_MSG_NOTICE()
740 AC_MSG_NOTICE([getpass() not available, dbclient will only have public-key authentication])
743 if test "t$found_crypt_func" != there; then
744 AC_MSG_NOTICE()
745 AC_MSG_NOTICE([crypt() not available, dropbear server will not have password authentication])
748 AC_MSG_NOTICE()
749 AC_MSG_NOTICE([Now edit options.h to choose features.])