source: trunk/configure.ac @ 2463

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

remove deprecated configure options: --with-gsl-prefix and --with-gsl-exec-prefix

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