add --disable-c-analyzers option

Summary:
public
This option disables the building of the C/C++/ObjC analyzers and the
associated autoconf checks.

Reviewed By: jeremydubreil

Differential Revision: D2712835

fb-gh-sync-id: f766ec2
master
Jules Villard 9 years ago committed by facebook-github-bot-1
parent 8ddf621ca3
commit 51f0f89f9d

@ -9,7 +9,11 @@
ROOT_DIR = . ROOT_DIR = .
include $(ROOT_DIR)/Makefile.config include $(ROOT_DIR)/Makefile.config
all: clang java all: java
ifeq (@BUILD_C_ANALYZERS@,yes)
all: clang
endif
java: java:
$(MAKE) -C $(INFER_DIR) java $(MAKE) -C $(INFER_DIR) java
@ -37,8 +41,19 @@ clang_plugin: clang_setup
CLANG_PREFIX=@CLANG_PREFIX@ \ CLANG_PREFIX=@CLANG_PREFIX@ \
CLANG_INCLUDES=@CLANG_INCLUDES@ CLANG_INCLUDES=@CLANG_INCLUDES@
ifneq (@BUILD_C_ANALYZERS@,yes)
clang:
@echo
@echo " error: clang analyzers disabled by ./configure"
@echo " to enable them again, see"
@echo
@echo " ./configure --help"
@echo
@exit 1
else
clang: clang_plugin clang: clang_plugin
$(MAKE) -C $(INFER_DIR) clang $(MAKE) -C $(INFER_DIR) clang
endif
clean: clean:
$(MAKE) -C $(FCP_DIR) clean $(MAKE) -C $(FCP_DIR) clean

