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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

Markus Elfring-2
URL:
  <http://savannah.gnu.org/support/?109320>

                 Summary: _AC_PROG_LEX_YYTEXT_DECL fails to compute LEXLIB
correctly using the original AT&T lex if Xcode's flex is installed
                 Project: Autoconf
            Submitted by: None
            Submitted on: Tue 23 May 2017 01:04:53 AM UTC
                Category: None
                Priority: 5 - Normal
                Severity: 3 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: [hidden email]
             Open/Closed: Open
         Discussion Lock: Any
        Operating System: Mac OS

    _______________________________________________________

Details:

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"



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Tue 23 May 2017 01:04:53 AM UTC  Name: programs.m4.patch  Size: 979B  
By: None

<http://savannah.gnu.org/support/download.php?file_id=40765>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/support/?109320>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/