1 | ## Process this file with autoconf to produce a configure script. |
---|
2 | ## |
---|
3 | ## $Id: configure.ac 3900 2020-05-03 08:29:25Z 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 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_IF([test $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 | AC_ARG_ENABLE([cxx11], |
---|
90 | [AS_HELP_STRING([--enable-cxx11], |
---|
91 | [search for compiler options to build with C++11 support]) |
---|
92 | AS_HELP_STRING([--disable-cxx11], |
---|
93 | [turn off C++11 support])], |
---|
94 | # disallow --enable-cxx11=foo (only yes or no) |
---|
95 | [AS_CASE([$enable_cxx11], |
---|
96 | [yes|no], [], |
---|
97 | [AC_MSG_ERROR([invalid argument for --enable-cxx11: $enable_cxx11])]) |
---|
98 | ], |
---|
99 | #default |
---|
100 | [enable_cxx11=maybe]) |
---|
101 | |
---|
102 | yat_have_rvalue=no |
---|
103 | yat_have_atomic=no |
---|
104 | yat_have_log2=no |
---|
105 | AS_VAR_IF([enable_cxx11], [no], [], [ |
---|
106 | # if CXX11 is wanted look for rvalue support |
---|
107 | YAT_CXX_RVALUE([yat_have_rvalue=yes |
---|
108 | AC_DEFINE([YAT_HAVE_RVALUE], [1], |
---|
109 | [Define if compiler supports rvalues])], |
---|
110 | [], [$enable_cxx11]) |
---|
111 | |
---|
112 | YAT_CXX_ATOMIC([yat_have_atomic=yes |
---|
113 | AC_DEFINE([YAT_HAVE_ATOMIC], [1], |
---|
114 | [Define if compiler supports std::atomic])], |
---|
115 | [], [$enable_cxx11]) |
---|
116 | |
---|
117 | YAT_CXX_LOG2([yat_have_log2=yes |
---|
118 | AC_DEFINE([YAT_HAVE_LOG2], [1], |
---|
119 | [Define if std::log2 exists])], |
---|
120 | [], [$enable_cxx11]) |
---|
121 | |
---|
122 | YAT_CXX_THROW_IF_NESTED([yat_have_throw_if_nested=yes |
---|
123 | AC_DEFINE([YAT_HAVE_THROW_IF_NESTED], [1], |
---|
124 | [Define if std::throw_if_nested exists])], |
---|
125 | [], [$enable_cxx11]) |
---|
126 | |
---|
127 | # Unless --disable-cxx11, #define YAT_WITH_CXX11 in 'config.h'. The |
---|
128 | # private 'config.h' is #included first in every source file |
---|
129 | # (i.e. before 'config_public.h') and thereby YAT_HAVE_CXX11__ is |
---|
130 | # #defined and cxx11 features compiled into libyat (if available). |
---|
131 | AC_DEFINE([YAT_WITH_CXX11], [1], [Define if cxx11 is wanted]) |
---|
132 | ]) |
---|
133 | |
---|
134 | AC_PROG_SED |
---|
135 | AC_PROG_LIBTOOL |
---|
136 | |
---|
137 | # find the compiler vendor: gnu, intel, etc |
---|
138 | AX_COMPILER_VENDOR |
---|
139 | |
---|
140 | AC_ARG_VAR([DOXYGEN], [path to doxygen program]) |
---|
141 | have_doxygen=no |
---|
142 | |
---|
143 | # Let the user turn off usage of doxygen |
---|
144 | AS_VAR_IF([DOXYGEN], [no], [ |
---|
145 | have_doxygen=notwanted |
---|
146 | ], [ |
---|
147 | AC_PATH_PROG([DOXYGEN], [doxygen], [no]) |
---|
148 | AS_VAR_IF([DOXYGEN], [no], [ |
---|
149 | AC_MSG_WARN([unable to find doxygen application]) |
---|
150 | ], [ # if we found doxygen look that it's new enough |
---|
151 | doxygen_min_version=1.5 |
---|
152 | AC_MSG_CHECKING([if doxygen is at least $doxygen_min_version]) |
---|
153 | doxygen_version=`$DOXYGEN --version` |
---|
154 | AX_COMPARE_VERSION([$doxygen_version], [ge], [$doxygen_min_version], |
---|
155 | [have_doxygen=yes], [have_doxygen=old]) |
---|
156 | AC_MSG_RESULT([$doxygen_version]) |
---|
157 | ]) |
---|
158 | ]) |
---|
159 | |
---|
160 | AC_SUBST(have_doxygen) |
---|
161 | AM_CONDITIONAL([DX_ENABLE_HTML], [test x$have_doxygen = xyes]) |
---|
162 | |
---|
163 | # check for quiet_NaN support in OS |
---|
164 | # Check at run-time, but if we are cross-compiling fall back on a |
---|
165 | # compilation test |
---|
166 | AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true]) |
---|
167 | AC_RUN_IFELSE( |
---|
168 | [AC_LANG_PROGRAM( |
---|
169 | [@%:@include <limits>], |
---|
170 | [return !std::numeric_limits<double>::has_quiet_NaN])], |
---|
171 | [quiet_nan=yes |
---|
172 | AC_MSG_RESULT($quiet_nan)], |
---|
173 | [quiet_nan=no |
---|
174 | AC_MSG_RESULT($quiet_nan)], |
---|
175 | # if we are cross-compiling fall back on compilation test |
---|
176 | [AC_MSG_RESULT(cross-compiling) |
---|
177 | AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()]) |
---|
178 | AC_COMPILE_IFELSE( |
---|
179 | [AC_LANG_PROGRAM( |
---|
180 | [@%:@include <limits> |
---|
181 | extern void f(double);], |
---|
182 | [f(std::numeric_limits<double>::quiet_NaN())])], |
---|
183 | [quiet_nan=yes], |
---|
184 | [quiet_nan=no]) |
---|
185 | AC_MSG_RESULT($quiet_nan)]) |
---|
186 | # No support for quiet NAN is fatal -- sub-sequent compilation, or execution |
---|
187 | # of created binary, will fail. |
---|
188 | AS_IF([test x"$quiet_nan" = x"no"], [ |
---|
189 | AC_MSG_FAILURE([dnl |
---|
190 | Support for quiet NAN required. yat will not work on this system!]) |
---|
191 | ]) |
---|
192 | |
---|
193 | # Check for infinity support for doubles in OS |
---|
194 | # Check at run-time, but if we are cross-compiling fall back on a |
---|
195 | # compilation test |
---|
196 | AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true]) |
---|
197 | AC_RUN_IFELSE( |
---|
198 | [AC_LANG_PROGRAM( |
---|
199 | [@%:@include <limits>], |
---|
200 | [return !std::numeric_limits<double>::has_infinity])], |
---|
201 | [has_infinity=yes |
---|
202 | AC_MSG_RESULT($has_infinity)], |
---|
203 | [has_infinity=no |
---|
204 | AC_MSG_RESULT($has_infinity)], |
---|
205 | # if we are cross-compiling fall back on compilation test |
---|
206 | [AC_MSG_RESULT(cross-compiling) |
---|
207 | AC_MSG_CHECKING([for std::numeric_limits<>::infinity()]) |
---|
208 | AC_COMPILE_IFELSE( |
---|
209 | [AC_LANG_PROGRAM( |
---|
210 | [@%:@include <limits> |
---|
211 | extern void f(double);], |
---|
212 | [f(std::numeric_limits<double>::infinity())])], |
---|
213 | [has_infinity=yes], |
---|
214 | [has_infinity=no]) |
---|
215 | AC_MSG_RESULT($has_infinity)]) |
---|
216 | # No support for infinity is fatal -- sub-sequent compilation, or execution |
---|
217 | # of created binary, will fail. |
---|
218 | AS_IF([test x"${has_infinity}" = x"no"], [ |
---|
219 | AC_MSG_FAILURE([dnl |
---|
220 | Support for infinity required. yat will not work on this system!]) |
---|
221 | ]) |
---|
222 | |
---|
223 | |
---|
224 | AC_MSG_CHECKING([g++ deprecation attribute]) |
---|
225 | AC_COMPILE_IFELSE( |
---|
226 | [AC_LANG_PROGRAM([[void f() __attribute__ ((deprecated));]],)], |
---|
227 | [AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1], |
---|
228 | [Define if compiler supports deprecated attribute, as in g++ 4.0]) |
---|
229 | AC_MSG_RESULT([yes])], |
---|
230 | [AC_MSG_RESULT([no])] ) |
---|
231 | |
---|
232 | AC_MSG_CHECKING([if std::multiset::iterator is mutable]) |
---|
233 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <set> |
---|
234 | @%:@include <vector>]], |
---|
235 | [[std::set<std::vector<double> > s; |
---|
236 | std::vector<double> v; |
---|
237 | s.insert(v); |
---|
238 | s.begin()->reserve(100); |
---|
239 | ]])], |
---|
240 | [AC_DEFINE([MULTISET_ITERATOR_IS_MUTABLE], [1], |
---|
241 | [Define if std::multiset::iterator is mutable]) |
---|
242 | AC_MSG_RESULT([yes]) |
---|
243 | ], |
---|
244 | [AC_MSG_RESULT([no])] ) |
---|
245 | |
---|
246 | # Save user-defined environment settings for later restoration |
---|
247 | APR_SAVE_THE_ENVIRONMENT(CPPFLAGS) |
---|
248 | APR_SAVE_THE_ENVIRONMENT(CXXFLAGS) |
---|
249 | APR_SAVE_THE_ENVIRONMENT(LDFLAGS) |
---|
250 | APR_SAVE_THE_ENVIRONMENT(LIBS) |
---|
251 | user_LIBS=$LIBS |
---|
252 | |
---|
253 | AS_CASE([$host_os], [darwin*], [ |
---|
254 | YAT_LD_ADD_FLAG([LDFLAGS], [-Wl,-flat_namespace]) |
---|
255 | ]) |
---|
256 | |
---|
257 | # prefer using libtool in link tests |
---|
258 | YAT_USE_LIBTOOL_PUSH |
---|
259 | |
---|
260 | # Checks for libraries. |
---|
261 | AC_MSG_NOTICE([checking for libraries]) |
---|
262 | AC_CHECK_LIBM |
---|
263 | LIBS="$LIBM $LIBS" |
---|
264 | # we store libs in YAT_STATIC_LIBS that are not suitable to link into |
---|
265 | # libyat but are needed when creating applications linking against |
---|
266 | # libyat. Typically these are static (only) libraries, but see ticket |
---|
267 | # 737 for discussion. |
---|
268 | YAT_STATIC_LIBS= |
---|
269 | YAT_CHECK_LA_LIBS([ |
---|
270 | double cos(double x); |
---|
271 | double foo(double x) { return cos(x); } |
---|
272 | ], [$LIBS], [$LIBM], [YAT_STATIC_LIBS]) |
---|
273 | |
---|
274 | # GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks |
---|
275 | m4_define([YAT_REQUIRED_GSL_VERSION], [1.8]) |
---|
276 | YAT_CHECK_GSL([YAT_REQUIRED_GSL_VERSION], [], |
---|
277 | [AC_MSG_FAILURE([dnl |
---|
278 | GSL YAT_REQUIRED_GSL_VERSION (or newer) not found. The GNU Scientific Library |
---|
279 | (GSL) library cannot be found. Please make sure GSL is installed.]) |
---|
280 | ]) |
---|
281 | |
---|
282 | # Boost http://www.boost.org |
---|
283 | m4_define([YAT_REQUIRED_BOOST_VERSION], [1.35]) |
---|
284 | AX_BOOST_BASE([YAT_REQUIRED_BOOST_VERSION], [], [AC_MSG_FAILURE([dnl |
---|
285 | Boost YAT_REQUIRED_BOOST_VERSION (or newer) not found. Please install boost, or provide |
---|
286 | CPPFLAGS=-I/path/to/boost]) |
---|
287 | ]) |
---|
288 | # skip boost link tests if boost is not wanted (--without-boost) |
---|
289 | AS_IF([test x"$want_boost" = x"yes"],[ |
---|
290 | AX_BOOST_SYSTEM |
---|
291 | LIBS="$BOOST_SYSTEM_LIB $LIBS" |
---|
292 | AX_BOOST_THREAD |
---|
293 | YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS]) |
---|
294 | YAT_LD_ADD_FLAG([LDFLAGS], [$BOOST_LDFLAGS]) |
---|
295 | LIBS="$BOOST_THREAD_LIB $LIBS" |
---|
296 | # linking tests in AX_BOOST_SYSTEM occasionaly miss to detect |
---|
297 | # missing lib (see ticket #719), so link specifically here to catch |
---|
298 | # that case. |
---|
299 | AC_MSG_CHECKING([for boost::thread_specific_ptr]) |
---|
300 | AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include <boost/thread/tss.hpp>], |
---|
301 | [boost::thread_specific_ptr<int> x; |
---|
302 | x.reset(new int(1));])], |
---|
303 | [AC_MSG_RESULT([yes])], |
---|
304 | [AC_MSG_RESULT([no]) |
---|
305 | AC_MSG_FAILURE([Boost thread library not found.]) |
---|
306 | ]) |
---|
307 | # Check if $BOOST_THREAD_LIB is appropriate for libyat.la |
---|
308 | YAT_CHECK_LA_LIBS([ |
---|
309 | @%:@include <boost/thread.hpp> |
---|
310 | int my_func(void) |
---|
311 | { boost::mutex mutex_; return 0; } |
---|
312 | ], [$BOOST_THREAD_LIB $user_LIBS], [$BOOST_THREAD_LIB], [YAT_STATIC_LIBS]) |
---|
313 | # Check if $BOOST_SYSTEM_LIB is appropriate for libyat.la |
---|
314 | YAT_CHECK_LA_LIBS([ |
---|
315 | @%:@include <boost/system/error_code.hpp> |
---|
316 | int my_func(void) |
---|
317 | { boost::system::system_category; return 0; } |
---|
318 | ], [$BOOST_SYSTEM_LIB $user_LIBS], [$BOOST_SYSTEM_LIB], [YAT_STATIC_LIBS]) |
---|
319 | |
---|
320 | AX_BOOST_IOSTREAMS |
---|
321 | LIBS="$BOOST_IOSTREAMS_LIB $LIBS" |
---|
322 | # Check if $BOOST_IOSTREAMS_LIB is appropriate for libyat.la |
---|
323 | YAT_CHECK_LA_LIBS([ |
---|
324 | @%:@include <boost/iostreams/filtering_stream.hpp> |
---|
325 | int my_func(void) |
---|
326 | { boost::iostreams::filtering_istream fis; return 0; } |
---|
327 | ], [$BOOST_IOSTREAMS_LIB $user_LIBS], |
---|
328 | [$BOOST_IOSTREAMS_LIB], |
---|
329 | [YAT_STATIC_LIBS]) |
---|
330 | |
---|
331 | ]) |
---|
332 | |
---|
333 | # find library implementing BLAS C API, or use gslcblas |
---|
334 | # We wait doing this test until after -L flags have been added to |
---|
335 | # LDFLAGS from gsl and boost, so the search path is the same in the |
---|
336 | # test as at make time and to avoid using the library (see ticket |
---|
337 | # #922) |
---|
338 | YAT_LIB_CBLAS([YAT_CBLAS_LIB=$CBLAS_LIB], [YAT_CBLAS_LIB=-lgslcblas]) |
---|
339 | LIBS="-lgsl $YAT_CBLAS_LIB $LIBS" |
---|
340 | |
---|
341 | YAT_CHECK_LA_LIBS([ |
---|
342 | double gsl_cdf_hypergeometric_P(const unsigned int k, const unsigned int n1, |
---|
343 | const unsigned int n2, const unsigned int t); |
---|
344 | double yat_foo(void) { return gsl_cdf_hypergeometric_P(1,2,3,10); } |
---|
345 | ], [$LIBS], [-lgsl], [YAT_STATIC_LIBS]) |
---|
346 | |
---|
347 | # see tickets #648 #687 |
---|
348 | AC_MSG_CHECKING([whether constructor in boost concept is supported]) |
---|
349 | AC_COMPILE_IFELSE([ |
---|
350 | AC_LANG_PROGRAM( |
---|
351 | [ |
---|
352 | @%:@include <boost/concept_check.hpp> |
---|
353 | template <typename T> |
---|
354 | class MyConcept |
---|
355 | { |
---|
356 | public: |
---|
357 | MyConcept(void) {} |
---|
358 | BOOST_CONCEPT_USAGE(MyConcept){} |
---|
359 | }; |
---|
360 | ],[ |
---|
361 | MyConcept<double> x; |
---|
362 | x = x; |
---|
363 | ]) |
---|
364 | ], |
---|
365 | [AC_MSG_RESULT([yes]) |
---|
366 | AC_DEFINE([YAT_HAVE_BOOST_CONCEPT_WITH_CONSTRUCTOR],[1], |
---|
367 | [define if compiler supports boost concept with constructor]) |
---|
368 | ], |
---|
369 | [AC_MSG_RESULT([no])] |
---|
370 | ) |
---|
371 | |
---|
372 | # Workaround problem that boost 1.41 does not work with certain versions of GCC |
---|
373 | # see ticket #762 |
---|
374 | AC_MSG_CHECKING([if boost::mutex workaround is needed]) |
---|
375 | AC_COMPILE_IFELSE( |
---|
376 | [AC_LANG_PROGRAM([@%:@include <boost/thread.hpp>], |
---|
377 | [boost::mutex mutex;] |
---|
378 | )], |
---|
379 | [AC_MSG_RESULT([no]) |
---|
380 | AC_DEFINE([YAT_HAVE_WORKING_BOOST_EXCEPTION_PTR], [1], |
---|
381 | [Define to 1 if boost::exception_ptr works]) |
---|
382 | ], |
---|
383 | [AC_MSG_RESULT([yes])]) |
---|
384 | |
---|
385 | # Check if boost::iterator_facade::operator-> works with a proxy class |
---|
386 | # as reference_type; otherwise workaround is needed in |
---|
387 | # e.g. BamPairIterator. See ticket #790. |
---|
388 | AC_MSG_CHECKING([if boost::iterator_facade::operator-> works]) |
---|
389 | AC_COMPILE_IFELSE( |
---|
390 | [AC_LANG_PROGRAM( |
---|
391 | [@%:@include <iterator> |
---|
392 | @%:@include <boost/iterator/iterator_facade.hpp> |
---|
393 | struct MyClass { void foo(void) const { } }; |
---|
394 | struct MyProxy { void foo(void) const { } }; |
---|
395 | // a nonsense class (only for compiler test purposes) |
---|
396 | class MyIterator |
---|
397 | : public boost::iterator_facade< |
---|
398 | MyIterator, const MyClass, std::input_iterator_tag, MyProxy |
---|
399 | > |
---|
400 | { |
---|
401 | friend class boost::iterator_core_access; |
---|
402 | const MyProxy dereference(void) const { return MyProxy(); } |
---|
403 | bool equal(const MyIterator& other) const { return true; } |
---|
404 | void increment(void) {} |
---|
405 | }; |
---|
406 | ], |
---|
407 | [MyIterator iter; iter->foo();] |
---|
408 | ) |
---|
409 | ],[ |
---|
410 | AC_MSG_RESULT([yes]) |
---|
411 | AC_DEFINE([YAT_HAVE_BOOST_ITERATOR_FACADE_PROXY_PTR], [1], |
---|
412 | [Define to 1 if boost::iterator_facade::operator-> works]) |
---|
413 | ],[ |
---|
414 | AC_MSG_RESULT([no]) |
---|
415 | ]) |
---|
416 | # test if boost::random::non_central_chi_squared_distribution<> is |
---|
417 | # available in header file |
---|
418 | # <boost/random/non_central_chi_squared_distribution.hpp> |
---|
419 | AC_COMPILE_IFELSE([ |
---|
420 | AC_LANG_PROGRAM( |
---|
421 | [@%:@include <boost/random/non_central_chi_squared_distribution.hpp>], |
---|
422 | [boost::random::non_central_chi_squared_distribution<> foo]) |
---|
423 | ], [ |
---|
424 | AC_DEFINE([YAT_HAVE_BOOST_RANDOM_NON_CENTRAL_CHI_SQUARED_DISTRIBUTION], |
---|
425 | [1], |
---|
426 | [Define to 1 if boost::random::non_central_chi_squared_distribution<> is available]) |
---|
427 | ]) |
---|
428 | |
---|
429 | # AC_DEFINE([YAT_HAVE_BOOST_RANDOM_NON_CENTRAL_CHI_SQUARED_DISTRIBUTION], |
---|
430 | # [1], |
---|
431 | # [define if boost::random::non_central_chi_squared_distribution<> is available]) |
---|
432 | |
---|
433 | # check for hts and samtools available from http://www.htslib.org |
---|
434 | YAT_CHECK_HTSLIB |
---|
435 | |
---|
436 | #support for large files |
---|
437 | AC_SYS_LARGEFILE |
---|
438 | if test "$enable_largefile" = "no"; then |
---|
439 | AC_DEFINE([YAT_LFS_DISABLED], 1, |
---|
440 | [defined to 1 if large file support is disabled]) |
---|
441 | fi |
---|
442 | |
---|
443 | AC_DEFINE([HAVE_INLINE], [1], [Define if inline is available on system]) |
---|
444 | # default is same as --disable-debug |
---|
445 | AC_ARG_ENABLE([debug], |
---|
446 | [AS_HELP_STRING([--enable-debug],[turn on debug options and code])], |
---|
447 | [], [enable_debug=no]) |
---|
448 | |
---|
449 | # If neither --enable-assert nor --disable-assert, set enable_assert |
---|
450 | # to same as enable_debug |
---|
451 | AC_ARG_ENABLE([assert], |
---|
452 | [AS_HELP_STRING([--enable-assert], [turn on assertions])], |
---|
453 | [], [enable_assert=$enable_debug]) |
---|
454 | |
---|
455 | # we use prefix INTERNAL_ for variables that are solely needed for |
---|
456 | # building yat, i.e., they are not needed for a user of yat and are |
---|
457 | # not propagated to yat-config or yat.m4. |
---|
458 | AC_ARG_VAR([INTERNAL_CPPFLAGS], |
---|
459 | [Similar to CPPFLAGS but value is not propagated to yat-config]) |
---|
460 | AC_ARG_VAR([INTERNAL_CXXFLAGS], |
---|
461 | [Similar to CXXFLAGS but value is not propagated to yat-config]) |
---|
462 | AC_ARG_VAR([INTERNAL_LDFLAGS], |
---|
463 | [Similar to LDFLAGS but value is not propagated to yat-config]) |
---|
464 | |
---|
465 | AS_IF([test "${enable_debug}" = "yes"], [ |
---|
466 | AC_DEFINE([YAT_DEBUG], [1], [Define to activate yat assertioons]) |
---|
467 | YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wall -pedantic -g -O]) |
---|
468 | ], [ |
---|
469 | # avoid defining GSL_RANGE_CHECK_OFF if GSL_RANGE_CHECK is already defined |
---|
470 | AC_CHECK_DECL([GSL_RANGE_CHECK],[], |
---|
471 | [AC_DEFINE([GSL_RANGE_CHECK_OFF], [1], |
---|
472 | [Define to turn off GSL range checks])]) |
---|
473 | # If CXXFLAGS not set by user, set it to default value |
---|
474 | AS_IF([test x$CXXFLAGS_set_by_user != xyes], [ |
---|
475 | YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS],[-O3]) |
---|
476 | ]) |
---|
477 | ]) |
---|
478 | |
---|
479 | AS_IF([test x"$enable_assert" = x"no"], [ |
---|
480 | AC_DEFINE([NDEBUG], [1], [Define to turn off assertions]) |
---|
481 | ]) |
---|
482 | |
---|
483 | # turn off compiler warning #654 from intel compiler |
---|
484 | AS_IF([test x"$ax_cv_cxx_compiler_vendor" = x"intel"], [ |
---|
485 | YAT_CXX_ADD_FLAG([CXXFLAGS], ['-diag-disable 654']) |
---|
486 | ]) |
---|
487 | |
---|
488 | # Turns warnings to errors in compilation tests. Only put tests that |
---|
489 | # should be warning sensitive below this point. Can't find any |
---|
490 | # mechanism to revert AC_LANG_WERROR |
---|
491 | AC_LANG_WERROR |
---|
492 | |
---|
493 | # GCC 4.0.1 on OSX complains about -pthread (issue #713) |
---|
494 | AS_IF([AS_ECHO(["$CPPFLAGS"]) | $GREP '\-pthread' > /dev/null], |
---|
495 | [AX_CHECK_PREPROC_FLAG([-pthread], [], |
---|
496 | [CPPFLAGS=`AS_ECHO(["$CPPFLAGS"]) | $SED 's%-pthread%%'`], |
---|
497 | [$INTERNAL_CPPFLAGS]) |
---|
498 | ]) |
---|
499 | |
---|
500 | # When compiling boost::Mutable_*Iterator some versions of clang complains: |
---|
501 | # warning: unsequenced modification and access to 'i' [-Wunsequenced] |
---|
502 | # Test if compiler gives that warning, and if it does turn it off. |
---|
503 | yat_save_CXXFLAGS=$CXXFLAGS |
---|
504 | AC_MSG_CHECKING([whether 'boost/concept_check.hpp' causes compiler warnings]) |
---|
505 | CXXFLAGS="$INTERNAL_CXXFLAGS $CXXFLAGS" |
---|
506 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
---|
507 | [ |
---|
508 | @%:@include <boost/concept_check.hpp> |
---|
509 | ],[ |
---|
510 | BOOST_CONCEPT_ASSERT((boost::Mutable_RandomAccessIterator<double* >)); |
---|
511 | ]) |
---|
512 | ], [ # IF-SUCCESSFUL |
---|
513 | AC_MSG_RESULT([no]) |
---|
514 | # restore CXXFLAGS |
---|
515 | CXXFLAGS=$yat_save_CXXFLAGS |
---|
516 | ], [ # IF-FAILED |
---|
517 | AC_MSG_RESULT([yes]) |
---|
518 | CXXFLAGS=$yat_save_CXXFLAGS |
---|
519 | YAT_CXX_ADD_FLAG([CXXFLAGS], [-Wno-unsequenced]) |
---|
520 | ]) |
---|
521 | |
---|
522 | |
---|
523 | AS_IF([test x$enable_debug = xyes], [ |
---|
524 | suppress_long_long_warnings=no |
---|
525 | # some versions of boost uses long long - turn off compiler warnings |
---|
526 | # with -Wno-long-long |
---|
527 | yat_save_CXXFLAGS=$CXXFLAGS |
---|
528 | AC_MSG_CHECKING([whether boost causes long long warnings]) |
---|
529 | CXXFLAGS="$INTERNAL_CXXFLAGS $CXXFLAGS" |
---|
530 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
---|
531 | [ |
---|
532 | @%:@include <boost/iterator/transform_iterator.hpp> |
---|
533 | @%:@include <boost/thread.hpp> |
---|
534 | @%:@include <cmath> |
---|
535 | @%:@include <functional> |
---|
536 | @%:@include <vector> |
---|
537 | ],[ |
---|
538 | using namespace boost; |
---|
539 | typedef std::pointer_to_unary_function<double, double> F; |
---|
540 | std::vector<double> vec; |
---|
541 | transform_iterator<F, std::vector<double>::iterator> |
---|
542 | i(vec.begin(), std::ptr_fun(fabs)); |
---|
543 | int x = boost::thread::hardware_concurrency(); |
---|
544 | ++x; |
---|
545 | ])], |
---|
546 | [AC_MSG_RESULT([no])], |
---|
547 | [AC_MSG_RESULT([yes]) |
---|
548 | suppress_long_long_warnings=yes |
---|
549 | ]) |
---|
550 | AS_IF([test x"$suppress_long_long_warnings" = x"no"], [ |
---|
551 | AC_MSG_CHECKING([whether <htslib/sam.h> causes long long warnings]) |
---|
552 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@ include <htslib/sam.h>],[])], |
---|
553 | [AC_MSG_RESULT([no])], |
---|
554 | [AC_MSG_RESULT([yes]) |
---|
555 | suppress_long_long_warnings=yes]) |
---|
556 | ]) |
---|
557 | AS_IF([test x"$suppress_long_long_warnings" = x"yes"], [ |
---|
558 | YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wno-long-long]) |
---|
559 | ]) |
---|
560 | # restore CXXFLAGS |
---|
561 | CXXFLAGS=$yat_save_CXXFLAGS |
---|
562 | ]) |
---|
563 | |
---|
564 | # Some versions of boost includes deprecated boost header, triggering |
---|
565 | # compiler warnings (see ticket #943) |
---|
566 | |
---|
567 | |
---|
568 | yat_save_CPPFLAGS=$CPPFLAGS |
---|
569 | CPPFLAGS="$INTERNAL_CPPFLAGS $CPPFLAGS" |
---|
570 | yat_save_CXXFLAGS=$CXXFLAGS |
---|
571 | CXXFLAGS="$INTERNAL_CXXFLAGS $CXXFLAGS" |
---|
572 | AC_MSG_CHECKING([whether boost headers include deprecated boost headers]) |
---|
573 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
---|
574 | [@%:@include <boost/random/negative_binomial_distribution.hpp>], |
---|
575 | []) |
---|
576 | ], [ |
---|
577 | AC_MSG_RESULT([no]) |
---|
578 | ], [ |
---|
579 | AC_MSG_RESULT([yes]) |
---|
580 | AC_DEFINE([YAT_BOOST_ALLOW_DEPRECATED_HEADERS], [1], |
---|
581 | [Define if deprecated boost headers should be allowed]) |
---|
582 | ]) |
---|
583 | CPPFLAGS=${save_CPPFLAGS} |
---|
584 | CXXFLAGS=${save_CXXFLAGS} |
---|
585 | |
---|
586 | #doxygen stuff |
---|
587 | DX_HTML_OUTPUT=html |
---|
588 | AC_SUBST(DX_HTML_OUTPUT) |
---|
589 | |
---|
590 | AC_CONFIG_FILES([build_support/gen_yat_pc.sh], |
---|
591 | [chmod +x build_support/gen_yat_pc.sh]) |
---|
592 | AC_CONFIG_FILES([Makefile |
---|
593 | doc/doxygen.config |
---|
594 | doc/first_page.doxygen |
---|
595 | test/defs.sh |
---|
596 | ]) |
---|
597 | |
---|
598 | AC_CONFIG_HEADERS([yat/utility/config_public.h]) |
---|
599 | canonical_abs_top_srcdir=`cd $srcdir && pwd -P` |
---|
600 | AC_SUBST([canonical_abs_top_srcdir]) |
---|
601 | canonical_abs_top_builddir=`pwd -P` |
---|
602 | AC_SUBST([canonical_abs_top_builddir]) |
---|
603 | |
---|
604 | # for the test suite |
---|
605 | yat_abs_top_srcdir=`cd $srcdir && pwd` |
---|
606 | AC_DEFINE_UNQUOTED([YAT_ABS_TOP_SRCDIR], ["$yat_abs_top_srcdir"], |
---|
607 | [Define to absolute path to top yat src dir]) |
---|
608 | |
---|
609 | # Reset flags |
---|
610 | APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_) |
---|
611 | APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, YAT_) |
---|
612 | APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, YAT_) |
---|
613 | APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_) |
---|
614 | |
---|
615 | # Set some variables useful when linking |
---|
616 | AC_SUBST([YAT_STATIC_LIBS]) |
---|
617 | |
---|
618 | # libs used in libyat.la |
---|
619 | yat_libyat_la_LIBADD="$YAT_LIBS" |
---|
620 | # We avoid linking in cblas in libyat.la, to let users choose |
---|
621 | # favourite cblas library at link time. |
---|
622 | YAT_VAR_REMOVE([yat_libyat_la_LIBADD], [$YAT_CBLAS_LIB]) |
---|
623 | # we avoid linking in YAT_STATIC_LIBS as they have been detected to |
---|
624 | # not be suitable libtool archive. |
---|
625 | YAT_VAR_REMOVE([yat_libyat_la_LIBADD], [$YAT_STATIC_LIBS]) |
---|
626 | AC_SUBST([yat_libyat_la_LIBADD]) |
---|
627 | |
---|
628 | # Primary LIBS are same as linked into libyat.la excluding LIBM |
---|
629 | YAT_PRIMARY_LIBS=$yat_libyat_la_LIBADD |
---|
630 | YAT_VAR_REMOVE([YAT_PRIMARY_LIBS], [$LIBM]) |
---|
631 | AC_SUBST(YAT_PRIMARY_LIBS) |
---|
632 | |
---|
633 | # Assign LIBS variables for yat.pc |
---|
634 | YAT_PC_LIBS_PRIVATE=$YAT_LIBS |
---|
635 | |
---|
636 | # Dependency to GSL is noted via 'Requires' field |
---|
637 | YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [-lgsl $YAT_CBLAS_LIB $LIBM]) |
---|
638 | YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [-lgsl], [ |
---|
639 | YAT_PC_REQUIRES_PRIVATE="gsl > YAT_REQUIRED_GSL_VERSION" |
---|
640 | ], [ |
---|
641 | YAT_PC_REQUIRES="gsl > YAT_REQUIRED_GSL_VERSION" |
---|
642 | ]) |
---|
643 | |
---|
644 | # ignore this whole htslib thing if --without-htslib |
---|
645 | AS_IF([test x$with_htslib != x"no"], [ |
---|
646 | # htslib comes with a pc file, so we can require htslib in yat.pc |
---|
647 | YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [$HTS_LIBS -lz]) |
---|
648 | # if libyat is linking in -lhts, linking against libyat is |
---|
649 | # sufficient and put htslib in 'requires private:', otherwise put |
---|
650 | # them in 'require:'. |
---|
651 | YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [-lhts], [ |
---|
652 | YAT_PC_REQUIRES_PRIVATE="$YAT_PC_REQUIRES_PRIVATE htslib" |
---|
653 | ], [ |
---|
654 | YAT_PC_REQUIRES="$YAT_PC_REQUIRES htslib" |
---|
655 | ]) |
---|
656 | ]) |
---|
657 | |
---|
658 | # Having libs declared as LIBS.private in yat.pc assumes that libs |
---|
659 | # have been linked into libyat. Therefore for each lib check if it is |
---|
660 | # mentioned in $yat_libyat_la_LIBADD, and if it's not move |
---|
661 | # lib to LIBS variable. |
---|
662 | for lib in $YAT_PC_LIBS_PRIVATE; do |
---|
663 | YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [$lib], [ |
---|
664 | ], [ |
---|
665 | # move lib from $YAT_PC_LIBS_PRIVATE to $YAT_PC_LIBS |
---|
666 | YAT_VAR_REMOVE([$YAT_PC_LIBS_PRIVATE], [$lib]) |
---|
667 | YAT_PC_LIBS="$YAT_PC_LIBS $lib" |
---|
668 | ]) |
---|
669 | done |
---|
670 | |
---|
671 | AC_SUBST([YAT_PC_LIBS]) |
---|
672 | AC_SUBST([YAT_PC_REQUIRES]) |
---|
673 | AC_SUBST([YAT_PC_LIBS_PRIVATE]) |
---|
674 | AC_SUBST([YAT_PC_REQUIRES_PRIVATE]) |
---|
675 | |
---|
676 | # propagate some variables to 'yat-config' |
---|
677 | AC_ARG_VAR([YAT_CONFIG_CPPFLAGS], |
---|
678 | [Similar to CPPFLAGS but value is only propagated to yat-config]) |
---|
679 | AC_ARG_VAR([YAT_CONFIG_CXXFLAGS], |
---|
680 | [Similar to CXXFLAGS but value is only propagated to yat-config]) |
---|
681 | AC_ARG_VAR([YAT_CONFIG_LDFLAGS], |
---|
682 | [Similar to LDFLAGS but value is only propagated to yat-config]) |
---|
683 | AC_SUBST([YAT_CONFIG_CPPFLAGS]) |
---|
684 | AC_SUBST([YAT_CONFIG_CXXFLAGS]) |
---|
685 | AC_SUBST([YAT_CONFIG_LDFLAGS]) |
---|
686 | |
---|
687 | AC_SUBST([GXX]) |
---|
688 | AC_SUBST(YAT_LIBS) |
---|
689 | AC_SUBST(YAT_CBLAS_LIB) |
---|
690 | |
---|
691 | # set and AC_SUBST variables that are interpreted by Automake |
---|
692 | AM_CPPFLAGS="$INTERNAL_CPPFLAGS $YAT_CPPFLAGS" |
---|
693 | AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS" |
---|
694 | AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS" |
---|
695 | |
---|
696 | AC_SUBST(AM_CPPFLAGS) |
---|
697 | AC_SUBST(AM_CXXFLAGS) |
---|
698 | AC_SUBST(AM_LDFLAGS) |
---|
699 | AC_SUBST([enable_shared]) |
---|
700 | AC_SUBST([enable_static]) |
---|
701 | |
---|
702 | # Name of directory libtool put stuff int - needed for some tests |
---|
703 | AC_SUBST([lt_cv_objdir]) |
---|
704 | |
---|
705 | YAT_SVN_RELEASE([am/maintainer.am], |
---|
706 | [$(YAT_MAJOR_VERSION).$(YAT_MINOR_VERSION)], |
---|
707 | [libyat@frs.sourceforge.net:/home/frs/project/l/li/libyat], |
---|
708 | [http://sourceforge.net/projects/libyat/files/$(distdir).tar.gz/files], |
---|
709 | [http://dev.thep.lu.se/yat/browser/tags/$(VERSION)/NEWS]) |
---|
710 | |
---|
711 | # make shell tests work in VPATH builds |
---|
712 | AC_CONFIG_LINKS([test/init.sh:test/init.sh]) |
---|
713 | |
---|
714 | # set some variable for final message |
---|
715 | AS_CASE([$have_doxygen], |
---|
716 | [yes], [doxygen_message=yes], |
---|
717 | [no], [doxygen_message="no (doxygen not found)"], |
---|
718 | [old], [doxygen_message="no (\`$DOXYGEN' too old)"], |
---|
719 | [notwanted], [doxygen_message="no"], |
---|
720 | [AC_MSG_WARN([unexpected value \$have_doxygen: '$have_doxygen']) |
---|
721 | AS_BOX([Report this to ]AC_PACKAGE_BUGREPORT) |
---|
722 | ]) |
---|
723 | |
---|
724 | yat_gslcblas_message= |
---|
725 | AS_IF([test "x$YAT_CBLAS_LIB" = "x-lgslcblas"], [ |
---|
726 | yat_gslcblas_message=' |
---|
727 | GSL CBLAS found. This is a reference implementation only. |
---|
728 | Consider using hardware optimized BLAS. |
---|
729 | ATLAS (http://math-atlas.sourceforge.net/) provides an |
---|
730 | optimized BLAS library. It is supported by yat! |
---|
731 | ' |
---|
732 | ]) |
---|
733 | |
---|
734 | # Create output. |
---|
735 | AC_OUTPUT |
---|
736 | |
---|
737 | |
---|
738 | # Some more messages. |
---|
739 | AC_MSG_RESULT([ |
---|
740 | yat is configured as follows: |
---|
741 | |
---|
742 | Build Shared Library: $enable_shared |
---|
743 | Build Static Library: $enable_static |
---|
744 | Build Documentation: $doxygen_message |
---|
745 | With Bam Support: $with_htslib |
---|
746 | With Rvalue Support: $yat_have_rvalue |
---|
747 | With Atomic Support: $yat_have_atomic |
---|
748 | |
---|
749 | Options used to compile and link: |
---|
750 | VERSION = $VERSION |
---|
751 | CXX = $CXX |
---|
752 | CPPFLAGS = $CPPFLAGS |
---|
753 | YAT_CPPFLAGS= $AM_CPPFLAGS |
---|
754 | CXXFLAGS = $CXXFLAGS |
---|
755 | YAT_CXXFLAGS= $AM_CXXFLAGS |
---|
756 | LD = $LD |
---|
757 | LDFLAGS = $LDFLAGS |
---|
758 | YAT_LDFLAGS = $AM_LDFLAGS |
---|
759 | LIBS = $LIBS |
---|
760 | YAT_LIBS = $YAT_LIBS |
---|
761 | ${yat_gslcblas_message}dnl |
---|
762 | ---------------------------------------------------------------- |
---|
763 | Now type `make'. dnl |
---|
764 | ]) |
---|