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
- 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:
@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
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
## -*- 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($@)])
subst.test \
subst2.test \
subst3.test \
+subst4.test \
substref.test \
substre2.test \
substtarg.test \
subst.test \
subst2.test \
subst3.test \
+subst4.test \
substref.test \
substre2.test \
substtarg.test \
--- /dev/null
+#! /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
+: