am-ft: make the environment available earlier
[platform/upstream/automake.git] / t / tags-pr12372.sh
old mode 100755 (executable)
new mode 100644 (file)
index e232d5f..6cf6e6e
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2012 Free Software Foundation, Inc.
+# Copyright (C) 2012-2013 Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -23,6 +23,9 @@ required='cc etags'
 cat >> configure.ac <<'END'
 AC_PROG_CC
 AC_CONFIG_FILES([sub/Makefile])
+# Fake linking.  Help avoid possible spurious errors from make
+# or from the linker; errors that are irrelevant to this test.
+AC_SUBST([LINK], ['echo $(CCLD) $(CFLAGS) $(LDFLAGS) -o $@'])
 AC_OUTPUT
 END
 
@@ -33,7 +36,6 @@ all-local: tags
        $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c $*.c
        rm -f $*.c
 
-LINK = $(CCLD) $(CFLAGS) $(LDFLAGS) -o $@
 noinst_PROGRAMS = foo
 foo_SOURCES = foo-main.pc barbar.c
 SUBDIRS = sub
@@ -47,7 +49,6 @@ all-local: tags
        $(CC) $(DEFS) $(CPPFLAGS) $(CFLAGS) -c $*.c
        rm -f $*.c
 
-LINK = $(CCLD) $(CFLAGS) $(LDFLAGS) -o $@
 noinst_PROGRAMS = zap
 zap_SOURCES = zardoz.pc
 END
@@ -62,7 +63,17 @@ $AUTOMAKE
 
 ./configure
 
-$MAKE
+# Exuberant Ctags (at least version 5.8) doesn't generate any tags
+# for file extensions it doesn't recognize.  This can be fixed by
+# using the '--langmap' option.  But we must be careful, because
+# etags from Emacs (at least version 23.4) doesn't recognize that
+# option.
+if etags --help | grep '.*--langmap'; then
+  run_make ETAGSFLAGS="--langmap=c:+.pc"
+else
+  $MAKE
+fi
+
 cat TAGS
 cat sub/TAGS
 $FGREP foo-main.pc TAGS