diff --git a/compiler/myocamlbuild.ml b/compiler/myocamlbuild.ml index 3f220c3..99f9a6e 100644 --- a/compiler/myocamlbuild.ml +++ b/compiler/myocamlbuild.ml @@ -8,7 +8,7 @@ let df = function ocamlfind_after_rules (); (* Tell ocamlbuild about the camlp4 library. *) - ocaml_lib ~extern:true ~dir:"+camlp4" "camlp4"; + ocaml_lib ~extern:true ~dir:(ocamlfind_query "camlp4") "camlp4"; (* Add preproc.cmo to the ocaml pre-processor when use_preproc is set *) flag ["ocaml"; "pp"; "use_preproc"] (A "preproc.cmo"); diff --git a/compiler/myocamlbuild_config.ml b/compiler/myocamlbuild_config.ml index a1a212b..56f83bb 100644 --- a/compiler/myocamlbuild_config.ml +++ b/compiler/myocamlbuild_config.ml @@ -32,6 +32,10 @@ let find_syntaxes () = ["camlp4o"; "camlp4r"] (* ocamlfind command *) let ocamlfind x = S[A"ocamlfind"; x] +let ocamlfind_query pkg = + let cmd = Printf.sprintf "ocamlfind query %s" (Filename.quote pkg) in + Ocamlbuild_pack.My_unix.run_and_open cmd (fun ic -> input_line ic) + let ocamlfind_before_options () = (* by using Before_options one let command line options have an higher priority *) (* on the contrary using After_options will guarantee to have the higher priority *) diff --git a/config b/config deleted file mode 100644 index dced476..0000000 --- a/config +++ /dev/null @@ -1,22 +0,0 @@ -srcdir = . -top_srcdir = . -prefix = /opt/local -exec_prefix = ${prefix} -bindir = ${exec_prefix}/bin -libdir = ${exec_prefix}/lib - -INSTALL= /usr/bin/install -c -MAKE= @MAKE@ - -BUILD= _build -COMPILER=heptc -SIMULATOR=hepts - -INSTALL_BINDIR=$(bindir) -INSTALL_LIBDIR=$(libdir)/heptagon -STDLIB_DIR=${exec_prefix}/lib/heptagon - -OCAMLBUILD=STDLIB=$(STDLIB_DIR) ocamlbuild - -TARGET=byte -ENABLE_SIMULATOR=yes diff --git a/configure b/configure index b47f139..eaf25a7 100755 --- a/configure +++ b/configure @@ -2929,6 +2929,12 @@ echo "$as_me: error: Please install OCaml findlib (the ocamlfind command)" >&2;} { (exit 1); exit 1; }; } fi +OCAMLC_STDLIB=`$OCAMLFIND ocamlc -where` +OCAMLFIND_STDLIB=`$OCAMLFIND printconf stdlib` +if test "$OCAMLC_STDLIB" != "$OCAMLFIND_STDLIB"; then + as_fn_error $? "OCaml and OCamlfind are installed in different directories" "$LINENO" 5 +fi + # Extract the first word of "menhir", so it can be a program name with args. set dummy menhir; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 @@ -3074,6 +3080,7 @@ fi + ac_config_files="$ac_config_files config" cat >confcache <<\_ACEOF diff --git a/configure.in b/configure.in index 91f97da..031cdb2 100644 --- a/configure.in +++ b/configure.in @@ -25,6 +25,12 @@ if test "$OCAMLFIND" = "no"; then AC_MSG_ERROR([Please install OCaml findlib (the ocamlfind command)]) fi +OCAMLC_STDLIB=`$OCAMLFIND ocamlc -where` +OCAMLFIND_STDLIB=`$OCAMLFIND printconf stdlib` +if test "$OCAMLC_STDLIB" != "$OCAMLFIND_STDLIB"; then + AC_MSG_ERROR([OCaml and OCamlfind make different assumptions about the standard library directory]) +fi + AC_CHECK_PROG(MENHIR,menhir,menhir,no) if test "$MENHIR" = no ; then AC_MSG_ERROR(Please install menhir.) @@ -52,6 +58,7 @@ else stdlib_dir=$libdir/heptagon fi + AC_SUBST(INSTALL) AC_SUBST(stdlib_dir)