Make perl & examples optional

Thomas Deutschmann <[email protected]>
Newsgroups gmane.comp.parsers.bison.bugs
Organization Gentoo Foundation, Inc
Message-ID <[email protected]>
Hi,

in Gentoo Linux we are carrying the following patch for quite some time
to make perl dependency which is required for examples optional.

Any chance to get this applied upstream?


-- 
Regards,
Thomas Deutschmann / Gentoo Linux Developer
C4DD 695F A713 8F24 2AA1 5638 5849 7EE5 1D5D 74A5
bison-3.5-optional-perl.patch (text/plain, 1.6 KB)
From 8fcea58bfb3e45cb19ce8a29d0ce10188d866555 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <[email protected]>
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
signature.asc (application/pgp-signature, 618 B)
-----BEGIN PGP SIGNATURE-----

iQGTBAEBCgB9FiEEExKRzo+LDXJgXHuURObr3Jv2BVkFAl9U9QNfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDEz
MTI5MUNFOEY4QjBENzI2MDVDN0I5NDQ0RTZFQkRDOUJGNjA1NTkACgkQRObr3Jv2
BVkxWgf/c22kvrBu7LobKHOoYY26aNeHm0e+PoZz6Vap+ah4i/kkyxCCvUAMHi2P
NmovIQOEygnpJS9Guu7RUP+nwpBQG2aCVo24JcYGgNJhNEV430NMO33jfZL2oEM2
BCtQvnSvzcG0IYZvgJuLtOs/h+Y5u0IAOmPOyheJOSfOyDjgNfJYYGr/K3wcyHop
bBAa5UX/Ck950rO27+D5FpQoiCKgSN6VPjBUATDTBpqcaHUgqfobXlcWb4sue57r
UXhRLA0JNUIDk+jMRS0u5LIlumYul3R3r9FsjxxAvi+9r+UT1GHUGD/2EWreACfM
yGkX2YlvViSutvr9mChvlMysX5mknw==
=CbwU
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.