* automake.texi (Complete, Macros, Options): Document the new style
authorAlexandre Duret-Lutz <adl@gnu.org>
Wed, 9 Jan 2002 08:52:09 +0000 (08:52 +0000)
committerAlexandre Duret-Lutz <adl@gnu.org>
Wed, 9 Jan 2002 08:52:09 +0000 (08:52 +0000)
AM_INIT_AUTOMAKE.  Remove AM_AUTOMAKE_OPTIONS documentaion.
* m4/init.m4 (AM_INIT_AUTOMAKE): Get PACKAGE and VERSION from
AC_INIT if they are available there.  Support a new call form
where the only argument is an optional space-separated list of
Automake options.
* m4/options.m4 (AM_AUTOMAKE_OPTIONS): Remove.
(_AM_MANGLE_OPTION, _AM_SET_OPTION, _AM_SET_OPTIONS,
_AM_IF_OPTION): New functions.
* automake.in (AC_INIT_PATTERN): New variable.
(global_options_line): Remove, use $seen_init_automake instead.
(scan_one_autoconf_file, scan_autoconf_traces): Set $package_version
from AC_INIT if available.  Support the new style AM_INIT_AUTOMAKE.
Remove the AM_AUTOMAKE_OPTIONS handling.
* configure.in: Modernize.
* tests/defs (configure.in): Modernize.  One third of the tests
still overwrite the default configure.in and use an old
AM_INIT_AUTOMAKE call,  so that makes testing for both.
* tests/nodefine.test, tests/nodefine2.test: New files.
* tests/Makefile.am (TESTS): Add them.

16 files changed:
ChangeLog
NEWS
aclocal.m4
automake.in
automake.texi
configure
configure.in
m4/init.m4
m4/options.m4
stamp-vti
tests/Makefile.am
tests/Makefile.in
tests/defs
tests/nodefine.test [new file with mode: 0755]
tests/nodefine2.test [new file with mode: 0755]
version.texi

index bdbb25d..6bc6e06 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,26 @@
+2002-01-09  Alexandre Duret-Lutz  <duret_g@epita.fr>
+
+       * automake.texi (Complete, Macros, Options): Document the new style
+       AM_INIT_AUTOMAKE.  Remove AM_AUTOMAKE_OPTIONS documentaion.
+       * m4/init.m4 (AM_INIT_AUTOMAKE): Get PACKAGE and VERSION from
+       AC_INIT if they are available there.  Support a new call form
+       where the only argument is an optional space-separated list of
+       Automake options.
+       * m4/options.m4 (AM_AUTOMAKE_OPTIONS): Remove.
+       (_AM_MANGLE_OPTION, _AM_SET_OPTION, _AM_SET_OPTIONS,
+       _AM_IF_OPTION): New functions.
+       * automake.in (AC_INIT_PATTERN): New variable.
+       (global_options_line): Remove, use $seen_init_automake instead.
+       (scan_one_autoconf_file, scan_autoconf_traces): Set $package_version
+       from AC_INIT if available.  Support the new style AM_INIT_AUTOMAKE.
+       Remove the AM_AUTOMAKE_OPTIONS handling.
+       * configure.in: Modernize.
+       * tests/defs (configure.in): Modernize.  One third of the tests
+       still overwrite the default configure.in and use an old
+       AM_INIT_AUTOMAKE call,  so that makes testing for both.
+       * tests/nodefine.test, tests/nodefine2.test: New files.
+       * tests/Makefile.am (TESTS): Add them.
+
 2002-01-08  Raja R Harinath  <harinath@cs.umn.edu>
 
        * automake.in (define_configure_variable): Propagate line numbers.
