source: trunk/configure.ac @ 1320

Last change on this file since 1320 was 1319, checked in by Peter, 13 years ago

config.h is no longer installed. Therefore, do not include config.h
into other header files. Instead there is a yat/yat-config.h which
will be installed and can therefore be used in header files. The
yat-config contains the same information as config.h but variables are
prefix'd with a YAT_. I had to change style in version.m4 due to a
variable clash between variables set in version.m4 and variables I
wanted in config.h.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 8.9 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 1319 2008-05-21 16:03:42Z 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
34m4_include([./build_support/version.m4])
35AC_INIT([yat],[yat_version],[jari@thep.lu.se])
36AC_PREREQ(2.60)
37AC_CONFIG_SRCDIR([yat/utility/Matrix.h])
38AC_CONFIG_AUX_DIR([autotools])
39AC_PREFIX_DEFAULT([/usr/local])
40
41AC_SUBST([YAT_LT_VERSION], [yat_lt_version])
42AC_SUBST([YAT_MAJOR_VERSION], [yat_major_version])
43AC_SUBST([YAT_MINOR_VERSION], [yat_minor_version])
44AC_SUBST([YAT_PATCH_VERSION], [yat_patch_version])
45
46AC_CONFIG_HEADER([config.h])
47m4_include(build_support/ax_prefix_config_h.m4)
48AX_PREFIX_CONFIG_H(yat/[AC_PACKAGE_NAME]-config.h,, config.h)
49
50AM_INIT_AUTOMAKE()
51
52# Set default programming language
53AC_LANG(C++)
54
55# Let user overide default CXXFLAGS
56if test "${CXXFLAGS+set}" != set; then
57  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
58fi
59# Checks for programs.
60AC_PROG_CXX
61AC_PROG_INSTALL
62AC_PROG_SED
63AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [true], [false])
64
65AM_CONDITIONAL(HAVE_DOXYGEN, test "$HAVE_DOXYGEN" = "true")
66
67# Checks for libraries.
68AC_CHECK_LIB(m,main)
69# searching for cblas. Priority 1) find a cblas library, 2) find ATLAS
70# generated cblas, and 3) fall back to GSL cblas implementation. If
71# partial ATLAS is detected the configure script fails.
72cblas_found="no"  # cblas_found may get values yes or no
73# atlas_found may get values yes, no, or partial. In some cases
74# partial atlas may be installed
75atlas_found="no"
76gslcblas_found="no" # gslcblas_found may get values yes or no
77AC_SEARCH_LIBS(cblas_sdsdot,cblas,cblas_found="yes",
78  AC_SEARCH_LIBS(ATL_sdsdot,atlas,
79    AC_SEARCH_LIBS(cblas_sdsdot,cblas,atlas_found="yes",
80                   atlas_found="partial",-m64),
81      AC_SEARCH_LIBS(cblas_dswap,gslcblas,gslcblas_found="yes"),-m64),)
82if test ${atlas_found} = "yes"; then
83  CXXFLAGS="$CXXFLAGS -m64" LDFLAGS="$LDFLAGS -m64"
84fi
85
86# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
87# Including AM_PATH_GSL macro from gsl.m4 distributed by GSL
88gsl_found="no"
89gsl_version="1.8"
90sinclude(./build_support/gsl.m4)
91AX_PATH_GSL(${gsl_version},gsl_found="yes",gsl_version_check="no")
92if test "$gsl_found" = "yes"; then
93   LIBS="-lgsl $LIBS"
94fi
95
96# Checks for header files.
97AC_CHECK_HEADERS([unistd.h])
98
99# Checks for typedefs, structures, and compiler characteristics.
100AC_HEADER_STDBOOL
101AC_C_CONST
102AC_C_INLINE
103AC_TYPE_SIZE_T
104
105# Checks for library functions.
106AC_PROG_LIBTOOL
107AC_FUNC_ERROR_AT_LINE
108AC_HEADER_STDC
109AC_CHECK_FUNCS([pow sqrt])
110
111CXXFLAGS="$CXXFLAGS -Wall -pedantic"
112CPPFLAGS="$CPPFLAGS -DHAVE_INLINE=1"
113AC_ARG_ENABLE(debug,
114  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
115if test "${enable_debug}" = "yes" ; then
116  CXXFLAGS="$CXXFLAGS -g -O"
117  CPPFLAGS="$CPPFLAGS -DYAT_DEBUG=1"
118else
119  CXXFLAGS="$CXXFLAGS -O3"
120  CPPFLAGS="$CPPFLAGS -DNDEBUG -DGSL_RANGE_CHECK_OFF"
121fi
122
123# check for quiet_NaN support in OS
124# At compile time, but this may not work if quiet_NaN exists and returns
125# an incorrect value
126AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()])
127AC_COMPILE_IFELSE(
128  [AC_LANG_PROGRAM(
129    [#include <limits>
130     extern void f(double);],
131    [f(std::numeric_limits<double>::quiet_NaN())])],
132  [quiet_nan=yes],
133  [quiet_nan=no])
134AC_MSG_RESULT($quiet_nan)
135# At run-time, but this has the disadvantage that yat cannot be built 
136# for cross-compilation
137AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true])
138AC_RUN_IFELSE(
139  [AC_LANG_PROGRAM(
140    [#include <limits>],
141    [return !std::numeric_limits<double>::has_quiet_NaN])],
142  [quiet_nan=yes],
143  [quiet_nan=no])
144AC_MSG_RESULT($quiet_nan)
145# Check for infinity support for doubles in OS
146# At run-time, but this has the disadvantage that yat cannot be built 
147# for cross-compilation
148AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true])
149AC_RUN_IFELSE(
150  [AC_LANG_PROGRAM(
151    [#include <limits>],
152    [return !std::numeric_limits<double>::has_infinity])],
153  [has_infinity=yes],
154  [has_infinity=no])
155AC_MSG_RESULT($has_infinity)
156
157
158# yat specific settings
159YAT_LIB="libyat.la"
160YAT_LIB_LOCATION="yat"
161AC_SUBST(YAT_LIB)
162AC_SUBST(YAT_LIB_LOCATION)
163AC_DEFINE([MAJOR_VERSION], [yat_major_version], [Define to yat MAJOR version])
164AC_DEFINE([MINOR_VERSION],[yat_minor_version], [Define to yat MINOR version])
165AC_DEFINE([PATCH_VERSION],[yat_patch_version], [Define to yat PATCH version])
166AC_DEFINE([DEV_BUILD],[yat_dev_build], [false if tagged release])
167
168#doxygen stuff
169DX_HTML_OUTPUT=html
170DX_LATEX_OUTPUT=latex
171AC_SUBST(DX_HTML_OUTPUT)
172AC_SUBST(DX_LATEX_OUTPUT)
173
174
175AC_CONFIG_FILES([Makefile
176     doc/Makefile
177     doc/doxygen.config
178     test/Makefile
179     test/environment.h
180     test/data/Makefile
181     yat/Makefile
182     yat/classifier/Makefile
183     yat/random/Makefile
184     yat/regression/Makefile
185     yat/statistics/Makefile
186     yat/utility/Makefile])
187
188# warning about missing doxygen
189if (test "$HAVE_DOXYGEN" != "true") ; then
190  AC_MSG_WARN([
191  Doxygen was not found. Yat will compile and work without doxygen.
192  However, in order to enable generation of documentation, please
193  install Doxygen available at http://www.doxygen.org/
194  ])
195fi
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
202all_reqs_ok="true"
203
204# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
205# of created binary, will fail.
206if 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!])
211fi
212
213# No support for infinity is fatal -- sub-sequent compilation, or execution
214# of created binary, will fail.
215if 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!])
220fi
221
222
223# Non-existing BLAS is fatal -- sub-sequent compilation will fail.
224if 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.])
230fi
231if test "${atlas_found}" = "partial"; then
232  all_reqs_ok="false"
233  AC_MSG_WARN([
234  Partial ATLAS BLAS library found. Please repair your installation.])
235fi
236
237# Non-existing GSL is fatal -- sub-sequent compilation will fail.
238if 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
249fi
250
251if (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.])
257fi
258
259# Create output.
260AC_OUTPUT
261
262# Some more messages.
263AC_MSG_NOTICE([])
264AC_MSG_NOTICE([ Ready to compile the yat library])
265AC_MSG_NOTICE([ The following flags and libraries will be used:])
266AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
267AC_MSG_NOTICE([  CPPFLAGS=\"$CPPFLAGS\"])
268AC_MSG_NOTICE([  CXXFLAGS=\"$CXXFLAGS\"])
269AC_MSG_NOTICE([  LIBS=\"$LIBS\"])
270AC_MSG_NOTICE([  LDFLAGS=\"$LDFLAGS\"])
271AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
272AC_MSG_NOTICE([])
273if test "${gslcblas_found}" = "yes"; then
274AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
275AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
276AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
277AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
278AC_MSG_NOTICE([])
279fi
280AC_MSG_NOTICE([ Now type 'make ; make check'.])
Note: See TracBrowser for help on using the repository browser.