1*97bd480fSBaptiste Daroussinm4_define([maj_ver], [0]) 2*97bd480fSBaptiste Daroussinm4_define([med_ver], [3]) 3*97bd480fSBaptiste Daroussinm4_define([min_ver], [0]) 4*97bd480fSBaptiste Daroussinm4_define([so_version], [maj_ver:med_ver]) 5*97bd480fSBaptiste Daroussinm4_define([ucl_version], [maj_ver.med_ver.min_ver]) 6*97bd480fSBaptiste Daroussin 7*97bd480fSBaptiste DaroussinAC_INIT([libucl],[ucl_version],[https://github.com/vstakhov/libucl],[libucl]) 8*97bd480fSBaptiste DaroussinAC_CONFIG_SRCDIR([configure.ac]) 9*97bd480fSBaptiste DaroussinAM_INIT_AUTOMAKE([1.11 foreign silent-rules -Wall -Wportability no-dist-gzip dist-xz]) 10*97bd480fSBaptiste Daroussin 11*97bd480fSBaptiste DaroussinUCL_VERSION=ucl_version 12*97bd480fSBaptiste DaroussinSO_VERSION=so_version 13*97bd480fSBaptiste Daroussin 14*97bd480fSBaptiste DaroussinAC_SUBST(UCL_VERSION) 15*97bd480fSBaptiste DaroussinAC_SUBST(SO_VERSION) 16*97bd480fSBaptiste Daroussin 17*97bd480fSBaptiste DaroussinAC_PROG_CC_C99 18*97bd480fSBaptiste DaroussinAM_PROG_CC_C_O 19*97bd480fSBaptiste DaroussinAM_PROG_AR 20*97bd480fSBaptiste DaroussinLT_INIT 21*97bd480fSBaptiste DaroussinAC_CONFIG_MACRO_DIR([m4]) 22*97bd480fSBaptiste DaroussinAC_CONFIG_HEADERS([config.h]) 23*97bd480fSBaptiste Daroussin 24*97bd480fSBaptiste DaroussinAC_C_CONST 25*97bd480fSBaptiste DaroussinAC_TYPE_SIZE_T 26*97bd480fSBaptiste Daroussin 27*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([fcntl.h unistd.h]) 28*97bd480fSBaptiste DaroussinAC_TYPE_OFF_T 29*97bd480fSBaptiste DaroussinAC_FUNC_MMAP 30*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([fcntl.h]) 31*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([sys/types.h]) 32*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([sys/stat.h]) 33*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([sys/param.h]) 34*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([sys/mman.h]) 35*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([stdlib.h]) 36*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([stddef.h]) 37*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([stdarg.h]) 38*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([stdbool.h]) 39*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([stdint.h]) 40*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([string.h]) 41*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([unistd.h]) 42*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([ctype.h]) 43*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([errno.h]) 44*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([limits.h]) 45*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([libgen.h]) 46*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([stdio.h]) 47*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([float.h]) 48*97bd480fSBaptiste DaroussinAC_CHECK_HEADERS_ONCE([math.h]) 49*97bd480fSBaptiste Daroussin 50*97bd480fSBaptiste Daroussindnl Example of default-disabled feature 51*97bd480fSBaptiste DaroussinAC_ARG_ENABLE([urls], AS_HELP_STRING([--enable-urls], [Enable URLs fetch (requires libfetch or libcurl)])) 52*97bd480fSBaptiste DaroussinAC_ARG_ENABLE([signatures], AS_HELP_STRING([--enable-signatures], 53*97bd480fSBaptiste Daroussin [Enable signatures check (requires openssl)])) 54*97bd480fSBaptiste DaroussinAC_ARG_ENABLE([utils], 55*97bd480fSBaptiste Daroussin [--enable-utils Build and install utils], 56*97bd480fSBaptiste Daroussin [case "${enableval}" in 57*97bd480fSBaptiste Daroussin yes) utils=true ;; 58*97bd480fSBaptiste Daroussin no) utils=false ;; 59*97bd480fSBaptiste Daroussin *) AC_MSG_ERROR([bad value ${enableval} for --enable-utils]) ;; 60*97bd480fSBaptiste Daroussin esac],[utils=false]) 61*97bd480fSBaptiste DaroussinAM_CONDITIONAL([UTILS], [test x$utils = xtrue]) 62*97bd480fSBaptiste Daroussin 63*97bd480fSBaptiste DaroussinAS_IF([test "x$enable_signatures" = "xyes"], [ 64*97bd480fSBaptiste Daroussin AC_SEARCH_LIBS([EVP_MD_CTX_create], [crypto], [ 65*97bd480fSBaptiste Daroussin AC_DEFINE(HAVE_OPENSSL, 1, [Define to 1 if you have the 'crypto' library (-lcrypto).]) 66*97bd480fSBaptiste Daroussin LIBSSL_LIB="-lcrypto" 67*97bd480fSBaptiste Daroussin LIBS_EXTRA="${LIBS_EXTRA} -lcrypto" 68*97bd480fSBaptiste Daroussin ], [AC_MSG_ERROR([unable to find the EVP_MD_CTX_create() function])]) 69*97bd480fSBaptiste Daroussin]) 70*97bd480fSBaptiste Daroussin 71*97bd480fSBaptiste DaroussinAC_PATH_PROG(PANDOC, pandoc, [/non/existent]) 72*97bd480fSBaptiste Daroussin 73*97bd480fSBaptiste DaroussinAC_SEARCH_LIBS([clock_gettime], [rt], [], [ 74*97bd480fSBaptiste Daroussin AC_CHECK_HEADER([mach/mach_time.h], [ 75*97bd480fSBaptiste Daroussin AC_DEFINE(HAVE_MACH_MACH_TIME_H, 1, [Define to 1 on Darwin]) 76*97bd480fSBaptiste Daroussin ], [AC_MSG_ERROR([unable to find clock_gettime or mach_absolute_time])]) 77*97bd480fSBaptiste Daroussin]) 78*97bd480fSBaptiste DaroussinAC_SEARCH_LIBS([remainder], [m], [], [AC_MSG_ERROR([unable to find remainder() function])]) 79*97bd480fSBaptiste Daroussin 80*97bd480fSBaptiste DaroussinAC_CHECK_HEADER([regex.h], [ 81*97bd480fSBaptiste Daroussin AC_DEFINE(HAVE_REGEX_H, 1, [Define to 1 if you have the <regex.h> header file.]) 82*97bd480fSBaptiste Daroussin ], 83*97bd480fSBaptiste Daroussin [AC_MSG_ERROR([unable to find the regex.h header])], 84*97bd480fSBaptiste Daroussin [#include <sys/types.h>]) 85*97bd480fSBaptiste Daroussin 86*97bd480fSBaptiste DaroussinAS_IF([test "x$enable_urls" = "xyes"], [ 87*97bd480fSBaptiste Daroussin AC_CHECK_HEADER([fetch.h], [ 88*97bd480fSBaptiste Daroussin AC_DEFINE(HAVE_FETCH_H, 1, [Define to 1 if you have the <fetch.h> header file.]) 89*97bd480fSBaptiste Daroussin AC_CHECK_LIB(fetch, fetchXGet, [ 90*97bd480fSBaptiste Daroussin AC_DEFINE(HAVE_LIBFETCH, 1, [Define to 1 if you have the 'fetch' library (-lfetch).]) 91*97bd480fSBaptiste Daroussin LIBFETCH_LIBS="-lfetch" 92*97bd480fSBaptiste Daroussin have_libfetch="yes" 93*97bd480fSBaptiste Daroussin LIBS_EXTRA="${LIBS_EXTRA} -lfetch" 94*97bd480fSBaptiste Daroussin ]) 95*97bd480fSBaptiste Daroussin ], [],[ 96*97bd480fSBaptiste Daroussin #include <stdio.h> 97*97bd480fSBaptiste Daroussin #ifdef HAVE_SYS_PARAM_H 98*97bd480fSBaptiste Daroussin #include <sys/param.h> 99*97bd480fSBaptiste Daroussin #endif 100*97bd480fSBaptiste Daroussin ]) 101*97bd480fSBaptiste Daroussin AC_SUBST(LIBFETCH_LIBS) 102*97bd480fSBaptiste Daroussin 103*97bd480fSBaptiste Daroussin AS_IF([ test "x$have_libfetch" != "xyes"], [ 104*97bd480fSBaptiste Daroussin dnl Fallback to libcurl 105*97bd480fSBaptiste Daroussin PKG_CHECK_MODULES([CURL], [libcurl], [ 106*97bd480fSBaptiste Daroussin AC_DEFINE(CURL_FOUND, 1, [Use libcurl]) 107*97bd480fSBaptiste Daroussin LIBS_EXTRA="${LIBS_EXTRA} -lcurl"], 108*97bd480fSBaptiste Daroussin [AC_MSG_ERROR([unable to find neither libfetch nor libcurl])]) 109*97bd480fSBaptiste Daroussin ]) 110*97bd480fSBaptiste Daroussin AC_SUBST(CURL_FOUND) 111*97bd480fSBaptiste Daroussin AC_SUBST(CURL_LIBS) 112*97bd480fSBaptiste Daroussin AC_SUBST(CURL_CFLAGS) 113*97bd480fSBaptiste Daroussin]) 114*97bd480fSBaptiste Daroussin 115*97bd480fSBaptiste DaroussinAC_SUBST(LIBS_EXTRA) 116*97bd480fSBaptiste Daroussin 117*97bd480fSBaptiste DaroussinAC_CONFIG_FILES(Makefile \ 118*97bd480fSBaptiste Daroussin src/Makefile \ 119*97bd480fSBaptiste Daroussin tests/Makefile \ 120*97bd480fSBaptiste Daroussin utils/Makefile \ 121*97bd480fSBaptiste Daroussin doc/Makefile \ 122*97bd480fSBaptiste Daroussin libucl.pc) 123*97bd480fSBaptiste DaroussinAC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h]) 124*97bd480fSBaptiste DaroussinAC_OUTPUT 125