From 8fcea58bfb3e45cb19ce8a29d0ce10188d866555 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Thu, 12 Dec 2019 08:47:20 +0100 Subject: [PATCH] make perl & examples optional The normal bison program does not require perl to build or run. We make the examples logic depend on perl. * configure.ac: Add an --enable-examples flag. * Makefile.am: Only include examples/local.mk when ENABLE_EXAMPLES. --- Makefile.am | 2 ++ configure.ac | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/Makefile.am b/Makefile.am index eeb348e4..934fda65 100644 --- a/Makefile.am +++ b/Makefile.am @@ -68,7 +68,9 @@ include build-aux/local.mk include data/local.mk include doc/local.mk include etc/local.mk +if ENABLE_EXAMPLES include examples/local.mk +endif include lib/local.mk include src/local.mk include tests/local.mk diff --git a/configure.ac b/configure.ac index 7a80eac1..84fec006 100644 --- a/configure.ac +++ b/configure.ac @@ -244,6 +244,25 @@ AM_MISSING_PROG([HELP2MAN], [help2man]) AC_PATH_PROG([XSLTPROC], [xsltproc]) AC_SUBST([XSLTPROC]) +AC_ARG_ENABLE([examples], + [AC_HELP_STRING([--disable-examples], + [do not build and install examples])]) +# Enable the examles by default if perl is available. +case $enable_examples in +no) ;; +yes) + if test -z "$PERL"; then + AC_MSG_ERROR([perl required for the examples]) + fi + ;; +*) + if test -n "$PERL"; then + enable_examples=yes + fi + ;; +esac +AM_CONDITIONAL([ENABLE_EXAMPLES], [test "x$enable_examples" = xyes]) + # Checks for header files. AC_CHECK_HEADERS_ONCE([locale.h]) -- 2.24.1