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:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Done
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Closed
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.


Thu 16 Jul 2020 05:00:06 PM UTC, comment #3: 

The patch as installed has problems, due to its AC_MSG_ERROR failing out of 'configure'. Please see sr #110269 which discusses the problems and a further fix that I installed.

Paul Eggert <eggert>
Project Administrator
Sun 12 Jul 2020 02:53:53 PM UTC, comment #2: 

Patch merged with refinements as 8173e5d6fefd8a2a36974610f85784121f8dc36e, will be included in Autoconf 2.70.

Zack Weinberg <zackw>
Project Administrator
Fri 10 Jul 2020 04:07:31 PM UTC, comment #1: 

Thank you for the nice clear bug report with included patch, and we apologize for the delay getting back to you.

Your patch is short enough that we don't need a copyright assignment, so I will test it and, assuming no problems, merge it for the upcoming 2.70 release.

(The patch does use up all of your quota for changes without a copyright assignment, so if you think you might like to submit further improvements to Autoconf, it would be a good idea to get started on the paperwork now.  See for instructions.)

Zack Weinberg <zackw>
Project Administrator
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 Files:

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
  • -email is unavailable- added by eggert (Posted a comment)
  • -email is unavailable- added by zackw (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)

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

    Only logged-in users can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-07-12 zackw StatusConfirmed => Done
        Open/ClosedOpen => Closed
    2020-07-10 zackw StatusNone => Confirmed
    2017-05-23 None Attached File- => Added programs.m4.patch, #40765

    Back to the top

    Powered by Savane 3.5