retitle 10473 get directory holding automake-provided scripts and data files
severity 10473 wishlist
tags 10473 patch
thanks

[dropping autoc...@gnu.org]

On 01/10/2012 10:57 PM, Mike Frysinger wrote:
> On Tuesday 10 January 2012 16:10:29 Nick Bowler wrote:
>> On 2012-01-10 15:41 -0500, Mike Frysinger wrote:
>>> On Monday 09 January 2012 18:49:28 Eric Blake wrote:
>>>> On 01/09/2012 03:46 PM, Roger Pau Monné wrote:
>>>>> It creates the needed files, but exits with status 1. Is there anyway
>>>>> to generate config.sub without relying on Automake,
>>>>
>>>> Use 'cp'.  That's all the more automake was doing when it outputs lines
>>>> about installing helper files.
>>>
>>> i wish automake (and gettext) had modes where you could say "i just want
>>> you to install XXX helpers for me)".  copying things by hand is error
>>> prone due to changing install paths across versions and distros.
>>>
>>> automake --foreign -c -f --tools="config.sub config.guess"
>>
>> CCing bug-automake.  This feature would be generally useful: another
>> example for automake-using packages is that at "foreign" strictness the
>> INSTALL file is not copied, but maintainers may still want to include it.
>>
>> Perhaps a simpler and more flexible option is to add an option to
>> automake which prints out the location where it finds these files,
>> similar to aclocal --print-ac-dir.  Something like (for example)
>>
>>  % automake --print-snippet-dir
>>  /usr/share/automake-1.11
> 
> i'd be OK with that too if the assumption is that all relevant files people 
> want to manually copy would be in there (INSTALL, config.sub, etc...).
> 
Here is a patch adding a new "--print-libdir" option (naming selected for
consistency with the "--libdir=DIR" option).  I will push it by tomorrow if
there is no objection.

Regards,
  Stefano

>From d2d0564ee78c58c2a22fdb1af56787fa9e5b05f9 Mon Sep 17 00:00:00 2001
Message-Id: <d2d0564ee78c58c2a22fdb1af56787fa9e5b05f9.1329673418.git.stefano.lattar...@gmail.com>
From: Stefano Lattarini <stefano.lattar...@gmail.com>
Date: Sun, 19 Feb 2012 18:43:28 +0100
Subject: [PATCH] automake: new option to print locations of scripts and data
 files

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                    |    3 +++
 automake.in             |    4 +++-
 doc/automake.texi       |    6 ++++++
 tests/list-of-tests.mk  |    1 +
 tests/print-libdir.test |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 59 insertions(+), 1 deletions(-)
 create mode 100755 tests/print-libdir.test

diff --git a/NEWS b/NEWS
index c1de9b2..14aae55 100644
--- a/NEWS
+++ b/NEWS
@@ -116,6 +116,9 @@ New in 1.11a:
 
 * Miscellaneous changes:
 
+  - Automake has a new option '--print-lidir' 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.
diff --git a/automake.in b/automake.in
index 5ee9f8a..13e65df 100644
--- a/automake.in
+++ b/automake.in
@@ -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'; },
diff --git a/doc/automake.texi b/doc/automake.texi
index ef094c0..f342686 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -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
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index a80879f..d10f585 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -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
index 0000000..f5764b3
--- /dev/null
+++ b/tests/print-libdir.test
@@ -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
+
+:
-- 
1.7.9

Reply via email to