[Zlib-devel] [PATCH 1/3] Add -I../.. -L../.. to CFLAGS for minizip and miniunzip

Mike Frysinger vapier at gentoo.org
Tue Jan 17 15:44:36 EST 2012


On Tuesday 17 January 2012 15:26:05 Jonathan Nieder wrote:
> Trying to build miniunzip utility from contrib/minizip after an
> autoreconf -f produces
> 
> 	[...]
> 	In file included from minizip.c:61:0:
> 	zip.h:50:18: fatal error: zlib.h: No such file or directory
> 
> unless zlib is already installed.  Use AM_CFLAGS to set the include
> path and library path to point to the just-build copy of zlib to
> fix this.  (This was already done for libminizip but not the binaries
> that use it before this patch.)
> ---
>  contrib/minizip/Makefile.am |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/contrib/minizip/Makefile.am b/contrib/minizip/Makefile.am
> index 7a1e3dbf..8f0459ba 100644
> --- a/contrib/minizip/Makefile.am
> +++ b/contrib/minizip/Makefile.am
> @@ -6,7 +6,7 @@ libminizip_la_SOURCES = \
>  	unzip.c \
>  	zip.c
> 
> -libminizip_la_CFLAGS = -I../.. -L../..
> +AM_CFLAGS = -I../.. -L../..

zlib.h is in the source tree, so you probably need:
	-I$(top_srcdir)/../..

while zlib.a is in the build tree, so:
	-L$(top_builddir)/../..

although these both beg for local variables like:
zlib_top_srcdir = $(top_srcdir)/../..
zlib_top_builddir = $(top_builddir)/../..

which you'd then base the -I flags off (which do not belong in CFLAGS):
AM_CPPFLAGS = -I$(zlib_top_srcdir)

and then the -L flags (which do not belong in CFLAGS):
AM_LDFLAGS = -L$(zlib_top_srcdir)
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://madler.net/pipermail/zlib-devel_madler.net/attachments/20120117/c2dc4ff9/attachment.sig>


More information about the Zlib-devel mailing list