2008-03-11 Peter Breitenlohner <peb@mppmu.mpg.de>
+ Implement the `notrans_' prefix for untransformed manpages.
+ * automake.in (handle_man_pages), lib/am/mans.am: Implement
+ notrans_ prefix for MANS primary and rework dependencies for
+ install-man%SECTION%; use only vars defined in Makefile.am.
+ * doc/automake.texi (Renaming, Uniform, Man pages):
+ Document notrans_ prefix.
+ * NEWS: Update.
+ * tests/notrans.test: New test.
+ * tests/Makefile.am: Update.
+
* automake.in (handle_man_pages): Reindent, for next patch.
2008-03-08 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
- The `color-tests' option causes colored test result output on terminals.
+ - New prefix `notrans_' for manpages which should not be transformed
+ by --program-transform.
+
Bugs fixed in 1.10a:
* Long standing bugs:
# Find all the sections in use. We do this by first looking for
# "standard" sections, and then looking for any additional
# sections used in man_MANS.
- my (%sections, %vlist);
+ my (%sections, %notrans_sections, %trans_sections,
+ %notrans_vars, %trans_vars, %notrans_sect_vars, %trans_sect_vars);
# We handle nodist_ for uniformity. man pages aren't distributed
# by default so it isn't actually very important.
+ foreach my $npfx ('', 'notrans_')
+ {
foreach my $pfx ('', 'dist_', 'nodist_')
{
# Add more sections as needed.
foreach my $section ('0'..'9', 'n', 'l')
{
- my $varname = $pfx . 'man' . $section . '_MANS';
+ my $varname = $npfx . $pfx . 'man' . $section . '_MANS';
if (var ($varname))
{
$sections{$section} = 1;
$varname = '$(' . $varname . ')';
- $vlist{$varname} = 1;
+ if ($npfx eq 'notrans_')
+ {
+ $notrans_sections{$section} = 1;
+ $notrans_sect_vars{$varname} = 1;
+ }
+ else
+ {
+ $trans_sections{$section} = 1;
+ $trans_sect_vars{$varname} = 1;
+ }
&push_dist_common ($varname)
if $pfx eq 'dist_';
}
}
- my $varname = $pfx . 'man_MANS';
+ my $varname = $npfx . $pfx . 'man_MANS';
my $var = var ($varname);
if ($var)
{
if (/\.([0-9a-z])([a-z]*)$/)
{
$sections{$1} = 1;
+ if ($npfx eq 'notrans_')
+ {
+ $notrans_sections{$1} = 1;
+ }
+ else
+ {
+ $trans_sections{$1} = 1;
+ }
}
}
$varname = '$(' . $varname . ')';
- $vlist{$varname} = 1;
+ if ($npfx eq 'notrans_')
+ {
+ $notrans_vars{$varname} = 1;
+ }
+ else
+ {
+ $trans_vars{$varname} = 1;
+ }
&push_dist_common ($varname)
if $pfx eq 'dist_';
}
}
+ }
return unless %sections;
+ my @unsorted_deps;
+
+ # Build section independent variables.
+ my $have_notrans = %notrans_vars;
+ my @notrans_list = sort keys %notrans_vars;
+ my $have_trans = %trans_vars;
+ my @trans_list = sort keys %trans_vars;
+
# Now for each section, generate an install and uninstall rule.
# Sort sections so output is deterministic.
foreach my $section (sort keys %sections)
{
+ # Build section dependent variables.
+ my $notrans_mans = $have_notrans || exists $notrans_sections{$section};
+ my $trans_mans = $have_trans || exists $trans_sections{$section};
+ my (%notrans_this_sect, %trans_this_sect);
+ my $expr = 'man' . $section . '_MANS';
+ foreach my $varname (keys %notrans_sect_vars)
+ {
+ if ($varname =~ /$expr/)
+ {
+ $notrans_this_sect{$varname} = 1;
+ }
+ }
+ foreach my $varname (keys %trans_sect_vars)
+ {
+ if ($varname =~ /$expr/)
+ {
+ $trans_this_sect{$varname} = 1;
+ }
+ }
+ my @notrans_sect_list = sort keys %notrans_this_sect;
+ my @trans_sect_list = sort keys %trans_this_sect;
+ @unsorted_deps = (keys %notrans_vars, keys %trans_vars,
+ keys %notrans_this_sect, keys %trans_this_sect);
+ my @deps = sort @unsorted_deps;
$output_rules .= &file_contents ('mans',
new Automake::Location,
- SECTION => $section);
- }
-
- my @mans = sort keys %vlist;
+ SECTION => $section,
+ DEPS => "@deps",
+ NOTRANS_MANS => $notrans_mans,
+ NOTRANS_SECT_LIST => "@notrans_sect_list",
+ HAVE_NOTRANS => $have_notrans,
+ NOTRANS_LIST => "@notrans_list",
+ TRANS_MANS => $trans_mans,
+ TRANS_SECT_LIST => "@trans_sect_list",
+ HAVE_TRANS => $have_trans,
+ TRANS_LIST => "@trans_list");
+ }
+
+ @unsorted_deps = (keys %notrans_vars, keys %trans_vars,
+ keys %notrans_sect_vars, keys %trans_sect_vars);
+ my @mans = sort @unsorted_deps;
$output_vars .= file_contents ('mans-vars',
new Automake::Location,
MANS => "@mans");
@cindex Programs, renaming during installation
The GNU Build System provides means to automatically rename
-executables before they are installed. This is especially convenient
+executables and manpages before they are installed (@pxref{Man pages}).
+This is especially convenient
when installing a GNU package on a system that already has a
proprietary implementation you do not want to overwrite. For instance,
you may want to install GNU @command{tar} as @command{gtar} so you can
Some primaries also allow additional prefixes that control other
aspects of @command{automake}'s behavior. The currently defined prefixes
-are @samp{dist_}, @samp{nodist_}, and @samp{nobase_}. These prefixes
-are explained later (@pxref{Program and Library Variables}).
+are @samp{dist_}, @samp{nodist_}, @samp{nobase_}, and @samp{notrans_}.
+These prefixes are explained later (@pxref{Program and Library Variables})
+(@pxref{Man pages}).
@node Canonicalization
The @code{nobase_} prefix is meaningless for man pages and is
disallowed.
+@vindex notrans_
+@cindex @code{notrans_} prefix
+@cindex Man page renaming, avoiding
+@cindex Avoiding man page renaming
+
+Executables and manpages may be renamed upon installation
+(@pxref{Renaming}). For manpages this can be avoided by use of the
+@code{notrans_} prefix. For instance, suppose an executable @samp{foo}
+allowing to access a library function @samp{foo} from the command line.
+The way to avoid renaming of the @file{foo.3} manpage is:
+
+@example
+man_MANS = foo.1
+notrans_man_MANS = foo.3
+@end example
+
+@cindex @code{notrans_} and @code{dist_} or @code{nodist_}
+@cindex @code{dist_} and @code{notrans_}
+@cindex @code{nodist_} and @code{notrans_}
+
+@samp{notrans_} must be specified first when used in conjunction with
+either @samp{dist_} or @samp{nodist_} (@pxref{Dist}). For instance:
+
+@example
+notrans_dist_man3_MANS = bar.3
+@end example
@node Install
@chapter What Gets Installed
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1998, 2001, 2003, 2004, 2006, 2008 Free Software Foundation, Inc.
+## Copyright (C) 1998, 2001, 2003, 2004, 2006, 2008 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
?INSTALL-MAN?install-data-am: install-man
?INSTALL-MAN?am__installdirs += "$(DESTDIR)$(man%SECTION%dir)"
.PHONY install-man: install-man%SECTION%
-install-man%SECTION%: $(man%SECTION%_MANS) $(man_MANS)
+install-man%SECTION%: %DEPS%
@$(NORMAL_INSTALL)
test -z "$(man%SECTION%dir)" || $(MKDIR_P) "$(DESTDIR)$(man%SECTION%dir)"
- @list='$(man%SECTION%_MANS) $(dist_man%SECTION%_MANS) $(nodist_man%SECTION%_MANS)'; \
-## Extract all items from man_MANS that should go in this section.
+if %?NOTRANS_MANS%
+## Handle MANS with notrans_ prefix
+ @list='%NOTRANS_SECT_LIST%'; \
+## Extract all items from notrans_man_MANS that should go in this section.
## This must be done dynamically to support conditionals.
- l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
- for i in $$l2; do \
- case "$$i" in \
+?HAVE_NOTRANS? l2='%NOTRANS_LIST%'; \
+?HAVE_NOTRANS? for i in $$l2; do \
+?HAVE_NOTRANS? case "$$i" in \
## Have to accept files like `foo.1c'.
- *.%SECTION%*) list="$$list $$i" ;; \
+?HAVE_NOTRANS? *.%SECTION%*) list="$$list $$i" ;; \
+?HAVE_NOTRANS? esac; \
+?HAVE_NOTRANS? done; \
+ for i in $$list; do \
+## Find the file.
+ if test -f $$i; then file=$$i; \
+ else file=$(srcdir)/$$i; fi; \
+## Change the extension if needed.
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ %SECTION%*) ;; \
+ *) ext='%SECTION%' ;; \
esac; \
- done; \
+## Extract basename of man page and append extension.
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man%SECTION%dir)/$$inst"; \
+ done
+endif %?NOTRANS_MANS%
+if %?TRANS_MANS%
+## Handle MANS without notrans_ prefix
+ @list='%TRANS_SECT_LIST%'; \
+## Extract all items from man_MANS that should go in this section.
+## This must be done dynamically to support conditionals.
+?HAVE_TRANS? l2='%TRANS_LIST%'; \
+?HAVE_TRANS? for i in $$l2; do \
+?HAVE_TRANS? case "$$i" in \
+## Have to accept files like `foo.1c'.
+?HAVE_TRANS? *.%SECTION%*) list="$$list $$i" ;; \
+?HAVE_TRANS? esac; \
+?HAVE_TRANS? done; \
for i in $$list; do \
## Find the file.
if test -f $$i; then file=$$i; \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man%SECTION%dir)/$$inst"; \
done
+endif %?TRANS_MANS%
## -------------- ##
.PHONY uninstall-man: uninstall-man%SECTION%
uninstall-man%SECTION%:
@$(NORMAL_UNINSTALL)
- @list='$(man%SECTION%_MANS) $(dist_man%SECTION%_MANS) $(nodist_man%SECTION%_MANS)'; \
-## Extract all items from man_MANS that should go in this section.
+if %?NOTRANS_MANS%
+## Handle MANS with notrans_ prefix
+ @list='%NOTRANS_SECT_LIST%'; \
+## Extract all items from notrans_man_MANS that should go in this section.
## This must be done dynamically to support conditionals.
- l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
- for i in $$l2; do \
- case "$$i" in \
+?HAVE_NOTRANS? l2='%NOTRANS_LIST%'; \
+?HAVE_NOTRANS? for i in $$l2; do \
+?HAVE_NOTRANS? case "$$i" in \
## Have to accept files like `foo.1c'.
- *.%SECTION%*) list="$$list $$i" ;; \
+?HAVE_NOTRANS? *.%SECTION%*) list="$$list $$i" ;; \
+?HAVE_NOTRANS? esac; \
+?HAVE_NOTRANS? done; \
+ for i in $$list; do \
+## Change the extension if needed.
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ %SECTION%*) ;; \
+ *) ext='%SECTION%' ;; \
esac; \
- done; \
+## Extract basename of man page and append extension.
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man%SECTION%dir)/$$inst"; \
+ done
+endif %?NOTRANS_MANS%
+if %?TRANS_MANS%
+## Handle MANS without notrans_ prefix
+ @list='%TRANS_SECT_LIST%'; \
+## Extract all items from man_MANS that should go in this section.
+## This must be done dynamically to support conditionals.
+?HAVE_TRANS? l2='%TRANS_LIST%'; \
+?HAVE_TRANS? for i in $$l2; do \
+?HAVE_TRANS? case "$$i" in \
+## Have to accept files like `foo.1c'.
+?HAVE_TRANS? *.%SECTION%*) list="$$list $$i" ;; \
+?HAVE_TRANS? esac; \
+?HAVE_TRANS? done; \
for i in $$list; do \
## Change the extension if needed.
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
echo " rm -f '$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \
rm -f "$(DESTDIR)$(man%SECTION%dir)/$$inst"; \
done
+endif %?TRANS_MANS%
noinstdir.test \
nolink.test \
nostdinc.test \
+notrans.test \
number.test \
objc.test \
objc2.test \
noinstdir.test \
nolink.test \
nostdinc.test \
+notrans.test \
number.test \
objc.test \
objc2.test \
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2008 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 3, 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/>.
+
+# Check all notrans_, dist_, nodist_ prefix combinations for MANS
+# primary and install-man dependencies.
+
+. ./defs || exit 1
+
+set -e
+
+cat >>configure.in <<'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'EOF'
+man_MANS = foo.1
+dist_man_MANS = bar.2
+nodist_man_MANS = baz.3
+notrans_man_MANS = x-foo.4
+notrans_dist_man_MANS = x-bar.5
+notrans_nodist_man_MANS = x-baz.6
+man7_MANS = y-foo.man
+dist_man5_MANS = y-bar.man
+nodist_man4_MANS = y-baz.man
+notrans_man3_MANS = z-foo.man
+notrans_dist_man2_MANS = z-bar.man
+notrans_nodist_man1_MANS = z-baz.man
+
+# These two are ignored
+dist_notrans_man_MANS = nosuch.8
+nodist_notrans_man9_MANS = nosuch.man
+
+y-foo.man:
+ : >$@
+y-bar.man:
+ : >$@
+y-baz.man:
+ : >$@
+z-foo.man:
+ : >$@
+z-bar.man:
+ : >$@
+z-baz.man:
+ : >$@
+
+test-install: install
+ test -f inst/man/man1/gnu-foo.1
+ test -f inst/man/man2/gnu-bar.2
+ test -f inst/man/man3/gnu-baz.3
+ test -f inst/man/man4/x-foo.4
+ test -f inst/man/man5/x-bar.5
+ test -f inst/man/man6/x-baz.6
+ test -f inst/man/man7/gnu-y-foo.7
+ test -f inst/man/man5/gnu-y-bar.5
+ test -f inst/man/man4/gnu-y-baz.4
+ test -f inst/man/man3/z-foo.3
+ test -f inst/man/man2/z-bar.2
+ test -f inst/man/man1/z-baz.1
+ if test -d inst/man/man8; then (exit 1); else :; fi
+ if test -d inst/man/man9; then (exit 1); else :; fi
+EOF
+
+: > foo.1
+: > bar.2
+: > baz.3
+: > x-foo.4
+: > x-bar.5
+: > x-baz.6
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+grep '^install-man1:' Makefile.in | grep '\$(man_MANS)'
+grep '^install-man2:' Makefile.in | grep '\$(dist_man_MANS)'
+grep '^install-man3:' Makefile.in | grep '\$(nodist_man_MANS)'
+grep '^install-man4:' Makefile.in | grep '\$(notrans_man_MANS)'
+grep '^install-man5:' Makefile.in | grep '\$(notrans_dist_man_MANS)'
+grep '^install-man6:' Makefile.in | grep '\$(notrans_nodist_man_MANS)'
+
+if grep '^install-man8:' Makefile.in; then exit 1; else :; fi
+if grep '^install-man9:' Makefile.in; then exit 1; else :; fi
+
+./configure --program-prefix=gnu- --prefix "`pwd`"/inst --mandir "`pwd`"/inst/man
+$MAKE
+$MAKE test-install
+test `find inst/man -type f -print | wc -l` = 12
+$MAKE uninstall
+test `find inst/man -type f -print | wc -l` = 0
+
+# Opportunistically test for installdirs.
+rm -rf inst
+$MAKE installdirs
+test -d inst/man/man1
+test -d inst/man/man2
+test -d inst/man/man3
+test -d inst/man/man4
+test -d inst/man/man5
+test -d inst/man/man6
+test -d inst/man/man7
+if test -d inst/man/man8; then exit 1; else :; fi
+if test -d inst/man/man9; then exit 1; else :; fi