1From da21733178b34eea303964db5a05e8a3ee4095b4 Mon Sep 17 00:00:00 2001
2From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3Date: Sat, 26 Aug 2017 15:17:06 +0200
4Subject: [PATCH] build: make it possible to disable the build of the flex
5 program
6
7The flex program uses fork(), which isn't available on noMMU
8systems. However, the libfl library does not use fork(), and be used
9by other programs/libraries.
10
11Therefore, it makes sense to provide an option to disable the build of
12the flex program.
13
14Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
15Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
16
17---
18Submitted-upstream: https://github.com/westes/flex/pull/256
19Refused. We'll have to adapt when they do a new release...
20---
21 Makefile.am     | 2 ++
22 configure.ac    | 6 ++++++
23 doc/Makefile.am | 4 ++++
24 src/Makefile.am | 3 +++
25 4 files changed, 15 insertions(+)
26
27diff --git a/Makefile.am b/Makefile.am
28index e790e9d..8b57bc9 100644
29--- a/Makefile.am
30+++ b/Makefile.am
31@@ -62,8 +62,10 @@ ChangeLog: $(srcdir)/tools/git2cl
32 indent:
33 	cd src && $(MAKE) $(AM_MAKEFLAGS) indent
34
35+if ENABLE_PROGRAM
36 install-exec-hook:
37 	cd $(DESTDIR)$(bindir) && \
38 		$(LN_S) -f flex$(EXEEXT) flex++$(EXEEXT)
39+endif
40
41 .PHONY: ChangeLog indent
42diff --git a/configure.ac b/configure.ac
43index 8882016..f49872b 100644
44--- a/configure.ac
45+++ b/configure.ac
46@@ -75,6 +75,12 @@ AC_ARG_ENABLE([libfl],
47   [], [enable_libfl=yes])
48 AM_CONDITIONAL([ENABLE_LIBFL], [test "x$enable_libfl" = xyes])
49
50+AC_ARG_ENABLE([program],
51+  [AS_HELP_STRING([--disable-program],
52+                  [do not build the flex program, only the libfl library])],
53+  [], [enable_program=yes])
54+AM_CONDITIONAL([ENABLE_PROGRAM], [test "x$enable_program" = xyes])
55+
56 # --disable-bootstrap is intended only to workaround problems with bootstrap
57 # (e.g. when cross-compiling flex or when bootstrapping has bugs).
58 # Ideally we should be able to bootstrap even when cross-compiling.
59diff --git a/src/Makefile.am b/src/Makefile.am
60index 0d13a5a..c73bc17 100644
61--- a/src/Makefile.am
62+++ b/src/Makefile.am
63@@ -4,7 +4,10 @@ LIBS = @LIBS@
64
65 m4 = @M4@
66
67+if ENABLE_PROGRAM
68 bin_PROGRAMS = flex
69+endif
70+
71 if ENABLE_BOOTSTRAP
72 noinst_PROGRAMS = stage1flex
73 endif
74--
752.9.4
76
77