@@ -33,6 +33,8 @@ stdenv.mkDerivation rec {
3333 preConfigure = ''
3434 sed -e 's|/usr/bin|/no-such-path|g' -i.bak configure
3535 rm src/tool_hugehelp.c
36+ '' ++ stdenv.lib.optionalString stdenv.isDarwin '';
37+ export DYLD_LIBRARY_PATH=${zlib}/lib:$DYLD_LIBRARY_PATH
3638 '';
3739
3840 # make curl honor CURL_CA_BUNDLE & SSL_CERT_FILE
@@ -41,12 +43,19 @@ stdenv.mkDerivation rec {
4143 '';
4244
4345 configureFlags = [
46+ ( if zlibSupport then "--with-zlib=${zlib}" else "--without-zlib" )
4447 ( if sslSupport then "--with-ssl=${openssl}" else "--without-ssl" )
4548 ( if scpSupport then "--with-libssh2=${libssh2}" else "--without-libssh2" )
4649 ]
4750 ++ stdenv.lib.optional c-aresSupport "--enable-ares=${c-ares}"
4851 ++ stdenv.lib.optional gssSupport "--with-gssapi=${gss}";
4952
53+ installPhase = stdenv.lib.optionalString stdenv.isDarwin ''
54+ for prog in $out/bin/*; do
55+ wrapProgram "$prog" --prefix DYLD_LIBRARY_PATH : "${zlib}/lib"
56+ done
57+ '';
58+
5059 CXX = "g++";
5160 CXXCPP = "g++ -E";
5261