source: trunk/configure.ac @ 3896

Last change on this file since 3896 was 3896, checked in by Peter, 3 years ago

fixes #943, avoid compiler warning about deprecated boost header

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 25.3 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 3896 2020-03-30 03:13:50Z 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
37m4_include([m4/version.m4])
38AC_INIT([yat],[my_VERSION],[libyat-users@lists.sourceforge.net],,
39        [http://dev.thep.lu.se/yat])
40MY_VERSION
41AC_PREREQ([2.64])
42AC_CONFIG_SRCDIR([yat/utility/Matrix.h])
43AC_CONFIG_AUX_DIR([autotools])
44dnl arg below should be the same as in Makefile.am
45AC_CONFIG_MACRO_DIR([m4])
46AC_PREFIX_DEFAULT([/usr/local])
47
48# Set default htmldir to ${docdir}/html
49AS_IF([test $htmldir = '${docdir}'], [htmldir='${docdir}/html'])
50
51AC_SUBST([YAT_LT_VERSION], [YAT_LT_VERSION_INFO])
52AC_DEFINE([YAT_VERSION], ["my_VERSION"], [version])
53
54AC_CONFIG_HEADERS([config.h])
55AM_INIT_AUTOMAKE([1.11 std-options color-tests parallel-tests
56                  silent-rules subdir-objects])
57
58# Set default programming language
59AC_LANG(C++)
60
61# propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS
62for 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
68done
69AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
70
71# record if CXXFLAGS was set by user for further use below
72AS_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.
85dnl FIXME remove m4_ifdef when we assume Automake 1.12
86m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
87AC_PROG_CXX
88
89AC_ARG_ENABLE([cxx11],
90  [AS_HELP_STRING([--enable-cxx11],
91                  [search for compiler options to build with C++11 support])
92AS_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
102yat_have_rvalue=no
103yat_have_atomic=no
104yat_have_log2=no
105AS_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
134AC_PROG_SED
135AC_PROG_LIBTOOL
136
137# find the compiler vendor: gnu, intel, etc
138AX_COMPILER_VENDOR
139
140AC_ARG_VAR([DOXYGEN], [path to doxygen program])
141have_doxygen=no
142
143# Let the user turn off usage of doxygen
144AS_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
160AC_SUBST(have_doxygen)
161AM_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
166AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true])
167AC_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.
188AS_IF([test x"$quiet_nan" = x"no"], [
189  AC_MSG_FAILURE([dnl
190Support 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
196AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true])
197AC_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.
218AS_IF([test x"${has_infinity}" = x"no"], [
219  AC_MSG_FAILURE([dnl
220Support for infinity required. yat will not work on this system!])
221])
222
223
224AC_MSG_CHECKING([g++ deprecation attribute])
225AC_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
232AC_MSG_CHECKING([if std::multiset::iterator is mutable])
233AC_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
247APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
248APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
249APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
250APR_SAVE_THE_ENVIRONMENT(LIBS)
251user_LIBS=$LIBS
252
253AS_CASE([$host_os], [darwin*], [
254  YAT_LD_ADD_FLAG([LDFLAGS], [-Wl,-flat_namespace])
255])
256
257# prefer using libtool in link tests
258YAT_USE_LIBTOOL_PUSH
259
260# Checks for libraries.
261AC_MSG_NOTICE([checking for libraries])
262AC_CHECK_LIBM
263LIBS="$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.
268YAT_STATIC_LIBS=
269YAT_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
275m4_define([YAT_REQUIRED_GSL_VERSION], [1.8])
276YAT_CHECK_GSL([YAT_REQUIRED_GSL_VERSION], [],
277   [AC_MSG_FAILURE([dnl
278GSL 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
283m4_define([YAT_REQUIRED_BOOST_VERSION], [1.35])
284AX_BOOST_BASE([YAT_REQUIRED_BOOST_VERSION], [], [AC_MSG_FAILURE([dnl
285Boost YAT_REQUIRED_BOOST_VERSION (or newer) not found. Please install boost, or provide
286CPPFLAGS=-I/path/to/boost])
287])
288# skip boost link tests if boost is not wanted (--without-boost)
289AS_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)
338YAT_LIB_CBLAS([YAT_CBLAS_LIB=$CBLAS_LIB], [YAT_CBLAS_LIB=-lgslcblas])
339LIBS="-lgsl $YAT_CBLAS_LIB $LIBS"
340
341YAT_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
348AC_MSG_CHECKING([whether constructor in boost concept is supported])
349AC_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
374AC_MSG_CHECKING([if boost::mutex workaround is needed])
375AC_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.
388AC_MSG_CHECKING([if boost::iterator_facade::operator-> works])
389AC_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
417
418# check for hts and samtools available from http://www.htslib.org
419YAT_CHECK_HTSLIB
420
421#support for large files
422AC_SYS_LARGEFILE
423if test "$enable_largefile" = "no"; then
424  AC_DEFINE([YAT_LFS_DISABLED], 1,
425            [defined to 1 if large file support is disabled])
426fi
427
428AC_DEFINE([HAVE_INLINE], [1], [Define if inline is available on system])
429# default is same as --disable-debug
430AC_ARG_ENABLE([debug],
431  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])],
432        [], [enable_debug=no])
433
434# If neither --enable-assert nor --disable-assert, set enable_assert
435# to same as enable_debug
436AC_ARG_ENABLE([assert],
437              [AS_HELP_STRING([--enable-assert], [turn on assertions])],
438              [], [enable_assert=$enable_debug])
439
440# we use prefix INTERNAL_ for variables that are solely needed for
441# building yat, i.e., they are not needed for a user of yat and are
442# not propagated to yat-config or yat.m4.
443AC_ARG_VAR([INTERNAL_CPPFLAGS],
444           [Similar to CPPFLAGS but value is not propagated to yat-config])
445AC_ARG_VAR([INTERNAL_CXXFLAGS],
446           [Similar to CXXFLAGS but value is not propagated to yat-config])
447AC_ARG_VAR([INTERNAL_LDFLAGS],
448           [Similar to LDFLAGS but value is not propagated to yat-config])
449
450AS_IF([test "${enable_debug}" = "yes"], [
451  AC_DEFINE([YAT_DEBUG], [1], [Define to activate yat assertioons])
452  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wall -pedantic -g -O])
453], [
454  # avoid defining GSL_RANGE_CHECK_OFF if GSL_RANGE_CHECK is already defined
455  AC_CHECK_DECL([GSL_RANGE_CHECK],[],
456                [AC_DEFINE([GSL_RANGE_CHECK_OFF], [1],
457                           [Define to turn off GSL range checks])])
458  # If CXXFLAGS not set by user, set it to default value
459  AS_IF([test x$CXXFLAGS_set_by_user != xyes], [
460    YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS],[-O3])
461  ])
462])
463
464AS_IF([test x"$enable_assert" = x"no"], [
465  AC_DEFINE([NDEBUG], [1], [Define to turn off assertions])
466])
467
468# turn off compiler warning #654 from intel compiler
469AS_IF([test x"$ax_cv_cxx_compiler_vendor" = x"intel"], [
470  YAT_CXX_ADD_FLAG([CXXFLAGS], ['-diag-disable 654'])
471])
472
473# Turns warnings to errors in compilation tests. Only put tests that
474# should be warning sensitive below this point. Can't find any
475# mechanism to revert AC_LANG_WERROR
476AC_LANG_WERROR
477
478# GCC 4.0.1 on OSX complains about -pthread (issue #713)
479AS_IF([AS_ECHO(["$CPPFLAGS"]) | $GREP '\-pthread' > /dev/null],
480  [AX_CHECK_PREPROC_FLAG([-pthread], [],
481     [CPPFLAGS=`AS_ECHO(["$CPPFLAGS"]) | $SED 's%-pthread%%'`],
482     [$INTERNAL_CPPFLAGS])
483])
484
485# When compiling boost::Mutable_*Iterator some versions of clang complains:
486# warning: unsequenced modification and access to 'i' [-Wunsequenced]
487# Test if compiler gives that warning, and if it does turn it off.
488yat_save_CXXFLAGS=$CXXFLAGS
489AC_MSG_CHECKING([whether 'boost/concept_check.hpp' causes compiler warnings])
490CXXFLAGS="$INTERNAL_CXXFLAGS $CXXFLAGS"
491AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
492  [
493    @%:@include <boost/concept_check.hpp>
494  ],[
495    BOOST_CONCEPT_ASSERT((boost::Mutable_RandomAccessIterator<double* >));
496  ])
497], [ # IF-SUCCESSFUL
498  AC_MSG_RESULT([no])
499  # restore CXXFLAGS
500  CXXFLAGS=$yat_save_CXXFLAGS
501], [ # IF-FAILED
502  AC_MSG_RESULT([yes])
503  CXXFLAGS=$yat_save_CXXFLAGS
504  YAT_CXX_ADD_FLAG([CXXFLAGS], [-Wno-unsequenced])
505])
506
507
508AS_IF([test x$enable_debug = xyes], [
509  suppress_long_long_warnings=no
510  # some versions of boost uses long long - turn off compiler warnings
511  # with -Wno-long-long
512  yat_save_CXXFLAGS=$CXXFLAGS
513  AC_MSG_CHECKING([whether boost causes long long warnings])
514  CXXFLAGS="$INTERNAL_CXXFLAGS $CXXFLAGS"
515  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
516    [
517      @%:@include <boost/iterator/transform_iterator.hpp>
518      @%:@include <boost/thread.hpp>
519      @%:@include <cmath>
520      @%:@include <functional>
521      @%:@include <vector>
522    ],[
523      using namespace boost;
524      typedef std::pointer_to_unary_function<double, double> F;
525      std::vector<double> vec;
526      transform_iterator<F, std::vector<double>::iterator>
527        i(vec.begin(), std::ptr_fun(fabs));
528      int x = boost::thread::hardware_concurrency();
529      ++x;
530    ])],
531  [AC_MSG_RESULT([no])],
532  [AC_MSG_RESULT([yes])
533   suppress_long_long_warnings=yes
534  ])
535  AS_IF([test x"$suppress_long_long_warnings" = x"no"], [
536    AC_MSG_CHECKING([whether <htslib/sam.h> causes long long warnings])
537    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@ include <htslib/sam.h>],[])],
538                      [AC_MSG_RESULT([no])],
539                      [AC_MSG_RESULT([yes])
540                       suppress_long_long_warnings=yes])
541  ])
542  AS_IF([test x"$suppress_long_long_warnings" = x"yes"], [
543    YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wno-long-long])
544  ])
545  # restore CXXFLAGS
546  CXXFLAGS=$yat_save_CXXFLAGS
547])
548
549# Some versions of boost includes deprecated boost header, triggering
550# compiler warnings (see ticket #943)
551
552
553yat_save_CPPFLAGS=$CPPFLAGS
554CPPFLAGS="$INTERNAL_CPPFLAGS $CPPFLAGS"
555yat_save_CXXFLAGS=$CXXFLAGS
556CXXFLAGS="$INTERNAL_CXXFLAGS $CXXFLAGS"
557AC_MSG_CHECKING([whether boost headers include deprecated boost headers])
558AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
559    [@%:@include <boost/random/negative_binomial_distribution.hpp>],
560    [])
561  ], [
562    AC_MSG_RESULT([no])
563  ], [
564    AC_MSG_RESULT([yes])
565    AC_DEFINE([YAT_BOOST_ALLOW_DEPRECATED_HEADERS], [1],
566              [Define if deprecated boost headers should be allowed])
567])
568CPPFLAGS=${save_CPPFLAGS}
569CXXFLAGS=${save_CXXFLAGS}
570
571#doxygen stuff
572DX_HTML_OUTPUT=html
573AC_SUBST(DX_HTML_OUTPUT)
574
575AC_CONFIG_FILES([build_support/gen_yat_pc.sh],
576                [chmod +x build_support/gen_yat_pc.sh])
577AC_CONFIG_FILES([Makefile
578     doc/doxygen.config
579     doc/first_page.doxygen
580                 test/defs.sh
581])
582
583AC_CONFIG_HEADERS([yat/utility/config_public.h])
584canonical_abs_top_srcdir=`cd $srcdir && pwd -P`
585AC_SUBST([canonical_abs_top_srcdir])
586canonical_abs_top_builddir=`pwd -P`
587AC_SUBST([canonical_abs_top_builddir])
588
589# for the test suite
590yat_abs_top_srcdir=`cd $srcdir && pwd`
591AC_DEFINE_UNQUOTED([YAT_ABS_TOP_SRCDIR], ["$yat_abs_top_srcdir"],
592                   [Define to absolute path to top yat src dir])
593
594# Reset flags
595APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_)
596APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, YAT_)
597APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, YAT_)
598APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_)
599
600# Set some variables useful when linking
601AC_SUBST([YAT_STATIC_LIBS])
602
603# libs used in libyat.la
604yat_libyat_la_LIBADD="$YAT_LIBS"
605# We avoid linking in cblas in libyat.la, to let users choose
606# favourite cblas library at link time.
607YAT_VAR_REMOVE([yat_libyat_la_LIBADD], [$YAT_CBLAS_LIB])
608# we avoid linking in YAT_STATIC_LIBS as they have been detected to
609# not be suitable libtool archive.
610YAT_VAR_REMOVE([yat_libyat_la_LIBADD], [$YAT_STATIC_LIBS])
611AC_SUBST([yat_libyat_la_LIBADD])
612
613# Primary LIBS are same as linked into libyat.la excluding LIBM
614YAT_PRIMARY_LIBS=$yat_libyat_la_LIBADD
615YAT_VAR_REMOVE([YAT_PRIMARY_LIBS], [$LIBM])
616AC_SUBST(YAT_PRIMARY_LIBS)
617
618# Assign LIBS variables for yat.pc
619YAT_PC_LIBS_PRIVATE=$YAT_LIBS
620
621# Dependency to GSL is noted via 'Requires' field
622YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [-lgsl $YAT_CBLAS_LIB $LIBM])
623YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [-lgsl], [
624  YAT_PC_REQUIRES_PRIVATE="gsl > YAT_REQUIRED_GSL_VERSION"
625], [
626  YAT_PC_REQUIRES="gsl > YAT_REQUIRED_GSL_VERSION"
627])
628
629# ignore this whole htslib thing if --without-htslib
630AS_IF([test x$with_htslib != x"no"], [
631  # htslib comes with a pc file, so we can require htslib in yat.pc
632  YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [$HTS_LIBS -lz])
633  # if libyat is linking in -lhts, linking against libyat is
634  # sufficient and put htslib in 'requires private:', otherwise put
635  # them in 'require:'.
636  YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [-lhts], [
637    YAT_PC_REQUIRES_PRIVATE="$YAT_PC_REQUIRES_PRIVATE htslib"
638  ], [
639    YAT_PC_REQUIRES="$YAT_PC_REQUIRES htslib"
640  ])
641])
642
643# Having libs declared as LIBS.private in yat.pc assumes that libs
644# have been linked into libyat. Therefore for each lib check if it is
645# mentioned in $yat_libyat_la_LIBADD, and if it's not move
646# lib to LIBS variable.
647for lib in $YAT_PC_LIBS_PRIVATE; do
648  YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [$lib], [
649  ], [
650    # move lib from $YAT_PC_LIBS_PRIVATE to $YAT_PC_LIBS
651    YAT_VAR_REMOVE([$YAT_PC_LIBS_PRIVATE], [$lib])
652    YAT_PC_LIBS="$YAT_PC_LIBS $lib"
653  ])
654done
655
656AC_SUBST([YAT_PC_LIBS])
657AC_SUBST([YAT_PC_REQUIRES])
658AC_SUBST([YAT_PC_LIBS_PRIVATE])
659AC_SUBST([YAT_PC_REQUIRES_PRIVATE])
660
661# propagate some variables to 'yat-config'
662AC_ARG_VAR([YAT_CONFIG_CPPFLAGS],
663           [Similar to CPPFLAGS but value is only propagated to yat-config])
664AC_ARG_VAR([YAT_CONFIG_CXXFLAGS],
665           [Similar to CXXFLAGS but value is only propagated to yat-config])
666AC_ARG_VAR([YAT_CONFIG_LDFLAGS],
667           [Similar to LDFLAGS but value is only propagated to yat-config])
668AC_SUBST([YAT_CONFIG_CPPFLAGS])
669AC_SUBST([YAT_CONFIG_CXXFLAGS])
670AC_SUBST([YAT_CONFIG_LDFLAGS])
671
672AC_SUBST([GXX])
673AC_SUBST(YAT_LIBS)
674AC_SUBST(YAT_CBLAS_LIB)
675
676# set and AC_SUBST variables that are interpreted by Automake
677AM_CPPFLAGS="$INTERNAL_CPPFLAGS $YAT_CPPFLAGS"
678AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS"
679AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS"
680
681AC_SUBST(AM_CPPFLAGS)
682AC_SUBST(AM_CXXFLAGS)
683AC_SUBST(AM_LDFLAGS)
684AC_SUBST([enable_shared])
685AC_SUBST([enable_static])
686
687# Name of directory libtool put stuff int - needed for some tests
688AC_SUBST([lt_cv_objdir])
689
690YAT_SVN_RELEASE([am/maintainer.am],
691  [$(YAT_MAJOR_VERSION).$(YAT_MINOR_VERSION)],
692  [libyat@frs.sourceforge.net:/home/frs/project/l/li/libyat],
693  [http://sourceforge.net/projects/libyat/files/$(distdir).tar.gz/files],
694  [http://dev.thep.lu.se/yat/browser/tags/$(VERSION)/NEWS])
695
696# make shell tests work in VPATH builds
697AC_CONFIG_LINKS([test/init.sh:test/init.sh])
698
699# set some variable for final message
700AS_CASE([$have_doxygen],
701        [yes], [doxygen_message=yes],
702        [no], [doxygen_message="no (doxygen not found)"],
703        [old], [doxygen_message="no (\`$DOXYGEN' too old)"],
704        [notwanted], [doxygen_message="no"],
705        [AC_MSG_WARN([unexpected value \$have_doxygen: '$have_doxygen'])
706         AS_BOX([Report this to ]AC_PACKAGE_BUGREPORT)
707        ])
708
709yat_gslcblas_message=
710AS_IF([test "x$YAT_CBLAS_LIB" = "x-lgslcblas"], [
711yat_gslcblas_message='
712  GSL CBLAS found. This is a reference implementation only.
713  Consider using hardware optimized BLAS.
714  ATLAS (http://math-atlas.sourceforge.net/) provides an
715  optimized BLAS library. It is supported by yat!
716'
717])
718
719# Create output.
720AC_OUTPUT
721
722
723# Some more messages.
724AC_MSG_RESULT([
725yat is configured as follows:
726
727  Build Shared Library: $enable_shared
728  Build Static Library: $enable_static
729  Build Documentation:  $doxygen_message
730  With Bam Support:     $with_htslib
731  With Rvalue Support:  $yat_have_rvalue
732  With Atomic Support:  $yat_have_atomic
733
734Options used to compile and link:
735  VERSION     = $VERSION
736  CXX         = $CXX
737  CPPFLAGS    = $CPPFLAGS
738  YAT_CPPFLAGS= $AM_CPPFLAGS
739  CXXFLAGS    = $CXXFLAGS
740  YAT_CXXFLAGS= $AM_CXXFLAGS
741  LD          = $LD
742  LDFLAGS     = $LDFLAGS
743  YAT_LDFLAGS = $AM_LDFLAGS
744  LIBS        = $LIBS
745  YAT_LIBS    = $YAT_LIBS
746${yat_gslcblas_message}dnl
747----------------------------------------------------------------
748Now type `make'. dnl
749])
Note: See TracBrowser for help on using the repository browser.