source: branches/0.5-stable/configure.ac @ 2091

Last change on this file since 2091 was 2091, checked in by Peter, 12 years ago

adding test for pspicture.ps; when absent turn off target for yat.ps document. fixes #569.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 15.7 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 2091 2009-10-22 03:11:25Z 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# Copyright (C) 2009 Jari Häkkinen, Peter Johansson
10#
11# This file is part of the yat library, http://dev.thep.lu.se/yat
12#
13# The yat library is free software; you can redistribute it
14# and/or modify it under the terms of the GNU General Public License as
15# published by the Free Software Foundation; either version 3 of the
16# License, or (at your option) any later version.
17#
18# The yat library is distributed in the hope that it will be useful,
19# but WITHOUT ANY WARRANTY; without even the implied warranty of
20# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21# General Public License for more details.
22#
23# You should have received a copy of the GNU General Public License
24# along with yat. If not, see <http://www.gnu.org/licenses/>.
25#
26# If you grabbed the source from the subversion repository you should,
27# at top-level, execute:
28#     ./bootstrap
29# To push subsequent changes of this file into the build scripts you
30# must issue:
31#     autoreconf
32
33m4_include([m4/version.m4])
34AC_INIT([yat],[YAT_VERSION],[jari@thep.lu.se])
35AC_PREREQ(2.61)
36AC_CONFIG_SRCDIR([yat/utility/Matrix.h])
37AC_CONFIG_AUX_DIR([autotools])
38dnl arg below should be the same as in Makefile.am
39AC_CONFIG_MACRO_DIR([m4])
40AC_PREFIX_DEFAULT([/usr/local])
41
42AC_SUBST([YAT_LT_VERSION], [YAT_LT_VERSION_INFO])
43AC_SUBST([YAT_MAJOR_VERSION], [MAJOR_VERSION])
44AC_SUBST([YAT_MINOR_VERSION], [MINOR_VERSION])
45AC_SUBST([YAT_PATCH_VERSION], [PATCH_VERSION])
46AC_SUBST([YAT_DEV_BUILD], [DEV_BUILD])
47
48AC_CONFIG_HEADER([config.h])
49AM_INIT_AUTOMAKE([1.10 std-options])
50
51# Set default programming language
52AC_LANG(C++)
53
54# propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS
55for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do
56  eval isset=\${$var+set}
57  if test "$isset" = 'set' ; then
58    eval val=$`echo $var`
59    DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' "
60  fi
61done
62AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
63
64# Let user overide default CXXFLAGS
65if test "${CXXFLAGS+set}" != set; then
66  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
67fi
68# Checks for programs.
69AC_PROG_CXX
70AC_PROG_INSTALL
71AC_PROG_SED
72AC_PROG_LIBTOOL
73# fall back to echo unless ECHO not already set (by libtool)
74AS_IF([test "x$ECHO" = x], [ECHO=echo])
75AC_SUBST(ECHO)
76
77AC_CHECK_PROGS([MD5], [md5sum md5 md5deep], [no])
78
79AC_MSG_NOTICE(dnl
80[checking whether tools for generating documentation are available])
81
82have_doxygen=no
83dx_enable_latex=no
84dx_enable_dvi=no
85dx_enable_ps=no
86dx_enable_pdf=no
87AC_PATH_PROG([DOXYGEN], [doxygen], [no])
88if test "$DOXYGEN" = "no"; then
89   AC_MSG_WARN([unable to find doxygen application])
90else
91   doxygen_min_version=1.5
92   AC_MSG_CHECKING([if doxygen is at least $doxygen_min_version])
93   doxygen_version=`$DOXYGEN --version`
94   AX_COMPARE_VERSION([$doxygen_version], [ge], [$doxygen_min_version],
95                      [have_doxygen=yes])
96   AC_MSG_RESULT([$doxygen_version])
97   dx_enable_latex=yes
98   # doxygen 1.5.8 has a bug for latex output and enums
99   AS_IF([test $have_doxygen = yes],
100         [AX_COMPARE_VERSION([$doxygen_version], [eq], [1.5.8],
101                             [dx_enable_latex=no])])
102fi
103
104# we need latex output to generate dvi, ps, and pdf
105AS_IF([test $dx_enable_latex = yes],
106  [dx_enable_pdf=yes
107   ACLTX_PROG_PDFLATEX([dx_enable_pdf=no])
108   ACLTX_PROG_MAKEINDEX([dx_enable_pdf=no])
109   dx_enable_dvi=yes
110   ACLTX_PROG_LATEX([dx_enable_dvi=no])
111   # ps needs dvi
112   dx_enable_ps=$dx_enable_dvi
113   ACLTX_PROG_DVIPS([dx_enable_ps=no])
114   AS_IF([test "x$dx_enable_ps" != xno], [
115     YAT_PROG_DVIPS_PSPICTURE([], [dx_enable_ps=no
116                                   AC_MSG_NOTICE([ps generation turned off])])
117   ])
118  ]
119)
120
121AC_SUBST(have_doxygen)
122AM_CONDITIONAL([DX_ENABLE_HTML], [test x$have_doxygen = xyes])
123AM_CONDITIONAL([DX_ENABLE_LATEX], [test x$dx_enable_latex = xyes])
124AM_CONDITIONAL([DX_ENABLE_DVI], [test x$dx_enable_dvi = xyes])
125AM_CONDITIONAL([DX_ENABLE_PS], [test x$dx_enable_ps = xyes])
126AM_CONDITIONAL([DX_ENABLE_PDF], [test x$dx_enable_pdf = xyes])
127AC_CONFIG_FILES([test/documentation_test.sh],
128                [chmod +x test/documentation_test.sh])
129
130# check for quiet_NaN support in OS
131# Check at run-time, but if we are cross-compiling fall back on a
132# compilation test
133AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true])
134AC_RUN_IFELSE(
135  [AC_LANG_PROGRAM(
136    [@%:@include <limits>],
137    [return !std::numeric_limits<double>::has_quiet_NaN])],
138  [quiet_nan=yes
139   AC_MSG_RESULT($quiet_nan)],
140  [quiet_nan=no
141   AC_MSG_RESULT($quiet_nan)],
142  # if we are cross-compiling fall back on compilation test
143  [AC_MSG_RESULT(cross-compiling)
144   AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()])
145    AC_COMPILE_IFELSE(
146     [AC_LANG_PROGRAM(
147        [@%:@include <limits>
148         extern void f(double);],
149        [f(std::numeric_limits<double>::quiet_NaN())])],
150     [quiet_nan=yes],
151     [quiet_nan=no])
152   AC_MSG_RESULT($quiet_nan)])
153# Check for infinity support for doubles in OS
154# Check at run-time, but if we are cross-compiling fall back on a
155# compilation test
156AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true])
157AC_RUN_IFELSE(
158  [AC_LANG_PROGRAM(
159    [@%:@include <limits>],
160    [return !std::numeric_limits<double>::has_infinity])],
161  [has_infinity=yes
162   AC_MSG_RESULT($has_infinity)],
163  [has_infinity=no
164   AC_MSG_RESULT($has_infinity)],
165  # if we are cross-compiling fall back on compilation test
166  [AC_MSG_RESULT(cross-compiling)
167   AC_MSG_CHECKING([for std::numeric_limits<>::infinity()])
168    AC_COMPILE_IFELSE(
169     [AC_LANG_PROGRAM(
170        [@%:@include <limits>
171         extern void f(double);],
172        [f(std::numeric_limits<double>::infinity())])],
173     [has_infinity=yes],
174     [has_infinity=no])
175   AC_MSG_RESULT($has_infinity)])
176
177AC_MSG_CHECKING([g++ deprecation attribute])
178AC_COMPILE_IFELSE(
179   [AC_LANG_PROGRAM([[void f() __attribute__ ((deprecated));]],)], 
180   [AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1],
181              [Define if compiler supports deprecated attribute, as in g++ 4.0])
182    AC_MSG_RESULT([yes])],
183   [AC_MSG_RESULT([no])] )
184
185AC_MSG_CHECKING([if std::multiset::iterator is mutable])
186AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <set>
187                                     @%:@include <vector>]],
188                                   [[std::set<std::vector<double> > s;
189                                     std::vector<double> v;
190                                     s.insert(v);
191                                     s.begin()->reserve(100);
192                                   ]])],
193                  [AC_DEFINE([MULTISET_ITERATOR_IS_MUTABLE], [1],
194                             [Define if std::multiset::iterator is mutable])
195                   AC_MSG_RESULT([yes])
196                  ],
197                  [AC_MSG_RESULT([no])] )
198
199# Save user-defined environment settings for later restoration
200APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
201APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
202APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
203
204# Checks for libraries.
205AC_MSG_NOTICE([checking for libraries])
206AC_CHECK_LIBM
207AS_IF([test "x$LIBM" != x], [LIBS="$LIBM $LIBS"])
208# searching for cblas. Priority 1) find a cblas library, 2) find ATLAS
209# generated cblas, and 3) fall back to GSL cblas implementation. If
210# partial ATLAS is detected the configure script fails.
211cblas_found="no"  # cblas_found may get values yes or no
212# atlas_found may get values yes, no, or partial. In some cases
213# partial atlas may be installed
214atlas_found="no"
215gslcblas_found="no" # gslcblas_found may get values yes or no
216AC_SEARCH_LIBS(cblas_sdsdot,cblas,cblas_found="yes",
217  AC_SEARCH_LIBS(ATL_sdsdot,atlas,
218    AC_SEARCH_LIBS(cblas_srot,cblas,atlas_found="yes",
219                   atlas_found="partial",-m64),
220      [gslcblas_found="yes"],-m64),)
221
222# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
223# Including AX_PATH_GSL macro from gsl.m4 distributed by GSL
224gsl_found="no"
225gsl_version="1.8"
226AC_SUBST(gsl_version)
227AX_PATH_GSL([${gsl_version}],[gsl_found="yes"],[gsl_version_check="no"])
228if test "$gsl_found" = "yes"; then
229   if test "x$gslcblas_found" = "xyes"; then
230     LIBS="-lgslcblas $LIBS";
231   fi
232   LIBS="-lgsl $LIBS"
233   # grep words starting with '-L' in other words LDFLAGS
234   for i in $GSL_LIBS; do
235       if test ${i:0:2} = "-L"; then
236           YAT_LD_ADD_FLAG([LDFLAGS], [$i])
237       fi
238   done
239   YAT_CPP_ADD_FLAG([CPPFLAGS], [`$GSL_CONFIG --cflags`])
240else
241   gslcblas="no";
242fi
243
244# Boost http://www.boost.org
245boost_version=1.33
246AC_SUBST(boost_version)
247AX_BOOST_BASE(["$boost_version"])
248boost_version_check=$succeeded;
249YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS])
250
251#support for large files
252AC_SYS_LARGEFILE
253if test "$enable_largefile" = "no"; then
254  AC_DEFINE([YAT_LFS_DISABLED], 1,
255            [defined to 1 if large file support is disabled])
256fi
257
258# we use AM_* for variables that are solely needed for building yat,
259# i.e., they are not needed for a user of yat and are not propagated
260# to yat-config or yat.m4.
261YAT_CXX_ADD_FLAG([AM_CXXFLAGS], [-Wall -pedantic])
262YAT_CPP_ADD_FLAG([AM_CPPFLAGS], [-DHAVE_INLINE=1])
263AC_ARG_ENABLE([debug],
264  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
265if test "${enable_debug}" = "yes" ; then
266  YAT_CPP_ADD_FLAG([AM_CPPFLAGS], [-DYAT_DEBUG=1])
267  YAT_CXX_ADD_FLAG([AM_CXXFLAGS], [-g -O])
268else
269  YAT_CPP_ADD_FLAG([AM_CPPFLAGS], [-DGSL_RANGE_CHECK_OFF -DNDEBUG])
270  YAT_CXX_ADD_FLAG([AM_CXXFLAGS], [-O3])
271fi
272
273# some versions of boost uses long long - turn off compiler warnings
274# with -Wno-long-long
275yat_save_CXXFLAGS=$CXXFLAGS
276# use -pedantic and friends in CXXFLAGS temporarily
277CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
278# turn warnings into errors
279YAT_CXX_ADD_FLAG([CXXFLAGS], [-Werror])
280AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
281  [
282    @%:@include <boost/iterator/transform_iterator.hpp>
283    @%:@include <cmath>
284    @%:@include <functional>
285    @%:@include <vector>
286  ],[
287      using namespace boost;
288      typedef std::pointer_to_unary_function<double, double> F;
289      std::vector<double> vec;
290      transform_iterator<F, std::vector<double>::iterator>
291        i(vec.begin(), std::ptr_fun(fabs));
292  ])],
293[],
294[YAT_CXX_ADD_FLAG([AM_CXXFLAGS], [-Wno-long-long])])
295# restore CXXFLAGS
296CXXFLAGS=$yat_save_CXXFLAGS
297
298AC_ARG_ENABLE([svn-support],
299              [AS_HELP_STRING([--enable-svn-support],
300                              [enable svn support - used by yat maintainer])])
301
302if test "x$enable_svn-support" = "xyes"; then
303  svn_error_msg="svn support cannot be enabled:"
304  AS_IF([test "x$MD5" = "xno"],
305        [AC_MSG_ERROR([$svn_error_msg tool to create md5 file not found])])
306
307  AC_CHECK_FILE([$srcdir/.svn], ,
308                AC_MSG_ERROR([$svn_error_msg `$srcdir' is not an svn wc.]))
309  AC_PATH_PROG([PERL], [perl], [no])
310  if test "x$PERL" = "xno"; then
311    AC_MSG_ERROR([$svn_error_msg perl executable not found.])
312  fi
313  AC_PROG_PERL_MODULES([strict Cwd File::Path Getopt::Long Pod::Usage], ,
314         [AC_MSG_ERROR([$svn_error_msg missing some perl module.])])
315fi
316AM_CONDITIONAL([ENABLE_SVN_SUPPORT], [test "x$enable_svn_support" = "xyes"])
317
318
319# yat specific settings
320YAT_LIBNAME="yat"
321YAT_LIB_LOCATION="yat"
322AC_SUBST(YAT_LIBNAME)
323AC_SUBST(YAT_LIB)
324AC_SUBST(YAT_LIB_LOCATION)
325
326#doxygen stuff
327DX_HTML_OUTPUT=html
328DX_LATEX_OUTPUT=latex
329AC_SUBST(DX_HTML_OUTPUT)
330AC_SUBST(DX_LATEX_OUTPUT)
331
332
333AC_CONFIG_FILES([test/create_yathello.sh], [chmod +x test/create_yathello.sh])
334AC_CONFIG_FILES([Makefile
335     build_support/Makefile
336     doc/Makefile
337     doc/doxygen.config
338     doc/first_page.doxygen
339     m4/Makefile
340     test/Makefile
341     test/environment.h
342     test/data/Makefile
343     yat/Makefile
344     yat/classifier/Makefile
345     yat/normalizer/Makefile
346     yat/random/Makefile
347     yat/regression/Makefile
348     yat/statistics/Makefile
349     yat/utility/version.h
350     yat/utility/Makefile])
351
352AC_CONFIG_HEADER([yat/utility/config_public.h])
353
354# Print failure status information about selected items, and exit if
355# fatal errors were encountered. No output will be created if
356# configure is halted prematurely.
357
358# used to trigger exit before creation of output
359all_reqs_ok="true"
360
361# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
362# of created binary, will fail.
363if test "${quiet_nan}" = "no" ; then
364  all_reqs_ok="false"
365  AC_MSG_WARN([
366  Support for quiet NAN required.
367  Yat will not work on this system!])
368fi
369
370# No support for infinity is fatal -- sub-sequent compilation, or execution
371# of created binary, will fail.
372if test "${has_infinity}" = "no" ; then
373  all_reqs_ok="false"
374  AC_MSG_WARN([
375  Support for infinity required.
376  Yat will not work on this system!])
377fi
378
379
380# Non-existing BLAS is fatal -- sub-sequent compilation will fail.
381if test "${cblas_found}" = "no" -a "${atlas_found}" = "no" -a "${gslcblas_found}" = "no"; then
382  all_reqs_ok="false"
383  AC_MSG_WARN([
384  cBLAS not found. The C implementation of Basic Linear Algebra
385  Subprograms (cBLAS) library cannot be found. Please make sure
386  cBLAS is installed.])
387fi
388if test "${atlas_found}" = "partial"; then
389  all_reqs_ok="false"
390  AC_MSG_WARN([
391  Partial ATLAS BLAS library found. Please repair your installation.])
392fi
393
394# Non-existing GSL is fatal -- sub-sequent compilation will fail.
395if test "${gsl_found}" = "no" ; then
396  all_reqs_ok="false"
397  if test "${gsl_version_check}" = "no" ; then
398  AC_MSG_WARN([
399  GSL found but not the required version. Please install
400  GSL version ${gsl_version} or later])
401  else
402  AC_MSG_WARN([
403  GSL not found. The GNU Scientific Library (GSL) library cannot be
404  found. Please make sure GSL is installed.])
405  fi
406fi
407
408# Too old Boost is fatal -- sub-sequent compilation will fail.
409if test "${boost_version_check}" != "yes" ; then
410  all_reqs_ok="false"
411  AC_MSG_WARN([
412  Boost found but not the required version. Please install
413  Boost version ${boost_version} or later])
414fi
415
416if (test "$all_reqs_ok" = "false") ; then
417  AC_MSG_FAILURE([
418  Some pre-requisites were not fulfilled, aborting configure.
419  Please consult the 'README' file for more information about what
420  is needed to compile yat and refer to above warning messages.
421  Needed files were NOT created.])
422fi
423
424# Reset flags
425APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, EXTRA_)
426APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, EXTRA_)
427APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, EXTRA_)
428
429AM_CPPFLAGS="-I\$(top_srcdir) $AM_CPPFLAGS $EXTRA_CPPFLAGS"
430AM_CXXFLAGS="$AM_CXXFLAGS $EXTRA_CXXFLAGS"
431AM_LDFLAGS="$AM_LDFLAGS $EXTRA_LDFLAGS"
432
433AC_SUBST(AM_CPPFLAGS)
434AC_SUBST(AM_CXXFLAGS)
435AC_SUBST(AM_LDFLAGS)
436
437# Create output.
438AC_OUTPUT
439
440# Some more messages.
441AC_MSG_NOTICE([])
442AC_MSG_NOTICE([ Ready to compile the yat library])
443AS_IF([test x$have_doxygen = xyes],
444  [AC_MSG_NOTICE([ Documentation will be generated in the following formats:])
445   AC_MSG_NOTICE([   html])
446   AS_IF([test x$dx_enable_pdf = xyes], [AC_MSG_NOTICE([   pdf])])
447   AS_IF([test x$dx_enable_ps = xyes],  [AC_MSG_NOTICE([   ps])])
448   AS_IF([test x$dx_enable_dvi = xyes], [AC_MSG_NOTICE([   dvi])])
449  ],
450  [AC_MSG_NOTICE([Generation of documentation is disabled])
451   AC_MSG_NOTICE([doxygen could not be found])
452  ])
453AC_MSG_NOTICE()
454AC_MSG_NOTICE([ The following flags and libraries will be used:])
455AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
456AC_MSG_NOTICE([  CPPFLAGS=$CPPFLAGS])
457AC_MSG_NOTICE([  AM_CPPFLAGS=$AM_CPPFLAGS])
458AC_MSG_NOTICE([  CXXFLAGS=$CXXFLAGS])
459AC_MSG_NOTICE([  AM_CXXFLAGS=$AM_CXXFLAGS])
460AC_MSG_NOTICE([  LDFLAGS=$LDFLAGS])
461AC_MSG_NOTICE([  AM_LDFLAGS=$AM_LDFLAGS])
462AC_MSG_NOTICE([  LIBS=$LIBS])
463AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
464AC_MSG_NOTICE([])
465if test "${gslcblas_found}" = "yes"; then
466AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
467AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
468AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
469AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
470AC_MSG_NOTICE([])
471fi
472AC_MSG_NOTICE([ Now type 'make && make check'.])
Note: See TracBrowser for help on using the repository browser.