{
my ($var, $cond) = @_;
- if (exists $conditional{$var} && !$var_is_am{$var})
+ $cond ||= 'TRUE';
+
+ if (!$var_is_am{$var})
{
- if ($cond && $conditional{$var})
+ if (!exists $conditional{$var}{$cond})
{
- if (exists $conditional{$var}{$cond})
- {
- # Even a conditional examination is good enough for us.
- # FIXME: really should maintain examined status on a
- # per-condition basis.
- $content_seen{$var} = 1;
- return 1;
- }
-
- # The variable is not defined for the given condition.
- return 0;
+ # The variable is not defined for the given condition.
+ return 0;
}
- $content_seen{$var} = 1;
- return 1;
+ # Even a conditional examination is good enough for us. FIXME:
+ # really should maintain examined status on a per-condition
+ # basis.
+ $content_seen{$var} = 1;
+ return 1;
}
&am_line_error ($var, "`$var' is a target; expected a variable")
push (@parent_conds, $vcond);
my @subvar_conds = ();
- foreach (split (' ', ${$conditional{$var}}{$vcond}))
+ foreach (split (' ', $conditional{$var}{$vcond}))
{
# If a comment seen, just leave.
last if /^#/;
$vars_scanned{$var} = 1;
foreach my $vcond (keys %{$conditional{$var}})
{
- my $val = ${$conditional{$var}}{$vcond};
+ my $val = $conditional{$var}{$vcond};
push (@result, &value_to_list ($var, $val, $cond));
}
}
my $onceflag;
foreach my $vcond (keys %{$conditional{$var}})
{
- my $val = ${$conditional{$var}}{$vcond};
+ my $val = $conditional{$var}{$vcond};
if (&conditional_true_when ($vcond, $cond))
{
# Warn if we have an ambiguity. It's hard to know how
}
-# define_variable ($VAR, $VALUE)
-# ------------------------------
-# Define a new user variable VAR to VALUE, but only if not already defined.
-sub define_variable
-{
- my ($var, $value) = @_;
- if (! defined $conditional{$var}{'TRUE'})
- {
- $output_vars .= $var . ' = ' . $value . "\n";
- macro_define ($var, 0, '', '', $value, undef);
- $content_seen{$var} = 1;
- }
- elsif ($var_was_plus_eq{$var})
- {
- &am_line_error ($var,
- "internally generated variable `$var' was set with `+='");
- }
-}
-
# Like define_variable, but the value is a list, and the variable may
# be defined conditionally. The second argument is the conditional
# under which the value should be defined; this should be the empty
{
my ($var, $cond, @value) = @_;
- if (! defined $conditional{$var}{'TRUE'}
- || ($cond && ! &variable_defined ($var, $cond)))
+ if (! &variable_defined ($var, $cond))
{
macro_define ($var, 0, '', $cond, join (' ', @value), undef);
my $make_condition = &make_condition ($cond);
$make_condition, @value);
$content_seen{$var} = 1;
}
+ elsif ($var_was_plus_eq{$var})
+ {
+ &am_line_error ($var,
+ "internally generated variable `$var' was set with `+='");
+ }
}
+
+# define_variable ($VAR, $VALUE)
+# ------------------------------
+# Define a new user variable VAR to VALUE, but only if not already defined.
+sub define_variable
+{
+ my ($var, $value) = @_;
+
+ define_pretty_variable ($var, 'TRUE', $value);
+}
+
+
# Like define_variable, but define a variable to be the configure
# substitution by the same name.
sub define_configure_variable
{
&check_ambiguous_conditional ($target, $cond);
}
- ${$target_conditional{$target}}{$cond} = $where;
+ $target_conditional{$target}{$cond} = $where;
}
my ($amfile) = @_;
# This supports the strange variable tricks we are about to play.
- &prog_error ("variable defined before read_main_am_file")
- if scalar keys %conditional > 0;
+ if (scalar keys %conditional > 0)
+ {
+ variables_dump ();
+ &prog_error ("variable defined before read_main_am_file");
+ }
# We want to predefine as many variables as possible. This lets
# the user set them with `+=' in Makefile.am. However, we don't