From 9e59aa1bc8c4d215ea3e05eafec7181747206f67 Mon Sep 17 00:00:00 2001 From: Jameson Nash Date: Tue, 19 Apr 2022 11:16:25 -0400 Subject: [PATCH] release: check versions of autogen scripts are newer (#3554) Use libtoolize --force to ensure it updates m4 directory with the latest files. Add an option "release" to the autogen.sh script that checks the versions of the input tools, so that we know they are always using the latest version for each release. --- autogen.sh | 35 ++++++++++++++++++++++++++++++++--- m4/libuv-check-versions.m4 | 7 +++++++ 2 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 m4/libuv-check-versions.m4 diff --git a/autogen.sh b/autogen.sh index 271c2ee8..bfd8f3e6 100755 --- a/autogen.sh +++ b/autogen.sh @@ -14,9 +14,16 @@ # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +set -eu cd `dirname "$0"` -if [ "$LIBTOOLIZE" = "" ] && [ "`uname`" = "Darwin" ]; then +if [ "${1:-dev}" == "release" ]; then + export LIBUV_RELEASE=true +else + export LIBUV_RELEASE=false +fi + +if [ "${LIBTOOLIZE:-}" = "" ] && [ "`uname`" = "Darwin" ]; then LIBTOOLIZE=glibtoolize fi @@ -25,9 +32,17 @@ AUTOCONF=${AUTOCONF:-autoconf} AUTOMAKE=${AUTOMAKE:-automake} LIBTOOLIZE=${LIBTOOLIZE:-libtoolize} +aclocal_version=`"$ACLOCAL" --version | head -n 1 | sed 's/[^.0-9]//g'` +autoconf_version=`"$AUTOCONF" --version | head -n 1 | sed 's/[^.0-9]//g'` automake_version=`"$AUTOMAKE" --version | head -n 1 | sed 's/[^.0-9]//g'` automake_version_major=`echo "$automake_version" | cut -d. -f1` automake_version_minor=`echo "$automake_version" | cut -d. -f2` +libtoolize_version=`"$LIBTOOLIZE" --version | head -n 1 | sed 's/[^.0-9]//g'` + +if [ $aclocal_version != $automake_version ]; then + echo "FATAL: aclocal version appears not to be from the same as automake" + exit 1 +fi UV_EXTRA_AUTOMAKE_FLAGS= if test "$automake_version_major" -gt 1 || \ @@ -39,8 +54,22 @@ fi echo "m4_define([UV_EXTRA_AUTOMAKE_FLAGS], [$UV_EXTRA_AUTOMAKE_FLAGS])" \ > m4/libuv-extra-automake-flags.m4 -set -ex -"$LIBTOOLIZE" --copy +(set -x +"$LIBTOOLIZE" --copy --force "$ACLOCAL" -I m4 +) +if $LIBUV_RELEASE; then + "$AUTOCONF" -o /dev/null m4/libuv-check-versions.m4 + echo " +AC_PREREQ($autoconf_version) +AC_INIT([libuv-release-check], [0.0]) +AM_INIT_AUTOMAKE([$automake_version]) +LT_PREREQ($libtoolize_version) +AC_OUTPUT +" > m4/libuv-check-versions.m4 +fi +( +set -x "$AUTOCONF" "$AUTOMAKE" --add-missing --copy +) diff --git a/m4/libuv-check-versions.m4 b/m4/libuv-check-versions.m4 new file mode 100644 index 00000000..a280596d --- /dev/null +++ b/m4/libuv-check-versions.m4 @@ -0,0 +1,7 @@ + +AC_PREREQ(2.71) +AC_INIT([libuv-release-check], [0.0]) +AM_INIT_AUTOMAKE([1.16.5]) +LT_PREREQ(2.4.6) +AC_OUTPUT +