1 | ## Process this file with autoconf to produce a configure script. |
---|
2 | ## |
---|
3 | ## $Id: configure.ac 4102 2021-09-22 07:50:18Z peter $ |
---|
4 | |
---|
5 | # Copyright (C) 2003 Daniel Dalevi, Jari Häkkinen |
---|
6 | # Copyright (C) 2004 Jari Häkkinen |
---|
7 | # Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson |
---|
8 | # Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér |
---|
9 | # Copyright (C) 2009 Jari Häkkinen, Peter Johansson |
---|
10 | # Copyright (C) 2010, 2011 Peter Johansson |
---|
11 | # Copyright (C) 2012 Jari Häkkinen, Peter Johansson |
---|
12 | # Copyright (C) 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Peter Johansson |
---|
13 | # |
---|
14 | # This file is part of the yat library, http://dev.thep.lu.se/yat |
---|
15 | # |
---|
16 | # The yat library is free software; you can redistribute it |
---|
17 | # and/or modify it under the terms of the GNU General Public License as |
---|
18 | # published by the Free Software Foundation; either version 3 of the |
---|
19 | # License, or (at your option) any later version. |
---|
20 | # |
---|
21 | # The yat library is distributed in the hope that it will be useful, |
---|
22 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
23 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
24 | # General Public License for more details. |
---|
25 | # |
---|
26 | # You should have received a copy of the GNU General Public License |
---|
27 | # along with yat. If not, see <http://www.gnu.org/licenses/>. |
---|
28 | # |
---|
29 | # If you grabbed the source from the subversion repository you should, |
---|
30 | # at top-level, execute: |
---|
31 | # ./bootstrap |
---|
32 | # To push subsequent changes of this file into the build scripts you |
---|
33 | # must issue: |
---|
34 | # autoreconf |
---|
35 | |
---|
36 | |
---|
37 | m4_include([m4/version.m4]) |
---|
38 | AC_INIT([yat],[my_VERSION],[libyat-users@lists.sourceforge.net],, |
---|
39 | [http://dev.thep.lu.se/yat]) |
---|
40 | MY_VERSION |
---|
41 | AC_PREREQ([2.64]) |
---|
42 | AC_CONFIG_SRCDIR([yat/utility/Matrix.h]) |
---|
43 | AC_CONFIG_AUX_DIR([autotools]) |
---|
44 | dnl arg below should be the same as in Makefile.am |
---|
45 | AC_CONFIG_MACRO_DIR([m4]) |
---|
46 | AC_PREFIX_DEFAULT([/usr/local]) |
---|
47 | |
---|
48 | # Set default htmldir to ${docdir}/html |
---|
49 | AS_VAR_IF([$htmldir], ['${docdir}'], [htmldir='${docdir}/html']) |
---|
50 | |
---|
51 | AC_SUBST([YAT_LT_VERSION], [YAT_LT_VERSION_INFO]) |
---|
52 | AC_DEFINE([YAT_VERSION], ["my_VERSION"], [version]) |
---|
53 | |
---|
54 | AC_CONFIG_HEADERS([config.h]) |
---|
55 | AM_INIT_AUTOMAKE([1.11 std-options color-tests parallel-tests |
---|
56 | silent-rules subdir-objects]) |
---|
57 | |
---|
58 | # Set default programming language |
---|
59 | AC_LANG(C++) |
---|
60 | |
---|
61 | # propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS |
---|
62 | for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do |
---|
63 | eval isset=\${$var+set} |
---|
64 | if test "$isset" = 'set' ; then |
---|
65 | eval val=$`echo $var` |
---|
66 | DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' " |
---|
67 | fi |
---|
68 | done |
---|
69 | AC_SUBST(DISTCHECK_CONFIGURE_FLAGS) |
---|
70 | |
---|
71 | # record if CXXFLAGS was set by user for further use below |
---|
72 | AS_IF([test "${CXXFLAGS+set}" = set], [ |
---|
73 | CXXFLAGS_set_by_user=yes |
---|
74 | ],[ |
---|
75 | AS_IF([test "${INTERNAL_CXXFLAGS+set}" = set], [ |
---|
76 | CXXFLAGS_set_by_user=yes |
---|
77 | ], [ |
---|
78 | CXXFLAGS_set_by_user=no |
---|
79 | ]) |
---|
80 | # set CXXFLAGS to avoid expansion in AC_PROG_CXX |
---|
81 | CXXFLAGS= |
---|
82 | ]) |
---|
83 | |
---|
84 | # Checks for programs. |
---|
85 | dnl FIXME remove m4_ifdef when we assume Automake 1.12 |
---|
86 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) |
---|
87 | AC_PROG_CXX |
---|
88 | |
---|
89 | yat_search_cxx11=no |
---|
90 | AC_ARG_ENABLE([cxx11], |
---|
91 | [AS_HELP_STRING([--enable-cxx11], |
---|
92 | [search for compiler options to build with C++11 support])], |
---|
93 | [AS_CASE([$enable_cxx11], |
---|
94 | [yes], [yat_search_cxx11=yes], |
---|
95 | [no], [AC_MSG_ERROR([invalid option: --disable-cxx11])], |
---|
96 | [AC_MSG_ERROR([invalid argument for --enable-cxx11: $enable_cxx11])]) |
---|
97 | ]) |
---|
98 | |
---|
99 | |
---|
100 | YAT_CXX11([$yat_search_cxx11], [ |
---|
101 | yat_has_cxx11=yes |
---|
102 | # If a C++11 compliant compiler was found, apply the old tests, |
---|
103 | # just to be sure but with no option searching. |
---|
104 | # no need to check for YAT_CXX_RVALUE |
---|
105 | YAT_CXX_ATOMIC([], [yat_has_cxx11=no]) |
---|
106 | YAT_CXX_LOG2([], [yat_has_cxx11=no]) |
---|
107 | YAT_CXX_THROW_IF_NESTED([], [yat_has_cxx11=no]) |
---|
108 | ], [ |
---|
109 | yat_has_cxx11=no |
---|
110 | ]) |
---|
111 | AS_VAR_IF([yat_has_cxx11], [no], [ |
---|
112 | AC_MSG_FAILURE([$CXX is not a C++11 compiler]) |
---|
113 | ]) |
---|
114 | # test for some features available in modern C++ versions (but not in c++11) |
---|
115 | YAT_FUNC_STRING_ENDS_WITH |
---|
116 | YAT_FUNC_STRING_STARTS_WITH |
---|
117 | YAT_FUNC_STRING_CONTAINS |
---|
118 | sleep 10 |
---|
119 | |
---|
120 | AC_PROG_SED |
---|
121 | LT_INIT |
---|
122 | |
---|
123 | # find the compiler vendor: gnu, intel, etc |
---|
124 | AX_COMPILER_VENDOR |
---|
125 | |
---|
126 | AC_ARG_VAR([DOXYGEN], [path to doxygen program]) |
---|
127 | have_doxygen=no |
---|
128 | |
---|
129 | # Let the user turn off usage of doxygen |
---|
130 | AS_VAR_IF([DOXYGEN], [no], [ |
---|
131 | have_doxygen=notwanted |
---|
132 | ], [ |
---|
133 | AC_PATH_PROG([DOXYGEN], [doxygen], [no]) |
---|
134 | AS_VAR_IF([DOXYGEN], [no], [ |
---|
135 | AC_MSG_WARN([unable to find doxygen application]) |
---|
136 | ], [ # if we found doxygen look that it's new enough |
---|
137 | doxygen_min_version=1.5 |
---|
138 | AC_MSG_CHECKING([if doxygen is at least $doxygen_min_version]) |
---|
139 | doxygen_version=`$DOXYGEN --version` |
---|
140 | AX_COMPARE_VERSION([$doxygen_version], [ge], [$doxygen_min_version], |
---|
141 | [have_doxygen=yes], [have_doxygen=old]) |
---|
142 | AC_MSG_RESULT([$doxygen_version]) |
---|
143 | ]) |
---|
144 | ]) |
---|
145 | |
---|
146 | AC_SUBST(have_doxygen) |
---|
147 | AM_CONDITIONAL([DX_ENABLE_HTML], [test x$have_doxygen = xyes]) |
---|
148 | |
---|
149 | # check for quiet_NaN support in OS |
---|
150 | # Check at run-time, but if we are cross-compiling fall back on a |
---|
151 | # compilation test |
---|
152 | AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true]) |
---|
153 | AC_RUN_IFELSE( |
---|
154 | [AC_LANG_PROGRAM( |
---|
155 | [@%:@include <limits>], |
---|
156 | [return !std::numeric_limits<double>::has_quiet_NaN])], |
---|
157 | [quiet_nan=yes |
---|
158 | AC_MSG_RESULT($quiet_nan)], |
---|
159 | [quiet_nan=no |
---|
160 | AC_MSG_RESULT($quiet_nan)], |
---|
161 | # if we are cross-compiling fall back on compilation test |
---|
162 | [AC_MSG_RESULT(cross-compiling) |
---|
163 | AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()]) |
---|
164 | AC_COMPILE_IFELSE( |
---|
165 | [AC_LANG_PROGRAM( |
---|
166 | [@%:@include <limits> |
---|
167 | extern void f(double);], |
---|
168 | [f(std::numeric_limits<double>::quiet_NaN())])], |
---|
169 | [quiet_nan=yes], |
---|
170 | [quiet_nan=no]) |
---|
171 | AC_MSG_RESULT($quiet_nan)]) |
---|
172 | # No support for quiet NAN is fatal -- sub-sequent compilation, or execution |
---|
173 | # of created binary, will fail. |
---|
174 | AS_IF([test x"$quiet_nan" = x"no"], [ |
---|
175 | AC_MSG_FAILURE([dnl |
---|
176 | Support for quiet NAN required. yat will not work on this system!]) |
---|
177 | ]) |
---|
178 | |
---|
179 | # Check for infinity support for doubles in OS |
---|
180 | # Check at run-time, but if we are cross-compiling fall back on a |
---|
181 | # compilation test |
---|
182 | AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true]) |
---|
183 | AC_RUN_IFELSE( |
---|
184 | [AC_LANG_PROGRAM( |
---|
185 | [@%:@include <limits>], |
---|
186 | [return !std::numeric_limits<double>::has_infinity])], |
---|
187 | [has_infinity=yes |
---|
188 | AC_MSG_RESULT($has_infinity)], |
---|
189 | [has_infinity=no |
---|
190 | AC_MSG_RESULT($has_infinity)], |
---|
191 | # if we are cross-compiling fall back on compilation test |
---|
192 | [AC_MSG_RESULT(cross-compiling) |
---|
193 | AC_MSG_CHECKING([for std::numeric_limits<>::infinity()]) |
---|
194 | AC_COMPILE_IFELSE( |
---|
195 | [AC_LANG_PROGRAM( |
---|
196 | [@%:@include <limits> |
---|
197 | extern void f(double);], |
---|
198 | [f(std::numeric_limits<double>::infinity())])], |
---|
199 | [has_infinity=yes], |
---|
200 | [has_infinity=no]) |
---|
201 | AC_MSG_RESULT($has_infinity)]) |
---|
202 | # No support for infinity is fatal -- sub-sequent compilation, or execution |
---|
203 | # of created binary, will fail. |
---|
204 | AS_IF([test x"${has_infinity}" = x"no"], [ |
---|
205 | AC_MSG_FAILURE([dnl |
---|
206 | Support for infinity required. yat will not work on this system!]) |
---|
207 | ]) |
---|
208 | |
---|
209 | |
---|
210 | AC_MSG_CHECKING([g++ deprecation attribute]) |
---|
211 | AC_COMPILE_IFELSE( |
---|
212 | [AC_LANG_PROGRAM([[void f() __attribute__ ((deprecated));]],)], |
---|
213 | [AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1], |
---|
214 | [Define if compiler supports deprecated attribute, as in g++ 4.0]) |
---|
215 | AC_MSG_RESULT([yes])], |
---|
216 | [AC_MSG_RESULT([no])] ) |
---|
217 | |
---|
218 | AC_MSG_CHECKING([if std::multiset::iterator is mutable]) |
---|
219 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <set> |
---|
220 | @%:@include <vector>]], |
---|
221 | [[std::set<std::vector<double> > s; |
---|
222 | std::vector<double> v; |
---|
223 | s.insert(v); |
---|
224 | s.begin()->reserve(100); |
---|
225 | ]])], |
---|
226 | [AC_DEFINE([MULTISET_ITERATOR_IS_MUTABLE], [1], |
---|
227 | [Define if std::multiset::iterator is mutable]) |
---|
228 | AC_MSG_RESULT([yes]) |
---|
229 | ], |
---|
230 | [AC_MSG_RESULT([no])] ) |
---|
231 | |
---|
232 | # Save user-defined environment settings for later restoration |
---|
233 | APR_SAVE_THE_ENVIRONMENT(CPPFLAGS) |
---|
234 | APR_SAVE_THE_ENVIRONMENT(CXXFLAGS) |
---|
235 | APR_SAVE_THE_ENVIRONMENT(LDFLAGS) |
---|
236 | APR_SAVE_THE_ENVIRONMENT(LIBS) |
---|
237 | user_LIBS=$LIBS |
---|
238 | |
---|
239 | AS_CASE([$host_os], [darwin*], [ |
---|
240 | YAT_LD_ADD_FLAG([LDFLAGS], [-Wl,-flat_namespace]) |
---|
241 | ]) |
---|
242 | |
---|
243 | # prefer using libtool in link tests |
---|
244 | YAT_USE_LIBTOOL_PUSH |
---|
245 | |
---|
246 | YAT_THREAD([ |
---|
247 | CPPFLAGS="$CPPFLAGS $YAT_THREAD_CPPFLAGS" |
---|
248 | LIBS="$LIBS $YAT_THREAD_LIBS" |
---|
249 | ], [ |
---|
250 | AC_MSG_FAILURE([$CXX does not work with std::thread]) |
---|
251 | ]) |
---|
252 | |
---|
253 | # Checks for libraries. |
---|
254 | AC_MSG_NOTICE([checking for libraries]) |
---|
255 | LT_LIB_M |
---|
256 | LIBS="$LIBM $LIBS" |
---|
257 | # we store libs in YAT_STATIC_LIBS that are not suitable to link into |
---|
258 | # libyat but are needed when creating applications linking against |
---|
259 | # libyat. Typically these are static (only) libraries, but see ticket |
---|
260 | # 737 for discussion. |
---|
261 | YAT_STATIC_LIBS= |
---|
262 | YAT_CHECK_LA_LIBS([ |
---|
263 | double cos(double x); |
---|
264 | double foo(double x) { return cos(x); } |
---|
265 | ], [$LIBS], [$LIBM], [YAT_STATIC_LIBS]) |
---|
266 | |
---|
267 | # GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks |
---|
268 | m4_define([YAT_REQUIRED_GSL_VERSION], [1.13]) |
---|
269 | YAT_CHECK_GSL([YAT_REQUIRED_GSL_VERSION], [], |
---|
270 | [AC_MSG_FAILURE([dnl |
---|
271 | GSL YAT_REQUIRED_GSL_VERSION (or newer) not found. The GNU Scientific Library |
---|
272 | (GSL) library cannot be found. Please make sure GSL is installed.]) |
---|
273 | ]) |
---|
274 | |
---|
275 | # Boost http://www.boost.org |
---|
276 | m4_define([YAT_REQUIRED_BOOST_VERSION], [1.35]) |
---|
277 | AX_BOOST_BASE([YAT_REQUIRED_BOOST_VERSION], [], [AC_MSG_FAILURE([dnl |
---|
278 | Boost YAT_REQUIRED_BOOST_VERSION (or newer) not found. Please install boost, or provide |
---|
279 | CPPFLAGS=-I/path/to/boost]) |
---|
280 | ]) |
---|
281 | # skip boost link tests if boost is not wanted (--without-boost) |
---|
282 | AS_IF([test x"$want_boost" = x"yes"],[ |
---|
283 | YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS]) |
---|
284 | YAT_LD_ADD_FLAG([LDFLAGS], [$BOOST_LDFLAGS]) |
---|
285 | AX_BOOST_IOSTREAMS |
---|
286 | LIBS="$BOOST_IOSTREAMS_LIB $LIBS" |
---|
287 | # Check if $BOOST_IOSTREAMS_LIB is appropriate for libyat.la |
---|
288 | YAT_CHECK_LA_LIBS([ |
---|
289 | @%:@include <boost/iostreams/filtering_stream.hpp> |
---|
290 | int my_func(void) |
---|
291 | { boost::iostreams::filtering_istream fis; return 0; } |
---|
292 | ], [$BOOST_IOSTREAMS_LIB $user_LIBS], |
---|
293 | [$BOOST_IOSTREAMS_LIB], |
---|
294 | [YAT_STATIC_LIBS]) |
---|
295 | |
---|
296 | ]) |
---|
297 | |
---|
298 | # find library implementing BLAS C API, or use gslcblas |
---|
299 | # We wait doing this test until after -L flags have been added to |
---|
300 | # LDFLAGS from gsl and boost, so the search path is the same in the |
---|
301 | # test as at make time and to avoid using the library (see ticket |
---|
302 | # #922) |
---|
303 | YAT_LIB_CBLAS([YAT_CBLAS_LIB=$CBLAS_LIB], [YAT_CBLAS_LIB=-lgslcblas]) |
---|
304 | LIBS="-lgsl $YAT_CBLAS_LIB $LIBS" |
---|
305 | |
---|
306 | YAT_CHECK_LA_LIBS([ |
---|
307 | double gsl_cdf_hypergeometric_P(const unsigned int k, const unsigned int n1, |
---|
308 | const unsigned int n2, const unsigned int t); |
---|
309 | double yat_foo(void) { return gsl_cdf_hypergeometric_P(1,2,3,10); } |
---|
310 | ], [$LIBS], [-lgsl], [YAT_STATIC_LIBS]) |
---|
311 | |
---|
312 | # see tickets #648 #687 |
---|
313 | AC_MSG_CHECKING([whether constructor in boost concept is supported]) |
---|
314 | AC_COMPILE_IFELSE([ |
---|
315 | AC_LANG_PROGRAM( |
---|
316 | [ |
---|
317 | @%:@include <boost/concept_check.hpp> |
---|
318 | template <typename T> |
---|
319 | class MyConcept |
---|
320 | { |
---|
321 | public: |
---|
322 | MyConcept(void) {} |
---|
323 | BOOST_CONCEPT_USAGE(MyConcept){} |
---|
324 | }; |
---|
325 | ],[ |
---|
326 | MyConcept<double> x; |
---|
327 | x = x; |
---|
328 | ]) |
---|
329 | ], |
---|
330 | [AC_MSG_RESULT([yes]) |
---|
331 | AC_DEFINE([YAT_HAVE_BOOST_CONCEPT_WITH_CONSTRUCTOR],[1], |
---|
332 | [define if compiler supports boost concept with constructor]) |
---|
333 | ], |
---|
334 | [AC_MSG_RESULT([no])] |
---|
335 | ) |
---|
336 | |
---|
337 | # Check if boost::iterator_facade::operator-> works with a proxy class |
---|
338 | # as reference_type; otherwise workaround is needed in |
---|
339 | # e.g. BamPairIterator. See ticket #790. |
---|
340 | AC_MSG_CHECKING([if boost::iterator_facade::operator-> works]) |
---|
341 | AC_COMPILE_IFELSE( |
---|
342 | [AC_LANG_PROGRAM( |
---|
343 | [@%:@include <iterator> |
---|
344 | @%:@include <boost/iterator/iterator_facade.hpp> |
---|
345 | struct MyClass { void foo(void) const { } }; |
---|
346 | struct MyProxy { void foo(void) const { } }; |
---|
347 | // a nonsense class (only for compiler test purposes) |
---|
348 | class MyIterator |
---|
349 | : public boost::iterator_facade< |
---|
350 | MyIterator, const MyClass, std::input_iterator_tag, MyProxy |
---|
351 | > |
---|
352 | { |
---|
353 | friend class boost::iterator_core_access; |
---|
354 | const MyProxy dereference(void) const { return MyProxy(); } |
---|
355 | bool equal(const MyIterator& other) const { return true; } |
---|
356 | void increment(void) {} |
---|
357 | }; |
---|
358 | ], |
---|
359 | [MyIterator iter; iter->foo();] |
---|
360 | ) |
---|
361 | ],[ |
---|
362 | AC_MSG_RESULT([yes]) |
---|
363 | AC_DEFINE([YAT_HAVE_BOOST_ITERATOR_FACADE_PROXY_PTR], [1], |
---|
364 | [Define to 1 if boost::iterator_facade::operator-> works]) |
---|
365 | ],[ |
---|
366 | AC_MSG_RESULT([no]) |
---|
367 | ]) |
---|
368 | |
---|
369 | |
---|
370 | # check for hts and samtools available from http://www.htslib.org |
---|
371 | YAT_CHECK_HTSLIB |
---|
372 | |
---|
373 | #support for large files |
---|
374 | AC_SYS_LARGEFILE |
---|
375 | if test "$enable_largefile" = "no"; then |
---|
376 | AC_DEFINE([YAT_LFS_DISABLED], 1, |
---|
377 | [defined to 1 if large file support is disabled]) |
---|
378 | fi |
---|
379 | |
---|
380 | AC_DEFINE([HAVE_INLINE], [1], [Define if inline is available on system]) |
---|
381 | # default is same as --disable-debug |
---|
382 | AC_ARG_ENABLE([debug], |
---|
383 | [AS_HELP_STRING([--enable-debug],[turn on debug options and code])], |
---|
384 | [], [enable_debug=no]) |
---|
385 | |
---|
386 | # If neither --enable-assert nor --disable-assert, set enable_assert |
---|
387 | # to same as enable_debug |
---|
388 | AC_ARG_ENABLE([assert], |
---|
389 | [AS_HELP_STRING([--enable-assert], [turn on assertions])], |
---|
390 | [], [enable_assert=$enable_debug]) |
---|
391 | |
---|
392 | # we use prefix INTERNAL_ for variables that are solely needed for |
---|
393 | # building yat, i.e., they are not needed for a user of yat and are |
---|
394 | # not propagated to yat-config or yat.m4. |
---|
395 | AC_ARG_VAR([INTERNAL_CPPFLAGS], |
---|
396 | [Similar to CPPFLAGS but value is not propagated to yat-config]) |
---|
397 | AC_ARG_VAR([INTERNAL_CXXFLAGS], |
---|
398 | [Similar to CXXFLAGS but value is not propagated to yat-config]) |
---|
399 | AC_ARG_VAR([INTERNAL_LDFLAGS], |
---|
400 | [Similar to LDFLAGS but value is not propagated to yat-config]) |
---|
401 | |
---|
402 | AS_IF([test "${enable_debug}" = "yes"], [ |
---|
403 | AC_DEFINE([YAT_DEBUG], [1], [Define to activate yat assertioons]) |
---|
404 | YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wall -pedantic -g -O]) |
---|
405 | ], [ |
---|
406 | # avoid defining GSL_RANGE_CHECK_OFF if GSL_RANGE_CHECK is already defined |
---|
407 | AC_CHECK_DECL([GSL_RANGE_CHECK],[], |
---|
408 | [AC_DEFINE([GSL_RANGE_CHECK_OFF], [1], |
---|
409 | [Define to turn off GSL range checks])]) |
---|
410 | # If CXXFLAGS not set by user, set it to default value |
---|
411 | AS_IF([test x$CXXFLAGS_set_by_user != xyes], [ |
---|
412 | YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS],[-O3]) |
---|
413 | ]) |
---|
414 | ]) |
---|
415 | |
---|
416 | AS_IF([test x"$enable_assert" = x"no"], [ |
---|
417 | AC_DEFINE([NDEBUG], [1], [Define to turn off assertions]) |
---|
418 | ]) |
---|
419 | |
---|
420 | # turn off compiler warning #654 from intel compiler |
---|
421 | AS_IF([test x"$ax_cv_cxx_compiler_vendor" = x"intel"], [ |
---|
422 | YAT_CXX_ADD_FLAG([CXXFLAGS], ['-diag-disable 654']) |
---|
423 | ]) |
---|
424 | |
---|
425 | # Turns warnings to errors in compilation tests. Only put tests that |
---|
426 | # should be warning sensitive below this point. Can't find any |
---|
427 | # mechanism to revert AC_LANG_WERROR |
---|
428 | AC_LANG_WERROR |
---|
429 | |
---|
430 | # GCC 4.0.1 on OSX complains about -pthread (issue #713) |
---|
431 | AS_IF([AS_ECHO(["$CPPFLAGS"]) | $GREP '\-pthread' > /dev/null], |
---|
432 | [AX_CHECK_PREPROC_FLAG([-pthread], [], |
---|
433 | [CPPFLAGS=`AS_ECHO(["$CPPFLAGS"]) | $SED 's%-pthread%%'`], |
---|
434 | [$INTERNAL_CPPFLAGS]) |
---|
435 | ]) |
---|
436 | |
---|
437 | # When compiling boost::Mutable_*Iterator some versions of clang complains: |
---|
438 | # warning: unsequenced modification and access to 'i' [-Wunsequenced] |
---|
439 | # Test if compiler gives that warning, and if it does turn it off. |
---|
440 | yat_save_CXXFLAGS=$CXXFLAGS |
---|
441 | AC_MSG_CHECKING([whether 'boost/concept_check.hpp' causes compiler warnings]) |
---|
442 | CXXFLAGS="$INTERNAL_CXXFLAGS $CXXFLAGS" |
---|
443 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
---|
444 | [ |
---|
445 | @%:@include <boost/concept_check.hpp> |
---|
446 | ],[ |
---|
447 | BOOST_CONCEPT_ASSERT((boost::Mutable_RandomAccessIterator<double* >)); |
---|
448 | ]) |
---|
449 | ], [ # IF-SUCCESSFUL |
---|
450 | AC_MSG_RESULT([no]) |
---|
451 | # restore CXXFLAGS |
---|
452 | CXXFLAGS=$yat_save_CXXFLAGS |
---|
453 | ], [ # IF-FAILED |
---|
454 | AC_MSG_RESULT([yes]) |
---|
455 | CXXFLAGS=$yat_save_CXXFLAGS |
---|
456 | YAT_CXX_ADD_FLAG([CXXFLAGS], [-Wno-unsequenced]) |
---|
457 | ]) |
---|
458 | |
---|
459 | AC_CONFIG_FILES([build_support/gen_yat_pc.sh], |
---|
460 | [chmod +x build_support/gen_yat_pc.sh]) |
---|
461 | AC_CONFIG_FILES([Makefile |
---|
462 | doc/first_page.doxygen |
---|
463 | test/defs.sh |
---|
464 | ]) |
---|
465 | |
---|
466 | AC_CONFIG_HEADERS([yat/utility/config_public.h]) |
---|
467 | canonical_abs_top_srcdir=`cd $srcdir && pwd -P` |
---|
468 | AC_SUBST([canonical_abs_top_srcdir]) |
---|
469 | canonical_abs_top_builddir=`pwd -P` |
---|
470 | AC_SUBST([canonical_abs_top_builddir]) |
---|
471 | |
---|
472 | # for the test suite |
---|
473 | yat_abs_top_srcdir=`cd $srcdir && pwd` |
---|
474 | AC_DEFINE_UNQUOTED([YAT_ABS_TOP_SRCDIR], ["$yat_abs_top_srcdir"], |
---|
475 | [Define to absolute path to top yat src dir]) |
---|
476 | |
---|
477 | # Reset flags |
---|
478 | APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_) |
---|
479 | APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, YAT_) |
---|
480 | APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, YAT_) |
---|
481 | APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_) |
---|
482 | |
---|
483 | # Set some variables useful when linking |
---|
484 | AC_SUBST([YAT_STATIC_LIBS]) |
---|
485 | |
---|
486 | # libs used in libyat.la |
---|
487 | yat_libyat_la_LIBADD="$YAT_LIBS" |
---|
488 | # We avoid linking in cblas in libyat.la, to let users choose |
---|
489 | # favourite cblas library at link time. |
---|
490 | YAT_VAR_REMOVE([yat_libyat_la_LIBADD], [$YAT_CBLAS_LIB]) |
---|
491 | # we avoid linking in YAT_STATIC_LIBS as they have been detected to |
---|
492 | # not be suitable libtool archive. |
---|
493 | YAT_VAR_REMOVE([yat_libyat_la_LIBADD], [$YAT_STATIC_LIBS]) |
---|
494 | AC_SUBST([yat_libyat_la_LIBADD]) |
---|
495 | |
---|
496 | # Primary LIBS are same as linked into libyat.la excluding LIBM |
---|
497 | YAT_PRIMARY_LIBS=$yat_libyat_la_LIBADD |
---|
498 | YAT_VAR_REMOVE([YAT_PRIMARY_LIBS], [$LIBM]) |
---|
499 | AC_SUBST(YAT_PRIMARY_LIBS) |
---|
500 | |
---|
501 | # Assign LIBS variables for yat.pc |
---|
502 | YAT_PC_LIBS_PRIVATE=$YAT_LIBS |
---|
503 | |
---|
504 | # Dependency to GSL is noted via 'Requires' field |
---|
505 | YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [-lgsl $YAT_CBLAS_LIB $LIBM]) |
---|
506 | YAT_PC_REQUIRES="gsl >= YAT_REQUIRED_GSL_VERSION" |
---|
507 | |
---|
508 | # ignore this whole htslib thing if --without-htslib |
---|
509 | AS_IF([test x$with_htslib != x"no"], [ |
---|
510 | # htslib comes with a pc file, so we can require htslib in yat.pc |
---|
511 | YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [$HTS_LIBS -lz]) |
---|
512 | YAT_PC_REQUIRES="$YAT_PC_REQUIRES htslib" |
---|
513 | ]) |
---|
514 | |
---|
515 | # Having libs declared as LIBS.private in yat.pc assumes that libs |
---|
516 | # have been linked into libyat. Therefore for each lib check if it is |
---|
517 | # mentioned in $yat_libyat_la_LIBADD, and if it's not move |
---|
518 | # lib to LIBS variable. |
---|
519 | for lib in $YAT_PC_LIBS_PRIVATE; do |
---|
520 | YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [$lib], [ |
---|
521 | ], [ |
---|
522 | # move lib from $YAT_PC_LIBS_PRIVATE to $YAT_PC_LIBS |
---|
523 | YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [$lib]) |
---|
524 | YAT_PC_LIBS="$YAT_PC_LIBS $lib" |
---|
525 | ]) |
---|
526 | done |
---|
527 | |
---|
528 | AC_SUBST([YAT_PC_LIBS]) |
---|
529 | AC_SUBST([YAT_PC_REQUIRES]) |
---|
530 | AC_SUBST([YAT_PC_LIBS_PRIVATE]) |
---|
531 | AC_SUBST([YAT_PC_REQUIRES_PRIVATE]) |
---|
532 | |
---|
533 | # propagate some variables to 'yat-config' |
---|
534 | AC_ARG_VAR([YAT_CONFIG_CPPFLAGS], |
---|
535 | [Similar to CPPFLAGS but value is only propagated to yat-config]) |
---|
536 | AC_ARG_VAR([YAT_CONFIG_CXXFLAGS], |
---|
537 | [Similar to CXXFLAGS but value is only propagated to yat-config]) |
---|
538 | AC_ARG_VAR([YAT_CONFIG_LDFLAGS], |
---|
539 | [Similar to LDFLAGS but value is only propagated to yat-config]) |
---|
540 | AC_SUBST([YAT_CONFIG_CPPFLAGS]) |
---|
541 | AC_SUBST([YAT_CONFIG_CXXFLAGS]) |
---|
542 | AC_SUBST([YAT_CONFIG_LDFLAGS]) |
---|
543 | |
---|
544 | AC_SUBST([GXX]) |
---|
545 | AC_SUBST(YAT_LIBS) |
---|
546 | AC_SUBST(YAT_CBLAS_LIB) |
---|
547 | |
---|
548 | # set and AC_SUBST variables that are interpreted by Automake |
---|
549 | AM_CPPFLAGS="$INTERNAL_CPPFLAGS $YAT_CPPFLAGS" |
---|
550 | AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS" |
---|
551 | AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS" |
---|
552 | |
---|
553 | AC_SUBST(AM_CPPFLAGS) |
---|
554 | AC_SUBST(AM_CXXFLAGS) |
---|
555 | AC_SUBST(AM_LDFLAGS) |
---|
556 | AC_SUBST([enable_shared]) |
---|
557 | AC_SUBST([enable_static]) |
---|
558 | |
---|
559 | # Name of directory libtool put stuff int - needed for some tests |
---|
560 | AC_SUBST([lt_cv_objdir]) |
---|
561 | |
---|
562 | YAT_SVN_RELEASE([am/maintainer.am], |
---|
563 | [$(YAT_MAJOR_VERSION).$(YAT_MINOR_VERSION)], |
---|
564 | [libyat@frs.sourceforge.net:/home/frs/project/l/li/libyat], |
---|
565 | [http://sourceforge.net/projects/libyat/files/$(distdir).tar.gz/files], |
---|
566 | [http://dev.thep.lu.se/yat/browser/tags/$(VERSION)/NEWS]) |
---|
567 | |
---|
568 | # make shell tests work in VPATH builds |
---|
569 | AC_CONFIG_LINKS([test/init.sh:test/init.sh]) |
---|
570 | |
---|
571 | # set some variable for final message |
---|
572 | AS_CASE([$have_doxygen], |
---|
573 | [yes], [doxygen_message=yes], |
---|
574 | [no], [doxygen_message="no (doxygen not found)"], |
---|
575 | [old], [doxygen_message="no (\`$DOXYGEN' too old)"], |
---|
576 | [notwanted], [doxygen_message="no"], |
---|
577 | [AC_MSG_WARN([unexpected value \$have_doxygen: '$have_doxygen']) |
---|
578 | AS_BOX([Report this to ]AC_PACKAGE_BUGREPORT) |
---|
579 | ]) |
---|
580 | |
---|
581 | yat_gslcblas_message= |
---|
582 | AS_IF([test "x$YAT_CBLAS_LIB" = "x-lgslcblas"], [ |
---|
583 | yat_gslcblas_message=' |
---|
584 | GSL CBLAS found. This is a reference implementation only. |
---|
585 | Consider using hardware optimized BLAS. |
---|
586 | ATLAS (http://math-atlas.sourceforge.net/) provides an |
---|
587 | optimized BLAS library. It is supported by yat! |
---|
588 | ' |
---|
589 | ]) |
---|
590 | |
---|
591 | # Create output. |
---|
592 | AC_OUTPUT |
---|
593 | |
---|
594 | |
---|
595 | # Some more messages. |
---|
596 | AC_MSG_RESULT([ |
---|
597 | yat is configured as follows: |
---|
598 | |
---|
599 | Build Shared Library: $enable_shared |
---|
600 | Build Static Library: $enable_static |
---|
601 | Build Documentation: $doxygen_message |
---|
602 | With Bam Support: $with_htslib |
---|
603 | |
---|
604 | Options used to compile and link: |
---|
605 | VERSION = $VERSION |
---|
606 | CXX = $CXX |
---|
607 | CPPFLAGS = $CPPFLAGS |
---|
608 | YAT_CPPFLAGS= $AM_CPPFLAGS |
---|
609 | CXXFLAGS = $CXXFLAGS |
---|
610 | YAT_CXXFLAGS= $AM_CXXFLAGS |
---|
611 | LD = $LD |
---|
612 | LDFLAGS = $LDFLAGS |
---|
613 | YAT_LDFLAGS = $AM_LDFLAGS |
---|
614 | LIBS = $LIBS |
---|
615 | YAT_LIBS = $YAT_LIBS |
---|
616 | ${yat_gslcblas_message}dnl |
---|
617 | ---------------------------------------------------------------- |
---|
618 | Now type `make'. dnl |
---|
619 | ]) |
---|