@@ -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
# ==============================================================================
@@ -111,11 +127,19 @@ AS_CASE([${enable_shared}], [yes], AC_DEFINE([BOOST_ALL_DYN_LINK]))
111
127
AS_CASE ( [ ${CC}] , [ *] ,
112
128
[ AX_BOOST_BASE ( [ 1.62.0] ,
113
129
[ AC_SUBST ( [ boost_CPPFLAGS] , [ ${BOOST_CPPFLAGS}] )
130
+ AC_SUBST ( [ boost_ISYS_CPPFLAGS] , [ `echo ${BOOST_CPPFLAGS} | $SED s/^-I/-isystem/g | $SED s/' -I'/' -isystem'/g`] )
114
131
AC_SUBST ( [ boost_LDFLAGS] , [ ${BOOST_LDFLAGS}] )
115
132
AC_MSG_NOTICE ( [ boost_CPPFLAGS : ${boost_CPPFLAGS}] )
133
+ AC_MSG_NOTICE ( [ boost_ISYS_CPPFLAGS : ${boost_ISYS_CPPFLAGS}] )
116
134
AC_MSG_NOTICE ( [ boost_LDFLAGS : ${boost_LDFLAGS}] ) ] ,
117
135
[ AC_MSG_ERROR ( [ Boost 1.62.0 or later is required but was not found.] ) ] ) ] )
118
136
137
+ AS_CASE ( [ ${enable_isystem}] ,[ yes] ,
138
+ [ AC_SUBST ( [ boost_BUILD_CPPFLAGS] , [ ${boost_ISYS_CPPFLAGS}] ) ] ,
139
+ [ AC_SUBST ( [ boost_BUILD_CPPFLAGS] , [ ${boost_CPPFLAGS}] ) ] )
140
+
141
+ AC_MSG_NOTICE ( [ boost_BUILD_CPPFLAGS : ${boost_BUILD_CPPFLAGS}] )
142
+
119
143
AS_CASE ( [ ${with_tests}] , [ yes] ,
120
144
[ AX_BOOST_UNIT_TEST_FRAMEWORK
121
145
AC_SUBST ( [ boost_unit_test_framework_LIBS] , [ ${BOOST_UNIT_TEST_FRAMEWORK_LIB}] )
@@ -124,20 +148,52 @@ AS_CASE([${with_tests}], [yes],
124
148
125
149
# Require zmq of at least version 4.2.0 and output ${zmq_CPPFLAGS/LIBS/PKG}.
126
150
# ------------------------------------------------------------------------------
127
- PKG_CHECK_MODULES([ zmq] , [ libzmq >= 4.2.0] )
151
+ PKG_CHECK_MODULES([ zmq] , [ libzmq >= 4.2.0] ,
152
+ [ zmq_INCLUDEDIR="`$PKG_CONFIG --variable=includedir "libzmq >= 4.2.0" 2>/dev/null`"
153
+ zmq_OTHER_CFLAGS="`$PKG_CONFIG --cflags-only-other "libzmq >= 4.2.0" 2>/dev/null`"] ,
154
+ [ zmq_INCLUDEDIR=""
155
+ zmq_OTHER_CFLAGS=""] )
128
156
AC_SUBST ( [ zmq_PKG] , [ 'libzmq >= 4.2.0'] )
129
157
AC_SUBST ( [ zmq_CPPFLAGS] , [ ${zmq_CFLAGS}] )
158
+ AS_IF ( [ test x${zmq_INCLUDEDIR} != "x"] ,
159
+ [ AC_SUBST ( [ zmq_ISYS_CPPFLAGS] , [ "-isystem${zmq_INCLUDEDIR} ${zmq_OTHER_CFLAGS}"] ) ] ,
160
+ [ AC_SUBST ( [ zmq_ISYS_CPPFLAGS] , [ ${zmq_OTHER_CFLAGS}] ) ] )
130
161
AC_MSG_NOTICE ( [ zmq_CPPFLAGS : ${zmq_CPPFLAGS}] )
162
+ AC_MSG_NOTICE ( [ zmq_ISYS_CPPFLAGS : ${zmq_ISYS_CPPFLAGS}] )
163
+ AC_MSG_NOTICE ( [ zmq_OTHER_CFLAGS : ${zmq_OTHER_CFLAGS}] )
164
+ AC_MSG_NOTICE ( [ zmq_INCLUDEDIR : ${zmq_INCLUDEDIR}] )
131
165
AC_MSG_NOTICE ( [ zmq_LIBS : ${zmq_LIBS}] )
132
166
167
+ AS_CASE ( [ ${enable_isystem}] ,[ yes] ,
168
+ [ AC_SUBST ( [ zmq_BUILD_CPPFLAGS] , [ ${zmq_ISYS_CPPFLAGS}] ) ] ,
169
+ [ AC_SUBST ( [ zmq_BUILD_CPPFLAGS] , [ ${zmq_CPPFLAGS}] ) ] )
170
+
171
+ AC_MSG_NOTICE ( [ zmq_BUILD_CPPFLAGS : ${zmq_BUILD_CPPFLAGS}] )
172
+
133
173
# Require bitcoin of at least version 4.0.0 and output ${bitcoin_CPPFLAGS/LIBS/PKG}.
134
174
# ------------------------------------------------------------------------------
135
- PKG_CHECK_MODULES([ bitcoin] , [ libbitcoin >= 4.0.0] )
175
+ PKG_CHECK_MODULES([ bitcoin] , [ libbitcoin >= 4.0.0] ,
176
+ [ bitcoin_INCLUDEDIR="`$PKG_CONFIG --variable=includedir "libbitcoin >= 4.0.0" 2>/dev/null`"
177
+ bitcoin_OTHER_CFLAGS="`$PKG_CONFIG --cflags-only-other "libbitcoin >= 4.0.0" 2>/dev/null`"] ,
178
+ [ bitcoin_INCLUDEDIR=""
179
+ bitcoin_OTHER_CFLAGS=""] )
136
180
AC_SUBST ( [ bitcoin_PKG] , [ 'libbitcoin >= 4.0.0'] )
137
181
AC_SUBST ( [ bitcoin_CPPFLAGS] , [ ${bitcoin_CFLAGS}] )
182
+ AS_IF ( [ test x${bitcoin_INCLUDEDIR} != "x"] ,
183
+ [ AC_SUBST ( [ bitcoin_ISYS_CPPFLAGS] , [ "-isystem${bitcoin_INCLUDEDIR} ${bitcoin_OTHER_CFLAGS}"] ) ] ,
184
+ [ AC_SUBST ( [ bitcoin_ISYS_CPPFLAGS] , [ ${bitcoin_OTHER_CFLAGS}] ) ] )
138
185
AC_MSG_NOTICE ( [ bitcoin_CPPFLAGS : ${bitcoin_CPPFLAGS}] )
186
+ AC_MSG_NOTICE ( [ bitcoin_ISYS_CPPFLAGS : ${bitcoin_ISYS_CPPFLAGS}] )
187
+ AC_MSG_NOTICE ( [ bitcoin_OTHER_CFLAGS : ${bitcoin_OTHER_CFLAGS}] )
188
+ AC_MSG_NOTICE ( [ bitcoin_INCLUDEDIR : ${bitcoin_INCLUDEDIR}] )
139
189
AC_MSG_NOTICE ( [ bitcoin_LIBS : ${bitcoin_LIBS}] )
140
190
191
+ AS_CASE ( [ ${enable_isystem}] ,[ yes] ,
192
+ [ AC_SUBST ( [ bitcoin_BUILD_CPPFLAGS] , [ ${bitcoin_ISYS_CPPFLAGS}] ) ] ,
193
+ [ AC_SUBST ( [ bitcoin_BUILD_CPPFLAGS] , [ ${bitcoin_CPPFLAGS}] ) ] )
194
+
195
+ AC_MSG_NOTICE ( [ bitcoin_BUILD_CPPFLAGS : ${bitcoin_BUILD_CPPFLAGS}] )
196
+
141
197
142
198
# Set flags.
143
199
# ==============================================================================
@@ -153,12 +209,24 @@ AS_CASE([${CC}], [*],
153
209
[ AX_CHECK_COMPILE_FLAG ( [ -Wall] ,
154
210
[ CFLAGS="$CFLAGS -Wall"] ) ] )
155
211
212
+ # Warn on all stuff.
213
+ # ------------------------------------------------------------------------------
214
+ AS_CASE ( [ ${CC}] , [ *] ,
215
+ [ AX_CHECK_COMPILE_FLAG ( [ -Wall] ,
216
+ [ CXXFLAGS="$CXXFLAGS -Wall"] ) ] )
217
+
156
218
# Warn on extra stuff.
157
219
# ------------------------------------------------------------------------------
158
220
AS_CASE ( [ ${CC}] , [ *] ,
159
221
[ AX_CHECK_COMPILE_FLAG ( [ -Wextra] ,
160
222
[ CFLAGS="$CFLAGS -Wextra"] ) ] )
161
223
224
+ # Warn on extra stuff.
225
+ # ------------------------------------------------------------------------------
226
+ AS_CASE ( [ ${CC}] , [ *] ,
227
+ [ AX_CHECK_COMPILE_FLAG ( [ -Wextra] ,
228
+ [ CXXFLAGS="$CXXFLAGS -Wextra"] ) ] )
229
+
162
230
# Be really annoying.
163
231
# ------------------------------------------------------------------------------
164
232
AS_CASE ( [ ${CC}] , [ *] ,
@@ -167,6 +235,26 @@ AS_CASE([${CC}], [*],
167
235
[ AX_CHECK_COMPILE_FLAG ( [ -pedantic] ,
168
236
[ CFLAGS="$CFLAGS -pedantic"] ) ] ) ] )
169
237
238
+ # Be really annoying.
239
+ # ------------------------------------------------------------------------------
240
+ AS_CASE ( [ ${CC}] , [ *] ,
241
+ [ AX_CHECK_COMPILE_FLAG ( [ -Wpedantic] ,
242
+ [ CXXFLAGS="$CXXFLAGS -Wpedantic"] ,
243
+ [ AX_CHECK_COMPILE_FLAG ( [ -pedantic] ,
244
+ [ CXXFLAGS="$CXXFLAGS -pedantic"] ) ] ) ] )
245
+
246
+ # Disallow warning on style order of declarations.
247
+ # ------------------------------------------------------------------------------
248
+ AS_CASE ( [ ${CC}] , [ *] ,
249
+ [ AX_CHECK_COMPILE_FLAG ( [ -Wno-reorder] ,
250
+ [ CXXFLAGS="$CXXFLAGS -Wno-reorder"] ) ] )
251
+
252
+ # Suppress warning for incomplete field initialization.
253
+ # ------------------------------------------------------------------------------
254
+ AS_CASE ( [ ${CC}] , [ *] ,
255
+ [ AX_CHECK_COMPILE_FLAG ( [ -Wno-missing-field-initializers] ,
256
+ [ CXXFLAGS="$CXXFLAGS -Wno-missing-field-initializers"] ) ] )
257
+
170
258
# Conform to style.
171
259
# ------------------------------------------------------------------------------
172
260
AS_CASE ( [ ${CC}] , [ *] ,
@@ -179,12 +267,6 @@ AS_CASE([${CC}], [*clang*],
179
267
[ AX_CHECK_COMPILE_FLAG ( [ -Wno-mismatched-tags] ,
180
268
[ CXXFLAGS="$CXXFLAGS -Wno-mismatched-tags"] ) ] )
181
269
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
270
# Protect stack.
189
271
# ------------------------------------------------------------------------------
190
272
AS_CASE ( [ ${CC}] , [ *] ,
@@ -197,12 +279,6 @@ AS_CASE([${CC}], [*],
197
279
[ AX_CHECK_LINK_FLAG ( [ -fstack-protector-all] ,
198
280
[ LDFLAGS="$LDFLAGS -fstack-protector-all"] ) ] )
199
281
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
282
# Hide inlines from external libs. Enabled in gcc only.
207
283
# ------------------------------------------------------------------------------
208
284
AS_CASE ( [ ${CC}] , [ *gcc*] ,
0 commit comments