aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2022-07-10 14:47:46 -0700
committerGuy Harris <gharris@sonic.net>2022-07-10 14:47:46 -0700
commitd9af4e9fc6aea75780163348497c08f128bb8274 (patch)
tree813861e47125a8c36388a92e6684d83fbfc30893 /CMakeLists.txt
parent88c1b88f78b3caf7cb887a478dc8dac00e6e3acc (diff)
CMake: check for a usable YACC.
As we do in autotools, if we find YACC rather than Bison, check whether it supports -V, to make sure it's Berkeley YACC not AT&T YACC.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 764e95da..fb545516 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2118,6 +2118,25 @@ endif()
if(YACC_EXECUTABLE MATCHES "byacc" OR YACC_EXECUTABLE MATCHES "yacc")
#
+ # Make sure this is Berkeley YACC, not AT&T YACC;
+ # the latter doesn't support reentrant parsers.
+ # Run it with "-V"; that succeeds and reports the
+ # version number with Berkeley YACC, but will
+ # (probably) fail with various vendor flavors
+ # of AT&T YACC.
+ #
+ # Hopefully this also eliminates any versions
+ # of Berkeley YACC that don't support reentrant
+ # parsers, if there are any.
+ #
+ execute_process(COMMAND ${YACC_EXECUTABLE} -V OUTPUT_QUIET
+ RESULT_VARIABLE EXIT_STATUS)
+ if(NOT EXIT_STATUS EQUAL 0)
+ message(FATAL_ERROR "${YACC_EXECUTABLE} is insufficient to compile libpcap.
+libpcap requires Bison, a newer version of Berkeley YACC with support
+for reentrant parsers, or another YACC compatible with them.")
+ endif()
+ #
# Berkeley YACC doesn't support "%define api.pure", so use
# "%pure-parser".
#