1 | ## Process this file with autoconf to produce a configure script. |
---|
2 | ## |
---|
3 | ## $Id: configure.ac 1429 2008-08-21 18:03:52Z 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://trac.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 2 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 this program; if not, write to the Free Software |
---|
24 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
25 | # 02111-1307, USA. |
---|
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 | m4_include([./build_support/version.m4]) |
---|
35 | AC_INIT([yat],[YAT_VERSION],[jari@thep.lu.se]) |
---|
36 | AC_PREREQ(2.60) |
---|
37 | AC_CONFIG_SRCDIR([yat/utility/Matrix.h]) |
---|
38 | AC_CONFIG_AUX_DIR([autotools]) |
---|
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([checking whether tools for generating documentation is available]) |
---|
63 | have_dox_tools="yes" |
---|
64 | AC_PATH_PROG([DOXYGEN], [doxygen], [no]) |
---|
65 | if test "$DOXYGEN" = "no"; then |
---|
66 | AC_MSG_WARN([unable to find doxygen application]) |
---|
67 | have_dox_tools=no |
---|
68 | fi |
---|
69 | AC_CHECK_PROG([have_epstopdf], [epstopdf], [yes], [no]) |
---|
70 | if test "$have_epstopdf" != "yes"; then |
---|
71 | AC_MSG_WARN([unable to find epstopdf application]) |
---|
72 | have_dox_tools=no |
---|
73 | fi |
---|
74 | AC_CHECK_PROG([have_latex], [latex], [yes], [no]) |
---|
75 | if test "$have_latex" != "yes"; then |
---|
76 | AC_MSG_WARN([unable to find latex application]) |
---|
77 | fi |
---|
78 | AC_CHECK_PROG([have_makeindex], [makeindex], [yes], [no]) |
---|
79 | if test "$have_makeindex" != "yes"; then |
---|
80 | AC_MSG_WARN([unable to find makeindex application]) |
---|
81 | have_dox_tools=no |
---|
82 | fi |
---|
83 | AC_CHECK_PROG([have_pdflatex], [pdflatex], [yes], [no]) |
---|
84 | if test "$have_pdflatex" != "yes"; then |
---|
85 | AC_MSG_WARN([unable to find pdflatex application]) |
---|
86 | have_dox_tools=no |
---|
87 | fi |
---|
88 | |
---|
89 | AM_CONDITIONAL(HAVE_DOXYGEN, test "$have_dox_tools" = "yes") |
---|
90 | AC_CONFIG_FILES([test/documentation_test.sh], |
---|
91 | [chmod +x test/documentation_test.sh]) |
---|
92 | |
---|
93 | # Save user-defined environment settings for later restoration |
---|
94 | APR_SAVE_THE_ENVIRONMENT(CPPFLAGS) |
---|
95 | APR_SAVE_THE_ENVIRONMENT(CXXFLAGS) |
---|
96 | APR_SAVE_THE_ENVIRONMENT(LDFLAGS) |
---|
97 | |
---|
98 | # Checks for libraries. |
---|
99 | AC_CHECK_LIB(m,main) |
---|
100 | # searching for cblas. Priority 1) find a cblas library, 2) find ATLAS |
---|
101 | # generated cblas, and 3) fall back to GSL cblas implementation. If |
---|
102 | # partial ATLAS is detected the configure script fails. |
---|
103 | cblas_found="no" # cblas_found may get values yes or no |
---|
104 | # atlas_found may get values yes, no, or partial. In some cases |
---|
105 | # partial atlas may be installed |
---|
106 | atlas_found="no" |
---|
107 | gslcblas_found="no" # gslcblas_found may get values yes or no |
---|
108 | AC_SEARCH_LIBS(cblas_sdsdot,cblas,cblas_found="yes", |
---|
109 | AC_SEARCH_LIBS(ATL_sdsdot,atlas, |
---|
110 | AC_SEARCH_LIBS(cblas_sdsdot,cblas,atlas_found="yes", |
---|
111 | atlas_found="partial",-m64), |
---|
112 | AC_SEARCH_LIBS(cblas_dswap,gslcblas,gslcblas_found="yes"),-m64),) |
---|
113 | # CBLAS used in test of GSL |
---|
114 | gsl_cblas_lib=-lgslcblas |
---|
115 | if test ${cblas_found} = "yes"; then |
---|
116 | gsl_cblas_lib=-lcblas |
---|
117 | fi |
---|
118 | if test ${atlas_found} = "yes"; then |
---|
119 | CXXFLAGS="$CXXFLAGS -m64" LDFLAGS="$LDFLAGS -m64" |
---|
120 | gsl_cblas_lib=-latlas |
---|
121 | fi |
---|
122 | export GSL_CBLAS_LIB=${gsl_cblas_lib} |
---|
123 | |
---|
124 | # GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks |
---|
125 | # Including AX_PATH_GSL macro from gsl.m4 distributed by GSL |
---|
126 | gsl_found="no" |
---|
127 | gsl_version="1.8" |
---|
128 | AC_SUBST(gsl_version) |
---|
129 | AX_PATH_GSL(${gsl_version},gsl_found="yes",gsl_version_check="no") |
---|
130 | if test "$gsl_found" = "yes"; then |
---|
131 | LIBS="-lgsl $LIBS" |
---|
132 | # grep words starting with '-L' in other words LDFLAGS |
---|
133 | for i in $GSL_LIBS; do |
---|
134 | if test ${i:0:2} = "-L"; then |
---|
135 | LDFLAGS="$LDFLAGS $i" |
---|
136 | fi |
---|
137 | done |
---|
138 | fi |
---|
139 | |
---|
140 | # Boost http://www.boost.org |
---|
141 | boost_version=1.33 |
---|
142 | AC_SUBST(boost_version) |
---|
143 | AX_BOOST_BASE("$boost_version") |
---|
144 | boost_version_check=$succeeded; |
---|
145 | CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS" |
---|
146 | |
---|
147 | |
---|
148 | # Checks for header files. |
---|
149 | AC_CHECK_HEADERS([unistd.h]) |
---|
150 | |
---|
151 | # Checks for typedefs, structures, and compiler characteristics. |
---|
152 | AC_HEADER_STDBOOL |
---|
153 | AC_C_CONST |
---|
154 | AC_C_INLINE |
---|
155 | AC_TYPE_SIZE_T |
---|
156 | |
---|
157 | # Checks for library functions. |
---|
158 | AC_PROG_LIBTOOL |
---|
159 | AC_FUNC_ERROR_AT_LINE |
---|
160 | AC_HEADER_STDC |
---|
161 | AC_CHECK_FUNCS([pow sqrt]) |
---|
162 | |
---|
163 | CXXFLAGS="$CXXFLAGS -Wall -pedantic" |
---|
164 | CPPFLAGS="$CPPFLAGS -DHAVE_INLINE=1" |
---|
165 | AC_ARG_ENABLE(debug, |
---|
166 | [AS_HELP_STRING([--enable-debug],[turn on debug options and code])]) |
---|
167 | if test "${enable_debug}" = "yes" ; then |
---|
168 | CXXFLAGS="$CXXFLAGS -g -O" |
---|
169 | CPPFLAGS="$CPPFLAGS -DYAT_DEBUG=1" |
---|
170 | else |
---|
171 | CXXFLAGS="$CXXFLAGS -O3" |
---|
172 | CPPFLAGS="$CPPFLAGS -DNDEBUG -DGSL_RANGE_CHECK_OFF" |
---|
173 | fi |
---|
174 | |
---|
175 | # check for quiet_NaN support in OS |
---|
176 | # Check at run-time, but if we are cross-compiling fall back on a |
---|
177 | # compilation test |
---|
178 | AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true]) |
---|
179 | AC_RUN_IFELSE( |
---|
180 | [AC_LANG_PROGRAM( |
---|
181 | [@%:@include <limits>], |
---|
182 | [return !std::numeric_limits<double>::has_quiet_NaN])], |
---|
183 | [quiet_nan=yes |
---|
184 | AC_MSG_RESULT($quiet_nan)], |
---|
185 | [quiet_nan=no |
---|
186 | AC_MSG_RESULT($quiet_nan)], |
---|
187 | # if we are cross-compiling fall back on compilation test |
---|
188 | [AC_MSG_RESULT(cross-compiling) |
---|
189 | AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()]) |
---|
190 | AC_COMPILE_IFELSE( |
---|
191 | [AC_LANG_PROGRAM( |
---|
192 | [@%:@include <limits> |
---|
193 | extern void f(double);], |
---|
194 | [f(std::numeric_limits<double>::quiet_NaN())])], |
---|
195 | [quiet_nan=yes], |
---|
196 | [quiet_nan=no]) |
---|
197 | AC_MSG_RESULT($quiet_nan)]) |
---|
198 | # Check for infinity support for doubles in OS |
---|
199 | # Check at run-time, but if we are cross-compiling fall back on a |
---|
200 | # compilation test |
---|
201 | AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true]) |
---|
202 | AC_RUN_IFELSE( |
---|
203 | [AC_LANG_PROGRAM( |
---|
204 | [@%:@include <limits>], |
---|
205 | [return !std::numeric_limits<double>::has_infinity])], |
---|
206 | [has_infinity=yes |
---|
207 | AC_MSG_RESULT($has_infinity)], |
---|
208 | [has_infinity=no |
---|
209 | AC_MSG_RESULT($has_infinity)], |
---|
210 | # if we are cross-compiling fall back on compilation test |
---|
211 | [AC_MSG_RESULT(cross-compiling) |
---|
212 | AC_MSG_CHECKING([for std::numeric_limits<>::infinity()]) |
---|
213 | AC_COMPILE_IFELSE( |
---|
214 | [AC_LANG_PROGRAM( |
---|
215 | [@%:@include <limits> |
---|
216 | extern void f(double);], |
---|
217 | [f(std::numeric_limits<double>::infinity())])], |
---|
218 | [has_infinity=yes], |
---|
219 | [has_infinity=no]) |
---|
220 | AC_MSG_RESULT($has_infinity)]) |
---|
221 | |
---|
222 | |
---|
223 | # yat specific settings |
---|
224 | YAT_LIBNAME="yat" |
---|
225 | YAT_LIB_LOCATION="yat" |
---|
226 | AC_SUBST(YAT_LIBNAME) |
---|
227 | AC_SUBST(YAT_LIB) |
---|
228 | AC_SUBST(YAT_LIB_LOCATION) |
---|
229 | |
---|
230 | #doxygen stuff |
---|
231 | DX_HTML_OUTPUT=html |
---|
232 | DX_LATEX_OUTPUT=latex |
---|
233 | AC_SUBST(DX_HTML_OUTPUT) |
---|
234 | AC_SUBST(DX_LATEX_OUTPUT) |
---|
235 | |
---|
236 | |
---|
237 | AC_CONFIG_FILES([Makefile |
---|
238 | build_support/yat.pc |
---|
239 | doc/Makefile |
---|
240 | doc/doxygen.config |
---|
241 | test/Makefile |
---|
242 | test/environment.h |
---|
243 | test/data/Makefile |
---|
244 | yat/Makefile |
---|
245 | yat/classifier/Makefile |
---|
246 | yat/normalization/Makefile |
---|
247 | yat/random/Makefile |
---|
248 | yat/regression/Makefile |
---|
249 | yat/statistics/Makefile |
---|
250 | yat/utility/version.h |
---|
251 | yat/utility/Makefile]) |
---|
252 | |
---|
253 | AC_CONFIG_FILES([build_support/yat-config], |
---|
254 | [chmod +x build_support/yat-config]) |
---|
255 | |
---|
256 | # warning about missing doxygen |
---|
257 | if (test "$have_dox_tools" != "yes") ; then |
---|
258 | AC_MSG_WARN([ |
---|
259 | Some pre-requisites for generating documentation were not |
---|
260 | fulfilled. The build will not create any documentation. |
---|
261 | Please consult the 'README' file for more information about |
---|
262 | what is needed to generate documentation and refer to above |
---|
263 | warning messages. |
---|
264 | ]) |
---|
265 | fi |
---|
266 | |
---|
267 | # Print failure status information about selected items, and exit if |
---|
268 | # fatal errors were encountered. No output will be created if |
---|
269 | # configure is halted prematurely. |
---|
270 | |
---|
271 | # used to trigger exit before creation of output |
---|
272 | all_reqs_ok="true" |
---|
273 | |
---|
274 | # No support for quiet NAN is fatal -- sub-sequent compilation, or execution |
---|
275 | # of created binary, will fail. |
---|
276 | if test "${quiet_nan}" = "no" ; then |
---|
277 | all_reqs_ok="false" |
---|
278 | AC_MSG_WARN([ |
---|
279 | Support for quiet NAN required. |
---|
280 | Yat will not work on this system!]) |
---|
281 | fi |
---|
282 | |
---|
283 | # No support for infinity is fatal -- sub-sequent compilation, or execution |
---|
284 | # of created binary, will fail. |
---|
285 | if test "${has_infinity}" = "no" ; then |
---|
286 | all_reqs_ok="false" |
---|
287 | AC_MSG_WARN([ |
---|
288 | Support for infinity required. |
---|
289 | Yat will not work on this system!]) |
---|
290 | fi |
---|
291 | |
---|
292 | |
---|
293 | # Non-existing BLAS is fatal -- sub-sequent compilation will fail. |
---|
294 | if test "${cblas_found}" = "no" -a "${atlas_found}" = "no" -a "${gslcblas_found}" = "no"; then |
---|
295 | all_reqs_ok="false" |
---|
296 | AC_MSG_WARN([ |
---|
297 | cBLAS not found. The C implementation of Basic Linear Algebra |
---|
298 | Subprograms (cBLAS) library cannot be found. Please make sure |
---|
299 | cBLAS is installed.]) |
---|
300 | fi |
---|
301 | if test "${atlas_found}" = "partial"; then |
---|
302 | all_reqs_ok="false" |
---|
303 | AC_MSG_WARN([ |
---|
304 | Partial ATLAS BLAS library found. Please repair your installation.]) |
---|
305 | fi |
---|
306 | |
---|
307 | # Non-existing GSL is fatal -- sub-sequent compilation will fail. |
---|
308 | if test "${gsl_found}" = "no" ; then |
---|
309 | all_reqs_ok="false" |
---|
310 | if test "${gsl_version_check}" = "no" ; then |
---|
311 | AC_MSG_WARN([ |
---|
312 | GSL found but not the required version. Please install |
---|
313 | GSL version ${gsl_version} or later]) |
---|
314 | else |
---|
315 | AC_MSG_WARN([ |
---|
316 | GSL not found. The GNU Scientific Library (GSL) library cannot be |
---|
317 | found. Please make sure GSL is installed.]) |
---|
318 | fi |
---|
319 | fi |
---|
320 | |
---|
321 | # Too old Boost is fatal -- sub-sequent compilation will fail. |
---|
322 | if test "${boost_version_check}" != "yes" ; then |
---|
323 | all_reqs_ok="false" |
---|
324 | AC_MSG_WARN([ |
---|
325 | Boost found but not the required version. Please install |
---|
326 | Boost version ${boost_version} or later]) |
---|
327 | fi |
---|
328 | |
---|
329 | if (test "$all_reqs_ok" = "false") ; then |
---|
330 | AC_MSG_FAILURE([ |
---|
331 | Some pre-requisites were not fulfilled, aborting configure. |
---|
332 | Please consult the 'README' file for more information about what |
---|
333 | is needed to compile yat and refer to above warning messages. |
---|
334 | Needed files were NOT created.]) |
---|
335 | fi |
---|
336 | |
---|
337 | # Reset flags |
---|
338 | APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, EXTRA_) |
---|
339 | APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, EXTRA_) |
---|
340 | APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, EXTRA_) |
---|
341 | |
---|
342 | # Create output. |
---|
343 | AC_OUTPUT |
---|
344 | |
---|
345 | # Some more messages. |
---|
346 | AC_MSG_NOTICE([]) |
---|
347 | AC_MSG_NOTICE([ Ready to compile the yat library]) |
---|
348 | AC_MSG_NOTICE([ The following flags and libraries will be used:]) |
---|
349 | AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) |
---|
350 | AC_MSG_NOTICE([ CPPFLAGS=\"$CPPFLAGS\"]) |
---|
351 | AC_MSG_NOTICE([ EXTRA_CPPFLAGS=\"$EXTRA_CPPFLAGS\"]) |
---|
352 | AC_MSG_NOTICE([ CXXFLAGS=\"$CXXFLAGS\"]) |
---|
353 | AC_MSG_NOTICE([ EXTRA_CXXFLAGS=\"$EXTRA_CXXFLAGS\"]) |
---|
354 | AC_MSG_NOTICE([ LDFLAGS=\"$LDFLAGS\"]) |
---|
355 | AC_MSG_NOTICE([ EXTRA_LDFLAGS=\"$EXTRA_LDFLAGS\"]) |
---|
356 | AC_MSG_NOTICE([ LIBS=\"$LIBS\"]) |
---|
357 | AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) |
---|
358 | AC_MSG_NOTICE([]) |
---|
359 | if test "${gslcblas_found}" = "yes"; then |
---|
360 | AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.]) |
---|
361 | AC_MSG_NOTICE([ Consider using hardware optimized BLAS.]) |
---|
362 | AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an]) |
---|
363 | AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!]) |
---|
364 | AC_MSG_NOTICE([]) |
---|
365 | fi |
---|
366 | AC_MSG_NOTICE([ Now type 'make ; make check'.]) |
---|