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