Heres a script that I use to generate configure.in from a template
file with @Makefiles@ in AC_OUTPUT. This is so that developers can add
directories without having to change configure.in.
Is this of use to anyone? If you have a better/simpler version let me
know, as this was a quick hack. I think its okay to require perl as
automake does, but sed/awk versions are welcome.
#!/bin/sh
# Builds configure.in from configure.inn
# Expects parameters:
# 1 - srcdir
# 2 - $@ (e.g. ../configure.in)
# list makefiles so that a Makefile is never built before its parent
list_makefiles() {
cd $1 &&
find . -name Makefile.am -print |
xargs -i sh -c 'depth=`echo {} | tr -cd '/' | wc -c` ; echo $depth {}' |
sort +0n |
cut -d\ -f2 |
sed -e 's/\.am$//' -e 's/^\.\///' | xargs echo
}
Makefiles=`list_makefiles $1`
perl -nle "s%\\@Makefiles\\@%${Makefiles}%g; print" < $1/configure.inn > "$2"t
rm -f "$2";
mv "$2"t "$2"