Change into the containing directory before running m4. The Makefile
machinery may want to use some other files lying around to do its thing,
and it makes life easier if it doesn't have to do stupid games with
relative-to-the-project-root file names.
if [ "$configure" ]; then
grep >/dev/null AM_PROG_LIBTOOL $configure && libtoolize
find . -name Makefile.m4 -print | while read m4; do
if [ "$configure" ]; then
grep >/dev/null AM_PROG_LIBTOOL $configure && libtoolize
find . -name Makefile.m4 -print | while read m4; do
- am=$(echo $m4 | sed 's:.m4:.am:')
- m4 $m4 >$am.new
- mv $am.new $am
+ dir=$(echo $m4 | sed 's:/[^/]*$::')
+ (cd $dir &&
+ m4 Makefile.m4 >Makefile.am.new &&
+ mv Makefile.am.new Makefile.am)