syncevolution/configure-pre.in

365 lines
16 KiB
Plaintext
Raw Normal View History

dnl -*- mode: Autoconf; -*-
dnl Invoke autogen.sh to produce a configure script.
AC_INIT(src/syncevolution.cpp)
AM_INIT_AUTOMAKE(syncevolution, 0.8.1)
define([FUNAMBOLSRC_REPO], [git://github.com/pohly/funambol-cpp-client-api.git])
dnl Specify git revisions/branches without prefix, i.e., without 'origin'.
dnl We'll sort that out below.
define([FUNAMBOLSRC_REVISION], [syncevolution-0.8.1a])
AM_CONFIG_HEADER(config.h)
AC_LIBTOOL_DLOPEN
dnl default device type (see AC_DEFINE below)
DEVICE_TYPE=desktop
# options to be used when configuring client library
CLIENT_CONFIGURE_OPTIONS=
AC_ARG_WITH(funambol,
AS_HELP_STRING([--with-funambol=<base directory>],
[specifies location of Funambol client library]),
[FUNAMBOL="$withval"])
AC_ARG_WITH(sync4j,
AS_HELP_STRING([--with-funambol=<base directory>],
[alias for --with-funambol]),
[FUNAMBOL="$withval"])
if test -e "$srcdir/src/client-api"; then
FUNAMBOLSRC_DEF="$srcdir/src/client-api"
else
FUNAMBOLSRC_DEF="FUNAMBOLSRC_REPO"
fi
dnl AC_ARG_WITH(funambol-src,
dnl AS_HELP_STRING([--with-funambol-src=<base directory|svn URL|git URL>],
dnl [Specifies location of the Funambol 'client-api/native' source code.
dnl Use this instead of --with-funambol when the client library is to
dnl be compiled as part of the SyncEvolution compilation. In release
dnl versions of SyncEvolution, a copy of the client library is bundled
dnl under 'src/client-api' and compiled unless something else is
dnl specified. --with-funambol-src can be given a path to sources
dnl checked out already, a Subversion repository URL or a git repository
dnl URL. When given a repository URL, then the configure script
dnl will checkout the sources into 'src/client-api-copy' or
dnl update that working copy if the directory already exists.
dnl Default: bundled source in src/client-api (in released SyncEvolution sources),
dnl FUNAMBOLSRC_REPO otherwise.]),
dnl [FUNAMBOLSRC="$withval"], [FUNAMBOLSRC="$FUNAMBOLSRC_DEF"; REVISION="FUNAMBOLSRC_REVISION"])
dnl AC_ARG_WITH(sync4j-src,
dnl AS_HELP_STRING([--with-sync4j-src=<base directory>],
dnl [alias for --with-funambol-src]),
dnl [FUNAMBOLSRC="$withval"])
dnl AC_ARG_WITH(funambol-username,
dnl AS_HELP_STRING([--with-funambol-username=<svn username>],
dnl [username to use when checking out --with-funambol-src sources from Subversion, default 'guest']),
dnl [USERNAME="$withval"], [USERNAME="guest"])
dnl AC_ARG_WITH(funambol-revision,
dnl AS_HELP_STRING([--with-funambol-revision=<git tag/branch/hash or Subversion revision>],
dnl [Identifies which source revision to use from --with-funambol-src repository, empty string stands for latest. Default for default --funambol-src: FUNAMBOLSRC_REVISION]),
dnl [REVISION="$withval"])
AC_ARG_ENABLE(shared,
AS_HELP_STRING([--enable-shared],
[build backends as dynamically loadable modules]),
enable_shared="$enableval", enable_shared="no")
AC_ARG_ENABLE(static,
AS_HELP_STRING([--enable-static],
[build backends also as static libraries]),
enable_static="$enableval", enable_static="no")
AC_ARG_ENABLE(unit-tests,
AS_HELP_STRING([--enable-unit-tests],
[enables tests embedded in the source code of the library (changes content of executable)]),
enable_unit_tests="$enableval", enable_unit_tests="no")
AC_ARG_ENABLE(integration-tests,
AS_HELP_STRING([--enable-integration-tests],
[enables tests outside of the library (can be used together with normal builds of the library)]),
enable_integration_tests="$enableval", enable_integration_tests="no")
AC_ARG_ENABLE(static-cxx,
AS_HELP_STRING([--enable-static-cxx],
[build executables which contain libstdc++ instead of requiring suitable libstdc++.so to run]),
enable_static_cxx="$enableval", enable_static_cxx="no")
AC_ARG_ENABLE(evolution-compatibility,
AS_HELP_STRING([--enable-evolution-compatibility],
[build executables which only call Evolution via dlopen/dlsym: this avoids all hard dependencies on EDS shared objects, but might lead to crashes when their ABI changes]),
enable_evolution_compatibility="$enableval", enable_evolution_compatibility="no")
# Maemo hacks:
# - set the (non-standard!) DBUS_DEFAULT_TIMEOUT
# - wrap e_book_from_string() to fix invalid parameter
# - don't use UTF-8 encoding in Perl script
AC_ARG_ENABLE(maemo,
AS_HELP_STRING([--enable-maemo],
[enables some hacks which work around problems with the Maemo 2.0 until at least 3.0 EDS-Dbus]),
[AC_DEFINE(ENABLE_MAEMO, 1, [enable Maemo hacks])
DEVICE_TYPE=Maemo
MODIFY_SYNCCOMPARE='-e "s/use encoding/#use encoding/;" -e "s/:utf8//;"'])
AC_SUBST(MODIFY_SYNCCOMPARE)
PKG_CHECK_MODULES(SYNTHESIS, "synthesis")
AC_CHECK_HEADERS(signal.h dlfcn.h)
# cppunit needed?
if test $enable_unit_tests == "yes" || test $enable_integration_tests == yes; then
CPPUNIT_CXXFLAGS=`cppunit-config --cflags` || AC_MSG_ERROR("cppunit-config --cflags failed - is it installed?")
CPPUNIT_LDFLAGS=`cppunit-config --libs` || AC_MSG_ERROR("cppunit-config --libs failed - is it installed?")
CPPUNIT_TESTS=client-test
fi
AC_SUBST(CPPUNIT_CXXFLAGS)
AC_SUBST(CPPUNIT_LDFLAGS)
AC_SUBST(CPPUNIT_TESTS)
if test $enable_unit_tests == "yes"; then
CLIENT_CONFIGURE_OPTIONS="$CLIENT_CONFIGURE_OPTIONS --enable-unit-tests"
AC_DEFINE(ENABLE_UNIT_TESTS, 1, [enable unit tests inside the library's source code])
fi
if test $enable_integration_tests == "yes"; then
CLIENT_CONFIGURE_OPTIONS="$CLIENT_CONFIGURE_OPTIONS --enable-integration-tests"
AC_DEFINE(ENABLE_INTEGRATION_TESTS, 1, [enable unit tests outside of the library's source code])
fi
if test $enable_static_cxx == "yes"; then
LIBS="$LIBS -L."
CORE_LDADD_DEP=libstdc++.a
fi
AC_SUBST(CORE_LDADD_DEP)
# preserve src/client-api by default,
# always
CLEAN_CLIENT_SRC=
dnl FUNAMBOL_LIB=$PWD/src/build-client-api/src/libfunambol.la
AC_SUBST(CLEAN_CLIENT_SRC)
# Check for transport layer.
# Both curl and libsoup can be enabled and disabled explicitly.
# The default is to use libsoup if available, otherwise curl.
AC_MSG_CHECKING([for libcurl])
if LIBCURL_LIBS=`sh -c 'curl-config --libs' 2>&AS_MESSAGE_LOG_FD` && \
LIBCURL_CFLAGS=`sh -c 'curl-config --cflags' 2>&AS_MESSAGE_LOG_FD`; then
AC_MSG_RESULT([yes])
have_libcurl="yes"
else
AC_MSG_RESULT([no])
have_libcurl="no"
fi
PKG_CHECK_MODULES(LIBSOUP, libsoup-2.4,
have_libsoup="yes",
have_libsoup="no")
TRANSPORT=
TRANSPORT_LIBS=
TRANSPORT_CFLAGS=
# choose default transport (mirrors code in EvolutionSyncClient::createTransportAgent())
if test "$have_libsoup" = "yes"; then
default_transport="libsoup"
elif test "$have_libcurl" = "yes"; then
default_transport="libcurl"
fi
AC_ARG_ENABLE(libcurl,
AC_HELP_STRING([--enable-libcurl],
[enable libcurl as transport layer]),
[ if test "$enableval" = "yes"; then
test "$have_libcurl" = "yes" || AC_MSG_ERROR([libcurl not found])
TRANSPORT="$TRANSPORT libcurl"
TRANSPORT_LIBS="$TRANSPORT_LIBS $LIBCURL_LIBS"
TRANSPORT_CFLAGS="$TRANSPORT_CFLAGS $LIBCURL_CFLAGS"
AC_DEFINE(ENABLE_LIBCURL, 1, [enable libcurl transport])
else
libcurl_disabled="yes"
fi ],
[ if test "$have_libcurl" = "yes" && test "$default_transport" = "libcurl" ; then
TRANSPORT="$TRANSPORT libcurl"
TRANSPORT_LIBS="$TRANSPORT_LIBS $LIBCURL_LIBS"
TRANSPORT_CFLAGS="$TRANSPORT_CFLAGS $LIBCURL_CFLAGS"
AC_DEFINE(ENABLE_LIBCURL, 1, [enable libcurl transport])
fi ])
AC_ARG_ENABLE(libsoup,
AC_HELP_STRING([--enable-libsoup],
[enable libsoup as transport layer]),
[ if test "$enableval" = "yes"; then
test "$have_libsoup" = "yes" || AC_MSG_ERROR([libsoup not found])
TRANSPORT="$TRANSPORT libsoup"
TRANSPORT_LIBS="$TRANSPORT_LIBS $LIBSOUP_LIBS"
TRANSPORT_CFLAGS="$TRANSPORT_CFLAGS $LIBSOUP_CFLAGS"
AC_DEFINE(ENABLE_LIBSOUP, 1, [enable libsoup transport])
else
libsoup_disabled="yes"
fi ],
[ if test "$have_libsoup" = "yes" && test "$default_transport" = "libsoup"; then
TRANSPORT="$TRANSPORT libsoup"
TRANSPORT_LIBS="$TRANSPORT_LIBS $LIBSOUP_LIBS"
TRANSPORT_CFLAGS="$TRANSPORT_CFLAGS $LIBSOUP_CFLAGS"
AC_DEFINE(ENABLE_LIBSOUP, 1, [enable libsoup transport])
fi ])
if test ! "$TRANSPORT" &&
test "$libsoup_disabled" != "yes" &&
test "$libcurl_disabled" != "yes"; then
AC_ERROR([no transport library found, configure with --disable-libcurl --disable-libsoup to continue anyway (only useful if users of libsyncevolution provide transport implementation)])
fi
AC_SUBST(TRANSPORT_LIBS)
AC_SUBST(TRANSPORT_CFLAGS)
dnl # absolute patch to source of Funambol client library
dnl CLIENT_API_SRC=no-client-api-source
dnl AC_SUBST(CLIENT_API_SRC)
dnl if test ! "$FUNAMBOL"; then
dnl if test "$FUNAMBOLSRC"; then
dnl # default: checkout a copy of the sources, remove it during maintainer-clean and distclean
dnl CLEAN_CLIENT_SRC=client-api-copy
dnl CLIENT_API_SRC=$PWD/src/client-api-copy
dnl AC_MSG_NOTICE( [updating the content of $CLIENT_API_SRC from $FUNAMBOLSRC] )
dnl case "$FUNAMBOLSRC" in
dnl *://*) protocol="`echo $FUNAMBOLSRC | sed -e 's;://.*;;'`";;
dnl *) protocol="file";;
dnl esac
dnl mkdir -p src
dnl case $protocol in
dnl file)
dnl # use existing copy of the sources
dnl CLEAN_CLIENT_SRC=
dnl case "$FUNAMBOLSRC" in
dnl /*) CLIENT_API_SRC="$FUNAMBOLSRC";;
dnl *) CLIENT_API_SRC="$PWD/$FUNAMBOLSRC";;
dnl esac
dnl ;;
dnl *svn*|*http*)
dnl FUNAMBOLSRCREV="$FUNAMBOLSRC"
dnl if test "$REVISION"; then
dnl revarg="-r $REVISION "
dnl if `echo $FUNAMBOLSRC | grep '@[0123456789]*'` >/dev/null; then
dnl :
dnl else
dnl FUNAMBOLSRCREV="$FUNAMBOLSRC@$REVISION"
dnl fi
dnl fi
dnl if test -d $CLIENT_API_SRC ; then
dnl ( set -x; cd $CLIENT_API_SRC && svn --username=$USERNAME switch $revarg "$FUNAMBOLSRC" ) || AC_ERROR([updating from $FUNAMBOLSRC failed])
dnl else
dnl (set -x; svn --username=$USERNAME checkout $revarg "$FUNAMBOLSRCREV" $CLIENT_API_SRC ) || AC_ERROR([checking out $FUNAMBOLSRC failed])
dnl fi
dnl ;;
dnl *git*)
dnl if test -d $CLIENT_API_SRC ; then
dnl ( set -x; cd $CLIENT_API_SRC && git fetch "$FUNAMBOLSRC" ) || AC_ERROR([updating from $FUNAMBOLSRC failed])
dnl else
dnl ( set -x; git clone "$FUNAMBOLSRC" $CLIENT_API_SRC ) || AC_ERROR([cloning $FUNAMBOLSRC failed])
dnl fi
dnl if test "$REVISION"; then
dnl # git 1.6 finds tags and branches without explicit prefix, 1.4.4.4 doesn't
dnl ( set -x; cd $CLIENT_API_SRC &&
dnl (git checkout "$REVISION" ||
dnl git checkout "tags/$REVISION" ||
dnl git checkout "origin/$REVISION") ) || AC_ERROR([checking out $FUNAMBOLSRC failed])
dnl fi
dnl ;;
dnl esac
dnl else
dnl # use existing copy of the sources; beware of
dnl # out-of-tree compilation
dnl case $srcdir in
dnl /*) CLIENT_API_SRC="$srcdir/src/client-api";;
dnl *) CLIENT_API_SRC="$PWD/$srcdir/src/client-api";;
dnl esac
dnl fi
dnl ( cd $CLIENT_API_SRC/build/autotools && ( test -f configure || sh autogen.sh ) )
dnl if test -f $CLIENT_API_SRC/build/autotools/configure; then
dnl CLIENT_CONFIGURE="$CLIENT_API_SRC/build/autotools/configure"
dnl chmod u+x $CLIENT_API_SRC/build/autotools/configure $CLIENT_API_SRC/build/autotools/config.sub $CLIENT_API_SRC/build/autotools/config.guess
dnl # use local copy of the sources, with dependencies
dnl # to trigger building the client library
dnl FUNAMBOL_SUBDIR=$PWD/src/build-client-api
dnl FUNAMBOL_DEP=$PWD/src/build-client-api/src/libfunambol.la
dnl FUNAMBOL_CFLAGS="-I$FUNAMBOL_SUBDIR/include/posix -I$FUNAMBOL_SUBDIR/include/common -I$FUNAMBOL_SUBDIR/include -I$FUNAMBOL_SUBDIR/test"
dnl FUNAMBOL_LIBS="-L$FUNAMBOL_SUBDIR/src -lfunambol"
dnl AC_MSG_NOTICE( [configuring the client library] )
dnl # Passing some specific configure arguments to the client library's
dnl # configure makes sense (e.g., --enable-unit-tests) or is
dnl # required (--disable-dependency-tracking when compiling for
dnl # multiple architectures on Mac OS X).
dnl cxx_lib_args=`for i in --disable-dependency-tracking --enable-unit-tests; do
dnl if echo $ac_configure_args | grep -e $i >/dev/null; then
dnl echo $i;
dnl fi;
dnl done`
dnl if test "$enable_shared" == "yes"; then
dnl # Okay, this is a shortcut: strictly speaking we would have
dnl # to check with autoconf for the right flags...
dnl FUNAMBOL_LIB_SHARED_FLAGS="-DPIC -fPIC"
dnl fi
dnl if (set -x; mkdir -p $FUNAMBOL_SUBDIR && cd $FUNAMBOL_SUBDIR && $CLIENT_CONFIGURE $CLIENT_CONFIGURE_OPTIONS --build=$build_alias --host=$host_alias --target=$target_alias --disable-shared --with-transport-agent=curl CFLAGS="$CFLAGS $FUNAMBOL_LIB_SHARED_FLAGS" CXXFLAGS="$CXXFLAGS $FUNAMBOL_LIB_SHARED_FLAGS" $cxx_lib_args); then true; else
dnl AC_MSG_ERROR( [configuring client library failed] )
dnl fi
dnl else
dnl AC_MSG_ERROR( [either --with-funambol or --with-funambol-src have to be used] )
dnl fi
dnl else
dnl if test -f $FUNAMBOL/include/funambol/common/spds/SyncItem.h; then
dnl FUNAMBOL_CFLAGS="-I$FUNAMBOL/include/funambol/posix -I$FUNAMBOL/include/funambol/common -I$FUNAMBOL/include/funambol"
dnl FUNAMBOL_LIBS="-L$FUNAMBOL/lib -lfunambol"
dnl else
dnl AC_MSG_ERROR( [$FUNAMBOL does seem to be valid (e.g. include/funambol/spds/common/SyncItem.h is missing)] )
dnl fi
dnl fi
dnl TODO: compile Synthesis library the same way Funambol was compiled/bundled before?
dnl Makefiles are unchanged for that purpose.
FUNAMBOL_CFLAGS="$FUNAMBOL_CFLAGS $SYNTHESIS_CFLAGS"
AC_SUBST(FUNAMBOL_CFLAGS)
AC_SUBST(FUNAMBOL_LIBS)
AC_SUBST(FUNAMBOL)
AC_SUBST(FUNAMBOL_SUBDIR)
AC_SUBST(FUNAMBOL_DEP)
AC_SUBST(FUNAMBOL_LIB)
AC_SUBST(FUNAMBOLSRC)
dnl select backends
BACKENDS=""
# AC_ARG_ENABLE_BACKEND(BACKEND, DIR, HELP-STRING, [ACTION-IF-GIVEN],
# [ACTION-IF-NOT-GIVEN])
#
# Same as AC_ARG_ENABLE(), but also tells configure that the
# backend exists.
#
# BACKEND = name of modules built in that dir as .la files without the
# obligatory sync prefix, e.g. "ebook"
# DIR = name of the directory inside src/backends, e.g., "evolution"
AC_DEFUN([AC_ARG_ENABLE_BACKEND],
[
AC_ARG_ENABLE($1, $3, $4, $5)
BACKENDS="$BACKENDS $1"
BACKEND_DEFINES="$BACKEND_DEFINES ENABLE_`echo $1 | tr a-z A-Z`"
for source in $2; do
SYNCSOURCES="$SYNCSOURCES backends/$2/sync$1.la"
done
])
AC_SUBST(SYNCSOURCES)
AC_SUBST(BACKEND_DEFINES)
dnl src/backends/*/configure-sub.in and configure-post.in follow