1 | ## Process this file with autoconf to produce a configure script. |
---|
2 | ## |
---|
3 | ## $Id: configure.ac 2452 2011-03-29 11:23:08Z 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 | # Copyright (C) 2010, 2011 Peter Johansson |
---|
11 | # |
---|
12 | # This file is part of the yat library, http://dev.thep.lu.se/yat |
---|
13 | # |
---|
14 | # The yat library is free software; you can redistribute it |
---|
15 | # and/or modify it under the terms of the GNU General Public License as |
---|
16 | # published by the Free Software Foundation; either version 3 of the |
---|
17 | # License, or (at your option) any later version. |
---|
18 | # |
---|
19 | # The yat library is distributed in the hope that it will be useful, |
---|
20 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
21 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
22 | # General Public License for more details. |
---|
23 | # |
---|
24 | # You should have received a copy of the GNU General Public License |
---|
25 | # along with yat. If not, see <http://www.gnu.org/licenses/>. |
---|
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 | |
---|
34 | |
---|
35 | m4_include([m4/version.m4]) |
---|
36 | AC_INIT([yat],[YAT_VERSION__],[libyat-users@lists.sourceforge.net],, |
---|
37 | [http://dev.thep.lu.se/yat]) |
---|
38 | AC_PREREQ(2.63) |
---|
39 | AC_CONFIG_SRCDIR([yat/utility/Matrix.h]) |
---|
40 | AC_CONFIG_AUX_DIR([autotools]) |
---|
41 | dnl arg below should be the same as in Makefile.am |
---|
42 | AC_CONFIG_MACRO_DIR([m4]) |
---|
43 | AC_PREFIX_DEFAULT([/usr/local]) |
---|
44 | |
---|
45 | AC_SUBST([YAT_LT_VERSION], [YAT_LT_VERSION_INFO]) |
---|
46 | AC_SUBST([YAT_MAJOR_VERSION], [MAJOR_VERSION]) |
---|
47 | AC_SUBST([YAT_MINOR_VERSION], [MINOR_VERSION]) |
---|
48 | AC_SUBST([YAT_PATCH_VERSION], [PATCH_VERSION]) |
---|
49 | AC_SUBST([YAT_DEV_BUILD], [DEV_BUILD]) |
---|
50 | AC_DEFINE([YAT_VERSION], ["YAT_VERSION__"], [version]) |
---|
51 | AC_DEFINE([YAT_MAJOR_VERSION], [MAJOR_VERSION], [major version]) |
---|
52 | AC_DEFINE([YAT_MINOR_VERSION], [MINOR_VERSION], [minor version]) |
---|
53 | AC_DEFINE([YAT_PATCH_VERSION], [PATCH_VERSION], [patch version]) |
---|
54 | AC_DEFINE([YAT_DEV_BUILD], [DEV_BUILD], [Define to false if offical version]) |
---|
55 | |
---|
56 | AC_CONFIG_HEADERS([config.h]) |
---|
57 | AM_INIT_AUTOMAKE([1.11 std-options color-tests parallel-tests]) |
---|
58 | |
---|
59 | dnl The empty help-string for --with-gsl-prefix and |
---|
60 | dnl --with-gsl-exec-prefix creates an empty line in middle of help |
---|
61 | dnl output. This hacks move the line to above 'Optional Packages:', |
---|
62 | dnl which is prettier. |
---|
63 | dnl |
---|
64 | dnl FIXME: remove when we removed support for --with-gsl-prefix and |
---|
65 | dnl --with-gsl-exec-prefix |
---|
66 | m4_divert_once([HELP_WITH], []) |
---|
67 | |
---|
68 | # Set default programming language |
---|
69 | AC_LANG(C++) |
---|
70 | |
---|
71 | # propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS |
---|
72 | for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do |
---|
73 | eval isset=\${$var+set} |
---|
74 | if test "$isset" = 'set' ; then |
---|
75 | eval val=$`echo $var` |
---|
76 | DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' " |
---|
77 | fi |
---|
78 | done |
---|
79 | AC_SUBST(DISTCHECK_CONFIGURE_FLAGS) |
---|
80 | |
---|
81 | # Let user overide default CXXFLAGS |
---|
82 | if test "${CXXFLAGS+set}" != set; then |
---|
83 | CXXFLAGS="" # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX |
---|
84 | fi |
---|
85 | # Checks for programs. |
---|
86 | AC_PROG_CXX |
---|
87 | AC_PROG_SED |
---|
88 | AC_PROG_LIBTOOL |
---|
89 | |
---|
90 | AC_MSG_NOTICE(dnl |
---|
91 | [checking whether tools for generating documentation are available]) |
---|
92 | |
---|
93 | have_doxygen=no |
---|
94 | AC_PATH_PROG([DOXYGEN], [doxygen], [no]) |
---|
95 | if test "$DOXYGEN" = "no"; then |
---|
96 | AC_MSG_WARN([unable to find doxygen application]) |
---|
97 | else |
---|
98 | doxygen_min_version=1.5 |
---|
99 | AC_MSG_CHECKING([if doxygen is at least $doxygen_min_version]) |
---|
100 | doxygen_version=`$DOXYGEN --version` |
---|
101 | AX_COMPARE_VERSION([$doxygen_version], [ge], [$doxygen_min_version], |
---|
102 | [have_doxygen=yes]) |
---|
103 | AC_MSG_RESULT([$doxygen_version]) |
---|
104 | fi |
---|
105 | |
---|
106 | AC_SUBST(have_doxygen) |
---|
107 | AM_CONDITIONAL([DX_ENABLE_HTML], [test x$have_doxygen = xyes]) |
---|
108 | AC_CONFIG_FILES([test/documentation_test.sh], |
---|
109 | [chmod +x test/documentation_test.sh]) |
---|
110 | |
---|
111 | # check for quiet_NaN support in OS |
---|
112 | # Check at run-time, but if we are cross-compiling fall back on a |
---|
113 | # compilation test |
---|
114 | AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true]) |
---|
115 | AC_RUN_IFELSE( |
---|
116 | [AC_LANG_PROGRAM( |
---|
117 | [@%:@include <limits>], |
---|
118 | [return !std::numeric_limits<double>::has_quiet_NaN])], |
---|
119 | [quiet_nan=yes |
---|
120 | AC_MSG_RESULT($quiet_nan)], |
---|
121 | [quiet_nan=no |
---|
122 | AC_MSG_RESULT($quiet_nan)], |
---|
123 | # if we are cross-compiling fall back on compilation test |
---|
124 | [AC_MSG_RESULT(cross-compiling) |
---|
125 | AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()]) |
---|
126 | AC_COMPILE_IFELSE( |
---|
127 | [AC_LANG_PROGRAM( |
---|
128 | [@%:@include <limits> |
---|
129 | extern void f(double);], |
---|
130 | [f(std::numeric_limits<double>::quiet_NaN())])], |
---|
131 | [quiet_nan=yes], |
---|
132 | [quiet_nan=no]) |
---|
133 | AC_MSG_RESULT($quiet_nan)]) |
---|
134 | # Check for infinity support for doubles in OS |
---|
135 | # Check at run-time, but if we are cross-compiling fall back on a |
---|
136 | # compilation test |
---|
137 | AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true]) |
---|
138 | AC_RUN_IFELSE( |
---|
139 | [AC_LANG_PROGRAM( |
---|
140 | [@%:@include <limits>], |
---|
141 | [return !std::numeric_limits<double>::has_infinity])], |
---|
142 | [has_infinity=yes |
---|
143 | AC_MSG_RESULT($has_infinity)], |
---|
144 | [has_infinity=no |
---|
145 | AC_MSG_RESULT($has_infinity)], |
---|
146 | # if we are cross-compiling fall back on compilation test |
---|
147 | [AC_MSG_RESULT(cross-compiling) |
---|
148 | AC_MSG_CHECKING([for std::numeric_limits<>::infinity()]) |
---|
149 | AC_COMPILE_IFELSE( |
---|
150 | [AC_LANG_PROGRAM( |
---|
151 | [@%:@include <limits> |
---|
152 | extern void f(double);], |
---|
153 | [f(std::numeric_limits<double>::infinity())])], |
---|
154 | [has_infinity=yes], |
---|
155 | [has_infinity=no]) |
---|
156 | AC_MSG_RESULT($has_infinity)]) |
---|
157 | |
---|
158 | AC_MSG_CHECKING([g++ deprecation attribute]) |
---|
159 | AC_COMPILE_IFELSE( |
---|
160 | [AC_LANG_PROGRAM([[void f() __attribute__ ((deprecated));]],)], |
---|
161 | [AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1], |
---|
162 | [Define if compiler supports deprecated attribute, as in g++ 4.0]) |
---|
163 | AC_MSG_RESULT([yes])], |
---|
164 | [AC_MSG_RESULT([no])] ) |
---|
165 | |
---|
166 | AC_MSG_CHECKING([if std::multiset::iterator is mutable]) |
---|
167 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@%:@include <set> |
---|
168 | @%:@include <vector>]], |
---|
169 | [[std::set<std::vector<double> > s; |
---|
170 | std::vector<double> v; |
---|
171 | s.insert(v); |
---|
172 | s.begin()->reserve(100); |
---|
173 | ]])], |
---|
174 | [AC_DEFINE([MULTISET_ITERATOR_IS_MUTABLE], [1], |
---|
175 | [Define if std::multiset::iterator is mutable]) |
---|
176 | AC_MSG_RESULT([yes]) |
---|
177 | ], |
---|
178 | [AC_MSG_RESULT([no])] ) |
---|
179 | |
---|
180 | # Save user-defined environment settings for later restoration |
---|
181 | APR_SAVE_THE_ENVIRONMENT(CPPFLAGS) |
---|
182 | APR_SAVE_THE_ENVIRONMENT(CXXFLAGS) |
---|
183 | APR_SAVE_THE_ENVIRONMENT(LDFLAGS) |
---|
184 | APR_SAVE_THE_ENVIRONMENT(LIBS) |
---|
185 | |
---|
186 | # Checks for libraries. |
---|
187 | AC_MSG_NOTICE([checking for libraries]) |
---|
188 | AC_CHECK_LIBM |
---|
189 | |
---|
190 | # find library implementing BLAS C API, or use gslcblas |
---|
191 | YAT_LIB_CBLAS([YAT_CBLAS_LIB=$CBLAS_LIB], [YAT_CBLAS_LIB=-lgslcblas]) |
---|
192 | |
---|
193 | # GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks |
---|
194 | # Including AX_PATH_GSL macro from gsl.m4 distributed by GSL |
---|
195 | gsl_version="1.8" |
---|
196 | AC_SUBST(gsl_version) |
---|
197 | gsl_ok=yes |
---|
198 | YAT_CHECK_GSL([$gsl_version],[gsl_ok=yes],[gsl_ok=no]) |
---|
199 | |
---|
200 | # Boost http://www.boost.org |
---|
201 | boost_version=1.35 |
---|
202 | AC_SUBST(boost_version) |
---|
203 | AX_BOOST_BASE(["$boost_version"], [boost_ok=yes], [boost_ok=no]) |
---|
204 | YAT_CPP_ADD_FLAG([CPPFLAGS], [$BOOST_CPPFLAGS]) |
---|
205 | |
---|
206 | #support for large files |
---|
207 | AC_SYS_LARGEFILE |
---|
208 | if test "$enable_largefile" = "no"; then |
---|
209 | AC_DEFINE([YAT_LFS_DISABLED], 1, |
---|
210 | [defined to 1 if large file support is disabled]) |
---|
211 | fi |
---|
212 | |
---|
213 | # we use prefix INTERNAL_ for variables that are solely needed for |
---|
214 | # building yat, i.e., they are not needed for a user of yat and are |
---|
215 | # not propagated to yat-config or yat.m4. |
---|
216 | YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wall -pedantic]) |
---|
217 | YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DHAVE_INLINE=1]) |
---|
218 | AC_ARG_ENABLE([debug], |
---|
219 | [AS_HELP_STRING([--enable-debug],[turn on debug options and code])]) |
---|
220 | if test "${enable_debug}" = "yes" ; then |
---|
221 | YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DYAT_DEBUG=1]) |
---|
222 | YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-g -O]) |
---|
223 | else |
---|
224 | # avoid defining GSL_RANGE_CHECK_OFF if GSL_RANGE_CHECK is already defined |
---|
225 | AC_CHECK_DECL([GSL_RANGE_CHECK],[], |
---|
226 | [YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS],[-DGSL_RANGE_CHECK_OFF])]) |
---|
227 | YAT_CPP_ADD_FLAG([INTERNAL_CPPFLAGS], [-DNDEBUG]) |
---|
228 | YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-O3]) |
---|
229 | fi |
---|
230 | |
---|
231 | # some versions of boost uses long long - turn off compiler warnings |
---|
232 | # with -Wno-long-long |
---|
233 | yat_save_CXXFLAGS=$CXXFLAGS |
---|
234 | # turn warnings into errors |
---|
235 | YAT_CXX_ADD_FLAG([CXXFLAGS], [-pedantic-errors]) |
---|
236 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
---|
237 | [ |
---|
238 | @%:@include <boost/iterator/transform_iterator.hpp> |
---|
239 | @%:@include <cmath> |
---|
240 | @%:@include <functional> |
---|
241 | @%:@include <vector> |
---|
242 | ],[ |
---|
243 | using namespace boost; |
---|
244 | typedef std::pointer_to_unary_function<double, double> F; |
---|
245 | std::vector<double> vec; |
---|
246 | transform_iterator<F, std::vector<double>::iterator> |
---|
247 | i(vec.begin(), std::ptr_fun(fabs)); |
---|
248 | ])], |
---|
249 | [], |
---|
250 | [YAT_CXX_ADD_FLAG([INTERNAL_CXXFLAGS], [-Wno-long-long])]) |
---|
251 | # restore CXXFLAGS |
---|
252 | CXXFLAGS=$yat_save_CXXFLAGS |
---|
253 | |
---|
254 | #doxygen stuff |
---|
255 | DX_HTML_OUTPUT=html |
---|
256 | AC_SUBST(DX_HTML_OUTPUT) |
---|
257 | # create dummie version of doxygen.mk |
---|
258 | AC_CONFIG_COMMANDS([doxygen.mk], |
---|
259 | [for f in $CONFIG_FILES; do |
---|
260 | # for each directory in yat that has a Makefile, create a doxygen.mk |
---|
261 | case $f in #( |
---|
262 | yat/*/Makefile) : |
---|
263 | outfile=`echo $f | sed 's,Makefile,doxygen.mk,'`; |
---|
264 | test -e $outfile || echo '# dummie' > $outfile; |
---|
265 | esac |
---|
266 | done |
---|
267 | ]) |
---|
268 | |
---|
269 | |
---|
270 | AC_CONFIG_FILES([build_support/gen_yat_pc.sh], |
---|
271 | [chmod +x build_support/gen_yat_pc.sh]) |
---|
272 | AC_CONFIG_FILES([Makefile |
---|
273 | build_support/Makefile |
---|
274 | doc/Makefile |
---|
275 | doc/doxygen.config |
---|
276 | doc/first_page.doxygen |
---|
277 | m4/Makefile |
---|
278 | test/Makefile |
---|
279 | test/common_defs.sh |
---|
280 | test/environment.h |
---|
281 | yat/Makefile |
---|
282 | yat/classifier/Makefile |
---|
283 | yat/normalizer/Makefile |
---|
284 | yat/omic/Makefile |
---|
285 | yat/random/Makefile |
---|
286 | yat/regression/Makefile |
---|
287 | yat/statistics/Makefile |
---|
288 | yat/utility/Makefile]) |
---|
289 | |
---|
290 | AC_CONFIG_HEADERS([yat/utility/config_public.h]) |
---|
291 | |
---|
292 | # Print failure status information about selected items, and exit if |
---|
293 | # fatal errors were encountered. No output will be created if |
---|
294 | # configure is halted prematurely. |
---|
295 | |
---|
296 | # used to trigger exit before creation of output |
---|
297 | all_reqs_ok="true" |
---|
298 | |
---|
299 | # No support for quiet NAN is fatal -- sub-sequent compilation, or execution |
---|
300 | # of created binary, will fail. |
---|
301 | if test "${quiet_nan}" = "no" ; then |
---|
302 | all_reqs_ok="false" |
---|
303 | AC_MSG_WARN([ |
---|
304 | Support for quiet NAN required. |
---|
305 | yat will not work on this system!]) |
---|
306 | fi |
---|
307 | |
---|
308 | # No support for infinity is fatal -- sub-sequent compilation, or execution |
---|
309 | # of created binary, will fail. |
---|
310 | if test "${has_infinity}" = "no" ; then |
---|
311 | all_reqs_ok="false" |
---|
312 | AC_MSG_WARN([ |
---|
313 | Support for infinity required. |
---|
314 | yat will not work on this system!]) |
---|
315 | fi |
---|
316 | |
---|
317 | |
---|
318 | # Non-existing GSL is fatal -- sub-sequent compilation will fail. |
---|
319 | if test "x$gsl_ok" != "xyes" ; then |
---|
320 | all_reqs_ok="false" |
---|
321 | AC_MSG_WARN([ |
---|
322 | GSL $gsl_version (or newer) not found. The GNU Scientific Library |
---|
323 | (GSL) library cannot be found. Please make sure GSL is |
---|
324 | installed. Please refer to warnings above for more details]) |
---|
325 | fi |
---|
326 | |
---|
327 | if test "x$want_boost" = "xyes"; then |
---|
328 | # Too old Boost is fatal -- sub-sequent compilation will fail. |
---|
329 | if test "${boost_ok}" != "yes" ; then |
---|
330 | all_reqs_ok="false" |
---|
331 | AC_MSG_WARN([ |
---|
332 | Boost ${boost_version} (or newer) not found. Please make sure Boost |
---|
333 | is installed.]) |
---|
334 | fi |
---|
335 | fi |
---|
336 | |
---|
337 | if (test "$all_reqs_ok" = "false") ; then |
---|
338 | AC_MSG_FAILURE([ |
---|
339 | Some pre-requisites were not fulfilled, aborting configure. |
---|
340 | Please consult the 'README' file for more information about what |
---|
341 | is needed to compile yat and refer to above warning messages. |
---|
342 | Needed files were NOT created.]) |
---|
343 | fi |
---|
344 | |
---|
345 | # Reset flags |
---|
346 | APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, YAT_) |
---|
347 | APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, YAT_) |
---|
348 | APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, YAT_) |
---|
349 | APR_RESTORE_THE_ENVIRONMENT(LIBS, YAT_) |
---|
350 | |
---|
351 | YAT_PRIMARY_LIBS=-lgsl |
---|
352 | YAT_LIBS="$YAT_PRIMARY_LIBS $YAT_CBLAS_LIB $LIBM" |
---|
353 | AC_SUBST(YAT_PRIMARY_LIBS) |
---|
354 | AC_SUBST(YAT_LIBS) |
---|
355 | AC_SUBST(YAT_CBLAS_LIB) |
---|
356 | |
---|
357 | # set and AC_SUBST variables that are interpreted by Automake |
---|
358 | AM_CPPFLAGS="-I\$(top_srcdir) $INTERNAL_CPPFLAGS $YAT_CPPFLAGS" |
---|
359 | AM_CXXFLAGS="$INTERNAL_CXXFLAGS $YAT_CXXFLAGS" |
---|
360 | AM_LDFLAGS="$INTERNAL_LDFLAGS $YAT_LDFLAGS" |
---|
361 | |
---|
362 | AC_SUBST(AM_CPPFLAGS) |
---|
363 | AC_SUBST(AM_CXXFLAGS) |
---|
364 | AC_SUBST(AM_LDFLAGS) |
---|
365 | AC_SUBST(enable_static) |
---|
366 | |
---|
367 | YAT_SVN_RELEASE([am/maintainer.am]) |
---|
368 | |
---|
369 | # Create output. |
---|
370 | AC_OUTPUT |
---|
371 | |
---|
372 | # Some more messages. |
---|
373 | AC_MSG_NOTICE([]) |
---|
374 | AC_MSG_NOTICE([ Ready to compile the yat library]) |
---|
375 | AC_MSG_NOTICE |
---|
376 | AS_IF([test x$have_doxygen = xyes], |
---|
377 | [AC_MSG_NOTICE([ Documentation will be generated in html.])], |
---|
378 | [AC_MSG_NOTICE([Generation of documentation is disabled]) |
---|
379 | AC_MSG_NOTICE([doxygen could not be found]) |
---|
380 | ]) |
---|
381 | AC_MSG_NOTICE() |
---|
382 | AC_MSG_NOTICE([ The following flags and libraries will be used:]) |
---|
383 | AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) |
---|
384 | AC_MSG_NOTICE([ CPPFLAGS=$CPPFLAGS]) |
---|
385 | AC_MSG_NOTICE([ AM_CPPFLAGS=$AM_CPPFLAGS]) |
---|
386 | AC_MSG_NOTICE([ CXXFLAGS=$CXXFLAGS]) |
---|
387 | AC_MSG_NOTICE([ AM_CXXFLAGS=$AM_CXXFLAGS]) |
---|
388 | AC_MSG_NOTICE([ LDFLAGS=$LDFLAGS]) |
---|
389 | AC_MSG_NOTICE([ AM_LDFLAGS=$AM_LDFLAGS]) |
---|
390 | AC_MSG_NOTICE([ LIBS=$LIBS]) |
---|
391 | AC_MSG_NOTICE([ YAT_LIBS=$YAT_LIBS]) |
---|
392 | AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) |
---|
393 | AC_MSG_NOTICE([]) |
---|
394 | if test "x$YAT_CBLAS_LIB" = "x-lgslcblas"; then |
---|
395 | AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.]) |
---|
396 | AC_MSG_NOTICE([ Consider using hardware optimized BLAS.]) |
---|
397 | AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an]) |
---|
398 | AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!]) |
---|
399 | AC_MSG_NOTICE([]) |
---|
400 | fi |
---|
401 | AC_MSG_NOTICE([ Now type 'make && make check'.]) |
---|