Merge branch 'jk/curl-ldflags'
authorJunio C Hamano <gitster@pobox.com>
Sun, 18 Nov 2018 09:23:53 +0000 (18:23 +0900)
committerJunio C Hamano <gitster@pobox.com>
Sun, 18 Nov 2018 09:23:53 +0000 (18:23 +0900)
The way -lcurl library gets linked has been simplified by taking
advantage of the fact that we can just ask curl-config command how.

* jk/curl-ldflags:
build: link with curl-defined linker flags

1  2 
Makefile
config.mak.uname
diff --combined Makefile
index 3b48e86e8b7660d8511aa8fee580d390955de2fb,ad005af5d4cce3565e91cf510f43d48c6eedaadb..7c4974348b4289a593755e69a99e5611c98df61c
+++ b/Makefile
@@@ -59,6 -59,13 +59,13 @@@ all:
  # 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 CURL_LDFLAGS to specify flags that you need to link when using libcurl,
+ # if you do not want to rely on the libraries provided by CURL_CONFIG.  The
+ # default value is a result of `curl-config --libs`.  An example value for
+ # CURL_LDFLAGS is as follows:
+ #
+ #     CURL_LDFLAGS=-lcurl
+ #
  # 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).
  #
  #
  # Define NEEDS_SSL_WITH_CRYPTO if you need -lssl when using -lcrypto (Darwin).
  #
- # Define NEEDS_SSL_WITH_CURL if you need -lssl with -lcurl (Minix).
- #
- # Define NEEDS_IDN_WITH_CURL if you need -lidn when using -lcurl (Minix).
- #
  # Define NEEDS_LIBICONV if linking with libc is not enough (Darwin).
  #
  # Define NEEDS_LIBINTL_BEFORE_LIBICONV if you need libintl before libiconv.
@@@ -751,7 -754,6 +754,7 @@@ TEST_BUILTINS_OBJS += test-sigchain.
  TEST_BUILTINS_OBJS += test-strcmp-offset.o
  TEST_BUILTINS_OBJS += test-string-list.o
  TEST_BUILTINS_OBJS += test-submodule-config.o
 +TEST_BUILTINS_OBJS += test-submodule-nested-repo-config.o
  TEST_BUILTINS_OBJS += test-subprocess.o
  TEST_BUILTINS_OBJS += test-urlmatch-normalization.o
  TEST_BUILTINS_OBJS += test-wildmatch.o
@@@ -993,7 -995,6 +996,7 @@@ LIB_OBJS += sub-process.
  LIB_OBJS += symlinks.o
  LIB_OBJS += tag.o
  LIB_OBJS += tempfile.o
 +LIB_OBJS += thread-utils.o
  LIB_OBJS += tmp-objdir.o
  LIB_OBJS += trace.o
  LIB_OBJS += trailer.o
        ifdef CURLDIR
                # Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
                BASIC_CFLAGS += -I$(CURLDIR)/include
-               CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib) -lcurl
+               CURL_LIBCURL = -L$(CURLDIR)/$(lib) $(CC_LD_DYNPATH)$(CURLDIR)/$(lib)
        else
-               CURL_LIBCURL = -lcurl
-       endif
-       ifdef NEEDS_SSL_WITH_CURL
-               CURL_LIBCURL += -lssl
-               ifdef NEEDS_CRYPTO_WITH_SSL
-                       CURL_LIBCURL += -lcrypto
-               endif
-       endif
-       ifdef NEEDS_IDN_WITH_CURL
-               CURL_LIBCURL += -lidn
+               CURL_LIBCURL =
        endif
  
+ ifdef CURL_LDFLAGS
+       CURL_LIBCURL += $(CURL_LDFLAGS)
+ else
+       CURL_LIBCURL += $(shell $(CURL_CONFIG) --libs)
+ endif
        REMOTE_CURL_PRIMARY = git-remote-http$X
        REMOTE_CURL_ALIASES = git-remote-https$X git-remote-ftp$X git-remote-ftps$X
        REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
@@@ -1678,6 -1676,7 +1678,6 @@@ ifdef NO_PTHREAD
  else
        BASIC_CFLAGS += $(PTHREAD_CFLAGS)
        EXTLIBS += $(PTHREAD_LIBS)
 -      LIB_OBJS += thread-utils.o
  endif
  
  ifdef HAVE_PATHS_H
@@@ -2071,7 -2070,7 +2071,7 @@@ $(BUILT_INS): git$
  
  command-list.h: generate-cmdlist.sh command-list.txt
  
 -command-list.h: $(wildcard Documentation/git*.txt) Documentation/*config.txt
 +command-list.h: $(wildcard Documentation/git*.txt) Documentation/*config.txt Documentation/config/*.txt
        $(QUIET_GEN)$(SHELL_PATH) ./generate-cmdlist.sh command-list.txt >$@+ && mv $@+ $@
  
  SCRIPT_DEFINES = $(SHELL_PATH_SQ):$(DIFF_SQ):$(GIT_VERSION):\
diff --combined config.mak.uname
index f179d7a1dc98d091f915dcca9ceb05dda5491549,19e6633040b1db4a148d7b33c4e9d374fe7f87ba..3ee7da0e230c4c33e79ae2f3cf498a5cd7cc4881
@@@ -370,6 -370,7 +370,6 @@@ ifeq ($(uname_S),Windows
        RUNTIME_PREFIX = YesPlease
        HAVE_WPGMPTR = YesWeDo
        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
 -      NO_NSEC = YesPlease
        USE_WIN32_MMAP = YesPlease
        MMAP_PREVENTS_DELETE = UnfortunatelyYes
        # USE_NED_ALLOCATOR = YesPlease
@@@ -430,8 -431,6 +430,6 @@@ ifeq ($(uname_S),Minix
        NO_NSEC = YesPlease
        NEEDS_LIBGEN =
        NEEDS_CRYPTO_WITH_SSL = YesPlease
-       NEEDS_IDN_WITH_CURL = YesPlease
-       NEEDS_SSL_WITH_CURL = YesPlease
        NEEDS_RESOLV =
        NO_HSTRERROR = YesPlease
        NO_MMAP = YesPlease
@@@ -457,7 -456,6 +455,6 @@@ ifeq ($(uname_S),NONSTOP_KERNEL
        # Missdetected, hence commented out, see below.
        #NO_CURL = YesPlease
        # Added manually, see above.
-       NEEDS_SSL_WITH_CURL = YesPlease
        HAVE_LIBCHARSET_H = YesPlease
        HAVE_STRINGS_H = YesPlease
        NEEDS_LIBICONV = YesPlease
@@@ -517,6 -515,7 +514,6 @@@ ifneq (,$(findstring MINGW,$(uname_S))
        RUNTIME_PREFIX = YesPlease
        HAVE_WPGMPTR = YesWeDo
        NO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease
 -      NO_NSEC = YesPlease
        USE_WIN32_MMAP = YesPlease
        MMAP_PREVENTS_DELETE = UnfortunatelyYes
        USE_NED_ALLOCATOR = YesPlease