1 | ## Process this file with autoconf to produce a configure script. |
---|
2 | ## |
---|
3 | ## $Id: configure.ac 1275 2008-04-11 06:10:12Z jari $ |
---|
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 | |
---|
46 | AC_CONFIG_HEADER([config.h]) |
---|
47 | AM_INIT_AUTOMAKE() |
---|
48 | |
---|
49 | # Set default programming language |
---|
50 | AC_LANG(C++) |
---|
51 | |
---|
52 | # Let user overide default CXXFLAGS |
---|
53 | if test "${CXXFLAGS+set}" != set; then |
---|
54 | CXXFLAGS="" # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX |
---|
55 | fi |
---|
56 | # Checks for programs. |
---|
57 | AC_PROG_CXX |
---|
58 | AC_PROG_INSTALL |
---|
59 | AC_PROG_SED |
---|
60 | AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [true], [false]) |
---|
61 | |
---|
62 | AM_CONDITIONAL(HAVE_DOXYGEN, test "$HAVE_DOXYGEN" = "true") |
---|
63 | |
---|
64 | # Checks for libraries. |
---|
65 | AC_CHECK_LIB(m,main) |
---|
66 | # searching for cblas. Priority 1) find a cblas library, 2) find ATLAS |
---|
67 | # generated cblas, and 3) fall back to GSL cblas implementation. If |
---|
68 | # partial ATLAS is detected the configure script fails. |
---|
69 | cblas_found="no" # cblas_found may get values yes or no |
---|
70 | # atlas_found may get values yes, no, or partial. In some cases |
---|
71 | # partial atlas may be installed |
---|
72 | atlas_found="no" |
---|
73 | gslcblas_found="no" # gslcblas_found may get values yes or no |
---|
74 | AC_SEARCH_LIBS(cblas_sdsdot,cblas,cblas_found="yes", |
---|
75 | AC_SEARCH_LIBS(ATL_sdsdot,atlas, |
---|
76 | AC_SEARCH_LIBS(cblas_sdsdot,cblas,atlas_found="yes", |
---|
77 | atlas_found="partial",-m64), |
---|
78 | AC_SEARCH_LIBS(cblas_dswap,gslcblas,gslcblas_found="yes"),-m64),) |
---|
79 | if test ${atlas_found} = "yes"; then |
---|
80 | CXXFLAGS="$CXXFLAGS -m64" LDFLAGS="$LDFLAGS -m64" |
---|
81 | fi |
---|
82 | |
---|
83 | # GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks |
---|
84 | # Including AM_PATH_GSL macro from gsl.m4 distributed by GSL |
---|
85 | gsl_found="no" |
---|
86 | gsl_version="1.6" |
---|
87 | sinclude(./build_support/gsl.m4) |
---|
88 | AX_PATH_GSL(${gsl_version},gsl_found="yes",gsl_version_check="no") |
---|
89 | if test "$gsl_found" = "yes"; then |
---|
90 | LIBS="-lgsl $LIBS" |
---|
91 | fi |
---|
92 | |
---|
93 | # Checks for header files. |
---|
94 | AC_CHECK_HEADERS([unistd.h]) |
---|
95 | |
---|
96 | # Checks for typedefs, structures, and compiler characteristics. |
---|
97 | AC_HEADER_STDBOOL |
---|
98 | AC_C_CONST |
---|
99 | AC_C_INLINE |
---|
100 | AC_TYPE_SIZE_T |
---|
101 | |
---|
102 | # Checks for library functions. |
---|
103 | AC_PROG_LIBTOOL |
---|
104 | AC_FUNC_ERROR_AT_LINE |
---|
105 | AC_HEADER_STDC |
---|
106 | AC_CHECK_FUNCS([pow sqrt]) |
---|
107 | |
---|
108 | CXXFLAGS="$CXXFLAGS -Wall -pedantic" |
---|
109 | CPPFLAGS="$CPPFLAGS -DHAVE_INLINE=1" |
---|
110 | AC_ARG_ENABLE(debug, |
---|
111 | [AS_HELP_STRING([--enable-debug],[turn on debug options and code])]) |
---|
112 | if test "${enable_debug}" = "yes" ; then |
---|
113 | CXXFLAGS="$CXXFLAGS -g -O" |
---|
114 | CPPFLAGS="$CPPFLAGS -DYAT_DEBUG=1" |
---|
115 | else |
---|
116 | CXXFLAGS="$CXXFLAGS -O3" |
---|
117 | CPPFLAGS="$CPPFLAGS -DNDEBUG -DGSL_RANGE_CHECK_OFF" |
---|
118 | fi |
---|
119 | |
---|
120 | # check for quiet_NaN support in OS |
---|
121 | # At compile time, but this may not work if quiet_NaN exists and returns |
---|
122 | # an incorrect value |
---|
123 | AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()]) |
---|
124 | AC_COMPILE_IFELSE( |
---|
125 | [AC_LANG_PROGRAM( |
---|
126 | [#include <limits> |
---|
127 | extern void f(double);], |
---|
128 | [f(std::numeric_limits<double>::quiet_NaN())])], |
---|
129 | [quiet_nan=yes], |
---|
130 | [quiet_nan=no]) |
---|
131 | AC_MSG_RESULT($quiet_nan) |
---|
132 | # At run-time, but this has the disadvantage that yat cannot be built |
---|
133 | # for cross-compilation |
---|
134 | AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true]) |
---|
135 | AC_RUN_IFELSE( |
---|
136 | [AC_LANG_PROGRAM( |
---|
137 | [#include <limits>], |
---|
138 | [return !std::numeric_limits<double>::has_quiet_NaN])], |
---|
139 | [quiet_nan=yes], |
---|
140 | [quiet_nan=no]) |
---|
141 | AC_MSG_RESULT($quiet_nan) |
---|
142 | # Check for infinity support for doubles in OS |
---|
143 | # At run-time, but this has the disadvantage that yat cannot be built |
---|
144 | # for cross-compilation |
---|
145 | AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true]) |
---|
146 | AC_RUN_IFELSE( |
---|
147 | [AC_LANG_PROGRAM( |
---|
148 | [#include <limits>], |
---|
149 | [return !std::numeric_limits<double>::has_infinity])], |
---|
150 | [has_infinity=yes], |
---|
151 | [has_infinity=no]) |
---|
152 | AC_MSG_RESULT($has_infinity) |
---|
153 | |
---|
154 | |
---|
155 | # yat specific settings |
---|
156 | YAT_LIB="libyat.la" |
---|
157 | YAT_LIB_LOCATION="yat" |
---|
158 | AC_SUBST(YAT_LIB) |
---|
159 | AC_SUBST(YAT_LIB_LOCATION) |
---|
160 | AC_DEFINE([YAT_MAJOR_VERSION],[MAJOR_VERSION], [Define to yat MAJOR version]) |
---|
161 | AC_DEFINE([YAT_MINOR_VERSION],[MINOR_VERSION], [Define to yat MINOR version]) |
---|
162 | AC_DEFINE([YAT_PATCH_VERSION],[PATCH_VERSION], [Define to yat PATCH version]) |
---|
163 | AC_DEFINE([YAT_DEV_BUILD],[DEV_BUILD], [false if tagged release]) |
---|
164 | |
---|
165 | #doxygen stuff |
---|
166 | DX_HTML_OUTPUT=html |
---|
167 | DX_LATEX_OUTPUT=latex |
---|
168 | AC_SUBST(DX_HTML_OUTPUT) |
---|
169 | AC_SUBST(DX_LATEX_OUTPUT) |
---|
170 | |
---|
171 | |
---|
172 | AC_CONFIG_FILES([Makefile |
---|
173 | doc/Makefile |
---|
174 | doc/doxygen.config |
---|
175 | test/Makefile |
---|
176 | test/environment.h |
---|
177 | test/data/Makefile |
---|
178 | yat/Makefile |
---|
179 | yat/classifier/Makefile |
---|
180 | yat/random/Makefile |
---|
181 | yat/regression/Makefile |
---|
182 | yat/statistics/Makefile |
---|
183 | yat/utility/Makefile]) |
---|
184 | |
---|
185 | # Only warning about missing programs (needed for docs generation) |
---|
186 | # when in debug mode |
---|
187 | if (test "$enable_debug" == "yes"); then |
---|
188 | if (test "$HAVE_DOXYGEN" != "true") ; then |
---|
189 | AC_MSG_WARN([ |
---|
190 | Doxygen was not found. Yat will compile and work without doxygen. |
---|
191 | However, in order to enable generation of documentation, please |
---|
192 | install Doxygen available at http://www.doxygen.org/ |
---|
193 | ]) |
---|
194 | fi |
---|
195 | fi |
---|
196 | |
---|
197 | # Print failure status information about selected items, and exit if |
---|
198 | # fatal errors were encountered. No output will be created if |
---|
199 | # configure is halted prematurely. |
---|
200 | |
---|
201 | # used to trigger exit before creation of output |
---|
202 | all_reqs_ok="true" |
---|
203 | |
---|
204 | # No support for quiet NAN is fatal -- sub-sequent compilation, or execution |
---|
205 | # of created binary, will fail. |
---|
206 | if test "${quiet_nan}" = "no" ; then |
---|
207 | all_reqs_ok="false" |
---|
208 | AC_MSG_WARN([ |
---|
209 | Support for quiet NAN required. |
---|
210 | Yat will not work on this system!]) |
---|
211 | fi |
---|
212 | |
---|
213 | # No support for infinity is fatal -- sub-sequent compilation, or execution |
---|
214 | # of created binary, will fail. |
---|
215 | if test "${has_infinity}" = "no" ; then |
---|
216 | all_reqs_ok="false" |
---|
217 | AC_MSG_WARN([ |
---|
218 | Support for infinity required. |
---|
219 | Yat will not work on this system!]) |
---|
220 | fi |
---|
221 | |
---|
222 | |
---|
223 | # Non-existing BLAS is fatal -- sub-sequent compilation will fail. |
---|
224 | if test "${cblas_found}" = "no" -a "${atlas_found}" = "no" -a "${gslcblas_found}" = "no"; then |
---|
225 | all_reqs_ok="false" |
---|
226 | AC_MSG_WARN([ |
---|
227 | cBLAS not found. The C implementation of Basic Linear Algebra |
---|
228 | Subprograms (cBLAS) library cannot be found. Please make sure |
---|
229 | cBLAS is installed.]) |
---|
230 | fi |
---|
231 | if test "${atlas_found}" = "partial"; then |
---|
232 | all_reqs_ok="false" |
---|
233 | AC_MSG_WARN([ |
---|
234 | Partial ATLAS BLAS library found. Please repair your installation.]) |
---|
235 | fi |
---|
236 | |
---|
237 | # Non-existing GSL is fatal -- sub-sequent compilation will fail. |
---|
238 | if test "${gsl_found}" = "no" ; then |
---|
239 | all_reqs_ok="false" |
---|
240 | if test "${gsl_version_check}" = "no" ; then |
---|
241 | AC_MSG_WARN([ |
---|
242 | GSL found but not the required version. Please install |
---|
243 | GSL version ${gsl_version} or later]) |
---|
244 | else |
---|
245 | AC_MSG_WARN([ |
---|
246 | GSL not found. The GNU Scientific Library (GSL) library cannot be |
---|
247 | found. Please make sure GSL is installed.]) |
---|
248 | fi |
---|
249 | fi |
---|
250 | |
---|
251 | if (test "$all_reqs_ok" = "false") ; then |
---|
252 | AC_MSG_FAILURE([ |
---|
253 | Some pre-requisites were not fulfilled, aborting configure. |
---|
254 | Please consult the 'README' file for more information about what |
---|
255 | is needed to compile yat and refer to above warning messages. |
---|
256 | Needed files were NOT created.]) |
---|
257 | fi |
---|
258 | |
---|
259 | # Create output. |
---|
260 | AC_OUTPUT |
---|
261 | |
---|
262 | # Some more messages. |
---|
263 | AC_MSG_NOTICE([]) |
---|
264 | AC_MSG_NOTICE([ Ready to compile the yat library]) |
---|
265 | AC_MSG_NOTICE([ The following flags and libraries will be used:]) |
---|
266 | AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) |
---|
267 | AC_MSG_NOTICE([ CPPFLAGS=\"$CPPFLAGS\"]) |
---|
268 | AC_MSG_NOTICE([ CXXFLAGS=\"$CXXFLAGS\"]) |
---|
269 | AC_MSG_NOTICE([ LIBS=\"$LIBS\"]) |
---|
270 | AC_MSG_NOTICE([ LDFLAGS=\"$LDFLAGS\"]) |
---|
271 | AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) |
---|
272 | AC_MSG_NOTICE([]) |
---|
273 | if test "${gslcblas_found}" = "yes"; then |
---|
274 | AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.]) |
---|
275 | AC_MSG_NOTICE([ Consider using hardware optimized BLAS.]) |
---|
276 | AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an]) |
---|
277 | AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!]) |
---|
278 | AC_MSG_NOTICE([]) |
---|
279 | fi |
---|
280 | AC_MSG_NOTICE([ Now type 'make ; make check'.]) |
---|