source: trunk/configure.ac @ 1439

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

adding call to AC_CONFIG_MACRO_DIR macro

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