source: trunk/configure.ac @ 1324

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

Boost is now required (ticket:370). Boost 1.33 is required, which is a
pretty arbitrary number. I happen to have 1.33 installed on my
machine. If someone can test that it works with an earlier version, I
am more than happy to soften this requirement. Currently, there is no
linking to Boost. I added a file yat.am that is included in most of
our Makefile.am, to avoid parallel modifications.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.6 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 1324 2008-05-24 04:00:18Z 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")
64
65# Checks for libraries.
66AC_CHECK_LIB(m,main)
67# searching for cblas. Priority 1) find a cblas library, 2) find ATLAS
68# generated cblas, and 3) fall back to GSL cblas implementation. If
69# partial ATLAS is detected the configure script fails.
70cblas_found="no"  # cblas_found may get values yes or no
71# atlas_found may get values yes, no, or partial. In some cases
72# partial atlas may be installed
73atlas_found="no"
74gslcblas_found="no" # gslcblas_found may get values yes or no
75AC_SEARCH_LIBS(cblas_sdsdot,cblas,cblas_found="yes",
76  AC_SEARCH_LIBS(ATL_sdsdot,atlas,
77    AC_SEARCH_LIBS(cblas_sdsdot,cblas,atlas_found="yes",
78                   atlas_found="partial",-m64),
79      AC_SEARCH_LIBS(cblas_dswap,gslcblas,gslcblas_found="yes"),-m64),)
80if test ${atlas_found} = "yes"; then
81  CXXFLAGS="$CXXFLAGS -m64" LDFLAGS="$LDFLAGS -m64"
82fi
83
84# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
85# Including AM_PATH_GSL macro from gsl.m4 distributed by GSL
86gsl_found="no"
87gsl_version="1.8"
88sinclude(./build_support/gsl.m4)
89AX_PATH_GSL(${gsl_version},gsl_found="yes",gsl_version_check="no")
90if test "$gsl_found" = "yes"; then
91   LIBS="-lgsl $LIBS"
92fi
93
94# Boost http://www.boost.org
95m4_sinclude(./build_support/ax_boost.m4)
96AX_BOOST("1.33",[boost_found="yes"], [echo AHA])
97
98# Checks for header files.
99AC_CHECK_HEADERS([unistd.h])
100
101# Checks for typedefs, structures, and compiler characteristics.
102AC_HEADER_STDBOOL
103AC_C_CONST
104AC_C_INLINE
105AC_TYPE_SIZE_T
106
107# Checks for library functions.
108AC_PROG_LIBTOOL
109AC_FUNC_ERROR_AT_LINE
110AC_HEADER_STDC
111AC_CHECK_FUNCS([pow sqrt])
112
113CXXFLAGS="$CXXFLAGS -Wall -pedantic"
114CPPFLAGS="$CPPFLAGS -DHAVE_INLINE=1"
115AC_ARG_ENABLE(debug,
116  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
117if test "${enable_debug}" = "yes" ; then
118  CXXFLAGS="$CXXFLAGS -g -O"
119  CPPFLAGS="$CPPFLAGS -DYAT_DEBUG=1"
120else
121  CXXFLAGS="$CXXFLAGS -O3"
122  CPPFLAGS="$CPPFLAGS -DNDEBUG -DGSL_RANGE_CHECK_OFF"
123fi
124
125# check for quiet_NaN support in OS
126# At compile time, but this may not work if quiet_NaN exists and returns
127# an incorrect value
128AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()])
129AC_COMPILE_IFELSE(
130  [AC_LANG_PROGRAM(
131    [#include <limits>
132     extern void f(double);],
133    [f(std::numeric_limits<double>::quiet_NaN())])],
134  [quiet_nan=yes],
135  [quiet_nan=no])
136AC_MSG_RESULT($quiet_nan)
137# At run-time, but this has the disadvantage that yat cannot be built 
138# for cross-compilation
139AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true])
140AC_RUN_IFELSE(
141  [AC_LANG_PROGRAM(
142    [#include <limits>],
143    [return !std::numeric_limits<double>::has_quiet_NaN])],
144  [quiet_nan=yes],
145  [quiet_nan=no])
146AC_MSG_RESULT($quiet_nan)
147# Check for infinity support for doubles in OS
148# At run-time, but this has the disadvantage that yat cannot be built 
149# for cross-compilation
150AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true])
151AC_RUN_IFELSE(
152  [AC_LANG_PROGRAM(
153    [#include <limits>],
154    [return !std::numeric_limits<double>::has_infinity])],
155  [has_infinity=yes],
156  [has_infinity=no])
157AC_MSG_RESULT($has_infinity)
158
159
160# yat specific settings
161YAT_LIB="libyat.la"
162YAT_LIB_LOCATION="yat"
163AC_SUBST(YAT_LIB)
164AC_SUBST(YAT_LIB_LOCATION)
165
166#doxygen stuff
167DX_HTML_OUTPUT=html
168DX_LATEX_OUTPUT=latex
169AC_SUBST(DX_HTML_OUTPUT)
170AC_SUBST(DX_LATEX_OUTPUT)
171
172
173AC_CONFIG_FILES([Makefile
174     doc/Makefile
175     doc/doxygen.config
176     test/Makefile
177     test/environment.h
178     test/data/Makefile
179     yat/Makefile
180     yat/classifier/Makefile
181     yat/random/Makefile
182     yat/regression/Makefile
183     yat/statistics/Makefile
184     yat/utility/version.h
185     yat/utility/Makefile])
186
187# warning about missing doxygen
188if (test "$HAVE_DOXYGEN" != "true") ; then
189  AC_MSG_WARN([
190  Doxygen was not found. Yat will compile and work without doxygen.
191  However, in order to enable generation of documentation, please
192  install Doxygen available at http://www.doxygen.org/
193  ])
194fi
195
196# Print failure status information about selected items, and exit if
197# fatal errors were encountered. No output will be created if
198# configure is halted prematurely.
199
200# used to trigger exit before creation of output
201all_reqs_ok="true"
202
203# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
204# of created binary, will fail.
205if test "${quiet_nan}" = "no" ; then
206  all_reqs_ok="false"
207  AC_MSG_WARN([
208  Support for quiet NAN required.
209  Yat will not work on this system!])
210fi
211
212# No support for infinity is fatal -- sub-sequent compilation, or execution
213# of created binary, will fail.
214if test "${has_infinity}" = "no" ; then
215  all_reqs_ok="false"
216  AC_MSG_WARN([
217  Support for infinity required.
218  Yat will not work on this system!])
219fi
220
221
222# Non-existing BLAS is fatal -- sub-sequent compilation will fail.
223if test "${cblas_found}" = "no" -a "${atlas_found}" = "no" -a "${gslcblas_found}" = "no"; then
224  all_reqs_ok="false"
225  AC_MSG_WARN([
226  cBLAS not found. The C implementation of Basic Linear Algebra
227  Subprograms (cBLAS) library cannot be found. Please make sure
228  cBLAS is installed.])
229fi
230if test "${atlas_found}" = "partial"; then
231  all_reqs_ok="false"
232  AC_MSG_WARN([
233  Partial ATLAS BLAS library found. Please repair your installation.])
234fi
235
236# Non-existing GSL is fatal -- sub-sequent compilation will fail.
237if test "${gsl_found}" = "no" ; then
238  all_reqs_ok="false"
239  if test "${gsl_version_check}" = "no" ; then
240  AC_MSG_WARN([
241  GSL found but not the required version. Please install
242  GSL version ${gsl_version} or later])
243  else
244  AC_MSG_WARN([
245  GSL not found. The GNU Scientific Library (GSL) library cannot be
246  found. Please make sure GSL is installed.])
247  fi
248fi
249
250if (test "$all_reqs_ok" = "false") ; then
251  AC_MSG_FAILURE([
252  Some pre-requisites were not fulfilled, aborting configure.
253  Please consult the 'README' file for more information about what
254  is needed to compile yat and refer to above warning messages.
255  Needed files were NOT created.])
256fi
257
258# Create output.
259AC_OUTPUT
260
261# Some more messages.
262AC_MSG_NOTICE([])
263AC_MSG_NOTICE([ Ready to compile the yat library])
264AC_MSG_NOTICE([ The following flags and libraries will be used:])
265AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
266AC_MSG_NOTICE([  CPPFLAGS=\"$CPPFLAGS\"])
267AC_MSG_NOTICE([  CXXFLAGS=\"$CXXFLAGS\"])
268AC_MSG_NOTICE([  LIBS=\"$LIBS\"])
269AC_MSG_NOTICE([  LDFLAGS=\"$LDFLAGS\"])
270AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
271AC_MSG_NOTICE([])
272if test "${gslcblas_found}" = "yes"; then
273AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
274AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
275AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
276AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
277AC_MSG_NOTICE([])
278fi
279AC_MSG_NOTICE([ Now type 'make ; make check'.])
Note: See TracBrowser for help on using the repository browser.