tools: update ocamlfind handling
authorOlaf Hering <olaf@aepfle.de>
Tue, 5 Feb 2013 11:31:11 +0000 (11:31 +0000)
committerOlaf Hering <olaf@aepfle.de>
Tue, 5 Feb 2013 11:31:11 +0000 (11:31 +0000)
configure checks just for ocamlc, but the tools in tools/ocaml depend
also on ocamlfind. On my workstation I have just ocamlc installed, but
no ocamlfind. As a result make will fail.

Update configure.ac to check also for OCAMLFIND, update various
Makefiles and replace hardcoded ocamlfind string with $(OCAMLFIND)

Please rerun autogen.sh after applying this patch.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
tools/configure
tools/configure.ac
tools/ocaml/common.make
tools/ocaml/libs/eventchn/Makefile
tools/ocaml/libs/mmap/Makefile
tools/ocaml/libs/xb/Makefile
tools/ocaml/libs/xc/Makefile
tools/ocaml/libs/xl/Makefile
tools/ocaml/libs/xs/Makefile

index 898dd1780950af6088a1a96488bdc9590fb19d00..66d588a1f8d2c8294f4d2108a479ff4466b6730d 100755 (executable)
@@ -620,6 +620,7 @@ GREP
 CPP
 pyconfig
 PYTHONPATH
+OCAMLFIND
 OCAMLBUILD
 OCAMLDOC
 OCAMLMKLIB
@@ -4796,7 +4797,103 @@ else
 fi
 
 
-    if test "x$OCAMLC" = "xno"; then :
+
+  # checking for ocamlfind
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}ocamlfind", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ocamlfind; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OCAMLFIND+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$OCAMLFIND"; then
+  ac_cv_prog_OCAMLFIND="$OCAMLFIND" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_OCAMLFIND="${ac_tool_prefix}ocamlfind"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+OCAMLFIND=$ac_cv_prog_OCAMLFIND
+if test -n "$OCAMLFIND"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OCAMLFIND" >&5
+$as_echo "$OCAMLFIND" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OCAMLFIND"; then
+  ac_ct_OCAMLFIND=$OCAMLFIND
+  # Extract the first word of "ocamlfind", so it can be a program name with args.
+set dummy ocamlfind; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OCAMLFIND+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$ac_ct_OCAMLFIND"; then
+  ac_cv_prog_ac_ct_OCAMLFIND="$ac_ct_OCAMLFIND" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_prog_ac_ct_OCAMLFIND="ocamlfind"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OCAMLFIND=$ac_cv_prog_ac_ct_OCAMLFIND
+if test -n "$ac_ct_OCAMLFIND"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OCAMLFIND" >&5
+$as_echo "$ac_ct_OCAMLFIND" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+  if test "x$ac_ct_OCAMLFIND" = x; then
+    OCAMLFIND="no"
+  else
+    case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+    OCAMLFIND=$ac_ct_OCAMLFIND
+  fi
+else
+  OCAMLFIND="$ac_cv_prog_OCAMLFIND"
+fi
+
+
+
+    if test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"; then :
 
         if test "x$enable_ocamltools" = "xyes"; then :
 
