summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkim Demaille <akim@epita.fr>2005-01-27 10:53:41 +0000
committerAkim Demaille <akim@epita.fr>2005-01-27 10:53:41 +0000
commitcdd416b0fe6ca618c48c4e7d4f186b6f735b61d1 (patch)
tree18b8b28984638b32223984ca90f21fe2501d984e
parent4c98943ec666761be915396fb099d9c4b02a0db7 (diff)
downloadautoconf-cdd416b0fe6ca618c48c4e7d4f186b6f735b61d1.tar.gz
Have autoheader honor --force.
* doc/make-stds.texi, doc/standards.texi: Update from masters. * lib/Autom4te/Channels.pm, lib/Autom4te/Configure_ac.pm * lib/Autom4te/FileUtils.pm, lib/Autom4te/XFile.pm: Update from masters, so that FileUtils.pm's update_file provide --force support. * bin/autoheader.in: Pass $force to update_file so that config.h.in is always recreated when --force.
-rw-r--r--ChangeLog12
-rw-r--r--bin/autoheader.in4
-rw-r--r--doc/make-stds.texi132
-rw-r--r--doc/standards.texi125
-rw-r--r--lib/Autom4te/Channels.pm13
-rw-r--r--lib/Autom4te/Configure_ac.pm2
-rw-r--r--lib/Autom4te/FileUtils.pm93
-rw-r--r--lib/Autom4te/XFile.pm8
-rw-r--r--man/autoheader.18
9 files changed, 280 insertions, 117 deletions
diff --git a/ChangeLog b/ChangeLog
index 3484be5a..3fda888b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2005-01-27 Akim Demaille <akim@epita.fr>
+
+ Have autoheader honor --force.
+
+ * doc/make-stds.texi, doc/standards.texi: Update from masters.
+ * lib/Autom4te/Channels.pm, lib/Autom4te/Configure_ac.pm
+ * lib/Autom4te/FileUtils.pm, lib/Autom4te/XFile.pm: Update
+ from masters, so that FileUtils.pm's update_file provide --force
+ support.
+ * bin/autoheader.in: Pass $force to update_file so that
+ config.h.in is always recreated when --force.
+
2005-01-24 Stepan Kasal <kasal@ucw.cz>
* doc/autoconf.texi (Introduction): Update Peter Simons' address.
diff --git a/bin/autoheader.in b/bin/autoheader.in
index 544afb63..b4ad709e 100644
--- a/bin/autoheader.in
+++ b/bin/autoheader.in
@@ -8,7 +8,7 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
# autoheader -- create `config.h.in' from `configure.ac'
# Copyright (C) 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004 Free Software Foundation, Inc.
+# 2003, 2004, 2005 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
@@ -280,7 +280,7 @@ $out->close;
if keys %symbol;
}
-update_file ("$tmp/config.hin", "$config_h_in");
+update_file ("$tmp/config.hin", "$config_h_in", $force);
### Setup "GNU" style for perl-mode and cperl-mode.
## Local Variables:
diff --git a/doc/make-stds.texi b/doc/make-stds.texi
index 8b58fa0a..24bb5d04 100644
--- a/doc/make-stds.texi
+++ b/doc/make-stds.texi
@@ -8,8 +8,8 @@
@cindex conventions for makefiles
@cindex standards for makefiles
-@c Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001 Free
-@c Software Foundation, Inc.
+@c Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
+@c 2004, 2005 Free @c Software Foundation, Inc.
@c Permission is granted to copy, distribute and/or modify this document
@c under the terms of the GNU Free Documentation License, Version 1.1
@@ -388,10 +388,10 @@ write it as @file{$(prefix)/share}. @samp{datadir}'s default value is
based on this variable; so are @samp{infodir}, @samp{mandir}, and others.
@item datadir
-The directory for installing ideosyncratic read-only
+The directory for installing idiosyncratic read-only
architecture-independent data files for this program. This is usually
the same place as @samp{datarootdir}, but we use the two separate
-variables so that you can move these ideosyncratic files without
+variables so that you can move these idiosyncratic files without
altering the location for Info files, man pages, etc.
The default definition of @samp{datadir} should be
@@ -471,11 +471,34 @@ package.
To tell whether @file{foo.h} came from the Foo package, put a magic
string in the file---part of a comment---and @code{grep} for that string.
+@item docdir
+The directory for installing documentation files (other than Info) for
+this package. By default, it should be
+@file{/usr/local/share/doc/@var{yourpkg}}, but it should be written as
+@file{$(datarootdir)/doc/@var{yourpkg}}. (If you are using Autoconf,
+write it as @samp{@@docdir@@}.) The @var{yourpkg} subdirectory, which
+may include a version number, prevents collisions among files with
+common names, such as @file{README}.
+
@item infodir
The directory for installing the Info files for this package. By
default, it should be @file{/usr/local/share/info}, but it should be
written as @file{$(datarootdir)/info}. (If you are using Autoconf,
-write it as @samp{@@infodir@@}.)
+write it as @samp{@@infodir@@}.) @code{infodir} is separate from
+@code{docdir} for compatibility with existing practice.
+
+@item htmldir
+@itemx dvidir
+@itemx pdfdir
+@itemx psdir
+Directories for installing documentation files in the particular
+format. (It is not required to support documentation in all these
+formats.) They should all be set to @code{$(docdir)} by default. (If
+you are using Autoconf, write them as @samp{@@htmldir@@},
+@samp{@@dvidir@@}, etc.) Packages which supply several translations
+of their documentation should install them in
+@samp{$(htmldir)/}@var{ll}, @samp{$(pdfdir)/}@var{ll}, etc. where
+@var{ll} is a locale abbreviation such as @samp{en} or @samp{pt_BR}.
@item libdir
The directory for object files and libraries of object code. Do not
@@ -654,9 +677,27 @@ commands into three categories: normal ones, @dfn{pre-installation}
commands and @dfn{post-installation} commands. @xref{Install Command
Categories}.
+@item install-html
+@itemx install-dvi
+@itemx install-pdf
+@itemx install-ps
+These targets install documentation in formats other than Info;
+they're intended to be called explicitly by the person installing the
+package, if that format is desired. GNU prefers Info files, so these
+must be installed by the @code{install} target.
+
+When you have many documentation files to install, we recommend that
+you avoid collisions and clutter by arranging for these targets to
+install in subdirectories of the appropriate installation directory,
+such as @code{htmldir}. As one example, if your package has multiple
+manuals, and you wish to install HTML documentation with many files
+(such as the ``split'' mode output by @code{makeinfo --html}), you'll
+certainly want to use subdirectories, or two nodes with the same name
+in different manuals will overwrite each other.
+
@item uninstall
Delete all the installed files---the copies that the @samp{install}
-target creates.
+and @samp{install-*} targets create.
This rule should not modify the directories where compilation is done,
only the directories where files are installed.
@@ -692,18 +733,24 @@ executable elsewhere in case there is a bug.
@comment in the printed Make manual. Please leave it in.
@item clean
-Delete all files from the current directory that are normally created by
-building the program. Don't delete the files that record the
-configuration. Also preserve files that could be made by building, but
-normally aren't because the distribution comes with them.
+Delete all files in the current directory that are normally created by
+building the program. Also delete files in other directories if they
+are created by this makefile. However, don't delete the files that
+record the configuration. Also preserve files that could be made by
+building, but normally aren't because the distribution comes with
+them. There is no need to delete parent directories that were created
+with @samp{mkdir -p}, since they could have existed anyway.
Delete @file{.dvi} files here if they are not part of the distribution.
@item distclean
-Delete all files from the current directory that are created by
-configuring or building the program. If you have unpacked the source
-and built the program without creating any other files, @samp{make
-distclean} should leave only the files that were in the distribution.
+Delete all files in the current directory (or created by this
+makefile) that are created by configuring or building the program. If
+you have unpacked the source and built the program without creating
+any other files, @samp{make distclean} should leave only the files
+that were in the distribution. However, there is no need to delete
+parent directories that were created with @samp{mkdir -p}, since they
+could have existed anyway.
@item mostlyclean
Like @samp{clean}, but may refrain from deleting a few files that people
@@ -712,18 +759,21 @@ target for GCC does not delete @file{libgcc.a}, because recompiling it
is rarely necessary and takes a lot of time.
@item maintainer-clean
-Delete almost everything from the current directory that can be
-reconstructed with this Makefile. This typically includes everything
-deleted by @code{distclean}, plus more: C source files produced by
-Bison, tags tables, Info files, and so on.
+Delete almost everything that can be reconstructed with this Makefile.
+This typically includes everything deleted by @code{distclean}, plus
+more: C source files produced by Bison, tags tables, Info files, and
+so on.
The reason we say ``almost everything'' is that running the command
-@samp{make maintainer-clean} should not delete @file{configure} even if
-@file{configure} can be remade using a rule in the Makefile. More generally,
-@samp{make maintainer-clean} should not delete anything that needs to
-exist in order to run @file{configure} and then begin to build the
-program. This is the only exception; @code{maintainer-clean} should
-delete everything else that can be rebuilt.
+@samp{make maintainer-clean} should not delete @file{configure} even
+if @file{configure} can be remade using a rule in the Makefile. More
+generally, @samp{make maintainer-clean} should not delete anything
+that needs to exist in order to run @file{configure} and then begin to
+build the program. Also, there is no need to delete parent
+directories that were created with @samp{mkdir -p}, since they could
+have existed anyway. These are the only exceptions;
+@code{maintainer-clean} should delete everything else that can be
+rebuilt.
The @samp{maintainer-clean} target is intended to be used by a maintainer of
the package, not by ordinary users. You may need special tools to
@@ -767,8 +817,11 @@ users build the package, ordinarily Make will not update the Info files
because they will already be up to date.
@item dvi
-Generate DVI files for all Texinfo documentation.
-For example:
+@itemx html
+@itemx pdf
+@itemx ps
+Generate documentation files in the given format, if possible.
+Here's an example rule for generating DVI files from Texinfo:
@smallexample
dvi: foo.dvi
@@ -784,6 +837,20 @@ distribution.@footnote{@code{texi2dvi} uses @TeX{} to do the real work
of formatting. @TeX{} is not distributed with Texinfo.} Alternatively,
write just the dependencies, and allow GNU @code{make} to provide the command.
+Here's another example, this one for generating HTML from Texinfo:
+
+@smallexample
+html: foo.html
+
+foo.html: foo.texi chap1.texi chap2.texi
+ $(TEXI2HTML) $(srcdir)/foo.texi
+@end smallexample
+
+@noindent
+Again, you would define the variable @code{TEXI2HTML} in the Makefile;
+for example, it might run @code{makeinfo --no-split --html}
+(@command{makeinfo} is part of the Texinfo distribution).
+
@item dist
Create a distribution tar file for this program. The tar file should be
set up so that the file names in the tar file start with a subdirectory
@@ -956,10 +1023,12 @@ execute the pre-installation and post-installation commands.
Programs to build binary packages work by extracting the
pre-installation and post-installation commands. Here is one way of
-extracting the pre-installation commands:
+extracting the pre-installation commands (the @option{-s} option to
+@command{make} is needed to silence messages about entering
+subdirectories):
@smallexample
-make -n install -o all \
+make -s -n install -o all \
PRE_INSTALL=pre-install \
POST_INSTALL=post-install \
NORMAL_INSTALL=normal-install \
@@ -970,10 +1039,7 @@ make -n install -o all \
where the file @file{pre-install.awk} could contain this:
@smallexample
-$0 ~ /^\t[ \t]*(normal_install|post_install)[ \t]*$/ @{on = 0@}
+$0 ~ /^(normal-install|post-install)[ \t]*$/ @{on = 0@}
on @{print $0@}
-$0 ~ /^\t[ \t]*pre_install[ \t]*$/ @{on = 1@}
+$0 ~ /^pre-install[ \t]*$/ @{on = 1@}
@end smallexample
-
-The resulting file of pre-installation commands is executed as a shell
-script as part of installing the binary package.
diff --git a/doc/standards.texi b/doc/standards.texi
index 2facefa1..9f1cfbf3 100644
--- a/doc/standards.texi
+++ b/doc/standards.texi
@@ -3,7 +3,7 @@
@setfilename standards.info
@settitle GNU Coding Standards
@c This date is automagically updated when you save this file:
-@set lastupdate February 20, 2004
+@set lastupdate January 1, 2005
@c %**end of header
@dircategory GNU organization
@@ -94,15 +94,9 @@ This release of the GNU Coding Standards was last updated
@cindex downloading this manual
If you did not obtain this file directly from the GNU project and
recently, please check for a newer version. You can get the GNU
-Coding Standards from the GNU World Wide Web server host in several
-different formats: @uref{http://www.gnu.org/prep/standards.text},
-@uref{http://www.gnu.org/prep/standards.info}, and
-@uref{http://www.gnu.org/prep/standards.dvi}, as well as the
-Texinfo ``source'' which is divided in two files:
-@uref{http://www.gnu.org/prep/standards.texi} and
-@uref{http://www.gnu.org/prep/make-stds.texi}. The GNU Coding
-Standards are also available in HTML format starting at
-@uref{http://www.gnu.org/prep/standards_toc.html}.
+Coding Standards from the GNU web server in many
+different formats, including the Texinfo source, PDF, HTML, DVI, plain
+text, and more, at: @uref{http://www.gnu.org/prep/standards/}.
Corrections or suggestions for this document should be sent to
@email{bug-standards@@gnu.org}. If you make a suggestion, please include a
@@ -130,7 +124,7 @@ world!}. @uref{http://www.gnu.org/software/hello/hello.html}.
@chapter Keeping Free Software Free
@cindex legal aspects
-This @value{CHAPTER} discusses how you can make sure that GNU software
+This chapter discusses how you can make sure that GNU software
avoids legal difficulties, and other related issues.
@menu
@@ -208,7 +202,7 @@ You might have to take that code out again!
You don't need papers for changes of a few lines here or there, since
they are not significant for copyright purposes. Also, you don't need
papers if all you get from the suggestion is some ideas, not actual code
-which you use. For example, if someone send you one implementation, but
+which you use. For example, if someone sent you one implementation, but
you write a different implementation of the same idea, you don't need to
get papers.
@@ -218,7 +212,8 @@ result.
We have more detailed advice for maintainers of programs; if you have
reached the stage of actually maintaining a program for GNU (whether
-released or not), please ask us for a copy.
+released or not), please ask us for a copy. It is also available
+online for your perusal: @uref{http://www.gnu.org/prep/maintain/}.
@node Trademarks
@section Trademarks
@@ -255,7 +250,7 @@ functions in Emacs that deal with Windows start with @samp{w32}.
@chapter General Program Design
@cindex program design
-This @value{CHAPTER} discusses some of the issues you should take into
+This chapter discusses some of the issues you should take into
account when designing your program.
@c Standard or ANSI C
@@ -269,7 +264,7 @@ account when designing your program.
@c A major revision of the C Standard appeared in 1999.
@menu
-* Source Language:: Which languges to use.
+* Source Language:: Which languages to use.
* Compatibility:: Compatibility with other implementations
* Using Extensions:: Using non-standard features
* Standard C:: Using Standard C features
@@ -278,7 +273,7 @@ account when designing your program.
@node Source Language
@section Which Languages to Use
-@cindex programming languges
+@cindex programming languages
When you want to use a language that gets compiled and runs at high
speed, the best language to use is C. Using another language is like
@@ -518,7 +513,7 @@ an easy workaround. Simply introduce another macro
@node Program Behavior
@chapter Program Behavior for All Programs
-This @value{CHAPTER} describes conventions for writing robust
+This chapter describes conventions for writing robust
software. It also describes general standards for error messages, the
command line interface, and how libraries should behave.
@@ -1497,9 +1492,7 @@ Used in @code{gawk}.
Used in @code{su}.
@item machine
-No listing of which programs already use this;
-someone should check to
-see if any actually do, and tell @email{gnu@@gnu.org}.
+Used in @code{uname}.
@item macro-name
@samp{-M} in @code{ptx}.
@@ -2137,7 +2130,7 @@ directory.
@node Writing C
@chapter Making The Best Use of C
-This @value{CHAPTER} provides advice on how best to use the C language
+This chapter provides advice on how best to use the C language
when writing GNU software.
@menu
@@ -2692,37 +2685,50 @@ while ((c = getchar()) != EOF)
write(file_descriptor, &c, 1);
@end example
-When calling functions, you need not worry about the difference between
-pointers of various types, or between pointers and integers. On most
-machines, there's no difference anyway. As for the few machines where
-there is a difference, all of them support Standard C prototypes, so you can
-use prototypes (perhaps conditionalized to be active only in Standard C)
-to make the code work on those systems.
+It used to be ok to not worry about the difference between pointers
+and integers when passing arguments to functions. However, on most
+modern 64-bit machines pointers are wider than @code{int}.
+Conversely, integer types like @code{long long int} and @code{off_t}
+are wider than pointers on most modern 32-bit machines. Hence it's
+often better nowadays to use prototypes to define functions whose
+argument types are not trivial.
-In certain cases, it is ok to pass integer and pointer arguments
-indiscriminately to the same function, and use no prototype on any
-system. For example, many GNU programs have error-reporting functions
-that pass their arguments along to @code{printf} and friends:
+In particular, if functions accept varying argument counts or types
+they should be declared using prototypes containing @samp{...} and
+defined using @file{stdarg.h}. For an example of this, please see the
+@uref{http://www.gnu.org/software/gnulib/, Gnulib} error module, which
+declares and defines the following function:
@example
-error (s, a1, a2, a3)
- char *s;
- char *a1, *a2, *a3;
-@{
- fprintf (stderr, "error: ");
- fprintf (stderr, s, a1, a2, a3);
-@}
+/* Print a message with `fprintf (stderr, FORMAT, ...)';
+ if ERRNUM is nonzero, follow it with ": " and strerror (ERRNUM).
+ If STATUS is nonzero, terminate the program with `exit (STATUS)'. */
+
+void error (int status, int errnum, const char *format, ...);
@end example
-@noindent
-In practice, this works on all machines, since a pointer is generally
-the widest possible kind of argument; it is much simpler than any
-``correct'' alternative. Be sure @emph{not} to use a prototype for such
-functions.
+A simple way to use the Gnulib error module is to obtain the two
+source files @file{error.c} and @file{error.h} from the Gnulib library
+source code repository at
+@uref{http://savannah.gnu.org/cgi-bin/viewcvs/gnulib/gnulib/lib/}.
+Here's a sample use:
-If you have decided to use Standard C, then you can instead define
-@code{error} using @file{stdarg.h}, and pass the arguments along to
-@code{vfprintf}.
+@example
+#include "error.h"
+#include <errno.h>
+#include <stdio.h>
+
+char *program_name = "myprogram";
+
+FILE *
+xfopen (char const *name)
+@{
+ FILE *fp = fopen (name, "r");
+ if (! fp)
+ error (1, errno, "cannot read %s", name);
+ return fp;
+@}
+@end example
@cindex casting pointers to integers
Avoid casting pointers to integers if you can. Such casts greatly
@@ -3143,7 +3149,7 @@ Each program documented in the manual should have a node named
@samp{@var{program} Invocation} or @samp{Invoking @var{program}}. This
node (together with its subnodes, if any) should describe the program's
command line arguments and how to run it (the sort of information people
-would look in a man page for). Start with an @samp{@@example}
+would look for in a man page). Start with an @samp{@@example}
containing a template for all the options and arguments that the program
uses.
@@ -3469,6 +3475,25 @@ page explaining that you don't maintain it and that the Texinfo manual
is more authoritative. The note should say how to access the Texinfo
documentation.
+Be sure that man pages include a copyright statement and free
+license. The simple all-permissive license is appropriate for simple
+man pages:
+
+@example
+Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved.
+@end example
+
+For long man pages, with enough explanation and documentation that
+they can be considered true manuals, use the GFDL (@pxref{License for
+Manuals}).
+
+Finally, the GNU help2man program
+(@uref{http://www.gnu.org/software/help2man/}) is one way to automate
+generation of a man page, in this case from @option{--help} output.
+This is sufficient in many cases.
+
@node Reading other Manuals
@section Reading other Manuals
@@ -3770,9 +3795,9 @@ advertise them to new potential customers. Proprietary software is a
social and ethical problem, and the point of GNU is to solve that
problem.
-The GNU definition of free software is found in
-@url{http://www.gnu.org/philosophy/free-sw.html}, with a list of
-important licenses and whether they qualify as free in
+The GNU definition of free software is found on the GNU web site at
+@url{http://www.gnu.org/philosophy/free-sw.html}. A list of
+important licenses and whether they qualify as free is in
@url{http://www.gnu.org/licenses/license-list.html}. The terms
``free'' and ``non-free'', used in this document, refer to that
definition. If it is not clear whether a license qualifies as free
diff --git a/lib/Autom4te/Channels.pm b/lib/Autom4te/Channels.pm
index 530511f3..ebc49d85 100644
--- a/lib/Autom4te/Channels.pm
+++ b/lib/Autom4te/Channels.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004 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
@@ -176,6 +176,9 @@ The part of the message subject to duplicate filtering. See the
documentation for the C<UP_NONE>, C<UP_TEXT>, and C<UP_LOC_TEXT>
constants above.
+C<uniq_part> can also be set to an arbitrary string that will be used
+instead of the message when considering duplicates.
+
=item C<uniq_scope =E<gt> US_LOCAL>
The scope of duplicate filtering. See the documentation for the
@@ -425,21 +428,21 @@ sub _print_message ($$%)
}
# Check for duplicate message if requested.
- if ($opts{'uniq_part'} != UP_NONE)
+ if ($opts{'uniq_part'} ne UP_NONE)
{
# Which part of the error should we match?
my $to_filter;
- if ($opts{'uniq_part'} == UP_TEXT)
+ if ($opts{'uniq_part'} eq UP_TEXT)
{
$to_filter = $message;
}
- elsif ($opts{'uniq_part'} == UP_LOC_TEXT)
+ elsif ($opts{'uniq_part'} eq UP_LOC_TEXT)
{
$to_filter = $msg;
}
else
{
- confess "unknown value for uniq_part: " . $opts{'uniq_part'};
+ $to_filter = $opts{'uniq_part'};
}
# Do we want local or global uniqueness?
diff --git a/lib/Autom4te/Configure_ac.pm b/lib/Autom4te/Configure_ac.pm
index 99317877..14addced 100644
--- a/lib/Autom4te/Configure_ac.pm
+++ b/lib/Autom4te/Configure_ac.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2005 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
diff --git a/lib/Autom4te/FileUtils.pm b/lib/Autom4te/FileUtils.pm
index 7fa18cc7..6ebbfc64 100644
--- a/lib/Autom4te/FileUtils.pm
+++ b/lib/Autom4te/FileUtils.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005 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
@@ -44,12 +44,12 @@ use vars qw (@ISA @EXPORT);
@EXPORT = qw (&contents
&find_file &mtime
&update_file &up_to_date_p
- &xsystem &xqx);
+ &xsystem &xqx &dir_has_case_matching_file &reset_dir_cache);
=item C<find_file ($file_name, @include)>
-Return the first name for a C<$file_name> in the C<include>s path.
+Return the first path for a C<$file_name> in the C<include>s.
We match exactly the behavior of GNU M4: first look in the current
directory (which includes the case of absolute file names), and, if
@@ -60,9 +60,9 @@ if absent, otherwise exit with error.
=cut
-# $FILE-NAME
-# find_file ($FILE-NAME, @INCLUDE)
-# --------------------------------
+# $FILE_NAME
+# find_file ($FILE_NAME, @INCLUDE)
+# -------------------------------
sub find_file ($@)
{
use File::Spec;
@@ -83,10 +83,10 @@ sub find_file ($@)
return undef;
}
- foreach my $dir (@include)
+ foreach my $path (@include)
{
- return File::Spec->canonpath (File::Spec->catfile ($dir, $file_name))
- if -e File::Spec->catfile ($dir, $file_name)
+ return File::Spec->canonpath (File::Spec->catfile ($path, $file_name))
+ if -e File::Spec->catfile ($path, $file_name)
}
fatal "$file_name: no such file or directory"
@@ -119,19 +119,22 @@ sub mtime ($)
}
-=item C<update_file ($from, $to)>
+=item C<update_file ($from, $to, [$force])>
Rename C<$from> as C<$to>, preserving C<$to> timestamp if it has not
-changed. Recognize C<$to> = C<-> standing for C<STDIN>. C<$from> is
-always removed/renamed.
+changed, unless C<$force> is true (defaults to false). Recognize
+C<$to> = C<-> standing for C<STDIN>. C<$from> is always
+removed/renamed.
=cut
-# &update_file ($FROM, $TO)
-# -------------------------
-sub update_file ($$)
+# &update_file ($FROM, $TO; $FORCE)
+# ---------------------------------
+sub update_file ($$;$)
{
- my ($from, $to) = @_;
+ my ($from, $to, $force) = @_;
+ $force = 0
+ unless defined $force;
my $SIMPLE_BACKUP_SUFFIX = $ENV{'SIMPLE_BACKUP_SUFFIX'} || '~';
use File::Compare;
use File::Copy;
@@ -149,7 +152,7 @@ sub update_file ($$)
return;
}
- if (-f "$to" && compare ("$from", "$to") == 0)
+ if (!$force && -f "$to" && compare ("$from", "$to") == 0)
{
# File didn't change, so don't update its mod time.
msg 'note', "`$to' is unchanged";
@@ -292,11 +295,11 @@ sub xsystem ($)
=item C<contents ($file_name)>
-Return the contents of c<$file_name>.
+Return the contents of C<$file_name>.
=cut
-# contents ($FILE-NAME)
+# contents ($FILE_NAME)
# ---------------------
sub contents ($)
{
@@ -310,6 +313,58 @@ sub contents ($)
}
+=item C<dir_has_case_matching_file ($DIRNAME, $FILE_NAME)>
+
+Return true iff $DIR contains a file name that matches $FILE_NAME case
+insensitively.
+
+We need to be cautious on case-insensitive case-preserving file
+systems (e.g. Mac OS X's HFS+). On such systems C<-f 'Foo'> and C<-f
+'foO'> answer the same thing. Hence if a package distributes its own
+F<CHANGELOG> file, but has no F<ChangeLog> file, automake would still
+try to distribute F<ChangeLog> (because it thinks it exists) in
+addition to F<CHANGELOG>, although it is impossible for these two
+files to be in the same directory (the two file names designate the
+same file).
+
+=cut
+
+use vars '%_directory_cache';
+sub dir_has_case_matching_file ($$)
+{
+ # Note that print File::Spec->case_tolerant returns 0 even on MacOS
+ # X (with Perl v5.8.1-RC3 at least), so do not try to shortcut this
+ # function using that.
+
+ my ($dirname, $file_name) = @_;
+ return 0 unless -f "$dirname/$file_name";
+
+ # The file appears to exist, however it might be a mirage if the
+ # system is case insensitive. Let's browse the directory and check
+ # whether the file is really in. We maintain a cache of directories
+ # so Automake doesn't spend all its time reading the same directory
+ # again and again.
+ if (!exists $_directory_cache{$dirname})
+ {
+ error "failed to open directory `$dirname'"
+ unless opendir (DIR, $dirname);
+ $_directory_cache{$dirname} = { map { $_ => 1 } readdir (DIR) };
+ closedir (DIR);
+ }
+ return exists $_directory_cache{$dirname}{$file_name};
+}
+
+=item C<reset_dir_cache ($dirname)>
+
+Clear C<dir_has_case_matching_file>'s cache for C<$dirname>.
+
+=cut
+
+sub reset_dir_cache ($)
+{
+ delete $_directory_cache{$_[0]};
+}
+
1; # for require
### Setup "GNU" style for perl-mode and cperl-mode.
diff --git a/lib/Autom4te/XFile.pm b/lib/Autom4te/XFile.pm
index fe2c1ea0..f10e4d10 100644
--- a/lib/Autom4te/XFile.pm
+++ b/lib/Autom4te/XFile.pm
@@ -1,4 +1,4 @@
-# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2004 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
@@ -228,10 +228,12 @@ sub lock
# Admittedly this is a bit of a hack.
if (!flock ($fh, $mode)
&& (!$!{ENOLCK}
- || " -$ENV{'MAKEFLAGS'}" =~ / (-[BdeikrRsSw]*j|---?jobs)/))
+ || (exists $ENV{'MAKEFLAGS'}
+ && " -$ENV{'MAKEFLAGS'}" =~ / (-[BdeikrRsSw]*j|---?jobs)/)))
{
my $file = $fh->name;
- fatal "cannot lock $file with mode $mode (perhaps you are running make -j on a lame NFS client?): $!";
+ fatal ("cannot lock $file with mode $mode "
+ . "(perhaps you are running make -j on a lame NFS client?): $!");
}
}
diff --git a/man/autoheader.1 b/man/autoheader.1
index 126a2dd5..a15c6594 100644
--- a/man/autoheader.1
+++ b/man/autoheader.1
@@ -1,4 +1,4 @@
-.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.33.
+.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.35.
.TH AUTOHEADER "1" "January 2005" "autoheader 2.59c" "User Commands"
.SH NAME
autoheader \- Create a template header for configure
@@ -7,7 +7,7 @@ autoheader \- Create a template header for configure
[\fIOPTION\fR] ... [\fITEMPLATE-FILE\fR]
.SH DESCRIPTION
Create a template file of C `#define' statements for `configure' to
-use. To this end, scan TEMPLATE-FILE, or `configure.ac' if present,
+use. To this end, scan TEMPLATE\-FILE, or `configure.ac' if present,
or else `configure.in'.
.TP
\fB\-h\fR, \fB\-\-help\fR
@@ -53,7 +53,7 @@ unsupported or incomplete features (default)
`all'
all the warnings
.TP
-`no-CATEGORY'
+`no\-CATEGORY'
turn off warnings in CATEGORY
.TP
`none'
@@ -71,7 +71,7 @@ append directory DIR to search path
.SH AUTHOR
Written by Roland McGrath and Akim Demaille.
.SH "REPORTING BUGS"
-Report bugs to <bug-autoconf@gnu.org>.
+Report bugs to <bug\-autoconf@gnu.org>.
.SH COPYRIGHT
Copyright \(co 2005 Free Software Foundation, Inc.
.br