mainAutoconf - Support: sr #111007, autoconf 2.72 warning: file...

 
 

sr #111007: autoconf 2.72 warning: file 'version.m4' included several times

Submitter:  Румен Петров <rpetrov>
Submitted:  Sat 13 Jan 2024 08:26:06 AM UTC
   
 
Priority:  * 8 - Release N (Blocker) Severity:  2 - Minor
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 21 Jan 2024 03:35:27 PM UTC, comment #4: 

I finish analisis of 2.72 impacts. Warning is harmless.

The real script is this one - https://gitlab.com/secsh/pkixssh/-/blob/master/configure.ac .

Unlike expectations expressed in a response quoted below ./configure --help shows that content of version.m4 is used.

For protocol autotools used in tests and generation are located in separate directories by project and release.
I guess that this does not make difference to the installation in system default paths.




$ cat version.m4
# update version number here and if necessary
# in version.h and in contrib/*/pkixssh.spec

m4_define([SSH_PACKAGE], [PKIX-SSH])
m4_define([SSH_VERSION], [14.4])
m4_define([SSH_BUGREPORT], [ssh_x509@roumenpetrov.info])
m4_define([SSH_URL], https://roumenpetrov.info/secsh)

$ ./configure --help
'configure' configures PKIX-SSH 14.4 to adapt to many kinds of systems.
....
Report bugs to <ssh_x509@roumenpetrov.info>.
PKIX-SSH home page: <https://roumenpetrov.info/secsh>.

Румен Петров <rpetrov>
Wed 17 Jan 2024 02:28:49 AM UTC, comment #3: 

Introducing an annoying, spurious warning on code recommended by the automake manual does seem important enough that it should be fixed in the very next release, but bad warning messages by themselves never rise to the level of a critical problem.  Are you saying that you're not getting your own version.m4 anymore when you do `m4_include([version.m4])` ?

Zack Weinberg <zackw>
Group administrator
Mon 15 Jan 2024 07:40:39 PM UTC, comment #2: 

Let review automake manual chapter 16 Rebuilding Makefiles.



Here, version.sh is a shell fragment that sets VERSION_NUMBER. The problem with this example is that automake cannot track dependencies (listing version.sh in CONFIG_STATUS_DEPENDENCIES, and distributing this file is up to the user), and that it uses the obsolete form of AC_INIT and AM_INIT_AUTOMAKE. Upgrading to the new syntax is not straightforward, because shell variables are not allowed in AC_INIT’s arguments. We recommend that version.sh be replaced by an M4 file that is included by configure.ac:

m4_include([version.m4])
AC_INIT([name], VERSION_NUMBER)
AM_INIT_AUTOMAKE


Here version.m4 could contain something like ‘m4_define([VERSION_NUMBER], [1.2])’. The advantage of this second form is that automake will take care of the dependencies when defining the rebuild rule, and will also distribute the file automatically. An inconvenience is that autoconf will now be rerun each time the version number is bumped, when only configure had to be rerun in the previous setup.



So use of project version.m4 is officially documented.

With other words warning is not harmless but critical functional regression.

Румен Петров <rpetrov>
Mon 15 Jan 2024 07:37:34 PM UTC, comment #1: 

Let me quote first feedback:
Nick Bowler wrote:> On 2024-01-13 03:26, Румен Петров wrote:

>> autoconf 2.72 is first release that prints warning:
>> configure.ac:2: warning: file 'version.m4' included several times
>
> The warning here is erroneous and happens now because Autoconf-2.72's
> m4sugar.m4 (which is used under the hood basically everywhere) now
> includes an expansion of m4_sinclude([version.m4]).
>
> Autoconf implements this warning with a very simplisic check for whether
> a file is actually included multiple times: it defines the m4_include
> and m4_sinclude macros which record the argument any time they are used,
> checking if either was ever called with that argument before.
>
> Now, m4sugar does not actually include your version.m4, because the
> Autoconf build/installation process generates an m4 "frozen state" file
> (m4sugar.m4f) where the file inclusion is already done using version.m4
> from Autoconf's source code, and this is what actually gets used when
> you run autoconf.  However, the frozen state does include the record
> that m4_sinclude was expanded previously with the version.m4 argument.
>
> Probably we could fix this problem by changing m4sugar.m4 to not use
> the m4_sinclude.  It could use m4_builtin([sinclude], [version.m4])
> instead which would then not expose the record of internal inclusions
> to the user like this.
>
> To work around the warning in autoconf-2.72, you can change the spelling
> of version.m4 to something functionally equivalent, for example:
>
>    m4_include([./version.m4])
>
> You can also just go in and delete the indication that Autoconf uses
> to produce this warning, for example:
>
>    m4_builtin([undefine], [m4_include(version.m4)])
>
> Incidentally, while not relevant to your example, Autoconf 2.72 also
> installs its own version.m4 file to the global m4 include search path,
> so if you were previously using M4PATH or autoconf's -I option to locate
> a file with this name then actually m4_include([version.m4]) will pick
> up the one shipped with Autoconf instead of what probably anyone would
> actually want to happen in this scenario.
>
> Cheers,
>    Nick
>


Румен Петров <rpetrov>
Sat 13 Jan 2024 08:26:06 AM UTC, original submission:  

Sample version:
$ cat > version.m4 <<EOF
m4_define([FOO_VERSION], [0.0.1])
EOF

Sample configuration:
$ cat > configure.ac <<EOF
AC_PREREQ([2.59])
m4_include([version.m4])

AC_INIT([foo],[FOO_VERSION])

#AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])

AC_OUTPUT
EOF

autoconf 2.72 is first release that prints warning:
configure.ac:2: warning: file 'version.m4' included several times

Румен Петров <rpetrov>

 

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

    There are 0 votes 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.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-01-17 zackw Priority5 - Unprioritized 8 - Release N (Blocker)

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code