Makefile: allow static linking against libcurl

This requires more flags than can be guessed with the old-style CURLDIR and related options, so is only supported when curl-config is present. Signed-off-by: Dave Borowitz <dborowitz@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Dave Borowitz committed Apr 15, 2014 at 03:40 UTC d5067112db68fcc8c7b13c769c896b17480cb5b0
1 file changed +13 -3
Makefile
+13 -3
@@ -37,6 +37,9 @@ all::
37 # Define CURL_CONFIG to the path to a curl-config binary other than the
38 # default 'curl-config'.
39 #
40 +# Define CURL_STATIC to statically link libcurl. Only applies if
41 +# CURL_CONFIG is used.
42 +#
43 # Define CURLDIR=/foo/bar if your curl header and library files are in
44 # /foo/bar/include and /foo/bar/lib directories. This overrides CURL_CONFIG,
45 # but is less robust.
@@ -1139,9 +1142,16 @@ else
1142 else
1143 CURL_CONFIG ?= curl-config
1144 BASIC_CFLAGS += $(shell $(CURL_CONFIG) --cflags)
1142 - CURL_LIBCURL = $(shell $(CURL_CONFIG) --libs)
1143 - ifeq "$(CURL_LIBCURL)" ""
1144 - $(error curl not detected; try setting CURLDIR)
1145 + ifdef CURL_STATIC
1146 + CURL_LIBCURL = $(shell $(CURL_CONFIG) --static-libs)
1147 + ifeq "$(CURL_LIBCURL)" ""
1148 + $(error libcurl not detected or not compiled with static support)
1149 + endif
1150 + else
1151 + CURL_LIBCURL = $(shell $(CURL_CONFIG) --libs)
1152 + ifeq "$(CURL_LIBCURL)" ""
1153 + $(error libcurl not detected; try setting CURLDIR)
1154 + endif
1155 endif
1156 endif
1157