automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

am_init_automake-vs-ac_init.patch


From: Alexandre Duret-Lutz
Subject: am_init_automake-vs-ac_init.patch
Date: 04 Jan 2002 16:38:51 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Now that Automake requires Autoconf 2.50, AM_INIT_AUTOMAKE could
get its PACKAGE and VERSION arguments from AC_INIT.

This patch allows one to call AM_INIT_AUTOMAKE without arguments,
and it documents the old-style call as obsolete.

I haven't yet done `make check' (that would drain my batteries).

Index: ChangeLog
===================================================================
RCS file: /home/adl/CVSROOT/automake-20020104-1222/ChangeLog,v
retrieving revision 1.1
diff -u -r1.1 ChangeLog
--- ChangeLog   4 Jan 2002 11:22:58 -0000       1.1
+++ ChangeLog   4 Jan 2002 15:25:13 -0000
@@ -1,3 +1,18 @@
+2002-01-04  Alexandre Duret-Lutz  <address@hidden>
+
+       * automake.texi (Complete, Macros): Document the new style
+       AM_INIT_AUTOMAKE.
+       * m4/init.m4 (AM_INIT_AUTOMAKE): Get PACKAGE and VERSION from
+       AC_INIT if they are available there.  Support a alternate
+       call form where only the NO-DEFINE argument is needed.
+       * automake.in (AC_INIT_PATTERN): New variable.
+       (scan_one_autoconf_file, scan_autoconf_traces): Set $package_version
+       from AC_INIT if available.  Support the new style AM_INIT_AUTOMAKE.
+       * 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.
+
 2002-01-02  Alexandre Duret-Lutz  <address@hidden>
 
        * m4/amversion.in, m4/amversion.m4: New files.