diff --git a/NEWS b/NEWS
index f5571ab..90cf05e 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-New in 1.5b:
+New in 1.5c:
 * Autoconf 2.52 is required.
 * `dist' generates all the archive flavors, as did `dist-all'.
 * `dist-gzip' generates the Gzip tar file only.
@@ -19,8 +19,11 @@ New in 1.5b:
 * Fixed handling of nobase_ targets.
 * Fixed support of implicit rules leading to .lo objects.
 * Fixed late inclusion of --add-missing files (e.g. depcomp) in DIST_COMMON
-* Added new AM_AUTOMAKE_OPTIONS macro
 * Added uninstall-hook target
+* `AC_INIT AM_INIT_AUTOMAKE(package,version)' is an obsolete construct.
+  You can now use `AC_INIT(package,version) AM_INIT_AUTOMAKE' instead.
+  It is also possible to pass a list of global Automake options as
+  first argument to this new form of AM_INIT_AUTOMAKE.
 \f
 New in 1.5:
 * Support for `configure.ac'.
index 01258d2..de34966 100644 (file)
@@ -34,7 +34,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 # 02111-1307, USA.
 
-# serial 7
+# serial 8
 
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -49,8 +49,17 @@ AC_PREREQ([2.52])
 # the ones we care about.
 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
 
-# AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE])
-# ----------------------------------------------
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
 AC_DEFUN([AM_INIT_AUTOMAKE],
 [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
  AC_REQUIRE([AC_PROG_INSTALL])dnl
@@ -60,13 +69,20 @@ if test "`cd $srcdir && pwd`" != "`pwd`" &&
   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
 fi
 
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+  [m4_ifval([$3],, [_AM_SET_OPTION([no-define])])],
+  [_AM_SET_OPTIONS([$1])])dnl
+
 # Define the identity of the package.
-AC_SUBST([PACKAGE], [$1])dnl
-AC_SUBST([VERSION], [$2])dnl
-ifelse([$3],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])
+AC_SUBST([PACKAGE],
+[m4_ifset([AC_PACKAGE_TARNAME], [AC_PACKAGE_TARNAME], [$1])])dnl
+AC_SUBST([VERSION],
+[m4_ifset([AC_PACKAGE_VERSION], [AC_PACKAGE_VERSION], [$2])])dnl
 
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
 
 # Some tools Automake needs.
 AC_REQUIRE([AM_SANITY_CHECK])dnl
@@ -124,6 +140,50 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],[])
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
         [AM_AUTOMAKE_VERSION([1.5c])])
 
+# Helper functions for option handling.                    -*- Autoconf -*-
+
+# Copyright 2001, 2002  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, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_if(_AM_MANGLE_OPTION([$1]), 1, [$2], [$3])])
+
 #
 # Check to make sure that the build environment is sane.
 #
@@ -682,34 +742,6 @@ AC_CONFIG_COMMANDS_PRE(
 Usually this means the macro was only invoked conditionally.])
 fi])])
 
-# Do all the work for Automake.                            -*- Autoconf -*-
-
-# Copyright 2001 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, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# serial 1
-
-# AM_AUTOMAKE_OPTIONS([OPTIONS])
-# ------------------------------
-# Set some automake options globally.
-AC_DEFUN([AM_AUTOMAKE_OPTIONS],
-[dnl nothing
-])
-
 # Copyright 2001 Free Software Foundation, Inc.             -*- Autoconf -*-
 
 # This program is free software; you can redistribute it and/or modify
