source: trunk/configure.ac @ 1356

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

fixes #533 - added creation and installation of a yat.pc file

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