]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Implement AM_MAINTAINER_MODE([DEFAULT-MODE]).
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 1 Sep 2008 18:29:58 +0000 (20:29 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 1 Sep 2008 18:30:34 +0000 (20:30 +0200)
* m4/maintainer.m4 (AM_MAINTAINER_MODE): Allow for an optional
first argument of `enable' or `disable', setting the default.
* doc/automake.texi (Optional, maintainer-mode): Document.
* tests/mmode.test: New test.
* tests/Makefile.am: Adjust.
* NEWS: Update.
Suggestion by Vincent Lefevre.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
doc/automake.texi
m4/maintainer.m4
tests/Makefile.am
tests/Makefile.in
tests/mmode.test [new file with mode: 0755]

index d49d6307dafdd0448348da9dcc8c1bd681efd650..a51a6e271104540fdcae063650ce31e551f16931 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2008-09-01  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Implement AM_MAINTAINER_MODE([DEFAULT-MODE]).
+       * m4/maintainer.m4 (AM_MAINTAINER_MODE): Allow for an optional
+       first argument of `enable' or `disable', setting the default.
+       * doc/automake.texi (Optional, maintainer-mode): Document.
+       * tests/mmode.test: New test.
+       * tests/Makefile.am: Adjust.
+       * NEWS: Update.
+       Suggestion by Vincent Lefevre.
+
 2008-08-31  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Copyright year updates.
diff --git a/NEWS b/NEWS
index bd1f369b81f6c79f5d5e67bed829eb742c51853b..a2b336ea67f6943df90009cf561ca2570a46450f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -70,6 +70,9 @@ New in 1.10a:
     remove the file in a non-VPATH build.  Such setups work with Autoconf
     2.62 or newer.
 
+  - AM_MAINTAINER_MODE now allows for an optional argument specifying
+    the default setting.
+
 Bugs fixed in 1.10a:
 
 * Long standing bugs:
index 265a3f8ab2f524e1e8ea9e8a1471ce06694e1dad..0ea578097052218fb8cb739483ee53f895f0d09d 100644 (file)
@@ -2863,14 +2863,16 @@ This macro specifies that the @file{intl/} subdirectory is to be built,
 even if the @code{AM_GNU_GETTEXT} macro was invoked with a first argument
 of @samp{external}.
 
-@item AM_MAINTAINER_MODE
+@item AM_MAINTAINER_MODE(@ovar{default-mode})
 @opindex --enable-maintainer-mode
-This macro adds a @option{--enable-maintainer-mode} option to
+@opindex --disable-maintainer-mode
+This macro adds an @option{--enable-maintainer-mode} option to
 @command{configure}.  If this is used, @command{automake} will cause
 ``maintainer-only'' rules to be turned off by default in the
-generated @file{Makefile.in}s.  This macro defines the
-@code{MAINTAINER_MODE} conditional, which you can use in your own
-@file{Makefile.am}.  @xref{maintainer-mode}.
+generated @file{Makefile.in}s, unless @var{default-mode} is
+@samp{enable}.  This macro defines the @code{MAINTAINER_MODE}
+conditional, which you can use in your own @file{Makefile.am}.
+@xref{maintainer-mode}.
 
 @item m4_include
 Files included by @file{configure.ac} using this macro will be
@@ -9882,16 +9884,19 @@ the build continue is one of the arguments of the
 @cindex @code{AM_MAINTAINER_MODE}, purpose
 @acindex AM_MAINTAINER_MODE
 
-@code{AM_MAINTAINER_MODE} disables the so called "rebuild rules" by
-default.  If you have @code{AM_MAINTAINER_MODE} in
-@file{configure.ac}, and run @samp{./configure && make}, then
-@command{make} will *never* attempt to rebuilt @file{configure},
-@file{Makefile.in}s, Lex or Yacc outputs, etc.  I.e., this disables
-build rules for files that are usually distributed and that users
-should normally not have to update.
-
-If you run @samp{./configure --enable-maintainer-mode}, then these
-rebuild rules will be active.
+@code{AM_MAINTAINER_MODE} allows to choose whether the so called
+"rebuild rules" should be enabled or disabled.  With
+@code{AM_MAINTAINER_MODE([enable])}, they are enabled by default,
+otherwise they are disabled by default.  In the latter case, if
+you have @code{AM_MAINTAINER_MODE} in @file{configure.ac}, and run
+@samp{./configure && make}, then @command{make} will *never* attempt to
+rebuilt @file{configure}, @file{Makefile.in}s, Lex or Yacc outputs, etc.
+I.e., this disables build rules for files that are usually distributed
+and that users should normally not have to update.
+
+The user can override the default setting by passing either
+@samp{--enable-maintainer-mode} or @samp{--disable-maintainer-mode}
+to @command{configure}.
 
 People use @code{AM_MAINTAINER_MODE} either because they do want their
 users (or themselves) annoyed by timestamps lossage (@pxref{CVS}), or
index 1c15c980f596a9319a16f8fc1188dee1960bf761..0b54e67edb57fd06893a75f3e424e35a3ddb9c97 100644 (file)
@@ -1,27 +1,38 @@
 # Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
 # From Jim Meyering
 
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 4
+# serial 5
 
+# AM_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless `enable' is passed literally.
+# For symmetry, `disable' may be passed as well.  Anyway, the user
+# can override the default with the --enable/--disable switch.
 AC_DEFUN([AM_MAINTAINER_MODE],
-[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
-  dnl maintainer-mode is disabled by default
-  AC_ARG_ENABLE(maintainer-mode,
-[  --enable-maintainer-mode  enable make rules and dependencies not useful
+[m4_case(m4_default([$1], [disable]),
+       [enable], [m4_define([am_maintainer_other], [disable])],
+       [disable], [m4_define([am_maintainer_other], [enable])],
+       [m4_define([am_maintainer_other], [enable])
+        m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
+  dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+  AC_ARG_ENABLE([maintainer-mode],
+[  --][am_maintainer_other][-maintainer-mode  am_maintainer_other make rules and dependencies not useful
                          (and sometimes confusing) to the casual installer],
-      USE_MAINTAINER_MODE=$enableval,
-      USE_MAINTAINER_MODE=no)
+      [USE_MAINTAINER_MODE=$enableval],
+      [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
   AC_MSG_RESULT([$USE_MAINTAINER_MODE])
-  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
+  AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
   MAINT=$MAINTAINER_MODE_TRUE
-  AC_SUBST(MAINT)dnl
+  AC_SUBST([MAINT])dnl
 ]
 )
 
index 1e19657c2a9c4b2b0c6f00739ef39839ebd27ff7..6aa5d5c46734e12f04e110d4f649c36889bd4feb 100644 (file)
@@ -394,6 +394,7 @@ missing6.test \
 mkinstall.test \
 mkinst2.test \
 mkinst3.test \
+mmode.test \
 mmodely.test \
 multlib.test \
 nobase.test \
index 969a57bb034e4c6c6645ec5a14b4afcc67856148..783ab8beb2801f753dbb0878912a2ec82cca60ff 100644 (file)
@@ -545,6 +545,7 @@ missing6.test \
 mkinstall.test \
 mkinst2.test \
 mkinst3.test \
+mmode.test \
 mmodely.test \
 multlib.test \
 nobase.test \
diff --git a/tests/mmode.test b/tests/mmode.test
new file mode 100755 (executable)
index 0000000..c067ccc
--- /dev/null
@@ -0,0 +1,67 @@
+#! /bin/sh
+# Copyright (C) 2008  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/>.
+
+# Check for AM_MAINTAINER_MODE defaults.
+
+. ./defs || exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AM_MAINTAINER_MODE
+AC_OUTPUT
+END
+
+: >Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure --help | grep 'enable-maintainer-mode.*enable make rules'
+./configure
+grep '^MAINT.*#' Makefile
+
+./configure --disable-maintainer-mode
+grep '^MAINT.*#' Makefile
+
+./configure --enable-maintainer-mode
+grep '^MAINT.*#' Makefile && exit 1
+
+sed 's/\(AM_MAINTAINER_MODE\).*/\1([disable])/' configure.in > configure.int
+mv -f configure.int configure.in
+mv configure configure1
+$AUTOCONF --force
+diff configure configure1
+
+sed 's/\(AM_MAINTAINER_MODE\).*/\1([enable])/' configure.in > configure.int
+mv -f configure.int configure.in
+$AUTOCONF --force
+
+./configure --help | grep 'disable-maintainer-mode.*disable make rules'
+./configure
+grep '^MAINT.*#' Makefile && exit 1
+
+./configure --enable-maintainer-mode
+grep '^MAINT.*#' Makefile && exit 1
+
+./configure --disable-maintainer-mode
+grep '^MAINT.*#' Makefile
+
+sed 's/\(AM_MAINTAINER_MODE\).*/\1([foo])/' configure.in > configure.int
+mv -f configure.int configure.in
+$AUTOCONF --force -Werror && exit 1
+: