{"thread":{"id":"40373","subject":"[PATCH] Makefile: Change library order for static linking","startedAt":"2015-09-17T19:25:00Z","lastAt":"2015-09-22T21:30:06Z","messageCount":10,"participants":["Remi Pommarel","Eric Sunshine","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"270257","messageId":"CAPig+cRCF1prBKRCUdEZwiA5=VshMcYPi9Fo5bHxD2Fp8wgrfg@mail.gmail.com","threadId":"40373","inReplyTo":"1442524332-10180-1-git-send-email-repk@triplefau.lt","subject":"Re: [PATCH] Makefile: Change library order for static linking","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2015-09-17T19:25:00Z","receivedAt":"2015-09-17T19:25:00Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Thu, Sep 17, 2015 at 5:12 PM, Remi Pommarel <repk@triplefau.lt> wrote:\n> For static linking especially library order while linking is important. For\n> example libssl contains symbol from libcrypto so the farmer should be linked\n\nI hope you meant: s/farmer/former/\n\n> before the latter. The global link order should be libcurl then libssl then\n> libcrypto then libintl and finally zlib.\n>\n> Signed-off-by: Remi Pommarel <repk@triplefau.lt>\n> ---\n>  Makefile | 10 +++++-----\n>  1 file changed, 5 insertions(+), 5 deletions(-)\n>\n> diff --git a/Makefile b/Makefile\n> index 81ac5bb..26a483a 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1030,7 +1030,6 @@ ifdef HAVE_ALLOCA_H\n>  endif\n>\n>  IMAP_SEND_BUILDDEPS =\n> -IMAP_SEND_LDFLAGS = $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)\n>\n>  ifdef NO_CURL\n>         BASIC_CFLAGS += -DNO_CURL\n> @@ -1087,6 +1086,7 @@ else\n>                 endif\n>         endif\n>  endif\n> +IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)\n>\n>  ifdef ZLIB_PATH\n>         BASIC_CFLAGS += -I$(ZLIB_PATH)/include\n> @@ -1117,7 +1117,7 @@ ifdef NO_OPENSSL\n>         LIB_4_CRYPTO =\n>  else\n>  ifdef NEEDS_SSL_WITH_CRYPTO\n> -       LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl\n> +       LIB_4_CRYPTO = $(OPENSSL_LINK) -lssl -lcrypto\n>  else\n>         LIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto\n>  endif\n> @@ -1972,10 +1972,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)\n>\n>  git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)\n>         $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n> -               $(LIBS) $(CURL_LIBCURL)\n> +               $(CURL_LIBCURL) $(LIBS)\n>  git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)\n>         $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n> -               $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n> +               $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)\n>\n>  git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)\n>         $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \\\n> @@ -1989,7 +1989,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)\n>\n>  $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)\n>         $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n> -               $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n> +               $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)\n>\n>  $(LIB_FILE): $(LIB_OBJS)\n>         $(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $^\n> --\n> 2.0.1\n"},{"id":"270260","messageId":"xmqqfv2cj03t.fsf@gitster.mtv.corp.google.com","threadId":"40373","inReplyTo":"1442524332-10180-1-git-send-email-repk@triplefau.lt","subject":"Re: [PATCH] Makefile: Change library order for static linking","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-09-17T19:51:18Z","receivedAt":"2015-09-17T19:51:18Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Remi Pommarel <repk@triplefau.lt> writes:\n\n> Subject: Re: [PATCH] Makefile: Change library order for static linking\n\ns/Change/change/;\n\nBut more importantly, I think you can do much better with the same\nspace.  Perhaps like this.\n\n    Makefile: link libcurl before openssl and crypto\n\n> For static linking especially library order while linking is important. For\n> example libssl contains symbol from libcrypto so the farmer should be linked\n> before the latter. The global link order should be libcurl then libssl then\n> libcrypto then libintl and finally zlib.\n\nIIRC historically the division between ssl and crypto was messy.\nEspecially, I am not sure if the change to NEEDS_SSL_WITH_CRYPTO\nin this patch is correct for platforms that require that macro\ndefined.\n\nOther changes in this patch looks sensible, though.\n\n\n>\n> Signed-off-by: Remi Pommarel <repk@triplefau.lt>\n> ---\n>  Makefile | 10 +++++-----\n>  1 file changed, 5 insertions(+), 5 deletions(-)\n>\n> diff --git a/Makefile b/Makefile\n> index 81ac5bb..26a483a 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -1030,7 +1030,6 @@ ifdef HAVE_ALLOCA_H\n>  endif\n>  \n>  IMAP_SEND_BUILDDEPS =\n> -IMAP_SEND_LDFLAGS = $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)\n>  \n>  ifdef NO_CURL\n>  \tBASIC_CFLAGS += -DNO_CURL\n> @@ -1087,6 +1086,7 @@ else\n>  \t\tendif\n>  \tendif\n>  endif\n> +IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)\n>  \n>  ifdef ZLIB_PATH\n>  \tBASIC_CFLAGS += -I$(ZLIB_PATH)/include\n> @@ -1117,7 +1117,7 @@ ifdef NO_OPENSSL\n>  \tLIB_4_CRYPTO =\n>  else\n>  ifdef NEEDS_SSL_WITH_CRYPTO\n> -\tLIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl\n> +\tLIB_4_CRYPTO = $(OPENSSL_LINK) -lssl -lcrypto\n>  else\n>  \tLIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto\n>  endif\n> @@ -1972,10 +1972,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)\n>  \n>  git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)\n>  \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n> -\t\t$(LIBS) $(CURL_LIBCURL)\n> +\t\t$(CURL_LIBCURL) $(LIBS)\n>  git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)\n>  \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n> -\t\t$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n> +\t\t$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)\n>  \n>  git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)\n>  \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \\\n> @@ -1989,7 +1989,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)\n>  \n>  $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)\n>  \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n> -\t\t$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n> +\t\t$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)\n>  \n>  $(LIB_FILE): $(LIB_OBJS)\n>  \t$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $^\n"},{"id":"270255","messageId":"1442524332-10180-1-git-send-email-repk@triplefau.lt","threadId":"40373","inReplyTo":null,"subject":"[PATCH] Makefile: Change library order for static linking","fromName":"Remi Pommarel","fromEmail":"repk@triplefau.lt","sentAt":"2015-09-17T21:12:12Z","receivedAt":"2015-09-17T21:12:12Z","isPatch":true,"sender":{"key":"repk@triplefau.lt","avatar":"https://avatars.githubusercontent.com/u/6833759?v=4"},"body":"For static linking especially library order while linking is important. For\nexample libssl contains symbol from libcrypto so the farmer should be linked\nbefore the latter. The global link order should be libcurl then libssl then\nlibcrypto then libintl and finally zlib.\n\nSigned-off-by: Remi Pommarel <repk@triplefau.lt>\n---\n Makefile | 10 +++++-----\n 1 file changed, 5 insertions(+), 5 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 81ac5bb..26a483a 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1030,7 +1030,6 @@ ifdef HAVE_ALLOCA_H\n endif\n \n IMAP_SEND_BUILDDEPS =\n-IMAP_SEND_LDFLAGS = $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)\n \n ifdef NO_CURL\n \tBASIC_CFLAGS += -DNO_CURL\n@@ -1087,6 +1086,7 @@ else\n \t\tendif\n \tendif\n endif\n+IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)\n \n ifdef ZLIB_PATH\n \tBASIC_CFLAGS += -I$(ZLIB_PATH)/include\n@@ -1117,7 +1117,7 @@ ifdef NO_OPENSSL\n \tLIB_4_CRYPTO =\n else\n ifdef NEEDS_SSL_WITH_CRYPTO\n-\tLIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto -lssl\n+\tLIB_4_CRYPTO = $(OPENSSL_LINK) -lssl -lcrypto\n else\n \tLIB_4_CRYPTO = $(OPENSSL_LINK) -lcrypto\n endif\n@@ -1972,10 +1972,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)\n \n git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n-\t\t$(LIBS) $(CURL_LIBCURL)\n+\t\t$(CURL_LIBCURL) $(LIBS)\n git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n-\t\t$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n+\t\t$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)\n \n git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \\\n@@ -1989,7 +1989,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)\n \n $(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \\\n-\t\t$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n+\t\t$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)\n \n $(LIB_FILE): $(LIB_OBJS)\n \t$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $^\n-- \n2.0.1\n"},{"id":"270265","messageId":"20150917212016.GF606@cruxbox","threadId":"40373","inReplyTo":"xmqqfv2cj03t.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] Makefile: Change library order for static linking","fromName":"Remi Pommarel","fromEmail":"repk@triplefau.lt","sentAt":"2015-09-17T21:20:16Z","receivedAt":"2015-09-17T21:20:16Z","isPatch":true,"sender":{"key":"repk@triplefau.lt","avatar":"https://avatars.githubusercontent.com/u/6833759?v=4"},"body":"On Thu, Sep 17, 2015 at 12:51:18PM -0700, Junio C Hamano wrote:\n> IIRC historically the division between ssl and crypto was messy.\n> Especially, I am not sure if the change to NEEDS_SSL_WITH_CRYPTO\n> in this patch is correct for platforms that require that macro\n> defined.\n\nI think it is correct as anywhere else in Makefile the order is ssl\nfirst then crypto (from Makefile:1047):\n\n        ifdef NEEDS_SSL_WITH_CURL\n                CURL_LIBCURL += -lssl\n                ifdef NEEDS_CRYPTO_WITH_SSL\n                        CURL_LIBCURL += -lcrypto\n                endif\n        endif\n\n\n> \n> Other changes in this patch looks sensible, though.\n\nIf you agree with the NEED_SSL_WITH_CURL modification, I'll resend a\npatch with the typos corrected.\n"},{"id":"270259","messageId":"20150917213143.GE606@cruxbox","threadId":"40373","inReplyTo":"CAPig+cRCF1prBKRCUdEZwiA5=VshMcYPi9Fo5bHxD2Fp8wgrfg@mail.gmail.com","subject":"Re: [PATCH] Makefile: Change library order for static linking","fromName":"Remi Pommarel","fromEmail":"repk@triplefau.lt","sentAt":"2015-09-17T21:31:43Z","receivedAt":"2015-09-17T21:31:43Z","isPatch":true,"sender":{"key":"repk@triplefau.lt","avatar":"https://avatars.githubusercontent.com/u/6833759?v=4"},"body":"On Thu, Sep 17, 2015 at 03:25:00PM -0400, Eric Sunshine wrote:\n> On Thu, Sep 17, 2015 at 5:12 PM, Remi Pommarel <repk@triplefau.lt> wrote:\n> > For static linking especially library order while linking is important. For\n> > example libssl contains symbol from libcrypto so the farmer should be linked\n> \n> I hope you meant: s/farmer/former/\n> \n\nOups sorry for the typo, yes I did mean former.\n"},{"id":"270268","messageId":"xmqq7fnoitra.fsf@gitster.mtv.corp.google.com","threadId":"40373","inReplyTo":"20150917212016.GF606@cruxbox","subject":"Re: [PATCH] Makefile: Change library order for static linking","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-09-17T22:08:25Z","receivedAt":"2015-09-17T22:08:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Remi Pommarel <repk@triplefau.lt> writes:\n\n> On Thu, Sep 17, 2015 at 12:51:18PM -0700, Junio C Hamano wrote:\n>> IIRC historically the division between ssl and crypto was messy.\n>> Especially, I am not sure if the change to NEEDS_SSL_WITH_CRYPTO\n>> in this patch is correct for platforms that require that macro\n>> defined.\n>\n> I think it is correct as anywhere else in Makefile the order is ssl\n> first then crypto (from Makefile:1047):\n\nIIRC, NEEDS_SSL_WITH_CRYPTO was invented for people whose platform\nneeded that to be different\n\n597c9cc5 (Flatten tools/ directory to make build procedure simpler.,\n2005-09-07) has this bit:\n\n    +ifdef NEEDS_SSL_WITH_CRYPTO\n    +       LIB_4_CRYPTO = -lcrypto -lssl\n    +else\n    +       LIB_4_CRYPTO = -lcrypto\n    +endif\n\nThat is, for most people, linking with -lcrypto was sufficient, but\nsome people needed to grab things from -lssl when they need to do\nso, because things in -lcrypto referred to what was only in -lssl.\n\nAre you on such a platform?  If so can you test these both ways and\nmake sure you are not breaking things for those on such a platform?\n"},{"id":"270277","messageId":"20150918071525.GA482@cruxbox","threadId":"40373","inReplyTo":"xmqq7fnoitra.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] Makefile: Change library order for static linking","fromName":"Remi Pommarel","fromEmail":"repk@triplefau.lt","sentAt":"2015-09-18T07:17:14Z","receivedAt":"2015-09-18T07:17:14Z","isPatch":true,"sender":{"key":"repk@triplefau.lt","avatar":"https://avatars.githubusercontent.com/u/6833759?v=4"},"body":"On Thu, Sep 17, 2015 at 03:08:25PM -0700, Junio C Hamano wrote:\n> That is, for most people, linking with -lcrypto was sufficient, but\n> some people needed to grab things from -lssl when they need to do\n> so, because things in -lcrypto referred to what was only in -lssl.\n\nOh I see what you mean, I misinterpreted what NEEDS_SSL_WITH_CRYPTO\ndoes.\n\nThe problem on static compiled target is that libcurl.a got linked with\nlibssl symbols. The proper variable I should have used is\nNEEDS_SSL_WITH_CURL. But this variable is not setted on Linux and not\nconfigurable, this is why I wrongly used NEEDS_SSL_WITH_CRYPTO.\n\nI see several ways to fix static compilation:\n\n\t1) Make NEED_SSL_WITH_CURL overridable by configure (the same\n\tway NEEDS_SSL_WITH_CRYPTO is). Then static target should run\n\t\"NEED_SSL_WITH_CURL=YesPlease ./configure\"\n\n\t2) Make configure know that static compilation is asked (ie\n\t./configure --static) and automatically set NEED_SSL_WITH_CURL.\n\n\t3) Use \"curl-config --static-libs\" to fill CURL_LIBCURL in\n\tMakefile when ones use \"./configure --static\".\n"},{"id":"270405","messageId":"xmqqh9mnbswv.fsf@gitster.mtv.corp.google.com","threadId":"40373","inReplyTo":"20150918071525.GA482@cruxbox","subject":"Re: [PATCH] Makefile: Change library order for static linking","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-09-21T17:09:52Z","receivedAt":"2015-09-21T17:09:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Remi Pommarel <repk@triplefau.lt> writes:\n\n> On Thu, Sep 17, 2015 at 03:08:25PM -0700, Junio C Hamano wrote:\n>> That is, for most people, linking with -lcrypto was sufficient, but\n>> some people needed to grab things from -lssl when they need to do\n>> so, because things in -lcrypto referred to what was only in -lssl.\n>\n> Oh I see what you mean, I misinterpreted what NEEDS_SSL_WITH_CRYPTO\n> does.\n>\n> The problem on static compiled target is that libcurl.a got linked with\n> libssl symbols. \n\nI think I said this already, but I found these bits from your patch\n\n-\t\t$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n+\t\t$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)\n\nthat first uses libcurl and then libs (which has ssl bits) totally\nsensible.  Shouldn't that be sufficient?\n\n> The proper variable I should have used is\n> NEEDS_SSL_WITH_CURL. But this variable is not setted on Linux and not\n> configurable,...\n\nReally?  Anything is configurable from your config.mak, I would have\nthought.\n"},{"id":"270524","messageId":"20150922203759.GB9793@cruxbox","threadId":"40373","inReplyTo":"xmqqh9mnbswv.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] Makefile: Change library order for static linking","fromName":"Remi Pommarel","fromEmail":"repk@triplefau.lt","sentAt":"2015-09-22T20:37:59Z","receivedAt":"2015-09-22T20:37:59Z","isPatch":true,"sender":{"key":"repk@triplefau.lt","avatar":"https://avatars.githubusercontent.com/u/6833759?v=4"},"body":"On Mon, Sep 21, 2015 at 10:09:52AM -0700, Junio C Hamano wrote:\n> I think I said this already, but I found these bits from your patch\n> \n> -\t\t$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)\n> +\t\t$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)\n> \n> that first uses libcurl and then libs (which has ssl bits) totally\n> sensible.  Shouldn't that be sufficient?\n\nThat is not sufficient on its own because -lssl is not added in $(LIBS), it\nis only added in $(CURL_LIBCURL) if NEEDS_SSL_WITH_CURL is set.\n\n> \n> > The proper variable I should have used is\n> > NEEDS_SSL_WITH_CURL. But this variable is not setted on Linux and not\n> > configurable,...\n> \n> Really?  Anything is configurable from your config.mak, I would have\n> thought.\n\nYou right using the parts you find sensible and adding\n\"NEEDS_SSL_WITH_CURL=YesPlease\" in config.mak makes git compile fine. So\nI will resubmit with only the sensible part of the patch.\n\nI have one last question thought. Wouldn't it be nice if we had\nconfigure to autodetect the need for -lssl with libcurl ? We could make\nconfigure to check for Curl_ssl_init function symbol in libcurl,\nwhich is only present if libcurl has been compiled with openssl support,\nby adding something like that in configure.ac:\n\nAC_CHECK_LIB([curl], [Curl_ssl_init],\n\t[NEEDS_SSL_WITH_CURL=YesPlease],\n\t[NEEDS_SSL_WITH_CURL=])\n\nThe thing that I'm afraid of is that checking a function that is not part\nof official libcurl API could be not very reliable, don't you think ?\n"},{"id":"270533","messageId":"xmqqlhby16sh.fsf@gitster.mtv.corp.google.com","threadId":"40373","inReplyTo":"20150922203759.GB9793@cruxbox","subject":"Re: [PATCH] Makefile: Change library order for static linking","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-09-22T21:30:06Z","receivedAt":"2015-09-22T21:30:06Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Remi Pommarel <repk@triplefau.lt> writes:\n\n> I have one last question thought. Wouldn't it be nice if we had\n> configure to autodetect the need for -lssl with libcurl?\n\nSure.  I do not think anybody tried, but it would be nice.\n\n> We could make\n> configure to check for Curl_ssl_init function symbol in libcurl,\n> which is only present if libcurl has been compiled with openssl support,\n> by adding something like that in configure.ac:\n>\n> AC_CHECK_LIB([curl], [Curl_ssl_init],\n> \t[NEEDS_SSL_WITH_CURL=YesPlease],\n> \t[NEEDS_SSL_WITH_CURL=])\n>\n> The thing that I'm afraid of is that checking a function that is not part\n> of official libcurl API could be not very reliable, don't you think ?\n\nThat is true.\n\nTo be bluntly honest, use of autoconf (and configure generated by\nit) in this project is optional, so I would not worry too much if\nyou misidentify a version of cURL that does not need -lssl as\nneeding one (or vice versa).  As long as other parts of the\nresulting ./configure keeps working (read: emitting a syntactically\nbroken shell script is not an OK offence) and if there is a way to\nwork around the result of misidentification made by ./configure\n(read: config.mak can cure all gotchas made by config.mak.autogen),\nit would be fine to use something like the above snippet you gave us\nas the starting point and it will help some positive number of\npeople.  We have to start from somewhere if we want to get there.\n\nPeople who find versions of libcURL that gets misidentified will\nsend in fixes if it matters to them.\n\nThanks.\n"}]}