| 1 | AC_INIT([ashd], [0.13]) |
| 2 | AC_CONFIG_SRCDIR(src/htparser.c) |
| 3 | AM_INIT_AUTOMAKE |
| 4 | AC_CONFIG_HEADERS(config.h) |
| 5 | AC_USE_SYSTEM_EXTENSIONS |
| 6 | |
| 7 | AC_PROG_CC |
| 8 | AM_PROG_CC_C_O |
| 9 | AC_PROG_INSTALL |
| 10 | AC_PROG_RANLIB |
| 11 | |
| 12 | HAS_MAGIC=yes |
| 13 | AC_CHECK_LIB(magic, magic_open, [:], [HAS_MAGIC=no]) |
| 14 | AC_CHECK_HEADER(magic.h, [], [HAS_MAGIC=no]) |
| 15 | if test "$HAS_MAGIC" = no; then |
| 16 | AC_MSG_ERROR([*** cannot find libmagic on this system]) |
| 17 | fi |
| 18 | |
| 19 | AH_TEMPLATE(HAVE_GLIBC_STDIO, [define to indicate system support for glibc cookie streams]) |
| 20 | AH_TEMPLATE(HAVE_BSD_STDIO, [define to indicate system support for BSD-style funopen streams]) |
| 21 | |
| 22 | HAS_FOPENCOOKIE=yes |
| 23 | AC_CHECK_FUNC(fopencookie, [], [HAS_FOPENCOOKIE=no]) |
| 24 | AC_CHECK_MEMBER([cookie_io_functions_t.read], [], [HAS_FOPENCOOKIE=no]) |
| 25 | |
| 26 | HAS_FUNOPEN=yes |
| 27 | AC_CHECK_FUNC(funopen, [], [HAS_FUNOPEN=no]) |
| 28 | |
| 29 | if test "$HAS_FOPENCOOKIE" = yes; then |
| 30 | AC_DEFINE(HAVE_GLIBC_STDIO) |
| 31 | elif test "$HAS_FUNOPEN" = yes; then |
| 32 | AC_DEFINE(HAVE_BSD_STDIO) |
| 33 | else |
| 34 | AC_MSG_ERROR([*** libc support for custom stdio streams is required]) |
| 35 | fi |
| 36 | |
| 37 | AH_TEMPLATE(HAVE_VALGRIND, [define to include debugging support for Valgrind]) |
| 38 | AC_CHECK_HEADER(valgrind/memcheck.h, [AC_DEFINE(HAVE_VALGRIND)], []) |
| 39 | |
| 40 | AH_TEMPLATE(HAVE_EPOLL, [define to enable epoll support]) |
| 41 | AC_ARG_WITH(epoll, AS_HELP_STRING([--with-epoll], [enable epoll(2) support])) |
| 42 | HAS_EPOLL="" |
| 43 | if test "$with_epoll" = no; then HAS_EPOLL=no; fi |
| 44 | if test -z "$HAS_EPOLL"; then |
| 45 | AC_CHECK_LIB(c, epoll_ctl, [:], [HAS_EPOLL=no]) |
| 46 | fi |
| 47 | if test -z "$HAS_EPOLL"; then |
| 48 | AC_CHECK_HEADER(sys/epoll.h, [], [HAS_EPOLL=no]) |
| 49 | fi |
| 50 | if test "$HAS_EPOLL" != no; then HAS_EPOLL=yes; fi |
| 51 | if test "$with_epoll" = yes -a "$HAS_EPOLL" = no; then |
| 52 | AC_MSG_ERROR([*** cannot find epoll support on this system]) |
| 53 | fi |
| 54 | if test "$HAS_EPOLL" = yes; then |
| 55 | AC_DEFINE(HAVE_EPOLL) |
| 56 | fi |
| 57 | |
| 58 | AH_TEMPLATE(HAVE_KQUEUE, [define to enable kqueue support]) |
| 59 | AC_ARG_WITH(kqueue, AS_HELP_STRING([--with-kqueue], [enable kqueue(2) support])) |
| 60 | HAS_KQUEUE="" |
| 61 | if test "$with_kqueue" = no; then HAS_QUEUE=no; fi |
| 62 | if test -z "$HAS_KQUEUE"; then |
| 63 | AC_CHECK_FUNC(kqueue, [], [HAS_KQUEUE=no]) |
| 64 | fi |
| 65 | if test -z "$HAS_KQUEUE"; then |
| 66 | AC_CHECK_HEADER(sys/event.h, [], [HAS_KQUEUE=no]) |
| 67 | fi |
| 68 | if test "$HAS_KQUEUE" != no; then HAS_KQUEUE=yes; fi |
| 69 | if test "$with_kqueue" = yes -a "$HAS_KQUEUE" = no; then |
| 70 | AC_MSG_ERROR([*** cannot find kqueue support on this system]) |
| 71 | fi |
| 72 | if test "$HAS_KQUEUE" = yes; then |
| 73 | AC_DEFINE(HAVE_KQUEUE) |
| 74 | fi |
| 75 | |
| 76 | AM_CONDITIONAL(USE_EPOLL, [test "$HAS_EPOLL" = yes]) |
| 77 | AM_CONDITIONAL(USE_KQUEUE, [test "$HAS_KQUEUE" = yes]) |
| 78 | |
| 79 | AH_TEMPLATE(HAVE_XATTR, [define to compile support for filesystem extended attributes]) |
| 80 | AC_ARG_WITH(xattr, AS_HELP_STRING([--with-xattr], [enable XATTR support])) |
| 81 | HAS_XATTR="" |
| 82 | if test "$with_xattr" = no; then HAS_XATTR=no; fi |
| 83 | if test -z "$HAS_XATTR"; then |
| 84 | AC_CHECK_LIB(attr, getxattr, [:], [HAS_XATTR=no]) |
| 85 | fi |
| 86 | if test -z "$HAS_XATTR"; then |
| 87 | AC_CHECK_HEADER(sys/xattr.h, [], [HAS_XATTR=no]) |
| 88 | fi |
| 89 | if test "$HAS_XATTR" != no; then HAS_XATTR=yes; fi |
| 90 | if test "$with_xattr" = yes -a "$HAS_XATTR" = no; then |
| 91 | AC_MSG_ERROR([*** cannot find xattr support on this system]) |
| 92 | fi |
| 93 | if test "$HAS_XATTR" = yes; then |
| 94 | XATTR_LIBS=-lattr |
| 95 | AC_DEFINE(HAVE_XATTR) |
| 96 | fi |
| 97 | AC_SUBST(XATTR_LIBS) |
| 98 | |
| 99 | AH_TEMPLATE(HAVE_GNUTLS, [define to use the GnuTLS library for SSL support]) |
| 100 | AH_TEMPLATE(HAVE_OPENSSL, [define to use the OpenSSL library for SSL support]) |
| 101 | AC_ARG_WITH(gnutls, AS_HELP_STRING([--with-gnutls], [enable SSL support with the GnuTLS library])) |
| 102 | AC_ARG_WITH(openssl, AS_HELP_STRING([--with-openssl], [enable SSL support with the OpenSSL library])) |
| 103 | HAS_GNUTLS="" |
| 104 | HAS_OPENSSL="" |
| 105 | |
| 106 | if test "$with_gnutls" = no; then HAS_GNUTLS=no; fi |
| 107 | if test -z "$HAS_GNUTLS"; then |
| 108 | AC_CHECK_LIB(gnutls, gnutls_global_init, [:], [HAS_GNUTLS=no]) |
| 109 | fi |
| 110 | if test -z "$HAS_GNUTLS"; then |
| 111 | AC_CHECK_HEADER(gnutls/gnutls.h, [], [HAS_GNUTLS=no]) |
| 112 | fi |
| 113 | if test "$HAS_GNUTLS" != no; then HAS_GNUTLS=yes; fi |
| 114 | if test "$with_gnutls" = yes -a "$HAS_GNUTLS" = no; then |
| 115 | AC_MSG_ERROR([*** cannot find GnuTLS on this system]) |
| 116 | fi |
| 117 | if test "$HAS_GNUTLS" = yes; then |
| 118 | GNUTLS_LIBS=-lgnutls |
| 119 | GNUTLS_CPPFLAGS=-D_GNU_SOURCE |
| 120 | AC_DEFINE(HAVE_GNUTLS) |
| 121 | fi |
| 122 | AC_SUBST(GNUTLS_CPPFLAGS) |
| 123 | AC_SUBST(GNUTLS_LIBS) |
| 124 | |
| 125 | if test "$with_openssl" = no; then |
| 126 | HAS_OPENSSL=no |
| 127 | elif test -z "$with_openssl" -a "$HAS_GNUTLS" = yes; then |
| 128 | HAS_OPENSSL=no |
| 129 | fi |
| 130 | if test -z "$HAS_OPENSSL"; then |
| 131 | AC_CHECK_LIB(ssl, SSL_CTX_new, [:], [HAS_OPENSSL=no]) |
| 132 | fi |
| 133 | if test -z "$HAS_OPENSSL"; then |
| 134 | AC_CHECK_LIB(crypto, ERR_get_error, [:], [HAS_OPENSSL=no]) |
| 135 | fi |
| 136 | if test -z "$HAS_OPENSSL"; then |
| 137 | AC_CHECK_HEADER(openssl/ssl.h, [], [HAS_OPENSSL=no]) |
| 138 | fi |
| 139 | if test "$HAS_OPENSSL" != no; then HAS_OPENSSL=yes; fi |
| 140 | if test "$with_openssl" = yes -a "$HAS_OPENSSL" = no; then |
| 141 | AC_MSG_ERROR([*** cannot find OpenSSL on this system]) |
| 142 | fi |
| 143 | if test "$HAS_OPENSSL" = yes; then |
| 144 | OPENSSL_LIBS="-lssl -lcrypto" |
| 145 | GNUTLS_CPPFLAGS= |
| 146 | AC_DEFINE(HAVE_OPENSSL) |
| 147 | fi |
| 148 | AC_SUBST(OPENSSL_CPPFLAGS) |
| 149 | AC_SUBST(OPENSSL_LIBS) |
| 150 | |
| 151 | if test "$HAS_GNUTLS" = yes -a "$HAS_OPENSSL" = yes; then |
| 152 | AC_MSG_ERROR([*** only one of GnuTLS and OpenSSL must be enabled]) |
| 153 | fi |
| 154 | |
| 155 | AC_CONFIG_FILES([ |
| 156 | Makefile |
| 157 | src/Makefile |
| 158 | src/dirplex/Makefile |
| 159 | lib/Makefile |
| 160 | doc/Makefile |
| 161 | ]) |
| 162 | AC_OUTPUT |