autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: autoheader & --force


From: Akim Demaille
Subject: FYI: autoheader & --force
Date: Thu, 27 Jan 2005 10:30:50 +0100
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.3 (gnu/linux)

Index: ChangeLog
from  Akim Demaille  <address@hidden>

        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.

Index: bin/autoheader.in
===================================================================
RCS file: /cvsroot/autoconf/autoconf/bin/autoheader.in,v
retrieving revision 1.142
diff -u -u -r1.142 autoheader.in
--- bin/autoheader.in 3 Jan 2005 07:38:01 -0000 1.142
+++ bin/autoheader.in 27 Jan 2005 09:31:39 -0000
@@ -8,7 +8,7 @@
 # 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 @@
     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:
Index: doc/make-stds.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/make-stds.texi,v
retrieving revision 1.32
diff -u -u -r1.32 make-stds.texi
--- doc/make-stds.texi 3 Dec 2002 07:58:02 -0000 1.32
+++ doc/make-stds.texi 27 Jan 2005 09:31:39 -0000
@@ -8,8 +8,8 @@
 @cindex conventions for makefiles
 @cindex standards for makefiles
 
address@hidden Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001 
Free
address@hidden Software Foundation, Inc.
address@hidden Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 
2001,
address@hidden 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 @@
 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 @@
 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.
 
address@hidden docdir
+The directory for installing documentation files (other than Info) for
+this package.  By default, it should be
address@hidden/usr/local/share/doc/@var{yourpkg}}, but it should be written as
address@hidden(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
address@hidden for compatibility with existing practice.
+
address@hidden htmldir
address@hidden dvidir
address@hidden pdfdir
address@hidden 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@@},
address@hidden@@dvidir@@}, etc.)  Packages which supply several translations
+of their documentation should install them in
address@hidden(htmldir)/address@hidden, @samp{$(pdfdir)/address@hidden, etc. 
where
address@hidden 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 and @dfn{post-installation} commands.  @xref{Install Command
 Categories}.
 
address@hidden install-html
address@hidden install-dvi
address@hidden install-pdf
address@hidden 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 @@
 @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 @@
 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
address@hidden maintainer-clean} should not delete @file{configure} even if
address@hidden can be remade using a rule in the Makefile.  More generally,
address@hidden 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.
address@hidden 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;
address@hidden 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 @@
 because they will already be up to date.
 
 @item dvi
-Generate DVI files for all Texinfo documentation.
-For example:
address@hidden html
address@hidden pdf
address@hidden 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 @@
 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:
+
address@hidden
+html: foo.html
+
+foo.html: foo.texi chap1.texi chap2.texi
+        $(TEXI2HTML) $(srcdir)/foo.texi
address@hidden smallexample
+
address@hidden
+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 @@
 
 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
address@hidden 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 @@
 where the file @file{pre-install.awk} could contain this:
 
 @smallexample
