Skip to content

Commit 3897d2d

Browse files
committed
Merge branch 'rp/link-curl-before-ssl' into maint
The linkage order of libraries was wrong in places around libcurl. * rp/link-curl-before-ssl: configure.ac: detect ssl need with libcurl Makefile: make curl-config path configurable Makefile: link libcurl before zlib
2 parents 4349f59 + 7e91e8d commit 3897d2d

File tree

2 files changed

+34
-6
lines changed

2 files changed

+34
-6
lines changed

Makefile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ all::
3939
# Define CURLDIR=/foo/bar if your curl header and library files are in
4040
# /foo/bar/include and /foo/bar/lib directories.
4141
#
42+
# Define CURL_CONFIG to curl's configuration program that prints information
43+
# about the library (e.g., its version number). The default is 'curl-config'.
44+
#
4245
# Define NO_EXPAT if you do not have expat installed. git-http-push is
4346
# not built, and you cannot push using http:// and https:// transports (dumb).
4447
#
@@ -428,6 +431,7 @@ TCL_PATH = tclsh
428431
TCLTK_PATH = wish
429432
XGETTEXT = xgettext
430433
MSGFMT = msgfmt
434+
CURL_CONFIG = curl-config
431435
PTHREAD_LIBS = -lpthread
432436
PTHREAD_CFLAGS =
433437
GCOV = gcov
@@ -1036,7 +1040,7 @@ ifdef HAVE_ALLOCA_H
10361040
endif
10371041

10381042
IMAP_SEND_BUILDDEPS =
1039-
IMAP_SEND_LDFLAGS = $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
1043+
IMAP_SEND_LDFLAGS =
10401044

10411045
ifdef NO_CURL
10421046
BASIC_CFLAGS += -DNO_CURL
@@ -1066,13 +1070,13 @@ else
10661070
REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
10671071
PROGRAM_OBJS += http-fetch.o
10681072
PROGRAMS += $(REMOTE_CURL_NAMES)
1069-
curl_check := $(shell (echo 070908; curl-config --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
1073+
curl_check := $(shell (echo 070908; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
10701074
ifeq "$(curl_check)" "070908"
10711075
ifndef NO_EXPAT
10721076
PROGRAM_OBJS += http-push.o
10731077
endif
10741078
endif
1075-
curl_check := $(shell (echo 072200; curl-config --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
1079+
curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
10761080
ifeq "$(curl_check)" "072200"
10771081
USE_CURL_FOR_IMAP_SEND = YesPlease
10781082
endif
@@ -1093,6 +1097,7 @@ else
10931097
endif
10941098
endif
10951099
endif
1100+
IMAP_SEND_LDFLAGS += $(OPENSSL_LINK) $(OPENSSL_LIBSSL) $(LIB_4_CRYPTO)
10961101

10971102
ifdef ZLIB_PATH
10981103
BASIC_CFLAGS += -I$(ZLIB_PATH)/include
@@ -1978,10 +1983,10 @@ git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
19781983

19791984
git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
19801985
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1981-
$(LIBS) $(CURL_LIBCURL)
1986+
$(CURL_LIBCURL) $(LIBS)
19821987
git-http-push$X: http.o http-push.o GIT-LDFLAGS $(GITLIBS)
19831988
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1984-
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
1989+
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
19851990

19861991
git-remote-testsvn$X: remote-testsvn.o GIT-LDFLAGS $(GITLIBS) $(VCSSVN_LIB)
19871992
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) \
@@ -1995,7 +2000,7 @@ $(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
19952000

19962001
$(REMOTE_CURL_PRIMARY): remote-curl.o http.o http-walker.o GIT-LDFLAGS $(GITLIBS)
19972002
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
1998-
$(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT)
2003+
$(CURL_LIBCURL) $(EXPAT_LIBEXPAT) $(LIBS)
19992004

20002005
$(LIB_FILE): $(LIB_OBJS)
20012006
$(QUIET_AR)$(RM) $@ && $(AR) $(ARFLAGS) $@ $^

configure.ac

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,10 +521,33 @@ AC_CHECK_LIB([curl], [curl_global_init],
521521
[NO_CURL=],
522522
[NO_CURL=YesPlease])
523523

524+
if test -z "${NO_CURL}" && test -z "${NO_OPENSSL}"; then
525+
526+
AC_CHECK_LIB([curl], [Curl_ssl_init],
527+
[NEEDS_SSL_WITH_CURL=YesPlease],
528+
[NEEDS_SSL_WITH_CURL=])
529+
530+
GIT_CONF_SUBST([NEEDS_SSL_WITH_CURL])
531+
532+
fi
533+
524534
GIT_UNSTASH_FLAGS($CURLDIR)
525535

526536
GIT_CONF_SUBST([NO_CURL])
527537

538+
if test -z "$NO_CURL"; then
539+
540+
AC_CHECK_PROG([CURL_CONFIG], [curl-config],
541+
[curl-config],
542+
[no])
543+
544+
if test $CURL_CONFIG != no; then
545+
GIT_CONF_SUBST([CURL_CONFIG])
546+
fi
547+
548+
fi
549+
550+
528551
#
529552
# Define NO_EXPAT if you do not have expat installed. git-http-push is
530553
# not built, and you cannot push using http:// and https:// transports.

0 commit comments

Comments
 (0)