From 861c19856121d8e875e30268dee6033ded6fc7ae Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Mon, 1 Sep 2008 20:29:58 +0200 Subject: [PATCH] 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. Signed-off-by: Ralf Wildenhues --- ChangeLog | 11 ++++++++ NEWS | 3 +++ doc/automake.texi | 35 ++++++++++++++----------- m4/maintainer.m4 | 31 +++++++++++++++------- tests/Makefile.am | 1 + tests/Makefile.in | 1 + tests/mmode.test | 67 +++++++++++++++++++++++++++++++++++++++++++++++ 7 files changed, 124 insertions(+), 25 deletions(-) create mode 100755 tests/mmode.test diff --git a/ChangeLog b/ChangeLog index d49d6307d..a51a6e271 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-09-01 Ralf Wildenhues + + 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 Copyright year updates. diff --git a/NEWS b/NEWS index bd1f369b8..a2b336ea6 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 265a3f8ab..0ea578097 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}. -@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 diff --git a/m4/maintainer.m4 b/m4/maintainer.m4 index 1c15c980f..0b54e67ed 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@&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 ] ) diff --git a/tests/Makefile.am b/tests/Makefile.am index 1e19657c2..6aa5d5c46 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/Makefile.in b/tests/Makefile.in index 969a57bb0..783ab8beb 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -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 index 000000000..c067ccc89 --- /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 . + +# 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 +: -- 2.47.2