mdw-setup: Fix for constructing Makefile.am from m4 source.
authorMark Wooding <mdw@distorted.org.uk>
Fri, 10 Mar 2006 00:33:30 +0000 (00:33 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Fri, 10 Mar 2006 00:33:30 +0000 (00:33 +0000)
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.

mdw-setup

index d18a49a..276b6da 100755 (executable)
--- a/mdw-setup
+++ b/mdw-setup
@@ -44,9 +44,10 @@ done
 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)
   done
   mkaclocal
   autoconf
   done
   mkaclocal
   autoconf