Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Remove config.cache files when reconfiguring at top level
@ 2010-02-15 10:53 Nick Clifton
  2010-02-15 10:58 ` Andreas Schwab
  0 siblings, 1 reply; 18+ messages in thread
From: Nick Clifton @ 2010-02-15 10:53 UTC (permalink / raw)
  To: binutils; +Cc: gdb-patches, gcc-patches

Hi Guys,

  I am going to apply the patch below to the top level configure.ac file
  to fix a problem reported in the binutils PR 11238.

  Essentially the problem is that if a toolchain builder re-runs the
  configure script with a new set of CFLAGS (or some other similar
  variable) without first running distclean, then the config.cache files
  will be left behind in the build sub-directories.  This then prevents
  the the next build from working as the cached value of CFLAGS differs
  from the new one.  The patch fixes the problem by makeing the
  configure script delete config.cache files at the same time as it is
  deleting Makefiles in the sub-directories.

Cheers
  Nick

ChangeLog
2010-02-15  Nick Clifton  <nickc@redhat.com>

	PR 11238
	* configure.ac: Delete config.cache files in sub-directories when
	deleting Makefiles.
	* configure: Regenerate.

Index: configure.ac
===================================================================
RCS file: /cvs/src/src/configure.ac,v
retrieving revision 1.93
diff -c -3 -p -r1.93 configure.ac
*** configure.ac	15 Feb 2010 10:37:54 -0000	1.93
--- configure.ac	15 Feb 2010 10:42:04 -0000
*************** for module in ${build_configdirs} ; do
*** 2710,2715 ****
--- 2710,2721 ----
      echo 1>&2 "*** removing ${build_subdir}/${module}/Makefile to force reconfigure"
      rm -f ${build_subdir}/${module}/Makefile
    fi
+   # PR 11238: Also remove config.cache files.
+   if test -z "${no_recursion}" \
+      && test -f ${build_subdir}/${module}/config.cache; then
+     echo 1>&2 "*** removing ${build_subdir}/${module}/config.cache to allow reconfigure"
+     rm -f ${build_subdir}/${module}/config.cache
+   fi
    extrasub_build="$extrasub_build
  /^@if build-$module\$/d
  /^@endif build-$module\$/d
*************** for module in ${configdirs} ; do
*** 2725,2730 ****
--- 2731,2741 ----
  	rm -f ${file}
        fi
      done
+     # PR 11238: Also remove config.cache files.
+     if test -f ${module}/config.cache; then
+       echo 1>&2 "*** removing ${module}/config.cache to allow reconfigure"
+       rm -f ${module}/config.cache
+     fi
    fi
    extrasub_host="$extrasub_host
  /^@if $module\$/d
*************** for module in ${target_configdirs} ; do
*** 2739,2744 ****
--- 2750,2761 ----
      echo 1>&2 "*** removing ${target_subdir}/${module}/Makefile to force reconfigure"
      rm -f ${target_subdir}/${module}/Makefile
    fi
+   # PR 11238: Also remove config.cache files.
+   if test -z "${no_recursion}" \
+      && test -f ${target_subdir}/${module}/config.cache; then
+     echo 1>&2 "*** removing ${target_subdir}/${module}/config.cache to allow reconfigure"
+     rm -f ${target_subdir}/${module}/config.cache
+   fi
  
    # We only bootstrap target libraries listed in bootstrap_target_libs.
    case $bootstrap_target_libs in


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-15 10:53 Remove config.cache files when reconfiguring at top level Nick Clifton
@ 2010-02-15 10:58 ` Andreas Schwab
  2010-02-15 15:54   ` Nick Clifton
  0 siblings, 1 reply; 18+ messages in thread
From: Andreas Schwab @ 2010-02-15 10:58 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils, gdb-patches, gcc-patches

Nick Clifton <nickc@redhat.com> writes:

>   I am going to apply the patch below to the top level configure.ac file
>   to fix a problem reported in the binutils PR 11238.

This should be optional, as it also erases any manual changes added to
the cache file.

Andreas.

-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-15 10:58 ` Andreas Schwab
@ 2010-02-15 15:54   ` Nick Clifton
  2010-02-15 18:04     ` Andreas Schwab
  0 siblings, 1 reply; 18+ messages in thread
