mainAutoconf - Support: sr #111140, autoscan gets confused by Makefile...

 
 

sr #111140: autoscan gets confused by Makefile rules that start with '-' to ignore errors

Submitter:  Eric Gallager <egallager>
Submitted:  Sun 20 Oct 2024 12:51:01 AM UTC
Votes: 1
 
Priority:  * 2 - Eventually Severity:  1 - Wish
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Mon 21 Oct 2024 06:17:15 PM UTC, comment #1: 

Unfortunately the suggested heuristic would cause autoscan to sometimes not report a library that it should report, since continuation lines can start with "\t" followed by "-".

When in doubt it is better for autoscan to be safe than sorry, and suggest the library; you can ignore the suggestion. (Alternatively 'autoscan' could be modified to do a full 'make' parse, but that'd be a big project.)

To prevent autoscan from suggesting "-ln", you can use a macro or (less obviously) an extra "-". For example:

$ cat Makefile
IGNORE_FAILURE = -
symlinks_a:
        $(IGNORE_FAILURE)ln -s foo bar

symlinks_b:
        --ln -s foo bar


Paul Eggert <eggert>
Group administrator
Sun 20 Oct 2024 12:51:01 AM UTC, original submission:  

Make has a feature where starting a line with a tab and a minus sign will ignore errors on that line: https://www.gnu.org/software/make/manual/html_node/Errors.html
However, if the command whose errors are meant to be ignored starts with an "l", `autoscan` will think it's a library that the user is trying to link with, and thus needs to be checked. Say I have the following Makefile in a directory:

$ cat Makefile
symlinks:
        -ln -s foo bar
$

If I then run `autoscan`, it will produce a `configure.scan` file that looks like this:

$ cat configure.scan
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.72])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])

# Checks for programs.

# Checks for libraries.
# FIXME: Replace 'main' with a function in '-ln':
AC_CHECK_LIB([n], [main])

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

AC_CONFIG_FILES([Makefile])
AC_OUTPUT

However, there is no actual "libn" that needs to be linked with, so `autoscan` shouldn't suggest checking for it. I think a decent heuristic to tell these apart would be that if a "-l" sequence in a Makefile is preceded by a tab immediately following the start of a line, it's probably a command rather than a library.

Eric Gallager <egallager>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by egallager (Voted in favor of this item)
  • -email is unavailable- added by eggert (Posted a comment)
  • -email is unavailable- added by egallager (Submitted the item)
  •  

    There is 1 vote so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-11-18 egallager Carbon-Copy- Added egallager
    2024-10-21 eggert Priority5 - Unprioritized 2 - Eventually
        Severity3 - Normal 1 - Wish

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code