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