source: trunk/configure.ac @ 1129

Last change on this file since 1129 was 1119, checked in by Peter Johansson, 10 years ago

move lib/yat to yat. close #461

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 15.5 KB
RevLine 
[84]1## Process this file with autoconf to produce a configure script.
2##
3## $Id: configure.ac 1119 2010-07-04 18:34:07Z peter $
4##
5## If you grabbed the source from subversion you should, at top-level,
6## execute:
7##          ./bootstrap
[480]8## To push subsequent changes of this file into the build scripts you
9## must issue:
10##          autoreconf
[84]11
[978]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
[1043]15# Copyright (C) 2010 Peter Johansson
[2]16#
[687]17# This file is part of svndigest, http://dev.thep.lu.se/svndigest
[2]18#
[149]19# svndigest is free software; you can redistribute it and/or modify it
[84]20# under the terms of the GNU General Public License as published by
[693]21# the Free Software Foundation; either version 3 of the License, or
[84]22# (at your option) any later version.
[2]23#
[149]24# svndigest is distributed in the hope that it will be useful, but
[84]25# WITHOUT ANY WARRANTY; without even the implied warranty of
[149]26# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
[84]27# General Public License for more details.
[2]28#
[84]29# You should have received a copy of the GNU General Public License
[693]30# along with svndigest. If not, see <http://www.gnu.org/licenses/>.
[2]31
[907]32AC_PREREQ([2.63])
[547]33
[775]34m4_include([m4/version.m4])
[910]35AC_INIT([svndigest], m4_defn([SVNDIGEST_VERSION]),[jari@thep.lu.se],,
[819]36        [http://dev.thep.lu.se/svndigest])
[5]37AC_CONFIG_SRCDIR([lib/File.h])
[2]38AC_CONFIG_AUX_DIR([autotools])
[720]39dnl arg below should be the same as in Makefile.am
[775]40AC_CONFIG_MACRO_DIR([m4])
[2]41AC_PREFIX_DEFAULT([/usr/local])
42
[892]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"],
[907]46                     [Define to home page for this package])
47           AC_SUBST([PACKAGE_URL], ["http://dev.thep.lu.se/svndigest"])])
[892]48
[909]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
[585]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],
[723]61          [true if dev build (version ends with pre)])
[675]62AC_DEFINE([SVNDIGEST_MAJOR_VERSION], [MAJOR_VERSION],
[585]63                    [Define to the svndigest major version])
[675]64AC_DEFINE([SVNDIGEST_MINOR_VERSION], [MINOR_VERSION],
[585]65                    [Define to the svndigest minor version])
[675]66AC_DEFINE([SVNDIGEST_PATCH_VERSION], [PATCH_VERSION],
[585]67                    [Define to the svndigest patch version])
68
[993]69AC_CONFIG_HEADERS([config.h])
[1044]70AM_INIT_AUTOMAKE([1.11 color-tests std-options parallel-tests])
[2]71
[907]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])
[911]76m4_pushdef([my_m4sh_options], [-m 0644])
[907]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
[480]86# Set default programming language
[880]87AC_LANG([C++])
[480]88
[741]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
[564]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
[687]103
[2]104# Checks for programs.
[566]105AC_PROG_CXXCPP
[2]106AC_PROG_CXX
[668]107AC_PROG_RANLIB
[586]108AC_PROG_SED
[732]109AC_PATH_PROG([HELP2MAN], [help2man], [no])
[880]110# look for pkg-config
111PKG_PROG_PKG_CONFIG([0.23])
[2]112
[640]113# Save FLAGS
[887]114APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
115APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
[640]116
[138]117# -Wno-long-long is needed to suppress compiler diagnostics regarding
118# using extension beyond the C++ standard (usage of non C++ standard
119# 'long long' types).
[887]120YAT_CXX_ADD_FLAG([CXXFLAGS],[-pedantic -Wno-long-long])
[769]121AC_TYPE_LONG_LONG_INT
[782]122AS_IF([test x$ac_cv_type_long_long_int = xno],
123      [AC_MSG_ERROR([compiler does not support long long int])]
124     )
[2]125
[782]126AC_ARG_ENABLE([debug],
[843]127  [AS_HELP_STRING([--enable-debug],[turn on debug options and code])])
128
129AS_IF([test x$enable_debug = xyes],
[887]130  [YAT_CXX_ADD_FLAG([CXXFLAGS],[-g -O])],
131  [YAT_CPP_ADD_FLAG([CPPFLAGS],[-DNDEBUG])
132   YAT_CXX_ADD_FLAG([CXXFLAGS],[-O3])])
[160]133
[164]134# Apache Portable Runtime (APR) API checks
[887]135APR_FIND_APR(,,[1],[1 0])
[773]136AS_IF([test "${with_apr+set}" = set],
137    [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-apr=$with_apr"]
138)
[164]139if test "$apr_found" = "yes" ; then
[887]140    APR_LIBS="`$apr_config --libs`"
141    apr_link_ld="`$apr_config --link-ld`"
[774]142    for i in $apr_link_ld; do
[887]143      AS_IF([test ${i:0:2} = "-l"],[APR_LIBS="$i $APR_LIBS"],
144            [YAT_LD_ADD_FLAG([APR_LDFLAGS], [$i])])
[774]145    done
[887]146    YAT_CPP_ADD_FLAG([APR_CPPFLAGS],[`$apr_config --includes --cppflags`])
147    save_CPPFLAGS=$CPPFLAGS
148    CPPFLAGS="$APR_CPPFLAGS $CPPFLAGS"
149    AC_CHECK_HEADER([apr_allocator.h],,[apr_found="no"])
150    CPPFLAGS=$save_CPPFLAGS
[164]151fi
[887]152AC_SUBST([APR_CPPFLAGS])
153AC_SUBST([APR_LDFLAGS])
154AC_SUBST([APR_LIBS])
[96]155
[164]156# Subversion API checks
157svn_found="yes"
[887]158AC_ARG_WITH([svn],
[172]159  [AS_HELP_STRING([--with-svn=DIR],[prefix for svn developer files [[PREFIX]]])],
[905]160  [ AS_CASE([$withval], [yes|no],
161            [AC_MSG_ERROR([--with-svn requires a directory to be provided])])
[973]162    AS_IF([test -d $with_svn], [],
163          [AC_MSG_ERROR([$with_svn: no such directory])])
164    # transform argument to absolute path
165    with_svn=`cd $with_svn && pwd`
166    DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-svn=$with_svn"
167    YAT_LD_ADD_FLAG([SVN_LDFLAGS], [-L$with_svn/lib])
168    YAT_CPP_ADD_FLAG([SVN_CPPFLAGS], [-I$with_svn/include])
[774]169  ])
[887]170# svn needs needs apr headers
171save_CPPFLAGS=$CPPFLAGS
172CPPFLAGS="$APR_CPPFLAGS $SVN_CPPFLAGS $CPPFLAGS"
173AC_CHECK_HEADER([subversion-1/svn_types.h],,[svn_found="no"])
174CPPFLAGS=$save_CPPFLAGS
[640]175
[887]176save_LDFLAGS=$LDFLAGS
177save_LIBS=$LIBS
178tmp_LIBS="$APR_LIBS $save_LIBS"
179LIBS=""
180LDFLAGS="$SVN_LDFLAGS $APR_LDFLAGS"
[640]181AC_SEARCH_LIBS([svn_cmdline_setup_auth_baton],[svn_subr-1],
[887]182               [], [svn_found="no"], [$tmp_LIBS])
183AC_SEARCH_LIBS([svn_ra_initialize],[svn_ra-1], [], [svn_found="no"],[$tmp_LIBS])
184AC_SEARCH_LIBS([svn_wc_adm_open3],[svn_wc-1], [], [svn_found="no"], [$tmp_LIBS])
185AC_SEARCH_LIBS([svn_diff_file_options_create],[svn_diff-1],[],
186               [svn_found="no"], [$tmp_LIBS])
187AC_SEARCH_LIBS([svn_client_log3],[svn_client-1],,[svn_found="no"], [$tmp_LIBS])
188SVN_LIBS=$LIBS
189LIBS=$save_LIBS
190LDFLAGS=$save_LDFLAGS
191AC_SUBST([SVN_CPPFLAGS])
192AC_SUBST([SVN_LDFLAGS])
193AC_SUBST([SVN_LIBS])
[96]194
[540]195
196# check if svnversion is installed
[690]197AC_PATH_PROG([SVNVERSION], [svnversion], [no])
[540]198
[858]199# PLplot API checks
[901]200# plplot_found can get values: skip, noheader, old, or nolib if an
201# error is detected.
[858]202plplot_found="yes"
203plplot_version=5.9
[888]204save_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
205AC_ARG_WITH([plplot],
206  [AS_HELP_STRING([--with-plplot=DIR],[prefix for plplot developer files])],
207  [DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-plplot=$withval"
[901]208   AS_IF([test "x$withval" = "xno"], [ dnl
209     plplot_found=skip;
210   ], [ dnl
[973]211     AS_IF([test -d $with_plplot], [],
212           [AC_MSG_ERROR([$with_plplot: no such directory])])
213     with_plplot=`cd $with_plplot && pwd`
[901]214     # help pkg-config find .pc file
[973]215     PKG_CONFIG_PATH=$with_plplot/lib/pkgconfig$PATH_SEPARATOR$PKG_CONFIG_PATH
[901]216     export PKG_CONFIG_PATH
217   ])
[888]218  ])
[858]219
[901]220use_plplot_pc="no"
221AS_IF([test "x$plplot_found" = "xyes" && test -n "$PKG_CONFIG"], [
222  AC_MSG_CHECKING([for plplotd-c++.pc])
223  AS_IF([$PKG_CONFIG --exists plplotd-c++], [
224    AC_MSG_RESULT([yes])
225    use_plplot_pc="yes"
226  ],[
227    AC_MSG_RESULT([no])
228    AC_MSG_WARN([cannot find plplotd-c++;
229      please use --with-plplot with appropriate argument to get more accurate
230      configuration.])
231  ])
[888]232])
[901]233
234AS_IF([test "x$plplot_found" = "xyes"], [
235  # copy flags if we have found pc file
236  AS_IF([test "$use_plplot_pc" = "yes"], [
237    YAT_LD_ADD_FLAG([PLPLOT_LDFLAGS], [`$PKG_CONFIG plplotd-c++ --libs-only-L`])
238    PLPLOT_LIBS="`$PKG_CONFIG plplotd-c++ --libs-only-l --libs-only-other`"
239  ],[
240    # otherwise guess
241    PLPLOT_LIBS="-lplplotcxxd -lplplotd";
242    AS_IF([test -n "$with_plplot" && test "x$with_plplot" != "xyes"], [
[988]243      YAT_LD_ADD_FLAG([PLPLOT_LDFLAGS], [-L$with_plplot/libs])
[901]244    ])
245  ])
[975]246  # don't use `pkg-config --cflags' because it returns
247  # `PREFIX/include/plplot' rather than `PREFIX/include'
248  AS_IF([test -n "$with_plplot" && test "x$with_plplot" != "xyes"], [
[988]249    YAT_CPP_ADD_FLAG([PLPLOT_CPPFLAGS], [-I$with_plplot/include])
[975]250  ])
[901]251])
[888]252                 
253AS_IF([test "x$plplot_found" = "xyes"], [
254  save_CPPFLAGS=$CPPFLAGS
255  CPPFLAGS="$PLPLOT_CPPFLAGS $CPPFLAGS"
256  AC_CHECK_HEADER([plplot/plstream.h], [], [plplot_found="noheader"])
257  CPPFLAGS=$save_CPPFLAGS
258])
259
[901]260
261AS_IF([test "x$plplot_found" = "xyes" && test -n "$PKG_CONFIG"], [
262  AC_MSG_CHECKING([plplot version >= $plplot_version])
263  AS_IF([$PKG_CONFIG --atleast-version=$plplot_version plplotd-c++], [
264    AC_MSG_RESULT([yes])
265  ],[
266    AC_MSG_RESULT([`$PKG_CONFIG --modversion= plplotd-c++`])
267    plplot_found="old"
[888]268  ])
269])
[901]270
[904]271AS_IF([test "x$plplot_found" = "xyes"], [
[988]272  save_CPPFLAGS=$CPPFLAGS
273  CPPFLAGS="$PLPLOT_CPPFLAGS $CPPFLAGS"
[901]274  save_LDFLAGS=$LDFLAGS
275  LDFLAGS="$PLPLOT_LDFLAGS $LDFLAGS"
276  save_LIBS=$LIBS
277  LIBS="$PLPLOT_LIBS $LIBS"
278  AC_MSG_CHECKING([for library containing plstream])
279  AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include <plplot/plstream.h>],
[1029]280                                  [plstream pls(1,1,"svg", "conftest.svg");
281                                   pls.scolbga(255, 255, 255, 0);
282                                  ])],
[901]283                 [AC_MSG_RESULT([yes]);
284                  AC_DEFINE([HAVE_PLPLOT], [1],
285                            [Define to 1 if you have plplot])],
286                 [AC_MSG_RESULT([no])
287                  plplot_found=nolib;])
[989]288  CPPFLAGS=$save_CPPFLAGS
289  LDFLAGS=$save_LDFLAGS
290  LIBS=$save_LIBS
[901]291])
[888]292# restore variable
293export PKG_CONFIG_PATH=$save_PKG_CONFIG_PATH
294AC_SUBST(PLPLOT_CPPFLAGS)
295AC_SUBST(PLPLOT_LDFLAGS)
296AC_SUBST(PLPLOT_LIBS)
297
[614]298# checking if we build in a subversion WC
[835]299AS_IF([test -d $srcdir/.svn], [wc_found="yes"], [wc_found="no"])
[730]300AM_CONDITIONAL([HAVE_SVN_WC], [test "$wc_found" = "yes"])
[738]301AC_SUBST([wc_found])
[730]302
303# checking if we have test repo
304test_repo_filename=$srcdir/test/repo;
[835]305AS_IF([test -r $test_repo_filename],
[744]306              [AC_DEFINE([HAVE_TEST_REPO],[1],[define if test repo is available])
307               test_repo_found="yes"],
[730]308              [test_repo_found="no"])
[748]309AC_SUBST([test_repo_found])
[772]310AS_IF([test "x$test_repo_found" = xyes],
311      [abs_test_repo=`cd $test_repo_filename && pwd`;
312       AC_SUBST(abs_test_repo)]
313     )
[952]314AC_CONFIG_FILES([test/init.sh])
[772]315AC_CONFIG_FILES([test/svn_update.sh], [chmod +x test/svn_update.sh])
[540]316
[880]317dnl maintainer make rukes from yat project
[874]318YAT_SVN_RELEASE
[561]319
[901]320# Restore FLAGS
321APR_RESTORE_THE_ENVIRONMENT([CPPFLAGS], [DEFAULT_])
322APR_RESTORE_THE_ENVIRONMENT([CXXFLAGS], [DEFAULT_])
323
[2]324AC_CONFIG_FILES([Makefile
[21]325                bin/Makefile
326                lib/Makefile
[1119]327                yat/Makefile
[724]328                man/Makefile
[597]329                test/environment.h
[569]330                test/Makefile])
[2]331
[1119]332AC_CONFIG_HEADER([yat/config_public.h])
[795]333
[164]334# Print failure status information about selected items, and exit if
335# fatal errors were encountered. No output will be created if
336# configure is halted prematurely.
[156]337
[164]338# used to trigger exit before creation of output
339all_reqs_ok="true"
[160]340
[730]341if (test "$wc_found" = "yes"); then
[742]342   if test x$HELP2MAN = xno; then
[740]343     AC_MSG_WARN(m4_text_wrap(m4_normalize([
344       `help2man' is missing on your system.  You will not be
345       able to create the man page. A sound man page should be
346       included in a distribution, and since you will not able
347       to create a complete distribution `make dist' will fail.
348       ]),[                   ],
349          [                             ], 79))
350   fi
[730]351   # svnversion is required when building from svn wc
352   if (test "$svnversion" = "no"); then
353      all_reqs_ok="false";
354      AC_MSG_WARN([dnl
355Cannot find svnversion, which is required when building from a
356subversion working copy. Please install svnversion and make sure it is
357in your search path.]);
358   fi
359   if (test "$test_repo_found" = "no"); then
360      all_reqs_ok="false";
361      AC_MSG_WARN([dnl
362Cannot find test repository (test_repo_filename), which should be
363available when building from a subversion working copy. Try svn
364update in top directory.]);
365   fi
[672]366fi
[540]367
[164]368# Non-existing APR is fatal -- sub-sequent compilation will fail.
369if (test "$apr_found" = "no") ; then
[670]370  AC_MSG_WARN([APR not found. The Apache Portable Runtime
371  (APR) library cannot be found. Please make sure APR is installed
372  and supply the appropriate --with-apr option to 'configure'.])
373  all_reqs_ok="false"
[164]374fi
[160]375
[164]376# Non-existing subversion API is fatal -- sub-sequent compilation will fail.
377if (test "$svn_found" = "no") ; then
[670]378  svn_msg="Subversion API not found. Subversion API libraries cannot
379  be found. Make sure the APIs are installed and supply the
380  appropriate --with-svn option to 'configure'."
381  if (test "$apr_found" = "no") ; then
[383]382    svn_msg="$svn_msg
[557]383    Note, APR was not found. Failure to locate APR affects the search
384    of the subversion API. Please fix the APR problem before trying
385    to resolve the subversion related issues."
[670]386  fi
387  AC_MSG_WARN([$svn_msg])
388  all_reqs_ok="false"
[383]389fi
[162]390
[858]391# Non-existing PLplot API is fatal -- sub-sequent compilation will fail.
[972]392AS_CASE([$plplot_found],
[901]393  [noheader],
394    [AC_MSG_WARN([
395    PLplot developer files cannot be found. Make sure PLplot is installed.])
396    all_reqs_ok="false"],
397  [old],
398    [AC_MSG_WARN([
399    PLplot developer files found but not required API version.
400    Version at least $plplot_version is required. Please upgrade PLplot.])
401    all_reqs_ok="false"],
402  [nolib],
403    [AC_MSG_WARN([
404    PLplot developer files found but linking against plplot library failed.])
405    all_reqs_ok="false"])
[858]406
[567]407if test $ac_cv_type_long_long_int != yes ; then
[670]408  AC_MSG_WARN([Compiler $CXX does not support `long long'.
409  svndigest must be compiled with a compiler that supports `long long'.])
410  all_reqs_ok="false"
[564]411fi
412
[164]413if (test "$all_reqs_ok" = "false") ; then
[670]414  AC_MSG_ERROR([Some pre-requisites were not fulfilled, aborting
415  configure. Please consult the 'README' file for more information
416  about what is needed to compile svndigest and refer to above
417  warning messages. Needed files were NOT created.])
[164]418fi
419
420# Create output.
421AC_OUTPUT
422
423# Some more messages.
[887]424AC_MSG_NOTICE([
425Ready to compile the executables of svndigest $VERSION
426The following flags and libs will be used:
427+++++++++++++++++++++++++++++++++++++++++++++++
428  Compiler:           $CXX
429  Preprocessor flags: $SD_CPPFLAGS $CPPFLAGS
430    CPPFLAGS:         $CPPFLAGS
431    DEFAULT_CPPFLAGS: $DEFAULT_CPPFLAGS
432    APR_CPPFLAGS:     $APR_CPPFLAGS
433    SVN_CPPFLAGS:     $SVN_CPPFLAGS
[888]434    PLPLOT_CPPFLAGS:  $PLPLOT_CPPFLAGS
[887]435  C++ flags:
436    CXXFLAGS:         $CXXFLAGS
437    DEFAULT_CXXFLAGS: $DEFAULT_CXXFLAGS
438  Linker flags:
439    LDFLAGS:          $LDFLAGS
440    APR_LDFLAGS:      $APR_LDFLAGS
441    SVN_LDFLAGS:      $SVN_LDFLAGS
442    PLPLOT_LDFLAGS:   $PLPLOT_LDFLAGS
443  Libraries:         
444    LIBS              $LIBS
445    APR_LIBS          $APR_LIBS
446    SVN_LIBS          $SVN_LIBS
[888]447    PLPLOT_LIBS       $PLPLOT_LIBS
[887]448+++++++++++++++++++++++++++++++++++++++++++++++]dnl
449)
[164]450
[880]451AC_MSG_NOTICE([Now type 'make all check'.])
Note: See TracBrowser for help on using the repository browser.