You have to use:
../libguestfs/run ./configure
../libguestfs/run make
Use of the second ../libguestfs/run against make is unfortunate but I
believe it's unavoidable due to the way that ocamlfind works.
---
.gitignore | 1 +
ocaml/Makefile.am | 19 ++++++++++++++++++-
run.in | 2 ++
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/.gitignore b/.gitignore
index 1ebc5421f..cdc90453c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -379,6 +379,7 @@ Makefile.in
/ocaml/examples/guestfs-ocaml.3
/ocaml/examples/inspect_vm
/ocaml/examples/stamp-guestfs-ocaml.pod
+/ocaml/guestfs
/ocaml/guestfs-c-actions.c
/ocaml/guestfs-c-errnos.c
/ocaml/guestfs.ml
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index c85efee64..c02246270 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -197,4 +197,21 @@ install-data-hook:
CLEANFILES += $(noinst_DATA) $(check_DATA)
-endif
+# This "tricks" ocamlfind into allowing us to compile other OCaml
+# programs against a locally compiled copy of the libguestfs sources.
+# ocamlfind needs to see a directory called ‘guestfs’ which contains
+# ‘META’. The current directory is called ‘ocaml’, but if we make
+# this symlink then we can create the required directory structure.
+#
+# Note if you just want to use this, make sure you use
+# ‘../libguestfs/run make’ in your other program and everything should
+# just work.
+CLEANFILES += guestfs
+
+all-local: guestfs
+
+guestfs:
+ rm -f $@
+ ln -sf . $@
+
+endif HAVE_OCAML
diff --git a/run.in b/run.in
index 6896d5a2c..90552fb04 100755
--- a/run.in
+++ b/run.in
@@ -227,6 +227,8 @@ export MALLOC_PERTURB_=$random_val
# local libguestfs.
prepend PKG_CONFIG_PATH "$b/lib/local"
export PKG_CONFIG_PATH
+prepend OCAMLPATH "$b/ocaml"
+export OCAMLPATH
# Do we have libtool? If we have it then we can use it to make
# running valgrind simpler. However don't depend on it.
--
2.24.1