From 0bdb4b19d800f2e0d6a65dd8a9194bec3124b8ae Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Wed, 21 Apr 2004 17:35:00 +0000 Subject: [PATCH] detect and use {ocamlc,ocamlopt}.opt when they are available --- helm/ocaml/Makefile.common.in | 2 +- helm/ocaml/Makefile.in | 4 ++-- helm/ocaml/configure.ac | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/helm/ocaml/Makefile.common.in b/helm/ocaml/Makefile.common.in index bdc6e09f7..8079765c4 100644 --- a/helm/ocaml/Makefile.common.in +++ b/helm/ocaml/Makefile.common.in @@ -15,7 +15,7 @@ PREREQ = OCAMLOPTIONS = -package "$(REQUIRES)" -predicates "$(PREDICATES)" -thread OCAMLDEBUGOPTIONS = -g OCAMLARCHIVEOPTIONS = -OCAMLFIND = ocamlfind +OCAMLFIND = @OCAMLFIND@ OCAMLC = $(OCAMLFIND) ocamlc $(OCAMLDEBUGOPTIONS) $(OCAMLOPTIONS) $(PREPROCOPTIONS) OCAMLOPT = $(OCAMLFIND) opt $(OCAMLOPTIONS) $(PREPROCOPTIONS) OCAMLDEP = $(OCAMLFIND) ocamldep $(PREPROCOPTIONS) diff --git a/helm/ocaml/Makefile.in b/helm/ocaml/Makefile.in index ca5a17f8e..1f47f9481 100644 --- a/helm/ocaml/Makefile.in +++ b/helm/ocaml/Makefile.in @@ -68,7 +68,7 @@ METAS/META.helm-%: METAS/meta.helm-%.src .dep.dot: echo "digraph G {" > $@ echo " rankdir = TB ;" >> $@ - for i in $(MODULES); do ocamlfind query helm-$$i -recursive -p-format | grep helm | sed "s/^helm-/ \"$$i\" -> \"/g" | sed "s/$$/\";/g" >> $@ ; done + for i in $(MODULES); do $(OCAMLFIND) query helm-$$i -recursive -p-format | grep helm | sed "s/^helm-/ \"$$i\" -> \"/g" | sed "s/$$/\";/g" >> $@ ; done mv $@ $@.old ; ./simplify_deps/simplify_deps.opt < $@.old > $@ ; rm $@.old echo "}" >> $@ @@ -76,7 +76,7 @@ METAS/META.helm-%: METAS/meta.helm-%.src .alldep.dot: echo "digraph G {" > $@ echo " rankdir = TB ;" >> $@ - for i in $(MODULES); do ocamlfind query helm-$$i -recursive -p-format | grep -v "pxp-" | sed "s/^pxp/pxp[-*]/g" | sed "s/^/ \"helm-$$i\" -> \"/g" | sed "s/$$/\";/g" >> $@ ; done + for i in $(MODULES); do $(OCAMLFIND) query helm-$$i -recursive -p-format | grep -v "pxp-" | sed "s/^pxp/pxp[-*]/g" | sed "s/^/ \"helm-$$i\" -> \"/g" | sed "s/$$/\";/g" >> $@ ; done mv $@ $@.old ; ./simplify_deps/simplify_deps.opt < $@.old > $@ ; rm $@.old for i in $(MODULES); do echo "\"helm-$$i\" [shape=box,style=filled,fillcolor=yellow];" >> $@ ; done echo "}" >> $@ diff --git a/helm/ocaml/configure.ac b/helm/ocaml/configure.ac index 8f368b0f9..0651685f1 100644 --- a/helm/ocaml/configure.ac +++ b/helm/ocaml/configure.ac @@ -8,6 +8,29 @@ fi AC_CHECK_PROG(HAVE_OCAMLFIND, ocamlfind, yes, no) if test $HAVE_OCAMLFIND = "no"; then AC_MSG_ERROR(could not find ocamlfind in PATH, please make sure findlib is installed) +else + OCAMLFIND=ocamlfind +fi + +OCAMLFIND_COMMANDS="" +AC_CHECK_PROG(HAVE_OCAMLC_OPT, ocamlc.opt, yes, no) +if test $HAVE_OCAMLC_OPT = "yes"; then + if test "$OCAMLFIND_COMMANDS" = ""; then + OCAMLFIND_COMMANDS="ocamlc=ocamlc.opt" + else + OCAMLFIND_COMMANDS="$OCAMLFIND_COMMANDS ocamlc=ocamlc.opt" + fi +fi +AC_CHECK_PROG(HAVE_OCAMLOPT_OPT, ocamlopt.opt, yes, no) +if test $HAVE_OCAMLOPT_OPT = "yes"; then + if test "$OCAMLFIND_COMMANDS" = ""; then + OCAMLFIND_COMMANDS="ocamlopt=ocamlopt.opt" + else + OCAMLFIND_COMMANDS="$OCAMLFIND_COMMANDS ocamlopt=ocamlopt.opt" + fi +fi +if test "$OCAMLFIND_COMMANDS" != ""; then + OCAMLFIND="OCAMLFIND_COMMANDS='$OCAMLFIND_COMMANDS' $OCAMLFIND" fi AC_MSG_CHECKING("where to install the library") @@ -18,6 +41,7 @@ AC_MSG_CHECKING("where to install the META files") OCAMLFIND_META_DIR="/public/sacerdot/prova/META" AC_MSG_RESULT($OCAMLFIND_META_DIR) +AC_SUBST(OCAMLFIND) AC_SUBST(OCAMLFIND_DEST_DIR) AC_SUBST(OCAMLFIND_META_DIR) AC_SUBST(CHOSEN_TERM_EDITOR) -- 2.39.2