[Zlib-devel] [PATCH] Out-of-srcdir builds, -Werror resistance

Daniel Richard G. oss at teragram.com
Sun Jun 10 18:24:03 EDT 2012


> The patch has this:
>
> -	rm -f Makefile zlib.pc configure.log
> +	rm -f Makefile zconf.h zlib.pc configure.log

Ah, I understood what you meant by patch-deleting-a-file differently.

I've re-worked the patch to work another way. In addition to zconf.h
staying in the source tree, I've left the #include"zconf.h" (rather than
#include<zconf.h>) in zlib.h---the #include"" ensures that zconf.h in the
same directory as zlib.h is always used, and I think aside from this being
a useful behavior, changing such a publicly-visible detail may have some
unforeseen consequences.

So instead, I did the following:

* When building outside of srcdir, zlib.h is copied to builddir

* All #include"zlib.h" references in the source are changed to
  #include<zlib.h> so that they pull in the copy of the header in builddir
  instead of the original in srcdir (and in turn, zlib.h pulls in the
  zconf.h in builddir via #include"").

* "make distclean" deletes the copies of zconf.h and zlib.h in builddir,
  but not the ones in srcdir


The #includes can be checked by configuring outside of the source tree,
and then adding #error bits to zconf.h and zlib.h in the source tree.

(Building inside the source tree continues to work as before, of course.)


--Daniel


-------------- next part --------------
A non-text attachment was scrubbed...
Name: zlib-build-2.patch.txt
Type: application/octet-stream
Size: 6820 bytes
Desc: not available
URL: <http://madler.net/pipermail/zlib-devel_madler.net/attachments/20120610/35f5b8f8/attachment.obj>


More information about the Zlib-devel mailing list