source: trunk/configure.ac @ 2607

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

write-protect generated file to avoid editing

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.6 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 2607 2011-10-31 18:04:34Z 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, 2011 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
45# Set default htmldir to ${docdir}/html
46AS_IF([test $htmldir = '${docdir}'], [htmldir='${docdir}/html'])
47
48dnl FIXME remove when we assume autoconf 2.64
49m4_ifndef([AC_PACKAGE_URL],
50          [AC_DEFINE([PACKAGE_URL], ["http://dev.thep.lu.se/yat"],
51                     [Define to home page for this package])
52           AC_SUBST([PACKAGE_URL], ["http://dev.thep.lu.se/yat"])])
53
54AC_SUBST([YAT_LT_VERSION], [YAT_LT_VERSION_INFO])
55AC_SUBST([YAT_MAJOR_VERSION], [MAJOR_VERSION])
56AC_SUBST([YAT_MINOR_VERSION], [MINOR_VERSION])
57AC_SUBST([YAT_PATCH_VERSION], [PATCH_VERSION])
58AC_SUBST([YAT_DEV_BUILD], [DEV_BUILD])
59AC_DEFINE([YAT_VERSION], ["YAT_VERSION__"], [version])
60AC_DEFINE([YAT_MAJOR_VERSION], [MAJOR_VERSION], [major version])
61AC_DEFINE([YAT_MINOR_VERSION], [MINOR_VERSION], [minor version])
62AC_DEFINE([YAT_PATCH_VERSION], [PATCH_VERSION], [patch version])
63AC_DEFINE([YAT_DEV_BUILD], [DEV_BUILD], [Define to false if official version])
64
65AC_CONFIG_HEADERS([config.h])
66AM_INIT_AUTOMAKE([1.11 std-options color-tests parallel-tests silent-rules])
67
68# Set default programming language
69AC_LANG(C++)
70
71# propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS
72for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do
73  eval isset=\${$var+set}
74  if test "$isset" = 'set' ; then
75    eval val=$`echo $var`
76    DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' "
77  fi
78done
79AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
80
81# Let user overide default CXXFLAGS
82if test "${CXXFLAGS+set}" != set; then
83  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
84fi
85# Checks for programs.
86AC_PROG_CXX
87AC_PROG_SED
88AC_PROG_LIBTOOL
89
90AC_MSG_NOTICE(dnl
91[checking whether tools for generating documentation are available])
92
93have_doxygen=no
94AC_PATH_PROG([DOXYGEN], [doxygen], [no])
95if test "$DOXYGEN" = "no"; then
96   AC_MSG_WARN([unable to find doxygen application])
97else
98   doxygen_min_version=1.5
99   AC_MSG_CHECKING([if doxygen is at least $doxygen_min_version])
100   doxygen_version=`$DOXYGEN --version`
101   AX_COMPARE_VERSION([$doxygen_version], [ge], [$doxygen_min_version],
102                      [have_doxygen=yes])
103   AC_MSG_RESULT([$doxygen_version])
104fi
105
106AC_SUBST(have_doxygen)
107AM_CONDITIONAL([DX_ENABLE_HTML], [test x$have_doxygen = xyes])
108
109# check for quiet_NaN support in OS
110# Check at run-time, but if we are cross-compiling fall back on a
111# compilation test
112AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true])
113AC_RUN_IFELSE(
114  [AC_LANG_PROGRAM(
115    [@%:@include <limits>],
116    [return !std::numeric_limits<double>::has_quiet_NaN])],
117  [quiet_nan=yes
118   AC_MSG_RESULT($quiet_nan)],
119  [quiet_nan=no
120   AC_MSG_RESULT($quiet_nan)],
121  # if we are cross-compiling fall back on compilation test
122  [AC_MSG_RESULT(cross-compiling)
123   AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()])
124    AC_COMPILE_IFELSE(
125     [AC_LANG_PROGRAM(
126        [@%:@include <limits>
127         extern void f(double);],
128        [f(std::numeric_limits<double>::quiet_NaN())])],
129     [quiet_nan=yes],
130     [quiet_nan=no])
131   AC_MSG_RESULT($quiet_nan)])
132# Check for infinity support for doubles in OS
133# Check at run-time, but if we are cross-compiling fall back on a
134# compilation test
135AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true])
136AC_RUN_IFELSE(
137  [AC_LANG_PROGRAM(
138    [@%:@include <limits>],
139    [return !std::numeric_limits<double>::has_infinity])],
140  [has_infinity=yes
141   AC_MSG_RESULT($has_infinity)],
142  [has_infinity=no
143   AC_MSG_RESULT($has_infinity)],
144  # if we are cross-compiling fall back on compilation test
145  [AC_MSG_RESULT(cross-compiling)
146   AC_MSG_CHECKING([for std::numeric_limits<>::infinity()])
147    AC_COMPILE_IFELSE(
148     [AC_LANG_PROGRAM(
149        [@%:@include <limits>
150         extern void f(double);],
151        [f(std::numeric_limits<double>::infinity())])],
152     [has_infinity=yes],
153     [has_infinity=no])
154   AC_MSG_RESULT($has_infinity)])
155
156AC_MSG_CHECKING([g++ deprecation attribute])
157AC_COMPILE_IFELSE(
158   [AC_LANG_PROGRAM([[void f() __attribute__ ((deprecated));]],)], 
159   [AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1],
160              [Define if compiler supports deprecated attribute, as in g++ 4.0])
161    AC_MSG_RESULT([yes])],
162   [AC_MSG_RESULT([no])] )
163
164AC_MSG_CHECKING([if std::multiset::iterator is mutable])
165AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <set>
166                                     @%:@include <vector>]],
167                                   [[std::set<std::vector<double> > s;
168                                     std::vector<double> v;
169                                     s.insert(v);
170                                     s.begin()->reserve(100);
171                                   ]])],
172                  [AC_DEFINE([MULTISET_ITERATOR_IS_MUTABLE], [1],
173                             [Define if std::multiset::iterator is mutable])
174                   AC_MSG_RESULT([yes])
175                  ],
176                  [AC_MSG_RESULT([no])] )
177
178# Save user-defined environment settings for later restoration
179APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
180APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
181APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
182APR_SAVE_THE_ENVIRONMENT(LIBS)
183
184# Checks for libraries.
185AC_MSG_NOTICE([checking for libraries])
186AC_CHECK_LIBM
187
188# find library implementing BLAS C API, or use gslcblas
189YAT_LIB_CBLAS([YAT_CBLAS_LIB=$CBLAS_LIB], [YAT_CBLAS_LIB=-lgslcblas])
190
191# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
192# Including AX_PATH_GSL macro from gsl.m4 distributed by GSL
193gsl_version="1.8"
194AC_SUBST(gsl_version)
195gsl_ok=yes
196YAT_CHECK_GSL([$gsl_version],[gsl_ok=yes],[gsl_ok=no])
197
198# Boost http://www.boost.org
199boost_version=1.35
200AC_SUBST(boost_version)
201AX_BOOST_BASE(["$boost_version"], [boost_ok=yes], [boost_ok=no])
202YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS])
203
204#support for large files
205AC_SYS_LARGEFILE
206if test "$enable_largefile" = "no"; then
207  AC_DEFINE([YAT_LFS_DISABLED], 1,
208            [defined to 1 if large file support is disabled])
209fi
210
211# we use prefix INTERNAL_ for variables that are solely needed for
212# building yat, i.e., they are not needed for a user of yat and are
213# not propagated to yat-config or yat.m4.
214YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wall -pedantic])
215YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DHAVE_INLINE=1])
216AC_ARG_ENABLE([debug],
217  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
218if test "${enable_debug}" = "yes" ; then
219  YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DYAT_DEBUG=1])
220  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-g -O])
221else
222  # avoid defining GSL_RANGE_CHECK_OFF if GSL_RANGE_CHECK is already defined
223  AC_CHECK_DECL([GSL_RANGE_CHECK],[],
224                [YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS],[-DGSL_RANGE_CHECK_OFF])])
225  YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DNDEBUG])
226  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-O3])
227fi
228
229# some versions of boost uses long long - turn off compiler warnings
230# with -Wno-long-long
231yat_save_CXXFLAGS=$CXXFLAGS
232# turn warnings into errors
233YAT_CXX_ADD_FLAG([CXXFLAGS], [-pedantic-errors])
234AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
235  [
236    @%:@include <boost/iterator/transform_iterator.hpp>
237    @%:@include <cmath>
238    @%:@include <functional>
239    @%:@include <vector>
240  ],[
241      using namespace boost;
242      typedef std::pointer_to_unary_function<double, double> F;
243      std::vector<double> vec;
244      transform_iterator<F, std::vector<double>::iterator>
245        i(vec.begin(), std::ptr_fun(fabs));
246  ])],
247[],
248[YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wno-long-long])])
249# restore CXXFLAGS
250CXXFLAGS=$yat_save_CXXFLAGS
251
252#doxygen stuff
253DX_HTML_OUTPUT=html
254AC_SUBST(DX_HTML_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([build_support/gen_yat_pc.sh],
269                [chmod +x build_support/gen_yat_pc.sh])
270AC_CONFIG_FILES([build_support/tag_and_release.sh],
271                [chmod +x-w build_support/tag_and_release.sh])
272AC_CONFIG_FILES([Makefile
273     build_support/Makefile
274     doc/Makefile
275     doc/doxygen.config
276     doc/first_page.doxygen
277     m4/Makefile
278     test/Makefile
279     test/common_defs.sh
280     yat/Makefile
281     yat/classifier/Makefile
282     yat/normalizer/Makefile
283     yat/omic/Makefile
284     yat/random/Makefile
285     yat/regression/Makefile
286     yat/statistics/Makefile
287     yat/utility/Makefile])
288
289AC_CONFIG_HEADERS([yat/utility/config_public.h])
290# for the test suite
291yat_abs_top_srcdir=`cd $srcdir && pwd`
292AC_DEFINE_UNQUOTED([YAT_ABS_TOP_SRCDIR], ["$yat_abs_top_srcdir"],
293                   [Define to absolute path to top yat src dir])
294
295# Print failure status information about selected items, and exit if
296# fatal errors were encountered. No output will be created if
297# configure is halted prematurely.
298
299# used to trigger exit before creation of output
300all_reqs_ok="true"
301
302# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
303# of created binary, will fail.
304if test "${quiet_nan}" = "no" ; then
305  all_reqs_ok="false"
306  AC_MSG_WARN([
307  Support for quiet NAN required.
308  yat will not work on this system!])
309fi
310
311# No support for infinity is fatal -- sub-sequent compilation, or execution
312# of created binary, will fail.
313if test "${has_infinity}" = "no" ; then
314  all_reqs_ok="false"
315  AC_MSG_WARN([
316  Support for infinity required.
317  yat will not work on this system!])
318fi
319
320
321# Non-existing GSL is fatal -- sub-sequent compilation will fail.
322if test "x$gsl_ok" != "xyes" ; then
323  all_reqs_ok="false"
324  AC_MSG_WARN([
325  GSL $gsl_version (or newer) not found. The GNU Scientific Library
326  (GSL) library cannot be found. Please make sure GSL is
327  installed. Please refer to warnings above for more details])
328fi
329
330if test "x$want_boost" = "xyes"; then
331# Too old Boost is fatal -- sub-sequent compilation will fail.
332if test "${boost_ok}" != "yes" ; then
333  all_reqs_ok="false"
334  AC_MSG_WARN([
335  Boost ${boost_version} (or newer) not found. Please make sure Boost
336  is installed.])
337fi
338fi
339
340if (test "$all_reqs_ok" = "false") ; then
341  AC_MSG_FAILURE([
342  Some pre-requisites were not fulfilled, aborting configure.
343  Please consult the 'README' file for more information about what
344  is needed to compile yat and refer to above warning messages.
345  Needed files were NOT created.])
346fi
347
348# Reset flags
349APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_)
350APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, YAT_)
351APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, YAT_)
352APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_)
353
354YAT_PRIMARY_LIBS=-lgsl
355YAT_LIBS="$YAT_PRIMARY_LIBS $YAT_CBLAS_LIB $LIBM"
356AC_SUBST(YAT_PRIMARY_LIBS)
357AC_SUBST(YAT_LIBS)
358AC_SUBST(YAT_CBLAS_LIB)
359
360# set and AC_SUBST variables that are interpreted by Automake
361AM_CPPFLAGS="-I\$(top_srcdir) $INTERNAL_CPPFLAGS $YAT_CPPFLAGS"
362AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS"
363AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS"
364
365AC_SUBST(AM_CPPFLAGS)
366AC_SUBST(AM_CXXFLAGS)
367AC_SUBST(AM_LDFLAGS)
368AC_SUBST(enable_static)
369
370YAT_SVN_RELEASE([am/maintainer.am])
371
372# Create output.
373AC_OUTPUT
374
375# Some more messages.
376AC_MSG_NOTICE([])
377AC_MSG_NOTICE([ Ready to compile the yat library])
378AC_MSG_NOTICE
379AS_IF([test x$have_doxygen = xyes],
380  [AC_MSG_NOTICE([ Documentation will be generated in html.])],
381  [AC_MSG_NOTICE([Generation of documentation is disabled])
382   AC_MSG_NOTICE([doxygen could not be found])
383  ])
384AC_MSG_NOTICE()
385AC_MSG_NOTICE([ The following flags and libraries will be used:])
386AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
387AC_MSG_NOTICE([  CPPFLAGS=$CPPFLAGS])
388AC_MSG_NOTICE([  AM_CPPFLAGS=$AM_CPPFLAGS])
389AC_MSG_NOTICE([  CXXFLAGS=$CXXFLAGS])
390AC_MSG_NOTICE([  AM_CXXFLAGS=$AM_CXXFLAGS])
391AC_MSG_NOTICE([  LDFLAGS=$LDFLAGS])
392AC_MSG_NOTICE([  AM_LDFLAGS=$AM_LDFLAGS])
393AC_MSG_NOTICE([  LIBS=$LIBS])
394AC_MSG_NOTICE([  YAT_LIBS=$YAT_LIBS])
395AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
396AC_MSG_NOTICE([])
397if test "x$YAT_CBLAS_LIB" = "x-lgslcblas"; then
398AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
399AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
400AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
401AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
402AC_MSG_NOTICE([])
403fi
404AC_MSG_NOTICE([ Now type 'make && make check'.])
Note: See TracBrowser for help on using the repository browser.