[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: configure warning suggests an anti-pattern
From: |
Thomas Dickey |
Subject: |
Re: configure warning suggests an anti-pattern |
Date: |
Sun, 7 Mar 2021 07:21:35 -0500 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Sun, Mar 07, 2021 at 11:39:03AM +0100, Bruno Haible wrote:
> On a Linux/mips machine, I'm compiling 32-bit binaries by setting
>
> CC="gcc -mabi=32"
> CXX="g++ -mabi=32"
>
> 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>
> Quote:
>
> "If an option selects a 32-bit or 64-bit build on a bi-arch system,
> it must be put direcly into CC, e.g., CC='gcc -m64'. This is necessary
> for config.guess to work right."
>
> Now the configuration of GNU ncurses 6.2 gives me a warning:
>
> $ ./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)
...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.
There was some user-complaint (i.e., broken configuration)
which prompted this change
-(*[[\ \ ]]-[[IUD]]*)
+(*[[\ \ ]]-*)
https://lists.gnu.org/archive/html/bug-ncurses/2016-05/msg00016.html
...which I forget the details (my checkin-comment only explains the code,
and looking at this mailing list, it wasn't mentioned during the preceding
few weeks):
https://github.com/ThomasDickey/my-autoconf-snapshots/blob/ee5a2d9f4cbb5010f1dd8895d045ee0e9411e19b/CHANGES#L1098
2016-05-21 Thomas E. Dickey <dickey@invisible-island.net>
* AcSplit/CF_CC_ENV_FLAGS:
don't limit the check to -I, -U and -D options, since the added options
can
include various compiler options before and after preprocessor options.
* AcSplit/CF_PROG_CC_C_O:
provide for passing compiler options to this check because some users
have
broken configurations requiring compiler options to do anything
However, that's a warning message rather than an error.
There's no -Werror in the configure script for users to blindly turn on,
to aggravate the problem.
If you're curious to know if the script is doing what it should
(by moving C preprocessor options _out_ of $CC and $CFLAGS),
the --verbose option would show the $CC, $CFLAGS and $CPPFLAGS variables.
--
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net
signature.asc
Description: PGP signature