From ea4be060f6419c176d1e1a0bf1c8043a527ec3b6 Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Tue, 15 Dec 2015 15:26:26 -0800 Subject: [PATCH] add --disable-java-analyzers option Summary: public This configure option disables building the java analysis and the associated checks. Refactor infer/src/Makefile.in to better isolate the Java-specific ocamlfind dependencies. Reviewed By: jeremydubreil Differential Revision: D2712921 fb-gh-sync-id: 08077c2 --- Makefile.in | 15 +++++++++++++++ build-infer.sh | 3 +++ configure.ac | 23 ++++++++++++++++++----- infer/src/Makefile.in | 20 ++++++++++---------- 4 files changed, 46 insertions(+), 15 deletions(-) diff --git a/Makefile.in b/Makefile.in index 8df29b5ea..7b7a8c202 100644 --- a/Makefile.in +++ b/Makefile.in @@ -9,14 +9,29 @@ ROOT_DIR = . include $(ROOT_DIR)/Makefile.config +all: + +ifeq (@BUILD_JAVA_ANALYZERS@,yes) all: java +endif ifeq (@BUILD_C_ANALYZERS@,yes) all: clang endif +ifneq (@BUILD_JAVA_ANALYZERS@,yes) +java: + @echo + @echo " error: java analyzers disabled by ./configure" + @echo " to enable them again, see" + @echo + @echo " ./configure --help" + @echo + @exit 1 +else java: $(MAKE) -C $(INFER_DIR) java +endif clang_setup: export CC="@CC@" CFLAGS="@CFLAGS@"; \ diff --git a/build-infer.sh b/build-infer.sh index 557f51e76..2f34e8714 100755 --- a/build-infer.sh +++ b/build-infer.sh @@ -153,6 +153,9 @@ CONFIGURE_ARGS= if [ "$BUILD_CLANG" = "no" ]; then CONFIGURE_ARGS+=" --disable-c-analyzers" fi +if [ "$BUILD_JAVA" = "no" ]; then + CONFIGURE_ARGS+=" --disable-java-analyzers" +fi echo echo " *************************" diff --git a/configure.ac b/configure.ac index 524df9a67..82d15523c 100644 --- a/configure.ac +++ b/configure.ac @@ -54,6 +54,15 @@ AC_ARG_ENABLE(c-analyzers, BUILD_C_ANALYZERS=$enable_c_analyzers AC_SUBST([BUILD_C_ANALYZERS]) +AC_ARG_ENABLE(java-analyzers, + AS_HELP_STRING([--disable-java-analyzers], + [do not build the Java analyzers (default is to build them)]), + , + enable_java_analyzers=yes) + +BUILD_JAVA_ANALYZERS=$enable_java_analyzers +AC_SUBST([BUILD_JAVA_ANALYZERS]) + AC_ARG_WITH(fcp-clang, AS_HELP_STRING([--without-fcp-clang], @@ -154,22 +163,26 @@ AC_ASSERT_PROG([ocamllex], [$OCAMLLEX]) AC_PROG_OCAMLYACC AC_ASSERT_PROG([ocamlyacc], [$OCAMLYACC]) AC_ASSERT_OCAML_PKG([atdgen], [], [1.6.0]) -AC_ASSERT_OCAML_PKG([extlib], [], [1.5.4]) -AC_ASSERT_OCAML_PKG([javalib], [], [2.3.1]) -AC_ASSERT_OCAML_PKG([sawja], [], [1.5.1]) AC_ASSERT_OCAML_PKG([biniou]) AC_ASSERT_OCAML_PKG([camlzip], [zip]) AC_ASSERT_OCAML_PKG([easy-format]) -AC_ASSERT_OCAML_PKG([ptrees]) +AC_ASSERT_OCAML_PKG([extlib], [], [1.5.4]) AC_ASSERT_OCAML_PKG([yojson]) +if [test "x$enable_java_analyzers" = "xyes"]; then + AC_ASSERT_OCAML_PKG([javalib], [], [2.3.1]) + AC_ASSERT_OCAML_PKG([sawja], [], [1.5.1]) + AC_ASSERT_OCAML_PKG([ptrees]) +fi + + AC_OCAML_CHECK_NATIVE_BYTES AC_OCAMLC_CHECK_SAFE_STRING - if test "$OCAML_HAS_NATIVE_BYTES" = "no"; then AC_ASSERT_OCAML_PKG([bytes]) fi + AC_CHECK_TOOL([ATDGEN], [atdgen], [no]) AC_ASSERT_PROG([atdgen], [$ATDGEN]) AC_SUBST([ATDGEN]) diff --git a/infer/src/Makefile.in b/infer/src/Makefile.in index ec62809b7..388c338ea 100644 --- a/infer/src/Makefile.in +++ b/infer/src/Makefile.in @@ -37,11 +37,13 @@ endif ATDGEN_INCLUDE_DIR = @OCAML_PKG_PATH_atdgen@ BINIOU_INCLUDE_DIR = @OCAML_PKG_PATH_biniou@ -YOJSON_INCLUDE_DIR = @OCAML_PKG_PATH_yojson@ EASYFORMAT_INCLUDE_DIR = @OCAML_PKG_PATH_easy_format@ +EXTLIB_INCLUDE_DIR = @OCAML_PKG_PATH_extlib@ +YOJSON_INCLUDE_DIR = @OCAML_PKG_PATH_yojson@ +ZIP_INCLUDE_DIR = @OCAML_PKG_PATH_camlzip@ -OCAML_INCLUDES = -I,$(EASYFORMAT_INCLUDE_DIR),-I,$(BINIOU_INCLUDE_DIR),-I,$(YOJSON_INCLUDE_DIR),-I,$(ATDGEN_INCLUDE_DIR) -OCAML_LIBS = unix str atdgen +OCAML_INCLUDES = -I,$(EASYFORMAT_INCLUDE_DIR),-I,$(BINIOU_INCLUDE_DIR),-I,$(YOJSON_INCLUDE_DIR),-I,$(ATDGEN_INCLUDE_DIR),-I,$(EXTLIB_INCLUDE_DIR),-I,$(ZIP_INCLUDE_DIR) +OCAML_LIBS = unix str atdgen extLib zip OCAML_MODS = easy_format bi_util bi_share bi_outbuf bi_inbuf bi_vint bi_io yojson ag_oj_run ag_ob_run ag_util # backwards compatibility with OCaml version < 4.02.0 @@ -83,15 +85,13 @@ INFERPRINT_MAIN = $(BACKEND_SOURCES)/inferprint #### Java declarations #### -EXTLIB_INCLUDE_DIR = @OCAML_PKG_PATH_extlib@ PTREES_INCLUDE_DIR = @OCAML_PKG_PATH_ptrees@ JAVALIB_INCLUDE_DIR = @OCAML_PKG_PATH_javalib@ SAWJA_INCLUDE_DIR = @OCAML_PKG_PATH_sawja@ -ZIP_INCLUDE_DIR = @OCAML_PKG_PATH_camlzip@ -JAVA_INCLUDES = -I,$(EXTLIB_INCLUDE_DIR),-I,$(ZIP_INCLUDE_DIR),-I,$(PTREES_INCLUDE_DIR),-I,$(JAVALIB_INCLUDE_DIR),-I,$(SAWJA_INCLUDE_DIR) -JAVA_LIBS = zip extLib ptrees javalib sawja -JAVA_OPTIONS = -cflags -annot -lflags $(JAVA_INCLUDES) -cflags $(JAVA_INCLUDES) $(addprefix -lib ,$(JAVA_LIBS)) +JAVA_INCLUDES = -I,$(PTREES_INCLUDE_DIR),-I,$(JAVALIB_INCLUDE_DIR),-I,$(SAWJA_INCLUDE_DIR) +JAVA_LIBS = ptrees javalib sawja +JAVA_OCAMLBUID_OPTIONS = -cflags -annot -lflags $(JAVA_INCLUDES) -cflags $(JAVA_INCLUDES) $(addprefix -lib ,$(JAVA_LIBS)) JAVA_SOURCES = java @@ -147,7 +147,7 @@ endif DEPENDENCIES = $(BACKEND_SOURCES) checkers facebook/checkers facebook/checkers/graphql facebook/scripts harness $(EXTRA_DEPS) -OCAMLBUILD = ocamlbuild $(OCAMLBUILD_OPTIONS) -build-dir $(BUILD_DIR) -j 0 $(addprefix -I , $(DEPENDENCIES)) $(JAVA_OPTIONS) +OCAMLBUILD = ocamlbuild $(OCAMLBUILD_OPTIONS) -build-dir $(BUILD_DIR) -j 0 $(addprefix -I , $(DEPENDENCIES)) .PHONY: all java clang llvm checkCopyright build_java build_clang build_llvm build_checkCopyright annotations init sanitize clean @@ -162,7 +162,7 @@ llvm: build_llvm annotations $(INFERLLVM_BIN) checkCopyright: build_checkCopyright annotations $(CHECKCOPYRIGHT_BIN) build_java: init $(INFERPRINT_ATDGEN_STUBS) - $(OCAMLBUILD) $(TYPEPROP_MAIN).native $(INFERANALYZE_MAIN).native $(INFERPRINT_MAIN).native $(INFERJAVA_MAIN).native + $(OCAMLBUILD) $(JAVA_OCAMLBUID_OPTIONS) $(TYPEPROP_MAIN).native $(INFERANALYZE_MAIN).native $(INFERPRINT_MAIN).native $(INFERJAVA_MAIN).native build_clang: init $(INFERPRINT_ATDGEN_STUBS) $(CLANG_ATDGEN_STUBS) $(INFER_CLANG_AST_PROJ) $(INFER_CLANG_AST_MAIN) $(OCAMLBUILD) $(INFERANALYZE_MAIN).native $(INFERPRINT_MAIN).native $(INFERCLANG_MAIN).native