source: trunk/configure.ac @ 3792

Last change on this file since 3792 was 3792, checked in by Peter, 7 months ago

update copyright years

  • 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 3792 2019-04-12 07:15:09Z 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
273gsl_version="1.8"
274AC_SUBST(gsl_version)
275YAT_CHECK_GSL([$gsl_version],[LIBS="-lgsl $LIBS"],[AC_MSG_FAILURE([dnl
276GSL $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
287min_boost_version=1.35
288AC_SUBST(min_boost_version)
289AX_BOOST_BASE(["$min_boost_version"], [], [AC_MSG_FAILURE([dnl
290Boost ${min_boost_version} (or newer) not found. Please install boost, or provide
291CPPFLAGS=-I/path/to/boost])
292])
293# skip boost link tests if boost is not wanted (--without-boost)
294AS_IF([test x"$want_boost" = x"yes"],[
295  AX_BOOST_SYSTEM
296  LIBS="$BOOST_SYSTEM_LIB $LIBS"
297  AX_BOOST_THREAD
298  YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS])
299  YAT_LD_ADD_FLAG([LDFLAGS], [$BOOST_LDFLAGS])
300  LIBS="$BOOST_THREAD_LIB $LIBS"
301  # linking tests in AX_BOOST_SYSTEM occasionaly miss to detect
302  # missing lib (see ticket #719), so link specifically here to catch
303  # that case.
304  AC_MSG_CHECKING([for boost::thread_specific_ptr])
305  AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include <boost/thread/tss.hpp>],
306                                  [boost::thread_specific_ptr<int> x;
307                                   x.reset(new int(1));])],
308                 [AC_MSG_RESULT([yes])],
309                 [AC_MSG_RESULT([no])
310                  AC_MSG_FAILURE([Boost thread library not found.])
311                 ])
312  # Check if $BOOST_THREAD_LIB is appropriate for libyat.la
313  YAT_CHECK_LA_LIBS([
314    @%:@include <boost/thread.hpp>
315    int my_func(void)
316    { boost::mutex mutex_; return 0; }
317  ], [$BOOST_THREAD_LIB $user_LIBS], [$BOOST_THREAD_LIB], [YAT_STATIC_LIBS])
318  # Check if $BOOST_SYSTEM_LIB is appropriate for libyat.la
319  YAT_CHECK_LA_LIBS([
320    @%:@include <boost/system/error_code.hpp>
321    int my_func(void)
322    { boost::system::system_category; return 0; }
323  ], [$BOOST_SYSTEM_LIB $user_LIBS], [$BOOST_SYSTEM_LIB], [YAT_STATIC_LIBS])
324
325  AX_BOOST_IOSTREAMS
326  LIBS="$BOOST_IOSTREAMS_LIB $LIBS"
327  # Check if $BOOST_IOSTREAMS_LIB is appropriate for libyat.la
328  YAT_CHECK_LA_LIBS([
329    @%:@include <boost/iostreams/filtering_stream.hpp>
330    int my_func(void)
331    { boost::iostreams::filtering_istream fis; return 0; }
332  ], [$BOOST_IOSTREAMS_LIB $user_LIBS],
333     [$BOOST_IOSTREAMS_LIB],
334     [YAT_STATIC_LIBS])
335
336])
337
338# see tickets #648 #687
339AC_MSG_CHECKING([whether constructor in boost concept is supported])
340AC_COMPILE_IFELSE([
341  AC_LANG_PROGRAM(
342    [
343     @%:@include <boost/concept_check.hpp>
344     template <typename T>
345     class MyConcept
346     {
347     public:
348       MyConcept(void) {}
349       BOOST_CONCEPT_USAGE(MyConcept){}
350     };
351    ],[
352     MyConcept<double> x;
353     x = x;
354    ])
355  ],
356  [AC_MSG_RESULT([yes])
357   AC_DEFINE([YAT_HAVE_BOOST_CONCEPT_WITH_CONSTRUCTOR],[1],
358             [define if compiler supports boost concept with constructor])
359  ],
360  [AC_MSG_RESULT([no])]
361)
362
363# Workaround problem that boost 1.41 does not work with certain versions of GCC
364# see ticket #762
365AC_MSG_CHECKING([if boost::mutex workaround is needed])
366AC_COMPILE_IFELSE(
367  [AC_LANG_PROGRAM([@%:@include <boost/thread.hpp>],
368                   [boost::mutex mutex;]
369   )],
370  [AC_MSG_RESULT([no])
371   AC_DEFINE([YAT_HAVE_WORKING_BOOST_EXCEPTION_PTR], [1],
372             [Define to 1 if boost::exception_ptr works])
373  ],
374  [AC_MSG_RESULT([yes])])
375
376# Check if boost::iterator_facade::operator-> works with a proxy class
377# as reference_type; otherwise workaround is needed in
378# e.g. BamPairIterator. See ticket #790.
379AC_MSG_CHECKING([if boost::iterator_facade::operator-> works])
380AC_COMPILE_IFELSE(
381  [AC_LANG_PROGRAM(
382    [@%:@include <iterator>
383     @%:@include <boost/iterator/iterator_facade.hpp>
384     struct MyClass { void foo(void) const { } };
385     struct MyProxy { void foo(void) const { } };
386     // a nonsense class (only for compiler test purposes)
387     class MyIterator
388       : public boost::iterator_facade<
389        MyIterator, const MyClass, std::input_iterator_tag, MyProxy
390       >
391     {
392       friend class boost::iterator_core_access;
393       const MyProxy dereference(void) const { return MyProxy(); }
394       bool equal(const MyIterator& other) const { return true; }
395       void increment(void) {}
396     };
397    ],
398    [MyIterator iter; iter->foo();]
399    )
400  ],[
401    AC_MSG_RESULT([yes])
402    AC_DEFINE([YAT_HAVE_BOOST_ITERATOR_FACADE_PROXY_PTR], [1],
403              [Define to 1 if boost::iterator_facade::operator-> works])
404  ],[
405    AC_MSG_RESULT([no])
406  ])
407
408
409# check for hts and samtools available from http://www.htslib.org
410YAT_CHECK_HTSLIB
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])
553canonical_abs_top_srcdir=`cd $srcdir && pwd -P`
554AC_SUBST([canonical_abs_top_srcdir])
555canonical_abs_top_builddir=`pwd -P`
556AC_SUBST([canonical_abs_top_builddir])
557
558# for the test suite
559yat_abs_top_srcdir=`cd $srcdir && pwd`
560AC_DEFINE_UNQUOTED([YAT_ABS_TOP_SRCDIR], ["$yat_abs_top_srcdir"],
561                   [Define to absolute path to top yat src dir])
562
563# Reset flags
564APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_)
565APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, YAT_)
566APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, YAT_)
567APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_)
568
569# Set some variables useful when linking
570AC_SUBST([YAT_STATIC_LIBS])
571
572# libs used in libyat.la
573yat_libyat_la_LIBADD="$YAT_LIBS"
574# We avoid linking in cblas in libyat.la, to let users choose
575# favourite cblas library at link time.
576YAT_VAR_REMOVE([yat_libyat_la_LIBADD], [$YAT_CBLAS_LIB])
577# we avoid linking in YAT_STATIC_LIBS as they have been detected to
578# not be suitable libtool archive.
579YAT_VAR_REMOVE([yat_libyat_la_LIBADD], [$YAT_STATIC_LIBS])
580AC_SUBST([yat_libyat_la_LIBADD])
581
582# Primary LIBS are same as linked into libyat.la excluding LIBM
583YAT_PRIMARY_LIBS=$yat_libyat_la_LIBADD
584YAT_VAR_REMOVE([YAT_PRIMARY_LIBS], [$LIBM])
585AC_SUBST(YAT_PRIMARY_LIBS)
586
587# Assign LIBS variables for yat.pc
588YAT_PC_LIBS_PRIVATE=$YAT_LIBS
589
590# Dependency to GSL is noted via 'Requires' field
591YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [-lgsl $YAT_CBLAS_LIB $LIBM])
592YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [-lgsl], [
593  YAT_PC_REQUIRES_PRIVATE="gsl > $gsl_version"
594], [
595  YAT_PC_REQUIRES="gsl > $gsl_version"
596])
597
598# ignore this whole bam thing if --without-htslib
599AS_IF([test x$with_htslib != x"no"], [
600  # htslib comes with a pc file, so we can require htslib in yat.pc
601  AS_IF([test x$have_hts = x"yes"], [
602    YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [$BAM_LIBS -lz])
603    YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [-lhts], [
604      YAT_PC_REQUIRES_PRIVATE="$YAT_PC_REQUIRES_PRIVATE htslib"
605    ], [
606      YAT_PC_REQUIRES="$YAT_PC_REQUIRES htslib"
607    ])
608  ],[
609    # libbam has no pc file, so has to remain in LIBS and instead we
610    # require zlib
611    YAT_VAR_REMOVE([YAT_PC_LIBS_PRIVATE], [-lz])
612    YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [-lz], [
613      YAT_PC_REQUIRES_PRIVATE="$YAT_PC_REQUIRES_PRIVATE zlib"
614    ], [
615      YAT_PC_REQUIRES="$YAT_PC_REQUIRES zlib"
616    ])
617  ])
618])
619
620# Having libs declared as LIBS.private in yat.pc assumes that libs
621# have been linked into libyat. Therefore for each lib check if it is
622# mentioned in $yat_libyat_la_LIBADD, and if it's not move
623# lib to LIBS variable.
624for lib in $YAT_PC_LIBS_PRIVATE; do
625  YAT_SET_CONTAINS([$yat_libyat_la_LIBADD], [$lib], [
626  ], [
627    # move lib from $YAT_PC_LIBS_PRIVATE to $YAT_PC_LIBS
628    YAT_VAR_REMOVE([$YAT_PC_LIBS_PRIVATE], [$lib])
629    YAT_PC_LIBS="$YAT_PC_LIBS $lib"
630  ])
631done
632
633AC_SUBST([YAT_PC_LIBS])
634AC_SUBST([YAT_PC_REQUIRES])
635AC_SUBST([YAT_PC_LIBS_PRIVATE])
636AC_SUBST([YAT_PC_REQUIRES_PRIVATE])
637
638# propagate some variables to 'yat-config'
639AC_ARG_VAR([YAT_CONFIG_CPPFLAGS],
640           [Similar to CPPFLAGS but value is only propagated to yat-config])
641AC_ARG_VAR([YAT_CONFIG_CXXFLAGS],
642           [Similar to CXXFLAGS but value is only propagated to yat-config])
643AC_ARG_VAR([YAT_CONFIG_LDFLAGS],
644           [Similar to LDFLAGS but value is only propagated to yat-config])
645AC_SUBST([YAT_CONFIG_CPPFLAGS])
646AC_SUBST([YAT_CONFIG_CXXFLAGS])
647AC_SUBST([YAT_CONFIG_LDFLAGS])
648
649AC_SUBST([GXX])
650AC_SUBST(YAT_LIBS)
651AC_SUBST(YAT_CBLAS_LIB)
652
653# set and AC_SUBST variables that are interpreted by Automake
654AM_CPPFLAGS="$INTERNAL_CPPFLAGS $YAT_CPPFLAGS"
655AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS"
656AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS"
657
658AC_SUBST(AM_CPPFLAGS)
659AC_SUBST(AM_CXXFLAGS)
660AC_SUBST(AM_LDFLAGS)
661AC_SUBST([enable_shared])
662AC_SUBST([enable_static])
663
664# Name of directory libtool put stuff int - needed for some tests
665AC_SUBST([lt_cv_objdir])
666
667YAT_SVN_RELEASE([am/maintainer.am],
668  [$(YAT_MAJOR_VERSION).$(YAT_MINOR_VERSION)],
669  [libyat@frs.sourceforge.net:/home/frs/project/l/li/libyat],
670  [http://sourceforge.net/projects/libyat/files/$(distdir).tar.gz/files],
671  [http://dev.thep.lu.se/yat/browser/tags/$(VERSION)/NEWS])
672
673# make shell tests work in VPATH builds
674AC_CONFIG_LINKS([test/init.sh:test/init.sh])
675
676# set some variable for final message
677AS_CASE([$have_doxygen],
678        [yes], [doxygen_message=yes],
679        [no], [doxygen_message="no (doxygen not found)"],
680        [old], [doxygen_message="no (\`$DOXYGEN' too old)"],
681        [AC_MSG_WARN([unexpected value \$have_doxygen: '$have_doxygen'])
682         AS_BOX([Report this to ]AC_PACKAGE_BUGREPORT)
683        ])
684
685yat_gslcblas_message=
686AS_IF([test "x$YAT_CBLAS_LIB" = "x-lgslcblas"], [
687yat_gslcblas_message='
688  GSL CBLAS found. This is a reference implementation only.
689  Consider using hardware optimized BLAS.
690  ATLAS (http://math-atlas.sourceforge.net/) provides an
691  optimized BLAS library. It is supported by yat!
692'
693])
694
695yat_libbam_message=
696AS_IF([test x$with_htslib = x"yes" && test x"$have_hts" != x"yes"], [
697yat_libbam_message='
698  LIBBAM found. Support for LIBBAM is deprecated and will be
699  removed in future versions. It is recommended to install HTSLIB
700  available from http://www.htslib.org
701'
702])
703
704# Create output.
705AC_OUTPUT
706
707
708# Some more messages.
709AC_MSG_RESULT([
710yat is configured as follows:
711
712  Build Shared Library: $enable_shared
713  Build Static Library: $enable_static
714  Build Documentation:  $doxygen_message
715  With Bam Support:     $with_htslib
716  With Rvalue Support:  $yat_have_rvalue
717  With Atomic Support:  $yat_have_atomic
718
719Options used to compile and link:
720  VERSION     = $VERSION
721  CXX         = $CXX
722  CPPFLAGS    = $CPPFLAGS
723  YAT_CPPFLAGS= $AM_CPPFLAGS
724  CXXFLAGS    = $CXXFLAGS
725  YAT_CXXFLAGS= $AM_CXXFLAGS
726  LD          = $LD
727  LDFLAGS     = $LDFLAGS
728  YAT_LDFLAGS = $AM_LDFLAGS
729  LIBS        = $LIBS
730  YAT_LIBS    = $YAT_LIBS
731${yat_gslcblas_message}dnl
732${yat_libbam_message}dnl
733----------------------------------------------------------------
734Now type `make'. dnl
735])
Note: See TracBrowser for help on using the repository browser.