source: trunk/configure.ac @ 1914

Last change on this file since 1914 was 1914, checked in by Peter, 14 years ago

Using ACX_BLAS macro for blas detection. The behavior will likely be a
bit different from before. The major difference is that there are no
-m64 flags in the atlas tests, which implies you might need to add
-m64 to LDFLAGS (and possibly CXXFLAGS) at configure time. It also
implies that you might detect atlas on your 32bit machine, which
previously was not possible. fixes #349

There is a new configure option: '--with-blas' that can be used to
specify which blas should be used. fixes #524

refs #518

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