You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/sys-devel/bison/files/bison-3.0.4-optional-perl.p...

73 lines
2.0 KiB

https://bugs.gentoo.org/538300
From 3da25ddd011c169b9857ed2f6a2e82988f059ba5 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Fri, 3 Apr 2015 02:39:21 -0400
Subject: [PATCH] make perl & examples optional
The normal bison program does not require perl to build or run, so lets
soften that requirement in the configure script. We now warn if its not
found, and we make the examples logic depend on that.
* configure.ac: Change AC_MSG_ERROR to AC_MSG_WARN for perl.
Add an --enable-examples flag.
* Makefile.am: Only include examples/local.mk when ENABLE_EXAMPLES.
---
Makefile.am | 2 ++
configure.ac | 21 ++++++++++++++++++++-
2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/Makefile.am b/Makefile.am
index b6135cb..50ea0a0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -59,7 +59,9 @@ include data/local.mk
include djgpp/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 6f20040..e67249b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -179,12 +179,31 @@ AC_DEFINE_UNQUOTED([M4_GNU_OPTION], ["$M4_GNU"], [Define to "-g" if GNU M4
supports -g, otherwise to "".])
AC_PATH_PROG([PERL], [perl])
if test -z "$PERL"; then
- AC_MSG_ERROR([perl not found])
+ AC_MSG_WARN([perl required for the testsuites])
fi
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 "xenable_examples" = xyes])
+
# Checks for header files.
AC_CHECK_HEADERS_ONCE([locale.h])
--
2.3.4