Hi Stepan, Stepan Kasal wrote: > > So I suppose something like this > > `IFS=:; for d in '' '$(srcdir)' $(VPATH); do \ > test -n "$$d" && d=$$d/; \ > test -f "$$d"%SOURCE% && echo "$$d" && break; \ > done`%SOURCE% > > Could you test whether this works for you? >
Something like IFS=:; for d in a:b; do echo $d; done works for Sun's /bin/sh, but not for Bash 2.05b (even if you use --posix). The Bash folks say that this has been done to fix a security hole. I have another concern: In your version $(srcdir) gets a higher priority than the $(VPATH) set in Makefile.am. If Automake instantiates the suffix rules to generate *.o files, then this is different, AFAICS. So how about this? `IFS=:; x=":$(VPATH)"; \ for d in $$x; do \ test -n "$$d" && d=$$d/; \ test -f "$$d"%SOURCE% && echo "$$d" && break; done`%SOURCE% It allows the writer of Makefile.am to completely ignore $(srcdir), if he wants to. Regards Harri