@@ -35,14 +35,17 @@ all::
3535# transports (neither smart nor dumb).
3636#
3737# 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.
3940#
4041# Define CURL_STATIC to statically link libcurl. Only applies if
4142# CURL_CONFIG is used.
4243#
4344# 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).
4649#
4750# Define NO_EXPAT if you do not have expat installed. git-http-push is
4851# not built, and you cannot push using http:// and https:// transports (dumb).
@@ -1127,9 +1130,27 @@ ifdef NO_CURL
11271130 REMOTE_CURL_NAMES =
11281131else
11291132 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
11331154 ifdef NEEDS_SSL_WITH_CURL
11341155 CURL_LIBCURL += -lssl
11351156 ifdef NEEDS_CRYPTO_WITH_SSL
@@ -1140,17 +1161,11 @@ else
11401161 CURL_LIBCURL += -lidn
11411162 endif
11421163 else
1143- CURL_CONFIG ?= curl-config
11441164 BASIC_CFLAGS += $(shell $(CURL_CONFIG) --cflags)
11451165 ifdef CURL_STATIC
11461166 CURL_LIBCURL = $(shell $(CURL_CONFIG) --static-libs)
11471167 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)
11541169 endif
11551170 endif
11561171 endif
0 commit comments