index 2bd71b6adcb984a0ace4a025be2d45a734d0ec24..de5d0859740390eeb16759593e1a190c0bf6ac63 100644 (file)
@@ -86,7 +86,8 @@ AS_IF([test "x$xapi" = "xy"], [
 ])
 AS_IF([test "x$ocamltools" = "xy"], [
     AC_PROG_OCAML
-    AS_IF([test "x$OCAMLC" = "xno"], [
+    AC_PROG_FINDLIB
+    AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [
         AS_IF([test "x$enable_ocamltools" = "xyes"], [
             AC_MSG_ERROR([Ocaml tools enabled, but unable to find Ocaml])])
         ocamltools="n"
index 949433fabaa0c3e38090e3b8d37d6ad644457716..d5478f626f45f2e55b7b71da53dba565ba7822e0 100644 (file)
@@ -7,6 +7,7 @@ OCAMLMKLIB ?= ocamlmklib
 OCAMLDEP ?= ocamldep
 OCAMLLEX ?= ocamllex
 OCAMLYACC ?= ocamlyacc
+OCAMLFIND ?= ocamlfind
 
 CFLAGS += -fPIC -Werror -I$(shell ocamlc -where)
 
@@ -16,6 +17,6 @@ OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
 
 VERSION := 4.1
 
-OCAMLDESTDIR ?= $(DESTDIR)$(shell ocamlfind printconf destdir)
+OCAMLDESTDIR ?= $(DESTDIR)$(shell $(OCAMLFIND) printconf destdir)
 
 o= >$@.new && mv -f $@.new $@
index 2eb50dc8d52f4320b6eadd3eb3555db9936a7a47..2d8d6184df97dd10c0d64c4afff15d1304431702 100644 (file)
@@ -24,12 +24,12 @@ OCAML_LIBRARY = xeneventchn
 .PHONY: install
 install: $(LIBS) META
        mkdir -p $(OCAMLDESTDIR)
-       ocamlfind remove -destdir $(OCAMLDESTDIR) xeneventchn
-       ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xeneventchn META $(INTF) $(LIBS) *.a *.so *.cmx
+       $(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xeneventchn
+       $(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xeneventchn META $(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-       ocamlfind remove -destdir $(OCAMLDESTDIR) xeneventchn
+       $(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xeneventchn
 
 include $(TOPLEVEL)/Makefile.rules
 
index c131948c954ba303dc9eb127976d28bc14cbf126..df45819df535409c9d13cc35ce832771e6556964 100644 (file)
@@ -19,12 +19,12 @@ OCAML_LIBRARY = xenmmap
 .PHONY: install
 install: $(LIBS) META
        mkdir -p $(OCAMLDESTDIR)
-       ocamlfind remove -destdir $(OCAMLDESTDIR) xenmmap
-       ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xenmmap META $(INTF) $(LIBS) *.a *.so *.cmx
+       $(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenmmap
+       $(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xenmmap META $(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-       ocamlfind remove -destdir $(OCAMLDESTDIR) xenmmap
+       $(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenmmap
 
 include $(TOPLEVEL)/Makefile.rules
 
index 35f23438d0e3abd795346f1d9e51d56250ceb9b5..62ffefb666a3ba7285c8f3cf200f128cf5e7de6c 100644 (file)
@@ -45,11 +45,11 @@ xenbus.cmo : $(foreach obj, $(OBJS), $(obj).cmo)
 .PHONY: install
 install: $(LIBS) META
        mkdir -p $(OCAMLDESTDIR)
-       ocamlfind remove -destdir $(OCAMLDESTDIR) xenbus
-       ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xenbus META $(LIBS) xenbus.cmo xenbus.cmi xenbus.cmx *.a *.so 
+       $(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenbus
+       $(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xenbus META $(LIBS) xenbus.cmo xenbus.cmi xenbus.cmx *.a *.so
 
 .PHONY: uninstall
 uninstall:
-       ocamlfind remove -destdir $(OCAMLDESTDIR) xenbus
+       $(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenbus
 
 include $(TOPLEVEL)/Makefile.rules
index b59b8dfb5424affc392da61f21515ff736434c5b..239c1878fe58a4b59521f8010913d45f185d20b6 100644 (file)
@@ -23,11 +23,11 @@ libs: $(LIBS)
 .PHONY: install
 install: $(LIBS) META
        mkdir -p $(OCAMLDESTDIR)
-       ocamlfind remove -destdir $(OCAMLDESTDIR) xenctrl
-       ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xenctrl META $(INTF) $(LIBS) *.a *.so *.cmx
+       $(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenctrl
+       $(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xenctrl META $(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-       ocamlfind remove -destdir $(OCAMLDESTDIR) xenctrl
+       $(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenctrl
 
 include $(TOPLEVEL)/Makefile.rules
index fe75abb582823e46544e29ed1d231e440cdf6107..c9e5274ea47b879c281ae11dab649735e449dbbe 100644 (file)
@@ -56,11 +56,11 @@ libs: $(LIBS)
 .PHONY: install
 install: $(LIBS) META
        mkdir -p $(OCAMLDESTDIR)
-       ocamlfind remove -destdir $(OCAMLDESTDIR) xenlight
-       ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xenlight META $(INTF) $(LIBS) *.a *.so *.cmx
+       $(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenlight
+       $(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xenlight META $(INTF) $(LIBS) *.a *.so *.cmx
 
 .PHONY: uninstall
 uninstall:
-       ocamlfind remove -destdir $(OCAMLDESTDIR) xenlight
+       $(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenlight
 
 include $(TOPLEVEL)/Makefile.rules
index 2913cae878f69a95f3b6e2505b784151b61ccaf1..7a3d886d7b4c2b4c03b993a70a892607ca835f37 100644 (file)
@@ -36,12 +36,12 @@ xenstore.cmo : $(foreach obj, $(OBJS), $(obj).cmo)
 .PHONY: install
 install: $(LIBS) META
        mkdir -p $(OCAMLDESTDIR)
-       ocamlfind remove -destdir $(OCAMLDESTDIR) xenstore
-       ocamlfind install -destdir $(OCAMLDESTDIR) -ldconf ignore xenstore META $(LIBS) xenstore.cmo xenstore.cmi xenstore.cmx *.a 
+       $(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenstore
+       $(OCAMLFIND) install -destdir $(OCAMLDESTDIR) -ldconf ignore xenstore META $(LIBS) xenstore.cmo xenstore.cmi xenstore.cmx *.a
 
 .PHONY: uninstall
 uninstall:
-       ocamlfind remove -destdir $(OCAMLDESTDIR) xenstore
+       $(OCAMLFIND) remove -destdir $(OCAMLDESTDIR) xenstore
 
 include $(TOPLEVEL)/Makefile.rules