[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] supporting enhanced regexes on OS X [patch]
From: |
Thomas Rosenau |
Subject: |
Re: [Nano-devel] supporting enhanced regexes on OS X [patch] |
Date: |
Mon, 14 Mar 2016 20:40:17 +0100 |
Mike,
thanks for pointing that out. I am the author of the patch, and by no
means an autoconf expert, so please bear with me.
Feel free to improve the patch at will.
AC_CACHE_CHECK certainly looks good, but I'm not sure about
AC_PREPROC_IFELSE. After digging through the docs, I found these
interesting parts:
> …you certainly want to run the compiler, not the preprocessor.
> Resist the temptation of following the easiest path.
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/Running-the-Preprocessor.html
and
> …check for C preprocessor symbols, either defined by header files
> or predefined by the C preprocessor:
> […] (i) use AC_LANG_PROGRAM, and (ii) run the compiler
https://www.gnu.org/software/autoconf/manual/autoconf-2.69/html_node/AC_005fACT_005fIFELSE-vs-AC_005fTRY_005fACT.html
I agree that AC_TRY_RUN is overkill (and obsolete), so according to
the above, shouldn't AC_COMPILE_IFELSE be used instead?
Kind regards
Thomas
> Gesendet: Montag, 14. März 2016 um 15:36 Uhr
> Von: "Mike Frysinger" <address@hidden>
> An: "Benno Schulenberg" <address@hidden>
> Cc: Nano <address@hidden>, "Thomas Rosenau" <address@hidden>
> Betreff: Re: [Nano-devel] supporting enhanced regexes on OS X [patch]
>
> On 14 Mar 2016 12:00, Benno Schulenberg wrote:
> > --- nano/configure.ac (revision 5734)
> > +++ nano/configure.ac (revision )
> > @@ -572,6 +572,25 @@
> > fi
> > fi
> >
> > +AC_MSG_CHECKING([for REG_ENHANCED flag support])
> > +nano_reg_extended="REG_EXTENDED"
> > +AC_TRY_RUN([
>
> AC_TRY_RUN should pretty much never be used. this code snippet is a
> great example of that being the case too -- all it's doing is looking
> for a define in a header.
>
> > +#include <regex.h>
> > +int main(void)
> > +{
> > +#ifdef REG_ENHANCED
> > + return 0;
> > +#else
> > + return 1;
> > +#endif
> > +}],
> > + AC_MSG_RESULT(yes)
> > + nano_reg_extended="REG_EXTENDED | REG_ENHANCED",
> > + AC_MSG_RESULT(no),
> > + AC_MSG_WARN([*** Can't check for REG_ENHANCED flag support when
> > cross-compiling])
> > +)
>
> this should be using AC_CACHE_CHECK & AC_PREPROC_IFELSE instead
> -mike
>