Hello!

We have an open issue about making compilation of libsynthesis more
dynamic via configure flags, which depends on the more general problem:
Bug 7913 - syncevolution.org binaries + Fedora Core 11 + libpcre.so.3
Bug 3471 - libsynthesis: better configuration mechanism + debugging

Right now, all compile-time options are controlled by a static targets.h
file, in the case of Linux/autotools located in
src/Targets/ReleasedProducts/combiEngine_opensource_linux/.

This file is also used by non-autotools builds. My proposal is to keep
it like that and add the possibility to set defines in
config.h/configure which override the default in targets.h. The
rationale for making that optional is that (at least in theory) such a
config.h could be generated in different ways and it shouldn't be
necessary to update all of these when adding something to targets.h.

Patch is below. It describes the key approach like this:
+// Many of the options below can also be configured via config.h.
+// If ONOFF_<feature> is defined, then the feature is on if
+// ONOFF_<feature> is != 0, otherwise it is off. If that
+// define is not set, then the default setting in this file applies.
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif

Is that okay?

Should I go ahead and add more of these ONOFF_<feature> checks to this
targets.h, or will we do that on demand?

Bye, Patrick

diff --git a/configure.in b/configure.in
index 35a7653..5fcda1e 100644
--- a/configure.in
+++ b/configure.in
@@ -12,10 +12,29 @@ AC_PROG_LIBTOOL
 AC_PROG_MAKE_SET
 AM_PROG_CC_C_O
 
+
 dnl All of these libraries have to be compiled and installed
 dnl separately. TODO: build bundled sources?
-PKG_CHECK_MODULES(PCRE, libpcre)
+dnl
+dnl WARNING: the initial PKG_CHECK_MODULES() must be executed
+dnl in all cases (i.e., not depend on an if clause) because
+dnl it initializes pkg-config checking.
 PKG_CHECK_MODULES(SQLITE3, sqlite3)
+AC_ARG_ENABLE(regex,
+              AS_HELP_STRING([--enable-regex],
+                             [enable regular expression support in scripts, 
depends on libpcre, enabled by default]),
+              [enable_regex=$enableval],
+              [enable_regex="yes"])
+if test "$enable_regex" == "yes"; then
+    PKG_CHECK_MODULES(PCRE, libpcre,
+                      [HAVE_PCRE=1],
+                      [AC_ERROR([libpcre not found, required for 
--enable-regex])])
+    HAVE_PCRE=1
+else
+    HAVE_PCRE=0
+fi
+AC_DEFINE_UNQUOTED(ONOFF_REGEX_SUPPORT, $HAVE_PCRE, "regular expressions in 
scripts")   
+
 AC_CHECK_HEADER(zlib.h, , [AC_ERROR(zlib.h not found.)])
 AC_CHECK_HEADER(xmltok/xmlparse.h, have_system_xmltok="yes")
 AC_CHECK_HEADER(expat.h, have_system_expat="yes")
diff --git 
a/src/Targets/ReleasedProducts/combiEngine_opensource_linux/target_options.h 
b/src/Targets/ReleasedProducts/combiEngine_opensource_linux/target_options.h
index 3253c15..868f6f7 100644
--- a/src/Targets/ReleasedProducts/combiEngine_opensource_linux/target_options.h
+++ b/src/Targets/ReleasedProducts/combiEngine_opensource_linux/target_options.h
@@ -3,6 +3,15 @@
  *
  */
 
+// Many of the options below can also be configured via config.h.
+// If ONOFF_<feature> is defined, then the feature is on if
+// ONOFF_<feature> is != 0, otherwise it is off. If that
+// define is not set, then the default setting in this file applies.
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+
 // SYNCML SERVER ENGINE LIBRARY OPENSOURCE LINUX
 // #############################################
 
@@ -126,6 +135,13 @@
 // - script with regex support
 #define SCRIPT_SUPPORT 1
 #define REGEX_SUPPORT 1
+#if defined(ONOFF_REGEX_SUPPORT)
+# if ONOFF_REGEX_SUPPORT
+#  define REGEX_SUPPORT 1
+# else
+#  undef REGEX_SUPPORT
+# endif
+#endif
 
 // - server does support target options
 #define SYSYNC_TARGET_OPTIONS 1


-- 
Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.



_______________________________________________
os-libsynthesis mailing list
os-libsynthesis@synthesis.ch
http://lists.synthesis.ch/mailman/listinfo/os-libsynthesis

Reply via email to