From: Richard W.M. Jones Date: Thu, 9 Apr 2015 14:06:59 +0000 (+0100) Subject: Allow building against local libguestfs v2v test harness. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=2516816627a00a85358c07757f02f4c7b05622da;p=virt-v2v-test-cases-nonfree.git Allow building against local libguestfs v2v test harness. ./configure --with-test-harness=/path/to/libguestfs/v2v/test-harness --- diff --git a/common-rules.mk b/common-rules.mk index 67afc1d..1f6fd56 100644 --- a/common-rules.mk +++ b/common-rules.mk @@ -19,7 +19,20 @@ CLEANFILES = *~ *.cmi *.cmo *.cmx *.cmxa *.o *.a *.so OCAMLFLAGS = -g -warn-error CDEFLMPSUVYZX-3-24 -OCAMLPACKAGES = -package str,unix,gettext-stub,libvirt,guestfs,v2v_test_harness +if INSTALLED_TEST_HARNESS +OCAMLLINKPKG = +else +OCAMLLINKPKG = v2v_test_harness.cmxa +endif + +OCAMLPACKAGES = -package str,unix,gettext-stub,libvirt,guestfs +OCAMLLINKPKG += -linkpkg + +if INSTALLED_TEST_HARNESS +OCAMLPACKAGES += -package v2v_test_harness +else +OCAMLPACKAGES += -I $(TEST_HARNESS_DIR) +endif # XXX FIXME # We don't distribute the xml.* files with the test harness. diff --git a/configure.ac b/configure.ac index 976cf82..a0a27c9 100644 --- a/configure.ac +++ b/configure.ac @@ -62,10 +62,30 @@ if test "x$OCAML_PKG_guestfs" = "xno"; then AC_MSG_ERROR([Cannot find required OCaml package 'guestfs']) fi -AC_CHECK_OCAML_PKG(v2v_test_harness) -if test "x$OCAML_PKG_v2v_test_harness" = "xno"; then - AC_MSG_ERROR([Cannot find required OCaml package 'v2v_test_harness']) +dnl Choose the installed v2v_test_harness module (default) or +dnl use --with-test-harness=/path/to/libguestfs/v2v/test-harness to +dnl compile against local libguestfs sources. + +AC_ARG_WITH([test-harness], + [AS_HELP_STRING([--with-test-harness], + [path to v2v test harness sources])], + [with_test_harness=$withval], + [with_test_harness=installed]) +if test "x$with_test_harness" = "xinstalled"; then + AC_CHECK_OCAML_PKG(v2v_test_harness) + if test "x$OCAML_PKG_v2v_test_harness" = "xno"; then + AC_MSG_ERROR([Cannot find required OCaml package 'v2v_test_harness' (try: --with-test-harness=/path/to/libguestfs/v2v/test-harness)]) + fi +else + AC_MSG_CHECKING([$with_test_harness contains the compiled v2v test harness]) + if test ! -f $with_test_harness/v2v_test_harness.cmi ; then + AC_MSG_ERROR([$with_test_harness does not contain the compiled v2v test harness]) + fi + AC_MSG_RESULT([yes]) + AC_SUBST([TEST_HARNESS_DIR],[$with_test_harness]) fi +AM_CONDITIONAL([INSTALLED_TEST_HARNESS], + [test "x$with_test_harness" = "xinstalled"]) dnl libxml2 (required) PKG_CHECK_MODULES([LIBXML2], [libxml-2.0]) diff --git a/rhel5xen-rhel/Makefile.am b/rhel5xen-rhel/Makefile.am index 1f4fee1..523dd5b 100644 --- a/rhel5xen-rhel/Makefile.am +++ b/rhel5xen-rhel/Makefile.am @@ -54,4 +54,4 @@ check_SCRIPTS = $(tests) %.test: %.cmx $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) \ - -linkpkg $< -o $@ + $(OCAMLLINKPKG) $< -o $@ diff --git a/vmware-rhel/Makefile.am b/vmware-rhel/Makefile.am index 65aca99..ef45016 100644 --- a/vmware-rhel/Makefile.am +++ b/vmware-rhel/Makefile.am @@ -34,4 +34,4 @@ check_SCRIPTS = $(tests) %.test: %.cmx $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) \ - -linkpkg $< -o $@ + $(OCAMLLINKPKG) $< -o $@ diff --git a/vmware-win/Makefile.am b/vmware-win/Makefile.am index 771ca89..0e3b03c 100644 --- a/vmware-win/Makefile.am +++ b/vmware-win/Makefile.am @@ -34,4 +34,4 @@ check_SCRIPTS = $(tests) %.test: %.cmx $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) \ - -linkpkg $< -o $@ + $(OCAMLLINKPKG) $< -o $@ diff --git a/windows-virtio/Makefile.am b/windows-virtio/Makefile.am index ec6e99e..0cb5af4 100644 --- a/windows-virtio/Makefile.am +++ b/windows-virtio/Makefile.am @@ -30,4 +30,4 @@ check_SCRIPTS = $(tests) %.test: %.cmx $(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) \ - -linkpkg $< -o $@ + $(OCAMLLINKPKG) $< -o $@