diff --git a/Quake/Makefile b/Quake/Makefile index e0eabc087..ad73a3f77 100644 --- a/Quake/Makefile +++ b/Quake/Makefile @@ -10,6 +10,9 @@ DO_USERDIRS=0 ### Enable/Disable SDL2 USE_SDL2=1 +### Enable/Disable Curl +USE_CURL=1 + ### Enable/Disable codecs for streaming music support USE_CODEC_WAVE=1 USE_CODEC_FLAC=0 @@ -114,8 +117,12 @@ else NET_LIBS := endif +ifeq ($(USE_CURL),1) NET_LIBS += -lcurl CFLAGS += $(shell $(PKG_CONFIG) --cflags libcurl) +else +CFLAGS += -DWITHOUT_CURL +endif ifneq ($(VORBISLIB),vorbis) ifneq ($(VORBISLIB),tremor) diff --git a/Quake/Makefile.w32 b/Quake/Makefile.w32 index 379f2a844..80cee15f7 100644 --- a/Quake/Makefile.w32 +++ b/Quake/Makefile.w32 @@ -8,6 +8,9 @@ ### Enable/disable SDL2 USE_SDL2=1 +### Enable/Disable Curl +USE_CURL=1 + ### Enable/disable codecs for streaming music support USE_CODEC_WAVE=1 USE_CODEC_FLAC=1 @@ -93,9 +96,13 @@ endif CFLAGS += $(DEFWINSOCK) NET_LIBS := $(LIBWINSOCK) +ifeq ($(USE_CURL),1) NET_LIBS += -lcurl CFLAGS += -I../Windows/curl/include LDFLAGS += -L../Windows/curl/lib/x86 +else +CFLAGS += -DWITHOUT_CURL +endif ifneq ($(VORBISLIB),vorbis) ifneq ($(VORBISLIB),tremor) diff --git a/Quake/Makefile.w64 b/Quake/Makefile.w64 index 1a4b09a53..f1c28245f 100644 --- a/Quake/Makefile.w64 +++ b/Quake/Makefile.w64 @@ -7,6 +7,9 @@ ### Enable/disable SDL2 USE_SDL2=1 +### Enable/Disable Curl +USE_CURL=1 + ### Enable/disable codecs for streaming music support USE_CODEC_WAVE=1 USE_CODEC_FLAC=1 @@ -86,9 +89,13 @@ LIBWINSOCK := -lws2_32 CFLAGS += $(DEFWINSOCK) NET_LIBS := $(LIBWINSOCK) +ifeq ($(USE_CURL),1) NET_LIBS += -lcurl CFLAGS += -I../Windows/curl/include LDFLAGS += -L../Windows/curl/lib/x64 +else +CFLAGS += -DWITHOUT_CURL +endif ifneq ($(VORBISLIB),vorbis) ifneq ($(VORBISLIB),tremor) diff --git a/Quake/host_cmd.c b/Quake/host_cmd.c index 180bd8d3b..5c1b400ba 100644 --- a/Quake/host_cmd.c +++ b/Quake/host_cmd.c @@ -24,8 +24,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "q_ctype.h" #include "json.h" - +#include +#ifndef WITHOUT_CURL #include +#endif #define MAX_URL 2048 extern cvar_t pausable; @@ -569,6 +571,10 @@ typedef struct download_s static qboolean Download (const char *url, download_t *download) { +#ifdef WITHOUT_CURL + download->error = "download support disabled at compile time."; + return false; +#else CURL *curl; CURLM *multi_handle; CURLMcode mc; @@ -647,6 +653,7 @@ static qboolean Download (const char *url, download_t *download) curl_multi_cleanup (multi_handle); return !download->error && !still_running && download->response == 200; +#endif } typedef struct diff --git a/Quake/net_main.c b/Quake/net_main.c index 4c7184b14..4a090399b 100644 --- a/Quake/net_main.c +++ b/Quake/net_main.c @@ -25,7 +25,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "net_sys.h" #include "net_defs.h" +#ifndef WITHOUT_CURL #include +#endif qsocket_t *net_activeSockets = NULL; qsocket_t *net_freeSockets = NULL; @@ -835,7 +837,9 @@ void NET_Init (void) Con_DPrintf("TCP/IP address %s\n", my_tcpip_address); } +#ifndef WITHOUT_CURL curl_global_init (CURL_GLOBAL_DEFAULT); +#endif } /* @@ -848,8 +852,9 @@ void NET_Shutdown (void) { qsocket_t *sock; +#ifndef WITHOUT_CURL curl_global_cleanup (); - +#endif SetNetTime(); for (sock = net_activeSockets; sock; sock = sock->next)