source: trunk/configure.ac @ 1796

Last change on this file since 1796 was 1795, checked in by Jari Häkkinen, 13 years ago

Updated make request in the end of the configure.ac

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