This is the mail archive of the automake@gnu.org mailing list for the automake project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] etags support


I added rudimentary support for different implementations of etags (read
the one Automake expects and Exuberent etags) since they take slightly
different options.  Exuberent etags is the version distributed with
RedHat Linux 6.2 & I believe Debian and a few others.

I added a macro to test for the presence of etags and whether it
supports "--etags-include=<file>" or "-i <file>" for includes.

This was enough to get the TAGS target working with CVS, but what it
probably still needs is a test for support for "--lang=none" and a hook
like @AMDEP@ to comment out the TAGS target or support in missing for
when the user doesn't have etags installed or configure can't figure out
how it works.

What version of etags was Automake expecting and where can I get it?

Derek

--
Derek Price                      CVS Solutions Architect ( http://CVSHome.org )
mailto:dprice@openavenue.com     OpenAvenue ( http://OpenAvenue.com )
--
There are two major products to come out of Berkley: LSD and UNIX . We don't
believe this to be a coincidence.


Index: ChangeLog
===================================================================
RCS file: /cvs/automake/automake/ChangeLog,v
retrieving revision 1.916
diff -u -r1.916 ChangeLog
--- ChangeLog	2000/12/21 06:07:14	1.916
+++ ChangeLog	2000/12/21 18:07:02
@@ -1,3 +1,10 @@
+2000-12-21  Derek Price  <derek.price@openavenue.com>
+
+	* m4/etags.m4: Discover the etags implementation
+	* m4/init.m4: Require AM_PROG_ETAGS
+	* tags.am: add support for AM_PROG_ETAGS & don't assume
+	@CONFIG@ is present in the build directory
+
 2000-12-18  Tom Tromey  <tromey@redhat.com>
 
 	* automake.in (handle_built_sources): Removed.
Index: tags.am
===================================================================
RCS file: /cvs/automake/automake/tags.am,v
retrieving revision 1.24
diff -u -r1.24 tags.am
--- tags.am	2000/10/16 09:01:36	1.24
+++ tags.am	2000/12/21 18:07:02
@@ -36,17 +36,17 @@
 SUBDIRS	list='$(SUBDIRS)'; for subdir in $$list; do \
 ## Do nothing if we're trying to look in `.'.
 SUBDIRS   if test "$$subdir" = .; then :; else \
-SUBDIRS	    test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+SUBDIRS	    test -f $$subdir/TAGS && tags="$$tags $(ETAGS_INCLUDE_OPTION)$$here/$$subdir/TAGS"; \
 SUBDIRS   fi; \
 SUBDIRS	done; \
 ## Make sure the list of sources is unique.
 	list='$(SOURCES) $(HEADERS) $(TAGS_FILES)'; \
-	unique=`for i in $$list; do \
+	unique=`for i in $$list @CONFIG@; do \
 ## Handle VPATH correctly.
 	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
 	  done | \
 	  $(AWK) '    { files[$$0] = 1; } \
 	       END { for (i in files) print i; }'`; \
 ## Make sure we have something to run etags on.
-	test -z "$(ETAGS_ARGS)@CONFIG@$$unique$(LISP)$$tags" \
-	  || etags $(ETAGS_ARGS) $$tags @CONFIG@ $$unique $(LISP)
+	test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+	  || $(ETAGS) $(ETAGS_ARGS) $$tags $$unique $(LISP)
Index: m4/init.m4
===================================================================
RCS file: /cvs/automake/automake/m4/init.m4,v
retrieving revision 1.20
diff -u -r1.20 m4/init.m4
--- m4/init.m4	2000/10/10 00:18:52	1.20
+++ m4/init.m4	2000/12/21 18:07:02
@@ -54,6 +54,7 @@
 # some platforms.
 AC_REQUIRE([AC_PROG_AWK])dnl
 AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_PROG_ETAGS])
 AC_REQUIRE([AM_DEP_TRACK])dnl
 AC_REQUIRE([AM_SET_DEPDIR])dnl
 AC_PROVIDE_IFELSE([AC_PROG_CC],
Index: tests/ChangeLog
===================================================================
RCS file: /cvs/automake/automake/tests/ChangeLog,v
retrieving revision 1.309
diff -u -r1.309 tests/ChangeLog
--- tests/ChangeLog	2000/12/17 21:32:57	1.309
+++ tests/ChangeLog	2000/12/21 18:07:02
@@ -1,3 +1,8 @@
+2000-12-21  Derek Price  <derek.price@openavenue.com>
+
+	* etags.test: New file
+	* Makefile.am (TESTS): added etags.test
+
 2000-12-17  Tom Tromey  <tromey@redhat.com>
 
 	* Makefile.am (XFAIL_TESTS): Don't mention ldflags.test.
Index: tests/Makefile.am
===================================================================
RCS file: /cvs/automake/automake/tests/Makefile.am,v
retrieving revision 1.240
diff -u -r1.240 tests/Makefile.am
--- tests/Makefile.am	2000/12/17 21:32:57	1.240
+++ tests/Makefile.am	2000/12/21 18:07:02
@@ -97,6 +98,7 @@
 empty3.test \
 empty4.test \
 error.test \
+etags.test \
 exdir.test \
 exdir2.test \
 exsource.test \
--- /dev/null	Thu Aug 24 05:00:32 2000
+++ m4/etags.m4	Thu Dec 21 12:03:24 2000
@@ -0,0 +1,60 @@
+#
+# Find some information about the etags program
+#
+# Sets
+#	ETAGS = path to etags
+#	ETAGS_INCLUDE_OPTION = option to pass to etags with arg for includes
+#
+
+AC_DEFUN([AM_PROG_ETAGS],
+[AC_BEFORE([$0], AM_PROG_ETAGS_WORKS)
+AC_CHECK_PROG(ETAGS, etags, etags)
+if test -z "$ETAGS"; then
+  AC_CHECK_PROG(ETAGS, ctags, ctags -e)
+fi
+if test -n "$ETAGS"; then
+	AM_PROG_ETAGS_WORKS
+	if test "$am_cv_prog_etags_works" = no ; then
+		ac_cv_prog_ETAGS=
+		ETAGS=
+	else
+		AM_PROG_ETAGS_INCLUDE_OPTION
+	fi
+fi])
+
+
+AC_DEFUN([AM_PROG_ETAGS_WORKS],
+[AC_CACHE_CHECK([whether etags works], [am_cv_prog_etags_works],
+[cat >conftest.c <<EOF
+int globalvar;
+EOF
+if AC_TRY_COMMAND(${ETAGS-etags} -f - conftest.c) |egrep "^int globalvar;" >/dev/null 2>&1; then
+	am_cv_prog_etags_works=yes
+else
+	am_cv_prog_etags_works=no
+fi
+rm -f conftest.c])])
+
+AC_DEFUN([AM_PROG_ETAGS_INCLUDE_OPTION],
+[AC_REQUIRE([AM_PROG_ETAGS_WORKS])
+if test "$am_cv_prog_etags_works" = yes ; then
+	AC_CACHE_CHECK([for etags include option],
+	[am_cv_prog_etags_include_option],
+	[cat >conftest.c <<EOF
+int globalvar;
+EOF
+	if AC_TRY_COMMAND(${ETAGS-etags} --etags-include=TAGS.inc -f - conftest.c) \
+			|egrep '^TAGS.inc,include$' >/dev/null 2>&1; then
+		am_cv_prog_etags_include_option=--etags-include=
+	elif AC_TRY_COMMAND(${ETAGS-etags} -i TAGS.inc -f - conftest.c) \
+			|egrep '^TAGS.inc,include$' >/dev/null 2>&1; then
+		am_cv_prog_etags_include_option='"-i "'
+	else :
+		# AC_MSG_ERROR(unfamiliar etags implementation)
+	fi
+	rm -f conftest.c])
+else
+	:
+fi
+ETAGS_INCLUDE_OPTION="$am_cv_prog_etags_include_option"
+AC_SUBST(ETAGS_INCLUDE_OPTION)])
--- /dev/null	Thu Aug 24 05:00:32 2000
+++ tests/etags.test	Wed Dec 20 19:24:26 2000
@@ -0,0 +1,28 @@
+#! /bin/sh
+
+# Test to make sure depcomp is installed and found properly
+# when required for multiple directories
+
+. $srcdir/defs || exit 1
+
+cat > configure.in << 'END'
+AC_INIT(Makefile.am)
+AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+AM_PROG_ETAGS
+AC_OUTPUT(Makefile)
+END
+
+: > Makefile.am
+
+# Fail gracefully if no autoconf.
+(autoconf --version) > /dev/null 2>&1 || exit 77
+
+$ACLOCAL || exit 1
+autoconf || exit 1
+$AUTOMAKE || exit 1
+./configure || exit 1
+
+egrep '^ETAGS = ..*$' Makefile >/dev/null 2>&1 || exit 1
+egrep '^ETAGS_INCLUDE_OPTION = ..*$' Makefile >/dev/null 2>&1 || exit 1
+
+exit 0

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]