source: trunk/configure.ac @ 1678

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

put back svn_error_msg that was accidently removed in r1657

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 14.0 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 1678 2008-12-24 18:31:18Z 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 3 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 yat. If not, see <http://www.gnu.org/licenses/>.
24#
25# If you grabbed the source from the subversion repository you should,
26# at top-level, execute:
27#     ./bootstrap
28# To push subsequent changes of this file into the build scripts you
29# must issue:
30#     autoreconf
31
32m4_include([build_support/version.m4])
33AC_INIT([yat],[YAT_VERSION],[jari@thep.lu.se])
34AC_PREREQ(2.60)
35AC_CONFIG_SRCDIR([yat/utility/Matrix.h])
36AC_CONFIG_AUX_DIR([autotools])
37dnl arg below should be the same as in Makefile.am
38AC_CONFIG_MACRO_DIR([build_support])
39AC_PREFIX_DEFAULT([/usr/local])
40
41AC_SUBST([YAT_LT_VERSION], [YAT_LT_VERSION_INFO])
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([1.10 std-options])
49
50# Set default programming language
51AC_LANG(C++)
52
53# propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS
54for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do
55  eval isset=\${$var+set}
56  if test "$isset" = 'set' ; then
57    eval val=$`echo $var`
58    DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' "
59  fi
60done
61AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
62
63# Let user overide default CXXFLAGS
64if test "${CXXFLAGS+set}" != set; then
65  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
66fi
67# Checks for programs.
68AC_PROG_CXX
69AC_PROG_INSTALL
70AC_PROG_SED
71
72AC_MSG_NOTICE(dnl
73[checking whether tools for generating documentation are available])
74
75have_dox_tools="yes"
76AC_PATH_PROG([DOXYGEN], [doxygen], [no])
77if test "$DOXYGEN" = "no"; then
78   AC_MSG_WARN([unable to find doxygen application])
79   have_dox_tools=no
80else
81   doxygen_min_version=1.5
82   AC_MSG_CHECKING([if doxygen is at least $doxygen_min_version])
83   doxygen_version=`$DOXYGEN --version`
84   AX_COMPARE_VERSION([$doxygen_version], [ge], [$doxygen_min_version], ,
85                      [have_dox_tools=no])
86   AC_MSG_RESULT([$doxygen_version])
87fi
88AC_CHECK_PROG([have_epstopdf], [epstopdf], [yes], [no])
89if test "$have_epstopdf" != "yes"; then
90   AC_MSG_WARN([unable to find epstopdf application])
91   have_dox_tools=no
92fi
93AC_CHECK_PROG([have_latex], [latex], [yes], [no])
94if test "$have_latex" != "yes"; then
95   AC_MSG_WARN([unable to find latex application])
96fi
97AC_CHECK_PROG([have_makeindex], [makeindex], [yes], [no])
98if test "$have_makeindex" != "yes"; then
99   AC_MSG_WARN([unable to find makeindex application])
100   have_dox_tools=no
101fi
102AC_CHECK_PROG([have_pdflatex], [pdflatex], [yes], [no])
103if test "$have_pdflatex" != "yes"; then
104   AC_MSG_WARN([unable to find pdflatex application])
105   have_dox_tools=no
106fi
107
108AC_SUBST(have_dox_tools)
109AM_CONDITIONAL(HAVE_DOXYGEN, test "$have_dox_tools" = "yes")
110AC_CONFIG_FILES([test/documentation_test.sh],
111                [chmod +x test/documentation_test.sh])
112
113# Save user-defined environment settings for later restoration
114APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
115APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
116APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
117
118# Checks for libraries.
119AC_MSG_NOTICE([checking for libraries])
120AC_CHECK_LIB(m,main)
121# searching for cblas. Priority 1) find a cblas library, 2) find ATLAS
122# generated cblas, and 3) fall back to GSL cblas implementation. If
123# partial ATLAS is detected the configure script fails.
124cblas_found="no"  # cblas_found may get values yes or no
125# atlas_found may get values yes, no, or partial. In some cases
126# partial atlas may be installed
127atlas_found="no"
128gslcblas_found="no" # gslcblas_found may get values yes or no
129AC_SEARCH_LIBS(cblas_sdsdot,cblas,cblas_found="yes",
130  AC_SEARCH_LIBS(ATL_sdsdot,atlas,
131    AC_SEARCH_LIBS(cblas_sdsdot,cblas,atlas_found="yes",
132                   atlas_found="partial",-m64),
133      AC_SEARCH_LIBS(cblas_dswap,gslcblas,gslcblas_found="yes"),-m64),)
134# CBLAS used in test of GSL
135gsl_cblas_lib=-lgslcblas
136if test ${cblas_found} = "yes"; then
137  gsl_cblas_lib=-lcblas
138fi
139if test ${atlas_found} = "yes"; then
140  YAT_CXX_ADD_FLAG([CXXFLAGS], [-m64])
141  YAT_LD_ADD_FLAG([LDFLAGS], [-m64])
142  gsl_cblas_lib=-latlas
143fi
144export GSL_CBLAS_LIB=${gsl_cblas_lib}
145
146# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
147# Including AX_PATH_GSL macro from gsl.m4 distributed by GSL
148gsl_found="no"
149gsl_version="1.8"
150AC_SUBST(gsl_version)
151AX_PATH_GSL(${gsl_version},gsl_found="yes",gsl_version_check="no")
152if test "$gsl_found" = "yes"; then
153   LIBS="-lgsl $LIBS"
154   # grep words starting with '-L' in other words LDFLAGS
155   for i in $GSL_LIBS; do
156     if test ${i:0:2} = "-L"; then
157       YAT_LD_ADD_FLAG([LDFLAGS], [$i])
158     fi
159   done
160fi
161
162# Boost http://www.boost.org
163boost_version=1.33
164AC_SUBST(boost_version)
165AX_BOOST_BASE("$boost_version")
166boost_version_check=$succeeded;
167YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS])
168
169# Checks for library functions.
170AC_PROG_LIBTOOL
171
172#support for large files
173AC_SYS_LARGEFILE
174if test "$enable_largefile" = "no"; then
175  AC_DEFINE([YAT_LFS_DISABLED], 1,
176            [defined to 1 if large file support is disabled])
177fi
178
179# we use AM_* for variables that are solely needed for building yat,
180# i.e., they are not needed for a user of yat and are not propagated
181# to yat-config or yat.m4.
182YAT_CXX_ADD_FLAG([AM_CXXFLAGS], [-Wall])
183YAT_CXX_ADD_FLAG([AM_CXXFLAGS], [-pedantic])
184YAT_CPP_ADD_FLAG([CPPFLAGS], [-DHAVE_INLINE=1])
185AC_ARG_ENABLE([debug],
186  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
187if test "${enable_debug}" = "yes" ; then
188  YAT_CPP_ADD_FLAG([AM_CPPFLAGS], [-DYAT_DEBUG=1])
189  YAT_CXX_ADD_FLAG([AM_CXXFLAGS], [-g])
190  YAT_CXX_ADD_FLAG([AM_CXXFLAGS], [-O])
191else
192  YAT_CPP_ADD_FLAG([CPPFLAGS], [-DGSL_RANGE_CHECK_OFF])
193  YAT_CPP_ADD_FLAG([AM_CPPFLAGS], [-DNDEBUG])
194  YAT_CXX_ADD_FLAG([AM_CXXFLAGS], [-O3])
195fi
196
197# enable target svn-clean
198AC_ARG_ENABLE([svn-support],
199   [AS_HELP_STRING([--enable-svn-support],
200                   [enable svn support - used by yat maintainer])],
201   [enable_svn_support=yes])
202if test "x$enable_svn_support" = "xyes"; then
203  svn_error_msg="svn support cannot be enabled:"
204  AC_CHECK_FILE([$srcdir/.svn], ,
205                AC_MSG_ERROR([$svn_error_msg `$srcdir' is not an svn wc.]))
206  AC_PATH_PROG([PERL], [perl], [no])
207  if test "x$PERL" = "xno"; then
208    AC_MSG_ERROR([$svn_error_msg perl executable not found.])
209  fi
210  AC_PROG_PERL_MODULES([strict], ,
211         [AC_MSG_ERROR([$svn_error_msg missing some perl module.])])
212  AC_PROG_PERL_MODULES([Cwd], ,
213         [AC_MSG_ERROR([$svn_error_msg missing some perl module.])])
214  AC_PROG_PERL_MODULES([File::Path], ,
215         [AC_MSG_ERROR([$svn_error_msg missing some perl module.])])
216  AC_PROG_PERL_MODULES([Getopt::Long], ,
217         [AC_MSG_ERROR([$svn_error_msg missing some perl module.])])
218  AC_PROG_PERL_MODULES([Pod::Usage], ,
219         [AC_MSG_ERROR([$svn_error_msg missing some perl module.])])
220
221fi
222AM_CONDITIONAL([ENABLE_SVN_SUPPORT], [test "x$enable_svn_support" = "xyes"])
223
224
225# check for quiet_NaN support in OS
226# Check at run-time, but if we are cross-compiling fall back on a
227# compilation test
228AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true])
229AC_RUN_IFELSE(
230  [AC_LANG_PROGRAM(
231    [@%:@include <limits>],
232    [return !std::numeric_limits<double>::has_quiet_NaN])],
233  [quiet_nan=yes
234   AC_MSG_RESULT($quiet_nan)],
235  [quiet_nan=no
236   AC_MSG_RESULT($quiet_nan)],
237  # if we are cross-compiling fall back on compilation test
238  [AC_MSG_RESULT(cross-compiling)
239   AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()])
240    AC_COMPILE_IFELSE(
241     [AC_LANG_PROGRAM(
242        [@%:@include <limits>
243         extern void f(double);],
244        [f(std::numeric_limits<double>::quiet_NaN())])],
245     [quiet_nan=yes],
246     [quiet_nan=no])
247   AC_MSG_RESULT($quiet_nan)])
248# Check for infinity support for doubles in OS
249# Check at run-time, but if we are cross-compiling fall back on a
250# compilation test
251AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true])
252AC_RUN_IFELSE(
253  [AC_LANG_PROGRAM(
254    [@%:@include <limits>],
255    [return !std::numeric_limits<double>::has_infinity])],
256  [has_infinity=yes
257   AC_MSG_RESULT($has_infinity)],
258  [has_infinity=no
259   AC_MSG_RESULT($has_infinity)],
260  # if we are cross-compiling fall back on compilation test
261  [AC_MSG_RESULT(cross-compiling)
262   AC_MSG_CHECKING([for std::numeric_limits<>::infinity()])
263    AC_COMPILE_IFELSE(
264     [AC_LANG_PROGRAM(
265        [@%:@include <limits>
266         extern void f(double);],
267        [f(std::numeric_limits<double>::infinity())])],
268     [has_infinity=yes],
269     [has_infinity=no])
270   AC_MSG_RESULT($has_infinity)])
271
272AC_MSG_CHECKING([g++ deprecation attribute])
273AC_TRY_COMPILE([void f() __attribute__ ((deprecated));], [],
274               AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1],
275          [Define if compiler supports deprecated attribute, as in g++ 4.0])
276               AC_MSG_RESULT([yes]),
277               AC_MSG_RESULT([no]) )
278
279
280# yat specific settings
281YAT_LIBNAME="yat"
282YAT_LIB_LOCATION="yat"
283AC_SUBST(YAT_LIBNAME)
284AC_SUBST(YAT_LIB)
285AC_SUBST(YAT_LIB_LOCATION)
286
287#doxygen stuff
288DX_HTML_OUTPUT=html
289DX_LATEX_OUTPUT=latex
290AC_SUBST(DX_HTML_OUTPUT)
291AC_SUBST(DX_LATEX_OUTPUT)
292
293
294AC_CONFIG_FILES([Makefile
295     build_support/Makefile
296     doc/Makefile
297     doc/doxygen.config
298     doc/first_page.doxygen
299     test/Makefile
300     test/environment.h
301     test/data/Makefile
302     yat/Makefile
303     yat/classifier/Makefile
304     yat/normalizer/Makefile
305     yat/random/Makefile
306     yat/regression/Makefile
307     yat/statistics/Makefile
308     yat/utility/version.h
309     yat/utility/Makefile])
310
311AC_CONFIG_HEADER([yat/utility/config_public.h])
312
313# warning about missing doxygen
314if (test "$have_dox_tools" != "yes") ; then
315  AC_MSG_WARN([
316  Some pre-requisites for generating documentation were not
317  fulfilled. The build will not create any documentation.
318  Please consult the 'README' file for more information about
319  what is needed to generate documentation and refer to above
320  warning messages.
321  ])
322fi
323
324# Print failure status information about selected items, and exit if
325# fatal errors were encountered. No output will be created if
326# configure is halted prematurely.
327
328# used to trigger exit before creation of output
329all_reqs_ok="true"
330
331# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
332# of created binary, will fail.
333if test "${quiet_nan}" = "no" ; then
334  all_reqs_ok="false"
335  AC_MSG_WARN([
336  Support for quiet NAN required.
337  Yat will not work on this system!])
338fi
339
340# No support for infinity is fatal -- sub-sequent compilation, or execution
341# of created binary, will fail.
342if test "${has_infinity}" = "no" ; then
343  all_reqs_ok="false"
344  AC_MSG_WARN([
345  Support for infinity required.
346  Yat will not work on this system!])
347fi
348
349
350# Non-existing BLAS is fatal -- sub-sequent compilation will fail.
351if test "${cblas_found}" = "no" -a "${atlas_found}" = "no" -a "${gslcblas_found}" = "no"; then
352  all_reqs_ok="false"
353  AC_MSG_WARN([
354  cBLAS not found. The C implementation of Basic Linear Algebra
355  Subprograms (cBLAS) library cannot be found. Please make sure
356  cBLAS is installed.])
357fi
358if test "${atlas_found}" = "partial"; then
359  all_reqs_ok="false"
360  AC_MSG_WARN([
361  Partial ATLAS BLAS library found. Please repair your installation.])
362fi
363
364# Non-existing GSL is fatal -- sub-sequent compilation will fail.
365if test "${gsl_found}" = "no" ; then
366  all_reqs_ok="false"
367  if test "${gsl_version_check}" = "no" ; then
368  AC_MSG_WARN([
369  GSL found but not the required version. Please install
370  GSL version ${gsl_version} or later])
371  else
372  AC_MSG_WARN([
373  GSL not found. The GNU Scientific Library (GSL) library cannot be
374  found. Please make sure GSL is installed.])
375  fi
376fi
377
378# Too old Boost is fatal -- sub-sequent compilation will fail.
379if test "${boost_version_check}" != "yes" ; then
380  all_reqs_ok="false"
381  AC_MSG_WARN([
382  Boost found but not the required version. Please install
383  Boost version ${boost_version} or later])
384fi
385
386if (test "$all_reqs_ok" = "false") ; then
387  AC_MSG_FAILURE([
388  Some pre-requisites were not fulfilled, aborting configure.
389  Please consult the 'README' file for more information about what
390  is needed to compile yat and refer to above warning messages.
391  Needed files were NOT created.])
392fi
393
394# Reset flags
395APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, EXTRA_)
396APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, EXTRA_)
397APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, EXTRA_)
398
399AM_CPPFLAGS="-I\$(top_srcdir) $AM_CPPFLAGS $EXTRA_CPPFLAGS"
400AM_CXXFLAGS="$AM_CXXFLAGS $EXTRA_CXXFLAGS"
401AM_LDFLAGS="$AM_LDFLAGS $EXTRA_LDFLAGS"
402
403AC_SUBST(AM_CPPFLAGS)
404AC_SUBST(AM_CXXFLAGS)
405AC_SUBST(AM_LDFLAGS)
406
407# Create output.
408AC_OUTPUT
409
410# Some more messages.
411AC_MSG_NOTICE([])
412AC_MSG_NOTICE([ Ready to compile the yat library])
413AC_MSG_NOTICE([ The following flags and libraries will be used:])
414AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
415AC_MSG_NOTICE([  CPPFLAGS=\"$CPPFLAGS\"])
416AC_MSG_NOTICE([  AM_CPPFLAGS=\"$AM_CPPFLAGS\"])
417AC_MSG_NOTICE([  CXXFLAGS=\"$CXXFLAGS\"])
418AC_MSG_NOTICE([  AM_CXXFLAGS=\"$AM_CXXFLAGS\"])
419AC_MSG_NOTICE([  LDFLAGS=\"$LDFLAGS\"])
420AC_MSG_NOTICE([  AM_LDFLAGS=\"$AM_LDFLAGS\"])
421AC_MSG_NOTICE([  LIBS=\"$LIBS\"])
422AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
423AC_MSG_NOTICE([])
424if test "${gslcblas_found}" = "yes"; then
425AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
426AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
427AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
428AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
429AC_MSG_NOTICE([])
430fi
431AC_MSG_NOTICE([ Now type 'make ; make check'.])
Note: See TracBrowser for help on using the repository browser.