source: trunk/configure.ac @ 3581

Last change on this file since 3581 was 3581, checked in by Peter, 6 years ago

refs #878

Make configure try to turn on compiler switches (such as -std=c++11),
so it supports rvalues. If found, #define YAT_HAVE_RVALUE, which can
be used both in source files and in header files. For header files,
<yat/utility/config_public.h> must be #included.

As detailed in README users can turn off cxx11 support when at
configure time of yat, or at compile time of user's package with
preprocessor definition YAT_WITHOUT_CXX.

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