]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* autoscan.in (%macro): Now maps from word to list of macros.
authorAkim Demaille <akim@epita.fr>
Mon, 25 Jun 2001 06:15:07 +0000 (06:15 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 25 Jun 2001 06:15:07 +0000 (06:15 +0000)
(&init_tables): Die when a word which is already handled by
explicit macros is mapped to the default macro.
(&print_unique): Remove, inlined in...
(&output_kind): here.
(File::Basename): Use it.
(&output): Sort the CONFIG_FILES.
* acheaders: Normalize.
* acfunctions: Likewise.

ChangeLog
acfunctions
acheaders
autoscan.in
bin/autoscan.in
lib/autoscan/functions
lib/autoscan/headers

index 7ccfe2995498193fc9f03117765de50f0b6cf51f..a7306277d2d99448a0340ca38ece5614cf754d81 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2001-06-25  Akim Demaille  <akim@epita.fr>
+
+       * autoscan.in (%macro): Now maps from word to list of macros.
+       (&init_tables): Die when a word which is already handled by
+       explicit macros is mapped to the default macro.
+       (&print_unique): Remove, inlined in...
+       (&output_kind): here.
+       (File::Basename): Use it.
+       (&output): Sort the CONFIG_FILES.
+       * acheaders: Normalize.
+       * acfunctions: Likewise.
+
+       
 2001-06-25  Akim Demaille  <akim@epita.fr>
 
        * aclang.m4 (_AC_LANG_COMPILER_GNU): If GNU, dump the compiler
index 5a38d1796daa29afa1d868c8a5e7dc13cfb5b2da..4e3d4c332142558ae848fbcf445c3380d9c236f3 100644 (file)
@@ -22,11 +22,12 @@ alloca              AC_FUNC_ALLOCA
 bcmp           AC_HEADER_STDC
 bcopy          AC_HEADER_STDC
 bzero          AC_HEADER_STDC
+bzero          AC_CHECK_FUNCS
 chown          AC_FUNC_CHOWN
 error          AC_FUNC_ERROR_AT_LINE
 error_at_line  AC_FUNC_ERROR_AT_LINE
 fnmatch                AC_FUNC_FNMATCH
-fork           AC_FUNC_FORK     
+fork           AC_FUNC_FORK
 fseeko         AC_FUNC_FSEEKO
 ftello         AC_FUNC_FSEEKO
 getgroups      AC_FUNC_GETGROUPS
@@ -39,10 +40,13 @@ major               AC_HEADER_MAJOR
 malloc         AC_FUNC_MALLOC
 makedev                AC_HEADER_MAJOR
 memchr         AC_HEADER_STDC
+memchr         AC_CHECK_FUNCS
 memcmp         AC_FUNC_MEMCMP
 memcpy         AC_HEADER_STDC
 memmove                AC_HEADER_STDC
+memmove                AC_CHECK_FUNCS
 memset         AC_HEADER_STDC
+memset         AC_CHECK_FUNCS
 minor          AC_HEADER_MAJOR
 mktime         AC_FUNC_MKTIME
 mmap           AC_FUNC_MMAP
@@ -57,6 +61,7 @@ strerror_r    AC_FUNC_STRERROR_R
 strftime       AC_FUNC_STRFTIME
 strtod         AC_FUNC_STRTOD
 utime          AC_FUNC_UTIME_NULL
+utime          AC_CHECK_FUNCS
 vfork          AC_FUNC_FORK
 vfprintf       AC_FUNC_VPRINTF
 vprintf                AC_FUNC_VPRINTF
@@ -72,7 +77,6 @@ acl
 alarm
 atexit
 btowc
-bzero
 clock_gettime
 dcgettext
 doprnt
@@ -85,17 +89,14 @@ fdatasync
 fesetround
 floor
 fs_stat_dev
-fseeko
 ftime
 ftruncate
 getcwd
 getdelim
-getgroups
 gethostbyaddr
 gethostbyname
 gethostname
 gethrtime
-getloadavg
 getmntent
 getmntinfo
 getpagesize
@@ -115,10 +116,7 @@ localtime_r
 mblen
 mbrlen
 mbrtowc
-memchr
-memmove
 mempcpy
-memset
 mkdir
 mkfifo
 modf
@@ -150,7 +148,6 @@ strchr
 strcspn
 strdup
 strerror
-strftime
 strncasecmp
 strndup
 strnlen
@@ -158,7 +155,6 @@ strpbrk
 strrchr
 strspn
 strstr
-strtod
 strtol
 strtoul
 strtoull
@@ -167,10 +163,8 @@ strverscmp
 sysinfo
 tzset
 uname
-utime
 utmpname
 utmpxname
-vprintf
 wcwidth
 
 # Local Variables:
index 2b343d107300e3cd4ad8f67a6b468cf3e257602d..a5b840482b1d4bd5698e40f6af4abf1f0fd14694 100644 (file)
--- a/acheaders
+++ b/acheaders
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 # 02111-1307, USA.
 
+# FIXME: The case of AC_HEADER_STDC + AC_CHECK_HEADERS headers is
+# unclear to me --akim.
+
 # Ones that have their own macros.
 X11/Xlib.h     AC_PATH_X
 dirent.h       AC_HEADER_DIRENT
 float.h                AC_HEADER_STDC
+float.h                AC_CHECK_HEADERS
 ndir.h         AC_HEADER_DIRENT
 stdarg.h       AC_HEADER_STDC
 stddef.h       AC_HEADER_STDC
+stddef.h       AC_CHECK_HEADERS
 stdlib.h       AC_HEADER_STDC
+stdlib.h       AC_CHECK_HEADERS
 string.h       AC_HEADER_STDC
+string.h       AC_CHECK_HEADERS
 sys/dir.h      AC_HEADER_DIRENT
 sys/mkdev.h    AC_HEADER_MAJOR
 sys/ndir.h     AC_HEADER_DIRENT
@@ -39,7 +46,6 @@ arpa/inet.h
 errno.h
 fcntl.h
 fenv.h
-float.h
 fs_info.h
 inttypes.h
 langinfo.h
@@ -58,11 +64,8 @@ nlist.h
 paths.h
 sgtty.h
 shadow.h
-stddef.h
 stdint.h
 stdio_ext.h
-stdlib.h
-string.h
 strings.h
 sys/acl.h
 sys/file.h
@@ -81,7 +84,6 @@ sys/systeminfo.h
 sys/time.h
 sys/timeb.h
 sys/vfs.h
-sys/wait.h
 sys/window.h
 syslog.h
 termio.h
index 887640a9e7907dfaa5b153ef9833a24fddcf0193..9493b4a0f24f375981955d42173bf689effdf4d6 100644 (file)
 
 use 5.005;
 require "find.pl";
+use File::Basename;
 use Getopt::Long;
 use strict;
 
-use vars qw($autoconf $datadir $initfile $me $name $verbose
+use vars qw($autoconf $datadir $initfile $name
             @cfiles @makefiles @shfiles %c_keywords %printed);
 
-($me = $0) =~ s,.*/,,;
-$verbose = 0;
+my $me = basename ($0);
+my $verbose = 0;
 
 # $USED{KIND}{ITEM} is set if ITEM is used in the program.
 # It is set to its list of locations.
 my %used = ();
 
-# $MACRO{KIND}{ITEM} is the macro to use to test ITEM.
+# $MACRO{KIND}{ITEM} is the list of macros to use to test ITEM.
 my %macro = ();
 
 # $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO.
@@ -80,7 +81,7 @@ sub END
 sub find_autoconf
 {
   $datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
-  (my $dir = $0) =~ s,[^/]*$,,;
+  my $dir = dirname ($0);
   $autoconf = '';
   # We test "$dir/autoconf" in case we are in the build tree, in which case
   # the names are not transformed yet.
@@ -206,7 +207,7 @@ sub init_tables ()
   # If more than that is required for a common portability problem,
   # a new Autoconf macro should probably be written for that case,
   # instead of duplicating the code in lots of configure.ac files.
-
+  my $tables_are_consistent = 1;
   foreach my $kind (@kinds)
     {
       my $file = "$datadir/ac$kind";
@@ -223,10 +224,25 @@ sub init_tables ()
            }
          my $word = $1;
          my $macro = $2 || $generic_macro{$kind};
-         $macro{$kind}{$word} = $macro;
+         # The default macro must be explicitly listed for words
+         # which have a specific macros.  This allows to enforce
+         # consistency checks.
+         if (!defined $2 && exists $macro{$kind}{$word})
+           {
+             warn ("$datadir/ac$kind:$.: "
+                   . "ignoring implicit call to the generic macro for $word\n");
+             $tables_are_consistent = 0;
+           }
+         else
+           {
+             push @{$macro{$kind}{$word}}, $macro;
+           }
        }
       close(TABLE);
     }
+
+  die "$me: some tables are inconsistent\n"
+    if !$tables_are_consistent;
 }
 
 
