source: trunk/configure.ac @ 1406

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

updating yat-config

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