autoconf-patches
[Top][All Lists]
Advanced

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

17-proto-autoscan-check.patch


From: Akim Demaille
Subject: 17-proto-autoscan-check.patch
Date: Sun, 21 Jan 2001 17:59:25 +0100

I don't know if you'll want to include this patch or not, it might be
good, even though very very preliminary.  In addition, I'm not fluent
in Perl, and I'll be happy to have some help from other people...
In particular for generic macros such as AC_CHECK_HEADERS.

Just for the fun, here is what autoscan run on bison outputs:

~/src/bison % ../ace/autoscan -A ../ace
Name "main::line" used only once: possible typo at ../ace/autoscan line 465.
Name "main::args" used only once: possible typo at ../ace/autoscan line 465.

 -t AC_PROG_CC -t 1 -t AC_PROG_LEX -t 1 -t AC_C_INLINE -t 1 -t AC_FUNC_MALLOC 
-t 1 -t AC_PROG_LN_S -t 1 -t AC_C_CONST -t 1 -t AC_FUNC_MEMCMP -t 1 -t 
AC_PROG_CXX -t 1 -t AC_PROG_INSTALL -t 1 -t AC_PROG_RANLIB -t 1 -t 
AC_TYPE_SIZE_T -t 1 -t AC_FUNC_ERROR_AT_LINE -t 1 -t AC_FUNC_OBSTACK -t 1 -t 
AC_FUNC_VPRINTF -t 1 -t AC_HEADER_STDC -t 1 -t AC_FUNC_MMAP -t 1 -t 
AC_PROG_YACC -t 1 -t AC_FUNC_ALLOCA -t 1 -t AC_PROG_CPP -t 1 -t AC_PROG_AWK -t 1
-A ../ace -t AC_PROG_CC -t 1 -t AC_PROG_LEX -t 1 -t AC_C_INLINE -t 1 -t 
AC_FUNC_MALLOC -t 1 -t AC_PROG_LN_S -t 1 -t AC_C_CONST -t 1 -t AC_FUNC_MEMCMP 
-t 1 -t AC_PROG_CXX -t 1 -t AC_PROG_INSTALL -t 1 -t AC_PROG_RANLIB -t 1 -t 
AC_TYPE_SIZE_T -t 1 -t AC_FUNC_ERROR_AT_LINE -t 1 -t AC_FUNC_OBSTACK -t 1 -t 
AC_FUNC_VPRINTF -t 1 -t AC_HEADER_STDC -t 1 -t AC_FUNC_MMAP -t 1 -t 
AC_PROG_YACC -t 1 -t AC_FUNC_ALLOCA -t 1 -t AC_PROG_CPP -t 1 -t AC_PROG_AWK -t 1
warning: missing AC_FUNC_ERROR_AT_LINE
warning: missing AC_FUNC_MALLOC
warning: missing AC_FUNC_MEMCMP
warning: missing AC_FUNC_OBSTACK
warning: missing AC_FUNC_VPRINTF
warning: missing AC_PROG_CXX
warning: missing AC_PROG_LEX
warning: missing AC_PROG_LN_S
warning: missing AC_PROG_YACC


Pay attention that the path to autoconf is hard coded
/home/akim/... (blush).  Some Perl programmer should copy the way
autoheader and autoupdate look for autoconf to fix this attrocity.

Having autoscan find configure.in/configure.ac would be another bonus :)


Index: TODO
--- TODO Sun, 14 Jan 2001 23:43:38 +0100 akim (ace/29_TODO 1.61 666)
+++ TODO Sun, 21 Jan 2001 17:09:49 +0100 akim (ace/29_TODO 1.61 666)
@@ -38,6 +38,15 @@
 ** Autotest
 Document it.

+** Document AC_COMPILE_IFELSE, AC_LANG_PROGRAM etc.
+And make AC_TRY_COMPILE etc. obsolete.
+
+** Autoscan macros
+Can be introduced even before specializing macros.  It just means that
+specializing macros will call them.  OTOH, this doubles our work,
+since specializing macros will save us from additional typing.  But
+the more powerful autoscan is, the better...
+
 * Autoconf 2.51 or later

 ** Libtool
Index: autoscan.pl
--- autoscan.pl Sat, 13 Jan 2001 11:47:33 +0100 akim (ace/13_autoscan.p 1.20 
666)
+++ autoscan.pl Sun, 21 Jan 2001 17:47:58 +0100 akim (ace/13_autoscan.p 1.20 
666)
@@ -27,15 +27,17 @@
 $verbose = 0;

 # Reference these variables to pacify perl -w.
-undef %identifiers_macros;
-undef %makevars_macros;
-undef %programs_macros;
+%identifiers_macros = ();
+%makevars_macros = ();
+%programs_macros = ();
+%needed_macros = ();

 &parse_args;
 &init_tables;
 &find('.');
 &scan_files;
 &output;
+&check_configure_ac ('configure.in');

 exit 0;

@@ -317,7 +319,7 @@ sub scan_sh_file
   }
 }

-# Print a configure.ac.
+# Print a proto configure.ac.
 sub output
 {
   local (%unique_makefiles);
@@ -332,6 +334,7 @@ sub output
   }

   &output_programs;
+  &output_libraries;
   &output_headers;
   &output_identifiers;
   &output_functions;
@@ -342,7 +345,7 @@ sub output
     $unique_makefiles{$_}++;
   }
   print CONF "\nAC_CONFIG_FILES([",
-    join("\n           ", keys(%unique_makefiles)), "])\n";
+        join("\n                 ", keys(%unique_makefiles)), "])\n";
   print CONF "AC_OUTPUT\n";

   close CONF;
@@ -356,6 +359,10 @@ sub print_unique
   if (defined($macro) && !defined($printed{$macro})) {
     print CONF "$macro\n";
     $printed{$macro} = 1;
+
+    # For the time being, just don't bother with macros with arguments.
+    $needed_macros{$macro} = 1
+      if ($macro !~ /]|^AC_CHECK_.*S/);
   }
 }

@@ -370,6 +377,12 @@ sub output_programs
   foreach $word (sort keys %makevars) {
     &print_unique($makevars_macros{$word});
   }
+}
+
+sub output_libraries
+{
+  local ($word);
+
   print CONF "\n# Checks for libraries.\n";
   foreach $word (sort keys %libraries) {
     print CONF "# FIXME: Replace `main' with a function in `-l$word':\n";
@@ -426,4 +439,34 @@ sub output_functions
   }
   print CONF "AC_CHECK_FUNCS([" . join(' ', sort(@have_funcs)) . "])\n"
     if defined(@have_funcs);
+}
+
+
+# Use autoconf to check if all the suggested macros are included
+# in `configure.ac'
+sub check_configure_ac
+{
+  local ($configure_ac) = $@;
+  local ($trace_option) = '';
+  local ($word);
+
+  print STDERR "$trace_option\n";
+  foreach $macro (%needed_macros)
+    {
+      $trace_option .= " -t $macro";
+    }
+
+  open (TRACES, "/home/akim/src/ace/autoconf -A $datadir $trace_option 
$configure_ac|") ||
+    die "$me: cannot create read traces: $!\n";
+
+  while (<TRACES>)
+    {
+      local ($file, $line, $macro, $args) = split (/:/, $_, 4);
+      delete ($needed_macros{$macro});
+    }
+
+  foreach $macro (sort keys %needed_macros)
+    {
+      print STDERR "warning: missing $macro\n";
+    }
 }



reply via email to

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