From: Nick Clifton @ 2010-02-15 15:54 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: binutils, gdb-patches, gcc-patches

Hi Andreas,

> This should be optional, as it also erases any manual changes added to
> the cache file.

Ah - I did not know that users would ever modify the cache files.  Given 
that they do though - is it right that they should expect their changes 
to be preserved across a reconfigure ?  I would have thought that the 
cache files would have the same status as Makefiles - OK to modify for 
temporary local changes but never expected to last for very long.

Cheers
   Nick



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-15 15:54   ` Nick Clifton
@ 2010-02-15 18:04     ` Andreas Schwab
  2010-02-15 18:23       ` Alfred M. Szmidt
                         ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Andreas Schwab @ 2010-02-15 18:04 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils, gdb-patches, gcc-patches

Nick Clifton <nickc@redhat.com> writes:

>> This should be optional, as it also erases any manual changes added to
>> the cache file.
>
> Ah - I did not know that users would ever modify the cache files.

That's the only way to override cross-compile defaults in target
libraries.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-15 18:04     ` Andreas Schwab
@ 2010-02-15 18:23       ` Alfred M. Szmidt
  2010-02-15 19:37         ` Andreas Schwab
  2010-02-16 10:07       ` Nick Clifton
       [not found]       ` <4B7A6E32.6070307__49868.1737961762$1266314832$gmane$org@redhat.com>
  2 siblings, 1 reply; 18+ messages in thread
From: Alfred M. Szmidt @ 2010-02-15 18:23 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: nickc, binutils, gdb-patches, gcc-patches

   >> This should be optional, as it also erases any manual changes
   >> added to the cache file.
   >
   > Ah - I did not know that users would ever modify the cache files.

   That's the only way to override cross-compile defaults in target
   libraries.

Can't you pass the variables on the command line?  I.e.

.../configure ac_cv_foo=123

I've used this for overriding cross-compile defaults in various
programs though never had the need for gcc/gdb/binutils.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-15 18:23       ` Alfred M. Szmidt
@ 2010-02-15 19:37         ` Andreas Schwab
  2010-02-16 11:23           ` Alfred M. Szmidt
  0 siblings, 1 reply; 18+ messages in thread
From: Andreas Schwab @ 2010-02-15 19:37 UTC (permalink / raw)
  To: ams; +Cc: nickc, binutils, gdb-patches, gcc-patches

"Alfred M. Szmidt" <ams@gnu.org> writes:

>    >> This should be optional, as it also erases any manual changes
>    >> added to the cache file.
>    >
>    > Ah - I did not know that users would ever modify the cache files.
>
>    That's the only way to override cross-compile defaults in target
>    libraries.
>
> Can't you pass the variables on the command line?  I.e.
>
> .../configure ac_cv_foo=123

That would also pass it to the host libraries, where it may be
inappropriate.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-15 18:04     ` Andreas Schwab
  2010-02-15 18:23       ` Alfred M. Szmidt
@ 2010-02-16 10:07       ` Nick Clifton
       [not found]       ` <4B7A6E32.6070307__49868.1737961762$1266314832$gmane$org@redhat.com>
  2 siblings, 0 replies; 18+ messages in thread
From: Nick Clifton @ 2010-02-16 10:07 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: binutils, gdb-patches, gcc-patches

Hi Andreas,

>> Ah - I did not know that users would ever modify the cache files.
>
> That's the only way to override cross-compile defaults in target
> libraries.

Hmm, I feel that there ought to be a better way to do that, but OK.

I would like to make the command line option to preserve the 
config.cache files opt-in, (ie the files are deleted unless this option 
is enabled as the configure script is run).  The reason being that I 
think that most users would expect a:

   configure <new-flags>
   make distclean
   make

sequence to just work without needing any extra configure options.  So I 
would propose adding a:

   --preserve-caches

option.  Is that OK with you ?

Cheers
   Nick



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
       [not found]       ` <4B7A6E32.6070307__49868.1737961762$1266314832$gmane$org@redhat.com>
