From 09220190683cf9170953b09e82759d442dde95c0 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 5 Apr 2010 21:08:30 +0530 Subject: [PATCH 1/4] added flex version check in configure.ac --- configure.ac | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/configure.ac b/configure.ac index 50edf645c..157a6114c 100644 --- a/configure.ac +++ b/configure.ac @@ -170,11 +170,6 @@ if test "x$CMP" = x; then AC_MSG_ERROR([cmp is not found]) fi -AC_CHECK_PROGS([LEX], [flex]) -if test "x$LEX" = x; then - AC_MSG_ERROR([flex is not found]) -fi - AC_CHECK_PROGS([YACC], [bison]) if test "x$YACC" = x; then AC_MSG_ERROR([bison is not found]) @@ -188,10 +183,23 @@ for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz /usr/s done AC_PROG_INSTALL +AC_PROG_SED AC_PROG_AWK +AC_PROG_LEX AC_PROG_MAKE_SET AC_PROG_MKDIR_P +if test "x$LEX" = x; then + AC_MSG_ERROR([flex is not found]) +else + version=`$LEX --version 2>/dev/null | $SED -e 's/flex //' | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 100 + $2) * 100 + $3;}'` + if test -n "$version" -a test "$version" -ge 205035; then + : + else + AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above]) + fi +fi + # These are not a "must". AC_PATH_PROG(RUBY, ruby) AC_PATH_PROG(MAKEINFO, makeinfo) From b777c18e388b55230058fdae5e0a120307b5430d Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Mon, 5 Apr 2010 21:47:19 +0530 Subject: [PATCH 2/4] fixed version canonicalization --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 157a6114c..1f55a9ca7 100644 --- a/configure.ac +++ b/configure.ac @@ -192,8 +192,8 @@ AC_PROG_MKDIR_P if test "x$LEX" = x; then AC_MSG_ERROR([flex is not found]) else - version=`$LEX --version 2>/dev/null | $SED -e 's/flex //' | $AWK 'BEGIN { FS = "."; } { printf "%d", ($1 * 100 + $2) * 100 + $3;}'` - if test -n "$version" -a test "$version" -ge 205035; then + version=`$LEX --version 2>/dev/null | $SED -e 's/flex //' | $AWK 'BEGIN { FS = "."; } { printf "%d", $1 * 10000 + $2 * 100 + $3;}'` + if test -n "$version" -a "$version" -ge 20535; then : else AC_MSG_ERROR([flex is too old. GRUB requires 2.5.35 or above]) From 4ee717e12b0a98c0763ac87e9fd27ad38a91b3f4 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Tue, 6 Apr 2010 14:39:11 +0530 Subject: [PATCH 3/4] fix freebsd build --- conf/common.rmk | 2 +- configure.ac | 2 +- script/yylex.l | 6 ------ 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/conf/common.rmk b/conf/common.rmk index 87ae1e202..a83d10662 100644 --- a/conf/common.rmk +++ b/conf/common.rmk @@ -653,7 +653,7 @@ normal_mod_LDFLAGS = $(COMMON_LDFLAGS) # For sh.mod. sh_mod_SOURCES = script/main.c script/script.c script/execute.c \ script/function.c script/lexer.c grub_script.tab.c grub_script.yy.c -sh_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS) +sh_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS) -Wno-error sh_mod_LDFLAGS = $(COMMON_LDFLAGS) ifneq (, $(FONT_SOURCE)) diff --git a/configure.ac b/configure.ac index 1f55a9ca7..0af597bd3 100644 --- a/configure.ac +++ b/configure.ac @@ -192,7 +192,7 @@ AC_PROG_MKDIR_P if test "x$LEX" = x; then AC_MSG_ERROR([flex is not found]) else - version=`$LEX --version 2>/dev/null | $SED -e 's/flex //' | $AWK 'BEGIN { FS = "."; } { printf "%d", $1 * 10000 + $2 * 100 + $3;}'` + version=`$LEX --version 2>/dev/null | $SED -e 's/flex//' -e 's/version//' | $AWK -F "." '{ printf "%d", $1 * 10000 + $2 * 100 + $3;}'` if test -n "$version" -a "$version" -ge 20535; then : else diff --git a/script/yylex.l b/script/yylex.l index 4d7c66448..0cf33c951 100644 --- a/script/yylex.l +++ b/script/yylex.l @@ -86,12 +86,6 @@ typedef size_t yy_size_t; #define exit(...) #endif -#pragma GCC diagnostic warning "-Wunused-variable" -#pragma GCC diagnostic warning "-Wunused-function" -#pragma GCC diagnostic warning "-Wunused-parameter" -#pragma GCC diagnostic warning "-Wstrict-prototypes" -#pragma GCC diagnostic warning "-Wmissing-prototypes" - } %option ecs From 2663fb5f046251e7b7e68d55843e28a63de82b18 Mon Sep 17 00:00:00 2001 From: BVK Chaitanya Date: Sat, 10 Apr 2010 18:06:45 +0530 Subject: [PATCH 4/4] flex version check is now done by awk alone --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 0af597bd3..08260eae5 100644 --- a/configure.ac +++ b/configure.ac @@ -192,7 +192,7 @@ AC_PROG_MKDIR_P if test "x$LEX" = x; then AC_MSG_ERROR([flex is not found]) else - version=`$LEX --version 2>/dev/null | $SED -e 's/flex//' -e 's/version//' | $AWK -F "." '{ printf "%d", $1 * 10000 + $2 * 100 + $3;}'` + version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'` if test -n "$version" -a "$version" -ge 20535; then : else