On 08/17/2017 01:29 AM, Mathieu Lirzin wrote:
> Michael Haubenwallner <michael.haubenwall...@ssi-schaefer.com> writes:
>> On 08/08/2017 11:17 PM, Mathieu Lirzin wrote:
>>> Michael Haubenwallner <michael.haubenwall...@ssi-schaefer.com> writes:

>>
>> This change fixes automake bug#27781.
>>
>> * bin/automake.in: Add Makefile dependency on LIBOBJDIR/dirstamp for
>> each LIBOBJS/ALLOCA variable used.
>> ---
> 
> Excellent!
> 
> To ensure this bug is not reintroduced later, I think it is important to
> combine this patch with a test.  Are you willing to look into adding
> one?

Ok - like this one?

Thanks!
/haubi/
>From 5c6e104ae5f2fa6d276fcc662d27ef046e77750d Mon Sep 17 00:00:00 2001
From: Michael Haubenwallner <michael.haubenwall...@ssi-schaefer.com>
Date: Thu, 17 Aug 2017 14:12:20 +0200
Subject: [PATCH] automake: add test for PR 27781

Add test for LIBOBJ_DIR containing nothing else but LIBOBJS source
files, in out of source build with dependency tracking disabled,
reported as PR 27781.
* t/pr27781.sh: New file.
* t/list-of-tests.mk (handwritten_TESTS): Add t/pr27781.sh.
---
 t/list-of-tests.mk |  1 +
 t/pr27781.sh       | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)
 create mode 100644 t/pr27781.sh

diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 051ac0c..8680483 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -886,6 +886,7 @@ t/pr307.sh \
 t/pr401.sh \
 t/pr401b.sh \
 t/pr401c.sh \
+t/pr27781.sh \
 t/prefix.sh \
 t/preproc-basics.sh \
 t/preproc-c-compile.sh \
diff --git a/t/pr27781.sh b/t/pr27781.sh
new file mode 100644
index 0000000..15e2da1
--- /dev/null
+++ b/t/pr27781.sh
@@ -0,0 +1,64 @@
+#! /bin/sh
+# Copyright (C) 2017 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 2, 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 for PR 27781.
+#
+# == Description ==
+# Suppose you have some LIBOBJS source files in a separate LIBOBJ_DIR,
+# but nothing else, even not some Makefile.
+# Now in an out of source build, with dependency tracking disabled,
+# there is nothing else that requires the LIBOBJ_DIR within the
+# build directory - except for the LIBOBJS files.
+#
+# This has happened with flex-2.6.4 when malloc.o was required,
+# reported as https://github.com/westes/flex/issues/244.
+#
+# We have to make sure the LIBOBJ_DIR is a prerequisite of the
+# LIBOBJS files in the Makefile using LIBOBJS.
+#
+
+. test-init.sh
+
+cat >> configure.ac << 'END'
+AC_PROG_CC
+AC_CONFIG_LIBOBJ_DIR(foo)
+AC_LIBOBJ(foo)
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = helldl
+LDADD = $(LIBOBJS)
+.PHONY: test-pr27781
+test-pr27781: $(LIBOBJS)
+END
+
+mkdir foo
+cat > foo/foo.c << 'END'
+int foo() { return 0; }
+END
+
+mkdir build
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+cd build
+../configure --disable-dependency-tracking
+run_make test-pr27781
+
+:
-- 
2.10.2

Reply via email to