Skip to content

Commit b16aedd

Browse files
avargitster
authored andcommitted
imap-send: replace auto-probe libcurl with hard dependency
Change the "imap-send" command to have a hard dependency on libcurl, before this it had an optional dependency on both libcurl and OpenSSL, now only the OpenSSL dependency is optional. This simplifies our dependency matrix my getting rid of yet another special-case. Given the prevalence of libcurl and portability of libcurl it seems reasonable to say that "git imap-send" cannot be used without libcurl, almost everyone building git needs to be able to push or pull over http(s), so they'll be building with libcurl already. So let's remove the previous "USE_CURL_FOR_IMAP_SEND" knob. Whether we build git-imap-send or not is now controlled by the "NO_CURL" knob. Let's also hide the old --curl and --no-curl options, and die if "--no-curl" is provided. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 844ede3 commit b16aedd

File tree

4 files changed

+14
-58
lines changed

4 files changed

+14
-58
lines changed

Documentation/git-imap-send.txt

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,6 @@ OPTIONS
3737
--quiet::
3838
Be quiet.
3939

40-
--curl::
41-
Use libcurl to communicate with the IMAP server, unless tunneling
42-
into it. Ignored if Git was built without the USE_CURL_FOR_IMAP_SEND
43-
option set.
44-
45-
--no-curl::
46-
Talk to the IMAP server using git's own IMAP routines instead of
47-
using libcurl. Ignored if Git was built with the NO_OPENSSL option
48-
set.
49-
5040

5141
CONFIGURATION
5242
-------------

INSTALL

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,13 @@ Issues of note:
129129
itself, e.g. Digest::MD5, File::Spec, File::Temp, Net::Domain,
130130
Net::SMTP, and Time::HiRes.
131131

132-
- git-imap-send needs the OpenSSL library to talk IMAP over SSL if
133-
you are using libcurl older than 7.34.0. Otherwise you can use
134-
NO_OPENSSL without losing git-imap-send.
132+
- git-imap-send needs libcurl 7.34.0 or newer, in addition
133+
OpenSSL is needed if using the "imap.tunnel" open to tunnel
134+
over SSL. Define NO_OPENSSL to omit the OpenSSL prerequisite.
135135

136136
- "libcurl" library is used for fetching and pushing
137137
repositories over http:// or https://, as well as by
138-
git-imap-send if the curl version is >= 7.34.0. If you do
138+
git-imap-send. If you do
139139
not need that functionality, use NO_CURL to build without
140140
it.
141141

Makefile

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,9 @@ PROGRAMS += $(EXTRA_PROGRAMS)
772772

773773
PROGRAM_OBJS += daemon.o
774774
PROGRAM_OBJS += http-backend.o
775+
ifndef NO_CURL
775776
PROGRAM_OBJS += imap-send.o
777+
endif
776778
PROGRAM_OBJS += sh-i18n--envsubst.o
777779
PROGRAM_OBJS += shell.o
778780
.PHONY: program-objs
@@ -1582,7 +1584,6 @@ ifdef HAVE_ALLOCA_H
15821584
BASIC_CFLAGS += -DHAVE_ALLOCA_H
15831585
endif
15841586

1585-
IMAP_SEND_BUILDDEPS =
15861587
IMAP_SEND_LDFLAGS =
15871588

