[Mesa-dev] [PATCH] build: check for flex and bison at configuration time.

Sam Hocevar sam at hocevar.net
Wed Feb 16 14:38:10 PST 2011


Fix the Makefiles so that they use $(FLEX) and $(BISON) instead of
flex and bison, so that the user may specify a different path for
them.

Signed-off-by: Sam Hocevar <sam at hocevar.net>
---

   This is only a suggestion but I found it pretty handy to decide
which version of bison to use. Also, I suggest making the configuration
step abort if neither bison or flex were found, to avoid unexpected
build fails.

 configure.ac              |    2 ++
 src/glsl/Makefile         |    8 ++++----
 src/mesa/program/Makefile |    4 ++--
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 46d3516..135bf05 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,6 +34,8 @@ AC_CHECK_PROGS([MAKE], [gmake make])
 AC_CHECK_PROGS([PYTHON2], [python2 python])
 AC_PATH_PROG([MKDEP], [makedepend])
 AC_PATH_PROG([SED], [sed])
+AC_PATH_PROG([FLEX], [flex])
+AC_PATH_PROG([BISON], [bison])
 
 if test "x$MKDEP" = "x"; then
     AC_MSG_ERROR([makedepend is required to build Mesa])
diff --git a/src/glsl/Makefile b/src/glsl/Makefile
index cf8d4b1..170fd3f 100644
--- a/src/glsl/Makefile
+++ b/src/glsl/Makefile
@@ -192,16 +192,16 @@ $(DRICORE_OBJ_DIR)/%.o : %.c
 	$(CC) -c $(INCLUDES) $(DRI_CFLAGS) $(DEFINES) $< -o $@
 
 glsl_lexer.cpp: glsl_lexer.lpp
-	flex --nounistd -o$@  $<
+	$(FLEX) --nounistd -o$@  $<
 
 glsl_parser.cpp: glsl_parser.ypp
-	bison -v -o "$@" -p "_mesa_glsl_" --defines=glsl_parser.h $<
+	$(BISON) -v -o "$@" -p "_mesa_glsl_" --defines=glsl_parser.h $<
 
 glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
-	flex --nounistd -o$@  $<
+	$(FLEX) --nounistd -o$@  $<
 
 glcpp/glcpp-parse.c: glcpp/glcpp-parse.y
-	bison -v -o "$@" --defines=glcpp/glcpp-parse.h $<
+	$(BISON) -v -o "$@" --defines=glcpp/glcpp-parse.h $<
 
 builtin_compiler: $(GLSL2_OBJECTS) $(OBJECTS) builtin_stubs.o
 	$(APP_CXX) $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(OBJECTS) $(GLSL2_OBJECTS) builtin_stubs.o -o $@
diff --git a/src/mesa/program/Makefile b/src/mesa/program/Makefile
index 400a543..971a5f3 100644
--- a/src/mesa/program/Makefile
+++ b/src/mesa/program/Makefile
@@ -1,7 +1,7 @@
 all: program_parse.tab.c lex.yy.c
 
 program_parse.tab.c program_parse.tab.h: program_parse.y
-	bison -v -d $<
+	$(BISON) -v -d $<
 
 lex.yy.c: program_lexer.l
-	flex --never-interactive $<
+	$(FLEX) --never-interactive $<
-- 
1.7.2.3


More information about the mesa-dev mailing list