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 D89DC3857813 for ; Fri, 11 Mar 2022 22:40:24 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D89DC3857813 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 c.2.0.2.0.a.8.c.1.f.f.7.c.c.9.0.d.a.0.2.5.1.e.d.0.b.8.0.1.0.0.2.ip6.arpa ([2001:8b0:de15:20ad:9cc:7ff1:c8a0:202c] 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 1nSnvr-0002kr-AD for cygwin-apps@cygwin.com; Fri, 11 Mar 2022 22:40:23 +0000 From: Adam Dinwoodie To: cygwin-apps@cygwin.com Subject: [PATCH cygport] autotools.cygclass: correctly detect Autoconf 2.70+ Date: Fri, 11 Mar 2022 22:40:05 +0000 Message-Id: <20220311224005.12377-1-adam@dinwoodie.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220311090520.5ztk6ybc6fv7oyvd@lucy.dinwoodie.org> References: <20220311090520.5ztk6ybc6fv7oyvd@lucy.dinwoodie.org> Reply-To: cygwin-apps@cygwin.com MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.5 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: Fri, 11 Mar 2022 22:40:26 -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. --- 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