From 79bd5f342f8d1490104e0ae85ce35c2cee7107fc Mon Sep 17 00:00:00 2001 From: Kolja Waschk Date: Sun, 9 Dec 2007 20:08:47 +0000 Subject: [PATCH] svf_flex now internally detects whether to assume --bison-locations or not git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@830 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 1 + jtag/configure.ac | 1 - jtag/src/svf/svf_flex.l | 19 +++++++++++++++---- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index cdfda448..6f890978 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -3,6 +3,7 @@ * configure.ac: Improve detection of flex version, get Subversion revision from 1. svn info, or 2. ChangeLog, or 3. Revision tag, auto-detect whether -lrt is needed + * src/svf/svf_flex.l: derive HAVE_MODERN_FLEX internally * src/jtag.c: show version from config.h, compile without readline * src/version.awk: not needed; SVN info now available in config.h * src/Makefile.am: removed -lrt link and version.h target diff --git a/jtag/configure.ac b/jtag/configure.ac index ae5aa1b8..54281f2e 100644 --- a/jtag/configure.ac +++ b/jtag/configure.ac @@ -112,7 +112,6 @@ if test "$LEX" == flex ; then fi if test "$modern_flex" == yes ; then - AC_DEFINE([HAVE_MODERN_FLEX], 1, [Define if flex version is >= $flex_ref_version]) AC_MSG_RESULT([yes - flex $flex_version]) AM_CONDITIONAL([BISON_LOCATIONS], true) else diff --git a/jtag/src/svf/svf_flex.l b/jtag/src/svf/svf_flex.l index 416551ca..e17e376d 100644 --- a/jtag/src/svf/svf_flex.l +++ b/jtag/src/svf/svf_flex.l @@ -28,9 +28,10 @@ * Note: This lexer supports bison_locations if HAVE_MODERN_FLEX is defined. Apart from this, the option --bison-locations has to be specified on the command line. - Both the define and the command line option are controlled - by the configure script that enables this feature based on - the available version of flex. + The command line option is controlled by the configure + script that enables this feature based on the available + version of flex. The #define is derived below from the version + information that flex itself embeds in the *.c output. */ @@ -45,7 +46,17 @@ static int map_keyw_ident(YYSTYPE *, char *); static void align_string(char *); -/* autodetected by configure based on current flex version */ +#ifdef YY_FLEX_MAJOR_VERSION + #if (YY_FLEX_MAJOR_VERSION > 2) ||\ + ((YY_FLEX_MAJOR_VERSION == 2) && ((YY_FLEX_MINOR_VERSION > 5) \ + || ((YY_FLEX_MINOR_VERSION == 5) && (YY_FLEX_SUBMINOR_VERSION >= 31)))) + #undef HAVE_MODERN_FLEX + #define HAVE_MODERN_FLEX 1 + #else + #undef HAVE_MODERN_FLEX + #endif +#endif + #ifdef HAVE_MODERN_FLEX static void fix_yylloc(YYLTYPE *, char *); static void fix_yylloc_nl(YYLTYPE *, char *);