source: trunk/configure.ac @ 2266

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

use 'echo' rather than the variable ECHO decided by libtool. The command decided by libtool 2.2.8 does not work from Makefiles on Mac OSX

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