threads / patch / 40423

patchconfigure: make curl-config path configurable

Subject: [PATCH 1/1] configure: make curl-config path configurable

## tl;dr

2 messages between Sep 24, 2015 and Sep 25, 2015. Diffs are folded; open one to read it.

replies: 1people: 2as markdown or json

Remi Pommarel· Sep 24, 2015, 19:50 UTC · lore

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

Make configure check that a custom curl-config program is passed by the user through ac_cv_prog_CURL_CONFIG then set CURL_CONFIG variable accordingly in config.mak.autogen. Makefile uses this variable to get the target's curl configuration program.

Signed-off-by: Remi Pommarel <repk@triplefau.lt>
---
 Makefile     |  5 +++--
 configure.ac | 10 ++++++++++
 2 files changed, 13 insertions(+), 2 deletions(-)
Show changes to 2 files +13 −2

Makefile, configure.ac

diff --git a/Makefile b/Makefile
index ce0cfe2..81ac5bb 100644
--- a/Makefile
+++ b/Makefile
@@ -374,6 +374,7 @@ LDFLAGS =
 ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
 ALL_LDFLAGS = $(LDFLAGS)
 STRIP ?= strip
+CURL_CONFIG=curl-config
 
 # Among the variables below, these:
 #   gitexecdir
@@ -1059,13 +1060,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
diff --git a/configure.ac b/configure.ac
index 14012fa..acc23fb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -525,6 +525,16 @@ 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.
-- 
2.0.1
Junio C Hamano· Sep 25, 2015, 00:21 UTC · re: Remi Pommarel · lore

Re: [PATCH 1/1] configure: make curl-config path configurable

Remi Pommarel <repk@triplefau.lt> writes:
Show 23 quoted lines
> There are situations, ie during cross compilation, where curl-config program
> is not present in the PATH.
>
> Make configure check that a custom curl-config program is passed by the user
> through ac_cv_prog_CURL_CONFIG then set CURL_CONFIG variable accordingly in
> config.mak.autogen. Makefile uses this variable to get the target's curl
> configuration program.
>
> Signed-off-by: Remi Pommarel <repk@triplefau.lt>
> ---
>  Makefile     |  5 +++--
>  configure.ac | 10 ++++++++++
>  2 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/Makefile b/Makefile
> index ce0cfe2..81ac5bb 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -374,6 +374,7 @@ LDFLAGS =
>  ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
>  ALL_LDFLAGS = $(LDFLAGS)
>  STRIP ?= strip
> +CURL_CONFIG=curl-config
s/.*/CURL_CONFIG = curl-config/;

Please also add description in the early part of Makefile, perhaps right after it explains CURLDIR=/foo/bar.

The officially supported way to tweak the build is to define these variables by whatever means, and use of autoconf/configure is merely one optional way of doing so. Other people need to know what can be tweaked and how, and even those who chose to use autoconf/configure would need to know when autoconf/configure did not work correctly.

Thanks.
Show 39 quoted lines
>  # Among the variables below, these:
>  #   gitexecdir
> @@ -1059,13 +1060,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
> diff --git a/configure.ac b/configure.ac
> index 14012fa..acc23fb 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -525,6 +525,16 @@ 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.

← back to recent threads