public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Adam Dinwoodie <adam@dinwoodie.org>
To: cygwin-apps@cygwin.com
Subject: [PATCH cygport v3] autotools.cygclass: correctly detect Autoconf 2.70+
Date: Mon, 14 Mar 2022 22:15:16 +0000	[thread overview]
Message-ID: <20220314221516.13101-1-adam@dinwoodie.org> (raw)
In-Reply-To: <20220314210539.inhr45iiryiqkcqd@lucy.dinwoodie.org>

The latest version of Autoconf is 2.71, but the version detection
incorrectly considers 2.70 and higher as being the same as 2.59 and
lower for the purposes of specifying documentation directories.  Correct
that, and make the version detection a bit more future-proof by parsing
out the actual version parts and performing numeric comparison.

While we're at it, add a bit more commentary explaining the intent of
the different behaviour over the different Autoconf versions.
---
Interdiff against v2:
  diff --git a/cygclass/autotools.cygclass b/cygclass/autotools.cygclass
  index 38ac8f0..b40828b 100644
  --- a/cygclass/autotools.cygclass
  +++ b/cygclass/autotools.cygclass
  @@ -652,7 +652,7 @@ cygconf() {
   	fi
   
   	configure="${confdir}/configure"
  -	confver=$(grep -m 1 'GNU Autoconf' ${configure} | cut -d ' ' -f 6)
  +	confver="$("$configure" --version | sed -rn 's/.*GNU Autoconf ([0-9\.]+)/\1/p')"
   	confver_maj=${confver%%.*}
   	confver_min=${confver##*.}
   	if [ $confver_maj -ne 2 ]

 cygclass/autotools.cygclass | 40 ++++++++++++++++++++++++++-----------
 1 file changed, 28 insertions(+), 12 deletions(-)

diff --git a/cygclass/autotools.cygclass b/cygclass/autotools.cygclass
index cce9be0..b40828b 100644
--- a/cygclass/autotools.cygclass
+++ b/cygclass/autotools.cygclass
@@ -619,6 +619,8 @@ cygconf() {
 	local confdir;
 	local configure;
 	local confver;
+	local confver_maj;
+	local confver_min;
 	local f;
 	local foo_config;
 	local prefix;
@@ -650,7 +652,13 @@ cygconf() {
 	fi
 
 	configure="${confdir}/configure"
-	confver=$(grep -m 1 'GNU Autoconf' ${configure} | cut -d ' ' -f 6)
+	confver="$("$configure" --version | sed -rn 's/.*GNU Autoconf ([0-9\.]+)/\1/p')"
+	confver_maj=${confver%%.*}
+	confver_min=${confver##*.}
+	if [ $confver_maj -ne 2 ]
+	then
+		error "unexpected autoconf version";
+	fi
 
 	# AC_CONFIG_FILES should not be dist'ed, but it sometimes happens anyway
 	eval $(grep -h '^ac_config_files=' ${configure})
@@ -678,18 +686,26 @@ cygconf() {
 		confargs+=" --libdir=${prefix}/${MULTILIB_LIBDIR}"
 	fi
 
-	case "x${confver}" in
-		x2.6[0-9]*)
-			confargs+=" --docdir=/usr/share/doc/${PN} --htmldir=/usr/share/doc/${PN}/html"
-			;;
-		*)
-			confargs+=" --infodir=${prefix}/share/info --mandir=${prefix}/share/man"
-			;;
-	esac
+	if [ $confver_min -ge 60 ]
+	then
+		# Autoconf version supports --docdir and --htmldir, which will
+		# need to be specified manually.  It also supports --infodir
+		# and --mandir, but the defaults for those match the FHS.
+		confargs+=" --docdir=/usr/share/doc/${PN} --htmldir=/usr/share/doc/${PN}/html"
+	else
+		# Autoconf version does not support --docdir or --htmldir, so
+		# don't specify those.  Set --infodir and --mandir, as those
+		# have defaults that don't match the FHS.
+		confargs+=" --infodir=${prefix}/share/info --mandir=${prefix}/share/man"
+	fi
 
-	case "x${confver}" in
-		x2.[5-9]*)	confargs+=" -C" ;;
-	esac
+
+	if [ $confver_min -ge 50 ]
+	then
+		# Always use a cache file; prior to 2.50, this was the default,
+		# thereafter it needs to be requested explicitly.
+		confargs+=" -C"
+	fi
 
 	if cross_compiling || inherited toolchain
 	then
-- 
2.35.1


  reply	other threads:[~2022-03-14 22:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10 16:41 Cygport configure script argument handling Adam Dinwoodie
2022-03-11  5:38 ` Yaakov Selkowitz
2022-03-11  9:05   ` Adam Dinwoodie
2022-03-11 22:40     ` [PATCH cygport] autotools.cygclass: correctly detect Autoconf 2.70+ Adam Dinwoodie
2022-03-12 13:02       ` Jon Turney
2022-03-13 20:31         ` Adam Dinwoodie
2022-03-13 20:44         ` [PATCH cygport v2] " Adam Dinwoodie
2022-03-14 19:05           ` Jon Turney
2022-03-14 21:05             ` Adam Dinwoodie
2022-03-14 22:15               ` Adam Dinwoodie [this message]
2022-04-13 17:58                 ` [PATCH cygport v3] " Jon Turney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220314221516.13101-1-adam@dinwoodie.org \
    --to=adam@dinwoodie.org \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).