source: trunk/configure.ac @ 905

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

disallow --with-svn and --without-svn. The same arg check already existed for apr.

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