Subject: Re: bug#10997: pkglibexecdir is unconditionally created when make install

From: Stefano Lattarini <[email-masked]>
Date: Mon, 12 Mar 2012 11:52:47 +0100

severity 10997 minor
thanks

Hi Daiki, thanks for the report.

On 03/12/2012 05:55 AM, Daiki Ueno wrote:
> I got a bug report for my package, which conditionally installs some
> scripts into pkglibexecdir like this:
> 
> if ENABLE_FOO
> pkglibexec_SCRIPTS = bar
> endif
> 
> where pkglibexec* is not referred outside of if...endif.  When "make
> install", automake creates pkglibexecdir even when ENABLE_FOO is false.
> 
> I'm attaching a prove which demonstrates the behavior.
>
I agree it would be nice to avoid creating directories that are not actually
needed; still, this is a low-priority bug, and I'm not yet sure how difficult
it would be to fix.  For the moment, I've committed (in your name) the test
case you've sent us (with minor tweakings), so that the bug will at least
remain exposed in the testsuite.  Attached is the patch I've pushed (to maint).

Thanks,
  Stefano
>From b153660787dd7dea409ad969c29393c105e13bf2 Mon Sep 17 00:00:00 2001
Message-Id: <b15366078[email-masked]>
From: Daiki Ueno <[email-masked]>
Date: Mon, 12 Mar 2012 11:46:04 +0100
Subject: [PATCH] coverage: expose automake bug#10997

* tests/instdir-cond.test: New test.
* tests/list-of-tests.mk: Add it.
* tests/Makefile.am (XFAIL_TESTS): Likewise.

Copyright-paperwork-exempt: yes
Signed-off-by: Stefano Lattarini <[email-masked]>
---
 tests/Makefile.am       |    1 +
 tests/instdir-cond.test |   49 +++++++++++++++++++++++++++++++++++++++++++++++
 tests/list-of-tests.mk  |    1 +
 3 files changed, 51 insertions(+), 0 deletions(-)
 create mode 100644 tests/instdir-cond.test

diff --git a/tests/Makefile.am b/tests/Makefile.am
index b8ede30..9cac904 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,6 +25,7 @@ dist-auxfile.test \
 dist-auxfile-2.test \
 dist-pr109765.test \
 gcj6.test \
+instdir-cond.test \
 java-nobase.test \
 objext-pr10128.test \
 pr8365-remake-timing.test \
diff --git a/tests/instdir-cond.test b/tests/instdir-cond.test
new file mode 100644
index 0000000..8d83f88
--- /dev/null
+++ b/tests/instdir-cond.test
@@ -0,0 +1,49 @@
+#! /bin/sh
+# Copyright (C) 2012 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/>.
+
+# Check against automake bug#10997: directories holding only
+# conditionally-installed files should not be created unconditionally.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AM_CONDITIONAL([ENABLE_FOO], [false])
+AC_OUTPUT
+END
+
+: > foo
+: > bar
+
+cat > Makefile.am << 'END'
+if ENABLE_FOO
+pkgdata_DATA = foo
+pkglibexec_SCRIPTS = bar
+endif
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure --prefix="`pwd`/inst"
+
+$MAKE install
+test ! -d inst/share/instdir-cond
+test ! -d inst/libexec/instdir-cond
+
+:
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index 023bf3b..7fd0376 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -459,6 +459,7 @@ instdat.test \
 instdat2.test \
 instdir.test \
 instdir2.test \
+instdir-cond.test \
 instdir-java.test \
 instdir-lisp.test \
 instdir-ltlib.test \
-- 
1.7.9