source: trunk/configure.ac @ 3366

Last change on this file since 3366 was 3366, checked in by Peter, 8 years ago

prefer private variables in yat.pc. closes #808

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