helpAutoconf - Support: sr #109320, _AC_PROG_LEX_YYTEXT_DECL fails to...


sr #109320: _AC_PROG_LEX_YYTEXT_DECL fails to compute LEXLIB correctly using the original AT&T lex if Xcode's flex is installed

Submitted by:  None
Submitted on:  Tue 23 May 2017 01:04:53 AM UTC  
Category: NonePriority: 5 - Normal
Severity: 3 - NormalStatus: None
Privacy: PublicAssigned to: None
Originator Email: -unavailable-Open/Closed: Open
Operating System: Mac OS

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Tue 23 May 2017 01:04:53 AM UTC, original submission:

Mac OS installs flex (obsolete version 2.5.35) as a part of Xcode's command line tools, with it's library installed as /usr/lib/libl.a.

I have a copy of a more recent flex (version 2.6.1) installed in /usr/local/bin, with its library installed as /usr/local/lib/libfl.a.

I also have a copy of the 4.3BSD version of lex installed in /usr/local/bin, with it's library installed as /usr/local/lib/libl.a.

I have a package that I want to be able to build with either lex or flex.

If I force AC_PROG_LEX to use lex rather than flex when running configure, the AC_LINK_IFELSE test located in _AC_PROG_LEX_YYTEXT_DECL fails for all choices ('', -lfl, -ll) but the AC_PROG_LEX macro completes with output message "none needed" (and with LEXLIB empty).

It took me a bit of head scratching until I understood what was happening: The loop running AC_LINK_IFELSE is not distinguishing between termination with success ("break" out of the loop) and termination with failure (normal completion of the loop). The AC_LINK_IFELSE fails when I force the use of lex because it tries to use the (incorrectly named) 'flex' link library /usr/lib/libl.a, since the default library search path is /usr/lib then /usr/local/lib.

I can, of course, work around this defect in _AC_PROG_LEX_YYTEXT_DECL by setting LDFLAGS="-L/usr/local/lib" on the configure command line.

However, it would have been nice if configure pointed out my error explicitly.

I have attached a patch to the file "programs.m4"



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

Attached Files
file #40765:  programs.m4.patch added by None (979B - application/octet-stream)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by None (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follows 1 latest change.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 23 May 2017 01:04:53 AM UTCNoneAttached File-=>Added programs.m4.patch, #40765

    Back to the top

    Powered by Savane 3.1-cleanup1