use Automake::XFile;
use IO::File;
use File::Basename;
+use Carp;
## ----------- ##
## Constants. ##
{
if (&variable_defined ($var) && !$var_is_am{$var})
{
- &am_line_error ($var, "`$var' should not be defined");
+ am_macro_error ($var, "`$var' should not be defined");
}
}
&& $ralpha gt $talpha)
|| ($rfork ne '' && $rfork ne $tfork))
{
- &am_line_error ('AUTOMAKE_OPTIONS',
- "require version $_, but have $VERSION");
+ am_macro_error ('AUTOMAKE_OPTIONS',
+ "require version $_, but have $VERSION");
return 1;
}
}
else
{
- &am_line_error ('AUTOMAKE_OPTIONS',
+ am_macro_error ('AUTOMAKE_OPTIONS',
"option `" . $_ . "\' not recognized");
}
}
{
if (defined $libsources{$file})
{
- &am_line_error ($prefix . $one_file . '_SOURCES',
+ am_macro_error ($prefix . $one_file . '_SOURCES',
"automatically discovered file `$file' should not be explicitly mentioned");
}
}
# Configure substitutions in _SOURCES variables are errors.
if (/^\@.*\@$/)
{
- &am_line_error ($var, "`$var' includes configure substitution `$_', and is referred to from `$topparent': configure substitutions not allowed in _SOURCES variables");
+ am_macro_error ($var, "`$var' includes configure substitution `$_', and is referred to from `$topparent': configure substitutions not allowed in _SOURCES variables");
next;
}
if (defined $vars_scanned{$var})
{
- &am_line_error ($var, "variable `$var' recursively defined");
+ am_macro_error ($var, "variable `$var' recursively defined");
return "";
}
$vars_scanned{$var} = 1;
if (&variable_defined ($one_file . "_OBJECTS"))
{
- &am_line_error ($one_file . '_OBJECTS',
+ am_macro_error ($one_file . '_OBJECTS',
$one_file . '_OBJECTS', 'should not be defined');
# No point in continuing.
return;
{
# Skip -dlopen and -dlpreopen; these are explicitly allowed.
next if $lsearch =~ /^-dl(pre)?open$/;
- &am_line_error ($var, "linker flags such as `$lsearch' belong in `${1}LDFLAGS");
+ am_macro_error ($var, "linker flags such as `$lsearch' belong in `${1}LDFLAGS");
}
else
{
# Only get this error once.
$flagvar = 1;
- &am_line_error ($var, "linker flags such as `$lsearch' belong in `${1}LDFLAGS");
+ am_macro_error ($var, "linker flags such as `$lsearch' belong in `${1}LDFLAGS");
}
}
if (! keys %libsources
&& ! &variable_defined ($lt . 'LIBOBJS'))
{
- &am_line_error ($var, "\@$lt" . "LIBOBJS\@ seen but never set in `$configure_ac'");
+ am_macro_error ($var, "\@$lt" . "LIBOBJS\@ seen but never set in `$configure_ac'");
}
foreach my $iter (keys %libsources)
my $myobjext = ($1 ? 'l' : '') . 'o';
push (@dep_list, $lsearch);
- &am_line_error ($var,
+ am_macro_error ($var,
"\@$lt" . "ALLOCA\@ seen but `AC_FUNC_ALLOCA' not in `$configure_ac'")
if ! defined $libsources{'alloca.c'};
$dep_files{'$(DEPDIR)/alloca.P' . $myobjext} = 1;
{
foreach my $xt (@suffixes)
{
- &am_line_error ("$name$xt",
+ am_macro_error ("$name$xt",
"invalid variable `$name$xt'; "
. "should be `$xname$xt'")
if &variable_defined ("$name$xt");
{
if (! $am_c_prototypes)
{
- &am_line_error ('AUTOMAKE_OPTIONS',
+ am_macro_error ('AUTOMAKE_OPTIONS',
"option `ansi2knr' in use but `AM_C_PROTOTYPES' not in `$configure_ac'");
&keyed_aclocal_warning ('AM_C_PROTOTYPES');
# Only give this error once.
if (&variable_defined ($xname . '_LIBADD'))
{
- &am_line_error ($xname . '_LIBADD',
+ am_macro_error ($xname . '_LIBADD',
"use `" . $xname . "_LDADD', not `"
. $xname . "_LIBADD'");
}
{
if (&variable_defined ($key . '_LIBRARIES'))
{
- &am_line_error ($key . '_LIBRARIES', "library used but `RANLIB' not defined in `$configure_ac'");
+ am_macro_error ($key . '_LIBRARIES', "library used but `RANLIB' not defined in `$configure_ac'");
# Only get this error once. If this is ever printed,
# we have a bug.
$configure_vars{'RANLIB'} = 'BUG';
if (&variable_defined ($xlib . '_LDADD'))
{
- &am_line_error ($xlib . '_LDADD',
+ am_macro_error ($xlib . '_LDADD',
"use `" . $xlib . "_LIBADD', not `"
. $xlib . "_LDADD'");
}
{
if (!$seen_libtool)
{
- &am_line_error ($key . '_LTLIBRARIES', "library used but `LIBTOOL' not defined in `$configure_ac'");
+ am_macro_error ($key . '_LTLIBRARIES', "library used but `LIBTOOL' not defined in `$configure_ac'");
# Only get this error once. If this is ever printed,
# we have a bug.
$configure_vars{'LIBTOOL'} = 'BUG';
if (&variable_defined ($xlib . '_LDADD'))
{
- &am_line_error ($xlib . '_LDADD',
+ am_macro_error ($xlib . '_LDADD',
"use `" . $xlib . "_LIBADD', not `"
. $xlib . "_LDADD'");
}
{
if ($varname =~ /$primary$/ && ! $content_seen{$varname})
{
- &am_line_error ($varname,
+ am_macro_error ($varname,
"invalid unused variable name: `$varname'");
}
}
# Handle all Texinfo source; helper for handle_texinfo
sub handle_texinfo_helper
{
- &am_line_error ('TEXINFOS',
+ am_macro_error ('TEXINFOS',
"`TEXINFOS' is an anachronism; use `info_TEXINFOS'")
if &variable_defined ('TEXINFOS');
return (0, '') if (! &variable_defined ('info_TEXINFOS')
if (&variable_defined ('html_TEXINFOS'))
{
- &am_line_error ('html_TEXINFOS',
+ am_macro_error ('html_TEXINFOS',
"HTML generation not yet supported");
return (0, '');
}
# Handle any man pages.
sub handle_man_pages
{
- &am_line_error ('MANS', "`MANS' is an anachronism; use `man_MANS'")
+ am_macro_error ('MANS', "`MANS' is an anachronism; use `man_MANS'")
if &variable_defined ('MANS');
# Find all the sections in use. We do this by first looking for
}
elsif (&variable_defined ('TAGS_DEPENDENCIES'))
{
- &am_line_error ('TAGS_DEPENDENCIES',
+ am_macro_error ('TAGS_DEPENDENCIES',
"doesn't make sense to define `TAGS_DEPENDENCIES' without sources or `ETAGS_ARGS'");
}
else
if (! -d $am_relative_dir . '/' . $dir)
{
- &am_line_error ('SUBDIRS',
+ am_macro_error ('SUBDIRS',
"required directory $am_relative_dir/$dir does not exist");
next;
}
- &am_line_error ('SUBDIRS', "directory should not contain `/'")
+ am_macro_error ('SUBDIRS', "directory should not contain `/'")
if $dir =~ /\//;
}
&define_variable ('mkinstalldirs',
('$(SHELL) ' . $config_aux_dir . '/mkinstalldirs'));
- &am_line_error ('CONFIG_HEADER',
+ am_macro_error ('CONFIG_HEADER',
"`CONFIG_HEADER' is an anachronism; now determined from `$configure_ac'")
if &variable_defined ('CONFIG_HEADER');
}
my @subdirs = &variable_value_as_list_recursive ('SUBDIRS', 'all');
- &am_line_error ('SUBDIRS',
+ am_macro_error ('SUBDIRS',
"AM_GNU_GETTEXT used but `po' not in SUBDIRS")
if ! grep ('po', @subdirs);
- &am_line_error ('SUBDIRS',
+ am_macro_error ('SUBDIRS',
"AM_GNU_GETTEXT used but `intl' not in SUBDIRS")
if ! grep ('intl', @subdirs);
{
foreach my $c ('DEJATOOL', 'RUNTEST', 'RUNTESTFLAGS')
{
- &am_line_error ($c,
+ am_macro_error ($c,
"`$c' defined but `dejagnu' not in `AUTOMAKE_OPTIONS'")
if &variable_defined ($c);
}
if (defined $dir)
{
- &am_line_error ($curs . '_JAVA',
+ am_macro_error ($curs . '_JAVA',
"multiple _JAVA primaries in use");
}
$dir = $curs;
if ($strictness >= $GNU
&& defined $options{'no-installman'})
{
- &am_line_error ('AUTOMAKE_OPTIONS',
+ am_macro_error ('AUTOMAKE_OPTIONS',
"option `no-installman' disallowed by GNU standards");
}
if ($strictness >= $GNU
&& defined $options{'no-installinfo'})
{
- &am_line_error ('AUTOMAKE_OPTIONS',
+ am_macro_error ('AUTOMAKE_OPTIONS',
"option `no-installinfo' disallowed by GNU standards");
}
}
if (&variable_defined ('YACCFLAGS'))
{
- &am_line_error ('YACCFLAGS',
+ am_macro_error ('YACCFLAGS',
"`YACCFLAGS' obsolete; use `YFLAGS' instead");
}
}
if ($message)
{
- &am_line_error ($var, $message);
+ am_macro_error ($var, $message);
macro_dump ($var);
}
}
{
if (defined $var_type{$var} && $var_type{$var} ne $type)
{
- am_line_error ($var,
+ am_macro_error ($var,
("$var was set with `$var_type{$var}=' "
. "and is now set with `$type='"));
}
{
if (!defined $var_type{$var} && $type eq '+')
{
- am_line_error ($var, "$var must be set with `=' before using `+='");
+ am_macro_error ($var, "$var must be set with `=' before using `+='");
}
}
$var_type{$var} = $type;
{
if (defined $targets{$var})
{
- &am_line_error ($var, "`$var' is a target; expected a variable")
+ am_macro_error ($var, "`$var' is a target; expected a variable")
}
# The variable is not defined
return 0;
if (defined $vars_scanned{$var})
{
- &am_line_error ($parent, "variable `$var' recursively defined");
+ am_macro_error ($parent, "variable `$var' recursively defined");
return ();
}
$vars_scanned{$var} = 1;
if ($parent)
{
- &am_line_error ($parent,
+ am_macro_error ($parent,
"warning: automake does not support conditional definition of $var in $parent");
}
else
{
- &am_line_error ($parent,
+ am_macro_error ($parent,
"warning: automake does not support $var being defined conditionally");
}
}
{
if (defined $targets{$var})
{
- &am_line_error ($var, "`$var' is a target; expected a variable");
+ am_macro_error ($var, "`$var' is a target; expected a variable");
}
else
{
- &am_line_error ($parent, "variable `$var' not defined");
+ am_macro_error ($parent, "variable `$var' not defined");
}
}
{
if (defined $targets{$var})
{
- &am_line_error ($var, "`$var' is a target; expected a variable");
+ am_macro_error ($var, "`$var' is a target; expected a variable");
}
else
{
- &am_line_error ($parent, "variable `$var' not defined");
+ am_macro_error ($parent, "variable `$var' not defined");
}
}
elsif (defined $vars_scanned{$var})
{
# `vars_scanned' is a global we use to keep track of which
# variables we've already examined.
- &am_line_error ($parent, "variable `$var' recursively defined");
+ am_macro_error ($parent, "variable `$var' recursively defined");
}
elsif ($cond eq 'all')
{
# The no-exeext option enables this feature.
if (! defined $options{'no-exeext'})
{
- &am_line_error ($noexe,
+ am_macro_error ($noexe,
"deprecated feature: `$noexe' overrides `$noexe\$(EXEEXT)'\nchange your target to read `$noexe\$(EXEEXT)'");
}
# Don't define.
# allow `JAVA', as it is customarily used to mean the Java
# interpreter. This is but one of several Java hacks. Similarly,
# `PYTHON' is customarily used to mean the Python interpreter.
- &am_line_error ($primary, "`$primary' is an anachronism")
+ am_macro_error ($primary, "`$primary' is an anachronism")
if &variable_defined ($primary)
&& ($primary ne 'JAVA' && $primary ne 'PYTHON');
if (! $warned_about_extra)
{
$warned_about_extra = 1;
- &am_line_error ($one_name,
+ am_macro_error ($one_name,
"`$one_name' contains configure substitution, but shouldn't");
}
}
if ($require_extra && ! &variable_defined ('EXTRA_' . $primary))
{
- &am_line_error ($require_extra,
+ am_macro_error ($require_extra,
"`$require_extra' contains configure substitution, but `EXTRA_$primary' not defined");
}
am_print_error ("$file: ", @args);
}
+
+# &am_macro_error ($MACRO, @ARGS)
+# -------------------------------
+# Report an error, @ARGS, about $MACRO.
+sub am_macro_error ($@)
+{
+ my ($macro, @args) = @_;
+ am_file_error ($var_location{$macro}, @args);
+}
+
+
# &am_line_error ($SYMBOL or $LINE, @ARGS)
# ----------------------------------------
# Report an error about $SYMBOL. The error message is composed of the
# SYMBOL is a line number, then it must be a Makefile.am.
$where = "${am_file}.am:$symbol";
}
- elsif (defined $var_location{$symbol})
- {
- # SYMBOL is a macro defined in an Makefile.am or a *.am file.
- $where = $var_location{$symbol};
- }
elsif (defined $configure_vars{$symbol})
{
# SYMBOL is a variable defined in configure.ac, so add the
# appropriate line number.
$where = $configure_vars{$symbol};
}
+ elsif (defined $var_location{$symbol})
+ {
+ croak "use am_macro_error for macros: $symbol\n";
+ }
else
{
# Couldn't find the line number.