source: trunk/configure.ac @ 3593

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

replace option --without-cxx11 with --enable-cxx11 and also change the default to 'disabled'. refs #878

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