From 34bd750be930dee47ba6114f211aa97935939ecc Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 5 Nov 2021 20:49:22 -0400 Subject: build: slim down autoconf-archive macro search Only copy in files that define the macros we need and not ones that reference the macros. This avoids copying a lot unused files in. Signed-off-by: Mike Frysinger --- autogen.sh | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'autogen.sh') diff --git a/autogen.sh b/autogen.sh index e583300..432152b 100755 --- a/autogen.sh +++ b/autogen.sh @@ -10,11 +10,18 @@ rm -f m4/*.m4 # not everyone has sys-devel/autoconf-archive installed has() { [[ " ${*:2} " == *" $1 "* ]] ; } import_ax() { - local macro content m4 lm4s=() + local macro content m4 found lm4s=() content=$(sed -e '/^[[:space:]]*#/d' -e 's:\.*::' "$@") for macro in $(echo "${content}" | grep -o '\' | sort -u) ; do - for m4 in $(grep -rl "\[${macro}\]" /usr/share/aclocal/) ; do - has ${m4} "${m4s[@]}" || lm4s+=( ${m4} ) + if ! found=$(grep -rl "AC_DEFUN(\[${macro}\]" /usr/share/aclocal/) ; then + echo "error: ${macro}: unable to locate m4 definition" + exit 1 + fi + for m4 in ${found} ; do + if ! has ${m4} "${m4s[@]}" "${lm4s[@]}" ; then + echo "$*: ${macro}: ${m4}" + lm4s+=( ${m4} ) + fi done done if [[ ${#lm4s[@]} -gt 0 ]] ; then -- cgit v1.2.3-65-gdbad