From 909b30a17e71253772d2cb174d0dae6d0b8c9401 Mon Sep 17 00:00:00 2001 From: Eric Gallager Date: Mon, 29 Nov 2021 13:24:12 -0500 Subject: [PATCH] Make etags path used by build system configurable This commit allows users to specify a path to their "etags" executable for use when doing "make tags". I based this patch off of this one from upstream automake: https://git.savannah.gnu.org/cgit/automake.git/commit/m4?id=d2ccbd7eb38d6a4277d6f42b994eb5a29b1edf29 This means that I just supplied variables that the user can override for the tags programs, rather than having the configure scripts actually check for them. I handle etags and ctags separately because the intl subdirectory has separate targets for them. This commit only affects the subdirectories that use handwritten Makefiles; the ones that use automake will have to wait until we update the version of automake used to be 1.16.4 or newer before they'll be fixed. Addresses #103021 gcc/ChangeLog: PR other/103021 * Makefile.in: Substitute CTAGS, ETAGS, and CSCOPE variables. Use ETAGS variable in TAGS target. * configure: Regenerate. * configure.ac: Allow CTAGS, ETAGS, and CSCOPE variables to be overridden. gcc/ada/ChangeLog: PR other/103021 * gcc-interface/Make-lang.in: Use ETAGS variable in TAGS target. gcc/c/ChangeLog: PR other/103021 * Make-lang.in: Use ETAGS variable in TAGS target. gcc/cp/ChangeLog: PR other/103021 * Make-lang.in: Use ETAGS variable in TAGS target. gcc/d/ChangeLog: PR other/103021 * Make-lang.in: Use ETAGS variable in TAGS target. gcc/fortran/ChangeLog: PR other/103021 * Make-lang.in: Use ETAGS variable in TAGS target. gcc/go/ChangeLog: PR other/103021 * Make-lang.in: Use ETAGS variable in TAGS target. gcc/objc/ChangeLog: PR other/103021 * Make-lang.in: Use ETAGS variable in TAGS target. gcc/objcp/ChangeLog: PR other/103021 * Make-lang.in: Use ETAGS variable in TAGS target. intl/ChangeLog: PR other/103021 * Makefile.in: Use ETAGS variable in TAGS target, CTAGS variable in CTAGS target, and MKID variable in ID target. * configure: Regenerate. * configure.ac: Allow CTAGS, ETAGS, and MKID variables to be overridden. libcpp/ChangeLog: PR other/103021 * Makefile.in: Use ETAGS variable in TAGS target. * configure: Regenerate. * configure.ac: Allow ETAGS variable to be overridden. libiberty/ChangeLog: PR other/103021 * Makefile.in: Use ETAGS variable in TAGS target. * configure: Regenerate. * configure.ac: Allow ETAGS variable to be overridden. --- gcc/Makefile.in | 8 ++++++-- gcc/ada/gcc-interface/Make-lang.in | 4 ++-- gcc/c/Make-lang.in | 4 ++-- gcc/configure | 21 +++++++++++++++++++-- gcc/configure.ac | 14 ++++++++++++++ gcc/cp/Make-lang.in | 4 ++-- gcc/d/Make-lang.in | 4 ++-- gcc/fortran/Make-lang.in | 4 ++-- gcc/go/Make-lang.in | 4 ++-- gcc/objc/Make-lang.in | 4 ++-- gcc/objcp/Make-lang.in | 4 ++-- intl/Makefile.in | 10 +++++++--- intl/configure | 16 ++++++++++++++++ intl/configure.ac | 14 ++++++++++++++ libcpp/Makefile.in | 4 +++- libcpp/configure | 6 ++++++ libcpp/configure.ac | 5 +++++ libiberty/Makefile.in | 4 +++- libiberty/configure | 6 ++++++ libiberty/configure.ac | 5 +++++ 20 files changed, 120 insertions(+), 25 deletions(-) diff --git a/gcc/Makefile.in b/gcc/Makefile.in index a4344d6..7054201 100644 --- a/gcc/Makefile.in +++ b/gcc/Makefile.in @@ -4319,6 +4319,10 @@ paranoia: paranoia.o real.o $(LIBIBERTY) # These exist for maintenance purposes. +CTAGS=@CTAGS@ +ETAGS=@ETAGS@ +CSCOPE=@CSCOPE@ + # Update the tags table. TAGS: lang.tags (cd $(srcdir); \ @@ -4328,14 +4332,14 @@ TAGS: lang.tags incs="$$incs --include $$dir/TAGS.sub"; \ fi; \ done; \ - etags -o TAGS.sub c-family/*.h c-family/*.c c-family/*.cc \ + $(ETAGS) -o TAGS.sub c-family/*.h c-family/*.c c-family/*.cc \ *.h *.c *.cc \ ../include/*.h ../libiberty/*.c \ ../libcpp/*.c ../libcpp/include/*.h \ --language=none --regex="/\(char\|unsigned int\|int\|bool\|void\|HOST_WIDE_INT\|enum [A-Za-z_0-9]+\) [*]?\([A-Za-z_0-9]+\)/\2/" common.opt \ --language=none --regex="/\(DEF_RTL_EXPR\|DEFTREECODE\|DEFGSCODE\|DEFTIMEVAR\|DEFPARAM\|DEFPARAMENUM5\)[ ]?(\([A-Za-z_0-9]+\)/\2/" rtl.def tree.def gimple.def timevar.def \ ; \ - etags --include TAGS.sub $$incs) + $(ETAGS) --include TAGS.sub $$incs) # ----------------------------------------------------- # Rules for generating translated message descriptions. diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index ae5158a..c01945b 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -805,8 +805,8 @@ ada.srcextra: ada.srcman: ada.tags: force - cd $(srcdir)/ada && etags -o TAGS.sub *.c *.h *.ads *.adb && \ - etags --include TAGS.sub --include ../TAGS.sub + cd $(srcdir)/ada && $(ETAGS) -o TAGS.sub *.c *.h *.ads *.adb && \ + $(ETAGS) --include TAGS.sub --include ../TAGS.sub # Generate documentation. diff --git a/gcc/c/Make-lang.in b/gcc/c/Make-lang.in index 67a40fc..9090096 100644 --- a/gcc/c/Make-lang.in +++ b/gcc/c/Make-lang.in @@ -109,8 +109,8 @@ c.srcinfo: c.srcextra: gengtype-lex.c -cp -p $^ $(srcdir) c.tags: force - cd $(srcdir)/c; etags -o TAGS.sub *.c *.h; \ - etags --include TAGS.sub --include ../TAGS.sub + cd $(srcdir)/c; $(ETAGS) -o TAGS.sub *.c *.h; \ + $(ETAGS) --include TAGS.sub --include ../TAGS.sub c.man: c.srcman: diff --git a/gcc/configure b/gcc/configure index 74b9d9b..40b5ed9 100755 --- a/gcc/configure +++ b/gcc/configure @@ -714,6 +714,9 @@ gcc_tooldir enable_lto DO_LINK_SERIALIZATION DO_LINK_MUTEX +CSCOPE +ETAGS +CTAGS MAINT zlibinc zlibdir @@ -19455,7 +19458,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19458 "configure" +#line 19461 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19561,7 +19564,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19564 "configure" +#line 19567 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -31378,6 +31381,19 @@ else MAINT='#' fi +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$CSCOPE"; then + CSCOPE=cscope +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to avoid linking multiple front-ends at once" >&5 $as_echo_n "checking whether to avoid linking multiple front-ends at once... " >&6; } @@ -33941,3 +33957,4 @@ $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi +_AC_FINALIZE diff --git a/gcc/configure.ac b/gcc/configure.ac index c9ee1fb..aa2f6d8 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -7040,6 +7040,20 @@ else fi AC_SUBST(MAINT)dnl +dnl Variables for tags utilities; copied from automake 1.16.4+'s init.m4 +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]) + dnl Whether to prevent multiple front-ends from linking at the same time AC_MSG_CHECKING([whether to avoid linking multiple front-ends at once]) diff --git a/gcc/cp/Make-lang.in b/gcc/cp/Make-lang.in index de1fc02..3dfa9ce 100644 --- a/gcc/cp/Make-lang.in +++ b/gcc/cp/Make-lang.in @@ -174,9 +174,9 @@ c++.srcinfo: c++.srcextra: c++.tags: force - cd $(srcdir)/cp; etags -o TAGS.sub *.c *.cc *.h --language=none \ + cd $(srcdir)/cp; $(ETAGS) -o TAGS.sub *.c *.cc *.h --language=none \ --regex='/DEFTREECODE [(]\([A-Z_]+\)/\1/' cp-tree.def; \ - etags --include TAGS.sub --include ../TAGS.sub + $(ETAGS) --include TAGS.sub --include ../TAGS.sub c++.man: doc/g++.1 diff --git a/gcc/d/Make-lang.in b/gcc/d/Make-lang.in index 554a26e..1ed8134 100644 --- a/gcc/d/Make-lang.in +++ b/gcc/d/Make-lang.in @@ -221,8 +221,8 @@ d.srcextra: d.tags: force cd $(srcdir)/d; \ - etags -o TAGS.sub *.c *.cc *.h dmd/*.c dmd/*.h dmd/root/*.h dmd/root/*.c; \ - etags --include TAGS.sub --include ../TAGS.sub + $(ETAGS) -o TAGS.sub *.c *.cc *.h dmd/*.c dmd/*.h dmd/root/*.h dmd/root/*.c; \ + $(ETAGS) --include TAGS.sub --include ../TAGS.sub d.man: doc/gdc.1 d.srcman: doc/gdc.1 diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in index 58ce589..414f3eb 100644 --- a/gcc/fortran/Make-lang.in +++ b/gcc/fortran/Make-lang.in @@ -113,8 +113,8 @@ fortran.srcinfo: doc/gfortran.info -cp -p $^ $(srcdir)/fortran fortran.tags: force - cd $(srcdir)/fortran; etags -o TAGS.sub *.c *.h; \ - etags --include TAGS.sub --include ../TAGS.sub + cd $(srcdir)/fortran; $(ETAGS) -o TAGS.sub *.c *.h; \ + $(ETAGS) --include TAGS.sub --include ../TAGS.sub fortran.info: doc/gfortran.info doc/gfc-internals.info diff --git a/gcc/go/Make-lang.in b/gcc/go/Make-lang.in index 4bdc8f6..6fdf55b 100644 --- a/gcc/go/Make-lang.in +++ b/gcc/go/Make-lang.in @@ -133,8 +133,8 @@ go.srcinfo: doc/gccgo.info go.srcextra: go.tags: force cd $(srcdir)/go; \ - etags -o TAGS.sub *.c *.h gofrontend/*.h gofrontend/*.cc; \ - etags --include TAGS.sub --include ../TAGS.sub + $(ETAGS) -o TAGS.sub *.c *.h gofrontend/*.h gofrontend/*.cc; \ + $(ETAGS) --include TAGS.sub --include ../TAGS.sub go.man: doc/gccgo.1 go.srcman: doc/gccgo.1 -cp -p $^ $(srcdir)/doc diff --git a/gcc/objc/Make-lang.in b/gcc/objc/Make-lang.in index d3f99c8..2a94815 100644 --- a/gcc/objc/Make-lang.in +++ b/gcc/objc/Make-lang.in @@ -102,8 +102,8 @@ objc.srcman: objc.install-plugin: objc.tags: force - cd $(srcdir)/objc; etags -o TAGS.sub *.c *.h; \ - etags --include TAGS.sub --include ../TAGS.sub + cd $(srcdir)/objc; $(ETAGS) -o TAGS.sub *.c *.h; \ + $(ETAGS) --include TAGS.sub --include ../TAGS.sub lang_checks += check-objc diff --git a/gcc/objcp/Make-lang.in b/gcc/objcp/Make-lang.in index 1806386..33f448a 100644 --- a/gcc/objcp/Make-lang.in +++ b/gcc/objcp/Make-lang.in @@ -136,8 +136,8 @@ obj-c++.man: obj-c++.install-plugin: obj-c++.tags: force - cd $(srcdir)/objcp; etags -o TAGS.sub *.c *.h; \ - etags --include TAGS.sub --include ../TAGS.sub + cd $(srcdir)/objcp; $(ETAGS) -o TAGS.sub *.c *.h; \ + $(ETAGS) --include TAGS.sub --include ../TAGS.sub lang_checks += check-obj-c++ diff --git a/intl/Makefile.in b/intl/Makefile.in index ec8c648..409d693 100644 --- a/intl/Makefile.in +++ b/intl/Makefile.in @@ -50,6 +50,10 @@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ DEFS = -DHAVE_CONFIG_H +CTAGS = @CTAGS@ +ETAGS = @ETAGS@ +MKID = @MKID@ + COMPILE = $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFS) $(DEFS-$@) $(INCLUDES) HEADERS = \ @@ -176,17 +180,17 @@ localealias.o localcharset.o relocatable.o: relocatable.h tags: TAGS TAGS: $(HEADERS) $(SOURCES) here=`pwd`; cd $(srcdir) && \ - etags -o $$here/TAGS $(HEADERS) $(SOURCES) + $(ETAGS) -o $$here/TAGS $(HEADERS) $(SOURCES) ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) here=`pwd`; cd $(srcdir) && \ - ctags -o $$here/CTAGS $(HEADERS) $(SOURCES) + $(CTAGS) -o $$here/CTAGS $(HEADERS) $(SOURCES) id: ID ID: $(HEADERS) $(SOURCES) here=`pwd`; cd $(srcdir) && \ - mkid -f$$here/ID $(HEADERS) $(SOURCES) + $(MKID) -f$$here/ID $(HEADERS) $(SOURCES) mostlyclean: rm -f *.a *.la *.o *.obj *.lo core core.* libintl.h diff --git a/intl/configure b/intl/configure index 9d4f500..03f4048 100755 --- a/intl/configure +++ b/intl/configure @@ -627,6 +627,9 @@ BISON3_NO BISON3_YES INCINTL LIBINTL_DEP +MKID +ETAGS +CTAGS MAINT AUTOHEADER AUTOCONF @@ -6799,6 +6802,19 @@ else fi +if test -z "$CTAGS"; then + CTAGS=ctags +fi + +if test -z "$ETAGS"; then + ETAGS=etags +fi + +if test -z "$MKID"; then + MKID=mkid +fi + + # Additional info for config.intl. diff --git a/intl/configure.ac b/intl/configure.ac index 72b1459..16a740a 100644 --- a/intl/configure.ac +++ b/intl/configure.ac @@ -32,6 +32,20 @@ else fi AC_SUBST(MAINT) +dnl Variables for tags utilities; based on automake 1.16.4+'s init.m4 +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 "$MKID"; then + MKID=mkid +fi +AC_SUBST([MKID]) + # Additional info for config.intl. AC_SUBST(LIBINTL_DEP) AC_SUBST(INCINTL) diff --git a/libcpp/Makefile.in b/libcpp/Makefile.in index 34e4206..6b6554b 100644 --- a/libcpp/Makefile.in +++ b/libcpp/Makefile.in @@ -264,11 +264,13 @@ po/$(PACKAGE).pot: $(libcpp_a_SOURCES) sed 's:$(srcdir)/::g' po/$(PACKAGE).pot rm po/$(PACKAGE).pot.tmp +ETAGS = @ETAGS@ + TAGS_SOURCES = $(libcpp_a_SOURCES) internal.h system.h ucnid.h \ include/cpplib.h include/line-map.h include/mkdeps.h include/symtab.h TAGS: $(TAGS_SOURCES) - cd $(srcdir) && etags $(TAGS_SOURCES) + cd $(srcdir) && $(ETAGS) $(TAGS_SOURCES) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. diff --git a/libcpp/configure b/libcpp/configure index 9674cd9..2797292 100755 --- a/libcpp/configure +++ b/libcpp/configure @@ -652,6 +652,7 @@ noexception_flags WARN_PEDANTIC c_warn warn +ETAGS AUTOHEADER AUTOCONF ACLOCAL @@ -4896,6 +4897,11 @@ done test -n "$AUTOHEADER" || AUTOHEADER="$MISSING autoheader" +if test -z "$ETAGS"; then + ETAGS=etags +fi + + # Figure out what compiler warnings we can enable. # See config/warnings.m4 for details. diff --git a/libcpp/configure.ac b/libcpp/configure.ac index 1efa96f..bc2373c 100644 --- a/libcpp/configure.ac +++ b/libcpp/configure.ac @@ -22,6 +22,11 @@ AC_CHECK_PROGS([ACLOCAL], [aclocal], [$MISSING aclocal]) AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf]) AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader]) +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) + # Figure out what compiler warnings we can enable. # See config/warnings.m4 for details. diff --git a/libiberty/Makefile.in b/libiberty/Makefile.in index 884cc6c..0d41a79 100644 --- a/libiberty/Makefile.in +++ b/libiberty/Makefile.in @@ -429,8 +429,10 @@ stamp-noasandir: .PHONY: all etags tags TAGS ls clean stage1 stage2 +ETAGS = @ETAGS@ + etags tags TAGS: etags-subdir - cd $(srcdir) && etags $(CFILES) + cd $(srcdir) && $(ETAGS) $(CFILES) # The standalone demangler (c++filt) has been moved to binutils. # But make this target work anyway for demangler hacking. diff --git a/libiberty/configure b/libiberty/configure index 3c7e588..0a79725 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -659,6 +659,7 @@ HAVE_PERL PERL BUILD_INFO MAKEINFO +ETAGS NOTMAINT MAINT libiberty_topdir @@ -2558,6 +2559,11 @@ else NOTMAINT='' fi +if test -z "$ETAGS"; then + ETAGS=etags +fi + + # Do we have a single-tree copy of texinfo? Even if we do, we can't # rely on it - libiberty is built before texinfo. # Extract the first word of "makeinfo", so it can be a program name with args. diff --git a/libiberty/configure.ac b/libiberty/configure.ac index 4b78c18..84a7b37 100644 --- a/libiberty/configure.ac +++ b/libiberty/configure.ac @@ -61,6 +61,11 @@ fi AC_SUBST(MAINT)dnl AC_SUBST(NOTMAINT)dnl +if test -z "$ETAGS"; then + ETAGS=etags +fi +AC_SUBST([ETAGS]) + # Do we have a single-tree copy of texinfo? Even if we do, we can't # rely on it - libiberty is built before texinfo. AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, ) -- 2.7.4