]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
* autoscan.pl: Instead of undefined globals, set them to empty
authorAkim Demaille <akim@epita.fr>
Mon, 22 Jan 2001 19:01:23 +0000 (19:01 +0000)
committerAkim Demaille <akim@epita.fr>
Mon, 22 Jan 2001 19:01:23 +0000 (19:01 +0000)
values.
(%needed_macros): New.
(&check_configure_ac): New.  Call it.
(&output_libraries): Eve out from &output_programs.
(&print_unique): For the time being register in %needed_macros
only argument less macros.

ChangeLog
TODO
autoscan.in
autoscan.pl
bin/autoscan.in

index c5bdda75ebe7f67d96bcad99ee3570861ea3037c..6a4caf3ca9516814b7e85b510e343eac97b7112b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2001-01-22  Akim Demaille  <akim@epita.fr>
+
+       * autoscan.pl: Instead of undefined globals, set them to empty
+       values.
+       (%needed_macros): New.
+       (&check_configure_ac): New.  Call it.
+       (&output_libraries): Eve out from &output_programs.
+       (&print_unique): For the time being register in %needed_macros
+       only argument less macros.
+
 2001-01-22  Lars J. Aas  <somelarsa@sim.no>
 
        * aclang.m4 (_AC_PROG_CXX_EXIT_DECLARATION): First try no declaration,
diff --git a/TODO b/TODO
index 8ee4a26cf94235b257ede2858bf6f56f85fd0e7f..21465756fbc047b0c39ee0601d567bd3634365a8 100644 (file)
--- a/TODO
+++ b/TODO
@@ -38,6 +38,15 @@ longer *ever* try to parse Autoconf files.
 ** 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 e81f074f7c2fe7e5f43d24ddebcd22e37b0d26f6..2c12724ebd7ad0c2872f54b100e6b3bab56739cc 100644 (file)
@@ -27,15 +27,17 @@ $datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
 $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";
@@ -427,3 +440,33 @@ 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";
+    }
+}
index e81f074f7c2fe7e5f43d24ddebcd22e37b0d26f6..2c12724ebd7ad0c2872f54b100e6b3bab56739cc 100644 (file)
@@ -27,15 +27,17 @@ $datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
 $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";
@@ -427,3 +440,33 @@ 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";
+    }
+}
index e81f074f7c2fe7e5f43d24ddebcd22e37b0d26f6..2c12724ebd7ad0c2872f54b100e6b3bab56739cc 100644 (file)
@@ -27,15 +27,17 @@ $datadir = $ENV{"AC_MACRODIR"} || "@datadir@";
 $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";
@@ -427,3 +440,33 @@ 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";
+    }
+}