build-sys: add support for --enable-fuzzing-engine

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
pull/1068/head
Evgeny Vereshchagin 2 years ago
parent 7b4ab119f4
commit 75196cd8be
  1. 12
      Makefile.am
  2. 10
      configure.ac

@ -10,14 +10,24 @@ AM_CPPFLAGS += \
-D_PATH_VENDORDIR=\"${vendordir}\"
endif
if FUZZING_ENGINE
if !OSS_FUZZ
AM_CPPFLAGS += \
-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
endif
endif
AM_CFLAGS = -fsigned-char $(WARN_CFLAGS)
AM_LDFLAGS = $(ASAN_LDFLAGS) $(UBSAN_LDFLAGS)
AM_CXXFLAGS = $(AM_CFLAGS)
AM_LDFLAGS = $(ASAN_LDFLAGS) $(UBSAN_LDFLAGS) $(FUZZING_ENGINE_LDFLAGS)
# Add gettext stuff to the global LDADD for systems with separate libintl
# library. The LTLIBINTL is generated by AM_GNU_GETTEXT macro.
#
LDADD = $(LTLIBINTL)
LIB_FUZZING_ENGINE ?= -fsanitize=fuzzer
# Automake (at least up to 1.10) mishandles dist_man_MANS inside conditionals.
# Unlike with other dist primaries, the files are not distributed if the
# conditional is false.

@ -193,8 +193,16 @@ AC_ARG_ENABLE([fuzzing-engine],
AS_HELP_STRING([--enable-fuzzing-engine], [compile with fuzzing engine]),
[], [enable_fuzzing_engine=no]
)
AS_IF([test "x$enable_fuzzing_engine" = xyes -a "x$LIB_FUZZING_ENGINE" = x], [
UL_WARN_ADD([-fno-omit-frame-pointer])
UL_WARN_ADD([-gline-tables-only])
UL_WARN_ADD([-fsanitize=fuzzer-no-link])
FUZZING_ENGINE_LDFLAGS="-fsanitize=fuzzer-no-link"
])
AC_SUBST([FUZZING_ENGINE_LDFLAGS])
AC_PROG_CXX
AM_CONDITIONAL([FUZZING_ENGINE], [test x$enable_fuzzing_engine = xyes])
AM_CONDITIONAL([FUZZING_ENGINE], [test "x$enable_fuzzing_engine" = xyes])
AM_CONDITIONAL([OSS_FUZZ], [test "x$LIB_FUZZING_ENGINE" != x])
dnl libtool-2
LT_INIT

Loading…
Cancel
Save