source: trunk/configure.ac @ 951

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

Addresses #118. Adding gsl.m4 as suggested by Peter since configure fails without it on my machine.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.4 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 951 2007-10-09 03:54:37Z 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
30AC_PREREQ(2.57)
31AC_INIT([yat],[0.4pre],[jari@thep.lu.se])
32AC_CONFIG_SRCDIR([yat/utility/matrix.h])
33AC_CONFIG_AUX_DIR([autotools])
34AC_PREFIX_DEFAULT([/usr/local])
35
36AM_CONFIG_HEADER([config.h])
37AM_INIT_AUTOMAKE()
38
39# Checks for programs.
40AC_PROG_CXX
41AC_PROG_INSTALL
42AC_CHECK_PROG([DOXYGEN], [doxygen], [yes], [no])
43AC_CHECK_PROG([DVIPDFM], [dvipdfm], [yes], [no])
44AC_CHECK_PROG([LATEX], [latex], [yes], [no])
45AC_CHECK_PROG([LATEX2HTML], [latex2html], [yes], [no])
46
47# Checks for libraries.
48AC_CHECK_LIB(m,main)
49AC_SEARCH_LIBS(ATL_ctrsv,atlas,,
50  AC_SEARCH_LIBS(cblas_sdsdot,gslcblas))
51AC_CHECK_LIB(gsl,main)
52
53# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
54# Including AM_PATH_GSL macro from gsl.m4 distributed by GSL
55sinclude(./build_support/gsl.m4)
56AM_PATH_GSL(1.6,,[AC_MSG_ERROR(could not find required version of GSL)])
57
58# Set default programming language
59AC_LANG(C++)
60
61# Checks for header files.
62AC_CHECK_HEADERS([unistd.h])
63
64# Checks for typedefs, structures, and compiler characteristics.
65AC_HEADER_STDBOOL
66AC_C_CONST
67AC_C_INLINE
68AC_TYPE_SIZE_T
69
70# Checks for library functions.
71AC_PROG_LIBTOOL
72AC_FUNC_ERROR_AT_LINE
73AC_HEADER_STDC
74AC_CHECK_FUNCS([pow sqrt])
75
76CXXFLAGS="-Wall -pedantic"
77CPPFLAGS="-DHAVE_INLINE=1"
78AC_ARG_ENABLE(debug,
79  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
80if test "${enable_debug}" = "yes" ; then
81  CXXFLAGS="$CXXFLAGS -g -O"
82  CPPFLAGS="$CPPFLAGS -DYAT_DEBUG=1"
83else
84  CXXFLAGS="$CXXFLAGS -O3"
85  CPPFLAGS="$CPPFLAGS -DNDEBUG -DGSL_RANGE_CHECK_OFF"
86fi
87CFLAGS="$CXXFLAGS"
88
89# check for quiet_NaN support in OS
90# At compile time, but this may not work if quiet_NaN exists and returns
91# an incorrect value
92AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()])
93AC_COMPILE_IFELSE(
94  [AC_LANG_PROGRAM(
95    [#include <limits>
96     extern void f(double);],
97    [f(std::numeric_limits<double>::quiet_NaN())])],
98  [quiet_nan=yes],
99  [quiet_nan=no])
100AC_MSG_RESULT($quiet_nan)
101if test "${quiet_nan}" = "no" ; then
102  AC_MSG_FAILURE([
103    Support for quiet NAN required.
104    Yat will not work on this system!])
105fi
106# At run-time, but this has the disadvantage that yat cannot be built 
107# for cross-compilation
108AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true])
109AC_RUN_IFELSE(
110  [AC_LANG_PROGRAM(
111    [#include <limits>],
112    [return !std::numeric_limits<double>::has_quiet_NaN])],
113  [quiet_nan=yes],
114  [quiet_nan=no])
115AC_MSG_RESULT($quiet_nan)
116if test "${quiet_nan}" = "no" ; then
117  AC_MSG_FAILURE([
118    Support for quiet NAN required.
119    Yat will not work on this system!])
120fi
121
122# yat specific settings
123YAT_LIB="libyat.la"
124YAT_LIB_LOCATION="yat"
125AC_SUBST(YAT_LIB)
126AC_SUBST(YAT_LIB_LOCATION)
127
128AC_CONFIG_FILES([Makefile
129     doc/Makefile
130     test/Makefile
131     test/data/Makefile
132     yat/Makefile
133     yat/classifier/Makefile
134     yat/random/Makefile
135     yat/regression/Makefile
136     yat/statistics/Makefile
137     yat/utility/Makefile])
138
139AC_OUTPUT
140
141# Only warning about missing programs (needed for docs generation)
142# when in debug mode
143if (test "$enable_debug" == "yes"); then
144   if (test "$DOXYGEN" != "yes") ; then
145      AC_MSG_WARN([Doxygen was not found. Yat will compile and work
146  without doxygen.  However, in order to enable
147  generation of documentation, please install doxygen
148  available at http://www.doxygen.org/])
149   fi       
150   if (test "$LATEX" != "yes") ; then
151      AC_MSG_WARN([latex was not found. Yat will compile and work
152  without latex. However, supporting documentation on
153  statistics used in yat cannot be generated without
154  latex.])
155   fi       
156   if (test "$DVIPDFM" != "yes") ; then
157      AC_MSG_WARN([dvipdfm was not found. Yat will compile and work
158  without dvipdfm. However, pdf document on statistics
159  used in yat cannot be generated without dvipdfm.])
160   fi       
161   if (test "$LATEX2HTML" != "yes") ; then
162      AC_MSG_WARN([latex2html was not found. Yat will compile and work
163  without Latex. However, html document on statistics
164  used in yat cannot be generated without latex.])
165   fi       
166fi
167
168# Some more messages.
169AC_MSG_NOTICE([])
170AC_MSG_NOTICE([ Ready to compile the yat library])
171AC_MSG_NOTICE([ The following flags and libraries will be used:])
172AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
173AC_MSG_NOTICE([  CPPFLAGS=\"$CPPFLAGS\"])
174AC_MSG_NOTICE([  CXXFLAGS=\"$CXXFLAGS\"])
175AC_MSG_NOTICE([  LIBS=\"$LIBS\"])
176AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
177AC_MSG_NOTICE([])
178AC_MSG_NOTICE([ Now type 'make ; make check'.])
Note: See TracBrowser for help on using the repository browser.