diff --git a/INSTALL.md b/INSTALL.md index e01d013dd..e3c00955f 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -106,6 +106,8 @@ compile Infer on a few Linux distributions. sudo apt-get update sudo apt-get upgrade sudo apt-get install -y \ + autoconf \ + automake \ build-essential \ git \ libgmp-dev \ @@ -125,6 +127,8 @@ sudo add-apt-repository ppa:ubuntu-toolchain-r/test sudo apt-get update sudo apt-get upgrade sudo apt-get install -y \ + autoconf \ + automake \ build-essential \ g++-4.8 \ gcc-4.8 \ @@ -148,8 +152,10 @@ Unfortunately, the version of opam that ships with some Linux distributions is broken, so you'll have to get it from the web: ```sh -wget -O opam https://github.com/ocaml/opam/releases/download/1.2.2/opam-1.2.2-x86_64-Linux -chmod +x opam +wget https://github.com/ocaml/opam/releases/download/1.2.2/opam-1.2.2-x86_64-Linux +chmod +x opam-1.2.2-x86_64-Linux +sudo cp opam-1.2.2-x86_64-Linux /usr/local/bin/opam +opam init --comp=4.02.3 ``` Alternatively, follow the instructions [from the opam diff --git a/build-infer.sh b/build-infer.sh index 28dc6353c..557f51e76 100755 --- a/build-infer.sh +++ b/build-infer.sh @@ -96,15 +96,19 @@ check_installed () { echo "initializing opam... " check_installed opam -# opam is noisy -opam init --no-setup --yes > /dev/null +# if the first command doesn't succeed it means that ocaml is not even +# installed on the system, so we have to pick a compiler version ourselves +# +# opam is noisy, so we silence the first invocation which typically would be a +# no-op +opam init --no-setup --yes > /dev/null || \ + opam init --no-setup --yes --comp=4.02.3 + eval $(opam config env) echo "preparing build... " if [ ! -f .release ]; then ./autogen.sh > /dev/null -elif [ ! -d .git ] && [ ! -f .release ]; then - git submodule update --init --recursive fi TARGETS="" diff --git a/configure.ac b/configure.ac index f2c104659..524df9a67 100644 --- a/configure.ac +++ b/configure.ac @@ -149,7 +149,6 @@ AC_ASSERT_PROG([ocamlc], [$OCAMLC]) AC_ASSERT_PROG([ocamlopt], [$OCAMLOPT]) AC_ASSERT_PROG([ocamlbuild], [$OCAMLBUILD]) AC_PROG_FINDLIB -AC_ASSERT_PROG([ocamlfind], [$OCAMLFIND]) AC_PROG_OCAMLLEX AC_ASSERT_PROG([ocamllex], [$OCAMLLEX]) AC_PROG_OCAMLYACC diff --git a/m4/ac_assert_ocaml_pkg.m4 b/m4/ac_assert_ocaml_pkg.m4 index d4c8fa9c9..4450e7ee3 100644 --- a/m4/ac_assert_ocaml_pkg.m4 +++ b/m4/ac_assert_ocaml_pkg.m4 @@ -9,16 +9,33 @@ dnl AC_ASSERT_OCAML_PKG([pkg_name], [pkg_version]) dnl dnl fails if $pkg_name is not installed; also fails if it is not dnl installed at version $pkg_version if specified +dnl +dnl assumes that AC_PROG_FINDLIB has been called AC_DEFUN([AC_ASSERT_OCAML_PKG], [dnl AC_CHECK_OCAML_PKG_PATH([$1], [$2], [$3]) unset has_pkg unset pkg + unset version - has_pkg=$AS_TR_SH[OCAML_PKG_$1] + AS_IF([test "$OCAMLFIND" = "no"], [dnl + # trick to detect if ocamlfind is correctly installed and give the + # right opam instructions to install it if not since they're the + # same as when any other opam package is missing. + has_pkg=no + pkg=ocamlfind + version= + ], [dnl + has_pkg=$AS_TR_SH[OCAML_PKG_$1] + pkg=$1 + version= + AS_IF([test "x$3" = "x"], [dnl + version=" version $3" + ]) + ]) AS_IF([test "$has_pkg" = "no"], [dnl - AC_MSG_ERROR([missing dependency: $1$version. + AC_MSG_ERROR([missing dependency: $pkg$version. If you are using opam, please run