forked from libbitcoin/libbitcoin-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
304 lines (250 loc) · 12 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
###############################################################################
# Copyright (c) 2014-2015 libbitcoin developers (see COPYING).
#
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY
#
###############################################################################
# Standard declarations.
#==============================================================================
# Declare the required version of autoconf.
AC_PREREQ([2.65])
# Process command-line arguments and perform initialization and verification.
AC_INIT([libbitcoin], [2.8.0], [[email protected]])
# Do compilation tests.
AC_LANG(C++)
# Specify the temporary directory for build tools.
AC_CONFIG_AUX_DIR([build-aux])
# Specify the directory of additional local Autoconf macros.
AC_CONFIG_MACRO_DIR([m4])
# Run macros for operation of generated Makefiles, enable non-recursive make.
# Unless [foreign] is specified standard GNU files will be required,
# specifically: AUTHORS, COPYING, INSTALL, NEWS, README and ChangeLog.
AM_INIT_AUTOMAKE([subdir-objects])
# Enable C and POSIX extensions that may be disabled on certain platforms.
AC_USE_SYSTEM_EXTENSIONS
# Enable the archiver.
AM_PROG_AR
# Initialize libtool.
LT_INIT
# Determine C++ compiler to use.
AC_PROG_CXX
# Enable shared libraries if available, and static if they don't conflict.
AC_PROG_LIBTOOL
# Compute the canonical host-system type variable host, including host_os.
AC_CANONICAL_HOST
# Enable silent rules option.
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
# Check for pkg-config.
PKG_PROG_PKG_CONFIG
# Declare environment variables that affect the build.
#------------------------------------------------------------------------------
AC_ARG_VAR([CC], "C compiler to use, such as gcc or clang")
AC_ARG_VAR([CXX], "C++ compiler to use, such as g++ or clang++")
AC_ARG_VAR([PKG_CONFIG_PATH], "Additional directories for package discovery.")
# Check for baseline language coverage in the compiler for the C++11 standard.
#------------------------------------------------------------------------------
AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
# Process options.
#==============================================================================
# Implement --with-pkgconfigdir and output ${pkgconfigdir}.
#------------------------------------------------------------------------------
AC_MSG_CHECKING([--with-pkgconfigdir option])
AC_ARG_WITH([pkgconfigdir],
AS_HELP_STRING([--with-pkgconfigdir=DIR],
[Path to pkgconfig directory. @<:@default=${libdir}/pkgconfig@:>@]),
[pkgconfigdir=$withval],
[pkgconfigdir=${libdir}/pkgconfig])
AC_MSG_RESULT([$pkgconfigdir])
AC_SUBST([pkgconfigdir])
# Implement --with-tests and declare WITH_TESTS.
#------------------------------------------------------------------------------
AC_MSG_CHECKING([--with-tests option])
AC_ARG_WITH([tests],
AS_HELP_STRING([--with-tests],
[Compile with unit tests. @<:@default=yes@:>@]),
[with_tests=$withval],
[with_tests=yes])
AC_MSG_RESULT([$with_tests])
AM_CONDITIONAL([WITH_TESTS], [test x$with_tests != xno])
# Implement --enable-ndebug and define NDEBUG.
#------------------------------------------------------------------------------
AC_MSG_CHECKING([--enable-ndebug option])
AC_ARG_ENABLE([ndebug],
AS_HELP_STRING([--enable-ndebug],
[Compile without debug assertions. @<:@default=yes@:>@]),
[enable_ndebug=$enableval],
[enable_ndebug=yes])
AC_MSG_RESULT([$enable_ndebug])
AS_CASE([${enable_ndebug}], [yes], AC_DEFINE([NDEBUG]))
# Implement --enable-testnet and define ENABLE_TESTNET and output ${testnet}.
#------------------------------------------------------------------------------
AC_MSG_CHECKING([--enable-testnet option])
AC_ARG_ENABLE([testnet],
AS_HELP_STRING([--enable-testnet],
[Compile for testnet (deprecated). @<:@default=no@:>@]),
[enable_testnet=$enableval],
[enable_testnet=no])
AC_MSG_RESULT([$enable_testnet])
AS_CASE([${enable_testnet}], [yes], AC_DEFINE([ENABLE_TESTNET]))
AS_CASE([${enable_testnet}], [yes], AC_SUBST([testnet], [-DENABLE_TESTNET]))
# Inherit --enable-shared and define BOOST_TEST_DYN_LINK.
#------------------------------------------------------------------------------
AS_CASE([${enable_shared}], [yes], AC_DEFINE([BOOST_TEST_DYN_LINK]))
# Check dependencies.
#==============================================================================
# Require Boost of at least version 1.50.0 if in gcc and output ${boost_CPPFLAGS/LDFLAGS}.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*gcc*],
[AX_BOOST_BASE([1.50.0],
[AC_SUBST([boost_CPPFLAGS], [${BOOST_CPPFLAGS}])
AC_SUBST([boost_LDFLAGS], [${BOOST_LDFLAGS}])
AC_MSG_NOTICE([boost_CPPFLAGS : ${boost_CPPFLAGS}])
AC_MSG_NOTICE([boost_LDFLAGS : ${boost_LDFLAGS}])],
[AC_MSG_ERROR([Boost 1.50.0 or later is required but was not found.])])])
# Require Boost of at least version 1.54.0 if in clang and output ${boost_CPPFLAGS/LDFLAGS}.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*clang*],
[AX_BOOST_BASE([1.54.0],
[AC_SUBST([boost_CPPFLAGS], [${BOOST_CPPFLAGS}])
AC_SUBST([boost_LDFLAGS], [${BOOST_LDFLAGS}])
AC_MSG_NOTICE([boost_CPPFLAGS : ${boost_CPPFLAGS}])
AC_MSG_NOTICE([boost_LDFLAGS : ${boost_LDFLAGS}])],
[AC_MSG_ERROR([Boost 1.54.0 or later is required but was not found.])])])
AX_BOOST_CHRONO
AC_SUBST([boost_chrono_LIBS], [${BOOST_CHRONO_LIB}])
AC_MSG_NOTICE([boost_chrono_LIBS : ${boost_chrono_LIBS}])
AX_BOOST_DATE_TIME
AC_SUBST([boost_date_time_LIBS], [${BOOST_DATE_TIME_LIB}])
AC_MSG_NOTICE([boost_date_time_LIBS : ${boost_date_time_LIBS}])
AX_BOOST_FILESYSTEM
AC_SUBST([boost_filesystem_LIBS], [${BOOST_FILESYSTEM_LIB}])
AC_MSG_NOTICE([boost_filesystem_LIBS : ${boost_filesystem_LIBS}])
AX_BOOST_LOCALE
AC_SUBST([boost_locale_LIBS], [${BOOST_LOCALE_LIB}])
AC_MSG_NOTICE([boost_locale_LIBS : ${boost_locale_LIBS}])
AX_BOOST_PROGRAM_OPTIONS
AC_SUBST([boost_program_options_LIBS], [${BOOST_PROGRAM_OPTIONS_LIB}])
AC_MSG_NOTICE([boost_program_options_LIBS : ${boost_program_options_LIBS}])
AX_BOOST_REGEX
AC_SUBST([boost_regex_LIBS], [${BOOST_REGEX_LIB}])
AC_MSG_NOTICE([boost_regex_LIBS : ${boost_regex_LIBS}])
AX_BOOST_SYSTEM
AC_SUBST([boost_system_LIBS], [${BOOST_SYSTEM_LIB}])
AC_MSG_NOTICE([boost_system_LIBS : ${boost_system_LIBS}])
AS_CASE([${with_tests}], [yes],
[AX_BOOST_UNIT_TEST_FRAMEWORK
AC_SUBST([boost_unit_test_framework_LIBS], [${BOOST_UNIT_TEST_FRAMEWORK_LIB}])
AC_MSG_NOTICE([boost_unit_test_framework_LIBS : ${boost_unit_test_framework_LIBS}])],
[AC_SUBST([boost_unit_test_framework_LIBS], [])])
# Require iconv and output ${iconv_CPPFLAGS/LIBS}.
#------------------------------------------------------------------------------
AM_ICONV
AC_SUBST([iconv_CPPFLAGS], [${INCICONV}])
AC_SUBST([iconv_LIBS], [${LIBICONV}])
AC_MSG_NOTICE([iconv_CPPFLAGS : ${iconv_CPPFLAGS}])
AC_MSG_NOTICE([iconv_LIBS : ${iconv_LIBS}])
# Require pthread and output ${pthread_CFLAGS/LIBS}.
#------------------------------------------------------------------------------
AX_PTHREAD(
[AC_SUBST([pthread_CFLAGS], [${PTHREAD_CFLAGS}])
AC_SUBST([pthread_LIBS], [${PTHREAD_LIBS}])
AC_MSG_NOTICE([pthread_CFLAGS : ${pthread_CFLAGS}])
AC_MSG_NOTICE([pthread_LIBS : ${pthread_LIBS}])],
[AC_MSG_ERROR([pthread library is required but was not found.])])
# Hard wired -lpthread because AX_PTHREAD does not do it.
AC_SUBST([pthread_LIBS], [-lpthread])
# Require rt if on linux and output ${rt_LIBS}.
#------------------------------------------------------------------------------
AS_CASE([${host_os}], [*linux*],
[AC_CHECK_LIB([rt], [clock_gettime],
[AC_SUBST([rt_LIBS], [-lrt])
AC_MSG_NOTICE([rt_LIBS : ${rt_LIBS}])],
[AC_MSG_ERROR([rt library is required but was not found.])])],
[AC_SUBST([rt_LIBS], [])])
# Require secp256k1 of at least version 0.0.1 and output ${secp256k1_CPPFLAGS/LIBS/PKG}.
#------------------------------------------------------------------------------
PKG_CHECK_MODULES([secp256k1], [libsecp256k1 >= 0.0.1])
AC_SUBST([secp256k1_PKG], ['libsecp256k1 >= 0.0.1'])
AC_SUBST([secp256k1_CPPFLAGS], [${secp256k1_CFLAGS}])
AC_MSG_NOTICE([secp256k1_CPPFLAGS : ${secp256k1_CPPFLAGS}])
AC_MSG_NOTICE([secp256k1_LIBS : ${secp256k1_LIBS}])
# Set flags.
#==============================================================================
# Require c++11 for all c++ products.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-std=c++11],
[CXXFLAGS="$CXXFLAGS -std=c++11"])])
# Warn on all stuff.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-Wall],
[CFLAGS="$CFLAGS -Wall"])])
# Warn on extra stuff.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-Wextra],
[CFLAGS="$CFLAGS -Wextra"])])
# Be really annoying.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-Wpedantic],
[CFLAGS="$CFLAGS -Wpedantic"],
[AX_CHECK_COMPILE_FLAG([-pedantic],
[CFLAGS="$CFLAGS -pedantic"])])])
# Allow use of C99 'long long' type.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-Wno-long-long],
[CFLAGS="$CFLAGS -Wno-long-long"],
[AX_CHECK_COMPILE_FLAG([-pedantic],
[CFLAGS="$CFLAGS -pedantic"])])])
# Conform to style.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-Wno-missing-braces],
[CXXFLAGS="$CXXFLAGS -Wno-missing-braces"])])
# Conflict in stdlib under clang. Enabled in clang only.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*clang*],
[AX_CHECK_COMPILE_FLAG([-Wno-mismatched-tags],
[CXXFLAGS="$CXXFLAGS -Wno-mismatched-tags"])])
# Clean up boost 1.54 headers. Enabled in clang only.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*clang*],
[AX_CHECK_COMPILE_FLAG([-Wno-deprecated-register],
[CXXFLAGS="$CXXFLAGS -Wno-deprecated-register"])])
# Clean up boost 1.49 headers. Enabled in gcc only.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*gcc*],
[AX_CHECK_COMPILE_FLAG([-Wno-unused-local-typedefs],
[CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedefs"])])
# Protect stack.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_LINK_FLAG([-fstack-protector],
[LDFLAGS="$LDFLAGS -fstack-protector"])])
# Protect stack comprehensively.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_LINK_FLAG([-fstack-protector-all],
[LDFLAGS="$LDFLAGS -fstack-protector-all"])])
# Hide internal functions from external libs. Enabled in gcc only.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*gcc*],
[AX_CHECK_COMPILE_FLAG([-fvisibility-hidden],
[CXXFLAGS="$CXXFLAGS -fvisibility-hidden"])])
# Hide inlines from external libs. Enabled in gcc only.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*gcc*],
[AX_CHECK_COMPILE_FLAG([-fvisibility-inlines-hidden],
[CXXFLAGS="$CXXFLAGS -fvisibility-inlines-hidden"])])
# Limit delays and warnings. Enabled in gcc only.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*gcc*],
[AX_CHECK_COMPILE_FLAG([-fno-var-tracking-assignments],
[CXXFLAGS="$CXXFLAGS -fno-var-tracking-assignments"])])
# Process outputs into templates.
#==============================================================================
AC_CONFIG_FILES([Makefile libbitcoin.pc ])
AC_OUTPUT