@ 2010-02-16 10:42         ` Andreas Schwab
  2010-02-16 11:04           ` Nick Clifton
  0 siblings, 1 reply; 18+ messages in thread
From: Andreas Schwab @ 2010-02-16 10:42 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils, gdb-patches, gcc-patches

Nick Clifton <nickc@redhat.com> writes:

> Is that OK with you ?

Why can't you just put the config.cache removal into distclean?  That's
what the bug is all about anyway.

Andreas.

-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-16 10:42         ` Andreas Schwab
@ 2010-02-16 11:04           ` Nick Clifton
  2010-02-16 11:12             ` Andreas Schwab
  2010-02-16 11:23             ` Alfred M. Szmidt
  0 siblings, 2 replies; 18+ messages in thread
From: Nick Clifton @ 2010-02-16 11:04 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: binutils, gdb-patches, gcc-patches

Hi Andreas,

>> Is that OK with you ?
>
> Why can't you just put the config.cache removal into distclean?  That's
> what the bug is all about anyway.

Because distclean is a Makefile target and the reconfigure deletes the 
Makefiles, so there are no distclean targets to be run.  What used to 
happens was:

  1. User runs configure.
     Top level files are created but no sub-directories.

  2. User runs make.
     Sub-directories are created.  Makefile and config.cache files
     are created in the sub-directories.

  3. User runs configure again, with different flags.
     The configure script deletes the Makefiles that were created
     in the sub-directories, but leaves the config.cache files alone.

  4. User runs make distclean.
     There are no Makefiles present in the sub-directories so
     the config.cache files are left intact.

  5. User runs make.
     The build fails because the values in the config.cache files
     in the sub-directories no longer match up with the values
     specified in the reconfigure.

My patch made step 3 delete the config.cache files in directories where 
a Makefile was being deleted so that step 5 would then execute successfully.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-16 11:04           ` Nick Clifton
@ 2010-02-16 11:12             ` Andreas Schwab
  2010-02-16 11:23             ` Alfred M. Szmidt
  1 sibling, 0 replies; 18+ messages in thread
From: Andreas Schwab @ 2010-02-16 11:12 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils, gdb-patches, gcc-patches

Nick Clifton <nickc@redhat.com> writes:

>  4. User runs make distclean.
>     There are no Makefiles present in the sub-directories so
>     the config.cache files are left intact.

So clean them here.  That's the only correct place to do it.  Only
distclean is allowed to remove configuration-recording files.

Andreas.

-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-16 11:04           ` Nick Clifton
  2010-02-16 11:12             ` Andreas Schwab
@ 2010-02-16 11:23             ` Alfred M. Szmidt
  2010-02-16 12:40               ` Nick Clifton
  1 sibling, 1 reply; 18+ messages in thread
From: Alfred M. Szmidt @ 2010-02-16 11:23 UTC (permalink / raw)
  To: Nick Clifton; +Cc: schwab, binutils, gdb-patches, gcc-patches

     4. User runs make distclean.
	There are no Makefiles present in the sub-directories so
	the config.cache files are left intact.

That seems like a bug, distclean should clean out everything not
suitable for distribution, so config.cache files should definition not
stay distclean.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-15 19:37         ` Andreas Schwab
@ 2010-02-16 11:23           ` Alfred M. Szmidt
  0 siblings, 0 replies; 18+ messages in thread
From: Alfred M. Szmidt @ 2010-02-16 11:23 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: nickc, binutils, gdb-patches, gcc-patches

   > Can't you pass the variables on the command line?  I.e.
   >
   > .../configure ac_cv_foo=123

   That would also pass it to the host libraries, where it may be
   inappropriate.

Ah right, I forgot that gdb/gcc has a non-standard setup for building
things.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-16 11:23             ` Alfred M. Szmidt
@ 2010-02-16 12:40               ` Nick Clifton
  2010-02-16 13:25                 ` Alfred M. Szmidt
  0 siblings, 1 reply; 18+ messages in thread
