Skip to content

Commit

Permalink
Use find with IFS for loop for all configure searches
Browse files Browse the repository at this point in the history
  • Loading branch information
dajobe committed Oct 1, 2024
1 parent fa4ec59 commit f1d79f3
Showing 1 changed file with 30 additions and 23 deletions.
53 changes: 30 additions & 23 deletions autogen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
#
# This script is in the public domain
#
# disabling these because the variables are defined in an eval.
# shellcheck disable=SC2034,SC2154

# Directory for the sources
SRCDIR=${SRCDIR-.}
Expand All @@ -48,29 +50,39 @@ CONFIG_DIR=${CONFIG_DIR-../config}
# GIT sub modules file
GITMODULES='.gitmodules'

autogen_get_version="$PWD/autogen-get-version.pl"
tmp1=$(mktemp)
trap 'rm -f $autogen_get_version $tmp1' 0 1


# The programs required for configuring which will be searched for
# in the current PATH.
# Set an envariable of the same name in uppercase, to override scan
#
programs="automake aclocal autoconf autoheader libtoolize"
confs=$(find . -name configure.ac -print | grep -v /releases/)

gtkdoc_args=
if grep "^GTK_DOC_CHECK" "$confs" >/dev/null; then
programs="$programs gtkdocize"
gtkdoc_args="--enable-gtk-doc"
fi
if grep "^AC_CHECK_PROGS.SWIG" "$confs" >/dev/null; then
programs="$programs swig"
fi
ltdl_args=
if grep "^AC_LIBLTDL_" "$confs" >/dev/null; then
ltdl_args="--ltdl"
fi
silent_args=
if grep "^AM_SILENT_RULES" "$confs" >/dev/null; then
silent_args="--enable-silent-rules"
fi

# Using a temporary file for find output not find | while so we can
# change variables outside subshell
find "." -name "configure.ac" -print | \
grep -v /releases/ > "$tmp1"
while IFS= read -r conf; do
if grep "^GTK_DOC_CHECK" "$conf" >/dev/null; then
programs="$programs gtkdocize"
gtkdoc_args="--enable-gtk-doc"
fi
if grep "^AC_CHECK_PROGS.SWIG" "$conf" >/dev/null; then
programs="$programs swig"
fi
if grep "^AC_LIBLTDL_" "$conf" >/dev/null; then
ltdl_args="--ltdl"
fi
if grep "^AM_SILENT_RULES" "$conf" >/dev/null; then
silent_args="--enable-silent-rules"
fi
done < "$tmp1"

# Some dependencies for autotools:
# automake 1.13 requires autoconf 2.65
Expand Down Expand Up @@ -145,9 +157,6 @@ print "\$vn\n";
exit 0;
EOF

autogen_get_version="$PWD/autogen-get-version.pl"

trap 'rm -f $autogen_get_version' 0 1


update_prog_version() {
Expand Down Expand Up @@ -298,10 +307,9 @@ fi

here="$PWD"

tmp=$(mktemp)
find "$SRCDIR" -name configure.ac -print | \
grep -v /releases/ > "$tmp"
while read -r coin; do
grep -v /releases/ > "$tmp1"
while IFS= read -r coin; do
status=0
dir=$(dirname "$coin")
if test -f "$dir/NO-AUTO-GEN"; then
Expand Down Expand Up @@ -400,8 +408,7 @@ while read -r coin; do
exit "$status"
fi

done < "$tmp"
rm -f "$tmp"
done < "$tmp1"



Expand Down

0 comments on commit f1d79f3

Please sign in to comment.