automake: new option to print location of scripts and data files
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 19 Feb 2012 17:43:28 +0000 (18:43 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 21 Feb 2012 08:51:45 +0000 (09:51 +0100)
With this change, we add a new automake option '--print-libdir'
that prints (on stdout) the path of the directory containing the
Automake-provided scripts (e.g., 'missing' and 'install-sh') and
data files (e.g., INSTALL or texinfo.tex).

Suggestion by Nick Bowler.  See also automake bug#10473.

* automake.in (parse_arguments): Handle the new option.
(usage): Mention it.
* doc/automake.texi (automake Invocation): Document it.
* NEWS: Update.
* tests/print-dir.test: New test.
* tests/list-of-tests.mk: Add it.

NEWS
automake.in
doc/automake.texi
tests/list-of-tests.mk
tests/print-libdir.test [new file with mode: 0755]

diff --git a/NEWS b/NEWS
index c1de9b2..4c7a54a 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -116,6 +116,9 @@ New in 1.11a:
 
 * Miscellaneous changes:
 
+  - Automake has a new option '--print-libdir' that prints the path of the
+    directory containing the Automake-provided scripts and data files.
+
   - The `dist' and `dist-all' targets now can run compressors in parallel.
 
   - Automake can now generate silenced rules for texinfo outputs.
index 5ee9f8a..13e65df 100644 (file)
@@ -8268,7 +8268,8 @@ Flavors:
 
 Library files:
   -a, --add-missing      add missing standard files to package
-      --libdir=DIR       directory storing library files
+      --libdir=DIR       set directory storing library files
+      --print-libdir     print directory storing library files
   -c, --copy             with -a, copy missing files (default is symlink)
   -f, --force-missing    force update of standard files
 
@@ -8327,6 +8328,7 @@ sub parse_arguments ()
      'version' => \&version,
      'help'    => \&usage,
      'libdir=s'        => \$libdir,
+     'print-libdir'     => sub { print "$libdir\n"; exit 0; },
      'gnu'             => sub { $strict = 'gnu'; },
      'gnits'           => sub { $strict = 'gnits'; },
      'foreign'         => sub { $strict = 'foreign'; },
index ef094c0..f342686 100644 (file)
@@ -2587,6 +2587,12 @@ for more information.
 Look for Automake data files in directory @var{dir} instead of in the
 installation directory.  This is typically used for debugging.
 
+@item --print-libdir
+@opindex --print-libdir
+Print the path of the installation directory containing Automake-provided
+scripts and data files (like e.g., @file{texinfo.texi} and
+@file{install-sh}).
+
 @item -c
 @opindex -c
 @itemx --copy
index a80879f..d10f585 100644 (file)
@@ -813,6 +813,7 @@ primary-prefix-invalid-couples.tap \
 primary-prefix-valid-couples.test \
 primary-prefix-couples-force-valid.test \
 primary-prefix-couples-documented-valid.test \
+print-libdir.test \
 proginst.test \
 programs-primary-rewritten.test \
 py-compile-basic.test \
diff --git a/tests/print-libdir.test b/tests/print-libdir.test
new file mode 100755 (executable)
index 0000000..f5764b3
--- /dev/null
@@ -0,0 +1,46 @@
+#! /bin/sh
+# Copyright (C) 2011-2012 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test on automake options '--print-data-dir' and '--print-script-dir'.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+libdir=`$AUTOMAKE --print-libdir` || Exit 1
+case $libdir in /*);; *) Exit 1;; esac
+test -d "$libdir"
+test "$libdir" = "$am_pkgvdatadir"
+test "$libdir" = "$am_scriptdir"
+
+: > Makefile.am
+
+cat > configure.ac <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([.])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+END
+
+touch ChangeLog README NEWS AUTHORS COPYING
+
+$ACLOCAL
+$AUTOMAKE --gnu --add-missing
+ls -l
+
+diff missing "$libdir"/missing
+diff INSTALL "$libdir"/INSTALL
+
+: