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