064c2edede1526e88ca3404208d89e02aab7cb07
[platform/upstream/syncevolution.git] / src / backends / akonadi / configure-sub.in
1 dnl -*- mode: Autoconf; -*-
2 dnl Invoke autogen.sh to produce a configure script.
3
4 AC_CHECK_PROGS([QMAKE], [qmake qmake-qt4])
5
6 # Check for Akonadi. There is no .pc file for it,
7 # so fall back to normal header file and library checking.
8 # kdepimlibs5-dev >= 4.3 provides the necessary files.
9 AKONADIFOUND=yes
10 if ! test "$KDEPIM_CFLAGS"; then
11    KDEPIM_CFLAGS="-I`kde4-config --path include` -I`kde4-config --path include`/KDE"
12    if test "$QMAKE"; then
13       KDEPIM_CFLAGS="$KDEPIM_CFLAGS -I`$QMAKE -query QT_INSTALL_HEADERS`"
14    fi
15 fi
16 if ! test "$KDEPIM_LIBS"; then
17    KDEPIM_LIBS="-L`kde4-config --install lib` -lakonadi-kde `pkg-config --libs QtDBus` -lQtCore -lkdeui -lkdecore"
18 fi
19 AC_LANG_PUSH(C++)
20 old_CPPFLAGS="$CPPFLAGS"
21 CPPFLAGS="$CPPFLAGS $KDEPIM_CFLAGS"
22 AC_CHECK_HEADERS(Akonadi/Collection, [], [AKONADIFOUND=no])
23 CPPFLAGS="$old_CPPFLAGS"
24 AC_LANG_POP(C++)
25
26 # In contrast to the Evolution backend, the Akonadi backend is
27 # currently considered optional. "configure" will enable it only
28 # if explicitly enabled (was turned on automatically previously,
29 # for example on Ubuntu Hardy, and didn't compile).
30 SE_ARG_ENABLE_BACKEND(akonadi, akonadi,
31                       [AS_HELP_STRING([--disable-akonadi],
32                                       [disable access to Akonadi (default is to use it if akonadi.pc is found)])],
33                       [enable_akonadi="$enableval"
34                        test $AKONADIFOUND = "yes" || test $enable_akonadi = "no" || AC_MSG_ERROR([akonadi.pc not found. Install it to compile with the Akonadi backend enabled.])],
35                       [enable_akonadi=no]
36                      )
37
38 if test "$enable_akonadi" = "yes"; then
39         # conditional compilation in preprocessor
40         AC_DEFINE(ENABLE_AKONADI, 1, [Akonadi available])
41 else
42         # avoid unneeded dependencies on Akonadi
43         KDEPIM_CFLAGS=
44         KDEPIM_LIBS=
45 fi
46 AC_SUBST(KDEPIM_LIBS)
47 AC_SUBST(KDEPIM_CFLAGS)
48
49 # conditional compilation in make
50 AM_CONDITIONAL([ENABLE_AKONADI], [test "$enable_akonadi" = "yes"])
51
52 # let others include Akonadi backend's header file
53 # (not strictly necessary, could be avoided by not
54 # including Akonadi header files in public header file
55 # of source)
56 BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $KDEPIM_CFLAGS"