[Xapian-devel] Available backends in xapian.h

franz.g at tin.it franz.g at tin.it
Thu Apr 28 18:57:25 BST 2005


A short note: this message comes as a public reply to a discussion about
xapian-bindings, that is why it can look a little bit incomplete... however
the problem for now was to modify the xapian-core distribution so that there
are symbols #defined (or maybe #undefined) to reflect what backends were
available in the library.

As I said to Olly, I'm a complete newbie at Autotools (and SWIG), so my
approach can look naive. However it's only a proposal: there are surely
better solutions.

I tried the following:

- changed $(srcdir)/include/xapian.h into $(srcdir)/include/xapian.h.in
- added the following lines somewhere (namely, line 51) in xapian.h.in:

---8-<-------------
// Backends
#define XAPIAN_BACKEND_MUSCAT36
#define XAPIAN_BACKEND_QUARTZ
#define XAPIAN_BACKEND_INMEMORY
#define XAPIAN_BACKEND_REMOTE
---8-<-------------

- added the following to configure.ac, at line 374 (to have $build_* set):

---8-<-------------
dnl @@MODIFIED@@ - Franz

dnl Remove unsupported backend #defines from xapian.h.in and output xapian.h

AC_MSG_CHECKING([for backends to exclude in xapian.h])
desc_excluded_backends=""
excluded_backends="\\#define XAPIAN_BACKEND_\(DUMMY"
if test false = "$build_muscat36"; then
    excluded_backends="$excluded_backends\|MUSCAT36"
    desc_excluded_backends="$desc_excluded_backends Muscat36"
fi
if test false = "$build_quartz"; then
    excluded_backends="$excluded_backends\|QUARTZ"
    desc_excluded_backends="$desc_excluded_backends Quartz"
fi
if test false = "$build_inmemory"; then
    excluded_backends="$excluded_backends\|INMEMORY"
    desc_excluded_backends="$desc_excluded_backends InMemory"
fi
if test false = "$build_remote"; then
    excluded_backends="$excluded_backends\|REMOTE"
    desc_excluded_backends="$desc_excluded_backends Remote"
fi
excluded_backends="$excluded_backends\)"
if test x"" = x"$desc_excluded_backends"; then
    desc_excluded_backends="none"
fi
grep -v "$excluded_backends" "$srcdir/include/xapian.h.in" > "$srcdir/include/xapian.h"
2> /dev/null
dnl The "grep" line is obviously just one
AC_MSG_RESULT($desc_excluded_backends)

dnl @@MODIFIED@@ - ends
---8-<-------------

- done an autoreconf and a configure: Muscat36 was reported to be dropped

In fact the resulting xapian.h only defines XAPIAN_BACKEND_QUARTZ, XAPIAN_BACKEND_INMEMORY
and XAPIAN_BACKEND_REMOTE, and the configure script reports the following
line "somewhere":

checking for backends to exclude in xapian.h...  Muscat36

as expected. Apart from being (once again) a "brute force" type of procedure,
I think that it has another drawback: it moves the generation of a source
file (other than config.h) into the configure step. I don't know if this
is correct. However, while there are no other solutions, this could do the
job. At least it does not imply the use of exoteric rules in Makefile.in
(and thus something I can't even think of in Makefile.am).

I really hope this would help somehow.

Cheers,

F.






More information about the Xapian-devel mailing list