Re: [PATCH cygport] autotools.cygclass: correctly detect Autoconf 2.70+

2022-03-13 Thread Adam Dinwoodie
On Sat, Mar 12, 2022 at 01:02:39PM +, Jon Turney wrote:
> On 11/03/2022 22:40, Adam Dinwoodie wrote:
> > -   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_maj -ge 2 -a $confver_min -ge 60 ] || [ $confver_maj -ge 
> > 3 ]
> 
> Great. Thanks.
> 
> I think it would be acceptable to error on autoconf >=3.0, rather than
> assuming it's going to be autoconf 2.6+ compatible.

No problem, I'll respin now.  I'd thought about doing exactly that, but
the current code looked like it was designed to assume things would be
fine unless there was a specific reason to bail out, so I tried to
follow that paradigm rather than bail out when there was no known reason
for doing so.


Re: [PATCH cygport] autotools.cygclass: correctly detect Autoconf 2.70+

2022-03-12 Thread Jon Turney

On 11/03/2022 22:40, Adam Dinwoodie wrote:

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.
---
  cygclass/autotools.cygclass | 34 +++---
  1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/cygclass/autotools.cygclass b/cygclass/autotools.cygclass
index cce9be0..2ab5626 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;
@@ -651,6 +653,8 @@ cygconf() {
  
  	configure="${confdir}/configure"

confver=$(grep -m 1 'GNU Autoconf' ${configure} | cut -d ' ' -f 6)
+   confver_maj=${confver%%.*}
+   confver_min=${confver##*.}
  
  	# AC_CONFIG_FILES should not be dist'ed, but it sometimes happens anyway

eval $(grep -h '^ac_config_files=' ${configure})
@@ -678,18 +682,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_maj -ge 2 -a $confver_min -ge 60 ] || [ $confver_maj -ge 
3 ]


Great. Thanks.

I think it would be acceptable to error on autoconf >=3.0, rather than 
assuming it's going to be autoconf 2.6+ compatible.


[PATCH cygport] autotools.cygclass: correctly detect Autoconf 2.70+

2022-03-11 Thread Adam Dinwoodie
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.
---
 cygclass/autotools.cygclass | 34 +++---
 1 file changed, 23 insertions(+), 11 deletions(-)

diff --git a/cygclass/autotools.cygclass b/cygclass/autotools.cygclass
index cce9be0..2ab5626 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;
@@ -651,6 +653,8 @@ cygconf() {
 
configure="${confdir}/configure"
confver=$(grep -m 1 'GNU Autoconf' ${configure} | cut -d ' ' -f 6)
+   confver_maj=${confver%%.*}
+   confver_min=${confver##*.}
 
# AC_CONFIG_FILES should not be dist'ed, but it sometimes happens anyway
eval $(grep -h '^ac_config_files=' ${configure})
@@ -678,18 +682,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_maj -ge 2 -a $confver_min -ge 60 ] || [ $confver_maj -ge 
3 ]
+   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_maj -ge 2 -a $confver_min -ge 50 ] || [ $confver_maj -ge 
3 ]
+   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