Some shells, like NetBSD 5.1 /bin/ksh, have a bug that causes wildcards resulting from an unquoted parameter expansion not to be expanded as expected:
$ touch a b c d $ /bin/sh -c 'var="[ab]" && echo $var' # As expected. a b $ /bin/ksh -c 'var="[ab]" && echo $var' # Oops. [ab] This was causing a failure in the 'extra11.test' test on NetBSD. * lib/distdir.am: Work around this ksh bug. --- This patch fixes the described problem, but then, ouch :-(, it breaks the 'dollar.test' test case, which checks that automake supports files with `$' characters in their names (Java people need this). Any idea on what we should do? Stefano lib/am/distdir.am | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/am/distdir.am b/lib/am/distdir.am index 8a64e5a..56570ab 100644 --- a/lib/am/distdir.am +++ b/lib/am/distdir.am @@ -169,10 +169,18 @@ endif %?TOPDIR_P% ## Also rewrite $(top_srcdir) (which sometimes appears in DISTFILES, and can ## be absolute) by $(top_builddir) (which is always relative). $(srcdir) will ## be prepended later. - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ +## + dist_files=`\ +## Use this instead of the usual idiom: +## list='$(DISTFILES)'; for file in $$list; do ... +## to better support wildcards in EXTRA_DIST (for make implementations +## that accepts them, as e.g., GNU make). This is required for shells, +## like /bin/ksh on NetBSD 5.1, that erroneously don't expand wildcards +## resulting from an unquoted parameter expansion. + for file in ' ' $(DISTFILES); do echo $$file; done \ + | sed -e '/^ *$$/d' \ + -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ ## (The second `t' command clears the flag for the next round.) ## ## Make the subdirectories for the files. -- 1.7.7.3