summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am3
-rw-r--r--xapian.i.in (renamed from xapian.i)9
2 files changed, 11 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index fa41918..71f83da 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,6 +26,9 @@ libguilexapian_la_SOURCES = xapian_wrap.cc
libguilexapian_la_CXXFLAGS = $(GUILE_CFLAGS) $(XAPIAN_CFLAGS)
libguilexapian_la_LDFLAGS = $(GUILE_LIBS) $(XAPIAN_LIBS)
+xapian.i: xapian.i.in Makefile
+ sed 's|@libdir[@]|$(libdir)|g' $< > $@
+
xapian_wrap.cc: xapian.i xapian-head.i xapian-headers.i
$(SWIG) $(SWIG_FLAGS) -scmstub -o $@ -guile -package xapian -c++ $<
diff --git a/xapian.i b/xapian.i.in
index 9c1a347..1832786 100644
--- a/xapian.i
+++ b/xapian.i.in
@@ -24,7 +24,14 @@
%scheme
%{
-(load-extension "libguilexapian" "SWIG_init")
+;; Try loading the shared library by absolute path. If that fails, try
+;; searching for it using LD_LIBRARY_PATH and other mechanisms. We do this
+;; so that guile-xapian finds libguilexapian both before and after installation.
+(catch #t
+ (lambda ()
+ (load-extension "@libdir@/libguilexapian" "SWIG_init"))
+ (lambda _
+ (load-extension "libguilexapian" "SWIG_init")))
%}
%include xapian-head.i