source: trunk/configure.ac @ 3417

Last change on this file since 3417 was 3417, checked in by Peter, 4 years ago

updating copyright statements

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 24.1 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 3417 2015-05-25 01:35:59Z 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 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_THREAD
250  AX_BOOST_SYSTEM
251  YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS])
252  YAT_LD_ADD_FLAG([LDFLAGS], [$BOOST_LDFLAGS])
253  # boost tests above only test compilation, so let's try link in the libs
254  LIBS="$LIBS $BOOST_THREAD_LIB $BOOST_SYSTEM_LIB"
255  AC_MSG_CHECKING([for boost::thread_specific_ptr])
256  AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include <boost/thread/tss.hpp>],
257                                  [boost::thread_specific_ptr<int> x;
258                                   x.reset(new int(1));])],
259                 [AC_MSG_RESULT([yes])],
260                 [AC_MSG_RESULT([no])
261                  AC_MSG_FAILURE([Boost thread library not found.])
262                 ])
263  # Check if $BOOST_THREAD_LIB is appropriate for libyat.la
264  YAT_CHECK_LA_LIBS([
265    @%:@include <boost/thread.hpp>
266    int my_func(void)
267    { boost::mutex mutex_; return 0; }
268  ], [$BOOST_THREAD_LIB $user_LIBS], [$BOOST_THREAD_LIB], [YAT_STATIC_LIBS])
269  # Check if $BOOST_SYSTEM_LIB is appropriate for libyat.la
270  YAT_CHECK_LA_LIBS([
271    @%:@include <boost/system/error_code.hpp>
272    int my_func(void)
273    { boost::system::system_category; return 0; }
274  ], [$BOOST_SYSTEM_LIB $user_LIBS], [$BOOST_SYSTEM_LIB], [YAT_STATIC_LIBS])
275])
276
277# see tickets #648 #687
278AC_MSG_CHECKING([whether constructor in boost concept is supported])
279AC_COMPILE_IFELSE([
280  AC_LANG_PROGRAM(
281    [
282     @%:@include <boost/concept_check.hpp>
283     template <typename T>
284     class MyConcept
285     {
286     public:
287       MyConcept(void) {}
288       BOOST_CONCEPT_USAGE(MyConcept){}
289     };
290    ],[
291     MyConcept<double> x;
292     x = x;
293    ])
294  ],
295  [AC_MSG_RESULT([yes])
296   AC_DEFINE([YAT_HAVE_BOOST_CONCEPT_WITH_CONSTRUCTOR],[1],
297             [define if compiler supports boost concept with constructor])
298  ],
299  [AC_MSG_RESULT([no])]
300)
301
302# Workaround problem that boost 1.41 does not work with certain versions of GCC
303# see ticket #762
304AC_MSG_CHECKING([if boost::mutex workaround is needed])
305AC_COMPILE_IFELSE(
306  [AC_LANG_PROGRAM([@%:@include <boost/thread.hpp>],
307                   [boost::mutex mutex;]
308   )],
309  [AC_MSG_RESULT([no])
310   AC_DEFINE([YAT_HAVE_WORKING_BOOST_EXCEPTION_PTR], [1],
311             [Define to 1 if boost::exception_ptr works])
312  ],
313  [AC_MSG_RESULT([yes])])
314
315# Check if boost::iterator_facade::operator-> works with a proxy class
316# as reference_type; otherwise workaround is needed in
317# e.g. BamPairIterator. See ticket #790.
318AC_MSG_CHECKING([if boost::iterator_facade::operator-> works])
319AC_COMPILE_IFELSE(
320  [AC_LANG_PROGRAM(
321    [@%:@include <iterator>
322     @%:@include <boost/iterator/iterator_facade.hpp>
323     struct MyClass { void foo(void) const { } };
324     struct MyProxy { void foo(void) const { } };
325     // a nonsense class (only for compiler test purposes)
326     class MyIterator
327       : public boost::iterator_facade<
328        MyIterator, const MyClass, std::input_iterator_tag, MyProxy
329       >
330     {
331       friend class boost::iterator_core_access;
332       const MyProxy dereference(void) const { return MyProxy(); }
333       bool equal(const MyIterator& other) const { return true; }
334       void increment(void) {}
335     };
336    ],
337    [MyIterator iter; iter->foo();]
338    )
339  ],[
340    AC_MSG_RESULT([yes])
341    AC_DEFINE([YAT_HAVE_BOOST_ITERATOR_FACADE_PROXY_PTR], [1],
342              [Define to 1 if boost::iterator_facade::operator-> works])
343  ],[
344    AC_MSG_RESULT([no])
345  ])
346
347# samtools API from http://samtools.sourceforge.net
348AC_ARG_WITH([samtools],
349            [AS_HELP_STRING([--without-samtools],
350                            [disable samtools support (deprecated)])],
351            [],
352            [with_samtools=yes])
353
354# HTSLIB API available from http://www.htslib.org/
355AC_ARG_WITH([htslib],
356            [AS_HELP_STRING([--without-htslib], [disable htslib support])],
357            [],
358            [with_htslib=$with_samtools])
359
360AS_IF([test x"$with_htslib" != x"no"], [
361  AC_CHECK_HEADER([zlib.h], [],
362    [AC_MSG_FAILURE([header file 'zlib.h' was not found])])
363  AC_SEARCH_LIBS([inflateEnd], [z], [],
364    [AC_MSG_FAILURE([library 'libz' was not found])])
365  LIBZ=$ac_cv_search_inflateEnd
366  AS_IF([test x"$LIBZ" = x"none required"], [LIBZ=])
367  YAT_CHECK_LA_LIBS([
368    @%:@include <zlib.h>
369    int my_func(void)
370    { z_streamp zs; inflateEnd(zs); return 0; }
371  ], [$LIBZ $user_LIBS], [$LIBZ], [YAT_STATIC_LIBS])
372
373  # Check if htslib is available. If no check if samtools API is available
374  YAT_CHECK_HTS([
375    AC_MSG_CHECKING([htslib])
376    AC_MSG_RESULT([yes])
377    AC_DEFINE([YAT_HAVE_HTSLIB], [1], [Define to 1 if HTS is available])
378    LIBS="$BAM_LIBS $LIBS"
379    have_hts=yes;
380  ],[
381    AC_MSG_CHECKING([htslib])
382    AC_MSG_RESULT([no])
383    have_hts=no;
384    YAT_CHECK_BAM([
385      AC_MSG_CHECKING([samtools API])
386      AC_MSG_RESULT([yes])
387      LIBS="$BAM_LIBS $LIBS"
388      # check if function bam_calend works. Result of this test can be
389      # overridden by setting variable 'yat_cv_func_bam_calend'
390      YAT_FUNC_BAM_CALEND([$srcdir/test/data/foo.sam])
391      # check if global variable bam_nt16_rev_table is available
392      YAT_BAM_NT16_REV_TABLE
393    ], [
394      AC_MSG_CHECKING([samtools API])
395      AC_MSG_RESULT([no])
396      AC_MSG_FAILURE([neither htslib or samtools was found])
397    ])
398  ])
399  AC_SUBST([HAVE_HTSLIB], [$have_hts])
400
401  AC_DEFINE([YAT_HAVE_LIBBAM], [1],
402            [Define to 1 if yat is built with bam support])
403
404  YAT_CHECK_LA_LIBS([
405    _YAT_BAM_INCLUDES
406    @%:@if YAT_HAVE_HTSLIB
407    void my_func(bam_hdr_t* hdr) { bam_hdr_destroy(hdr); }
408    @%:@else
409    void my_func(bam_header_t* hdr) { bam_header_destroy(hdr); }
410    @%:@endif
411  ], [$BAM_LIBS $LIBZ $user_LIBS], [$BAM_LIBS], [YAT_STATIC_LIBS])
412
413  AC_PATH_PROG([SAMTOOLS], [samtools], [false])
414  AC_ARG_VAR([SAMTOOLS], [Tools for alignment in the SAM format])
415
416], [
417  SAMTOOLS=false
418])
419AM_CONDITIONAL([HAVE_HTSLIB], [test x"$with_htslib" = x"yes"])
420have_htslib=$with_htslib
421AC_SUBST([have_htslib])
422AM_CONDITIONAL([HAVE_SAMTOOLS_EXECUTABLE], [test x"$SAMTOOLS" != x"false"])
423AC_SUBST([SAMTOOLS])
424AS_IF([test x"$SAMTOOLS" = x"false"], [], [
425  AC_DEFINE([HAVE_SAMTOOLS_EXECUTABLE], [1],
426            [Define if samtools executable is available])
427])
428
429#support for large files
430AC_SYS_LARGEFILE
431if test "$enable_largefile" = "no"; then
432  AC_DEFINE([YAT_LFS_DISABLED], 1,
433            [defined to 1 if large file support is disabled])
434fi
435
436AC_DEFINE([HAVE_INLINE], [1], [Define if inline is available on system])
437# default is same as --disable-debug
438AC_ARG_ENABLE([debug],
439  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])],
440        [], [enable_debug=no])
441
442# If neither --enable-assert nor --disable-assert, set enable_assert
443# to same as enable_debug
444AC_ARG_ENABLE([assert],
445              [AS_HELP_STRING([--enable-assert], [turn on assertions])],
446              [], [enable_assert=$enable_debug])
447
448# we use prefix INTERNAL_ for variables that are solely needed for
449# building yat, i.e., they are not needed for a user of yat and are
450# not propagated to yat-config or yat.m4.
451AC_ARG_VAR([INTERNAL_CPPFLAGS],
452           [Similar to CPPFLAGS but value is not propagated to yat-config])
453AC_ARG_VAR([INTERNAL_CXXFLAGS],
454           [Similar to CXXFLAGS but value is not propagated to yat-config])
455AC_ARG_VAR([INTERNAL_LDFLAGS],
456           [Similar to LDFLAGS but value is not propagated to yat-config])
457
458AS_IF([test "${enable_debug}" = "yes"], [
459  AC_DEFINE([YAT_DEBUG], [1], [Define to activate yat assertioons])
460  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wall -pedantic -g -O])
461], [
462  # avoid defining GSL_RANGE_CHECK_OFF if GSL_RANGE_CHECK is already defined
463  AC_CHECK_DECL([GSL_RANGE_CHECK],[],
464                [AC_DEFINE([GSL_RANGE_CHECK_OFF], [1],
465                           [Define to turn off GSL range checks])])
466  # If CXXFLAGS not set by user, set it to default value
467  AS_IF([test x$CXXFLAGS_set_by_user != xyes], [
468    YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS],[-O3])
469  ])
470])
471
472AS_IF([test x"$enable_assert" = x"no"], [
473  AC_DEFINE([NDEBUG], [1], [Define to turn off assertions])
474])
475
476# turn off compiler warning #654 from intel compiler
477AS_IF([test x"$ax_cv_cxx_compiler_vendor" = x"intel"], [
478  YAT_CXX_ADD_FLAG([CXXFLAGS], ['-diag-disable 654'])
479])
480
481# Turns warnings to errors in compilation tests. Only put tests that
482# should be warning sensitive below this point. Can't find any
483# mechanism to revert AC_LANG_WERROR
484AC_LANG_WERROR
485
486# GCC 4.0.1 on OSX complains about -pthread (issue #713)
487AS_IF([AS_ECHO(["$CPPFLAGS"]) | $GREP '\-pthread' > /dev/null],
488  [AX_CHECK_PREPROC_FLAG([-pthread], [],
489     [CPPFLAGS=`AS_ECHO(["$CPPFLAGS"]) | $SED 's%-pthread%%'`],
490     [$INTERNAL_CPPFLAGS])
491])
492
493# When compiling boost::Mutable_*Iterator some versions of clang complains:
494# warning: unsequenced modification and access to 'i' [-Wunsequenced]
495# Test if compiler gives that warning, and if it does turn it off.
496yat_save_CXXFLAGS=$CXXFLAGS
497AC_MSG_CHECKING([whether 'boost/concept_check.hpp' causes compiler warnings])
498CXXFLAGS="$INTERNAL_CXXFLAGS $CXXFLAGS"
499AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
500  [
501    @%:@include <boost/concept_check.hpp>
502  ],[
503    BOOST_CONCEPT_ASSERT((boost::Mutable_RandomAccessIterator<double* >));
504  ])
505], [ # IF-SUCCESSFUL
506  AC_MSG_RESULT([no])
507  # restore CXXFLAGS
508  CXXFLAGS=$yat_save_CXXFLAGS
509], [ # IF-FAILED
510  AC_MSG_RESULT([yes])
511  CXXFLAGS=$yat_save_CXXFLAGS
512  YAT_CXX_ADD_FLAG([CXXFLAGS], [-Wno-unsequenced])
513])
514
515
516AS_IF([test x$enable_debug = xyes], [
517  suppress_long_long_warnings=no
518  # some versions of boost uses long long - turn off compiler warnings
519  # with -Wno-long-long
520  yat_save_CXXFLAGS=$CXXFLAGS
521  AC_MSG_CHECKING([whether boost causes long long warnings])
522  CXXFLAGS="$INTERNAL_CXXFLAGS $CXXFLAGS"
523  AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
524    [
525      @%:@include <boost/iterator/transform_iterator.hpp>
526      @%:@include <boost/thread.hpp>
527      @%:@include <cmath>
528      @%:@include <functional>
529      @%:@include <vector>
530    ],[
531      using namespace boost;
532      typedef std::pointer_to_unary_function<double, double> F;
533      std::vector<double> vec;
534      transform_iterator<F, std::vector<double>::iterator>
535        i(vec.begin(), std::ptr_fun(fabs));
536      int x = boost::thread::hardware_concurrency();
537      ++x;
538    ])],
539  [AC_MSG_RESULT([no])],
540  [AC_MSG_RESULT([yes])
541   suppress_long_long_warnings=yes
542  ])
543  AS_IF([test x"$suppress_long_long_warnings" = x"no"], [
544    AC_MSG_CHECKING([whether samtools causes long long warnings])
545    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([_YAT_BAM_INCLUDES],[])],
546                      [AC_MSG_RESULT([no])],
547                      [AC_MSG_RESULT([yes])
548                       suppress_long_long_warnings=yes])
549  ])
550  AS_IF([test x"$suppress_long_long_warnings" = x"yes"], [
551    YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wno-long-long])
552  ])
553  # restore CXXFLAGS
554  CXXFLAGS=$yat_save_CXXFLAGS
555])
556
557#doxygen stuff
558DX_HTML_OUTPUT=html
559AC_SUBST(DX_HTML_OUTPUT)
560
561AC_CONFIG_FILES([build_support/gen_yat_pc.sh],
562                [chmod +x build_support/gen_yat_pc.sh])
563AC_CONFIG_FILES([Makefile
564     doc/doxygen.config
565     doc/first_page.doxygen
566                 test/defs.sh
567])
568
569AC_CONFIG_HEADERS([yat/utility/config_public.h])
570# for the test suite
571yat_abs_top_srcdir=`cd $srcdir && pwd`
572AC_DEFINE_UNQUOTED([YAT_ABS_TOP_SRCDIR], ["$yat_abs_top_srcdir"],
573                   [Define to absolute path to top yat src dir])
574
575# Reset flags
576APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_)
577APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, YAT_)
578APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, YAT_)
579APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_)
580
581# Set some variables useful when linking
582AC_SUBST([YAT_STATIC_LIBS])
583
584# libs used in libyat.la
585yat_libyat_la_LIBADD="$YAT_LIBS"
586# We avoid linking in cblas in libyat.la, to let users choose
587# favourite cblas library at link time.
588YAT_VAR_REMOVE([yat_libyat_la_LIBADD], [$YAT_CBLAS_LIB])
589# we avoid linking in YAT_STATIC_LIBS as they have been detected to
590# not be suitable libtool archive.
591YAT_VAR_REMOVE([yat_libyat_la_LIBADD], [$YAT_STATIC_LIBS])
592AC_SUBST([yat_libyat_la_LIBADD])
593
594# Primary LIBS are same as linked into libyat.la excluding LIBM
595YAT_PRIMARY_LIBS=$yat_libyat_la_LIBADD
596YAT_VAR_REMOVE([YAT_PRIMARY_LIBS], [$LIBM])
597AC_SUBST(YAT_PRIMARY_LIBS)
598
599# Assign LIBS variables for yat.pc
600YAT_PC_LIBS_PRIVATE=$YAT_LIBS
601
602# Dependency to GSL is noted via 'Requires' field
603YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [-lgsl $YAT_CBLAS_LIB $LIBM])
604YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [-lgsl], [
605  YAT_PC_REQUIRES_PRIVATE="gsl > $gsl_version"
606], [
607  YAT_PC_REQUIRES="gsl > $gsl_version"
608])
609
610# ignore this whole bam thing if --without-htslib
611AS_IF([test x$with_htslib != x"no"], [
612  # htslib comes with a pc file, so we can require htslib in yat.pc
613  AS_IF([test x$with_hts = x"yes"], [
614    YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [$BAM_LIBS -lz])
615    YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [-lhts], [
616      YAT_PC_REQUIRES_PRIVATE="$YAT_PC_REQUIRES_PRIVATE htslib"
617    ], [
618      YAT_PC_REQUIRES="$YAT_PC_REQUIRES htslib"
619    ])
620  ],[
621    # libbam has no pc file, so has to remain in LIBS and instead we
622    # require zlib
623    YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [-lz])
624    YAT_PC_REQUIRES="$YAT_PC_REQUIRES zlib"
625    YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [-lz], [
626      YAT_PC_REQUIRES_PRIVATE="$YAT_PC_REQUIRES_PRIVATE zlib"
627    ], [
628      YAT_PC_REQUIRES="$YAT_PC_REQUIRES zlib"
629    ])
630  ])
631])
632
633# Having libs declared as LIBS.private in yat.pc assumes that libs
634# have been linked into libyat. Therefore for each lib check if it is
635# mentioned in $yat_libyat_la_LIBADD, and if it's not move
636# lib to LIBS variable.
637for lib in $YAT_PC_LIBS_PRIVATE; do
638  YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [$lib], [
639  ], [
640    # move lib from $YAT_PC_LIBS_PRIVATE to $YAT_PC_LIBS
641    YAT_VAR_REMOVE([$YAT_PC_LIBS_PRIVATE], [$lib])
642    YAT_PC_LIBS="$YAT_PC_LIBS $lib"
643  ])
644done
645
646AC_SUBST([YAT_PC_LIBS])
647AC_SUBST([YAT_PC_REQUIRES])
648AC_SUBST([YAT_PC_LIBS_PRIVATE])
649AC_SUBST([YAT_PC_REQUIRES_PRIVATE])
650
651AC_SUBST(YAT_LIBS)
652AC_SUBST(YAT_CBLAS_LIB)
653
654# set and AC_SUBST variables that are interpreted by Automake
655AM_CPPFLAGS="$INTERNAL_CPPFLAGS $YAT_CPPFLAGS"
656AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS"
657AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS"
658
659AC_SUBST(AM_CPPFLAGS)
660AC_SUBST(AM_CXXFLAGS)
661AC_SUBST(AM_LDFLAGS)
662AC_SUBST([enable_shared])
663AC_SUBST([enable_static])
664
665# Name of directory libtool put stuff int - needed for some tests
666AC_SUBST([lt_cv_objdir])
667
668YAT_SVN_RELEASE([am/maintainer.am],
669  [$(YAT_MAJOR_VERSION).$(YAT_MINOR_VERSION)],
670  [libyat@frs.sourceforge.net:/home/frs/project/l/li/libyat],
671  [http://sourceforge.net/projects/libyat/files/$(distdir).tar.gz/files],
672  [http://dev.thep.lu.se/yat/browser/tags/$(VERSION)/NEWS])
673
674# make shell tests work in VPATH builds
675AC_CONFIG_LINKS([test/init.sh:test/init.sh])
676
677# set some variable for final message
678AS_CASE([$have_doxygen],
679        [yes], [doxygen_message=yes],
680        [no], [doxygen_message="no (doxygen not found)"],
681        [old], [doxygen_message="no (\`$DOXYGEN' too old)"],
682        [AC_MSG_WARN([unexpected value \$have_doxygen: '$have_doxygen'])
683         AS_BOX([Report this to ]AC_PACKAGE_BUGREPORT)
684        ])
685
686yat_gslcblas_message=
687AS_IF([test "x$YAT_CBLAS_LIB" = "x-lgslcblas"], [
688yat_gslcblas_message='
689  GSL CBLAS found. This is a reference implementation only.
690  Consider using hardware optimized BLAS.
691  ATLAS (http://math-atlas.sourceforge.net/) provides an
692  optimized BLAS library. It is supported by yat!
693'
694])
695
696# Create output.
697AC_OUTPUT
698
699
700# Some more messages.
701AC_MSG_RESULT([
702yat is configured as follows:
703
704  Build Shared Library: $enable_shared
705  Build Static Library: $enable_static
706  Build Documentation:  $doxygen_message
707  With Bam Support:     $with_htslib
708
709Options used to compile and link:
710  VERSION     = $VERSION
711  CXX         = $CXX
712  CPPFLAGS    = $CPPFLAGS
713  YAT_CPPFLAGS= $AM_CPPFLAGS
714  CXXFLAGS    = $CXXFLAGS
715  YAT_CXXFLAGS= $AM_CXXFLAGS
716  LD          = $LD
717  LDFLAGS     = $LDFLAGS
718  YAT_LDFLAGS = $AM_LDFLAGS
719  LIBS        = $LIBS
720  YAT_LIBS    = $YAT_LIBS
721${yat_gslcblas_message}dnl
722----------------------------------------------------------------
723Now type `make'. dnl
724])
Note: See TracBrowser for help on using the repository browser.