index 8b3c856..90a05fa 100755 (executable)
@@ -161,6 +161,7 @@ my $INCLUDE_PATTERN = ('^include\s+'
 # makes indentation work better in Emacs.
 my $AC_CONFIG_AUX_DIR_PATTERN = 'AC_CONFIG_AUX_DIR\(([^)]+)\)';
 my $AM_INIT_AUTOMAKE_PATTERN = 'AM_INIT_AUTOMAKE\([^,]*,([^,)]+)[,)]';
+my $AC_INIT_PATTERN = 'AC_INIT\([^,]*,([^,)]+)[,)]';
 my $AM_PACKAGE_VERSION_PATTERN = '^\s*\[?([^]\s]+)\]?\s*$';
 
 # This handles substitution references like ${foo:.a=.b}.
@@ -393,7 +394,7 @@ my $seen_multilib = 0;
 # TRUE if we've seen AM_PROG_CC_C_O
 my $seen_cc_c_o = 0;
 
-# TRUE if we've seen AM_INIT_AUTOMAKE.
+# Where AM_INIT_AUTOMAKE is called;
 my $seen_init_automake = 0;
 
 # TRUE if we've seen AM_AUTOMAKE_VERSION.
@@ -457,10 +458,8 @@ my %required_targets =
 # should distribute depcomp -- has been generated.)
 my $automake_needs_to_reprocess_all_files = 0;
 
-# Options set via AM_AUTOMAKE_OPTIONS.
+# Options set via AM_INIT_AUTOMAKE.
 my $global_options = '';
-# Line number for AM_AUTOMAKE_OPTIONS.
-my $global_options_line;
 
 \f
 
@@ -1444,7 +1443,7 @@ sub process_option_list
               || $_ eq 'dejagnu' || $_ eq 'no-texinfo.tex'
               || $_ eq 'readme-alpha' || $_ eq 'check-news'
               || $_ eq 'subdir-objects' || $_ eq 'nostdinc'
-              || $_ eq 'no-exeext')
+              || $_ eq 'no-exeext' || $_ eq 'no-define')
        {
            # Explicitly recognize these.
        }
@@ -1464,7 +1463,7 @@ sub process_option_list
        {
            if ($config)
            {
-               file_error ($global_options_line,
+               file_error ($seen_init_automake,
                            "option `" . $_ . "\' not recognized");
            }
            else
@@ -4495,17 +4494,17 @@ sub scan_autoconf_traces ($)
                  AC_CANONICAL_SYSTEM
                  AC_CONFIG_AUX_DIR
                  AC_CONFIG_FILES
+                 AC_INIT
                  AC_LIBSOURCE
-                 AC_PROG_LIBTOOL AM_PROG_LIBTOOL
                  AC_PROG_LEX
+                 AC_PROG_LIBTOOL AM_PROG_LIBTOOL
                  AC_SUBST
+                 AM_AUTOMAKE_VERSION
                  AM_CONDITIONAL
                  AM_CONFIG_HEADER
                  AM_C_PROTOTYPES
                  AM_GNU_GETTEXT
                  AM_INIT_AUTOMAKE
-                 AM_AUTOMAKE_OPTIONS
-                 AM_AUTOMAKE_VERSION
                  AM_MAINTAINER_MODE
                  AM_PATH_LISPDIR
                  AM_PATH_PYTHON
@@ -4552,6 +4551,14 @@ sub scan_autoconf_traces ($)
          $ac_config_files_location = $here;
          &scan_autoconf_config_files ($args[1]);
        }
+      elsif ($macro eq 'AC_INIT')
+        {
+         if (defined $args[2])
+           {
+             $package_version = $args[2];
+             $package_version_location = $here;
+           }
+       }
       elsif ($macro eq 'AC_LIBSOURCE')
        {
          $libsources{$args[1]} = $here;
@@ -4571,6 +4578,17 @@ sub scan_autoconf_traces ($)
          $configure_vars{$args[1]} = $here
            if $args[1] =~ /^\w+$/;
        }
+      elsif ($macro eq 'AM_AUTOMAKE_VERSION')
+        {
+         file_error ($here,
+                     "version mismatch.  This is Automake $VERSION,\n" .
+                     "but the definition used by this AM_INIT_AUTOMAKE\n" .
+                     "comes from Automake $args[1].  You should recreate\n" .
+                     "aclocal.m4 with aclocal and run automake again.\n")
+             if ($VERSION ne $args[1]);
+
+         $seen_automake_version = 1;
+        }
       elsif ($macro eq 'AM_CONDITIONAL')
        {
          $configure_cond{$args[1]} = $here;
@@ -4591,26 +4609,17 @@ sub scan_autoconf_traces ($)
        }
       elsif ($macro eq 'AM_INIT_AUTOMAKE')
        {
-         $package_version = $args[2];
-         $package_version_location = $here;
-         $seen_init_automake = 1;
-       }
-      elsif ($macro eq 'AM_AUTOMAKE_OPTIONS')
-        {
-         $global_options = $args[1];
-         $global_options_line = $here;
+         $seen_init_automake = $here;
+         if (defined $args[2])
+           {
+             $package_version = $args[2];
+             $package_version_location = $here;
+           }
+         elsif (defined $args[1])
+           {
+             $global_options = $args[1];
+           }
        }
-      elsif ($macro eq 'AM_AUTOMAKE_VERSION')
-        {
-         file_error ($here,
-                     "version mismatch.  This is Automake $VERSION,\n" .
-                     "but the definition used by this AM_INIT_AUTOMAKE\n" .
-                     "comes from Automake $args[1].  You should recreate\n" .
-                     "aclocal.m4 with aclocal and run automake again.\n")
-             if ($VERSION ne $args[1]);
-
-         $seen_automake_version = 1;
-        }
       elsif ($macro eq 'AM_MAINTAINER_MODE')
        {
          $seen_maint_mode = $here;
@@ -4839,18 +4848,26 @@ sub scan_one_autoconf_file
              }
          }
 
