diff options
Diffstat (limited to 'contrib/libucl/configure.ac')
-rw-r--r-- | contrib/libucl/configure.ac | 61 |
1 files changed, 50 insertions, 11 deletions
diff --git a/contrib/libucl/configure.ac b/contrib/libucl/configure.ac index c936829..1f6e87d 100644 --- a/contrib/libucl/configure.ac +++ b/contrib/libucl/configure.ac @@ -1,5 +1,5 @@ m4_define([maj_ver], [0]) -m4_define([med_ver], [3]) +m4_define([med_ver], [4]) m4_define([min_ver], [0]) m4_define([so_version], [maj_ver:med_ver]) m4_define([ucl_version], [maj_ver.med_ver.min_ver]) @@ -48,11 +48,17 @@ AC_CHECK_HEADERS_ONCE([float.h]) AC_CHECK_HEADERS_ONCE([math.h]) dnl Example of default-disabled feature -AC_ARG_ENABLE([urls], AS_HELP_STRING([--enable-urls], [Enable URLs fetch (requires libfetch or libcurl)])) +AC_ARG_ENABLE([urls], AS_HELP_STRING([--enable-urls], + [Enable URLs fetch (requires libfetch or libcurl) @<:@default=no@:>@]), [], + [enable_urls=no]) +AC_ARG_ENABLE([regex], AS_HELP_STRING([--enable-regex], + [Enable regex checking for schema @<:@default=yes@:>@]), [], + [enable_regex=yes]) AC_ARG_ENABLE([signatures], AS_HELP_STRING([--enable-signatures], - [Enable signatures check (requires openssl)])) + [Enable signatures check (requires openssl) @<:@default=no@:>@]), [], + [enable_signatures=no]) AC_ARG_ENABLE([utils], - [--enable-utils Build and install utils], + AS_HELP_STRING([--enable-utils], [Build and install utils @<:@default=no@:>@]), [case "${enableval}" in yes) utils=true ;; no) utils=false ;; @@ -63,11 +69,11 @@ AM_CONDITIONAL([UTILS], [test x$utils = xtrue]) AS_IF([test "x$enable_signatures" = "xyes"], [ AC_SEARCH_LIBS([EVP_MD_CTX_create], [crypto], [ AC_DEFINE(HAVE_OPENSSL, 1, [Define to 1 if you have the 'crypto' library (-lcrypto).]) - LIBSSL_LIB="-lcrypto" + LIBCRYPTO_LIB="-lcrypto" LIBS_EXTRA="${LIBS_EXTRA} -lcrypto" ], [AC_MSG_ERROR([unable to find the EVP_MD_CTX_create() function])]) ]) - +AC_SUBST(LIBCRYPTO_LIB) AC_PATH_PROG(PANDOC, pandoc, [/non/existent]) AC_SEARCH_LIBS([clock_gettime], [rt], [], [ @@ -77,11 +83,21 @@ AC_SEARCH_LIBS([clock_gettime], [rt], [], [ ]) AC_SEARCH_LIBS([remainder], [m], [], [AC_MSG_ERROR([unable to find remainder() function])]) -AC_CHECK_HEADER([regex.h], [ - AC_DEFINE(HAVE_REGEX_H, 1, [Define to 1 if you have the <regex.h> header file.]) - ], - [AC_MSG_ERROR([unable to find the regex.h header])], - [#include <sys/types.h>]) +AS_IF([test "x$enable_regex" = "xyes"], [ + AC_CHECK_HEADER([regex.h], [ + AC_DEFINE(HAVE_REGEX_H, 1, [Define to 1 if you have the <regex.h> header file.]) + AC_SEARCH_LIBS([regexec], [regex], [ + AS_IF([test "x$ac_cv_search_regexec" = "x-lregex"], [ + LIBREGEX_LIB="-lregex" + LIBS_EXTRA="${LIBS_EXTRA} -lregex" + ] + )], + [AC_MSG_ERROR([unable to find the regexec() function])])], + [AC_MSG_ERROR([unable to find the regex.h header]) + ], + [#include <sys/types.h>]) +]) +AC_SUBST(LIBREGEX_LIB) AS_IF([test "x$enable_urls" = "xyes"], [ AC_CHECK_HEADER([fetch.h], [ @@ -114,6 +130,29 @@ AS_IF([test "x$enable_urls" = "xyes"], [ AC_SUBST(LIBS_EXTRA) +AC_MSG_CHECKING(for GCC atomic builtins) +AC_LINK_IFELSE([ + AC_LANG_SOURCE([[ + int main() { + volatile unsigned long val = 1; + __sync_synchronize(); + __sync_val_compare_and_swap(&val, 1, 0); + __sync_add_and_fetch(&val, 1); + __sync_sub_and_fetch(&val, 1); + return 0; + } + ]]) +], +[ + AC_MSG_RESULT([yes]) + AC_DEFINE([HAVE_ATOMIC_BUILTINS], [1], [Has gcc/MSVC atomic intrinsics]) +], +[ + AC_MSG_RESULT([no]) + AC_DEFINE([HAVE_ATOMIC_BUILTINS], [0], [Has gcc/MSVC atomic intrinsics]) + AC_MSG_WARN([Libucl references could be thread-unsafe because atomic builtins are missing]) +]) + AC_CONFIG_FILES(Makefile \ src/Makefile \ tests/Makefile \ |