source: trunk/configure.ac @ 892

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

define PACKAGE_URL in configure.ac also for autoconf 2.63 and older. Use PACKAGE_URL in footer rather than hard-coded value.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 12.2 KB
Line 
1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 892 2009-11-26 05:56:47Z 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.61)
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
47AC_SUBST([SVNDIGEST_MAJOR_VERSION], [MAJOR_VERSION])
48AC_SUBST([SVNDIGEST_MINOR_VERSION], [MINOR_VERSION])
49AC_SUBST([SVNDIGEST_PATCH_VERSION], [PATCH_VERSION])
50
51AC_DEFINE([DEV_BUILD],[SVNDIGEST_DEV_BUILD],
52          [true if dev build (version ends with pre)])
53AC_DEFINE([SVNDIGEST_MAJOR_VERSION], [MAJOR_VERSION],
54                    [Define to the svndigest major version])
55AC_DEFINE([SVNDIGEST_MINOR_VERSION], [MINOR_VERSION],
56                    [Define to the svndigest minor version])
57AC_DEFINE([SVNDIGEST_PATCH_VERSION], [PATCH_VERSION],
58                    [Define to the svndigest patch version])
59
60AC_CONFIG_HEADER([config.h])
61AM_INIT_AUTOMAKE([1.10 std-options])
62
63# Set default programming language
64AC_LANG([C++])
65
66# propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS
67for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do
68  eval isset=\${$var+set}
69  if test "$isset" = 'set' ; then
70    eval val=$`echo $var`
71    DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' "
72  fi
73done
74AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
75
76# Let user overide default CXXFLAGS
77if test "${CXXFLAGS+set}" != set; then
78  CXXFLAGS=""  # Setting CXXFLAGS here to prevent expansion in AC_PROG_CXX
79fi
80
81# Checks for programs.
82AC_PROG_CXXCPP
83AC_PROG_CXX
84AC_PROG_INSTALL
85AC_PROG_RANLIB
86AC_PROG_SED
87AC_PATH_PROG([HELP2MAN], [help2man], [no])
88AM_CONDITIONAL([HAVE_HELP2MAN], [test x$HELP2MAN != xno])
89# look for pkg-config
90PKG_PROG_PKG_CONFIG([0.23])
91
92# Save FLAGS
93APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
94APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
95
96# -Wno-long-long is needed to suppress compiler diagnostics regarding
97# using extension beyond the C++ standard (usage of non C++ standard
98# 'long long' types).
99YAT_CXX_ADD_FLAG([CXXFLAGS],[-pedantic -Wno-long-long])
100AC_TYPE_LONG_LONG_INT
101AS_IF([test x$ac_cv_type_long_long_int = xno],
102      [AC_MSG_ERROR([compiler does not support long long int])]
103     )
104
105AC_ARG_ENABLE([debug],
106  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
107
108AS_IF([test x$enable_debug = xyes],
109  [YAT_CXX_ADD_FLAG([CXXFLAGS],[-g -O])],
110  [YAT_CPP_ADD_FLAG([CPPFLAGS],[-DNDEBUG])
111   YAT_CXX_ADD_FLAG([CXXFLAGS],[-O3])])
112
113# Apache Portable Runtime (APR) API checks
114APR_FIND_APR(,,[1],[1 0])
115AS_IF([test "${with_apr+set}" = set],
116    [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-apr=$with_apr"]
117)
118if test "$apr_found" = "yes" ; then
119    APR_LIBS="`$apr_config --libs`"
120    apr_link_ld="`$apr_config --link-ld`"
121    for i in $apr_link_ld; do
122      AS_IF([test ${i:0:2} = "-l"],[APR_LIBS="$i $APR_LIBS"],
123            [YAT_LD_ADD_FLAG([APR_LDFLAGS], [$i])])
124    done
125    YAT_CPP_ADD_FLAG([APR_CPPFLAGS],[`$apr_config --includes --cppflags`])
126    save_CPPFLAGS=$CPPFLAGS
127    CPPFLAGS="$APR_CPPFLAGS $CPPFLAGS"
128    AC_CHECK_HEADER([apr_allocator.h],,[apr_found="no"])
129    CPPFLAGS=$save_CPPFLAGS
130fi
131AC_SUBST([APR_CPPFLAGS])
132AC_SUBST([APR_LDFLAGS])
133AC_SUBST([APR_LIBS])
134
135# Subversion API checks
136svn_found="yes"
137AC_ARG_WITH([svn],
138  [AS_HELP_STRING([--with-svn=DIR],[prefix for svn developer files [[PREFIX]]])],
139  [ DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-svn=$withval"
140    YAT_LD_ADD_FLAG([SVN_LDFLAGS], [-L$withval/lib])
141    YAT_CPP_ADD_FLAG([SVN_CPPFLAGS], [-I$withval/include])
142  ])
143# svn needs needs apr headers
144save_CPPFLAGS=$CPPFLAGS
145CPPFLAGS="$APR_CPPFLAGS $SVN_CPPFLAGS $CPPFLAGS"
146AC_CHECK_HEADER([subversion-1/svn_types.h],,[svn_found="no"])
147CPPFLAGS=$save_CPPFLAGS
148
149save_LDFLAGS=$LDFLAGS
150save_LIBS=$LIBS
151tmp_LIBS="$APR_LIBS $save_LIBS"
152LIBS=""
153LDFLAGS="$SVN_LDFLAGS $APR_LDFLAGS"
154AC_SEARCH_LIBS([svn_cmdline_setup_auth_baton],[svn_subr-1],
155               [], [svn_found="no"], [$tmp_LIBS])
156AC_SEARCH_LIBS([svn_ra_initialize],[svn_ra-1], [], [svn_found="no"],[$tmp_LIBS])
157AC_SEARCH_LIBS([svn_wc_adm_open3],[svn_wc-1], [], [svn_found="no"], [$tmp_LIBS])
158AC_SEARCH_LIBS([svn_diff_file_options_create],[svn_diff-1],[],
159               [svn_found="no"], [$tmp_LIBS])
160AC_SEARCH_LIBS([svn_client_log3],[svn_client-1],,[svn_found="no"], [$tmp_LIBS])
161SVN_LIBS=$LIBS
162LIBS=$save_LIBS
163LDFLAGS=$save_LDFLAGS
164AC_SUBST([SVN_CPPFLAGS])
165AC_SUBST([SVN_LDFLAGS])
166AC_SUBST([SVN_LIBS])
167
168
169# check if svnversion is installed
170AC_PATH_PROG([SVNVERSION], [svnversion], [no])
171
172# PLplot API checks
173plplot_found="yes"
174plplot_version=5.9
175save_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
176AC_ARG_WITH([plplot],
177  [AS_HELP_STRING([--with-plplot=DIR],[prefix for plplot developer files])],
178  [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-plplot=$withval"
179   PKG_CONFIG_PATH=${withval}/lib/pkgconfig${PATH_SEPARATOR}${PKG_CONFIG_PATH}
180   export PKG_CONFIG_PATH
181  ])
182
183# copy flags if pkg-config finds plplot
184PKG_CHECK_EXISTS([plplotd-c++], [
185  YAT_CPP_ADD_FLAG([PLPLOT_CPPFLAGS], [`$PKG_CONFIG plplotd-c++ --cflags`])
186  YAT_LD_ADD_FLAG([PLPLOT_LDFLAGS], [`$PKG_CONFIG plplotd-c++ --libs-only-L`])
187  PLPLOT_LIBS="`$PKG_CONFIG plplotd-c++ --libs-only-l --libs-only-other`"
188],[
189  plplot_found=no-pkg-config
190])
191                 
192AS_IF([test "x$plplot_found" = "xyes"], [
193  save_CPPFLAGS=$CPPFLAGS
194  CPPFLAGS="$PLPLOT_CPPFLAGS $CPPFLAGS"
195  AC_CHECK_HEADER([plplot/plstream.h], [], [plplot_found="noheader"])
196  CPPFLAGS=$save_CPPFLAGS
197])
198
199AS_IF([test "x$plplot_found" = "xyes"], [
200  AS_IF([$PKG_CONFIG --atleast-version=$plplot_version plplotd-c++], [],[
201    plplot_found="nolib"
202  ])
203])
204# restore variable
205export PKG_CONFIG_PATH=$save_PKG_CONFIG_PATH
206AC_SUBST(PLPLOT_CPPFLAGS)
207AC_SUBST(PLPLOT_LDFLAGS)
208AC_SUBST(PLPLOT_LIBS)
209
210# checking if we build in a subversion WC
211AS_IF([test -d $srcdir/.svn], [wc_found="yes"], [wc_found="no"])
212AM_CONDITIONAL([HAVE_SVN_WC], [test "$wc_found" = "yes"])
213AC_SUBST([wc_found])
214
215# Reset FLAGS
216APR_RESTORE_THE_ENVIRONMENT([CPPFLAGS], [DEFAULT_])
217APR_RESTORE_THE_ENVIRONMENT([CXXFLAGS], [DEFAULT_])
218
219# checking if we have test repo
220test_repo_filename=$srcdir/test/repo;
221AS_IF([test -r $test_repo_filename],
222              [AC_DEFINE([HAVE_TEST_REPO],[1],[define if test repo is available])
223               test_repo_found="yes"],
224              [test_repo_found="no"])
225AC_SUBST([test_repo_found])
226AS_IF([test "x$test_repo_found" = xyes],
227      [abs_test_repo=`cd $test_repo_filename && pwd`;
228       AC_SUBST(abs_test_repo)]
229     )
230AC_CONFIG_FILES([test/test_repo.sh], [chmod +x test/test_repo.sh])
231AC_CONFIG_FILES([test/svn_update.sh], [chmod +x test/svn_update.sh])
232AC_CONFIG_FILES([test/check_repo_status.sh],
233                [chmod +x test/check_repo_status.sh])   
234
235dnl maintainer make rukes from yat project
236YAT_SVN_RELEASE
237
238AC_CONFIG_FILES([Makefile
239                bin/Makefile
240                lib/Makefile
241                lib/yat/Makefile
242                man/Makefile
243                test/environment.h
244                test/Makefile])
245
246AC_CONFIG_HEADER([lib/yat/config_public.h])
247
248# Print failure status information about selected items, and exit if
249# fatal errors were encountered. No output will be created if
250# configure is halted prematurely.
251
252# used to trigger exit before creation of output
253all_reqs_ok="true"
254
255if (test "$wc_found" = "yes"); then
256   if test x$HELP2MAN = xno; then
257     AC_MSG_WARN(m4_text_wrap(m4_normalize([
258       `help2man' is missing on your system.  You will not be
259       able to create the man page. A sound man page should be
260       included in a distribution, and since you will not able
261       to create a complete distribution `make dist' will fail.
262       ]),[                   ],
263          [                             ], 79))
264   fi
265   # svnversion is required when building from svn wc
266   if (test "$svnversion" = "no"); then
267      all_reqs_ok="false";
268      AC_MSG_WARN([dnl
269Cannot find svnversion, which is required when building from a
270subversion working copy. Please install svnversion and make sure it is
271in your search path.]);
272   fi
273   if (test "$test_repo_found" = "no"); then
274      all_reqs_ok="false";
275      AC_MSG_WARN([dnl
276Cannot find test repository (test_repo_filename), which should be
277available when building from a subversion working copy. Try svn
278update in top directory.]);
279   fi
280fi
281
282# Non-existing APR is fatal -- sub-sequent compilation will fail.
283if (test "$apr_found" = "no") ; then
284  AC_MSG_WARN([APR not found. The Apache Portable Runtime
285  (APR) library cannot be found. Please make sure APR is installed
286  and supply the appropriate --with-apr option to 'configure'.])
287  all_reqs_ok="false"
288fi
289
290# Non-existing subversion API is fatal -- sub-sequent compilation will fail.
291if (test "$svn_found" = "no") ; then
292  svn_msg="Subversion API not found. Subversion API libraries cannot
293  be found. Make sure the APIs are installed and supply the
294  appropriate --with-svn option to 'configure'."
295  if (test "$apr_found" = "no") ; then
296    svn_msg="$svn_msg
297    Note, APR was not found. Failure to locate APR affects the search
298    of the subversion API. Please fix the APR problem before trying
299    to resolve the subversion related issues."
300  fi
301  AC_MSG_WARN([$svn_msg])
302  all_reqs_ok="false"
303fi
304
305# Non-existing PLplot API is fatal -- sub-sequent compilation will fail.
306if (test "$plplot_found" = "noheader") ; then
307  AC_MSG_WARN([PLplot developer files cannot be found. Make sure PLplot
308  is installed.])
309  all_reqs_ok="false"
310elif (test "$plplot_found" = "nolib") ; then
311  AC_MSG_WARN([PLplot developer files found but not required API version.
312  Version at least $plplot_version is required. Please upgrade PLplot.])
313  all_reqs_ok="false"
314elif (test "$plplot_found" = "no-pkg-config") ; then
315  AC_MSG_WARN([cannot find pkg-config])
316  all_reqs_ok="false"
317fi
318
319if test $ac_cv_type_long_long_int != yes ; then
320  AC_MSG_WARN([Compiler $CXX does not support `long long'.
321  svndigest must be compiled with a compiler that supports `long long'.])
322  all_reqs_ok="false"
323fi
324
325if (test "$all_reqs_ok" = "false") ; then
326  AC_MSG_ERROR([Some pre-requisites were not fulfilled, aborting
327  configure. Please consult the 'README' file for more information
328  about what is needed to compile svndigest and refer to above
329  warning messages. Needed files were NOT created.])
330fi
331
332# Create output.
333AC_OUTPUT
334
335# Some more messages.
336AC_MSG_NOTICE([
337Ready to compile the executables of svndigest $VERSION
338The following flags and libs will be used:
339+++++++++++++++++++++++++++++++++++++++++++++++
340  Compiler:           $CXX
341  Preprocessor flags: $SD_CPPFLAGS $CPPFLAGS
342    CPPFLAGS:         $CPPFLAGS
343    DEFAULT_CPPFLAGS: $DEFAULT_CPPFLAGS
344    APR_CPPFLAGS:     $APR_CPPFLAGS
345    SVN_CPPFLAGS:     $SVN_CPPFLAGS
346    PLPLOT_CPPFLAGS:  $PLPLOT_CPPFLAGS
347  C++ flags:
348    CXXFLAGS:         $CXXFLAGS
349    DEFAULT_CXXFLAGS: $DEFAULT_CXXFLAGS
350  Linker flags:
351    LDFLAGS:          $LDFLAGS
352    APR_LDFLAGS:      $APR_LDFLAGS
353    SVN_LDFLAGS:      $SVN_LDFLAGS
354    PLPLOT_LDFLAGS:   $PLPLOT_LDFLAGS
355  Libraries:         
356    LIBS              $LIBS
357    APR_LIBS          $APR_LIBS
358    SVN_LIBS          $SVN_LIBS
359    PLPLOT_LIBS       $PLPLOT_LIBS
360+++++++++++++++++++++++++++++++++++++++++++++++]dnl
361)
362
363AC_MSG_NOTICE([Now type 'make all check'.])
Note: See TracBrowser for help on using the repository browser.