From: Nick Clifton @ 2010-02-16 12:40 UTC (permalink / raw)
  To: ams, schwab; +Cc: binutils, gdb-patches, gcc-patches

Hi Alfred, Hi Andreas,

>>       4. User runs make distclean.
>> 	There are no Makefiles present in the sub-directories so
>> 	the config.cache files are left intact.

> That seems like a bug, distclean should clean out everything not
> suitable for distribution, so config.cache files should definition not
> stay distclean.

> So clean them here.  That's the only correct place to do it.  Only
> distclean is allowed to remove configuration-recording files.

OK - so what do you guys think to this patch ?  (Presuming that I also 
revert my patch to configure.ac).

Cheers
   Nick

ChangeLog
2010-02-16  Nick Clifton  <nickc@redhat.com>

	PR 11238
	* Makefile.tpl (local-distclean): Also remove config.cache files in
	sub-directories as there may not be Makefiles present in the
	sub-directories.

Index: Makefile.tpl
===================================================================
RCS file: /cvs/src/src/Makefile.tpl,v
retrieving revision 1.214
diff -c -3 -p -r1.214 Makefile.tpl
*** Makefile.tpl        22 Jan 2010 16:28:24 -0000      1.214
--- Makefile.tpl        16 Feb 2010 12:37:35 -0000
*************** local-distclean:
*** 771,776 ****
--- 771,777 ----
         -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 
2>/dev/null
         -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
         -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
+       -find . -name config.cache -exec rm -f {} \; 2>/dev/null

   local-maintainer-clean:
         @echo "This command is intended for maintainers to use;"


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-16 12:40               ` Nick Clifton
@ 2010-02-16 13:25                 ` Alfred M. Szmidt
  2010-02-16 14:03                   ` Andreas Schwab
  2010-02-17 10:06                   ` Nick Clifton
  0 siblings, 2 replies; 18+ messages in thread
From: Alfred M. Szmidt @ 2010-02-16 13:25 UTC (permalink / raw)
  To: Nick Clifton; +Cc: schwab, binutils, gdb-patches, gcc-patches

   *************** local-distclean:
   *** 771,776 ****
   --- 771,777 ----
	    -rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 
   2>/dev/null
	    -rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
	    -rmdir fastjar gcc libiberty texinfo zlib 2>/dev/null
   +       -find . -name config.cache -exec rm -f {} \; 2>/dev/null

I'd use -delete instead of `rm -f {} \;'.  But I think this is OK too.

      local-maintainer-clean:
	    @echo "This command is intended for maintainers to use;"


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-16 13:25                 ` Alfred M. Szmidt
@ 2010-02-16 14:03                   ` Andreas Schwab
  2010-02-17 10:06                   ` Nick Clifton
  1 sibling, 0 replies; 18+ messages in thread
From: Andreas Schwab @ 2010-02-16 14:03 UTC (permalink / raw)
  To: ams; +Cc: Nick Clifton, binutils, gdb-patches, gcc-patches

"Alfred M. Szmidt" <ams@gnu.org> writes:

> I'd use -delete instead of `rm -f {} \;'.  But I think this is OK too.

-delete is a GNU extension.  But `-exec rm -f {} +' may be ok.

Andreas.

-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-16 13:25                 ` Alfred M. Szmidt
  2010-02-16 14:03                   ` Andreas Schwab
@ 2010-02-17 10:06                   ` Nick Clifton
  2010-02-17 10:17                     ` Mark Kettenis
  1 sibling, 1 reply; 18+ messages in thread
From: Nick Clifton @ 2010-02-17 10:06 UTC (permalink / raw)
  To: ams, schwab; +Cc: binutils, gdb-patches, gcc-patches

Hi Alfred, Hi Andreas,

> I'd use -delete instead of `rm -f {} \;'.  But I think this is OK too.

