@@ -44,6 +44,9 @@ AC_PROG_CXX
44
44
# Enable shared libraries if available, and static if they don't conflict.
45
45
AC_PROG_LIBTOOL
46
46
47
+ # Enable sed for substitution.
48
+ AC_PROG_SED
49
+
47
50
# Compute the canonical host-system type variable host, including host_os.
48
51
AC_CANONICAL_HOST
49
52
@@ -52,6 +55,9 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
52
55
53
56
# Check for pkg-config.
54
57
PKG_PROG_PKG_CONFIG
58
+ AS_IF ( [ test -n "$PKG_CONFIG"] , [ ] ,
59
+ [ AC_MSG_ERROR ( [ pkg-config is required but was not found.] ) ] )
60
+
55
61
56
62
# Declare environment variables that affect the build.
57
63
# ------------------------------------------------------------------------------
@@ -103,6 +109,16 @@ AS_CASE([${enable_ndebug}], [yes], AC_DEFINE([NDEBUG]))
103
109
# ------------------------------------------------------------------------------
104
110
AS_CASE ( [ ${enable_shared}] , [ yes] , AC_DEFINE ( [ BOOST_ALL_DYN_LINK] ) )
105
111
112
+ # Implement --enable-isystem.
113
+ # ------------------------------------------------------------------------------
114
+ AC_MSG_CHECKING ( [ --enable-isystem option] )
115
+ AC_ARG_ENABLE ( [ isystem] ,
116
+ AS_HELP_STRING ( [ --enable-isystem] ,
117
+ [ Substitute -isystem for -I in dependencies. @<:@ default=no@:>@ ] ) ,
118
+ [ enable_isystem=$enableval] ,
119
+ [ enable_isystem=no] )
120
+ AC_MSG_RESULT ( [ $enable_isystem] )
121
+
106
122
107
123
# Check dependencies.
108
124
# ==============================================================================
@@ -116,6 +132,12 @@ AS_CASE([${CC}], [*],
116
132
AC_MSG_NOTICE ( [ boost_LDFLAGS : ${boost_LDFLAGS}] ) ] ,
117
133
[ AC_MSG_ERROR ( [ Boost 1.62.0 or later is required but was not found.] ) ] ) ] )
118
134
135
+ AS_CASE ( [ ${enable_isystem}] ,[ yes] ,
136
+ [ AC_SUBST ( [ boost_BUILD_CPPFLAGS] , [ ${boost_ISYS_CPPFLAGS}] ) ] ,
137
+ [ AC_SUBST ( [ boost_BUILD_CPPFLAGS] , [ ${boost_CPPFLAGS}] ) ] )
138
+
139
+ AC_MSG_NOTICE ( [ boost_BUILD_CPPFLAGS : ${boost_BUILD_CPPFLAGS}] )
140
+
119
141
AS_CASE ( [ ${with_tests}] , [ yes] ,
120
142
[ AX_BOOST_UNIT_TEST_FRAMEWORK
121
143
AC_SUBST ( [ boost_unit_test_framework_LIBS] , [ ${BOOST_UNIT_TEST_FRAMEWORK_LIB}] )
@@ -124,20 +146,46 @@ AS_CASE([${with_tests}], [yes],
124
146
125
147
# Require zmq of at least version 4.2.0 and output ${zmq_CPPFLAGS/LIBS/PKG}.
126
148
# ------------------------------------------------------------------------------
127
- PKG_CHECK_MODULES([ zmq] , [ libzmq >= 4.2.0] )
149
+ PKG_CHECK_MODULES([ zmq] , [ libzmq >= 4.2.0] ,
150
+ [ zmq_INCLUDEDIR="`$PKG_CONFIG --variable=includedir "libzmq >= 4.2.0" 2>/dev/null`"
151
+ zmq_OTHER_CFLAGS="`$PKG_CONFIG --cflags-only-other "libzmq >= 4.2.0" 2>/dev/null`"] ,
152
+ [ zmq_INCLUDEDIR=""
153
+ zmq_OTHER_CFLAGS=""] )
128
154
AC_SUBST ( [ zmq_PKG] , [ 'libzmq >= 4.2.0'] )
129
155
AC_SUBST ( [ zmq_CPPFLAGS] , [ ${zmq_CFLAGS}] )
156
+ AS_IF ( [ test x${zmq_INCLUDEDIR} != "x"] ,
157
+ [ AC_SUBST ( [ zmq_ISYS_CPPFLAGS] , [ -isystem${zmq_INCLUDEDIR} ${zmq_OTHER_CFLAGS}] ) ] ,
158
+ [ AC_SUBST ( [ zmq_ISYS_CPPFLAGS] , [ ${zmq_OTHER_CFLAGS}] ) ] )
130
159
AC_MSG_NOTICE ( [ zmq_CPPFLAGS : ${zmq_CPPFLAGS}] )
131
160
AC_MSG_NOTICE ( [ zmq_LIBS : ${zmq_LIBS}] )
132
161
162
+ AS_CASE ( [ ${enable_isystem}] ,[ yes] ,
163
+ [ AC_SUBST ( [ zmq_BUILD_CPPFLAGS] , [ ${zmq_ISYS_CPPFLAGS}] ) ] ,
164
+ [ AC_SUBST ( [ zmq_BUILD_CPPFLAGS] , [ ${zmq_CPPFLAGS}] ) ] )
165
+
166
+ AC_MSG_NOTICE ( [ zmq_BUILD_CPPFLAGS : ${zmq_BUILD_CPPFLAGS}] )
167
+
133
168
# Require bitcoin of at least version 4.0.0 and output ${bitcoin_CPPFLAGS/LIBS/PKG}.
134
169
# ------------------------------------------------------------------------------
135
- PKG_CHECK_MODULES([ bitcoin] , [ libbitcoin >= 4.0.0] )
170
+ PKG_CHECK_MODULES([ bitcoin] , [ libbitcoin >= 4.0.0] ,
171
+ [ bitcoin_INCLUDEDIR="`$PKG_CONFIG --variable=includedir "libbitcoin >= 4.0.0" 2>/dev/null`"
172
+ bitcoin_OTHER_CFLAGS="`$PKG_CONFIG --cflags-only-other "libbitcoin >= 4.0.0" 2>/dev/null`"] ,
173
+ [ bitcoin_INCLUDEDIR=""
174
+ bitcoin_OTHER_CFLAGS=""] )
136
175
AC_SUBST ( [ bitcoin_PKG] , [ 'libbitcoin >= 4.0.0'] )
137
176
AC_SUBST ( [ bitcoin_CPPFLAGS] , [ ${bitcoin_CFLAGS}] )
177
+ AS_IF ( [ test x${bitcoin_INCLUDEDIR} != "x"] ,
178
+ [ AC_SUBST ( [ bitcoin_ISYS_CPPFLAGS] , [ -isystem${bitcoin_INCLUDEDIR} ${bitcoin_OTHER_CFLAGS}] ) ] ,
179
+ [ AC_SUBST ( [ bitcoin_ISYS_CPPFLAGS] , [ ${bitcoin_OTHER_CFLAGS}] ) ] )
138
180
AC_MSG_NOTICE ( [ bitcoin_CPPFLAGS : ${bitcoin_CPPFLAGS}] )
139
181
AC_MSG_NOTICE ( [ bitcoin_LIBS : ${bitcoin_LIBS}] )
140
182
183
+ AS_CASE ( [ ${enable_isystem}] ,[ yes] ,
184
+ [ AC_SUBST ( [ bitcoin_BUILD_CPPFLAGS] , [ ${bitcoin_ISYS_CPPFLAGS}] ) ] ,
185
+ [ AC_SUBST ( [ bitcoin_BUILD_CPPFLAGS] , [ ${bitcoin_CPPFLAGS}] ) ] )
186
+
187
+ AC_MSG_NOTICE ( [ bitcoin_BUILD_CPPFLAGS : ${bitcoin_BUILD_CPPFLAGS}] )
188
+
141
189
142
190
# Set flags.
143
191
# ==============================================================================
@@ -153,12 +201,24 @@ AS_CASE([${CC}], [*],
153
201
[ AX_CHECK_COMPILE_FLAG ( [ -Wall] ,
154
202
[ CFLAGS="$CFLAGS -Wall"] ) ] )
155
203
204
+ # Warn on all stuff.
205
+ # ------------------------------------------------------------------------------
206
+ AS_CASE ( [ ${CC}] , [ *] ,
207
+ [ AX_CHECK_COMPILE_FLAG ( [ -Wall] ,
208
+ [ CXXFLAGS="$CXXFLAGS -Wall"] ) ] )
209
+
156
210
# Warn on extra stuff.
157
211
# ------------------------------------------------------------------------------
158
212
AS_CASE ( [ ${CC}] , [ *] ,
159
213
[ AX_CHECK_COMPILE_FLAG ( [ -Wextra] ,
160
214
[ CFLAGS="$CFLAGS -Wextra"] ) ] )
161
215
216
+ # Warn on extra stuff.
217
+ # ------------------------------------------------------------------------------
218
+ AS_CASE ( [ ${CC}] , [ *] ,
219
+ [ AX_CHECK_COMPILE_FLAG ( [ -Wextra] ,
220
+ [ CXXFLAGS="$CXXFLAGS -Wextra"] ) ] )
221
+
162
222
# Be really annoying.
163
223
# ------------------------------------------------------------------------------
164
224
AS_CASE ( [ ${CC}] , [ *] ,
@@ -167,6 +227,26 @@ AS_CASE([${CC}], [*],
167
227
[ AX_CHECK_COMPILE_FLAG ( [ -pedantic] ,
168
228
[ CFLAGS="$CFLAGS -pedantic"] ) ] ) ] )
169
229
230
+ # Be really annoying.
231
+ # ------------------------------------------------------------------------------
232
+ AS_CASE ( [ ${CC}] , [ *] ,
233
+ [ AX_CHECK_COMPILE_FLAG ( [ -Wpedantic] ,
234
+ [ CXXFLAGS="$CXXFLAGS -Wpedantic"] ,
235
+ [ AX_CHECK_COMPILE_FLAG ( [ -pedantic] ,
236
+ [ CXXFLAGS="$CXXFLAGS -pedantic"] ) ] ) ] )
237
+
238
+ # Disallow warning on style order of declarations.
239
+ # ------------------------------------------------------------------------------
240
+ AS_CASE ( [ ${CC}] , [ *] ,
241
+ [ AX_CHECK_COMPILE_FLAG ( [ -Wno-reorder] ,
242
+ [ CXXFLAGS="$CXXFLAGS -Wno-reorder"] ) ] )
243
+
244
+ # Suppress warning for incomplete field initialization.
245
+ # ------------------------------------------------------------------------------
246
+ AS_CASE ( [ ${CC}] , [ *] ,
247
+ [ AX_CHECK_COMPILE_FLAG ( [ -Wno-missing-field-initializers] ,
248
+ [ CXXFLAGS="$CXXFLAGS -Wno-missing-field-initializers"] ) ] )
249
+
170
250
# Conform to style.
171
251
# ------------------------------------------------------------------------------
172
252
AS_CASE ( [ ${CC}] , [ *] ,
@@ -179,12 +259,6 @@ AS_CASE([${CC}], [*clang*],
179
259
[ AX_CHECK_COMPILE_FLAG ( [ -Wno-mismatched-tags] ,
180
260
[ CXXFLAGS="$CXXFLAGS -Wno-mismatched-tags"] ) ] )
181
261
182
- # Clean up boost 1.55 headers. Enabled in gcc only.
183
- # ------------------------------------------------------------------------------
184
- AS_CASE ( [ ${CC}] , [ *gcc*] ,
185
- [ AX_CHECK_COMPILE_FLAG ( [ -Wno-deprecated-declarations] ,
186
- [ CXXFLAGS="$CXXFLAGS -Wno-deprecated-declarations"] ) ] )
187
-
188
262
# Protect stack.
189
263
# ------------------------------------------------------------------------------
190
264
AS_CASE ( [ ${CC}] , [ *] ,
@@ -197,12 +271,6 @@ AS_CASE([${CC}], [*],
197
271
[ AX_CHECK_LINK_FLAG ( [ -fstack-protector-all] ,
198
272
[ LDFLAGS="$LDFLAGS -fstack-protector-all"] ) ] )
199
273
200
- # Hide internal functions from external libs. Enabled in gcc only.
201
- # ------------------------------------------------------------------------------
202
- AS_CASE ( [ ${CC}] , [ *gcc*] ,
203
- [ AX_CHECK_COMPILE_FLAG ( [ -fvisibility-hidden] ,
204
- [ CXXFLAGS="$CXXFLAGS -fvisibility-hidden"] ) ] )
205
-
206
274
# Hide inlines from external libs. Enabled in gcc only.
207
275
# ------------------------------------------------------------------------------
208
276
AS_CASE ( [ ${CC}] , [ *gcc*] ,
0 commit comments