Fix FreeBSD build

This commit is contained in:
Sergey Lyubka 2022-01-24 02:20:45 +00:00
parent f7fbcd2451
commit 32f3c48b65
4 changed files with 18 additions and 7 deletions

View File

@ -18,12 +18,12 @@ CFLAGS ?= $(OPTS) $(WARN) $(INCS) $(DEFS) $(ASAN) -DMG_ENABLE_IPV6=$(IPV6) $(TFL
.PHONY: examples test
ifeq "$(SSL)" "MBEDTLS"
MBEDTLS ?= /usr
MBEDTLS ?= /usr/local
CFLAGS += -DMG_ENABLE_MBEDTLS=1 -I$(MBEDTLS)/include -I/usr/include
LDFLAGS ?= -L$(MBEDTLS)/lib -lmbedtls -lmbedcrypto -lmbedx509
endif
ifeq "$(SSL)" "OPENSSL"
OPENSSL ?= /usr
OPENSSL ?= /usr/local
CFLAGS += -DMG_ENABLE_OPENSSL=1 -I$(OPENSSL)/include
LDFLAGS ?= -L$(OPENSSL)/lib -lssl -lcrypto
endif

View File

@ -312,6 +312,7 @@ struct timeval {
#include <inttypes.h>
#include <limits.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <signal.h>
#include <stdarg.h>
@ -590,17 +591,24 @@ bool mg_log_prefix(int ll, const char *file, int line, const char *fname);
void mg_log_set(const char *spec);
void mg_log_set_callback(void (*fn)(const void *, size_t, void *), void *param);
// Let the compiler always see the log invocation in order to check parameters
// For MG_ENABLE_LOG=0 case, the call will be optimised out, anyway
#if MG_ENABLE_LOG
#define LOG(level, args) \
do { \
if (mg_log_prefix((level), __FILE__, __LINE__, __func__)) mg_log args; \
} while (0)
#else
#define LOG(level, args) \
do { \
(void) level; \
if (0) mg_log args; \
} while (0)
#endif
@ -983,11 +991,12 @@ long mg_tls_recv(struct mg_connection *, void *buf, size_t len);
void mg_tls_handshake(struct mg_connection *);
#if MG_ENABLE_MBEDTLS
#include <mbedtls/debug.h>
#include <mbedtls/net_sockets.h>
#include <mbedtls/ssl.h>

View File

@ -12,6 +12,7 @@
#include <inttypes.h>
#include <limits.h>
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <signal.h>
#include <stdarg.h>

View File

@ -1,10 +1,11 @@
#pragma once
#if MG_ENABLE_MBEDTLS
#include "config.h"
#include "log.h"
#include "url.h"
#include "util.h"
#if MG_ENABLE_MBEDTLS
#include <mbedtls/debug.h>
#include <mbedtls/net_sockets.h>
#include <mbedtls/ssl.h>