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} "[EMAIL PROTECTED]" ${CYGCONF_ARGS} \ - || error "configure failed" + --srcdir="${confdir}" ${confargs} ${docdir} "[EMAIL PROTECTED]" ${CYGCONF_ARGS} && \ + configured=yes + [ "${configured}" = no -a ! -s config.log ] && \ + verbose ${configure} \ + --srcdir="${confdir}" ${confargs} ${nodocdir} "[EMAIL PROTECTED]" ${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/