Good idea.  OK I have checked this revised patch in along with this 
changelog entry.

Cheers
   Nick

ChangeLog
2010-02-17  Nick Clifton  <nickc@redhat.com>

	PR 11238
	* Makefile.tpl (local-distclean): Also remove config.cache files in
	sub-directories as there may not be Makefiles present in the
	sub-directories.
	* Makefile.in: Regenerate.
	* configure.ac: Revert previous delta.
	* configure: Regenerate.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-17 10:06                   ` Nick Clifton
@ 2010-02-17 10:17                     ` Mark Kettenis
  2010-02-17 11:04                       ` Nick Clifton
  0 siblings, 1 reply; 18+ messages in thread
From: Mark Kettenis @ 2010-02-17 10:17 UTC (permalink / raw)
  To: nickc; +Cc: ams, schwab, binutils, gdb-patches, gcc-patches

> Date: Wed, 17 Feb 2010 10:06:46 +0000
> From: Nick Clifton <nickc@redhat.com>
> 
> Hi Alfred, Hi Andreas,
> 
> > I'd use -delete instead of `rm -f {} \;'.  But I think this is OK too.
> 
> Good idea.  OK I have checked this revised patch in along with this 
> changelog entry.

Sorry, but that's not a good idea.  The -delete option is a GNU
extension that's not present on OpenBSD and Solaris for example.


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Remove config.cache files when reconfiguring at top level
  2010-02-17 10:17                     ` Mark Kettenis
@ 2010-02-17 11:04                       ` Nick Clifton
  0 siblings, 0 replies; 18+ messages in thread
From: Nick Clifton @ 2010-02-17 11:04 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: ams, schwab, binutils, gdb-patches, gcc-patches

Hi Mark,

>>> I'd use -delete instead of `rm -f {} \;'.  But I think this is OK too.
>>
>> Good idea.  OK I have checked this revised patch in along with this
>> changelog entry.
>
> Sorry, but that's not a good idea.  The -delete option is a GNU
> extension that's not present on OpenBSD and Solaris for example.

*sigh* Of course it is. :-)

OK I have checked in a minor correction to my patch to use "rm -f {}" 
instead of "-delete".

Cheers
   Nick

ChangeLog
2010-02-17  Nick Clifton  <nickc@redhat.com>

	* Makefile.tpl: Use "-exec rm {}" rather than "-delete" to delete
	the config.cache files found by the find command.


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2010-02-17 11:04 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-15 10:53 Remove config.cache files when reconfiguring at top level Nick Clifton
2010-02-15 10:58 ` Andreas Schwab
2010-02-15 15:54   ` Nick Clifton
2010-02-15 18:04     ` Andreas Schwab
2010-02-15 18:23       ` Alfred M. Szmidt
2010-02-15 19:37         ` Andreas Schwab
2010-02-16 11:23           ` Alfred M. Szmidt
2010-02-16 10:07       ` Nick Clifton
     [not found]       ` <4B7A6E32.6070307__49868.1737961762$1266314832$gmane$org@redhat.com>
2010-02-16 10:42         ` Andreas Schwab
2010-02-16 11:04           ` Nick Clifton
2010-02-16 11:12             ` Andreas Schwab
2010-02-16 11:23             ` Alfred M. Szmidt
2010-02-16 12:40               ` Nick Clifton
2010-02-16 13:25                 ` Alfred M. Szmidt
2010-02-16 14:03                   ` Andreas Schwab
2010-02-17 10:06                   ` Nick Clifton
2010-02-17 10:17                     ` Mark Kettenis
2010-02-17 11:04                       ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox