summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2013-02-16 19:39:07 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2013-02-16 19:39:07 +0100
commit5e074aa5e14c7debc33f01ff9f40283278d06128 (patch)
treedf05c46ed9f64c7754d97d307413e84cd16dde5f
parent73e9f71c130dd620350553752d63edb761336e0e (diff)
parent9829cf24dad4310de0dbfbc3732f6c439b8e6931 (diff)
downloadautomake-5e074aa5e14c7debc33f01ff9f40283278d06128.tar.gz
Merge branch 'maint'
* maint: style: call perl functions 'like_this()', not '&like_this()' maint: use more perl subroutines prototypes in the automake script build: auto-generate perl subroutines prototypes for automake and aclocal refactor: rip module Automake::Language out of automake script Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
-rw-r--r--HACKING5
-rw-r--r--Makefile.am14
-rw-r--r--aclocal.in22
-rw-r--r--automake.in750
-rwxr-xr-xbootstrap.sh11
-rw-r--r--lib/Automake/Language.pm122
-rwxr-xr-xlib/gen-perl-protos36
-rw-r--r--maintainer/syntax-checks.mk19
8 files changed, 521 insertions, 458 deletions
diff --git a/HACKING b/HACKING
index 8f51ff425..a4f89bd66 100644
--- a/HACKING
+++ b/HACKING
@@ -96,11 +96,8 @@
default), and other portions using the GNU style (cperl-mode's
default). Write new code using GNU style.
-* Don't use & for function calls, unless required.
+* Don't use & for function calls, unless really required.
The use of & prevents prototypes from being checked.
- Just as above, don't change massively all the code to strip the
- &, just convert the old code as you work on it, and write new
- code without.
============================================================================
= Working with git
diff --git a/Makefile.am b/Makefile.am
index 8990648d2..e4817265b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -96,13 +96,18 @@ uninstall-hook:
# $(datadir) or other do_subst'ituted variables change.
automake: automake.in
aclocal: aclocal.in
-automake aclocal: Makefile
- $(AM_V_at)rm -f $@ $@-t
- $(AM_V_GEN)in=$@.in; $(do_subst) <$(srcdir)/$@.in >$@-t
+automake aclocal: Makefile lib/gen-perl-protos
+ $(AM_V_GEN)rm -f $@ $@-t $@-t2 \
+## Common substitutions.
+ && in=$@.in && $(do_subst) <$(srcdir)/$$in >$@-t \
+## Auto-compute prototypes of perl subroutines.
+ && $(PERL) -w $(srcdir)/lib/gen-perl-protos $@-t > $@-t2 \
+ && mv -f $@-t2 $@-t \
## We can't use '$(generated_file_finalize)' here, because currently
## Automake contains occurrences of unexpanded @substitutions@ in
## comments, and that is perfectly legit.
- $(AM_V_at)chmod a+x,a-w $@-t && mv -f $@-t $@
+ && chmod a+x,a-w $@-t && mv -f $@-t $@
+EXTRA_DIST += lib/gen-perl-protos
# The master location for INSTALL is lib/INSTALL.
# This is where "make fetch" will install new versions.
@@ -187,6 +192,7 @@ dist_perllib_DATA = \
lib/Automake/Getopt.pm \
lib/Automake/Item.pm \
lib/Automake/ItemDef.pm \
+ lib/Automake/Language.pm \
lib/Automake/Location.pm \
lib/Automake/Options.pm \
lib/Automake/Rule.pm \
diff --git a/aclocal.in b/aclocal.in
index 42eb2e140..98f606f59 100644
--- a/aclocal.in
+++ b/aclocal.in
@@ -169,27 +169,7 @@ my $erase_me;
# Prototypes for all subroutines.
-sub unlink_tmp (;$);
-sub xmkdir_p ($);
-sub check_acinclude ();
-sub reset_maps ();
-sub install_file ($$);
-sub list_compare (\@\@);
-sub scan_m4_dirs ($$@);
-sub scan_m4_files ();
-sub add_macro ($);
-sub scan_configure_dep ($);
-sub add_file ($);
-sub scan_file ($$$);
-sub strip_redundant_includes (%);
-sub trace_used_macros ();
-sub scan_configure ();
-sub write_aclocal ($@);
-sub usage ($);
-sub version ();
-sub handle_acdir_option ($$);
-sub parse_arguments ();
-sub parse_ACLOCAL_PATH ();
+#! Prototypes here will automatically be generated by the build system.
################################################################
diff --git a/automake.in b/automake.in
index 70214e45e..02c6d4138 100644
--- a/automake.in
+++ b/automake.in
@@ -25,7 +25,9 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac'
# Perl reimplementation by Tom Tromey <tromey@redhat.com>, and
# Alexandre Duret-Lutz <adl@gnu.org>.
-package Language;
+package Automake;
+
+use strict;
BEGIN
{
@@ -34,93 +36,6 @@ BEGIN
unshift @INC, @Automake::perl_libdirs;
}
-use Class::Struct ();
-Class::Struct::struct (
- # Short name of the language (c, f77...).
- 'name' => "\$",
- # Nice name of the language (C, Fortran 77...).
- 'Name' => "\$",
-
- # List of configure variables which must be defined.
- 'config_vars' => '@',
-
- # 'pure' is '1' or ''. A 'pure' language is one where, if
- # all the files in a directory are of that language, then we
- # do not require the C compiler or any code to call it.
- 'pure' => "\$",
-
- 'autodep' => "\$",
-
- # Name of the compiling variable (COMPILE).
- 'compiler' => "\$",
- # Content of the compiling variable.
- 'compile' => "\$",
- # Flag to require compilation without linking (-c).
- 'compile_flag' => "\$",
- 'extensions' => '@',
- # A subroutine to compute a list of possible extensions of
- # the product given the input extensions.
- # (defaults to a subroutine which returns ('.$(OBJEXT)', '.lo'))
- 'output_extensions' => "\$",
- # A list of flag variables used in 'compile'.
- # (defaults to [])
- 'flags' => "@",
-
- # Any tag to pass to libtool while compiling.
- 'libtool_tag' => "\$",
-
- # The file to use when generating rules for this language.
- # The default is 'depend2'.
- 'rule_file' => "\$",
-
- # Name of the linking variable (LINK).
- 'linker' => "\$",
- # Content of the linking variable.
- 'link' => "\$",
-
- # Name of the compiler variable (CC).
- 'ccer' => "\$",
-
- # Name of the linker variable (LD).
- 'lder' => "\$",
- # Content of the linker variable ($(CC)).
- 'ld' => "\$",
-
- # Flag to specify the output file (-o).
- 'output_flag' => "\$",
- '_finish' => "\$",
-
- # This is a subroutine which is called whenever we finally
- # determine the context in which a source file will be
- # compiled.
- '_target_hook' => "\$",
-
- # If TRUE, nodist_ sources will be compiled using specific rules
- # (i.e. not inference rules). The default is FALSE.
- 'nodist_specific' => "\$");
-
-
-sub finish ($)
-{
- my ($self) = @_;
- if (defined $self->_finish)
- {
- &{$self->_finish} (@_);
- }
-}
-
-sub target_hook ($$$$%)
-{
- my ($self) = @_;
- if (defined $self->_target_hook)
- {
- &{$self->_target_hook} (@_);
- }
-}
-
-package Automake;
-
-use strict;
use Automake::Config;
BEGIN
{
@@ -146,10 +61,18 @@ use Automake::VarDef;
use Automake::Rule;
use Automake::RuleDef;
use Automake::Wrap 'makefile_wrap';
+use Automake::Language;
use File::Basename;
use File::Spec;
use Carp;
+## ----------------------- ##
+## Subroutine prototypes. ##
+## ----------------------- ##
+
+#! Prototypes here will automatically be generated by the build system.
+
+
## ----------- ##
## Constants. ##
## ----------- ##
@@ -332,7 +255,7 @@ my %ac_config_files_location = ();
my %ac_config_files_condition = ();
# Directory to search for configure-required files. This
-# will be computed by &locate_aux_dir and can be set using
+# will be computed by locate_aux_dir() and can be set using
# AC_CONFIG_AUX_DIR in configure.ac.
# $CONFIG_AUX_DIR is the 'raw' directory, valid only in the source-tree.
my $config_aux_dir = '';
@@ -606,16 +529,9 @@ Automake::Variable::hook ('SUFFIXES', \&var_SUFFIXES_trigger);
################################################################
-## --------------------------------- ##
-## Forward subroutine declarations. ##
-## --------------------------------- ##
-sub register_language (%);
-sub file_contents_internal ($$$%);
-sub define_files_variable ($\@$$);
-
-# &initialize_per_input ()
-# ------------------------
+# initialize_per_input ()
+# -----------------------
# (Re)-Initialize per-Makefile.am variables.
sub initialize_per_input ()
{
@@ -1023,7 +939,7 @@ register_language ('name' => 'java',
# Uncategorized errors about the current Makefile.am.
sub err_am ($;%)
{
- msg_am ('error', @_);
+ msg_am ('error', shift, @_);
}
# err_ac ($MESSAGE, [%OPTIONS])
@@ -1031,7 +947,7 @@ sub err_am ($;%)
# Uncategorized errors about configure.ac.
sub err_ac ($;%)
{
- msg_ac ('error', @_);
+ msg_ac ('error', shift, @_);
}
# msg_am ($CHANNEL, $MESSAGE, [%OPTIONS])
@@ -1070,8 +986,8 @@ sub subst ($)
# $BACKPATH
-# &backname ($RELDIR)
-# --------------------
+# backname ($RELDIR)
+# -------------------
# If I "cd $RELDIR", then to come back, I should "cd $BACKPATH".
# For instance 'src/foo' => '../..'.
# Works with non strictly increasing paths, i.e., 'src/../lib' => '..'.
@@ -1221,7 +1137,7 @@ sub handle_silent ()
# Handle AUTOMAKE_OPTIONS variable. Return 1 on error, 0 otherwise.
-sub handle_options
+sub handle_options ()
{
my $var = var ('AUTOMAKE_OPTIONS');
if ($var)
@@ -1294,7 +1210,7 @@ sub check_user_variables (@)
}
# Call finish function for each language that was used.
-sub handle_languages
+sub handle_languages ()
{
if (! option 'no-dependencies')
{
@@ -1303,10 +1219,10 @@ sub handle_languages
if (keys %extension_seen && keys %dep_files)
{
# Set location of depcomp.
- &define_variable ('depcomp',
- "\$(SHELL) $am_config_aux_dir/depcomp",
- INTERNAL);
- &define_variable ('am__depfiles_maybe', 'depfiles', INTERNAL);
+ define_variable ('depcomp',
+ "\$(SHELL) $am_config_aux_dir/depcomp",
+ INTERNAL);
+ define_variable ('am__depfiles_maybe', 'depfiles', INTERNAL);
require_conf_file ("$am_file.am", FOREIGN, 'depcomp');
@@ -1329,15 +1245,15 @@ sub handle_languages
# Compute the set of directories to remove in distclean-depend.
my @depdirs = uniq (map { dirname ($_) } @deplist);
- $output_rules .= &file_contents ('depend',
- new Automake::Location,
- DEPDIRS => "@depdirs");
+ $output_rules .= file_contents ('depend',
+ new Automake::Location,
+ DEPDIRS => "@depdirs");
}
}
else
{
- &define_variable ('depcomp', '', INTERNAL);
- &define_variable ('am__depfiles_maybe', '', INTERNAL);
+ define_variable ('depcomp', '', INTERNAL);
+ define_variable ('am__depfiles_maybe', '', INTERNAL);
}
my %done;
@@ -1372,7 +1288,7 @@ sub handle_languages
'FASTDEP' => $FASTDEP,
'-c' => $lang->compile_flag || '',
# These are not used, but they need to be defined
- # so &transform do not complain.
+ # so transform() do not complain.
SUBDIROBJ => 0,
'DERIVED-EXT' => 'BUG',
DIST_SOURCE => 1,
@@ -1395,7 +1311,7 @@ sub handle_languages
# Compute a possible derived extension.
# This is not used by depend2.am.
- my $der_ext = (&{$lang->output_extensions} ($ext))[0];
+ my $der_ext = ($lang->output_extensions->($ext))[0];
# When we output an inference rule like '.c.o:' we
# have two cases to consider: either subdir-objects
@@ -1565,7 +1481,7 @@ sub handle_languages
if ($needs_c)
{
- &define_compiler_variable ($languages{'c'})
+ define_compiler_variable ($languages{'c'})
unless defined $done{$languages{'c'}};
define_linker_variable ($languages{'c'});
}
@@ -1601,7 +1517,7 @@ sub append_exeext (&$)
# mentioned. This is a separate function (as opposed to being inlined
# in handle_source_transform) because it isn't always appropriate to
# do this check.
-sub check_libobjs_sources
+sub check_libobjs_sources ($$)
{
my ($one_file, $unxformed) = @_;
@@ -1700,13 +1616,13 @@ sub handle_single_transform ($$$$$%)
# language function.
my $aggregate = 'AM';
- $extension = &derive_suffix ($extension, $obj);
+ $extension = derive_suffix ($extension, $obj);
my $lang;
if ($extension_map{$extension} &&
($lang = $languages{$extension_map{$extension}}))
{
# Found the language, so see what it says.
- &saw_extension ($extension);
+ saw_extension ($extension);
# Do we have per-executable flags for this executable?
my $have_per_exec_flags = 0;
@@ -1946,7 +1862,7 @@ EOF
unshift (@files, $object);
# Distribute derived sources unless the source they are
# derived from is not.
- &push_dist_common ($object)
+ push_dist_common ($object)
unless ($topparent =~ /^(?:nobase_)?nodist_/);
next;
}
@@ -2001,7 +1917,7 @@ EOF
unless option 'no-dependencies';
}
- &pretty_print_rule ($object . ':', "\t", @dep_list)
+ pretty_print_rule ($object . ':', "\t", @dep_list)
if scalar @dep_list > 0;
}
@@ -2131,7 +2047,7 @@ sub handle_source_transform ($$$$%)
}
if ($needlinker)
{
- $linker ||= &resolve_linker (%linkers_used);
+ $linker ||= resolve_linker (%linkers_used);
}
my @keys = sort keys %used_pfx;
@@ -2171,7 +2087,7 @@ sub handle_source_transform ($$$$%)
$default_source = '$(srcdir)/' . $default_source;
}
- &define_variable ($one_file . "_SOURCES", $default_source, $where);
+ define_variable ($one_file . "_SOURCES", $default_source, $where);
push (@sources, $default_source);
push (@dist_sources, $default_source);
@@ -2181,7 +2097,7 @@ sub handle_source_transform ($$$$%)
$one_file . '_SOURCES',
$one_file, $obj,
$default_source, %transform);
- $linker ||= &resolve_linker (%linkers_used);
+ $linker ||= resolve_linker (%linkers_used);
define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @result);
}
else
@@ -2208,7 +2124,7 @@ sub handle_source_transform ($$$$%)
# transformed name of object being built, or empty string if no object
# name of _LDADD/_LIBADD-type variable to examine
# Returns 1 if LIBOBJS seen, 0 otherwise.
-sub handle_lib_objects
+sub handle_lib_objects ($$)
{
my ($xname, $varname) = @_;
@@ -2340,8 +2256,8 @@ sub handle_LIBOBJS ($$$)
{
if ($iter =~ /\.[cly]$/)
{
- &saw_extension ($&);
- &saw_extension ('.c');
+ saw_extension ($&);
+ saw_extension ('.c');
}
if ($iter =~ /\.h$/)
@@ -2374,11 +2290,11 @@ sub handle_ALLOCA ($$$)
$var->requires_variables ("\@${lt}ALLOCA\@ used", $lt . 'ALLOCA');
$dep_files{$dir . '$(DEPDIR)/alloca.P' . $myobjext} = 1;
require_libsource_with_macro ($cond, $var, FOREIGN, 'alloca.c');
- &saw_extension ('.c');
+ saw_extension ('.c');
}
# Canonicalize the input parameter
-sub canonicalize
+sub canonicalize ($)
{
my ($string) = @_;
$string =~ tr/A-Za-z0-9_\@/_/c;
@@ -2388,11 +2304,11 @@ sub canonicalize
# Canonicalize a name, and check to make sure the non-canonical name
# is never used. Returns canonical name. Arguments are name and a
# list of suffixes to check for.
-sub check_canonical_spelling
+sub check_canonical_spelling ($@)
{
my ($name, @suffixes) = @_;
- my $xname = &canonicalize ($name);
+ my $xname = canonicalize ($name);
if ($xname ne $name)
{
foreach my $xt (@suffixes)
@@ -2452,11 +2368,11 @@ sub handle_compile ()
}
my ($coms, $vars, $rules) =
- &file_contents_internal (1, "$libdir/am/compile.am",
- new Automake::Location,
- ('DEFAULT_INCLUDES' => $default_includes,
- 'MOSTLYRMS' => join ("\n", @mostly_rms),
- 'DISTRMS' => join ("\n", @dist_rms)));
+ file_contents_internal (1, "$libdir/am/compile.am",
+ new Automake::Location,
+ 'DEFAULT_INCLUDES' => $default_includes,
+ 'MOSTLYRMS' => join ("\n", @mostly_rms),
+ 'DISTRMS' => join ("\n", @dist_rms));
$output_vars .= $vars;
$output_rules .= "$coms$rules";
}
@@ -2464,7 +2380,7 @@ sub handle_compile ()
# handle_libtool ()
# -----------------
# Handle libtool rules.
-sub handle_libtool
+sub handle_libtool ()
{
return unless var ('LIBTOOL');
@@ -2485,24 +2401,24 @@ sub handle_libtool
check_user_variables 'LIBTOOLFLAGS';
# Output the libtool compilation rules.
- $output_rules .= &file_contents ('libtool',
- new Automake::Location,
+ $output_rules .= file_contents ('libtool',
+ new Automake::Location,
LTRMS => join ("\n", @libtool_rms));
}
# handle_programs ()
# ------------------
# Handle C programs.
-sub handle_programs
+sub handle_programs ()
{
- my @proglist = &am_install_var ('progs', 'PROGRAMS',
- 'bin', 'sbin', 'libexec', 'pkglibexec',
- 'noinst', 'check');
+ my @proglist = am_install_var ('progs', 'PROGRAMS',
+ 'bin', 'sbin', 'libexec', 'pkglibexec',
+ 'noinst', 'check');
return if ! @proglist;
$must_handle_compiled_objects = 1;
my $seen_global_libobjs =
- var ('LDADD') && &handle_lib_objects ('', 'LDADD');
+ var ('LDADD') && handle_lib_objects ('', 'LDADD');
foreach my $pair (@proglist)
{
@@ -2514,30 +2430,30 @@ sub handle_programs
$known_programs{$one_file} = $where;
# Canonicalize names and check for misspellings.
- my $xname = &check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS',
- '_SOURCES', '_OBJECTS',
- '_DEPENDENCIES');
+ my $xname = check_canonical_spelling ($one_file, '_LDADD', '_LDFLAGS',
+ '_SOURCES', '_OBJECTS',
+ '_DEPENDENCIES');
$where->push_context ("while processing program '$one_file'");
$where->set (INTERNAL->get);
- my $linker = &handle_source_transform ($xname, $one_file, $obj, $where,
- NONLIBTOOL => 1, LIBTOOL => 0);
+ my $linker = handle_source_transform ($xname, $one_file, $obj, $where,
+ NONLIBTOOL => 1, LIBTOOL => 0);
if (var ($xname . "_LDADD"))
{
- $seen_libobjs = &handle_lib_objects ($xname, $xname . '_LDADD');
+ $seen_libobjs = handle_lib_objects ($xname, $xname . '_LDADD');
}
else
{
# User didn't define prog_LDADD override. So do it.
- &define_variable ($xname . '_LDADD', '$(LDADD)', $where);
+ define_variable ($xname . '_LDADD', '$(LDADD)', $where);
# This does a bit too much work. But we need it to
# generate _DEPENDENCIES when appropriate.
if (var ('LDADD'))
{
- $seen_libobjs = &handle_lib_objects ($xname, 'LDADD');
+ $seen_libobjs = handle_lib_objects ($xname, 'LDADD');
}
}
@@ -2549,7 +2465,7 @@ sub handle_programs
set_seen ($xname . '_LDFLAGS');
# Determine program to use for link.
- my($xlink, $vlink) = &define_per_target_linker_variable ($linker, $xname);
+ my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xname);
$vlink = verbose_flag ($vlink || 'GEN');
# If the resulting program lies in a subdirectory,
@@ -2558,24 +2474,24 @@ sub handle_programs
$libtool_clean_directories{dirname ($one_file)} = 1;
- $output_rules .= &file_contents ('program',
- $where,
- PROGRAM => $one_file,
- XPROGRAM => $xname,
- XLINK => $xlink,
- VERBOSE => $vlink,
- DIRSTAMP => $dirstamp,
- EXEEXT => '$(EXEEXT)');
+ $output_rules .= file_contents ('program',
+ $where,
+ PROGRAM => $one_file,
+ XPROGRAM => $xname,
+ XLINK => $xlink,
+ VERBOSE => $vlink,
+ DIRSTAMP => $dirstamp,
+ EXEEXT => '$(EXEEXT)');
if ($seen_libobjs || $seen_global_libobjs)
{
if (var ($xname . '_LDADD'))
{
- &check_libobjs_sources ($xname, $xname . '_LDADD');
+ check_libobjs_sources ($xname, $xname . '_LDADD');
}
elsif (var ('LDADD'))
{
- &check_libobjs_sources ($xname, 'LDADD');
+ check_libobjs_sources ($xname, 'LDADD');
}
}
}
@@ -2585,10 +2501,10 @@ sub handle_programs
# handle_libraries ()
# -------------------
# Handle libraries.
-sub handle_libraries
+sub handle_libraries ()
{
- my @liblist = &am_install_var ('libs', 'LIBRARIES',
- 'lib', 'pkglib', 'noinst', 'check');
+ my @liblist = am_install_var ('libs', 'LIBRARIES',
+ 'lib', 'pkglib', 'noinst', 'check');
return if ! @liblist;
$must_handle_compiled_objects = 1;
@@ -2601,9 +2517,9 @@ sub handle_libraries
$var->requires_variables ('library used', 'RANLIB');
}
- &define_variable ('AR', 'ar', INTERNAL);
- &define_variable ('ARFLAGS', 'cru', INTERNAL);
- &define_verbose_tagvar ('AR');
+ define_variable ('AR', 'ar', INTERNAL);
+ define_variable ('ARFLAGS', 'cru', INTERNAL);
+ define_verbose_tagvar ('AR');
foreach my $pair (@liblist)
{
@@ -2630,27 +2546,27 @@ sub handle_libraries
my $obj = '.$(OBJEXT)';
# Canonicalize names and check for misspellings.
- my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES',
- '_OBJECTS', '_DEPENDENCIES',
- '_AR');
+ my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES',
+ '_OBJECTS', '_DEPENDENCIES',
+ '_AR');
if (! var ($xlib . '_AR'))
{
- &define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where);
+ define_variable ($xlib . '_AR', '$(AR) $(ARFLAGS)', $where);
}
# Generate support for conditional object inclusion in
# libraries.
if (var ($xlib . '_LIBADD'))
{
- if (&handle_lib_objects ($xlib, $xlib . '_LIBADD'))
+ if (handle_lib_objects ($xlib, $xlib . '_LIBADD'))
{
$seen_libobjs = 1;
}
}
else
{
- &define_variable ($xlib . "_LIBADD", '', $where);
+ define_variable ($xlib . "_LIBADD", '', $where);
}
reject_var ($xlib . '_LDADD',
@@ -2660,8 +2576,8 @@ sub handle_libraries
set_seen ($xlib . '_DEPENDENCIES');
set_seen ('EXTRA_' . $xlib . '_DEPENDENCIES');
- &handle_source_transform ($xlib, $onelib, $obj, $where,
- NONLIBTOOL => 1, LIBTOOL => 0);
+ handle_source_transform ($xlib, $onelib, $obj, $where,
+ NONLIBTOOL => 1, LIBTOOL => 0);
# If the resulting library lies in a subdirectory,
# make sure this directory will exist.
@@ -2669,19 +2585,19 @@ sub handle_libraries
my $verbose = verbose_flag ('AR');
my $silent = silent_flag ();
- $output_rules .= &file_contents ('library',
- $where,
- VERBOSE => $verbose,
- SILENT => $silent,
- LIBRARY => $onelib,
- XLIBRARY => $xlib,
- DIRSTAMP => $dirstamp);
+ $output_rules .= file_contents ('library',
+ $where,
+ VERBOSE => $verbose,
+ SILENT => $silent,
+ LIBRARY => $onelib,
+ XLIBRARY => $xlib,
+ DIRSTAMP => $dirstamp);
if ($seen_libobjs)
{
if (var ($xlib . '_LIBADD'))
{
- &check_libobjs_sources ($xlib, $xlib . '_LIBADD');
+ check_libobjs_sources ($xlib, $xlib . '_LIBADD');
}
}
@@ -2698,10 +2614,10 @@ sub handle_libraries
# handle_ltlibraries ()
# ---------------------
# Handle shared libraries.
-sub handle_ltlibraries
+sub handle_ltlibraries ()
{
- my @liblist = &am_install_var ('ltlib', 'LTLIBRARIES',
- 'noinst', 'lib', 'pkglib', 'check');
+ my @liblist = am_install_var ('ltlib', 'LTLIBRARIES',
+ 'noinst', 'lib', 'pkglib', 'check');
return if ! @liblist;
$must_handle_compiled_objects = 1;
@@ -2803,9 +2719,9 @@ sub handle_ltlibraries
my $obj = '.lo';
# Canonicalize names and check for misspellings.
- my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS',
- '_SOURCES', '_OBJECTS',
- '_DEPENDENCIES');
+ my $xlib = check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS',
+ '_SOURCES', '_OBJECTS',
+ '_DEPENDENCIES');
# Check that the library fits the standard naming convention.
my $libname_rx = '^lib.*\.la';
@@ -2852,25 +2768,25 @@ sub handle_ltlibraries
# libraries.
if (var ($xlib . '_LIBADD'))
{
- if (&handle_lib_objects ($xlib, $xlib . '_LIBADD'))
+ if (handle_lib_objects ($xlib, $xlib . '_LIBADD'))
{
$seen_libobjs = 1;
}
}
else
{
- &define_variable ($xlib . "_LIBADD", '', $where);
+ define_variable ($xlib . "_LIBADD", '', $where);
}
reject_var ("${xlib}_LDADD",
"use '${xlib}_LIBADD', not '${xlib}_LDADD'");
- my $linker = &handle_source_transform ($xlib, $onelib, $obj, $where,
- NONLIBTOOL => 0, LIBTOOL => 1);
+ my $linker = handle_source_transform ($xlib, $onelib, $obj, $where,
+ NONLIBTOOL => 0, LIBTOOL => 1);
# Determine program to use for link.
- my($xlink, $vlink) = &define_per_target_linker_variable ($linker, $xlib);
+ my($xlink, $vlink) = define_per_target_linker_variable ($linker, $xlib);
$vlink = verbose_flag ($vlink || 'GEN');
my $rpathvar = "am_${xlib}_rpath";
@@ -2915,19 +2831,19 @@ sub handle_ltlibraries
my $dirname = dirname $onelib;
$libtool_clean_directories{$dirname} = 1;
- $output_rules .= &file_contents ('ltlibrary',
- $where,
- LTLIBRARY => $onelib,
- XLTLIBRARY => $xlib,
- RPATH => $rpath,
- XLINK => $xlink,
- VERBOSE => $vlink,
- DIRSTAMP => $dirstamp);
+ $output_rules .= file_contents ('ltlibrary',
+ $where,
+ LTLIBRARY => $onelib,
+ XLTLIBRARY => $xlib,
+ RPATH => $rpath,
+ XLINK => $xlink,
+ VERBOSE => $vlink,
+ DIRSTAMP => $dirstamp);
if ($seen_libobjs)
{
if (var ($xlib . '_LIBADD'))
{
- &check_libobjs_sources ($xlib, $xlib . '_LIBADD');
+ check_libobjs_sources ($xlib, $xlib . '_LIBADD');
}
}
@@ -2968,14 +2884,14 @@ sub check_typos ()
# Handle scripts.
-sub handle_scripts
+sub handle_scripts ()
{
# NOTE we no longer automatically clean SCRIPTS, because it is
# useful to sometimes distribute scripts verbatim. This happens
# e.g. in Automake itself.
- &am_install_var ('-candist', 'scripts', 'SCRIPTS',
- 'bin', 'sbin', 'libexec', 'pkglibexec', 'pkgdata',
- 'noinst', 'check');
+ am_install_var ('-candist', 'scripts', 'SCRIPTS',
+ 'bin', 'sbin', 'libexec', 'pkglibexec', 'pkgdata',
+ 'noinst', 'check');
}
@@ -2986,8 +2902,8 @@ sub handle_scripts
## ------------------------ ##
# ($OUTFILE, $VFILE)
-# &scan_texinfo_file ($FILENAME)
-# ------------------------------
+# scan_texinfo_file ($FILENAME)
+# -----------------------------
# $OUTFILE - name of the info file produced by $FILENAME.
# $VFILE - name of the version.texi file used (undef if none).
sub scan_texinfo_file ($)
@@ -3491,7 +3407,7 @@ sub handle_texinfo ()
# Handle any man pages.
-sub handle_man_pages
+sub handle_man_pages ()
{
reject_var 'MANS', "'MANS' is an anachronism; use 'man_MANS'";
@@ -3525,7 +3441,7 @@ sub handle_man_pages
$trans_sect_vars{$varname} = 1;
}
- &push_dist_common ($varname)
+ push_dist_common ($varname)
if $pfx eq 'dist_';
}
}
@@ -3560,7 +3476,7 @@ sub handle_man_pages
{
$trans_vars{$varname} = 1;
}
- &push_dist_common ($varname)
+ push_dist_common ($varname)
if $pfx eq 'dist_';
}
}
@@ -3604,18 +3520,18 @@ sub handle_man_pages
@unsorted_deps = (keys %notrans_vars, keys %trans_vars,
keys %notrans_this_sect, keys %trans_this_sect);
my @deps = sort @unsorted_deps;
- $output_rules .= &file_contents ('mans',
- new Automake::Location,
- SECTION => $section,
- DEPS => "@deps",
- NOTRANS_MANS => $notrans_mans,
- NOTRANS_SECT_LIST => "@notrans_sect_list",
- HAVE_NOTRANS => $have_notrans,
- NOTRANS_LIST => "@notrans_list",
- TRANS_MANS => $trans_mans,
- TRANS_SECT_LIST => "@trans_sect_list",
- HAVE_TRANS => $have_trans,
- TRANS_LIST => "@trans_list");
+ $output_rules .= file_contents ('mans',
+ new Automake::Location,
+ SECTION => $section,
+ DEPS => "@deps",
+ NOTRANS_MANS => $notrans_mans,
+ NOTRANS_SECT_LIST => "@notrans_sect_list",
+ HAVE_NOTRANS => $have_notrans,
+ NOTRANS_LIST => "@notrans_list",
+ TRANS_MANS => $trans_mans,
+ TRANS_SECT_LIST => "@trans_sect_list",
+ HAVE_TRANS => $have_trans,
+ TRANS_LIST => "@trans_list");
}
@unsorted_deps = (keys %notrans_vars, keys %trans_vars,
@@ -3630,16 +3546,16 @@ sub handle_man_pages
}
# Handle DATA variables.
-sub handle_data
+sub handle_data ()
{
- &am_install_var ('-noextra', '-candist', 'data', 'DATA',
- 'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf',
- 'ps', 'sysconf', 'sharedstate', 'localstate',
- 'pkgdata', 'lisp', 'noinst', 'check');
+ am_install_var ('-noextra', '-candist', 'data', 'DATA',
+ 'data', 'dataroot', 'doc', 'dvi', 'html', 'pdf',
+ 'ps', 'sysconf', 'sharedstate', 'localstate',
+ 'pkgdata', 'lisp', 'noinst', 'check');
}
# Handle TAGS.
-sub handle_tags
+sub handle_tags ()
{
my @config;
foreach my $spec (@config_headers)
@@ -3661,7 +3577,7 @@ sub handle_tags
if (rvar('am__tagged_files')->value_as_list_recursive
|| var ('ETAGS_ARGS') || var ('SUBDIRS'))
{
- $output_rules .= &file_contents ('tags', new Automake::Location);
+ $output_rules .= file_contents ('tags', new Automake::Location);
set_seen 'TAGS_DEPENDENCIES';
}
else
@@ -3770,7 +3686,7 @@ sub handle_dist ()
if ($relative_dir eq '.'
&& $config_aux_dir_set_in_configure_ac)
{
- if (! &is_make_dir ($config_aux_dir))
+ if (! is_make_dir ($config_aux_dir))
{
$check_aux = 1;
}
@@ -3781,14 +3697,14 @@ sub handle_dist ()
# The file might be absent, but if it can be built it's ok.
|| rule $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 && dir_has_case_matching_file ($config_aux_dir, $cfile))
{
- &push_dist_common ("$config_aux_dir/$cfile")
+ push_dist_common ("$config_aux_dir/$cfile")
}
}
@@ -3816,7 +3732,7 @@ sub handle_dist ()
# Files to distributed. Don't use ->value_as_list_recursive
# as it recursively expands '$(dist_pkgdata_DATA)' etc.
my @dist_common = split (' ', rvar ('DIST_COMMON')->variable_value);
- @dist_common = uniq @dist_common;
+ @dist_common = uniq (@dist_common);
variable_delete 'DIST_COMMON';
define_pretty_variable ('DIST_COMMON', TRUE, INTERNAL, @dist_common);
@@ -3837,10 +3753,10 @@ sub handle_dist ()
my $flm = option ('filename-length-max');
my $filename_filter = $flm ? '.' x $flm->[1] : '';
- $output_rules .= &file_contents ('distdir',
- new Automake::Location,
- %transform,
- FILENAME_FILTER => $filename_filter);
+ $output_rules .= file_contents ('distdir',
+ new Automake::Location,
+ %transform,
+ FILENAME_FILTER => $filename_filter);
}
@@ -3900,8 +3816,8 @@ sub check_directories_in_var ($)
skip_ac_subst => 1);
}
-# &handle_subdirs ()
-# ------------------
+# handle_subdirs ()
+# -----------------
# Handle subdirectories.
sub handle_subdirs ()
{
@@ -3915,14 +3831,14 @@ sub handle_subdirs ()
check_directories_in_var $dsubdirs
if $dsubdirs;
- $output_rules .= &file_contents ('subdirs', new Automake::Location);
+ $output_rules .= file_contents ('subdirs', new Automake::Location);
rvar ('RECURSIVE_TARGETS')->rdef (TRUE)->{'pretty'} = VAR_SORTED; # Gross!
}
# ($REGEN, @DEPENDENCIES)
-# &scan_aclocal_m4
-# ----------------
+# scan_aclocal_m4
+# ---------------
# If aclocal.m4 creation is automated, return the list of its dependencies.
sub scan_aclocal_m4 ()
{
@@ -3933,7 +3849,7 @@ sub scan_aclocal_m4 ()
if (-f 'aclocal.m4')
{
- &define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL);
+ define_variable ("ACLOCAL_M4", '$(top_srcdir)/aclocal.m4', INTERNAL);
my $aclocal = new Automake::XFile "< aclocal.m4";
my $line = $aclocal->getline;
@@ -3965,13 +3881,13 @@ sub substitute_ac_subst_variables_worker($)
sub substitute_ac_subst_variables ($)
{
my ($text) = @_;
- $text =~ s/\${([^ \t=:+{}]+)}/&substitute_ac_subst_variables_worker ($1)/ge;
+ $text =~ s/\${([^ \t=:+{}]+)}/substitute_ac_subst_variables_worker ($1)/ge;
return $text;
}
# @DEPENDENCIES
-# &prepend_srcdir (@INPUTS)
-# -------------------------
+# prepend_srcdir (@INPUTS)
+# ------------------------
# Prepend $(srcdir) or $(top_srcdir) to all @INPUTS. The idea is that
# if an input file has a directory part the same as the current
# directory, then the directory part is simply replaced by $(srcdir).
@@ -4044,8 +3960,8 @@ sub rewrite_inputs_into_dependencies ($@)
-# &handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS)
-# ------------------------------------------------------------------
+# handle_configure ($MAKEFILE_AM, $MAKEFILE_IN, $MAKEFILE, @INPUTS)
+# -----------------------------------------------------------------
# Handle remaking and configure stuff.
# We need the name of the input file, to do proper remaking rules.
sub handle_configure ($$$@)
@@ -4090,7 +4006,7 @@ sub handle_configure ($$$@)
if ($relative_dir eq '.')
{
- &push_dist_common ('acconfig.h')
+ push_dist_common ('acconfig.h')
if -f 'acconfig.h';
}
@@ -4109,7 +4025,7 @@ sub handle_configure ($$$@)
# directory and the header's directory doesn't have a
# Makefile, then we also want to build the header.
if ($relative_dir eq $config_h_dir
- || ($relative_dir eq '.' && ! &is_make_dir ($config_h_dir)))
+ || ($relative_dir eq '.' && ! is_make_dir ($config_h_dir)))
{
my ($cn_sans_dir, $stamp_dir);
if ($relative_dir eq $config_h_dir)
@@ -4256,7 +4172,7 @@ sub handle_configure ($$$@)
my $fd = dirname ($file);
if ($fd ne $relative_dir)
{
- if ($relative_dir eq '.' && ! &is_make_dir ($fd))
+ if ($relative_dir eq '.' && ! is_make_dir ($fd))
{
$local = $file;
}
@@ -4311,7 +4227,7 @@ sub handle_configure ($$$@)
my $fd = dirname ($link);
if ($fd ne $relative_dir)
{
- if ($relative_dir eq '.' && ! &is_make_dir ($fd))
+ if ($relative_dir eq '.' && ! is_make_dir ($fd))
{
$local = $link;
}
@@ -4339,7 +4255,7 @@ sub handle_configure ($$$@)
# At the top-level ('.') we also distribute files whose
# directory does not have a Makefile.
if (($fd eq $relative_dir)
- || ($relative_dir eq '.' && ! &is_make_dir ($fd)))
+ || ($relative_dir eq '.' && ! is_make_dir ($fd)))
{
# The following will distribute $file as a side-effect when
# it is appropriate (i.e., when $file is not already an output).
@@ -4357,19 +4273,19 @@ sub handle_configure ($$$@)
}
# Handle C headers.
-sub handle_headers
+sub handle_headers ()
{
- my @r = &am_install_var ('-defaultdist', 'header', 'HEADERS', 'include',
- 'oldinclude', 'pkginclude',
- 'noinst', 'check');
+ my @r = am_install_var ('-defaultdist', 'header', 'HEADERS', 'include',
+ 'oldinclude', 'pkginclude',
+ 'noinst', 'check');
foreach (@r)
{
next unless $_->[1] =~ /\..*$/;
- &saw_extension ($&);
+ saw_extension ($&);
}
}
-sub handle_gettext
+sub handle_gettext ()
{
return if ! $seen_gettext || $relative_dir ne '.';
@@ -4426,7 +4342,7 @@ sub handle_gettext
}
# Handle footer elements.
-sub handle_footer
+sub handle_footer ()
{
reject_rule ('.SUFFIXES',
"use variable 'SUFFIXES', not target '.SUFFIXES'");
@@ -4464,7 +4380,7 @@ sub handle_footer
# Generate 'make install' rules.
sub handle_install ()
{
- $output_rules .= &file_contents
+ $output_rules .= file_contents
('install',
new Automake::Location,
maybe_BUILT_SOURCES => (set_seen ('BUILT_SOURCES')
@@ -4500,8 +4416,8 @@ sub handle_all ($)
push (@all, "all-local")
if user_phony_rule "all-local";
- &pretty_print_rule ("all-am:", "\t\t", @all);
- &depend ('.PHONY', 'all-am', 'all');
+ pretty_print_rule ("all-am:", "\t\t", @all);
+ depend ('.PHONY', 'all-am', 'all');
# Output 'all'.
@@ -4557,7 +4473,7 @@ sub handle_user_recursion ()
# associated 'foo-local' rule; we define it as an empty rule by
# default, so that the user can transparently extend it in his
# own Makefile.am.
- pretty_print_rule ("$target-local:");
+ pretty_print_rule ("$target-local:", '', '');
# $target-recursive might as well be undefined, so do not add
# it here; it's taken care of in subdirs.am anyway.
depend (".PHONY", "$target-am", "$target-local");
@@ -4565,8 +4481,8 @@ sub handle_user_recursion ()
}
-# &do_check_merge_target ()
-# -------------------------
+# do_check_merge_target ()
+# ------------------------
# Handle check merge target specially.
sub do_check_merge_target ()
{
@@ -4644,7 +4560,7 @@ sub handle_clean ($)
push @{$rms{$when}}, "\t-$rm\n";
}
- $output_rules .= &file_contents
+ $output_rules .= file_contents
('clean',
new Automake::Location,
MOSTLYCLEAN_RMS => join ('', sort @{$rms{&MOSTLY_CLEAN}}),
@@ -4656,10 +4572,9 @@ sub handle_clean ($)
}
-# &target_cmp ($A, $B)
-# --------------------
-# Subroutine for &handle_factored_dependencies to let '.PHONY' and
-# other '.TARGETS' be last.
+# Subroutine for handle_factored_dependencies() to let '.PHONY' and
+# other '.TARGETS' be last. This is meant to be used as a comparison
+# subroutine passed to the sort built-int.
sub target_cmp
{
return 0 if $a eq $b;
@@ -4675,10 +4590,10 @@ sub target_cmp
}
-# &handle_factored_dependencies ()
-# --------------------------------
+# handle_factored_dependencies ()
+# -------------------------------
# Handle everything related to gathered targets.
-sub handle_factored_dependencies
+sub handle_factored_dependencies ()
{
# Reject bad hooks.
foreach my $utarg ('uninstall-data-local', 'uninstall-data-hook',
@@ -4755,7 +4670,7 @@ sub handle_factored_dependencies
foreach my $cond (@undefined_conds)
{
my $condstr = $cond->subst_string;
- &pretty_print_rule ("$condstr$_:", "$condstr\t", @uniq_deps);
+ pretty_print_rule ("$condstr$_:", "$condstr\t", @uniq_deps);
$output_rules .= $actions{$_} if defined $actions{$_};
$output_rules .= "\n";
}
@@ -4763,15 +4678,15 @@ sub handle_factored_dependencies
}
-# &handle_tests_dejagnu ()
-# ------------------------
-sub handle_tests_dejagnu
+# handle_tests_dejagnu ()
+# -----------------------
+sub handle_tests_dejagnu ()
{
push (@check_tests, 'check-DEJAGNU');
$output_rules .= file_contents ('dejagnu', new Automake::Location);
}
-sub handle_per_suffix_test
+sub handle_per_suffix_test ($%)
{
my ($test_suffix, %transform) = @_;
my ($pfx, $generic, $am_exeext);
@@ -4835,11 +4750,11 @@ sub is_valid_test_extension ($)
}
# Handle TESTS variable and other checks.
-sub handle_tests
+sub handle_tests ()
{
if (option 'dejagnu')
{
- &handle_tests_dejagnu;
+ handle_tests_dejagnu;
}
else
{
@@ -4854,9 +4769,9 @@ sub handle_tests
{
push (@check_tests, 'check-TESTS');
my $check_deps = "@check";
- $output_rules .= &file_contents ('check', new Automake::Location,
- SERIAL_TESTS => !! option 'serial-tests',
- CHECK_DEPS => $check_deps);
+ $output_rules .= file_contents ('check', new Automake::Location,
+ SERIAL_TESTS => !! option 'serial-tests',
+ CHECK_DEPS => $check_deps);
# Tests that are known programs should have $(EXEEXT) appended.
# For matching purposes, we need to adjust XFAIL_TESTS as well.
@@ -4969,10 +4884,10 @@ sub handle_tests
}
# Handle Emacs Lisp.
-sub handle_emacs_lisp
+sub handle_emacs_lisp ()
{
- my @elfiles = &am_install_var ('-candist', 'lisp', 'LISP',
- 'lisp', 'noinst');
+ my @elfiles = am_install_var ('-candist', 'lisp', 'LISP',
+ 'lisp', 'noinst');
return if ! @elfiles;
@@ -4990,23 +4905,23 @@ sub handle_emacs_lisp
}
# Handle Python
-sub handle_python
+sub handle_python ()
{
- my @pyfiles = &am_install_var ('-defaultdist', 'python', 'PYTHON',
- 'noinst');
+ my @pyfiles = am_install_var ('-defaultdist', 'python', 'PYTHON',
+ 'noinst');
return if ! @pyfiles;
require_variables ($pyfiles[0][0], "Python sources seen", TRUE, 'PYTHON');
require_conf_file ($pyfiles[0][0], FOREIGN, 'py-compile');
- &define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL);
+ define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL);
}
# Handle Java.
-sub handle_java
+sub handle_java ()
{
- my @sourcelist = &am_install_var ('-candist',
- 'java', 'JAVA',
- 'noinst', 'check');
+ my @sourcelist = am_install_var ('-candist',
+ 'java', 'JAVA',
+ 'noinst', 'check');
return if ! @sourcelist;
my @prefixes = am_primary_prefixes ('JAVA', 1,
@@ -5047,7 +4962,7 @@ sub handle_java
# Handle some of the minor options.
-sub handle_minor_options
+sub handle_minor_options ()
{
if (option 'readme-alpha')
{
@@ -5072,8 +4987,8 @@ sub handle_minor_options
################################################################
# ($OUTPUT, @INPUTS)
-# &split_config_file_spec ($SPEC)
-# -------------------------------
+# split_config_file_spec ($SPEC)
+# ------------------------------
# Decode the Autoconf syntax for config files (files, headers, links
# etc.).
sub split_config_file_spec ($)
@@ -5110,8 +5025,8 @@ sub locate_am (@)
my %make_list;
-# &scan_autoconf_config_files ($WHERE, $CONFIG-FILES)
-# ---------------------------------------------------
+# scan_autoconf_config_files ($WHERE, $CONFIG-FILES)
+# --------------------------------------------------
# Study $CONFIG-FILES which is the first argument to AC_CONFIG_FILES
# (or AC_OUTPUT).
sub scan_autoconf_config_files ($$)
@@ -5152,8 +5067,8 @@ sub scan_autoconf_config_files ($$)
}
-# &scan_autoconf_traces ($FILENAME)
-# ---------------------------------
+# scan_autoconf_traces ($FILENAME)
+# --------------------------------
sub scan_autoconf_traces ($)
{
my ($filename) = @_;
@@ -5449,7 +5364,7 @@ EOF
}
-# &scan_autoconf_files ()
+# scan_autoconf_files ()
# -----------------------
# Scan it (and possibly 'aclocal.m4') for interesting things.
# We must scan aclocal.m4 because there might be AC_SUBSTs and such there.
@@ -5535,7 +5450,7 @@ sub scan_autoconf_files ()
################################################################
# Do any extra checking for GNU standards.
-sub check_gnu_standards
+sub check_gnu_standards ()
{
if ($relative_dir eq '.')
{
@@ -5567,7 +5482,7 @@ sub check_gnu_standards
}
# Do any extra checking for GNITS standards.
-sub check_gnits_standards
+sub check_gnits_standards ()
{
if ($relative_dir eq '.')
{
@@ -5593,7 +5508,7 @@ sub check_gnits_standards
# This is just a convenience function that can be used to determine
# when a subdir object should be used.
-sub lang_sub_obj
+sub lang_sub_obj ()
{
return option 'subdir-objects' ? LANG_SUBDIR : LANG_PROCESS;
}
@@ -5619,7 +5534,7 @@ sub lang_yacc_rewrite
{
my ($directory, $base, $ext) = @_;
- my $r = &lang_sub_obj;
+ my $r = lang_sub_obj;
(my $newext = $ext) =~ tr/y/c/;
return ($r, $newext);
}
@@ -5630,7 +5545,7 @@ sub lang_lex_rewrite
{
my ($directory, $base, $ext) = @_;
- my $r = &lang_sub_obj;
+ my $r = lang_sub_obj;
(my $newext = $ext) =~ tr/l/c/;
return ($r, $newext);
}
@@ -5742,7 +5657,7 @@ sub lang_vala_finish_target ($$)
# Add output rules to invoke valac and create stamp file as a witness
# to handle multiple outputs. This function is called after all source
# file processing is done.
-sub lang_vala_finish
+sub lang_vala_finish ()
{
my ($self) = @_;
@@ -5760,7 +5675,7 @@ sub lang_vala_finish
# The built .c files should be cleaned only on maintainer-clean
# as the .c files are distributed. This function is called for each
# .vala source file.
-sub lang_vala_target_hook
+sub lang_vala_target_hook ($$$$%)
{
my ($self, $aggregate, $output, $input, %transform) = @_;
@@ -5769,7 +5684,7 @@ sub lang_vala_target_hook
# This is a yacc helper which is called whenever we have decided to
# compile a yacc file.
-sub lang_yacc_target_hook
+sub lang_yacc_target_hook ($$$$%)
{
my ($self, $aggregate, $output, $input, %transform) = @_;
@@ -5828,9 +5743,9 @@ sub lang_yacc_target_hook
. "$condstr\t\@if test ! -f \$@; then \$(MAKE) \$(AM_MAKEFLAGS) $output; else :; fi\n";
}
# Distribute the generated file, unless its .y source was
- # listed in a nodist_ variable. (&handle_source_transform
+ # listed in a nodist_ variable. (handle_source_transform()
# will set DIST_SOURCE.)
- &push_dist_common ($header)
+ push_dist_common ($header)
if $transform{'DIST_SOURCE'};
# The GNU rules say that yacc/lex output files should be removed
@@ -5845,7 +5760,7 @@ sub lang_yacc_target_hook
# This is a lex helper which is called whenever we have decided to
# compile a lex file.
-sub lang_lex_target_hook
+sub lang_lex_target_hook ($$$$%)
{
my ($self, $aggregate, $output, $input, %transform) = @_;
# The GNU rules say that yacc/lex output files should be removed
@@ -5856,17 +5771,17 @@ sub lang_lex_target_hook
}
# This is a helper for both lex and yacc.
-sub yacc_lex_finish_helper
+sub yacc_lex_finish_helper ()
{
return if defined $language_scratch{'lex-yacc-done'};
$language_scratch{'lex-yacc-done'} = 1;
# FIXME: for now, no line number.
require_conf_file ($configure_ac, FOREIGN, 'ylwrap');
- &define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL);
+ define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL);
}
-sub lang_yacc_finish
+sub lang_yacc_finish ()
{
return if defined $language_scratch{'yacc-done'};
$language_scratch{'yacc-done'} = 1;
@@ -5877,7 +5792,7 @@ sub lang_yacc_finish
}
-sub lang_lex_finish
+sub lang_lex_finish ()
{
return if defined $language_scratch{'lex-done'};
$language_scratch{'lex-done'} = 1;
@@ -5890,7 +5805,7 @@ sub lang_lex_finish
# precedence. This is lame, but something has to have global
# knowledge in order to eliminate the conflict. Add more linkers as
# required.
-sub resolve_linker
+sub resolve_linker (%)
{
my (%linkers) = @_;
@@ -5902,7 +5817,7 @@ sub resolve_linker
}
# Called to indicate that an extension was used.
-sub saw_extension
+sub saw_extension ($)
{
my ($ext) = @_;
$extension_seen{$ext} = 1;
@@ -5928,7 +5843,7 @@ sub register_language (%)
$option{'nodist_specific'} = 0
unless defined $option{'nodist_specific'};
- my $lang = new Language (%option);
+ my $lang = new Automake::Language (%option);
# Fill indexes.
$extension_map{$_} = $lang->name foreach @{$lang->extensions};
@@ -5954,7 +5869,7 @@ sub register_language (%)
# Update the $suffix_rule map.
foreach my $suffix (@{$lang->extensions})
{
- foreach my $dest (&{$lang->output_extensions} ($suffix))
+ foreach my $dest ($lang->output_extensions->($suffix))
{
register_suffix_rule (INTERNAL, $suffix, $dest);
}
@@ -5984,9 +5899,9 @@ sub derive_suffix ($$)
################################################################
# Pretty-print something and append to output_rules.
-sub pretty_print_rule
+sub pretty_print_rule ($$@)
{
- $output_rules .= &makefile_wrap (@_);
+ $output_rules .= makefile_wrap (shift, shift, @_);
}
@@ -6124,8 +6039,8 @@ sub cond_stack_endif ($$$)
## ------------------------ ##
-# &define_pretty_variable ($VAR, $COND, $WHERE, @VALUE)
-# -----------------------------------------------------
+# define_pretty_variable ($VAR, $COND, $WHERE, @VALUE)
+# ----------------------------------------------------
# Like define_variable, but the value is a list, and the variable may
# be defined conditionally. The second argument is the condition
# under which the value should be defined; this should be the empty
@@ -6195,14 +6110,14 @@ sub define_compiler_variable ($)
my $libtool_tag = '';
$libtool_tag = '--tag=' . $lang->libtool_tag . ' '
if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
- &define_variable ($var, $value, INTERNAL);
+ define_variable ($var, $value, INTERNAL);
if (var ('LIBTOOL'))
{
my $verbose = define_verbose_libtool ();
- &define_variable ("LT$var",
- "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) "
- . "\$(LIBTOOLFLAGS) --mode=compile $value",
- INTERNAL);
+ define_variable ("LT$var",
+ "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS)"
+ . " \$(LIBTOOLFLAGS) --mode=compile $value",
+ INTERNAL);
}
define_verbose_tagvar ($lang->ccer || 'GEN');
}
@@ -6219,7 +6134,7 @@ sub define_linker_variable ($)
$libtool_tag = '--tag=' . $lang->libtool_tag . ' '
if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
# CCLD = $(CC).
- &define_variable ($lang->lder, $lang->ld, INTERNAL);
+ define_variable ($lang->lder, $lang->ld, INTERNAL);
# CCLINK = $(CCLD) blah blah...
my $link = '';
if (var ('LIBTOOL'))
@@ -6228,9 +6143,9 @@ sub define_linker_variable ($)
$link = "\$(LIBTOOL) $verbose $libtool_tag\$(AM_LIBTOOLFLAGS) "
. "\$(LIBTOOLFLAGS) --mode=link ";
}
- &define_variable ($lang->linker, $link . $lang->link, INTERNAL);
- &define_variable ($lang->compiler, $lang);
- &define_verbose_tagvar ($lang->lder || 'GEN');
+ define_variable ($lang->linker, $link . $lang->link, INTERNAL);
+ define_variable ($lang->compiler, $lang, INTERNAL);
+ define_verbose_tagvar ($lang->lder || 'GEN');
}
sub define_per_target_linker_variable ($$)
@@ -6277,14 +6192,14 @@ sub define_per_target_linker_variable ($$)
return ($lang->linker, $lang->lder)
if $link_command eq $orig_command;
- &define_variable ("${target}_LINK", $link_command, INTERNAL);
+ define_variable ("${target}_LINK", $link_command, INTERNAL);
return ("${target}_LINK", $lang->lder);
}
################################################################
-# &check_trailing_slash ($WHERE, $LINE)
-# -------------------------------------
+# check_trailing_slash ($WHERE, $LINE)
+# ------------------------------------
# Return 1 iff $LINE ends with a slash.
# Might modify $LINE.
sub check_trailing_slash ($\$)
@@ -6302,8 +6217,8 @@ sub check_trailing_slash ($\$)
}
-# &read_am_file ($AMFILE, $WHERE)
-# -------------------------------
+# read_am_file ($AMFILE, $WHERE)
+# ------------------------------
# Read Makefile.am and set up %contents. Simultaneously copy lines
# from Makefile.am into $output_trailer, or define variables as
# appropriate. NOTE we put rules in the trailer section. We want
@@ -6557,7 +6472,7 @@ sub read_am_file ($$)
$path = $relative_dir . "/" . $path if $relative_dir ne '.';
}
$where->push_context ("'$path' included from here");
- &read_am_file ($path, $where);
+ read_am_file ($path, $where);
$where->pop_context;
}
else
@@ -6594,7 +6509,7 @@ sub read_am_file ($$)
# ----------------------------
# A helper for read_main_am_file which initializes configure variables
# and variables from header-vars.am.
-sub define_standard_variables
+sub define_standard_variables ()
{
my $saved_output_vars = $output_vars;
my ($comments, undef, $rules) =
@@ -6603,7 +6518,7 @@ sub define_standard_variables
foreach my $var (sort keys %configure_vars)
{
- &define_configure_variable ($var);
+ define_configure_variable ($var);
}
$output_vars .= $comments . $rules;
@@ -6627,10 +6542,10 @@ sub read_main_am_file ($$)
# We want to predefine as many variables as possible. This lets
# the user set them with '+=' in Makefile.am.
- &define_standard_variables;
+ define_standard_variables;
# Read user file, which might override some of our values.
- &read_am_file ($amfile, new Automake::Location);
+ read_am_file ($amfile, new Automake::Location);
}
@@ -6638,10 +6553,10 @@ sub read_main_am_file ($$)
################################################################
# $FLATTENED
-# &flatten ($STRING)
-# ------------------
+# flatten ($STRING)
+# -----------------
# Flatten the $STRING and return the result.
-sub flatten
+sub flatten ($)
{
$_ = shift;
@@ -6771,8 +6686,8 @@ sub preprocess_file ($%)
# @PARAGRAPHS
-# &make_paragraphs ($MAKEFILE, [%TRANSFORM])
-# ------------------------------------------
+# make_paragraphs ($MAKEFILE, [%TRANSFORM])
+# -----------------------------------------
# Load a $MAKEFILE, apply the %TRANSFORM, and return it as a list of
# paragraphs.
sub make_paragraphs ($%)
@@ -6817,8 +6732,8 @@ sub make_paragraphs ($%)
# ($COMMENT, $VARIABLES, $RULES)
-# &file_contents_internal ($IS_AM, $FILE, $WHERE, [%TRANSFORM])
-# -------------------------------------------------------------
+# file_contents_internal ($IS_AM, $FILE, $WHERE, [%TRANSFORM])
+# ------------------------------------------------------------
# Return contents of a file from $libdir/am, automatically skipping
# macros or rules which are already known. $IS_AM iff the caller is
# reading an Automake file (as opposed to the user's Makefile.am).
@@ -6916,7 +6831,7 @@ sub file_contents_internal ($$$%)
my ($targets, $dependencies) = ($1, $2);
# Remove the escaped new lines.
# I don't know why, but I have to use a tmp $flat_deps.
- my $flat_deps = &flatten ($dependencies);
+ my $flat_deps = flatten ($dependencies);
my @deps = split (' ', $flat_deps);
foreach (split (' ', $targets))
@@ -6940,7 +6855,7 @@ sub file_contents_internal ($$$%)
# Output only if not in FALSE.
if (defined $dependencies{$_} && $cond != FALSE)
{
- &depend ($_, @deps);
+ depend ($_, @deps);
register_action ($_, $actions);
}
else
@@ -7010,8 +6925,8 @@ sub file_contents_internal ($$$%)
# $CONTENTS
-# &file_contents ($BASENAME, $WHERE, [%TRANSFORM])
-# ------------------------------------------------
+# file_contents ($BASENAME, $WHERE, [%TRANSFORM])
+# -----------------------------------------------
# Return contents of a file from $libdir/am, automatically skipping
# macros or rules which are already known.
sub file_contents ($$%)
@@ -7025,8 +6940,8 @@ sub file_contents ($$%)
# @PREFIX
-# &am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES)
-# -----------------------------------------------------
+# am_primary_prefixes ($PRIMARY, $CAN_DIST, @PREFIXES)
+# ----------------------------------------------------
# Find all variable prefixes that are used for install directories. A
# prefix 'zar' qualifies iff:
#
@@ -7115,7 +7030,7 @@ sub am_primary_prefixes ($$@)
# up into multiple functions.
#
# Usage is: am_install_var (OPTION..., file, HOW, where...)
-sub am_install_var
+sub am_install_var (@)
{
my (@args) = @_;
@@ -7219,11 +7134,12 @@ sub am_install_var
}
else
{
- # Strip any $(EXEEXT) suffix the user might have added, or this
- # will confuse &handle_source_transform and &check_canonical_spelling.
+ # Strip any $(EXEEXT) suffix the user might have added,
+ # or this will confuse handle_source_transform() and
+ # check_canonical_spelling().
# We'll add $(EXEEXT) back later anyway.
- # Do it here rather than in handle_programs so the uniquifying at the
- # end of this function works.
+ # Do it here rather than in handle_programs so the
+ # uniquifying at the end of this function works.
${$locvals}[1] =~ s/\$\(EXEEXT\)$//
if $primary eq 'PROGRAMS';
@@ -7267,18 +7183,17 @@ sub am_install_var
# Singular form of $PRIMARY.
(my $one_primary = $primary) =~ s/S$//;
- $output_rules .= &file_contents ($file, $where,
- PRIMARY => $primary,
- ONE_PRIMARY => $one_primary,
- DIR => $X,
- NDIR => $nodir_name,
- BASE => $strip_subdir,
-
- EXEC => $exec_p,
- INSTALL => $install_p,
- DIST => $dist_p,
- DISTVAR => $distvar,
- 'CK-OPTS' => $check_options_p);
+ $output_rules .= file_contents ($file, $where,
+ PRIMARY => $primary,
+ ONE_PRIMARY => $one_primary,
+ DIR => $X,
+ NDIR => $nodir_name,
+ BASE => $strip_subdir,
+ EXEC => $exec_p,
+ INSTALL => $install_p,
+ DIST => $dist_p,
+ DISTVAR => $distvar,
+ 'CK-OPTS' => $check_options_p);
}
# The JAVA variable is used as the name of the Java interpreter.
@@ -7321,7 +7236,7 @@ sub am_install_var
my %make_dirs = ();
my $make_dirs_set = 0;
-sub is_make_dir
+sub is_make_dir ($)
{
my ($dir) = @_;
if (! $make_dirs_set)
@@ -7372,10 +7287,10 @@ sub locate_aux_dir ()
}
-# &push_required_file ($DIR, $FILE, $FULLFILE)
-# --------------------------------------------------
+# push_required_file ($DIR, $FILE, $FULLFILE)
+# -------------------------------------------------
# Push the given file onto DIST_COMMON.
-sub push_required_file
+sub push_required_file ($$$)
{
my ($dir, $file, $fullfile) = @_;
@@ -7409,7 +7324,7 @@ sub push_required_file
$am_config_libobj_dir =~ s|/*$||;
push_dist_common ("$am_config_libobj_dir/$file");
}
- elsif ($relative_dir eq '.' && ! &is_make_dir ($dir))
+ elsif ($relative_dir eq '.' && ! is_make_dir ($dir))
{
# If we are doing the topmost directory, and the file is in a
# subdir which does not have a Makefile, then we distribute it
@@ -7459,8 +7374,8 @@ sub push_required_file
# than once.
my %required_file_not_found = ();
-# &required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE)
-# --------------------------------------------------------
+# required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE)
+# -------------------------------------------------------
# Verify that the file must exist in $DIRECTORY, or install it.
sub required_file_check_or_copy ($$$)
{
@@ -7568,8 +7483,8 @@ sub required_file_check_or_copy ($$$)
}
-# &require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES)
-# ----------------------------------------------------------------------
+# require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES)
+# ---------------------------------------------------------------------
# Verify that the file must exist in $DIRECTORY, or install it.
# $MYSTRICT is the strictness level at which this file becomes required.
# Worker threads may queue up the action to be serialized by the master,
@@ -7597,16 +7512,16 @@ sub require_file_internal ($$$@)
}
}
-# &require_file ($WHERE, $MYSTRICT, @FILES)
-# -----------------------------------------
+# require_file ($WHERE, $MYSTRICT, @FILES)
+# ----------------------------------------
sub require_file ($$@)
{
my ($where, $mystrict, @files) = @_;
require_file_internal ($where, $mystrict, $relative_dir, 0, @files);
}
-# &require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
-# -----------------------------------------------------------
+# require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
+# ----------------------------------------------------------
sub require_file_with_macro ($$$@)
{
my ($cond, $macro, $mystrict, @files) = @_;
@@ -7614,8 +7529,8 @@ sub require_file_with_macro ($$$@)
require_file ($macro->rdef ($cond)->location, $mystrict, @files);
}
-# &require_libsource_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
-# ----------------------------------------------------------------
+# require_libsource_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
+# ---------------------------------------------------------------
# Require an AC_LIBSOURCEd file. If AC_CONFIG_LIBOBJ_DIR was called, it
# must be in that directory. Otherwise expect it in the current directory.
sub require_libsource_with_macro ($$$@)
@@ -7633,9 +7548,9 @@ sub require_libsource_with_macro ($$$@)
}
}
-# &queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE,
+# queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE,
# $MYSTRICT, @FILES)
-# ---------------------------------------------------------------
+# --------------------------------------------------------------
sub queue_required_file_check_or_copy ($$$$@)
{
my ($queue, $key, $dir, $where, $mystrict, @files) = @_;
@@ -7651,8 +7566,8 @@ sub queue_required_file_check_or_copy ($$$$@)
$queue->enqueue ($key, $dir, @serial_loc, $mystrict, 0 + @files, @files);
}
-# &require_queued_file_check_or_copy ($QUEUE)
-# -------------------------------------------
+# require_queued_file_check_or_copy ($QUEUE)
+# ------------------------------------------
sub require_queued_file_check_or_copy ($)
{
my ($queue) = @_;
@@ -7684,8 +7599,8 @@ sub require_queued_file_check_or_copy ($)
}
}
-# &require_conf_file ($WHERE, $MYSTRICT, @FILES)
-# ----------------------------------------------
+# require_conf_file ($WHERE, $MYSTRICT, @FILES)
+# ---------------------------------------------
# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR.
sub require_conf_file ($$@)
{
@@ -7696,8 +7611,8 @@ sub require_conf_file ($$@)
}
-# &require_conf_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
-# ----------------------------------------------------------------
+# require_conf_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
+# ---------------------------------------------------------------
sub require_conf_file_with_macro ($$$@)
{
my ($cond, $macro, $mystrict, @files) = @_;
@@ -7707,8 +7622,8 @@ sub require_conf_file_with_macro ($$$@)
################################################################
-# &require_build_directory ($DIRECTORY)
-# -------------------------------------
+# require_build_directory ($DIRECTORY)
+# ------------------------------------
# Emit rules to create $DIRECTORY if needed, and return
# the file that any target requiring this directory should be made
# dependent upon.
@@ -7747,8 +7662,8 @@ sub require_build_directory ($)
return $dirstamp;
}
-# &require_build_directory_maybe ($FILE)
-# --------------------------------------
+# require_build_directory_maybe ($FILE)
+# -------------------------------------
# If $FILE lies in a subdirectory, emit a rule to create this
# directory and return the file that $FILE should be made
# dependent upon. Otherwise, just return the empty string.
@@ -7770,7 +7685,7 @@ sub require_build_directory_maybe ($)
################################################################
# Push a list of files onto dist_common.
-sub push_dist_common
+sub push_dist_common (@)
{
prog_error "push_dist_common run after handle_dist"
if $handle_dist_run;
@@ -7800,8 +7715,8 @@ sub generate_makefile ($$)
# $OUTPUT is encoded. If it contains a ":" then the first element
# is the real output file, and all remaining elements are input
# files. We don't scan or otherwise deal with these input files,
- # other than to mark them as dependencies. See
- # &scan_autoconf_files for details.
+ # other than to mark them as dependencies. See the subroutine
+ # 'scan_autoconf_files' for details.
my ($makefile, @inputs) = split (/:/, $output_files{$makefile_in});
$relative_dir = dirname ($makefile);
@@ -7862,9 +7777,9 @@ sub generate_makefile ($$)
handle_silent;
- # These must be run after all the sources are scanned. They
- # use variables defined by &handle_libraries, &handle_ltlibraries,
- # or &handle_programs.
+ # These must be run after all the sources are scanned. They use
+ # variables defined by handle_libraries(), handle_ltlibraries(),
+ # or handle_programs().
handle_compile;
handle_languages;
handle_libtool;
@@ -7975,6 +7890,9 @@ sub generate_makefile ($$)
# Helper function for usage().
sub print_autodist_files (@)
{
+ # NOTE: we need to call our 'uniq' function with the leading '&'
+ # here, because otherwise perl complains that "Unquoted string
+ # 'uniq' may clash with future reserved word".
my @lcomm = sort (&uniq (@_));
my @four;
@@ -8067,8 +7985,8 @@ General help using GNU software: <http://www.gnu.org/gethelp/>.
}
-# &version ()
-# -----------
+# version ()
+# ----------
# Print version information
sub version ()
{
@@ -8122,7 +8040,7 @@ sub parse_arguments ()
set_global_option ('no-dependencies', $cli_where) if $ignore_deps;
for my $warning (@warnings)
{
- &parse_warnings ('-W', $warning);
+ parse_warnings ('-W', $warning);
}
return unless @ARGV;
@@ -8190,7 +8108,7 @@ sub handle_makefiles_serial ()
# get_number_of_threads ()
# ------------------------
# Logic for deciding how many worker threads to use.
-sub get_number_of_threads
+sub get_number_of_threads ()
{
my $nthreads = $ENV{'AUTOMAKE_JOBS'} || 0;
diff --git a/bootstrap.sh b/bootstrap.sh
index bb4221d01..6e49d278f 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -88,14 +88,15 @@ dosubst ()
dosubst automake-$APIVERSION/Automake/Config.in \
automake-$APIVERSION/Automake/Config.pm
-# Create temporary replacement for aclocal.
-dosubst aclocal.in aclocal.tmp
-
# Overwrite amversion.m4.
dosubst m4/amversion.in m4/amversion.m4
-# Create temporary replacement for automake.
-dosubst automake.in automake.tmp
+# Create temporary replacement for aclocal and automake.
+for p in aclocal automake; do
+ dosubst $p.in $p.tmp
+ $PERL -w lib/gen-perl-protos $p.tmp > $p.tmp2
+ mv -f $p.tmp2 $p.tmp
+done
# Create required makefile snippets.
$PERL ./gen-testsuite-part > t/testsuite-part.tmp
diff --git a/lib/Automake/Language.pm b/lib/Automake/Language.pm
new file mode 100644
index 000000000..a678e1e4d
--- /dev/null
+++ b/lib/Automake/Language.pm
@@ -0,0 +1,122 @@
+# Copyright (C) 2013 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+package Automake::Language;
+
+use 5.006;
+use strict;
+
+use Class::Struct ();
+Class::Struct::struct (
+ # Short name of the language (c, f77...).
+ 'name' => "\$",
+ # Nice name of the language (C, Fortran 77...).
+ 'Name' => "\$",
+
+ # List of configure variables which must be defined.
+ 'config_vars' => '@',
+
+ # 'pure' is '1' or ''. A 'pure' language is one where, if
+ # all the files in a directory are of that language, then we
+ # do not require the C compiler or any code to call it.
+ 'pure' => "\$",
+
+ 'autodep' => "\$",
+
+ # Name of the compiling variable (COMPILE).
+ 'compiler' => "\$",
+ # Content of the compiling variable.
+ 'compile' => "\$",
+ # Flag to require compilation without linking (-c).
+ 'compile_flag' => "\$",
+ 'extensions' => '@',
+ # A subroutine to compute a list of possible extensions of
+ # the product given the input extensions.
+ # (defaults to a subroutine which returns ('.$(OBJEXT)', '.lo'))
+ 'output_extensions' => "\$",
+ # A list of flag variables used in 'compile'.
+ # (defaults to [])
+ 'flags' => "@",
+
+ # Any tag to pass to libtool while compiling.
+ 'libtool_tag' => "\$",
+
+ # The file to use when generating rules for this language.
+ # The default is 'depend2'.
+ 'rule_file' => "\$",
+
+ # Name of the linking variable (LINK).
+ 'linker' => "\$",
+ # Content of the linking variable.
+ 'link' => "\$",
+
+ # Name of the compiler variable (CC).
+ 'ccer' => "\$",
+
+ # Name of the linker variable (LD).
+ 'lder' => "\$",
+ # Content of the linker variable ($(CC)).
+ 'ld' => "\$",
+
+ # Flag to specify the output file (-o).
+ 'output_flag' => "\$",
+ '_finish' => "\$",
+
+ # This is a subroutine which is called whenever we finally
+ # determine the context in which a source file will be
+ # compiled.
+ '_target_hook' => "\$",
+
+ # If TRUE, nodist_ sources will be compiled using specific rules
+ # (i.e. not inference rules). The default is FALSE.
+ 'nodist_specific' => "\$");
+
+
+sub finish ($)
+{
+ my ($self) = @_;
+ if (defined $self->_finish)
+ {
+ &{$self->_finish} (@_);
+ }
+}
+
+sub target_hook ($$$$%)
+{
+ my ($self) = @_;
+ if (defined $self->_target_hook)
+ {
+ $self->_target_hook->(@_);
+ }
+}
+
+1;
+
+### Setup "GNU" style for perl-mode and cperl-mode.
+## Local Variables:
+## perl-indent-level: 2
+## perl-continued-statement-offset: 2
+## perl-continued-brace-offset: 0
+## perl-brace-offset: 0
+## perl-brace-imaginary-offset: 0
+## perl-label-offset: -2
+## cperl-indent-level: 2
+## cperl-brace-offset: 0
+## cperl-continued-brace-offset: 0
+## cperl-label-offset: -2
+## cperl-extra-newline-before-brace: t
+## cperl-merge-trailing-else: nil
+## cperl-continued-statement-offset: 2
+## End:
diff --git a/lib/gen-perl-protos b/lib/gen-perl-protos
new file mode 100755
index 000000000..9e73d8d7a
--- /dev/null
+++ b/lib/gen-perl-protos
@@ -0,0 +1,36 @@
+#!/usr/bin/env perl
+#
+# Copyright (C) 2013 Free Software Foundation, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+use warnings;
+use strict;
+
+my @lines = <>;
+my @protos = map { /^(sub \w+\s*\(.*\))/ ? ("$1;") : () } @lines;
+
+while (defined ($_ = shift @lines))
+ {
+ if (/^#!.* prototypes/i)
+ {
+ print "# BEGIN AUTOMATICALLY GENERATED PROTOTYPES\n";
+ print join ("\n", sort @protos) . "\n";
+ print "# END AUTOMATICALLY GENERATED PROTOTYPES\n";
+ }
+ else
+ {
+ print;
+ }
+ }
diff --git a/maintainer/syntax-checks.mk b/maintainer/syntax-checks.mk
index e1d5e6b5d..1f72085ea 100644
--- a/maintainer/syntax-checks.mk
+++ b/maintainer/syntax-checks.mk
@@ -86,19 +86,22 @@ sc_at_in_texi
automake_diff_no = 7
aclocal_diff_no = 9
sc_diff_automake sc_diff_aclocal: sc_diff_% :
- @set +e; tmp=$*-diffs.tmp; \
- diff -u $(srcdir)/$*.in $* > $$tmp; test $$? -eq 1 || exit 1; \
- added=`grep -v '^+++ ' $$tmp | grep -c '^+'` || exit 1; \
- removed=`grep -v '^--- ' $$tmp | grep -c '^-'` || exit 1; \
- test $$added,$$removed = $($*_diff_no),$($*_diff_no) \
+ @set +e; \
+ in=$*-in.tmp out=$*-out.tmp diffs=$*-diffs.tmp \
+ && sed '/^#!.*[pP]rototypes/d' $(srcdir)/$*.in > $$in \
+ && sed '/^# BEGIN.* PROTO/,/^# END.* PROTO/d' $* > $$out \
+ && { diff -u $$in $$out > $$diffs; test $$? -eq 1; } \
+ && added=`grep -v '^+++ ' $$diffs | grep -c '^+'` \
+ && removed=`grep -v '^--- ' $$diffs | grep -c '^-'` \
+ && test $$added,$$removed = $($*_diff_no),$($*_diff_no) \
|| { \
echo "Found unexpected diffs between $*.in and $*"; \
echo "Lines added: $$added" ; \
echo "Lines removed: $$removed"; \
- cat $$tmp >&2; \
+ cat $$diffs; \
exit 1; \
- } >&1; \
- rm -f $$tmp
+ } >&2; \
+ rm -f $$in $$out $$diffs
## Expect no instances of '${...}'. However, $${...} is ok, since that
## is a shell construct, not a Makefile construct.