syncevolution/configure.in

253 lines
10 KiB
Plaintext

dnl Process this file with autoconf to produce a configure script.
AC_INIT(src/syncevolution.cpp)
AM_INIT_AUTOMAKE(syncevolution, 0.6-CVS)
AM_CONFIG_HEADER(config.h)
AC_LIBTOOL_DLOPEN
# command used to configure client library, including options
CLIENT_CONFIGURE=$PWD/src/client-api/build/autotools/configure
AC_ARG_WITH(sync4j,
AS_HELP_STRING([--with-sync4j=<base directory>],
[specifies location of Sync4j client library]),
[SYNC4J="$withval"])
AC_ARG_WITH(sync4j-src,
AS_HELP_STRING([--with-sync4j-src=<base directory>],
[specifies location of the Sync4j '3x/client-api/native' source code]),
[SYNC4JSRC="$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")
# 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])
MODIFY_SYNCCOMPARE='-e "s/use encoding/#use encoding/;" -e s/:utf8//'])
AC_SUBST(MODIFY_SYNCCOMPARE)
AC_CHECK_HEADERS(signal.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="$CLIENT_CONFIGURE --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="$CLIENT_CONFIGURE --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)
if test ! "$SYNC4J"; then
if test "$SYNC4JSRC"; then
# make a copy of the sources
AC_MSG_NOTICE( [updating the content of src/client-api from $SYNC4JSRC] )
mkdir -p src/client-api
if cp --update --archive $SYNC4JSRC/* src/client-api; then
( cd src/client-api/build/autotools && ( test -f configure || sh autogen.sh ) )
else
AC_MSG_ERROR( [copying $SYNC4JSRC into src/client-api failed] )
fi
find src/client-api/build/autotools/win* -name output | xargs rm -rf
find src/client-api/build/autotools/include/* src/client-api/build/autotools/src/* -type d | xargs rm -rf
find src/client-api -name "*~*" -o -name ".#*" -o -name "*.orig" -o -name "stamp-*" -o -name "*.o" -o -name "*.lo" -o -name .libs -o -name autom4te.cache -o -name config.status | xargs rm -rf
else
if test ! -d src/client-api; then
if test -d $srcdir/src/client-api; then
mkdir -p src
case $srcdir in
/*) ln -s $srcdir/src/client-api src/client-api;;
*) ln -s $PWD/$srcdir/src/client-api src/client-api;;
esac
fi
fi
fi
if test -f src/client-api/build/autotools/configure; then
chmod u+x src/client-api/build/autotools/configure src/client-api/build/autotools/config.sub src/client-api/build/autotools/config.guess
# use local copy of the sources
SYNC4J_SUBDIR=$PWD/src/client-api.build
SYNC4J_CFLAGS="-I$SYNC4J_SUBDIR/include/common -I$SYNC4J_SUBDIR/include -I$SYNC4J_SUBDIR/test"
SYNC4J_LIBS="-L$SYNC4J_SUBDIR/src -lsync4j"
AC_MSG_NOTICE( [configuring the client library] )
if (set -x; mkdir -p $SYNC4J_SUBDIR && cd $SYNC4J_SUBDIR && $CLIENT_CONFIGURE --build=$build_alias --host=$host_alias --target=$target_alias --disable-shared); then true; else
AC_MSG_ERROR( [configuring client library failed] )
fi
else
AC_MSG_ERROR( [either --with-sync4j or --with-sync4j-src have to be used] )
fi
else
if test -f $SYNC4J/include/sync4j/common/spds/SyncItem.h; then
SYNC4J_CFLAGS="-I$SYNC4J/include/sync4j/common -I$SYNC4J/include/sync4j"
SYNC4J_LIBS="-L$SYNC4J/lib -lsync4j"
else
AC_MSG_ERROR( [$SYNC4J does seem to be valid (e.g. include/sync4j/spds/common/SyncItem.h is missing)] )
fi
fi
AC_SUBST(SYNC4J_CFLAGS)
AC_SUBST(SYNC4J_LIBS)
AC_SUBST(SYNC4J)
AC_SUBST(SYNC4J_SUBDIR)
AC_SUBST(SYNC4JSRC)
pkg_emodules_10="evolution-data-server-1.0 libedataserver-1.0"
pkg_emodules_11="evolution-data-server-1.1 libedataserver-1.1"
pkg_emodules_12="evolution-data-server-1.2 libedataserver-1.2"
pkg_ebook_10="libebook-1.0"
pkg_ebook_11="libebook-1.1"
pkg_ebook_12="libebook-1.2"
pkg_ecal_10="libecal-1.0 libedata-cal-1.0"
pkg_ecal_11="libecal-1.1 libedata-cal-1.1"
pkg_ecal_12="libecal-1.2 libedata-cal-1.2"
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/usr/lib/pkgconfig:$prefix/lib/pkgconfig:/usr/local/lib/pkgconfig
evomissing="No compatible evolution-data-server was found.
Please install the development packages of Evolution and/or
set the PKG_CONFIG_PATH variable so that it points towards
the .pc files of evolution-data-server, libedataserver,
libedata, libecal/libical and libebook (the latter two are
optional).
You can check that these packages are available by running
pkg-config --list-all."
dnl check for Evolution core packages
PKG_CHECK_MODULES(EPACKAGE, [$pkg_emodules_12], EDSFOUND=yes, [EDSFOUND=no])
if test "x${EDSFOUND}" = "xno"; then
PKG_CHECK_MODULES(EPACKAGE, [$pkg_emodules_11], EDSFOUND=yes, [EDSFOUND=no])
if test "x${EDSFOUND}" = "xno"; then
PKG_CHECK_MODULES(EPACKAGE, [$pkg_emodules_10],,AC_MSG_ERROR($evomissing))
fi
fi
AC_SUBST(EPACKAGE_CFLAGS)
AC_SUBST(EPACKAGE_LIBS)
dnl check for Evolution calendar packages
PKG_CHECK_MODULES(ECAL, [$pkg_ecal_12], ECALFOUND=yes, [ECALFOUND=no])
if test "x${ECALFOUND}" = "xno"; then
PKG_CHECK_MODULES(ECAL, [$pkg_ecal_11], ECALFOUND=yes, [ECALFOUND=no])
if test "x${ECALFOUND}" = "xno"; then
PKG_CHECK_MODULES(ECAL, [$pkg_ecal_10], ECALFOUND=yes, [ECALFOUND=no])
fi
fi
AC_SUBST(ECAL_CFLAGS)
AC_SUBST(ECAL_LIBS)
dnl check for Evolution contact packages
PKG_CHECK_MODULES(EBOOK, [$pkg_ebook_12], EBOOKFOUND=yes, [EBOOKFOUND=no])
if test "x${EBOOKFOUND}" = "xno"; then
PKG_CHECK_MODULES(EBOOK, [$pkg_ebook_11], EBOOKFOUND=yes, [EBOOKFOUND=no])
if test "x${EBOOKFOUND}" = "xno"; then
PKG_CHECK_MODULES(EBOOK, [$pkg_ebook_10], EBOOKFOUND=yes, [EBOOKFOUND=no])
fi
fi
AC_SUBST(EBOOK_CFLAGS)
AC_SUBST(EBOOK_LIBS)
AC_ARG_ENABLE(ebook, AS_HELP_STRING([--disable-ebook], [disable access to addressbooks (default on if available)]),
[enable_ebook="$enableval"], [enable_ebook=$EBOOKFOUND])
AC_ARG_ENABLE(ecal, AS_HELP_STRING([--disable-ecal], [disable access to calendars and tasks (default on if available)]),
[enable_ecal="$enableval"], [enable_ecal=$ECALFOUND])
if test "$enable_ebook" = "yes"; then
test "x${EBOOKFOUND}" == "xyes" || AC_MSG_ERROR(["--enable-ebook requires pkg-config information for libebook, which was not found"])
AC_DEFINE(ENABLE_EBOOK, 1, [libebook available])
fi
if test "$enable_ecal" = "yes"; then
test "x${ECALFOUND}" == "xyes" || AC_MSG_ERROR(["--enable-ecal requires pkg-config information for libecal, which was not found"])
AC_DEFINE(ENABLE_ECAL, 1, [libecal available])
fi
dnl check for glib - calling g_type_init() is expected on Maemo
PKG_CHECK_MODULES(GLIB, "glib-2.0", GLIBFOUND=yes, GLIBFOUND=no)
if test "x${GLIBFOUND}" = "xno"; then
PKG_CHECK_MODULES(GLIB, "glib", GLIBFOUND=yes, GLIBFOUND=no)
fi
if test "x${GLIBFOUND}" = "xyes"; then
AC_DEFINE(HAVE_GLIB, 1, [glib found])
fi
AC_SUBST(GLIB_CFLAGS)
AC_SUBST(GLIB_LIBS)
dnl check for programs.
AC_PROG_CXX
AC_PROG_LIBTOOL
AC_PROG_MAKE_SET
dnl which backends are available?
if test "$enable_ebook" == "yes"; then
SYNCEVOLUTION_MODULES="$SYNCEVOLUTION_MODULES syncebook.la"
fi
if test "$enable_ecal" == "yes"; then
SYNCEVOLUTION_MODULES="$SYNCEVOLUTION_MODULES syncecal.la"
fi
dnl figure out whether we link all code statically or as modules
if test "$enable_shared" == "yes"; then
SYNCEVOLUTION_LTLIBRARIES="$SYNCEVOLUTION_MODULES"
AC_DEFINE(ENABLE_MODULES, 1, [enable dynamically opening sync source backends])
SYNCEVOLUTION_LDADD="-Wl,-export-dynamic -rpath '\$(pkglibdir)'"
else
SYNCEVOLUTION_LDADD="$SYNCEVOLUTION_MODULES"
fi
AC_SUBST(SYNCEVOLUTION_LTLIBRARIES)
AC_SUBST(SYNCEVOLUTION_LDADD)
AC_SUBST(SYNCEVOLUTION_MODULES)
AC_CHECK_HEADERS(stdarg.h)
AC_OUTPUT([
Makefile
src/Makefile
etc/Makefile
])