]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
New public macro AM_SUBST_NOTMAKE.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 3 Nov 2008 21:56:22 +0000 (22:56 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Mon, 3 Nov 2008 21:57:06 +0000 (22:57 +0100)
* m4/substnot.m4 (AM_SUBST_NOTMAKE): New public macro; invoke
_AM_SUBST_NOTMAKE with arguments.
* doc/automake.texi (Optional): Document it.
* NEWS: Update.
* tests/subst4.test: New test.
* tests/Makefile.am: Update.
Suggestion by Bruno Haible.

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

index ef3b8f39757fc9c0be6f797b559781c5c0bdefbb..a6c63a2a108a277cab44036fa071a50e82911b26 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2008-11-03  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
+       New public macro AM_SUBST_NOTMAKE.
+       * m4/substnot.m4 (AM_SUBST_NOTMAKE): New public macro; invoke
+       _AM_SUBST_NOTMAKE with arguments.
+       * doc/automake.texi (Optional): Document it.
+       * NEWS: Update.
+       * tests/subst4.test: New test.
+       * tests/Makefile.am: Update.
+       Suggestion by Bruno Haible.
+
        Fix regression introduced by AM_DEFAULT_SOURCE_EXT.
        * automake.in (handle_source_transform): Use the right variable
        when determining whether to apply the old rule for the libtool
diff --git a/NEWS b/NEWS
index 5c7d295a39dbdb217fc8075b8f4e590a5da01d67..483416593026ffd2c67fcd55d8a4de0878c80345 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -114,6 +114,9 @@ New in 1.10a:
   - AM_MAINTAINER_MODE now allows for an optional argument specifying
     the default setting.
 
+  - AM_SUBST_NOTMAKE may prevent substitution of AC_SUBSTed variables,
+    useful especially for multi-line values.
+
 Bugs fixed in 1.10a:
 
 * Long standing bugs:
index acb97cdcc31217596479f33c17fa447e44a67d56..40b5b5d21f322365df4684e63225c6a79138a083 100644 (file)
@@ -2896,7 +2896,8 @@ The Autoconf Manual}.
 
 @item AC_SUBST
 The first argument is automatically defined as a variable in each
-generated @file{Makefile.in}.  @xref{Setting Output Variables, , Setting
+generated @file{Makefile.in}, unless @code{AM_SUBST_NOTMAKE} is also
+used for this variable.  @xref{Setting Output Variables, , Setting
 Output Variables, autoconf, The Autoconf Manual}.
 
 If the Autoconf manual says that a macro calls @code{AC_SUBST} for
@@ -2941,6 +2942,17 @@ generated @file{Makefile.in}s, unless @var{default-mode} is
 conditional, which you can use in your own @file{Makefile.am}.
 @xref{maintainer-mode}.
 
+@item AM_SUBST_NOTMAKE(@var{var})
+Prevent Automake from defining a variable @var{var}, even if it is
+substituted by @command{config.status}.  Normally, Automake defines a
+@command{make} variable for each @command{configure} substitution,
+i.e., for each @code{AC_SUBST([@var{var}])}.  This macro prevents that
+definition from Automake.  If @code{AC_SUBST} has not been called
+for this variable, then @code{AM_SUBST_NOTMAKE} has no effects.
+Preventing variable definitions may be useful for substitution of
+multi-line values, where @code{@var{var} = @@@var{value}@@} might yield
+unintended results.
+
 @item m4_include
 Files included by @file{configure.ac} using this macro will be
 detected by Automake and automatically distributed.  They will also
index 5958962bb1ddd6a8ae94f4d9488df9d3ad8615e9..811d28685437681c2c7ee45cd596f4c31d2957e3 100644 (file)
@@ -1,12 +1,19 @@
 ##                                                          -*- Autoconf -*-
-# Copyright (C) 2006  Free Software Foundation, Inc.
+# Copyright (C) 2006, 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 2
+
 # _AM_SUBST_NOTMAKE(VARIABLE)
 # ---------------------------
 # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
 # This macro is traced by Automake.
 AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
index fa2b9a8666eef5ca761275a8a4fe4611b6b21d2b..52c37c54646f2772dd02c6c8158525d6c2e6f4a4 100644 (file)
@@ -574,6 +574,7 @@ subpkg3.test \
 subst.test \
 subst2.test \
 subst3.test \
+subst4.test \
 substref.test \
 substre2.test \
 substtarg.test \
index f063770665ad04227542a73c50cacac9121be96b..04d205c31d52459116b6c9fcba4a98633887eeec 100644 (file)
@@ -727,6 +727,7 @@ subpkg3.test \
 subst.test \
 subst2.test \
 subst3.test \
+subst4.test \
 substref.test \
 substre2.test \
 substtarg.test \
diff --git a/tests/subst4.test b/tests/subst4.test
new file mode 100755 (executable)
index 0000000..02e46bd
--- /dev/null
@@ -0,0 +1,46 @@
+#! /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/>.
+
+# Test AM_SUBST_NOTMAKE.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'EOF'
+myrule="\
+foo: bar
+       echo making \$@ from bar
+       echo \$@ > \$@
+"
+AC_SUBST([myrule])
+AM_SUBST_NOTMAKE([myrule])
+AC_OUTPUT
+EOF
+
+cat > Makefile.am <<'EOF'
+@myrule@
+EOF
+: > bar
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+$MAKE foo
+test -f foo
+: