From 18fb90545d124c21abcaeab8826c05a41cecdc75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arnim=20L=C3=A4uger?= Date: Fri, 18 Jan 2008 22:59:06 +0000 Subject: [PATCH] restructured the test logic for bison error locations and the BSDL subsystem [ 1873515 ] BSDL part doesn't compile under Cygwin git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@930 b68d4a1b-bc3d-0410-92ed-d4ac073336b7 --- jtag/ChangeLog | 6 ++ jtag/configure.ac | 143 ++++++++++++++++++++++++++++---------------- jtag/doc/ChangeLog | 4 ++ jtag/doc/UrJTAG.txt | 34 ++++++++--- 4 files changed, 129 insertions(+), 58 deletions(-) diff --git a/jtag/ChangeLog b/jtag/ChangeLog index 6fc7bbc6..d9a3094c 100644 --- a/jtag/ChangeLog +++ b/jtag/ChangeLog @@ -1,3 +1,9 @@ +2008-01-18 Arnim Laeuger + + * configure.ac: restructured the test logic for bison error locations and the + the BSDL subsystem + [ 1873515 ] BSDL part doesn't compile under Cygwin + 2008-01-18 Kolja Waschk * Moved the code from libbrux/ subdirectory into appropriate locations in diff --git a/jtag/configure.ac b/jtag/configure.ac index ff51719d..7d9ff1f6 100644 --- a/jtag/configure.ac +++ b/jtag/configure.ac @@ -86,53 +86,6 @@ AC_PROG_CC AC_PROG_RANLIB AC_PROG_YACC -# check for lex/flex -AC_PROG_LEX -# check for modern version of flex -AC_PROG_AWK -AC_PROG_SED -if test "$LEX" == flex ; then - # compare >= 2.5.31 - flex_ref_v1=2 - flex_ref_v2=5 - flex_ref_v3=31 - flex_ref_version="$flex_ref_v1.$flex_ref_v2.$flex_ref_v3" - AC_MSG_CHECKING([for flex >= $flex_ref_version]) - - modern_flex=no - flex_version=`$LEX --version | $AWK '{print $2}'` - if test "$flex_version" == "version" ; then - flex_version=`$LEX --version | $AWK '{print $3}'` - fi - - flex_v1=`echo $flex_version | $AWK -F . '{print $1}' | $SED -e 's/[a-zA-Z]//g'` - flex_v2=`echo $flex_version | $AWK -F . '{print $2}' | $SED -e 's/[a-zA-Z]//g'` - flex_v3=`echo $flex_version | $AWK -F . '{print $3}' | $SED -e 's/[a-zA-Z]//g'` - - if test -n "$flex_v1" -a "$flex_v1" -gt "$flex_ref_v1" ; then - modern_flex=yes - fi - if test -n "$flex_v1" -a "$flex_v1" -eq "$flex_ref_v1" ; then - if test "$flex_v2" -gt "$flex_ref_v2" ; then - modern_flex=yes - fi - if test "$flex_v2" -eq "$flex_ref_v2" ; then - if test "$flex_v3" -ge "$flex_ref_v3" ; then - modern_flex=yes - fi - fi - fi - - if test "$modern_flex" == yes ; then - AC_MSG_RESULT([yes - flex $flex_version]) - AM_CONDITIONAL([BISON_LOCATIONS], true) - else - AC_MSG_RESULT([no - flex $flex_version]) - AM_CONDITIONAL([BISON_LOCATIONS], false) - fi -else - AM_CONDITIONAL([BISON_LOCATIONS], false) -fi AC_SEARCH_LIBS([ioperm], [ioperm]) if test "$ac_cv_search_ioperm" != "no"; then @@ -283,7 +236,7 @@ CFLAGS="$CFLAGS -Wall" CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/include" -dnl Disable SVF player? +dnl Enable SVF player? AC_ARG_ENABLE(svf, [ --enable-svf Enable SVF player (default is enabled)], [case "${enableval}" in @@ -300,7 +253,95 @@ AS_IF([test "x$svf" = xtrue], [ ]) -dnl Disable BSDL subsystem? +# check for lex/flex +AC_PROG_LEX +# check for modern version of flex +AC_PROG_AWK +AC_PROG_SED + +AS_IF([test "$LEX" == flex], [ + ver_ge_ver () { + v1=$1 + v2=$2 + v3=$3 + ref_v1=$4 + ref_v2=$5 + ref_v3=$6 + + AS_IF([test -n "$v1" -a "$v1" -gt "$ref_v1"], [ + return 0 + ]) + AS_IF([test -n "$v1" -a "$v1" -eq "$ref_v1"], [ + AS_IF([test "$v2" -gt "$ref_v2"], [ + return 0 + ]) + AS_IF([test "$v2" -eq "$ref_v2"], [ + AS_IF([test "$v3" -ge "$ref_v3"], [ + return 0 + ]) + ]) + ]) + + return 1 + } + + flex_version=`$LEX --version | $AWK '{print $2}'` + AS_IF([test "$flex_version" == "version"], [ + flex_version=`$LEX --version | $AWK '{print $3}'` + ]) + + flex_v1=`echo $flex_version | $AWK -F . '{print $1}' | $SED -e 's/[a-zA-Z]//g'` + flex_v2=`echo $flex_version | $AWK -F . '{print $2}' | $SED -e 's/[a-zA-Z]//g'` + flex_v3=`echo $flex_version | $AWK -F . '{print $3}' | $SED -e 's/[a-zA-Z]//g'` + + # bison error locations require flex >= 2.5.31 + flex_ref_v1=2 + flex_ref_v2=5 + flex_ref_v3=31 + flex_ref_version="$flex_ref_v1.$flex_ref_v2.$flex_ref_v3" + AC_MSG_CHECKING([for flex >= $flex_ref_version, required for SVF error locations]) + # + AS_IF([ver_ge_ver $flex_v1 $flex_v2 $flex_v3 $flex_ref_v1 $flex_ref_v2 $flex_ref_v3], [ + AC_MSG_RESULT([yes - flex $flex_version]) + AM_CONDITIONAL([BISON_LOCATIONS], true) + bison_locations=yes + ], [ + AC_MSG_RESULT([no - flex $flex_version]) + AM_CONDITIONAL([BISON_LOCATIONS], false) + bison_locations=no + ]) + + # bsdl lexer requires flex >= 2.5.33 + flex_ref_v1=2 + flex_ref_v2=5 + flex_ref_v3=33 + flex_ref_version="$flex_ref_v1.$flex_ref_v2.$flex_ref_v3" + AC_MSG_CHECKING([for flex >= $flex_ref_version, required for BSDL lexer]) + # + AS_IF([ver_ge_ver $flex_v1 $flex_v2 $flex_v3 $flex_ref_v1 $flex_ref_v2 $flex_ref_v3], [ + AC_MSG_RESULT([yes - flex $flex_version]) + bsdl_lexer=true + ], [ + AC_MSG_RESULT([no - flex $flex_version]) + bsdl_lexer=false + ]) +], [ + bison_locations=no + AM_CONDITIONAL([BISON_LOCATIONS], false) + bsdl_lexer=false +]) + + +dnl If the transformed bsdl_flex.c is already existing, it doesn't matter +dnl that flex is too old for building the lexer. +AS_IF([test "x$bsdl_lexer" == xfalse], [ + AS_IF([test -r src/bsdl/bsdl_flex.c], [ + bsdl_lexer=true + ]) +]) + + +dnl Enable BSDL subsystem? AC_ARG_ENABLE(bsdl, [ --enable-bsdl Enable BSDL subsystem (default is enabled)], [case "${enableval}" in @@ -308,7 +349,7 @@ AC_ARG_ENABLE(bsdl, no) bsdl=false ;; *) AC_MSG_ERROR(bad value ${enableval} for --enable-bsdl) ;; esac], -[bsdl=true]) +[bsdl=$bsdl_lexer]) AS_IF([test "x$bsdl" = xtrue], [ AM_CONDITIONAL(ENABLE_BSDL, true) AC_DEFINE(ENABLE_BSDL, 1, [define if BSDL subsystem is enabled]) @@ -353,7 +394,7 @@ jtag is now configured for FTDI cable support via libftdi : $FLAG_HAVELIBFTDI via libftd2xx : $FLAG_HAVELIBFTD2XX - SVF error locations : $modern_flex ($LEX $flex_version) + SVF error locations : $bison_locations Build SVF player : $FLAG_SVF Build BSDL subsystem : $FLAG_BSDL ]) diff --git a/jtag/doc/ChangeLog b/jtag/doc/ChangeLog index 3b45fe2f..b0a263a1 100644 --- a/jtag/doc/ChangeLog +++ b/jtag/doc/ChangeLog @@ -1,3 +1,7 @@ +2008-01-18 Arnim Laeuger + + * UrJTAG.txt (packages): Some notes about Flex & BSDL + 2007-12-30 Arnim Laeuger * UrJTAG.txt (Example): Added contents from README.svf, new section on BSDL diff --git a/jtag/doc/UrJTAG.txt b/jtag/doc/UrJTAG.txt index e2f8376d..3c95bf27 100644 --- a/jtag/doc/UrJTAG.txt +++ b/jtag/doc/UrJTAG.txt @@ -1,7 +1,7 @@ Universal JTAG library, server and tools ======================================== Kolja Waschk (Ed.) -$Id $ +$Id$ ///////////////////////////////////////////////////////////////////////////// This document is formatted to be readable for "asciidoc". Before you @@ -267,7 +267,10 @@ be untested combinations of chip type, bus width, ... To run autogen.sh, you need autoconf and automake, bison, and a recent flex. Flex 2.5.4a as it comes with Cygwin will work but some parts of UrJTAG (namely -the SVF player) become more verbose if Flex 2.5.31 or newer is used. +the SVF player) become more verbose if Flex 2.5.31 or newer is used. Building +the BSDL subsystem files requires Flex 2.5.33 or newer. The configure script +will compare the availble Flex version against these preconditions and enables +or disables the related features. Furthermore, libtool should be available, and "devel" versions of the following packages: @@ -352,6 +355,23 @@ Configure should now report via libftdi : no via libftd2xx : yes +==== Building the BSDL subsystem ==== + +As mentioned above, building the BSDL lexer requires Flex 2.5.33 or newer. If +the detected Flex version is not recent enough, configure will disable the +BSDL subsystem. The detection result is summarized at the end of configure: + + jtag is now configured for + ... + Build BSDL subsystem : yes + +Flex is only required when you're working on a check-out of the Subversion +repository. In this case Flex has to be called to transform bsdl_flex.l to +bsdl_flex.c. When you're compiling from released sources, the local Flex +version is not relevant since the output file of Flex is part of the +tarball. I.e. even if the local Flex fails the check, the BSDL subsystem is +enabled and will be compiled from the released C files. + //========================================================================= == Usage == @@ -723,13 +743,13 @@ this standard process follows. To tell the BSDL subsytem where to look for BSDL files, the 'bsdl path pathlist' command has to be issued prior to 'detect'. The contents of 'pathlist' must be a semicolon-separated list of directories where BSDL files -are located. This list is stored by 'bsdl path' and used lateron when 'detect' -calls the BSDL subsystem. +are located. This list is stored by 'bsdl path' and is used lateron when +'detect' calls the BSDL subsystem. IMPORTANT: The BSDL subsystem applies the first BSDL file that parses without -errors and contains the correct IDCODE. Scanning the specified directories -happens in extactly the given order. Inside a directory however, the order -depends largely on your filesystem's behavior. +errors and that contains the correct IDCODE. Scanning the specified +directories happens in extactly the given order. Inside a directory however, +the order depends largely on your filesystem's behavior. Further details of the 'bsdl' command: