Imported Upstream version 1.0beta3
[platform/upstream/syncevolution.git] / configure-post.in
1 dnl -*- mode: Autoconf; -*-
2 dnl Invoke autogen.sh to produce a configure script.
3 dnl configure-pre.in and src/backends/*/configure-sub.in and configure-post.in come before this part
4
5 AC_SUBST(BACKEND_CPPFLAGS)
6
7 enable_any="no"
8 backend_is_enabled () {
9     eval echo \${enable_${1}}
10 }
11 for backend in $BACKENDS; do
12     if test `backend_is_enabled $backend` == "yes"; then
13        enable_any="yes"
14        SYNCEVOLUTION_MODULES="$SYNCEVOLUTION_MODULES src/backends/sync${backend}.la"
15     fi
16 done
17
18 if test "$enable_any" = "no"; then
19         AC_MSG_ERROR([no backend enabled - refusing to continue: $anymissing])
20 fi
21
22 dnl check for programs.
23 AC_PROG_CXX
24 AC_PROG_LIBTOOL
25 AC_PROG_MAKE_SET
26
27 dnl glib initialization is done only if requested by some configure-sub.in,
28 dnl for not needed otherwise even if found
29 if test "$need_glib" = "yes"; then
30         # HAVE_GLIB (aka GLIBFOUND) are a catch-all for these
31         # three GNOME libs. Assume we have all three unless one of
32         # the checks fails.
33         GLIBFOUND=yes
34
35         dnl check for glib - calling g_type_init() is expected on Maemo
36         PKG_CHECK_MODULES(GLIB, "glib-2.0", , GLIBFOUND=no)
37         # This check here is broken on Ubuntu 8.04: it calls glib-config,
38         # which isn't found, but the error is not detected by configure.
39         #if test "x${GLIBFOUND}" = "xno"; then
40         #       PKG_CHECK_MODULES(GLIB, "glib", GLIBFOUND=yes, GLIBFOUND=no)
41         #fi
42
43         PKG_CHECK_MODULES(GTHREAD, "gthread-2.0", , GLIBFOUND=no)
44         PKG_CHECK_MODULES(GOBJECT, "gobject-2.0", , GLIBFOUND=no)
45
46         if  test "x${GLIBFOUND}" = "xyes"; then
47             AC_DEFINE(HAVE_GLIB, 1, [glib found])
48         else
49             AC_ERROR([not all GNOME libraries found])
50         fi
51         BACKEND_CPPFLAGS="$BACKEND_CPPFLAGS $GLIB_CFLAGS $GTHREAD_CFLAGS $GOBJECT_CFLAGS"
52 fi
53
54 # determine from where we can get a SHA-256 implementation
55 have_sha="no"
56 if test "$GLIBFOUND" = "yes"; then
57    # only use glib if we need it anyway, also has to be at lease 2.16
58    PKG_CHECK_MODULES(GLIB216, [glib-2.0 >= 2.16],
59                      [AC_DEFINE(USE_SHA256, 1, [choose implementation of SHA-256])
60                       have_sha="glib"],
61                      [true])
62 fi
63 if test "$have_sha" = "no"; then
64    # Fallback is Mozilla NSS. In contrast to libgcrypt it has a .pc
65    # file and a simple API.
66    PKG_CHECK_MODULES(NSS, "nss",
67                      [AC_DEFINE(USE_SHA256, 2, [choose implementation of SHA-256])
68                       have_sha="nss"],
69                      [true])
70 fi
71
72 dnl figure out whether we link all code statically or as modules
73 AM_CONDITIONAL([ENABLE_MODULES], [test "$enable_shared" == "yes"])
74 if test "$enable_shared" == "yes"; then
75         AC_DEFINE(ENABLE_MODULES, 1, [enable dynamically opening sync source backends])
76 fi
77 AC_SUBST(SYNCEVOLUTION_LDADD)
78
79 dnl CXXFLAGS gets applied to SyncEvolution and the client library.
80 dnl For e.g. "-Wall -Werror" this might not be such a good idea;
81 dnl SYNCEVOLUTION_CXXFLAGS can be used instead. It applies only
82 dnl to the sources in the SyncEvolution repository.
83 AC_SUBST(SYNCEVOLUTION_CXXFLAGS)
84
85 dnl a quick-and-dirty way to detect compilation for the iPhone
86 if test "$host" == "arm-apple-darwin"; then
87    AC_DEFINE(IPHONE, 1, [compiling for iPhone])
88    DEVICE_TYPE=iPhone
89 fi
90
91 dnl --enable-evolution-compatibility
92 if test "$enable_evolution_compatibility" == "yes"; then
93    AC_DEFINE(EVOLUTION_COMPATIBILITY, 1, [avoid hard dependency on Evolution shared objects])
94 fi
95 AM_CONDITIONAL([ENABLE_EVOLUTION_COMPATIBILITY], [test "$enable_evolution_compatibility" == "yes"])
96
97 dnl --enable-developer-mode
98 if test "$enable_developer_mode" == "yes"; then
99 backendsearchdir="`pwd`/src/backends/"
100 else
101 backendsearchdir='$(libdir)'/syncevolution/backends/
102 fi
103
104 backenddir='$(libdir)'/syncevolution/backends
105 AC_SUBST(backenddir)
106 AC_SUBST(backendsearchdir)
107
108 dnl This string is sent as part of the SyncML DevInf (device
109 dnl information) structure to the server. All SyncEvolution platforms
110 dnl use "SyncEvolution" as HTTP user agent and "Mod" (model), so the
111 dnl device type is the only way how different kinds of clients can be
112 dnl distinguished.
113 AC_DEFINE_UNQUOTED(DEVICE_TYPE, "$DEVICE_TYPE", "SyncML DevInf DevType")
114
115 AC_CHECK_HEADERS(stdarg.h valgrind/valgrind.h execinfo.h)
116
117 AC_DEFINE(SYNTHESIS, 1, "using Synthesis engine")
118
119 # fallback for lack of --with-docdir support in older automake
120 if test ! "$docdir"; then
121    docdir = ${datadir}/doc/syncevolution
122    AC_SUBST(docdir)
123 fi
124
125 AC_CONFIG_FILES(Makefile src/dbus/interfaces/Makefile src/gdbus/Makefile src/dbus/Makefile src/Makefile src/syncevo/Makefile src/syncevo/syncevolution.pc src/syncevo/configs/Makefile src/synthesis-includes/Makefile src/gtk-ui/Makefile po/Makefile.in test/Makefile src/dbus/syncevo-dbus.pc)
126 AC_OUTPUT
127
128 echo
129 echo CONFIGURATION SUMMARY
130 echo "Core SyncEvolution: $enable_core"
131 for backend in $BACKENDS; do
132     eval echo $backend: \${enable_${backend}}
133 done
134 echo "DBus service: $enable_dbus_service"
135 echo "UI (DBus client): $enable_gui"
136 echo "Bluetooth transport: $have_bluetooth"
137 echo "GNOME Bluetooth panel plugin: $enable_gnome_bluetooth_panel"
138 echo "SHA-256: $have_sha"
139 echo