automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Do not create conditional installation directories


From: Ralf Wildenhues
Subject: Do not create conditional installation directories
Date: Sun, 15 Mar 2009 11:43:03 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

Hello,

I have a patch to let 'make install' not create installation directories
in which no files will end up.  This half-fixes a long-standing TODO
item; so far, one had to work around this with conditionals and hacks in
order to achieve it.

However, there is a downside: this patch does not fix the TODO item for
the 'installdirs' target (yet).  Do you still think it's worthwhile to
have, and ok if we leave installdirs to be fixed in a later version?

Thanks Akim for reminding me of this issue,
Ralf

    Do not create conditional installation directories. TODO: doc
    
    If primaries are defined conditionally only, do not create their
    target directory if no files are going to be installed there.
    This fixes the `install' target but not the `installdirs' one.
    
    * lib/am/data.am (install-%DIR%%PRIMARY%): Rewrite to only
    create the installation directory if we have files to install.
    * lib/am/libs.am (install-%DIR%LIBRARIES): Likewise.
    * lib/am/ltlib.am (install-%DIR%LTLIBRARIES): Likewise.
    * lib/am/mans.am (install-man%SECTION%): Likewise.
    * lib/am/progs.am (install-%DIR%PROGRAMS): Likewise.
    * lib/am/python.am (install-%DIR%PYTHON): Likewise.
    * lib/am/scripts.am (install-%DIR%SCRIPTS): Likewise.
    * TODO: One item half down.
    * tests/instspc.test: Adjust: install doesn't fail any more with
    single quote.  Tests from within the makefile are not effective
    in finding out that '$' is expanded, so also test for directory
    existence from the shell script.
    * tests/condinst.test: New test.
    * tests/condinst-ltlib.test: New test.
    * tests/Makefile.am: Adjust.
    * NEWS: Update.

diff --git a/NEWS b/NEWS
index 8c6445b..3d1837e 100644
--- a/NEWS
+++ b/NEWS
@@ -102,6 +102,10 @@ New in 1.10a:
     counterpart, depending on the type of files and the need for automatic
     target directory creation.
 
+  - Upon `make install', installation directories are not created any more
+    for targets which are defined only conditionally and commented out.
+    However, the `installdirs' rule still creates them.
+
   - The "deleted header file problem" for *.m4 files is avoided by
     stub rules.  This allows `make' to trigger a rerun of `aclocal'
     also if some previously needed macro file has been removed.
diff --git a/TODO b/TODO
index 3a1e907..9a9e3cf 100644
--- a/TODO
+++ b/TODO
@@ -1,8 +1,5 @@
-We should arrange so that install-%DIR%%PRIMARY% is run conditionally
-when %DIR%_%PRIMARY% is defined conditionally.  Currently it is always
-run, and that will therefore always create %DIR% (unless %DIR%dir is
-also defined conditionally).  Likewise, installdirs should not
-create %DIR% in conditions were no %DIR%_%PRIMARY% is enabled.
+install-%DIR%%PRIMARY% does not create %DIR% when %DIR%_%PRIMARY% is
+defined conditionally.  installdirs should not either.
 
 check should depend on all
   from ben elliston
diff --git a/lib/am/data.am b/lib/am/data.am
index 62383fa..1995ef7 100644
--- a/lib/am/data.am
+++ b/lib/am/data.am
@@ -28,7 +28,6 @@ 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.
@@ -40,10 +39,12 @@ if %?BASE%
 ## new dir variable or use a nobase_ target for the latter case.
          echo "$$d$$p"; \
        done | $(am__base_list) | \
-       while read files; do \
+       { first=:; while read files; do $$first && { first=false; \
+           echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+           $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit $$?; } || :; \
          echo " $(INSTALL_%ONE_PRIMARY%) $$files '$(DESTDIR)$(%NDIR%dir)'"; \
          $(INSTALL_%ONE_PRIMARY%) $$files "$(DESTDIR)$(%NDIR%dir)" || exit 
$$?; \
-       done
+       done; }
 else !%?BASE%
        @list='$(%DIR%_%PRIMARY%)'; $(am__nobase_list) | \
        while read dir files; do \
@@ -51,9 +52,8 @@ else !%?BASE%
            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'"; \
-             $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
+           echo "$(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
+           $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; \
            echo " $(INSTALL_%ONE_PRIMARY%) $$xfiles 
