-
Notifications
You must be signed in to change notification settings - Fork 50
/
configure.ac
341 lines (283 loc) · 15.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
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
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
###############################################################################
# Copyright (c) 2014-2023 libbitcoin-node developers (see COPYING).
#
# GENERATED SOURCE CODE, DO NOT EDIT EXCEPT EXPERIMENTALLY
#
###############################################################################
# Standard declarations.
#==============================================================================
# Requires Automake 1.14 or newer.
# Declare the required version of Autoconf.
AC_PREREQ([2.65])
# Process command-line arguments and perform initialization and verification.
AC_INIT([libbitcoin-node], [4.0.0], [eric@voskuil.org])
# 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_PREREQ(2.4.2)
# Enable shared libraries if available, and static if they don't conflict.
LT_INIT
AC_SUBST([LIBTOOL_DEPS])
# Determine C++ compiler to use.
AC_PROG_CXX
# Enable sed for substitution.
AC_PROG_SED
# 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
AS_IF([test -n "$PKG_CONFIG"], [],
[AC_MSG_ERROR([pkg-config is required but was not found.])])
AS_CASE([${enable_static}],
[yes], [AC_SUBST([PKG_CONFIG], ["$PKG_CONFIG --static"])],
[])
# 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++20 standard.
#------------------------------------------------------------------------------
AX_CXX_COMPILE_STDCXX([20], [noext], [mandatory])
# Process options.
#==============================================================================
# Implement --with-bash-completiondir and output ${bash_completiondir} and declare BASH_COMPLETIONDIR.
#------------------------------------------------------------------------------
AC_MSG_CHECKING([--with-bash-completiondir option])
AC_ARG_WITH([bash-completiondir],
AS_HELP_STRING([--with-bash-completiondir[=DIR]],
[Install bash completion support, optionally specifying the directory. This option may require elevated permissions. @<:@default=no@:>@]),
[bash_completiondir=$withval],
[bash_completiondir=no])
AC_MSG_RESULT([$bash_completiondir])
AC_SUBST([bash_completiondir])
AM_CONDITIONAL([BASH_COMPLETIONDIR], [test x$bash_completiondir != xno])
# 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 --with-console and declare WITH_CONSOLE.
#------------------------------------------------------------------------------
AC_MSG_CHECKING([--with-console option])
AC_ARG_WITH([console],
AS_HELP_STRING([--with-console],
[Compile console application. @<:@default=yes@:>@]),
[with_console=$withval],
[with_console=yes])
AC_MSG_RESULT([$with_console])
AM_CONDITIONAL([WITH_CONSOLE], [test x$with_console != 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]))
# Inherit --enable-shared and define BOOST_ALL_DYN_LINK.
#------------------------------------------------------------------------------
AS_CASE([${enable_shared}], [yes], AC_DEFINE([BOOST_ALL_DYN_LINK]))
# Implement --enable-isystem.
#------------------------------------------------------------------------------
AC_MSG_CHECKING([--enable-isystem option])
AC_ARG_ENABLE([isystem],
AS_HELP_STRING([--enable-isystem],
[Substitute -isystem for -I in dependencies. @<:@default=no@:>@]),
[enable_isystem=$enableval],
[enable_isystem=no])
AC_MSG_RESULT([$enable_isystem])
# Set flags.
#==============================================================================
# Require c++20 for all c++ products.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-std=c++20],
[CXXFLAGS="$CXXFLAGS -std=c++20"])])
# Warn on all stuff.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-Wall],
[CFLAGS="$CFLAGS -Wall"])])
# Warn on all stuff.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-Wall],
[CXXFLAGS="$CXXFLAGS -Wall"])])
# Warn on extra stuff.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-Wextra],
[CFLAGS="$CFLAGS -Wextra"])])
# Warn on extra stuff.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-Wextra],
[CXXFLAGS="$CXXFLAGS -Wextra"])])
# Disallow warning on style order of declarations.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-Wno-reorder],
[CXXFLAGS="$CXXFLAGS -Wno-reorder"])])
# Suppress warning for incomplete field initialization.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-Wno-missing-field-initializers],
[CXXFLAGS="$CXXFLAGS -Wno-missing-field-initializers"])])
# Conform to style.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-Wno-missing-braces],
[CXXFLAGS="$CXXFLAGS -Wno-missing-braces"])])
# Ignore comments within comments or commenting of backslash extended lines.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-Wno-comment],
[CXXFLAGS="$CXXFLAGS -Wno-comment"])])
# Suppress warning for copy of implicitly generated copy constructor.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_COMPILE_FLAG([-Wno-deprecated-copy],
[CXXFLAGS="$CXXFLAGS -Wno-deprecated-copy"])])
# 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"])])
# Address -undefined dynamic_lookup MacOS error.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_CHECK_LINK_FLAG([-no_fixup_chains],
[LDFLAGS="$LDFLAGS -no_fixup_chains"])])
# 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"])])
# Check dependencies.
#==============================================================================
# Require Boost of at least version 1.76.0 and output ${boost_CPPFLAGS/LDFLAGS}.
#------------------------------------------------------------------------------
AS_CASE([${CC}], [*],
[AX_BOOST_BASE([1.76.0],
[AC_SUBST([boost_CPPFLAGS], [${BOOST_CPPFLAGS}])
AC_SUBST([boost_ISYS_CPPFLAGS], [`echo ${BOOST_CPPFLAGS} | $SED s/^-I/-isystem/g | $SED s/' -I'/' -isystem'/g`])
AC_SUBST([boost_LDFLAGS], [${BOOST_LDFLAGS}])
AC_MSG_NOTICE([boost_CPPFLAGS : ${boost_CPPFLAGS}])
AC_MSG_NOTICE([boost_ISYS_CPPFLAGS : ${boost_ISYS_CPPFLAGS}])
AC_MSG_NOTICE([boost_LDFLAGS : ${boost_LDFLAGS}])],
[AC_MSG_ERROR([Boost 1.76.0 or later is required but was not found.])])])
AS_CASE([${enable_isystem}],[yes],
[AC_SUBST([boost_BUILD_CPPFLAGS], [${boost_ISYS_CPPFLAGS}])],
[AC_SUBST([boost_BUILD_CPPFLAGS], [${boost_CPPFLAGS}])])
AC_MSG_NOTICE([boost_BUILD_CPPFLAGS : ${boost_BUILD_CPPFLAGS}])
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 bash-completion of at least version 2.0.0 and output ${bash_completion_CPPFLAGS/LIBS/PKG}.
#------------------------------------------------------------------------------
AS_CASE([${bash_completiondir}], [yes],
[PKG_CHECK_MODULES([bash_completion], [bash-completion >= 2.0.0],
[bash_completion_INCLUDEDIR="`$PKG_CONFIG --variable=includedir "bash-completion >= 2.0.0" 2>/dev/null`"
bash_completion_OTHER_CFLAGS="`$PKG_CONFIG --cflags-only-other "bash-completion >= 2.0.0" 2>/dev/null`"
bash_completiondir="`$PKG_CONFIG --variable=completionsdir "bash-completion >= 2.0.0" 2>/dev/null`"],
[bash_completion_INCLUDEDIR=""
bash_completion_OTHER_CFLAGS=""
bash_completiondir="${datadir}/bash-completion/completions"])
AC_SUBST([bash_completion_PKG], ['bash-completion >= 2.0.0'])
AC_SUBST([bash_completion_CPPFLAGS], [${bash_completion_CFLAGS}])
AS_IF([test x${bash_completion_INCLUDEDIR} != "x"],
[AC_SUBST([bash_completion_ISYS_CPPFLAGS], ["-isystem${bash_completion_INCLUDEDIR} ${bash_completion_OTHER_CFLAGS}"])],
[AC_SUBST([bash_completion_ISYS_CPPFLAGS], [${bash_completion_OTHER_CFLAGS}])])
AC_MSG_NOTICE([bash_completion_CPPFLAGS : ${bash_completion_CPPFLAGS}])
AC_MSG_NOTICE([bash_completion_ISYS_CPPFLAGS : ${bash_completion_ISYS_CPPFLAGS}])
AC_MSG_NOTICE([bash_completion_OTHER_CFLAGS : ${bash_completion_OTHER_CFLAGS}])
AC_MSG_NOTICE([bash_completion_INCLUDEDIR : ${bash_completion_INCLUDEDIR}])
AC_MSG_NOTICE([bash_completion_LIBS : ${bash_completion_LIBS}])],
[AC_SUBST([bash_completion_PKG], [])])
AS_CASE([${enable_isystem}],[yes],
[AC_SUBST([bash_completion_BUILD_CPPFLAGS], [${bash_completion_ISYS_CPPFLAGS}])],
[AC_SUBST([bash_completion_BUILD_CPPFLAGS], [${bash_completion_CPPFLAGS}])])
AC_MSG_NOTICE([bash_completion_BUILD_CPPFLAGS : ${bash_completion_BUILD_CPPFLAGS}])
# Require bitcoin-database of at least version 4.0.0 and output ${bitcoin_database_CPPFLAGS/LIBS/PKG}.
#------------------------------------------------------------------------------
PKG_CHECK_MODULES([bitcoin_database], [libbitcoin-database >= 4.0.0],
[bitcoin_database_INCLUDEDIR="`$PKG_CONFIG --variable=includedir "libbitcoin-database >= 4.0.0" 2>/dev/null`"
bitcoin_database_OTHER_CFLAGS="`$PKG_CONFIG --cflags-only-other "libbitcoin-database >= 4.0.0" 2>/dev/null`"],
[AC_MSG_ERROR([libbitcoin-database >= 4.0.0 is required but was not found.])])
AC_SUBST([bitcoin_database_PKG], ['libbitcoin-database >= 4.0.0'])
AC_SUBST([bitcoin_database_CPPFLAGS], [${bitcoin_database_CFLAGS}])
AS_IF([test x${bitcoin_database_INCLUDEDIR} != "x"],
[AC_SUBST([bitcoin_database_ISYS_CPPFLAGS], ["-isystem${bitcoin_database_INCLUDEDIR} ${bitcoin_database_OTHER_CFLAGS}"])],
[AC_SUBST([bitcoin_database_ISYS_CPPFLAGS], [${bitcoin_database_OTHER_CFLAGS}])])
AC_MSG_NOTICE([bitcoin_database_CPPFLAGS : ${bitcoin_database_CPPFLAGS}])
AC_MSG_NOTICE([bitcoin_database_ISYS_CPPFLAGS : ${bitcoin_database_ISYS_CPPFLAGS}])
AC_MSG_NOTICE([bitcoin_database_OTHER_CFLAGS : ${bitcoin_database_OTHER_CFLAGS}])
AC_MSG_NOTICE([bitcoin_database_INCLUDEDIR : ${bitcoin_database_INCLUDEDIR}])
AC_MSG_NOTICE([bitcoin_database_LIBS : ${bitcoin_database_LIBS}])
AS_CASE([${enable_isystem}],[yes],
[AC_SUBST([bitcoin_database_BUILD_CPPFLAGS], [${bitcoin_database_ISYS_CPPFLAGS}])],
[AC_SUBST([bitcoin_database_BUILD_CPPFLAGS], [${bitcoin_database_CPPFLAGS}])])
AC_MSG_NOTICE([bitcoin_database_BUILD_CPPFLAGS : ${bitcoin_database_BUILD_CPPFLAGS}])
# Require bitcoin-network of at least version 4.0.0 and output ${bitcoin_network_CPPFLAGS/LIBS/PKG}.
#------------------------------------------------------------------------------
PKG_CHECK_MODULES([bitcoin_network], [libbitcoin-network >= 4.0.0],
[bitcoin_network_INCLUDEDIR="`$PKG_CONFIG --variable=includedir "libbitcoin-network >= 4.0.0" 2>/dev/null`"
bitcoin_network_OTHER_CFLAGS="`$PKG_CONFIG --cflags-only-other "libbitcoin-network >= 4.0.0" 2>/dev/null`"],
[AC_MSG_ERROR([libbitcoin-network >= 4.0.0 is required but was not found.])])
AC_SUBST([bitcoin_network_PKG], ['libbitcoin-network >= 4.0.0'])
AC_SUBST([bitcoin_network_CPPFLAGS], [${bitcoin_network_CFLAGS}])
AS_IF([test x${bitcoin_network_INCLUDEDIR} != "x"],
[AC_SUBST([bitcoin_network_ISYS_CPPFLAGS], ["-isystem${bitcoin_network_INCLUDEDIR} ${bitcoin_network_OTHER_CFLAGS}"])],
[AC_SUBST([bitcoin_network_ISYS_CPPFLAGS], [${bitcoin_network_OTHER_CFLAGS}])])
AC_MSG_NOTICE([bitcoin_network_CPPFLAGS : ${bitcoin_network_CPPFLAGS}])
AC_MSG_NOTICE([bitcoin_network_ISYS_CPPFLAGS : ${bitcoin_network_ISYS_CPPFLAGS}])
AC_MSG_NOTICE([bitcoin_network_OTHER_CFLAGS : ${bitcoin_network_OTHER_CFLAGS}])
AC_MSG_NOTICE([bitcoin_network_INCLUDEDIR : ${bitcoin_network_INCLUDEDIR}])
AC_MSG_NOTICE([bitcoin_network_LIBS : ${bitcoin_network_LIBS}])
AS_CASE([${enable_isystem}],[yes],
[AC_SUBST([bitcoin_network_BUILD_CPPFLAGS], [${bitcoin_network_ISYS_CPPFLAGS}])],
[AC_SUBST([bitcoin_network_BUILD_CPPFLAGS], [${bitcoin_network_CPPFLAGS}])])
AC_MSG_NOTICE([bitcoin_network_BUILD_CPPFLAGS : ${bitcoin_network_BUILD_CPPFLAGS}])
# Process outputs into templates.
#==============================================================================
AC_CONFIG_FILES([Makefile libbitcoin-node.pc])
AC_OUTPUT