summaryrefslogtreecommitdiffstats
path: root/configure.ac
diff options
context:
space:
mode:
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac73
1 files changed, 72 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 1ad1341..43017bf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -156,6 +156,76 @@ case "$GLOBAL_CFLAGS" in
156 AC_DEFINE([HAVE_FVISIBILITY], [1], [Define if compiled with -fvisibility=hidden]) 156 AC_DEFINE([HAVE_FVISIBILITY], [1], [Define if compiled with -fvisibility=hidden])
157esac 157esac
158 158
159AC_ARG_WITH([fuzzers],
160 [AS_HELP_STRING([--with-fuzzers],
161 [build fuzzers and libplist with sanitizers (default is no)])],
162 [build_fuzzers=true],
163 [build_fuzzers=false])
164if test "x$build_fuzzers" = "xtrue"; then
165 AS_COMPILER_FLAG([-fsanitize=address], [
166 SANITIZER_FLAGS+=" -fsanitize=address"
167 ASAN_AVAILABLE=yes
168 ], [])
169 if test "$ASAN_AVAILABLE" = "yes"; then
170 AS_COMPILER_FLAG([-fsanitize=address -fsanitize-address-use-after-scope], [
171 SANITIZER_FLAGS+=" -fsanitize-address-use-after-scope"
172 ], [])
173 SANITIZERS+="ASAN "
174 fi
175
176 AS_COMPILER_FLAG([-fsanitize=undefined], [
177 SANITIZER_FLAGS+=" -fsanitize=undefined"
178 UBSAN_AVAILABLE=yes
179 ], [])
180
181 if test "$UBSAN_AVAILABLE" = "yes"; then
182 SANITIZERS+="UBSAN "
183 fi
184
185 if test -z "$SANITIZER_FLAGS"; then
186 AC_MSG_ERROR([compiler doesn't support -fsanitize=address nor -fsanitize=undefined])
187 fi
188
189 COVERAGE_CHECKS="trace-pc-guard trace-cmp edge"
190 for COV_CHECK in $COVERAGE_CHECKS; do
191 AS_COMPILER_FLAG([-fsanitize-coverage=$COV_CHECK], [
192 if test -z "$SAN_COV_FLAGS"; then
193 SAN_COV_FLAGS="$COV_CHECK"
194 else
195 SAN_COV_FLAGS+=",$COV_CHECK"
196 fi
197 ], [])
198 done
199 if test -n "$SAN_COV_FLAGS"; then
200 SANITIZER_FLAGS+=" -fsanitize-coverage=$SAN_COV_FLAGS"
201 else
202 AC_MSG_WARN([No sanitizer coverage supported by compiler])
203 fi
204
205 CFLAGS="-O1"
206
207 AS_COMPILER_FLAG([-fno-omit-frame-pointer], [
208 CFLAGS+=" -fno-omit-frame-pointer"
209 ], [])
210
211 AS_COMPILER_FLAG([-gline-tables-only], [
212 CFLAGS+=" -gline-tables-only"
213 ],
214 [
215 CFLAGS+=" -g"
216 ])
217
218 CFLAGS+=" -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION"
219 CFLAGS+=" $SANITIZER_FLAGS"
220 CXXFLAGS="$CFLAGS -std=c++11"
221 EXTRA_CONF+=" Build fuzzers ...........: yes
222"
223 EXTRA_CONF+=" Enabled sanitizers ......: $SANITIZERS
224"
225 AS_COMPILER_FLAGS(TEST_CFLAGS, [$CFLAGS])
226fi
227AM_CONDITIONAL([BUILD_FUZZERS],[test "x$build_fuzzers" = "xtrue"])
228
159m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) 229m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
160 230
161AC_OUTPUT([ 231AC_OUTPUT([
@@ -168,6 +238,7 @@ include/Makefile
168tools/Makefile 238tools/Makefile
169cython/Makefile 239cython/Makefile
170test/Makefile 240test/Makefile
241fuzz/Makefile
171doxygen.cfg 242doxygen.cfg
172]) 243])
173 244
@@ -178,7 +249,7 @@ Configuration for $PACKAGE $VERSION:
178 Install prefix ..........: $prefix 249 Install prefix ..........: $prefix
179 Debug code ..............: $debug 250 Debug code ..............: $debug
180 Python bindings .........: $cython_python_bindings 251 Python bindings .........: $cython_python_bindings
181 252$EXTRA_CONF
182 Now type 'make' to build $PACKAGE $VERSION, 253 Now type 'make' to build $PACKAGE $VERSION,
183 and then 'make install' for installation. 254 and then 'make install' for installation.
184" 255"