## Process this file with autoconf to produce a configure script.
##
## $Id: configure.ac 1598 2015-08-26 15:11:38Z jari $
##
## If you grabbed the source from subversion you should, at top-level,
## execute:
## ./bootstrap
## To push subsequent changes of this file into the build scripts you
## must issue:
## autoreconf
# Copyright (C) 2005 Jari Häkkinen, Peter Johansson
# Copyright (C) 2006 Jari Häkkinen
# Copyright (C) 2007, 2008, 2009, 2010 Jari Häkkinen, Peter Johansson
# Copyright (C) 2011, 2012 Peter Johansson
# Copyright (C) 2015 Jari Häkkinen, Peter Johansson
#
# This file is part of svndigest, http://dev.thep.lu.se/svndigest
#
# svndigest is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# svndigest is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with svndigest. If not, see .
AC_PREREQ([2.63])
m4_include([m4/version.m4])
AC_INIT([svndigest], m4_defn([my_VERSION]),
[svndigest-users@lists.sourceforge.net],,
[http://dev.thep.lu.se/svndigest])
AC_CONFIG_SRCDIR([lib/File.h])
AC_CONFIG_AUX_DIR([autotools])
dnl arg below should be the same as in Makefile.am
AC_CONFIG_MACRO_DIR([m4])
AC_PREFIX_DEFAULT([/usr/local])
dnl FIXME remove when we assume autoconf 2.64
m4_ifndef([AC_PACKAGE_URL],
[AC_DEFINE([PACKAGE_URL], ["http://dev.thep.lu.se/svndigest"],
[Define to home page for this package])
AC_SUBST([PACKAGE_URL], ["http://dev.thep.lu.se/svndigest"])])
MY_VERSION
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([1.11 color-tests std-options parallel-tests
silent-rules subdir-objects])
# Set default programming language
AC_LANG([C++])
# propagate selected configure variables to DISTCHECK_CONFIGURE_FLAGS
for var in CPPFLAGS CXX CXXFLAGS CXXCPP LDFLAGS LIBS; do
eval isset=\${$var+set}
if test "$isset" = 'set' ; then
eval val=$`echo $var`
DISTCHECK_CONFIGURE_FLAGS="${DISTCHECK_CONFIGURE_FLAGS}'${var}=${val}' "
fi
done
AC_SUBST(DISTCHECK_CONFIGURE_FLAGS)
# record if CXXFLAGS was set by user for further use below
AS_IF([test "${CXXFLAGS+set}" = set], [
CXXFLAGS_set_by_user=yes
],[
CXXFLAGS_set_by_user=no
# set CXXFLAGS to avoid expansion in AC_PROG_CXX
CXXFLAGS=
])
# Checks for programs.
AC_PROG_CXXCPP
AC_PROG_CXX
AC_PROG_RANLIB
AC_PROG_SED
# avoid running help2man when cross-compiling (as it involves invoking binaries)
AS_IF([test x$cross_compiling = xno], [
AM_MISSING_PROG([HELP2MAN], [help2man])
], [
# user is always right
HELP2MAN=${HELP2MAN-:}
])
# look for pkg-config
PKG_PROG_PKG_CONFIG([0.23])
# Save FLAGS
APR_SAVE_THE_ENVIRONMENT(CPPFLAGS)
APR_SAVE_THE_ENVIRONMENT(CXXFLAGS)
AC_TYPE_LONG_LONG_INT
AS_IF([test x$ac_cv_type_long_long_int = xno],
[AC_MSG_ERROR([compiler does not support long long int])]
)
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],[turn on debug options and code])],
[], [enable_debug=no])
# Set CXXFLAGS depending on whether CXXFLAGS was provided by user and
# whether we are in debug mode
AS_IF([test x$enable_debug = xyes], [
# in debug we alsways add flags below i.e. we turn on warnings,
# debug symbols, and low level of optimisation.
# -Wno-long-long is needed to suppress compiler diagnostics regarding
# using extension beyond the C++ standard (usage of non C++ standard
# 'long long' types).
YAT_CXX_ADD_FLAG([CXXFLAGS],[-pedantic -Wall -Wno-long-long -g -O])
],[
# in standard mode we set to CXXFLAGS default to '-O3', but only if
# CXXFLAGS was not proved by user. If user provided a VALUE FOR
# CXXFLAGS we listen to that and leave as is.
AS_IF([test x$CXXFLAGS_set_by_user != xyes], [
YAT_CXX_ADD_FLAG([CXXFLAGS],[-O3])
])
])
AC_ARG_ENABLE([assert],
[AS_HELP_STRING([--enable-assert], [turn on assertions])])
# if assert not enabled/disabled explicitly, default behaviour is to
# enable assert in debug mode and disable otherwise
test "${enable_assert+set}" = set || enable_assert=$enable_debug
# FIXME perhaps we should AC_DEFINE NDEBUG instead but then we need to
# include config.h in all source files.
#
# propagate enable_assert to CPPFLAGS
AS_IF([test x$enable_assert != xyes],[YAT_CPP_ADD_FLAG([CPPFLAGS],[-DNDEBUG])])
AC_MSG_CHECKING([g++ deprecation attribute])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[void f() __attribute__ ((deprecated));]],)],
[AC_DEFINE([YAT_HAVE_GCC_DEPRECATED], [1],
[Define if compiler supports deprecated attribute, as in g++ 4.0])
AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])] )
# Apache Portable Runtime (APR) API checks
APR_FIND_APR(,,[1],[1 0])
AS_IF([test "${with_apr+set}" = set],
[DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-apr=$with_apr"]
)
if test "$apr_found" = "yes" ; then
APR_LIBS="`$apr_config --libs`"
apr_link_ld="`$apr_config --link-ld`"
for i in $apr_link_ld; do
AS_IF([AS_ECHO([$i]) | grep '^-l' > /dev/null],
[APR_LIBS="$i $APR_LIBS"],
[YAT_LD_ADD_FLAG([LDFLAGS], [$i])])
done
YAT_CPP_ADD_FLAG([CPPFLAGS],[`$apr_config --includes --cppflags`])
AC_CHECK_HEADER([apr_allocator.h],,[apr_found="no"])
fi
AC_SUBST([APR_LIBS])
# Subversion API checks
svn_found="yes"
AC_ARG_WITH([svn],
[AS_HELP_STRING([--with-svn=DIR],
[prefix for svn developer files])],
[ AS_CASE([$withval], [yes|no],
[AC_MSG_ERROR([--with-svn requires a directory to be provided])])
AS_IF([test -d $with_svn], [],
[AC_MSG_ERROR([$with_svn: no such directory])])
# transform argument to absolute path
with_svn=`cd $with_svn && pwd`
DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-svn=$with_svn"
YAT_LD_ADD_FLAG([LDFLAGS], [-L$with_svn/lib])
YAT_CPP_ADD_FLAG([CPPFLAGS], [-I$with_svn/include])
])
# svn needs needs apr headers
AC_CHECK_HEADER([subversion-1/svn_types.h],,[svn_found="no"])
# In some versions, such as 1.7, of Subversion header file `svn_wc.h'
# does not conform to C++98 and therefore compiling with -pedantic
# fails. As -pedantic is automatically turned on in --enable-debug
# mode we need to turn it off -pedantic to allow building with
# --enable-debug (see ticket #506)
AS_IF([test x$enable_debug = xyes],
[AC_MSG_CHECKING([subversion-1/svn_wc.h usability with -pedantic])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([@%:@include ])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
CXXFLAGS=`AS_ECHO(["$CXXFLAGS"]) | $SED 's|-pedantic||'`
AC_MSG_NOTICE([remove -pedantic from \$CXXFLAGS])
]
)
])
save_LIBS=$LIBS
tmp_LIBS="$APR_LIBS $save_LIBS"
LIBS=""
AC_SEARCH_LIBS([svn_cmdline_setup_auth_baton],[svn_subr-1],
[], [svn_found="no"], [$tmp_LIBS])
AC_SEARCH_LIBS([svn_ra_initialize],[svn_ra-1], [], [svn_found="no"],[$tmp_LIBS])
AC_SEARCH_LIBS([svn_wc_adm_open3],[svn_wc-1], [], [svn_found="no"], [$tmp_LIBS])
AC_SEARCH_LIBS([svn_diff_file_options_create],[svn_diff-1],[],
[svn_found="no"], [$tmp_LIBS])
AC_SEARCH_LIBS([svn_client_log3],[svn_client-1],,[svn_found="no"], [$tmp_LIBS])
SVN_LIBS=$LIBS
LIBS=$save_LIBS
AC_SUBST([SVN_LIBS])
# PLplot API checks
# plplot_found can get values: skip, noheader, old, or nolib if an
# error is detected.
plplot_found="yes"
plplot_version=5.10.0
save_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
AC_ARG_WITH([plplot],
[AS_HELP_STRING([--with-plplot=DIR],[prefix for plplot developer files])],
[DISTCHECK_CONFIGURE_FLAGS="$DISTCHECK_CONFIGURE_FLAGS --with-plplot=$withval"
AS_IF([test "x$withval" = "xno"], [ dnl
plplot_found=skip;
], [ dnl
AS_IF([test -d $with_plplot], [],
[AC_MSG_ERROR([$with_plplot: no such directory])])
with_plplot=`cd $with_plplot && pwd`
# help pkg-config find .pc file
PKG_CONFIG_PATH=$with_plplot/lib/pkgconfig$PATH_SEPARATOR$PKG_CONFIG_PATH
export PKG_CONFIG_PATH
])
])
# PLPLOT_USE_D is set to character 'd' for plplot versions prior to
# 5.11 since library names changed in plplot 5.11, i.e., the 'd' to
# indicate double floating number precision was removed from library
# names.
PLPLOT_USE_D=
use_plplot_pc="no"
AS_IF([test "x$plplot_found" = "xyes" && test -n "$PKG_CONFIG"], [
# check for plplot 5.11 or later first
AC_MSG_CHECKING([for plplot-c++.pc])
AS_IF([$PKG_CONFIG --exists plplot-c++], [
AC_MSG_RESULT([yes])
use_plplot_pc="yes"
],[
# fall back to check for plplot prior to version 5.11
AC_MSG_CHECKING([for plplotd-c++.pc])
AS_IF([$PKG_CONFIG --exists plplotd-c++], [
AC_MSG_RESULT([yes])
use_plplot_pc="yes"
# plplot prior to 5.11 found, use 'd'
PLPLOT_USE_D=d
],[
AC_MSG_RESULT([no])
AC_MSG_WARN([cannot find plplotd-c++ nor plplot-c++;
please use --with-plplot with appropriate argument to get more accurate
configuration.])
])
])
])
AS_IF([test "x$plplot_found" = "xyes"], [
# copy flags if we have found pc file
AS_IF([test "$use_plplot_pc" = "yes"], [
# plplot typically returns /include/plplot because plplot
# people assumes users include header files as . We prefer
# including files as and therefore need to trim off
# trailing '/plplot'. Space is included in sed expression to avoid
# substituting potential '/plplot' in PREFIX.
YAT_CPP_ADD_FLAG([CPPFLAGS],
[`$PKG_CONFIG plplot$PLPLOT_USE_D-c++ --cflags-only-I | sed 's|/plplot | |g'`])
YAT_LD_ADD_FLAG([LDFLAGS], [`$PKG_CONFIG plplot$PLPLOT_USE_D-c++ --libs-only-L`])
PLPLOT_LIBS="`$PKG_CONFIG plplot$PLPLOT_USE_D-c++ --libs-only-l --libs-only-other`"
],[
# otherwise guess
PLPLOT_LIBS="-lplplotcxx -lplplot";
AS_IF([test -n "$with_plplot" && test "x$with_plplot" != "xyes"], [
YAT_LD_ADD_FLAG([LDFLAGS], [-L$with_plplot/lib])
YAT_CPP_ADD_FLAG([CPPFLAGS], [-I$with_plplot/include])
])
])
])
AS_IF([test "x$plplot_found" = "xyes"], [
AC_CHECK_HEADER([plplot/plstream.h], [], [plplot_found="noheader"])
])
AS_IF([test "x$plplot_found" = "xyes" && test -n "$PKG_CONFIG"], [
AC_MSG_CHECKING([plplot version >= $plplot_version])
AS_IF([$PKG_CONFIG --atleast-version=$plplot_version plplot$PLPLOT_USE_D-c++], [
AC_MSG_RESULT([yes])
],[
have_plplot_version=`$PKG_CONFIG --modversion plplot$PLPLOT_USE_D-c++`
AC_MSG_RESULT([$have_plplot_version])
plplot_found="old"
])
])
AS_IF([test "x$plplot_found" = "xyes"], [
save_LIBS=$LIBS
LIBS="$PLPLOT_LIBS $LIBS"
AC_MSG_CHECKING([for library containing plstream])
AC_LINK_IFELSE([AC_LANG_PROGRAM([@%:@include ],
[plstream pls(1,1,"svg", "conftest.svg");
pls.scolbga(255, 255, 255, 0);
])],
[AC_MSG_RESULT([yes]);
AC_DEFINE([HAVE_PLPLOT], [1],
[Define to 1 if you have plplot])],
[AC_MSG_RESULT([no])
plplot_found=nolib;])
LIBS=$save_LIBS
])
# restore variable
export PKG_CONFIG_PATH=$save_PKG_CONFIG_PATH
AC_SUBST(PLPLOT_LIBS)
# checking if we have test repo
test_repo_filename=$srcdir/test/repo;
AS_IF([test -r $test_repo_filename],
[AC_DEFINE([HAVE_TEST_REPO],[1],[define if test repo is available])
test_repo_found="yes"],
[test_repo_found="no"])
AC_SUBST([test_repo_found])
AS_IF([test "x$test_repo_found" = xyes],
[abs_test_repo=`cd $test_repo_filename && pwd`;
AC_SUBST(abs_test_repo)]
)
AC_CONFIG_FILES([test/init.sh])
AC_CONFIG_FILES([test/svn_update.sh], [chmod +x test/svn_update.sh])
dnl maintainer make rules from yat project
YAT_SVN_RELEASE
YAT_SVN_REVISION
YAT_REVISION_HEADER
YAT_SVN_RELEASE_YEAR
# Set variable if we are bulding from a typical distribution, i.e., we
# don't have svn wc and we have man pages (included in dist).
AM_CONDITIONAL([MAN_TARBALL],
[test $have_svn_wc = "no" && test -r $srcdir/man/svndigest.1 && \
test -r $srcdir/man/svncopyright.1 && \
test -r $srcdir/man/svndigest-copy-cache.1])
# Restore FLAGS
APR_RESTORE_THE_ENVIRONMENT([CPPFLAGS], [SVNDIGEST_])
APR_RESTORE_THE_ENVIRONMENT([CXXFLAGS], [SVNDIGEST_])
APR_RESTORE_THE_ENVIRONMENT([LDFLAGS], [SVNDIGEST_])
AC_CONFIG_FILES([Makefile test/environment.h])
AC_CONFIG_FILES([build_support/tag_and_release.sh],
[chmod +x-w build_support/tag_and_release.sh])
AC_CONFIG_HEADER([yat/config_public.h])
# Print failure status information about selected items, and exit if
# fatal errors were encountered. No output will be created if
# configure is halted prematurely.
# used to trigger exit before creation of output
all_reqs_ok="true"
# checking for help2man, missing help2man is non-fatal but subsequent
# use of `make dist` and `make distcheck` is constructed to fail.
AC_MSG_CHECKING([help2man])
# redirecting potential error msg to log file
AS_IF([help2man --version >/dev/null 2>&AS_MESSAGE_LOG_FD],
[have_help2man=yes], [have_help2man=no])
AM_CONDITIONAL([HAVE_HELP2MAN], [test "x$have_help2man" = "xyes"])
AC_SUBST([have_help2man])
AC_MSG_RESULT([$have_help2man])
# if we work in an svn wc we should have a test repository and warn if
# help2man missing
AS_VAR_IF([have_svn_wc], [yes], [
if (test "$test_repo_found" = "no"); then
all_reqs_ok="false";
AC_MSG_WARN(m4_text_wrap(m4_normalize([
Cannot find test repository (test/repo), which should be
available when building from a subversion working copy.
Try svn update in top directory.
]),
[ ],[ ],79))
fi
if (test "$have_help2man" = "no"); then
# non-fatal, only issue warning
AC_MSG_WARN(m4_text_wrap(m4_normalize([
`help2man' is missing on your system. You will not be
able to create the man page. A sound man page should be
included in a distribution, and since you will not able
to create a complete distribution `make dist' will fail.
]),
[ ],[ ],79))
fi
])
# Non-existing APR is fatal -- sub-sequent compilation will fail.
if (test "$apr_found" = "no") ; then
AC_MSG_WARN([APR not found. The Apache Portable Runtime
(APR) library cannot be found. Please make sure APR is installed
and supply the appropriate --with-apr option to 'configure'.])
all_reqs_ok="false"
fi
# Non-existing subversion API is fatal -- sub-sequent compilation will fail.
if (test "$svn_found" = "no") ; then
svn_msg="Subversion API not found. Subversion API libraries cannot
be found. Make sure the APIs are installed and supply the
appropriate --with-svn option to 'configure'."
if (test "$apr_found" = "no") ; then
svn_msg="$svn_msg
Note, APR was not found. Failure to locate APR affects the search
of the subversion API. Please fix the APR problem before trying
to resolve the subversion related issues."
fi
AC_MSG_WARN([$svn_msg])
all_reqs_ok="false"
fi
# Non-existing PLplot API is fatal -- sub-sequent compilation will fail.
AS_CASE([$plplot_found],
[noheader],
[AC_MSG_WARN([
PLplot developer files cannot be found. Make sure PLplot is installed.])
all_reqs_ok="false"],
[old],
[AC_MSG_WARN([
PLplot developer files found but not required API version.
Version at least $plplot_version is required. Please upgrade PLplot.])
all_reqs_ok="false"],
[nolib],
[AC_MSG_WARN([
PLplot developer files found but linking against plplot library failed.])
all_reqs_ok="false"])
if test $ac_cv_type_long_long_int != yes ; then
AC_MSG_WARN([Compiler $CXX does not support `long long'.
svndigest must be compiled with a compiler that supports `long long'.])
all_reqs_ok="false"
fi
if (test "$all_reqs_ok" = "false") ; then
AC_MSG_ERROR([Some pre-requisites were not fulfilled, aborting
configure. Please consult the 'README' file for more information
about what is needed to compile svndigest and refer to above
warning messages. Needed files were NOT created.])
fi
# Create output.
AC_OUTPUT
# Some more messages.
AC_MSG_NOTICE([
Ready to compile the executables of svndigest $VERSION
The following flags and libs will be used:
+++++++++++++++++++++++++++++++++++++++++++++++
Compiler: $CXX
Preprocessor flags:
CPPFLAGS: $CPPFLAGS
SVNDIGEST_CPPFLAGS: $SVNDIGEST_CPPFLAGS
C++ flags:
CXXFLAGS: $CXXFLAGS
SVNDIGEST_CXXFLAGS: $SVNDIGEST_CXXFLAGS
Linker flags:
LDFLAGS: $LDFLAGS
SVNDIGEST_LDFLAGS: $SVNDIGEST_LDFLAGS
Libraries:
LIBS $LIBS
APR_LIBS $APR_LIBS
SVN_LIBS $SVN_LIBS
PLPLOT_LIBS $PLPLOT_LIBS
+++++++++++++++++++++++++++++++++++++++++++++++]dnl
)
AC_MSG_NOTICE([Now type 'make all check'.])