[71] | 1 | ## Process this file with autoconf to produce a configure script. |
---|
| 2 | ## |
---|
| 3 | ## $Id: configure.ac 1429 2008-08-21 18:03:52Z peter $ |
---|
[2] | 4 | |
---|
[831] | 5 | # Copyright (C) 2003 Daniel Dalevi, Jari Häkkinen |
---|
| 6 | # Copyright (C) 2004 Jari Häkkinen |
---|
[1275] | 7 | # Copyright (C) 2005, 2006 Jari Häkkinen, Peter Johansson |
---|
| 8 | # Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér |
---|
[572] | 9 | # |
---|
[1000] | 10 | # This file is part of the yat library, http://trac.thep.lu.se/yat |
---|
[572] | 11 | # |
---|
[675] | 12 | # The yat library is free software; you can redistribute it |
---|
[572] | 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 | # |
---|
[675] | 17 | # The yat library is distributed in the hope that it will be useful, |
---|
[572] | 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 | # |
---|
[923] | 27 | # If you grabbed the source from the subversion repository you should, |
---|
| 28 | # at top-level, execute: |
---|
| 29 | # ./bootstrap |
---|
[954] | 30 | # To push subsequent changes of this file into the build scripts you |
---|
| 31 | # must issue: |
---|
| 32 | # autoreconf |
---|
[572] | 33 | |
---|
[1216] | 34 | m4_include([./build_support/version.m4]) |
---|
[1321] | 35 | AC_INIT([yat],[YAT_VERSION],[jari@thep.lu.se]) |
---|
[976] | 36 | AC_PREREQ(2.60) |
---|
[1128] | 37 | AC_CONFIG_SRCDIR([yat/utility/Matrix.h]) |
---|
[71] | 38 | AC_CONFIG_AUX_DIR([autotools]) |
---|
| 39 | AC_PREFIX_DEFAULT([/usr/local]) |
---|
[2] | 40 | |
---|
[1321] | 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]) |
---|
[1097] | 46 | |
---|
[1225] | 47 | AC_CONFIG_HEADER([config.h]) |
---|
[943] | 48 | AM_INIT_AUTOMAKE() |
---|
[2] | 49 | |
---|
[952] | 50 | # Set default programming language |
---|
| 51 | AC_LANG(C++) |
---|
| 52 | |
---|
[1213] | 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 |
---|
[2] | 57 | # Checks for programs. |
---|
| 58 | AC_PROG_CXX |
---|
| 59 | AC_PROG_INSTALL |
---|
[1077] | 60 | AC_PROG_SED |
---|
[2] | 61 | |
---|
[1397] | 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") |
---|
[1367] | 90 | AC_CONFIG_FILES([test/documentation_test.sh], |
---|
| 91 | [chmod +x test/documentation_test.sh]) |
---|
[1209] | 92 | |
---|
[1348] | 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 | |
---|
[71] | 98 | # Checks for libraries. |
---|
[941] | 99 | AC_CHECK_LIB(m,main) |
---|
[969] | 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. |
---|
[1060] | 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),) |
---|
[1349] | 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 |
---|
[1060] | 118 | if test ${atlas_found} = "yes"; then |
---|
| 119 | CXXFLAGS="$CXXFLAGS -m64" LDFLAGS="$LDFLAGS -m64" |
---|
[1349] | 120 | gsl_cblas_lib=-latlas |
---|
[1060] | 121 | fi |
---|
[1349] | 122 | export GSL_CBLAS_LIB=${gsl_cblas_lib} |
---|
[2] | 123 | |
---|
[951] | 124 | # GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks |
---|
[1327] | 125 | # Including AX_PATH_GSL macro from gsl.m4 distributed by GSL |
---|
[1060] | 126 | gsl_found="no" |
---|
[1287] | 127 | gsl_version="1.8" |
---|
[1356] | 128 | AC_SUBST(gsl_version) |
---|
[1223] | 129 | AX_PATH_GSL(${gsl_version},gsl_found="yes",gsl_version_check="no") |
---|
[1060] | 130 | if test "$gsl_found" = "yes"; then |
---|
[1212] | 131 | LIBS="-lgsl $LIBS" |
---|
[1348] | 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 |
---|
[1060] | 138 | fi |
---|
[942] | 139 | |
---|
[1324] | 140 | # Boost http://www.boost.org |
---|
[1356] | 141 | boost_version=1.33 |
---|
| 142 | AC_SUBST(boost_version) |
---|
[1391] | 143 | AX_BOOST_BASE("$boost_version") |
---|
[1394] | 144 | boost_version_check=$succeeded; |
---|
[1348] | 145 | CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS" |
---|
[1324] | 146 | |
---|
[1356] | 147 | |
---|
[71] | 148 | # Checks for header files. |
---|
| 149 | AC_CHECK_HEADERS([unistd.h]) |
---|
[2] | 150 | |
---|
[71] | 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. |
---|
[296] | 158 | AC_PROG_LIBTOOL |
---|
[71] | 159 | AC_FUNC_ERROR_AT_LINE |
---|
| 160 | AC_HEADER_STDC |
---|
| 161 | AC_CHECK_FUNCS([pow sqrt]) |
---|
| 162 | |
---|
[969] | 163 | CXXFLAGS="$CXXFLAGS -Wall -pedantic" |
---|
[1096] | 164 | CPPFLAGS="$CPPFLAGS -DHAVE_INLINE=1" |
---|
[694] | 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" |
---|
[916] | 169 | CPPFLAGS="$CPPFLAGS -DYAT_DEBUG=1" |
---|
[694] | 170 | else |
---|
| 171 | CXXFLAGS="$CXXFLAGS -O3" |
---|
| 172 | CPPFLAGS="$CPPFLAGS -DNDEBUG -DGSL_RANGE_CHECK_OFF" |
---|
| 173 | fi |
---|
[2] | 174 | |
---|
[922] | 175 | # check for quiet_NaN support in OS |
---|
[1358] | 176 | # Check at run-time, but if we are cross-compiling fall back on a |
---|
| 177 | # compilation test |
---|
[924] | 178 | AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true]) |
---|
| 179 | AC_RUN_IFELSE( |
---|
| 180 | [AC_LANG_PROGRAM( |
---|
[1359] | 181 | [@%:@include <limits>], |
---|
[924] | 182 | [return !std::numeric_limits<double>::has_quiet_NaN])], |
---|
[1358] | 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( |
---|
[1359] | 192 | [@%:@include <limits> |
---|
[1358] | 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)]) |
---|
[1156] | 198 | # Check for infinity support for doubles in OS |
---|
[1358] | 199 | # Check at run-time, but if we are cross-compiling fall back on a |
---|
| 200 | # compilation test |
---|
[1156] | 201 | AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true]) |
---|
| 202 | AC_RUN_IFELSE( |
---|
| 203 | [AC_LANG_PROGRAM( |
---|
[1359] | 204 | [@%:@include <limits>], |
---|
[1156] | 205 | [return !std::numeric_limits<double>::has_infinity])], |
---|
[1358] | 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( |
---|
[1359] | 215 | [@%:@include <limits> |
---|
[1358] | 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)]) |
---|
[922] | 221 | |
---|
[1156] | 222 | |
---|
[675] | 223 | # yat specific settings |
---|
[1348] | 224 | YAT_LIBNAME="yat" |
---|
[675] | 225 | YAT_LIB_LOCATION="yat" |
---|
[1348] | 226 | AC_SUBST(YAT_LIBNAME) |
---|
[675] | 227 | AC_SUBST(YAT_LIB) |
---|
| 228 | AC_SUBST(YAT_LIB_LOCATION) |
---|
[2] | 229 | |
---|
[1265] | 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) |
---|
[1216] | 235 | |
---|
| 236 | |
---|
[945] | 237 | AC_CONFIG_FILES([Makefile |
---|
[1356] | 238 | build_support/yat.pc |
---|
[945] | 239 | doc/Makefile |
---|
[1225] | 240 | doc/doxygen.config |
---|
[945] | 241 | test/Makefile |
---|
[1249] | 242 | test/environment.h |
---|
[945] | 243 | test/data/Makefile |
---|
| 244 | yat/Makefile |
---|
| 245 | yat/classifier/Makefile |
---|
[1429] | 246 | yat/normalization/Makefile |
---|
[945] | 247 | yat/random/Makefile |
---|
| 248 | yat/regression/Makefile |
---|
| 249 | yat/statistics/Makefile |
---|
[1321] | 250 | yat/utility/version.h |
---|
[945] | 251 | yat/utility/Makefile]) |
---|
| 252 | |
---|
[1348] | 253 | AC_CONFIG_FILES([build_support/yat-config], |
---|
| 254 | [chmod +x build_support/yat-config]) |
---|
| 255 | |
---|
[1303] | 256 | # warning about missing doxygen |
---|
[1398] | 257 | if (test "$have_dox_tools" != "yes") ; then |
---|
[1060] | 258 | AC_MSG_WARN([ |
---|
[1397] | 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. |
---|
[1060] | 264 | ]) |
---|
[944] | 265 | fi |
---|
| 266 | |
---|
[1060] | 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 | |
---|
[1156] | 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 | |
---|
[1060] | 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 | |
---|
[1394] | 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 | |
---|
[1060] | 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 | |
---|
[1348] | 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 | |
---|
[1060] | 342 | # Create output. |
---|
| 343 | AC_OUTPUT |
---|
| 344 | |
---|
[694] | 345 | # Some more messages. |
---|
| 346 | AC_MSG_NOTICE([]) |
---|
| 347 | AC_MSG_NOTICE([ Ready to compile the yat library]) |
---|
[943] | 348 | AC_MSG_NOTICE([ The following flags and libraries will be used:]) |
---|
[694] | 349 | AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) |
---|
| 350 | AC_MSG_NOTICE([ CPPFLAGS=\"$CPPFLAGS\"]) |
---|
[1348] | 351 | AC_MSG_NOTICE([ EXTRA_CPPFLAGS=\"$EXTRA_CPPFLAGS\"]) |
---|
[694] | 352 | AC_MSG_NOTICE([ CXXFLAGS=\"$CXXFLAGS\"]) |
---|
[1348] | 353 | AC_MSG_NOTICE([ EXTRA_CXXFLAGS=\"$EXTRA_CXXFLAGS\"]) |
---|
| 354 | AC_MSG_NOTICE([ LDFLAGS=\"$LDFLAGS\"]) |
---|
| 355 | AC_MSG_NOTICE([ EXTRA_LDFLAGS=\"$EXTRA_LDFLAGS\"]) |
---|
[694] | 356 | AC_MSG_NOTICE([ LIBS=\"$LIBS\"]) |
---|
| 357 | AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++]) |
---|
| 358 | AC_MSG_NOTICE([]) |
---|
[1060] | 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 |
---|
[694] | 366 | AC_MSG_NOTICE([ Now type 'make ; make check'.]) |
---|