[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Explanation needed?
From: |
Eric Blake |
Subject: |
Re: Explanation needed? |
Date: |
Tue, 24 Feb 2009 16:46:52 +0000 (UTC) |
User-agent: |
Loom/3.14 (http://gmane.org/) |
Reuben Thomas <rrt <at> sc3d.org> writes:
> >> edit = sed \
> >> -e 's|@address@hidden|$(pkgdatadir)|g' \
> >> -e 's|@address@hidden|$(prefix)|g'
> >
> > Thanks for spotting this. It looks like the example has confusing datadir
> > with pkgdatadir since Jul 2000, even before GNU Coding Standards added
> > pkgdatadir as a mandatory variable. I'll work on a patch to make it
> > consistent.
It turns out that pkgdatadir is not a GCS mandated variable; rather, it is an
automake shorthand for $(pkgdir)/$(PACKAGE). I guess I was thinking of the
addition of $(datarootdir), which indirectly impacts $(datadir) and
$(pkgdatadir).
>
> But it's not wrong, in the sense that it does reflect the actual code in
> autoconf!
Good point. But that only means that autoconf is not setting a very good
example. I'd rather use $pkgdatadir to be clear that we mean
$datadir/autoconf, rather than abusing $datadir with two different meanings
(one during configure, another in all the *.in files). So, I'm committing this.
From: Eric Blake <address@hidden>
Date: Tue, 24 Feb 2009 09:27:15 -0700
Subject: [PATCH] Use pkgdatadir consistently.
* bin/Makefile.am (edit): Substitute pkgdatadir, not datadir.
* lib/Makefile.am (edit): Likewise.
* lib/autom4te.in (Autoconf-without-aclocal-m4, Autotest, M4sh)
(M4sugar): Use @pkgdatadir@, not @address@hidden
* bin/autoheader.in ($datadir): Likewise.
* bin/autom4te.in ($datadir): Likewise.
* bin/autoreconf.in ($datadir): Likewise.
* bin/autoscan.in ($datadir): Likewise.
* bin/autoupdate.in ($datadir): Likewise.
* bin/ifnames.in ($datadir): Likewise.
* doc/autoconf.texi (Installation Directory Variables): Update
example to be consistent; focus on $(bindir) as an autoconf
variable, and mention that $(pkgdatadir) comes from automake.
Reported by Reuben Thomas.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 18 ++++++++++++++++++
bin/Makefile.am | 6 +++---
bin/autoheader.in | 4 ++--
bin/autom4te.in | 8 ++++----
bin/autoreconf.in | 4 ++--
bin/autoscan.in | 6 +++---
bin/autoupdate.in | 6 +++---
bin/ifnames.in | 4 ++--
doc/autoconf.texi | 23 +++++++++++++++--------
lib/Makefile.am | 6 +++---
lib/autom4te.in | 12 ++++++------
11 files changed, 61 insertions(+), 36 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c68d1b5..08f9e29 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2009-02-24 Eric Blake <address@hidden>
+
+ Use pkgdatadir consistently.
+ * bin/Makefile.am (edit): Substitute pkgdatadir, not datadir.
+ * lib/Makefile.am (edit): Likewise.
+ * lib/autom4te.in (Autoconf-without-aclocal-m4, Autotest, M4sh)
+ (M4sugar): Use @pkgdatadir@, not @address@hidden
+ * bin/autoheader.in ($datadir): Likewise.
+ * bin/autom4te.in ($datadir): Likewise.
+ * bin/autoreconf.in ($datadir): Likewise.
+ * bin/autoscan.in ($datadir): Likewise.
+ * bin/autoupdate.in ($datadir): Likewise.
+ * bin/ifnames.in ($datadir): Likewise.
+ * doc/autoconf.texi (Installation Directory Variables): Update
+ example to be consistent; focus on $(bindir) as an autoconf
+ variable, and mention that $(pkgdatadir) comes from automake.
+ Reported by Reuben Thomas.
+
2009-02-19 Eric Blake <address@hidden>
Use m4_translit more efficiently in AS_ESCAPE.
diff --git a/bin/Makefile.am b/bin/Makefile.am
index acb5e61..ba88ab0 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -1,7 +1,7 @@
# Make Autoconf commands.
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free
-# Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+# 2009 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
@@ -39,7 +39,7 @@ edit = sed \
-e 's|@address@hidden|$(SHELL)|g' \
-e 's|@address@hidden|$(PERL)|g' \
-e 's|@address@hidden|$(bindir)|g' \
- -e 's|@address@hidden|$(pkgdatadir)|g' \
+ -e 's|@address@hidden|$(pkgdatadir)|g' \
-e 's|@address@hidden|$(prefix)|g' \
-e 's|@address@hidden|'`echo autoconf | sed '$(transform)'`'|g' \
-e 's|@address@hidden|'`echo autoheader | sed '$(transform)'`'|g' \
diff --git a/bin/autoheader.in b/bin/autoheader.in
index 66a2f2c..9f9fba3 100644
--- a/bin/autoheader.in
+++ b/bin/autoheader.in
@@ -31,8 +31,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -
S "$0" "$@";; esac'
BEGIN
{
- my $datadir = $ENV{'autom4te_perllibdir'} || '@datadir@';
- unshift @INC, "$datadir";
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
+ unshift @INC, "$pkgdatadir";
# Override SHELL. On DJGPP SHELL may not be set to a shell
# that can handle redirection and quote arguments correctly,
diff --git a/bin/autom4te.in b/bin/autom4te.in
index 946452c..471b165 100644
--- a/bin/autom4te.in
+++ b/bin/autom4te.in
@@ -27,8 +27,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -
S "$0" "$@";; esac'
BEGIN
{
- my $datadir = $ENV{'autom4te_perllibdir'} || '@datadir@';
- unshift @INC, $datadir;
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
+ unshift @INC, $pkgdatadir;
# Override SHELL. On DJGPP SHELL may not be set to a shell
# that can handle redirection and quote arguments correctly,
@@ -47,7 +47,7 @@ use File::Basename;
use strict;
# Data directory.
-my $datadir = $ENV{'AC_MACRODIR'} || '@datadir@';
+my $pkgdatadir = $ENV{'AC_MACRODIR'} || '@pkgdatadir@';
# $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE.
my %language;
@@ -958,7 +958,7 @@ sub freeze ($)
## -------------- ##
mktmpdir ('am4t');
-load_configuration ($ENV{'AUTOM4TE_CFG'} || "$datadir/autom4te.cfg");
+load_configuration ($ENV{'AUTOM4TE_CFG'} || "$pkgdatadir/autom4te.cfg");
load_configuration ("$ENV{'HOME'}/.autom4te.cfg")
if exists $ENV{'HOME'} && -f "$ENV{'HOME'}/.autom4te.cfg";
load_configuration (".autom4te.cfg")
diff --git a/bin/autoreconf.in b/bin/autoreconf.in
index 9bedbf6..2eae717 100644
--- a/bin/autoreconf.in
+++ b/bin/autoreconf.in
@@ -29,8 +29,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -
S "$0" "$@";; esac'
BEGIN
{
- my $datadir = $ENV{'autom4te_perllibdir'} || '@datadir@';
- unshift @INC, $datadir;
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
+ unshift @INC, $pkgdatadir;
# Override SHELL. On DJGPP SHELL may not be set to a shell
# that can handle redirection and quote arguments correctly,
diff --git a/bin/autoscan.in b/bin/autoscan.in
index df39c9b..75abd1c 100644
--- a/bin/autoscan.in
+++ b/bin/autoscan.in
@@ -28,8 +28,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -
S "$0" "$@";; esac'
BEGIN
{
- my $datadir = $ENV{'autom4te_perllibdir'} || '@datadir@';
- unshift @INC, $datadir;
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
+ unshift @INC, $pkgdatadir;
# Override SHELL. On DJGPP SHELL may not be set to a shell
# that can handle redirection and quote arguments correctly,
@@ -97,7 +97,7 @@ my $log;
my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';
my $autoconf = "$autom4te --language=autoconf";
my @prepend_include;
-my @include = ('@datadir@');
+my @include = ('@pkgdatadir@');
# $help
# -----
diff --git a/bin/autoupdate.in b/bin/autoupdate.in
index 50987b4..e6f17e7 100644
--- a/bin/autoupdate.in
+++ b/bin/autoupdate.in
@@ -29,8 +29,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -
S "$0" "$@";; esac'
BEGIN
{
- my $datadir = $ENV{'autom4te_perllibdir'} || '@datadir@';
- unshift @INC, $datadir;
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
+ unshift @INC, $pkgdatadir;
# Override SHELL. On DJGPP SHELL may not be set to a shell
# that can handle redirection and quote arguments correctly,
@@ -53,7 +53,7 @@ my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@';
my $autoconf = "$autom4te --language=autoconf";
# We need to find m4sugar.
my @prepend_include;
-my @include = ('@datadir@');
+my @include = ('@pkgdatadir@');
my $force = 0;
# m4.
my $m4 = $ENV{"M4"} || '@M4@';
diff --git a/bin/ifnames.in b/bin/ifnames.in
index f99e4b9..d470744 100644
--- a/bin/ifnames.in
+++ b/bin/ifnames.in
@@ -33,8 +33,8 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -
S "$0" "$@";; esac'
BEGIN
{
- my $datadir = $ENV{'autom4te_perllibdir'} || '@datadir@';
- unshift @INC, $datadir;
+ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@';
+ unshift @INC, $pkgdatadir;
# Override SHELL. On DJGPP SHELL may not be set to a shell
# that can handle redirection and quote arguments correctly,
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index dcf591d..0c0740b 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -2729,7 +2729,7 @@ Installation Directory Variables
@code{CPPFLAGS} (@code{AM_CPPFLAGS} if you are also using Automake).
Similarly, you should not rely on @code{AC_CONFIG_FILES} to replace
address@hidden and friends in your shell scripts and other files; instead,
address@hidden and friends in your shell scripts and other files; instead,
let @command{make} manage their replacement. For instance Autoconf
ships templates of its shell scripts ending with @samp{.in}, and uses a
makefile snippet similar to the following to build scripts like
@@ -2738,14 +2738,17 @@ Installation Directory Variables
@example
@group
edit = sed \
- -e 's|@@datadir[@@]|$(pkgdatadir)|g' \
+ -e 's|@@bindir[@@]|$(bindir)|g' \
+ -e 's|@@pkgdatadir[@@]|$(pkgdatadir)|g' \
-e 's|@@prefix[@@]|$(prefix)|g'
@end group
@group
autoheader autom4te: Makefile
rm -f $@@ $@@.tmp
- $(edit) '$(srcdir)/$@@.in' >$@@.tmp
+ srcdir=''; \
+ test -f ./$@@.in || srcdir=$(srcdir)/; \
+ $(edit) address@hidden@}$@@.in >$@@.tmp
chmod +x $@@.tmp
chmod a-w $@@.tmp
mv $@@.tmp $@@
@@ -2760,20 +2763,24 @@ Installation Directory Variables
Some details are noteworthy:
@table @asis
address@hidden @samp{@@datadir[@@]}
address@hidden @samp{@@bindir[@@]}
The brackets prevent @command{configure} from replacing
address@hidden@@datadir@@} in the Sed expression itself.
address@hidden@@bindir@@} in the Sed expression itself.
Brackets are preferable to a backslash here, since
Posix says @samp{\@@} is not portable.
address@hidden @samp{$(pkgdatadir)}
-Don't use @samp{@@pkgdatadir@@}! Use the matching makefile variable
address@hidden @samp{$(bindir)}
+Don't use @samp{@@bindir@@}! Use the matching makefile variable
instead.
address@hidden @samp{$(pkgdatadir)}
+The example takes advantage of the variable @samp{$(pkgdatadir)}
+provided by Automake; it is equivalent to @samp{$(datadir)/$(PACKAGE)}.
+
@item @samp{/}
Don't use @samp{/} in the Sed expressions that replace file names since
most likely the
-variables you use, such as @samp{$(pkgdatadir)}, contain @samp{/}.
+variables you use, such as @samp{$(bindir)}, contain @samp{/}.
Use a shell metacharacter instead, such as @samp{|}.
@item special characters
diff --git a/lib/Makefile.am b/lib/Makefile.am
index ac5dfb9..ab52b66 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -1,7 +1,7 @@
# Make Autoconf-related libraries.
-# Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
-# Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2009 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
@@ -24,7 +24,7 @@ edit = sed \
-e 's|@address@hidden|$(SHELL)|g' \
-e 's|@address@hidden|$(PERL)|g' \
-e 's|@address@hidden|$(bindir)|g' \
- -e 's|@address@hidden|$(pkgdatadir)|g' \
+ -e 's|@address@hidden|$(pkgdatadir)|g' \
-e 's|@address@hidden|$(prefix)|g' \
-e 's|@address@hidden|'`echo autoconf | sed '$(transform)'`'|g' \
-e 's|@address@hidden|'`echo autoheader | sed '$(transform)'`'|g' \
diff --git a/lib/autom4te.in b/lib/autom4te.in
index 36ea61a..e473fd4 100644
--- a/lib/autom4te.in
+++ b/lib/autom4te.in
@@ -1,7 +1,7 @@
# Definition of Autom4te option sets. -*- Makefile -*-
#
-# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free
-# Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+# Free Software Foundation, Inc.
#
# This file is part of GNU Autoconf.
#
@@ -100,7 +100,7 @@ end-language: "Autoreconf-preselections"
# This intermediate language is used by aclocal to build aclocal.m4.
begin-language: "Autoconf-without-aclocal-m4"
-args: --prepend-include '@datadir@'
+args: --prepend-include '@pkgdatadir@'
args: --cache=autom4te.cache
args: autoconf/autoconf.m4f
args: acsite.m4?
@@ -127,7 +127,7 @@ end-language: "Autoconf"
## -------- ##
begin-language: "Autotest"
-args: --prepend-include '@datadir@'
+args: --prepend-include '@pkgdatadir@'
args: autotest/autotest.m4f
args: package.m4?
args: local.at?
@@ -141,7 +141,7 @@ end-language: "Autotest"
## ---- ##
begin-language: "M4sh"
-args: --prepend-include '@datadir@'
+args: --prepend-include '@pkgdatadir@'
args: m4sugar/m4sh.m4f
args: --mode 777
args: --language M4sugar
@@ -153,7 +153,7 @@ end-language: "M4sh"
## ------- ##
begin-language: "M4sugar"
-args: --prepend-include '@datadir@'
+args: --prepend-include '@pkgdatadir@'
args: m4sugar/m4sugar.m4f
args: --warnings syntax
end-language: "M4sugar"
--
1.6.1.2