* automake.in (handle_source_transform): If foo_SOURCES is defined conditionally, create and use am__foo_SOURCES_DIST for distribution. * tests/condd.test: Extend to check distributed files. * tests/substref.test: Make sure we don't use such a variable when it's not needed. Reported by Marcus Brinkmann.