autoconf-patches
[Top][All Lists]
Advanced

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

autoscan.patch


From: akim
Subject: autoscan.patch
Date: Mon, 25 Jun 2001 00:48:24 +0200
User-agent: Mutt/1.3.18i

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * 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.
        
        
Index: acfunctions
--- acfunctions Sat, 23 Jun 2001 23:01:08 +0200 akim (ace/23_acfunction 1.11 
644)
+++ acfunctions Sun, 24 Jun 2001 11:10:52 +0200 akim (ace/23_acfunction 1.11 
644)
@@ -22,11 +22,12 @@
 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 @@
 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 @@
 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 @@
 alarm
 atexit
 btowc
-bzero
 clock_gettime
 dcgettext
 doprnt
@@ -85,17 +89,14 @@
 fesetround
 floor
 fs_stat_dev
-fseeko
 ftime
 ftruncate
 getcwd
 getdelim
-getgroups
 gethostbyaddr
 gethostbyname
 gethostname
 gethrtime
-getloadavg
 getmntent
 getmntinfo
 getpagesize
@@ -115,10 +116,7 @@
 mblen
 mbrlen
 mbrtowc
-memchr
-memmove
 mempcpy
-memset
 mkdir
 mkfifo
 modf
@@ -150,7 +148,6 @@
 strcspn
 strdup
 strerror
-strftime
 strncasecmp
 strndup
 strnlen
@@ -158,7 +155,6 @@
 strrchr
 strspn
 strstr
-strtod
 strtol
 strtoul
 strtoull
@@ -167,10 +163,8 @@
 sysinfo
 tzset
 uname
-utime
 utmpname
 utmpxname
-vprintf
 wcwidth
 
 # Local Variables:
Index: acheaders
--- acheaders Mon, 04 Jun 2001 18:29:01 +0200 akim (ace/22_acheaders 1.3 644)
+++ acheaders Sun, 24 Jun 2001 11:10:58 +0200 akim (ace/22_acheaders 1.3 644)
@@ -17,15 +17,22 @@
 # 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 @@
 errno.h
 fcntl.h
 fenv.h
-float.h
 fs_info.h
 inttypes.h
 langinfo.h
@@ -58,11 +64,8 @@
 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/time.h
 sys/timeb.h
 sys/vfs.h
-sys/wait.h
 sys/window.h
 syslog.h
 termio.h
Index: autoscan.in
--- autoscan.in Sat, 23 Jun 2001 23:01:08 +0200 akim (ace/13_autoscan.p 1.38 
644)
+++ autoscan.in Mon, 25 Jun 2001 00:43:55 +0200 akim (ace/13_autoscan.p 1.38 
644)
@@ -22,20 +22,21 @@
 
 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 ||



reply via email to

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