Subject: Re: bug#45013: Using a different tags program

From: Reuben Thomas <[email-masked]>
Date: Fri, 4 Dec 2020 23:18:04 +0000

On Thu, 3 Dec 2020 at 22:26, Reuben Thomas <[email-masked]> wrote:

> Happy to look into it.

I have looked into it and attach a trivial patch, which works nicely.

It's not obvious to me whether any documentation is required; I rather
expected that these variables would behave like others (CC, CXX etc.). I've
actually struggled to find other variables which work similarly. CYGPATH_W
does, but it's not documented at all.

-- 
https://rrt.sc3d.org
From 2ee7f693f6106d6f55064f4dcfc3b01dc1a53bde Mon Sep 17 00:00:00 2001
From: Reuben Thomas <[email-masked]>
Date: Fri, 4 Dec 2020 23:11:13 +0000
Subject: [PATCH] tags: add support for CTAGS, ETAGS and CSCOPE to be set by
 ./configure

This change fixes https://bugs.gnu.org/45013

* lib/am/tags.m4: add default settings and AC_SUBST calls for the variables
  `CTAGS', `ETAGS' and `CSCOPE'.
* m4/init.m4: remove default settings of the above variables.
---
 lib/am/tags.am |  3 ---
 m4/init.m4     | 14 ++++++++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/lib/am/tags.am b/lib/am/tags.am
index a485ff840..c1ec37772 100644
--- a/lib/am/tags.am
+++ b/lib/am/tags.am
@@ -45,7 +45,6 @@ ID: $(am__tagged_files)
 ## TAGS.  ##
 ## ------ ##
 
-ETAGS = etags
 .PHONY: TAGS tags
 if %?SUBDIRS%
 AM_RECURSIVE_TARGETS += TAGS
@@ -101,7 +100,6 @@ tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
 ## vi-style tags.  ##
 ## --------------- ##
 
-CTAGS = ctags
 .PHONY: CTAGS ctags
 if %?SUBDIRS%
 AM_RECURSIVE_TARGETS += CTAGS
@@ -136,7 +134,6 @@ GTAGS:
 ## ------- ##
 
 if %?TOPDIR_P%
-CSCOPE = cscope
 .PHONY: cscope clean-cscope
 AM_RECURSIVE_TARGETS += cscope
 cscope: cscope.files
diff --git a/m4/init.m4 b/m4/init.m4
index ba73676c1..f82d756c2 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -116,6 +116,20 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
 		  [m4_define([AC_PROG_OBJCXX],
 			     m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl
 ])
+# Variables for tags utilities; see am/tags.am
+if test -z "$CTAGS"; then
+  CTAGS=ctags
+fi
+AC_SUBST([CTAGS])
+if test -z "$ETAGS"; then
+  ETAGS=etags
+fi
+AC_SUBST([ETAGS])
+if test -z "$CSCOPE"; then
+  CSCOPE=cscope
+fi
+AC_SUBST([CSCOPE])
+
 AC_REQUIRE([AM_SILENT_RULES])dnl
 dnl The testsuite driver may need to know about EXEEXT, so add the
 dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This
-- 
2.25.1