source: trunk/configure.ac @ 2309

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

create dummie doxygen.mk only if it doesnt exist

  • 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 2309 2010-08-12 16:15:31Z 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# create dummie version of doxygen.mk
256AC_CONFIG_COMMANDS([doxygen.mk],
257[for f in $CONFIG_FILES; do
258# for each directory in yat that has a Makefile, create a doxygen.mk
259case $f in #(
260  yat/*/Makefile) :
261   outfile=`echo $f | sed 's,Makefile,doxygen.mk,'`;
262   test -e $outfile || echo '# dummie' > $outfile;
263esac
264done
265])
266
267
268AC_CONFIG_FILES([test/create_yathello.sh], [chmod +x test/create_yathello.sh])
269AC_CONFIG_FILES([Makefile
270     build_support/Makefile
271     doc/Makefile
272     doc/doxygen.config
273     doc/first_page.doxygen
274     m4/Makefile
275     test/Makefile
276     test/common_defs.sh
277     test/environment.h
278     test/data/Makefile
279     yat/Makefile
280     yat/classifier/Makefile
281     yat/normalizer/Makefile
282     yat/random/Makefile
283     yat/regression/Makefile
284     yat/statistics/Makefile
285     yat/utility/version.h
286     yat/utility/Makefile])
287
288AC_CONFIG_HEADERS([yat/utility/config_public.h])
289
290# Print failure status information about selected items, and exit if
291# fatal errors were encountered. No output will be created if
292# configure is halted prematurely.
293
294# used to trigger exit before creation of output
295all_reqs_ok="true"
296
297# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
298# of created binary, will fail.
299if test "${quiet_nan}" = "no" ; then
300  all_reqs_ok="false"
301  AC_MSG_WARN([
302  Support for quiet NAN required.
303  yat will not work on this system!])
304fi
305
306# No support for infinity is fatal -- sub-sequent compilation, or execution
307# of created binary, will fail.
308if test "${has_infinity}" = "no" ; then
309  all_reqs_ok="false"
310  AC_MSG_WARN([
311  Support for infinity required.
312  yat will not work on this system!])
313fi
314
315
316# Non-existing GSL is fatal -- sub-sequent compilation will fail.
317if test "x$gsl_ok" != "xyes" ; then
318  all_reqs_ok="false"
319  AC_MSG_WARN([
320  GSL $gsl_version (or newer) not found. The GNU Scientific Library
321  (GSL) library cannot be found. Please make sure GSL is
322  installed. Please refer to warnings above for more details])
323fi
324
325if test "x$want_boost" = "xyes"; then
326# Too old Boost is fatal -- sub-sequent compilation will fail.
327if test "${boost_version_check}" != "yes" ; then
328  all_reqs_ok="false"
329  AC_MSG_WARN([
330  Boost found but not the required version. Please install
331  Boost version ${boost_version} or later])
332fi
333fi
334
335if (test "$all_reqs_ok" = "false") ; then
336  AC_MSG_FAILURE([
337  Some pre-requisites were not fulfilled, aborting configure.
338  Please consult the 'README' file for more information about what
339  is needed to compile yat and refer to above warning messages.
340  Needed files were NOT created.])
341fi
342
343# Reset flags
344APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_)
345APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, YAT_)
346APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, YAT_)
347APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_)
348
349YAT_PRIMARY_LIBS=-lgsl
350YAT_LIBS="$YAT_PRIMARY_LIBS $YAT_CBLAS_LIB $LIBM"
351AC_SUBST(YAT_PRIMARY_LIBS)
352AC_SUBST(YAT_LIBS)
353AC_SUBST(YAT_CBLAS_LIB)
354
355# set and AC_SUBST variables that are interpreted by Automake
356AM_CPPFLAGS="-I\$(top_srcdir) $INTERNAL_CPPFLAGS $YAT_CPPFLAGS"
357AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS"
358AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS"
359
360AC_SUBST(AM_CPPFLAGS)
361AC_SUBST(AM_CXXFLAGS)
362AC_SUBST(AM_LDFLAGS)
363AC_SUBST(enable_static)
364
365YAT_SVN_RELEASE([am/maintainer.am])
366
367# Create output.
368AC_OUTPUT
369
370# Some more messages.
371AC_MSG_NOTICE([])
372AC_MSG_NOTICE([ Ready to compile the yat library])
373AC_MSG_NOTICE
374AS_IF([test x$have_doxygen = xyes],
375  [AC_MSG_NOTICE([ Documentation will be generated in html.])],
376  [AC_MSG_NOTICE([Generation of documentation is disabled])
377   AC_MSG_NOTICE([doxygen could not be found])
378  ])
379AC_MSG_NOTICE()
380AC_MSG_NOTICE([ The following flags and libraries will be used:])
381AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
382AC_MSG_NOTICE([  CPPFLAGS=$CPPFLAGS])
383AC_MSG_NOTICE([  AM_CPPFLAGS=$AM_CPPFLAGS])
384AC_MSG_NOTICE([  CXXFLAGS=$CXXFLAGS])
385AC_MSG_NOTICE([  AM_CXXFLAGS=$AM_CXXFLAGS])
386AC_MSG_NOTICE([  LDFLAGS=$LDFLAGS])
387AC_MSG_NOTICE([  AM_LDFLAGS=$AM_LDFLAGS])
388AC_MSG_NOTICE([  LIBS=$LIBS])
389AC_MSG_NOTICE([  YAT_LIBS=$YAT_LIBS])
390AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
391AC_MSG_NOTICE([])
392if test "x$YAT_CBLAS_LIB" = "x-lgslcblas"; then
393AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
394AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
395AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
396AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
397AC_MSG_NOTICE([])
398fi
399AC_MSG_NOTICE([ Now type 'make && make check'.])
Note: See TracBrowser for help on using the repository browser.