{"thread":{"id":"42733","subject":"[PATCH] ./configure.ac: Detect SSL in libcurl using curl-config","startedAt":"2016-06-28T12:17:21Z","lastAt":"2016-06-28T16:32:40Z","messageCount":2,"participants":["Дилян Палаузов","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"290374","messageId":"20160628120434.28105-1-git-dpa@aegee.org","threadId":"42733","inReplyTo":null,"subject":"[PATCH] ./configure.ac: Detect SSL in libcurl using curl-config","fromName":"Дилян Палаузов","fromEmail":"git-dpa@aegee.org","sentAt":"2016-06-28T12:04:34Z","receivedAt":"2016-06-28T12:17:21Z","isPatch":true,"sender":{"key":"git-dpa@aegee.org","avatar":"https://avatars.githubusercontent.com/u/4992947?v=4"},"body":"The API of libcurl does not mention Curl_ssl_init() and when curl is built\nwith -flto, the Curl_ssl_init symbol is not exported.\n\nhttps://curl.haxx.se/libcurl/using/ suggests calling\n  curl-config --feature | grep SSL\nto see, if the installed curl has SSL support.  Another approach would\nbe calling curl_version_info and checking the returned struct.\n\nThis patch removes the check for the Curl_ssl_init exported symbol from\nlibcurl and uses curl-config to detect SSL support in libcurl.\n\nSigned-Off-By: Дилян Палаузов <git-dpa@aegee.org>\n---\n configure.ac | 21 +++++++++++----------\n 1 file changed, 11 insertions(+), 10 deletions(-)\n\ndiff --git a/configure.ac b/configure.ac\nindex c279025..5e9ba59 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -528,16 +528,6 @@ AC_CHECK_LIB([curl], [curl_global_init],\n [NO_CURL=],\n [NO_CURL=YesPlease])\n \n-if test -z \"${NO_CURL}\" && test -z \"${NO_OPENSSL}\"; then\n-\n-AC_CHECK_LIB([curl], [Curl_ssl_init],\n-[NEEDS_SSL_WITH_CURL=YesPlease],\n-[NEEDS_SSL_WITH_CURL=])\n-\n-GIT_CONF_SUBST([NEEDS_SSL_WITH_CURL])\n-\n-fi\n-\n GIT_UNSTASH_FLAGS($CURLDIR)\n \n GIT_CONF_SUBST([NO_CURL])\n@@ -550,6 +540,17 @@ AC_CHECK_PROG([CURL_CONFIG], [curl-config],\n \n if test $CURL_CONFIG != no; then\n     GIT_CONF_SUBST([CURL_CONFIG])\n+    if test -z \"${NO_OPENSSL}\"; then\n+      AC_MSG_CHECKING([if Curl supports SSL])\n+      if test $(curl-config --features|grep SSL) = SSL; then\n+         NEEDS_SSL_WITH_CURL=YesPlease\n+         AC_MSG_RESULT([yes])\n+      else\n+         NEEDS_SSL_WITH_CURL=\n+         AC_MSG_RESULT([no])\n+      fi\n+      GIT_CONF_SUBST([NEEDS_SSL_WITH_CURL])\n+    fi\n fi\n \n fi\n-- \n2.9.0\n\n"},{"id":"290392","messageId":"xmqqeg7h9svf.fsf@gitster.mtv.corp.google.com","threadId":"42733","inReplyTo":"20160628120434.28105-1-git-dpa@aegee.org","subject":"Re: [PATCH] ./configure.ac: Detect SSL in libcurl using curl-config","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-06-28T16:32:20Z","receivedAt":"2016-06-28T16:32:40Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Дилян Палаузов  <git-dpa@aegee.org> writes:\n\n> The API of libcurl does not mention Curl_ssl_init() and when curl is built\n> with -flto, the Curl_ssl_init symbol is not exported.\n>\n> https://curl.haxx.se/libcurl/using/ suggests calling\n>   curl-config --feature | grep SSL\n> to see, if the installed curl has SSL support.  Another approach would\n> be calling curl_version_info and checking the returned struct.\n>\n> This patch removes the check for the Curl_ssl_init exported symbol from\n> libcurl and uses curl-config to detect SSL support in libcurl.\n>\n> Signed-Off-By: Дилян Палаузов <git-dpa@aegee.org>\n> ---\n\nThis is a tangent, but the patch made me notice [*1*] that a user\ncannot build Git without libcurl support if curl is installed on the\nsystem, with something like:\n\n\t$ ./configure NO_CURL=NoThanks\n\nI do not know if that is a problem (it certainly is NOT a new\nproblem introduced by your change).\n\nAnyway, will queue.\n\nThanks.\n\n[Footnote]\n\n*1* The updated code does not have any branch based on $NO_CURL the\n    original used to have, even though it does branch on\n    $NO_OPENSSL, which is why I got curious.\n\n>  configure.ac | 21 +++++++++++----------\n>  1 file changed, 11 insertions(+), 10 deletions(-)\n>\n> diff --git a/configure.ac b/configure.ac\n> index c279025..5e9ba59 100644\n> --- a/configure.ac\n> +++ b/configure.ac\n> @@ -528,16 +528,6 @@ AC_CHECK_LIB([curl], [curl_global_init],\n>  [NO_CURL=],\n>  [NO_CURL=YesPlease])\n>  \n> -if test -z \"${NO_CURL}\" && test -z \"${NO_OPENSSL}\"; then\n> -\n> -AC_CHECK_LIB([curl], [Curl_ssl_init],\n> -[NEEDS_SSL_WITH_CURL=YesPlease],\n> -[NEEDS_SSL_WITH_CURL=])\n> -\n> -GIT_CONF_SUBST([NEEDS_SSL_WITH_CURL])\n> -\n> -fi\n> -\n>  GIT_UNSTASH_FLAGS($CURLDIR)\n>  \n>  GIT_CONF_SUBST([NO_CURL])\n> @@ -550,6 +540,17 @@ AC_CHECK_PROG([CURL_CONFIG], [curl-config],\n>  \n>  if test $CURL_CONFIG != no; then\n>      GIT_CONF_SUBST([CURL_CONFIG])\n> +    if test -z \"${NO_OPENSSL}\"; then\n> +      AC_MSG_CHECKING([if Curl supports SSL])\n> +      if test $(curl-config --features|grep SSL) = SSL; then\n> +         NEEDS_SSL_WITH_CURL=YesPlease\n> +         AC_MSG_RESULT([yes])\n> +      else\n> +         NEEDS_SSL_WITH_CURL=\n> +         AC_MSG_RESULT([no])\n> +      fi\n> +      GIT_CONF_SUBST([NEEDS_SSL_WITH_CURL])\n> +    fi\n>  fi\n>  \n>  fi\n"}]}