'$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
            $(INSTALL_%ONE_PRIMARY%) $$xfiles "$(DESTDIR)$(%NDIR%dir)/$$dir" || 
exit $$?; }; \
        done
diff --git a/lib/am/libs.am b/lib/am/libs.am
index ee0061e..192fe28 100644
--- a/lib/am/libs.am
+++ b/lib/am/libs.am
@@ -28,7 +28,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.
@@ -38,6 +37,8 @@ if %?BASE%
          else :; fi; \
        done; \
        test -z "$$list2" || { \
+         echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit $$?; \
          echo " $(INSTALL_DATA) $$list2 '$(DESTDIR)$(%NDIR%dir)'"; \
          $(INSTALL_DATA) $$list2 "$(DESTDIR)$(%NDIR%dir)" || exit $$?; }
 else !%?BASE%
@@ -48,9 +49,8 @@ else !%?BASE%
          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'"; \
-             $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
+           echo "$(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
+           $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; \
            echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
            $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit 
$$?; }; \
        done
diff --git a/lib/am/ltlib.am b/lib/am/ltlib.am
index 08e055d..6dd0e5a 100644
--- a/lib/am/ltlib.am
+++ b/lib/am/ltlib.am
@@ -28,7 +28,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.
@@ -38,6 +37,8 @@ if %?BASE%
          else :; fi; \
        done; \
        test -z "$$list2" || { \
+         echo "$(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit $$?; \
 ## 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
@@ -57,9 +58,8 @@ else !%?BASE%
          END { print cur, files }' | \
        while read dir files; do \
          test -z "$$files" || { \
-           test "x$$dir" = x. || { \
-             echo "$(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
-             $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
+           echo "$(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
+           $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; \
 ## 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
diff --git a/lib/am/mans.am b/lib/am/mans.am
index 803a892..2c70532 100644
--- a/lib/am/mans.am
+++ b/lib/am/mans.am
@@ -31,7 +31,6 @@ 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%'; \
@@ -52,7 +51,9 @@ if %?NOTRANS_MANS%
        sed 'n;s,.*/,,;p;s,\.[^%SECTION%][0-9a-z]*$$,.%SECTION%,' | \
        sed 'N;N;s,\n, ,g' | { \
 ## We now have a list "sourcefile basename installed-name".
-       list=; while read file base inst; do \
+       list=; first=:; while read file base inst; do $$first && { first=false; 
\
+         echo " $(MKDIR_P) '$(DESTDIR)$(man%SECTION%dir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(man%SECTION%dir)" || exit $$?; } || :; \
          if test "$$base" = "$$inst"; then list="$$list $$file"; else \
            echo " $(INSTALL_DATA) '$$file' 
'$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \
            $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man%SECTION%dir)/$$inst" || 
exit $$?; \
@@ -86,7 +87,9 @@ if %?TRANS_MANS%
              -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
        sed 'N;N;s,\n, ,g' | { \
 ## We now have a list "sourcefile basename installed-name".
-       list=; while read file base inst; do \
+       list=; first=:; while read file base inst; do $$first && { first=false; 
\
+         echo " $(MKDIR_P) '$(DESTDIR)$(man%SECTION%dir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(man%SECTION%dir)" || exit $$?; } || :; \
          if test "$$base" = "$$inst"; then list="$$list $$file"; else \
            echo " $(INSTALL_DATA) '$$file' 
'$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \
            $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man%SECTION%dir)/$$inst" || 
exit $$?; \
diff --git a/lib/am/progs.am b/lib/am/progs.am
index 114407f..040f4d7 100644
--- a/lib/am/progs.am
+++ b/lib/am/progs.am
@@ -24,7 +24,6 @@ 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)'; \
@@ -44,16 +43,16 @@ install-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
 ## The following awk script turns that into one line containing directories
 ## and then lines of 'type target_name_or_directory sources...', with type
 ## 'd' designating directories, and 'f' files.
-       $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+       $(AWK) 'BEGIN { files["."] = "" } \
          { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
            if ($$2 == $$4) files[d] = files[d] " " $$1; \
            else { print "f", $$3 "/" $$4, $$1; } } \
          END { for (d in files) print "f", d, files[d] }' | \
        while read type dir files; do \
-?!BASE?          case $$type in \
-?!BASE?          d) echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
-?!BASE?             $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?;; \
-?!BASE?          f) \
+         case $$type in \
+         d) echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
+            $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?;; \
+         f) \
            if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
            test -z "$$files" || { \
 ?!LIBTOOL?           echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files 
'$(DESTDIR)$(%NDIR%dir)$$dir'"; \
@@ -64,7 +63,7 @@ install-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
 ?LIBTOOL?          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) 
