GDB: How does configure with with config.cache??

Paul Smith via Gdb <[email protected]>
Newsgroups gmane.comp.gdb.devel
Organization GNU's Not UNIX!
Message-ID <[email protected]>
Can someone explain to me how the GDB top-level configure script works?
It's driving me bananas.

I'm trying to build a version of GDB based on non-default compiler and
libraries, and what keeps happening is that I invoke the top-level
configure script with all the settings etc. that I want, and after it's
finished running I see that there is a config.cache file in each of the
subdirectories, and its contents are WRONG.

This causes everything to go haywire when I run make and it tries to
run configure in each of the subdirectories.

For example, I invoke configure with this argument (among many):

    ../gdb-15.1/configure ... CFLAGS='-O2 -static-libgcc' ...

after the configure script runs, when I look at the gdb/config.cache
for example, its contents are wrong:

   ac_cv_env_CFLAGS_set=set
   ac_cv_env_CFLAGS_value='-ggdb3    '

this isn't what I said, and it's wrong because then when I run make and
it invokes configure in the subdirectories passing this CFLAGS
assignment on the command line as above, and it fails:

  configure: loading cache ./config.cache
  configure: error: `CFLAGS' has changed since the previous run:
  configure:   former value:  `-ggdb3    '
  configure:   current value: `-O2 -static-libgcc  '

I just can't figure out how this is supposed to work.  Why are the
initial values in subdirs config.cache files all wrong?  Where are
these config.cache files even created (I couldn't find where it's
created in the configure or configure.ac files but it must be there,
hiding).


PS. It's annoying that the GDB top-level makefile doesn't support any
way to show the commands being invoked in the makefile recipes; most
modern GNU makefiles use the $V.SILENT: trick to do this but this
doesn't appear to be used in the Makefile.tpl file.

If people are interested I could send a patch.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.