source: trunk/configure.ac @ 1429

Last change on this file since 1429 was 1429, checked in by Peter, 15 years ago

refs #416 - added directory and modified build

  • 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 1429 2008-08-21 18:03: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/normalization/Makefile
247     yat/random/Makefile
248     yat/regression/Makefile
249     yat/statistics/Makefile
250     yat/utility/version.h
251     yat/utility/Makefile])
252
253AC_CONFIG_FILES([build_support/yat-config],
254                [chmod +x build_support/yat-config])
255
256# warning about missing doxygen
257if (test "$have_dox_tools" != "yes") ; then
258  AC_MSG_WARN([
259  Some pre-requisites for generating documentation were not
260  fulfilled. The build will not create any documentation.
261  Please consult the 'README' file for more information about
262  what is needed to generate documentation and refer to above
263  warning messages.
264  ])
265fi
266
267# Print failure status information about selected items, and exit if
268# fatal errors were encountered. No output will be created if
269# configure is halted prematurely.
270
271# used to trigger exit before creation of output
272all_reqs_ok="true"
273
274# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
275# of created binary, will fail.
276if test "${quiet_nan}" = "no" ; then
277  all_reqs_ok="false"
278  AC_MSG_WARN([
279  Support for quiet NAN required.
280  Yat will not work on this system!])
281fi
282
283# No support for infinity is fatal -- sub-sequent compilation, or execution
284# of created binary, will fail.
285if test "${has_infinity}" = "no" ; then
286  all_reqs_ok="false"
287  AC_MSG_WARN([
288  Support for infinity required.
289  Yat will not work on this system!])
290fi
291
292
293# Non-existing BLAS is fatal -- sub-sequent compilation will fail.
294if test "${cblas_found}" = "no" -a "${atlas_found}" = "no" -a "${gslcblas_found}" = "no"; then
295  all_reqs_ok="false"
296  AC_MSG_WARN([
297  cBLAS not found. The C implementation of Basic Linear Algebra
298  Subprograms (cBLAS) library cannot be found. Please make sure
299  cBLAS is installed.])
300fi
301if test "${atlas_found}" = "partial"; then
302  all_reqs_ok="false"
303  AC_MSG_WARN([
304  Partial ATLAS BLAS library found. Please repair your installation.])
305fi
306
307# Non-existing GSL is fatal -- sub-sequent compilation will fail.
308if test "${gsl_found}" = "no" ; then
309  all_reqs_ok="false"
310  if test "${gsl_version_check}" = "no" ; then
311  AC_MSG_WARN([
312  GSL found but not the required version. Please install
313  GSL version ${gsl_version} or later])
314  else
315  AC_MSG_WARN([
316  GSL not found. The GNU Scientific Library (GSL) library cannot be
317  found. Please make sure GSL is installed.])
318  fi
319fi
320
321# Too old Boost is fatal -- sub-sequent compilation will fail.
322if test "${boost_version_check}" != "yes" ; then
323  all_reqs_ok="false"
324  AC_MSG_WARN([
325  Boost found but not the required version. Please install
326  Boost version ${boost_version} or later])
327fi
328
329if (test "$all_reqs_ok" = "false") ; then
330  AC_MSG_FAILURE([
331  Some pre-requisites were not fulfilled, aborting configure.
332  Please consult the 'README' file for more information about what
333  is needed to compile yat and refer to above warning messages.
334  Needed files were NOT created.])
335fi
336
337# Reset flags
338APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, EXTRA_)
339APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, EXTRA_)
340APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, EXTRA_)
341
342# Create output.
343AC_OUTPUT
344
345# Some more messages.
346AC_MSG_NOTICE([])
347AC_MSG_NOTICE([ Ready to compile the yat library])
348AC_MSG_NOTICE([ The following flags and libraries will be used:])
349AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
350AC_MSG_NOTICE([  CPPFLAGS=\"$CPPFLAGS\"])
351AC_MSG_NOTICE([  EXTRA_CPPFLAGS=\"$EXTRA_CPPFLAGS\"])
352AC_MSG_NOTICE([  CXXFLAGS=\"$CXXFLAGS\"])
353AC_MSG_NOTICE([  EXTRA_CXXFLAGS=\"$EXTRA_CXXFLAGS\"])
354AC_MSG_NOTICE([  LDFLAGS=\"$LDFLAGS\"])
355AC_MSG_NOTICE([  EXTRA_LDFLAGS=\"$EXTRA_LDFLAGS\"])
356AC_MSG_NOTICE([  LIBS=\"$LIBS\"])
357AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
358AC_MSG_NOTICE([])
359if test "${gslcblas_found}" = "yes"; then
360AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
361AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
362AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
363AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
364AC_MSG_NOTICE([])
365fi
366AC_MSG_NOTICE([ Now type 'make ; make check'.])
Note: See TracBrowser for help on using the repository browser.