[build] honour `OPAMROOT`

Reviewed By: jberdine

Differential Revision: D6136780

fbshipit-source-id: 4b26a36
master
Jules Villard 7 years ago committed by Facebook Github Bot
parent b67a82636c
commit 7ef191f4be

@ -60,6 +60,7 @@ OCAMLFIND = @OCAMLFIND@
OCAMLLEX = @OCAMLLEX@
OCAMLOPT = @OCAMLOPT@
OPAM = @OPAM@
OPAMROOT = @OPAMROOT@
OPAMSWITCH = @OPAMSWITCH@
PATH = @PATH@
prefix = @prefix@
@ -80,3 +81,4 @@ endif
# Export parts of the config relevant to running other programs
export PATH := $(PATH)
export CAML_LD_LIBRARY_PATH := $(CAML_LD_LIBRARY_PATH)
export OPAMROOT := $(OPAMROOT)

@ -201,14 +201,22 @@ AC_ASSERT_OCAML_PKG([yojson])
AC_ARG_VAR([CAML_LD_LIBRARY_PATH],
[Additional directories to search for dynamically-loaded libraries.])
AC_ARG_VAR([OPAMROOT], [Root of the local opam installation.])
AC_ARG_VAR([OPAMSWITCH], [Opam switch used for building infer.])
AC_CHECK_TOOL([OPAM], [opam], [no])
AS_IF([test "$OPAM" != "no"], [
AC_MSG_CHECKING([current opam root])
OPAMROOT=$("$OPAM" config var root)
AC_MSG_RESULT([$OPAMROOT])
AC_MSG_CHECKING([current opam switch])
OPAMSWITCH=$("$OPAM" switch show)
AC_MSG_RESULT([$OPAMSWITCH])
], [OPAMSWITCH=no])
], [
OPAMROOT=no
OPAMSWITCH=no
])
AC_SUBST([OPAMROOT])
AC_SUBST([OPAMSWITCH])
if test "x$enable_java_analyzers" = "xyes"; then

Loading…
Cancel
Save