@@ -35,14 +35,17 @@ all::
35
35
# transports (neither smart nor dumb).
36
36
#
37
37
# Define CURL_CONFIG to the path to a curl-config binary other than the
38
- # default 'curl-config'.
38
+ # default 'curl-config'. If CURL_CONFIG is unset or points to a binary that
39
+ # is not found, defaults to the CURLDIR behavior.
39
40
#
40
41
# Define CURL_STATIC to statically link libcurl. Only applies if
41
42
# CURL_CONFIG is used.
42
43
#
43
44
# 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.
45
+ # /foo/bar/include and /foo/bar/lib directories. This overrides
46
+ # CURL_CONFIG, but is less robust. If not set, and CURL_CONFIG is not set,
47
+ # uses -lcurl with no additional library detection (other than
48
+ # NEEDS_*_WITH_CURL).
46
49
#
47
50
# Define NO_EXPAT if you do not have expat installed. git-http-push is
48
51
# not built, and you cannot push using http:// and https:// transports (dumb).
@@ -1127,9 +1130,27 @@ ifdef NO_CURL
1127
1130
REMOTE_CURL_NAMES =
1128
1131
else
1129
1132
ifdef CURLDIR
1130
- # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
1131
- BASIC_CFLAGS += -I$(CURLDIR)/include
1132
- CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl
1133
+ CURL_LIBCURL =
1134
+ else
1135
+ CURL_CONFIG = curl-config
1136
+ ifeq "$(CURL_CONFIG)" ""
1137
+ CURL_LIBCURL =
1138
+ else
1139
+ CURL_LIBCURL := $(shell $(CURL_CONFIG) --libs)
1140
+ endif
1141
+ endif
1142
+
1143
+ ifeq "$(CURL_LIBCURL)" ""
1144
+ ifdef CURL_STATIC
1145
+ $(error "CURL_STATIC must be used with CURL_CONFIG")
1146
+ endif
1147
+ ifdef CURLDIR
1148
+ # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
1149
+ BASIC_CFLAGS += -I$(CURLDIR)/include
1150
+ CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl
1151
+ else
1152
+ CURL_LIBCURL = -lcurl
1153
+ endif
1133
1154
ifdef NEEDS_SSL_WITH_CURL
1134
1155
CURL_LIBCURL += -lssl
1135
1156
ifdef NEEDS_CRYPTO_WITH_SSL
@@ -1140,17 +1161,11 @@ else
1140
1161
CURL_LIBCURL += -lidn
1141
1162
endif
1142
1163
else
1143
- CURL_CONFIG ?= curl-config
1144
1164
BASIC_CFLAGS += $(shell $(CURL_CONFIG) --cflags)
1145
1165
ifdef CURL_STATIC
1146
1166
CURL_LIBCURL = $(shell $(CURL_CONFIG) --static-libs)
1147
1167
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)
1168
+ $(error libcurl not detected or not compiled with static support)
1154
1169
endif
1155
1170
endif
1156
1171
endif
0 commit comments