forked from facebook/infer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
203 lines (166 loc) · 5.55 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
dnl autoconf script for Infer
dnl run ./autogen.sh to generate a configure script
dnl
dnl Copyright (c) 2015 - present Facebook, Inc.
dnl All rights reserved.
dnl
dnl This source code is licensed under the BSD style license found in the
dnl LICENSE file in the root directory of this source tree. An additional grant
dnl of patent rights can be found in the PATENTS file in the same directory.
AC_PREREQ([2.63])
# WARNING: AC_INIT only accepts string literals so the version number
# has to be kept in sync with below
AC_INIT([Infer],
[0.4.0],
[https://github.com/facebook/infer/issues/])
AC_CONFIG_SRCDIR([infer/src/backend/sil.ml])
# WARNING: keep in sync with above
INFER_MAJOR=0
INFER_MINOR=4
INFER_PATCH=0
AC_SUBST([INFER_MAJOR])
AC_SUBST([INFER_MINOR])
AC_SUBST([INFER_PATCH])
# record if we are in a release of Infer
AC_MSG_CHECKING([if we are in an Infer release build])
is_infer_release=no
AS_IF([test -f ".release"], [is_infer_release=yes])
INFER_IS_RELEASE=$is_infer_release
AC_SUBST([INFER_IS_RELEASE])
AC_MSG_RESULT([$is_infer_release])
# to compile the facebook-clang-plugins
AC_ARG_VAR([CLANG_PREFIX], [directory where clang is installed (defaults=$PWD/facebook-clang-plugins/clang)])
AS_IF([test "x$CLANG_PREFIX" = "x"], [
CLANG_PREFIX="$(pwd)/facebook-clang-plugins/clang"
])
AC_ARG_VAR([CLANG_INCLUDES], [clang headers directories (defaults=$CLANG_PREFIX/include)])
AS_IF([test "x$CLANG_INCLUDES" = "x"], [
CLANG_INCLUDES="$CLANG_PREFIX/include"
])
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_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],
[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)
AS_IF([test "x$enable_c_analyzers" = "xyes"], [
AC_MSG_CHECKING([whether to use the compilers in $CLANG_PREFIX/bin])
case "$with_fcp_clang" in
no)
AC_MSG_RESULT([no])
;;
yes)
CC=$CLANG_PREFIX/bin/clang
CXX=$CLANG_PREFIX/bin/clang++
OBJC=$CLANG_PREFIX/bin/clang
AC_MSG_RESULT([yes])
;;
*)
AC_MSG_ERROR([invalid value for --without-fcp-clang; use "yes" or "no"])
;;
esac
AC_CHECK_TOOL([SHASUM], [shasum], [no])
AC_ASSERT_PROG([shasum], [$SHASUM])
])
# end if($enable_c_analyzers)
AC_CHECK_TOOL([PYTHON27], [python2.7], [no])
AC_ASSERT_PROG([python2.7], [$PYTHON27])
AC_CHECK_TOOL([JAVAC], [javac], [no])
AC_ASSERT_PROG([javac], [$JAVAC])
AC_CHECK_TOOL([XCODE_SELECT], [xcode-select], [no])
AC_SUBST([XCODE_SELECT])
# prefer clang over gcc because the plugins makes use of
# clang-specific #pragma's
AC_PROG_CC(clang gcc)
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([if the C/C++ compiler is recent enough])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#ifdef __clang__
#if __clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 1)
#error compiler is too old
#endif // version check
#elif defined __GNUC__ // __clang__
#if __GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 7 || (__GNUC_MINOR__ == 7 && __GNUC_PATCHLEVEL__ < 2)))
#error compiler is too old
#endif // version check
#endif // __GNUC__
]])],
[AC_MSG_RESULT([yes])],
[dnl
AC_MSG_RESULT([no])
AC_MSG_ERROR([
Your C/C++ compiler seems to be too old to build clang, which is
required by the facebook-clang-plugins. Please install either
gcc version >= 4.7.2 or clang version >= 3.1.
See the output of `./configure --help` to force the use of a different
C compiler.
Alternatively, you can checkout a release of infer with clang
pre-compiled here:
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
AC_PROG_OCAML
AC_ASSERT_PROG([ocamlc], [$OCAMLC])
AC_ASSERT_PROG([ocamlopt], [$OCAMLOPT])
AC_ASSERT_PROG([ocamlbuild], [$OCAMLBUILD])
AC_PROG_FINDLIB
AC_PROG_OCAMLLEX
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([biniou])
AC_ASSERT_OCAML_PKG([camlzip], [zip])
AC_ASSERT_OCAML_PKG([easy-format])
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])
AC_CONFIG_FILES([
Makefile.config
Makefile
infer/Makefile
infer/models/Makefile
infer/models/c/Makefile
infer/models/cpp/Makefile
infer/models/objc/Makefile
infer/models/java/Makefile
infer/src/Makefile
])
AC_OUTPUT