>>> "James" == James Amundson <[EMAIL PROTECTED]> writes:
James> Wait a minute... You were joking, right? An important James> piece of infrastructure like automake shouldn't have James> amateurish mistakes like forgetting to properly quote James> pathnames in scripts and makefiles. James> Surely the automake maintainers realize that this is a James> bug, don't they? I do. In fact there is two different problems. One is that we cannot support spaces in source filenames. As Russ Allbery pointed out in another thread (he didn't Cc you) make uses space as a separator and we cannot work around this. It is not possible to write a portable makefile with a dependency or target that contains a space. (Incidentally this will also break builds if the package has been unpacked in a directory with a space, and $(srcdir) is absolute.) Your problem is different. You want spaces in installation paths. Those paths do not appear as target or dependencies in Makefiles so there is no insurmountable obstacle. As you say it's a simple matter of quoting. Well sort of... The appended patch is the start of a fix for this. Unfortunately it is not yet complete: it breaks `make installdirs' on conditional directories (this is because installdirs now tries to run $(mkdir_p) "$(DESTDIR)$(bardir)" "$(DESTDIR)$(include_foodir)" and this fails if $(DESTDIR)$(bardir) or $(DESTDIR)$(include_foodir) is empty -- mkdir won't create "".) It shouldn't be too hard to fix, but unfortunately it's bedtime :) 2004-01-27 Alexandre Duret-Lutz <[EMAIL PROTECTED]> * Makefile.am (maintainer-check): Check for unquoted $(DESTDIR) uses. * lib/am/data.am, lib/am/distdir.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: Quote installation paths in install, uninstall, and installcheck rules, as well as in am__installdirs variables. This is for the sake of paths containing spaces. * test/instspc.test: New file. * test/Makefile.am (TESTS): Add instspc.test. Report from James Amundson. Index: Makefile.am =================================================================== RCS file: /cvs/automake/automake/Makefile.am,v retrieving revision 1.226.2.1 diff -u -r1.226.2.1 Makefile.am --- Makefile.am 5 Jan 2004 22:21:48 -0000 1.226.2.1 +++ Makefile.am 27 Jan 2004 23:02:09 -0000 @@ -252,6 +252,10 @@ @if test `grep -E '[EMAIL PROTECTED]@' automake | wc -l` -ne 0; then \ echo "Unresolved @...@ substitution in automake" 1>&2; \ exit 1; \ + fi; \ + if grep -E "[^\'\"]\\\$$\(DESTDIR" $(srcdir)/lib/am/*.am; then \ + echo 'Suspicious unquoted DESTDIR uses.' 1>&2 ; \ + exit 1; \ fi Index: THANKS =================================================================== RCS file: /cvs/automake/automake/THANKS,v retrieving revision 1.230.2.7 diff -u -r1.230.2.7 THANKS --- THANKS 12 Jan 2004 21:58:55 -0000 1.230.2.7 +++ THANKS 27 Jan 2004 23:02:10 -0000 @@ -88,6 +88,7 @@ Ian Lance Taylor [EMAIL PROTECTED] Imacat [EMAIL PROTECTED] Inoue [EMAIL PROTECTED] +James Amundson [EMAIL PROTECTED] James Henstridge [EMAIL PROTECTED] James R. Van Zandt [EMAIL PROTECTED] James Youngman [EMAIL PROTECTED] Index: lib/am/data.am =================================================================== RCS file: /cvs/automake/automake/lib/am/data.am,v retrieving revision 1.41.2.2 diff -u -r1.41.2.2 data.am --- lib/am/data.am 10 Jan 2004 13:41:53 -0000 1.41.2.2 +++ lib/am/data.am 27 Jan 2004 23:02:10 -0000 @@ -22,14 +22,14 @@ ## ------------ ## if %?INSTALL% -am__installdirs += $(DESTDIR)$(%NDIR%dir) +am__installdirs += "$(DESTDIR)$(%NDIR%dir)" ?BASE?%DIR%%PRIMARY%_INSTALL = $(INSTALL_%ONE_PRIMARY%) ?!BASE?%DIR%%PRIMARY%_INSTALL = $(install_sh_DATA) ?EXEC?.PHONY install-exec-am: install-%DIR%%PRIMARY% ?!EXEC?.PHONY install-data-am: install-%DIR%%PRIMARY% install-%DIR%%PRIMARY%: $(%DIR%_%PRIMARY%) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(%NDIR%dir) + test -z "$(%NDIR%dir)" || $(mkdir_p) "$(DESTDIR)$(%NDIR%dir)" ?!BASE? @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ ## Funny invocation because Makefile variable can be empty, leading to ## a syntax error in sh. @@ -45,8 +45,8 @@ ?!BASE? $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ ?!BASE? *) f=$$p;; \ ?!BASE? esac; \ - echo " $(%DIR%%PRIMARY%_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f"; \ - $(%DIR%%PRIMARY%_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f; \ + echo " $(%DIR%%PRIMARY%_INSTALL) '$$d$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \ + $(%DIR%%PRIMARY%_INSTALL) "$$d$$p" "$(DESTDIR)$(%NDIR%dir)/$$f"; \ done endif %?INSTALL% @@ -67,8 +67,8 @@ ?!BASE? $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ ?!BASE? *) f=$$p;; \ ?!BASE? esac; \ - echo " rm -f $(DESTDIR)$(%NDIR%dir)/$$f"; \ - rm -f $(DESTDIR)$(%NDIR%dir)/$$f; \ + echo " rm -f '$(DESTDIR)$(%NDIR%dir)/$$f'"; \ + rm -f "$(DESTDIR)$(%NDIR%dir)/$$f"; \ done endif %?INSTALL% Index: lib/am/distdir.am =================================================================== RCS file: /cvs/automake/automake/lib/am/distdir.am,v retrieving revision 1.52.2.1 diff -u -r1.52.2.1 distdir.am --- lib/am/distdir.am 27 Dec 2003 01:38:54 -0000 1.52.2.1 +++ lib/am/distdir.am 27 Jan 2004 23:02:10 -0000 @@ -1,5 +1,5 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. +## Copyright (C) 2001, 2002, 2003, 2004 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 @@ -324,8 +324,8 @@ ## Undo the write access. chmod a-w $(distdir) ## Compute the absolute path of `_inst'. Strip any leading DOS drive -## to allow DESTDIR installations. Otherwise $(DESTDIR)$(prefix) would -## expand to c:/temp/am-dc-5668/c:/src/package/package-1.0/_inst. +## to allow DESTDIR installations. Otherwise "$(DESTDIR)$(prefix)" would +## expand to "c:/temp/am-dc-5668/c:/src/package/package-1.0/_inst". dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ ## We will attemp a DESTDIR install in $dc_destdir. We don't ## create this directory under $dc_install_base, because it would Index: lib/am/java.am =================================================================== RCS file: /cvs/automake/automake/lib/am/java.am,v retrieving revision 1.20.2.1 diff -u -r1.20.2.1 java.am --- lib/am/java.am 10 Jan 2004 13:41:53 -0000 1.20.2.1 +++ lib/am/java.am 27 Jan 2004 23:02:10 -0000 @@ -39,18 +39,18 @@ ## ------------ ## if %?INSTALL% -am__installdirs += $(DESTDIR)$(%NDIR%dir) +am__installdirs += "$(DESTDIR)$(%NDIR%dir)" ?EXEC?.PHONY install-exec-am: install-%DIR%JAVA ?!EXEC?.PHONY install-data-am: install-%DIR%JAVA install-%DIR%JAVA: class%DIR%.stamp @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(%NDIR%dir) + 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. for p in *.class; do \ - echo " $(INSTALL_DATA) $$p $(DESTDIR)$(%NDIR%dir)/$$p"; \ - $(INSTALL_DATA) $$p $(DESTDIR)$(%NDIR%dir)/$$p; \ + echo " $(INSTALL_DATA) '$$p' '$(DESTDIR)$(%NDIR%dir)/$$p'"; \ + $(INSTALL_DATA) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$p"; \ done endif %?INSTALL% @@ -64,8 +64,8 @@ uninstall-%DIR%JAVA: @$(NORMAL_UNINSTALL) @for p in *.class; do \ - echo " rm -f $(DESTDIR)$(%NDIR%dir)/$$p"; \ - rm -f $(DESTDIR)$(%NDIR%dir)/$$p; \ + echo " rm -f '$(DESTDIR)$(%NDIR%dir)/$$p'"; \ + rm -f "$(DESTDIR)$(%NDIR%dir)/$$p"; \ done endif %?INSTALL% Index: lib/am/libs.am =================================================================== RCS file: /cvs/automake/automake/lib/am/libs.am,v retrieving revision 1.25 diff -u -r1.25 libs.am --- lib/am/libs.am 10 Nov 2003 20:55:32 -0000 1.25 +++ lib/am/libs.am 27 Jan 2004 23:02:10 -0000 @@ -1,5 +1,5 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003 +## Copyright (C) 1994, 1995, 1996, 1998, 1999, 2001, 2002, 2003, 2004 ## Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify @@ -34,14 +34,14 @@ ## ------------ ## if %?INSTALL% -am__installdirs += $(DESTDIR)$(%NDIR%dir) +am__installdirs += "$(DESTDIR)$(%NDIR%dir)" ?BASE?%DIR%LIBRARIES_INSTALL = $(INSTALL_DATA) ?!BASE?%DIR%LIBRARIES_INSTALL = $(install_sh_DATA) ?EXEC?.PHONY install-exec-am: install-%DIR%LIBRARIES ?!EXEC?.PHONY install-data-am: install-%DIR%LIBRARIES install-%DIR%LIBRARIES: $(%DIR%_LIBRARIES) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(%NDIR%dir) + 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%_LIBRARIES)'; for p in $$list; do \ @@ -51,8 +51,8 @@ ## not '$(DESTDIR)$(%NDIR%dir)/python/foo.yo'. ?BASE? f="`echo $$p | sed -e 's|^.*/||'`"; \ ?!BASE? f="$$p"; \ - echo " $(%DIR%LIBRARIES_INSTALL) $$p $(DESTDIR)$(%NDIR%dir)/$$f"; \ - $(%DIR%LIBRARIES_INSTALL) $$p $(DESTDIR)$(%NDIR%dir)/$$f; \ + echo " $(%DIR%LIBRARIES_INSTALL) '$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \ + $(%DIR%LIBRARIES_INSTALL) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$f"; \ else :; fi; \ done ## We do two loops here so that $(POST_INSTALL) can be empty. If we @@ -65,8 +65,8 @@ if test -f $$p; then \ ?BASE? p="`echo $$p | sed -e 's|^.*/||'`"; \ ## Must ranlib after installing because mod time changes. - echo " $(RANLIB) $(DESTDIR)$(%NDIR%dir)/$$p"; \ - $(RANLIB) $(DESTDIR)$(%NDIR%dir)/$$p; \ + echo " $(RANLIB) '$(DESTDIR)$(%NDIR%dir)/$$p'"; \ + $(RANLIB) "$(DESTDIR)$(%NDIR%dir)/$$p"; \ else :; fi; \ done endif %?INSTALL% @@ -82,8 +82,8 @@ @$(NORMAL_UNINSTALL) @list='$(%DIR%_LIBRARIES)'; for p in $$list; do \ ?BASE? p="`echo $$p | sed -e 's|^.*/||'`"; \ - echo " rm -f $(DESTDIR)$(%NDIR%dir)/$$p"; \ - rm -f $(DESTDIR)$(%NDIR%dir)/$$p; \ + echo " rm -f '$(DESTDIR)$(%NDIR%dir)/$$p'"; \ + rm -f "$(DESTDIR)$(%NDIR%dir)/$$p"; \ done endif %?INSTALL% Index: lib/am/lisp.am =================================================================== RCS file: /cvs/automake/automake/lib/am/lisp.am,v retrieving revision 1.39.2.2 diff -u -r1.39.2.2 lisp.am --- lib/am/lisp.am 10 Jan 2004 13:41:53 -0000 1.39.2.2 +++ lib/am/lisp.am 27 Jan 2004 23:02:10 -0000 @@ -51,7 +51,7 @@ ## ------------ ## if %?INSTALL% -am__installdirs += $(DESTDIR)$(%NDIR%dir) +am__installdirs += "$(DESTDIR)$(%NDIR%dir)" ?BASE?%DIR%LISP_INSTALL = $(INSTALL_DATA) ?!BASE?%DIR%LISP_INSTALL = $(install_sh_DATA) ?EXEC?.PHONY install-exec-am: install-%DIR%LISP @@ -60,7 +60,7 @@ @$(NORMAL_INSTALL) ## Do not install anything if EMACS was not found. @if test "$(EMACS)" != no; then \ - $(mkdir_p) $(DESTDIR)$(%NDIR%dir); \ + test -z "$(%NDIR%dir)" || $(mkdir_p) "$(DESTDIR)$(%NDIR%dir)"; \ ?!BASE? srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ ## Funny invocation because Makefile variable can be empty, leading to ## a syntax error in sh. @@ -72,12 +72,12 @@ ?!BASE? $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ ?!BASE? *) f=$$p;; \ ?!BASE? esac; \ - echo " $(%DIR%LISP_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f"; \ - $(%DIR%LISP_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f; \ + echo " $(%DIR%LISP_INSTALL) '$$d$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \ + $(%DIR%LISP_INSTALL) "$$d$$p" "$(DESTDIR)$(%NDIR%dir)/$$f"; \ ## Only install .elc file if it exists. if test -f $${p}c; then \ - echo " $(%DIR%LISP_INSTALL) $${p}c $(DESTDIR)$(%NDIR%dir)/$${f}c"; \ - $(%DIR%LISP_INSTALL) $${p}c $(DESTDIR)$(%NDIR%dir)/$${f}c; \ + echo " $(%DIR%LISP_INSTALL) '$${p}c' '$(DESTDIR)$(%NDIR%dir)/$${f}c'"; \ + $(%DIR%LISP_INSTALL) "$${p}c" "$(DESTDIR)$(%NDIR%dir)/$${f}c"; \ else : ; fi; \ done; \ else : ; fi @@ -101,8 +101,8 @@ ?!BASE? $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ ?!BASE? *) f=$$p;; \ ?!BASE? esac; \ - echo " rm -f $(DESTDIR)$(%NDIR%dir)/$$f $(DESTDIR)$(%NDIR%dir)/$${f}c"; \ - rm -f $(DESTDIR)$(%NDIR%dir)/$$f $(DESTDIR)$(%NDIR%dir)/$${f}c; \ + echo " rm -f '$(DESTDIR)$(%NDIR%dir)/$$f' '$(DESTDIR)$(%NDIR%dir)/$${f}c'"; \ + rm -f "$(DESTDIR)$(%NDIR%dir)/$$f" "$(DESTDIR)$(%NDIR%dir)/$${f}c"; \ done; \ else : ; fi endif %?INSTALL% Index: lib/am/ltlib.am =================================================================== RCS file: /cvs/automake/automake/lib/am/ltlib.am,v retrieving revision 1.28 diff -u -r1.28 ltlib.am --- lib/am/ltlib.am 10 Nov 2003 20:55:32 -0000 1.28 +++ lib/am/ltlib.am 27 Jan 2004 23:02:10 -0000 @@ -1,5 +1,5 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2003 +## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004 ## Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify @@ -22,14 +22,14 @@ ## ------------ ## if %?INSTALL% -am__installdirs += $(DESTDIR)$(%NDIR%dir) +am__installdirs += "$(DESTDIR)$(%NDIR%dir)" ?BASE?%DIR%LTLIBRARIES_INSTALL = $(INSTALL) ?!BASE?%DIR%LTLIBRARIES_INSTALL = $(install_sh) -c ?EXEC?.PHONY install-exec-am: install-%DIR%LTLIBRARIES ?!EXEC?.PHONY install-data-am: install-%DIR%LTLIBRARIES install-%DIR%LTLIBRARIES: $(%DIR%_LTLIBRARIES) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(%NDIR%dir) + 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%_LTLIBRARIES)'; for p in $$list; do \ @@ -43,10 +43,10 @@ ## if the program doesn't have a name that libtool expects. ## Use INSTALL and not INSTALL_DATA because libtool knows the right ## permissions to use. -?LIBTOOL? echo " $(LIBTOOL) --mode=install $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(%NDIR%dir)/$$f"; \ -?LIBTOOL? $(LIBTOOL) --mode=install $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(%NDIR%dir)/$$f; \ -?!LIBTOOL? echo " $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(%NDIR%dir)/$$f"; \ -?!LIBTOOL? $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(%NDIR%dir)/$$f; \ +?LIBTOOL? echo " $(LIBTOOL) --mode=install $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \ +?LIBTOOL? $(LIBTOOL) --mode=install $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$f"; \ +?!LIBTOOL? echo " $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \ +?!LIBTOOL? $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$f"; \ else :; fi; \ done endif %?INSTALL% @@ -62,10 +62,10 @@ @$(NORMAL_UNINSTALL) @list='$(%DIR%_LTLIBRARIES)'; for p in $$list; do \ ?BASE? p="`echo $$p | sed -e 's|^.*/||'`"; \ -?LIBTOOL? echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(%NDIR%dir)/$$p"; \ -?LIBTOOL? $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(%NDIR%dir)/$$p; \ -?!LIBTOOL? echo " rm -f $(DESTDIR)$(%NDIR%dir)/$$p"; \ -?!LIBTOOL? rm -f $(DESTDIR)$(%NDIR%dir)/$$p; \ +?LIBTOOL? echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(%NDIR%dir)/$$p'"; \ +?LIBTOOL? $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(%NDIR%dir)/$$p"; \ +?!LIBTOOL? echo " rm -f '$(DESTDIR)$(%NDIR%dir)/$$p'"; \ +?!LIBTOOL? rm -f "$(DESTDIR)$(%NDIR%dir)/$$p"; \ done endif %?INSTALL% Index: lib/am/mans.am =================================================================== RCS file: /cvs/automake/automake/lib/am/mans.am,v retrieving revision 1.28 diff -u -r1.28 mans.am --- lib/am/mans.am 10 Nov 2003 20:55:32 -0000 1.28 +++ lib/am/mans.am 27 Jan 2004 23:02:10 -0000 @@ -1,5 +1,5 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 1998, 2001, 2003 Free Software Foundation, Inc. +## Copyright (C) 1998, 2001, 2003, 2004 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 @@ -27,11 +27,11 @@ .PHONY: install-man ?INSTALL-MAN?install-data-am: install-man -?INSTALL-MAN?am__installdirs += $(DESTDIR)$(man%SECTION%dir) +?INSTALL-MAN?am__installdirs += "$(DESTDIR)$(man%SECTION%dir)" .PHONY install-man: install-man%SECTION% install-man%SECTION%: $(man%SECTION%_MANS) $(man_MANS) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(man%SECTION%dir) + test -z "$(%NDIR%dir)" || $(mkdir_p) "$(DESTDIR)$(man%SECTION%dir)" @list='$(man%SECTION%_MANS) $(dist_man%SECTION%_MANS) $(nodist_man%SECTION%_MANS)'; \ ## Extract all items from man_MANS that should go in this section. ## This must be done dynamically to support conditionals. @@ -57,8 +57,8 @@ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man%SECTION%dir)/$$inst"; \ - $(INSTALL_DATA) $$file $(DESTDIR)$(man%SECTION%dir)/$$inst; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man%SECTION%dir)/$$inst"; \ done @@ -94,6 +94,6 @@ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ - echo " rm -f $(DESTDIR)$(man%SECTION%dir)/$$inst"; \ - rm -f $(DESTDIR)$(man%SECTION%dir)/$$inst; \ + echo " rm -f '$(DESTDIR)$(man%SECTION%dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man%SECTION%dir)/$$inst"; \ done Index: lib/am/progs.am =================================================================== RCS file: /cvs/automake/automake/lib/am/progs.am,v retrieving revision 1.43 diff -u -r1.43 progs.am --- lib/am/progs.am 10 Nov 2003 20:55:32 -0000 1.43 +++ lib/am/progs.am 27 Jan 2004 23:02:10 -0000 @@ -1,5 +1,5 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2003 +## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2003, 2004 ## Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify @@ -23,14 +23,14 @@ ## ------------ ## if %?INSTALL% -am__installdirs += $(DESTDIR)$(%NDIR%dir) +am__installdirs += "$(DESTDIR)$(%NDIR%dir)" ?BASE?%DIR%PROGRAMS_INSTALL = $(INSTALL_PROGRAM) ?!BASE?%DIR%PROGRAMS_INSTALL = $(install_sh_PROGRAM) ?EXEC?.PHONY install-exec-am: install-%DIR%PROGRAMS ?!EXEC?.PHONY install-data-am: install-%DIR%PROGRAMS install-%DIR%PROGRAMS: $(%DIR%_PROGRAMS) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(%NDIR%dir) + 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)'; for p in $$list; do \ @@ -51,10 +51,10 @@ ## Note that we explicitly set the libtool mode. This avoids any ## lossage if the install program doesn't have a name that libtool ## expects. -?LIBTOOL? echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(%DIR%PROGRAMS_INSTALL) $$p $(DESTDIR)$(%NDIR%dir)/$$f"; \ -?LIBTOOL? $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(%DIR%PROGRAMS_INSTALL) $$p $(DESTDIR)$(%NDIR%dir)/$$f || exit 1; \ -?!LIBTOOL? echo " $(INSTALL_PROGRAM_ENV) $(%DIR%PROGRAMS_INSTALL) $$p $(DESTDIR)$(%NDIR%dir)/$$f"; \ -?!LIBTOOL? $(INSTALL_PROGRAM_ENV) $(%DIR%PROGRAMS_INSTALL) $$p $(DESTDIR)$(%NDIR%dir)/$$f || exit 1; \ +?LIBTOOL? echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(%DIR%PROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \ +?LIBTOOL? $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(%DIR%PROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$f" || exit 1; \ +?!LIBTOOL? echo " $(INSTALL_PROGRAM_ENV) $(%DIR%PROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \ +?!LIBTOOL? $(INSTALL_PROGRAM_ENV) $(%DIR%PROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$f" || exit 1; \ else :; fi; \ done endif %?INSTALL% @@ -73,8 +73,8 @@ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ ## Prepend the directory part if nobase_ is used. ?!BASE? f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \ - echo " rm -f $(DESTDIR)$(%NDIR%dir)/$$f"; \ - rm -f $(DESTDIR)$(%NDIR%dir)/$$f; \ + echo " rm -f '$(DESTDIR)$(%NDIR%dir)/$$f'"; \ + rm -f "$(DESTDIR)$(%NDIR%dir)/$$f"; \ done endif %?INSTALL% @@ -120,7 +120,7 @@ ## Insert the directory back if nobase_ is used. ?!BASE? f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \ for opt in --help --version; do \ - if $(DESTDIR)$(%NDIR%dir)/$$f $$opt > c$${pid}_.out 2> c$${pid}_.err \ + if "$(DESTDIR)$(%NDIR%dir)/$$f" $$opt > c$${pid}_.out 2> c$${pid}_.err \ && test -n "`cat c$${pid}_.out`" \ && test -z "`cat c$${pid}_.err`"; then :; \ else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \ Index: lib/am/python.am =================================================================== RCS file: /cvs/automake/automake/lib/am/python.am,v retrieving revision 1.18.2.3 diff -u -r1.18.2.3 python.am --- lib/am/python.am 12 Jan 2004 22:57:22 -0000 1.18.2.3 +++ lib/am/python.am 27 Jan 2004 23:02:10 -0000 @@ -22,14 +22,14 @@ ## ------------ ## if %?INSTALL% -am__installdirs += $(DESTDIR)$(%NDIR%dir) +am__installdirs += "$(DESTDIR)$(%NDIR%dir)" ?BASE?%DIR%PYTHON_INSTALL = $(INSTALL_DATA) ?!BASE?%DIR%PYTHON_INSTALL = $(install_sh_DATA) ?EXEC?.PHONY install-exec-am: install-%DIR%PYTHON ?!EXEC?.PHONY install-data-am: install-%DIR%PYTHON install-%DIR%PYTHON: $(%DIR%_PYTHON) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(%NDIR%dir) + test -z "$(%NDIR%dir)" || $(mkdir_p) "$(DESTDIR)$(%NDIR%dir)" ?!BASE? @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ ?!BASE? list='$(%DIR%_PYTHON)'; dlist=''; for p in $$list; do\ ?BASE? @list='$(%DIR%_PYTHON)'; dlist=''; for p in $$list; do\ @@ -46,14 +46,14 @@ ?!BASE? esac; \ dlist="$$dlist $$d"; \ ## Don't perform translation, since script name is important. - echo " $(%DIR%PYTHON_INSTALL) $$b$$p $(DESTDIR)$(%NDIR%dir)/$$d"; \ - $(%DIR%PYTHON_INSTALL) $$b$$p $(DESTDIR)$(%NDIR%dir)/$$d; \ + echo " $(%DIR%PYTHON_INSTALL) '$$b$$p' '$(DESTDIR)$(%NDIR%dir)/$$d'"; \ + $(%DIR%PYTHON_INSTALL) "$$b$$p" "$(DESTDIR)$(%NDIR%dir)/$$d"; \ else :; fi; \ done; \ ## Byte-compile must be done at install time, since file times are ## encoded in the actual files. test -z "$$dlist" || \ - PYTHON=$(PYTHON) $(py_compile) --basedir $(DESTDIR)$(%NDIR%dir) $$dlist + PYTHON=$(PYTHON) $(py_compile) --basedir "$(DESTDIR)$(%NDIR%dir)" $$dlist endif %?INSTALL% @@ -73,11 +73,11 @@ ?!BASE? $(srcdir)/*) d=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ ?!BASE? *) d=$$p;; \ ?!BASE? esac; \ - rm -f $(DESTDIR)$(%NDIR%dir)/$$d; \ + rm -f "$(DESTDIR)$(%NDIR%dir)/$$d"; \ ## This is to remove the .pyc and .pyo byte compiled versions (a bit ## of a hack). - rm -f $(DESTDIR)$(%NDIR%dir)/$${d}c; \ - rm -f $(DESTDIR)$(%NDIR%dir)/$${d}o; \ + rm -f "$(DESTDIR)$(%NDIR%dir)/$${d}c"; \ + rm -f "$(DESTDIR)$(%NDIR%dir)/$${d}o"; \ done endif %?INSTALL% Index: lib/am/scripts.am =================================================================== RCS file: /cvs/automake/automake/lib/am/scripts.am,v retrieving revision 1.51.2.2 diff -u -r1.51.2.2 scripts.am --- lib/am/scripts.am 10 Jan 2004 13:41:53 -0000 1.51.2.2 +++ lib/am/scripts.am 27 Jan 2004 23:02:10 -0000 @@ -24,14 +24,14 @@ if %?INSTALL% ## if doesn't work properly for Automake variables yet. -am__installdirs += $(DESTDIR)$(%NDIR%dir) +am__installdirs += "$(DESTDIR)$(%NDIR%dir)" ?BASE?%DIR%SCRIPT_INSTALL = $(INSTALL_SCRIPT) ?!BASE?%DIR%SCRIPT_INSTALL = $(install_sh_SCRIPT) ?EXEC?.PHONY install-exec-am: install-%DIR%SCRIPTS ?!EXEC?.PHONY install-data-am: install-%DIR%SCRIPTS install-%DIR%SCRIPTS: $(%DIR%_SCRIPTS) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(%NDIR%dir) + test -z "$(%NDIR%dir)" || $(mkdir_p) "$(DESTDIR)$(%NDIR%dir)" ?!BASE? @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ ## Funny invocation because Makefile variable can be empty, leading to ## a syntax error in sh. @@ -51,8 +51,8 @@ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ ## Prepend the directory part if nobase_ is used. ?!BASE? f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \ - echo " $(%DIR%SCRIPT_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f"; \ - $(%DIR%SCRIPT_INSTALL) $$d$$p $(DESTDIR)$(%NDIR%dir)/$$f; \ + echo " $(%DIR%SCRIPT_INSTALL) '$$d$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \ + $(%DIR%SCRIPT_INSTALL) "$$d$$p" "$(DESTDIR)$(%NDIR%dir)/$$f"; \ else :; fi; \ done endif %?INSTALL% @@ -76,8 +76,8 @@ f=`echo "$$p" | sed 's|^.*/||;$(transform)'`; \ ## Prepend the directory part if nobase_ is used. ?!BASE? f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \ - echo " rm -f $(DESTDIR)$(%NDIR%dir)/$$f"; \ - rm -f $(DESTDIR)$(%NDIR%dir)/$$f; \ + echo " rm -f '$(DESTDIR)$(%NDIR%dir)/$$f'"; \ + rm -f "$(DESTDIR)$(%NDIR%dir)/$$f"; \ done endif %?INSTALL% @@ -109,7 +109,7 @@ ## Insert the directory back if nobase_ is used. ?!BASE? f=`echo "$$p" | sed 's|[^/]*$$||'`"$$f"; \ for opt in --help --version; do \ - if $(DESTDIR)$(%NDIR%dir)/$$f $$opt > c$${pid}_.out 2> c$${pid}_.err \ + if "$(DESTDIR)$(%NDIR%dir)/$$f" $$opt > c$${pid}_.out 2> c$${pid}_.err \ && test -n "`cat c$${pid}_.out`" \ && test -z "`cat c$${pid}_.err`"; then :; \ else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \ Index: lib/am/texinfos.am =================================================================== RCS file: /cvs/automake/automake/lib/am/texinfos.am,v retrieving revision 1.111 diff -u -r1.111 texinfos.am --- lib/am/texinfos.am 18 Nov 2003 20:40:48 -0000 1.111 +++ lib/am/texinfos.am 27 Jan 2004 23:02:11 -0000 @@ -1,6 +1,6 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +## Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 ## Free Software Foundation, Inc. ## This program is free software; you can redistribute it and/or modify @@ -107,7 +107,7 @@ ## is hard coded. if %?INSTALL-INFO% if %?LOCAL-TEXIS% -am__installdirs += $(DESTDIR)$(infodir) +am__installdirs += "$(DESTDIR)$(infodir)" install-data-am: install-info-am endif %?LOCAL-TEXIS% endif %?INSTALL-INFO% @@ -123,7 +123,7 @@ if %?LOCAL-TEXIS% install-info-am: $(INFO_DEPS) @$(NORMAL_INSTALL) - $(mkdir_p) $(DESTDIR)$(infodir) + test -z "$(%NDIR%dir)" || $(mkdir_p) "$(DESTDIR)$(infodir)" @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ list='$(INFO_DEPS)'; \ for file in $$list; do \ @@ -147,8 +147,8 @@ if test -f $$ifile; then \ ## Strip directory relfile=`echo "$$ifile" | sed 's|^.*/||'`; \ - echo " $(INSTALL_DATA) $$ifile $(DESTDIR)$(infodir)/$$relfile"; \ - $(INSTALL_DATA) $$ifile $(DESTDIR)$(infodir)/$$relfile; \ + echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \ + $(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \ else : ; fi; \ done; \ done @@ -174,10 +174,10 @@ ## instance if you don't have a dir file, install-info will fail. I ## think instead it should create a new dir file for you. This bug ## causes the `make distcheck' target to fail reliably. - echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$relfile";\ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ ## Use `|| :' here because Sun make passes -e to sh; if install-info ## fails then we'd fail if we used `;'. - install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$relfile || :;\ + install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ done; \ else : ; fi else ! %?LOCAL-TEXIS% @@ -207,8 +207,8 @@ relfile=`echo "$$file" | sed 's|^.*/||'`; \ ## install-info needs the actual info file. We use the installed one, ## rather than relying on one still being in srcdir or builddir. - echo " install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$relfile"; \ - install-info --info-dir=$(DESTDIR)$(infodir) --remove $(DESTDIR)$(infodir)/$$relfile; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ + install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ done; \ else :; fi @$(NORMAL_UNINSTALL) @@ -217,7 +217,7 @@ relfile=`echo "$$file" | sed 's|^.*/||'`; \ ## DJGPP-style info files. See comment in install-info-am. relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ - (if cd $(DESTDIR)$(infodir); then \ + (if cd "$(DESTDIR)$(infodir)"; then \ echo " rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9])"; \ rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ else :; fi); \ Index: tests/Makefile.am =================================================================== RCS file: /cvs/automake/automake/tests/Makefile.am,v retrieving revision 1.539.2.5 diff -u -r1.539.2.5 Makefile.am --- tests/Makefile.am 12 Jan 2004 22:57:22 -0000 1.539.2.5 +++ tests/Makefile.am 27 Jan 2004 23:02:11 -0000 @@ -246,6 +246,7 @@ insthook.test \ instman.test \ instman2.test \ +instspc.test \ interp.test \ interp2.test \ java.test \ Index: tests/instspc.test =================================================================== RCS file: tests/instspc.test diff -N tests/instspc.test --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tests/instspc.test 27 Jan 2004 23:02:11 -0000 @@ -0,0 +1,112 @@ +#! /bin/sh +# Copyright (C) 2004 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 2, 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., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# Check that installation to directory with space succeed. + +# This is mostly the same input as nobase.test, but we do not use +# libtool libraries, because Libtool does not preserve space in +# filenames (Issue observed with ltmain.sh (GNU libtool) 1.5a (1.1323 +# 2003/11/10 21:06:47)) + + +required='gcc' +. ./defs || exit 1 + +set -e + +# Make sure this system supports spaces in filenames. +mkdir 'a b' || exit 77 + +cat >> configure.in <<'EOF' +AC_PROG_CC +AC_PROG_RANLIB +AC_OUTPUT +EOF + +cat > Makefile.am << 'EOF' +foodir = $(prefix)/foo +fooexecdir = $(prefix)/foo + +foo_HEADERS = sub/base.h +nobase_foo_HEADERS = sub/nobase.h + +dist_foo_DATA = sub/base.dat +nobase_dist_foo_DATA = sub/nobase.dat + +dist_fooexec_SCRIPTS = sub/base.sh +nobase_dist_fooexec_SCRIPTS = sub/nobase.sh + +fooexec_PROGRAMS = sub/base +nobase_fooexec_PROGRAMS = sub/nobase +sub_base_SOURCES = source.c +sub_nobase_SOURCES = source.c + +fooexec_LIBRARIES = sub/libbase.a +nobase_fooexec_LIBRARIES = sub/libnobase.a +sub_libbase_a_SOURCES = source.c +sub_libnobase_a_SOURCES = source.c + +test-install-space: install + test -f "$(DESTDIR)/more space/foo/sub/nobase.h" + test ! -f "$(DESTDIR)/more space/foo/nobase.h" + test -f "$(DESTDIR)/more space/foo/base.h" + test -f "$(DESTDIR)/more space/foo/sub/nobase.dat" + test ! -f "$(DESTDIR)/more space/foo/nobase.dat" + test -f "$(DESTDIR)/more space/foo/base.dat" + test -f "$(DESTDIR)/more space/foo/sub/nobase.sh" + test ! -f "$(DESTDIR)/more space/foo/nobase.sh" + test -f "$(DESTDIR)/more space/foo/base.sh" + test -f "$(DESTDIR)/more space/foo/sub/nobase$(EXEEXT)" + test ! -f "$(DESTDIR)/more space/foo/nobase$(EXEEXT)" + test -f "$(DESTDIR)/more space/foo/base$(EXEEXT)" + test -f "$(DESTDIR)/more space/foo/sub/libnobase.a" + test ! -f "$(DESTDIR)/more space/foo/libnobase.a" + test -f "$(DESTDIR)/more space/foo/libbase.a" +EOF + +mkdir sub + +: > sub/base.h +: > sub/nobase.h +: > sub/base.dat +: > sub/nobase.dat +: > sub/base.sh +: > sub/nobase.sh + +cat >source.c <<'EOF' +int +main (int argc, char *argv[]) +{ + return 0; +} +EOF +cp source.c source2.c + +$ACLOCAL +$AUTOCONF +$AUTOMAKE -a + +mkdir build +cd build + +../configure --prefix '/more space' +$MAKE +dest=`pwd`/'with space'; +DESTDIR="$dest" $MAKE -e test-install-space -- Alexandre Duret-Lutz