@@ -423,43 +439,29 @@ sub scan_sh_file ($)
 }
 
 
-# print_unique ($KIND, $WORD)
-# ---------------------------
-# $WORD, of some $KIND, is used, and needs to be checked.  (i) output
-# the needed macro invocation in $configure_scan if it exists and
-# hasn't been printed already, (ii), remember this macro needed.
-sub print_unique ($@)
-{
-  my ($kind, $word) = @_;
-
-  my $macro = $macro{$kind}{$word};
-  my @where = @{$used{$kind}{$word}};
-
-  if (defined $macro && !defined $printed{$macro})
-    {
-      print CONF "$macro\n";
-      $printed{$macro} = 1;
-
-      push (@{$needed_macros{$macro}}, @where);
-    }
-}
-
-
 # output_kind ($KIND)
 # -------------------
 sub output_kind ($)
 {
   my ($kind) = @_;
+  # Lists of words to be checked with the generic macro.
   my @have;
 
   print CONF "\n# $kind_comment{$kind}\n"
     if exists $kind_comment{$kind};
   foreach my $word (sort keys %{$used{$kind}})
     {
-      if (defined $macro{$kind}{$word})
+      # Words that were caught, but not to be checked according to
+      # the autoscan library files.
+      next
+       if ! exists $macro{$kind}{$word};
+
+      # Output the needed macro invocations in $configure_scan if not
+      # already printed, and remember these macros are needed.
+      foreach my $macro (@{$macro{$kind}{$word}})
        {
          if (exists $generic_macro{$kind}
-             && $macro{$kind}{$word} eq $generic_macro{$kind})
+             && $macro eq $generic_macro{$kind})
            {
              push (@have, $word);
              push (@{$needed_macros{"$generic_macro{$kind}([$word])"}},
@@ -467,7 +469,13 @@ sub output_kind ($)
            }
          else
            {
-             print_unique ($kind, $word);
+             if (! $printed{$macro})
+               {
+                 print CONF "$macro\n";
+                 $printed{$macro} = 1;
+               }
+             push (@{$needed_macros{$macro}},
+                   @{$used{$kind}{$word}});
            }
        }
     }
@@ -525,7 +533,7 @@ sub output ($)
       $unique_makefiles{$m}++;
     }
   print CONF "\nAC_CONFIG_FILES([",
