source: trunk/configure.ac @ 1606

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

fixes #456. YAT_LT_VERSION was already used to I picked YAT_LT_VERSION_INFO intead. Also the declaration was split into current revision and age. Currently those are no AC_SUBSTed out to Makefiles though.

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