]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
* lib/Automake/Variable.pm (vardef, rvardef, set_seen): New functions.
authorAlexandre Duret-Lutz <adl@gnu.org>
Mon, 23 Jun 2003 21:39:54 +0000 (21:39 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Mon, 23 Jun 2003 21:39:54 +0000 (21:39 +0000)
(variable_defined, examine_variable): Remove.
(%_ac_macro_for_var): Add an entry for ALLOCA.
(require_variables): Use vardef instead of variable_defined.
Do not use _cvar.
* automake.in (generate_makefile): Do not push $(SOURCE) into
@sources.  Use define_pretty_variable to define SOURCES.
(handle_LIBOBJS, handle_ALLOCA): Use require_variables_for_variable
to require LIBOBJS, LTLIBOBJS and ALLOCA.
(handle_programs, handle_ltlibraries): Do not define an empty
_DEPENDENCIES or _LDFLAGS variable when none is defined.
(define_configure_variable): Do not check whether the variable
already exists (it's Automake::Variable::define's job).
(require_build_directory): Likewise, do not check
the existence of am__dirstamp.
(generate_makefile, handle_options, handle_languages)
(check_libobjs_sources, handle_single_transform_list)
(traverse_variable_recursively_worker, handle_source_transform)
(handle_lib_objects, handle_LIBOBJS, handle_compile)
(handle_libtool, handle_programs, handle_libraries)
(handle_ltlibraries, check_typos, handle_texinfo_helper)
(handle_man_pages, handle_tags, handle_dist, handle_subdirs)
(scan_aclocal_m4, handle_gettext, handle_footer, handle_install)
(handle_all, do_check_merge_target, handle_clean, lang_c_finish)
(handle_tests, lang_yacc_target_hook, define_pretty_variable)
(define_compiler_variable, define_linker_variable)
(make_paragraphs, am_primary_prefixes, am_install_var): Adjust to
call var, vardef, or set_seen, instead of variable_defined.  Use
set_seen only for variables which are actually checked by
check_typos.
* tests/target.test: Delete.
* tests/alloca.test, tests/alloca2.test: New files.
* tests/libobj3.test: Check error message.
* tests/distcom4.test: Make sure configure is in DIST_COMMON.
This replace confdist.test.
* tests/Makefile.am (TESTS, XFAIL_TESTS): Remove target.test.
(TESTS): Add alloca.test and alloca2.test.  Remove confdist.test.

ChangeLog
automake.in
lib/Automake/Variable.pm
tests/Makefile.am
tests/Makefile.in
tests/alloca.test [moved from tests/target.test with 64% similarity]
tests/alloca2.test [moved from tests/confdist.test with 61% similarity]
tests/distcom4.test
tests/libobj3.test

index edb5694b3870d935cf4629353d7dd65a2b32efee..645a026390d87ef626bfda0b9d0a94251d2018b0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,43 @@
+2003-06-23  Alexandre Duret-Lutz  <adl@gnu.org>
+
+       * lib/Automake/Variable.pm (vardef, rvardef, set_seen): New functions.
+       (variable_defined, examine_variable): Remove.
+       (%_ac_macro_for_var): Add an entry for ALLOCA.
+       (require_variables): Use vardef instead of variable_defined.
+       Do not use _cvar.
+       * automake.in (generate_makefile): Do not push $(SOURCE) into
+       @sources.  Use define_pretty_variable to define SOURCES.
+       (handle_LIBOBJS, handle_ALLOCA): Use require_variables_for_variable
+       to require LIBOBJS, LTLIBOBJS and ALLOCA.
+       (handle_programs, handle_ltlibraries): Do not define an empty
+       _DEPENDENCIES or _LDFLAGS variable when none is defined.
+       (define_configure_variable): Do not check whether the variable
+       already exists (it's Automake::Variable::define's job).
+       (require_build_directory): Likewise, do not check
+       the existence of am__dirstamp.
+       (generate_makefile, handle_options, handle_languages)
+       (check_libobjs_sources, handle_single_transform_list)
+       (traverse_variable_recursively_worker, handle_source_transform)
+       (handle_lib_objects, handle_LIBOBJS, handle_compile)
+       (handle_libtool, handle_programs, handle_libraries)
+       (handle_ltlibraries, check_typos, handle_texinfo_helper)
+       (handle_man_pages, handle_tags, handle_dist, handle_subdirs)
+       (scan_aclocal_m4, handle_gettext, handle_footer, handle_install)
+       (handle_all, do_check_merge_target, handle_clean, lang_c_finish)
+       (handle_tests, lang_yacc_target_hook, define_pretty_variable)
+       (define_compiler_variable, define_linker_variable)
+       (make_paragraphs, am_primary_prefixes, am_install_var): Adjust to
+       call var, vardef, or set_seen, instead of variable_defined.  Use
+       set_seen only for variables which are actually checked by
+       check_typos.
+       * tests/target.test: Delete.
+       * tests/alloca.test, tests/alloca2.test: New files.
+       * tests/libobj3.test: Check error message.
+       * tests/distcom4.test: Make sure configure is in DIST_COMMON.
+       This replace confdist.test.
+       * tests/Makefile.am (TESTS, XFAIL_TESTS): Remove target.test.
+       (TESTS): Add alloca.test and alloca2.test.  Remove confdist.test.
+
 2003-06-20  Alexandre Duret-Lutz  <adl@gnu.org>
 
        * automake.in (handle_dist): Delete DIST_COMMON before redefining
index b3b749f8b56b3d1561d293f2e10c5742e5aaeaab..228ef51d5f92d0b776aaa3ac8bb6cf30a4a3972e 100755 (executable)
@@ -1229,7 +1229,7 @@ sub generate_makefile
     # Catch some obsolete variables.
     msg_var ('obsolete', 'INCLUDES',
             "`INCLUDES' is the old name for `AM_CPPFLAGS'")
-      if variable_defined ('INCLUDES');
+      if var ('INCLUDES');
 
     # At the toplevel directory, we might need config.guess, config.sub
     # or libtool scripts (ltconfig and ltmain.sh).
@@ -1251,9 +1251,6 @@ sub generate_makefile
        &push_dist_common ($in_file_name, $am_file_name);
     }
 
-    push (@sources, '$(SOURCES)')
-       if variable_defined ('SOURCES');
-
     # Must do this after reading .am file.
     &define_variable ('subdir', $relative_dir, INTERNAL);
 
@@ -1280,10 +1277,8 @@ sub generate_makefile
     # We have to run this after dealing with all the programs.
     &handle_libtool;
 
-    # Re-init SOURCES.  FIXME: other code shouldn't depend on this
-    # (but currently does).
-    Automake::Variable::define ('SOURCES', VAR_AUTOMAKE, '', TRUE,
-                               "@sources", '', INTERNAL, VAR_PRETTY);
+    # Variables used by distdir.am and tags.am.
+    define_pretty_variable ('SOURCES', TRUE, INTERNAL, @sources);
     define_pretty_variable ('DIST_SOURCES', TRUE, INTERNAL, @dist_sources);
 
     &handle_multilib;
@@ -1307,8 +1302,7 @@ sub generate_makefile
     &handle_all ($output);
 
     # FIXME: Gross!
-    if (variable_defined ('lib_LTLIBRARIES') &&
-       variable_defined ('bin_PROGRAMS'))
+    if (var ('lib_LTLIBRARIES') && var ('bin_PROGRAMS'))
     {
        $output_rules .= "install-binPROGRAMS: install-libLTLIBRARIES\n\n";
     }
@@ -1448,29 +1442,29 @@ sub process_option_list
 # Handle AUTOMAKE_OPTIONS variable.  Return 1 on error, 0 otherwise.
 sub handle_options
 {
-    # Process global options first so that more specific options can
-    # override.
-    if (&process_option_list (1, split (' ', $global_options)))
+  # Process global options first so that more specific options can
+  # override.
+  if (&process_option_list (1, split (' ', $global_options)))
     {
-       return 1;
+      return 1;
     }
 
-    if (variable_defined ('AUTOMAKE_OPTIONS'))
+  if (var ('AUTOMAKE_OPTIONS'))
     {
-       if (&process_option_list (0, &variable_value_as_list_recursive ('AUTOMAKE_OPTIONS', TRUE)))
+      if (&process_option_list (0, &variable_value_as_list_recursive ('AUTOMAKE_OPTIONS', TRUE)))
        {
-           return 1;
+         return 1;
        }
     }
 
-    if ($strictness == GNITS)
+  if ($strictness == GNITS)
     {
-       $options{'readme-alpha'} = 1;
-       $options{'std-options'} = 1;
-       $options{'check-news'} = 1;
+      $options{'readme-alpha'} = 1;
+      $options{'std-options'} = 1;
+      $options{'check-news'} = 1;
     }
 
-    return 0;
+  return 0;
 }
 
 
@@ -1644,7 +1638,7 @@ sub handle_languages
              {
                my $val = "${derived}_$flag";
                $obj_compile =~ s/\(AM_$flag\)/\($val\)/
-                 if variable_defined ($val);
+                 if set_seen ($val);
              }
 
            my $obj_ltcompile = '$(LIBTOOL) --mode=compile ' . $obj_compile;
