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 :)
12 # Checks for programs.
16 if test -z "$LD" ; then
21 if test -z "$OLDCFLAGS" && test "$GCC" = "yes"; then
22 AC_MSG_NOTICE(No \$CFLAGS set... using "-Os -W -Wall" for GCC)
26 # large file support is useful for scp
29 # Host specific options
30 # this isn't a definitive list of hosts, they are just added as required
40 CFLAGS="$CFLAGS -I/usr/local/include"
41 LDFLAGS="$LDFLAGS -L/usr/local/lib -R/usr/local/lib"
42 conf_lastlog_location="/var/adm/lastlog"
43 AC_MSG_CHECKING(for obsolete utmp and wtmp in solaris2.x)
44 sol2ver=`echo "$host"| sed -e 's/.*[[0-9]]\.//'`
45 if test "$sol2ver" -ge 8; then
47 AC_DEFINE(DISABLE_UTMP,,Disable utmp)
48 AC_DEFINE(DISABLE_WTMP,,Disable wtmp)
52 AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
53 AC_CHECK_LIB(nsl, yp_match, LIBS="$LIBS -lnsl")
57 AC_DEFINE(AIX,,Using AIX)
58 # OpenSSH thinks it's broken. If it isn't, let me know.
59 AC_DEFINE(BROKEN_GETADDRINFO,,Broken getaddrinfo)
64 # It's probably broken.
65 AC_DEFINE(BROKEN_GETADDRINFO,,Broken getaddrinfo)
68 AC_DEFINE(BROKEN_GETADDRINFO,,Broken getaddrinfo)
72 AC_CHECK_TOOL(AR, ar, :)
73 AC_CHECK_TOOL(RANLIB, ranlib, :)
74 AC_CHECK_TOOL(STRIP, strip, :)
75 AC_CHECK_TOOL(INSTALL, install, :)
77 dnl Can't use login() or logout() with uclibc
78 AC_CHECK_DECL(__UCLIBC__,
81 AC_MSG_NOTICE([Using uClibc - login() and logout() probably don't work, so we won't use them.])
84 # Checks for libraries.
85 AC_CHECK_LIB(crypt, crypt, CRYPTLIB="-lcrypt")
88 # Check if zlib is needed
90 [ --with-zlib=PATH Use zlib in PATH],
93 if test -d "$withval/lib"; then
94 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
96 LDFLAGS="-L${withval} ${LDFLAGS}"
98 if test -d "$withval/include"; then
99 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
101 CPPFLAGS="-I${withval} ${CPPFLAGS}"
107 [ --disable-zlib Don't include zlib support],
109 if test "x$enableval" = "xno"; then
110 AC_DEFINE(DISABLE_ZLIB,, Use zlib)
111 AC_MSG_NOTICE(Disabling zlib)
113 AC_CHECK_LIB(z, deflate, , AC_MSG_ERROR([*** zlib missing - install first or check config.log ***]))
114 AC_MSG_NOTICE(Enabling zlib)
118 # if not disabled, check for zlib
119 AC_CHECK_LIB(z, deflate, , AC_MSG_ERROR([*** zlib missing - install first or check config.log ***]))
120 AC_MSG_NOTICE(Enabling zlib)
124 # Check if pam is needed
126 [ --with-pam=PATH Use pam in PATH],
129 if test -d "$withval/lib"; then
130 LDFLAGS="-L${withval}/lib ${LDFLAGS}"
132 LDFLAGS="-L${withval} ${LDFLAGS}"
134 if test -d "$withval/include"; then
135 CPPFLAGS="-I${withval}/include ${CPPFLAGS}"
137 CPPFLAGS="-I${withval} ${CPPFLAGS}"
144 [ --enable-pam Try to include PAM support],
146 if test "x$enableval" = "xyes"; then
147 AC_CHECK_LIB(pam, pam_authenticate, , AC_MSG_ERROR([*** PAM missing - install first or check config.log ***]))
148 AC_MSG_NOTICE(Enabling PAM)
149 AC_CHECK_FUNCS(pam_fail_delay)
151 AC_DEFINE(DISABLE_PAM,, Use PAM)
152 AC_MSG_NOTICE(Disabling PAM)
156 # disable it by default
157 AC_DEFINE(DISABLE_PAM,, Use PAM)
158 AC_MSG_NOTICE(Disabling PAM)
162 AC_ARG_ENABLE(openpty,
163 [ --disable-openpty Don't use openpty, use alternative method],
165 if test "x$enableval" = "xno"; then
166 AC_MSG_NOTICE(Not using openpty)
168 AC_MSG_NOTICE(Using openpty if available)
169 AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY,,Have openpty() function)])
173 AC_MSG_NOTICE(Using openpty if available)
174 AC_SEARCH_LIBS(openpty, util, [AC_DEFINE(HAVE_OPENPTY)])
179 AC_ARG_ENABLE(syslog,
180 [ --disable-syslog Don't include syslog support],
182 if test "x$enableval" = "xno"; then
183 AC_DEFINE(DISABLE_SYSLOG,, Using syslog)
184 AC_MSG_NOTICE(Disabling syslog)
186 AC_MSG_NOTICE(Enabling syslog)
190 AC_MSG_NOTICE(Enabling syslog)
194 AC_ARG_ENABLE(shadow,
195 [ --disable-shadow Don't use shadow passwords (if available)],
197 if test "x$enableval" = "xno"; then
198 AC_MSG_NOTICE(Not using shadow passwords)
200 AC_CHECK_HEADERS([shadow.h])
201 AC_MSG_NOTICE(Using shadow passwords if available)
205 AC_CHECK_HEADERS([shadow.h])
206 AC_MSG_NOTICE(Using shadow passwords if available)
211 # Checks for header files.
214 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])
216 # Checks for typedefs, structures, and compiler characteristics.
224 AC_CHECK_TYPES([uint16_t, u_int16_t, struct sockaddr_storage])
225 AC_CHECK_TYPE([socklen_t], ,[
226 AC_MSG_CHECKING([for socklen_t equivalent])
227 AC_CACHE_VAL([curl_cv_socklen_t_equiv],
229 # Systems have either "struct sockaddr *" or
230 # "void *" as the second argument to getpeername
231 curl_cv_socklen_t_equiv=
232 for arg2 in "struct sockaddr" void; do
233 for t in int size_t unsigned long "unsigned long"; do
235 #include <sys/types.h>
236 #include <sys/socket.h>
238 int getpeername (int, $arg2 *, $t *);
241 getpeername(0,0,&len);
243 curl_cv_socklen_t_equiv="$t"
249 if test "x$curl_cv_socklen_t_equiv" = x; then
250 AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
253 AC_MSG_RESULT($curl_cv_socklen_t_equiv)
254 AC_DEFINE_UNQUOTED(socklen_t, $curl_cv_socklen_t_equiv,
255 [type to use in place of socklen_t if not defined])],
256 [#include <sys/types.h>
257 #include <sys/socket.h>])
259 # for the fake-rfc2553 stuff - straight from OpenSSH
261 AC_CACHE_CHECK([for struct sockaddr_storage], ac_cv_have_struct_sockaddr_storage, [
264 #include <sys/types.h>
265 #include <sys/socket.h>
267 [ struct sockaddr_storage s; ],
268 [ ac_cv_have_struct_sockaddr_storage="yes" ],
269 [ ac_cv_have_struct_sockaddr_storage="no" ]
272 if test "x$ac_cv_have_struct_sockaddr_storage" = "xyes" ; then
273 AC_DEFINE(HAVE_STRUCT_SOCKADDR_STORAGE)
276 AC_CACHE_CHECK([for struct sockaddr_in6], ac_cv_have_struct_sockaddr_in6, [
279 #include <sys/types.h>
280 #include <netinet/in.h>
282 [ struct sockaddr_in6 s; s.sin6_family = 0; ],
283 [ ac_cv_have_struct_sockaddr_in6="yes" ],
284 [ ac_cv_have_struct_sockaddr_in6="no" ]
287 if test "x$ac_cv_have_struct_sockaddr_in6" = "xyes" ; then
288 AC_DEFINE(HAVE_STRUCT_SOCKADDR_IN6,,Have struct sockaddr_in6)
291 AC_CACHE_CHECK([for struct in6_addr], ac_cv_have_struct_in6_addr, [
294 #include <sys/types.h>
295 #include <netinet/in.h>
297 [ struct in6_addr s; s.s6_addr[0] = 0; ],
298 [ ac_cv_have_struct_in6_addr="yes" ],
299 [ ac_cv_have_struct_in6_addr="no" ]
302 if test "x$ac_cv_have_struct_in6_addr" = "xyes" ; then
303 AC_DEFINE(HAVE_STRUCT_IN6_ADDR,,Have struct in6_addr)
306 AC_CACHE_CHECK([for struct addrinfo], ac_cv_have_struct_addrinfo, [
309 #include <sys/types.h>
310 #include <sys/socket.h>
313 [ struct addrinfo s; s.ai_flags = AI_PASSIVE; ],
314 [ ac_cv_have_struct_addrinfo="yes" ],
315 [ ac_cv_have_struct_addrinfo="no" ]
318 if test "x$ac_cv_have_struct_addrinfo" = "xyes" ; then
319 AC_DEFINE(HAVE_STRUCT_ADDRINFO,,Have struct addrinfo)
323 # IRIX has a const char return value for gai_strerror()
324 AC_CHECK_FUNCS(gai_strerror,[
325 AC_DEFINE(HAVE_GAI_STRERROR)
327 #include <sys/types.h>
328 #include <sys/socket.h>
331 const char *gai_strerror(int);],[
334 str = gai_strerror(0);],[
335 AC_DEFINE(HAVE_CONST_GAI_STRERROR_PROTO, 1,
336 [Define if gai_strerror() returns const char *])])])
340 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],,,[
341 #include <sys/types.h>
347 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],,,[
348 #include <sys/types.h>
349 #include <sys/socket.h>
355 AC_CHECK_MEMBERS([struct sockaddr_storage.ss_family],,,[
356 #include <sys/types.h>
357 #include <sys/socket.h>
360 AC_CHECK_FUNCS(endutent getutent getutid getutline pututline setutent)
361 AC_CHECK_FUNCS(utmpname)
362 AC_CHECK_FUNCS(endutxent getutxent getutxid getutxline pututxline )
363 AC_CHECK_FUNCS(setutxent utmpxname)
364 AC_CHECK_FUNCS(logout updwtmp logwtmp)
366 dnl Added from OpenSSH 3.6.1p2's configure.ac
368 dnl allow user to disable some login recording features
369 AC_ARG_ENABLE(lastlog,
370 [ --disable-lastlog Disable use of lastlog even if detected [no]],
371 [ AC_DEFINE(DISABLE_LASTLOG,,Disable use of lastlog()) ]
374 [ --disable-utmp Disable use of utmp even if detected [no]],
375 [ AC_DEFINE(DISABLE_UTMP,,Disable use of utmp) ]
378 [ --disable-utmpx Disable use of utmpx even if detected [no]],
379 [ AC_DEFINE(DISABLE_UTMPX,,Disable use of utmpx) ]
382 [ --disable-wtmp Disable use of wtmp even if detected [no]],
383 [ AC_DEFINE(DISABLE_WTMP,,Disable use of wtmp) ]
386 [ --disable-wtmpx Disable use of wtmpx even if detected [no]],
387 [ AC_DEFINE(DISABLE_WTMPX,,Disable use of wtmpx) ]
389 AC_ARG_ENABLE(loginfunc,
390 [ --disable-loginfunc Disable use of login() etc. [no]],
391 [ no_loginfunc_check=1
392 AC_MSG_NOTICE(Not using login() etc) ]
394 AC_ARG_ENABLE(pututline,
395 [ --disable-pututline Disable use of pututline() etc. ([uw]tmp) [no]],
396 [ AC_DEFINE(DISABLE_PUTUTLINE,,Disable use of pututline()) ]
398 AC_ARG_ENABLE(pututxline,
399 [ --disable-pututxline Disable use of pututxline() etc. ([uw]tmpx) [no]],
400 [ AC_DEFINE(DISABLE_PUTUTXLINE,,Disable use of pututxline()) ]
403 [ --with-lastlog=FILE|DIR specify lastlog location [common locations]],
405 if test "x$withval" = "xno" ; then
406 AC_DEFINE(DISABLE_LASTLOG)
408 conf_lastlog_location=$withval
413 if test -z "$no_loginfunc_check"; then
414 dnl Checks for libutil functions (login(), logout() etc, not openpty() )
415 AC_SEARCH_LIBS(login, util bsd, [AC_DEFINE(HAVE_LOGIN,,Have login() function)])
416 AC_CHECK_FUNCS(logout updwtmp logwtmp)
419 dnl lastlog, [uw]tmpx? detection
420 dnl NOTE: set the paths in the platform section to avoid the
421 dnl need for command-line parameters
422 dnl lastlog and [uw]tmp are subject to a file search if all else fails
424 dnl lastlog detection
425 dnl NOTE: the code itself will detect if lastlog is a directory
426 AC_MSG_CHECKING([if your system defines LASTLOG_FILE])
428 #include <sys/types.h>
430 #ifdef HAVE_LASTLOG_H
431 # include <lastlog.h>
440 [ char *lastlog = LASTLOG_FILE; ],
441 [ AC_MSG_RESULT(yes) ],
444 AC_MSG_CHECKING([if your system defines _PATH_LASTLOG])
446 #include <sys/types.h>
448 #ifdef HAVE_LASTLOG_H
449 # include <lastlog.h>
455 [ char *lastlog = _PATH_LASTLOG; ],
456 [ AC_MSG_RESULT(yes) ],
459 system_lastlog_path=no
464 if test -z "$conf_lastlog_location"; then
465 if test x"$system_lastlog_path" = x"no" ; then
466 for f in /var/log/lastlog /usr/adm/lastlog /var/adm/lastlog /etc/security/lastlog ; do
467 if (test -d "$f" || test -f "$f") ; then
468 conf_lastlog_location=$f
471 if test -z "$conf_lastlog_location"; then
472 AC_MSG_WARN([** Cannot find lastlog **])
473 dnl Don't define DISABLE_LASTLOG - that means we don't try wtmp/wtmpx
478 if test -n "$conf_lastlog_location"; then
479 AC_DEFINE_UNQUOTED(CONF_LASTLOG_FILE, "$conf_lastlog_location", lastlog file location)
483 AC_MSG_CHECKING([if your system defines UTMP_FILE])
485 #include <sys/types.h>
491 [ char *utmp = UTMP_FILE; ],
492 [ AC_MSG_RESULT(yes) ],
494 system_utmp_path=no ]
496 if test -z "$conf_utmp_location"; then
497 if test x"$system_utmp_path" = x"no" ; then
498 for f in /etc/utmp /usr/adm/utmp /var/run/utmp; do
500 conf_utmp_location=$f
503 if test -z "$conf_utmp_location"; then
504 AC_DEFINE(DISABLE_UTMP)
508 if test -n "$conf_utmp_location"; then
509 AC_DEFINE_UNQUOTED(CONF_UTMP_FILE, "$conf_utmp_location", utmp file location)
513 AC_MSG_CHECKING([if your system defines WTMP_FILE])
515 #include <sys/types.h>
521 [ char *wtmp = WTMP_FILE; ],
522 [ AC_MSG_RESULT(yes) ],
524 system_wtmp_path=no ]
526 if test -z "$conf_wtmp_location"; then
527 if test x"$system_wtmp_path" = x"no" ; then
528 for f in /usr/adm/wtmp /var/log/wtmp; do
530 conf_wtmp_location=$f
533 if test -z "$conf_wtmp_location"; then
534 AC_DEFINE(DISABLE_WTMP)
538 if test -n "$conf_wtmp_location"; then
539 AC_DEFINE_UNQUOTED(CONF_WTMP_FILE, "$conf_wtmp_location", wtmp file location)
543 dnl utmpx detection - I don't know any system so perverse as to require
544 dnl utmpx, but not define UTMPX_FILE (ditto wtmpx.) No doubt it's out
546 AC_MSG_CHECKING([if your system defines UTMPX_FILE])
548 #include <sys/types.h>
557 [ char *utmpx = UTMPX_FILE; ],
558 [ AC_MSG_RESULT(yes) ],
560 system_utmpx_path=no ]
562 if test -z "$conf_utmpx_location"; then
563 if test x"$system_utmpx_path" = x"no" ; then
564 AC_DEFINE(DISABLE_UTMPX)
567 AC_DEFINE_UNQUOTED(CONF_UTMPX_FILE, "$conf_utmpx_location", utmpx file location)
571 AC_MSG_CHECKING([if your system defines WTMPX_FILE])
573 #include <sys/types.h>
582 [ char *wtmpx = WTMPX_FILE; ],
583 [ AC_MSG_RESULT(yes) ],
585 system_wtmpx_path=no ]
587 if test -z "$conf_wtmpx_location"; then
588 if test x"$system_wtmpx_path" = x"no" ; then
589 AC_DEFINE(DISABLE_WTMPX)
592 AC_DEFINE_UNQUOTED(CONF_WTMPX_FILE, "$conf_wtmpx_location", wtmpx file location)
595 # Checks for library functions.
596 AC_PROG_GCC_TRADITIONAL
598 AC_FUNC_SELECT_ARGTYPES
600 AC_CHECK_FUNCS([dup2 getspnam getusershell memset putenv select socket strdup clearenv strlcpy strlcat daemon basename _getpty getaddrinfo freeaddrinfo getnameinfo])
602 AC_SEARCH_LIBS(basename, gen, AC_DEFINE(HAVE_BASENAME))
605 if test -z "$no_ptmx_check" ; then
606 if test x"$cross_compiling" = x"no" ; then
607 AC_CHECK_FILE("/dev/ptmx", AC_DEFINE(USE_DEV_PTMX,,Use /dev/ptmx))
609 AC_MSG_NOTICE([Not checking for /dev/ptmx, we're cross-compiling])
613 if test -z "$no_ptc_check" ; then
614 if test x"$cross_compiling" = x"no" ; then
615 AC_CHECK_FILE("/dev/ptc", AC_DEFINE(HAVE_DEV_PTS_AND_PTC,,Use /dev/ptc & /dev/pts))
617 AC_MSG_NOTICE([Not checking for /dev/ptc & /dev/pts since we're cross-compiling])
623 # XXX there must be a nicer way to do this
624 AS_MKDIR_P(libtomcrypt/src/ciphers/aes)
625 AS_MKDIR_P(libtomcrypt/src/ciphers/safer)
626 AS_MKDIR_P(libtomcrypt/src/ciphers/twofish)
627 AS_MKDIR_P(libtomcrypt/src/encauth/ccm)
628 AS_MKDIR_P(libtomcrypt/src/encauth/eax)
629 AS_MKDIR_P(libtomcrypt/src/encauth/gcm)
630 AS_MKDIR_P(libtomcrypt/src/encauth/ocb)
631 AS_MKDIR_P(libtomcrypt/src/hashes)
632 AS_MKDIR_P(libtomcrypt/src/hashes/chc)
633 AS_MKDIR_P(libtomcrypt/src/hashes/helper)
634 AS_MKDIR_P(libtomcrypt/src/hashes/sha2)
635 AS_MKDIR_P(libtomcrypt/src/hashes/whirl)
636 AS_MKDIR_P(libtomcrypt/src/mac/hmac)
637 AS_MKDIR_P(libtomcrypt/src/mac/omac)
638 AS_MKDIR_P(libtomcrypt/src/mac/pelican)
639 AS_MKDIR_P(libtomcrypt/src/mac/pmac)
640 AS_MKDIR_P(libtomcrypt/src/mac/f9)
641 AS_MKDIR_P(libtomcrypt/src/mac/xcbc)
642 AS_MKDIR_P(libtomcrypt/src/math/fp)
643 AS_MKDIR_P(libtomcrypt/src/misc/base64)
644 AS_MKDIR_P(libtomcrypt/src/misc/crypt)
645 AS_MKDIR_P(libtomcrypt/src/misc/mpi)
646 AS_MKDIR_P(libtomcrypt/src/misc/pkcs5)
647 AS_MKDIR_P(libtomcrypt/src/modes/cbc)
648 AS_MKDIR_P(libtomcrypt/src/modes/cfb)
649 AS_MKDIR_P(libtomcrypt/src/modes/ctr)
650 AS_MKDIR_P(libtomcrypt/src/modes/ecb)
651 AS_MKDIR_P(libtomcrypt/src/modes/ofb)
652 AS_MKDIR_P(libtomcrypt/src/modes/f8)
653 AS_MKDIR_P(libtomcrypt/src/modes/lrw)
654 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/bit)
655 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/choice)
656 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/ia5)
657 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/integer)
658 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/object_identifier)
659 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/octet)
660 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/printable_string)
661 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/sequence)
662 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/short_integer)
663 AS_MKDIR_P(libtomcrypt/src/pk/asn1/der/utctime)
664 AS_MKDIR_P(libtomcrypt/src/pk/dh)
665 AS_MKDIR_P(libtomcrypt/src/pk/dsa)
666 AS_MKDIR_P(libtomcrypt/src/pk/ecc)
667 AS_MKDIR_P(libtomcrypt/src/pk/pkcs1)
668 AS_MKDIR_P(libtomcrypt/src/pk/rsa)
669 AS_MKDIR_P(libtomcrypt/src/prng)
670 AC_CONFIG_HEADER(config.h)
672 AC_OUTPUT(libtomcrypt/Makefile)
673 AC_OUTPUT(libtommath/Makefile)
675 AC_MSG_NOTICE(Now edit options.h to choose features.)