Mercurial > hg > octave-jordi > gnulib-hg
view check-module @ 7172:be9e01d008cb
Avoid the need for AC_LIBSOURCES in m4 macros.
* modules/acl (EXTRA_DIST): Add acl.h.
* modules/argmatch (Files): Add m4/argmatch.m4.
(configure.ac): Add gl_ARGMATCH.
(EXTRA_DIST): Renamed from lib_SOURCES, for
consistency with the other modules. Remove argmatch.c.
* modules/backupfile (EXTRA_DIST): Add backupfile.h.
* modules/c-strtod (EXTRA_DIST): Add c-strtod.h.
* modules/c-strtold (EXTRA_DIST): Add c-strtod.c, c-strtod.h.
* modules/canonhost (EXTRA_DIST): Add c-canonhost.h.
* modules/canonicalize (EXTRA_DIST): Add canonicalize.h.
* modules/chdir-long (EXTRA_DIST): Add chdir-long.h.
* modules/chdir-safer (EXTRA_DIST): Add chdir-safer.h.
* modules/cloexec (EXTRA_DIST): Add cloexec.h.
* modules/close-stream (EXTRA_DIST): Add close-stream.h.
* modules/closeout (EXTRA_DIST): Add closeout.h.
* modules/cycle-check (EXTRA_DIST): Add cycle-check.h.
* modules/dev-ino (EXTRA_DIST): Add dev-ino.h.
* modules/dirfd (EXTRA_DIST): Add dirfd.h.
* modules/dirname (EXTRA_DIST): Renamed from lib_SOURCES. Add
dirname.h; remove basename.c and stripslash.c.
* modules/exclude (EXTRA_DIST): Add exclude.h.
* modules/exitfail (EXTRA_DIST): Add exitfail.h.
* modules/fcntl-safer (EXTRA_DIST): Add fcntl-safer.h fcntl--.h.
* modules/file-type (EXTRA_DIST): Add file-type.h.
* modules/filemode (EXTRA_DIST): Add filemode.h.
* modules/filenamecat (EXTRA_DIST): Add filenamecat.h.
* modules/fopen-safer (EXTRA_DIST): Add stdio-safer.h stdio--.h.
* modules/fpending (EXTRA_DIST): Add __fpending.h.
* modules/fprintftime (EXTRA_DIST): Add fprintftime.h.
* modules/fsusage (EXTRA_DIST): Add fsusage.h.
* modules/fts (EXTRA_DIST): Add fts_.h fts-cycle.c.
* modules/getcwd (EXTRA_DIST): Add getcwd.h.
* modules/getdate (EXTRA_DIST): Add getdate.c.
* modules/gethrxtime (EXTRA_DIST): Add gethrxtime.h xtime.h.
* modules/getpagesize (EXTRA_DIST): Add getpagesize.h.
* modules/getpass (EXTRA_DIST): Add getpass.h.
* modules/glob (EXTRA_DIST): Add glob_.h glob-libc.h.
* modules/group-member (EXTRA_DIST): Add group-member.h.
* modules/hard-locale (EXTRA_DIST): Add hard-locale.h.
* modules/hash (EXTRA_DIST): Add hash.h.
* modules/human (EXTRA_DIST): Add human.h.
* modules/inttypes (EXTRA_DIST): Add inttypes.h.
* modules/lchmod (EXTRA_DIST): Add lchmod.h.
* modules/lchown (EXTRA_DIST): Add lchown.h.
* modules/long-options (EXTRA_DIST): Add long-options.h.
* modules/lstat (EXTRA_DIST): Add lstat.h.
* modules/md5 (EXTRA_DIST): Add memcasecmp.h.
* modules/memcoll (EXTRA_DIST): Add memcoll.h.
* modules/mempcpy (EXTRA_DIST): Add mempcpy.h.
* modules/memrchr (EXTRA_DIST): Add memrchr.h.
* modules/memxor (EXTRA_DIST): Add memxor.h.
* modules/mkancesdirs (EXTRA_DIST): Add mkancesdirs.h.
* modules/mkdir-p (EXTRA_DIST): Add modechange.h.
* modules/mountlist (EXTRA_DIST): Add mountlist.h.
* modules/openat (EXTRA_DIST): Add at-func.c openat.h openat-priv.h.
* modules/pathmax (EXTRA_DIST): Add pathmax.h.
* modules/physmem (EXTRA_DIST): Add physmem.h.
* modules/posixtm (EXTRA_DIST): Add posixtm.h.
* modules/posixver (EXTRA_DIST): Add posixver.h.
* modules/quote (EXTRA_DIST): Add quote.h.
* modules/quotearg (EXTRA_DIST): Add quotearg.h.
* modules/readtokens (EXTRA_DIST): Add readtokens.h.
* modules/readutmp (EXTRA_DIST): Add readutmp.h.
* modules/regex (EXTRA_DIST): Add regcomp.c regex.h regex_internal.c regex_internal.h regexec.c.
* modules/safe-read (EXTRA_DIST): Add safe-read.h.
* modules/safe-write (EXTRA_DIST): Add safe-write.h.
* modules/same (EXTRA_DIST): Add same.h.
* modules/same-inode (EXTRA_DIST): Add same-inode.h.
* modules/save-cwd (EXTRA_DIST): Add save-cwd.h.
* modules/savedir (EXTRA_DIST): Add savedir.h.
* modules/sha1 (EXTRA_DIST): Add sha1.h.
* modules/sig2str (EXTRA_DIST): Add sig2str.h.
* modules/stat-macros (EXTRA_DIST): Add stat-macros.h.
* modules/stat-time (EXTRA_DIST): Add stat-time.h.
* modules/stdlib-safer (EXTRA_DIST): Add stdlib-safer.h stdlib--.h.
* modules/strdup (EXTRA_DIST): Add strdup.h.
* modules/strftime (EXTRA_DIST): Add strftime.h.
* modules/strndup (EXTRA_DIST): Add strndup.h.
* modules/strnlen (EXTRA_DIST): Add strnlen.h.
* modules/strverscmp (EXTRA_DIST): Add strverscmp.h.
* modules/time_r (EXTRA_DIST): Add time_r.h.
* modules/timespec (EXTRA_DIST): Add timespec.h.
* modules/tmpfile-safer (EXTRA_DIST): Add stdio-safer.h stdio--.h.
* modules/unistd-safer (EXTRA_DIST): Add unistd-safer.h unistd--.h.
* modules/unlinkdir (EXTRA_DIST): Add unlinkdir.h.
* modules/unlocked-io (EXTRA_DIST): Add unlocked-io.h.
* modules/userspec (EXTRA_DIST): Add userspec.h.
* modules/utimecmp (EXTRA_DIST): Add utimecmp.h.
* modules/utimens (EXTRA_DIST): Add utimens.h.
* modules/xalloc (EXTRA_DIST): Add xalloc.h.
* modules/xgetcwd (EXTRA_DIST): Add xgetcwd.h.
* modules/xnanosleep (EXTRA_DIST): Add xnanosleep.h.
* modules/xreadlink (EXTRA_DIST): Add xreadlink.h.
* modules/xstrtod (EXTRA_DIST): Add xstrtod.h.
* modules/xstrtol (EXTRA_DIST): Add xstrtol.h.
* modules/xstrtold (EXTRA_DIST): Add xstrtod.c xstrtod.h.
* modules/yesno (EXTRA_DIST): Add yesno.h.
+
* m4/argmatch.m4: New file, from coreutils with AC_LIBSOURCES removed.
* m4/dev-ino.m4, same-inode.m4: Remove.
+
* m4/_inttypes_h.m4 (gl_INTTYPES_H):
* m4/acl.m4 (AC_FUNC_ACL):
* m4/backupfile.m4 (gl_BACKUPFILE):
* m4/c-strtod.m4 (gl_C99_STRTOLD):
* m4/canon-host.m4 (gl_CANON_HOST):
* m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
* m4/chdir-long.m4 (gl_FUNC_CHDIR_LONG):
* m4/chdir-safer.m4 (gl_CHDIR_SAFER):
* m4/cloexec.m4 (gl_CLOEXEC):
* m4/close-stream.m4 (gl_CLOSE_STREAM):
* m4/closeout.m4 (gl_CLOSEOUT):
* m4/dirfd.m4 (gl_FUNC_DIRFD):
* m4/dirname.m4 (gl_DIRNAME):
* m4/exclude.m4 (gl_EXCLUDE):
* m4/exitfail.m4 (gl_EXITFAIL):
* m4/fcntl-safer.m4 (gl_FCNTL_SAFER):
* m4/file-type.m4 (gl_FILE_TYPE):
* m4/filemode.m4 (gl_FILEMODE):
* m4/filenamecat.m4 (gl_FILE_NAME_CONCAT):
* m4/fpending.m4 (gl_FUNC_FPENDING):
* m4/fprintftime.m4 (gl_FPRINTFTIME):
* m4/fts.m4 (gl_FUNC_FTS):
* m4/getcwd.m4 (gl_FUNC_GETCWD_NULL):
* m4/getdate.m4 (gl_GETDATE):
* m4/gethrxtime.m4 (gl_GETHRXTIME):
* m4/getpagesize.m4 (gl_GETPAGESIZE):
* m4/getpass.m4 (gl_FUNC_GETPASS):
* m4/gettime.m4 (gl_GETTIME):
* m4/getugroups.m4 (gl_GETUGROUPS):
* m4/glob.m4 (gl_GLOB_SUBSTITUTE):
* m4/group-member.m4 (gl_FUNC_GROUP_MEMBER):
* m4/hard-locale.m4 (gl_HARD_LOCALE):
* m4/hash.m4 (gl_HASH):
* m4/idcache.m4 (gl_IDCACHE):
* m4/lchmod.m4 (gl_FUNC_LCHMOD):
* m4/lchown.m4 (gl_FUNC_LCHOWN):
* m4/long-options.m4 (gl_LONG_OPTIONS):
* m4/lstat.m4 (gl_FUNC_LSTAT):
* m4/md5.m4 (gl_MD5):
* m4/memcasecmp.m4 (gl_MEMCASECMP):
* m4/memcoll.m4 (gl_MEMCOLL):
* m4/mempcpy.m4 (gl_FUNC_MEMPCPY):
* m4/memrchr.m4 (gl_FUNC_MEMRCHR):
* m4/memxor.m4 (gl_MEMXOR):
* m4/mkancesdirs.m4 (gl_MKANCESDIRS):
* m4/mkdir-p.m4 (gl_MKDIR_PARENTS):
* m4/modechange.m4 (gl_MODECHANGE):
* m4/mountlist.m4 (gl_MOUNTLIST):
* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP):
* m4/openat.m4 (gl_FUNC_OPENAT):
* m4/pathmax.m4 (gl_PATHMAX):
* m4/physmem.m4 (gl_PHYSMEM):
* m4/posixtm.m4 (gl_POSIXTM):
* m4/posixver.m4 (gl_POSIXVER):
* m4/quote.m4 (gl_QUOTE):
* m4/quotearg.m4 (gl_QUOTEARG):
* m4/readtokens.m4 (gl_READTOKENS):
* m4/readutmp.m4 (gl_READUTMP):
* m4/regex.m4 (gl_REGEX):
* m4/safe-read.m4 (gl_SAFE_READ):
* m4/safe-write.m4 (gl_SAFE_WRITE):
* m4/same.m4 (gl_SAME):
* m4/save-cwd.m4 (gl_SAVE_CWD):
* m4/savedir.m4 (gl_SAVEDIR):
* m4/settime.m4 (gl_SETTIME):
* m4/sha1.m4 (gl_SHA1):
* m4/sig2str.m4 (gl_FUNC_SIG2STR):
* m4/stat-macros.m4 (gl_STAT_MACROS):
* m4/stat-time.m4 (gl_STAT_TIME):
* m4/stdio-safer.m4 (gl_FOPEN_SAFER):
* m4/stdlib-safer.m4 (gl_STDLIB_SAFER):
* m4/strdup.m4 (gl_FUNC_STRDUP):
* m4/strftime.m4 (gl_FUNC_GNU_STRFTIME):
* m4/strndup.m4 (gl_FUNC_STRNDUP):
* m4/strnlen.m4 (gl_FUNC_STRNLEN):
* m4/strverscmp.m4 (gl_FUNC_STRVERSCMP):
* m4/time_r.m4 (gl_TIME_R):
* m4/timespec.m4 (gl_TIMESPEC):
* m4/unistd-safer.m4 (gl_UNISTD_SAFER):
* m4/unlinkdir.m4 (gl_UNLINKDIR):
* m4/unlocked-io.m4 (gl_FUNC_GLIBC_UNLOCKED_IO):
* m4/userspec.m4 (gl_USERSPEC):
* m4/utimecmp.m4 (gl_UTIMECMP):
* m4/utimens.m4 (gl_UTIMENS):
* m4/xalloc.m4 (gl_XALLOC):
* m4/xgetcwd.m4 (gl_XGETCWD):
* m4/xnanosleep.m4 (gl_XNANOSLEEP):
* m4/xreadlink.m4 (gl_XREADLINK):
* m4/xstrtod.m4 (gl_XSTRTOD):
* m2/yesno.m4 (gl_YESNO):
Don't use AC_LIBSOURCES; instead, rely on the files in ../modules/
to get the necessary .h files and whatnot.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Mon, 21 Aug 2006 21:46:31 +0000 |
parents | 117d96f809c4 |
children | 502a0e8a8bfe |
line wrap: on
line source
#!/usr/bin/perl -w # Check a gnulib module. # Copyright (C) 2005, 2006 Free Software Foundation, Inc. # This file 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 2 of the License, 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, write to the Free Software # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA # 02110-1301, USA. # Read a module description file and derive the set of files # included directly by any .c or .h file listed in the `Files:' section. # Take the union of all such sets for any dependent modules. # Then, compare that set with the set derived from the names # listed in the various Files: sections. # This script makes no attempt to diagnose invalid or empty # module-description files. # Written by Jim Meyering # FIXME: # for each .m4 file listed in the Files: section(s) # parse it for AC_LIBSOURCES directives, and accumulate the set # of files `required' via all AC_LIBSOURCES. # If this set is not empty, ensure that it contains # the same (.c and .h only?) files as are listed in the Files: sections. use strict; use Getopt::Long; #use Coda; my $COPYRIGHT_NOTICE = "Copyright (C) 2006 Free Software Foundation, Inc.\n". "This is free software. You may redistribute copies of it under the terms of\n". "the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.\n". "There is NO WARRANTY, to the extent permitted by law.\n"; (my $VERSION = '$Revision: 1.6 $ ') =~ tr/[0-9].//cd; (my $ME = $0) =~ s|.*/||; use constant ST_INIT => 1; use constant ST_FILES => 2; use constant ST_DEPENDENTS => 3; # Parse a module file (returning list of Files: names and # list of dependent-modules. # my ($file, $dep) = parse_module_file $module_file; sub parse_module_file ($) { my ($module_file) = @_; open FH, '<', $module_file or die "$ME: can't open `$module_file' for reading: $!\n"; my %file_set; my %dep_set; my $state = ST_INIT; while (defined (my $line = <FH>)) { if ($state eq ST_INIT) { if ($line =~ /^Files:$/) { $state = ST_FILES; } elsif ($line =~ /^Depends-on:$/) { $state = ST_DEPENDENTS; } } else { chomp $line; $line =~ s/^\s+//; $line =~ s/\s+$//; if ( ! $line) { $state = ST_INIT; next; } if ($state eq ST_FILES) { $file_set{$line} = 1; } elsif ($state eq ST_DEPENDENTS) { $dep_set{$line} = 1; } } } close FH; # my @t = sort keys %file_set; # print "files: @t\n"; # my @u = sort keys %dep_set; # print "dependents: @u\n"; return (\%file_set, \%dep_set); } # Extract the set of files required for this module, including # those required via dependent modules. # Files: # lib/stat.c # m4/stat.m4 # lib/foo.h # # Depends-on: # some-other-module sub usage ($) { my ($exit_code) = @_; my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR); if ($exit_code != 0) { print $STREAM "Try `$ME --help' for more information.\n"; } else { print $STREAM <<EOF; Usage: $ME [OPTIONS] FILE... Read a module description file and derive the set of files included directly by any .c or .h file listed in the `Files:' section. Take the union of all such sets for any dependent modules. Then, compare that set with the set derived from the names listed in the various Files: sections. OPTIONS: --help display this help and exit --version output version information and exit EOF } exit $exit_code; } sub find_included_lib_files ($) { my ($file) = @_; # Special cases... my %special_non_dup = ( 'fnmatch_loop.c' => 1, 'regex.c' => 1, 'at-func.c' => 1 ); my %inc; open FH, '<', $file or die "$ME: can't open `$file' for reading: $!\n"; while (defined (my $line = <FH>)) { # Ignore test-driver code at end of file. $line =~ m!^\#if(def)? TEST_! and last; $line =~ m!^\s*\#\s*include\s+"! or next; $line =~ s///; chomp $line; $line =~ s/".*//; exists $inc{$line} && ! exists $special_non_dup{$line} and warn "$ME: $file: duplicate inclusion of $line\n"; $inc{$line} = 1; } close FH; return \%inc; } my %exempt_header = ( # Exempt headers like unlocked-io.h that are `#include'd # but not necessarily used. 'unlocked-io.h' => 1, # Give gettext.h a free pass only when included from lib/error.c, # since we've made that exception solely to make the error # module easier to use -- at RMS's request. 'lib/error.c:gettext.h' => 1, # The full-read module shares code with the full-write module. 'lib/full-write.c:full-read.h' => 1, # The safe-write module shares code with the safe-read module. 'lib/safe-read.c:safe-write.h' => 1, # The use of obstack.h in the hash module is conditional, off by default. 'lib/hash.c:obstack.h' => 1, # The fts-lgpl module doesn't actually use fts-cycle.c and unistd-safer.h. 'lib/fts.c:fts-cycle.c' => 1, 'lib/fts.c:unistd-safer.h' => 1, ); sub check_module ($) { my @m = @_; my %file; my %module_all_files; my %dep; my %seen_module; while (@m) { my $m = pop @m; # warn "M: $m\n"; exists $seen_module{$m} and next; $seen_module{$m} = 1; my ($file, $dep) = parse_module_file $m; push @m, keys %$dep; foreach my $f (keys %$file) { $module_all_files{$f} = 1; } } my @t = sort keys %module_all_files; # warn "ALL files: @t\n"; # Derive from %module_all_files (by parsing the .c and .h files therein), # the list of all #include'd files that reside in lib/. foreach my $f (keys %module_all_files) { $f =~ /\.[ch]$/ or next; # FIXME: this is too naive my $inc = find_included_lib_files "../$f"; foreach my $i (sort keys %$inc) { my $lib_file = "lib/$i"; exists $exempt_header{"$f:$i"} || exists $exempt_header{$i} and next; !exists $module_all_files{$lib_file} && -f "../lib/$i" and warn "$f: $i is `#include'd, but not " . "listed in module's Files: section\n"; } #my @t = sort keys %$inc; #print "** $f: @t\n"; } } { GetOptions ( help => sub { usage 0 }, version => sub { print "$ME version $VERSION\n$COPYRIGHT_NOTICE"; exit }, ) or usage 1; @ARGV < 1 and (warn "$ME: missing FILE argument\n"), usage 1; foreach my $module (@ARGV) { check_module $module; } exit 0; }