15881589
ifdef NO_CURL
@@ -1591,6 +1592,7 @@ ifdef NO_CURL
15911592
REMOTE_CURL_ALIASES =
15921593
REMOTE_CURL_NAMES =
15931594
EXCLUDED_PROGRAMS += git-http-fetch git-http-push
1595+
EXCLUDED_PROGRAMS += git-imap-send
15941596
else
15951597
ifdef CURLDIR
15961598
# Try "-Wl,-rpath=$(CURLDIR)/$(lib)" in such a case.
@@ -1616,19 +1618,9 @@ else
16161618
REMOTE_CURL_NAMES = $(REMOTE_CURL_PRIMARY) $(REMOTE_CURL_ALIASES)
16171619
PROGRAM_OBJS += http-fetch.o
16181620
PROGRAMS += $(REMOTE_CURL_NAMES)
1621+
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
16191622
ifndef NO_EXPAT
16201623
PROGRAM_OBJS += http-push.o
1621-
endif
1622-
curl_check := $(shell (echo 072200; $(CURL_CONFIG) --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
1623-
ifeq "$(curl_check)" "072200"
1624-
USE_CURL_FOR_IMAP_SEND = YesPlease
1625-
endif
1626-
ifdef USE_CURL_FOR_IMAP_SEND
1627-
BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
1628-
IMAP_SEND_BUILDDEPS = http.o
1629-
IMAP_SEND_LDFLAGS += $(CURL_LIBCURL)
1630-
endif
1631-
ifndef NO_EXPAT
16321624
ifdef EXPATDIR
16331625
BASIC_CFLAGS += -I$(EXPATDIR)/include
16341626
EXPAT_LIBEXPAT = -L$(EXPATDIR)/$(lib) $(CC_LD_DYNPATH)$(EXPATDIR)/$(lib) -lexpat
@@ -2780,7 +2772,7 @@ endif
27802772
git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
27812773
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
27822774

2783-
git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
2775+
git-imap-send$X: imap-send.o http.o GIT-LDFLAGS $(GITLIBS)
27842776
$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
27852777
$(IMAP_SEND_LDFLAGS) $(LIBS)
27862778

imap-send.c

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,16 @@
3030
#if defined(NO_OPENSSL) && !defined(HAVE_OPENSSL_CSPRNG)
3131
typedef void *SSL;
3232
#endif
33-
#ifdef USE_CURL_FOR_IMAP_SEND
3433
#include "http.h"
35-
#endif
36-
37-
#if defined(USE_CURL_FOR_IMAP_SEND)
38-
/* Always default to curl if it's available. */
39-
#define USE_CURL_DEFAULT 1
40-
#else
41-
/* We don't have curl, so continue to use the historical implementation */
42-
#define USE_CURL_DEFAULT 0
43-
#endif
4434

4535
static int verbosity;
46-
static int use_curl = USE_CURL_DEFAULT;
36+
static int use_curl = 1;
4737

4838
static const char * const imap_send_usage[] = { "git imap-send [-v] [-q] [--[no-]curl] < <mbox>", NULL };
4939

5040
static struct option imap_send_options[] = {
5141
OPT__VERBOSITY(&verbosity),
52-
OPT_BOOL(0, "curl", &use_curl, "use libcurl to communicate with the IMAP server"),
42+
OPT_HIDDEN_BOOL(0, "curl", &use_curl, "use libcurl to communicate with the IMAP server"),
5343
OPT_END()
5444
};
5545

@@ -1396,7 +1386,6 @@ static int append_msgs_to_imap(struct imap_server_conf *server,
13961386
return 0;
13971387
}
13981388

1399-
#ifdef USE_CURL_FOR_IMAP_SEND
14001389
static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred)
14011390
{
14021391
CURL *curl;
@@ -1515,7 +1504,6 @@ static int curl_append_msgs_to_imap(struct imap_server_conf *server,
15151504

15161505
return res != CURLE_OK;
15171506
}
1518-
#endif
15191507

15201508
int cmd_main(int argc, const char **argv)
15211509
{
@@ -1531,17 +1519,8 @@ int cmd_main(int argc, const char **argv)
15311519
if (argc)
15321520
usage_with_options(imap_send_usage, imap_send_options);
15331521

1534-
#ifndef USE_CURL_FOR_IMAP_SEND
1535-
if (use_curl) {
1536-
warning("--curl not supported in this build");
1537-
use_curl = 0;
1538-
}
1539-
#elif defined(NO_OPENSSL)
1540-
if (!use_curl) {
1541-
warning("--no-curl not supported in this build");
1542-
use_curl = 1;
1543-
}
1544-
#endif
1522+
if (!use_curl)
1523+
die(_("the --no-curl option to imap-send has been deprecated"));
15451524

15461525
if (!server.port)
15471526
server.port = server.use_ssl ? 993 : 143;
@@ -1580,10 +1559,5 @@ int cmd_main(int argc, const char **argv)
15801559
if (server.tunnel)
15811560
return append_msgs_to_imap(&server, &all_msgs, total);
15821561

1583-
#ifdef USE_CURL_FOR_IMAP_SEND
1584-
if (use_curl)
1585-
return curl_append_msgs_to_imap(&server, &all_msgs, total);
1586-
#endif
1587-
1588-
return append_msgs_to_imap(&server, &all_msgs, total);
1562+
return curl_append_msgs_to_imap(&server, &all_msgs, total);
15891563
}

0 commit comments

Comments
 (0)