source: trunk/configure.ac @ 2354

Last change on this file since 2354 was 2354, checked in by Peter, 11 years ago

Before we generate other docs in other formats than html. Remove leftovers reflecting that.

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