summaryrefslogtreecommitdiff
path: root/configure.ac
blob: 7cb66270fba986692fc88407dcdaee2e4114a2e1 (plain)
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#
# This configure file is in the public domain

AC_PREREQ([2.69])
AC_INIT([sync], [0.8.3], [taler-bug@gnu.org])
AC_CONFIG_SRCDIR([src/sync/sync-httpd.c])
AC_CONFIG_HEADERS([sync_config.h])
# support for non-recursive builds
AM_INIT_AUTOMAKE([subdir-objects 1.9 tar-pax])

# pretty build rules
AM_SILENT_RULES([yes])

AC_CONFIG_MACRO_DIR([m4])
AC_PROG_AWK
AC_PROG_CC_C99
AC_PROG_OBJC
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AM_PROG_CC_C_O

LT_INIT([disable-static])


DX_INIT_DOXYGEN([sync],,,
DX_PS_FEATURE(OFF),
DX_PDF_FEATURE(OFF),
DX_RTF_FEATURE(OFF),
DX_CHI_FEATURE(OFF),
DX_XML_FEATURE(OFF))

AC_MSG_CHECKING([whether to compile documentation ONLY])
AC_ARG_ENABLE([only-doc],
  [AS_HELP_STRING([--enable-only-doc], [only compile Taler documentation])],
  [doc_only=${enableval}],
  [doc_only=no])
AC_MSG_RESULT($doc_only)
AM_CONDITIONAL([DOC_ONLY], [test "$doc_only" = "yes"])


