bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: configure warning suggests an anti-pattern


From: Bruno Haible
Subject: Re: configure warning suggests an anti-pattern
Date: Sun, 07 Mar 2021 17:15:08 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-203-generic; KDE/5.18.0; x86_64; ; )

Hi Thomas,

> > This is the recommended way to do, per the Autoconf manual
> > <https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/html_node/Preset-Output-Variables.html>
> ...
> > $ ./configure
> > ...
> > checking for gcc -mabi=32 option to accept ANSI C... none needed
> > checking $CFLAGS variable... ok
> > checking $CC variable... broken
> > configure: WARNING: your environment uses the CC variable to hold 
> > CFLAGS/CPPFLAGS options
> > ...
> > 
> > There is nothing to warn about! Putting '-mabi=32' into CFLAGS or CPPFLAGS
> > would be an anti-pattern, because it would break 'config.guess'.
> 
> hmm - that's from this bit of script:
> 
> AC_MSG_CHECKING(\$CC variable)
> case "$CC" in
> (*[[\ \       ]]-*)
>       AC_MSG_RESULT(broken)
>       AC_MSG_WARN(your environment uses the CC variable to hold 
> CFLAGS/CPPFLAGS options)

Yes, that looks like the piece of script that produces the warning.

> ...which dates from 2016/5/21.  ncurses uses the C preprocessor flags,
> which (owing to rote copy/paste on the part of some users) ended up in
> $CFLAGS and even $CC (and produced a broken configuration).  The comment
> you cite is by developers who don't solve problems of that sort.

What do you mean? The text in the Autoconf manual is from me, with approval
from Paul Eggert, based on experience installing many GNU packages on
dozens of platforms. Both Paul and I solve configuration problems on a daily
basis.

The vast majority of GNU packages use the GNU build system in such a way
that
  * Configuration uses config.guess,
  * The Makefiles use
    - $(CC) only together with $(CPPFLAGS) $(CFLAGS) when compiling source.
    - $(CC) only together with $(CFLAGS) $(LDFLAGS) when linking.
    and when one needs the preprocessor, one uses '$(CC) -E', not
    /lib/cpp or something like that.

The text in the Autoconf manual is made for this majority of GNU packages.

It is well possible that ncurses, at some point in its build process,
does not work like this, and therefore needs the reshuffling that it
does in the CF_CC_ENV_FLAGS macro. That's good, as it makes things work
fine, as users expect.

But what I object to is a warning text and suggestion that, if users
follow it, will cause them trouble with *other* GNU packages than ncurses.

> There's no -Werror in the configure script for users to blindly turn on,
> to aggravate the problem.

What do you mean? '-Werror' is known to cause many configuration tests
to fail, in many GNU packages, and is therefore tricky to use correctly.
Do you with that users have the ability to turn on -Werror? Or do you
wish that -Werror be detected early and rejected?

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]