bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org, Paul Eggert <eggert@cs.ucla.edu>
Cc: Collin Funk <collin.funk1@gmail.com>
Subject: Re: *.m4 conventions
Date: Mon, 13 May 2024 18:57:01 +0200	[thread overview]
Message-ID: <6550480.K2JlShyGXD@nimes> (raw)
In-Reply-To: <ba073c23-e1fd-491a-aa0b-2bdf54ac34e3@cs.ucla.edu>

Paul Eggert wrote:
> Is this stuff documented somewhere in the .texi files? If not, I suppose 
> it should be.

Done through the patch below.

> Frankly I continue to be annoyed by having to read and write a line "# 
> FILENAME.m4" at the start of every m4 file FILENAME.m4. It's better for 
> a file's first line to be a human-readable comment explaining what the 
> file is for. Any automated procedure already knows the file name, so why 
> do we need to put the name there manually, an error-prone process?

Documented as below.

Note that in Gnulib, a human-readable comment
  # Autoconf macros for the stdio module.
is just as trivial as this comment:
  # stdio_h.m4

Note also that both the file name line and the serial number appear
to be *currently* unused for most Gnulib *.m4 files. That's because they
become relevant only for *.m4 files installed in $PREFIX/share/aclocal.
*Currently* there are only few (host-cpu-c-abi.m4, lib-*.m4, progtest.m4, ...)
because after being imported into gettext, gettext installs them in
$PREFIX/share/aclocal. But they become relevant again
  - When users use *.m4 files outside of their package's directory
    (and it's not our business to control or dictate the package structure
    of the packages),
  - When users or distros install *.m4 files globally, for whatever reason
    (and it's not our business to control or dictate what distros do).
  - When gnulib-tool's way of operating may change. I can imagine that
    in a couple of years, the way gnulib-tool shares its source code
    is different than what it is today. (Simon Josefsson and the Debian
    project are already experimenting with alternative but correct ways
    to distribute Gnulib.)


2024-05-13  Bruno Haible  <bruno@clisp.org>

	doc: Document our conventions for *.m4 files.
	Suggested by Paul Eggert in
	<https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00156.html>.
	* doc/gnulib.texi (Autoconf macros): Document the structure of our *.m4
	files.

diff --git a/doc/gnulib.texi b/doc/gnulib.texi
index 24acb1afc8..07b18aa7b8 100644
--- a/doc/gnulib.texi
+++ b/doc/gnulib.texi
@@ -584,6 +584,27 @@
 maintenance.
 @end enumerate
 
+Autoconf macro files in Gnulib all start with a header consisting of
+@c https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00053.html
+@enumerate
+@item
+A comment line with the file name.
+This is useful because in some cases the generated @code{aclocal.m4}
+file does not contain a reference to the @code{.m4} file but its entire
+contents.
+The comment makes it clear which @code{.m4} file is where in the
+@code{aclocal.m4} file.
+@item
+A comment line with a serial number.
+This is useful when people use the @samp{aclocal --install} command.
+@code{aclocal} will then refrain from copying a file with a smaller
+serial number onto a file with a larger serial number.
+The serial number should be a positive integer on the main branch,
+or a positive fractional number on a stable branch.
+@item
+The copyright and license header, as usual.
+@end enumerate
+
 
 @node Using @code{AC_LIBOBJ}
 @section Making proper use of @code{AC_LIBOBJ}





  parent reply	other threads:[~2024-05-13 18:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-11 19:08 [PATCH 0/4] New stdbit module, for C23 style stdbit.h Paul Eggert
2024-05-11 19:08 ` [PATCH 1/4] stdbit: new module Paul Eggert
2024-05-12  6:48   ` Collin Funk
2024-05-12 15:23     ` Paul Eggert
2024-05-12 18:43       ` Collin Funk
2024-05-12 19:25         ` Paul Eggert
     [not found]         ` <4664326.CvnuH1ECHv@nimes>
2024-05-13 21:06           ` Python class comments Collin Funk
2024-05-13 16:57       ` Bruno Haible [this message]
2024-05-13 19:26         ` *.m4 conventions Paul Eggert
2024-05-13 20:23           ` Bruno Haible
2024-05-14  2:09             ` Paul Eggert
2024-05-11 19:08 ` [PATCH 2/4] stdbit-tests: new module Paul Eggert
2024-05-13 17:47   ` Bruno Haible
     [not found]     ` <ddb37f62-e93a-4da2-bdee-94cc4ad1edd4@cs.ucla.edu>
2024-05-13 21:52       ` Bruno Haible
2024-05-11 19:08 ` [PATCH 3/4] stdbit: remove most module dependence Paul Eggert
2024-05-13 21:08   ` Collin Funk
2024-05-11 19:08 ` [PATCH 4/4] stdbit: clean up namespace and simplify Paul Eggert
2024-05-13 16:17   ` considering L1 cache Bruno Haible
2024-05-13 22:44     ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6550480.K2JlShyGXD@nimes \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=collin.funk1@gmail.com \
    --cc=eggert@cs.ucla.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).