-
Notifications
You must be signed in to change notification settings - Fork 4
/
configure.ac
175 lines (138 loc) · 6.3 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
-*- Autoconf -*-
m4_define([xcm_major_version], [1])
m4_define([xcm_minor_version], [10])
m4_define([xcm_patch_version], [1])
m4_define([xcm_version],[xcm_major_version.xcm_minor_version.xcm_patch_version])
# XCM never had a non-backward-compatible API/ABI change for any
# release, even before version 1.0.0.
m4_define([xcm_abi_major_version], [m4_eval(xcm_major_version - 1)])
# step xcm_minor_version if this is increased
m4_define([xcm_abi_minor_version], 25)
m4_define([xcm_abi_version],[xcm_abi_major_version.xcm_abi_minor_version])
AC_INIT(xcm, [xcm_version], [mattias.ronnblom@ericsson.com])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([common/config.h])
AC_PREREQ([2.63])
AC_PROG_CC
AC_SUBST([XCM_ABI_MAJOR_VERSION], [xcm_abi_major_version])
AC_SUBST([XCM_ABI_MINOR_VERSION], [xcm_abi_minor_version])
AC_SUBST([XCM_ABI_VERSION], [xcm_abi_version])
AC_SUBST([XCM_MAJOR_VERSION], [xcm_major_version])
AC_SUBST([XCM_MINOR_VERSION], [xcm_minor_version])
AC_SUBST([XCM_PATCH_VERSION], [xcm_patch_version])
AC_SUBST([XCM_VERSION], [xcm_version])
# XCM depends on constructor functions to register transports into the
# core library, and thus cannot be built statically.
AC_DISABLE_STATIC
# Enable late pthread features
AC_USE_SYSTEM_EXTENSIONS
LT_INIT
AC_CHECK_LIB([rt], [clock_gettime],
[AC_SUBST([RT_LIBS], [-lrt])],
[AC_MSG_ERROR([Unable to find the RT library.])])
AC_CHECK_LIB([pthread], [pthread_create],
[AC_SUBST([PTHREAD_LIBS], [-lpthread])],
[AC_MSG_ERROR([Unable to find the pthread library.])])
AC_SUBST([AM_CFLAGS])
AC_CONFIG_FILES([Makefile include/xcm_version.h python/config.py])
AC_ARG_ENABLE([cares],
AS_HELP_STRING([--disable-cares], [use glibc resolver instead of the c-ares library]))
AS_IF([test "x$enable_cares" != "xno"], [
AC_CHECK_LIB([cares], [ares_init],
[AC_SUBST([CARES_LIBS], [-lcares])],
[AC_MSG_ERROR([Unable to find the c-ares DNS library.])])
AC_CHECK_HEADERS(ares.h, [:],
[AC_MSG_ERROR([Unable to find c-ares header file.])])
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([#include <ares.h>],
[
#if ARES_VERSION < 0x11000
#error c-ares version must be at least 1.16.0
#endif
])],
[AC_MSG_RESULT(yes)],
[AC_MSG_FAILURE([c-ares 1.16.0 or later is required.])])
AC_DEFINE([XCM_CARES], [1], [Use c-ares DNS library.])
AC_SUBST(XCM_CARES, 1)], [
AC_CHECK_LIB([anl], [getaddrinfo_a],
[AC_SUBST([ANL_LIBS], [-lanl])],
[AC_MSG_ERROR([Unable to find the ANL library.])])
]
)
AM_CONDITIONAL([CARES], [test "x$enable_cares" != "xno"])
AC_ARG_ENABLE([tls],
AS_HELP_STRING([--disable-tls], [disable XCM TLS and UTLS transports]))
AS_IF([test "x$enable_tls" != "xno"], [
AC_CHECK_LIB(crypto, CRYPTO_memdup, [:],
[AC_MSG_ERROR([Unable to find the Crypto library.])])
AC_CHECK_LIB(ssl, SSL_write, [AC_SUBST([SSL_LIBS], [-lssl])],
[AC_MSG_ERROR([Unable to find the OpenSSL library.])])
AC_CHECK_HEADERS(openssl/ssl.h, [:],
[AC_MSG_ERROR([Unable to find the OpenSSL header files.])])
AC_CHECK_DECLS([OPENSSL_THREADS], [],
[AC_MSG_ERROR([OpenSSL is built w/o threads support.])],
[#include <openssl/ssl.h>])
AC_MSG_CHECKING([OpenSSL version])
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([#include <openssl/opensslv.h>],
[
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#error OpenSSL version is not recent enough
#endif
])],
[AC_MSG_RESULT(yes)],
[AC_MSG_FAILURE([OpenSSL 1.1.x or later is required])])
AC_DEFINE([XCM_TLS], [1], [XCM TLS and UTLS Transports.])
AC_SUBST(XCM_TLS, 1)
])
AM_CONDITIONAL([TLS], [test "x$enable_tls" != "xno"])
AC_ARG_ENABLE([sctp],
AS_HELP_STRING([--enable-sctp], [enable XCM SCTP transport]))
AS_IF([test "x$enable_sctp" = "xyes"], [
AC_CHECK_HEADERS(netinet/sctp.h, [],
[AC_MSG_ERROR([Unable to find the SCTP header files.])])
AC_DEFINE([XCM_SCTP], [1], [XCM SCTP Transports.])
])
AM_CONDITIONAL([SCTP], [test "x$enable_sctp" = "xyes"])
AC_ARG_ENABLE([examples],
AS_HELP_STRING([--enable-examples], [enable building the XCM examples]))
AM_CONDITIONAL([EXAMPLES], [test "x$enable_examples" = "xyes"])
AC_ARG_ENABLE([xcm_tool],
AS_HELP_STRING([--disable-xcm-tool], [disable the 'xcm' command-line tool]))
AS_IF([test "x$enable_xcm_tool" != "xno" -o "x$enable_examples" = "xyes"], [
AC_CHECK_LIB(event, event_base_dispatch,
[AC_SUBST([EVENT_LIBS], [-levent])],
[AC_MSG_ERROR([Unable to find the libevent library. Disable the XCM tool to avoid this dependency.])])
AC_CHECK_HEADERS(event.h, [:],
[AC_MSG_ERROR([Unable to find libevent header files.])])
])
AM_CONDITIONAL([XCM_TOOL], [test "x$enable_xcm_tool" != "xno"])
AC_ARG_ENABLE([lttng],
AS_HELP_STRING([--disable-lttng], [disable LTTNG logging support]))
AM_CONDITIONAL([LTTNG], [test "x$enable_lttng" != "xno"])
AS_IF([test "x$enable_lttng" != "xno"], [
AC_CHECK_LIB([lttng-ust], [main],
[AC_SUBST([LTTNG_LIBS], [-llttng-ust])],
[AC_MSG_ERROR([Unable to find the lttng-ust library. Disable LTTng to avoid this dependency.])])
])
AC_ARG_ENABLE([ctl],
AS_HELP_STRING([--disable-ctl], [disable XCM control interface]))
AM_CONDITIONAL([CTL], [test "x$enable_ctl" != "xno"])
AS_IF([test "x$enable_ctl" != "xno"], [
AC_DEFINE([XCM_CTL], [1], [XCM Control interface.])
])
AC_ARG_ENABLE([python],
AS_HELP_STRING([--disable-python], [disable Python XCM interface]))
AM_CONDITIONAL([PYTHON], [test "x$enable_python" != "xno"])
AS_IF([test "x$enable_python" != "xno"], [AM_PATH_PYTHON])
AC_ARG_ENABLE([valgrind],
AS_HELP_STRING([--enable-valgrind], [use Valgrind when running tests]))
AS_IF([test "x$enable_valgrind" = "xyes"], [
AC_CHECK_PROG(valgrind, [],
[AC_MSG_ERROR([Unable to find Valgrind executable.])])
AC_CHECK_HEADERS(valgrind/valgrind.h, [:],
[AC_MSG_ERROR([Unable to find the valgrind header files.])])
AC_DEFINE([XCM_VALGRIND], [1], [Use valgrind.])
AC_SUBST(XCM_VALGRIND, 1)], [
])
AM_CONDITIONAL([VALGRIND], [test "x$enable_valgrind" = "xyes"])
AC_OUTPUT