@ -34,26 +34,26 @@ function usage() {
} }
# arguments # arguments
BUILD_CLANG=0 BUILD_CLANG=no
BUILD_JAVA=0 BUILD_JAVA=no
INTERACTIVE=yes INTERACTIVE=yes
while [[ $# > 0 ]]; do while [[ $# > 0 ]]; do
opt_key="$1" opt_key="$1"
case $opt_key in case $opt_key in
all) all)
BUILD_CLANG=1 BUILD_CLANG=yes
BUILD_JAVA=1 BUILD_JAVA=yes
shift shift
continue continue
;; ;;
clang) clang)
BUILD_CLANG=1 BUILD_CLANG=yes
shift shift
continue continue
;; ;;
java) java)
BUILD_JAVA=1 BUILD_JAVA=yes
shift shift
continue continue
;; ;;
@ -74,9 +74,9 @@ while [[ $# > 0 ]]; do
done done
# if no arguments then build both clang and Java # if no arguments then build both clang and Java
if [ "$BUILD_CLANG" = "0" ] && [ "$BUILD_JAVA" = "0" ]; then if [ "$BUILD_CLANG" = "no" ] && [ "$BUILD_JAVA" = "no" ]; then
BUILD_CLANG=1 BUILD_CLANG=yes
BUILD_JAVA=1 BUILD_JAVA=yes
fi fi
# enable --yes option for some commands in non-interactive mode # enable --yes option for some commands in non-interactive mode
@ -108,10 +108,10 @@ elif [ ! -d .git ] && [ ! -f .release ]; then
fi fi
TARGETS="" TARGETS=""
if [ "$BUILD_JAVA" = "1" ]; then if [ "$BUILD_JAVA" = "yes" ]; then
TARGETS+=" java" TARGETS+=" java"
fi fi
if [ "$BUILD_CLANG" = "1" ]; then if [ "$BUILD_CLANG" = "yes" ]; then
TARGETS+=" clang" TARGETS+=" clang"
if ! facebook-clang-plugins/clang/setup.sh --only-check-install; then if ! facebook-clang-plugins/clang/setup.sh --only-check-install; then
echo "" echo ""
@ -145,6 +145,11 @@ if [ "$BUILD_CLANG" = "1" ]; then
fi fi
fi fi
CONFIGURE_ARGS=
if [ "$BUILD_CLANG" = "no" ]; then
CONFIGURE_ARGS+=" --disable-c-analyzers"
fi
echo echo
echo " *************************" echo " *************************"
echo " ** **" echo " ** **"
@ -153,5 +158,5 @@ echo " ** **"
echo " *************************" echo " *************************"
echo echo
./configure ./configure $CONFIGURE_ARGS
make $TARGETS || (echo "compilation failure; try running `make clean`"; exit 1) make $TARGETS || (echo "compilation failure; try running `make clean`"; exit 1)

@ -33,14 +33,24 @@ AS_IF([test "x$CLANG_INCLUDES" = "x"], [
]) ])
AC_ARG_ENABLE(c-analyzers,
AS_HELP_STRING([--disable-c-analyzers],
[do not build the C/C++/ObjC analyzers (default is to build them)]),
,
enable_c_analyzers=yes)
BUILD_C_ANALYZERS=$enable_c_analyzers
AC_SUBST([BUILD_C_ANALYZERS])
AC_ARG_WITH(fcp-clang, AC_ARG_WITH(fcp-clang,
AS_HELP_STRING([--without-fcp-clang], AS_HELP_STRING([--without-fcp-clang],
[do not use $CLANG_PREFIX/bin/clang to override the default compiler (default is to override if in an infer release)]), [do not use $CLANG_PREFIX/bin/clang to override the default compiler (default is to override if in an infer release)]),
, ,
with_fcp_clang=$is_infer_release) with_fcp_clang=$is_infer_release)
AC_MSG_CHECKING([checking whether to use the compilers in $CLANG_PREFIX/bin]) AS_IF([test "x$enable_c_analyzers" = "xyes"], [
case "$with_fcp_clang" in AC_MSG_CHECKING([checking whether to use the compilers in $CLANG_PREFIX/bin])
case "$with_fcp_clang" in
no) no)
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
;; ;;
@ -53,20 +63,11 @@ case "$with_fcp_clang" in
*) *)
AC_MSG_ERROR([invalid value for --without-fcp-clang; use "yes" or "no"]) AC_MSG_ERROR([invalid value for --without-fcp-clang; use "yes" or "no"])
;; ;;
esac esac
])
# end if($enable_c_analyzers)
# prefer clang over gcc because the plugins makes use of
# clang-specific #pragma's
AC_PROG_CC(clang gcc)
AC_PROG_CXX(clang++ g++)
AC_PROG_AWK
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_OBJC
AC_CHECK_TOOL([PYTHON27], [python2.7], [no]) AC_CHECK_TOOL([PYTHON27], [python2.7], [no])
AC_ASSERT_PROG([python2.7], [$PYTHON27]) AC_ASSERT_PROG([python2.7], [$PYTHON27])
@ -77,10 +78,22 @@ AC_CHECK_TOOL([XCODE_SELECT], [xcode-select], [no])
AC_SUBST([XCODE_SELECT]) AC_SUBST([XCODE_SELECT])
dnl clang wants either clang version >= 3.1 or gcc version >= 4.7.2 to # prefer clang over gcc because the plugins makes use of
dnl compile itself # clang-specific #pragma's
AC_MSG_CHECKING([checking if the C/C++ compiler is recent enough]) AC_PROG_CC(clang gcc)
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
if test "x$enable_c_analyzers" = "xyes"; then
AC_PROG_CPP
AC_PROG_CXX(clang++ g++)
dnl clang wants either clang version >= 3.1 or gcc version >= 4.7.2 to
dnl compile itself
AC_MSG_CHECKING([checking if the C/C++ compiler is recent enough])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#ifdef __clang__ #ifdef __clang__
#if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 1) #if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 1)
#error compiler is too old #error compiler is too old
@ -107,7 +120,12 @@ pre-compiled here:
https://github.com/facebook/infer/releases/]) https://github.com/facebook/infer/releases/])
] ]
) )
AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h locale.h malloc.h stddef.h stdint.h stdlib.h string.h sys/mount.h sys/param.h sys/socket.h sys/statfs.h sys/time.h unistd.h wchar.h wctype.h])
fi
# end if($enable_c_analyzers)
# OCaml dependencies # OCaml dependencies
AC_PROG_OCAML AC_PROG_OCAML
@ -142,9 +160,6 @@ AC_ASSERT_PROG([atdgen], [$ATDGEN])
AC_SUBST([ATDGEN]) AC_SUBST([ATDGEN])
# Checks for header files.
AC_CHECK_HEADERS([fcntl.h inttypes.h limits.h locale.h malloc.h stddef.h stdint.h stdlib.h string.h sys/mount.h sys/param.h sys/socket.h sys/statfs.h sys/time.h unistd.h wchar.h wctype.h])
AC_CONFIG_FILES([ AC_CONFIG_FILES([
Makefile.config Makefile.config
Makefile Makefile
@ -156,4 +171,5 @@ AC_CONFIG_FILES([
infer/models/java/Makefile infer/models/java/Makefile
infer/src/Makefile infer/src/Makefile
]) ])
AC_OUTPUT AC_OUTPUT

Loading…
Cancel
Save