configure.ac (10122B)
1 # -*- Autoconf -*- 2 # Process this file with autoconf to produce a configure script. 3 # 4 # This configure file is in the public domain 5 6 AC_PREREQ([2.69]) 7 AC_INIT([sync],[1.1.0],[taler-bug@gnu.org]) 8 AC_CONFIG_SRCDIR([src/sync/sync-httpd.c]) 9 AC_CONFIG_HEADERS([sync_config.h]) 10 # support for non-recursive builds 11 AM_INIT_AUTOMAKE([subdir-objects 1.9 tar-pax]) 12 13 # pretty build rules 14 AM_SILENT_RULES([yes]) 15 16 AC_CONFIG_MACRO_DIR([m4]) 17 AC_PROG_AWK 18 AC_PROG_CC 19 AC_PROG_OBJC 20 AC_PROG_INSTALL 21 AC_PROG_LN_S 22 AC_PROG_MAKE_SET 23 AM_PROG_CC_C_O 24 25 LT_INIT([disable-static]) 26 27 28 DX_INIT_DOXYGEN([sync],,, 29 DX_PS_FEATURE(OFF), 30 DX_PDF_FEATURE(OFF), 31 DX_RTF_FEATURE(OFF), 32 DX_CHI_FEATURE(OFF), 33 DX_XML_FEATURE(OFF)) 34 35 36 AC_CHECK_PROG([DPKG_ARCH], [dpkg-architecture], [yes], [no]) 37 if test "x$DPKG_ARCH" = "xyes"; then 38 MULTIARCH=`dpkg-architecture -qDEB_HOST_MULTIARCH` 39 else 40 MULTIARCH="" 41 fi 42 43 AC_MSG_CHECKING([whether to compile documentation ONLY]) 44 AC_ARG_ENABLE([only-doc], 45 [AS_HELP_STRING([--enable-only-doc], [only compile Taler documentation])], 46 [doc_only=${enableval}], 47 [doc_only=no]) 48 AC_MSG_RESULT($doc_only) 49 AM_CONDITIONAL([DOC_ONLY], [test "$doc_only" = "yes"]) 50 51 52 # Not indented as it covers most of the file... 53 AS_IF([test "x$doc_only" != xyes],[ 54 55 56 # Checks for programs. 57 AC_PROG_CC 58 59 # Force some CFLAGS 60 CFLAGS="-Wall -Wno-address-of-packed-member $CFLAGS" 61 62 # Checks for header files. 63 AC_CHECK_HEADERS([stdint.h stdlib.h string.h unistd.h]) 64 65 66 # Check for Taler's libtalermerchant 67 libtalermerchant=0 68 AC_MSG_CHECKING([for libtalermerchant]) 69 AC_ARG_WITH(merchant, 70 [AS_HELP_STRING([--with-merchant=PFX], [base of Taler MERCHANT installation])], 71 [AC_MSG_RESULT([given as $with_merchant])], 72 [AC_MSG_RESULT(not given) 73 with_merchant=yes]) 74 AS_CASE([$with_merchant], 75 [yes], [], 76 [no], [AC_MSG_ERROR([--with-merchant is required])], 77 [LDFLAGS="-L$with_merchant/lib/$MULTIARCH -L$with_merchant/lib/ $LDFLAGS" 78 CPPFLAGS="-I$with_merchant/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) 79 80 AC_CHECK_HEADERS([taler/taler_merchant_service.h], 81 [AC_CHECK_LIB([talermerchant], [TALER_MERCHANT_poll_payment], libtalermerchant=1)], 82 [], [#ifdef HAVE_TALER_PLATFORM_H 83 #include <taler/platform.h> 84 #endif]) 85 86 87 # Check for GNUnet's libgnunetutil. 88 libgnunetutil=0 89 AC_MSG_CHECKING([for libgnunetutil]) 90 AC_ARG_WITH(gnunet, 91 [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])], 92 [AC_MSG_RESULT([given as $with_gnunet])], 93 [AC_MSG_RESULT(not given) 94 with_gnunet=yes]) 95 AS_CASE([$with_gnunet], 96 [yes], [], 97 [no], [AC_MSG_ERROR([--with-gnunet is required])], 98 [LDFLAGS="-L$with_gnunet/lib/$MULTIARCH -L$with_gnunet/lib/ $LDFLAGS" 99 CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"]) 100 AC_CHECK_HEADERS([gnunet/gnunet_util_lib.h], 101 [AC_CHECK_LIB([gnunetutil], [GNUNET_SCHEDULER_run], libgnunetutil=1)]) 102 AS_IF([test $libgnunetutil != 1], 103 [AC_MSG_ERROR([[ 104 *** 105 *** You need libgnunetutil to build this program. 106 *** This library is part of GNUnet, available at 107 *** https://gnunet.org 108 *** ]])]) 109 110 111 AC_CHECK_HEADERS([taler/taler_mhd_lib.h], 112 [AC_CHECK_LIB([talermhd], [TALER_MHD_listen_bind], libtalermhd=1)]) 113 AM_CONDITIONAL(HAVE_TALERMHD, test x$libtalermhd = x1) 114 AS_IF([test $libtalermhd != 1], 115 [AC_MSG_ERROR([[ 116 *** 117 *** You need libtalermhd >= 1.1.0 (API v6) to build this program. 118 *** This library is part of the GNU Taler exchange, available at 119 *** https://taler.net 120 *** ]])]) 121 122 123 124 # test for postgres 125 AX_LIB_POSTGRESQL([15]) 126 AS_IF([test "x$found_postgresql" = "xyes"],[postgres=true]) 127 AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue) 128 129 SYNC_LIB_LDFLAGS="-export-dynamic -no-undefined" 130 SYNC_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined" 131 132 AC_SUBST(SYNC_LIB_LDFLAGS) 133 AC_SUBST(SYNC_PLUGIN_LDFLAGS) 134 135 # Check for Taler's libtalerpq 136 libtalerpq=0 137 AC_MSG_CHECKING([for libtalerpq]) 138 AC_ARG_WITH(exchange, 139 [AS_HELP_STRING([--with-exchange=PFX], [base of Taler EXCHANGE installation])], 140 [AC_MSG_RESULT([given as $with_exchange])], 141 [AC_MSG_RESULT(not given) 142 with_exchange=yes]) 143 AS_CASE([$with_exchange], 144 [yes], [], 145 [no], [AC_MSG_ERROR([--with-exchange is required])], 146 [LDFLAGS="-L$with_exchange/lib/$MULTIARCH -L$with_exchange/lib/ $LDFLAGS" 147 CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) 148 149 CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS" 150 151 AC_CHECK_HEADERS([gnunet/gnunet_pq_lib.h], 152 [AC_CHECK_LIB([gnunetpq], [GNUNET_PQ_connect_with_cfg], libgnunetpq=1)]) 153 AM_CONDITIONAL(HAVE_GNUNETPQ, test x$libgnunetpq = x1) 154 155 156 157 158 # check for libmicrohttpd 159 microhttpd=0 160 AC_MSG_CHECKING([for microhttpd]) 161 AC_ARG_WITH([microhttpd], 162 [AS_HELP_STRING([--with-microhttpd=PFX], [base of microhttpd installation])], 163 [AC_MSG_RESULT([given as $with_microhttpd])], 164 [AC_MSG_RESULT([not given]) 165 with_microhttpd=yes]) 166 AS_CASE([$with_microhttpd], 167 [yes], [], 168 [no], [AC_MSG_ERROR([--with-microhttpd is required])], 169 [LDFLAGS="-L$with_microhttpd/lib/$MULTIARCH -L$with_microhttpd/lib/ $LDFLAGS" 170 CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS"]) 171 AC_CHECK_LIB(microhttpd,MHD_start_daemon, 172 [AC_CHECK_HEADER([microhttpd.h],[microhttpd=1])]) 173 AS_IF([test $microhttpd = 0], 174 [AC_MSG_ERROR([[ 175 *** 176 *** You need libmicrohttpd to build this program. 177 *** ]])]) 178 179 180 # check for libmicrohttpd2 181 AC_MSG_CHECKING([for microhttpd2]) 182 AC_ARG_WITH([microhttpd2], 183 [AS_HELP_STRING([--with-microhttpd2=PFX], [base of libmicrohttpd2 installation])], 184 [AC_MSG_RESULT([given as $with_microhttpd2])], 185 [AC_MSG_RESULT([not given]) 186 with_microhttpd2=yes]) 187 AS_CASE([$with_microhttpd2], 188 [yes],[], 189 [no],[], 190 [LDFLAGS="-L$with_microhttpd2/lib/$MULTIARCH -L$with_microhttpd2/lib/ $LDFLAGS" 191 CPPFLAGS="-I$with_microhttpd2/include $CPPFLAGS"]) 192 MHD2_VERSION_AT_LEAST([1.99.0]) 193 194 195 196 jansson=0 197 PKG_CHECK_MODULES([JANSSON], [jansson >= 2.3], 198 [LDFLAGS="$JANSSON_LIBS $LDFLAGS" 199 CPPFLAGS="$JANSSON_CFLAGS $CPPFLAGS"], 200 [AC_MSG_ERROR([[ 201 *** 202 *** You need libjansson to build this program. 203 ***]])]) 204 205 # libcurl-gnutls 206 AC_CHECK_LIB([curl], 207 [curl_easy_getinfo], 208 [LIBCURL="-lcurl" 209 curl_gnutls=1], 210 [curl_gnutls=0]) 211 LIBCURL_CHECK_CONFIG([],[7.34.0],[curl=true],[curl=false]) 212 # Check for curl/curl.h 213 AC_CHECK_HEADERS([curl/curl.h],, 214 curl=false) 215 216 AS_IF([test x$curl = xfalse], 217 [AC_MSG_ERROR([sync requires libcurl-gnutls >= 7.34])]) 218 219 # gcov compilation 220 AC_MSG_CHECKING(whether to compile with support for code coverage analysis) 221 AC_ARG_ENABLE([coverage], 222 AS_HELP_STRING([--enable-coverage], 223 [compile the library with code coverage support]), 224 [use_gcov=${enableval}], 225 [use_gcov=no]) 226 AC_MSG_RESULT($use_gcov) 227 AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"]) 228 229 # Require minimum libgcrypt version 230 need_libgcrypt_version=1.6.1 231 AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], ["$need_libgcrypt_version"], 232 [minimum version of libgcrypt required]) 233 AM_PATH_LIBGCRYPT([$need_libgcrypt_version]) 234 235 # logging 236 extra_logging=0 237 AC_ARG_ENABLE([logging], 238 AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose ('yes' is the default)]), 239 [AS_IF([test "x$enableval" = "xyes"], [], 240 [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])], 241 [test "x$enableval" = "xverbose"], [extra_logging=1] 242 [test "x$enableval" = "xveryverbose"], [extra_logging=2]) 243 ], []) 244 AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise]) 245 246 # version info 247 AC_PATH_PROG(gitcommand, git) 248 AC_MSG_CHECKING(for source being under a VCS) 249 git_version= 250 AS_IF([test ! "X$gitcommand" = "X"], 251 [ 252 git_version=$(cd $srcdir ; git rev-list --full-history --all --abbrev-commit | head -n 1 2>/dev/null) 253 ]) 254 AS_IF([test "X$git_version" = "X"], 255 [ 256 vcs_name="no" 257 vcs_version="\"release\"" 258 ], 259 [ 260 vcs_name="yes, git-svn" 261 vcs_version="\"git-$git_version\"" 262 ]) 263 AC_MSG_RESULT($vcs_name) 264 265 AC_MSG_CHECKING(VCS version) 266 AC_MSG_RESULT($vcs_version) 267 AC_DEFINE_UNQUOTED(VCS_VERSION, [$vcs_version], [VCS revision/hash or tarball version]) 268 269 # Checks for typedefs, structures, and compiler characteristics. 270 AC_TYPE_PID_T 271 AC_TYPE_SIZE_T 272 AC_TYPE_UINT16_T 273 AC_TYPE_UINT32_T 274 AC_TYPE_UINT64_T 275 AC_TYPE_INTMAX_T 276 AC_TYPE_UINTMAX_T 277 278 # Checks for library functions. 279 AC_CHECK_FUNCS([strdup]) 280 281 282 AC_ARG_ENABLE([[doc]], 283 [AS_HELP_STRING([[--disable-doc]], [do not build any documentation])], , 284 [enable_doc=yes]) 285 test "x$enable_doc" = "xno" || enable_doc=yes 286 AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = "xyes"]) 287 288 289 ],[ # this is about the doc-only if on top of the file 290 291 # logic if doc_only is set, make sure conditionals are still defined 292 AM_CONDITIONAL([HAVE_MHD2], [false]) 293 AM_CONDITIONAL([HAVE_GNUNETPQ], [false]) 294 AM_CONDITIONAL([HAVE_POSTGRESQL], [false]) 295 AM_CONDITIONAL([HAVE_TALERMHD], [false]) 296 AM_CONDITIONAL([USE_COVERAGE], [false]) 297 AM_CONDITIONAL([ENABLE_DOC], [true]) 298 299 300 # end of 'doc_only' 301 ]) 302 303 304 # should experimental code be compiled (code that may not yet compile / have passing test cases)? 305 AC_MSG_CHECKING(whether to compile experimental code) 306 AC_ARG_ENABLE([experimental], 307 [AS_HELP_STRING([--enable-experimental], [enable compiling experimental code])], 308 [enable_experimental=${enableval}], 309 [enable_experimental=no]) 310 AC_MSG_RESULT($enable_experimental) 311 AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"]) 312 313 314 AC_CONFIG_FILES([Makefile 315 contrib/Makefile 316 doc/Makefile 317 doc/doxygen/Makefile 318 src/Makefile 319 src/include/Makefile 320 src/lib/Makefile 321 src/util/Makefile 322 src/sync/Makefile 323 src/syncdb/Makefile 324 src/testing/Makefile 325 ]) 326 AC_OUTPUT