aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xautogen.sh24
1 files changed, 21 insertions, 3 deletions
diff --git a/autogen.sh b/autogen.sh
index 3d49418..f552d22 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -40,10 +40,28 @@ v --fold="gnulib-tool" gnulib-tool \
# not everyone has sys-devel/autoconf-archive installed
v tar xf travis/autotools.tar.xz
-for macro in $(grep -o '\<AX[A-Z_]*\>' configure.ac | sort -u) ; do
- if m4=$(grep -rl "\[${macro}\]" /usr/share/aclocal/) ; then
- v cp $m4 ${m4dir}/
+has() { [[ " ${*:2} " == *" $1 "* ]] ; }
+import_ax() {
+ local macro content m4 lm4s=()
+ content=$(sed -e '/^[[:space:]]*#/d' -e 's:\<dnl\>.*::' "$@")
+ for macro in $(echo "${content}" | grep -o '\<AX[A-Z_]*\>' | sort -u) ; do
+ for m4 in $(grep -rl "\[${macro}\]" /usr/share/aclocal/) ; do
+ has ${m4} "${m4s[@]}" || lm4s+=( ${m4} )
+ done
+ done
+ if [[ ${#lm4s[@]} -gt 0 ]] ; then
+ cp -v `printf '%s\n' ${lm4s[@]} | sort -u` autotools/m4/
+ m4s+=( "${lm4s[@]}" )
fi
+}
+m4s=()
+import_ax configure.ac
+curr=1
+new=0
+while [[ ${curr} -ne ${new} ]] ; do
+ curr=${#m4s[@]}
+ import_ax autotools/m4/ax_*.m4
+ new=${#m4s[@]}
done
export AUTOMAKE="automake --foreign"