source: trunk/configure.ac @ 1221

Last change on this file since 1221 was 1192, checked in by Peter Johansson, 11 years ago

closes #479. yat deprecation arning are turned on

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 15.2 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 1192 2010-10-02 15:09:04Z peter $
4##
5## If you grabbed the source from subversion you should, at top-level,
6## execute:
7##          ./bootstrap
8## To push subsequent changes of this file into the build scripts you
9## must issue:
10##          autoreconf
11
12# Copyright (C) 2005 Jari Häkkinen, Peter Johansson
13# Copyright (C) 2006 Jari Häkkinen
14# Copyright (C) 2007, 2008, 2009, 2010 Jari Häkkinen, Peter Johansson
15#
16# This file is part of svndigest, http://dev.thep.lu.se/svndigest
17#
18# svndigest is free software; you can redistribute it and/or modify it
19# under the terms of the GNU General Public License as published by
20# the Free Software Foundation; either version 3 of the License, or
21# (at your option) any later version.
22#
23# svndigest is distributed in the hope that it will be useful, but
24# WITHOUT ANY WARRANTY; without even the implied warranty of
25# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
26# General Public License for more details.
27#
28# You should have received a copy of the GNU General Public License
29# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
30
31AC_PREREQ([2.63])
32
33m4_include([m4/version.m4])
34AC_INIT([svndigest], m4_defn([SVNDIGEST_VERSION]),
35        [svndigest-users@lists.sourceforge.net],,
36        [http://dev.thep.lu.se/svndigest])
37AC_CONFIG_SRCDIR([lib/File.h])
38AC_CONFIG_AUX_DIR([autotools])
39dnl arg below should be the same as in Makefile.am
40AC_CONFIG_MACRO_DIR([m4])
41AC_PREFIX_DEFAULT([/usr/local])
42
43dnl FIXME remove when we assume autoconf 2.64
44m4_ifndef([AC_PACKAGE_URL],
45          [AC_DEFINE([PACKAGE_URL], ["http://dev.thep.lu.se/svndigest"],
46                     [Define to home page for this package])
47           AC_SUBST([PACKAGE_URL], ["http://dev.thep.lu.se/svndigest"])])
48
49# propagate RELEASE_YEAR from file .release_year
50RELEASE_YEAR=`cat $srcdir/.release_year`
51AC_SUBST([RELEASE_YEAR])
52AC_DEFINE_UNQUOTED([RELEASE_YEAR], ["$RELEASE_YEAR"],
53                   [Define year package was last modified])
54AC_SUBST([CONFIG_STATUS_DEPENDENCIES], ['$(top_srcdir)/.release_year'])
55
56AC_SUBST([SVNDIGEST_MAJOR_VERSION], [MAJOR_VERSION])
57AC_SUBST([SVNDIGEST_MINOR_VERSION], [MINOR_VERSION])
58AC_SUBST([SVNDIGEST_PATCH_VERSION], [PATCH_VERSION])
59
60AC_DEFINE([DEV_BUILD],[SVNDIGEST_DEV_BUILD],
61          [true if dev build (version ends with pre)])
62AC_DEFINE([SVNDIGEST_MAJOR_VERSION], [MAJOR_VERSION],
63                    [Define to the svndigest major version])
64AC_DEFINE([SVNDIGEST_MINOR_VERSION], [MINOR_VERSION],
65                    [Define to the svndigest minor version])
66AC_DEFINE([SVNDIGEST_PATCH_VERSION], [PATCH_VERSION],
67                    [Define to the svndigest patch version])
68
69AC_CONFIG_HEADERS([config.h])
70AM_INIT_AUTOMAKE([1.11 color-tests std-options parallel-tests])
71
72dnl create bin/svndigest-copy-cache.in at autoconf time and let
73dnl config.status create bin/svndigest-copy-cache from
74dnl bin/svndigest-copy-cache.in
75m4_pushdef([FILE], [svndigest-copy-cache])
76m4_pushdef([my_m4sh_options], [-m 0644])
77dnl me cd down in bin to have same output as when created from Makefile
78m4_syscmd([cd bin && autom4te -l M4sh -o ]FILE[.in ]my_m4sh_options FILE[.as])
79AC_CONFIG_FILES([bin/]FILE[], [chmod +x bin/]FILE[ && chmod a-w bin/]FILE[])
80dnl export options so we can use the same in Makefile
81AC_SUBST([M4SH_OPTIONS], ['my_m4sh_options'])
82m4_popdef([my_m4sh_options])
83m4_popdef([FILE])
84AM_MISSING_PROG([AUTOM4TE], [autom4te])
85
86# Set default programming language
87AC_LANG([C++])
88
89# propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS
90for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do
91  eval isset=\${$var+set}
92  if test "$isset" = 'set' ; then
93    eval val=$`echo $var`
94    DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' "
95  fi
96done
97AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
98
99# Let user overide default CXXFLAGS
100if test "${CXXFLAGS+set}" != set; then
101  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
102fi
103
104# Checks for programs.
105AC_PROG_CXXCPP
106AC_PROG_CXX
107AC_PROG_RANLIB
108AC_PROG_SED
109AM_MISSING_PROG([HELP2MAN], [help2man])
110# look for pkg-config
111PKG_PROG_PKG_CONFIG([0.23])
112
113# Save FLAGS
114APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
115APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
116
117# -Wno-long-long is needed to suppress compiler diagnostics regarding
118# using extension beyond the C++ standard (usage of non C++ standard
119# 'long long' types).
120YAT_CXX_ADD_FLAG([CXXFLAGS],[-pedantic -Wno-long-long])
121AC_TYPE_LONG_LONG_INT
122AS_IF([test x$ac_cv_type_long_long_int = xno],
123      [AC_MSG_ERROR([compiler does not support long long int])]
124     )
125
126AC_ARG_ENABLE([debug],
127  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
128
129AS_IF([test x$enable_debug = xyes],
130  [YAT_CXX_ADD_FLAG([CXXFLAGS],[-g -O])],
131  [YAT_CPP_ADD_FLAG([CPPFLAGS],[-DNDEBUG])
132   YAT_CXX_ADD_FLAG([CXXFLAGS],[-O3])])
133
134AC_MSG_CHECKING([g++ deprecation attribute])
135AC_COMPILE_IFELSE(
136  [AC_LANG_PROGRAM([[void f() __attribute__ ((deprecated));]],)], 
137  [AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1],
138             [Define if compiler supports deprecated attribute, as in g++ 4.0])
139   AC_MSG_RESULT([yes])],
140  [AC_MSG_RESULT([no])] )
141
142# Apache Portable Runtime (APR) API checks
143APR_FIND_APR(,,[1],[1 0])
144AS_IF([test "${with_apr+set}" = set],
145    [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-apr=$with_apr"]
146)
147if test "$apr_found" = "yes" ; then
148    APR_LIBS="`$apr_config --libs`"
149    apr_link_ld="`$apr_config --link-ld`"
150    for i in $apr_link_ld; do
151      AS_IF([test ${i:0:2} = "-l"],[APR_LIBS="$i $APR_LIBS"],
152            [YAT_LD_ADD_FLAG([LDFLAGS], [$i])])
153    done
154    YAT_CPP_ADD_FLAG([CPPFLAGS],[`$apr_config --includes --cppflags`])
155    AC_CHECK_HEADER([apr_allocator.h],,[apr_found="no"])
156fi
157AC_SUBST([APR_LIBS])
158
159# Subversion API checks
160svn_found="yes"
161AC_ARG_WITH([svn],
162  [AS_HELP_STRING([--with-svn=DIR],[prefix for svn developer files [[PREFIX]]])],
163  [ AS_CASE([$withval], [yes|no],
164            [AC_MSG_ERROR([--with-svn requires a directory to be provided])])
165    AS_IF([test -d $with_svn], [],
166          [AC_MSG_ERROR([$with_svn: no such directory])])
167    # transform argument to absolute path
168    with_svn=`cd $with_svn && pwd`
169    DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-svn=$with_svn"
170    YAT_LD_ADD_FLAG([LDFLAGS], [-L$with_svn/lib])
171    YAT_CPP_ADD_FLAG([CPPFLAGS], [-I$with_svn/include])
172  ])
173# svn needs needs apr headers
174AC_CHECK_HEADER([subversion-1/svn_types.h],,[svn_found="no"])
175
176save_LIBS=$LIBS
177tmp_LIBS="$APR_LIBS $save_LIBS"
178LIBS=""
179AC_SEARCH_LIBS([svn_cmdline_setup_auth_baton],[svn_subr-1],
180               [], [svn_found="no"], [$tmp_LIBS])
181AC_SEARCH_LIBS([svn_ra_initialize],[svn_ra-1], [], [svn_found="no"],[$tmp_LIBS])
182AC_SEARCH_LIBS([svn_wc_adm_open3],[svn_wc-1], [], [svn_found="no"], [$tmp_LIBS])
183AC_SEARCH_LIBS([svn_diff_file_options_create],[svn_diff-1],[],
184               [svn_found="no"], [$tmp_LIBS])
185AC_SEARCH_LIBS([svn_client_log3],[svn_client-1],,[svn_found="no"], [$tmp_LIBS])
186SVN_LIBS=$LIBS
187LIBS=$save_LIBS
188AC_SUBST([SVN_LIBS])
189
190
191# check if svnversion is installed
192AC_PATH_PROG([SVNVERSION], [svnversion], [no])
193
194# PLplot API checks
195# plplot_found can get values: skip, noheader, old, or nolib if an
196# error is detected.
197plplot_found="yes"
198plplot_version=5.9.6
199save_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
200AC_ARG_WITH([plplot],
201  [AS_HELP_STRING([--with-plplot=DIR],[prefix for plplot developer files])],
202  [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-plplot=$withval"
203   AS_IF([test "x$withval" = "xno"], [ dnl
204     plplot_found=skip;
205   ], [ dnl
206     AS_IF([test -d $with_plplot], [],
207           [AC_MSG_ERROR([$with_plplot: no such directory])])
208     with_plplot=`cd $with_plplot && pwd`
209     # help pkg-config find .pc file
210     PKG_CONFIG_PATH=$with_plplot/lib/pkgconfig$PATH_SEPARATOR$PKG_CONFIG_PATH
211     export PKG_CONFIG_PATH
212   ])
213  ])
214
215use_plplot_pc="no"
216AS_IF([test "x$plplot_found" = "xyes" && test -n "$PKG_CONFIG"], [
217  AC_MSG_CHECKING([for plplotd-c++.pc])
218  AS_IF([$PKG_CONFIG --exists plplotd-c++], [
219    AC_MSG_RESULT([yes])
220    use_plplot_pc="yes"
221  ],[
222    AC_MSG_RESULT([no])
223    AC_MSG_WARN([cannot find plplotd-c++;
224      please use --with-plplot with appropriate argument to get more accurate
225      configuration.])
226  ])
227])
228
229AS_IF([test "x$plplot_found" = "xyes"], [
230  # copy flags if we have found pc file
231  AS_IF([test "$use_plplot_pc" = "yes"], [
232    YAT_LD_ADD_FLAG([LDFLAGS], [`$PKG_CONFIG plplotd-c++ --libs-only-L`])
233    PLPLOT_LIBS="`$PKG_CONFIG plplotd-c++ --libs-only-l --libs-only-other`"
234  ],[
235    # otherwise guess
236    PLPLOT_LIBS="-lplplotcxxd -lplplotd";
237    AS_IF([test -n "$with_plplot" && test "x$with_plplot" != "xyes"], [
238      YAT_LD_ADD_FLAG([LDFLAGS], [-L$with_plplot/lib])
239    ])
240  ])
241  # don't use `pkg-config --cflags' because it returns
242  # `PREFIX/include/plplot' rather than `PREFIX/include'
243  AS_IF([test -n "$with_plplot" && test "x$with_plplot" != "xyes"], [
244    YAT_CPP_ADD_FLAG([CPPFLAGS], [-I$with_plplot/include])
245  ])
246])
247                 
248AS_IF([test "x$plplot_found" = "xyes"], [
249  AC_CHECK_HEADER([plplot/plstream.h], [], [plplot_found="noheader"])
250])
251
252
253AS_IF([test "x$plplot_found" = "xyes" && test -n "$PKG_CONFIG"], [
254  AC_MSG_CHECKING([plplot version >= $plplot_version])
255  AS_IF([$PKG_CONFIG --atleast-version=$plplot_version plplotd-c++], [
256    AC_MSG_RESULT([yes])
257  ],[
258    have_plplot_version=`$PKG_CONFIG --modversion plplotd-c++`
259    AC_MSG_RESULT([$have_plplot_version])
260    plplot_found="old"
261  ])
262])
263
264AS_IF([test "x$plplot_found" = "xyes"], [
265  save_LIBS=$LIBS
266  LIBS="$PLPLOT_LIBS $LIBS"
267  AC_MSG_CHECKING([for library containing plstream])
268  AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include <plplot/plstream.h>],
269                                  [plstream pls(1,1,"svg", "conftest.svg");
270                                   pls.scolbga(255, 255, 255, 0);
271                                  ])],
272                 [AC_MSG_RESULT([yes]);
273                  AC_DEFINE([HAVE_PLPLOT], [1],
274                            [Define to 1 if you have plplot])],
275                 [AC_MSG_RESULT([no])
276                  plplot_found=nolib;])
277  LIBS=$save_LIBS
278])
279# restore variable
280export PKG_CONFIG_PATH=$save_PKG_CONFIG_PATH
281AC_SUBST(PLPLOT_LIBS)
282
283# checking if we build in a subversion WC
284AS_IF([test -d $srcdir/.svn], [wc_found="yes"], [wc_found="no"])
285AM_CONDITIONAL([HAVE_SVN_WC], [test "$wc_found" = "yes"])
286AC_SUBST([wc_found])
287
288# checking if we have test repo
289test_repo_filename=$srcdir/test/repo;
290AS_IF([test -r $test_repo_filename],
291              [AC_DEFINE([HAVE_TEST_REPO],[1],[define if test repo is available])
292               test_repo_found="yes"],
293              [test_repo_found="no"])
294AC_SUBST([test_repo_found])
295AS_IF([test "x$test_repo_found" = xyes],
296      [abs_test_repo=`cd $test_repo_filename && pwd`;
297       AC_SUBST(abs_test_repo)]
298     )
299AC_CONFIG_FILES([test/init.sh])
300AC_CONFIG_FILES([test/svn_update.sh], [chmod +x test/svn_update.sh])
301
302dnl maintainer make rukes from yat project
303YAT_SVN_RELEASE
304
305# Restore FLAGS
306APR_RESTORE_THE_ENVIRONMENT([CPPFLAGS], [SVNDIGEST_])
307APR_RESTORE_THE_ENVIRONMENT([CXXFLAGS], [SVNDIGEST_])
308APR_RESTORE_THE_ENVIRONMENT([LDFLAGS], [SVNDIGEST_])
309
310AC_CONFIG_FILES([Makefile
311                bin/Makefile
312                lib/Makefile
313                yat/Makefile
314                man/Makefile
315                test/environment.h
316                test/Makefile])
317
318AC_CONFIG_HEADER([yat/config_public.h])
319
320# Print failure status information about selected items, and exit if
321# fatal errors were encountered. No output will be created if
322# configure is halted prematurely.
323
324# used to trigger exit before creation of output
325all_reqs_ok="true"
326
327if (test "$wc_found" = "yes"); then
328   AC_MSG_CHECKING([help2man])
329   # redirecting potential error msg to log file
330   AS_IF([help2man --version >/dev/null 2>&AS_MESSAGE_LOG_FD],
331         [AC_MSG_RESULT([yes])],
332         [AC_MSG_RESULT([no])
333     AC_MSG_WARN(m4_text_wrap(m4_normalize([
334       `help2man' is missing on your system.  You will not be
335       able to create the man page. A sound man page should be
336       included in a distribution, and since you will not able
337       to create a complete distribution `make dist' will fail.
338       ]),[                   ],
339          [                             ], 79))
340   ])
341   # svnversion is required when building from svn wc
342   if (test "x$SVNVERSION" = "xno"); then
343      all_reqs_ok="false";
344      AC_MSG_WARN([dnl
345Cannot find svnversion, which is required when building from a
346subversion working copy. Please install svnversion and make sure it is
347in your search path.]);
348   fi
349   if (test "$test_repo_found" = "no"); then
350      all_reqs_ok="false";
351      AC_MSG_WARN([dnl
352Cannot find test repository (test_repo_filename), which should be
353available when building from a subversion working copy. Try svn
354update in top directory.]);
355   fi
356fi
357
358# Non-existing APR is fatal -- sub-sequent compilation will fail.
359if (test "$apr_found" = "no") ; then
360  AC_MSG_WARN([APR not found. The Apache Portable Runtime
361  (APR) library cannot be found. Please make sure APR is installed
362  and supply the appropriate --with-apr option to 'configure'.])
363  all_reqs_ok="false"
364fi
365
366# Non-existing subversion API is fatal -- sub-sequent compilation will fail.
367if (test "$svn_found" = "no") ; then
368  svn_msg="Subversion API not found. Subversion API libraries cannot
369  be found. Make sure the APIs are installed and supply the
370  appropriate --with-svn option to 'configure'."
371  if (test "$apr_found" = "no") ; then
372    svn_msg="$svn_msg
373    Note, APR was not found. Failure to locate APR affects the search
374    of the subversion API. Please fix the APR problem before trying
375    to resolve the subversion related issues."
376  fi
377  AC_MSG_WARN([$svn_msg])
378  all_reqs_ok="false"
379fi
380
381# Non-existing PLplot API is fatal -- sub-sequent compilation will fail.
382AS_CASE([$plplot_found],
383  [noheader],
384    [AC_MSG_WARN([
385    PLplot developer files cannot be found. Make sure PLplot is installed.])
386    all_reqs_ok="false"],
387  [old],
388    [AC_MSG_WARN([
389    PLplot developer files found but not required API version.
390    Version at least $plplot_version is required. Please upgrade PLplot.])
391    all_reqs_ok="false"],
392  [nolib],
393    [AC_MSG_WARN([
394    PLplot developer files found but linking against plplot library failed.])
395    all_reqs_ok="false"])
396
397if test $ac_cv_type_long_long_int != yes ; then
398  AC_MSG_WARN([Compiler $CXX does not support `long long'.
399  svndigest must be compiled with a compiler that supports `long long'.])
400  all_reqs_ok="false"
401fi
402
403if (test "$all_reqs_ok" = "false") ; then
404  AC_MSG_ERROR([Some pre-requisites were not fulfilled, aborting
405  configure. Please consult the 'README' file for more information
406  about what is needed to compile svndigest and refer to above
407  warning messages. Needed files were NOT created.])
408fi
409
410# Create output.
411AC_OUTPUT
412
413# Some more messages.
414AC_MSG_NOTICE([
415Ready to compile the executables of svndigest $VERSION
416The following flags and libs will be used:
417+++++++++++++++++++++++++++++++++++++++++++++++
418  Compiler:           $CXX
419  Preprocessor flags:
420    CPPFLAGS:           $CPPFLAGS
421    SVNDIGEST_CPPFLAGS: $SVNDIGEST_CPPFLAGS
422  C++ flags:
423    CXXFLAGS:           $CXXFLAGS
424    SVNDIGEST_CXXFLAGS: $SVNDIGEST_CXXFLAGS
425  Linker flags:
426    LDFLAGS:            $LDFLAGS
427    SVNDIGEST_LDFLAGS:  $SVNDIGEST_LDFLAGS
428  Libraries:         
429    LIBS                $LIBS
430    APR_LIBS            $APR_LIBS
431    SVN_LIBS            $SVN_LIBS
432    PLPLOT_LIBS         $PLPLOT_LIBS
433+++++++++++++++++++++++++++++++++++++++++++++++]dnl
434)
435
436AC_MSG_NOTICE([Now type 'make all check'.])
Note: See TracBrowser for help on using the repository browser.