$(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files 
'$(DESTDIR)$(%NDIR%dir)$$dir'"; \
 ?LIBTOOL?          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) 
$(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files 
"$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
            } \
-?!BASE?          ;; esac \
+         ;; esac \
        ; done
 
 endif %?INSTALL%
diff --git a/lib/am/python.am b/lib/am/python.am
index 7047452..1ffce74 100644
--- a/lib/am/python.am
+++ b/lib/am/python.am
@@ -28,7 +28,6 @@ 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=''; for p in $$list; do\
 ## A file can be in the source directory or the build directory.
@@ -43,7 +42,9 @@ if %?BASE%
          else :; fi; \
        done; \
        for file in $$list2; do echo $$file; done | $(am__base_list) | \
-       while read files; do \
+       { first=:; while read files; do $$first && { first=false; \
+         echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
+         $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit $$?; } || :; \
 ## Don't perform translation, since script name is important.
          echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(%NDIR%dir)'"; \
          $(INSTALL_DATA) $$files "$(DESTDIR)$(%NDIR%dir)" || exit $$?; \
@@ -56,7 +57,7 @@ if %?BASE%
          else \
            PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir 
"$(%NDIR%dir)" $$dlist; \
          fi; \
-       else :; fi
+       else :; fi; }
 else !%?BASE%
        @list='$(%DIR%_PYTHON)'; $(am__nobase_list) | \
        while read dir files; do \
@@ -66,9 +67,8 @@ else !%?BASE%
            if test -f "$$b$$p"; then xfiles="$$xfiles $$b$$p"; dlist="$$dlist 
$$p"; \
            else :; fi; done; \
          test -z "$$xfiles" || { \
-           test "x$$dir" = x. || { \
-             echo "$(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
-             $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
+           echo "$(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
+           $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; \
 ## Don't perform translation, since script name is important.
            echo " $(INSTALL_DATA) $$xfiles '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
            $(INSTALL_DATA) $$xfiles "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit 
$$?; }; \
diff --git a/lib/am/scripts.am b/lib/am/scripts.am
index b8e61c9..b9467a3 100644
--- a/lib/am/scripts.am
+++ b/lib/am/scripts.am
@@ -29,7 +29,6 @@ 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)'; \
@@ -47,7 +46,7 @@ install-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
 ?BASE?     -e 'h;s|.*|.|' \
 ?!BASE?            -e "s|$$srcdirstrip/||" -e 'h;s|[^/]*$$||; s|^$$|.|' \
            -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
-       $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+       $(AWK) 'BEGIN { files["."] = "" } \
          { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
            if ($$2 == $$4) { files[d] = files[d] " " $$1; \
              if (++n[d] == $(am__install_max)) { \
@@ -55,16 +54,16 @@ install-%DIR%SCRIPTS: $(%DIR%_SCRIPTS)
            else { print "f", d "/" $$4, $$1 } } \
          END { for (d in files) print "f", d, files[d] }' | \
        while read type dir files; do \
-?!BASE?          case $$type in \
-?!BASE?          d) echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
-?!BASE?             $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?;; \
-?!BASE?          f) \
+         case $$type in \
+         d) echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
+            $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?;; \
+         f) \
             if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
             test -z "$$files" || { \
               echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; 
\
               $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(%NDIR%dir)$$dir" || exit 
$$?; \
             } \
-?!BASE?          ;; esac \
+         ;; esac \
        ; done
 endif %?INSTALL%
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7194bfd..077db92 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -169,6 +169,8 @@ condd.test \
 condhook.test \
 condinc.test \
 condinc2.test \
+condinst.test \
+condinst-ltlib.test \
 condlib.test \
 condman.test \
 condman2.test \