-       join ("\n                 ", keys(%unique_makefiles)), "])\n";
+       join ("\n                 ", sort keys %unique_makefiles), "])\n";
   print CONF "AC_OUTPUT\n";
 
   close CONF ||
index 887640a9e7907dfaa5b153ef9833a24fddcf0193..9493b4a0f24f375981955d42173bf689effdf4d6 100644 (file)
 
 use 5.005;
 require "find.pl";
+use File::Basename;
 use Getopt::Long;
 use strict;
 
-use vars qw($autoconf $datadir $initfile $me $name $verbose
+use vars qw($autoconf $datadir $initfile $name
             @cfiles @makefiles @shfiles %c_keywords %printed);
 
-($me = $0) =~ s,.*/,,;
-$verbose = 0;
+my $me = basename ($0);
+my $verbose = 0;
 
 # $USED{KIND}{ITEM} is set if ITEM is used in the program.
 # It is set to its list of locations.
 my %used = ();
 
-# $MACRO{KIND}{ITEM} is the macro to use to test ITEM.
+# $MACRO{KIND}{ITEM} is the list of macros to use to test ITEM.
 my %macro = ();
 
 # $NEEDED_MACROS{MACRO} is an array of locations requiring MACRO.
@@ -80,7 +81,7 @@ sub END
 sub find_autoconf
 {
   $datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
-  (my $dir = $0) =~ s,[^/]*$,,;
+  my $dir = dirname ($0);
   $autoconf = '';
   # We test "$dir/autoconf" in case we are in the build tree, in which case
   # the names are not transformed yet.
@@ -206,7 +207,7 @@ sub init_tables ()
   # If more than that is required for a common portability problem,
   # a new Autoconf macro should probably be written for that case,
   # instead of duplicating the code in lots of configure.ac files.
-
+  my $tables_are_consistent = 1;
   foreach my $kind (@kinds)
     {
       my $file = "$datadir/ac$kind";
@@ -223,10 +224,25 @@ sub init_tables ()
            }
          my $word = $1;
          my $macro = $2 || $generic_macro{$kind};
-         $macro{$kind}{$word} = $macro;
+         # The default macro must be explicitly listed for words
+         # which have a specific macros.  This allows to enforce
+         # consistency checks.
+         if (!defined $2 && exists $macro{$kind}{$word})
+           {
+             warn ("$datadir/ac$kind:$.: "
+                   . "ignoring implicit call to the generic macro for $word\n");
+             $tables_are_consistent = 0;
+           }
+         else
+           {
+             push @{$macro{$kind}{$word}}, $macro;
+           }
        }
       close(TABLE);
     }
