1 | # Init |
---|
2 | |
---|
3 | AC_INIT([SINA],[1.7.2],[elmar@pruesse.net],,[http://github.com/epruesse/SINA]) |
---|
4 | AC_COPYRIGHT([Copyright (c) 2005-2018 Elmar Pruesse]) |
---|
5 | AC_CONFIG_AUX_DIR([build-aux]) |
---|
6 | AC_CONFIG_MACRO_DIR([m4]) |
---|
7 | AC_CONFIG_SRCDIR([src/sina.cpp]) |
---|
8 | AM_INIT_AUTOMAKE([parallel-tests foreign subdir-objects]) |
---|
9 | AC_PREREQ([2.50]) |
---|
10 | |
---|
11 | # build rules for silent compile |
---|
12 | AM_SILENT_RULES([yes]) |
---|
13 | |
---|
14 | # Check for programs |
---|
15 | |
---|
16 | # only run AR check if AM_PROG_AR defined |
---|
17 | # (automake > 1.11 needs it somehow, older ones don't have it) |
---|
18 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) |
---|
19 | |
---|
20 | # AC_PROG_CXX sets -O2, which we don't want if debug enabled, so we store this |
---|
21 | # as default flags for later decision |
---|
22 | saved_CXXFLAGS="$CXXFLAGS" |
---|
23 | AC_PROG_CXX |
---|
24 | default_CXXFLAGS="$CXXFLAGS" |
---|
25 | CXXFLAGS="$saved_CXXFLAGS" |
---|
26 | AC_PROG_LIBTOOL |
---|
27 | AC_PROG_SED |
---|
28 | AC_PROG_LN_S |
---|
29 | AC_PROG_INSTALL |
---|
30 | AC_PROG_MKDIR_P |
---|
31 | AC_CHECK_TOOL([BC], [bc], [:]) |
---|
32 | AC_CHECK_TOOL([TEE], [tee], [:]) |
---|
33 | AC_CHECK_TOOL([MKTEMP], [mktemp], [:]) |
---|
34 | AC_CHECK_TOOL([SPHINX_BUILD], [sphinx-build], [:]) |
---|
35 | AC_PROG_GREP |
---|
36 | |
---|
37 | LT_INIT([shared static]) |
---|
38 | |
---|
39 | AC_REQUIRE_AUX_FILE([tap-driver.sh]) |
---|
40 | |
---|
41 | # Check for C++ and required features |
---|
42 | |
---|
43 | AC_SUBST(CPPFLAGS) |
---|
44 | AC_SUBST(CXXFLAGS) |
---|
45 | AC_SUBST(LDFLAGS) |
---|
46 | AC_LANG([C++]) |
---|
47 | AC_C_INLINE |
---|
48 | AC_TYPE_SIZE_T |
---|
49 | AC_TYPE_UINT32_T |
---|
50 | AC_TYPE_UINT64_T |
---|
51 | AC_HEADER_STDBOOL |
---|
52 | AX_CXX_COMPILE_STDCXX([11],[noext],[mandatory]) |
---|
53 | |
---|
54 | # Check general functions |
---|
55 | |
---|
56 | AC_CHECK_FUNCS([strdup]) |
---|
57 | AC_CHECK_FUNCS([gettimeofday]) |
---|
58 | AC_CHECK_FUNCS([getpid]) |
---|
59 | |
---|
60 | # Check headers |
---|
61 | |
---|
62 | AC_CHECK_HEADERS([sys/time.h]) |
---|
63 | AC_CHECK_HEADER(cstdio) |
---|
64 | |
---|
65 | # Check for libraries |
---|
66 | |
---|
67 | AC_CHECK_LIB(z, compress, [Z_LIB=-lz], [AC_MSG_ERROR([libz.so not found!])]) |
---|
68 | AC_SUBST(Z_LIB) |
---|
69 | AC_CHECK_LIB(rt, clock_gettime) |
---|
70 | |
---|
71 | # Need dladdr to locate libARBDB and thereby ARBHOME |
---|
72 | AC_SEARCH_LIBS([dladdr], [dl dld], [], [ |
---|
73 | AC_MSG_ERROR([unable to find the dladdr() function]) |
---|
74 | ]) |
---|
75 | |
---|
76 | # Define something for PSTREAMS (to get rid of warnings) |
---|
77 | AH_TEMPLATE(REDI_EVISCERATE_PSTREAMS, |
---|
78 | [Define interpreted by PSTREAMS header lib, only |
---|
79 | set to supress Wundef warnings]) |
---|
80 | AC_DEFINE(REDI_EVISCERATE_PSTREAMS, [0]) |
---|
81 | |
---|
82 | # Add coverage option |
---|
83 | AX_CODE_COVERAGE |
---|
84 | AM_COND_IF([CODE_COVERAGE_ENABLED], [ |
---|
85 | AC_CACHE_CHECK([for coverage libs], [_cv_coverage_libs], [ |
---|
86 | _cv_coverage_libs=no |
---|
87 | save_LIBS=$LIBS |
---|
88 | res= |
---|
89 | AC_LANG_CONFTEST([AC_LANG_CALL([], [main])]) |
---|
90 | for lib in '' "$CODE_COVERAGE_LIBS"; do |
---|
91 | if test -z "$lib"; then |
---|
92 | res="none required" |
---|
93 | else |
---|
94 | res=$CODE_COVERAGE_LIBS |
---|
95 | LIBS="-l$lib $save_LIBS" |
---|
96 | fi |
---|
97 | AC_LINK_IFELSE([], [_cv_coverage_libs=$res]) |
---|
98 | AS_IF([test -n "$_cv_coverage_libs"], [break]) |
---|
99 | done |
---|
100 | LIBS=$save_LIBS |
---|
101 | ]) |
---|
102 | AC_MSG_NOTICE([here - $_cv_coverage_libs]) |
---|
103 | AS_IF([test x"$_cv_coverage_libs" != x"no"], [ |
---|
104 | AS_IF([test x"$_cv_coverage_libs" == x"none required"], [ |
---|
105 | CODE_COVERAGE_LIBS= |
---|
106 | ],[ |
---|
107 | CODE_COVERAGE_LIBS=$_cv_coverage_libs |
---|
108 | ]) |
---|
109 | ], [ |
---|
110 | missing_libs="$missing_libs |
---|
111 | coverage libs ($CODE_COVERAGE_LIBS)" |
---|
112 | ]) |
---|
113 | ]) |
---|
114 | |
---|
115 | # Export all symbols to get helpful backtraces |
---|
116 | # (don't on Darwin, ld doesn't support these options there) |
---|
117 | #if test `uname` = Linux; then |
---|
118 | # CXXFLAGS="$CXXFLAGS -rdynamic" |
---|
119 | # LDFLAGS="$LDFLAGS -export-dynamic" |
---|
120 | #fi |
---|
121 | |
---|
122 | # Add debug option |
---|
123 | AH_TEMPLATE([DEBUG]) |
---|
124 | AH_TEMPLATE([NDEBUG]) |
---|
125 | AX_ARG_ENABLE([debug], [disable optimizations and add debug symbols], |
---|
126 | [ |
---|
127 | AM_COND_IF([CODE_COVERAGE_ENABLED], [ |
---|
128 | AC_MSG_WARN([Code Coverage enabled: using -DNDEBUG instead of -DDEBUG]) |
---|
129 | AC_DEFINE([NDEBUG]) |
---|
130 | ],[ |
---|
131 | AC_DEFINE([DEBUG]) |
---|
132 | ]) |
---|
133 | CXXFLAGS="$(echo $CXXFLAGS | sed 's/-O@<:@@<:@:alnum:@:>@@:>@*//g')" |
---|
134 | CXXFLAGS="$CXXFLAGS -Og -ggdb3" |
---|
135 | AX_CHECK_COMPILE_FLAG([-fno-omit-frame-pointer],[ |
---|
136 | CXXFLAGS="$CXXFLAGS -fno-omit-frame-pointer" |
---|
137 | ]) |
---|
138 | ],[ |
---|
139 | CPPFLAGS="$CPPFLAGS -DNDEBUG" |
---|
140 | CXXFLAGS="$default_CXXFLAGS $CXXFLAGS" |
---|
141 | ]) |
---|
142 | |
---|
143 | # Add address sanitizer option |
---|
144 | AX_ARG_ENABLE([asan], [enable AddressSanitizer], [ |
---|
145 | AX_CHECK_COMPILE_FLAG([-fsanitize=address],[ |
---|
146 | CXXFLAGS="$CXXFLAGS -fsanitize=address" |
---|
147 | ]) |
---|
148 | AX_CHECK_LINK_FLAG([-fsanitize=address],[ |
---|
149 | LDFLAGS="$LDFLAGS -fsanitize=address" |
---|
150 | ]) |
---|
151 | ]) |
---|
152 | |
---|
153 | |
---|
154 | # Add option to disable building docs (needs latex...) |
---|
155 | AX_ARG_DISABLE([docs], [don't build documentation]) |
---|
156 | |
---|
157 | AX_ARG_ENABLE([fat_tar], [try to build a fat tar containing deps]) |
---|
158 | |
---|
159 | # Add profiling option |
---|
160 | AX_ARG_ENABLE([profiling], [add profiling information to build], |
---|
161 | [ |
---|
162 | CXXFLAGS="$CXXFLAGS -pg" |
---|
163 | LDFLAGS="$LDFLAGS -pg" |
---|
164 | ]) |
---|
165 | |
---|
166 | |
---|
167 | # Add buildno option |
---|
168 | AC_ARG_WITH([buildinfo], AS_HELP_STRING([--with-buildinfo=<NO>]), |
---|
169 | AC_DEFINE_UNQUOTED([PACKAGE_BUILDINFO], ["${withval}"], [Add extra buildinfo]) |
---|
170 | PACKAGE_BUILDINFO="$withval" |
---|
171 | ) |
---|
172 | |
---|
173 | |
---|
174 | # ARB dependencies |
---|
175 | PKG_CHECK_MODULES([GLIB], [glib-2.0 > 2.2]) |
---|
176 | if test x"$GLIB_LIBS" = x""; then |
---|
177 | missing_libs="$missing_libs |
---|
178 | glib-2.0 (libglib)" |
---|
179 | fi |
---|
180 | |
---|
181 | AX_LIB_ARBDB |
---|
182 | if test x"$ARB_LIBS" = x""; then |
---|
183 | missing_libs="$missing_libs |
---|
184 | ARB libraries (libARBDB)" |
---|
185 | fi |
---|
186 | |
---|
187 | AX_LIB_ARB_PROBE |
---|
188 | if test x"$ARB_PROBE_LIBS" = x""; then |
---|
189 | missing_libs="$missing_libs |
---|
190 | ARB PROBE library (PROBE_COM/client.a)" |
---|
191 | fi |
---|
192 | |
---|
193 | AX_LIB_ARB_HELIX |
---|
194 | if test x"$ARB_HELIX_LIBS" = x""; then |
---|
195 | missing_libs="$missing_libs |
---|
196 | ARB HELIX library (SL/HELIX/HELIX.a)" |
---|
197 | fi |
---|
198 | |
---|
199 | AX_ARB_CHECK_FUNC([GBT_FIND_SEQUENCE], [GBT_find_sequence(NULL, NULL)]) |
---|
200 | AX_ARB_STATUS_RETURN_TYPE |
---|
201 | |
---|
202 | case "$host_os" in |
---|
203 | darwin*) |
---|
204 | LIBEXT=.dylib |
---|
205 | OSNAME=macos |
---|
206 | ;; |
---|
207 | *) |
---|
208 | LIBEXT=.so |
---|
209 | OSNAME=linux |
---|
210 | ;; |
---|
211 | esac |
---|
212 | AC_SUBST(LIBEXT) |
---|
213 | AC_SUBST(OSNAME) |
---|
214 | |
---|
215 | |
---|
216 | # Dynamic libs that need to be copied |
---|
217 | if test `uname` = Darwin; then |
---|
218 | # need to copy glib for darwin (only present if provided by macports) |
---|
219 | GLIB_LIBPATH=`$PKG_CONFIG --variable=libdir glib-2.0` |
---|
220 | ARB_FILES="$ARB_FILES $GLIB_LIBPATH/libglib-2.0.0.dylib" |
---|
221 | fi |
---|
222 | |
---|
223 | for lib in CORE ARBDB; do |
---|
224 | if test -e "$ARBHOME/lib/lib${lib}${LIBEXT}"; then |
---|
225 | ARB_FILES="$ARB_FILES $ARBHOME/lib/lib${lib}${LIBEXT}" |
---|
226 | fi |
---|
227 | done |
---|
228 | AC_SUBST(ARB_FILES) |
---|
229 | |
---|
230 | AX_LIB_TBB |
---|
231 | if test x"$TBB_LIB" = x""; then |
---|
232 | missing_libs="$missing_libs |
---|
233 | Intel Threading Building Blocks (libtbb)" |
---|
234 | fi |
---|
235 | |
---|
236 | AX_LIB_TBB_MALLOC |
---|
237 | |
---|
238 | AX_BOOST_BASE([1.62]) |
---|
239 | AX_BOOST_THREAD |
---|
240 | if test x"$BOOST_THREAD_LIB" = x""; then |
---|
241 | missing_libs="$missing_libs |
---|
242 | BOOST Thread (libboost_thread)" |
---|
243 | fi |
---|
244 | AX_BOOST_PROGRAM_OPTIONS |
---|
245 | if test x"$BOOST_PROGRAM_OPTIONS_LIB" = x""; then |
---|
246 | missing_libs="$missing_libs |
---|
247 | BOOST Program Options (libboost_program_options)" |
---|
248 | fi |
---|
249 | AX_BOOST_IOSTREAMS |
---|
250 | if test x"$BOOST_IOSTREAMS_LIB" = x""; then |
---|
251 | missing_libs="$missing_libs |
---|
252 | BOOST Program Options (libboost_iostreams)" |
---|
253 | fi |
---|
254 | AX_BOOST_FILESYSTEM |
---|
255 | if test x"$BOOST_FILESYSTEM_LIB" = x""; then |
---|
256 | missing_libs="$missing_libs |
---|
257 | BOOST Program Options (libboost_filesystem)" |
---|
258 | fi |
---|
259 | |
---|
260 | AX_BOOST_SYSTEM |
---|
261 | if test x"$BOOST_SYSTEM_LIB" = x""; then |
---|
262 | missing_libs="$missing_libs |
---|
263 | BOOST System (libboost_system)" |
---|
264 | fi |
---|
265 | AX_BOOST_UNIT_TEST_FRAMEWORK |
---|
266 | #if test x"$BOOST_UNIT_TEST_FRAMEWORK_LIBS" = x""; then |
---|
267 | # missing_libs="$missing_libs\n BOOST Unit Test Framework (libboost_unit_test_framework)" |
---|
268 | #fi |
---|
269 | |
---|
270 | # Allways show warnings |
---|
271 | CXXFLAGS="$CXXFLAGS -W" |
---|
272 | |
---|
273 | # Disable warnings creating too much clutter from within TBB |
---|
274 | CXXFLAGS="$CXXFLAGS -Wno-deprecated-copy" |
---|
275 | |
---|
276 | |
---|
277 | # Generate output |
---|
278 | |
---|
279 | AC_CONFIG_HEADERS([config.h]) |
---|
280 | AC_CONFIG_FILES([ |
---|
281 | Makefile |
---|
282 | tests/test_helper.sh |
---|
283 | ]) |
---|
284 | |
---|
285 | |
---|
286 | ###### print some summaries |
---|
287 | |
---|
288 | AC_MSG_NOTICE([---------------------------------------]) |
---|
289 | AC_MSG_NOTICE([ AC_PACKAGE_STRING summary]) |
---|
290 | AC_MSG_NOTICE([---------------------------------------]) |
---|
291 | AC_MSG_NOTICE([]) |
---|
292 | AC_MSG_NOTICE([ prefix: $prefix]) |
---|
293 | AC_MSG_NOTICE([ build: $build]) |
---|
294 | AC_MSG_NOTICE([ host: $host]) |
---|
295 | AC_MSG_NOTICE([]) |
---|
296 | AC_MSG_NOTICE([ debug: $enable_debug]) |
---|
297 | AC_MSG_NOTICE([ profiling: $enable_profiling]) |
---|
298 | AC_MSG_NOTICE([ coverage: $CODE_COVERAGE_ENABLED]) |
---|
299 | AC_MSG_NOTICE([ buildinfo: $PACKAGE_BUILDINFO]) |
---|
300 | AC_MSG_NOTICE([ docs: $enable_docs]) |
---|
301 | AC_MSG_NOTICE([]) |
---|
302 | AC_MSG_NOTICE([ CFLAGS: $CFLAGS]) |
---|
303 | AC_MSG_NOTICE([ CPPFLAGS: $CPPFLAGS]) |
---|
304 | AC_MSG_NOTICE([ CXXFLAGS: $CXXFLAGS]) |
---|
305 | AC_MSG_NOTICE([ LIBS: $LIBS]) |
---|
306 | AC_MSG_NOTICE([ LDFLAGS: $LDFLAGS]) |
---|
307 | AC_MSG_NOTICE([ CC: $CC]) |
---|
308 | AC_MSG_NOTICE([ CXX: $CXX]) |
---|
309 | AC_MSG_NOTICE([ LD: $LD]) |
---|
310 | AC_MSG_NOTICE([]) |
---|
311 | AM_COND_IF([CODE_COVERAGE_ENABLED], [ |
---|
312 | AC_MSG_NOTICE([ CODE COVERAGE:]) |
---|
313 | AC_MSG_NOTICE([ CPPFLAGS: $CODE_COVERAGE_CPPFLAGS]) |
---|
314 | AC_MSG_NOTICE([ CFLAGS: $CODE_COVERAGE_CFLAGS]) |
---|
315 | AC_MSG_NOTICE([ CXXFLAGS: $CODE_COVERAGE_CXXFLAGS]) |
---|
316 | AC_MSG_NOTICE([ LIBS: $CODE_COVERAGE_LIBS]) |
---|
317 | AC_MSG_NOTICE([]) |
---|
318 | ]) |
---|
319 | AC_MSG_NOTICE([ ARB:]) |
---|
320 | AC_MSG_NOTICE([ ARBHOME: ${ARBHOME}]) |
---|
321 | AC_MSG_NOTICE([ CPPFLAGS: ${ARB_CPPFLAGS}]) |
---|
322 | AC_MSG_NOTICE([ LDFLAGS: ${ARB_LDFLAGS}]) |
---|
323 | AC_MSG_NOTICE([ LIBS: ${ARB_LIBS}]) |
---|
324 | AC_MSG_NOTICE([ PROBE LIBS: ${ARB_PROBE_LIBS}]) |
---|
325 | AC_MSG_NOTICE([ HELIX LIBS: ${ARB_HELIX_LIBS}]) |
---|
326 | AC_MSG_NOTICE([ BOOST:]) |
---|
327 | AC_MSG_NOTICE([ LDFLAGS: ${BOOST_LDFLAGS}]) |
---|
328 | AC_MSG_NOTICE([ CPPFLAGS: ${BOOST_CPPFLAGS}]) |
---|
329 | AC_MSG_NOTICE([ PROGRAM_OPTIONS: ${BOOST_PROGRAM_OPTIONS_LIB}]) |
---|
330 | AC_MSG_NOTICE([ THREAD: ${BOOST_THREAD_LIB}]) |
---|
331 | AC_MSG_NOTICE([ IOSTREAMS: ${BOOST_IOSTREAMS_LIB}]) |
---|
332 | AC_MSG_NOTICE([ SYSTEM: ${BOOST_SYSTEM_LIB}]) |
---|
333 | AC_MSG_NOTICE([ FILESYSTEM: ${BOOST_FILESYSTEM_LIB}]) |
---|
334 | AC_MSG_NOTICE([ UNIT_TEST: ${BOOST_UNIT_TEST_FRAMEWORK_LIB}]) |
---|
335 | AC_MSG_NOTICE([ zlib:]) |
---|
336 | AC_MSG_NOTICE([ LIBS: ${Z_LIB}]) |
---|
337 | AC_MSG_NOTICE([ tbb:]) |
---|
338 | AC_MSG_NOTICE([ CPPFLAGS: ${TBB_CPPFLAGS}]) |
---|
339 | AC_MSG_NOTICE([ LDFLAGS: ${TBB_LDFLAGS}]) |
---|
340 | AC_MSG_NOTICE([ LIBS: ${TBB_LIB}]) |
---|
341 | AC_MSG_NOTICE([ tbb malloc:]) |
---|
342 | AC_MSG_NOTICE([ CPPFLAGS: ${TBB_MALLOC_CPPFLAGS}]) |
---|
343 | AC_MSG_NOTICE([ LDFLAGS: ${TBB_MALLOC_LDFLAGS}]) |
---|
344 | AC_MSG_NOTICE([ LIBS: ${TBB_MALLOC_LIB}]) |
---|
345 | |
---|
346 | |
---|
347 | ### check that all deps are satisfied |
---|
348 | |
---|
349 | if test x"$missing_libs" != x""; then |
---|
350 | AC_MSG_FAILURE(Required libraries found missing: $missing_libs ) |
---|
351 | fi |
---|
352 | |
---|
353 | AC_OUTPUT |
---|