source: trunk/configure.ac @ 1148

Last change on this file since 1148 was 1148, checked in by Peter, 16 years ago

fixes #338

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