The folder where zlib installed we could provide when configure setting:
/configure --prefix=$DIR/netcdf CPPFLAGS="-I$DIR/hdf5/include -I$DIR/grib2/include -I/home/ubuntu/flexpart_libs/zlib/include -O3" LDFLAGS="-L$DIR/hdf5/lib -L$DIR/grib2/lib -L/home/ubuntu/flexpart_libs/zlib/lib" --enable-shared --enable-netcdf-4 --disable-dap --disable-doxygen
Also, you need to indicate where to find the HDF5 library, using CPPFLAGS and
LDFLAGS environment
variables, as described in
http://www.unidata.ucar.edu/netcdf/docs/getting_and_building_netcdf.html#build_default
Note that the "--with-zlib=..." configure option you used is not supported by
the netCDF-4 configure,
as it's not listed in configure --help output. Instead, zlib must be found
either in a default system
directory or in locations listed with the CPPFLAGS and LDFLAGS environment
The folder where zlib installed we could provide when configure setting:
/configure --prefix=$DIR/netcdf CPPFLAGS="-I$DIR/hdf5/include -I$DIR/grib2/include -I/home/ubuntu/flexpart_libs/zlib/include -O3" LDFLAGS="-L$DIR/hdf5/lib -L$DIR/grib2/lib -L/home/ubuntu/flexpart_libs/zlib/lib" --enable-shared --enable-netcdf-4 --disable-dap --disable-doxygen