source: trunk/configure.ac @ 2487

Last change on this file since 2487 was 2487, checked in by Peter, 10 years ago

Change the semantics of htmldir and where htlm docs are
installed. Before html was installed in ${htmldir}/html and ${htmldir}
was by default set to 'htmldir=${docdir}'. The current behavior is
that htmldir is defult set to 'htmldir=${docdir}/html' and html docs
are installed in ${htmldir}. Thus the default behavior is not changed,
i.e., docs are before and after this change installed in
${docdir}/html. This change leaves more flexibility to the user who can now
configure where to install the html output.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.3 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 2487 2011-05-27 14:55:25Z 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#
12# This file is part of the yat library, http://dev.thep.lu.se/yat
13#
14# The yat library is free software; you can redistribute it
15# and/or modify it under the terms of the GNU General Public License as
16# published by the Free Software Foundation; either version 3 of the
17# License, or (at your option) any later version.
18#
19# The yat library is distributed in the hope that it will be useful,
20# but WITHOUT ANY WARRANTY; without even the implied warranty of
21# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
22# General Public License for more details.
23#
24# You should have received a copy of the GNU General Public License
25# along with yat. If not, see <http://www.gnu.org/licenses/>.
26#
27# If you grabbed the source from the subversion repository you should,
28# at top-level, execute:
29#     ./bootstrap
30# To push subsequent changes of this file into the build scripts you
31# must issue:
32#     autoreconf
33
34
35m4_include([m4/version.m4])
36AC_INIT([yat],[YAT_VERSION__],[libyat-users@lists.sourceforge.net],,
37        [http://dev.thep.lu.se/yat])
38AC_PREREQ(2.63)
39AC_CONFIG_SRCDIR([yat/utility/Matrix.h])
40AC_CONFIG_AUX_DIR([autotools])
41dnl arg below should be the same as in Makefile.am
42AC_CONFIG_MACRO_DIR([m4])
43AC_PREFIX_DEFAULT([/usr/local])
44
45# Set default htmldir to ${docdir}/html
46AS_IF([test $htmldir = '${docdir}'], [htmldir='${docdir}/html'])
47
48AC_SUBST([YAT_LT_VERSION], [YAT_LT_VERSION_INFO])
49AC_SUBST([YAT_MAJOR_VERSION], [MAJOR_VERSION])
50AC_SUBST([YAT_MINOR_VERSION], [MINOR_VERSION])
51AC_SUBST([YAT_PATCH_VERSION], [PATCH_VERSION])
52AC_SUBST([YAT_DEV_BUILD], [DEV_BUILD])
53AC_DEFINE([YAT_VERSION], ["YAT_VERSION__"], [version])
54AC_DEFINE([YAT_MAJOR_VERSION], [MAJOR_VERSION], [major version])
55AC_DEFINE([YAT_MINOR_VERSION], [MINOR_VERSION], [minor version])
56AC_DEFINE([YAT_PATCH_VERSION], [PATCH_VERSION], [patch version])
57AC_DEFINE([YAT_DEV_BUILD], [DEV_BUILD], [Define to false if official version])
58
59AC_CONFIG_HEADERS([config.h])
60AM_INIT_AUTOMAKE([1.11 std-options color-tests parallel-tests])
61
62# Set default programming language
63AC_LANG(C++)
64
65# propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS
66for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do
67  eval isset=\${$var+set}
68  if test "$isset" = 'set' ; then
69    eval val=$`echo $var`
70    DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' "
71  fi
72done
73AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
74
75# Let user overide default CXXFLAGS
76if test "${CXXFLAGS+set}" != set; then
77  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
78fi
79# Checks for programs.
80AC_PROG_CXX
81AC_PROG_SED
82AC_PROG_LIBTOOL
83
84AC_MSG_NOTICE(dnl
85[checking whether tools for generating documentation are available])
86
87have_doxygen=no
88AC_PATH_PROG([DOXYGEN], [doxygen], [no])
89if test "$DOXYGEN" = "no"; then
90   AC_MSG_WARN([unable to find doxygen application])
91else
92   doxygen_min_version=1.5
93   AC_MSG_CHECKING([if doxygen is at least $doxygen_min_version])
94   doxygen_version=`$DOXYGEN --version`
95   AX_COMPARE_VERSION([$doxygen_version], [ge], [$doxygen_min_version],
96                      [have_doxygen=yes])
97   AC_MSG_RESULT([$doxygen_version])
98fi
99
100AC_SUBST(have_doxygen)
101AM_CONDITIONAL([DX_ENABLE_HTML], [test x$have_doxygen = xyes])
102AC_CONFIG_FILES([test/documentation_test.sh],
103                [chmod +x test/documentation_test.sh])
104
105# check for quiet_NaN support in OS
106# Check at run-time, but if we are cross-compiling fall back on a
107# compilation test
108AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true])
109AC_RUN_IFELSE(
110  [AC_LANG_PROGRAM(
111    [@%:@include <limits>],
112    [return !std::numeric_limits<double>::has_quiet_NaN])],
113  [quiet_nan=yes
114   AC_MSG_RESULT($quiet_nan)],
115  [quiet_nan=no
116   AC_MSG_RESULT($quiet_nan)],
117  # if we are cross-compiling fall back on compilation test
118  [AC_MSG_RESULT(cross-compiling)
119   AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()])
120    AC_COMPILE_IFELSE(
121     [AC_LANG_PROGRAM(
122        [@%:@include <limits>
123         extern void f(double);],
124        [f(std::numeric_limits<double>::quiet_NaN())])],
125     [quiet_nan=yes],
126     [quiet_nan=no])
127   AC_MSG_RESULT($quiet_nan)])
128# Check for infinity support for doubles in OS
129# Check at run-time, but if we are cross-compiling fall back on a
130# compilation test
131AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true])
132AC_RUN_IFELSE(
133  [AC_LANG_PROGRAM(
134    [@%:@include <limits>],
135    [return !std::numeric_limits<double>::has_infinity])],
136  [has_infinity=yes
137   AC_MSG_RESULT($has_infinity)],
138  [has_infinity=no
139   AC_MSG_RESULT($has_infinity)],
140  # if we are cross-compiling fall back on compilation test
141  [AC_MSG_RESULT(cross-compiling)
142   AC_MSG_CHECKING([for std::numeric_limits<>::infinity()])
143    AC_COMPILE_IFELSE(
144     [AC_LANG_PROGRAM(
145        [@%:@include <limits>
146         extern void f(double);],
147        [f(std::numeric_limits<double>::infinity())])],
148     [has_infinity=yes],
149     [has_infinity=no])
150   AC_MSG_RESULT($has_infinity)])
151
152AC_MSG_CHECKING([g++ deprecation attribute])
153AC_COMPILE_IFELSE(
154   [AC_LANG_PROGRAM([[void f() __attribute__ ((deprecated));]],)], 
155   [AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1],
156              [Define if compiler supports deprecated attribute, as in g++ 4.0])
157    AC_MSG_RESULT([yes])],
158   [AC_MSG_RESULT([no])] )
159
160AC_MSG_CHECKING([if std::multiset::iterator is mutable])
161AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <set>
162                                     @%:@include <vector>]],
163                                   [[std::set<std::vector<double> > s;
164                                     std::vector<double> v;
165                                     s.insert(v);
166                                     s.begin()->reserve(100);
167                                   ]])],
168                  [AC_DEFINE([MULTISET_ITERATOR_IS_MUTABLE], [1],
169                             [Define if std::multiset::iterator is mutable])
170                   AC_MSG_RESULT([yes])
171                  ],
172                  [AC_MSG_RESULT([no])] )
173
174# Save user-defined environment settings for later restoration
175APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
176APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
177APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
178APR_SAVE_THE_ENVIRONMENT(LIBS)
179
180# Checks for libraries.
181AC_MSG_NOTICE([checking for libraries])
182AC_CHECK_LIBM
183
184# find library implementing BLAS C API, or use gslcblas
185YAT_LIB_CBLAS([YAT_CBLAS_LIB=$CBLAS_LIB], [YAT_CBLAS_LIB=-lgslcblas])
186
187# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
188# Including AX_PATH_GSL macro from gsl.m4 distributed by GSL
189gsl_version="1.8"
190AC_SUBST(gsl_version)
191gsl_ok=yes
192YAT_CHECK_GSL([$gsl_version],[gsl_ok=yes],[gsl_ok=no])
193
194# Boost http://www.boost.org
195boost_version=1.35
196AC_SUBST(boost_version)
197AX_BOOST_BASE(["$boost_version"], [boost_ok=yes], [boost_ok=no])
198YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS])
199
200#support for large files
201AC_SYS_LARGEFILE
202if test "$enable_largefile" = "no"; then
203  AC_DEFINE([YAT_LFS_DISABLED], 1,
204            [defined to 1 if large file support is disabled])
205fi
206
207# we use prefix INTERNAL_ for variables that are solely needed for
208# building yat, i.e., they are not needed for a user of yat and are
209# not propagated to yat-config or yat.m4.
210YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wall -pedantic])
211YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DHAVE_INLINE=1])
212AC_ARG_ENABLE([debug],
213  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
214if test "${enable_debug}" = "yes" ; then
215  YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DYAT_DEBUG=1])
216  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-g -O])
217else
218  # avoid defining GSL_RANGE_CHECK_OFF if GSL_RANGE_CHECK is already defined
219  AC_CHECK_DECL([GSL_RANGE_CHECK],[],
220                [YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS],[-DGSL_RANGE_CHECK_OFF])])
221  YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DNDEBUG])
222  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-O3])
223fi
224
225# some versions of boost uses long long - turn off compiler warnings
226# with -Wno-long-long
227yat_save_CXXFLAGS=$CXXFLAGS
228# turn warnings into errors
229YAT_CXX_ADD_FLAG([CXXFLAGS], [-pedantic-errors])
230AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
231  [
232    @%:@include <boost/iterator/transform_iterator.hpp>
233    @%:@include <cmath>
234    @%:@include <functional>
235    @%:@include <vector>
236  ],[
237      using namespace boost;
238      typedef std::pointer_to_unary_function<double, double> F;
239      std::vector<double> vec;
240      transform_iterator<F, std::vector<double>::iterator>
241        i(vec.begin(), std::ptr_fun(fabs));
242  ])],
243[],
244[YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wno-long-long])])
245# restore CXXFLAGS
246CXXFLAGS=$yat_save_CXXFLAGS
247
248#doxygen stuff
249DX_HTML_OUTPUT=html
250AC_SUBST(DX_HTML_OUTPUT)
251# create dummie version of doxygen.mk
252AC_CONFIG_COMMANDS([doxygen.mk],
253[for f in $CONFIG_FILES; do
254# for each directory in yat that has a Makefile, create a doxygen.mk
255case $f in #(
256  yat/*/Makefile) :
257   outfile=`echo $f | sed 's,Makefile,doxygen.mk,'`;
258   test -e $outfile || echo '# dummie' > $outfile;
259esac
260done
261])
262
263
264AC_CONFIG_FILES([build_support/gen_yat_pc.sh],
265                [chmod +x build_support/gen_yat_pc.sh])
266AC_CONFIG_FILES([Makefile
267     build_support/Makefile
268     doc/Makefile
269     doc/doxygen.config
270     doc/first_page.doxygen
271     m4/Makefile
272     test/Makefile
273     test/common_defs.sh
274     yat/Makefile
275     yat/classifier/Makefile
276     yat/normalizer/Makefile
277     yat/omic/Makefile
278     yat/random/Makefile
279     yat/regression/Makefile
280     yat/statistics/Makefile
281     yat/utility/Makefile])
282
283AC_CONFIG_HEADERS([yat/utility/config_public.h])
284# for the test suite
285yat_abs_top_srcdir=`cd $srcdir && pwd`
286AC_DEFINE_UNQUOTED([YAT_ABS_TOP_SRCDIR], ["$yat_abs_top_srcdir"],
287                   [Define to absolute path to top yat src dir])
288
289# Print failure status information about selected items, and exit if
290# fatal errors were encountered. No output will be created if
291# configure is halted prematurely.
292
293# used to trigger exit before creation of output
294all_reqs_ok="true"
295
296# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
297# of created binary, will fail.
298if test "${quiet_nan}" = "no" ; then
299  all_reqs_ok="false"
300  AC_MSG_WARN([
301  Support for quiet NAN required.
302  yat will not work on this system!])
303fi
304
305# No support for infinity is fatal -- sub-sequent compilation, or execution
306# of created binary, will fail.
307if test "${has_infinity}" = "no" ; then
308  all_reqs_ok="false"
309  AC_MSG_WARN([
310  Support for infinity required.
311  yat will not work on this system!])
312fi
313
314
315# Non-existing GSL is fatal -- sub-sequent compilation will fail.
316if test "x$gsl_ok" != "xyes" ; then
317  all_reqs_ok="false"
318  AC_MSG_WARN([
319  GSL $gsl_version (or newer) not found. The GNU Scientific Library
320  (GSL) library cannot be found. Please make sure GSL is
321  installed. Please refer to warnings above for more details])
322fi
323
324if test "x$want_boost" = "xyes"; then
325# Too old Boost is fatal -- sub-sequent compilation will fail.
326if test "${boost_ok}" != "yes" ; then
327  all_reqs_ok="false"
328  AC_MSG_WARN([
329  Boost ${boost_version} (or newer) not found. Please make sure Boost
330  is installed.])
331fi
332fi
333
334if (test "$all_reqs_ok" = "false") ; then
335  AC_MSG_FAILURE([
336  Some pre-requisites were not fulfilled, aborting configure.
337  Please consult the 'README' file for more information about what
338  is needed to compile yat and refer to above warning messages.
339  Needed files were NOT created.])
340fi
341
342# Reset flags
343APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_)
344APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, YAT_)
345APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, YAT_)
346APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_)
347
348YAT_PRIMARY_LIBS=-lgsl
349YAT_LIBS="$YAT_PRIMARY_LIBS $YAT_CBLAS_LIB $LIBM"
350AC_SUBST(YAT_PRIMARY_LIBS)
351AC_SUBST(YAT_LIBS)
352AC_SUBST(YAT_CBLAS_LIB)
353
354# set and AC_SUBST variables that are interpreted by Automake
355AM_CPPFLAGS="-I\$(top_srcdir) $INTERNAL_CPPFLAGS $YAT_CPPFLAGS"
356AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS"
357AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS"
358
359AC_SUBST(AM_CPPFLAGS)
360AC_SUBST(AM_CXXFLAGS)
361AC_SUBST(AM_LDFLAGS)
362AC_SUBST(enable_static)
363
364YAT_SVN_RELEASE([am/maintainer.am])
365
366# Create output.
367AC_OUTPUT
368
369# Some more messages.
370AC_MSG_NOTICE([])
371AC_MSG_NOTICE([ Ready to compile the yat library])
372AC_MSG_NOTICE
373AS_IF([test x$have_doxygen = xyes],
374  [AC_MSG_NOTICE([ Documentation will be generated in html.])],
375  [AC_MSG_NOTICE([Generation of documentation is disabled])
376   AC_MSG_NOTICE([doxygen could not be found])
377  ])
378AC_MSG_NOTICE()
379AC_MSG_NOTICE([ The following flags and libraries will be used:])
380AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
381AC_MSG_NOTICE([  CPPFLAGS=$CPPFLAGS])
382AC_MSG_NOTICE([  AM_CPPFLAGS=$AM_CPPFLAGS])
383AC_MSG_NOTICE([  CXXFLAGS=$CXXFLAGS])
384AC_MSG_NOTICE([  AM_CXXFLAGS=$AM_CXXFLAGS])
385AC_MSG_NOTICE([  LDFLAGS=$LDFLAGS])
386AC_MSG_NOTICE([  AM_LDFLAGS=$AM_LDFLAGS])
387AC_MSG_NOTICE([  LIBS=$LIBS])
388AC_MSG_NOTICE([  YAT_LIBS=$YAT_LIBS])
389AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
390AC_MSG_NOTICE([])
391if test "x$YAT_CBLAS_LIB" = "x-lgslcblas"; then
392AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
393AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
394AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
395AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
396AC_MSG_NOTICE([])
397fi
398AC_MSG_NOTICE([ Now type 'make && make check'.])
Note: See TracBrowser for help on using the repository browser.