1 | ## Process this file with autoconf to produce a configure script. |
---|
2 | ## |
---|
3 | ## $Id: configure.ac 3181 2014-03-24 10:27:13Z 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 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.63) |
---|
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 | dnl FIXME remove when we assume autoconf 2.64 |
---|
52 | m4_ifndef([AC_PACKAGE_URL], |
---|
53 | [AC_DEFINE([PACKAGE_URL], ["http://dev.thep.lu.se/yat"], |
---|
54 | [Define to home page for this package]) |
---|
55 | AC_SUBST([PACKAGE_URL], ["http://dev.thep.lu.se/yat"])]) |
---|
56 | |
---|
57 | AC_SUBST([YAT_LT_VERSION], [YAT_LT_VERSION_INFO]) |
---|
58 | AC_DEFINE([YAT_VERSION], ["my_VERSION"], [version]) |
---|
59 | |
---|
60 | AC_CONFIG_HEADERS([config.h]) |
---|
61 | AM_INIT_AUTOMAKE([1.11 std-options color-tests parallel-tests |
---|
62 | silent-rules subdir-objects]) |
---|
63 | |
---|
64 | # Set default programming language |
---|
65 | AC_LANG(C++) |
---|
66 | |
---|
67 | # propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS |
---|
68 | for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do |
---|
69 | eval isset=\${$var+set} |
---|
70 | if test "$isset" = 'set' ; then |
---|
71 | eval val=$`echo $var` |
---|
72 | DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' " |
---|
73 | fi |
---|
74 | done |
---|
75 | AC_SUBST(DISTCHECK_CONFIGURE_FLAGS) |
---|
76 | |
---|
77 | # record if CXXFLAGS was set by user for further use below |
---|
78 | AS_IF([test "${CXXFLAGS+set}" = set], [ |
---|
79 | CXXFLAGS_set_by_user=yes |
---|
80 | ],[ |
---|
81 | CXXFLAGS_set_by_user=no |
---|
82 | # set CXXFLAGS to avoid expansion in AC_PROG_CXX |
---|
83 | CXXFLAGS= |
---|
84 | ]) |
---|
85 | |
---|
86 | # Checks for programs. |
---|
87 | dnl FIXME remove m4_ifdef when we assume Automake 1.12 |
---|
88 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) |
---|
89 | AC_PROG_CXX |
---|
90 | AC_PROG_SED |
---|
91 | AC_PROG_LIBTOOL |
---|
92 | |
---|
93 | # find the compiler vendor: gnu, intel, etc |
---|
94 | AX_COMPILER_VENDOR |
---|
95 | |
---|
96 | have_doxygen=no |
---|
97 | AC_PATH_PROG([DOXYGEN], [doxygen], [no]) |
---|
98 | if test "$DOXYGEN" = "no"; then |
---|
99 | AC_MSG_WARN([unable to find doxygen application]) |
---|
100 | else |
---|
101 | doxygen_min_version=1.5 |
---|
102 | AC_MSG_CHECKING([if doxygen is at least $doxygen_min_version]) |
---|
103 | doxygen_version=`$DOXYGEN --version` |
---|
104 | AX_COMPARE_VERSION([$doxygen_version], [ge], [$doxygen_min_version], |
---|
105 | [have_doxygen=yes], [have_doxygen=old]) |
---|
106 | AC_MSG_RESULT([$doxygen_version]) |
---|
107 | fi |
---|
108 | |
---|
109 | AC_SUBST(have_doxygen) |
---|
110 | AM_CONDITIONAL([DX_ENABLE_HTML], [test x$have_doxygen = xyes]) |
---|
111 | |
---|
112 | # check for quiet_NaN support in OS |
---|
113 | # Check at run-time, but if we are cross-compiling fall back on a |
---|
114 | # compilation test |
---|
115 | AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true]) |
---|
116 | AC_RUN_IFELSE( |
---|
117 | [AC_LANG_PROGRAM( |
---|
118 | [@%:@include <limits>], |
---|
119 | [return !std::numeric_limits<double>::has_quiet_NaN])], |
---|
120 | [quiet_nan=yes |
---|
121 | AC_MSG_RESULT($quiet_nan)], |
---|
122 | [quiet_nan=no |
---|
123 | AC_MSG_RESULT($quiet_nan)], |
---|
124 | # if we are cross-compiling fall back on compilation test |
---|
125 | [AC_MSG_RESULT(cross-compiling) |
---|
126 | AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()]) |
---|
127 | AC_COMPILE_IFELSE( |
---|
128 | [AC_LANG_PROGRAM( |
---|
129 | [@%:@include <limits> |
---|
130 | extern void f(double);], |
---|
131 | [f(std::numeric_limits<double>::quiet_NaN())])], |
---|
132 | [quiet_nan=yes], |
---|
133 | [quiet_nan=no]) |
---|
134 | AC_MSG_RESULT($quiet_nan)]) |
---|
135 | # No support for quiet NAN is fatal -- sub-sequent compilation, or execution |
---|
136 | # of created binary, will fail. |
---|
137 | AS_IF([test x"$quiet_nan" = x"no"], [ |
---|
138 | AC_MSG_FAILURE([dnl |
---|
139 | Support for quiet NAN required. yat will not work on this system!]) |
---|
140 | ]) |
---|
141 | |
---|
142 | # Check for infinity support for doubles in OS |
---|
143 | # Check at run-time, but if we are cross-compiling fall back on a |
---|
144 | # compilation test |
---|
145 | AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true]) |
---|
146 | AC_RUN_IFELSE( |
---|
147 | [AC_LANG_PROGRAM( |
---|
148 | [@%:@include <limits>], |
---|
149 | [return !std::numeric_limits<double>::has_infinity])], |
---|
150 | [has_infinity=yes |
---|
151 | AC_MSG_RESULT($has_infinity)], |
---|
152 | [has_infinity=no |
---|
153 | AC_MSG_RESULT($has_infinity)], |
---|
154 | # if we are cross-compiling fall back on compilation test |
---|
155 | [AC_MSG_RESULT(cross-compiling) |
---|
156 | AC_MSG_CHECKING([for std::numeric_limits<>::infinity()]) |
---|
157 | AC_COMPILE_IFELSE( |
---|
158 | [AC_LANG_PROGRAM( |
---|
159 | [@%:@include <limits> |
---|
160 | extern void f(double);], |
---|
161 | [f(std::numeric_limits<double>::infinity())])], |
---|
162 | [has_infinity=yes], |
---|
163 | [has_infinity=no]) |
---|
164 | AC_MSG_RESULT($has_infinity)]) |
---|
165 | # No support for infinity is fatal -- sub-sequent compilation, or execution |
---|
166 | # of created binary, will fail. |
---|
167 | AS_IF([test x"${has_infinity}" = x"no"], [ |
---|
168 | AC_MSG_FAILURE([dnl |
---|
169 | Support for infinity required. yat will not work on this system!]) |
---|
170 | ]) |
---|
171 | |
---|
172 | |
---|
173 | AC_MSG_CHECKING([g++ deprecation attribute]) |
---|
174 | AC_COMPILE_IFELSE( |
---|
175 | [AC_LANG_PROGRAM([[void f() __attribute__ ((deprecated));]],)], |
---|
176 | [AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1], |
---|
177 | [Define if compiler supports deprecated attribute, as in g++ 4.0]) |
---|
178 | AC_MSG_RESULT([yes])], |
---|
179 | [AC_MSG_RESULT([no])] ) |
---|
180 | |
---|
181 | AC_MSG_CHECKING([if std::multiset::iterator is mutable]) |
---|
182 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <set> |
---|
183 | @%:@include <vector>]], |
---|
184 | [[std::set<std::vector<double> > s; |
---|
185 | std::vector<double> v; |
---|
186 | s.insert(v); |
---|
187 | s.begin()->reserve(100); |
---|
188 | ]])], |
---|
189 | [AC_DEFINE([MULTISET_ITERATOR_IS_MUTABLE], [1], |
---|
190 | [Define if std::multiset::iterator is mutable]) |
---|
191 | AC_MSG_RESULT([yes]) |
---|
192 | ], |
---|
193 | [AC_MSG_RESULT([no])] ) |
---|
194 | |
---|
195 | # Save user-defined environment settings for later restoration |
---|
196 | APR_SAVE_THE_ENVIRONMENT(CPPFLAGS) |
---|
197 | APR_SAVE_THE_ENVIRONMENT(CXXFLAGS) |
---|
198 | APR_SAVE_THE_ENVIRONMENT(LDFLAGS) |
---|
199 | APR_SAVE_THE_ENVIRONMENT(LIBS) |
---|
200 | user_LIBS=$LIBS |
---|
201 | |
---|
202 | AS_CASE([$host_os], [darwin*], [ |
---|
203 | YAT_LD_ADD_FLAG([LDFLAGS], [-Wl,-flat_namespace]) |
---|
204 | ]) |
---|
205 | |
---|
206 | # prefer using libtool in link tests |
---|
207 | YAT_USE_LIBTOOL_PUSH |
---|
208 | |
---|
209 | # Checks for libraries. |
---|
210 | AC_MSG_NOTICE([checking for libraries]) |
---|
211 | AC_CHECK_LIBM |
---|
212 | LIBS="$LIBM $LIBS" |
---|
213 | # we store libs in YAT_STATIC_LIBS that are not suitable to link into |
---|
214 | # libyat but are needed when creating applications linking against |
---|
215 | # libyat. Typically these are static (only) libraries, but see ticket |
---|
216 | # 737 for discussion. |
---|
217 | YAT_STATIC_LIBS= |
---|
218 | YAT_CHECK_LA_LIBS([ |
---|
219 | double cos(double x); |
---|
220 | double foo(double x) { return cos(x); } |
---|
221 | ], [$LIBS], [$LIBM], [YAT_STATIC_LIBS]) |
---|
222 | |
---|
223 | # find library implementing BLAS C API, or use gslcblas |
---|
224 | YAT_LIB_CBLAS([YAT_CBLAS_LIB=$CBLAS_LIB], [YAT_CBLAS_LIB=-lgslcblas]) |
---|
225 | LIBS="$YAT_CBLAS_LIB $LIBS" |
---|
226 | |
---|
227 | # GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks |
---|
228 | # Including AX_PATH_GSL macro from gsl.m4 distributed by GSL |
---|
229 | gsl_version="1.8" |
---|
230 | AC_SUBST(gsl_version) |
---|
231 | YAT_CHECK_GSL([$gsl_version],[LIBS="-lgsl $LIBS"],[AC_MSG_FAILURE([dnl |
---|
232 | GSL $gsl_version (or newer) not found. The GNU Scientific Library |
---|
233 | (GSL) library cannot be found. Please make sure GSL is installed.]) |
---|
234 | ]) |
---|
235 | |
---|
236 | YAT_CHECK_LA_LIBS([ |
---|
237 | double gsl_cdf_hypergeometric_P(const unsigned int k, const unsigned int n1, |
---|
238 | const unsigned int n2, const unsigned int t); |
---|
239 | double yat_foo(void) { return gsl_cdf_hypergeometric_P(1,2,3,10); } |
---|
240 | ], [$LIBS], [-lgsl], [YAT_STATIC_LIBS]) |
---|
241 | |
---|
242 | # Boost http://www.boost.org |
---|
243 | boost_version=1.35 |
---|
244 | AC_SUBST(boost_version) |
---|
245 | AX_BOOST_BASE(["$boost_version"], [], [AC_MSG_FAILURE([dnl |
---|
246 | Boost ${boost_version} (or newer) not found. Please install boost, or provide |
---|
247 | CPPFLAGS=-I/path/to/boost]) |
---|
248 | ]) |
---|
249 | # skip boost link tests if boost is not wanted (--without-boost) |
---|
250 | AS_IF([test x"$want_boost" = x"yes"],[ |
---|
251 | AX_BOOST_THREAD |
---|
252 | AX_BOOST_SYSTEM |
---|
253 | YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS]) |
---|
254 | YAT_LD_ADD_FLAG([LDFLAGS], [$BOOST_LDFLAGS]) |
---|
255 | # boost tests above only test compilation, so let's try link in the libs |
---|
256 | LIBS="$LIBS $BOOST_THREAD_LIB $BOOST_SYSTEM_LIB" |
---|
257 | AC_MSG_CHECKING([for thread_specific_ptr]) |
---|
258 | AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include <boost/thread/tss.hpp>], |
---|
259 | [boost::thread_specific_ptr<int> x; |
---|
260 | x.reset(new int(1));])], |
---|
261 | [AC_MSG_RESULT([yes])], |
---|
262 | [AC_MSG_RESULT([no]) |
---|
263 | AC_MSG_FAILURE([Boost thread library not found.]) |
---|
264 | ]) |
---|
265 | # Check if $BOOST_THREAD_LIB is appropriate for libyat.la |
---|
266 | YAT_CHECK_LA_LIBS([ |
---|
267 | @%:@include <boost/thread.hpp> |
---|
268 | int my_func(void) |
---|
269 | { boost::mutex mutex_; return 0; } |
---|
270 | ], [$BOOST_THREAD_LIB $user_LIBS], [$BOOST_THREAD_LIB], [YAT_STATIC_LIBS]) |
---|
271 | # Check if $BOOST_SYSTEM_LIB is appropriate for libyat.la |
---|
272 | YAT_CHECK_LA_LIBS([ |
---|
273 | @%:@include <boost/system/error_code.hpp> |
---|
274 | int my_func(void) |
---|
275 | { boost::system::system_category; return 0; } |
---|
276 | ], [$BOOST_SYSTEM_LIB $user_LIBS], [$BOOST_SYSTEM_LIB], [YAT_STATIC_LIBS]) |
---|
277 | ]) |
---|
278 | |
---|
279 | # see tickets #648 #687 |
---|
280 | AC_MSG_CHECKING([whether constructor in boost concept is supported]) |
---|
281 | AC_COMPILE_IFELSE([ |
---|
282 | AC_LANG_PROGRAM( |
---|
283 | [ |
---|
284 | @%:@include <boost/concept_check.hpp> |
---|
285 | template <typename T> |
---|
286 | class MyConcept |
---|
287 | { |
---|
288 | public: |
---|
289 | MyConcept(void) {} |
---|
290 | BOOST_CONCEPT_USAGE(MyConcept){} |
---|
291 | }; |
---|
292 | ],[ |
---|
293 | MyConcept<double> x; |
---|
294 | x = x; |
---|
295 | ]) |
---|
296 | ], |
---|
297 | [AC_MSG_RESULT([yes]) |
---|
298 | AC_DEFINE([YAT_HAVE_BOOST_CONCEPT_WITH_CONSTRUCTOR],[1], |
---|
299 | [define if compiler supports boost concept with constructor]) |
---|
300 | ], |
---|
301 | [AC_MSG_RESULT([no])] |
---|
302 | ) |
---|
303 | |
---|
304 | # Workaround problem that boost 1.41 does not work with certain versions of GCC |
---|
305 | # see ticket #762 |
---|
306 | AC_MSG_CHECKING([if boost::mutex workaround is needed]) |
---|
307 | AC_COMPILE_IFELSE( |
---|
308 | [AC_LANG_PROGRAM([@%:@include <boost/thread.hpp>], |
---|
309 | [boost::mutex mutex;] |
---|
310 | )], |
---|
311 | [AC_MSG_RESULT([no]) |
---|
312 | AC_DEFINE([YAT_HAVE_WORKING_BOOST_EXCEPTION_PTR], [1], |
---|
313 | [Define to 1 if boost::exception_ptr works]) |
---|
314 | ], |
---|
315 | [AC_MSG_RESULT([yes])]) |
---|
316 | |
---|
317 | # samtools API from http://samtools.sourceforge.net |
---|
318 | AC_ARG_WITH([samtools], |
---|
319 | [AS_HELP_STRING([--without-samtools], |
---|
320 | [disable samtools support])], |
---|
321 | [], |
---|
322 | [with_samtools=yes]) |
---|
323 | |
---|
324 | AS_IF([test x"$with_samtools" != x"no"], [ |
---|
325 | AC_CHECK_HEADER([zlib.h], [], |
---|
326 | [AC_MSG_FAILURE([header file 'zlib.h' was not found])]) |
---|
327 | AC_SEARCH_LIBS([inflateEnd], [z], [], |
---|
328 | [AC_MSG_FAILURE([library 'libz' was not found])]) |
---|
329 | LIBZ=$ac_cv_search_inflateEnd |
---|
330 | AS_IF([test x"$LIBZ" = x"none required"], [LIBZ=]) |
---|
331 | YAT_CHECK_LA_LIBS([ |
---|
332 | @%:@include <zlib.h> |
---|
333 | int my_func(void) |
---|
334 | { z_streamp zs; inflateEnd(zs); return 0; } |
---|
335 | ], [$LIBZ $user_LIBS], [$LIBZ], [YAT_STATIC_LIBS]) |
---|
336 | YAT_CHECK_HEADER_BAM([],[AC_MSG_FAILURE([header file 'bam.h' was not found])]) |
---|
337 | # try link against libbam |
---|
338 | YAT_CHECK_LIBBAM([LIBS="$BAM_LIBS $LIBS" |
---|
339 | AC_DEFINE([HAVE_LIBBAM], [1], |
---|
340 | [Define to 1 if libbam is available])], |
---|
341 | [AC_MSG_FAILURE([library 'libbam' was not found])]) |
---|
342 | YAT_CHECK_LA_LIBS([ |
---|
343 | _YAT_BAM_INCLUDES |
---|
344 | void my_func(bam_header_t* hdr) { bam_header_destroy(hdr); } |
---|
345 | ], [$BAM_LIBS $LIBZ $user_LIBS], [$BAM_LIBS], [YAT_STATIC_LIBS]) |
---|
346 | # check if global variable bam_nt16_rev_table is available |
---|
347 | YAT_BAM_NT16_REV_TABLE |
---|
348 | AC_PATH_PROG([SAMTOOLS], [samtools], [false]) |
---|
349 | AC_ARG_VAR([SAMTOOLS], [Tools for alignment in the SAM format]) |
---|
350 | ], [ |
---|
351 | SAMTOOLS=false |
---|
352 | ]) |
---|
353 | AM_CONDITIONAL([HAVE_LIBBAM], [test x"$with_samtools" = x"yes"]) |
---|
354 | have_libbam=$with_samtools |
---|
355 | AC_SUBST([have_libbam]) |
---|
356 | AM_CONDITIONAL([HAVE_SAMTOOLS], [test x"$SAMTOOLS" != x"false"]) |
---|
357 | AC_SUBST([SAMTOOLS]) |
---|
358 | AS_IF([test x"$SAMTOOLS" = x"false"], [], [ |
---|
359 | AC_DEFINE([HAVE_SAMTOOLS], [1], [Define if samtools executable is available]) |
---|
360 | ]) |
---|
361 | |
---|
362 | #support for large files |
---|
363 | AC_SYS_LARGEFILE |
---|
364 | if test "$enable_largefile" = "no"; then |
---|
365 | AC_DEFINE([YAT_LFS_DISABLED], 1, |
---|
366 | [defined to 1 if large file support is disabled]) |
---|
367 | fi |
---|
368 | |
---|
369 | AC_DEFINE([HAVE_INLINE], [1], [Define if inline is available on system]) |
---|
370 | # default is same as --disable-debug |
---|
371 | AC_ARG_ENABLE([debug], |
---|
372 | [AS_HELP_STRING([--enable-debug],[turn on debug options and code])], |
---|
373 | [], [enable_debug=no]) |
---|
374 | |
---|
375 | # If neither --enable-assert nor --disable-assert, set enable_assert |
---|
376 | # to same as enable_debug |
---|
377 | AC_ARG_ENABLE([assert], |
---|
378 | [AS_HELP_STRING([--enable-assert], [turn on assertions])], |
---|
379 | [], [enable_assert=$enable_debug]) |
---|
380 | |
---|
381 | # we use prefix INTERNAL_ for variables that are solely needed for |
---|
382 | # building yat, i.e., they are not needed for a user of yat and are |
---|
383 | # not propagated to yat-config or yat.m4. |
---|
384 | AS_IF([test "${enable_debug}" = "yes"], [ |
---|
385 | AC_DEFINE([YAT_DEBUG], [1], [Define to activate yat assertioons]) |
---|
386 | YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wall -pedantic -g -O]) |
---|
387 | ], [ |
---|
388 | # avoid defining GSL_RANGE_CHECK_OFF if GSL_RANGE_CHECK is already defined |
---|
389 | AC_CHECK_DECL([GSL_RANGE_CHECK],[], |
---|
390 | [AC_DEFINE([GSL_RANGE_CHECK_OFF], [1], |
---|
391 | [Define to turn off GSL range checks])]) |
---|
392 | # If CXXFLAGS not set by user, set it to default value |
---|
393 | AS_IF([test x$CXXFLAGS_set_by_user != xyes], [ |
---|
394 | YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS],[-O3]) |
---|
395 | ]) |
---|
396 | ]) |
---|
397 | |
---|
398 | AS_IF([test x"$enable_assert" = x"no"], [ |
---|
399 | AC_DEFINE([NDEBUG], [1], [Define to turn off assertions]) |
---|
400 | ]) |
---|
401 | |
---|
402 | # turn off compiler warning #654 from intel compiler |
---|
403 | AS_IF([test x"$ax_cv_cxx_compiler_vendor" = x"intel"], [ |
---|
404 | YAT_CXX_ADD_FLAG([CXXFLAGS], ['-diag-disable 654']) |
---|
405 | ]) |
---|
406 | |
---|
407 | # Turns warnings to errors in compilation tests. Only put tests that |
---|
408 | # should be warning sensitive below this point. Can't find any |
---|
409 | # mechanism to revert AC_LANG_WERROR |
---|
410 | AC_LANG_WERROR |
---|
411 | |
---|
412 | # GCC 4.0.1 on OSX complains about -pthread (issue #713) |
---|
413 | AS_IF([AS_ECHO(["$CPPFLAGS"]) | $GREP '\-pthread' > /dev/null], |
---|
414 | [AX_CHECK_PREPROC_FLAG([-pthread], [], |
---|
415 | [CPPFLAGS=`AS_ECHO(["$CPPFLAGS"]) | $SED 's%-pthread%%'`], |
---|
416 | [$INTERNAL_CPPFLAGS]) |
---|
417 | ]) |
---|
418 | |
---|
419 | AS_IF([test x$enable_debug = xyes], [ |
---|
420 | # some versions of boost uses long long - turn off compiler warnings |
---|
421 | # with -Wno-long-long |
---|
422 | yat_save_CXXFLAGS=$CXXFLAGS |
---|
423 | AC_MSG_CHECKING([whether boost uses long long]) |
---|
424 | CXXFLAGS="$INTERNAL_CXXFLAGS $CXXFLAGS" |
---|
425 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
---|
426 | [ |
---|
427 | @%:@include <boost/iterator/transform_iterator.hpp> |
---|
428 | @%:@include <boost/thread.hpp> |
---|
429 | @%:@include <cmath> |
---|
430 | @%:@include <functional> |
---|
431 | @%:@include <vector> |
---|
432 | ],[ |
---|
433 | using namespace boost; |
---|
434 | typedef std::pointer_to_unary_function<double, double> F; |
---|
435 | std::vector<double> vec; |
---|
436 | transform_iterator<F, std::vector<double>::iterator> |
---|
437 | i(vec.begin(), std::ptr_fun(fabs)); |
---|
438 | int x = boost::thread::hardware_concurrency(); |
---|
439 | ++x; |
---|
440 | ])], |
---|
441 | [AC_MSG_RESULT([no])], |
---|
442 | [AC_MSG_RESULT([yes]) |
---|
443 | YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wno-long-long]) |
---|
444 | ]) |
---|
445 | # restore CXXFLAGS |
---|
446 | CXXFLAGS=$yat_save_CXXFLAGS |
---|
447 | ]) |
---|
448 | |
---|
449 | #doxygen stuff |
---|
450 | DX_HTML_OUTPUT=html |
---|
451 | AC_SUBST(DX_HTML_OUTPUT) |
---|
452 | |
---|
453 | AC_CONFIG_FILES([build_support/gen_yat_pc.sh], |
---|
454 | [chmod +x build_support/gen_yat_pc.sh]) |
---|
455 | AC_CONFIG_FILES([build_support/gen_announce.sh], |
---|
456 | [chmod +x-w build_support/gen_announce.sh]) |
---|
457 | AC_CONFIG_FILES([Makefile |
---|
458 | doc/doxygen.config |
---|
459 | doc/first_page.doxygen |
---|
460 | test/defs.sh |
---|
461 | ]) |
---|
462 | |
---|
463 | AC_CONFIG_HEADERS([yat/utility/config_public.h]) |
---|
464 | # for the test suite |
---|
465 | yat_abs_top_srcdir=`cd $srcdir && pwd` |
---|
466 | AC_DEFINE_UNQUOTED([YAT_ABS_TOP_SRCDIR], ["$yat_abs_top_srcdir"], |
---|
467 | [Define to absolute path to top yat src dir]) |
---|
468 | |
---|
469 | # Reset flags |
---|
470 | APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_) |
---|
471 | APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, YAT_) |
---|
472 | APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, YAT_) |
---|
473 | APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_) |
---|
474 | |
---|
475 | # Set some variables useful when linking |
---|
476 | AC_SUBST([YAT_STATIC_LIBS]) |
---|
477 | |
---|
478 | # libs used in libyat.la |
---|
479 | yat_libyat_la_LIBADD="$YAT_LIBS" |
---|
480 | # We avoid linking in cblas in libyat.la, to let users choose |
---|
481 | # favourite cblas library at link time. |
---|
482 | YAT_VAR_REMOVE([yat_libyat_la_LIBADD], [$YAT_CBLAS_LIB]) |
---|
483 | # we avoid linking in YAT_STATIC_LIBS as they have been detected to |
---|
484 | # not be suitable libtool archive. |
---|
485 | YAT_VAR_REMOVE([yat_libyat_la_LIBADD], [$YAT_STATIC_LIBS]) |
---|
486 | AC_SUBST([yat_libyat_la_LIBADD]) |
---|
487 | |
---|
488 | # Primary LIBS are same as linked into libyat.la excluding LIBM |
---|
489 | YAT_PRIMARY_LIBS=$yat_libyat_la_LIBADD |
---|
490 | YAT_VAR_REMOVE([YAT_PRIMARY_LIBS], [$LIBM]) |
---|
491 | AC_SUBST(YAT_PRIMARY_LIBS) |
---|
492 | |
---|
493 | # Assign LIBS variables for yat.pc |
---|
494 | YAT_PC_LIBS=$YAT_LIBS |
---|
495 | # Dependency to GSL is noted via 'Requires' field |
---|
496 | YAT_VAR_REMOVE([YAT_PC_LIBS], [-lgsl $YAT_CBLAS_LIB $LIBM]) |
---|
497 | AC_SUBST([YAT_PC_LIBS]) |
---|
498 | |
---|
499 | AC_SUBST(YAT_LIBS) |
---|
500 | AC_SUBST(YAT_CBLAS_LIB) |
---|
501 | |
---|
502 | # set and AC_SUBST variables that are interpreted by Automake |
---|
503 | AM_CPPFLAGS="$INTERNAL_CPPFLAGS $YAT_CPPFLAGS" |
---|
504 | AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS" |
---|
505 | AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS" |
---|
506 | |
---|
507 | AC_SUBST(AM_CPPFLAGS) |
---|
508 | AC_SUBST(AM_CXXFLAGS) |
---|
509 | AC_SUBST(AM_LDFLAGS) |
---|
510 | AC_SUBST([enable_shared]) |
---|
511 | AC_SUBST([enable_static]) |
---|
512 | |
---|
513 | # Name of directory libtool put stuff int - needed for some tests |
---|
514 | AC_SUBST([lt_cv_objdir]) |
---|
515 | |
---|
516 | YAT_SVN_RELEASE([am/maintainer.am]) |
---|
517 | |
---|
518 | # make shell tests work in VPATH builds |
---|
519 | AC_CONFIG_LINKS([test/init.sh:test/init.sh]) |
---|
520 | |
---|
521 | # set some variable for final message |
---|
522 | AS_CASE([$have_doxygen], |
---|
523 | [yes], [doxygen_message=yes], |
---|
524 | [no], [doxygen_message="no (doxygen not found)"], |
---|
525 | [old], [doxygen_message="no (\`$DOXYGEN' too old)"], |
---|
526 | [AC_MSG_WARN([unexpected value \$have_doxygen: '$have_doxygen']) |
---|
527 | AS_BOX([Report this to ]AC_PACKAGE_BUGREPORT) |
---|
528 | ]) |
---|
529 | |
---|
530 | yat_gslcblas_message= |
---|
531 | AS_IF([test "x$YAT_CBLAS_LIB" = "x-lgslcblas"], [ |
---|
532 | yat_gslcblas_message=' |
---|
533 | GSL CBLAS found. This is a reference implementation only. |
---|
534 | Consider using hardware optimized BLAS. |
---|
535 | ATLAS (http://math-atlas.sourceforge.net/) provides an |
---|
536 | optimized BLAS library. It is supported by yat! |
---|
537 | ' |
---|
538 | ]) |
---|
539 | |
---|
540 | # Create output. |
---|
541 | AC_OUTPUT |
---|
542 | |
---|
543 | |
---|
544 | # Some more messages. |
---|
545 | AC_MSG_RESULT([ |
---|
546 | yat is configured as follows: |
---|
547 | |
---|
548 | Build Shared Library: $enable_shared |
---|
549 | Build Static Library: $enable_static |
---|
550 | Build Documentation: $doxygen_message |
---|
551 | With Bam Support: $with_samtools |
---|
552 | |
---|
553 | Options used to compile and link: |
---|
554 | VERSION = $VERSION |
---|
555 | CXX = $CXX |
---|
556 | CPPFLAGS = $CPPFLAGS |
---|
557 | YAT_CPPFLAGS= $AM_CPPFLAGS |
---|
558 | CXXFLAGS = $CXXFLAGS |
---|
559 | YAT_CXXFLAGS= $AM_CXXFLAGS |
---|
560 | LD = $LD |
---|
561 | LDFLAGS = $LDFLAGS |
---|
562 | YAT_LDFLAGS = $AM_LDFLAGS |
---|
563 | LIBS = $LIBS |
---|
564 | YAT_LIBS = $YAT_LIBS |
---|
565 | ${yat_gslcblas_message}dnl |
---|
566 | ---------------------------------------------------------------- |
---|
567 | Now type `make'. dnl |
---|
568 | ]) |
---|