Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: Tom Tromey <tom@tromey.com>
Cc: Bruno Haible <bruno@clisp.org>,  Paul Eggert <eggert@cs.ucla.edu>,
	 bug-gnulib@gnu.org,  gdb-patches@sourceware.org
Subject: Re: hierarchical projects with configure scripts
Date: Sat, 01 Sep 2018 00:26:00 -0000	[thread overview]
Message-ID: <875zzqgj09.fsf@redhat.com> (raw)
In-Reply-To: <87lg8mz2zm.fsf@tromey.com> (Tom Tromey's message of "Fri, 31 Aug	2018 14:37:49 -0600")

On Friday, August 31 2018, Tom Tromey wrote:

>>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:
>
>>>> "CC=$(CC)" \
>>>> "CFLAGS=$(CFLAGS)" \
>>>> "CXX=$(CXX)" \
>>>> "CXX_DIALECT=$(CXX_DIALECT)" \
>>>> "CXXFLAGS=$(CXXFLAGS)" \
>>>> ...
>
>>>> Which ends up overriding gnulib's CC/CXX variables.  That's why we don't
>>>> see the "-std=gnu11" there.
>
>>> Maybe the solution can be inspired by the line of thought Paul started
>>> in [1]. Namely:
>>> Define a *small* set of variables that influence the configure
>>> results. Currently these are CC, CFLAGS, LDFLAGS, but not CPPFLAGS.
>>> Then, can we define a set of variables that can be passed down from the
>>> top-level Makefile the subordinate Makefiles?
>>> These two sets of variables must be disjoint, and that is the problem
>>> here, because users would like to use CFLAGS to pass optimization and
>>> debugging flags down the build tree, after the configuration is complete.
>
> Sergio> I'm still inclined to go the "easy way" and do what I proposed above:
> Sergio> create a "FLAGS_TO_PASS_TO_GNULIB" which would omit the CC/CXX (and
> Sergio> possibly other) variables, even if it's just to unbreak the s390x build
> Sergio> (I still have a gnulib issue happening with mingw to investigate, sigh).
>
> Historically the GNU and/or configure and/or automake rule was that
> variables like CC, CXX, CFLAGS (etc) were for users.  So, following this
> rule, I think it's correct for gdb to pass these to sub-configures and
> sub-makes.

Hm, fair enough.  Actually, after experimenting with this yesterday, I
found that it's not enough to remove CC/CXX from the list of variables
passed down to gnulib.  I still haven't found a fix for this problem.

> I haven't looked at the gnulib code here, but it seems to me that if
> gnulib wants to find special compiler flags to build itself, then I
> think those should be stuck into some other-named variable, not CFLAGS.
> gdb does this itself as well, for example warning flags aren't added to
> CXXFLAGS but some other variable.  In automake the convention is to name
> these internal things AM_mumble, like AM_CFLAGS.  There's some
> discussion in (info "(automake) Flag Variables Ordering")

That's a good idea.  I'd like to know what the gnulib folks think of it.
I'll try to take a look at the gnulib code and see if I can come up with
a patch for this.

Also, Paul Eggert suggested something yesterday:

  Another possibility that may be simpler for GDB, is to change its
  configure.ac files to require C99 or later everywhere. At this point
  it's more trouble than it's worth to tweak source code or makefiles to
  cater to compilers operating in C89 mode. Just tell your C compiler to
  support C99-or-better everywhere, and your life will surely be
  simpler.

I don't know if just requiring C99 or later would be enough to solve
this problem, but it's something to consider for GDB, I think.

Thanks,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/


  reply	other threads:[~2018-09-01  0:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87lg8pm4li.fsf@redhat.com>
     [not found] ` <2805333.pL1CPYTu1R@omega>
     [not found]   ` <87y3cokaai.fsf@redhat.com>
     [not found]     ` <2373646.KA5HVAegPz@omega>
2018-08-30  3:18       ` Sergio Durigan Junior
2018-08-31 20:38         ` Tom Tromey
2018-09-01  0:26           ` Sergio Durigan Junior [this message]
2018-09-01  6:05             ` Tom Tromey
2018-09-01  6:59               ` Eli Zaretskii
2018-09-01  7:42                 ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875zzqgj09.fsf@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=eggert@cs.ucla.edu \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox