Skip to contentSkip to conversation

configure: respect --without-<package> flags

PATCH Superseded Đoàn Trần Công Danh 4 participants 14 messages Mar 18, 2020 – Mar 27, 2020

lore
Share & tools
lore
#0 lore raw

cover configure: respect --without-<package> flags

Current git's configure script allow --without-<package>,
it rightfully set NO_<PACKAGE> in the beginning of the configure script, but overwrite them with autodetect later.

Respect them now.

P/S: I'm not sure about the change to NO_OPENSSL

Đoàn Trần Công Danh (3):
configure: respect --without-curl flags
configure: respect --without-expat
configure: respect --without-openssl

 configure.ac | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)
Signature · 1 line
2.26.0.rc2.234.g969ad452ca
#1 lore raw

PATCH 1/3 configure: respect --without-curl flags

---
 configure.ac | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
configure.ac +6 -2
index 66aedb9288..f4742878c0 100644
@@ -592,6 +592,9 @@ fi
 # git-http-push are not built, and you cannot use http:// and https://
 # transports.
 
+# Respect --without-curl
+if test "x$NO_CURL" != "xYesPlease"; then
+
 GIT_STASH_FLAGS($CURLDIR)
 
 AC_CHECK_LIB([curl], [curl_global_init],
@@ -600,8 +603,6 @@ AC_CHECK_LIB([curl], [curl_global_init],
 
 GIT_UNSTASH_FLAGS($CURLDIR)
 
-GIT_CONF_SUBST([NO_CURL])
-
 if test -z "$NO_CURL"; then
 
 AC_CHECK_PROG([CURL_CONFIG], [curl-config],
@@ -622,6 +623,9 @@ fi
 
 fi
 
+fi
+
+GIT_CONF_SUBST([NO_CURL])
 
 #
 # Define NO_EXPAT if you do not have expat installed.  git-http-push is
Signature · 1 line
2.26.0.rc2.234.g969ad452ca
#2 lore raw

Re: [PATCH 1/3] configure: respect --without-curl flags

configure.ac fi

Quoted 10 lines · Đoàn Trần Công Danh
configure.ac +2 -0
@@ -592,6 +592,9 @@ fi
 # Define NO_CURL if you do not have libcurl installed.  git-http-pull and
 # git-http-push are not built, and you cannot use http:// and https://
 # transports.
 
+# Respect --without-curl
+if test "x$NO_CURL" != "xYesPlease"; then
...
 if test -z "$NO_CURL"; then

I realize that GIT_PARSE_WITH() will either clear NO_CURL or set it to literal "YesPlease", but the comment(s) in this file describing NO_CURL say only to _define_ it to build without curl support. So, I'm wondering if it would make more sense to take a looser view about the value of NO_CURL. The existing check of NO_CURL doesn't bother looking for a specific value, but instead just tests whether it has a value or not. Perhaps the new check can be modeled after that one.

Also, I think you can reduce the scope of this change quite a bit by merely wrapping the AC_CHECK_LIB() invocation. So, either:

    ...
    if test -z "$NO_CURL"; then
    GIT_STASH_FLAGS($CURLDIR)

    AC_CHECK_LIB([curl], [curl_global_init],
    [NO_CURL=],
    [NO_CURL=YesPlease])

    GIT_UNSTASH_FLAGS($CURLDIR)
    fi

    GIT_CONF_SUBST([NO_CURL])
    ...

or even:

    ...
    if test -z "$NO_CURL"; then
    AC_CHECK_LIB([curl], [curl_global_init],
    [NO_CURL=],
    [NO_CURL=YesPlease])
    fi
    ...

Same comments applies to the other patches, as well.

author
#3 lore raw

Re: [PATCH 1/3] configure: respect --without-curl flags

Quoted 48 lines · Eric Sunshine

configure.ac fi

Quoted 10 lines · Đoàn Trần Công Danh
configure.ac +2 -0
@@ -592,6 +592,9 @@ fi
 # Define NO_CURL if you do not have libcurl installed.  git-http-pull and
 # git-http-push are not built, and you cannot use http:// and https://
 # transports.
 
+# Respect --without-curl
+if test "x$NO_CURL" != "xYesPlease"; then
...
 if test -z "$NO_CURL"; then

I realize that GIT_PARSE_WITH() will either clear NO_CURL or set it to literal "YesPlease", but the comment(s) in this file describing NO_CURL say only to _define_ it to build without curl support. So, I'm wondering if it would make more sense to take a looser view about the value of NO_CURL. The existing check of NO_CURL doesn't bother looking for a specific value, but instead just tests whether it has a value or not. Perhaps the new check can be modeled after that one.

Also, I think you can reduce the scope of this change quite a bit by merely wrapping the AC_CHECK_LIB() invocation. So, either:

    ...
    if test -z "$NO_CURL"; then
    GIT_STASH_FLAGS($CURLDIR)

    AC_CHECK_LIB([curl], [curl_global_init],
    [NO_CURL=],
    [NO_CURL=YesPlease])

    GIT_UNSTASH_FLAGS($CURLDIR)
    fi

    GIT_CONF_SUBST([NO_CURL])
    ...

or even:

    ...
    if test -z "$NO_CURL"; then
    AC_CHECK_LIB([curl], [curl_global_init],
    [NO_CURL=],
    [NO_CURL=YesPlease])
    fi
    ...
Quoted 1 line

Same comments applies to the other patches, as well.

I've re-checked the configure.ac code.

We've already use:

	test -z "$NO_ICONV"

I think rewrite like your suggestion would be better choice, and it'll be consistence with the current code.

I'll send a reroll after checking what should be done with NO_OPENSSL.

Signature · 1 line
Danh
#4 lore raw

PATCH 2/3 configure: respect --without-expat

In reply to Đoàn Trần Công Danh
---
 configure.ac | 5 +++++
 1 file changed, 5 insertions(+)
configure.ac +5 -0
index f4742878c0..7468eb6bc8 100644
@@ -631,6 +631,9 @@ GIT_CONF_SUBST([NO_CURL])
 # 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.
 
+# Respect --without-expat
+if test "x$NO_EXPAT" != xYesPlease; then
+
 GIT_STASH_FLAGS($EXPATDIR)
 
 AC_CHECK_LIB([expat], [XML_ParserCreate],
@@ -639,6 +642,8 @@ AC_CHECK_LIB([expat], [XML_ParserCreate],
 
 GIT_UNSTASH_FLAGS($EXPATDIR)
 
+fi
+
 GIT_CONF_SUBST([NO_EXPAT])
 
 #
Signature · 1 line
2.26.0.rc2.234.g969ad452ca
#5 lore raw

PATCH 3/3 configure: respect --without-openssl

In reply to Đoàn Trần Công Danh
---
 configure.ac | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
configure.ac +9 -3
index 7468eb6bc8..20a11e1f32 100644
@@ -544,9 +544,15 @@ GIT_STASH_FLAGS($OPENSSLDIR)
 
 AC_CHECK_LIB([crypto], [SHA1_Init],
 [NEEDS_SSL_WITH_CRYPTO=],
-[AC_CHECK_LIB([ssl], [SHA1_Init],
- [NEEDS_SSL_WITH_CRYPTO=YesPlease NO_OPENSSL=],
- [NEEDS_SSL_WITH_CRYPTO=          NO_OPENSSL=YesPlease])])
+[
+if "x$NO_OPENSSL" = xYesPlease; then
+	AC_MSG_ERROR([Disabled OpenSSL is required for SHA1])
+else
+	AC_CHECK_LIB([ssl], [SHA1_Init],
+	[NEEDS_SSL_WITH_CRYPTO=YesPlease NO_OPENSSL=],
+	[NEEDS_SSL_WITH_CRYPTO=          NO_OPENSSL=YesPlease])
+fi
+])
 
 GIT_UNSTASH_FLAGS($OPENSSLDIR)
 
Signature · 1 line
2.26.0.rc2.234.g969ad452ca
#6 lore raw

Re: [PATCH 3/3] configure: respect --without-openssl

Quoted 10 lines · Đoàn Trần Công Danh
---
 configure.ac | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
configure.ac +0 -0
index 7468eb6bc8..20a11e1f32 100644

configure.ac GIT_STASH_FLAGS($OPENSSLDIR) · line 549

Quoted 9 lines
configure.ac +3 -3
@@ -544,9 +544,15 @@ GIT_STASH_FLAGS($OPENSSLDIR)
 
 AC_CHECK_LIB([crypto], [SHA1_Init],
 [NEEDS_SSL_WITH_CRYPTO=],
-[AC_CHECK_LIB([ssl], [SHA1_Init],
- [NEEDS_SSL_WITH_CRYPTO=YesPlease NO_OPENSSL=],
- [NEEDS_SSL_WITH_CRYPTO=          NO_OPENSSL=YesPlease])])
+[
+if "x$NO_OPENSSL" = xYesPlease; then
+	AC_MSG_ERROR([Disabled OpenSSL is required for SHA1])

I don't see this in the original. Wouldn't we want to fall back to the default in this case, which would be SHA1DC?

Signature · 2 lines
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204
author
#7 lore raw

Re: [PATCH 3/3] configure: respect --without-openssl

Quoted 12 lines · brian m. carlson
Quoted 11 lines · Đoàn Trần Công Danh
---
 configure.ac | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
configure.ac +0 -0
index 7468eb6bc8..20a11e1f32 100644
@@ -544,9 +544,15 @@ GIT_STASH_FLAGS($OPENSSLDIR)
 
Quoted 11 lines

configure.ac GIT_STASH_FLAGS($OPENSSLDIR) · line 549

Quoted 8 lines
configure.ac +3 -3
 AC_CHECK_LIB([crypto], [SHA1_Init],
 [NEEDS_SSL_WITH_CRYPTO=],
-[AC_CHECK_LIB([ssl], [SHA1_Init],
- [NEEDS_SSL_WITH_CRYPTO=YesPlease NO_OPENSSL=],
- [NEEDS_SSL_WITH_CRYPTO=          NO_OPENSSL=YesPlease])])
+[
+if "x$NO_OPENSSL" = xYesPlease; then
+	AC_MSG_ERROR([Disabled OpenSSL is required for SHA1])

I don't see this in the original. Wouldn't we want to fall back to the default in this case, which would be SHA1DC?

This block of code will be run into in macOS only.

Really, I wasn't sure what should be done in this case (I mentioned in the cover letter).

Should we set:

NEEDS_SSL_WITH_CRYPTO=
NO_OPENSSL=YesPlease

in this case instead?

Signature · 1 line
Danh
#8 lore raw

v2 cover configure: respect --without-<package> flags

In reply to Đoàn Trần Công Danh

Current git's configure script allow --without-<package>,
it rightfully set NO_<PACKAGE> in the beginning of the configure script, but overwrite them with autodetect later.

Respect them now.

Change from v1:
- Simply check if NO_<PACKAGE> is empty or not instead of explicitly check for YesPlease
- --without-openssl will ignore libcrypto all-together and fallback into DC_SHA1

Đoàn Trần Công Danh (3):
configure: respect --without-curl flag
configure: respect --without-expat flag
configure: respect --without-openssl flag

 configure.ac | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Interdiff against v1:

configure.ac +16 -18
index 20a11e1f32..807bb8bc5a 100644
@@ -542,17 +542,18 @@ AC_MSG_NOTICE([CHECKS for libraries])
 
 GIT_STASH_FLAGS($OPENSSLDIR)
 
+if test -z "$NO_OPENSSL"; then
 AC_CHECK_LIB([crypto], [SHA1_Init],
 [NEEDS_SSL_WITH_CRYPTO=],
-[
-if "x$NO_OPENSSL" = xYesPlease; then
-	AC_MSG_ERROR([Disabled OpenSSL is required for SHA1])
+[AC_CHECK_LIB([ssl], [SHA1_Init],
+ [NEEDS_SSL_WITH_CRYPTO=YesPlease NO_OPENSSL=],
+ [NEEDS_SSL_WITH_CRYPTO=          NO_OPENSSL=YesPlease])])
 else
-	AC_CHECK_LIB([ssl], [SHA1_Init],
-	[NEEDS_SSL_WITH_CRYPTO=YesPlease NO_OPENSSL=],
-	[NEEDS_SSL_WITH_CRYPTO=          NO_OPENSSL=YesPlease])
+	# Fallback to DC SHA1
+	NEEDS_SSL_WITH_CRYPTO=
+	DC_SHA1=YesPlease
+	GIT_CONF_SUBST([DC_SHA1])
 fi
-])
 
 GIT_UNSTASH_FLAGS($OPENSSLDIR)
 
@@ -598,17 +599,19 @@ fi
 # git-http-push are not built, and you cannot use http:// and https://
 # transports.
 
-# Respect --without-curl
-if test "x$NO_CURL" != "xYesPlease"; then
-
 GIT_STASH_FLAGS($CURLDIR)
 
+# Respect --without-curl
+if test -z "$NO_CURL"; then
 AC_CHECK_LIB([curl], [curl_global_init],
 [NO_CURL=],
 [NO_CURL=YesPlease])
+fi
 
 GIT_UNSTASH_FLAGS($CURLDIR)
 
+GIT_CONF_SUBST([NO_CURL])
+
 if test -z "$NO_CURL"; then
 
 AC_CHECK_PROG([CURL_CONFIG], [curl-config],
@@ -629,27 +632,22 @@ fi
 
 fi
 
-fi
-
-GIT_CONF_SUBST([NO_CURL])
 
 #
 # 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.
 
-# Respect --without-expat
-if test "x$NO_EXPAT" != xYesPlease; then
-
 GIT_STASH_FLAGS($EXPATDIR)
 
+# Respect --without-expat
+if test -z "$NO_EXPAT"; then
 AC_CHECK_LIB([expat], [XML_ParserCreate],
 [NO_EXPAT=],
 [NO_EXPAT=YesPlease])
+fi
 
 GIT_UNSTASH_FLAGS($EXPATDIR)
 
-fi
-
 GIT_CONF_SUBST([NO_EXPAT])
 
 #
Signature · 1 line
2.26.0.rc2.234.g969ad452ca
#9 lore raw

PATCH v2 1/3 configure: respect --without-curl flag

---
 configure.ac | 3 +++
 1 file changed, 3 insertions(+)
configure.ac +3 -0
index 66aedb9288..5a73a592e1 100644
@@ -594,9 +594,12 @@ fi
 
 GIT_STASH_FLAGS($CURLDIR)
 
+# Respect --without-curl
+if test -z "$NO_CURL"; then
 AC_CHECK_LIB([curl], [curl_global_init],
 [NO_CURL=],
 [NO_CURL=YesPlease])
+fi
 
 GIT_UNSTASH_FLAGS($CURLDIR)
 
Signature · 1 line
2.26.0.rc2.234.g969ad452ca
#10 lore raw

PATCH v2 2/3 configure: respect --without-expat flag

In reply to Đoàn Trần Công Danh
---
 configure.ac | 3 +++
 1 file changed, 3 insertions(+)
configure.ac +3 -0
index 5a73a592e1..896996e177 100644
@@ -632,9 +632,12 @@ fi
 
 GIT_STASH_FLAGS($EXPATDIR)
 
+# Respect --without-expat
+if test -z "$NO_EXPAT"; then
 AC_CHECK_LIB([expat], [XML_ParserCreate],
 [NO_EXPAT=],
 [NO_EXPAT=YesPlease])
+fi
 
 GIT_UNSTASH_FLAGS($EXPATDIR)
 
Signature · 1 line
2.26.0.rc2.234.g969ad452ca
#11 lore raw

PATCH v2 3/3 configure: respect --without-openssl flag

In reply to Đoàn Trần Công Danh
---
 configure.ac | 7 +++++++
 1 file changed, 7 insertions(+)
configure.ac +7 -0
index 896996e177..807bb8bc5a 100644
@@ -542,11 +542,18 @@ AC_MSG_NOTICE([CHECKS for libraries])
 
 GIT_STASH_FLAGS($OPENSSLDIR)
 
+if test -z "$NO_OPENSSL"; then
 AC_CHECK_LIB([crypto], [SHA1_Init],
 [NEEDS_SSL_WITH_CRYPTO=],
 [AC_CHECK_LIB([ssl], [SHA1_Init],
  [NEEDS_SSL_WITH_CRYPTO=YesPlease NO_OPENSSL=],
  [NEEDS_SSL_WITH_CRYPTO=          NO_OPENSSL=YesPlease])])
+else
+	# Fallback to DC SHA1
+	NEEDS_SSL_WITH_CRYPTO=
+	DC_SHA1=YesPlease
+	GIT_CONF_SUBST([DC_SHA1])
+fi
 
 GIT_UNSTASH_FLAGS($OPENSSLDIR)
 
Signature · 1 line
2.26.0.rc2.234.g969ad452ca
author
#12 lore raw
In reply to Đoàn Trần Công Danh
Quoted 5 lines · Đoàn Trần Công Danh

Current git's configure script allow --without-<package>,
it rightfully set NO_<PACKAGE> in the beginning of the configure script, but overwrite them with autodetect later.

Respect them now.

Hi Junio,

Can I get your opinion on this serie?

I didn't see it in cooking list.
I guess it was lost because of 2.26.

Quoted 103 lines

Change from v1:
- Simply check if NO_<PACKAGE> is empty or not instead of explicitly check for YesPlease
- --without-openssl will ignore libcrypto all-together and fallback into DC_SHA1

Đoàn Trần Công Danh (3):
configure: respect --without-curl flag
configure: respect --without-expat flag
configure: respect --without-openssl flag

 configure.ac | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Interdiff against v1:

configure.ac +16 -18
index 20a11e1f32..807bb8bc5a 100644
@@ -542,17 +542,18 @@ AC_MSG_NOTICE([CHECKS for libraries])
 
 GIT_STASH_FLAGS($OPENSSLDIR)
 
+if test -z "$NO_OPENSSL"; then
 AC_CHECK_LIB([crypto], [SHA1_Init],
 [NEEDS_SSL_WITH_CRYPTO=],
-[
-if "x$NO_OPENSSL" = xYesPlease; then
-	AC_MSG_ERROR([Disabled OpenSSL is required for SHA1])
+[AC_CHECK_LIB([ssl], [SHA1_Init],
+ [NEEDS_SSL_WITH_CRYPTO=YesPlease NO_OPENSSL=],
+ [NEEDS_SSL_WITH_CRYPTO=          NO_OPENSSL=YesPlease])])
 else
-	AC_CHECK_LIB([ssl], [SHA1_Init],
-	[NEEDS_SSL_WITH_CRYPTO=YesPlease NO_OPENSSL=],
-	[NEEDS_SSL_WITH_CRYPTO=          NO_OPENSSL=YesPlease])
+	# Fallback to DC SHA1
+	NEEDS_SSL_WITH_CRYPTO=
+	DC_SHA1=YesPlease
+	GIT_CONF_SUBST([DC_SHA1])
 fi
-])
 
 GIT_UNSTASH_FLAGS($OPENSSLDIR)
 
@@ -598,17 +599,19 @@ fi
 # git-http-push are not built, and you cannot use http:// and https://
 # transports.
 
-# Respect --without-curl
-if test "x$NO_CURL" != "xYesPlease"; then
-
 GIT_STASH_FLAGS($CURLDIR)
 
+# Respect --without-curl
+if test -z "$NO_CURL"; then
 AC_CHECK_LIB([curl], [curl_global_init],
 [NO_CURL=],
 [NO_CURL=YesPlease])
+fi
 
 GIT_UNSTASH_FLAGS($CURLDIR)
 
+GIT_CONF_SUBST([NO_CURL])
+
 if test -z "$NO_CURL"; then
 
 AC_CHECK_PROG([CURL_CONFIG], [curl-config],
@@ -629,27 +632,22 @@ fi
 
 fi
 
-fi
-
-GIT_CONF_SUBST([NO_CURL])
 
 #
 # 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.
 
-# Respect --without-expat
-if test "x$NO_EXPAT" != xYesPlease; then
-
 GIT_STASH_FLAGS($EXPATDIR)
 
+# Respect --without-expat
+if test -z "$NO_EXPAT"; then
 AC_CHECK_LIB([expat], [XML_ParserCreate],
 [NO_EXPAT=],
 [NO_EXPAT=YesPlease])
+fi
 
 GIT_UNSTASH_FLAGS($EXPATDIR)
 
-fi
-
 GIT_CONF_SUBST([NO_EXPAT])
 
 #
Signature · 1 line
2.26.0.rc2.234.g969ad452ca
Signature · 1 line
Danh
#13 lore raw
Quoted 10 lines · Danh Doan
Quoted 5 lines · Đoàn Trần Công Danh

Current git's configure script allow --without-<package>,
it rightfully set NO_<PACKAGE> in the beginning of the configure script, but overwrite them with autodetect later.

Respect them now.

Hi Junio,

Can I get your opinion on this serie?

I do not have opinion on everything ;-) If you sent it during the pre-release freeze, it is very possible that I totally ignored it, especially if nobody showed interest in the topic.

Not limited to this topic, but I'd prefer to see leftover topics reappear after the tip of 'next' gets rewind.

Thanks.