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