source: trunk/configure.ac @ 2128

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

remove left-over code. we are using yat_svn_release.m4 now instead.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 14.0 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 2128 2009-12-22 22:05:35Z 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#
11# This file is part of the yat library, http://dev.thep.lu.se/yat
12#
13# The yat library is free software; you can redistribute it
14# and/or modify it under the terms of the GNU General Public License as
15# published by the Free Software Foundation; either version 3 of the
16# License, or (at your option) any later version.
17#
18# The yat library is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21# General Public License for more details.
22#
23# You should have received a copy of the GNU General Public License
24# along with yat. If not, see <http://www.gnu.org/licenses/>.
25#
26# If you grabbed the source from the subversion repository you should,
27# at top-level, execute:
28#     ./bootstrap
29# To push subsequent changes of this file into the build scripts you
30# must issue:
31#     autoreconf
32
33m4_include([m4/version.m4])
34AC_INIT([yat],[YAT_VERSION],[jari@thep.lu.se],,[http://dev.thep.lu.se/yat])
35AC_PREREQ(2.63)
36AC_CONFIG_SRCDIR([yat/utility/Matrix.h])
37AC_CONFIG_AUX_DIR([autotools])
38dnl arg below should be the same as in Makefile.am
39AC_CONFIG_MACRO_DIR([m4])
40AC_PREFIX_DEFAULT([/usr/local])
41
42AC_SUBST([YAT_LT_VERSION], [YAT_LT_VERSION_INFO])
43AC_SUBST([YAT_MAJOR_VERSION], [MAJOR_VERSION])
44AC_SUBST([YAT_MINOR_VERSION], [MINOR_VERSION])
45AC_SUBST([YAT_PATCH_VERSION], [PATCH_VERSION])
46AC_SUBST([YAT_DEV_BUILD], [DEV_BUILD])
47
48AC_CONFIG_HEADER([config.h])
49AM_INIT_AUTOMAKE([1.10 std-options])
50
51# Set default programming language
52AC_LANG(C++)
53
54# propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS
55for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do
56  eval isset=\${$var+set}
57  if test "$isset" = 'set' ; then
58    eval val=$`echo $var`
59    DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' "
60  fi
61done
62AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
63
64# Let user overide default CXXFLAGS
65if test "${CXXFLAGS+set}" != set; then
66  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
67fi
68# Checks for programs.
69AC_PROG_CXX
70AC_PROG_INSTALL
71AC_PROG_SED
72AC_PROG_LIBTOOL
73# fall back to echo unless ECHO not already set (by libtool)
74AS_IF([test "x$ECHO" = x], [ECHO=echo])
75AC_SUBST(ECHO)
76
77AC_MSG_NOTICE(dnl
78[checking whether tools for generating documentation are available])
79
80have_doxygen=no
81dx_enable_latex=no
82dx_enable_dvi=no
83dx_enable_ps=no
84dx_enable_pdf=no
85AC_PATH_PROG([DOXYGEN], [doxygen], [no])
86if test "$DOXYGEN" = "no"; then
87   AC_MSG_WARN([unable to find doxygen application])
88else
89   doxygen_min_version=1.5
90   AC_MSG_CHECKING([if doxygen is at least $doxygen_min_version])
91   doxygen_version=`$DOXYGEN --version`
92   AX_COMPARE_VERSION([$doxygen_version], [ge], [$doxygen_min_version],
93                      [have_doxygen=yes])
94   AC_MSG_RESULT([$doxygen_version])
95   dx_enable_latex=yes
96   # doxygen 1.5.8 has a bug for latex output and enums
97   AS_IF([test $have_doxygen = yes],
98         [AX_COMPARE_VERSION([$doxygen_version], [eq], [1.5.8],
99                 [AC_MSG_WARN([doxygen 1.5.8 detected - latex output turned off])
100                  dx_enable_latex=no])])
101fi
102
103# we need latex output to generate dvi, ps, and pdf
104AS_IF([test $dx_enable_latex = yes],
105  [dx_enable_pdf=yes
106   ACLTX_PROG_PDFLATEX([dx_enable_pdf=no])
107   ACLTX_PROG_MAKEINDEX([dx_enable_pdf=no])
108   dx_enable_dvi=yes
109   ACLTX_PROG_LATEX([dx_enable_dvi=no])
110   # ps needs dvi
111   dx_enable_ps=$dx_enable_dvi
112   ACLTX_PROG_DVIPS([dx_enable_ps=no])
113   AS_IF([test "x$dx_enable_ps" != xno], [
114     YAT_PROG_DVIPS_PSPICTURE([], [dx_enable_ps=no
115                                   AC_MSG_NOTICE([ps generation turned off])])
116   ])
117  ]
118)
119
120AC_SUBST(have_doxygen)
121AM_CONDITIONAL([DX_ENABLE_HTML], [test x$have_doxygen = xyes])
122AM_CONDITIONAL([DX_ENABLE_LATEX], [test x$dx_enable_latex = xyes])
123AM_CONDITIONAL([DX_ENABLE_DVI], [test x$dx_enable_dvi = xyes])
124AM_CONDITIONAL([DX_ENABLE_PS], [test x$dx_enable_ps = xyes])
125AM_CONDITIONAL([DX_ENABLE_PDF], [test x$dx_enable_pdf = xyes])
126AC_CONFIG_FILES([test/documentation_test.sh],
127                [chmod +x test/documentation_test.sh])
128
129# check for quiet_NaN support 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_quiet_NaN is true])
133AC_RUN_IFELSE(
134  [AC_LANG_PROGRAM(
135    [@%:@include <limits>],
136    [return !std::numeric_limits<double>::has_quiet_NaN])],
137  [quiet_nan=yes
138   AC_MSG_RESULT($quiet_nan)],
139  [quiet_nan=no
140   AC_MSG_RESULT($quiet_nan)],
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<>::quiet_NaN()])
144    AC_COMPILE_IFELSE(
145     [AC_LANG_PROGRAM(
146        [@%:@include <limits>
147         extern void f(double);],
148        [f(std::numeric_limits<double>::quiet_NaN())])],
149     [quiet_nan=yes],
150     [quiet_nan=no])
151   AC_MSG_RESULT($quiet_nan)])
152# Check for infinity support for doubles in OS
153# Check at run-time, but if we are cross-compiling fall back on a
154# compilation test
155AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true])
156AC_RUN_IFELSE(
157  [AC_LANG_PROGRAM(
158    [@%:@include <limits>],
159    [return !std::numeric_limits<double>::has_infinity])],
160  [has_infinity=yes
161   AC_MSG_RESULT($has_infinity)],
162  [has_infinity=no
163   AC_MSG_RESULT($has_infinity)],
164  # if we are cross-compiling fall back on compilation test
165  [AC_MSG_RESULT(cross-compiling)
166   AC_MSG_CHECKING([for std::numeric_limits<>::infinity()])
167    AC_COMPILE_IFELSE(
168     [AC_LANG_PROGRAM(
169        [@%:@include <limits>
170         extern void f(double);],
171        [f(std::numeric_limits<double>::infinity())])],
172     [has_infinity=yes],
173     [has_infinity=no])
174   AC_MSG_RESULT($has_infinity)])
175
176AC_MSG_CHECKING([g++ deprecation attribute])
177AC_COMPILE_IFELSE(
178   [AC_LANG_PROGRAM([[void f() __attribute__ ((deprecated));]],)], 
179   [AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1],
180              [Define if compiler supports deprecated attribute, as in g++ 4.0])
181    AC_MSG_RESULT([yes])],
182   [AC_MSG_RESULT([no])] )
183
184AC_MSG_CHECKING([if std::multiset::iterator is mutable])
185AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <set>
186                                     @%:@include <vector>]],
187                                   [[std::set<std::vector<double> > s;
188                                     std::vector<double> v;
189                                     s.insert(v);
190                                     s.begin()->reserve(100);
191                                   ]])],
192                  [AC_DEFINE([MULTISET_ITERATOR_IS_MUTABLE], [1],
193                             [Define if std::multiset::iterator is mutable])
194                   AC_MSG_RESULT([yes])
195                  ],
196                  [AC_MSG_RESULT([no])] )
197
198# Save user-defined environment settings for later restoration
199APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
200APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
201APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
202APR_SAVE_THE_ENVIRONMENT(LIBS)
203
204# Checks for libraries.
205AC_MSG_NOTICE([checking for libraries])
206AC_CHECK_LIBM
207
208# find library implementing BLAS C API, or use gslcblas
209YAT_LIB_CBLAS([YAT_CBLAS_LIB=$CBLAS_LIB], [YAT_CBLAS_LIB=-lgslcblas])
210
211# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
212# Including AX_PATH_GSL macro from gsl.m4 distributed by GSL
213gsl_version="1.8"
214AC_SUBST(gsl_version)
215gsl_ok=yes
216YAT_CHECK_GSL([$gsl_version],[gsl_ok=yes],[gsl_ok=no])
217
218# Boost http://www.boost.org
219boost_version=1.33
220AC_SUBST(boost_version)
221AX_BOOST_BASE(["$boost_version"])
222boost_version_check=$succeeded;
223YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS])
224
225#support for large files
226AC_SYS_LARGEFILE
227if test "$enable_largefile" = "no"; then
228  AC_DEFINE([YAT_LFS_DISABLED], 1,
229            [defined to 1 if large file support is disabled])
230fi
231
232# we use prefix INTERNAL_ for variables that are solely needed for
233# building yat, i.e., they are not needed for a user of yat and are
234# not propagated to yat-config or yat.m4.
235YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wall -pedantic])
236YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DHAVE_INLINE=1])
237AC_ARG_ENABLE([debug],
238  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
239if test "${enable_debug}" = "yes" ; then
240  YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DYAT_DEBUG=1])
241  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-g -O])
242else
243  # avoid defining GSL_RANGE_CHECK_OFF if GSL_RANGE_CHECK is already defined
244  AC_CHECK_DECL([GSL_RANGE_CHECK],[],
245                [YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS],[-DGSL_RANGE_CHECK_OFF])])
246  YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DNDEBUG])
247  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-O3])
248fi
249
250# some versions of boost uses long long - turn off compiler warnings
251# with -Wno-long-long
252yat_save_CXXFLAGS=$CXXFLAGS
253# turn warnings into errors
254YAT_CXX_ADD_FLAG([CXXFLAGS], [-pedantic-errors])
255AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
256  [
257    @%:@include <boost/iterator/transform_iterator.hpp>
258    @%:@include <cmath>
259    @%:@include <functional>
260    @%:@include <vector>
261  ],[
262      using namespace boost;
263      typedef std::pointer_to_unary_function<double, double> F;
264      std::vector<double> vec;
265      transform_iterator<F, std::vector<double>::iterator>
266        i(vec.begin(), std::ptr_fun(fabs));
267  ])],
268[],
269[YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wno-long-long])])
270# restore CXXFLAGS
271CXXFLAGS=$yat_save_CXXFLAGS
272
273# yat specific settings
274YAT_LIBNAME="yat"
275YAT_LIB_LOCATION="yat"
276AC_SUBST(YAT_LIBNAME)
277AC_SUBST(YAT_LIB_LOCATION)
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_HEADER([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)
381
382YAT_SVN_RELEASE
383
384# Create output.
385AC_OUTPUT
386
387# Some more messages.
388AC_MSG_NOTICE([])
389AC_MSG_NOTICE([ Ready to compile the yat library])
390AS_IF([test x$have_doxygen = xyes],
391  [AC_MSG_NOTICE([ Documentation will be generated in the following formats:])
392   dox_formats="   html";
393   AS_IF([test x$dx_enable_pdf = xyes], [dox_formats="$dox_formats pdf"])
394   AS_IF([test x$dx_enable_ps = xyes],  [dox_formats="$dox_formats ps"])
395   AS_IF([test x$dx_enable_dvi = xyes], [dox_formats="$dox_formats dvi"])
396   AC_MSG_NOTICE([$dox_formats])
397  ],
398  [AC_MSG_NOTICE([Generation of documentation is disabled])
399   AC_MSG_NOTICE([doxygen could not be found])
400  ])
401AC_MSG_NOTICE()
402AC_MSG_NOTICE([ The following flags and libraries will be used:])
403AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
404AC_MSG_NOTICE([  CPPFLAGS=$CPPFLAGS])
405AC_MSG_NOTICE([  AM_CPPFLAGS=$AM_CPPFLAGS])
406AC_MSG_NOTICE([  CXXFLAGS=$CXXFLAGS])
407AC_MSG_NOTICE([  AM_CXXFLAGS=$AM_CXXFLAGS])
408AC_MSG_NOTICE([  LDFLAGS=$LDFLAGS])
409AC_MSG_NOTICE([  AM_LDFLAGS=$AM_LDFLAGS])
410AC_MSG_NOTICE([  LIBS=$LIBS])
411AC_MSG_NOTICE([  YAT_LIBS=$YAT_LIBS])
412AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
413AC_MSG_NOTICE([])
414if test "x$YAT_CBLAS_LIB" = "x-lgslcblas"; then
415AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
416AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
417AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
418AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
419AC_MSG_NOTICE([])
420fi
421AC_MSG_NOTICE([ Now type 'make && make check'.])
Note: See TracBrowser for help on using the repository browser.