source: trunk/configure.ac @ 1500

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

Added structure to deprecate functions. I chose to use a gcc style,
and it is tested in configure whether the compiler supports it. If not
the deprecation has no effect. Using a deprecated function will cause
a compiler warning. In gcc the warning can be turned off with
'-Wno-deprecated'. Possibly we should turn off the warning by default,
so a user has to turn it on by defining
-DYAT_DISABLE_DEPRECATED...

fixes #367

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 12.4 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 1500 2008-09-15 18:47:37Z 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://dev.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 3 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 yat. If not, see <http://www.gnu.org/licenses/>.
24#
25# If you grabbed the source from the subversion repository you should,
26# at top-level, execute:
27#     ./bootstrap
28# To push subsequent changes of this file into the build scripts you
29# must issue:
30#     autoreconf
31
32m4_include([./build_support/version.m4])
33AC_INIT([yat],[YAT_VERSION],[jari@thep.lu.se])
34AC_PREREQ(2.60)
35AC_CONFIG_SRCDIR([yat/utility/Matrix.h])
36AC_CONFIG_AUX_DIR([autotools])
37dnl arg below should be the same as in Makefile.am
38AC_CONFIG_MACRO_DIR([build_support])
39AC_PREFIX_DEFAULT([/usr/local])
40
41AC_SUBST([YAT_LT_VERSION], [LT_VERSION])
42AC_SUBST([YAT_MAJOR_VERSION], [MAJOR_VERSION])
43AC_SUBST([YAT_MINOR_VERSION], [MINOR_VERSION])
44AC_SUBST([YAT_PATCH_VERSION], [PATCH_VERSION])
45AC_SUBST([YAT_DEV_BUILD], [DEV_BUILD])
46
47AC_CONFIG_HEADER([config.h])
48AM_INIT_AUTOMAKE()
49
50# Set default programming language
51AC_LANG(C++)
52
53# Let user overide default CXXFLAGS
54if test "${CXXFLAGS+set}" != set; then
55  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
56fi
57# Checks for programs.
58AC_PROG_CXX
59AC_PROG_INSTALL
60AC_PROG_SED
61
62AC_MSG_NOTICE(dnl
63[checking whether tools for generating documentation are available])
64
65have_dox_tools="yes"
66AC_PATH_PROG([DOXYGEN], [doxygen], [no])
67if test "$DOXYGEN" = "no"; then
68   AC_MSG_WARN([unable to find doxygen application])
69   have_dox_tools=no
70else
71   doxygen_min_version=1.5
72   AC_MSG_CHECKING([if doxygen is at least $doxygen_min_version])
73   doxygen_version=`$DOXYGEN --version`
74   AX_COMPARE_VERSION([$doxygen_version], [ge], [$doxygen_min_version], ,
75                      [have_dox_tools=no])
76   AC_MSG_RESULT([$doxygen_version])
77fi
78AC_CHECK_PROG([have_epstopdf], [epstopdf], [yes], [no])
79if test "$have_epstopdf" != "yes"; then
80   AC_MSG_WARN([unable to find epstopdf application])
81   have_dox_tools=no
82fi
83AC_CHECK_PROG([have_latex], [latex], [yes], [no])
84if test "$have_latex" != "yes"; then
85   AC_MSG_WARN([unable to find latex application])
86fi
87AC_CHECK_PROG([have_makeindex], [makeindex], [yes], [no])
88if test "$have_makeindex" != "yes"; then
89   AC_MSG_WARN([unable to find makeindex application])
90   have_dox_tools=no
91fi
92AC_CHECK_PROG([have_pdflatex], [pdflatex], [yes], [no])
93if test "$have_pdflatex" != "yes"; then
94   AC_MSG_WARN([unable to find pdflatex application])
95   have_dox_tools=no
96fi
97
98AM_CONDITIONAL(HAVE_DOXYGEN, test "$have_dox_tools" = "yes")
99AC_CONFIG_FILES([test/documentation_test.sh],
100                [chmod +x test/documentation_test.sh])
101
102# Save user-defined environment settings for later restoration
103APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
104APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
105APR_SAVE_THE_ENVIRONMENT(LDFLAGS)
106
107# Checks for libraries.
108AC_MSG_NOTICE([checking for libraries])
109AC_CHECK_LIB(m,main)
110# searching for cblas. Priority 1) find a cblas library, 2) find ATLAS
111# generated cblas, and 3) fall back to GSL cblas implementation. If
112# partial ATLAS is detected the configure script fails.
113cblas_found="no"  # cblas_found may get values yes or no
114# atlas_found may get values yes, no, or partial. In some cases
115# partial atlas may be installed
116atlas_found="no"
117gslcblas_found="no" # gslcblas_found may get values yes or no
118AC_SEARCH_LIBS(cblas_sdsdot,cblas,cblas_found="yes",
119  AC_SEARCH_LIBS(ATL_sdsdot,atlas,
120    AC_SEARCH_LIBS(cblas_sdsdot,cblas,atlas_found="yes",
121                   atlas_found="partial",-m64),
122      AC_SEARCH_LIBS(cblas_dswap,gslcblas,gslcblas_found="yes"),-m64),)
123# CBLAS used in test of GSL
124gsl_cblas_lib=-lgslcblas
125if test ${cblas_found} = "yes"; then
126  gsl_cblas_lib=-lcblas
127fi
128if test ${atlas_found} = "yes"; then
129  CXXFLAGS="$CXXFLAGS -m64" LDFLAGS="$LDFLAGS -m64"
130  gsl_cblas_lib=-latlas
131fi
132export GSL_CBLAS_LIB=${gsl_cblas_lib}
133
134# GNU Scientific Library, GSL http://www.gnu.org/software/gsl/, checks
135# Including AX_PATH_GSL macro from gsl.m4 distributed by GSL
136gsl_found="no"
137gsl_version="1.8"
138AC_SUBST(gsl_version)
139AX_PATH_GSL(${gsl_version},gsl_found="yes",gsl_version_check="no")
140if test "$gsl_found" = "yes"; then
141   LIBS="-lgsl $LIBS"
142   # grep words starting with '-L' in other words LDFLAGS
143   for i in $GSL_LIBS; do
144     if test ${i:0:2} = "-L"; then
145       LDFLAGS="$LDFLAGS $i"
146     fi
147   done
148fi
149
150# Boost http://www.boost.org
151boost_version=1.33
152AC_SUBST(boost_version)
153AX_BOOST_BASE("$boost_version")
154boost_version_check=$succeeded;
155CPPFLAGS="$BOOST_CPPFLAGS $CPPFLAGS"
156
157# Checks for library functions.
158AC_PROG_LIBTOOL
159
160#support for large files
161AC_SYS_LARGEFILE
162if test "$enable_largefile" = "no"; then
163  AC_DEFINE([YAT_LFS_DISABLED], 1,
164            [defined to 1 if large file support is disabled])
165fi
166
167# we use AM_* for variables that are solely needed for building yat,
168# i.e., they are not needed for a user of yat and are not propagated
169# to yat-config or yat.m4.
170AM_CXXFLAGS="$AM_CXXFLAGS -Wall -pedantic"
171CPPFLAGS="$CPPFLAGS -DHAVE_INLINE=1"
172AC_ARG_ENABLE(debug,
173  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
174if test "${enable_debug}" = "yes" ; then
175  AM_CXXFLAGS="$AM_CXXFLAGS -g -O"
176  AM_CPPFLAGS="$AM_CPPFLAGS -DYAT_DEBUG=1"
177else
178  AM_CXXFLAGS="$CXXFLAGS -O3"
179  CPPFLAGS="$CPPFLAGS -DGSL_RANGE_CHECK_OFF"
180  AM_CPPFLAGS="$CPPFLAGS -DNDEBUG"
181fi
182
183# check for quiet_NaN support in OS
184# Check at run-time, but if we are cross-compiling fall back on a
185# compilation test
186AC_MSG_CHECKING([if std::numeric_limits<>::has_quiet_NaN is true])
187AC_RUN_IFELSE(
188  [AC_LANG_PROGRAM(
189    [@%:@include <limits>],
190    [return !std::numeric_limits<double>::has_quiet_NaN])],
191  [quiet_nan=yes
192   AC_MSG_RESULT($quiet_nan)],
193  [quiet_nan=no
194   AC_MSG_RESULT($quiet_nan)],
195  # if we are cross-compiling fall back on compilation test
196  [AC_MSG_RESULT(cross-compiling)
197   AC_MSG_CHECKING([for std::numeric_limits<>::quiet_NaN()])
198    AC_COMPILE_IFELSE(
199     [AC_LANG_PROGRAM(
200        [@%:@include <limits>
201         extern void f(double);],
202        [f(std::numeric_limits<double>::quiet_NaN())])],
203     [quiet_nan=yes],
204     [quiet_nan=no])
205   AC_MSG_RESULT($quiet_nan)])
206# Check for infinity support for doubles in OS
207# Check at run-time, but if we are cross-compiling fall back on a
208# compilation test
209AC_MSG_CHECKING([if std::numeric_limits<>::has_infinity is true])
210AC_RUN_IFELSE(
211  [AC_LANG_PROGRAM(
212    [@%:@include <limits>],
213    [return !std::numeric_limits<double>::has_infinity])],
214  [has_infinity=yes
215   AC_MSG_RESULT($has_infinity)],
216  [has_infinity=no
217   AC_MSG_RESULT($has_infinity)],
218  # if we are cross-compiling fall back on compilation test
219  [AC_MSG_RESULT(cross-compiling)
220   AC_MSG_CHECKING([for std::numeric_limits<>::infinity()])
221    AC_COMPILE_IFELSE(
222     [AC_LANG_PROGRAM(
223        [@%:@include <limits>
224         extern void f(double);],
225        [f(std::numeric_limits<double>::infinity())])],
226     [has_infinity=yes],
227     [has_infinity=no])
228   AC_MSG_RESULT($has_infinity)])
229
230AC_MSG_CHECKING([g++ deprecation attribute])
231AC_TRY_COMPILE([void f() __attribute__ ((deprecated));], [],
232               AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1],
233          [Define if compiler supports deprecated attribute, as in g++ 4.0])
234               AC_MSG_RESULT([yes]),
235               AC_MSG_RESULT([no]) )
236
237
238# yat specific settings
239YAT_LIBNAME="yat"
240YAT_LIB_LOCATION="yat"
241AC_SUBST(YAT_LIBNAME)
242AC_SUBST(YAT_LIB)
243AC_SUBST(YAT_LIB_LOCATION)
244
245#doxygen stuff
246DX_HTML_OUTPUT=html
247DX_LATEX_OUTPUT=latex
248AC_SUBST(DX_HTML_OUTPUT)
249AC_SUBST(DX_LATEX_OUTPUT)
250
251
252AC_CONFIG_FILES([Makefile
253     build_support/yat.pc
254     doc/Makefile
255     doc/doxygen.config
256     doc/first_page.doxygen
257     test/Makefile
258     test/environment.h
259     test/data/Makefile
260     yat/Makefile
261     yat/classifier/Makefile
262     yat/normalizer/Makefile
263     yat/random/Makefile
264     yat/regression/Makefile
265     yat/statistics/Makefile
266     yat/utility/version.h
267     yat/utility/Makefile])
268
269AC_CONFIG_FILES([build_support/yat-config],
270                [chmod +x build_support/yat-config])
271
272AC_CONFIG_HEADER([yat/utility/config_public.h])
273
274# warning about missing doxygen
275if (test "$have_dox_tools" != "yes") ; then
276  AC_MSG_WARN([
277  Some pre-requisites for generating documentation were not
278  fulfilled. The build will not create any documentation.
279  Please consult the 'README' file for more information about
280  what is needed to generate documentation and refer to above
281  warning messages.
282  ])
283fi
284
285# Print failure status information about selected items, and exit if
286# fatal errors were encountered. No output will be created if
287# configure is halted prematurely.
288
289# used to trigger exit before creation of output
290all_reqs_ok="true"
291
292# No support for quiet NAN is fatal -- sub-sequent compilation, or execution
293# of created binary, will fail.
294if test "${quiet_nan}" = "no" ; then
295  all_reqs_ok="false"
296  AC_MSG_WARN([
297  Support for quiet NAN required.
298  Yat will not work on this system!])
299fi
300
301# No support for infinity is fatal -- sub-sequent compilation, or execution
302# of created binary, will fail.
303if test "${has_infinity}" = "no" ; then
304  all_reqs_ok="false"
305  AC_MSG_WARN([
306  Support for infinity required.
307  Yat will not work on this system!])
308fi
309
310
311# Non-existing BLAS is fatal -- sub-sequent compilation will fail.
312if test "${cblas_found}" = "no" -a "${atlas_found}" = "no" -a "${gslcblas_found}" = "no"; then
313  all_reqs_ok="false"
314  AC_MSG_WARN([
315  cBLAS not found. The C implementation of Basic Linear Algebra
316  Subprograms (cBLAS) library cannot be found. Please make sure
317  cBLAS is installed.])
318fi
319if test "${atlas_found}" = "partial"; then
320  all_reqs_ok="false"
321  AC_MSG_WARN([
322  Partial ATLAS BLAS library found. Please repair your installation.])
323fi
324
325# Non-existing GSL is fatal -- sub-sequent compilation will fail.
326if test "${gsl_found}" = "no" ; then
327  all_reqs_ok="false"
328  if test "${gsl_version_check}" = "no" ; then
329  AC_MSG_WARN([
330  GSL found but not the required version. Please install
331  GSL version ${gsl_version} or later])
332  else
333  AC_MSG_WARN([
334  GSL not found. The GNU Scientific Library (GSL) library cannot be
335  found. Please make sure GSL is installed.])
336  fi
337fi
338
339# Too old Boost is fatal -- sub-sequent compilation will fail.
340if test "${boost_version_check}" != "yes" ; then
341  all_reqs_ok="false"
342  AC_MSG_WARN([
343  Boost found but not the required version. Please install
344  Boost version ${boost_version} or later])
345fi
346
347if (test "$all_reqs_ok" = "false") ; then
348  AC_MSG_FAILURE([
349  Some pre-requisites were not fulfilled, aborting configure.
350  Please consult the 'README' file for more information about what
351  is needed to compile yat and refer to above warning messages.
352  Needed files were NOT created.])
353fi
354
355# Reset flags
356APR_RESTORE_THE_ENVIRONMENT(CPPFLAGS, EXTRA_)
357APR_RESTORE_THE_ENVIRONMENT(CXXFLAGS, EXTRA_)
358APR_RESTORE_THE_ENVIRONMENT(LDFLAGS, EXTRA_)
359
360AM_CPPFLAGS="-I\$(top_srcdir) $AM_CPPFLAGS $EXTRA_CPPFLAGS"
361AM_CXXFLAGS="$AM_CXXFLAGS $EXTRA_CXXFLAGS"
362AM_LDFLAGS="$AM_LDFLAGS $EXTRA_LDFLAGS"
363
364AC_SUBST(AM_CPPFLAGS)
365AC_SUBST(AM_CXXFLAGS)
366AC_SUBST(AM_LDFLAGS)
367
368# Create output.
369AC_OUTPUT
370
371# Some more messages.
372AC_MSG_NOTICE([])
373AC_MSG_NOTICE([ Ready to compile the yat library])
374AC_MSG_NOTICE([ The following flags and libraries will be used:])
375AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
376AC_MSG_NOTICE([  CPPFLAGS=\"$CPPFLAGS\"])
377AC_MSG_NOTICE([  AM_CPPFLAGS=\"$AM_CPPFLAGS\"])
378AC_MSG_NOTICE([  CXXFLAGS=\"$CXXFLAGS\"])
379AC_MSG_NOTICE([  AM_CXXFLAGS=\"$AM_CXXFLAGS\"])
380AC_MSG_NOTICE([  LDFLAGS=\"$LDFLAGS\"])
381AC_MSG_NOTICE([  AM_LDFLAGS=\"$AM_LDFLAGS\"])
382AC_MSG_NOTICE([  LIBS=\"$LIBS\"])
383AC_MSG_NOTICE([ +++++++++++++++++++++++++++++++++++++++++++++++])
384AC_MSG_NOTICE([])
385if test "${gslcblas_found}" = "yes"; then
386AC_MSG_NOTICE([ GSL BLAS found. This is a reference implementation only.])
387AC_MSG_NOTICE([ Consider using hardware optimized BLAS.])
388AC_MSG_NOTICE([ ATLAS (http://math-atlas.sourceforge.net/) provides an])
389AC_MSG_NOTICE([ optimized BLAS library. It is supported by yat!])
390AC_MSG_NOTICE([])
391fi
392AC_MSG_NOTICE([ Now type 'make ; make check'.])
Note: See TracBrowser for help on using the repository browser.