source: trunk/configure.ac @ 3811

Last change on this file since 3811 was 3811, checked in by Peter, 11 months ago

prefer variable assignment as autoconf time rather than at configure time and get rid of the variable in Makefile and gen_yat_pc script.

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