+
+  die "$me: some tables are inconsistent\n"
+    if !$tables_are_consistent;
 }
 
 
@@ -423,43 +439,29 @@ sub scan_sh_file ($)
 }
 
 
-# print_unique ($KIND, $WORD)
-# ---------------------------
-# $WORD, of some $KIND, is used, and needs to be checked.  (i) output
-# the needed macro invocation in $configure_scan if it exists and
-# hasn't been printed already, (ii), remember this macro needed.
-sub print_unique ($@)
-{
-  my ($kind, $word) = @_;
-
-  my $macro = $macro{$kind}{$word};
-  my @where = @{$used{$kind}{$word}};
-
-  if (defined $macro && !defined $printed{$macro})
-    {
-      print CONF "$macro\n";
-      $printed{$macro} = 1;
-
-      push (@{$needed_macros{$macro}}, @where);
-    }
-}
-
-
 # output_kind ($KIND)
 # -------------------
 sub output_kind ($)
 {
   my ($kind) = @_;
+  # Lists of words to be checked with the generic macro.
   my @have;
 
   print CONF "\n# $kind_comment{$kind}\n"
     if exists $kind_comment{$kind};
   foreach my $word (sort keys %{$used{$kind}})
     {
-      if (defined $macro{$kind}{$word})
+      # Words that were caught, but not to be checked according to
+      # the autoscan library files.
+      next
+       if ! exists $macro{$kind}{$word};
+
+      # Output the needed macro invocations in $configure_scan if not
+      # already printed, and remember these macros are needed.
+      foreach my $macro (@{$macro{$kind}{$word}})
        {
          if (exists $generic_macro{$kind}
-             && $macro{$kind}{$word} eq $generic_macro{$kind})
+             && $macro eq $generic_macro{$kind})
            {
              push (@have, $word);
              push (@{$needed_macros{"$generic_macro{$kind}([$word])"}},
@@ -467,7 +469,13 @@ sub output_kind ($)
            }
          else
            {
-             print_unique ($kind, $word);
+             if (! $printed{$macro})
+               {
+                 print CONF "$macro\n";
+                 $printed{$macro} = 1;
+               }
+             push (@{$needed_macros{$macro}},
+                   @{$used{$kind}{$word}});
            }
        }
     }
@@ -525,7 +533,7 @@ sub output ($)
       $unique_makefiles{$m}++;
     }
   print CONF "\nAC_CONFIG_FILES([",
-       join ("\n                 ", keys(%unique_makefiles)), "])\n";
+       join ("\n                 ", sort keys %unique_makefiles), "])\n";
   print CONF "AC_OUTPUT\n";
 
   close CONF ||
index 5a38d1796daa29afa1d868c8a5e7dc13cfb5b2da..4e3d4c332142558ae848fbcf445c3380d9c236f3 100644 (file)
@@ -22,11 +22,12 @@ alloca              AC_FUNC_ALLOCA
 bcmp           AC_HEADER_STDC
 bcopy          AC_HEADER_STDC
 bzero          AC_HEADER_STDC
+bzero          AC_CHECK_FUNCS
 chown          AC_FUNC_CHOWN
 error          AC_FUNC_ERROR_AT_LINE
 error_at_line  AC_FUNC_ERROR_AT_LINE
 fnmatch                AC_FUNC_FNMATCH
