source: trunk/configure.ac @ 971

Last change on this file since 971 was 969, checked in by Jari Häkkinen, 15 years ago

Addresses #118. ATLAS is now detected, see ticket comments for more info.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 969 2007-10-13 23:57: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#
9# This file is part of the yat library, http://trac.thep.lu.se/trac/yat
10#
11# The yat library is free software; you can redistribute it
12# and/or modify it under the terms of the GNU General Public License as
13# published by the Free Software Foundation; either version 2 of the
14# License, or (at your option) any later version.
15#
16# The yat library is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19# General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software
23# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24# 02111-1307, USA.
25#
26# If you grabbed the source from the subversion repository you should,
27# at top-level, execute:
28#     ./bootstrap
29# To push subsequent changes of this file into the build scripts you
30# must issue:
31#     autoreconf
32
33AC_PREREQ(2.57)
34AC_INIT([yat],[0.4pre],[jari@thep.lu.se])
35AC_CONFIG_SRCDIR([yat/utility/matrix.h])
36AC_CONFIG_AUX_DIR([autotools])
37AC_PREFIX_DEFAULT([/usr/local])
38
39AM_CONFIG_HEADER([config.h])
40AM_INIT_AUTOMAKE()
41
42# Set default programming language
43AC_LANG(C++)
44# reset CXXFLAGS, it has "-g -O2" as default
45CXXFLAGS=""
46
47# Checks for programs.
48AC_PROG_CXX
49AC_PROG_INSTALL
50AC_CHECK_PROG([HAVE_DOXYGEN], [doxygen], [true], [false])
51AC_CHECK_PROG([HAVE_DVIPDFM], [dvipdfm], [true], [false])
52AC_CHECK_PROG([HAVE_LATEX], [latex], [true], [false])
53AC_CHECK_PROG([HAVE_LATEX2HTML], [latex2html], [true], [false])
54
55# Checks for libraries.
56AC_CHECK_LIB(m,main)
57# searching for cblas. Priority 1) find a cblas library, 2) find ATLAS
58# generated cblas, and 3) fall back to GSL cblas implementation. If
59# partial ATLAS is detected the configure script fails.
60AC_SEARCH_LIBS(cblas_sdsdot,cblas,,
61  AC_SEARCH_LIBS(ATL_sdsdot,atlas,
62    AC_SEARCH_LIBS(cblas_sdsdot,cblas,[CXXFLAGS="$CXXFLAGS -m64" LDFLAGS="$LDFLAGS -m64"],
63      AC_MSG_ERROR(partial ATLAS library detected!),-m64),
64                            AC_SEARCH_LIBS(cblas_sdsdot,gslcblas),-m64))
65AC_CHECK_LIB(gsl,main)
66
67# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
68# Including AM_PATH_GSL macro from gsl.m4 distributed by GSL
69sinclude(./build_support/gsl.m4)
70AM_PATH_GSL(1.6,,[AC_MSG_ERROR(could not find required version of GSL)])
71
72# Checks for header files.
73AC_CHECK_HEADERS([unistd.h])
74
75# Checks for typedefs, structures, and compiler characteristics.
76AC_HEADER_STDBOOL
77AC_C_CONST
78AC_C_INLINE
79AC_TYPE_SIZE_T
80
81# Checks for library functions.
82AC_PROG_LIBTOOL
83AC_FUNC_ERROR_AT_LINE
84AC_HEADER_STDC
85AC_CHECK_FUNCS([pow sqrt])
86
87CXXFLAGS="$CXXFLAGS -Wall -pedantic"
88CPPFLAGS="-DHAVE_INLINE=1"
89AC_ARG_ENABLE(debug,
90  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
91if test "${enable_debug}" = "yes" ; then
92  CXXFLAGS="$CXXFLAGS -g -O"
93  CPPFLAGS="$CPPFLAGS -DYAT_DEBUG=1"
94else
95  CXXFLAGS="$CXXFLAGS -O3"
96  CPPFLAGS="$CPPFLAGS -DNDEBUG -DGSL_RANGE_CHECK_OFF"
97fi
98
99# check for quiet_NaN support in OS
100# At compile time, but this may not work if quiet_NaN exists and returns
101# an incorrect value
102AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()])
103AC_COMPILE_IFELSE(
104  [AC_LANG_PROGRAM(
105    [#include <limits>
106     extern void f(double);],
107    [f(std::numeric_limits<double>::quiet_NaN())])],
108  [quiet_nan=yes],
109  [quiet_nan=no])
110AC_MSG_RESULT($quiet_nan)
111if test "${quiet_nan}" = "no" ; then
112  AC_MSG_FAILURE([
113    Support for quiet NAN required.
114    Yat will not work on this system!])
115fi
116# At run-time, but this has the disadvantage that yat cannot be built 
117# for cross-compilation
118AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true])
119AC_RUN_IFELSE(
120  [AC_LANG_PROGRAM(
121    [#include <limits>],
122    [return !std::numeric_limits<double>::has_quiet_NaN])],
123  [quiet_nan=yes],
124  [quiet_nan=no])
125AC_MSG_RESULT($quiet_nan)
126if test "${quiet_nan}" = "no" ; then
127  AC_MSG_FAILURE([
128    Support for quiet NAN required.
129    Yat will not work on this system!])
130fi
131
132# yat specific settings
133YAT_LIB="libyat.la"
134YAT_LIB_LOCATION="yat"
135AC_SUBST(YAT_LIB)
136AC_SUBST(YAT_LIB_LOCATION)
137
138AC_CONFIG_FILES([Makefile
139     doc/Makefile
140     test/Makefile
141     test/data/Makefile
142     yat/Makefile
143     yat/classifier/Makefile
144     yat/random/Makefile
145     yat/regression/Makefile
146     yat/statistics/Makefile
147     yat/utility/Makefile])
148
149AC_OUTPUT
150
151# Only warning about missing programs (needed for docs generation)
152# when in debug mode
153if (test "$enable_debug" == "yes"); then
154   if (test "$HAVE_DOXYGEN" != "true") ; then
155      AC_MSG_WARN([Doxygen was not found. Yat will compile and work
156  without doxygen.  However, in order to enable
157  generation of documentation, please install doxygen
158  available at http://www.doxygen.org/])
159   fi       
160   if (test "$HAVE_LATEX" != "true") ; then
161      AC_MSG_WARN([latex was not found. Yat will compile and work
162  without latex. However, supporting documentation on
163  statistics used in yat cannot be generated without
164  latex.])
165   fi       
166   if (test "$HAVE_DVIPDFM" != "true") ; then
167      AC_MSG_WARN([dvipdfm was not found. Yat will compile and work
168  without dvipdfm. However, pdf document on statistics
169  used in yat cannot be generated without dvipdfm.])
170   fi       
171   if (test "$HAVE_LATEX2HTML" != "true") ; then
172      AC_MSG_WARN([latex2html was not found. Yat will compile and work
173  without Latex. However, html document on statistics
174  used in yat cannot be generated without latex.])
175   fi       
176fi
177
178# Some more messages.
179AC_MSG_NOTICE([])
180AC_MSG_NOTICE([ Ready to compile the yat library])
181AC_MSG_NOTICE([ The following flags and libraries will be used:])
182AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
183AC_MSG_NOTICE([  CPPFLAGS=\"$CPPFLAGS\"])
184AC_MSG_NOTICE([  CXXFLAGS=\"$CXXFLAGS\"])
185AC_MSG_NOTICE([  LIBS=\"$LIBS\"])
186AC_MSG_NOTICE([  LDFLAGS=\"$LDFLAGS\"])
187AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
188AC_MSG_NOTICE([])
189AC_MSG_NOTICE([ Now type 'make ; make check'.])
Note: See TracBrowser for help on using the repository browser.