@@ -27,7 +27,7 @@ AC_CONFIG_MACRO_DIR([m4])
2727# specifically: AUTHORS, COPYING, INSTALL, NEWS, README and ChangeLog.
2828AM_INIT_AUTOMAKE ( [ subdir-objects] )
2929
30- # Enable C and Posix extensions that may be disabled on certain platforms.
30+ # Enable C and POSIX extensions that may be disabled on certain platforms.
3131AC_USE_SYSTEM_EXTENSIONS
3232
3333# Enable the archiver.
@@ -57,104 +57,139 @@ AC_ARG_VAR([CC], "C compiler to use, such as gcc or clang")
5757AC_ARG_VAR ( [ CXX] , "C++ compiler to use , such as g++ or clang++" )
5858AC_ARG_VAR ( [ PKG_CONFIG_PATH] , "Additional directories for package discovery." )
5959
60+ # Check for baseline language coverage in the compiler for the C++11 standard.
61+ # ------------------------------------------------------------------------------
62+ AX_CXX_COMPILE_STDCXX_11 ( [ noext] , [ mandatory] )
63+
6064
6165# Process options.
6266# ==============================================================================
63- # Implement --with-bash-completion-dir and output ${bash_completion_dir } and declare BASH_COMPLETION_DIR .
67+ # Implement --with-bash-completiondir and output ${bash_completiondir } and declare BASH_COMPLETIONDIR .
6468# ------------------------------------------------------------------------------
65- AC_MSG_CHECKING ( -- with-bash-completion-dir option )
66- AC_ARG_WITH ( [ bash-completion-dir ] ,
67- AS_HELP_STRING ( [ --with-bash-completion-dir [ =PATH ] ] ,
69+ AC_MSG_CHECKING ( [ --with-bash-completiondir option] )
70+ AC_ARG_WITH ( [ bash-completiondir ] ,
71+ AS_HELP_STRING ( [ --with-bash-completiondir [ =DIR ] ] ,
6872 [ Install bash completion support, optionally specifying the directory. This option may require elevated permissions. @<:@ default=no@:>@ ] ) ,
69- [ bash_completion_dir =$withval] ,
70- [ bash_completion_dir =no] )
71- AC_MSG_RESULT ( [ $bash_completion_dir ] )
72- AC_SUBST ( [ bash_completion_dir ] )
73- AM_CONDITIONAL([ BASH_COMPLETION_DIR ] , [ test x$bash_completion_dir != xno] )
73+ [ bash_completiondir =$withval] ,
74+ [ bash_completiondir =no] )
75+ AC_MSG_RESULT ( [ $bash_completiondir ] )
76+ AC_SUBST ( [ bash_completiondir ] )
77+ AM_CONDITIONAL([ BASH_COMPLETIONDIR ] , [ test x$bash_completiondir != xno] )
7478
7579# Implement --with-pkgconfigdir and output ${pkgconfigdir}.
7680# ------------------------------------------------------------------------------
77- AC_MSG_CHECKING ( -- with-pkgconfigdir option )
81+ AC_MSG_CHECKING ( [ --with-pkgconfigdir option] )
7882AC_ARG_WITH ( [ pkgconfigdir] ,
79- AS_HELP_STRING ( [ --with-pkgconfigdir=PATH ] ,
83+ AS_HELP_STRING ( [ --with-pkgconfigdir=DIR ] ,
8084 [ Path to pkgconfig directory. @<:@ default=${libdir}/pkgconfig@:>@ ] ) ,
8185 [ pkgconfigdir=$withval] ,
8286 [ pkgconfigdir=${libdir}/pkgconfig] )
8387AC_MSG_RESULT ( [ $pkgconfigdir] )
8488AC_SUBST ( [ pkgconfigdir] )
8589
86- # Implement --enable-ndebug option and define NDEBUG.
90+ # Implement --enable-ndebug and define NDEBUG.
8791# ------------------------------------------------------------------------------
88- AC_MSG_CHECKING ( -- enable-ndebug option )
92+ AC_MSG_CHECKING ( [ --enable-ndebug option] )
8993AC_ARG_ENABLE ( [ ndebug] ,
9094 AS_HELP_STRING ( [ --enable-ndebug] ,
9195 [ Compile without debug assertions. @<:@ default=yes@:>@ ] ) ,
9296 [ enable_ndebug=$enableval] ,
9397 [ enable_ndebug=yes] )
9498AC_MSG_RESULT ( [ $enable_ndebug] )
95- AS_IF ( [ test x$ enable_ndebug != xno ] , AC_DEFINE ( [ NDEBUG] ) )
99+ AS_CASE ( [ ${ enable_ndebug} ] , [ yes ] , AC_DEFINE ( [ NDEBUG] ) )
96100
97- # Inherit --enable-shared option and define BOOST_TEST_DYN_LINK.
101+ # Inherit --enable-shared and define BOOST_TEST_DYN_LINK.
98102# ------------------------------------------------------------------------------
99- AS_IF ( [ test x$ enable_shared != xno ] , AC_DEFINE ( [ BOOST_TEST_DYN_LINK] ) )
103+ AS_CASE ( [ ${ enable_shared} ] , [ yes ] , AC_DEFINE ( [ BOOST_TEST_DYN_LINK] ) )
100104
101105
102106# Check dependencies.
103107# ==============================================================================
104- # Require Boost of at least version 1.49 .0 if in gcc.
108+ # Require Boost of at least version 1.50 .0 if in gcc and output ${boost_CPPFLAGS/LDFLAGS} .
105109# ------------------------------------------------------------------------------
106110AS_CASE ( [ ${CC}] , [ *gcc*] ,
107- [ AX_BOOST_BASE ( [ 1.49.0] , [ ] , [ AC_MSG_ERROR (
108- [ Boost 1.49.0 or later is required but was not found.] ) ] ) ] )
111+ [ AX_BOOST_BASE ( [ 1.50.0] ,
112+ [ AC_SUBST ( [ boost_CPPFLAGS] , [ ${BOOST_CPPFLAGS}] )
113+ AC_SUBST ( [ boost_LDFLAGS] , [ ${BOOST_LDFLAGS}] )
114+ AC_MSG_NOTICE ( [ boost_CPPFLAGS : ${boost_CPPFLAGS}] )
115+ AC_MSG_NOTICE ( [ boost_LDFLAGS : ${boost_LDFLAGS}] ) ] ,
116+ [ AC_MSG_ERROR ( [ Boost 1.50.0 or later is required but was not found.] ) ] ) ] )
109117
110- # Require Boost of at least version 1.54.0 if in clang.
118+ # Require Boost of at least version 1.54.0 if in clang and output ${boost_CPPFLAGS/LDFLAGS} .
111119# ------------------------------------------------------------------------------
112120AS_CASE ( [ ${CC}] , [ *clang*] ,
113- [ AX_BOOST_BASE ( [ 1.54.0] , [ ] , [ AC_MSG_ERROR (
114- [ Boost 1.54.0 or later is required but was not found.] ) ] ) ] )
121+ [ AX_BOOST_BASE ( [ 1.54.0] ,
122+ [ AC_SUBST ( [ boost_CPPFLAGS] , [ ${BOOST_CPPFLAGS}] )
123+ AC_SUBST ( [ boost_LDFLAGS] , [ ${BOOST_LDFLAGS}] )
124+ AC_MSG_NOTICE ( [ boost_CPPFLAGS : ${boost_CPPFLAGS}] )
125+ AC_MSG_NOTICE ( [ boost_LDFLAGS : ${boost_LDFLAGS}] ) ] ,
126+ [ AC_MSG_ERROR ( [ Boost 1.54.0 or later is required but was not found.] ) ] ) ] )
115127
116- # Require bash-completion of at least version 2.0.0 and output ${bash_completion_CFLAGS} and ${bash_completion_LIBS }.
128+ # Require bash-completion of at least version 2.0.0 and output ${bash_completion_CFLAGS/LIBS/PKG }.
117129# ------------------------------------------------------------------------------
118- AS_IF ( [ test x$bash_completion_dir = xyes ] ,
130+ AS_CASE ( [ ${bash_completiondir} ] , [ yes ] ,
119131 [ PKG_CHECK_MODULES([ bash_completion] , [ bash-completion >= 2.0.0] ,
120- [ bash_completion_dir="`pkg-config --variable=completionsdir bash-completion`"] ,
121- [ bash_completion_dir="${datadir}/bash-completion/completions"] )] )
132+ [ bash_completiondir="`pkg-config --variable=completionsdir bash-completion`"] ,
133+ [ bash_completiondir="${datadir}/bash-completion/completions"] )
134+ AC_SUBST ( [ bash_completion_PKG] , [ 'bash-completion >= 2.0.0'] )
135+ AC_SUBST ( [ bash_completion_CPPFLAGS] , [ ${bash_completion_CFLAGS}] )
136+ AC_MSG_NOTICE ( [ bash_completion_CPPFLAGS : ${bash_completion_CPPFLAGS}] )
137+ AC_MSG_NOTICE ( [ bash_completion_LIBS : ${bash_completion_LIBS}] ) ] ,
138+ [ AC_SUBST ( [ bash_completion_PKG] , [ ] ) ] )
122139
123- # Require sodium of at least version 1.0.0 and output ${sodium_CFLAGS} and ${sodium_LIBS }.
140+ # Require sodium of at least version 1.0.0 and output ${sodium_CFLAGS/LIBS/PKG }.
124141# ------------------------------------------------------------------------------
125142# The chained zmq dependency doesn't set a minimum version for sodium.
126143PKG_CHECK_MODULES([ sodium] , [ libsodium >= 1.0.0] )
144+ AC_SUBST ( [ sodium_PKG] , [ 'libsodium >= 1.0.0'] )
145+ AC_SUBST ( [ sodium_CPPFLAGS] , [ ${sodium_CFLAGS}] )
146+ AC_MSG_NOTICE ( [ sodium_CPPFLAGS : ${sodium_CPPFLAGS}] )
147+ AC_MSG_NOTICE ( [ sodium_LIBS : ${sodium_LIBS}] )
127148
128- # Require czmq++ of at least version 1.1.0 and output ${czmq___CFLAGS} and ${czmq___LIBS }.
149+ # Require czmq++ of at least version 1.1.0 and output ${czmq___CFLAGS/LIBS/PKG }.
129150# ------------------------------------------------------------------------------
130151PKG_CHECK_MODULES([ czmq__] , [ libczmq++ >= 1.1.0] )
152+ AC_SUBST ( [ czmq___PKG] , [ 'libczmq++ >= 1.1.0'] )
153+ AC_SUBST ( [ czmq___CPPFLAGS] , [ ${czmq___CFLAGS}] )
154+ AC_MSG_NOTICE ( [ czmq___CPPFLAGS : ${czmq___CPPFLAGS}] )
155+ AC_MSG_NOTICE ( [ czmq___LIBS : ${czmq___LIBS}] )
131156
132- # Require bitcoin-node of at least version 2.0.0 and output ${bitcoin_node_CFLAGS} and ${bitcoin_node_LIBS }.
157+ # Require bitcoin-node of at least version 2.0.0 and output ${bitcoin_node_CFLAGS/LIBS/PKG }.
133158# ------------------------------------------------------------------------------
134159PKG_CHECK_MODULES([ bitcoin_node] , [ libbitcoin-node >= 2.0.0] )
160+ AC_SUBST ( [ bitcoin_node_PKG] , [ 'libbitcoin-node >= 2.0.0'] )
161+ AC_SUBST ( [ bitcoin_node_CPPFLAGS] , [ ${bitcoin_node_CFLAGS}] )
162+ AC_MSG_NOTICE ( [ bitcoin_node_CPPFLAGS : ${bitcoin_node_CPPFLAGS}] )
163+ AC_MSG_NOTICE ( [ bitcoin_node_LIBS : ${bitcoin_node_LIBS}] )
135164
136165
137166# Set flags.
138167# ==============================================================================
168+ # Require c++11 for all c++ products.
169+ # ------------------------------------------------------------------------------
170+ AS_CASE ( [ ${CC}] , [ *] ,
171+ [ AX_CHECK_COMPILE_FLAG ( [ -std=c++11] ,
172+ [ CXXFLAGS="$CXXFLAGS -std=c++11"] ) ] )
173+
139174# Warn on all stuff.
140175# ------------------------------------------------------------------------------
141176AS_CASE ( [ ${CC}] , [ *] ,
142177 [ AX_CHECK_COMPILE_FLAG ( [ -Wall] ,
143- [ CXXFLAGS ="$CXXFLAGS -Wall"] ) ] )
178+ [ CFLAGS ="$CFLAGS -Wall"] ) ] )
144179
145180# Warn on extra stuff.
146181# ------------------------------------------------------------------------------
147182AS_CASE ( [ ${CC}] , [ *] ,
148183 [ AX_CHECK_COMPILE_FLAG ( [ -Wextra] ,
149- [ CXXFLAGS ="$CXXFLAGS -Wextra"] ) ] )
184+ [ CFLAGS ="$CFLAGS -Wextra"] ) ] )
150185
151186# Be really annoying.
152187# ------------------------------------------------------------------------------
153188AS_CASE ( [ ${CC}] , [ *] ,
154189 [ AX_CHECK_COMPILE_FLAG ( [ -Wpedantic] ,
155- [ CXXFLAGS ="$CXXFLAGS -Wpedantic"] ,
190+ [ CFLAGS ="$CFLAGS -Wpedantic"] ,
156191 [ AX_CHECK_COMPILE_FLAG ( [ -pedantic] ,
157- [ CXXFLAGS ="$CXXFLAGS -pedantic"] ) ] ) ] )
192+ [ CFLAGS ="$CFLAGS -pedantic"] ) ] ) ] )
158193
159194# Conform to style.
160195# ------------------------------------------------------------------------------
@@ -180,37 +215,17 @@ AS_CASE([${CC}], [*gcc*],
180215 [ AX_CHECK_COMPILE_FLAG ( [ -Wno-unused-local-typedefs] ,
181216 [ CXXFLAGS="$CXXFLAGS -Wno-unused-local-typedefs"] ) ] )
182217
183- # Clean up boost 1.49 headers, static with no exceptions. Enabled in gcc only.
184- # ------------------------------------------------------------------------------
185- AS_CASE ( [ ${CC}] , [ *gcc*] ,
186- [ AX_CHECK_COMPILE_FLAG ( [ -Wno-maybe-uninitialized] ,
187- [ CXXFLAGS="$CXXFLAGS -Wno-maybe-uninitialized"] ) ] )
188-
189- # Clean up boost 1.54 headers, static with no exceptions. Enabled in clang only.
190- # ------------------------------------------------------------------------------
191- AS_CASE ( [ ${CC}] , [ *clang*] ,
192- [ AX_CHECK_COMPILE_FLAG ( [ -Wno-sometimes-uninitialized] ,
193- [ CXXFLAGS="$CXXFLAGS -Wno-sometimes-uninitialized"] ) ] )
194-
195- # Clean up boost property_tree headers, with no exceptions.
196- # ------------------------------------------------------------------------------
197- AS_CASE ( [ ${CC}] , [ *] ,
198- [ AX_CHECK_COMPILE_FLAG ( [ -Wno-return-type] ,
199- [ CXXFLAGS="$CXXFLAGS -Wno-return-type"] ) ] )
200-
201218# Protect stack.
202219# ------------------------------------------------------------------------------
203220AS_CASE ( [ ${CC}] , [ *] ,
204- [ AX_CHECK_COMPILE_FLAG ( [ -fstack-protector] ,
205- [ AX_CHECK_LINK_FLAG ( [ -fstack-protector] ,
206- [ CXXFLAGS="$CXXFLAGS -fstack-protector"] ) ] ) ] )
221+ [ AX_CHECK_LINK_FLAG ( [ -fstack-protector] ,
222+ [ LDFLAGS="$LDFLAGS -fstack-protector"] ) ] )
207223
208224# Protect stack comprehensively.
209225# ------------------------------------------------------------------------------
210226AS_CASE ( [ ${CC}] , [ *] ,
211- [ AX_CHECK_COMPILE_FLAG ( [ -fstack-protector-all] ,
212- [ AX_CHECK_LINK_FLAG ( [ -fstack-protector-all] ,
213- [ CXXFLAGS="$CXXFLAGS -fstack-protector-all"] ) ] ) ] )
227+ [ AX_CHECK_LINK_FLAG ( [ -fstack-protector-all] ,
228+ [ LDFLAGS="$LDFLAGS -fstack-protector-all"] ) ] )
214229
215230# Hide internal functions from external libs. Enabled in gcc only.
216231# ------------------------------------------------------------------------------
0 commit comments