source: trunk/configure.ac @ 1044

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

using parallel-tests driver and making c++ tests verbose by default.

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