source: trunk/configure.ac @ 2297

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

dvi, ps, and pdf docs are no longer supported

  • 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 2297 2010-07-12 13:22:39Z 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
34m4_include([m4/version.m4])
35AC_INIT([yat],[YAT_VERSION],[jari@thep.lu.se],,[http://dev.thep.lu.se/yat])
36AC_PREREQ(2.63)
37AC_CONFIG_SRCDIR([yat/utility/Matrix.h])
38AC_CONFIG_AUX_DIR([autotools])
39dnl arg below should be the same as in Makefile.am
40AC_CONFIG_MACRO_DIR([m4])
41AC_PREFIX_DEFAULT([/usr/local])
42
43AC_SUBST([YAT_LT_VERSION], [YAT_LT_VERSION_INFO])
44AC_SUBST([YAT_MAJOR_VERSION], [MAJOR_VERSION])
45AC_SUBST([YAT_MINOR_VERSION], [MINOR_VERSION])
46AC_SUBST([YAT_PATCH_VERSION], [PATCH_VERSION])
47AC_SUBST([YAT_DEV_BUILD], [DEV_BUILD])
48
49AC_CONFIG_HEADERS([config.h])
50AM_INIT_AUTOMAKE([1.11 std-options color-tests parallel-tests])
51
52dnl The empty help-string for --with-gsl-prefix and
53dnl --with-gsl-exec-prefix creates an empty line in middle of help
54dnl output. This hacks move the line to above 'Optional Packages:',
55dnl which is prettier.
56dnl
57dnl FIXME: remove when we removed support for --with-gsl-prefix and
58dnl --with-gsl-exec-prefix
59m4_divert_once([HELP_WITH], [])
60
61# Set default programming language
62AC_LANG(C++)
63
64# propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS
65for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do
66  eval isset=\${$var+set}
67  if test "$isset" = 'set' ; then
68    eval val=$`echo $var`
69    DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' "
70  fi
71done
72AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
73
74# Let user overide default CXXFLAGS
75if test "${CXXFLAGS+set}" != set; then
76  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
77fi
78# Checks for programs.
79AC_PROG_CXX
80AC_PROG_SED
81AC_PROG_LIBTOOL
82
83AC_MSG_NOTICE(dnl
84[checking whether tools for generating documentation are available])
85
86have_doxygen=no
87AC_PATH_PROG([DOXYGEN], [doxygen], [no])
88if test "$DOXYGEN" = "no"; then
89   AC_MSG_WARN([unable to find doxygen application])
90else
91   doxygen_min_version=1.5
92   AC_MSG_CHECKING([if doxygen is at least $doxygen_min_version])
93   doxygen_version=`$DOXYGEN --version`
94   AX_COMPARE_VERSION([$doxygen_version], [ge], [$doxygen_min_version],
95                      [have_doxygen=yes])
96   AC_MSG_RESULT([$doxygen_version])
97fi
98
99AC_SUBST(have_doxygen)
100AM_CONDITIONAL([DX_ENABLE_HTML], [test x$have_doxygen = xyes])
101AC_CONFIG_FILES([test/documentation_test.sh],
102                [chmod +x test/documentation_test.sh])
103
104# check for quiet_NaN support in OS
105# Check at run-time, but if we are cross-compiling fall back on a
106# compilation test
107AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true])
108AC_RUN_IFELSE(
109  [AC_LANG_PROGRAM(
110    [@%:@include <limits>],
111    [return !std::numeric_limits<double>::has_quiet_NaN])],
112  [quiet_nan=yes
113   AC_MSG_RESULT($quiet_nan)],
114  [quiet_nan=no
115   AC_MSG_RESULT($quiet_nan)],
116  # if we are cross-compiling fall back on compilation test
117  [AC_MSG_RESULT(cross-compiling)
118   AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()])
119    AC_COMPILE_IFELSE(
120     [AC_LANG_PROGRAM(
121        [@%:@include <limits>
122         extern void f(double);],
123        [f(std::numeric_limits<double>::quiet_NaN())])],
124     [quiet_nan=yes],
125     [quiet_nan=no])
126   AC_MSG_RESULT($quiet_nan)])
127# Check for infinity support for doubles in OS
128# Check at run-time, but if we are cross-compiling fall back on a
129# compilation test
130AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true])
131AC_RUN_IFELSE(
132  [AC_LANG_PROGRAM(
133    [@%:@include <limits>],
134    [return !std::numeric_limits<double>::has_infinity])],
135  [has_infinity=yes
136   AC_MSG_RESULT($has_infinity)],
137  [has_infinity=no
138   AC_MSG_RESULT($has_infinity)],
139  # if we are cross-compiling fall back on compilation test
140  [AC_MSG_RESULT(cross-compiling)
141   AC_MSG_CHECKING([for std::numeric_limits<>::infinity()])
142    AC_COMPILE_IFELSE(
143     [AC_LANG_PROGRAM(
144        [@%:@include <limits>
145         extern void f(double);],
146        [f(std::numeric_limits<double>::infinity())])],
147     [has_infinity=yes],
148     [has_infinity=no])
149   AC_MSG_RESULT($has_infinity)])
150
151AC_MSG_CHECKING([g++ deprecation attribute])
152AC_COMPILE_IFELSE(
153   [AC_LANG_PROGRAM([[void f() __attribute__ ((deprecated));]],)], 
154   [AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1],
155              [Define if compiler supports deprecated attribute, as in g++ 4.0])
156    AC_MSG_RESULT([yes])],
157   [AC_MSG_RESULT([no])] )
158
159AC_MSG_CHECKING([if std::multiset::iterator is mutable])
160AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <set>
161                                     @%:@include <vector>]],
162                                   [[std::set<std::vector<double> > s;
163                                     std::vector<double> v;
164                                     s.insert(v);
165                                     s.begin()->reserve(100);
166                                   ]])],
167                  [AC_DEFINE([MULTISET_ITERATOR_IS_MUTABLE], [1],
168                             [Define if std::multiset::iterator is mutable])
169                   AC_MSG_RESULT([yes])
170                  ],
171                  [AC_MSG_RESULT([no])] )
172
173# Save user-defined environment settings for later restoration
174APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
175APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
176APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
177APR_SAVE_THE_ENVIRONMENT(LIBS)
178
179# Checks for libraries.
180AC_MSG_NOTICE([checking for libraries])
181AC_CHECK_LIBM
182
183# find library implementing BLAS C API, or use gslcblas
184YAT_LIB_CBLAS([YAT_CBLAS_LIB=$CBLAS_LIB], [YAT_CBLAS_LIB=-lgslcblas])
185
186# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
187# Including AX_PATH_GSL macro from gsl.m4 distributed by GSL
188gsl_version="1.8"
189AC_SUBST(gsl_version)
190gsl_ok=yes
191YAT_CHECK_GSL([$gsl_version],[gsl_ok=yes],[gsl_ok=no])
192
193# Boost http://www.boost.org
194boost_version=1.35
195AC_SUBST(boost_version)
196AX_BOOST_BASE(["$boost_version"])
197boost_version_check=$succeeded;
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
250DX_LATEX_OUTPUT=latex
251AC_SUBST(DX_HTML_OUTPUT)
252AC_SUBST(DX_LATEX_OUTPUT)
253
254
255AC_CONFIG_FILES([test/create_yathello.sh], [chmod +x test/create_yathello.sh])
256AC_CONFIG_FILES([Makefile
257     build_support/Makefile
258     doc/Makefile
259     doc/doxygen.config
260     doc/first_page.doxygen
261     m4/Makefile
262     test/Makefile
263     test/common_defs.sh
264     test/environment.h
265     test/data/Makefile
266     yat/Makefile
267     yat/classifier/Makefile
268     yat/normalizer/Makefile
269     yat/random/Makefile
270     yat/regression/Makefile
271     yat/statistics/Makefile
272     yat/utility/version.h
273     yat/utility/Makefile])
274
275AC_CONFIG_HEADERS([yat/utility/config_public.h])
276
277# Print failure status information about selected items, and exit if
278# fatal errors were encountered. No output will be created if
279# configure is halted prematurely.
280
281# used to trigger exit before creation of output
282all_reqs_ok="true"
283
284# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
285# of created binary, will fail.
286if test "${quiet_nan}" = "no" ; then
287  all_reqs_ok="false"
288  AC_MSG_WARN([
289  Support for quiet NAN required.
290  yat will not work on this system!])
291fi
292
293# No support for infinity is fatal -- sub-sequent compilation, or execution
294# of created binary, will fail.
295if test "${has_infinity}" = "no" ; then
296  all_reqs_ok="false"
297  AC_MSG_WARN([
298  Support for infinity required.
299  yat will not work on this system!])
300fi
301
302
303# Non-existing GSL is fatal -- sub-sequent compilation will fail.
304if test "x$gsl_ok" != "xyes" ; then
305  all_reqs_ok="false"
306  AC_MSG_WARN([
307  GSL $gsl_version (or newer) not found. The GNU Scientific Library
308  (GSL) library cannot be found. Please make sure GSL is
309  installed. Please refer to warnings above for more details])
310fi
311
312if test "x$want_boost" = "xyes"; then
313# Too old Boost is fatal -- sub-sequent compilation will fail.
314if test "${boost_version_check}" != "yes" ; then
315  all_reqs_ok="false"
316  AC_MSG_WARN([
317  Boost found but not the required version. Please install
318  Boost version ${boost_version} or later])
319fi
320fi
321
322if (test "$all_reqs_ok" = "false") ; then
323  AC_MSG_FAILURE([
324  Some pre-requisites were not fulfilled, aborting configure.
325  Please consult the 'README' file for more information about what
326  is needed to compile yat and refer to above warning messages.
327  Needed files were NOT created.])
328fi
329
330# Reset flags
331APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_)
332APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, YAT_)
333APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, YAT_)
334APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_)
335
336YAT_PRIMARY_LIBS=-lgsl
337YAT_LIBS="$YAT_PRIMARY_LIBS $YAT_CBLAS_LIB $LIBM"
338AC_SUBST(YAT_PRIMARY_LIBS)
339AC_SUBST(YAT_LIBS)
340AC_SUBST(YAT_CBLAS_LIB)
341
342# set and AC_SUBST variables that are interpreted by Automake
343AM_CPPFLAGS="-I\$(top_srcdir) $INTERNAL_CPPFLAGS $YAT_CPPFLAGS"
344AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS"
345AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS"
346
347AC_SUBST(AM_CPPFLAGS)
348AC_SUBST(AM_CXXFLAGS)
349AC_SUBST(AM_LDFLAGS)
350AC_SUBST(enable_static)
351
352YAT_SVN_RELEASE([am/maintainer.am])
353
354# Create output.
355AC_OUTPUT
356
357# Some more messages.
358AC_MSG_NOTICE([])
359AC_MSG_NOTICE([ Ready to compile the yat library])
360AS_IF([test x$have_doxygen = xyes],
361  [AC_MSG_NOTICE([ Documentation will be generated in the following formats:])
362   dox_formats="   html";
363   AS_IF([test x$dx_enable_pdf = xyes], [dox_formats="$dox_formats pdf"])
364   AS_IF([test x$dx_enable_ps = xyes],  [dox_formats="$dox_formats ps"])
365   AS_IF([test x$dx_enable_dvi = xyes], [dox_formats="$dox_formats dvi"])
366   AC_MSG_NOTICE([$dox_formats])
367  ],
368  [AC_MSG_NOTICE([Generation of documentation is disabled])
369   AC_MSG_NOTICE([doxygen could not be found])
370  ])
371AC_MSG_NOTICE()
372AC_MSG_NOTICE([ The following flags and libraries will be used:])
373AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
374AC_MSG_NOTICE([  CPPFLAGS=$CPPFLAGS])
375AC_MSG_NOTICE([  AM_CPPFLAGS=$AM_CPPFLAGS])
376AC_MSG_NOTICE([  CXXFLAGS=$CXXFLAGS])
377AC_MSG_NOTICE([  AM_CXXFLAGS=$AM_CXXFLAGS])
378AC_MSG_NOTICE([  LDFLAGS=$LDFLAGS])
379AC_MSG_NOTICE([  AM_LDFLAGS=$AM_LDFLAGS])
380AC_MSG_NOTICE([  LIBS=$LIBS])
381AC_MSG_NOTICE([  YAT_LIBS=$YAT_LIBS])
382AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
383AC_MSG_NOTICE([])
384if test "x$YAT_CBLAS_LIB" = "x-lgslcblas"; then
385AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
386AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
387AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
388AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
389AC_MSG_NOTICE([])
390fi
391AC_MSG_NOTICE([ Now type 'make && make check'.])
Note: See TracBrowser for help on using the repository browser.