-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
206 lines (187 loc) · 5.87 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
AC_INIT([isync], [1.3.0])
AC_CONFIG_HEADERS([autodefs.h])
AM_INIT_AUTOMAKE
AM_MAINTAINER_MODE
AC_PROG_CC_C99
if test "$GCC" = yes; then
CFLAGS="$CFLAGS -pipe -W -Wall -Wshadow -Wstrict-prototypes -std=c99 -pedantic -Wno-overlength-strings"
fi
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
AC_CACHE_CHECK([whether strftime supports %z], ob_cv_strftime_z,
[AC_TRY_RUN(
[#include <time.h>
#include <string.h>
int main(void)
{
time_t t = 0;
char buf[32];
strftime(buf, sizeof(buf), "%z", localtime(&t));
return !(buf[0] == '+' || buf[0] == '-');
}
], [ob_cv_strftime_z=yes], [ob_cv_strftime_z=no], [ob_cv_strftime_z="yes (assumed)"])])
if test "x$ob_cv_strftime_z" = x"no"; then
AC_MSG_ERROR([libc lacks necessary feature])
fi
AC_CHECK_HEADERS(sys/poll.h sys/select.h)
AC_CHECK_FUNCS(vasprintf strnlen memrchr timegm)
AC_CHECK_LIB(socket, socket, [SOCK_LIBS="-lsocket"])
AC_CHECK_LIB(nsl, inet_ntoa, [SOCK_LIBS="$SOCK_LIBS -lnsl"])
AC_SUBST(SOCK_LIBS)
have_ipv6=true
sav_LIBS=$LIBS
LIBS="$LIBS $SOCK_LIBS"
AC_CHECK_FUNCS(getaddrinfo inet_ntop, , [have_ipv6=false])
LIBS=$sav_LIBS
if $have_ipv6; then
AC_DEFINE(HAVE_IPV6, 1, [if your libc has IPv6 support])
fi
have_ssl_paths=
AC_ARG_WITH(ssl,
AC_HELP_STRING([--with-ssl[=PATH]], [where to look for SSL [detect]]),
[ob_cv_with_ssl=$withval])
if test "x$ob_cv_with_ssl" != xno; then
case $ob_cv_with_ssl in
""|yes)
dnl Detect the pkg-config tool, as it may have extra info about the openssl
dnl installation we can use. I *believe* this is what we are expected to do
dnl on really recent Redhat Linux hosts.
AC_PATH_PROG(PKGCONFIG, pkg-config, no, $PATH:/usr/bin:/usr/local/bin)
if test "$PKGCONFIG" != "no" ; then
AC_MSG_CHECKING([OpenSSL presence with pkg-config])
if $PKGCONFIG --exists openssl; then
SSL_LIBS=`$PKGCONFIG --libs-only-l openssl`
SSL_LDFLAGS=`$PKGCONFIG --libs-only-L openssl`
SSL_CPPFLAGS=`$PKGCONFIG --cflags-only-I openssl`
have_ssl_paths=yes
AC_MSG_RESULT([found])
else
AC_MSG_RESULT([not found])
fi
fi
;;
*)
SSL_LDFLAGS=-L$ob_cv_with_ssl/lib$libsuff
SSL_CPPFLAGS=-I$ob_cv_with_ssl/include
;;
esac
if test -z "$have_ssl_paths"; then
sav_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
AC_CHECK_LIB(dl, dlopen, [LIBDL=-ldl])
AC_CHECK_LIB(crypto, CRYPTO_lock, [LIBCRYPTO=-lcrypto])
AC_CHECK_LIB(ssl, SSL_connect,
[SSL_LIBS="-lssl $LIBCRYPTO $LIBDL" have_ssl_paths=yes])
LDFLAGS=$sav_LDFLAGS
fi
sav_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
AC_CHECK_HEADER(openssl/ssl.h, , [have_ssl_paths=])
CPPFLAGS=$sav_CPPFLAGS
if test -z "$have_ssl_paths"; then
if test -n "$ob_cv_with_ssl"; then
AC_MSG_ERROR([OpenSSL libs and/or includes were not found where specified])
fi
else
AC_DEFINE(HAVE_LIBSSL, 1, [if you have the OpenSSL libraries])
CPPFLAGS="$CPPFLAGS $SSL_CPPFLAGS"
LDFLAGS="$LDFLAGS $SSL_LDFLAGS"
fi
fi
AC_SUBST(SSL_LIBS)
have_sasl_paths=
AC_ARG_WITH(sasl,
AS_HELP_STRING([--with-sasl[=PATH]], [where to look for SASL [detect]]),
[ob_cv_with_sasl=$withval])
if test "x$ob_cv_with_sasl" != xno; then
case $ob_cv_with_sasl in
""|yes)
dnl FIXME: Try various possible paths here...
;;
*)
SASL_LDFLAGS=-L$ob_cv_with_sasl/lib$libsuff
SASL_CPPFLAGS=-I$ob_cv_with_sasl/include
;;
esac
if test -z "$have_sasl_paths"; then
sav_LDFLAGS=$LDFLAGS
LDFLAGS="$LDFLAGS $SASL_LDFLAGS"
AC_CHECK_LIB(sasl2, sasl_client_init,
[SASL_LIBS="-lsasl2" have_sasl_paths=yes])
LDFLAGS=$sav_LDFLAGS
fi
sav_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $SASL_CPPFLAGS"
AC_CHECK_HEADER(sasl/sasl.h, , [have_sasl_paths=])
CPPFLAGS=$sav_CPPFLAGS
if test -z "$have_sasl_paths"; then
if test -n "$ob_cv_with_sasl"; then
AC_MSG_ERROR([SASL libs and/or includes were not found where specified])
fi
else
AC_DEFINE(HAVE_LIBSASL, 1, [if you have the SASL libraries])
CPPFLAGS="$CPPFLAGS $SASL_CPPFLAGS"
LDFLAGS="$LDFLAGS $SASL_LDFLAGS"
fi
fi
AC_SUBST(SASL_LIBS)
AC_CACHE_CHECK([for Berkeley DB >= 4.1], ac_cv_berkdb4,
[ac_cv_berkdb4=no
sav_LIBS=$LIBS
LIBS="$LIBS -ldb"
AC_TRY_LINK([#include <db.h>],
[DB *db;
db_create(&db, 0, 0);
db->truncate(db, 0, 0, 0);
db->open(db, 0, "foo", "foo", DB_HASH, DB_CREATE, 0)],
[ac_cv_berkdb4=yes])
LIBS=$sav_LIBS
])
if test "x$ac_cv_berkdb4" = xyes; then
AC_SUBST([DB_LIBS], ["-ldb"])
AC_DEFINE(USE_DB, 1, [if Berkeley DB should be used])
fi
have_zlib=
AC_ARG_WITH(zlib,
AS_HELP_STRING([--with-zlib], [use zlib [detect]]),
[ob_cv_with_zlib=$withval])
if test "x$ob_cv_with_zlib" != xno; then
AC_CHECK_LIB([z], [deflate],
[AC_CHECK_HEADER(zlib.h,
[have_zlib=1
AC_SUBST([Z_LIBS], ["-lz"])
AC_DEFINE([HAVE_LIBZ], 1, [if you have the zlib library])]
)]
)
fi
AC_ARG_ENABLE(compat,
AC_HELP_STRING([--disable-compat], [don't include isync compatibility wrapper [no]]),
[ob_cv_enable_compat=$enableval])
if test "x$ob_cv_enable_compat" != xno; then
AC_CHECK_FUNCS(getopt_long)
fi
AM_CONDITIONAL(with_compat, test "x$ob_cv_enable_compat" != xno -a "x$ac_cv_berkdb4" = xyes)
AM_CONDITIONAL(with_mdconvert, test "x$ac_cv_berkdb4" = xyes)
AC_CONFIG_FILES([Makefile src/Makefile src/compat/Makefile isync.spec])
AC_OUTPUT
AC_MSG_RESULT()
if test -n "$have_ssl_paths"; then
AC_MSG_RESULT([Using SSL])
else
AC_MSG_RESULT([Not using SSL])
fi
if test -n "$have_sasl_paths"; then
AC_MSG_RESULT([Using SASL])
else
AC_MSG_RESULT([Not using SASL])
fi
if test -n "$have_zlib"; then
AC_MSG_RESULT([Using zlib])
else
AC_MSG_RESULT([Not using zlib])
fi
if test "x$ac_cv_berkdb4" = xyes; then
AC_MSG_RESULT([Using Berkeley DB])
else
AC_MSG_RESULT([Not using Berkeley DB])
fi
AC_MSG_RESULT()