Index: NEWS
===================================================================
RCS file: /home/adl/CVSROOT/automake-20020104-1222/NEWS,v
retrieving revision 1.1
diff -u -r1.1 NEWS
--- NEWS        4 Jan 2002 11:22:59 -0000       1.1
+++ NEWS        4 Jan 2002 12:30:56 -0000
@@ -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.
@@ -21,6 +21,8 @@
 * 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.
 
 New in 1.5:
 * Support for `configure.ac'.
Index: aclocal.m4
===================================================================
RCS file: /home/adl/CVSROOT/automake-20020104-1222/aclocal.m4,v
retrieving revision 1.1
diff -u -r1.1 aclocal.m4
--- aclocal.m4  4 Jan 2002 11:22:59 -0000       1.1
+++ aclocal.m4  4 Jan 2002 12:27:44 -0000
@@ -49,8 +49,17 @@
 # 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([NO-DEFINE])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is been phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# AM_INIT_AUTOMAKE.
+# We still support both call styles for the transition.  After
+# the next Automake release is done, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on this 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
@@ -61,12 +70,14 @@
 fi
 
 # 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],[$1])])dnl
 
+m4_ifval([m4_ifval([$2], [$3], [$1])],
+[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: automake.in
===================================================================
RCS file: /home/adl/CVSROOT/automake-20020104-1222/automake.in,v
retrieving revision 1.1
diff -u -r1.1 automake.in
--- automake.in 4 Jan 2002 11:22:59 -0000       1.1
+++ automake.in 4 Jan 2002 12:26:38 -0000
@@ -161,6 +161,7 @@
 # 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}.
@@ -4493,6 +4494,7 @@
                  AC_CANONICAL_SYSTEM
                  AC_CONFIG_AUX_DIR
                  AC_CONFIG_FILES
+                 AC_INIT
                  AC_LIBSOURCE
                  AC_PROG_LIBTOOL AM_PROG_LIBTOOL
                  AC_PROG_LEX
@@ -4550,6 +4552,14 @@
          $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;
@@ -4589,9 +4599,12 @@
        }
       elsif ($macro eq 'AM_INIT_AUTOMAKE')
        {
-         $package_version = $args[2];
-         $package_version_location = $here;
          $seen_init_automake = 1;
+         if (defined $args[2])
+           {
+             $package_version = $args[2];
+             $package_version_location = $here;
+           }
        }
       elsif ($macro eq 'AM_AUTOMAKE_OPTIONS')
         {
@@ -4835,12 +4848,19 @@
              }
          }
 
-        # This macro handles several different things.
-        if (/$AM_INIT_AUTOMAKE_PATTERN/o)
+       if (/AM_INIT_AUTOMAKE/)
        {
-           ($package_version = $1) =~ s/$AM_PACKAGE_VERSION_PATTERN/$1/o;
-           $package_version_location = $here;
            $seen_init_automake = $here;
+        }
+
+        if (/$AC_INIT_PATTERN/o || /$AM_INIT_AUTOMAKE_PATTERN/o)
+       {
+            if ($1 =~ /$AM_PACKAGE_VERSION_PATTERN/o)
+            {
+               $package_version = $1;
+               $package_version_location = $here;
+               print "$package_version\n";
+           }
        }
 
        if (/AM_AUTOMAKE_OPTIONS\(([^)]+)\)/)
Index: automake.texi
===================================================================
RCS file: /home/adl/CVSROOT/automake-20020104-1222/automake.texi,v
retrieving revision 1.1
diff -u -r1.1 automake.texi
--- automake.texi       4 Jan 2002 11:22:59 -0000       1.1
+++ automake.texi       4 Jan 2002 15:17:28 -0000
@@ -617,7 +617,9 @@
 @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 @@
 @cindex Hello, configure.in
 
 Here is the @file{configure.in} from GNU Hello:
address@hidden FIXME: This definitively requires an update.
 
 @example
 dnl Process this file with autoconf to produce a configure script.
@@ -1369,11 +1372,31 @@
 found in @file{<termios.h>}.
 @cvindex AM_HEADER_TIOCGWINSZ_NEEDS_SYS_IOCTL
 
address@hidden AM_INIT_AUTOMAKE
address@hidden AM_INIT_AUTOMAKE([NO-DEFINE])
address@hidden 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
address@hidden 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:
address@hidden
+AC_INIT(src/foo.c)
+AM_INIT_AUTOMAKE(mumble, 1.5)
address@hidden example
+you can modernize it as follow:
address@hidden
+AC_INIT(mumble, 1.5)
+AC_CONFIG_SRCDIR(src/foo.c)
+AM_INIT_AUTOMAKE
address@hidden example
+
+By default this macro @code{AC_DEFINE}'s @samp{PACKAGE} and
address@hidden  This can be avoided by passing in an additional
+non-empty argument.
address@hidden PACKAGE, prevent definition
address@hidden VERSION, prevent definition
 
 @item AM_MAKE_INCLUDE
 This macro is used to discover how the user's @code{make} handles
Index: configure.in
===================================================================
RCS file: /home/adl/CVSROOT/automake-20020104-1222/configure.in,v
retrieving revision 1.1
diff -u -r1.1 configure.in
--- configure.in        4 Jan 2002 11:22:59 -0000       1.1
+++ configure.in        4 Jan 2002 12:27:43 -0000
@@ -24,7 +24,7 @@
 AC_CONFIG_SRCDIR(automake.in)
 AC_CONFIG_AUX_DIR(lib)
 
-AM_INIT_AUTOMAKE(automake, 1.5c)
+AM_INIT_AUTOMAKE
 AM_AUTOMAKE_OPTIONS([1.5 dist-bzip2])
 
 ACLOCAL="`pwd`/aclocal --acdir=m4"
Index: stamp-vti
===================================================================
RCS file: /home/adl/CVSROOT/automake-20020104-1222/stamp-vti,v
retrieving revision 1.1
diff -u -r1.1 stamp-vti
--- stamp-vti   4 Jan 2002 11:22:59 -0000       1.1
+++ stamp-vti   4 Jan 2002 15:17:48 -0000
@@ -1,4 +1,4 @@
address@hidden UPDATED 2 January 2002
address@hidden UPDATED 4 January 2002
 @set UPDATED-MONTH January 2002
 @set EDITION 1.5c
 @set VERSION 1.5c
Index: version.texi
===================================================================
RCS file: /home/adl/CVSROOT/automake-20020104-1222/version.texi,v
retrieving revision 1.1
diff -u -r1.1 version.texi
--- version.texi        4 Jan 2002 11:22:59 -0000       1.1
+++ version.texi        4 Jan 2002 12:24:59 -0000
@@ -1,4 +1,4 @@
address@hidden UPDATED 2 January 2002
address@hidden UPDATED 4 January 2002
 @set UPDATED-MONTH January 2002
 @set EDITION 1.5c
 @set VERSION 1.5c
Index: m4/init.m4
===================================================================
RCS file: /home/adl/CVSROOT/automake-20020104-1222/m4/init.m4,v
retrieving revision 1.1
diff -u -r1.1 init.m4
--- m4/init.m4  4 Jan 2002 11:23:00 -0000       1.1
+++ m4/init.m4  4 Jan 2002 12:53:50 -0000
@@ -36,8 +36,17 @@
 # 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([NO-DEFINE])
+# -----------------------------------------------
+# 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 still 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 this 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
@@ -48,12 +57,14 @@
 fi
 
 # 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],[$1])])dnl
 
+m4_ifval([m4_ifval([$2], [$3], [$1])],
+[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: tests/defs
===================================================================
RCS file: /home/adl/CVSROOT/automake-20020104-1222/tests/defs,v
retrieving revision 1.1
diff -u -r1.1 defs
--- tests/defs  4 Jan 2002 11:23:03 -0000       1.1
+++ tests/defs  4 Jan 2002 15:21:53 -0000
@@ -53,8 +53,8 @@
 # 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)

-- 
Alexandre Duret-Lutz



reply via email to

[Prev in Thread] Current Thread [Next in Thread]