Bug 56416

Summary: Inconsistent substitution of AC_SUBST variables
Product: [Retired] Red Hat Raw Hide Reporter: Enrico Scholz <rh-bugzilla>
Component: automakeAssignee: Jens Petersen <petersen>
Status: CLOSED CURRENTRELEASE QA Contact: Brian Brock <bbrock>
Severity: low Docs Contact:
Priority: medium    
Version: 1.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-11-10 03:05:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Enrico Scholz 2001-11-17 00:29:29 UTC
Description of Problem:

When using 'AC_SUBST(FOO)' in configure.ac directly, automake generates a
variable

| FOO = @FOO@

in each Makefile.in. This works also when using AC_SUBST() in an AC_DEFUN
and specifiying the varname explicitely, but it fails if a '$...'
parametername is used.


Version-Release number of selected component (if applicable):

autoconf-2.52-3
automake-1.5-1


How Reproducible:

everytime


Steps to Reproduce:
1. cat <<EOF >configure.ac
AC_INIT(foo, 0.0.1)
AM_INIT_AUTOMAKE(foo, 0.0.1, XX)

AC_DEFUN(foo_TEST,
[
        FOOIN=fooin
        AC_SUBST(FOOIN)

        $1=foo
        AC_SUBST($1)
])

BAR=bar

foo_TEST(FOO)
AC_SUBST(BAR)

AC_CONFIG_FILES(Makefile)
AC_OUTPUT
EOF

2. cat <<EOF >Makefile.am 
AUTOMAKE_OPTIONS = foreign

FOO_EXPLICIT    =  @FOO@

all-local:
                @echo "FOO   = '${FOO}'"
                @echo "FOO   = '${FOO_EXPLICIT}'  (explicit)"
                @echo "BAR   = '${BAR}'"
                @echo "FOOIN = '${FOOIN}'"
EOF

3. automake=automake autoreconf -i

4. make


Actual Results:

FOO   = ''
FOO   = 'foo'  (explicit)
BAR   = 'bar'
FOOIN = 'fooin'


Expected Results:

FOO   = 'foo'
FOO   = 'foo'  (explicit)
BAR   = 'bar'
FOOIN = 'fooin'

Comment 1 Enrico Scholz 2001-11-17 00:35:58 UTC
An alternative expected result would be

FOO   = ''
FOO   = 'foo'  (explicit)
BAR   = ''
FOOIN = ''

There the behavior of AC_SUBST is more consistent.

Comment 2 Tom Tromey 2001-11-26 19:56:58 UTC
This is a known bug in automake.

In 1.5 and earlier releases, automake configure.in scanning
was relatively dumb.  It did only textual scanning of configure.in
and related files.  So things like your code confused it.

An upcoming automake release will fix this by using autoconf's
"trace" facility to more correctly scan configure.in.
No one knows when this release will happen, however.


Comment 3 Jens Petersen 2002-03-27 06:25:03 UTC
moved to automake15 component

Comment 4 Jens Petersen 2002-07-09 08:18:25 UTC
With autoconf-2.53-7 and automake-1.6.2-1 I still get:

FOO   = ''
FOO   = 'foo'  (explicit)
BAR   = 'bar'
FOOIN = 'fooin'

(Did you mean "AUTOMAKE=automake" by "automake=automake"?)


[Just btw: "cat <<EOF >file" doesn't work so well here for me
since my shell expands the embedded "$VAR"'s and the tabs
in "Makefile.am" are lost.]


Comment 5 Jens Petersen 2003-11-10 03:05:02 UTC
With automake-1.7.8 and autoconf-2.58 I now see
the expected result.  I suspect this is probably
fixed in all 1.7.x.