source: trunk/configure.ac @ 907

Last change on this file since 907 was 907, checked in by Peter Johansson, 12 years ago

Autoconf 2.63 is now required (closes #414).

refs #380. A first implementation of svndigest-copy-cache. It is is
written in M4sh. Autoconf compiles the source in
svndigest-copy-cache.as to svndigest-copy-cache.in, which in turn is
processed by config.status to replace some keywords such as PACKAGE
and friends. There is no docs and no test yet.

added *.as in config file

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