From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dalaran.tastycake.net (dalaran.tastycake.net [IPv6:2001:ba8:0:1c0::1:1]) by sourceware.org (Postfix) with ESMTPS id BDBFA3858C2D for ; Sun, 13 Mar 2022 20:44:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org BDBFA3858C2D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dinwoodie.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dinwoodie.org Received: from 0.e.5.1.d.8.b.4.5.9.0.b.8.1.d.6.d.a.0.2.5.1.e.d.0.b.8.0.1.0.0.2.ip6.arpa ([2001:8b0:de15:20ad:6d18:b095:4b8d:15e0] helo=dinwoodie.org) by dalaran.tastycake.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nTV4X-0006ge-81 for cygwin-apps@cygwin.com; Sun, 13 Mar 2022 20:44:13 +0000 From: Adam Dinwoodie To: cygwin-apps@cygwin.com Subject: [PATCH cygport v2] autotools.cygclass: correctly detect Autoconf 2.70+ Date: Sun, 13 Mar 2022 20:44:03 +0000 Message-Id: <20220313204403.3372-1-adam@dinwoodie.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <70a9c487-e302-5342-61ce-5b917d089ec6@dronecode.org.uk> References: <70a9c487-e302-5342-61ce-5b917d089ec6@dronecode.org.uk> Reply-To: cygwin-apps@cygwin.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin-apps@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin package maintainer discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Mar 2022 20:44:17 -0000 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 v1: diff --git a/cygclass/autotools.cygclass b/cygclass/autotools.cygclass index 2ab5626..38ac8f0 100644 --- a/cygclass/autotools.cygclass +++ b/cygclass/autotools.cygclass @@ -655,6 +655,10 @@ cygconf() { confver=$(grep -m 1 'GNU Autoconf' ${configure} | cut -d ' ' -f 6) 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}) @@ -682,7 +686,7 @@ cygconf() { confargs+=" --libdir=${prefix}/${MULTILIB_LIBDIR}" fi - if [ $confver_maj -ge 2 -a $confver_min -ge 60 ] || [ $confver_maj -ge 3 ] + if [ $confver_min -ge 60 ] then # Autoconf version supports --docdir and --htmldir, which will # need to be specified manually. It also supports --infodir @@ -696,7 +700,7 @@ cygconf() { fi - if [ $confver_maj -ge 2 -a $confver_min -ge 50 ] || [ $confver_maj -ge 3 ] + 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. cygclass/autotools.cygclass | 38 ++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/cygclass/autotools.cygclass b/cygclass/autotools.cygclass index cce9be0..38ac8f0 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,12 @@ cygconf() { configure="${confdir}/configure" confver=$(grep -m 1 'GNU Autoconf' ${configure} | cut -d ' ' -f 6) + 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