Imported Upstream version 1.3.99.3~20130529~SE~b989f69~SYSYNC~3366831
[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 # four digit upstream version, one additional digit for
6 # Linux/SyncEvolution specific extensions:
7 AM_INIT_AUTOMAKE(synthesis, 3.4.0.16.9)
8 AM_CONFIG_HEADER(config.h)
9 AC_LIBTOOL_DLOPEN
10
11 dnl check for programs.
12 AC_PROG_CXX
13 AC_PROG_LIBTOOL
14 AC_PROG_MAKE_SET
15 AM_PROG_CC_C_O
16
17 # --enable-warning=min/max/fatal/none
18 DK_ARG_ENABLE_WARNINGS([SYNTHESIS_WFLAGS],
19                        [-Wall -Wno-unknown-pragmas -Wno-unused-but-set-variable],
20                        [-Wall -Wno-unknown-pragmas -Wno-unused-but-set-variable],
21                        [])
22
23 dnl Extract PIC flags from libtool configure for libsynthesissdk.a
24 dnl (makes assumptions about libtool var naming!). Some versions
25 dnl of libtool use PIC mode automatically for static libraries,
26 dnl others don't (?!). See "[os-libsynthesis] libsynthesissdk.a built without -fPIC".
27 PIC_CXXFLAGS="$lt_prog_compiler_pic_CXX"
28 AC_SUBST(PIC_CXXFLAGS)
29
30 AC_ARG_ENABLE(debug-logs,
31               AS_HELP_STRING([--enable-debug-logs],
32                              [For developers: add links to call location to HTML log files. Depends on Doxygen (for HTML version of source) and g++ (for __PRETTY_FUNCTION__).]),
33               enable_debug_logs="$enableval", enable_debug_logs="no")
34 if test "$enable_debug_logs" = "yes"; then
35    AC_DEFINE_UNQUOTED(SYDEBUG_LOCATION, "`pwd`/src/html", [absolute path to Doxygen HTML output])
36 fi
37 AM_CONDITIONAL([COND_DOXYGEN], [test "$enable_debug_logs" = "yes"])
38
39 dnl All of these libraries have to be compiled and installed
40 dnl separately. TODO: build bundled sources?
41 dnl
42 dnl WARNING: the initial PKG_CHECK_MODULES() must be executed
43 dnl in all cases (i.e., not depend on an if clause) because
44 dnl it initializes pkg-config checking.
45 PKG_CHECK_MODULES(FOOBAR, foobar, [true], [true])
46
47 AC_ARG_ENABLE(sqlite,
48               AS_HELP_STRING([--enable-sqlite],
49                              [enable the sqlite-based ODBC backend, depends on libsqlite3, enabled by default]),
50               [enable_sqlite=$enableval],
51               [enable_sqlite="yes"])
52 if test "$enable_sqlite" == "yes"; then
53     PKG_CHECK_MODULES(SQLITE3, sqlite3)
54     HAVE_SQLITE=1
55 else
56     HAVE_SQLITE=0
57 fi
58 AC_DEFINE_UNQUOTED(ONOFF_SQLITE_SUPPORT, $HAVE_SQLITE, [controls whether ODBC backend with libsqlite is enabled])
59
60 AC_ARG_ENABLE(regex,
61               AS_HELP_STRING([--enable-regex],
62                              [enable regular expression support in scripts, depends on libpcre, enabled by default]),
63               [enable_regex=$enableval],
64               [enable_regex="yes"])
65 if test "$enable_regex" == "yes"; then
66     PKG_CHECK_MODULES(PCRE, libpcre,
67                       [HAVE_PCRE=1],
68                       [AC_ERROR([libpcre not found, required for --enable-regex])])
69     HAVE_PCRE=1
70 else
71     HAVE_PCRE=0
72 fi
73 AC_DEFINE_UNQUOTED(ONOFF_REGEX_SUPPORT, $HAVE_PCRE, "regular expressions in scripts")
74
75 AC_CHECK_HEADER(zlib.h, , [AC_ERROR(zlib.h not found.)])
76 AC_CHECK_HEADER(xmltok/xmlparse.h, have_system_xmltok="yes")
77 AC_CHECK_HEADER(expat.h, have_system_expat="yes")
78
79 dnl libical might be installed stand-alone (upstream)
80 dnl or bundled with libecal. Upstream is preferred and
81 dnl thus checked first. libical is optional, so don't
82 dnl complain if not found.
83 AC_ARG_ENABLE(libical,
84               AS_HELP_STRING([--enable-libical],
85                              [use libical (if necessary, the one in libecal) to improve time zone support, enabled by default if necessary libs are found]),
86               [enable_libical=$enableval],
87               [enable_libical="yes"])
88 if test "$enable_libical" == "yes"; then
89    PKG_CHECK_MODULES(LIBICAL, libical,
90                      [AC_DEFINE(HAVE_LIBICAL, 1, "libical available")],
91                      [PKG_CHECK_MODULES(LIBECAL, libecal-1.2,
92                                         [AC_DEFINE(HAVE_LIBICAL, 1, "libical available")
93                                          AC_DEFINE(HAVE_LIBECAL, 1, "libecal available")],
94                                          [true])])
95 fi
96
97 AC_ARG_ENABLE(evolution-compatibility,
98               AS_HELP_STRING([--enable-evolution-compatibility],
99                              [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]),
100               enable_evolution_compatibility="$enableval", enable_evolution_compatibility="no")
101 if test "$enable_evolution_compatibility" == "yes"; then
102    AC_DEFINE(EVOLUTION_COMPATIBILITY, 1, [avoid hard dependency on Evolution shared objects])
103    LIBICAL_LIBS=
104    LIBECAL_LIBS=
105 fi
106
107 AC_ARG_WITH(xmltok,
108         AS_HELP_STRING([--with-xmltok=<builtin|system|path>],
109                        [Chooses which xmltok/xmlparse gets used.
110                         "builtin" = compile code into libsynthesis.
111                         "system" = use header files and libxmlparse from standard search paths.
112                         "path" = use header files in "path/include" and libxmlparse in "path/lib".
113                         Default is system if header files are found, otherwise builtin.]),
114         [ if test "$withval" = "builtin"; then with_xmltok="builtin"
115           elif test "$withval" = "system" || test "$withval" = "yes"; then with_xmltok="system"
116           else with_xmltok="$withval"
117           fi ],
118         [ with_xmltok="no" ])
119
120 AC_ARG_WITH(expat,
121         AS_HELP_STRING([--with-expat=<system|path>],
122                        [Choose expat as the XML parser library. Replaces --with-xmltok.
123                         "system" = use header files and libexpat from standard search paths.
124                         "path" = use header files in "path/include", and libexpat in "path/lib".]),
125         [ if test "$withval" = "system" || test "$withval" = "yes"; then with_expat="system"
126           else with_expath="$withval"
127           fi ],
128         [ with_expat="no" ])
129
130 if test "$with_xmltok" = "no" && test "$with_expat" = "no"; then
131    if test "$have_system_expat" = "yes"; then
132       with_expat="yes"
133       XMLPARSE_LIBS="-lexpat"
134    elif test "$have_system_xmltok" = "yes"; then
135       with_xmltok="yes"
136       XMLPARSE_LIBS="-lxmlparse"
137    else
138       with_xmltok="builtin"
139    fi
140 elif test "$with_expat" != "no"; then
141    if test "$with_expat" = "system"; then
142       if test "$have_system_expat" = "yes"; then XMLPARSE_LIBS="-lexpat"
143       else AC_ERROR(expat.h not found.)
144       fi
145    else # user path
146       XMLPARSE_LIBS="-L$with_expat/lib -lexpat"
147       XMLPARSE_CFLAGS="-I$with_expat/include"
148    fi
149    with_expat="yes"
150 else # with_xmltok
151    if test "$with_xmltok" = "system"; then
152       if test "$have_system_xmltok" = "yes"; then XMLPARSE_LIBS="-lxmlparse"
153       else AC_ERROR(xmltok/xmplarse.h not found.)
154       fi
155    elif test "$with_xmltok" != "builtin"; then
156       XMLPARSE_LIBS="-L$with_xmltok/lib -lxmlparse"
157       XMLPARSE_CFLAGS="-I$with_xmltok/include"
158    fi
159 fi
160
161 if test "$with_expat" = "yes"; then
162    AC_DEFINE(HAVE_EXPAT, 1, [Define to 1 to use expat as XML parser])
163 elif test "$with_xmltok" != "builtin"; then
164    AC_DEFINE(HAVE_SYS_XMLTOK, 1, [Define to 1 use system xmltok as XML parser])
165 else
166    AC_DEFINE(HAVE_BUILTIN_XMLTOK, 1, [Define to 1 use builtin xmltok as XML Parser])
167 fi
168
169 AC_SUBST(XMLPARSE_LIBS)
170 AC_SUBST(XMLPARSE_CFLAGS)
171 AM_CONDITIONAL([COND_XMLPARSE], [test "$with_xmltok" = "builtin"])
172
173 AC_CHECK_HEADER(stdint.h)
174
175 # the autotools SDK always assumes that it is linked against the engine
176 AC_DEFINE(UIAPI_LINKED, 1, [libsynthesis.a linked statically])
177 AC_DEFINE(DBAPI_LINKED, 1, [client engine linked statically])
178 AC_DEFINE(DBAPI_SRV_LINKED, 1, [server engine linked statically])
179
180 # determines which object files are needed in the SDK:
181 # if linking statically, some object files are shared with
182 # libsynthesis.a
183 AM_CONDITIONAL([COND_STATIC], [test "$enable_shared" = "no"])
184
185 # Disable unconditionally at the moment. Would add dependency of SDK
186 # on SyncML Toolkit.
187 #AC_DEFINE(WITHOUT_SAN_1_1, 1,
188 #          [support for Server Alerted Notifications according to SyncML 1.1])
189
190 AC_CONFIG_FILES(Makefile src/Makefile synthesis.pc synthesis-sdk.pc)
191 AC_OUTPUT