configure.ac (10110B)
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.5.1],[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 [], []) 83 84 85 # Check for GNUnet's libgnunetutil. 86 libgnunetutil=0 87 AC_MSG_CHECKING([for libgnunetutil]) 88 AC_ARG_WITH(gnunet, 89 [AS_HELP_STRING([--with-gnunet=PFX], [base of GNUnet installation])], 90 [AC_MSG_RESULT([given as $with_gnunet])], 91 [AC_MSG_RESULT(not given) 92 with_gnunet=yes]) 93 AS_CASE([$with_gnunet], 94 [yes], [], 95 [no], [AC_MSG_ERROR([--with-gnunet is required])], 96 [LDFLAGS="-L$with_gnunet/lib/$MULTIARCH -L$with_gnunet/lib/ $LDFLAGS" 97 CPPFLAGS="-I$with_gnunet/include $CPPFLAGS"]) 98 AC_CHECK_HEADERS([gnunet/gnunet_util_lib.h], 99 [AC_CHECK_LIB([gnunetutil], [GNUNET_SCHEDULER_run], libgnunetutil=1)]) 100 AS_IF([test $libgnunetutil != 1], 101 [AC_MSG_ERROR([[ 102 *** 103 *** You need libgnunetutil to build this program. 104 *** This library is part of GNUnet, available at 105 *** https://gnunet.org 106 *** ]])]) 107 108 109 AC_CHECK_HEADERS([taler/taler_mhd_lib.h], 110 [AC_CHECK_LIB([talermhd], [TALER_MHD_listen_bind], libtalermhd=1)]) 111 AM_CONDITIONAL(HAVE_TALERMHD, test x$libtalermhd = x1) 112 AS_IF([test $libtalermhd != 1], 113 [AC_MSG_ERROR([[ 114 *** 115 *** You need libtalermhd >= 1.1.0 (API v6) to build this program. 116 *** This library is part of the GNU Taler exchange, available at 117 *** https://taler.net 118 *** ]])]) 119 120 121 122 # test for postgres 123 AX_LIB_POSTGRESQL([15]) 124 AS_IF([test "x$found_postgresql" = "xyes"],[postgres=true]) 125 AM_CONDITIONAL(HAVE_POSTGRESQL, test x$postgres = xtrue) 126 127 SYNC_LIB_LDFLAGS="-export-dynamic -no-undefined" 128 SYNC_PLUGIN_LDFLAGS="-export-dynamic -avoid-version -module -no-undefined" 129 130 AC_SUBST(SYNC_LIB_LDFLAGS) 131 AC_SUBST(SYNC_PLUGIN_LDFLAGS) 132 133 # Check for Taler's libtalerpq 134 libtalerpq=0 135 AC_MSG_CHECKING([for libtalerpq]) 136 AC_ARG_WITH(exchange, 137 [AS_HELP_STRING([--with-exchange=PFX], [base of Taler EXCHANGE installation])], 138 [AC_MSG_RESULT([given as $with_exchange])], 139 [AC_MSG_RESULT(not given) 140 with_exchange=yes]) 141 AS_CASE([$with_exchange], 142 [yes], [], 143 [no], [AC_MSG_ERROR([--with-exchange is required])], 144 [LDFLAGS="-L$with_exchange/lib/$MULTIARCH -L$with_exchange/lib/ $LDFLAGS" 145 CPPFLAGS="-I$with_exchange/include $CPPFLAGS $POSTGRESQL_CPPFLAGS"]) 146 147 CPPFLAGS="$CPPFLAGS $POSTGRESQL_CPPFLAGS" 148 149 AC_CHECK_HEADERS([gnunet/gnunet_pq_lib.h], 150 [AC_CHECK_LIB([gnunetpq], [GNUNET_PQ_connect_with_cfg], libgnunetpq=1)]) 151 AM_CONDITIONAL(HAVE_GNUNETPQ, test x$libgnunetpq = x1) 152 153 154 155 156 # check for libmicrohttpd 157 microhttpd=0 158 AC_MSG_CHECKING([for microhttpd]) 159 AC_ARG_WITH([microhttpd], 160 [AS_HELP_STRING([--with-microhttpd=PFX], [base of microhttpd installation])], 161 [AC_MSG_RESULT([given as $with_microhttpd])], 162 [AC_MSG_RESULT([not given]) 163 with_microhttpd=yes]) 164 AS_CASE([$with_microhttpd], 165 [yes], [], 166 [no], [AC_MSG_ERROR([--with-microhttpd is required])], 167 [LDFLAGS="-L$with_microhttpd/lib/$MULTIARCH -L$with_microhttpd/lib/ $LDFLAGS" 168 CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS"]) 169 AC_CHECK_LIB(microhttpd,MHD_start_daemon, 170 [AC_CHECK_HEADER([microhttpd.h],[microhttpd=1])]) 171 AS_IF([test $microhttpd = 0], 172 [AC_MSG_ERROR([[ 173 *** 174 *** You need libmicrohttpd to build this program. 175 *** ]])]) 176 177 178 # check for libmicrohttpd2 179 AC_MSG_CHECKING([for microhttpd2]) 180 AC_ARG_WITH([microhttpd2], 181 [AS_HELP_STRING([--with-microhttpd2=PFX], [base of libmicrohttpd2 installation])], 182 [AC_MSG_RESULT([given as $with_microhttpd2])], 183 [AC_MSG_RESULT([not given]) 184 with_microhttpd2=yes]) 185 AS_CASE([$with_microhttpd2], 186 [yes],[], 187 [no],[], 188 [LDFLAGS="-L$with_microhttpd2/lib/$MULTIARCH -L$with_microhttpd2/lib/ $LDFLAGS" 189 CPPFLAGS="-I$with_microhttpd2/include $CPPFLAGS"]) 190 MHD2_VERSION_AT_LEAST([1.99.0]) 191 192 193 194 jansson=0 195 PKG_CHECK_MODULES([JANSSON], [jansson >= 2.3], 196 [LDFLAGS="$JANSSON_LIBS $LDFLAGS" 197 CPPFLAGS="$JANSSON_CFLAGS $CPPFLAGS"], 198 [AC_MSG_ERROR([[ 199 *** 200 *** You need libjansson to build this program. 201 ***]])]) 202 203 # libcurl-gnutls 204 AC_CHECK_LIB([curl], 205 [curl_easy_getinfo], 206 [LIBCURL="-lcurl" 207 curl_gnutls=1], 208 [curl_gnutls=0]) 209 LIBCURL_CHECK_CONFIG([],[7.34.0],[curl=true],[curl=false]) 210 # Check for curl/curl.h 211 AC_CHECK_HEADERS([curl/curl.h],, 212 curl=false) 213 214 AS_IF([test x$curl = xfalse], 215 [AC_MSG_ERROR([sync requires libcurl-gnutls >= 7.34])]) 216 217 # gcov compilation 218 AC_MSG_CHECKING(whether to compile with support for code coverage analysis) 219 AC_ARG_ENABLE([coverage], 220 AS_HELP_STRING([--enable-coverage], 221 [compile the library with code coverage support]), 222 [use_gcov=${enableval}], 223 [use_gcov=no]) 224 AC_MSG_RESULT($use_gcov) 225 AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"]) 226 227 # Require minimum libgcrypt version 228 need_libgcrypt_version=1.6.1 229 AC_DEFINE_UNQUOTED([NEED_LIBGCRYPT_VERSION], ["$need_libgcrypt_version"], 230 [minimum version of libgcrypt required]) 231 AM_PATH_LIBGCRYPT([$need_libgcrypt_version]) 232 233 # logging 234 extra_logging=0 235 AC_ARG_ENABLE([logging], 236 AS_HELP_STRING([--enable-logging@<:@=value@:>@],[Enable logging calls. Possible values: yes,no,verbose ('yes' is the default)]), 237 [AS_IF([test "x$enableval" = "xyes"], [], 238 [test "x$enableval" = "xno"], [AC_DEFINE([GNUNET_CULL_LOGGING],[],[Define to cull all logging calls])], 239 [test "x$enableval" = "xverbose"], [extra_logging=1] 240 [test "x$enableval" = "xveryverbose"], [extra_logging=2]) 241 ], []) 242 AC_DEFINE_UNQUOTED([GNUNET_EXTRA_LOGGING],[$extra_logging],[1 if extra logging is enabled, 2 for very verbose extra logging, 0 otherwise]) 243 244 # version info 245 AC_PATH_PROG(gitcommand, git) 246 AC_MSG_CHECKING(for source being under a VCS) 247 git_version= 248 AS_IF([test ! "X$gitcommand" = "X"], 249 [ 250 git_version=$(cd $srcdir ; git rev-list --full-history --all --abbrev-commit | head -n 1 2>/dev/null) 251 ]) 252 AS_IF([test "X$git_version" = "X"], 253 [ 254 vcs_name="no" 255 vcs_version="\"release\"" 256 ], 257 [ 258 vcs_name="yes, git-svn" 259 vcs_version="\"git-$git_version\"" 260 ]) 261 AC_MSG_RESULT($vcs_name) 262 263 AC_MSG_CHECKING(VCS version) 264 AC_MSG_RESULT($vcs_version) 265 AC_DEFINE_UNQUOTED(VCS_VERSION, [$vcs_version], [VCS revision/hash or tarball version]) 266 267 # Checks for typedefs, structures, and compiler characteristics. 268 AC_TYPE_PID_T 269 AC_TYPE_SIZE_T 270 AC_TYPE_UINT16_T 271 AC_TYPE_UINT32_T 272 AC_TYPE_UINT64_T 273 AC_TYPE_INTMAX_T 274 AC_TYPE_UINTMAX_T 275 276 # Checks for library functions. 277 AC_CHECK_FUNCS([strdup]) 278 279 280 AC_ARG_ENABLE([[doc]], 281 [AS_HELP_STRING([[--disable-doc]], [do not build any documentation])], , 282 [enable_doc=yes]) 283 test "x$enable_doc" = "xno" || enable_doc=yes 284 AM_CONDITIONAL([ENABLE_DOC], [test "x$enable_doc" = "xyes"]) 285 286 287 ],[ # this is about the doc-only if on top of the file 288 289 # logic if doc_only is set, make sure conditionals are still defined 290 AM_CONDITIONAL([HAVE_MHD2], [false]) 291 AM_CONDITIONAL([HAVE_GNUNETPQ], [false]) 292 AM_CONDITIONAL([HAVE_POSTGRESQL], [false]) 293 AM_CONDITIONAL([HAVE_TALERMHD], [false]) 294 AM_CONDITIONAL([USE_COVERAGE], [false]) 295 AM_CONDITIONAL([ENABLE_DOC], [true]) 296 297 298 # end of 'doc_only' 299 ]) 300 301 302 # should experimental code be compiled (code that may not yet compile / have passing test cases)? 303 AC_MSG_CHECKING(whether to compile experimental code) 304 AC_ARG_ENABLE([experimental], 305 [AS_HELP_STRING([--enable-experimental], [enable compiling experimental code])], 306 [enable_experimental=${enableval}], 307 [enable_experimental=no]) 308 AC_MSG_RESULT($enable_experimental) 309 AM_CONDITIONAL([HAVE_EXPERIMENTAL], [test "x$enable_experimental" = "xyes"]) 310 311 312 AC_CONFIG_FILES([Makefile 313 contrib/Makefile 314 doc/Makefile 315 doc/doxygen/Makefile 316 src/Makefile 317 src/include/Makefile 318 src/include/sync/Makefile 319 src/include/sync/sync-database/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