source: trunk/configure.ac @ 1293

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

rewrite svndigest-copy-cache in C++. closes #463

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 14.5 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 1293 2010-11-14 05:34:10Z 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
72# Set default programming language
73AC_LANG([C++])
74
75# propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS
76for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do
77  eval isset=\${$var+set}
78  if test "$isset" = 'set' ; then
79    eval val=$`echo $var`
80    DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' "
81  fi
82done
83AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
84
85# Let user overide default CXXFLAGS
86if test "${CXXFLAGS+set}" != set; then
87  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
88fi
89
90# Checks for programs.
91AC_PROG_CXXCPP
92AC_PROG_CXX
93AC_PROG_RANLIB
94AC_PROG_SED
95AM_MISSING_PROG([HELP2MAN], [help2man])
96# look for pkg-config
97PKG_PROG_PKG_CONFIG([0.23])
98
99# Save FLAGS
100APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
101APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
102
103# -Wno-long-long is needed to suppress compiler diagnostics regarding
104# using extension beyond the C++ standard (usage of non C++ standard
105# 'long long' types).
106YAT_CXX_ADD_FLAG([CXXFLAGS],[-pedantic -Wno-long-long])
107AC_TYPE_LONG_LONG_INT
108AS_IF([test x$ac_cv_type_long_long_int = xno],
109      [AC_MSG_ERROR([compiler does not support long long int])]
110     )
111
112AC_ARG_ENABLE([debug],
113  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
114
115AS_IF([test x$enable_debug = xyes],
116  [YAT_CXX_ADD_FLAG([CXXFLAGS],[-g -O])],
117  [YAT_CPP_ADD_FLAG([CPPFLAGS],[-DNDEBUG])
118   YAT_CXX_ADD_FLAG([CXXFLAGS],[-O3])])
119
120AC_MSG_CHECKING([g++ deprecation attribute])
121AC_COMPILE_IFELSE(
122  [AC_LANG_PROGRAM([[void f() __attribute__ ((deprecated));]],)], 
123  [AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1],
124             [Define if compiler supports deprecated attribute, as in g++ 4.0])
125   AC_MSG_RESULT([yes])],
126  [AC_MSG_RESULT([no])] )
127
128# Apache Portable Runtime (APR) API checks
129APR_FIND_APR(,,[1],[1 0])
130AS_IF([test "${with_apr+set}" = set],
131    [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-apr=$with_apr"]
132)
133if test "$apr_found" = "yes" ; then
134    APR_LIBS="`$apr_config --libs`"
135    apr_link_ld="`$apr_config --link-ld`"
136    for i in $apr_link_ld; do
137      AS_IF([AS_ECHO([$i]) | grep '^-l' > /dev/null],[APR_LIBS="$i $APR_LIBS"],
138            [YAT_LD_ADD_FLAG([LDFLAGS], [$i])])
139    done
140    YAT_CPP_ADD_FLAG([CPPFLAGS],[`$apr_config --includes --cppflags`])
141    AC_CHECK_HEADER([apr_allocator.h],,[apr_found="no"])
142fi
143AC_SUBST([APR_LIBS])
144
145# Subversion API checks
146svn_found="yes"
147AC_ARG_WITH([svn],
148  [AS_HELP_STRING([--with-svn=DIR],[prefix for svn developer files [[PREFIX]]])],
149  [ AS_CASE([$withval], [yes|no],
150            [AC_MSG_ERROR([--with-svn requires a directory to be provided])])
151    AS_IF([test -d $with_svn], [],
152          [AC_MSG_ERROR([$with_svn: no such directory])])
153    # transform argument to absolute path
154    with_svn=`cd $with_svn && pwd`
155    DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-svn=$with_svn"
156    YAT_LD_ADD_FLAG([LDFLAGS], [-L$with_svn/lib])
157    YAT_CPP_ADD_FLAG([CPPFLAGS], [-I$with_svn/include])
158  ])
159# svn needs needs apr headers
160AC_CHECK_HEADER([subversion-1/svn_types.h],,[svn_found="no"])
161
162save_LIBS=$LIBS
163tmp_LIBS="$APR_LIBS $save_LIBS"
164LIBS=""
165AC_SEARCH_LIBS([svn_cmdline_setup_auth_baton],[svn_subr-1],
166               [], [svn_found="no"], [$tmp_LIBS])
167AC_SEARCH_LIBS([svn_ra_initialize],[svn_ra-1], [], [svn_found="no"],[$tmp_LIBS])
168AC_SEARCH_LIBS([svn_wc_adm_open3],[svn_wc-1], [], [svn_found="no"], [$tmp_LIBS])
169AC_SEARCH_LIBS([svn_diff_file_options_create],[svn_diff-1],[],
170               [svn_found="no"], [$tmp_LIBS])
171AC_SEARCH_LIBS([svn_client_log3],[svn_client-1],,[svn_found="no"], [$tmp_LIBS])
172SVN_LIBS=$LIBS
173LIBS=$save_LIBS
174AC_SUBST([SVN_LIBS])
175
176
177# check if svnversion is installed
178AC_PATH_PROG([SVNVERSION], [svnversion], [no])
179
180# PLplot API checks
181# plplot_found can get values: skip, noheader, old, or nolib if an
182# error is detected.
183plplot_found="yes"
184plplot_version=5.9.6
185save_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
186AC_ARG_WITH([plplot],
187  [AS_HELP_STRING([--with-plplot=DIR],[prefix for plplot developer files])],
188  [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-plplot=$withval"
189   AS_IF([test "x$withval" = "xno"], [ dnl
190     plplot_found=skip;
191   ], [ dnl
192     AS_IF([test -d $with_plplot], [],
193           [AC_MSG_ERROR([$with_plplot: no such directory])])
194     with_plplot=`cd $with_plplot && pwd`
195     # help pkg-config find .pc file
196     PKG_CONFIG_PATH=$with_plplot/lib/pkgconfig$PATH_SEPARATOR$PKG_CONFIG_PATH
197     export PKG_CONFIG_PATH
198   ])
199  ])
200
201use_plplot_pc="no"
202AS_IF([test "x$plplot_found" = "xyes" && test -n "$PKG_CONFIG"], [
203  AC_MSG_CHECKING([for plplotd-c++.pc])
204  AS_IF([$PKG_CONFIG --exists plplotd-c++], [
205    AC_MSG_RESULT([yes])
206    use_plplot_pc="yes"
207  ],[
208    AC_MSG_RESULT([no])
209    AC_MSG_WARN([cannot find plplotd-c++;
210      please use --with-plplot with appropriate argument to get more accurate
211      configuration.])
212  ])
213])
214
215AS_IF([test "x$plplot_found" = "xyes"], [
216  # copy flags if we have found pc file
217  AS_IF([test "$use_plplot_pc" = "yes"], [
218    YAT_LD_ADD_FLAG([LDFLAGS], [`$PKG_CONFIG plplotd-c++ --libs-only-L`])
219    PLPLOT_LIBS="`$PKG_CONFIG plplotd-c++ --libs-only-l --libs-only-other`"
220  ],[
221    # otherwise guess
222    PLPLOT_LIBS="-lplplotcxxd -lplplotd";
223    AS_IF([test -n "$with_plplot" && test "x$with_plplot" != "xyes"], [
224      YAT_LD_ADD_FLAG([LDFLAGS], [-L$with_plplot/lib])
225    ])
226  ])
227  # don't use `pkg-config --cflags' because it returns
228  # `PREFIX/include/plplot' rather than `PREFIX/include'
229  AS_IF([test -n "$with_plplot" && test "x$with_plplot" != "xyes"], [
230    YAT_CPP_ADD_FLAG([CPPFLAGS], [-I$with_plplot/include])
231  ])
232])
233                 
234AS_IF([test "x$plplot_found" = "xyes"], [
235  AC_CHECK_HEADER([plplot/plstream.h], [], [plplot_found="noheader"])
236])
237
238
239AS_IF([test "x$plplot_found" = "xyes" && test -n "$PKG_CONFIG"], [
240  AC_MSG_CHECKING([plplot version >= $plplot_version])
241  AS_IF([$PKG_CONFIG --atleast-version=$plplot_version plplotd-c++], [
242    AC_MSG_RESULT([yes])
243  ],[
244    have_plplot_version=`$PKG_CONFIG --modversion plplotd-c++`
245    AC_MSG_RESULT([$have_plplot_version])
246    plplot_found="old"
247  ])
248])
249
250AS_IF([test "x$plplot_found" = "xyes"], [
251  save_LIBS=$LIBS
252  LIBS="$PLPLOT_LIBS $LIBS"
253  AC_MSG_CHECKING([for library containing plstream])
254  AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include <plplot/plstream.h>],
255                                  [plstream pls(1,1,"svg", "conftest.svg");
256                                   pls.scolbga(255, 255, 255, 0);
257                                  ])],
258                 [AC_MSG_RESULT([yes]);
259                  AC_DEFINE([HAVE_PLPLOT], [1],
260                            [Define to 1 if you have plplot])],
261                 [AC_MSG_RESULT([no])
262                  plplot_found=nolib;])
263  LIBS=$save_LIBS
264])
265# restore variable
266export PKG_CONFIG_PATH=$save_PKG_CONFIG_PATH
267AC_SUBST(PLPLOT_LIBS)
268
269# checking if we build in a subversion WC
270AS_IF([test -d $srcdir/.svn], [wc_found="yes"], [wc_found="no"])
271AM_CONDITIONAL([HAVE_SVN_WC], [test "$wc_found" = "yes"])
272AC_SUBST([wc_found])
273
274# checking if we have test repo
275test_repo_filename=$srcdir/test/repo;
276AS_IF([test -r $test_repo_filename],
277              [AC_DEFINE([HAVE_TEST_REPO],[1],[define if test repo is available])
278               test_repo_found="yes"],
279              [test_repo_found="no"])
280AC_SUBST([test_repo_found])
281AS_IF([test "x$test_repo_found" = xyes],
282      [abs_test_repo=`cd $test_repo_filename && pwd`;
283       AC_SUBST(abs_test_repo)]
284     )
285AC_CONFIG_FILES([test/init.sh])
286AC_CONFIG_FILES([test/svn_update.sh], [chmod +x test/svn_update.sh])
287
288dnl maintainer make rukes from yat project
289YAT_SVN_RELEASE
290
291# Restore FLAGS
292APR_RESTORE_THE_ENVIRONMENT([CPPFLAGS], [SVNDIGEST_])
293APR_RESTORE_THE_ENVIRONMENT([CXXFLAGS], [SVNDIGEST_])
294APR_RESTORE_THE_ENVIRONMENT([LDFLAGS], [SVNDIGEST_])
295
296AC_CONFIG_FILES([Makefile
297                bin/Makefile
298                lib/Makefile
299                yat/Makefile
300                man/Makefile
301                test/environment.h
302                test/Makefile])
303
304AC_CONFIG_HEADER([yat/config_public.h])
305
306# Print failure status information about selected items, and exit if
307# fatal errors were encountered. No output will be created if
308# configure is halted prematurely.
309
310# used to trigger exit before creation of output
311all_reqs_ok="true"
312
313if (test "$wc_found" = "yes"); then
314   AC_MSG_CHECKING([help2man])
315   # redirecting potential error msg to log file
316   AS_IF([help2man --version >/dev/null 2>&AS_MESSAGE_LOG_FD],
317         [AC_MSG_RESULT([yes])],
318         [AC_MSG_RESULT([no])
319     AC_MSG_WARN(m4_text_wrap(m4_normalize([
320       `help2man' is missing on your system.  You will not be
321       able to create the man page. A sound man page should be
322       included in a distribution, and since you will not able
323       to create a complete distribution `make dist' will fail.
324       ]),[                   ],
325          [                             ], 79))
326   ])
327   # svnversion is required when building from svn wc
328   if (test "x$SVNVERSION" = "xno"); then
329      all_reqs_ok="false";
330      AC_MSG_WARN([dnl
331Cannot find svnversion, which is required when building from a
332subversion working copy. Please install svnversion and make sure it is
333in your search path.]);
334   fi
335   if (test "$test_repo_found" = "no"); then
336      all_reqs_ok="false";
337      AC_MSG_WARN([dnl
338Cannot find test repository (test_repo_filename), which should be
339available when building from a subversion working copy. Try svn
340update in top directory.]);
341   fi
342fi
343
344# Non-existing APR is fatal -- sub-sequent compilation will fail.
345if (test "$apr_found" = "no") ; then
346  AC_MSG_WARN([APR not found. The Apache Portable Runtime
347  (APR) library cannot be found. Please make sure APR is installed
348  and supply the appropriate --with-apr option to 'configure'.])
349  all_reqs_ok="false"
350fi
351
352# Non-existing subversion API is fatal -- sub-sequent compilation will fail.
353if (test "$svn_found" = "no") ; then
354  svn_msg="Subversion API not found. Subversion API libraries cannot
355  be found. Make sure the APIs are installed and supply the
356  appropriate --with-svn option to 'configure'."
357  if (test "$apr_found" = "no") ; then
358    svn_msg="$svn_msg
359    Note, APR was not found. Failure to locate APR affects the search
360    of the subversion API. Please fix the APR problem before trying
361    to resolve the subversion related issues."
362  fi
363  AC_MSG_WARN([$svn_msg])
364  all_reqs_ok="false"
365fi
366
367# Non-existing PLplot API is fatal -- sub-sequent compilation will fail.
368AS_CASE([$plplot_found],
369  [noheader],
370    [AC_MSG_WARN([
371    PLplot developer files cannot be found. Make sure PLplot is installed.])
372    all_reqs_ok="false"],
373  [old],
374    [AC_MSG_WARN([
375    PLplot developer files found but not required API version.
376    Version at least $plplot_version is required. Please upgrade PLplot.])
377    all_reqs_ok="false"],
378  [nolib],
379    [AC_MSG_WARN([
380    PLplot developer files found but linking against plplot library failed.])
381    all_reqs_ok="false"])
382
383if test $ac_cv_type_long_long_int != yes ; then
384  AC_MSG_WARN([Compiler $CXX does not support `long long'.
385  svndigest must be compiled with a compiler that supports `long long'.])
386  all_reqs_ok="false"
387fi
388
389if (test "$all_reqs_ok" = "false") ; then
390  AC_MSG_ERROR([Some pre-requisites were not fulfilled, aborting
391  configure. Please consult the 'README' file for more information
392  about what is needed to compile svndigest and refer to above
393  warning messages. Needed files were NOT created.])
394fi
395
396# Create output.
397AC_OUTPUT
398
399# Some more messages.
400AC_MSG_NOTICE([
401Ready to compile the executables of svndigest $VERSION
402The following flags and libs will be used:
403+++++++++++++++++++++++++++++++++++++++++++++++
404  Compiler:           $CXX
405  Preprocessor flags:
406    CPPFLAGS:           $CPPFLAGS
407    SVNDIGEST_CPPFLAGS: $SVNDIGEST_CPPFLAGS
408  C++ flags:
409    CXXFLAGS:           $CXXFLAGS
410    SVNDIGEST_CXXFLAGS: $SVNDIGEST_CXXFLAGS
411  Linker flags:
412    LDFLAGS:            $LDFLAGS
413    SVNDIGEST_LDFLAGS:  $SVNDIGEST_LDFLAGS
414  Libraries:         
415    LIBS                $LIBS
416    APR_LIBS            $APR_LIBS
417    SVN_LIBS            $SVN_LIBS
418    PLPLOT_LIBS         $PLPLOT_LIBS
419+++++++++++++++++++++++++++++++++++++++++++++++]dnl
420)
421
422AC_MSG_NOTICE([Now type 'make all check'.])
Note: See TracBrowser for help on using the repository browser.