source: trunk/configure.ac @ 1375

Last change on this file since 1375 was 1367, checked in by Peter, 13 years ago

closes #162 - if you have doxygen available there will be a test that html documentation is ok (i.e. no warnings from doxygen)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 10.3 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 1367 2008-07-10 23:07:52Z 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#
10# This file is part of the yat library, http://trac.thep.lu.se/yat
11#
12# The yat library is free software; you can redistribute it
13# and/or modify it under the terms of the GNU General Public License as
14# published by the Free Software Foundation; either version 2 of the
15# License, or (at your option) any later version.
16#
17# The yat library is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
20# General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, write to the Free Software
24# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25# 02111-1307, USA.
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
34m4_include([./build_support/version.m4])
35AC_INIT([yat],[YAT_VERSION],[jari@thep.lu.se])
36AC_PREREQ(2.60)
37AC_CONFIG_SRCDIR([yat/utility/Matrix.h])
38AC_CONFIG_AUX_DIR([autotools])
39AC_PREFIX_DEFAULT([/usr/local])
40
41AC_SUBST([YAT_LT_VERSION], [LT_VERSION])
42AC_SUBST([YAT_MAJOR_VERSION], [MAJOR_VERSION])
43AC_SUBST([YAT_MINOR_VERSION], [MINOR_VERSION])
44AC_SUBST([YAT_PATCH_VERSION], [PATCH_VERSION])
45AC_SUBST([YAT_DEV_BUILD], [DEV_BUILD])
46
47AC_CONFIG_HEADER([config.h])
48AM_INIT_AUTOMAKE()
49
50# Set default programming language
51AC_LANG(C++)
52
53# Let user overide default CXXFLAGS
54if test "${CXXFLAGS+set}" != set; then
55  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
56fi
57# Checks for programs.
58AC_PROG_CXX
59AC_PROG_INSTALL
60AC_PROG_SED
61AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [true], [false])
62
63AM_CONDITIONAL(HAVE_DOXYGEN, test "$HAVE_DOXYGEN" = "true")
64AC_CONFIG_FILES([test/documentation_test.sh],
65                [chmod +x test/documentation_test.sh])
66
67m4_sinclude(./build_support/apr_common.m4)
68# Save user-defined environment settings for later restoration
69APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
70APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
71APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
72
73# Checks for libraries.
74AC_CHECK_LIB(m,main)
75# searching for cblas. Priority 1) find a cblas library, 2) find ATLAS
76# generated cblas, and 3) fall back to GSL cblas implementation. If
77# partial ATLAS is detected the configure script fails.
78cblas_found="no"  # cblas_found may get values yes or no
79# atlas_found may get values yes, no, or partial. In some cases
80# partial atlas may be installed
81atlas_found="no"
82gslcblas_found="no" # gslcblas_found may get values yes or no
83AC_SEARCH_LIBS(cblas_sdsdot,cblas,cblas_found="yes",
84  AC_SEARCH_LIBS(ATL_sdsdot,atlas,
85    AC_SEARCH_LIBS(cblas_sdsdot,cblas,atlas_found="yes",
86                   atlas_found="partial",-m64),
87      AC_SEARCH_LIBS(cblas_dswap,gslcblas,gslcblas_found="yes"),-m64),)
88# CBLAS used in test of GSL
89gsl_cblas_lib=-lgslcblas
90if test ${cblas_found} = "yes"; then
91  gsl_cblas_lib=-lcblas
92fi
93if test ${atlas_found} = "yes"; then
94  CXXFLAGS="$CXXFLAGS -m64" LDFLAGS="$LDFLAGS -m64"
95  gsl_cblas_lib=-latlas
96fi
97export GSL_CBLAS_LIB=${gsl_cblas_lib}
98
99# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
100# Including AX_PATH_GSL macro from gsl.m4 distributed by GSL
101gsl_found="no"
102gsl_version="1.8"
103AC_SUBST(gsl_version)
104sinclude(./build_support/gsl.m4)
105AX_PATH_GSL(${gsl_version},gsl_found="yes",gsl_version_check="no")
106if test "$gsl_found" = "yes"; then
107   LIBS="-lgsl $LIBS"
108   # grep words starting with '-L' in other words LDFLAGS
109   for i in $GSL_LIBS; do
110     if test ${i:0:2} = "-L"; then
111       LDFLAGS="$LDFLAGS $i"
112     fi
113   done
114fi
115
116# Boost http://www.boost.org
117m4_sinclude(./build_support/ax_boost.m4)
118boost_version=1.33
119AC_SUBST(boost_version)
120AX_BOOST("$boost_version")
121CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
122
123
124# Checks for header files.
125AC_CHECK_HEADERS([unistd.h])
126
127# Checks for typedefs, structures, and compiler characteristics.
128AC_HEADER_STDBOOL
129AC_C_CONST
130AC_C_INLINE
131AC_TYPE_SIZE_T
132
133# Checks for library functions.
134AC_PROG_LIBTOOL
135AC_FUNC_ERROR_AT_LINE
136AC_HEADER_STDC
137AC_CHECK_FUNCS([pow sqrt])
138
139CXXFLAGS="$CXXFLAGS -Wall -pedantic"
140CPPFLAGS="$CPPFLAGS -DHAVE_INLINE=1"
141AC_ARG_ENABLE(debug,
142  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
143if test "${enable_debug}" = "yes" ; then
144  CXXFLAGS="$CXXFLAGS -g -O"
145  CPPFLAGS="$CPPFLAGS -DYAT_DEBUG=1"
146else
147  CXXFLAGS="$CXXFLAGS -O3"
148  CPPFLAGS="$CPPFLAGS -DNDEBUG -DGSL_RANGE_CHECK_OFF"
149fi
150
151# check for quiet_NaN support in OS
152# Check at run-time, but if we are cross-compiling fall back on a
153# compilation test
154AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true])
155AC_RUN_IFELSE(
156  [AC_LANG_PROGRAM(
157    [@%:@include <limits>],
158    [return !std::numeric_limits<double>::has_quiet_NaN])],
159  [quiet_nan=yes
160   AC_MSG_RESULT($quiet_nan)],
161  [quiet_nan=no
162   AC_MSG_RESULT($quiet_nan)],
163  # if we are cross-compiling fall back on compilation test
164  [AC_MSG_RESULT(cross-compiling)
165   AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()])
166    AC_COMPILE_IFELSE(
167     [AC_LANG_PROGRAM(
168        [@%:@include <limits>
169         extern void f(double);],
170        [f(std::numeric_limits<double>::quiet_NaN())])],
171     [quiet_nan=yes],
172     [quiet_nan=no])
173   AC_MSG_RESULT($quiet_nan)])
174# Check for infinity support for doubles in OS
175# Check at run-time, but if we are cross-compiling fall back on a
176# compilation test
177AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true])
178AC_RUN_IFELSE(
179  [AC_LANG_PROGRAM(
180    [@%:@include <limits>],
181    [return !std::numeric_limits<double>::has_infinity])],
182  [has_infinity=yes
183   AC_MSG_RESULT($has_infinity)],
184  [has_infinity=no
185   AC_MSG_RESULT($has_infinity)],
186  # if we are cross-compiling fall back on compilation test
187  [AC_MSG_RESULT(cross-compiling)
188   AC_MSG_CHECKING([for std::numeric_limits<>::infinity()])
189    AC_COMPILE_IFELSE(
190     [AC_LANG_PROGRAM(
191        [@%:@include <limits>
192         extern void f(double);],
193        [f(std::numeric_limits<double>::infinity())])],
194     [has_infinity=yes],
195     [has_infinity=no])
196   AC_MSG_RESULT($has_infinity)])
197
198
199# yat specific settings
200YAT_LIBNAME="yat"
201YAT_LIB="libyat.la"
202YAT_LIB_LOCATION="yat"
203AC_SUBST(YAT_LIBNAME)
204AC_SUBST(YAT_LIB)
205AC_SUBST(YAT_LIB_LOCATION)
206
207#doxygen stuff
208DX_HTML_OUTPUT=html
209DX_LATEX_OUTPUT=latex
210AC_SUBST(DX_HTML_OUTPUT)
211AC_SUBST(DX_LATEX_OUTPUT)
212
213
214AC_CONFIG_FILES([Makefile
215     build_support/yat.pc
216     doc/Makefile
217     doc/doxygen.config
218     test/Makefile
219     test/environment.h
220     test/data/Makefile
221     yat/Makefile
222     yat/classifier/Makefile
223     yat/random/Makefile
224     yat/regression/Makefile
225     yat/statistics/Makefile
226     yat/utility/version.h
227     yat/utility/Makefile])
228
229AC_CONFIG_FILES([build_support/yat-config],
230                [chmod +x build_support/yat-config])
231
232# warning about missing doxygen
233if (test "$HAVE_DOXYGEN" != "true") ; then
234  AC_MSG_WARN([
235  Doxygen was not found. Yat will compile and work without doxygen.
236  However, in order to enable generation of documentation, please
237  install Doxygen available at http://www.doxygen.org/
238  ])
239fi
240
241# Print failure status information about selected items, and exit if
242# fatal errors were encountered. No output will be created if
243# configure is halted prematurely.
244
245# used to trigger exit before creation of output
246all_reqs_ok="true"
247
248# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
249# of created binary, will fail.
250if test "${quiet_nan}" = "no" ; then
251  all_reqs_ok="false"
252  AC_MSG_WARN([
253  Support for quiet NAN required.
254  Yat will not work on this system!])
255fi
256
257# No support for infinity is fatal -- sub-sequent compilation, or execution
258# of created binary, will fail.
259if test "${has_infinity}" = "no" ; then
260  all_reqs_ok="false"
261  AC_MSG_WARN([
262  Support for infinity required.
263  Yat will not work on this system!])
264fi
265
266
267# Non-existing BLAS is fatal -- sub-sequent compilation will fail.
268if test "${cblas_found}" = "no" -a "${atlas_found}" = "no" -a "${gslcblas_found}" = "no"; then
269  all_reqs_ok="false"
270  AC_MSG_WARN([
271  cBLAS not found. The C implementation of Basic Linear Algebra
272  Subprograms (cBLAS) library cannot be found. Please make sure
273  cBLAS is installed.])
274fi
275if test "${atlas_found}" = "partial"; then
276  all_reqs_ok="false"
277  AC_MSG_WARN([
278  Partial ATLAS BLAS library found. Please repair your installation.])
279fi
280
281# Non-existing GSL is fatal -- sub-sequent compilation will fail.
282if test "${gsl_found}" = "no" ; then
283  all_reqs_ok="false"
284  if test "${gsl_version_check}" = "no" ; then
285  AC_MSG_WARN([
286  GSL found but not the required version. Please install
287  GSL version ${gsl_version} or later])
288  else
289  AC_MSG_WARN([
290  GSL not found. The GNU Scientific Library (GSL) library cannot be
291  found. Please make sure GSL is installed.])
292  fi
293fi
294
295if (test "$all_reqs_ok" = "false") ; then
296  AC_MSG_FAILURE([
297  Some pre-requisites were not fulfilled, aborting configure.
298  Please consult the 'README' file for more information about what
299  is needed to compile yat and refer to above warning messages.
300  Needed files were NOT created.])
301fi
302
303# Reset flags
304APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, EXTRA_)
305APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, EXTRA_)
306APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, EXTRA_)
307
308# Create output.
309AC_OUTPUT
310
311# Some more messages.
312AC_MSG_NOTICE([])
313AC_MSG_NOTICE([ Ready to compile the yat library])
314AC_MSG_NOTICE([ The following flags and libraries will be used:])
315AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
316AC_MSG_NOTICE([  CPPFLAGS=\"$CPPFLAGS\"])
317AC_MSG_NOTICE([  EXTRA_CPPFLAGS=\"$EXTRA_CPPFLAGS\"])
318AC_MSG_NOTICE([  CXXFLAGS=\"$CXXFLAGS\"])
319AC_MSG_NOTICE([  EXTRA_CXXFLAGS=\"$EXTRA_CXXFLAGS\"])
320AC_MSG_NOTICE([  LDFLAGS=\"$LDFLAGS\"])
321AC_MSG_NOTICE([  EXTRA_LDFLAGS=\"$EXTRA_LDFLAGS\"])
322AC_MSG_NOTICE([  LIBS=\"$LIBS\"])
323AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
324AC_MSG_NOTICE([])
325if test "${gslcblas_found}" = "yes"; then
326AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
327AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
328AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
329AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
330AC_MSG_NOTICE([])
331fi
332AC_MSG_NOTICE([ Now type 'make ; make check'.])
Note: See TracBrowser for help on using the repository browser.