[master] 7cbbe58c2 build: New --enable-oss-fuzz configure option

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Tue Sep 7 15:45:06 UTC 2021


commit 7cbbe58c2016f25e6d85a726bce70d907bdc3e30
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Tue Sep 7 16:55:51 2021 +0200

    build: New --enable-oss-fuzz configure option
    
    To avoid the maintenance of a downstream patch.

diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am
index 583f9c5dc..e70b43de9 100644
--- a/bin/varnishd/Makefile.am
+++ b/bin/varnishd/Makefile.am
@@ -205,11 +205,17 @@ esi_parse_fuzzer_SOURCES = \
 	cache/cache_esi_parse.c \
 	fuzzers/esi_parse_fuzzer.c
 esi_parse_fuzzer_CFLAGS = \
-	-DNOT_IN_A_VMOD -DTEST_DRIVER
+	-DNOT_IN_A_VMOD
 esi_parse_fuzzer_LDADD = \
 	$(top_builddir)/lib/libvarnish/libvarnish.la \
 	$(top_builddir)/lib/libvgz/libvgz.a
 
+if ENABLE_OSS_FUZZ
+esi_parse_fuzzer_LDFLAGS = $(LIB_FUZZING_ENGINE)
+else
+esi_parse_fuzzer_CFLAGS += -DTEST_DRIVER
+endif
+
 TESTS = vhp_table_test vhp_decode_test
 
 #
diff --git a/configure.ac b/configure.ac
index 097b8a763..513bf9fbe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -806,15 +806,15 @@ AC_SUBST(AM_LT_LDFLAGS)
 AC_ARG_ENABLE(coverage,
 	AS_HELP_STRING([--enable-coverage],
 		[enable coverage (implies debugging symbols, default is NO)]),
-	    [],
-	    [enable_coverage=no])
+	[],
+	[enable_coverage=no])
 
 # --enable-debugging-symbols
 AC_ARG_ENABLE(debugging-symbols,
 	AS_HELP_STRING([--enable-debugging-symbols],
 		[enable debugging symbols (default is NO)]),
-	    [],
-	    [enable_debugging_symbols=no])
+	[],
+	[enable_debugging_symbols=no])
 
 if test "$enable_coverage" != no; then
 	AC_DEFINE([ENABLE_COVERAGE], [1], [Define to 1 if code coverage is enabled.])
@@ -843,6 +843,14 @@ if test "$enable_debugging_symbols" != no; then
 	fi
 fi
 
+# --enable-oss-fuzz
+AC_ARG_ENABLE(oss-fuzz,
+	AS_HELP_STRING([--enable-oss-fuzz],
+		[enable build tweaks for OSS-Fuzz (default is NO)]),
+	[],
+	[enable_oss_fuzz=no])
+
+AM_CONDITIONAL(ENABLE_OSS_FUZZ, [test "$enable_oss_fuzz" != no])
 
 # Command line for compiling VCL code.  I wish there were a simple way
 # to figure this out dynamically without introducing a run-time


More information about the varnish-commit mailing list