source: trunk/configure.ac @ 1435

Last change on this file since 1435 was 1429, checked in by Peter, 15 years ago

refs #416 - added directory and modified build

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 11.4 KB
RevLine 
[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]34m4_include([./build_support/version.m4])
[1321]35AC_INIT([yat],[YAT_VERSION],[jari@thep.lu.se])
[976]36AC_PREREQ(2.60)
[1128]37AC_CONFIG_SRCDIR([yat/utility/Matrix.h])
[71]38AC_CONFIG_AUX_DIR([autotools])
39AC_PREFIX_DEFAULT([/usr/local])
[2]40
[1321]41AC_SUBST([YAT_LT_VERSION], [LT_VERSION])
42AC_SUBST([YAT_MAJOR_VERSION], [MAJOR_VERSION])
43AC_SUBST([YAT_MINOR_VERSION], [MINOR_VERSION])
44AC_SUBST([YAT_PATCH_VERSION], [PATCH_VERSION])
45AC_SUBST([YAT_DEV_BUILD], [DEV_BUILD])
[1097]46
[1225]47AC_CONFIG_HEADER([config.h])
[943]48AM_INIT_AUTOMAKE()
[2]49
[952]50# Set default programming language
51AC_LANG(C++)
52
[1213]53# Let user overide default CXXFLAGS
54if test "${CXXFLAGS+set}" != set; then
55  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
56fi
[2]57# Checks for programs.
58AC_PROG_CXX
59AC_PROG_INSTALL
[1077]60AC_PROG_SED
[2]61
[1397]62AC_MSG_NOTICE([checking whether tools for generating documentation is available])
63have_dox_tools="yes"
64AC_PATH_PROG([DOXYGEN], [doxygen], [no])
65if test "$DOXYGEN" = "no"; then
66   AC_MSG_WARN([unable to find doxygen application])
67   have_dox_tools=no
68fi
69AC_CHECK_PROG([have_epstopdf], [epstopdf], [yes], [no])
70if test "$have_epstopdf" != "yes"; then
71   AC_MSG_WARN([unable to find epstopdf application])
72   have_dox_tools=no
73fi
74AC_CHECK_PROG([have_latex], [latex], [yes], [no])
75if test "$have_latex" != "yes"; then
76   AC_MSG_WARN([unable to find latex application])
77fi
78AC_CHECK_PROG([have_makeindex], [makeindex], [yes], [no])
79if test "$have_makeindex" != "yes"; then
80   AC_MSG_WARN([unable to find makeindex application])
81   have_dox_tools=no
82fi
83AC_CHECK_PROG([have_pdflatex], [pdflatex], [yes], [no])
84if test "$have_pdflatex" != "yes"; then
85   AC_MSG_WARN([unable to find pdflatex application])
86   have_dox_tools=no
87fi
88
89AM_CONDITIONAL(HAVE_DOXYGEN, test "$have_dox_tools" = "yes")
[1367]90AC_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
94APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
95APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
96APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
97
[71]98# Checks for libraries.
[941]99AC_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]103cblas_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
106atlas_found="no"
107gslcblas_found="no" # gslcblas_found may get values yes or no
108AC_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
114gsl_cblas_lib=-lgslcblas
115if test ${cblas_found} = "yes"; then
116  gsl_cblas_lib=-lcblas
117fi
[1060]118if test ${atlas_found} = "yes"; then
119  CXXFLAGS="$CXXFLAGS -m64" LDFLAGS="$LDFLAGS -m64"
[1349]120  gsl_cblas_lib=-latlas
[1060]121fi
[1349]122export 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]126gsl_found="no"
[1287]127gsl_version="1.8"
[1356]128AC_SUBST(gsl_version)
[1223]129AX_PATH_GSL(${gsl_version},gsl_found="yes",gsl_version_check="no")
[1060]130if 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]138fi
[942]139
[1324]140# Boost http://www.boost.org
[1356]141boost_version=1.33
142AC_SUBST(boost_version)
[1391]143AX_BOOST_BASE("$boost_version")
[1394]144boost_version_check=$succeeded;
[1348]145CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
[1324]146
[1356]147
[71]148# Checks for header files.
149AC_CHECK_HEADERS([unistd.h])
[2]150
[71]151# Checks for typedefs, structures, and compiler characteristics.
152AC_HEADER_STDBOOL
153AC_C_CONST
154AC_C_INLINE
155AC_TYPE_SIZE_T
156
157# Checks for library functions.
[296]158AC_PROG_LIBTOOL
[71]159AC_FUNC_ERROR_AT_LINE
160AC_HEADER_STDC
161AC_CHECK_FUNCS([pow sqrt])
162
[969]163CXXFLAGS="$CXXFLAGS -Wall -pedantic"
[1096]164CPPFLAGS="$CPPFLAGS -DHAVE_INLINE=1"
[694]165AC_ARG_ENABLE(debug,
166  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
167if test "${enable_debug}" = "yes" ; then
168  CXXFLAGS="$CXXFLAGS -g -O"
[916]169  CPPFLAGS="$CPPFLAGS -DYAT_DEBUG=1"
[694]170else
171  CXXFLAGS="$CXXFLAGS -O3"
172  CPPFLAGS="$CPPFLAGS -DNDEBUG -DGSL_RANGE_CHECK_OFF"
173fi
[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]178AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true])
179AC_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]201AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true])
202AC_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]224YAT_LIBNAME="yat"
[675]225YAT_LIB_LOCATION="yat"
[1348]226AC_SUBST(YAT_LIBNAME)
[675]227AC_SUBST(YAT_LIB)
228AC_SUBST(YAT_LIB_LOCATION)
[2]229
[1265]230#doxygen stuff
231DX_HTML_OUTPUT=html
232DX_LATEX_OUTPUT=latex
233AC_SUBST(DX_HTML_OUTPUT)
234AC_SUBST(DX_LATEX_OUTPUT)
[1216]235
236
[945]237AC_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]253AC_CONFIG_FILES([build_support/yat-config],
254                [chmod +x build_support/yat-config])
255
[1303]256# warning about missing doxygen
[1398]257if (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]265fi
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
272all_reqs_ok="true"
273
274# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
275# of created binary, will fail.
276if 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!])
281fi
282
[1156]283# No support for infinity is fatal -- sub-sequent compilation, or execution
284# of created binary, will fail.
285if 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!])
290fi
291
292
[1060]293# Non-existing BLAS is fatal -- sub-sequent compilation will fail.
294if 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.])
300fi
301if test "${atlas_found}" = "partial"; then
302  all_reqs_ok="false"
303  AC_MSG_WARN([
304  Partial ATLAS BLAS library found. Please repair your installation.])
305fi
306
307# Non-existing GSL is fatal -- sub-sequent compilation will fail.
308if 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
319fi
320
[1394]321# Too old Boost is fatal -- sub-sequent compilation will fail.
322if 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])
327fi
328
[1060]329if (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.])
335fi
336
[1348]337# Reset flags
338APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, EXTRA_)
339APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, EXTRA_)
340APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, EXTRA_)
341
[1060]342# Create output.
343AC_OUTPUT
344
[694]345# Some more messages.
346AC_MSG_NOTICE([])
347AC_MSG_NOTICE([ Ready to compile the yat library])
[943]348AC_MSG_NOTICE([ The following flags and libraries will be used:])
[694]349AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
350AC_MSG_NOTICE([  CPPFLAGS=\"$CPPFLAGS\"])
[1348]351AC_MSG_NOTICE([  EXTRA_CPPFLAGS=\"$EXTRA_CPPFLAGS\"])
[694]352AC_MSG_NOTICE([  CXXFLAGS=\"$CXXFLAGS\"])
[1348]353AC_MSG_NOTICE([  EXTRA_CXXFLAGS=\"$EXTRA_CXXFLAGS\"])
354AC_MSG_NOTICE([  LDFLAGS=\"$LDFLAGS\"])
355AC_MSG_NOTICE([  EXTRA_LDFLAGS=\"$EXTRA_LDFLAGS\"])
[694]356AC_MSG_NOTICE([  LIBS=\"$LIBS\"])
357AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
358AC_MSG_NOTICE([])
[1060]359if test "${gslcblas_found}" = "yes"; then
360AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
361AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
362AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
363AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
364AC_MSG_NOTICE([])
365fi
[694]366AC_MSG_NOTICE([ Now type 'make ; make check'.])
Note: See TracBrowser for help on using the repository browser.