On Mon, Aug 01, 2016 at 04:22:37PM +1000, Brendan O'Dea wrote:
> On Sun, Jul 31, 2016 at 03:40:14PM -0400, Thomas Dickey wrote:
> >I normally don't build with "new" flex, but took a look today and had
> >no problem building with the version in testing (which appears to match
> >that in experimental).
> >
> >What is the problem that you are seeing when building?
> 
> The problem is not with building, but that the resulting .so refers to, but
> doesn't define the whatever_wrap() function, so dynamic linking fails.
> 
> configure doesn't cope with the new version in so far as to say that it
> expects to find flex >= 2.5 and <= 2.6, but the substitution on line 259 of
> configure.in doesn't cope with 2.6:
> 
>   sed -e 's/^2.5.//
> 
> resulting in this output from configure:
> 
>   checking version of flex... 2.6.0
>   ../configure: 5316: test: Illegal number: 2.6.0

I did notice that yesterday, but since it built, didn't look too closely.
 
> at the time I didn't look too deeply, but just figured that it was simplest to
> go back to flex-old (2.5.4) and will probably just stick with that for now.
> 
> For reference, I ran configure with flex-old (2.5.4), the newest version of
> flex I could find in the archive >= 2.5 (2.5.39), and the current version
> (2.6.0).  I then generated mailfilt.c for each.  See attached.
> 
> All three produced an identical config.h.
> 
> I suspect that the actual problem is this code in filters/filters.h (line
> 157):
> 
>   #if defined(FLEX_SCANNER) && defined(FLEX_BETA)

...so after ten years, it's no longer a beta.  I can fix this :-)

>   #define YY_SKIP_YYWRAP
>   #define yywrap() private_yywrap()
>   #define USE_LEXWRAP(name) static int private_yywrap(void) { return 1; }
>   #else
>   #define USE_LEXWRAP(name) /* nothing */
>   #endif
> 
> which doesn't choose the first case on 2.6.0, since FLEX_BETA is not defined.
> See this fragment from the generated mailfilt.c:
> 
>   #define FLEX_SCANNER
>   #define YY_FLEX_MAJOR_VERSION 2
>   #define YY_FLEX_MINOR_VERSION 6
>   #define YY_FLEX_SUBMINOR_VERSION 0
>   #if YY_FLEX_SUBMINOR_VERSION > 0
>   #define FLEX_BETA
>   #endif
> 
> the equivalent code for 2.5.x works since YY_FLEX_SUBMINOR_VERSION is
> non-zero.
> 
> Out of curiosity, why does USE_LEXWRAP take an option?  It doesn't appear to
> do anything with it.

It's used a little later in filters.h:

        /*
         * We'll put a DefineFilter() in each filter program.  To handle 
special cases
         * such as c-filt.c, use DefineOptFilter().
         */
        #define DefineOptFilter(name,options) \
        USE_LEXWRAP(name##_wrap) \
        static void init_filter(int before); \
        static void do_filter(FILE *Input); \
        DCL_LEXFREE \
        FILTER_DEF filter_def = { #name, 1, init_filter, do_filter, options 
REF_LEXFREE }

and FILTER_DEF is used in builtflt.c (the main programs list of linkages).

-- 
Thomas E. Dickey <dic...@invisible-island.net>
http://invisible-island.net
ftp://invisible-island.net

Attachment: signature.asc
Description: Digital signature

Reply via email to