forked from libbitcoin/libbitcoin-system
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
238 lines (190 loc) · 8.71 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
###############################################################################
# Copyright (c) 2011-2014 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.7.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.
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
# Declare using the GNU C library (glibc).
AC_GNU_SOURCE
# Compute the canonical host-system type variable host, including host_os.
AC_CANONICAL_HOST
# Check for baseline language coverage in the compiler for the C++11 standard.
AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
# 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.")
# Process options.
#==============================================================================
# Implement --with-pkgconfigdir and output ${pkgconfigdir}.
#------------------------------------------------------------------------------
AC_MSG_CHECKING(--with-pkgconfigdir option)
AC_ARG_WITH([pkgconfigdir],
AS_HELP_STRING([--with-pkgconfigdir=PATH],
[Path to pkgconfig directory.]),
[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.]),
[with_tests=$withval],
[with_tests=yes])
AC_MSG_RESULT([$with_tests])
AM_CONDITIONAL([WITH_TESTS], [test x$with_tests != xno])
# Implement --enable-debug option and define DEBUG.
#------------------------------------------------------------------------------
AC_MSG_CHECKING(--enable-debug option)
AC_ARG_ENABLE([debug],
AS_HELP_STRING([--enable-debug],
[Compile with debug assertions.]),
[enable_debug=$enableval],
[enable_debug=no])
AC_MSG_RESULT([$enable_debug])
AS_IF([test x$enable_debug != xno], AC_DEFINE([DEBUG]))
# Implement --enable-testnet option and define ENABLE_TESTNET.
#------------------------------------------------------------------------------
AC_MSG_CHECKING(--enable-testnet option)
AC_ARG_ENABLE([testnet],
AS_HELP_STRING([--enable-testnet],
[Compile for testnet (deprecated).]),
[enable_testnet=$enableval],
[enable_testnet=no])
AC_MSG_RESULT([$enable_testnet])
AS_IF([test x$enable_testnet != xno], AC_DEFINE([ENABLE_TESTNET]))
# Inherit --enable-shared option and declare ENABLE_SHARED.
#------------------------------------------------------------------------------
AM_CONDITIONAL([ENABLE_SHARED], [test x$enable_shared != xno])
# Check dependencies.
#==============================================================================
# Require Boost of at least version 1.49.0 if on linux.
#------------------------------------------------------------------------------
AS_CASE([${host_os}], [*linux*],
[AX_BOOST_BASE([1.49.0], [], [AC_MSG_ERROR(
[Boost 1.49.0 or later is required but was not found.])])])
# Require Boost of at least version 1.54.0 if on darwin.
#------------------------------------------------------------------------------
AS_CASE([${host_os}], [*darwin*],
[AX_BOOST_BASE([1.54.0], [], [AC_MSG_ERROR(
[Boost 1.54.0 or later is required but was not found.])])])
AX_BOOST_DATE_TIME
AX_BOOST_FILESYSTEM
AX_BOOST_REGEX
AX_BOOST_SYSTEM
AS_IF([test x$with_tests != xno], [AX_BOOST_UNIT_TEST_FRAMEWORK])
# 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_SUBST([rt_LIBS], [])
AC_MSG_ERROR([rt library is required but was not found.])])])
# Require gmp if on linux and output ${gmp_LIBS}.
#------------------------------------------------------------------------------
AS_CASE([${host_os}], [*linux*],
[AC_CHECK_HEADER([gmp.h], [],
[AC_MSG_ERROR([gmp header is required but was not found.])],-)])
AS_CASE([${host_os}], [*linux*],
[AC_CHECK_LIB([gmp],[__gmpz_init],
[AC_SUBST([gmp_LIBS], [-lgmp])],
[AC_SUBST([gmp_LIBS], [])
AC_MSG_ERROR([gmp library is required but was not found.])])])
# Require gmp if on darwin and output ${gmp_LIBS}.
#------------------------------------------------------------------------------
AS_CASE([${host_os}], [*darwin*],
[CPPFLAGS="$CPPFLAGS -I//opt/local/include"])
AS_CASE([${host_os}], [*darwin*],
[AC_CHECK_HEADER([gmp.h], [],
[AC_MSG_ERROR([gmp header is required but was not found.])],-)])
AS_CASE([${host_os}], [*darwin*],
[LDFLAGS="$LDFLAGS -L/opt/local/lib"])
AS_CASE([${host_os}], [*darwin*],
[AC_CHECK_LIB([gmp],[__gmpz_init],
[AC_SUBST([gmp_LIBS], [-lgmp])],
[AC_SUBST([gmp_LIBS], [])
AC_MSG_ERROR([gmp library is required but was not found.])])])
# Require secp256k1 of at least version 0.0.1 and output ${secp256k1}.
#------------------------------------------------------------------------------
PKG_CHECK_MODULES([secp256k1], [libsecp256k1 >= 0.0.1])
# Output ${boost_LIBS}
#------------------------------------------------------------------------------
AC_SUBST([boost_LIBS], ["-lboost_date_time -lboost_filesystem -lboost_regex -lboost_system"])
# Set flags.
#==============================================================================
# Warn on all stuff.
#------------------------------------------------------------------------------
AX_CHECK_COMPILE_FLAG([-Wall],
[CXXFLAGS="$CXXFLAGS -Wall"])
# Warn on extra stuff.
#------------------------------------------------------------------------------
AX_CHECK_COMPILE_FLAG([-Wextra],
[CXXFLAGS="$CXXFLAGS -Wextra"])
# Be really annoying.
#------------------------------------------------------------------------------
AX_CHECK_COMPILE_FLAG([-Wpedantic],
[CXXFLAGS="$CXXFLAGS -Wpedantic"],
[AX_CHECK_COMPILE_FLAG([-pedantic],
[CXXFLAGS="$CXXFLAGS -pedantic"])])
# Conform to style.
#------------------------------------------------------------------------------
AX_CHECK_COMPILE_FLAG([-Wno-missing-braces],
[CXXFLAGS="$CXXFLAGS -Wno-missing-braces"])
# Clean up Boost 1.54 headers (clang).
#------------------------------------------------------------------------------
AX_CHECK_COMPILE_FLAG([-Wno-deprecated-register],
[CXXFLAGS="$CXXFLAGS -Wno-deprecated-register"])
# Clean up Boost 1.49 headers (gcc).
#------------------------------------------------------------------------------
AX_CHECK_COMPILE_FLAG([-Wno-unused-local-typedefs],
[CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedefs"])
# Clean up on OSX (clang).
#------------------------------------------------------------------------------
AX_CHECK_COMPILE_FLAG([-Wno-unknown-warning-option],
[CXXFLAGS="$CXXFLAGS -Wno-unknown-warning-option"])
# Protect stack.
#------------------------------------------------------------------------------
AX_CHECK_COMPILE_FLAG([-fstack-protector],
[AX_CHECK_LINK_FLAG([-fstack-protector],
[CXXFLAGS="$CXXFLAGS -fstack-protector"])])
# Protect stack comprehensively.
#------------------------------------------------------------------------------
AX_CHECK_COMPILE_FLAG([-fstack-protector-all],
[AX_CHECK_LINK_FLAG([-fstack-protector-all],
[CXXFLAGS="$CXXFLAGS -fstack-protector-all"])])
# Process outputs into templates.
#==============================================================================
AC_CONFIG_FILES([Makefile libbitcoin.pc ])
AC_OUTPUT