@@ -1856,23 +1850,23 @@ sub check_libobjs_sources
   foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_',
                      'dist_EXTRA_', 'nodist_EXTRA_')
     {
-        my @files;
-       if (variable_defined ($prefix . $one_file . '_SOURCES'))
+      my @files;
+      my $varname = $prefix . $one_file . '_SOURCES';
+      my $var = var ($varname);
+      if ($var)
        {
-           @files = &variable_value_as_list_recursive (
-                               ($prefix . $one_file . '_SOURCES'),
-                               'all');
+         @files = &variable_value_as_list_recursive ($varname, 'all');
        }
-       elsif ($prefix eq '')
+      elsif ($prefix eq '')
        {
-           @files = ($unxformed . '.c');
+         @files = ($unxformed . '.c');
        }
-       else
+      else
        {
-           next;
+         next;
        }
 
-       foreach my $file (@files)
+      foreach my $file (@files)
        {
          err_var ($prefix . $one_file . '_SOURCES',
                   "automatically discovered file `$file' should not" .
@@ -1988,7 +1982,7 @@ sub handle_single_transform_list ($$$$@)
            my $have_per_exec_flags = 0;
            foreach my $flag (@{$lang->flags})
              {
-               if (variable_defined ("${derived}_$flag"))
+               if (set_seen ("${derived}_$flag"))
                  {
                    $have_per_exec_flags = 1;
                    last;
@@ -2011,13 +2005,14 @@ sub handle_single_transform_list ($$$$@)
                 # override.
 
                 my $dname = $derived;
-                if (variable_defined ($derived . '_SHORTNAME'))
+               my $var = var ($derived . '_SHORTNAME');
+                if ($var)
                 {
                     # FIXME: should use the same Condition as
                     # the _SOURCES variable.  But this is really
                     # silly overkill -- nobody should have
                     # conditional shortnames.
-                    $dname = &variable_value ($derived . '_SHORTNAME');
+                    $dname = $var->variable_value;
                 }
                 $object = $dname . '-' . $object;
 
@@ -2266,9 +2261,11 @@ sub traverse_variable_recursively_worker ($$&&$$)
 {
   my ($var, $parent, $fun_item, $fun_collect, $cond_filter, $parent_cond) = @_;
 
-  # Don't recurse into undefined variables.
-  # This will also mark existing variables as examined.
-  return () if ! variable_defined ($var);
+  # Don't recurse into undefined variables and mark
+  # existing variable as examined.
+  my $v = set_seen $var;
+  return ()
+    unless $v;
 
   if (defined $vars_scanned{$var})
     {
@@ -2279,7 +2276,6 @@ sub traverse_variable_recursively_worker ($$&&$$)
 
   my @allresults = ();
   my $cond_once = 0;
-  my $v = rvar $var;
   foreach my $cond ($v->conditions->conds)
     {
       if (ref $cond_filter)
@@ -2532,9 +2528,9 @@ sub handle_source_transform
     foreach my $prefix ('', 'EXTRA_', 'dist_', 'nodist_',
                        'dist_EXTRA_', 'nodist_EXTRA_')
     {
-       my $var = $prefix . $one_file . "_SOURCES";
-       next
-         if !variable_defined ($var);
+       my $varname = $prefix . $one_file . "_SOURCES";
+       my $var = var $varname;
+       next unless $var;
 
        # We are going to define _OBJECTS variables using the prefix.
        # Then we glom them all together.  So we can't use the null
@@ -2545,29 +2541,29 @@ sub handle_source_transform
        $used_pfx{$xpfx} = 1
          unless $prefix =~ /EXTRA_/;
 
-       push @sources, "\$($var)";
+       push @sources, "\$($varname)";
        if ($prefix !~ /^nodist_/)
          {
            # If the VAR wasn't definined conditionally, we add
            # it to DIST_SOURCES as is.  Otherwise we create a
            # am__VAR_DIST variable which contains all possible values,
            # and add this variable to DIST_SOURCES.
-           my $distvar = "$var";
-           if (variable_conditionally_defined ($var))
+           my $distvar = $varname;
+           if (variable_conditionally_defined ($varname))
              {
-               $distvar = "am__${var}_DIST";
+               $distvar = "am__${varname}_DIST";
                my @files =
-                 uniq (variable_value_as_list_recursive ($var, 'all'));
+                 uniq (variable_value_as_list_recursive ($varname, 'all'));
                define_pretty_variable ($distvar, TRUE, $where, @files);
              }
            push @dist_sources, "\$($distvar)"
          }
 
        $needlinker |=
-           define_objects_from_sources ($var,
+           define_objects_from_sources ($varname,
                                         $xpfx . $one_file . '_OBJECTS',
                                         $prefix =~ /EXTRA_/,
-                                        $one_file, $obj, $var, $where);
+                                        $one_file, $obj, $varname, $where);
     }
     if ($needlinker)
     {
@@ -2616,19 +2612,21 @@ sub handle_source_transform
 # Returns 1 if LIBOBJS seen, 0 otherwise.
 sub handle_lib_objects
 {
-  my ($xname, $var) = @_;
+  my ($xname, $varname) = @_;
 
-  prog_error "handle_lib_objects: `$var' undefined"
-    if ! variable_defined ($var);
-  prog_error ("handle_lib_objects: unexpected variable name `$var'")
-    unless $var =~ /^(.*)(?:LIB|LD)ADD$/;
+  my $var = var ($varname);
+  prog_error "handle_lib_objects: `$varname' undefined"
+    unless $var;
+  prog_error "handle_lib_objects: unexpected variable name `$varname'"
+    unless $varname =~ /^(.*)(?:LIB|LD)ADD$/;
   my $prefix = $1 || 'AM_';
 
   my $seen_libobjs = 0;
   my $flagvar = 0;
 
   transform_variable_recursively
-    ($var, $xname . '_DEPENDENCIES', 'am__DEPENDENCIES', ! $xname, INTERNAL,
+    ($varname, $xname . '_DEPENDENCIES', 'am__DEPENDENCIES',
+     ! $xname, INTERNAL,
      # Transformation function, run on each filename.
      sub {
        my ($subvar, $val, $cond, $full_cond) = @_;
@@ -2692,10 +2690,11 @@ sub handle_LIBOBJS ($$$)
   $lt ||= '';
   my $myobjext = ($1 ? 'l' : '') . 'o';
 
-  if (! keys %libsources && ! variable_defined ($lt . 'LIBOBJS'))
+  if (! keys %libsources)
     {
-      err_var ($var, "\@${lt}LIBOBJS\@ seen but never set in "
-              . "`$configure_ac'");
+      require_variables_for_variable ($var,
+                                     "\@${lt}LIBOBJS\@ used",
+                                     $lt . 'LIBOBJS');
     }
 
   foreach my $iter (keys %libsources)
@@ -2717,7 +2716,7 @@ sub handle_LIBOBJS ($$$)
          $dep_files{'$(DEPDIR)/' . $rewrite} = 1;
          $rewrite = "^" . quotemeta ($iter) . "\$";
          # Only require the file if it is not a built source.
-         if (! variable_defined ('BUILT_SOURCES')
+         if (! var ('BUILT_SOURCES')
              || ! grep (/$rewrite/,
                         &variable_value_as_list_recursive ('BUILT_SOURCES',
                                                            'all')))
@@ -2731,11 +2730,10 @@ sub handle_LIBOBJS ($$$)
 sub handle_ALLOCA ($$$)
 {
   my ($var, $cond, $lt) = @_;
-  my $myobjext = ($1 ? 'l' : '') . 'o';
-
-  err_var ($var, "\@${lt}ALLOCA\@ seen but `AC_FUNC_ALLOCA' not in "
-          . "`$configure_ac'")
-    if ! defined $libsources{'alloca.c'};
+  my $myobjext = ($lt ? 'l' : '') . 'o';
+  $lt ||= '';
+  require_variables_for_variable ($var, "\@${lt}ALLOCA\@ used",
+                                 $lt . 'ALLOCA');
   $dep_files{'$(DEPDIR)/alloca.P' . $myobjext} = 1;
   require_file_with_macro ($cond, $var, FOREIGN, 'alloca.c');
   &saw_extension ('c');
@@ -2783,9 +2781,10 @@ sub handle_compile ()
       {
        $default_includes = ' -I. -I$(srcdir)';
 
-       if (variable_defined ('CONFIG_HEADER'))
+       my $var = var 'CONFIG_HEADER';
+       if ($var)
          {
-           foreach my $hdr (split (' ', &variable_value ('CONFIG_HEADER')))
+           foreach my $hdr (split (' ', $var->variable_value))
              {
                $default_includes .= ' -I' . dirname ($hdr);
              }
@@ -2855,7 +2854,7 @@ sub handle_compile ()
 # Handle libtool rules.
 sub handle_libtool
 {
-  return unless variable_defined ('LIBTOOL');
+  return unless var ('LIBTOOL');
 
   # Libtool requires some files, but only at top level.
   require_conf_file_with_macro (TRUE, 'LIBTOOL', FOREIGN, @libtool_files)
@@ -2886,7 +2885,7 @@ sub handle_programs
   return if ! @proglist;
 
   my $seen_global_libobjs =
-    variable_defined ('LDADD') && &handle_lib_objects ('', 'LDADD');
+    var ('LDADD') && &handle_lib_objects ('', 'LDADD');
 
   foreach my $pair (@proglist)
     {
@@ -2910,11 +2909,9 @@ sub handle_programs
 
       my $linker = &handle_source_transform ($xname, $one_file, $obj, $where);
 
-      my $xt = '';
-      if (variable_defined ($xname . "_LDADD"))
+      if (var ($xname . "_LDADD"))
        {
          $seen_libobjs = &handle_lib_objects ($xname, $xname . '_LDADD');
-         $xt = '_LDADD';
        }
       else
        {
@@ -2923,29 +2920,21 @@ sub handle_programs
 
          # This does a bit too much work.  But we need it to
          # generate _DEPENDENCIES when appropriate.
-         if (variable_defined ('LDADD'))
+         if (var ('LDADD'))
            {
              $seen_libobjs = &handle_lib_objects ($xname, 'LDADD');
            }
-         elsif (! variable_defined ($xname . '_DEPENDENCIES'))
-           {
-             &define_variable ($xname . '_DEPENDENCIES', '', $where);
-           }
-         $xt = '_SOURCES';
        }
 
       reject_var ($xname . '_LIBADD',
                  "use `${xname}_LDADD', not `${xname}_LIBADD'");
 
-      if (! variable_defined ($xname . '_LDFLAGS'))
-       {
-         # Define the prog_LDFLAGS variable.
-         &define_variable ($xname . '_LDFLAGS', '', $where);
-       }
+      set_seen ($xname . '_DEPENDENCIES');
+      set_seen ($xname . '_LDFLAGS');
 
       # Determine program to use for link.
       my $xlink;
-      if (variable_defined ($xname . '_LINK'))
+      if (var ($xname . '_LINK'))
        {
          $xlink = $xname . '_LINK';
        }
@@ -2968,11 +2957,11 @@ sub handle_programs
 
       if ($seen_libobjs || $seen_global_libobjs)
        {
-         if (variable_defined ($xname . '_LDADD'))
+         if (var ($xname . '_LDADD'))
            {
              &check_libobjs_sources ($xname, $xname . '_LDADD');
            }
-         elsif (variable_defined ('LDADD'))
+         elsif (var ('LDADD'))
            {
              &check_libobjs_sources ($xname, 'LDADD');
            }
@@ -3018,14 +3007,14 @@ sub handle_libraries
                                            '_OBJECTS', '_DEPENDENCIES',
                                            '_AR');
 
-      if (! variable_defined ($xlib . '_AR'))
+      if (! var ($xlib . '_AR'))
        {
          &define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where);
        }
 
       # Generate support for conditional object inclusion in
       # libraries.
-      if (variable_defined ($xlib . '_LIBADD'))
+      if (var ($xlib . '_LIBADD'))
        {
          if (&handle_lib_objects ($xlib, $xlib . '_LIBADD'))
            {
@@ -3041,7 +3030,7 @@ sub handle_libraries
                  "use `${xlib}_LIBADD', not `${xlib}_LDADD'");
 
       # Make sure we at look at this.
-      &examine_variable ($xlib . '_DEPENDENCIES');
+      set_seen ($xlib . '_DEPENDENCIES');
 
       &handle_source_transform ($xlib, $onelib, $obj, $where);
 
@@ -3057,7 +3046,7 @@ sub handle_libraries
 
       if ($seen_libobjs)
        {
-         if (variable_defined ($xlib . '_LIBADD'))
+         if (var ($xlib . '_LIBADD'))
            {
              &check_libobjs_sources ($xlib, $xlib . '_LIBADD');
            }
@@ -3139,11 +3128,11 @@ sub handle_ltlibraries
 
       # Check that the library fits the standard naming convention.
       my $libname_rx = "^lib.*\.la";
-      if ((variable_defined ($xlib . '_LDFLAGS')
+      if ((var ($xlib . '_LDFLAGS')
           && grep (/-module/,
                    &variable_value_as_list_recursive ($xlib . '_LDFLAGS',
                                                       'all')))
-         || (variable_defined ('LDFLAGS')
+         || (var ('LDFLAGS')
              && grep (/-module/,
                       &variable_value_as_list_recursive ('LDFLAGS', 'all'))))
        {
@@ -3159,15 +3148,13 @@ sub handle_ltlibraries
       $where->push_context ("while processing Libtool library `$onelib'");
       $where->set (INTERNAL->get);
 
-      if (! variable_defined ($xlib . '_LDFLAGS'))
-       {
-         # Define the lib_LDFLAGS variable.
-         &define_variable ($xlib . '_LDFLAGS', '', $where);
-       }
+      # Make sure we at look at these.
+      set_seen ($xlib . '_LDFLAGS');
+      set_seen ($xlib . '_DEPENDENCIES');
 
       # Generate support for conditional object inclusion in
       # libraries.
-      if (variable_defined ($xlib . '_LIBADD'))
+      if (var ($xlib . '_LIBADD'))
        {
          if (&handle_lib_objects ($xlib, $xlib . '_LIBADD'))
            {
@@ -3182,14 +3169,12 @@ sub handle_ltlibraries
       reject_var ("${xlib}_LDADD",
                  "use `${xlib}_LIBADD', not `${xlib}_LDADD'");
 
-      # Make sure we at look at this.
-      &examine_variable ($xlib . '_DEPENDENCIES');
 
       my $linker = &handle_source_transform ($xlib, $onelib, $obj, $where);
 
       # Determine program to use for link.
       my $xlink;
-      if (variable_defined ($xlib . '_LINK'))
+      if (var ($xlib . '_LINK'))
        {
          $xlink = $xlib . '_LINK';
        }
@@ -3232,7 +3217,7 @@ sub handle_ltlibraries
                                       DIRSTAMP   => $dirstamp);
       if ($seen_libobjs)
        {
-         if (variable_defined ($xlib . '_LIBADD'))
+         if (var ($xlib . '_LIBADD'))
            {
              &check_libobjs_sources ($xlib, $xlib . '_LIBADD');
            }
@@ -3244,7 +3229,7 @@ sub handle_ltlibraries
 sub check_typos ()
 {
   # It is ok if the user sets this particular variable.
-  &examine_variable ('AM_LDFLAGS');
+  set_seen 'AM_LDFLAGS';
 
   foreach my $varname (variables)
     {
@@ -3455,7 +3440,7 @@ sub handle_texinfo_helper
     reject_var 'TEXINFOS', "`TEXINFOS' is an anachronism; use `info_TEXINFOS'";
     reject_var 'html_TEXINFOS', "HTML generation not yet supported";
 
-    return (0, '') if ! variable_defined ('info_TEXINFOS');
+    return (0, '') unless var ('info_TEXINFOS');
 
     my @texis = &variable_value_as_list_recursive ('info_TEXINFOS', 'all');
 
@@ -3499,7 +3484,7 @@ sub handle_texinfo_helper
        push (@texi_deps, "$outdir$vtexi") if $vtexi;
 
        my $canonical = &canonicalize ($infobase);
-       if (variable_defined ($canonical . "_TEXINFOS"))
+       if (var ($canonical . "_TEXINFOS"))
        {
            push (@texi_deps, '$(' . $canonical . '_TEXINFOS)');
            &push_dist_common ('$(' . $canonical . '_TEXINFOS)');
@@ -3576,7 +3561,7 @@ sub handle_texinfo_helper
        &define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL);
        $need_texi_file = 2; # so that we require_conf_file later
     }
-    elsif (variable_defined ('TEXINFO_TEX'))
+    elsif (var ('TEXINFO_TEX'))
     {
        # The user defined TEXINFO_TEX so assume he knows what he is
        # doing.
@@ -3648,65 +3633,69 @@ sub handle_texinfo
 # Handle any man pages.
 sub handle_man_pages
 {
-    reject_var 'MANS', "`MANS' is an anachronism; use `man_MANS'";
+  reject_var 'MANS', "`MANS' is an anachronism; use `man_MANS'";
 
-    # Find all the sections in use.  We do this by first looking for
-    # "standard" sections, and then looking for any additional
-    # sections used in man_MANS.
-    my (%sections, %vlist);
-    # We handle nodist_ for uniformity.  man pages aren't distributed
-    # by default so it isn't actually very important.
-    foreach my $pfx ('', 'dist_', 'nodist_')
+  # Find all the sections in use.  We do this by first looking for
+  # "standard" sections, and then looking for any additional
+  # sections used in man_MANS.
+  my (%sections, %vlist);
+  # We handle nodist_ for uniformity.  man pages aren't distributed
+  # by default so it isn't actually very important.
+  foreach my $pfx ('', 'dist_', 'nodist_')
     {
-       # Add more sections as needed.
-       foreach my $section ('0'..'9', 'n', 'l')
+      # Add more sections as needed.
+      foreach my $section ('0'..'9', 'n', 'l')
        {
-           if (variable_defined ($pfx . 'man' . $section . '_MANS'))
+         my $varname = $pfx . 'man' . $section . '_MANS';
+         if (var ($varname))
            {
-               $sections{$section} = 1;
-               $vlist{'$(' . $pfx . 'man' . $section . '_MANS)'} = 1;
+             $sections{$section} = 1;
+             $varname = '$(' . $varname . ')';
+             $vlist{$varname} = 1;
 
-               &push_dist_common ('$(' . $pfx . 'man' . $section . '_MANS)')
-                   if $pfx eq 'dist_';
+             &push_dist_common ($varname)
+               if $pfx eq 'dist_';
            }
        }
 
-       if (variable_defined ($pfx . 'man_MANS'))
+      my $varname = $pfx . 'man_MANS';
+      if (var ($varname))
        {
-           $vlist{'$(' . $pfx . 'man_MANS)'} = 1;
-           foreach (&variable_value_as_list_recursive ($pfx . 'man_MANS', 'all'))
+         foreach (&variable_value_as_list_recursive ($varname, 'all'))
            {
-               # A page like `foo.1c' goes into man1dir.
-               if (/\.([0-9a-z])([a-z]*)$/)
+             # A page like `foo.1c' goes into man1dir.
+             if (/\.([0-9a-z])([a-z]*)$/)
                {
-                   $sections{$1} = 1;
+                 $sections{$1} = 1;
                }
            }
 
-           &push_dist_common ('$(' . $pfx . 'man_MANS)')
-               if $pfx eq 'dist_';
+         $varname = '$(' . $varname . ')';
+         $vlist{$varname} = 1;
+         &push_dist_common ($varname)
+           if $pfx eq 'dist_';
        }
     }
 
-    return unless %sections;
+  return unless %sections;
 
-    # Now for each section, generate an install and unintall rule.
-    # Sort sections so output is deterministic.
-    foreach my $section (sort keys %sections)
+  # Now for each section, generate an install and unintall rule.
+  # Sort sections so output is deterministic.
+  foreach my $section (sort keys %sections)
     {
-       $output_rules .= &file_contents ('mans',
-                                        new Automake::Location,
-                                        SECTION => $section);
+      $output_rules .= &file_contents ('mans',
+                                      new Automake::Location,
+                                      SECTION => $section);
     }
 
-    my @mans = sort keys %vlist;
-    $output_vars .= file_contents ('mans-vars',
-                                  new Automake::Location,
-                                  MANS => "@mans");
+  my @mans = sort keys %vlist;
+  $output_vars .= file_contents ('mans-vars',
+                                new Automake::Location,
+                                MANS => "@mans");
 
-    if (! defined $options{'no-installman'})
+  if (! defined $options{'no-installman'})
     {
-       push (@all, '$(MANS)');
+      push (@all, '$(MANS)');
     }
 }
 
@@ -3723,7 +3712,7 @@ sub handle_tags
 {
     my @tag_deps = ();
     my @ctag_deps = ();
-    if (variable_defined ('SUBDIRS'))
+    if (var ('SUBDIRS'))
     {
        $output_rules .= ("tags-recursive:\n"
                          . "\tlist=\'\$(SUBDIRS)\'; for subdir in \$\$list; do \\\n"
@@ -3747,7 +3736,7 @@ sub handle_tags
     }
 
     if (&saw_sources_p (1)
-       || variable_defined ('ETAGS_ARGS')
+       || var ('ETAGS_ARGS')
        || @tag_deps)
     {
        my @config;
@@ -3767,7 +3756,8 @@ sub handle_tags
                                         CONFIG    => "@config",
                                         TAGSDIRS  => "@tag_deps",
                                         CTAGSDIRS => "@ctag_deps");
-       &examine_variable ('TAGS_DEPENDENCIES');
+
+       set_seen 'TAGS_DEPENDENCIES';
     }
     elsif (reject_var ('TAGS_DEPENDENCIES',
                       "doesn't make sense to define `TAGS_DEPENDENCIES'"
@@ -3821,168 +3811,168 @@ sub for_dist_common
 # Handle 'dist' target.
 sub handle_dist
 {
-    my ($makefile) = @_;
+  my ($makefile) = @_;
 
-    # `make dist' isn't used in a Cygnus-style tree.
-    # Omit the rules so that people don't try to use them.
-    return if $cygnus_mode;
+  # `make dist' isn't used in a Cygnus-style tree.
+  # Omit the rules so that people don't try to use them.
+  return if $cygnus_mode;
 
-    # At least one of the archive formats must be enabled.
-    if ($relative_dir eq '.')
-      {
-       my $archive_defined = $options{'no-dist-gzip'} ? 0 : 1;
-       $archive_defined ||=
-         grep { $options{"dist-$_"} } ('shar', 'zip', 'tarZ', 'bzip2');
-       error ($options{'no-dist-gzip'},
-              "no-dist-gzip specified but no dist-* specified, "
-              . "at least one archive format must be enabled")
-         unless $archive_defined;
-      }
+  # At least one of the archive formats must be enabled.
+  if ($relative_dir eq '.')
+    {
+      my $archive_defined = $options{'no-dist-gzip'} ? 0 : 1;
+      $archive_defined ||=
+       grep { $options{"dist-$_"} } ('shar', 'zip', 'tarZ', 'bzip2');
+      error ($options{'no-dist-gzip'},
+            "no-dist-gzip specified but no dist-* specified, "
+            . "at least one archive format must be enabled")
+       unless $archive_defined;
+    }
 
-    # Look for common files that should be included in distribution.
-    # If the aux dir is set, and it does not have a Makefile.am, then
-    # we check for these files there as well.
-    my $check_aux = 0;
-    my $auxdir = '';
-    if ($relative_dir eq '.'
-       && $config_aux_dir_set_in_configure_in)
+  # Look for common files that should be included in distribution.
+  # If the aux dir is set, and it does not have a Makefile.am, then
+  # we check for these files there as well.
+  my $check_aux = 0;
+  my $auxdir = '';
+  if ($relative_dir eq '.'
+      && $config_aux_dir_set_in_configure_in)
     {
-       ($auxdir = $config_aux_dir) =~ s,^\$\(top_srcdir\)/,,;
-       if (! &is_make_dir ($auxdir))
+      ($auxdir = $config_aux_dir) =~ s,^\$\(top_srcdir\)/,,;
+      if (! &is_make_dir ($auxdir))
        {
-           $check_aux = 1;
+         $check_aux = 1;
        }
     }
-    foreach my $cfile (@common_files)
+  foreach my $cfile (@common_files)
     {
-       if (-f ($relative_dir . "/" . $cfile)
-           # The file might be absent, but if it can be built it's ok.
-           || exists $targets{$cfile})
+      if (-f ($relative_dir . "/" . $cfile)
+         # The file might be absent, but if it can be built it's ok.
+         || exists $targets{$cfile})
        {
-           &push_dist_common ($cfile);
+         &push_dist_common ($cfile);
        }
 
-       # Don't use `elsif' here because a file might meaningfully
-       # appear in both directories.
-       if ($check_aux && -f ($auxdir . '/' . $cfile))
+      # Don't use `elsif' here because a file might meaningfully
+      # appear in both directories.
+      if ($check_aux && -f ($auxdir . '/' . $cfile))
        {
-           &push_dist_common ($auxdir . '/' . $cfile);
+         &push_dist_common ($auxdir . '/' . $cfile);
        }
     }
 
-    # We might copy elements from $configure_dist_common to
-    # %dist_common if we think we need to.  If the file appears in our
-    # directory, we would have discovered it already, so we don't
-    # check that.  But if the file is in a subdir without a Makefile,
-    # we want to distribute it here if we are doing `.'.  Ugly!
-    if ($relative_dir eq '.')
+  # We might copy elements from $configure_dist_common to
+  # %dist_common if we think we need to.  If the file appears in our
+  # directory, we would have discovered it already, so we don't
+  # check that.  But if the file is in a subdir without a Makefile,
+  # we want to distribute it here if we are doing `.'.  Ugly!
+  if ($relative_dir eq '.')
     {
-       foreach my $file (split (' ' , $configure_dist_common))
-       {
-          push_dist_common ($file)
-            unless is_make_dir (dirname ($file));
-       }
-    }
-
-    # Files to distributed.  Don't use &variable_value_as_list_recursive
-    # as it recursively expands `$(dist_pkgdata_DATA)' etc.
-    my @dist_common = split (' ', rvar ('DIST_COMMON')->variable_value);
-    @dist_common = uniq (sort for_dist_common (@dist_common));
-    variable_delete 'DIST_COMMON';
-    define_pretty_variable ('DIST_COMMON', TRUE, INTERNAL, @dist_common);
-
-    # Now that we've processed DIST_COMMON, disallow further attempts
-    # to set it.
-    $handle_dist_run = 1;
-
-    # Scan EXTRA_DIST to see if we need to distribute anything from a
-    # subdir.  If so, add it to the list.  I didn't want to do this
-    # originally, but there were so many requests that I finally
-    # relented.
-    if (variable_defined ('EXTRA_DIST'))
-    {
-       # FIXME: This should be fixed to work with conditions.  That
-       # will require only making the entries in %dist_dirs under the
-       # appropriate condition.  This is meaningful if the nature of
-       # the distribution should depend upon the configure options
-       # used.
-       foreach (&variable_value_as_list_recursive ('EXTRA_DIST', 'all'))
-       {
-           next if /^\@.*\@$/;
-           next unless s,/+[^/]+$,,;
-           $dist_dirs{$_} = 1
-               unless $_ eq '.';
-       }
-    }
-
-    # We have to check DIST_COMMON for extra directories in case the
-    # user put a source used in AC_OUTPUT into a subdir.
-    my $topsrcdir = backname ($relative_dir);
-    foreach (&variable_value_as_list_recursive ('DIST_COMMON', 'all'))
-    {
-       next if /^\@.*\@$/;
-       s/\$\(top_srcdir\)/$topsrcdir/;
-       s/\$\(srcdir\)/./;
-       # Strip any leading `./'.
-       s,^(:?\./+)*,,;
-       next unless s,/+[^/]+$,,;
-       $dist_dirs{$_} = 1
+      foreach my $file (split (' ' , $configure_dist_common))
+       {
+         push_dist_common ($file)
+           unless is_make_dir (dirname ($file));
+       }
+    }
+
+  # Files to distributed.  Don't use &variable_value_as_list_recursive
+  # as it recursively expands `$(dist_pkgdata_DATA)' etc.
+  my @dist_common = split (' ', rvar ('DIST_COMMON')->variable_value);
+  @dist_common = uniq (sort for_dist_common (@dist_common));
+  variable_delete 'DIST_COMMON';
+  define_pretty_variable ('DIST_COMMON', TRUE, INTERNAL, @dist_common);
+
+  # Now that we've processed DIST_COMMON, disallow further attempts
+  # to set it.
+  $handle_dist_run = 1;
+
+  # Scan EXTRA_DIST to see if we need to distribute anything from a
+  # subdir.  If so, add it to the list.  I didn't want to do this
+  # originally, but there were so many requests that I finally
+  # relented.
+  if (var ('EXTRA_DIST'))
+    {
+      # FIXME: This should be fixed to work with conditions.  That
+      # will require only making the entries in %dist_dirs under the
+      # appropriate condition.  This is meaningful if the nature of
+      # the distribution should depend upon the configure options
+      # used.
+      foreach (&variable_value_as_list_recursive ('EXTRA_DIST', 'all'))
+       {
+         next if /^\@.*\@$/;
+         next unless s,/+[^/]+$,,;
+         $dist_dirs{$_} = 1
            unless $_ eq '.';
+       }
+    }
+
+  # We have to check DIST_COMMON for extra directories in case the
+  # user put a source used in AC_OUTPUT into a subdir.
+  my $topsrcdir = backname ($relative_dir);
+  foreach (&variable_value_as_list_recursive ('DIST_COMMON', 'all'))
+    {
+      next if /^\@.*\@$/;
+      s/\$\(top_srcdir\)/$topsrcdir/;
+      s/\$\(srcdir\)/./;
+      # Strip any leading `./'.
+      s,^(:?\./+)*,,;
+      next unless s,/+[^/]+$,,;
+      $dist_dirs{$_} = 1
+       unless $_ eq '.';
     }
 
-    # Rule to check whether a distribution is viable.
-    my %transform = ('DISTCHECK-HOOK' => &target_defined ('distcheck-hook'),
-                    'GETTEXT' => $seen_gettext && !$seen_gettext_external);
+  # Rule to check whether a distribution is viable.
+  my %transform = ('DISTCHECK-HOOK' => &target_defined ('distcheck-hook'),
+                  'GETTEXT' => $seen_gettext && !$seen_gettext_external);
 
-    # Prepend $(distdir) to each directory given.
-    my %rewritten = map { '$(distdir)/' . "$_" => 1 } keys %dist_dirs;
-    $transform{'DISTDIRS'} = join (' ', sort keys %rewritten);
+  # Prepend $(distdir) to each directory given.
+  my %rewritten = map { '$(distdir)/' . "$_" => 1 } keys %dist_dirs;
+  $transform{'DISTDIRS'} = join (' ', sort keys %rewritten);
 
-    # If we have SUBDIRS, create all dist subdirectories and do
-    # recursive build.
-    if (variable_defined ('SUBDIRS'))
+  # If we have SUBDIRS, create all dist subdirectories and do
+  # recursive build.
+  if (var ('SUBDIRS'))
     {
-       # If SUBDIRS is conditionally defined, then set DIST_SUBDIRS
-       # to all possible directories, and use it.  If DIST_SUBDIRS is
-       # defined, just use it.
-       my $dist_subdir_name;
-       # Note that we check DIST_SUBDIRS first on purpose.  At least
-       # one project uses so many conditional subdirectories that
-       # calling variable_conditionally_defined on SUBDIRS will cause
-       # automake to grow to 150Mb.  Sigh.
-       if (variable_defined ('DIST_SUBDIRS')
-           || variable_conditionally_defined ('SUBDIRS'))
+      # If SUBDIRS is conditionally defined, then set DIST_SUBDIRS
+      # to all possible directories, and use it.  If DIST_SUBDIRS is
+      # defined, just use it.
+      my $dist_subdir_name;
+      # Note that we check DIST_SUBDIRS first on purpose.  At least
+      # one project uses so many conditional subdirectories that
+      # calling variable_conditionally_defined on SUBDIRS will cause
+      # automake to grow to 150Mb.  Sigh.
+      if (var ('DIST_SUBDIRS'))
        {
-           $dist_subdir_name = 'DIST_SUBDIRS';
-           if (! variable_defined ('DIST_SUBDIRS'))
-           {
-               define_pretty_variable
-                 ('DIST_SUBDIRS', TRUE, INTERNAL,
-                  uniq (&variable_value_as_list_recursive ('SUBDIRS', 'all')));
-           }
+         $dist_subdir_name = 'DIST_SUBDIRS';
        }
-       else
+      elsif (variable_conditionally_defined ('SUBDIRS'))
+       {
+         $dist_subdir_name = 'DIST_SUBDIRS';
+         define_pretty_variable
+           ('DIST_SUBDIRS', TRUE, INTERNAL,
+            uniq (&variable_value_as_list_recursive ('SUBDIRS', 'all')));
+       }
+      else
        {
-           $dist_subdir_name = 'SUBDIRS';
-           # We always define this because that is what `distclean'
-           # wants.
-           define_pretty_variable ('DIST_SUBDIRS', TRUE, INTERNAL,
-                                   '$(SUBDIRS)');
+         $dist_subdir_name = 'SUBDIRS';
+         # We always define this because that is what `distclean'
+         # wants.
+         define_pretty_variable ('DIST_SUBDIRS', TRUE, INTERNAL,
+                                 '$(SUBDIRS)');
        }
 
-       $transform{'DIST_SUBDIR_NAME'} = $dist_subdir_name;
+      $transform{'DIST_SUBDIR_NAME'} = $dist_subdir_name;
     }
 
-    # If the target `dist-hook' exists, make sure it is run.  This
-    # allows users to do random weird things to the distribution
-    # before it is packaged up.
-    push (@dist_targets, 'dist-hook')
-      if &target_defined ('dist-hook');
-    $transform{'DIST-TARGETS'} = join(' ', @dist_targets);
+  # If the target `dist-hook' exists, make sure it is run.  This
+  # allows users to do random weird things to the distribution
+  # before it is packaged up.
+  push (@dist_targets, 'dist-hook')
+    if &target_defined ('dist-hook');
+  $transform{'DIST-TARGETS'} = join(' ', @dist_targets);
 
-    $output_rules .= &file_contents ('distdir',
-                                    new Automake::Location,
-                                    %transform);
+  $output_rules .= &file_contents ('distdir',
+                                  new Automake::Location,
+                                  %transform);
 }
 
 
@@ -3990,12 +3980,12 @@ sub handle_dist
 sub handle_subdirs
 {
     return
-      unless variable_defined ('SUBDIRS');
+      unless var ('SUBDIRS');
 
     my @subdirs = &variable_value_as_list_recursive ('SUBDIRS', 'all');
     my @dsubdirs = ();
     @dsubdirs = &variable_value_as_list_recursive ('DIST_SUBDIRS', 'all')
-      if variable_defined ('DIST_SUBDIRS');
+      if var ('DIST_SUBDIRS');
 
     # If an `obj/' directory exists, BSD make will enter it before
     # reading `Makefile'.  Hence the `Makefile' in the current directory
@@ -4050,8 +4040,8 @@ sub scan_aclocal_m4
 {
     my $regen_aclocal = 0;
 
-    &examine_variable ('CONFIG_STATUS_DEPENDENCIES');
-    &examine_variable ('CONFIGURE_DEPENDENCIES');
+    set_seen 'CONFIG_STATUS_DEPENDENCIES';
+    set_seen 'CONFIGURE_DEPENDENCIES';
 
     if (-f 'aclocal.m4')
     {
@@ -4066,7 +4056,7 @@ sub scan_aclocal_m4
 
     my @ac_deps = ();
 
-    if (variable_defined ('ACLOCAL_M4_SOURCES'))
+    if (set_seen ('ACLOCAL_M4_SOURCES'))
     {
        push (@ac_deps, '$(ACLOCAL_M4_SOURCES)');
        msg_var ('obsolete', 'ACLOCAL_M4_SOURCES',
@@ -4377,7 +4367,7 @@ sub handle_gettext
 {
   return if ! $seen_gettext || $relative_dir ne '.';
 
-  if (! variable_defined ('SUBDIRS'))
+  if (! var ('SUBDIRS'))
     {
       err_ac "AM_GNU_GETTEXT used but SUBDIRS not defined";
       return;
@@ -4440,7 +4430,7 @@ sub handle_footer
     # before .SUFFIXES.  So we make sure that .SUFFIXES appears before
     # anything else, by sticking it right after the default: target.
     $output_header .= ".SUFFIXES:\n";
-    if (@suffixes || variable_defined ('SUFFIXES'))
+    if (@suffixes || var ('SUFFIXES'))
     {
        # Make sure suffixes has unique elements.  Sort them to ensure
        # the output remains consistent.  However, $(SUFFIXES) is
@@ -4449,7 +4439,7 @@ sub handle_footer
        # suffixes, and this lets the user have some control.  Push
        # actual suffixes, and not $(SUFFIXES).  Some versions of make
        # do not like variable substitutions on the .SUFFIXES line.
-       my @user_suffixes = (variable_defined ('SUFFIXES')
+       my @user_suffixes = (var ('SUFFIXES')
                             ? &variable_value_as_list_recursive ('SUFFIXES',
                                                                  'all')
                             : ());
@@ -4472,7 +4462,7 @@ sub handle_install ()
   $output_rules .= &file_contents
     ('install',
      new Automake::Location,
-     maybe_BUILT_SOURCES => (variable_defined ('BUILT_SOURCES')
+     maybe_BUILT_SOURCES => (set_seen ('BUILT_SOURCES')
                             ? (" \$(BUILT_SOURCES)\n"
                                . "\t\$(MAKE) \$(AM_MAKEFLAGS)")
                             : ''),
@@ -4516,7 +4506,7 @@ sub handle_all ($)
 
     my @local_headers = ();
     push @local_headers, '$(BUILT_SOURCES)'
-      if variable_defined ('BUILT_SOURCES');
+      if var ('BUILT_SOURCES');
     foreach my $spec (@config_headers)
       {
         my ($out, @ins) = split_config_file_spec ($spec);
@@ -4535,13 +4525,12 @@ sub handle_all ($)
        $output_all .= ("all: @local_headers"
                        . "\n\t"
                        . '$(MAKE) $(AM_MAKEFLAGS) '
-                       . (variable_defined ('SUBDIRS')
-                          ? 'all-recursive' : 'all-am')
+                       . (var ('SUBDIRS') ? 'all-recursive' : 'all-am')
                        . "\n\n");
       }
     else
       {
-       $output_all .= "all: " . (variable_defined ('SUBDIRS')
+       $output_all .= "all: " . (var ('SUBDIRS')
                                  ? 'all-recursive' : 'all-am') . "\n\n";
       }
 }
@@ -4580,11 +4569,10 @@ sub do_check_merge_target
     &depend ('.PHONY', 'check', 'check-am');
     # Handle recursion.  We have to honor BUILT_SOURCES like for `all:'.
     $output_rules .= ("check: "
-                     . (variable_defined ('BUILT_SOURCES')
+                     . (var ('BUILT_SOURCES')
                         ? "\$(BUILT_SOURCES)\n\t\$(MAKE) \$(AM_MAKEFLAGS) "
                         : '')
-                     . (variable_defined ('SUBDIRS')
-                        ? 'check-recursive' : 'check-am')
+                     . (var ('SUBDIRS') ? 'check-recursive' : 'check-am')
                      . "\n");
 }
 
@@ -4593,17 +4581,17 @@ sub handle_clean
 {
   # Clean the files listed in user variables if they exist.
   $clean_files{'$(MOSTLYCLEANFILES)'} = MOSTLY_CLEAN
-    if variable_defined ('MOSTLYCLEANFILES');
+    if var ('MOSTLYCLEANFILES');
   $clean_files{'$(CLEANFILES)'} = CLEAN
-    if variable_defined ('CLEANFILES');
+    if var ('CLEANFILES');
   $clean_files{'$(DISTCLEANFILES)'} = DIST_CLEAN
-    if variable_defined ('DISTCLEANFILES');
+    if var ('DISTCLEANFILES');
   $clean_files{'$(MAINTAINERCLEANFILES)'} = MAINTAINER_CLEAN
-    if variable_defined ('MAINTAINERCLEANFILES');
+    if var ('MAINTAINERCLEANFILES');
 
   # Built sources are automatically removed by maintainer-clean.
   $clean_files{'$(BUILT_SOURCES)'} = MAINTAINER_CLEAN
-    if variable_defined ('BUILT_SOURCES');
+    if var ('BUILT_SOURCES');
 
   # Compute a list of "rm"s to run for each target.
   my %rms = (MOSTLY_CLEAN, [],
@@ -4771,7 +4759,7 @@ sub handle_tests
        }
     }
 
-  if (variable_defined ('TESTS'))
+  if (var ('TESTS'))
     {
       push (@check_tests, 'check-TESTS');
       $output_rules .= &file_contents ('check', new Automake::Location);
@@ -5394,7 +5382,7 @@ sub lang_c_finish
                              . " || rm -f \$\@\n");
            push (@objects, $base . '_.$(OBJEXT)');
            push (@objects, $base . '_.lo')
-             if variable_defined ('LIBTOOL');
+             if var ('LIBTOOL');
        }
 
        # Make all _.o (and _.lo) files depend on ansi2knr.
@@ -5410,10 +5398,10 @@ sub lang_yacc_target_hook
     my ($self, $aggregate, $output, $input) = @_;
 
     my $flag = $aggregate . "_YFLAGS";
-    if ((variable_defined ($flag)
-        && &variable_value ($flag) =~ /$DASH_D_PATTERN/o)
-       || (variable_defined ('YFLAGS')
-           && &variable_value ('YFLAGS') =~ /$DASH_D_PATTERN/o))
+    my $flagvar = var $flag;
+    my $YFLAGSvar = var 'YFLAGS';
+    if (($flagvar && $flagvar->variable_value =~ /$DASH_D_PATTERN/o)
+       || ($YFLAGSvar && $YFLAGSvar->variable_value =~ /$DASH_D_PATTERN/o))
     {
        (my $output_base = $output) =~ s/$KNOWN_EXTENSIONS_PATTERN$//;
        my $header = $output_base . '.h';
@@ -5866,7 +5854,7 @@ sub define_pretty_variable ($$$@)
 {
     my ($var, $cond, $where, @value) = @_;
 
-    if (! variable_defined ($var, $cond))
+    if (! vardef ($var, $cond))
     {
         Automake::Variable::define ($var, VAR_AUTOMAKE, '', $cond, "@value",
                                    '', $where, VAR_PRETTY);
@@ -5890,25 +5878,23 @@ sub define_variable ($$$)
 sub define_configure_variable ($)
 {
   my ($var) = @_;
-  if (! variable_defined ($var, TRUE))
-    {
-      my $pretty = VAR_ASIS;
-      my $owner = VAR_CONFIGURE;
 
-      # Do not output the ANSI2KNR configure variable -- we AC_SUBST
-      # it in protos.m4, but later redefine it elsewhere.  This is
-      # pretty hacky.  We also don't output AMDEPBACKSLASH: it might
-      # be subst'd by `\', which certainly would not be appreciated by
-      # Make.
-      if ($var eq 'ANSI2KNR' || $var eq 'AMDEPBACKSLASH')
-       {
-         $pretty = VAR_SILENT;
-         $owner = VAR_AUTOMAKE;
-       }
+  my $pretty = VAR_ASIS;
+  my $owner = VAR_CONFIGURE;
 
-      Automake::Variable::define ($var, $owner, '', TRUE, subst $var,
-                                 '', $configure_vars{$var}, $pretty);
+  # Do not output the ANSI2KNR configure variable -- we AC_SUBST
+  # it in protos.m4, but later redefine it elsewhere.  This is
+  # pretty hacky.  We also don't output AMDEPBACKSLASH: it might
+  # be subst'd by `\', which certainly would not be appreciated by
+  # Make.
+  if ($var eq 'ANSI2KNR' || $var eq 'AMDEPBACKSLASH')
+    {
+      $pretty = VAR_SILENT;
+      $owner = VAR_AUTOMAKE;
     }
+
+  Automake::Variable::define ($var, $owner, '', TRUE, subst $var,
+                             '', $configure_vars{$var}, $pretty);
 }
 
 
@@ -5923,7 +5909,7 @@ sub define_compiler_variable ($)
     my ($var, $value) = ($lang->compiler, $lang->compile);
     &define_variable ($var, $value, INTERNAL);
     &define_variable ("LT$var", "\$(LIBTOOL) --mode=compile $value", INTERNAL)
-      if variable_defined ('LIBTOOL');
+      if var ('LIBTOOL');
 }
 
 
@@ -5939,8 +5925,7 @@ sub define_linker_variable ($)
     &define_variable ($lang->lder, $lang->ld, INTERNAL);
     # CCLINK = $(CCLD) blah blah...
     &define_variable ($lang->linker,
-                     ((variable_defined ('LIBTOOL')
-                       ? '$(LIBTOOL) --mode=link ' : '')
+                     ((var ('LIBTOOL') ? '$(LIBTOOL) --mode=link ' : '')
                       . $lang->link),
                      INTERNAL);
 }
@@ -6667,7 +6652,7 @@ sub make_paragraphs ($%)
                     'INSTALL-MAN'  => !$options{'no-installman'},
                     'CK-NEWS'      => $options{'check-news'} || 0,
 
-                    'SUBDIRS'      => variable_defined ('SUBDIRS'),
+                    'SUBDIRS'      => !! var ('SUBDIRS'),
                     'TOPDIR'       => backname ($relative_dir),
                     'TOPDIR_P'     => $relative_dir eq '.',
                     'CONFIGURE-AC' => $configure_ac,
@@ -6676,7 +6661,7 @@ sub make_paragraphs ($%)
                     'HOST'     => $seen_canonical,
                     'TARGET'   => $seen_canonical == AC_CANONICAL_SYSTEM,
 
-                    'LIBTOOL'      => variable_defined ('LIBTOOL'))
+                    'LIBTOOL'      => !! var ('LIBTOOL'))
          # We don't need more than two consecutive new-lines.
          . 's/\n{3,}/\n\n/g';
 
@@ -7063,7 +7048,7 @@ sub am_primary_prefixes ($$@)
     }
 
   # Return only those which are actually defined.
-  return sort grep { variable_defined ($_ . '_' . $primary) } keys %valid;
+  return sort grep { var ($_ . '_' . $primary) } keys %valid;
 }
 
 
@@ -7255,7 +7240,7 @@ sub am_install_var
   err_var ($require_extra,
           "`$require_extra' contains configure substitution,\n"
           . "but `EXTRA_$primary' not defined")
-    if ($require_extra && ! variable_defined ('EXTRA_' . $primary));
+    if ($require_extra && ! var ('EXTRA_' . $primary));
 
   # Push here because PRIMARY might be configure time determined.
   push (@all, '$(' . $primary . ')')
@@ -7544,8 +7529,7 @@ sub require_build_directory ($)
 
       # Set a variable for the dirstamp basename.
       define_pretty_variable ('am__dirstamp', TRUE, INTERNAL,
-                             '$(am__leading_dot)dirstamp')
-       unless variable_defined ('am__dirstamp');
+                             '$(am__leading_dot)dirstamp');
 
       # Directory must be removed by `make distclean'.
       $clean_files{$dirstamp} = DIST_CLEAN;
index 5e705512d999c6b0f5371f88c73a252a06be0828..55433726005f998115b5d40f1befddebad274d3f 100644 (file)
@@ -31,14 +31,13 @@ require Exporter;
 use vars '@ISA', '@EXPORT', '@EXPORT_OK';
 @ISA = qw/Exporter/;
 @EXPORT = qw (err_var msg_var msg_cond_var reject_var
-             var rvar
+             var rvar vardef rvardef
              variables
              scan_variable_expansions check_variable_expansions
              condition_ambiguous_p
              variable_delete
              variable_dump variables_dump
-             variable_defined
-             examine_variable
+             set_seen
              require_variables require_variables_for_variable
              variable_value
              output_variables);
@@ -117,10 +116,15 @@ but is better written
 
   return rvar ($name)->rdef ($cond)->value;
 
-The I<r> variants of the C<var> and C<def> methods add an extra test
-to ensure that the lookup succeeded, and will diagnose failure as
-internal errors (which a message which is much more informative than
-Perl's warning about calling a method on a non-object).
+or even
+
+  return rvardef ($name, $cond)->value;
+
+The I<r> variants of the C<var>, C<def>, and C<vardef> methods add an
+extra test to ensure that the lookup succeeded, and will diagnose
+failures as internal errors (which a message which is much more
+informative than Perl's warning about calling a method on a
+non-object).
 
 =cut
 
@@ -155,6 +159,7 @@ my %_am_macro_for_var =
 # Macros shipped with Autoconf.
 my %_ac_macro_for_var =
   (
+   ALLOCA => 'AC_FUNC_ALLOCA',
    CC => 'AC_PROG_CC',
    CFLAGS => 'AC_PROG_CC',
    CXX => 'AC_PROG_CXX',
@@ -301,8 +306,7 @@ sub reset ()
 =item C<var ($varname)>
 
 Return the C<Automake::Variable> object for the variable
-named C<$varname> if defined.   Return the empty list
-otherwise.
+named C<$varname> if defined.   Return 0 otherwise.
 
 =cut
 
@@ -310,7 +314,22 @@ sub var ($)
 {
   my ($name) = @_;
   return $_variable_dict{$name} if exists $_variable_dict{$name};
-  return ();
+  return 0;
+}
+
+=item C<vardef ($varname, $cond)>
+
+Return the C<Automake::VarDef> object for the variable named
+C<$varname> if defined in condition C<$cond>.  Return the empty list
+if the condition or the variable does not exist.
+
+=cut
+
+sub vardef ($$)
+{
+  my ($name, $cond) = @_;
+  my $var = var $name;
+  return $var && $var->def ($cond);
 }
 
 # Create the variable if it does not exist.
@@ -343,6 +362,20 @@ sub rvar ($)
   return $v;
 }
 
+=item C<rvardef ($varname, $cond)>
+
+Return the C<Automake::VarDef> object for the variable named
+C<$varname> if defined in condition C<$cond>.  Abort with an internal
+error if the variable or the variable does not exist.
+
+=cut
+
+sub rvardef ($$)
+{
+  my ($name, $cond) = @_;
+  return rvar ($name)->rdef ($cond);
+}
+
 =back
 
 =head2 Methods
@@ -385,7 +418,7 @@ sub name ($)
 =item C<$var-E<gt>def ($cond)>
 
 Return the C<Automake::VarDef> definition for this variable in
-condition C<$cond>, if it exists.  Return the empty list otherwise.
+condition C<$cond>, if it exists.  Return 0 otherwise.
 
 =cut
 
@@ -393,7 +426,7 @@ sub def ($$)
 {
   my ($self, $cond) = @_;
   return $self->{'defs'}{$cond} if exists $self->{'defs'}{$cond};
-  return ();
+  return 0;
 }
 
 =item C<$var-E<gt>rdef ($cond)>
@@ -624,7 +657,7 @@ C<("foo", "$(B)", "bar")>.
 
 =cut
 
-sub value_as_list($$;$$)
+sub value_as_list ($$;$$)
 {
   my ($self, $cond, $parent, $parent_cond) = @_;
   my @result;
@@ -660,7 +693,6 @@ sub value_as_list($$;$$)
   return @result;
 }
 
-
 =back
 
 =head2 Utility functions
@@ -1099,93 +1131,34 @@ sub variables_dump ()
   return $text;
 }
 
-=item C<$bool = variable_defined ($varname, [$cond])>
 
-See if a variable exists.  C<$varname> is the variable name, and
-C<$cond> is the condition which we should check.  If no condition is
-given, we currently return true if the variable is defined under any
-condition.
+=item C<$var = set_seen ($varname)>
+
+=item C<$var = $var->set_seen>
+
+Mark all definitions of this variable as examined, if the variable
+exists.  See L<Automake::VarDef::set_seen>.
+
+Return the C<Variable> object if the variable exists, or 0
+otherwise (i.e., as the C<var> function).
 
 =cut
 
-sub variable_defined ($;$)
+sub set_seen ($)
 {
-  my ($var, $cond) = @_;
+  my ($self) = @_;
+  $self = ref $self ? $self : var $self;
 
-  my $v = var $var;
-  my $def = ($v && $cond) ? ($v->def ($cond)) : 0;
+  return 0 unless $self;
 
-  if (!$v || ($cond && !$def))
+  for my $c ($self->conditions->conds)
     {
-      # VAR is not defined.
-
-      # Check there is no target defined with the name of the
-      # variable we check.
-
-      # adl> I'm wondering if this error still makes any sense today. I
-      # adl> guess it was because targets and variables used to share
-      # adl> the same namespace in older versions of Automake?
-      # tom> While what you say is definitely part of it, I think it
-      # tom> might also have been due to someone making a "spelling error"
-      # tom> -- writing "foo:..." instead of "foo = ...".
-      # tom> I'm not sure whether it is really worth diagnosing
-      # tom> this sort of problem.  In the old days I used to add warnings
-      # tom> and errors like this pretty randomly, based on bug reports I
-      # tom> got.  But there's a plausible argument that I was trying
-      # tom> too hard to prevent people from making mistakes.
-
-      ### FIXME: Presently we can't do this.  Wait until targets are handled
-      ### in there own module.
-      # if (exists $Automake::targets{$var}
-      #          && (!$cond || exists $Automake::targets{$var}{$cond}))
-      #        {
-      #          for my $tcond ($cond || keys %{$Automake::targets{$var}})
-      #            {
-      #              prog_error ("\$Automake::targets{$var}{" . $tcond->human
-      #                          . "} exists but \$target_owner doesn't")
-      #                unless exists $Automake::target_owner{$var}{$tcond};
-      #              # Diagnose the first user target encountered, if any.
-      #              # Restricting this test to user targets allows Automake
-      #              # to create rules for things like `bin_PROGRAMS = LDADD'.
-      #              if ($Automake::target_owner{$var}{$tcond}
-      #                  == &Automake::TARGET_USER)
-      #                {
-      #                  Automake::msg_cond_target ('syntax', $tcond, $var,
-      #                                             "`$var' is a target; "
-      #                                             . "expected a variable");
-      #                  return 0;
-      #                }
-      #            }
-      #        }
-      return 0;
+      $self->rdef ($c)->set_seen;
     }
 
-  # VAR is defined.  Record we have examined this variable.
-  if (!$cond)
-    {
-      for my $c ($v->conditions->conds)
-       {
-         $v->rdef ($c)->set_seen;
-       }
-    }
-  else
-    {
-      $def->set_seen;
-    }
-  return 1;
+  return $self;
 }
 
-=item C<examine_variable ($varname)>
-
-Mark a variable as examined.
-
-=cut
-
-sub examine_variable ($)
-{
-  my ($var) = @_;
-  variable_defined ($var);
-}
 
 =item C<$count = require_variables ($where, $reason, $cond, @variables)>
 
@@ -1208,16 +1181,15 @@ sub require_variables ($$$@)
     {
       # Nothing to do if the variable exists.
       next VARIABLE
-       if variable_defined ($var, $cond);
-
-      my $v = _cvar $var;
-      my $undef_cond = $v->not_always_defined_in_cond ($cond);
-      next VARIABLE
-       if $undef_cond->false;
+       if vardef ($var, $cond);
 
       my $text = "$reason`$var' is undefined\n";
-      if (! $undef_cond->true)
+      my $v = var $var;
+      if ($v)
        {
+         my $undef_cond = $v->not_always_defined_in_cond ($cond);
+         next VARIABLE
+           if $undef_cond->false;
          $text .= ("in the following conditions:\n  "
                    . join ("\n  ", map { $_->human } $undef_cond->conds));
        }
index 9eb2650b92baf2189a575214d434725f3954944e..e8db714190a08a6ac5d8253f76d76f5aaa5c2123 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to create Makefile.in
 
-XFAIL_TESTS = auxdir2.test cond17.test txinfo5.test target.test
+XFAIL_TESTS = auxdir2.test cond17.test txinfo5.test
 
 TESTS =        \
 aclibobj.test \
@@ -19,6 +19,8 @@ acsilent.test \
 acsubst.test \
 acsubst2.test \
 all.test \
+alloca.test \
+alloca2.test \
 alpha.test \
 alpha2.test \
 amassign.test \
@@ -115,7 +117,6 @@ condman.test \
 condman2.test \
 conf2.test \
 confdeps.test \
-confdist.test \
 conff.test \
 confh.test \
 confh4.test \
@@ -427,7 +428,6 @@ symlink3.test \
 syntax.test \
 tags.test \
 tagsub.test \
-target.test \
 target-cflags.test \
 targetclash.test \
 txinfo.test \
index d9790506a216bf0731214bfb48308b13f8cdb3eb..df8a3bbcd1c20fe8a35da8d25f2c3b8202025169 100644 (file)
@@ -112,7 +112,7 @@ sbindir = @sbindir@
 sharedstatedir = @sharedstatedir@
 sysconfdir = @sysconfdir@
 target_alias = @target_alias@
-XFAIL_TESTS = auxdir2.test cond17.test txinfo5.test target.test
+XFAIL_TESTS = auxdir2.test cond17.test txinfo5.test
 TESTS = \
 aclibobj.test \
 aclocal.test \
@@ -130,6 +130,8 @@ acsilent.test \
 acsubst.test \
 acsubst2.test \
 all.test \
+alloca.test \
+alloca2.test \
 alpha.test \
 alpha2.test \
 amassign.test \
@@ -226,7 +228,6 @@ condman.test \
 condman2.test \
 conf2.test \
 confdeps.test \
-confdist.test \
 conff.test \
 confh.test \
 confh4.test \
@@ -538,7 +539,6 @@ symlink3.test \
 syntax.test \
 tags.test \
 tagsub.test \
-target.test \
 target-cflags.test \
 targetclash.test \
 txinfo.test \
similarity index 64%
rename from tests/target.test
rename to tests/alloca.test
index 44f30d0728d7f6cc477ebdb9b2ba13842cfc2162..15811f395eb883304bcbe9a707bc074d6dd8f746 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with autoconf; see the file COPYING.  If not, write to
+# along with Automake; see the file COPYING.  If not, write to
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-# Test for a bug where target names and variable names are treated alike.
-# Bug from François Pinard.
+# Make sure we complain if @ALLOCA@ is used without being set in configure.in
 
 . ./defs || exit 1
 
-echo AC_PROG_CC >> configure.in
+set -e
 
 cat > Makefile.am << 'END'
-bin_PROGRAMS = consud
-## Note next line is target, not variable.
-consud_SOURCES: consud.c
+noinst_LIBRARIES = libtu.a
+libtu_a_SOURCES =
+libtu_a_LIBADD = @ALLOCA@
 END
 
-echo > consud.c
-
-$ACLOCAL || exit 1
-$AUTOMAKE && exit 1
-exit 0
+$ACLOCAL
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep 'Makefile.am:1:.*AC_PROG_RANLIB' stderr
+grep 'Makefile.am:3:.*AC_FUNC_ALLOCA' stderr
similarity index 61%
rename from tests/confdist.test
rename to tests/alloca2.test
index 6478a255b3a1595b2d61380492a55e2d3ec97d0e..36db4af04009ce915839b0d7d14182b13241ff0d 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with autoconf; see the file COPYING.  If not, write to
+# along with Automake; see the file COPYING.  If not, write to
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-# Test to make sure configure is included in distribution.  Report
-# from Eleftherios Gkioulekas.
+# Make sure we complain if @LTALLOCA@ is used without being set in configure.in
 
 . ./defs || exit 1
 
-: > Makefile.am
+set -e
 
-$ACLOCAL || exit 1
-$AUTOMAKE || exit 1
+cat > Makefile.am << 'END'
+noinst_LTLIBRARIES = libtu.la
+libtu_la_SOURCES =
+libtu_la_LIBADD = @LTALLOCA@
+END
 
-grep '^DIST_COMMON.*configure ' Makefile.in
+$ACLOCAL
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep 'Makefile.am:1:.*AC_PROG_LIBTOOL' stderr
+grep 'Makefile.am:3:.*ALLOCA' stderr
index 916fa9b89f92f38e23f9d72d4599a8fc962cda0c..975f157d9fc415baeb9518eea67b1e44d73ff3a0 100755 (executable)
@@ -70,4 +70,6 @@ sed -n -e '/^DIST_COMMON =.*\\$/ {
    }' -e '/^DIST_COMMON =/ p' Makefile.in > dc.txt
 
 test 1 = `grep tests dc.txt | wc -l`
+grep configure dc.txt
+# README must come first.
 grep 'DIST_COMMON = README' Makefile.in
index 22e8c37cfe8ae219e817ddcdb3259f338976e2a2..8e1331c506eb5ad719b29a0402cf1947d8f0eac1 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2001, 2002, 2003  Free Software Foundation, Inc.
 #
 # This file is part of GNU Automake.
 #
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-# Test to make sure LIBOBJS actually set in configure.in if seen.
+# Make sure we complain if @LIBOBJS@ is used without being set in configure.in
 
 . ./defs || exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 AC_PROG_RANLIB
 END
@@ -32,6 +34,7 @@ libtu_a_SOURCES =
 libtu_a_LIBADD = @LIBOBJS@
 END
 
-$ACLOCAL || exit 1
-$AUTOMAKE && exit 1
-exit 0
+$ACLOCAL
+$AUTOMAKE 2>stderr && exit 1
+cat stderr
+grep 'Makefile.am:3:.*LIBOBJS' stderr