-$0 ~ /^\t[ \t]*(normal_install|post_install)[ \t]*$/ @{on = address@hidden
+$0 ~ /^(normal-install|post-install)[ \t]*$/ @{on = address@hidden
 on @{print address@hidden
-$0 ~ /^\t[ \t]*pre_install[ \t]*$/ @{on = address@hidden
+$0 ~ /^pre-install[ \t]*$/ @{on = address@hidden
 @end smallexample
-
-The resulting file of pre-installation commands is executed as a shell
-script as part of installing the binary package.
Index: doc/standards.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/standards.texi,v
retrieving revision 1.67
diff -u -u -r1.67 standards.texi
--- doc/standards.texi 20 Aug 2004 20:19:38 -0000 1.67
+++ doc/standards.texi 27 Jan 2005 09:31:39 -0000
@@ -3,7 +3,7 @@
 @setfilename standards.info
 @settitle GNU Coding Standards
 @c This date is automagically updated when you save this file:
address@hidden lastupdate February 20, 2004
address@hidden lastupdate January 1, 2005
 @c %**end of header
 
 @dircategory GNU organization
@@ -94,15 +94,9 @@
 @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},
address@hidden://www.gnu.org/prep/standards.info}, and
address@hidden://www.gnu.org/prep/standards.dvi}, as well as the
-Texinfo ``source'' which is divided in two files:
address@hidden://www.gnu.org/prep/standards.texi} and
address@hidden://www.gnu.org/prep/make-stds.texi}.  The GNU Coding
-Standards are also available in HTML format starting at
address@hidden://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 @@
 @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 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 @@
 
 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 @@
 @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 @@
 @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 @@
 
 @node Source Language
 @section Which Languages to Use
address@hidden programming languges
address@hidden 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 @@
 @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{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 @@
 @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 @@
   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.
-
-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:
-
address@hidden
-error (s, a1, a2, a3)
-     char *s;
-     char *a1, *a2, *a3;
address@hidden
-  fprintf (stderr, "error: ");
-  fprintf (stderr, s, a1, a2, a3);
address@hidden
+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 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
address@hidden://www.gnu.org/software/gnulib/, Gnulib} error module, which
+declares and defines the following function:
+
address@hidden
+/* 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
 
address@hidden
-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
address@hidden://savannah.gnu.org/cgi-bin/viewcvs/gnulib/gnulib/lib/}.
+Here's a sample use:
+
address@hidden
+#include "error.h"
+#include <errno.h>
+#include <stdio.h>
 
-If you have decided to use Standard C, then you can instead define
address@hidden using @file{stdarg.h}, and pass the arguments along to
address@hidden
+char *program_name = "myprogram";
+
+FILE *
+xfopen (char const *name)
address@hidden
+  FILE *fp = fopen (name, "r");
+  if (! fp)
+    error (1, errno, "cannot read %s", name);
+  return fp;
address@hidden
address@hidden example
 
 @cindex casting pointers to integers
 Avoid casting pointers to integers if you can.  Such casts greatly
@@ -3143,7 +3149,7 @@
 @address@hidden 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 @@
 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:
+
address@hidden
+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.
address@hidden 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 @@
 social and ethical problem, and the point of GNU is to solve that
 problem.
 
-The GNU definition of free software is found in
address@hidden://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
address@hidden://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
Index: lib/Autom4te/Channels.pm
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/Autom4te/Channels.pm,v
retrieving revision 1.2
diff -u -u -r1.2 Channels.pm
--- lib/Autom4te/Channels.pm 12 Sep 2003 08:40:36 -0000 1.2
+++ lib/Autom4te/Channels.pm 27 Jan 2005 09:31:39 -0000
@@ -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 @@
 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 @@
     }
 
   # 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?
Index: lib/Autom4te/Configure_ac.pm
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/Autom4te/Configure_ac.pm,v
retrieving revision 1.4
diff -u -u -r1.4 Configure_ac.pm
--- lib/Autom4te/Configure_ac.pm 20 Aug 2004 19:58:07 -0000 1.4
+++ lib/Autom4te/Configure_ac.pm 27 Jan 2005 09:31:39 -0000
@@ -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
Index: lib/Autom4te/FileUtils.pm
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/Autom4te/FileUtils.pm,v
retrieving revision 1.6
diff -u -u -r1.6 FileUtils.pm
--- lib/Autom4te/FileUtils.pm 20 Aug 2004 19:58:07 -0000 1.6
+++ lib/Autom4te/FileUtils.pm 27 Jan 2005 09:31:39 -0000
@@ -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 @@
 @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 @@
 
 =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 @@
       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 @@
 }
 
 
-=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 @@
       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 @@
 
 =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 @@
 }
 
 
+=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.
Index: lib/Autom4te/XFile.pm
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/Autom4te/XFile.pm,v
retrieving revision 1.11
diff -u -u -r1.11 XFile.pm
--- lib/Autom4te/XFile.pm 9 Oct 2003 20:23:54 -0000 1.11
+++ lib/Autom4te/XFile.pm 27 Jan 2005 09:31:39 -0000
@@ -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 @@
   # 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?): $!");
     }
 }
 
Index: man/autoheader.1
===================================================================
RCS file: /cvsroot/autoconf/autoconf/man/autoheader.1,v
retrieving revision 1.98
diff -u -u -r1.98 autoheader.1
--- man/autoheader.1 3 Jan 2005 07:45:04 -0000 1.98
+++ man/autoheader.1 27 Jan 2005 09:31:39 -0000
@@ -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 @@
 [\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 @@
 `all'
 all the warnings
 .TP
-`no-CATEGORY'
+`no\-CATEGORY'
 turn off warnings in CATEGORY
 .TP
 `none'
@@ -71,7 +71,7 @@
 .SH AUTHOR
 Written by Roland McGrath and Akim Demaille.
 .SH "REPORTING BUGS"
-Report bugs to <address@hidden>.
+Report bugs to <address@hidden>.
 .SH COPYRIGHT
 Copyright \(co 2005 Free Software Foundation, Inc.
 .br




reply via email to

[Prev in Thread] Current Thread [Next in Thread]