source: trunk/configure.ac @ 1351

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

fixing #385 - setting env var GSL_CBLAS_LIB when gslcblas is not used

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