cmdline parsing: move into a dedicated perl module
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 18 Jan 2012 16:55:40 +0000 (17:55 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 18 Jan 2012 17:26:25 +0000 (18:26 +0100)
commit52246cc7355cedbc9cb992095870572beb767ca1
tree91124e12405b69cc274462705516988f9b662e67
parenta1e77caf20a62b14d549307a73131fedb9c0f696
cmdline parsing: move into a dedicated perl module

With this change, we delegate most of the automake and aclocal code
for command-line options parsing to a new module "Automake::Getopt".
This allows better code sharing between automake and aclocal, and
also with Autoconf, which will sync the new module from us.  See
also autoconf commit 'v2.68-120-gf4be358' (2012-01-17, "getopt: new
Autom4te::Getopt module"), and this mailing list discussion:
<http://lists.gnu.org/archive/html/autoconf-patches/2012-01/msg00033.html>

This change might interact with the behaviour described in automake
bug#7434; for example, starting from now, "automake -Wfoo --version"
will cause automake to emit diagnostic like "unknown warning
category 'foo'" before actually printing the version number and
exiting.  This is not a big deal in practice, and the code sharing
and simplifications introduced by this patch is certainly worth it.
Still, we should revisited the issue in the future.

* lib/Automake/Getopt.pm: New module, basically a slightly-edited
copy of the 'lib/Autom4te/Getopt.pm' file from the autoconf devel
repository (commit v2.68-120-gf4be358).  It defines and exports ...
(parse_options): ... this new function.
* automake.in (parse_arguments): Use the new function.
* aclocal.in (parse_arguments): Likewise.
* lib/Automake/Makefile.am (dist_perllib_DATA): Add the new file.
* tests/getopt.test: Remove.
* tests/list-of-tests.mk: Update.
aclocal.in
automake.in
lib/Automake/Getopt.pm [new file with mode: 0644]
lib/Automake/Makefile.am
tests/getopt.test [deleted file]
tests/list-of-tests.mk