From: Eric Blake Date: Tue, 24 Feb 2009 16:27:15 +0000 (-0700) Subject: Use pkgdatadir consistently. X-Git-Tag: v2.63b~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b35598a688ebba088500e96735bf25f920db6192;p=thirdparty%2Fautoconf.git 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 @datadir@. * 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 --- diff --git a/ChangeLog b/ChangeLog index c68d1b5de..08f9e292c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2009-02-24 Eric Blake + + 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 @datadir@. + * 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 Use m4_translit more efficiently in AS_ESCAPE. diff --git a/bin/Makefile.am b/bin/Makefile.am index acb5e61b9..ba88ab01f 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|@SHELL[@]|$(SHELL)|g' \ -e 's|@PERL[@]|$(PERL)|g' \ -e 's|@bindir[@]|$(bindir)|g' \ - -e 's|@datadir[@]|$(pkgdatadir)|g' \ + -e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \ -e 's|@prefix[@]|$(prefix)|g' \ -e 's|@autoconf-name[@]|'`echo autoconf | sed '$(transform)'`'|g' \ -e 's|@autoheader-name[@]|'`echo autoheader | sed '$(transform)'`'|g' \ diff --git a/bin/autoheader.in b/bin/autoheader.in index 66a2f2cf9..9f9fba36e 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 946452cd4..471b1656c 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 9bedbf643..2eae7176c 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 df39c9b19..75abd1cd2 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 50987b47f..e6f17e7f8 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 f99e4b973..d470744c2 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 dcf591d28..0c0740b8d 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -2729,7 +2729,7 @@ you should add @code{CPPFLAGS} (@code{AM_CPPFLAGS} if you are also using Automake). Similarly, you should not rely on @code{AC_CONFIG_FILES} to replace -@code{datadir} and friends in your shell scripts and other files; instead, +@code{bindir} 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 @@ makefile snippet similar to the following to build scripts like @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) $$@{srcdir@}$@@.in >$@@.tmp chmod +x $@@.tmp chmod a-w $@@.tmp mv $@@.tmp $@@ @@ -2760,20 +2763,24 @@ autom4te: $(srcdir)/autom4te.in Some details are noteworthy: @table @asis -@item @samp{@@datadir[@@]} +@item @samp{@@bindir[@@]} The brackets prevent @command{configure} from replacing -@samp{@@datadir@@} in the Sed expression itself. +@samp{@@bindir@@} in the Sed expression itself. Brackets are preferable to a backslash here, since Posix says @samp{\@@} is not portable. -@item @samp{$(pkgdatadir)} -Don't use @samp{@@pkgdatadir@@}! Use the matching makefile variable +@item @samp{$(bindir)} +Don't use @samp{@@bindir@@}! Use the matching makefile variable instead. +@item @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 ac5dfb95a..ab52b66db 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|@SHELL[@]|$(SHELL)|g' \ -e 's|@PERL[@]|$(PERL)|g' \ -e 's|@bindir[@]|$(bindir)|g' \ - -e 's|@datadir[@]|$(pkgdatadir)|g' \ + -e 's|@pkgdatadir[@]|$(pkgdatadir)|g' \ -e 's|@prefix[@]|$(prefix)|g' \ -e 's|@autoconf-name[@]|'`echo autoconf | sed '$(transform)'`'|g' \ -e 's|@autoheader-name[@]|'`echo autoheader | sed '$(transform)'`'|g' \ diff --git a/lib/autom4te.in b/lib/autom4te.in index 36ea61a6c..e473fd442 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"