Subject: Re: [PATCH 1/2] Makefile: use curl-config to determine curl flags

From: Junio C Hamano <[email-masked]>
Date: Tue, 15 Apr 2014 09:50:45 -0700

Dave Borowitz <[email-masked]> writes:

> My end goal is to statically link git on Mac OS X (10.9) against a
> newer version of libcurl than ships with the OS. The normal CURLDIR
> approach should work with system libcurl:
>
> $ /usr/bin/curl-config --libs
> -lcurl
>
> But it gets a bit more complicated with a recent curl version. This
> likely has to do with the set of enabled options; I passed flags to
> ./configure based on the build script "MacOSX-Framework" included in
> the curl distribution:
> $ ~/d/curl-out-7.36.0/bin/curl-config --libs
> -L/Users/dborowitz/d/curl-out-7.36.0/lib -lcurl -lgssapi_krb5 -lresolv
> -lldap -lz
>
> And with --static-libs there's just that much more:
> $ ~/d/curl-out-7.36.0/bin/curl-config --static-libs
> /Users/dborowitz/d/curl-out-7.36.0/lib/libcurl.a
> -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
> -arch x86_64 -Wl,-headerpad_max_install_names -framework
> CoreFoundation -framework Security -lgssapi_krb5 -lresolv -lldap -lz
>
> So I don't think specifying NEEDS_*_WITH_CURL scales to this use case.

Thanks.  As I said, the kosher way to learn how to link with libcURL
is by asking curl-config about the details of options to give to the
compiler and the linker, so I am all for this change.

> While writing this up I also noticed an issue with the second patch,
> namely that `curl-config --static-libs` is empty when curl is not
> built for static linking.
>
> I will reroll with a more detailed commit message and a fix to the second patch.

I love it whenever I see the contents of the patch improved after
spending a bit more time trying to describe the problem and the
solution (which is time worth spending).

Thanks.