[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Implement AM_MAINTAINER_MODE([DEFAULT-MODE]).
From: |
Ralf Wildenhues |
Subject: |
Re: [PATCH] Implement AM_MAINTAINER_MODE([DEFAULT-MODE]). |
Date: |
Mon, 1 Sep 2008 20:33:15 +0200 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Hi Eric,
* Eric Blake wrote on Mon, Sep 01, 2008 at 04:43:08AM CEST:
> Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de> writes:
>
> > Somebody please check what I'm currently not seeing in the m4 fu I
> > tried (the test fails, because there is something wrong in
> > m4/maintainer.m4). Also a review of the rest would be nice as well.
> >
>
> > +[m4_if(m4_default([$1], [disable]),
>
> s/m4_if/m4_case/
D'oh. Thanks, I was somehow never thinking of that bit.
> > + 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],
>
> I'd use AS_HELP_STRING here. Something like (untested):
>
> AC_ARG_ENABLE([maintainer-mode],
> [AS_HELP_STRING([--am_maintainer_other-maintainer-mode],
> am_maintainer_other[ make rules and dependencies not useful
> (and sometimes confusing) to the casual installer])],
Yes, but that would waste another line of --help output. In this case
I'd prefer leaving it at the manual output, that's a bit more compact.
> The rest of the patch looked okay at a cursory glance.
A couple of nits to get the test fully working and get a nice backtrace:
use m4_warn instead of m4_warning, and lose some more m4 quoting.
Applied to master like this.
Cheers,
Ralf
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.
diff --git a/NEWS b/NEWS
index bd1f369..a2b336e 100644
--- 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:
diff --git a/doc/automake.texi b/doc/automake.texi
index 265a3f8..0ea5780 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -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}.
address@hidden AM_MAINTAINER_MODE
address@hidden AM_MAINTAINER_MODE(@ovar{default-mode})
@opindex --enable-maintainer-mode
-This macro adds a @option{--enable-maintainer-mode} option to
address@hidden --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
address@hidden conditional, which you can use in your own
address@hidden @xref{maintainer-mode}.
+generated @file{Makefile.in}s, unless @var{default-mode} is
address@hidden This macro defines the @code{MAINTAINER_MODE}
+conditional, which you can use in your own @file{Makefile.am}.
address@hidden
@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
address@hidden disables the so called "rebuild rules" by
-default. If you have @code{AM_MAINTAINER_MODE} in
address@hidden, and run @samp{./configure && make}, then
address@hidden will *never* attempt to rebuilt @file{configure},
address@hidden, 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.
address@hidden allows to choose whether the so called
+"rebuild rules" should be enabled or disabled. With
address@hidden([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
address@hidden/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
address@hidden 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
diff --git a/m4/maintainer.m4 b/m4/maintainer.m4
index 1c15c98..0b54e67 100644
--- a/m4/maintainer.m4
+++ b/m4/maintainer.m4
@@ -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@&address@hidden: $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
]
)
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1e19657..6aa5d5c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -394,6 +394,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
index 0000000..c067ccc
--- /dev/null
+++ b/tests/mmode.test
@@ -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
+:
- Re: [PATCH] Implement AM_MAINTAINER_MODE([DEFAULT-MODE]).,
Ralf Wildenhues <=