source: trunk/configure.ac @ 1457

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

fixes #426 - skipping test of LFS when configure option --disable-largefile is used.

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