source: trunk/configure.ac @ 2300

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

update BUG_REPORT

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.1 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 2300 2010-07-20 15:59:18Z 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"])
199boost_version_check=$succeeded;
200YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS])
201
202#support for large files
203AC_SYS_LARGEFILE
204if test "$enable_largefile" = "no"; then
205  AC_DEFINE([YAT_LFS_DISABLED], 1,
206            [defined to 1 if large file support is disabled])
207fi
208
209# we use prefix INTERNAL_ for variables that are solely needed for
210# building yat, i.e., they are not needed for a user of yat and are
211# not propagated to yat-config or yat.m4.
212YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wall -pedantic])
213YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DHAVE_INLINE=1])
214AC_ARG_ENABLE([debug],
215  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
216if test "${enable_debug}" = "yes" ; then
217  YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DYAT_DEBUG=1])
218  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-g -O])
219else
220  # avoid defining GSL_RANGE_CHECK_OFF if GSL_RANGE_CHECK is already defined
221  AC_CHECK_DECL([GSL_RANGE_CHECK],[],
222                [YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS],[-DGSL_RANGE_CHECK_OFF])])
223  YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DNDEBUG])
224  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-O3])
225fi
226
227# some versions of boost uses long long - turn off compiler warnings
228# with -Wno-long-long
229yat_save_CXXFLAGS=$CXXFLAGS
230# turn warnings into errors
231YAT_CXX_ADD_FLAG([CXXFLAGS], [-pedantic-errors])
232AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
233  [
234    @%:@include <boost/iterator/transform_iterator.hpp>
235    @%:@include <cmath>
236    @%:@include <functional>
237    @%:@include <vector>
238  ],[
239      using namespace boost;
240      typedef std::pointer_to_unary_function<double, double> F;
241      std::vector<double> vec;
242      transform_iterator<F, std::vector<double>::iterator>
243        i(vec.begin(), std::ptr_fun(fabs));
244  ])],
245[],
246[YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wno-long-long])])
247# restore CXXFLAGS
248CXXFLAGS=$yat_save_CXXFLAGS
249
250#doxygen stuff
251DX_HTML_OUTPUT=html
252DX_LATEX_OUTPUT=latex
253AC_SUBST(DX_HTML_OUTPUT)
254AC_SUBST(DX_LATEX_OUTPUT)
255
256
257AC_CONFIG_FILES([test/create_yathello.sh], [chmod +x test/create_yathello.sh])
258AC_CONFIG_FILES([Makefile
259     build_support/Makefile
260     doc/Makefile
261     doc/doxygen.config
262     doc/first_page.doxygen
263     m4/Makefile
264     test/Makefile
265     test/common_defs.sh
266     test/environment.h
267     test/data/Makefile
268     yat/Makefile
269     yat/classifier/Makefile
270     yat/normalizer/Makefile
271     yat/random/Makefile
272     yat/regression/Makefile
273     yat/statistics/Makefile
274     yat/utility/version.h
275     yat/utility/Makefile])
276
277AC_CONFIG_HEADERS([yat/utility/config_public.h])
278
279# Print failure status information about selected items, and exit if
280# fatal errors were encountered. No output will be created if
281# configure is halted prematurely.
282
283# used to trigger exit before creation of output
284all_reqs_ok="true"
285
286# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
287# of created binary, will fail.
288if test "${quiet_nan}" = "no" ; then
289  all_reqs_ok="false"
290  AC_MSG_WARN([
291  Support for quiet NAN required.
292  yat will not work on this system!])
293fi
294
295# No support for infinity is fatal -- sub-sequent compilation, or execution
296# of created binary, will fail.
297if test "${has_infinity}" = "no" ; then
298  all_reqs_ok="false"
299  AC_MSG_WARN([
300  Support for infinity required.
301  yat will not work on this system!])
302fi
303
304
305# Non-existing GSL is fatal -- sub-sequent compilation will fail.
306if test "x$gsl_ok" != "xyes" ; then
307  all_reqs_ok="false"
308  AC_MSG_WARN([
309  GSL $gsl_version (or newer) not found. The GNU Scientific Library
310  (GSL) library cannot be found. Please make sure GSL is
311  installed. Please refer to warnings above for more details])
312fi
313
314if test "x$want_boost" = "xyes"; then
315# Too old Boost is fatal -- sub-sequent compilation will fail.
316if test "${boost_version_check}" != "yes" ; then
317  all_reqs_ok="false"
318  AC_MSG_WARN([
319  Boost found but not the required version. Please install
320  Boost version ${boost_version} or later])
321fi
322fi
323
324if (test "$all_reqs_ok" = "false") ; then
325  AC_MSG_FAILURE([
326  Some pre-requisites were not fulfilled, aborting configure.
327  Please consult the 'README' file for more information about what
328  is needed to compile yat and refer to above warning messages.
329  Needed files were NOT created.])
330fi
331
332# Reset flags
333APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_)
334APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, YAT_)
335APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, YAT_)
336APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_)
337
338YAT_PRIMARY_LIBS=-lgsl
339YAT_LIBS="$YAT_PRIMARY_LIBS $YAT_CBLAS_LIB $LIBM"
340AC_SUBST(YAT_PRIMARY_LIBS)
341AC_SUBST(YAT_LIBS)
342AC_SUBST(YAT_CBLAS_LIB)
343
344# set and AC_SUBST variables that are interpreted by Automake
345AM_CPPFLAGS="-I\$(top_srcdir) $INTERNAL_CPPFLAGS $YAT_CPPFLAGS"
346AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS"
347AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS"
348
349AC_SUBST(AM_CPPFLAGS)
350AC_SUBST(AM_CXXFLAGS)
351AC_SUBST(AM_LDFLAGS)
352AC_SUBST(enable_static)
353
354YAT_SVN_RELEASE([am/maintainer.am])
355
356# Create output.
357AC_OUTPUT
358
359# Some more messages.
360AC_MSG_NOTICE([])
361AC_MSG_NOTICE([ Ready to compile the yat library])
362AS_IF([test x$have_doxygen = xyes],
363  [AC_MSG_NOTICE([ Documentation will be generated in the following formats:])
364   dox_formats="   html";
365   AS_IF([test x$dx_enable_pdf = xyes], [dox_formats="$dox_formats pdf"])
366   AS_IF([test x$dx_enable_ps = xyes],  [dox_formats="$dox_formats ps"])
367   AS_IF([test x$dx_enable_dvi = xyes], [dox_formats="$dox_formats dvi"])
368   AC_MSG_NOTICE([$dox_formats])
369  ],
370  [AC_MSG_NOTICE([Generation of documentation is disabled])
371   AC_MSG_NOTICE([doxygen could not be found])
372  ])
373AC_MSG_NOTICE()
374AC_MSG_NOTICE([ The following flags and libraries will be used:])
375AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
376AC_MSG_NOTICE([  CPPFLAGS=$CPPFLAGS])
377AC_MSG_NOTICE([  AM_CPPFLAGS=$AM_CPPFLAGS])
378AC_MSG_NOTICE([  CXXFLAGS=$CXXFLAGS])
379AC_MSG_NOTICE([  AM_CXXFLAGS=$AM_CXXFLAGS])
380AC_MSG_NOTICE([  LDFLAGS=$LDFLAGS])
381AC_MSG_NOTICE([  AM_LDFLAGS=$AM_LDFLAGS])
382AC_MSG_NOTICE([  LIBS=$LIBS])
383AC_MSG_NOTICE([  YAT_LIBS=$YAT_LIBS])
384AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
385AC_MSG_NOTICE([])
386if test "x$YAT_CBLAS_LIB" = "x-lgslcblas"; then
387AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
388AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
389AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
390AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
391AC_MSG_NOTICE([])
392fi
393AC_MSG_NOTICE([ Now type 'make && make check'.])
Note: See TracBrowser for help on using the repository browser.