summaryrefslogtreecommitdiff
path: root/methods/connect.cc
diff options
context:
space:
mode:
authorSteve Langasek <steve.langasek@canonical.com>2024-03-03 07:10:14 +0000
committerSteve Langasek <steve.langasek@canonical.com>2024-03-03 07:23:51 +0000
commit9044806c2adc6118399349c70a6c5746cedcc374 (patch)
tree5f943ccc04d4b8021200085610f079ce1e6ecba8 /methods/connect.cc
parent09092ad336e9f8a64ee59794fdc301a74238fe1c (diff)
Support building without gnutls
Once in a generation, it may be necessary to bootstrap apt in an environment where gnutls is not yet available. This makes gnutls support in apt optional. You may also want a configure flag to force gnutls to be required from outside the buildsystem (e.g. debian/rules).
Diffstat (limited to 'methods/connect.cc')
-rw-r--r--methods/connect.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/methods/connect.cc b/methods/connect.cc
index 110f2fc75..f3e199d0a 100644
--- a/methods/connect.cc
+++ b/methods/connect.cc
@@ -19,8 +19,10 @@
#include <apt-pkg/srvrec.h>
#include <apt-pkg/strutl.h>
+#ifdef HAVE_GNUTLS
#include <gnutls/gnutls.h>
#include <gnutls/x509.h>
+#endif
#include <cerrno>
#include <cstdio>
@@ -798,7 +800,8 @@ ResultState UnwrapSocks(std::string Host, int Port, URI Proxy, std::unique_ptr<M
return ResultState::SUCCESSFUL;
}
- /*}}}*/
+
+#ifdef HAVE_GNUTLS /*}}}*/
// UnwrapTLS - Handle TLS connections /*{{{*/
// ---------------------------------------------------------------------
/* Performs a TLS handshake on the socket */
@@ -1050,4 +1053,4 @@ ResultState UnwrapTLS(std::string const &Host, std::unique_ptr<MethodFd> &Fd,
return ResultState::SUCCESSFUL;
}
- /*}}}*/
+#endif /*}}}*/