# Not indented as it covers most of the file...
AS_IF([test "x$doc_only" != xyes],[


# Checks for programs.
AC_PROG_CC
AC_PROG_CC_C99

# Force some CFLAGS
CFLAGS="-Wall -Wno-address-of-packed-member $CFLAGS"

# Checks for header files.
AC_CHECK_HEADERS([stdint.h stdlib.h string.h unistd.h])


# Check for Taler's libtalermerchant
libtalermerchant=0
AC_MSG_CHECKING([for libtalermerchant])
AC_ARG_WITH(merchant,
            [AS_HELP_STRING([--with-merchant=PFX], [base of Taler MERCHANT installation])],
            [AC_MSG_RESULT([given as $with_merchant])],
            [AC_MSG_RESULT(not given)
             with_merchant=yes])
AS_CASE([$with_merchant],
        [yes], [],
        [no], [AC_MSG_ERROR([--with-merchant is required])],
        [LDFLAGS="-L$with_merchant/lib $LDFLAGS"
         CPPFLAGS="-I$with_merchant/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"])

AC_CHECK_HEADERS([taler/taler_merchant_service.h],
 [AC_CHECK_LIB([talermerchant], [TALER_MERCHANT_poll_payment], libtalermerchant=1)],
   [], [#ifdef HAVE_TALER_PLATFORM_H
        #include <taler/platform.h>
       #endif])


# Check for GNUnet's libgnunetutil.
libgnunetutil=0
AC_MSG_CHECKING([for libgnunetutil])
AC_ARG_WITH(gnunet,
            [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])],
            [AC_MSG_RESULT([given as $with_gnunet])],
            [AC_MSG_RESULT(not given)
             with_gnunet=yes])
AS_CASE([$with_gnunet],
        [yes], [],
        [no], [AC_MSG_ERROR([--with-gnunet is required])],
        [LDFLAGS="-L$with_gnunet/lib $LDFLAGS"
         CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"])
AC_CHECK_HEADERS([gnunet/platform.h gnunet/gnunet_util_lib.h],
 [AC_CHECK_LIB([gnunetutil], [GNUNET_SCHEDULER_run], libgnunetutil=1)],
  [], [#ifdef HAVE_GNUNET_PLATFORM_H
        #include <gnunet/platform.h>
       #endif])
AS_IF([test $libgnunetutil != 1],
  [AC_MSG_ERROR([[
***
*** You need libgnunetutil to build this program.
*** This library is part of GNUnet, available at
***   https://gnunet.org
*** ]])])


# test for postgres
AX_LIB_POSTGRESQL([9.3])
AS_IF([test "x$found_postgresql" = "xyes"],[postgres=true])
AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue)

SYNC_LIB_LDFLAGS="-export-dynamic -no-undefined"
SYNC_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined"

AC_SUBST(SYNC_LIB_LDFLAGS)
AC_SUBST(SYNC_PLUGIN_LDFLAGS)

# Check for Taler's libtalerpq
libtalerpq=0
AC_MSG_CHECKING([for libtalerpq])
AC_ARG_WITH(exchange,
            [AS_HELP_STRING([--with-exchange=PFX], [base of Taler EXCHANGE installation])],
            [AC_MSG_RESULT([given as $with_exchange])],
            [AC_MSG_RESULT(not given)
             with_exchange=yes])
AS_CASE([$with_exchange],
        [yes], [],
        [no], [AC_MSG_ERROR([--with-exchange is required])],
        [LDFLAGS="-L$with_exchange/lib $LDFLAGS"
         CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"])

CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS"
LDFLAGS="$LDFLAGS -L/usr/local/lib"

AC_CHECK_HEADERS([gnunet/gnunet_pq_lib.h],
 [AC_CHECK_LIB([gnunetpq], [GNUNET_PQ_connect_with_cfg], libgnunetpq=1)],
   [], [#ifdef HAVE_GNUNET_PLATFORM_H
        #include <gnunet/platform.h>
       #endif])
AM_CONDITIONAL(HAVE_GNUNETPQ, test x$libgnunetpq = x1)




# check for libmicrohttpd
microhttpd=0
AC_MSG_CHECKING([for microhttpd])
AC_ARG_WITH([microhttpd],
            [AS_HELP_STRING([--with-microhttpd=PFX], [base of microhttpd installation])],
            [AC_MSG_RESULT([given as $with_microhttpd])],
            [AC_MSG_RESULT([not given])
             with_microhttpd=yes])
AS_CASE([$with_microhttpd],
        [yes], [],
        [no], [AC_MSG_ERROR([--with-microhttpd is required])],
        [LDFLAGS="-L$with_microhttpd/lib $LDFLAGS"
         CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS"])
AC_CHECK_LIB(microhttpd,MHD_start_daemon,
  [AC_CHECK_HEADER([microhttpd.h],[microhttpd=1])])
AS_IF([test $microhttpd = 0],
  [AC_MSG_ERROR([[
***
*** You need libmicrohttpd to build this program.
*** ]])])

jansson=0
PKG_CHECK_MODULES([JANSSON], [jansson >= 2.3],
                  [LDFLAGS="$JANSSON_LIBS $LDFLAGS"
                   CPPFLAGS="$JANSSON_CFLAGS $CPPFLAGS"],
                  [AC_MSG_ERROR([[
***
*** You need libjansson to build this program.
***]])])

# check for libgnurl
# libgnurl
LIBGNURL_CHECK_CONFIG(,7.34.0,gnurl=1,gnurl=0)
AS_IF([test "x$gnurl" = x1],[
	AM_CONDITIONAL(HAVE_LIBGNURL, true)
	AC_DEFINE([HAVE_LIBGNURL],[1],[Have libgnurl])
],[
	AM_CONDITIONAL(HAVE_LIBGNURL, false)
])

# libcurl-gnutls
LIBCURL_CHECK_CONFIG(,7.34.0,[curl=true],[curl=false])
AS_IF([test "x$curl" = xtrue],
      [LDFLAGS="-L$with_libcurl/lib $LDFLAGS"
       CPPFLAGS="-I$with_libcurl/include $CPPFLAGS"
       AC_CHECK_HEADERS([curl/curl.h],
                        [AC_CHECK_DECLS(CURLINFO_TLS_SESSION,
                         [curl=true],
                         [curl=false],
                         [[#include <curl/curl.h>]])],
                        [curl=false])
       # need libcurl-gnutls.so, everything else is not acceptable
       AC_CHECK_LIB([curl-gnutls],
                    [curl_easy_getinfo],,
                    [curl=false])])
       # cURL must support CURLINFO_TLS_SESSION, version >= 7.34

# Check for curl/curl.h and gnurl/curl.h so we can use #ifdef
# HAVE_CURL_CURL_H later (the above LIBCURL_CHECK_CONFIG accepted
# *either* header set).
AC_CHECK_HEADERS([curl/curl.h],,
  curl=false
  AC_CHECK_HEADERS([gnurl/curl.h],,
  gnurl=false))

# libgnurl
AS_IF([test "x$gnurl" = "x0"],
      [AS_IF([test "x$curl" = "x0"],
              [AC_MSG_NOTICE([NOTICE: libgnurl not found. taler-bank support will not be compiled.])],
              [AC_MSG_NOTICE([WARNING: libgnurl not found, trying to use libcurl-gnutls instead.])])])

AS_IF([test x$curl = xfalse],
       [AM_CONDITIONAL(HAVE_LIBCURL, false)
        AS_IF([test "x$gnurl" = "x0"],
              [AC_MSG_WARN([GNU Taler requires libcurl-gnutls  >= 7.34])])],
       [AM_CONDITIONAL(HAVE_LIBCURL, true)
	AC_DEFINE([HAVE_LIBCURL],[1],[Have CURL])])

# check for libtalertwistertesting
twistertesting=0
AC_MSG_CHECKING([for talerwtistertesting])
AC_ARG_WITH([twister],
            [AS_HELP_STRING([--with-twister=PFX], [base of libtalertwistertesting])],
            [AC_MSG_RESULT([given as $with_twister])],
            [AC_MSG_RESULT([not given])
             with_twister=yes])
AS_CASE([$with_twister],
        [yes], [],
        [no], [AC_MSG_WARN([no twister-testing will be compiled])],
        [LDFLAGS="-L$with_twister/lib $LDFLAGS"
         CPPFLAGS="-I$with_twister/include $CPPFLAGS"])

AC_CHECK_HEADERS([taler/taler_twister_testing_lib.h],
 [AC_CHECK_LIB([talertwistertesting], [TALER_TESTING_run_twister], twistertesting=1,, [-ltalerexchange -ltalerbank])],
   [], [#ifdef HAVE_GNUNET_PLATFORM_H
        #include <gnunet/platform.h>
       #endif])
AM_CONDITIONAL(HAVE_TWISTER, test x$twistertesting = x1)

# gcov compilation
AC_MSG_CHECKING(whether to compile with support for code coverage analysis)
AC_ARG_ENABLE([coverage],
              AS_HELP_STRING([--enable-coverage],
                             [compile the library with code coverage support]),
              [use_gcov=${enableval}],
              [use_gcov=no])
AC_MSG_RESULT($use_gcov)
AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])

# Require minimum libgcrypt version
need_libgcrypt_version=1.6.1
AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], ["$need_libgcrypt_version"],
                                             [minimum version of libgcrypt required])
AM_PATH_LIBGCRYPT([$need_libgcrypt_version])

# logging
extra_logging=0
AC_ARG_ENABLE([logging],
   AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose ('yes' is the default)]),
   [AS_IF([test "x$enableval" = "xyes"], [],
          [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])],
          [test "x$enableval" = "xverbose"], [extra_logging=1]
          [test "x$enableval" = "xveryverbose"], [extra_logging=2])
   ], [])
AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise])

# version info
AC_PATH_PROG(gitcommand, git)
AC_MSG_CHECKING(for source being under a VCS)
git_version=
AS_IF([test ! "X$gitcommand" = "X"],
[
  git_version=$(cd $srcdir ; git rev-list --full-history --all --abbrev-commit | head -n 1 2>/dev/null)
])
AS_IF([test "X$git_version" = "X"],
  [
    vcs_name="no"
    vcs_version="\"release\""
  ],
  [
    vcs_name="yes, git-svn"
    vcs_version="\"git-$git_version\""
  ])
AC_MSG_RESULT($vcs_name)

AC_MSG_CHECKING(VCS version)
AC_MSG_RESULT($vcs_version)
AC_DEFINE_UNQUOTED(VCS_VERSION, [$vcs_version], [VCS revision/hash or tarball version])

# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_INTMAX_T
AC_TYPE_UINTMAX_T

# Checks for library functions.
AC_CHECK_FUNCS([strdup])


AC_ARG_ENABLE([[doc]],
  [AS_HELP_STRING([[--disable-doc]], [do not build any documentation])], ,
    [enable_doc=yes])
test "x$enable_doc" = "xno" || enable_doc=yes
AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = "xyes"])


],[  # this is about the doc-only if on top of the file

# logic if doc_only is set, make sure conditionals are still defined
AM_CONDITIONAL([HAVE_GNUNETPQ], [false])
AM_CONDITIONAL([HAVE_POSTGRESQL], [false])
AM_CONDITIONAL([HAVE_LIBCURL], [false])
AM_CONDITIONAL([HAVE_LIBGNURL], [false])
AM_CONDITIONAL([USE_COVERAGE], [false])
AM_CONDITIONAL([ENABLE_DOC], [true])
AM_CONDITIONAL([HAVE_TWISTER], [true])


# end of 'doc_only'
])


# should experimental code be compiled (code that may not yet compile / have passing test cases)?
AC_MSG_CHECKING(whether to compile experimental code)
AC_ARG_ENABLE([experimental],
   [AS_HELP_STRING([--enable-experimental], [enable compiling experimental code])],
   [enable_experimental=${enableval}],
   [enable_experimental=no])
AC_MSG_RESULT($enable_experimental)
AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"])


AC_CONFIG_FILES([Makefile
doc/Makefile
src/Makefile
src/include/Makefile
src/lib/Makefile
src/util/Makefile
src/sync/Makefile
src/syncdb/Makefile
src/testing/Makefile
])
AC_OUTPUT