35a7653b9d1565b725bb497b009721e6208b9d1c
[platform/upstream/syncevolution.git] / src / synthesis / configure.in
1 dnl Invoke autogen.sh to produce a configure script.
2
3 AC_INIT(src/sysync/engineinterface.cpp)
4 AC_CONFIG_MACRO_DIR([m4])
5 AM_INIT_AUTOMAKE(syncevolution, 0.8-beta2)
6 AM_CONFIG_HEADER(config.h)
7 AC_LIBTOOL_DLOPEN
8
9 dnl check for programs.
10 AC_PROG_CXX
11 AC_PROG_LIBTOOL
12 AC_PROG_MAKE_SET
13 AM_PROG_CC_C_O
14
15 dnl All of these libraries have to be compiled and installed
16 dnl separately. TODO: build bundled sources?
17 PKG_CHECK_MODULES(PCRE, libpcre)
18 PKG_CHECK_MODULES(SQLITE3, sqlite3)
19 AC_CHECK_HEADER(zlib.h, , [AC_ERROR(zlib.h not found.)])
20 AC_CHECK_HEADER(xmltok/xmlparse.h, have_system_xmltok="yes")
21 AC_CHECK_HEADER(expat.h, have_system_expat="yes")
22
23 dnl libical might be installed stand-alone (upstream)
24 dnl or bundled with libecal. Upstream is preferred and
25 dnl thus checked first. libical is optional, so don't
26 dnl complain if not found.
27 PKG_CHECK_MODULES(LIBICAL, libical,
28                            [AC_DEFINE(HAVE_LIBICAL, 1, "libical available")],
29                            [PKG_CHECK_MODULES(LIBECAL, libecal-1.2,
30                                                        [AC_DEFINE(HAVE_LIBICAL, 1, "libical available")
31                                                         AC_DEFINE(HAVE_LIBECAL, 1, "libecal available")],
32                                                        [true])])
33
34 AC_ARG_ENABLE(evolution-compatibility,
35               AS_HELP_STRING([--enable-evolution-compatibility],
36                              [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]),
37               enable_evolution_compatibility="$enableval", enable_evolution_compatibility="no")
38 if test "$enable_evolution_compatibility" == "yes"; then
39    AC_DEFINE(EVOLUTION_COMPATIBILITY, 1, [avoid hard dependency on Evolution shared objects])
40    LIBICAL_LIBS=
41    LIBECAL_LIBS=
42 fi
43
44 AC_ARG_WITH(xmltok,
45         AS_HELP_STRING([--with-xmltok=<builtin|system|path>],
46                        [Chooses which xmltok/xmlparse gets used.
47                         "builtin" = compile code into libsynthesis.
48                         "system" = use header files and libxmlparse from standard search paths.
49                         "path" = use header files in "path/include" and libxmlparse in "path/lib".
50                         Default is system if header files are found, otherwise builtin.]),
51         [ if test "$withval" = "builtin"; then with_xmltok="builtin"
52           elif test "$withval" = "system" || test "$withval" = "yes"; then with_xmltok="system"
53           else with_xmltok="$withval"
54           fi ],
55         [ with_xmltok="no" ])
56
57 AC_ARG_WITH(expat,
58         AS_HELP_STRING([--with-expat=<system|path>],
59                        [Choose expat as the XML parser library. Replaces --with-xmltok.
60                         "system" = use header files and libexpat from standard search paths.
61                         "path" = use header files in "path/include", and libexpat in "path/lib".]),
62         [ if test "$withval" = "system" || test "$withval" = "yes"; then with_expat="system"
63           else with_expath="$withval"
64           fi ],
65         [ with_expat="no" ])
66
67 if test "$with_xmltok" = "no" && test "$with_expat" = "no"; then
68    if test "$have_system_expat" = "yes"; then
69       with_expat="yes"
70       XMLPARSE_LIBS="-lexpat"
71    elif test "$have_system_xmltok" = "yes"; then
72       with_xmltok="yes"
73       XMLPARSE_LIBS="-lxmlparse"
74    else
75       with_xmltok="builtin"
76    fi
77 elif test "$with_expat" != "no"; then
78    if test "$with_expat" = "system"; then
79       if test "$have_system_expat" = "yes"; then XMLPARSE_LIBS="-lexpat"
80       else AC_ERROR(expat.h not found.)
81       fi
82    else # user path
83       XMLPARSE_LIBS="-L$with_expat/lib -lexpat"
84       XMLPARSE_CFLAGS="-I$with_expat/include"
85    fi
86    with_expat="yes"
87 else # with_xmltok
88    if test "$with_xmltok" = "system"; then
89       if test "$have_system_xmltok" = "yes"; then XMLPARSE_LIBS="-lxmlparse"
90       else AC_ERROR(xmltok/xmplarse.h not found.)
91       fi
92    elif test "$with_xmltok" != "builtin"; then
93       XMLPARSE_LIBS="-L$with_xmltok/lib -lxmlparse"
94       XMLPARSE_CFLAGS="-I$with_xmltok/include"
95    fi
96 fi
97
98 if test "$with_expat" = "yes"; then
99    AC_DEFINE(HAVE_EXPAT, 1, [Define to 1 to use expat as XML parser])
100 elif test "$with_xmltok" != "builtin"; then
101    AC_DEFINE(HAVE_SYS_XMLTOK, 1, [Define to 1 use system xmltok as XML parser])
102 else
103    AC_DEFINE(HAVE_BUILTIN_XMLTOK, 1, [Define to 1 use builtin xmltok as XML Parser])
104 fi
105
106 AC_SUBST(XMLPARSE_LIBS)
107 AC_SUBST(XMLPARSE_CFLAGS)
108 AM_CONDITIONAL([COND_XMLPARSE], [test "$with_xmltok" = "builtin"])
109
110 AC_CHECK_HEADER(stdint.h)
111
112 # the autotools SDK always assumes that it is linked against the engine
113 AC_DEFINE(UIAPI_LINKED, 1, [libsynthesis.a linked statically])
114 AC_DEFINE(DBAPI_LINKED, 1, [client engine linked statically])
115 AC_DEFINE(DBAPI_SRV_LINKED, 1, [server engine linked statically])
116
117 # determines which object files are needed in the SDK:
118 # if linking statically, some object files are shared with
119 # libsynthesis.a
120 AM_CONDITIONAL([COND_STATIC], [test "$enable_shared" = "no"])
121
122 # Disable unconditionally at the moment. Would add dependency of SDK
123 # on SyncML Toolkit.
124 AC_DEFINE(WITHOUT_SAN_1_1, 1,
125           [support for Server Alerted Notifications according to SyncML 1.1])
126
127 AC_CONFIG_FILES(Makefile src/Makefile synthesis.pc synthesis-sdk.pc)
128 AC_OUTPUT