Subject: bug#7562: automake-set variables don't get properly reordered when overriden in Makefile.am

From: Stefano Lattarini <[email-masked]>
Date: Sun, 5 Dec 2010 18:34:33 +0100

Severity: wishlist

This issue was brought up by Ralf Wildenhues in a thread on automake-patches.

Automake generally orders all of its variable settings before all of the user
ones (so the user ones are preferred).  But when one overrides e.g. bindir in
a Makefile.am, that variable doesn't get reordered to the user part, because
it is actually automake-set before it is overridden.  The issue is exposed in
the attached testcase.

It's still not clear to me whether this is a bug or a feature, but I thought
that entering it into the Automake bug database would be a good idea anyway.

Regards,
   Stefano

#! /bin/sh

# Test that := definitions work as expected at make time, even when
# whey involve user-overridden automake-set variables.
#
# Currently, this test doesn't work, because automake generally orders
# all of its variable settings (e.g. bindir and the like) before all
# of the user ones.  Even when  bindir is overridden, it doesn't get
# reordered to the user part.  Might this be considered an automake bug?

required=GNUmake
. ./defs || Exit 1

set -e

cat >> configure.in << 'END'
AC_OUTPUT
END

cat > Makefile.am << 'END'
BAR := $(bindir)
BAZ = $(bindir)
bindir = foo
.PHONY: test
test:
	test x'$(bindir)' = x'foo'
	test x'$(BAZ)' = x'foo'
	test x'$(BAR)' = x
END

$ACLOCAL
$AUTOCONF
$AUTOMAKE -Wno-portability

./configure
$MAKE test

: