delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/12/07/15:04:56

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: Dean Scarff <dos AT scarff DOT id DOT au>
Subject: Re: Cygport bug: autoconf 2.6x check fails 2.61.
Date: Sat, 08 Dec 2007 05:03:52 +0900
Lines: 123
Message-ID: <m21w9yclw7.fsf@scarff.id.au>
References: <announce DOT E2260BB9-DDD1-42BD-9916-9A23DEDF97F9 AT scarff DOT id DOT au> <82wsrubplj DOT fsf AT vzell-de DOT de DOT oracle DOT com> <m21w9yilga DOT fsf AT scarff DOT id DOT au> <m2ir3ah1ov DOT fsf_-_ AT scarff DOT id DOT au> <060901c838f5$51c0c530$2e08a8c0 AT CAM DOT ARTIMI DOT COM> <m263zacspr DOT fsf AT scarff DOT id DOT au> <47599308 DOT 2000003 AT users DOT sourceforge DOT net>
Mime-Version: 1.0
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (darwin)
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Yaakov wrote:
> Dean Scarff wrote:
>> In short, the grep + cut doesn't quite work like it used to because
>> there is a trailing period.  The case glob (which is not a POSIX
>> regex under the Bourne shell, right?) matches "x2.61." as well as
>> "x2.60", which is what we want.

> AFAIK that trailing period wasn't there with 2.60.  I have already

That's what I assumed (and indicated with my examples too).

> fixed this locally, but I see it hasn't got into CVS yet; it will
> soon.

>> Either way the whole thing isn't a robust check, autoconf's manual
>> doesn't make any claims to insert that particular string.

> Can you find a better solution?  PTC.

% wtf PTC
Gee...  I don't know what PTC means...

Test by feature rather than by version: I guess I'm getting a little
inspiration from the subject material here (autoconf).  Also there's
no need to be so sensitive to context and formatting changes (which a
grep | cut certainly is).  I've got two mutually exclusive patches,
you can choose one or none as you see fit; I haven't tested them
against all the obvious Autoconf versions either (2.59, 2.60 and 2.61
would seem prudent).  It's all a bit of an overkill though: I'm sure
my last patch will be fine for the forseeable future (and I feel bad
for dropping noisy patches on the cygwin list).

The first figures the help output is relatively stable, and
essentially all you want to know is whether configure supports a
docdir switch, so test for that.  Of course, this will have problems
if someone clever decides to include "--docdir=" in their help output,
and somehow doesn't support it as an option (although all the autoconf
options are currently hardcoded in autoconf's general.m4).
Furthermore if the list of installation directory variables supported
by Autoconf keeps growing, they might just drop support for listing them
in the help in the one-line-per-option format.
===================================================================
RCS file: /cvsroot/cygwin-ports/cygport/bin/cygport.in,v
retrieving revision 1.89
diff -u -3 -r1.89 cygport.in
--- bin/cygport.in      3 Dec 2007 23:00:54 -0000       1.89
+++ bin/cygport.in      7 Dec 2007 19:08:39 -0000
@@ -1007,15 +1007,12 @@
                          --sbindir=/usr/sbin --libexecdir=/usr/sbin \
                          --localstatedir=/var --sysconfdir=/etc"
 
-       case "x$(grep -m 1 'GNU Autoconf' ${configure} | cut -d ' ' -f 6)" in
-               x2.6[0-9])
-                       confargs+=" --datarootdir=/usr/share --docdir=/usr/share/doc/${P}"
-                       ;;
-               *)
-                       confargs+=" --datadir=/usr/share --infodir=/usr/share/info \
-                               --mandir=/usr/share/man"
-                       ;;
-       esac
+       if ${configure} --help | grep -e --docdir= >/dev/null ; then
+               confargs+=" --datarootdir=/usr/share --docdir=/usr/share/doc/${P}"
+       else
+               confargs+=" --datadir=/usr/share --infodir=/usr/share/info \
+                          --mandir=/usr/share/man"
+       fi
 
        # AC_HAVE_MMAP fails despite a working mmap, so we force this to yes
        # (see http://www.cygwin.com/ml/cygwin/2004-09/msg00741.html

The second approach is to actually *try* to use docdir.  If configure
doesn't support it then it will fail quickly.  If configure does
support it but fails for other reasons, it will write to config.log.
This relies on the config.log file and behaviour.  It's also not very
extensible when there's more future-autoconf-features you want to take
advantage of.  You can deal with that in the future, no?  It's not the
most elegant piece of code either.
===================================================================
RCS file: /cvsroot/cygwin-ports/cygport/bin/cygport.in,v
retrieving revision 1.89
diff -u -3 -r1.89 cygport.in
--- bin/cygport.in      3 Dec 2007 23:00:54 -0000       1.89
+++ bin/cygport.in      7 Dec 2007 19:48:57 -0000
@@ -1006,25 +1006,26 @@
        confargs="--prefix=/usr --exec-prefix=/usr --bindir=/usr/bin \
                          --sbindir=/usr/sbin --libexecdir=/usr/sbin \
                          --localstatedir=/var --sysconfdir=/etc"
-
-       case "x$(grep -m 1 'GNU Autoconf' ${configure} | cut -d ' ' -f 6)" in
-               x2.6[0-9])
-                       confargs+=" --datarootdir=/usr/share --docdir=/usr/share/doc/${P}"
-                       ;;
-               *)
-                       confargs+=" --datadir=/usr/share --infodir=/usr/share/info \
-                               --mandir=/usr/share/man"
-                       ;;
-       esac
+       docdir=" --datarootdir=/usr/share --docdir=/usr/share/doc/${P}"
+       nodocdir=" --datadir=/usr/share --infodir=/usr/share/info \
+                          --mandir=/usr/share/man"
 
        # AC_HAVE_MMAP fails despite a working mmap, so we force this to yes
        # (see http://www.cygwin.com/ml/cygwin/2004-09/msg00741.html
        # and following thread for details)
        export ac_cv_func_mmap_fixed_mapped=yes;
 
+       # if Autoconf-generated configure scripts fail with an
+       # unrecognised option, they do not write a log.
+       configured=no
        verbose ${configure} \
-               --srcdir="${confdir}" ${confargs} "${@}" ${CYGCONF_ARGS} \
-               || error "configure failed"
+               --srcdir="${confdir}" ${confargs} ${docdir} "${@}" ${CYGCONF_ARGS} && \
+               configured=yes
+       [ "${configured}" = no -a ! -s config.log ] && \
+               verbose ${configure} \
+               --srcdir="${confdir}" ${confargs} ${nodocdir} "${@}" ${CYGCONF_ARGS} && \
+               configured=yes
+       [ "${configured}" = yes ] || error "configure failed"
 }
 
 # cmake configuration


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019