-fork           AC_FUNC_FORK     
+fork           AC_FUNC_FORK
 fseeko         AC_FUNC_FSEEKO
 ftello         AC_FUNC_FSEEKO
 getgroups      AC_FUNC_GETGROUPS
@@ -39,10 +40,13 @@ major               AC_HEADER_MAJOR
 malloc         AC_FUNC_MALLOC
 makedev                AC_HEADER_MAJOR
 memchr         AC_HEADER_STDC
+memchr         AC_CHECK_FUNCS
 memcmp         AC_FUNC_MEMCMP
 memcpy         AC_HEADER_STDC
 memmove                AC_HEADER_STDC
+memmove                AC_CHECK_FUNCS
 memset         AC_HEADER_STDC
+memset         AC_CHECK_FUNCS
 minor          AC_HEADER_MAJOR
 mktime         AC_FUNC_MKTIME
 mmap           AC_FUNC_MMAP
@@ -57,6 +61,7 @@ strerror_r    AC_FUNC_STRERROR_R
 strftime       AC_FUNC_STRFTIME
 strtod         AC_FUNC_STRTOD
 utime          AC_FUNC_UTIME_NULL
+utime          AC_CHECK_FUNCS
 vfork          AC_FUNC_FORK
 vfprintf       AC_FUNC_VPRINTF
 vprintf                AC_FUNC_VPRINTF
@@ -72,7 +77,6 @@ acl
 alarm
 atexit
 btowc
-bzero
 clock_gettime
 dcgettext
 doprnt
@@ -85,17 +89,14 @@ fdatasync
 fesetround
 floor
 fs_stat_dev
-fseeko
 ftime
 ftruncate
 getcwd
 getdelim
-getgroups
 gethostbyaddr
 gethostbyname
 gethostname
 gethrtime
-getloadavg
 getmntent
 getmntinfo
 getpagesize
@@ -115,10 +116,7 @@ localtime_r
 mblen
 mbrlen
 mbrtowc
-memchr
-memmove
 mempcpy
-memset
 mkdir
 mkfifo
 modf
@@ -150,7 +148,6 @@ strchr
 strcspn
 strdup
 strerror
-strftime
 strncasecmp
 strndup
 strnlen
@@ -158,7 +155,6 @@ strpbrk
 strrchr
 strspn
 strstr
-strtod
 strtol
 strtoul
 strtoull
@@ -167,10 +163,8 @@ strverscmp
 sysinfo
 tzset
 uname
-utime
 utmpname
 utmpxname
-vprintf
 wcwidth
 
 # Local Variables:
index 2b343d107300e3cd4ad8f67a6b468cf3e257602d..a5b840482b1d4bd5698e40f6af4abf1f0fd14694 100644 (file)
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 # 02111-1307, USA.
 
+# FIXME: The case of AC_HEADER_STDC + AC_CHECK_HEADERS headers is
+# unclear to me --akim.
+
 # Ones that have their own macros.
 X11/Xlib.h     AC_PATH_X
 dirent.h       AC_HEADER_DIRENT
 float.h                AC_HEADER_STDC
+float.h                AC_CHECK_HEADERS
 ndir.h         AC_HEADER_DIRENT
 stdarg.h       AC_HEADER_STDC
 stddef.h       AC_HEADER_STDC
+stddef.h       AC_CHECK_HEADERS
 stdlib.h       AC_HEADER_STDC
+stdlib.h       AC_CHECK_HEADERS
 string.h       AC_HEADER_STDC
+string.h       AC_CHECK_HEADERS
 sys/dir.h      AC_HEADER_DIRENT
 sys/mkdev.h    AC_HEADER_MAJOR
 sys/ndir.h     AC_HEADER_DIRENT
@@ -39,7 +46,6 @@ arpa/inet.h
 errno.h
 fcntl.h
 fenv.h
-float.h
 fs_info.h
 inttypes.h
 langinfo.h
@@ -58,11 +64,8 @@ nlist.h
 paths.h
 sgtty.h
 shadow.h
-stddef.h
 stdint.h
 stdio_ext.h
-stdlib.h
-string.h
 strings.h
 sys/acl.h
 sys/file.h
@@ -81,7 +84,6 @@ sys/systeminfo.h
 sys/time.h
 sys/timeb.h
 sys/vfs.h
-sys/wait.h
 sys/window.h
 syslog.h
 termio.h