source: trunk/configure.ac @ 2517

Last change on this file since 2517 was 2517, checked in by Peter, 12 years ago

use common_defs in documentation_test. Change name to doxygen_test to avoid filename conflict

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.2 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 2517 2011-07-11 13:58:16Z 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])
102
103# check for quiet_NaN support in OS
104# Check at run-time, but if we are cross-compiling fall back on a
105# compilation test
106AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true])
107AC_RUN_IFELSE(
108  [AC_LANG_PROGRAM(
109    [@%:@include <limits>],
110    [return !std::numeric_limits<double>::has_quiet_NaN])],
111  [quiet_nan=yes
112   AC_MSG_RESULT($quiet_nan)],
113  [quiet_nan=no
114   AC_MSG_RESULT($quiet_nan)],
115  # if we are cross-compiling fall back on compilation test
116  [AC_MSG_RESULT(cross-compiling)
117   AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()])
118    AC_COMPILE_IFELSE(
119     [AC_LANG_PROGRAM(
120        [@%:@include <limits>
121         extern void f(double);],
122        [f(std::numeric_limits<double>::quiet_NaN())])],
123     [quiet_nan=yes],
124     [quiet_nan=no])
125   AC_MSG_RESULT($quiet_nan)])
126# Check for infinity support for doubles in OS
127# Check at run-time, but if we are cross-compiling fall back on a
128# compilation test
129AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true])
130AC_RUN_IFELSE(
131  [AC_LANG_PROGRAM(
132    [@%:@include <limits>],
133    [return !std::numeric_limits<double>::has_infinity])],
134  [has_infinity=yes
135   AC_MSG_RESULT($has_infinity)],
136  [has_infinity=no
137   AC_MSG_RESULT($has_infinity)],
138  # if we are cross-compiling fall back on compilation test
139  [AC_MSG_RESULT(cross-compiling)
140   AC_MSG_CHECKING([for std::numeric_limits<>::infinity()])
141    AC_COMPILE_IFELSE(
142     [AC_LANG_PROGRAM(
143        [@%:@include <limits>
144         extern void f(double);],
145        [f(std::numeric_limits<double>::infinity())])],
146     [has_infinity=yes],
147     [has_infinity=no])
148   AC_MSG_RESULT($has_infinity)])
149
150AC_MSG_CHECKING([g++ deprecation attribute])
151AC_COMPILE_IFELSE(
152   [AC_LANG_PROGRAM([[void f() __attribute__ ((deprecated));]],)], 
153   [AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1],
154              [Define if compiler supports deprecated attribute, as in g++ 4.0])
155    AC_MSG_RESULT([yes])],
156   [AC_MSG_RESULT([no])] )
157
158AC_MSG_CHECKING([if std::multiset::iterator is mutable])
159AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <set>
160                                     @%:@include <vector>]],
161                                   [[std::set<std::vector<double> > s;
162                                     std::vector<double> v;
163                                     s.insert(v);
164                                     s.begin()->reserve(100);
165                                   ]])],
166                  [AC_DEFINE([MULTISET_ITERATOR_IS_MUTABLE], [1],
167                             [Define if std::multiset::iterator is mutable])
168                   AC_MSG_RESULT([yes])
169                  ],
170                  [AC_MSG_RESULT([no])] )
171
172# Save user-defined environment settings for later restoration
173APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
174APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
175APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
176APR_SAVE_THE_ENVIRONMENT(LIBS)
177
178# Checks for libraries.
179AC_MSG_NOTICE([checking for libraries])
180AC_CHECK_LIBM
181
182# find library implementing BLAS C API, or use gslcblas
183YAT_LIB_CBLAS([YAT_CBLAS_LIB=$CBLAS_LIB], [YAT_CBLAS_LIB=-lgslcblas])
184
185# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
186# Including AX_PATH_GSL macro from gsl.m4 distributed by GSL
187gsl_version="1.8"
188AC_SUBST(gsl_version)
189gsl_ok=yes
190YAT_CHECK_GSL([$gsl_version],[gsl_ok=yes],[gsl_ok=no])
191
192# Boost http://www.boost.org
193boost_version=1.35
194AC_SUBST(boost_version)
195AX_BOOST_BASE(["$boost_version"], [boost_ok=yes], [boost_ok=no])
196YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS])
197
198#support for large files
199AC_SYS_LARGEFILE
200if test "$enable_largefile" = "no"; then
201  AC_DEFINE([YAT_LFS_DISABLED], 1,
202            [defined to 1 if large file support is disabled])
203fi
204
205# we use prefix INTERNAL_ for variables that are solely needed for
206# building yat, i.e., they are not needed for a user of yat and are
207# not propagated to yat-config or yat.m4.
208YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wall -pedantic])
209YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DHAVE_INLINE=1])
210AC_ARG_ENABLE([debug],
211  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
212if test "${enable_debug}" = "yes" ; then
213  YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DYAT_DEBUG=1])
214  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-g -O])
215else
216  # avoid defining GSL_RANGE_CHECK_OFF if GSL_RANGE_CHECK is already defined
217  AC_CHECK_DECL([GSL_RANGE_CHECK],[],
218                [YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS],[-DGSL_RANGE_CHECK_OFF])])
219  YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DNDEBUG])
220  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-O3])
221fi
222
223# some versions of boost uses long long - turn off compiler warnings
224# with -Wno-long-long
225yat_save_CXXFLAGS=$CXXFLAGS
226# turn warnings into errors
227YAT_CXX_ADD_FLAG([CXXFLAGS], [-pedantic-errors])
228AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
229  [
230    @%:@include <boost/iterator/transform_iterator.hpp>
231    @%:@include <cmath>
232    @%:@include <functional>
233    @%:@include <vector>
234  ],[
235      using namespace boost;
236      typedef std::pointer_to_unary_function<double, double> F;
237      std::vector<double> vec;
238      transform_iterator<F, std::vector<double>::iterator>
239        i(vec.begin(), std::ptr_fun(fabs));
240  ])],
241[],
242[YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wno-long-long])])
243# restore CXXFLAGS
244CXXFLAGS=$yat_save_CXXFLAGS
245
246#doxygen stuff
247DX_HTML_OUTPUT=html
248AC_SUBST(DX_HTML_OUTPUT)
249# create dummie version of doxygen.mk
250AC_CONFIG_COMMANDS([doxygen.mk],
251[for f in $CONFIG_FILES; do
252# for each directory in yat that has a Makefile, create a doxygen.mk
253case $f in #(
254  yat/*/Makefile) :
255   outfile=`echo $f | sed 's,Makefile,doxygen.mk,'`;
256   test -e $outfile || echo '# dummie' > $outfile;
257esac
258done
259])
260
261
262AC_CONFIG_FILES([build_support/gen_yat_pc.sh],
263                [chmod +x build_support/gen_yat_pc.sh])
264AC_CONFIG_FILES([Makefile
265     build_support/Makefile
266     doc/Makefile
267     doc/doxygen.config
268     doc/first_page.doxygen
269     m4/Makefile
270     test/Makefile
271     test/common_defs.sh
272     yat/Makefile
273     yat/classifier/Makefile
274     yat/normalizer/Makefile
275     yat/omic/Makefile
276     yat/random/Makefile
277     yat/regression/Makefile
278     yat/statistics/Makefile
279     yat/utility/Makefile])
280
281AC_CONFIG_HEADERS([yat/utility/config_public.h])
282# for the test suite
283yat_abs_top_srcdir=`cd $srcdir && pwd`
284AC_DEFINE_UNQUOTED([YAT_ABS_TOP_SRCDIR], ["$yat_abs_top_srcdir"],
285                   [Define to absolute path to top yat src dir])
286
287# Print failure status information about selected items, and exit if
288# fatal errors were encountered. No output will be created if
289# configure is halted prematurely.
290
291# used to trigger exit before creation of output
292all_reqs_ok="true"
293
294# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
295# of created binary, will fail.
296if test "${quiet_nan}" = "no" ; then
297  all_reqs_ok="false"
298  AC_MSG_WARN([
299  Support for quiet NAN required.
300  yat will not work on this system!])
301fi
302
303# No support for infinity is fatal -- sub-sequent compilation, or execution
304# of created binary, will fail.
305if test "${has_infinity}" = "no" ; then
306  all_reqs_ok="false"
307  AC_MSG_WARN([
308  Support for infinity required.
309  yat will not work on this system!])
310fi
311
312
313# Non-existing GSL is fatal -- sub-sequent compilation will fail.
314if test "x$gsl_ok" != "xyes" ; then
315  all_reqs_ok="false"
316  AC_MSG_WARN([
317  GSL $gsl_version (or newer) not found. The GNU Scientific Library
318  (GSL) library cannot be found. Please make sure GSL is
319  installed. Please refer to warnings above for more details])
320fi
321
322if test "x$want_boost" = "xyes"; then
323# Too old Boost is fatal -- sub-sequent compilation will fail.
324if test "${boost_ok}" != "yes" ; then
325  all_reqs_ok="false"
326  AC_MSG_WARN([
327  Boost ${boost_version} (or newer) not found. Please make sure Boost
328  is installed.])
329fi
330fi
331
332if (test "$all_reqs_ok" = "false") ; then
333  AC_MSG_FAILURE([
334  Some pre-requisites were not fulfilled, aborting configure.
335  Please consult the 'README' file for more information about what
336  is needed to compile yat and refer to above warning messages.
337  Needed files were NOT created.])
338fi
339
340# Reset flags
341APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_)
342APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, YAT_)
343APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, YAT_)
344APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_)
345
346YAT_PRIMARY_LIBS=-lgsl
347YAT_LIBS="$YAT_PRIMARY_LIBS $YAT_CBLAS_LIB $LIBM"
348AC_SUBST(YAT_PRIMARY_LIBS)
349AC_SUBST(YAT_LIBS)
350AC_SUBST(YAT_CBLAS_LIB)
351
352# set and AC_SUBST variables that are interpreted by Automake
353AM_CPPFLAGS="-I\$(top_srcdir) $INTERNAL_CPPFLAGS $YAT_CPPFLAGS"
354AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS"
355AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS"
356
357AC_SUBST(AM_CPPFLAGS)
358AC_SUBST(AM_CXXFLAGS)
359AC_SUBST(AM_LDFLAGS)
360AC_SUBST(enable_static)
361
362YAT_SVN_RELEASE([am/maintainer.am])
363
364# Create output.
365AC_OUTPUT
366
367# Some more messages.
368AC_MSG_NOTICE([])
369AC_MSG_NOTICE([ Ready to compile the yat library])
370AC_MSG_NOTICE
371AS_IF([test x$have_doxygen = xyes],
372  [AC_MSG_NOTICE([ Documentation will be generated in html.])],
373  [AC_MSG_NOTICE([Generation of documentation is disabled])
374   AC_MSG_NOTICE([doxygen could not be found])
375  ])
376AC_MSG_NOTICE()
377AC_MSG_NOTICE([ The following flags and libraries will be used:])
378AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
379AC_MSG_NOTICE([  CPPFLAGS=$CPPFLAGS])
380AC_MSG_NOTICE([  AM_CPPFLAGS=$AM_CPPFLAGS])
381AC_MSG_NOTICE([  CXXFLAGS=$CXXFLAGS])
382AC_MSG_NOTICE([  AM_CXXFLAGS=$AM_CXXFLAGS])
383AC_MSG_NOTICE([  LDFLAGS=$LDFLAGS])
384AC_MSG_NOTICE([  AM_LDFLAGS=$AM_LDFLAGS])
385AC_MSG_NOTICE([  LIBS=$LIBS])
386AC_MSG_NOTICE([  YAT_LIBS=$YAT_LIBS])
387AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
388AC_MSG_NOTICE([])
389if test "x$YAT_CBLAS_LIB" = "x-lgslcblas"; then
390AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
391AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
392AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
393AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
394AC_MSG_NOTICE([])
395fi
396AC_MSG_NOTICE([ Now type 'make && make check'.])
Note: See TracBrowser for help on using the repository browser.