-        # This macro handles several different things.
-        if (/$AM_INIT_AUTOMAKE_PATTERN/o)
+       # AM_INIT_AUTOMAKE with any number of argument
+       if (/AM_INIT_AUTOMAKE/)
        {
-           ($package_version = $1) =~ s/$AM_PACKAGE_VERSION_PATTERN/$1/o;
-           $package_version_location = $here;
            $seen_init_automake = $here;
+        }
+
+       # AC_INIT or AM_INIT_AUTOMAKE with two arguments
+        if (/$AC_INIT_PATTERN/o || /$AM_INIT_AUTOMAKE_PATTERN/o)
+       {
+            if ($1 =~ /$AM_PACKAGE_VERSION_PATTERN/o)
+            {
+               $package_version = $1;
+               $package_version_location = $here;
+           }
        }
 
-       if (/AM_AUTOMAKE_OPTIONS\(([^)]+)\)/)
+       # AM_INIT_AUTOMAKE with one argument.
+       if (/AM_INIT_AUTOMAKE\(([^),]+)\)/)
        {
             $global_options = &unquote_m4_arg ($1);
-            $global_options_line = $here;
        }
 
        if (/AM_AUTOMAKE_VERSION\(([^)]+)\)/)
@@ -5012,14 +5029,14 @@ sub scan_autoconf_files
     {
        if (-f 'aclocal.m4')
        {
-           file_error ($package_version_location || $me,
+           file_error ($seen_init_automake || $me,
                        "your implementation of AM_INIT_AUTOMAKE comes from " .
                        "an\nold Automake version.  You should recreate " .
                        "aclocal.m4\nwith aclocal and run automake again.\n");
        }
        else
        {
-           file_error ($package_version_location || $me,
+           file_error ($seen_init_automake || $me,
                        "no proper implementation of AM_INIT_AUTOMAKE was " .
                        "found,\nprobably because aclocal.m4 is missing...\n" .
                        "You should run aclocal to create this file, then\n" .
index 430ff77..7e5760f 100644 (file)
@@ -617,7 +617,9 @@ commands that @code{automake} needs.  The way to do this is to add an
 @code{AM_INIT_AUTOMAKE} call just after @code{AC_INIT}:
 
 @example
-AM_INIT_AUTOMAKE(zardoz, 1.0)
+AC_INIT(zardoz, 1.0)
+AM_INIT_AUTOMAKE
+...
 @end example
 
 Since your program doesn't have any complicating factors (e.g., it
@@ -686,6 +688,7 @@ has a manual and a test suite.
 @cindex Hello, configure.in
 
 Here is the @file{configure.in} from GNU Hello:
+@c FIXME: This definitively requires an update.
 
 @example
 dnl Process this file with autoconf to produce a configure script.
@@ -1329,11 +1332,6 @@ Print the version number of Automake and exit.
 @c consider generating this node automatically from m4 files.
 
 @table @code
-@item AM_AUTOMAKE_OPTIONS
-This takes a single argument which is a list of options which should be
-applied to every @file{Makefile.am} in the tree.  The effect is as if
-each option were listed in @code{AUTOMAKE_OPTIONS}.
-
 @item AM_CONFIG_HEADER
 Automake will generate rules to automatically regenerate the config
 header.
@@ -1369,11 +1367,41 @@ define @code{GWINSZ_IN_SYS_IOCTL}.  Otherwise @code{TIOCGWINSZ} can be
 found in @file{<termios.h>}.
 @cvindex AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
 
-@item AM_INIT_AUTOMAKE
+@item AM_INIT_AUTOMAKE([OPTIONS])
+@itemx AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
 Runs many macros that most @file{configure.in}'s need.  This macro has
-two required arguments, the package and the version number.  By default
-this macro @code{AC_DEFINE}'s @samp{PACKAGE} and @samp{VERSION}.  This
-can be avoided by passing in a non-empty third argument.
+two forms, the second of which has two required arguments: the package
+and the version number.  This latter form is obsolete because the
+@var{package} and @var{version} are now arguments of the @samp{AC_INIT}
+Autoconf macro, and Automake can get this information from there.
+
+If your @file{configure.in} has:
+@example
+AC_INIT(src/foo.c)
+AM_INIT_AUTOMAKE(mumble, 1.5)
+@end example
+you can modernize it as follow:
+@example
+AC_INIT(mumble, 1.5)
+AC_CONFIG_SRCDIR(src/foo.c)
+AM_INIT_AUTOMAKE
+@end example
+
+If this macro is called with a single argument, it is interpreted as a
+space-separated list of Automake options which should be applied to
+every @file{Makefile.am} in the tree.  The effect is as if each option
+were listed in @code{AUTOMAKE_OPTIONS}.
+
+By default this macro @code{AC_DEFINE}'s @samp{PACKAGE} and
+@samp{VERSION}.  This can be avoided by passing the @samp{no-define}
+option, as in:
+@example
+AM_INIT_AUTOMAKE([gnits 1.5 no-define dist-bzip2])
+@end example
+or by passing a third non-empty argument to the obsolete form.
+
+@cvindex PACKAGE, prevent definition
+@cvindex VERSION, prevent definition
 
 @item AM_MAKE_INCLUDE
 This macro is used to discover how the user's @code{make} handles
@@ -3850,8 +3878,12 @@ this by writing an @code{installcheck-local} target.
 @chapter Changing Automake's Behavior
 
 Various features of Automake can be controlled by options in the
-@file{Makefile.am}.  Such options are listed in a special variable named
-@code{AUTOMAKE_OPTIONS}.  Currently understood options are:
+@file{Makefile.am}.  Such options are applied on a per-@file{Makefile}
+basis when listed in a special @file{Makefile} variable named
+@code{AUTOMAKE_OPTIONS}.  They are applied globally to all processed
+@file{Makefiles} when listed in the first argument of
+@code{AM_INIT_AUTOMAKE} in @file{configure.in}.  Currently understood
+options are:
 @vindex AUTOMAKE_OPTIONS
 
 @table @asis
@@ -3913,6 +3945,12 @@ the distribution.  @code{dist} will create it in addition to the other
 formats.
 @trindex dist-tarZ
 
+@item @code{no-define}
+@cindex Option, no-define
+This options is meaningful only when passed as an argument to
+AM_INIT_AUTOMAKE.  It will prevent the @code{PACKAGE} and @code{VERSION}
+variable to be @code{AC_DEFINE}d.
+
 @item @code{no-dependencies}
 @cindex Option, no-dependencies
 This is similar to using @samp{--include-deps} on the command line, but
index d8e76d0..d0a00bc 100755 (executable)
--- a/configure
+++ b/configure
@@ -1419,10 +1419,12 @@ echo "$as_me: error: source directory already configured; run \"make distclean\"
    { (exit 1); exit 1; }; }
 fi
 
+
 # Define the identity of the package.
 PACKAGE=automake
 VERSION=1.5c
 
+
 cat >>confdefs.h <<_ACEOF
 #define PACKAGE "$PACKAGE"
 _ACEOF
@@ -1432,8 +1434,6 @@ cat >>confdefs.h <<_ACEOF
 #define VERSION "$VERSION"
 _ACEOF
 
-
-
 # Some tools Automake needs.
 
 ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal"}
@@ -1461,7 +1461,6 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
 # some platforms.
 
 
-
 # $AUTOMAKE and $ACLOCAL are always run after a `cd $top_srcdir',
 # hence `.' is really what we want for perllibdir and libdir.
 ACLOCAL="perllibdir=./lib `pwd`/aclocal --acdir=m4"
index b020956..bde1395 100644 (file)
@@ -24,8 +24,7 @@ AC_INIT([GNU Automake], [1.5c], [bug-automake@gnu.org])
 AC_CONFIG_SRCDIR(automake.in)
 AC_CONFIG_AUX_DIR(lib)
 
-AM_INIT_AUTOMAKE(automake, 1.5c)
-AM_AUTOMAKE_OPTIONS([1.5 dist-bzip2])
+AM_INIT_AUTOMAKE([1.5 dist-bzip2])
 
 # $AUTOMAKE and $ACLOCAL are always run after a `cd $top_srcdir',
 # hence `.' is really what we want for perllibdir and libdir.
index 724b25e..0d2698d 100644 (file)
@@ -21,7 +21,7 @@
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 # 02111-1307, USA.
 
-# serial 7
+# serial 8
 
 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -36,8 +36,17 @@ AC_PREREQ([2.52])
 # the ones we care about.
 m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
 
-# AM_INIT_AUTOMAKE(PACKAGE,VERSION, [NO-DEFINE])
-# ----------------------------------------------
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
 AC_DEFUN([AM_INIT_AUTOMAKE],
 [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
  AC_REQUIRE([AC_PROG_INSTALL])dnl
@@ -47,13 +56,20 @@ if test "`cd $srcdir && pwd`" != "`pwd`" &&
   AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
 fi
 
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+  [m4_ifval([$3],, [_AM_SET_OPTION([no-define])])],
+  [_AM_SET_OPTIONS([$1])])dnl
+
 # Define the identity of the package.
-AC_SUBST([PACKAGE], [$1])dnl
-AC_SUBST([VERSION], [$2])dnl
-ifelse([$3],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
-AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])
+AC_SUBST([PACKAGE],
+[m4_ifset([AC_PACKAGE_TARNAME], [AC_PACKAGE_TARNAME], [$1])])dnl
+AC_SUBST([VERSION],
+[m4_ifset([AC_PACKAGE_VERSION], [AC_PACKAGE_VERSION], [$2])])dnl
 
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
 
 # Some tools Automake needs.
 AC_REQUIRE([AM_SANITY_CHECK])dnl
index 412c5bd..8c9779a 100644 (file)
@@ -1,6 +1,6 @@
-# Do all the work for Automake.                            -*- Autoconf -*-
+# Helper functions for option handling.                    -*- Autoconf -*-
 
-# Copyright 2001 Free Software Foundation, Inc.
+# Copyright 2001, 2002  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
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 # 02111-1307, USA.
 
-# serial 1
+# serial 2
 
-# AM_AUTOMAKE_OPTIONS([OPTIONS])
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
 # ------------------------------
-# Set some automake options globally.
-AC_DEFUN([AM_AUTOMAKE_OPTIONS],
-[dnl nothing
-])
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_if(_AM_MANGLE_OPTION([$1]), 1, [$2], [$3])])
index 1b26760..d016b7a 100644 (file)
--- a/stamp-vti
+++ b/stamp-vti
@@ -1,4 +1,4 @@
-@set UPDATED 7 January 2002
+@set UPDATED 9 January 2002
 @set UPDATED-MONTH January 2002
 @set EDITION 1.5c
 @set VERSION 1.5c
index bcbed9f..0836e3a 100644 (file)
@@ -216,6 +216,8 @@ mkinstall.test \
 nobase.test \
 nodep.test \
 nodepcomp.test \
+nodefine.test \
+nodefine2.test \
 nodist.test \
 nodist2.test \
 noinst.test \
index 3722519..1b33ed3 100644 (file)
@@ -288,6 +288,8 @@ mkinstall.test \
 nobase.test \
 nodep.test \
 nodepcomp.test \
+nodefine.test \
+nodefine2.test \
 nodist.test \
 nodist2.test \
 noinst.test \
index fa3b5f7..1236dcf 100644 (file)
@@ -53,8 +53,8 @@ cd ./testSubDir
 # still produces a valid configure.ac.  But then, tests running
 # config.status really need to append AC_OUTPUT.
 cat > configure.in << END
-AC_INIT
-AM_INIT_AUTOMAKE($me, 1.0)
+AC_INIT($me, 1.0)
+AM_INIT_AUTOMAKE
 AC_PROG_INSTALL
 AC_PROG_MAKE_SET
 AC_CONFIG_FILES(Makefile)
diff --git a/tests/nodefine.test b/tests/nodefine.test
new file mode 100755 (executable)
index 0000000..ed00ff0
--- /dev/null
@@ -0,0 +1,44 @@
+#! /bin/sh
+# Make sure that PACKAGE and VERSION are AC_DEFINEd when requested.
+
+. $srcdir/defs || exit 1
+
+set -e
+
+# -------------------------------------------------------------------
+# Do not upgrade this file to use the modern AC_INIT/AM_INIT_AUTOMAKE
+# forms.  The day these obsolete AC_INIT and AM_INIT_AUTOMAKE forms
+# are dropped, just erase the file.
+# nodefine2.test contains the modern version of this test.
+# -------------------------------------------------------------------
+
+# First, check that PACKAGE and VERSION are output by default.
+
+cat > configure.in << 'END'
+AC_INIT
+AM_INIT_AUTOMAKE([UnIqUe_PaCkAgE], [UnIqUe_VeRsIoN])
+AC_OUTPUT(output)
+END
+
+echo 'DEFS = @DEFS@' > output.in
+
+$ACLOCAL
+$AUTOCONF
+./configure
+
+grep 'DEFS.*-DVERSION=\\"UnIqUe' output
+
+# Then, check that PACKAGE and VERSION are not output if requested.
+
+cat > configure.in << 'END'
+AC_INIT
+AM_INIT_AUTOMAKE([UnIqUe_PaCkAgE], [UnIqUe_VeRsIoN], [no])
+AC_OUTPUT(output)
+END
+
+$ACLOCAL
+$AUTOCONF
+./configure
+
+grep 'DEFS.*-DVERSION=\\"UnIqUe' output || exit 1
+:
diff --git a/tests/nodefine2.test b/tests/nodefine2.test
new file mode 100755 (executable)
index 0000000..cd3df26
--- /dev/null
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Make sure that PACKAGE and VERSION are AC_DEFINEd when requested.
+
+. $srcdir/defs || exit 1
+
+set -e
+
+# First, check that PACKAGE and VERSION are output by default.
+
+cat > configure.in << 'END'
+AC_INIT([UnIqUe_PaCkAgE], [UnIqUe_VeRsIoN])
+AM_INIT_AUTOMAKE
+AC_OUTPUT(output)
+END
+
+echo 'DEFS = @DEFS@' > output.in
+
+$ACLOCAL
+$AUTOCONF
+./configure
+
+grep 'DEFS.*-DVERSION=\\"UnIqUe' output
+
+# Then, check that PACKAGE and VERSION are not output if requested.
+
+cat > configure.in << 'END'
+AC_INIT([UnIqUe_PaCkAgE], [UnIqUe_VeRsIoN])
+AM_INIT_AUTOMAKE([no-define])
+AC_OUTPUT(output Makefile)
+END
+
+: > Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE   # Dummy call to make sure Automake grok `no-define' silently.
+./configure
+
+grep 'DEFS.*-DVERSION=\\"UnIqUe' output || exit 1
+:
index 1b26760..d016b7a 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 7 January 2002
+@set UPDATED 9 January 2002
 @set UPDATED-MONTH January 2002
 @set EDITION 1.5c
 @set VERSION 1.5c