Skip to contentSkip to conversation

libxl/build: print a pretty message if flex/bison are needed but not found

PATCH Superseded Roger Pau Monne 2 participants 2 messages Apr 13, 2012 – Apr 24, 2012

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxl/build: print a pretty message if flex/bison are needed but not found

This patchs adds better support for both Flex and Bison, which might be needed to compile libxl. Now configure script sets BISON and FLEX Makefile vars if bison and flex are found, but doesn't complain if they are not found.

Also, added some Makefile soccery to print a nice error message if Bison or Flex are needed but not found.

Please run autogen after applying this patch.

Cc zhihao wang <[email protected]>
Cc Ian Campbell <[email protected]>
---
 tools/configure.ac   |    2 ++
 tools/libxl/Makefile |   16 ++++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
tools/configure.ac +2 -0
index 3da0c82..8ccdc92 100644
@@ -75,6 +75,8 @@ AC_PROG_CC
 AC_PROG_LN_S
 AC_PROG_MAKE_SET
 AC_PROG_INSTALL
+AC_PATH_PROG([BISON], [bison])
+AC_PATH_PROG([FLEX], [flex])
 AX_PATH_PROG_OR_FAIL([PERL], [perl])
 AS_IF([test "x$xapi" = "xy"], [
     AX_PATH_PROG_OR_FAIL([CURL], [curl-config])
tools/libxl/Makefile +14 -2
index ac8b810..e8ec8e9 100644
@@ -48,6 +48,18 @@ please check libxl_linux.c and libxl_netbsd.c to see how to get it ported)
 endif
 endif
 
+ifeq ($(FLEX),)
+%.c %.h:: %.l
+	$(error Flex is needed to compile libxl, please install it and rerun \
+	configure)
+endif
+
+ifeq ($(BISON),)
+%.c %.h:: %.y
+	$(error Bison is needed to compile libxl, please install it an rerun \
+	configure)
+endif
+
 LIBXL_LIBS += -lyajl
 
 LIBXL_OBJS = flexarray.o libxl.o libxl_create.o libxl_dm.o libxl_pci.o \
@@ -83,11 +95,11 @@ all: $(CLIENTS) libxenlight.so libxenlight.a libxlutil.so libxlutil.a \
 
 $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS): $(AUTOINCS)
 
-%.c %.h: %.y
+%.c %.h:: %.y
 	@rm -f $*.[ch]
 	$(BISON) --output=$*.c $<
 
-%.c %.h: %.l
+%.c %.h:: %.l
 	@rm -f $*.[ch]
 	$(FLEX) --header-file=$*.h --outfile=$*.c $<
 
Signature · 1 line
1.7.7.5 (Apple Git-26)
#1 lore raw

Roger Pau Monne writes ("[Xen-devel] [PATCH] libxl/build: print a pretty message if flex/bison are needed but not found"):

Quoted 3 lines

This patchs adds better support for both Flex and Bison, which might be needed to compile libxl. Now configure script sets BISON and FLEX Makefile vars if bison and flex are found, but doesn't complain if they are not found.

Please see my recent comments in response to Jean Guyader's related patch.

Thanks,
Ian.