summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-03-16 23:48:53 +0100
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-03-18 19:29:45 +0100
commit368f1c4c295e3cc4c442af986a1cbb0daa16e3ad (patch)
tree4522c47291f88f86fd3da5ab289c198b84201ee2
parent6743961843f3d810500aabe20cfe2cb0e9ae5839 (diff)
downloadautomake-368f1c4c295e3cc4c442af986a1cbb0daa16e3ad.tar.gz
install: don't create empty dirs when an empty 'foo_PRIMARY' is used
Fixes automake bug#11030 and bug#10997. An empty declaration of "foo_PRIMARY" in a Makefile.am used to cause the generated install rules to create the directory $(foodir) anyway, even if nothing was to be installed there. While this could be seen as a convenient way to create a $(foodir) directory upon "make install" (respecting $(DESTDIR) settings and such), it also caused problems with conditionals; for example, an input of: if FALSE pgkdata_DATA = something endif caused the generated install rules to unconditionally create the $(pkgdatadir) directory (see automake bug#10997). Also, a user wanting to create an empty directory upon installation can easily do so with a custom install hook, as in: installdirs-local: $(MKDIR_P) $(DESTDIR)$(foodir) install-data-hook: installdirs-local On the other hand, the old behavior of "always create $(foodir), even if 'foo_PRIMARY' is empty" was harder and more tricky to override. Thus, from now on, an empty declaration of "foo_PRIMARY" will not cause the directory $(foodir) to be created upon "make install" anymore. * lib/am/data.am, lib/am/java.am, lib/am/libs.am, lib/am/lisp.am, lib/am/ltlib.am, lib/am/mans.am, lib/am/progs.am, lib/am/python.am, lib/am/scripts.am, lib/am/texinfos.am: Adjust install rules to avoid creating an installation directory if no files are actually to be installed there. * tests/instdir-empty.test: Remove, it was testing a semantic opposite to the one we now want and implement. * tests/instdir-no-empty.test: New test, check the new semantic. * tests/instdir-cond.test: Enhance. Move the still-failing part of the test ... * tests/instdir-cond2.test: ... here. * tests/list-of-tests.mk, tests/Makefile.am (XFAIL_TESTS): Update. * tests/java3.test: Adjust to avoid spurious failures. * HACKING, NEWS, THANKS: Update. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
-rw-r--r--HACKING3
-rw-r--r--NEWS11
-rw-r--r--THANKS1
-rw-r--r--lib/am/data.am14
-rw-r--r--lib/am/java.am6
-rw-r--r--lib/am/libs.am12
-rw-r--r--lib/am/lisp.am11
-rw-r--r--lib/am/ltlib.am12
-rw-r--r--lib/am/mans.am38
-rw-r--r--lib/am/progs.am8
-rw-r--r--lib/am/python.am9
-rw-r--r--lib/am/scripts.am8
-rw-r--r--lib/am/texinfos.am28
-rw-r--r--tests/Makefile.am2
-rwxr-xr-xtests/installdir.test36
-rw-r--r--tests/instdir-cond.test3
-rw-r--r--tests/instdir-cond2.test (renamed from tests/instdir-empty.test)47
-rwxr-xr-xtests/instdir-no-empty.test123
-rwxr-xr-xtests/java3.test5
-rw-r--r--tests/list-of-tests.mk3
20 files changed, 303 insertions, 77 deletions
diff --git a/HACKING b/HACKING
index 5420fbcad..8b5cdb930 100644
--- a/HACKING
+++ b/HACKING
@@ -75,6 +75,9 @@
"important" command it runs. The printed commands should be preceded
by a single space.
+* Ensure install rules do not create any installation directory where
+ nothing is to be actually installed. See automake bug#11030.
+
================================================================
= Editing automake.in and aclocal.in
diff --git a/NEWS b/NEWS
index 2b5f68f4d..5d463da38 100644
--- a/NEWS
+++ b/NEWS
@@ -171,6 +171,17 @@ Bugs fixed in 1.11.0a:
* Long-standing bugs:
+ - An empty declaration of a "foo_PRIMARY" don't cause anymore the
+ generated install rules to create an empty $(foodir) directory;
+ for example, if Makefile.am contains something like:
+
+ pkglibexec_SCRIPTS =
+ if FALSE
+ pkglibexec_SCRIPTS += bar.sh
+ endif
+
+ the $(pkglibexec) directory will not be created upon "make install".
+
- It is now possible for a foo_SOURCES variable to hold Vala sources
together with C header files, as well as with sources and headers for
other supported languages (e.g., C++). Previously, only mixing C and
diff --git a/THANKS b/THANKS
index d7b36585f..e0c44d7b6 100644
--- a/THANKS
+++ b/THANKS
@@ -64,6 +64,7 @@ Christina Gratorp christina.gratorp@gmail.com
Claudio Fontana sick_soul@yahoo.it
Clifford Wolf clifford@clifford.at
Dagobert Michelsen dam@opencsw.org
+Daiki Ueno ueno@unixuser.org
Dalibor Topic robilad@kaffe.org
danbp danpb@nospam.postmaster.co.uk
Daniel Jacobowitz drow@false.org
diff --git a/lib/am/data.am b/lib/am/data.am
index 1817447de..98a38a832 100644
--- a/lib/am/data.am
+++ b/lib/am/data.am
@@ -1,6 +1,5 @@
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1998, 1999, 2001, 2003, 2004, 2006,
-## 2007, 2008, 2009 Free Software Foundation, Inc.
+## Copyright (C) 1994-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
@@ -28,11 +27,14 @@ am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
.PHONY install-%EXEC?exec:data%-am: install-%DIR%%PRIMARY%
install-%DIR%%PRIMARY%: $(%DIR%_%PRIMARY%)
@$(NORMAL_INSTALL)
- test -z "$(%NDIR%dir)" || $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"
if %?BASE%
## Funny invocation because Makefile variable can be empty, leading to
## a syntax error in sh.
@list='$(%DIR%_%PRIMARY%)'; test -n "$(%NDIR%dir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+ $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)' || exit 1; \
+ fi; \
for p in $$list; do \
## A file can be in the source directory or the build directory.
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
@@ -47,13 +49,17 @@ if %?BASE%
done
else !%?BASE%
@list='$(%DIR%_%PRIMARY%)'; test -n "$(%NDIR%dir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
+ fi; \
$(am__nobase_list) | while read dir files; do \
xfiles=; for file in $$files; do \
if test -f "$$file"; then xfiles="$$xfiles $$file"; \
else xfiles="$$xfiles $(srcdir)/$$file"; fi; done; \
test -z "$$xfiles" || { \
test "x$$dir" = x. || { \
- echo "$(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
$(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
echo " $(INSTALL_%ONE_PRIMARY%) $$xfiles '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
$(INSTALL_%ONE_PRIMARY%) $$xfiles "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; }; \
diff --git a/lib/am/java.am b/lib/am/java.am
index 464b70609..6c163b56f 100644
--- a/lib/am/java.am
+++ b/lib/am/java.am
@@ -1,6 +1,5 @@
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1998, 1999, 2001, 2003, 2004, 2006, 2008, 2009 Free Software
-## Foundation, Inc.
+## Copyright (C) 1998-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
@@ -48,11 +47,12 @@ am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
?!EXEC?.PHONY install-data-am: install-%DIR%JAVA
install-%DIR%JAVA: class%NDIR%.stamp
@$(NORMAL_INSTALL)
- test -z "$(%NDIR%dir)" || $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"
## A single .java file can be compiled into multiple .class files. So
## we just install all the .class files that got built into this
## directory. This is not optimal, but will have to do for now.
@test -n "$(%DIR%_JAVA)" && test -n "$(%NDIR%dir)" || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"; \
set x *.class; shift; test "$$1" != "*.class" || exit 0; \
echo " $(INSTALL_DATA)" "$$@" "'$(DESTDIR)$(%NDIR%dir)/$$p'"; \
$(INSTALL_DATA) "$$@" "$(DESTDIR)$(%NDIR%dir)"
diff --git a/lib/am/libs.am b/lib/am/libs.am
index 29f630b76..4006bd008 100644
--- a/lib/am/libs.am
+++ b/lib/am/libs.am
@@ -1,6 +1,5 @@
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
-## 2007, 2008, 2009 Free Software Foundation, Inc.
+## Copyright (C) 1994-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
@@ -28,7 +27,6 @@ am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
.PHONY install-%EXEC?exec:data%-am: install-%DIR%LIBRARIES
install-%DIR%LIBRARIES: $(%DIR%_LIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(%NDIR%dir)" || $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"
if %?BASE%
## Funny invocation because Makefile variable can be empty, leading to
## a syntax error in sh.
@@ -39,18 +37,24 @@ if %?BASE%
else :; fi; \
done; \
test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(%NDIR%dir)'"; \
$(INSTALL_DATA) $$list2 "$(DESTDIR)$(%NDIR%dir)" || exit $$?; }
else !%?BASE%
## Funny invocation because Makefile variable can be empty, leading to
## a syntax error in sh.
@list='$(%DIR%_LIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+ $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)' || exit 1; \
+ fi; \
$(am__nobase_list) | while read dir files; do \
xfiles=; for p in $$files; do \
if test -f "$$p"; then xfiles="$$xfiles $$p"; else :; fi; done; \
test -z "$$xfiles" || { \
test "x$$dir" = x. || { \
- echo "$(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
$(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
$(INSTALL_DATA) $$xfiles "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; }; \
diff --git a/lib/am/lisp.am b/lib/am/lisp.am
index 0194c1bd1..968439f32 100644
--- a/lib/am/lisp.am
+++ b/lib/am/lisp.am
@@ -1,6 +1,5 @@
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-## 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+## Copyright (C) 1996-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
@@ -90,11 +89,15 @@ install-%DIR%LISP: $(%DIR%_LISP) $(ELCFILES)
@$(NORMAL_INSTALL)
## Do not install anything if EMACS was not found.
@if test "$(EMACS)" != no && test -n "$(%NDIR%dir)"; then \
- $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"; \
?!BASE? $(am__vpath_adj_setup) \
## Funny invocation because Makefile variable can be empty, leading to
## a syntax error in sh.
- list='$(%DIR%_LISP)'; for p in $$list; do \
+ list='$(%DIR%_LISP)'; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
## A lisp file can be in the source directory or the build directory.
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
%BASE?$(am__strip_dir):$(am__vpath_adj)% \
diff --git a/lib/am/ltlib.am b/lib/am/ltlib.am
index 29aa00ce7..65210c153 100644
--- a/lib/am/ltlib.am
+++ b/lib/am/ltlib.am
@@ -1,6 +1,5 @@
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004,
-## 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+## Copyright (C) 1994-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
@@ -28,7 +27,6 @@ am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
.PHONY install-%EXEC?exec:data%-am: install-%DIR%LTLIBRARIES
install-%DIR%LTLIBRARIES: $(%DIR%_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(%NDIR%dir)" || $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"
if %?BASE%
## Funny invocation because Makefile variable can be empty, leading to
## a syntax error in sh.
@@ -39,6 +37,8 @@ if %?BASE%
else :; fi; \
done; \
test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+ $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)' || exit 1; \
## Note that we explicitly set the libtool mode. This avoids any lossage
## if the program doesn't have a name that libtool expects.
## Use INSTALL and not INSTALL_DATA because libtool knows the right
@@ -50,6 +50,10 @@ if %?BASE%
}
else !%?BASE%
@list='$(%DIR%_LTLIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
+ fi; \
for p in $$list; do if test -f "$$p"; then echo "$$p $$p"; else :; fi; done | \
sed '/ .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { cur = "." } \
@@ -59,7 +63,7 @@ else !%?BASE%
while read dir files; do \
test -z "$$files" || { \
test "x$$dir" = x. || { \
- echo "$(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
$(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
## Note that we explicitly set the libtool mode. This avoids any lossage
## if the program doesn't have a name that libtool expects.
diff --git a/lib/am/mans.am b/lib/am/mans.am
index b41a94d18..b0d5335b9 100644
--- a/lib/am/mans.am
+++ b/lib/am/mans.am
@@ -1,6 +1,5 @@
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1998, 2001, 2003, 2004, 2006, 2008, 2009 Free Software
-## Foundation, Inc.
+## Copyright (C) 1998-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
@@ -31,16 +30,24 @@ man%SECTION%dir = $(mandir)/man%SECTION%
.PHONY install-man: install-man%SECTION%
install-man%SECTION%: %DEPS%
@$(NORMAL_INSTALL)
- test -z "$(man%SECTION%dir)" || $(MKDIR_P) "$(DESTDIR)$(man%SECTION%dir)"
if %?NOTRANS_MANS%
## Handle MANS with notrans_ prefix
- @list='%NOTRANS_SECT_LIST%'; test -n "$(man%SECTION%dir)" || exit 0; \
- { for i in $$list; do echo "$$i"; done; \
+ @list1='%NOTRANS_SECT_LIST%'; \
+?!HAVE_NOTRANS? list2=''; \
+?HAVE_NOTRANS? list2='%NOTRANS_LIST%'; \
+ test -n "$(man%SECTION%dir)" \
+ && case "$$list1$$list2" in *[^\ ]*) :;; *) false;; esac \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man%SECTION%dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man%SECTION%dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
## Extract all items from notrans_man_MANS that should go in this section.
## This must be done dynamically to support conditionals.
-?HAVE_NOTRANS? l2='%NOTRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
## Accept for `man1' files like `foo.1c' but not `sub.1/foo.2' or `foo-2.1.4'.
-?HAVE_NOTRANS? sed -n '/\.%SECTION%[a-z]*$$/p'; \
+ | sed -n '/\.%SECTION%[a-z]*$$/p'; \
+ fi; \
## Extract basename of manpage, change the extension if needed.
} | while read p; do \
## Find the file.
@@ -66,13 +73,22 @@ if %?NOTRANS_MANS%
endif %?NOTRANS_MANS%
if %?TRANS_MANS%
## Handle MANS without notrans_ prefix
- @list='%TRANS_SECT_LIST%'; test -n "$(man%SECTION%dir)" || exit 0; \
- { for i in $$list; do echo "$$i"; done; \
+ @list1='%TRANS_SECT_LIST%'; \
+?!HAVE_TRANS? list2=''; \
+?HAVE_TRANS? list2='%TRANS_LIST%'; \
+ test -n "$(man%SECTION%dir)" \
+ && case "$$list1$$list2" in *[^\ ]*) :;; *) false;; esac \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man%SECTION%dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man%SECTION%dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
## Extract all items from notrans_man_MANS that should go in this section.
## This must be done dynamically to support conditionals.
-?HAVE_TRANS? l2='%TRANS_LIST%'; for i in $$l2; do echo "$$i"; done | \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
## Accept for `man1' files like `foo.1c' but not `sub.1/foo.2' or `foo-2.1.4'.
-?HAVE_TRANS? sed -n '/\.%SECTION%[a-z]*$$/p'; \
+ | sed -n '/\.%SECTION%[a-z]*$$/p'; \
+ fi; \
## Extract basename of manpage, change the extension if needed.
} | while read p; do \
## Find the file.
diff --git a/lib/am/progs.am b/lib/am/progs.am
index d39b23dbb..da262772f 100644
--- a/lib/am/progs.am
+++ b/lib/am/progs.am
@@ -1,6 +1,5 @@
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004,
-## 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+## Copyright (C) 1994-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
@@ -24,10 +23,13 @@ am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
.PHONY install-%EXEC?exec:data%-am: install-%DIR%PROGRAMS
install-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
@$(NORMAL_INSTALL)
- test -z "$(%NDIR%dir)" || $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"
## Funny invocation because Makefile variable can be empty, leading to
## a syntax error in sh.
@list='$(%DIR%_PROGRAMS)'; test -n "$(%NDIR%dir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
+ fi; \
for p in $$list; do echo "$$p $$p"; done | \
## On Cygwin with libtool test won't see `foo.exe' but instead `foo'.
## So we check for both.
diff --git a/lib/am/python.am b/lib/am/python.am
index bb2748cd2..cab61294a 100644
--- a/lib/am/python.am
+++ b/lib/am/python.am
@@ -29,9 +29,12 @@ am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
.PHONY install-%EXEC?exec:data%-am: install-%DIR%PYTHON
install-%DIR%PYTHON: $(%DIR%_PYTHON)
@$(NORMAL_INSTALL)
- test -z "$(%NDIR%dir)" || $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"
if %?BASE%
@list='$(%DIR%_PYTHON)'; dlist=; list2=; test -n "$(%NDIR%dir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
+ fi; \
for p in $$list; do \
## A file can be in the source directory or the build directory.
if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \
@@ -58,6 +61,10 @@ if %?BASE%
else :; fi
else !%?BASE%
@list='$(%DIR%_PYTHON)'; test -n "$(%NDIR%dir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
+ fi; \
$(am__nobase_list) | while read dir files; do \
xfiles=; for p in $$files; do \
## A file can be in the source directory or the build directory.
diff --git a/lib/am/scripts.am b/lib/am/scripts.am
index 346f0d3b9..64e093e64 100644
--- a/lib/am/scripts.am
+++ b/lib/am/scripts.am
@@ -1,6 +1,5 @@
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1998, 1999, 2001, 2003, 2004, 2006, 2007,
-## 2008, 2009 Free Software Foundation, Inc.
+## Copyright (C) 1994-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
@@ -29,10 +28,13 @@ am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
.PHONY install-%EXEC?exec:data%-am: install-%DIR%SCRIPTS
install-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
@$(NORMAL_INSTALL)
- test -z "$(%NDIR%dir)" || $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"
## Funny invocation because Makefile variable can be empty, leading to
## a syntax error in sh.
@list='$(%DIR%_SCRIPTS)'; test -n "$(%NDIR%dir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
+ fi; \
?!BASE? $(am__nobase_strip_setup); \
for p in $$list; do \
## A file can be in the source directory or the build directory.
diff --git a/lib/am/texinfos.am b/lib/am/texinfos.am
index 5314dec8d..9190e8fb4 100644
--- a/lib/am/texinfos.am
+++ b/lib/am/texinfos.am
@@ -1,7 +1,6 @@
## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-## 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+## Copyright (C) 1994-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
@@ -143,8 +142,11 @@ include inst-vars.am
install-dvi-am: $(DVIS)
@$(NORMAL_INSTALL)
- test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)"
@list='$(DVIS)'; test -n "$(dvidir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -156,8 +158,11 @@ install-dvi-am: $(DVIS)
install-html-am: $(HTMLS)
@$(NORMAL_INSTALL)
- test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)"
@list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
$(am__strip_dir) \
@@ -184,9 +189,12 @@ install-html-am: $(HTMLS)
install-info-am: $(INFO_DEPS)
@$(NORMAL_INSTALL)
- test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \
+ fi; \
for file in $$list; do \
## Strip possible $(srcdir) prefix.
case $$file in \
@@ -242,8 +250,11 @@ install-info-am: $(INFO_DEPS)
install-pdf-am: $(PDFS)
@$(NORMAL_INSTALL)
- test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)"
@list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
@@ -254,8 +265,11 @@ install-pdf-am: $(PDFS)
install-ps-am: $(PSS)
@$(NORMAL_INSTALL)
- test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)"
@list='$(PSS)'; test -n "$(psdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9cac904a1..b2a8e053b 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -25,7 +25,7 @@ dist-auxfile.test \
dist-auxfile-2.test \
dist-pr109765.test \
gcj6.test \
-instdir-cond.test \
+instdir-cond2.test \
java-nobase.test \
objext-pr10128.test \
pr8365-remake-timing.test \
diff --git a/tests/installdir.test b/tests/installdir.test
index b09f49534..2fc1285ec 100755
--- a/tests/installdir.test
+++ b/tests/installdir.test
@@ -1,5 +1,5 @@
#! /bin/sh
-# Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2001-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
@@ -15,17 +15,47 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test for PR 203.
+# See also automake bug#11030.
. ./defs || Exit 1
set -e
+echo AC_OUTPUT >> configure.in
+
cat > Makefile.am << 'END'
+foodir = $(datadir)/$(distdir)
installdirs-local:
- @echo here
+ $(MKDIR_P) $(DESTDIR)$(foodir)
+install-data-hook: installdirs-local
END
$ACLOCAL
$AUTOMAKE
-test `grep installdirs-local Makefile.in | wc -l` -eq 3
+test `grep installdirs-local Makefile.in | wc -l` -eq 4
+
+cwd=`pwd` || fatal_ "getting current working directory"
+
+$AUTOCONF
+./configure --prefix="$cwd/inst"
+
+$MAKE installdirs
+test -d inst/share/$me-1.0
+rm -rf inst
+
+$MAKE install
+test -d inst/share/$me-1.0
+rm -rf inst
+
+./configure --prefix=/foo
+
+$MAKE installdirs DESTDIR="$cwd/dest"
+test -d dest/foo/share/$me-1.0
+rm -rf dest
+
+$MAKE install DESTDIR="$cwd/dest"
+test -d dest/foo/share/$me-1.0
+rm -rf dest
+
+:
diff --git a/tests/instdir-cond.test b/tests/instdir-cond.test
index 8d83f8826..9cdd81063 100644
--- a/tests/instdir-cond.test
+++ b/tests/instdir-cond.test
@@ -30,9 +30,10 @@ END
: > bar
cat > Makefile.am << 'END'
+pkglibexec_SCRIPTS =
if ENABLE_FOO
pkgdata_DATA = foo
-pkglibexec_SCRIPTS = bar
+pkglibexec_SCRIPTS += bar
endif
END
diff --git a/tests/instdir-empty.test b/tests/instdir-cond2.test
index f69958349..6cdc26d2e 100644
--- a/tests/instdir-empty.test
+++ b/tests/instdir-cond2.test
@@ -14,45 +14,40 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# An empty "foo_PRIMARY" declaration should cause "make install" to create
-# directory $(foodir). Suggested in discussion on automake bug#10997.
+# Check against automake bug#10997: directories holding only
+# conditionally-installed files should not be created unconditionally.
+# FIXME: this test tries to check that the above also hold for the
+# FIXME: "installdirs" target, but that doesn't currently work :-(
+# FIXME: So this test is still xfailing.
+# See sister test 'instdir-cond.test' for the succeeding part.
. ./defs || Exit 1
set -e
-echo AC_OUTPUT >> configure.in
+cat >> configure.in << 'END'
+AM_CONDITIONAL([ENABLE_FOO], [false])
+AC_OUTPUT
+END
+
+: > foo
+: > bar
cat > Makefile.am << 'END'
-pkgdata_DATA =
-libexec_SCRIPTS =
+pkglibexec_SCRIPTS =
+if ENABLE_FOO
+pkgdata_DATA = foo
+pkglibexec_SCRIPTS += bar
+endif
END
$ACLOCAL
$AUTOMAKE
$AUTOCONF
-cwd=`pwd`
-./configure --prefix="$cwd/inst"
-
-$MAKE install
-test -d inst/share/$me
-test -d inst/libexec
-rm -rf inst
-
-$MAKE install-exec
-test ! -d inst/share
-test -d inst/libexec
-rm -rf inst
-
-$MAKE install-data
-test -d inst/share/$me
-test ! -d inst/libexec
-rm -rf inst
+./configure --prefix="`pwd`/inst"
-./configure --prefix=/foo
-$MAKE install DESTDIR=$cwd/dest
-test -d dest/foo/share/$me
-test -d dest/foo/libexec
+$MAKE installdirs
+test ! -d inst || { find inst; Exit 1; }
:
diff --git a/tests/instdir-no-empty.test b/tests/instdir-no-empty.test
new file mode 100755
index 000000000..cf579969c
--- /dev/null
+++ b/tests/instdir-no-empty.test
@@ -0,0 +1,123 @@
+#! /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/>.
+
+# An empty "foo_PRIMARY" declaration should *not* cause "make install"
+# to create directory $(foodir). See automake bug#10997 and bug#11030.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<END
+AC_SUBST([CC], [whatever])
+AC_SUBST([JAVAC], [whatever])
+AM_PATH_PYTHON(,,:)
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = no-dependencies
+mydir = $(prefix)/my
+myexecdir = $(prefix)/myexec
+javadir = $(prefix)/java
+END
+
+# Write Makefile.am.
+{
+
+ for dir in sbin bin libexec pkglibexec myexec; do
+ for dst in '' dist_ nodist_; do
+ echo "${dst}${dir}_SCRIPTS ="
+ done
+ echo "${dir}_PROGRAMS ="
+ done
+
+ for dir in lib pkglib myexec my; do
+ echo "${dir}_LIBRARIES ="
+ echo "${dir}_LTLIBRARIES ="
+ done
+
+ for p1 in '' notrans_; do
+ for p2 in '' dist_ nodist_; do
+ for s in '' 1 2 3 4 5 6 7 8 9; do
+ echo "${p1}${p2}man${s}_MANS ="
+ done
+ done
+ done
+
+ for dst in '' dist_ nodist_; do
+ for dir in dataroot data pkgdata doc lisp my; do
+ echo "${dst}${dir}_DATA ="
+ done
+ for dir in include pkginclude oldinclude my; do
+ echo "${dst}${dir}_HEADERS ="
+ done
+ for dir in python my; do
+ echo "${dst}${dir}_PYTHON ="
+ done
+ for dir in info my; do
+ echo "${dst}${dir}_TEXINFOS ="
+ done
+ for dir in java my; do
+ echo "${dst}${dir}_JAVA ="
+ done
+ for dir in lisp my; do
+ echo "${dst}${dir}_LISP ="
+ done
+ done
+
+} > t
+
+cat t >> Makefile.am
+sed 's/^/nobase_/' t >> Makefile.am
+rm -f t
+
+cat Makefile.am # For debugging.
+
+# Sanity check.
+grep '^oldinclude_HEADERS =' Makefile.am \
+ && grep '^nodist_my_PYTHON =' Makefile.am \
+ && grep '^notrans_dist_man5_MANS =' Makefile.am \
+ || fatal_ "creating Makefile.am"
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+cwd=`pwd` || fatal_ "getting current working directory"
+
+doinst ()
+{
+ $MAKE install install-pdf install-ps install-dvi ${1+"$@"}
+}
+
+: > foo.sh
+
+./configure --prefix="$cwd/inst"
+doinst
+test ! -d inst || { find inst; Exit 1; }
+$MAKE uninstall
+doinst bin_SCRIPTS=foo.sh
+test -f inst/bin/foo.sh
+
+./configure
+doinst DESTDIR="$cwd/dest"
+test ! -d dest || { find dest; Exit 1; }
+$MAKE uninstall
+doinst DESTDIR="$cwd/dest" bin_SCRIPTS=foo.sh
+test -f dest/usr/local/bin/foo.sh
+
+:
diff --git a/tests/java3.test b/tests/java3.test
index e1850a819..5701d8fd1 100755
--- a/tests/java3.test
+++ b/tests/java3.test
@@ -48,8 +48,11 @@ cwd=`pwd` || Exit 1
./configure --prefix="$cwd/_inst"
$MAKE
$MAKE install
-ls -l . _inst/java # For debugging.
+ls -l .
find . -name '*.class' | grep . && Exit 1
+# If we have nothing to install, we shouldn't create any installation
+# directory. Related to automake bug#11030.
+test ! -d _inst
$MAKE uninstall
$MAKE distcheck
diff --git a/tests/list-of-tests.mk b/tests/list-of-tests.mk
index f9109c060..328083371 100644
--- a/tests/list-of-tests.mk
+++ b/tests/list-of-tests.mk
@@ -464,7 +464,8 @@ instdat2.test \
instdir.test \
instdir2.test \
instdir-cond.test \
-instdir-empty.test \
+instdir-cond2.test \
+instdir-no-empty.test \
instdir-java.test \
instdir-lisp.test \
instdir-ltlib.test \