source: branches/0.9-stable/configure.ac

Last change on this file was 1490, checked in by Peter Johansson, 9 years ago

update copyright years and set property svncopyright:ignore

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