2003-01-07  Klee Dienes  <kdienes@apple.com>

	* bin/autoreconf.in (autoreconf_current_directory): Properly
	handle an empty aclocal.m4.

	* bin/autoheader.in (categories): Contains a list of valid warning
	categories.
	(validate_category): Check the argument against @categories,
	generating an error if it does not match a valid category.
	(validate_warnings): Check the contents of @warning against
	@categories.
	(match_warning): Checks an exception type against @categories.
	Returns -1 if the exception should be treated as an error; 1 if it
	should be treated as a warning.
	(main): Call validate_warnings.  Wrap the warning output for
	config.h.in auxiliary files with match_warning ('obsolete').
	
2003-01-07  Tom Tromey  <tromey@bogus.example.com>

        * lib/autoconf/lang.m4 (AC_NO_EXECUTABLES): Don't disable link
        tests.

--- lib/autoconf/lang.m4	2002-10-31 03:27:15.000000000 -0500
+++ lib/autoconf/lang.m4	2003-01-04 15:16:56.000000000 -0500
@@ -347,11 +347,6 @@
 # hack until Autoconf is abble to provide the services its users
 # needs.
 #
-# Several of the support libraries that are often built with GCC can't
-# assume the tool-chain is already capable of linking a program: the
-# compiler often expects to be able to link with some of such
-# libraries.
-#
 # In several of these libraries, workarounds have been introduced to
 # avoid the AC_PROG_CC_WORKS test, that would just abort their
 # configuration.  The introduction of AC_EXEEXT, enabled either by
@@ -370,9 +365,6 @@
 [EXEEXT=
 ])
 
-m4_define([AC_LINK_IFELSE],
-[AC_FATAL([All the tests involving linking were disabled by $0])])
-
 m4_divert_pop()dnl
 ])# AC_NO_EXECUTABLES
 
--- bin/autoreconf.in	2002-12-19 12:36:35.000000000 -0500
+++ bin/autoreconf.in	2002-12-28 21:29:00.000000000 -0500
@@ -297,7 +297,7 @@
       my $aclocal_m4 = new Autom4te::XFile 'aclocal.m4';
       $_ = $aclocal_m4->getline;
       $uses_aclocal = 0
-	unless /generated.*by aclocal/;
+	unless defined ($_) && /generated.*by aclocal/;
     }
 
   # If there are flags for aclocal in Makefile.am, use them.
--- bin/autoheader.in	2002-12-19 12:36:35.000000000 -0500
+++ bin/autoheader.in	2002-12-28 20:52:48.000000000 -0500
@@ -47,7 +47,7 @@
 my @prepend_include;
 my @include;
 my @warning;
-
+my @categories = ('obsolete');
 
 # $HELP
 # -----
@@ -117,6 +117,47 @@
     }
 }
 
+sub validate_category {
+  my ($category) = @_;
+  foreach my $c (@categories) {
+    if ($category eq $c) { return; }
+  }
+  error "error: invalid warning category \"$category\"";
+} 
+
+sub validate_warnings {
+  foreach my $w (@warning) {
+    if ($w =~ /^(no-)?([-a-z]+)$/) {
+      my ($prefix, $value) = ($1, $2);
+      if ($value =~ /^(all|none|error)$/) {
+	if ($prefix ne "") {
+	  error "error: a \"no-\" prefix may not be used with the 'all', 'none', or 'error' specifiers";
+	}
+      } else {
+	validate_category ($value);
+      }
+    } else {
+      error "error: invalid warning specifier \"$w\"";
+    }
+  }
+}
+
+sub match_warning {
+  my ($warning) = @_;
+  my $is_warning = 1;
+  my $is_error = 0;
+  validate_category ($warning);
+  foreach my $w (@warning) {
+    if ($w eq 'all') { $is_warning = 1; }
+    if ($w eq 'none') { $is_warning = 0; }
+    if ($w eq 'error') { $is_error = 1; }
+    if ($w eq $warning) { $is_warning = 1; }
+    if ($w eq ('no-'. $warning)) { $is_warning = 0; }
+  }
+  if ($is_warning && $is_error) { return -1; }
+  if ($is_warning) { return 1; }
+  return 0;
+}
 
 ## -------------- ##
 ## Main program.  ##
@@ -124,6 +165,7 @@
 
 mktmpdir ('ah');
 parse_args;
+validate_warnings;
 
 # Preach.
 my $config_h_top = find_file ("config.h.top?",
@@ -133,25 +175,29 @@
 my $acconfig_h = find_file ("acconfig.h?",
 			    reverse (@prepend_include), @include);
 if ($config_h_top || $config_h_bot || $acconfig_h)
-  {
-    my $msg = << "END";
-    Using auxiliary files such as \`acconfig.h\', \`config.h.bot\'
-    and \`config.h.top\', to define templates for \`config.h.in\'
-    is deprecated and discouraged.
-
-    Using the third argument of \`AC_DEFINE\' and
-    \`AC_DEFINE_UNQUOTED\' allows to define a template without
-    \`acconfig.h\':
+{
+  my $val = match_warning ('obsolete');
+  if ($val)
+    {
+      my $msg = << "END";
+Using auxiliary files such as \`acconfig.h\', \`config.h.bot\'
+and \`config.h.top\', to define templates for \`config.h.in\'
+is deprecated and discouraged.
+
+Using the third argument of \`AC_DEFINE\' and
+\`AC_DEFINE_UNQUOTED\' allows to define a template without
+\`acconfig.h\':
 
-      AC_DEFINE([NEED_MAIN], 1,
-                [Define if a function \`main\' is needed.])
+AC_DEFINE([NEED_MAIN], 1,
+	  [Define if a function \`main\' is needed.])
 
-    More sophisticated templates can also be produced, see the
-    documentation.
+More sophisticated templates can also be produced, see the
+documentation.
 END
-    $msg =~ s/^    /WARNING: /gm;
-    print STDERR $msg;
-  }
+      $msg =~ s/^/WARNING: /gm;
+      print STDERR $msg;
+    }
+}
 
 # Set up autoconf.
 my $autoconf = "$autom4te --language=autoconf ";
