source: branches/0.13-stable/configure.ac

Last change on this file was 3504, checked in by Peter, 5 years ago

fixes #863. add libboost_system before looking for boost_thread.

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