lib: skip compiling code with features disabled

In non-SSL, non-SSH, non-H3, non-AppleSecTrust builds.

Also:
- drop unused internal macro `SSL_SYSTEM_VERIFIER`.

Closes #20587
This commit is contained in:
Viktor Szakats 2026-02-13 10:32:28 +01:00
parent 0649eb0825
commit d445f2d930
No known key found for this signature in database
10 changed files with 31 additions and 28 deletions

View file

@ -22,32 +22,35 @@
*
***************************************************************************/
#include "../curl_setup.h"
#include "../urldata.h"
#include "vquic.h"
#include "../curl_trc.h"
#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
#ifdef HAVE_NETINET_UDP_H
#include <netinet/udp.h>
#endif
#ifdef USE_NGHTTP3
#include <nghttp3/nghttp3.h>
#endif
#include "../urldata.h"
#include "../bufq.h"
#include "../curlx/dynbuf.h"
#include "../curlx/fopen.h"
#include "../cfilters.h"
#include "../curl_trc.h"
#include "curl_ngtcp2.h"
#include "curl_quiche.h"
#include "../multiif.h"
#include "../progress.h"
#include "../rand.h"
#include "vquic.h"
#include "vquic_int.h"
#include "../curlx/strerr.h"
#include "../curlx/strparse.h"
#if !defined(CURL_DISABLE_HTTP) && defined(USE_HTTP3)
#define NW_CHUNK_SIZE (64 * 1024)
#define NW_SEND_CHUNKS 1

View file

@ -25,10 +25,10 @@
***************************************************************************/
#include "../curl_setup.h"
#include "../bufq.h"
#ifdef USE_HTTP3
#include "../bufq.h"
#define MAX_PKT_BURST 10
#define MAX_UDP_PAYLOAD_SIZE 1452
@ -121,8 +121,6 @@ CURLcode vquic_recv_packets(struct Curl_cfilter *cf,
size_t max_pkts,
vquic_recv_pkts_cb *recv_cb, void *userp);
#endif /* !USE_HTTP3 */
#ifdef USE_NGTCP2
struct ngtcp2_mem;
struct ngtcp2_mem *Curl_ngtcp2_mem(void);
@ -132,4 +130,6 @@ struct nghttp3_mem;
struct nghttp3_mem *Curl_nghttp3_mem(void);
#endif
#endif /* !USE_HTTP3 */
#endif /* HEADER_CURL_VQUIC_QUIC_INT_H */

View file

@ -24,6 +24,7 @@
*
***************************************************************************/
#include "../curl_setup.h"
#include "../urldata.h"
extern const struct Curl_protocol Curl_protocol_sftp;
extern const struct Curl_protocol Curl_protocol_scp;
@ -31,6 +32,8 @@ extern const struct Curl_protocol Curl_protocol_scp;
extern const struct Curl_scheme Curl_scheme_sftp;
extern const struct Curl_scheme Curl_scheme_scp;
#ifdef USE_SSH
#ifdef USE_LIBSSH2
#include <libssh2.h>
#include <libssh2_sftp.h>
@ -236,8 +239,6 @@ struct ssh_conn {
#endif /* USE_LIBSSH2 */
#ifdef USE_SSH
#ifdef CURLVERBOSE
const char *Curl_ssh_statename(sshstate state);
#else
@ -255,11 +256,10 @@ void Curl_ssh_cleanup(void);
void Curl_ssh_version(char *buffer, size_t buflen);
void Curl_ssh_attach(struct Curl_easy *data,
struct connectdata *conn);
#else
/* for non-SSH builds */
#else /* !USE_SSH */
#define Curl_ssh_cleanup()
#define Curl_ssh_attach(x, y)
#define Curl_ssh_init() 0
#endif
#endif /* USE_SSH */
#endif /* HEADER_CURL_SSH_H */

View file

@ -22,10 +22,11 @@
*
***************************************************************************/
#include "../curl_setup.h"
#include "ssh.h"
#ifdef USE_SSH
#include "vssh.h"
#include "ssh.h"
#ifdef USE_SSH
#include "../curlx/strparse.h"
#include "../curl_trc.h"
#include "../escape.h"

View file

@ -25,6 +25,8 @@
***************************************************************************/
#include "../curl_setup.h"
#ifdef USE_SSH
#include "../urldata.h"
CURLcode Curl_getworkingpath(struct Curl_easy *data,
@ -36,5 +38,5 @@ CURLcode Curl_get_pathname(const char **cpp, char **path, const char *homedir);
CURLcode Curl_ssh_range(struct Curl_easy *data,
const char *range, curl_off_t filesize,
curl_off_t *startp, curl_off_t *sizep);
#endif /* USE_SSH */
#endif /* HEADER_CURL_VSSH_VSSH_H */

View file

@ -40,19 +40,15 @@
#include "../curl_setup.h"
#ifdef USE_APPLE_SECTRUST
#include "../urldata.h"
#include "../cfilters.h"
#include "../curl_trc.h"
#include "vtls.h"
#include "apple.h"
#ifdef USE_APPLE_SECTRUST
#include <Security/Security.h>
#endif
#ifdef USE_APPLE_SECTRUST
#define SSL_SYSTEM_VERIFIER
#if (defined(MAC_OS_X_VERSION_MAX_ALLOWED) && \
MAC_OS_X_VERSION_MAX_ALLOWED >= 101400) || \

View file

@ -30,6 +30,7 @@
#include "../curl_setup.h"
#ifdef USE_SCHANNEL
#ifndef USE_WINDOWS_SSPI
#error "cannot compile Schannel support without SSPI."
#endif

View file

@ -147,7 +147,7 @@ static const struct alpn_spec ALPN_SPEC_H2_H11 = {
static const struct alpn_spec ALPN_SPEC_H11_H2 = {
{ ALPN_HTTP_1_1, ALPN_H2 }, 2
};
#endif
#endif /* USE_HTTP2 */
#if !defined(CURL_DISABLE_HTTP) || !defined(CURL_DISABLE_PROXY)
static const struct alpn_spec *alpn_get_spec(http_majors wanted,

View file

@ -25,13 +25,13 @@
***************************************************************************/
#include "../curl_setup.h"
#ifdef USE_SSL
#include "../cfilters.h"
#include "../select.h"
#include "../urldata.h"
#include "vtls.h"
#ifdef USE_SSL
struct Curl_ssl;
struct ssl_connect_data;
struct Curl_ssl_session;

View file

@ -25,11 +25,11 @@
***************************************************************************/
#include "../curl_setup.h"
#ifdef USE_SSL
#include "../cfilters.h"
#include "../urldata.h"
#ifdef USE_SSL
struct Curl_cfilter;
struct Curl_easy;
struct Curl_ssl_scache;