summaryrefslogtreecommitdiffstats
path: root/external/curl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 16:51:28 +0000
commit940b4d1848e8c70ab7642901a68594e8016caffc (patch)
treeeb72f344ee6c3d9b80a7ecc079ea79e9fba8676d /external/curl
parentInitial commit. (diff)
downloadlibreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.tar.xz
libreoffice-940b4d1848e8c70ab7642901a68594e8016caffc.zip
Adding upstream version 1:7.0.4.upstream/1%7.0.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--external/curl/ExternalPackage_curl.mk28
-rw-r--r--external/curl/ExternalProject_curl.mk95
-rw-r--r--external/curl/Makefile7
-rw-r--r--external/curl/Module_curl.mk18
-rw-r--r--external/curl/README1
-rw-r--r--external/curl/UnpackedTarball_curl.mk39
-rw-r--r--external/curl/clang-cl.patch.011
-rw-r--r--external/curl/curl-7.26.0_win-proxy.patch121
-rw-r--r--external/curl/curl-msvc-disable-protocols.patch.135
-rw-r--r--external/curl/curl-msvc.patch.127
-rw-r--r--external/curl/curl-nss.patch.112
-rw-r--r--external/curl/zlib.patch.090
12 files changed, 484 insertions, 0 deletions
diff --git a/external/curl/ExternalPackage_curl.mk b/external/curl/ExternalPackage_curl.mk
new file mode 100644
index 000000000..8da569e3e
--- /dev/null
+++ b/external/curl/ExternalPackage_curl.mk
@@ -0,0 +1,28 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalPackage_ExternalPackage,curl,curl))
+
+$(eval $(call gb_ExternalPackage_use_external_project,curl,curl))
+
+ifneq ($(DISABLE_DYNLOADING),TRUE)
+
+ifeq ($(COM),MSC)
+$(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl$(if $(MSVC_USE_DEBUG_RUNTIME),_debug).dll,builds/libcurl-vc12-$(if $(filter X86_64,$(CPUNAME)),x64,x86)-$(if $(MSVC_USE_DEBUG_RUNTIME),debug,release)-dll-ipv6-sspi-winssl/bin/libcurl$(if $(MSVC_USE_DEBUG_RUNTIME),_debug).dll))
+else ifeq ($(OS),MACOSX)
+$(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl.4.dylib,lib/.libs/libcurl.4.dylib))
+else ifeq ($(OS),AIX)
+$(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl.so,lib/.libs/libcurl.so.4))
+else
+$(eval $(call gb_ExternalPackage_add_file,curl,$(LIBO_LIB_FOLDER)/libcurl.so.4,lib/.libs/libcurl.so.4.6.0))
+endif
+
+endif # $(DISABLE_DYNLOADING)
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/curl/ExternalProject_curl.mk b/external/curl/ExternalProject_curl.mk
new file mode 100644
index 000000000..f6eb073f5
--- /dev/null
+++ b/external/curl/ExternalProject_curl.mk
@@ -0,0 +1,95 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalProject_ExternalProject,curl))
+
+$(eval $(call gb_ExternalProject_use_externals,curl,\
+ $(if $(ENABLE_NSS),nss3) \
+ zlib \
+))
+
+$(eval $(call gb_ExternalProject_register_targets,curl,\
+ build \
+))
+
+ifneq ($(OS),WNT)
+
+curl_CPPFLAGS :=
+curl_LDFLAGS := $(if $(filter LINUX FREEBSD,$(OS)),-Wl$(COMMA)-z$(COMMA)origin -Wl$(COMMA)-rpath$(COMMA)\$$$$ORIGIN)
+
+ifneq ($(OS),ANDROID)
+ifneq ($(SYSBASE),)
+curl_CPPFLAGS += -I$(SYSBASE)/usr/include
+curl_LDFLAGS += -L$(SYSBASE)/usr/lib
+endif
+endif
+
+# there are 2 include paths, the other one is passed to --with-nss below
+ifeq ($(SYSTEM_NSS),)
+curl_CPPFLAGS += -I$(call gb_UnpackedTarball_get_dir,nss)/dist/public/nss
+endif
+
+# use --with-darwinssl on macOS >10.5 and iOS to get a native UI for SSL certs for CMIS usage
+# use --with-nss only on platforms other than macOS and iOS
+$(call gb_ExternalProject_get_state_target,curl,build):
+ $(call gb_Trace_StartRange,curl,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ ./configure \
+ $(if $(filter iOS MACOSX,$(OS)),\
+ --with-darwinssl,\
+ $(if $(ENABLE_NSS),--with-nss$(if $(SYSTEM_NSS),,="$(call gb_UnpackedTarball_get_dir,nss)/dist/out"),--without-nss)) \
+ --without-ssl --without-gnutls --without-polarssl --without-cyassl --without-axtls --without-mbedtls \
+ --enable-ftp --enable-http --enable-ipv6 \
+ --without-libidn2 --without-libpsl --without-librtmp \
+ --without-libssh2 --without-metalink --without-nghttp2 \
+ --without-libssh --without-brotli \
+ --without-ngtcp2 --without-quiche \
+ --disable-ares \
+ --disable-dict --disable-file --disable-gopher --disable-imap \
+ --disable-ldap --disable-ldaps --disable-manual --disable-pop3 \
+ --disable-rtsp --disable-smb --disable-smtp --disable-telnet \
+ --disable-tftp \
+ $(if $(filter LINUX,$(OS)),--without-ca-bundle --without-ca-path) \
+ $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM)) \
+ $(if $(filter TRUE,$(DISABLE_DYNLOADING)),--disable-shared,--disable-static) \
+ $(if $(ENABLE_DEBUG),--enable-debug) \
+ $(if $(verbose),--disable-silent-rules,--enable-silent-rules) \
+ $(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \
+ $(if $(filter MACOSX,$(OS)),CFLAGS='$(CFLAGS) \
+ -mmacosx-version-min=$(MACOSX_DEPLOYMENT_TARGET)') \
+ CPPFLAGS='$(curl_CPPFLAGS)' \
+ LDFLAGS='$(curl_LDFLAGS)' \
+ ZLIB_CFLAGS='$(ZLIB_CFLAGS)' ZLIB_LIBS='$(ZLIB_LIBS)' \
+ && cd lib \
+ && $(MAKE) \
+ )
+ $(call gb_Trace_EndRange,curl,EXTERNAL)
+
+else ifeq ($(COM),MSC)
+
+$(eval $(call gb_ExternalProject_use_nmake,curl,build))
+
+$(call gb_ExternalProject_get_state_target,curl,build):
+ $(call gb_Trace_StartRange,curl,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ nmake -f Makefile.vc \
+ mode=dll \
+ VC=12 \
+ $(if $(filter X86_64,$(CPUNAME)),MACHINE=x64,MACHINE=x86) \
+ GEN_PDB=$(if $(call gb_Module__symbols_enabled,curl),yes,no) \
+ DEBUG=$(if $(MSVC_USE_DEBUG_RUNTIME),yes,no) \
+ ENABLE_IPV6=yes \
+ ENABLE_SSPI=yes \
+ ENABLE_WINSSL=yes \
+ ,winbuild)
+ $(call gb_Trace_EndRange,curl,EXTERNAL)
+
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/curl/Makefile b/external/curl/Makefile
new file mode 100644
index 000000000..e4968cf85
--- /dev/null
+++ b/external/curl/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/curl/Module_curl.mk b/external/curl/Module_curl.mk
new file mode 100644
index 000000000..2b4c61c04
--- /dev/null
+++ b/external/curl/Module_curl.mk
@@ -0,0 +1,18 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,curl))
+
+$(eval $(call gb_Module_add_targets,curl,\
+ UnpackedTarball_curl \
+ ExternalPackage_curl \
+ ExternalProject_curl \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/curl/README b/external/curl/README
new file mode 100644
index 000000000..292e4edf5
--- /dev/null
+++ b/external/curl/README
@@ -0,0 +1 @@
+A URL manipulation engine from [http://curl.haxx.se/].
diff --git a/external/curl/UnpackedTarball_curl.mk b/external/curl/UnpackedTarball_curl.mk
new file mode 100644
index 000000000..1cdb64c0b
--- /dev/null
+++ b/external/curl/UnpackedTarball_curl.mk
@@ -0,0 +1,39 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,curl))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,curl,$(CURL_TARBALL),,curl))
+
+$(eval $(call gb_UnpackedTarball_set_patchlevel,curl,1))
+
+$(eval $(call gb_UnpackedTarball_fix_end_of_line,curl,\
+ winbuild/MakefileBuild.vc \
+))
+
+$(eval $(call gb_UnpackedTarball_add_patches,curl,\
+ external/curl/curl-msvc.patch.1 \
+ external/curl/curl-msvc-disable-protocols.patch.1 \
+ external/curl/curl-7.26.0_win-proxy.patch \
+ external/curl/zlib.patch.0 \
+))
+
+ifeq ($(SYSTEM_NSS),)
+$(eval $(call gb_UnpackedTarball_add_patches,curl,\
+ external/curl/curl-nss.patch.1 \
+))
+endif
+
+ifeq ($(OS)-$(COM_IS_CLANG),WNT-TRUE)
+$(eval $(call gb_UnpackedTarball_add_patches,curl, \
+ external/curl/clang-cl.patch.0 \
+))
+endif
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/curl/clang-cl.patch.0 b/external/curl/clang-cl.patch.0
new file mode 100644
index 000000000..2fbb10c2a
--- /dev/null
+++ b/external/curl/clang-cl.patch.0
@@ -0,0 +1,11 @@
+--- winbuild/MakefileBuild.vc
++++ winbuild/MakefileBuild.vc
+@@ -60,7 +60,7 @@
+ !ELSE
+ CC_NODEBUG = $(CC) /O2 /DNDEBUG
+ CC_DEBUG = $(CC) /Od /D_DEBUG /RTC1 /Z7 /LDd
+-CFLAGS = /I. /I ../lib /I../include /nologo /W4 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL $(SOLARINC)
++CFLAGS = /I. /I ../lib /I../include /nologo /W4 /EHsc /DWIN32 /c /DBUILDING_LIBCURL $(SOLARINC)
+ !ENDIF
+
+ LFLAGS = /nologo /machine:$(MACHINE)
diff --git a/external/curl/curl-7.26.0_win-proxy.patch b/external/curl/curl-7.26.0_win-proxy.patch
new file mode 100644
index 000000000..852881570
--- /dev/null
+++ b/external/curl/curl-7.26.0_win-proxy.patch
@@ -0,0 +1,121 @@
+--- curl/winbuild/MakefileBuild.vc.orig 2017-10-23 17:15:22.969492548 +0200
++++ curl/winbuild/MakefileBuild.vc 2017-10-23 17:16:38.491490679 +0200
+@@ -72,7 +72,7 @@
+
+ CFLAGS_LIBCURL_STATIC = /DCURL_STATICLIB
+
+-WIN_LIBS = ws2_32.lib wldap32.lib advapi32.lib crypt32.lib
++WIN_LIBS = ws2_32.lib wldap32.lib advapi32.lib crypt32.lib winhttp.lib
+
+ BASE_NAME = libcurl
+ BASE_NAME_DEBUG = $(BASE_NAME)_debug
+--- curl-7.26.0/lib/url.c
++++ misc/build/curl-7.26.0/lib/url.c
+@@ -78,6 +78,10 @@
+ bool curl_win32_idn_to_ascii(const char *in, char **out);
+ #endif /* USE_LIBIDN2 */
+
++#ifdef _WIN32
++#include <WinHttp.h>
++#endif
++
+ #include "urldata.h"
+ #include "netrc.h"
+
+@@ -4586,6 +4590,21 @@
+ }
+
+ #ifndef CURL_DISABLE_HTTP
++#ifdef _WIN32
++static char *wstrToCstr(LPWSTR wStr)
++{
++ int bufSize;
++ char *out = NULL;
++ if(wStr != NULL) {
++ bufSize = WideCharToMultiByte(
++ CP_ACP, 0, wStr, -1, NULL, 0, NULL, NULL);
++ out = (char *)malloc(bufSize * sizeof(char));
++ WideCharToMultiByte(CP_ACP, 0, wStr, -1, out, bufSize, NULL, NULL);
++ }
++ return out;
++}
++#endif
++
+ /****************************************************************
+ * Detect what (if any) proxy to use. Remember that this selects a host
+ * name and is not limited to HTTP proxies only.
+@@ -4613,6 +4633,66 @@
+ * For compatibility, the all-uppercase versions of these variables are
+ * checked if the lowercase versions don't exist.
+ */
++#ifdef _WIN32
++ char *no_proxy = NULL;
++ WINHTTP_CURRENT_USER_IE_PROXY_CONFIG *ieProxyConfig;
++ ieProxyConfig = (WINHTTP_CURRENT_USER_IE_PROXY_CONFIG *)
++ malloc(sizeof(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG));
++ if(WinHttpGetIEProxyConfigForCurrentUser(ieProxyConfig)) {
++ if(!ieProxyConfig->fAutoDetect) {
++ char *ieProxy;
++ char *ieNoProxy;
++ char *pos;
++
++ ieProxy = wstrToCstr(ieProxyConfig->lpszProxy);
++ ieNoProxy = wstrToCstr(ieProxyConfig->lpszProxyBypass);
++
++ /* Convert the ieNoProxy into a proper no_proxy value */
++ if(NULL != ieNoProxy) {
++ no_proxy = strdup(ieNoProxy);
++ pos = strpbrk(no_proxy, "; ");
++ while(NULL != pos) {
++ no_proxy[pos-no_proxy] = ',';
++ pos = strpbrk(no_proxy, "; ");
++ }
++ }
++
++ if(!check_noproxy(conn->host.name, no_proxy)) {
++ /* Look for the http proxy setting */
++ char *tok;
++ char *saveptr;
++
++ if(NULL != ieProxy) {
++ tok = strtok_s(ieProxy, ";", &saveptr);
++ if(strchr(tok, '=') == NULL) {
++ proxy = strdup(ieProxy);
++ }
++ else {
++ do {
++ if(strncmp(tok, "http=", 5) == 0) {
++ /* We found HTTP proxy value, then use it */
++ proxy = strdup(tok + 5);
++ }
++ tok = strtok_s(NULL, ";", &saveptr);
++ }
++ while(NULL != tok);
++ }
++ }
++ }
++
++ free(ieProxy);
++ free(ieNoProxy);
++ }
++ else {
++ /* TODO Handle the Proxy config Auto Detection case */
++ }
++
++ GlobalFree(ieProxyConfig->lpszAutoConfigUrl);
++ GlobalFree(ieProxyConfig->lpszProxy);
++ GlobalFree(ieProxyConfig->lpszProxyBypass);
++ }
++ free(no_proxy);
++#else /* !_WIN32 */
+ char proxy_env[128];
+ const char *protop = conn->handler->scheme;
+ char *envp = proxy_env;
+@@ -4663,6 +4739,7 @@
+ }
+ if(proxy)
+ infof(conn->data, "Uses proxy env variable %s == '%s'\n", envp, proxy);
++#endif /* _WIN32 */
+
+ return proxy;
+ }
diff --git a/external/curl/curl-msvc-disable-protocols.patch.1 b/external/curl/curl-msvc-disable-protocols.patch.1
new file mode 100644
index 000000000..c8747a5fc
--- /dev/null
+++ b/external/curl/curl-msvc-disable-protocols.patch.1
@@ -0,0 +1,35 @@
+disable protocols nobody needs in MSVC build
+
+--- curl/lib/config-win32.h.orig 2017-08-09 16:43:29.464000000 +0200
++++ curl/lib/config-win32.h 2017-08-09 16:47:38.549200000 +0200
+@@ -733,4 +733,19 @@
+ # define ENABLE_IPV6 1
+ #endif
+
++#define CURL_DISABLE_DICT 1
++#define CURL_DISABLE_FILE 1
++//#undef CURL_DISABLE_FTP
++#define CURL_DISABLE_GOPHER 1
++//#undef CURL_DISABLE_HTTP
++#define CURL_DISABLE_IMAP 1
++#define CURL_DISABLE_LDAP 1
++#define CURL_DISABLE_LDAPS 1
++#define CURL_DISABLE_POP3 1
++#define CURL_DISABLE_RTSP 1
++#define CURL_DISABLE_SMB 1
++#define CURL_DISABLE_SMTP 1
++#define CURL_DISABLE_TELNET 1
++#define CURL_DISABLE_TFTP 1
++
+ #endif /* HEADER_CURL_CONFIG_WIN32_H */
+--- curl/winbuild/MakefileBuild.vc.orig 2017-10-23 23:41:21.393200000 +0200
++++ curl/winbuild/MakefileBuild.vc 2017-10-23 23:34:16.028000000 +0200
+@@ -431,7 +431,7 @@
+
+ EXE_OBJS = $(CURL_OBJS) $(CURL_DIROBJ)\curl.res
+
+-all : $(TARGET) $(PROGRAM_NAME)
++all : $(TARGET)
+
+ package: $(TARGET)
+ @cd $(DIRDIST)
diff --git a/external/curl/curl-msvc.patch.1 b/external/curl/curl-msvc.patch.1
new file mode 100644
index 000000000..a5b79a8e9
--- /dev/null
+++ b/external/curl/curl-msvc.patch.1
@@ -0,0 +1,27 @@
+MSVC: using SOLARINC
+
+--- curl/winbuild/MakefileBuild.vc.orig 2017-10-23 16:36:07.713550851 +0200
++++ curl/winbuild/MakefileBuild.vc 2017-10-23 16:38:19.301547594 +0200
+@@ -60,7 +60,7 @@
+ !ELSE
+ CC_NODEBUG = $(CC) /O2 /DNDEBUG
+ CC_DEBUG = $(CC) /Od /D_DEBUG /RTC1 /Z7 /LDd
+-CFLAGS = /I. /I ../lib /I../include /nologo /W4 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL
++CFLAGS = /I. /I ../lib /I../include /nologo /W4 /EHsc /DWIN32 /FD /c /DBUILDING_LIBCURL $(SOLARINC)
+ !ENDIF
+
+ LFLAGS = /nologo /machine:$(MACHINE)
+@@ -300,11 +300,11 @@
+ # CURL_XX macros are for the curl.exe command
+
+ !IF "$(DEBUG)"=="yes"
+-RC_FLAGS = /dDEBUGBUILD=1 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
++RC_FLAGS = $(SOLARINC) /dDEBUGBUILD=1 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
+ CURL_CC = $(CC_DEBUG) $(RTLIB_DEBUG)
+ CURL_RC_FLAGS = $(CURL_RC_FLAGS) /i../include /dDEBUGBUILD=1 /Fo $@ $(CURL_SRC_DIR)\curl.rc
+ !ELSE
+-RC_FLAGS = /dDEBUGBUILD=0 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
++RC_FLAGS = $(SOLARINC) /dDEBUGBUILD=0 /Fo $@ $(LIBCURL_SRC_DIR)\libcurl.rc
+ CURL_CC = $(CC_NODEBUG) $(RTLIB)
+ CURL_RC_FLAGS = $(CURL_RC_FLAGS) /i../include /dDEBUGBUILD=0 /Fo $@ $(CURL_SRC_DIR)\curl.rc
+ !ENDIF
diff --git a/external/curl/curl-nss.patch.1 b/external/curl/curl-nss.patch.1
new file mode 100644
index 000000000..69fde5f7f
--- /dev/null
+++ b/external/curl/curl-nss.patch.1
@@ -0,0 +1,12 @@
+diff -ur curl.org/configure curl/configure
+--- curl.org/configure 2016-03-13 15:14:07.177000076 +0100
++++ curl/configure 2016-03-13 15:16:44.132000076 +0100
+@@ -24009,7 +24009,7 @@
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Using hard-wired libraries and compilation flags for NSS." >&5
+ $as_echo "$as_me: WARNING: Using hard-wired libraries and compilation flags for NSS." >&2;}
+ addld="-L$OPT_NSS/lib"
+- addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4"
++ addlib="-lssl3 -lsmime3 -lnss3 -lplds4 -lplc4 -lnspr4 -lnssutil3"
+ addcflags="-I$OPT_NSS/include"
+ version="unknown"
+ nssprefix=$OPT_NSS
diff --git a/external/curl/zlib.patch.0 b/external/curl/zlib.patch.0
new file mode 100644
index 000000000..189e820d1
--- /dev/null
+++ b/external/curl/zlib.patch.0
@@ -0,0 +1,90 @@
+--- configure
++++ configure
+@@ -20709,7 +20709,6 @@
+ clean_CPPFLAGS=$CPPFLAGS
+ clean_LDFLAGS=$LDFLAGS
+ clean_LIBS=$LIBS
+-ZLIB_LIBS=""
+
+ # Check whether --with-zlib was given.
+ if test "${with_zlib+set}" = set; then :
+@@ -20718,6 +20719,7 @@
+
+
+ if test "$OPT_ZLIB" = "no" ; then
++ ZLIB_LIBS=""
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: zlib disabled" >&5
+ $as_echo "$as_me: WARNING: zlib disabled" >&2;}
+ else
+@@ -20725,6 +20725,21 @@
+ OPT_ZLIB=""
+ fi
+
++ if test -n "$ZLIB_CFLAGS$ZLIB_LIBS"; then
++ CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS"
++ LIBS="$ZLIB_LIBS $LIBS"
++ HAVE_LIBZ="1"
++
++
++$as_echo "#define HAVE_ZLIB_H 1" >>confdefs.h
++
++
++$as_echo "#define HAVE_LIBZ 1" >>confdefs.h
++
++ AMFIXLIB="1"
++ else
++ ZLIB_LIBS=""
++
+ if test -z "$OPT_ZLIB" ; then
+
+ if test -n "$PKG_CONFIG"; then
+@@ -21005,6 +21020,7 @@
+ $as_echo "$as_me: found both libz and libz.h header" >&6;}
+ curl_zlib_msg="enabled"
+ fi
++ fi
+ fi
+
+ if test x"$AMFIXLIB" = x1; then
+--- configure.ac
++++ configure.ac
+@@ -880,19 +880,30 @@
+ clean_CPPFLAGS=$CPPFLAGS
+ clean_LDFLAGS=$LDFLAGS
+ clean_LIBS=$LIBS
+-ZLIB_LIBS=""
+ AC_ARG_WITH(zlib,
+ AC_HELP_STRING([--with-zlib=PATH],[search for zlib in PATH])
+ AC_HELP_STRING([--without-zlib],[disable use of zlib]),
+ [OPT_ZLIB="$withval"])
+
+ if test "$OPT_ZLIB" = "no" ; then
++ ZLIB_LIBS=""
+ AC_MSG_WARN([zlib disabled])
+ else
+ if test "$OPT_ZLIB" = "yes" ; then
+ OPT_ZLIB=""
+ fi
+
++ if test -n "$ZLIB_CFLAGS$ZLIB_LIBS"; then
++ CPPFLAGS="$CPPFLAGS $ZLIB_CFLAGS"
++ LIBS="$ZLIB_LIBS $LIBS"
++ HAVE_LIBZ="1"
++ AC_SUBST(HAVE_LIBZ)
++ AC_DEFINE(HAVE_ZLIB_H, 1, [if you have the zlib.h header file])
++ AC_DEFINE(HAVE_LIBZ, 1, [if zlib is available])
++ AMFIXLIB="1"
++ else
++ ZLIB_LIBS=""
++
+ if test -z "$OPT_ZLIB" ; then
+ CURL_CHECK_PKGCONFIG(zlib)
+
+@@ -975,6 +986,7 @@
+ AC_MSG_NOTICE([found both libz and libz.h header])
+ curl_zlib_msg="enabled"
+ fi
++ fi
+ fi
+
+ dnl set variable for use in automakefile(s)