source: trunk/configure.ac @ 1327

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

fixes #352

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