Skip to content

Commit d506711

Browse files
dborowitzgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 61a64ff commit d506711

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

Makefile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ all::
3737
# Define CURL_CONFIG to the path to a curl-config binary other than the
3838
# default 'curl-config'.
3939
#
40+
# Define CURL_STATIC to statically link libcurl. Only applies if
41+
# CURL_CONFIG is used.
42+
#
4043
# Define CURLDIR=/foo/bar if your curl header and library files are in
4144
# /foo/bar/include and /foo/bar/lib directories. This overrides CURL_CONFIG,
4245
# but is less robust.
@@ -1139,9 +1142,16 @@ else
11391142
else
11401143
CURL_CONFIG ?= curl-config
11411144
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
11451155
endif
11461156
endif
11471157

0 commit comments

Comments
 (0)