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