Skip to contentSkip to conversation

Makefile: make curl-config path configurable

PATCH Superseded Remi Pommarel 2 participants 5 messages Jun 15, 2016 Kbuild

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Makefile: make curl-config path configurable

There are situations, e.g. during cross compilation, where curl-config program is not present in the PATH.

Make the makefile use a configurable curl-config program passed through CURL_CONFIG variable which can be set through config.mak.

Also make this variable tunable through use of autoconf/configure. Configure will set CURL_CONFIG variable in config.mak.autogen to whatever value has been passed to ac_cv_prog_CURL_CONFIG.

---
 Makefile     |  9 +++++++--
 configure.ac | 13 +++++++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)
Makefile +7 -2
index ce0cfe2..3cba678 100644
@@ -39,6 +39,10 @@ all::
 # Define CURLDIR=/foo/bar if your curl header and library files are in
 # /foo/bar/include and /foo/bar/lib directories.
 #
+# Define CURL_CONFIG to curl's configuration program that gives informations
+# about the library (ie curl's version, cflags, ...) . If not set it defaults
+# to 'curl-config'.
+#
 # Define NO_EXPAT if you do not have expat installed.  git-http-push is
 # not built, and you cannot push using http:// and https:// transports (dumb).
 #
@@ -425,6 +429,7 @@ TCL_PATH = tclsh
 TCLTK_PATH = wish
 XGETTEXT = xgettext
 MSGFMT = msgfmt
+CURL_CONFIG = curl-config
 PTHREAD_LIBS = -lpthread
 PTHREAD_CFLAGS =
 GCOV = gcov
@@ -1059,13 +1064,13 @@ else
 	REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
 	PROGRAM_OBJS += http-fetch.o
 	PROGRAMS += $(REMOTE_CURL_NAMES)
-	curl_check := $(shell (echo 070908; curl-config --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
+	curl_check := $(shell (echo 070908; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
 	ifeq "$(curl_check)" "070908"
 		ifndef NO_EXPAT
 			PROGRAM_OBJS += http-push.o
 		endif
 	endif
-	curl_check := $(shell (echo 072200; curl-config --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
+	curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
 	ifeq "$(curl_check)" "072200"
 		USE_CURL_FOR_IMAP_SEND = YesPlease
 	endif
configure.ac +13 -0
index 14012fa..01b07ad 100644
@@ -525,6 +525,19 @@ GIT_UNSTASH_FLAGS($CURLDIR)
 
 GIT_CONF_SUBST([NO_CURL])
 
+if test -z "$NO_CURL"; then
+
+AC_CHECK_PROG([CURL_CONFIG], [curl-config],
+[curl-config],
+[no])
+
+if test $CURL_CONFIG != no; then
+    GIT_CONF_SUBST([CURL_CONFIG])
+fi
+
+fi
+
+
 #
 # Define NO_EXPAT if you do not have expat installed.  git-http-push is
 # not built, and you cannot push using http:// and https:// transports.
Signature · 1 line
2.0.1
Reviewed-by on v3 1/1
#1 lore raw
Quoted 1 line · Remi Pommarel

For what it's worth, with or without the tweaks below,

[...]

Makefile all:: · line 44

Quoted 9 lines
Makefile +3 -0
@@ -39,6 +39,10 @@ all::
 # Define CURLDIR=/foo/bar if your curl header and library files are in
 # /foo/bar/include and /foo/bar/lib directories.
 #
+# Define CURL_CONFIG to curl's configuration program that gives informations
+# about the library (ie curl's version, cflags, ...) . If not set it defaults
+# to 'curl-config'.

Extra spaces, some wording tweaks:

s/gives informations about the library/prints information about the library/ s/(ie curl's version, cflags, .../) /(e.g., its version number)/ s/If not set it defaults to/The default is/

Thanks.

Makefile +2 -3
index 5a94434..4a870a4 100644
@@ -39,9 +39,8 @@ all::
 # Define CURLDIR=/foo/bar if your curl header and library files are in
 # /foo/bar/include and /foo/bar/lib directories.
 #
-# Define CURL_CONFIG to curl's configuration program that gives informations
-# about the library (ie curl's version, cflags, ...) . If not set it defaults
-# to 'curl-config'.
+# Define CURL_CONFIG to curl's configuration program that prints information
+# about the library (e.g., its version number).  The default is 'curl-config'.
 #
 # Define NO_EXPAT if you do not have expat installed.  git-http-push is
 # not built, and you cannot push using http:// and https:// transports (dumb).
#2 lore raw
Quoted 7 lines · Jonathan Nieder
Quoted 1 line · Remi Pommarel

For what it's worth, with or without the tweaks below,

Thanks.

Quoted 14 lines

[...]

Makefile all:: · line 44

Quoted 9 lines
Makefile +3 -0
@@ -39,6 +39,10 @@ all::
 # Define CURLDIR=/foo/bar if your curl header and library files are in
 # /foo/bar/include and /foo/bar/lib directories.
 #
+# Define CURL_CONFIG to curl's configuration program that gives informations
+# about the library (ie curl's version, cflags, ...) . If not set it defaults
+# to 'curl-config'.

Extra spaces, some wording tweaks:

Quoted 4 lines

s/gives informations about the library/prints information about the library/ s/(ie curl's version, cflags, .../) /(e.g., its version number)/ s/If not set it defaults to/The default is/

Do I need to resend a v4 patch with these modifications ? I am not sure about the correct workflow here.

Signature · 1 line
Rémi
#3 lore raw
Quoted 2 lines · Remi Pommarel

Do I need to resend a v4 patch with these modifications ? I am not sure about the correct workflow here.

If you like the changes, you can ask Junio to squash them in.

If you don't like them, that's also fine and you can just say so.

#4 lore raw
Quoted 8 lines · Jonathan Nieder
Quoted 2 lines · Remi Pommarel

Do I need to resend a v4 patch with these modifications ? I am not sure about the correct workflow here.

If you like the changes, you can ask Junio to squash them in.

If you don't like them, that's also fine and you can just say so.

These modifications are very fine with me and can be squash in.

Thanks a lot.