source: trunk/configure.ac @ 1077

Last change on this file since 1077 was 1077, checked in by Jari Häkkinen, 13 years ago

Added check for existence of sed, needed to set variable SED used in makefiles.

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