source: trunk/configure.ac @ 2030

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

adding project url

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 13.5 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 2030 2009-08-19 01:03: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# 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],,[http://dev.thep.lu.se/yat])
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                 [AC_MSG_WARN([doxygen 1.5.8 detected - latex output turned off])
102                  dx_enable_latex=no])])
103fi
104
105# we need latex output to generate dvi, ps, and pdf
106AS_IF([test $dx_enable_latex = yes],
107  [dx_enable_pdf=yes
108   ACLTX_PROG_PDFLATEX([dx_enable_pdf=no])
109   ACLTX_PROG_MAKEINDEX([dx_enable_pdf=no])
110   dx_enable_dvi=yes
111   ACLTX_PROG_LATEX([dx_enable_dvi=no])
112   # ps needs dvi
113   dx_enable_ps=$dx_enable_dvi
114   ACLTX_PROG_DVIPS([dx_enable_ps=no])
115  ]
116)
117
118AC_SUBST(have_doxygen)
119AM_CONDITIONAL([DX_ENABLE_HTML], [test x$have_doxygen = xyes])
120AM_CONDITIONAL([DX_ENABLE_LATEX], [test x$dx_enable_latex = xyes])
121AM_CONDITIONAL([DX_ENABLE_DVI], [test x$dx_enable_dvi = xyes])
122AM_CONDITIONAL([DX_ENABLE_PS], [test x$dx_enable_ps = xyes])
123AM_CONDITIONAL([DX_ENABLE_PDF], [test x$dx_enable_pdf = xyes])
124AC_CONFIG_FILES([test/documentation_test.sh],
125                [chmod +x test/documentation_test.sh])
126
127# Save user-defined environment settings for later restoration
128APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
129APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
130APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
131APR_SAVE_THE_ENVIRONMENT(LIBS)
132
133# Checks for libraries.
134AC_MSG_NOTICE([checking for libraries])
135AC_CHECK_LIBM
136
137# find library implementing BLAS C API, or use gslcblas
138YAT_LIB_CBLAS([YAT_CBLAS_LIB=$CBLAS_LIB], [YAT_CBLAS_LIB=-lgslcblas])
139
140# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
141# Including AX_PATH_GSL macro from gsl.m4 distributed by GSL
142gsl_version="1.8"
143AC_SUBST(gsl_version)
144gsl_ok=yes
145YAT_CHECK_GSL([$gsl_version],[gsl_ok=yes],[gsl_ok=no])
146
147# Boost http://www.boost.org
148boost_version=1.33
149AC_SUBST(boost_version)
150AX_BOOST_BASE(["$boost_version"])
151boost_version_check=$succeeded;
152YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS])
153
154#support for large files
155AC_SYS_LARGEFILE
156if test "$enable_largefile" = "no"; then
157  AC_DEFINE([YAT_LFS_DISABLED], 1,
158            [defined to 1 if large file support is disabled])
159fi
160
161# we use prefix INTERNAL_ for variables that are solely needed for
162# building yat, i.e., they are not needed for a user of yat and are
163# not propagated to yat-config or yat.m4.
164YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wall -pedantic])
165YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DHAVE_INLINE=1])
166AC_ARG_ENABLE([debug],
167  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
168if test "${enable_debug}" = "yes" ; then
169  YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DYAT_DEBUG=1])
170  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-g -O])
171else
172  YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DGSL_RANGE_CHECK_OFF -DNDEBUG])
173  YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-O3])
174fi
175
176AC_ARG_ENABLE([svn-support],
177              [AS_HELP_STRING([--enable-svn-support],
178                              [enable svn support - used by yat maintainer])])
179
180if test "x$enable_svn-support" = "xyes"; then
181  svn_error_msg="svn support cannot be enabled:"
182  AS_IF([test "x$MD5" = "xno"],
183        [AC_MSG_ERROR([$svn_error_msg tool to create md5 file not found])])
184
185  AC_CHECK_FILE([$srcdir/.svn], ,
186                AC_MSG_ERROR([$svn_error_msg `$srcdir' is not an svn wc.]))
187fi
188AM_CONDITIONAL([ENABLE_SVN_SUPPORT], [test "x$enable_svn_support" = "xyes"])
189
190
191# check for quiet_NaN support in OS
192# Check at run-time, but if we are cross-compiling fall back on a
193# compilation test
194AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true])
195AC_RUN_IFELSE(
196  [AC_LANG_PROGRAM(
197    [@%:@include <limits>],
198    [return !std::numeric_limits<double>::has_quiet_NaN])],
199  [quiet_nan=yes
200   AC_MSG_RESULT($quiet_nan)],
201  [quiet_nan=no
202   AC_MSG_RESULT($quiet_nan)],
203  # if we are cross-compiling fall back on compilation test
204  [AC_MSG_RESULT(cross-compiling)
205   AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()])
206    AC_COMPILE_IFELSE(
207     [AC_LANG_PROGRAM(
208        [@%:@include <limits>
209         extern void f(double);],
210        [f(std::numeric_limits<double>::quiet_NaN())])],
211     [quiet_nan=yes],
212     [quiet_nan=no])
213   AC_MSG_RESULT($quiet_nan)])
214# Check for infinity support for doubles in OS
215# Check at run-time, but if we are cross-compiling fall back on a
216# compilation test
217AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true])
218AC_RUN_IFELSE(
219  [AC_LANG_PROGRAM(
220    [@%:@include <limits>],
221    [return !std::numeric_limits<double>::has_infinity])],
222  [has_infinity=yes
223   AC_MSG_RESULT($has_infinity)],
224  [has_infinity=no
225   AC_MSG_RESULT($has_infinity)],
226  # if we are cross-compiling fall back on compilation test
227  [AC_MSG_RESULT(cross-compiling)
228   AC_MSG_CHECKING([for std::numeric_limits<>::infinity()])
229    AC_COMPILE_IFELSE(
230     [AC_LANG_PROGRAM(
231        [@%:@include <limits>
232         extern void f(double);],
233        [f(std::numeric_limits<double>::infinity())])],
234     [has_infinity=yes],
235     [has_infinity=no])
236   AC_MSG_RESULT($has_infinity)])
237
238AC_MSG_CHECKING([g++ deprecation attribute])
239AC_COMPILE_IFELSE(
240   [AC_LANG_PROGRAM([[void f() __attribute__ ((deprecated));]],)], 
241   [AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1],
242              [Define if compiler supports deprecated attribute, as in g++ 4.0])
243    AC_MSG_RESULT([yes])],
244   [AC_MSG_RESULT([no])] )
245
246AC_MSG_CHECKING([if std::multiset::iterator is mutable])
247AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <set>
248                                     @%:@include <vector>]],
249                                   [[std::set<std::vector<double> > s;
250                                     std::vector<double> v;
251                                     s.insert(v);
252                                     s.begin()->reserve(100);
253                                   ]])],
254                  [AC_DEFINE([MULTISET_ITERATOR_IS_MUTABLE], [1],
255                             [Define if std::multiset::iterator is mutable])
256                   AC_MSG_RESULT([yes])
257                  ],
258                  [AC_MSG_RESULT([no])] )
259
260# yat specific settings
261YAT_LIBNAME="yat"
262YAT_LIB_LOCATION="yat"
263AC_SUBST(YAT_LIBNAME)
264AC_SUBST(YAT_LIB_LOCATION)
265
266#doxygen stuff
267DX_HTML_OUTPUT=html
268DX_LATEX_OUTPUT=latex
269AC_SUBST(DX_HTML_OUTPUT)
270AC_SUBST(DX_LATEX_OUTPUT)
271
272
273AC_CONFIG_FILES([test/create_yathello.sh], [chmod +x test/create_yathello.sh])
274AC_CONFIG_FILES([Makefile
275     build_support/Makefile
276     doc/Makefile
277     doc/doxygen.config
278     doc/first_page.doxygen
279     m4/Makefile
280     test/Makefile
281     test/common_defs.sh
282     test/environment.h
283     test/data/Makefile
284     yat/Makefile
285     yat/classifier/Makefile
286     yat/normalizer/Makefile
287     yat/random/Makefile
288     yat/regression/Makefile
289     yat/statistics/Makefile
290     yat/utility/version.h
291     yat/utility/Makefile])
292
293AC_CONFIG_HEADER([yat/utility/config_public.h])
294
295# Print failure status information about selected items, and exit if
296# fatal errors were encountered. No output will be created if
297# configure is halted prematurely.
298
299# used to trigger exit before creation of output
300all_reqs_ok="true"
301
302# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
303# of created binary, will fail.
304if test "${quiet_nan}" = "no" ; then
305  all_reqs_ok="false"
306  AC_MSG_WARN([
307  Support for quiet NAN required.
308  Yat will not work on this system!])
309fi
310
311# No support for infinity is fatal -- sub-sequent compilation, or execution
312# of created binary, will fail.
313if test "${has_infinity}" = "no" ; then
314  all_reqs_ok="false"
315  AC_MSG_WARN([
316  Support for infinity required.
317  Yat will not work on this system!])
318fi
319
320
321# Non-existing GSL is fatal -- sub-sequent compilation will fail.
322if test "x$gsl_ok" != "xyes" ; then
323  all_reqs_ok="false"
324  AC_MSG_WARN([
325  GSL $gsl_version (or newer) not found. The GNU Scientific Library
326  (GSL) library cannot be found. Please make sure GSL is
327  installed. Please refer to warnings above for more details])
328fi
329
330if test "x$want_boost" = "xyes"; then
331# Too old Boost is fatal -- sub-sequent compilation will fail.
332if test "${boost_version_check}" != "yes" ; then
333  all_reqs_ok="false"
334  AC_MSG_WARN([
335  Boost found but not the required version. Please install
336  Boost version ${boost_version} or later])
337fi
338fi
339
340if (test "$all_reqs_ok" = "false") ; then
341  AC_MSG_FAILURE([
342  Some pre-requisites were not fulfilled, aborting configure.
343  Please consult the 'README' file for more information about what
344  is needed to compile yat and refer to above warning messages.
345  Needed files were NOT created.])
346fi
347
348# Reset flags
349APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_)
350APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, YAT_)
351APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, YAT_)
352APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_)
353
354YAT_PRIMARY_LIBS=-lgsl
355YAT_LIBS="$YAT_PRIMARY_LIBS $YAT_CBLAS_LIB $LIBM"
356AC_SUBST(YAT_PRIMARY_LIBS)
357AC_SUBST(YAT_LIBS)
358AC_SUBST(YAT_CBLAS_LIB)
359
360# set and AC_SUBST variables that are interpreted by Automake
361AM_CPPFLAGS="-I\$(top_srcdir) $INTERNAL_CPPFLAGS $YAT_CPPFLAGS"
362AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS"
363AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS"
364
365AC_SUBST(AM_CPPFLAGS)
366AC_SUBST(AM_CXXFLAGS)
367AC_SUBST(AM_LDFLAGS)
368
369
370# Create output.
371AC_OUTPUT
372
373# Some more messages.
374AC_MSG_NOTICE([])
375AC_MSG_NOTICE([ Ready to compile the yat library])
376AS_IF([test x$have_doxygen = xyes],
377  [AC_MSG_NOTICE([ Documentation will be generated in the following formats:])
378   dox_formats="   html";
379   AS_IF([test x$dx_enable_pdf = xyes], [dox_formats="$dox_formats pdf"])
380   AS_IF([test x$dx_enable_ps = xyes],  [dox_formats="$dox_formats ps"])
381   AS_IF([test x$dx_enable_dvi = xyes], [dox_formats="$dox_formats dvi"])
382   AC_MSG_NOTICE([$dox_formats])
383  ],
384  [AC_MSG_NOTICE([Generation of documentation is disabled])
385   AC_MSG_NOTICE([doxygen could not be found])
386  ])
387AC_MSG_NOTICE()
388AC_MSG_NOTICE([ The following flags and libraries will be used:])
389AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
390AC_MSG_NOTICE([  CPPFLAGS=$CPPFLAGS])
391AC_MSG_NOTICE([  AM_CPPFLAGS=$AM_CPPFLAGS])
392AC_MSG_NOTICE([  CXXFLAGS=$CXXFLAGS])
393AC_MSG_NOTICE([  AM_CXXFLAGS=$AM_CXXFLAGS])
394AC_MSG_NOTICE([  LDFLAGS=$LDFLAGS])
395AC_MSG_NOTICE([  AM_LDFLAGS=$AM_LDFLAGS])
396AC_MSG_NOTICE([  LIBS=$LIBS])
397AC_MSG_NOTICE([  YAT_LIBS=$YAT_LIBS])
398AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
399AC_MSG_NOTICE([])
400if test "x$YAT_CBLAS_LIB" = "x-lgslcblas"; then
401AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
402AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
403AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
404AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
405AC_MSG_NOTICE([])
406fi
407AC_MSG_NOTICE([ Now type 'make && make check'.])
Note: See TracBrowser for help on using the repository browser.