[PATCH] aclocal: add m4 search path info to --help

Mike Frysinger <[email protected]>
Newsgroups gmane.comp.sysutils.automake.patches
Message-ID <[email protected]>
Add a short summary to --help of the current paths that will be
searched.  Make sure to omit this from the man page when running
help2man since pre-inst-env specifically clears some and others
to the current build directory.

* bin/aclocal.in: Include m4 search paths in usage.
* doc/local.mk: Run help2man with AUTOMAKE_HELP2MAN=true.
---
 bin/aclocal.in | 20 +++++++++++++++++++-
 doc/local.mk   |  2 +-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/bin/aclocal.in b/bin/aclocal.in
index 857e85308cd3..36651c8c2882 100644
--- a/bin/aclocal.in
+++ b/bin/aclocal.in
@@ -1044,12 +1044,30 @@ Options:
                               third-party m4 files, then exit
       --verbose             don't be silent
       --version             print version number, then exit
-  -W, --warnings=CATEGORY   report the warnings falling in CATEGORY
+  -W, --warnings=CATEGORY   report the warnings falling in CATEGORY,
+                              defaults to $WARNINGS
+
 EOF
 
   print Automake::ChannelDefs::usage (), "\n";
 
+  # This output depends on the current environment, and when generating the man
+  # pages during Automake compilation, the environment is set to local values.
+  # So don't include it in the installed man page.
+  if (!$ENV{AUTOMAKE_HELP2MAN}) {
+    print <<"EOF";
+
+Current m4 search paths (in order):
+  -I dirs:                  @user_includes
+  --automake-acdir:         @automake_includes
+  \$ACLOCAL_AUTOMAKE_DIR:    $ENV{"ACLOCAL_AUTOMAKE_DIR"}
+  --system-acdir:           @system_includes
+  \$ACLOCAL_PATH:            $ENV{"ACLOCAL_PATH"}
+EOF
+  }
+
   print <<'EOF';
+
 Report bugs to <@PACKAGE_BUGREPORT@>.
 GNU Automake home page: <@PACKAGE_URL@>.
 General help using GNU software: <https://www.gnu.org/gethelp/>.
diff --git a/doc/local.mk b/doc/local.mk
index 06c78823a574..921e22e9ec54 100644
--- a/doc/local.mk
+++ b/doc/local.mk
@@ -37,7 +37,7 @@ EXTRA_DIST += %D%/help2man
 update_mans = \
   $(AM_V_GEN): \
     && $(MKDIR_P) %D% \
-    && ./pre-inst-env $(PERL) $(srcdir)/%D%/help2man --output=$@
+    && AUTOMAKE_HELP2MAN=true ./pre-inst-env $(PERL) $(srcdir)/%D%/help2man --output=$@
 
 %D%/aclocal.1 %D%/automake.1:
 	$(AM_V_GEN): \
-- 
2.34.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.