]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#640] Fuzzing-related configure.ac updates
authorStephen Morris <stephen@isc.org>
Tue, 10 Dec 2019 16:11:02 +0000 (16:11 +0000)
committerStephen Morris <stephen@isc.org>
Fri, 20 Dec 2019 17:55:45 +0000 (17:55 +0000)
1. The switch to enable fuzzing is now "--enable-fuzzing".
2. A check is now made to see that the CXX environment variable
   points to an AFL-enabled compiler when the switch is modified.

configure.ac

index 6f292d6508ff7fc29eb9501cfb1b89326cd9875c..4a33cedc0906c56f869806c7a51b71f5137bfc9b 100755 (executable)
@@ -1460,14 +1460,22 @@ if test "x$VALGRIND" != "xno"; then
    found_valgrind="found"
 fi
 
-AC_ARG_ENABLE(fuzz, [AC_HELP_STRING([--enable-fuzz],
+AC_ARG_ENABLE([fuzzing], [AC_HELP_STRING([--enable-fuzzing],
   [indicates that the code will be built with AFL (American Fuzzy Lop) support.
    Code built this way is unusable as a regular server. [default=no]])],
-   enable_fuzz=$enableval, enable_fuzz=no)
-AM_CONDITIONAL(ENABLE_AFL, test x$enable_fuzz != xno)
+   [enable_fuzzing=$enableval], [enable_fuzzing=no])
+AM_CONDITIONAL([ENABLE_AFL], [test x$enable_fuzzing != xno])
 
-if test "x$enable_fuzz" != "xno" ; then
+if test "x$enable_fuzzing" != "xno" ; then
     AC_DEFINE([ENABLE_AFL], [1], [AFL fuzzing was enabled.])
+    AC_MSG_CHECKING([for AFL enabled compiler])
+    AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
+                                         [#ifndef __AFL_COMPILER
+                                          #error AFL compiler required
+                                          #endif
+                                         ])],
+                        [AC_MSG_RESULT([yes])],
+                        [AC_MSG_ERROR([set CXX to afl-clang-fast++ when --enable-fuzzing is used])])
 fi
 
 
@@ -1987,7 +1995,7 @@ Developer:
   Generate Messages Files:   $enable_generate_messages
   Perfdhcp:                  $enable_perfdhcp
   Kea-shell:                 $shell_report
-  Enable fuzz:               $enable_fuzz
+  Enable fuzzing:            $enable_fuzzing
 
 END