I'm having some trouble building libpng with a zlib newer than the system's zlib. My system has zlib 1.2.7 installed. But I want to build libpng against the latest zlib which I have built in a separate directory. So I'm doing this:
cd zlib-1.2.13
./configure
make
cd ../libpng-1.6.40
export CFLAGS=-I../zlib-1.2.13
export LDFLAGS=-L../zlib-1.2.13
./configure
But still, in the pnglibconf.h
generated by configure
, PNG_ZLIB_VERNUM
is defined as 0x1270
, i.e. zlib 1.2.7 - the system's zlib version. What do I need to do to tell libpng's configure to use zlib 1.2.13 instead? As you can see above, I've set CFLAGS
and LDFLAGS
to point to zlib-1.2.13 but it doesn't seem to work. It still uses the system's zlib.
From the documentation:
If you wish to test with a particular zlib that is not first in the standard library search path, put ZLIBLIB, ZLIBINC, CPPFLAGS, LDFLAGS, and LD_LIBRARY_PATH in your environment before running "make test" or "make distcheck":
ZLIBLIB=/path/to/lib export ZLIBLIB ZLIBINC=/path/to/include export ZLIBINC CPPFLAGS="-I$ZLIBINC" export CPPFLAGS LDFLAGS="-L$ZLIBLIB" export LDFLAGS LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH