>From d2d0564ee78c58c2a22fdb1af56787fa9e5b05f9 Mon Sep 17 00:00:00 2001 Message-Id: From: Stefano Lattarini 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. address@hidden --print-libdir address@hidden --print-libdir +Print the path of the installation directory containing Automake-provided +scripts and data files (like e.g., @file{texinfo.texi} and address@hidden). + @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 . + +# 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 <