source: trunk/configure.ac @ 1209

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

fixes #331

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