diff --git a/tests/condinst-ltlib.test b/tests/condinst-ltlib.test
new file mode 100755
index 0000000..0b91f6c
--- /dev/null
+++ b/tests/condinst-ltlib.test
@@ -0,0 +1,61 @@
+#!/bin/sh
+# Copyright (C) 2008  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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 3, or (at your option)
+# any later version.
+#
+# GNU Automake 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 Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Ensure that %DIR% is not created by install if %DIR%_%PRIMARY% is not
+# defined.  This test deals with LTLIBRARIES.
+
+required=libtoolize
+. ./defs
+set -e
+
+cat >>configure.in <<'END'
+AM_CONDITIONAL([COND], [false])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_LIBTOOL
+AC_OUTPUT
+END
+
+cat >Makefile.am <<'END'
+AUTOMAKE_OPTIONS = subdir-objects
+if COND
+bin_PROGRAMS = foo
+nobase_bin_PROGRAMS = nfoo sub/nfoo
+lib_LTLIBRARIES = libfoo.la
+nobase_lib_LTLIBRARIES = libnfoo.la sub/libnfoo.la
+endif
+END
+
+libtoolize
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+./configure "--prefix=`pwd`/inst"
+$MAKE
+$MAKE install
+test ! -d inst/bin
+test ! -d inst/lib
+test ! -d inst
+
+./configure
+$MAKE
+DESTDIR="`pwd`/inst" $MAKE -e install
+test ! -d inst
+:
diff --git a/tests/condinst.test b/tests/condinst.test
new file mode 100755
index 0000000..6c286f5
--- /dev/null
+++ b/tests/condinst.test
@@ -0,0 +1,75 @@
+#!/bin/sh
+# Copyright (C) 2008  Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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 3, or (at your option)
+# any later version.
+#
+# GNU Automake 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 Automake; see the file COPYING.  If not, write to
+# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301, USA.
+
+# Ensure that %DIR% is not created by install if %DIR%_%PRIMARY% is not
+# defined.
+
+. ./defs
+set -e
+
+cat >>configure.in <<'END'
+AM_CONDITIONAL([COND], [false])
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_PROG_RANLIB
+AC_SUBST([JAVA])
+AM_PATH_PYTHON([], [], [:])
+AC_OUTPUT
+END
+cat >Makefile.am <<'END'
+AUTOMAKE_OPTIONS = subdir-objects
+if COND
+include_HEADERS = inc.h
+nobase_include_HEADERS = ninc.h sub/ninc.h
+bin_PROGRAMS = foo
+nobase_bin_PROGRAMS = nfoo sub/nfoo
+bin_SCRIPTS = bar
+nobase_bin_SCRIPTS = nbar sub/nbar
+lib_LIBRARIES = libfoo.a
+nobase_lib_LIBRARIES = libnfoo.a sub/libnfoo.a
+javadir = $(datadir)/java
+java_JAVA = a.java
+python_PYTHON = foo.py
+nobase_python_PYTHON = nfoo.py sub/nfoo.py
+data_DATA = data
+nobase_data_DATA = ndata sub/ndata
+man_MANS = foo.1
+notrans_man_MANS = bar.1
+endif
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+$AUTOCONF
+./configure "--prefix=`pwd`/inst"
+$MAKE
+$MAKE install
+test ! -d inst/bin
+test ! -d inst/lib
+test ! -d inst/share
+test ! -d inst/include
+test ! -d inst/man
+test ! -d inst
+
+./configure
+$MAKE
+DESTDIR="`pwd`/inst" $MAKE -e install
+test ! -d inst
+:
diff --git a/tests/instspc.test b/tests/instspc.test
index a59177d..f418e4c 100755
--- a/tests/instspc.test
+++ b/tests/instspc.test
@@ -137,7 +137,8 @@ do
 
     ../configure --prefix "/$file-prefix" &&
     $MAKE &&
-    DESTDIR=$dest file=$file $MAKE -e test-install-sep ||
+    DESTDIR=$dest file=$file $MAKE -e test-install-sep &&
+    test -d "$dest/$file-prefix" ||
       eval "${test}_failures=\"\$${test}_failures$lf\$file\""
 
     cd ..
@@ -167,7 +168,6 @@ expected_install_failures='
 "
 #
 $
-'\''
 `
 '"$lf"'
 a'"${lf}"'b'




reply via email to

[Prev in Thread] Current Thread [Next in Thread]