tidy-up: delete parallel/unused feature flags

Detecting headers and lib separately makes sense when headers come in
variations or with extra ones, but this wasn't the case here. These were
duplicate/parallel macros that we had to keep in sync with each other
for a working build. This patch leaves a single macro for each of these
dependencies:

- Rely on `HAVE_LIBZ`, delete parallel `HAVE_ZLIB_H`.

  Also delete CMake logic making sure these two were in sync, along with
  a toggle to turn off that logic, called `CURL_SPECIAL_LIBZ`.

  Also delete stray `HAVE_ZLIB` defines.

  There is also a `USE_ZLIB` variant in `lib/config-dos.h`. This patch
  retains it for compatibility and deprecates it.

- Rely on `USE_LIBSSH2`, delete parallel `HAVE_LIBSSH2_H`.

  Also delete `LIBSSH2_WIN32`, `LIBSSH2_LIBRARY` from
  `winbuild/MakefileBuild.vc`, these have a role when building libssh2
  itself. And `CURL_USE_LIBSSH`, which had no use at all.

  Also delete stray `HAVE_LIBSSH2` defines.

- Rely on `USE_LIBSSH`, delete parallel `HAVE_LIBSSH_LIBSSH_H`.

  Also delete `LIBSSH_WIN32`, `LIBSSH_LIBRARY` and `HAVE_LIBSSH` from
  `winbuild/MakefileBuild.vc`, these were the result of copy-pasting the
  libssh2 line, and were not having any use.

- Delete unused `HAVE_LIBPSL_H` and `HAVE_LIBPSL`.

Reviewed-by: Daniel Stenberg

Closes #9652
This commit is contained in:
Viktor Szakats 2022-10-06 15:30:13 +00:00
parent 6d90308a39
commit 0c327464ca
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
23 changed files with 91 additions and 151 deletions

View file

@ -132,7 +132,7 @@ ifneq ($(findstring -rtmp,$(CFG)),)
endif
ifneq ($(findstring -ssh2,$(CFG)),)
LIBSSH2_PATH ?= $(PROOT)/../libssh2
CPPFLAGS += -DUSE_LIBSSH2 -DHAVE_LIBSSH2_H
CPPFLAGS += -DUSE_LIBSSH2
CPPFLAGS += -I"$(LIBSSH2_PATH)/include"
_LDFLAGS += -L"$(LIBSSH2_PATH)/lib"
_LDFLAGS += -L"$(LIBSSH2_PATH)/win32"
@ -187,7 +187,7 @@ endif
ifneq ($(findstring -zlib,$(CFG))$(ZLIB),)
ZLIB_PATH ?= $(PROOT)/../zlib
# These CPPFLAGS are also required when compiling the curl tool via 'src'.
CPPFLAGS += -DHAVE_LIBZ -DHAVE_ZLIB_H
CPPFLAGS += -DHAVE_LIBZ
CPPFLAGS += -I"$(ZLIB_PATH)"
_LDFLAGS += -L"$(ZLIB_PATH)"
_LIBS += -lz

View file

@ -65,7 +65,6 @@
#define HAVE_UTIME 1
#define HAVE_UTIME_H 1
#define HAVE_WRITABLE_ARGV 1
#define HAVE_ZLIB_H 1
#define HAVE_SYS_IOCTL_H 1
#define NEED_MALLOC_H 1

View file

@ -105,9 +105,7 @@
/* CURLDEBUG definition enables memory tracking */
/* #define CURLDEBUG */
/* USE_ZLIB on cmd-line */
#ifdef USE_ZLIB
#define HAVE_ZLIB_H 1
#ifdef USE_ZLIB /* Deprecated. Use HAVE_LIBZ instead. */
#define HAVE_LIBZ 1
#endif

View file

@ -141,8 +141,6 @@
#define HAVE_UTIME 1
#define HAVE_UTIME_H 1
#define HAVE_ZLIB_H 1
#define HAVE_POSIX_STRERROR_R 1
#define HAVE_STRERROR_R 1

View file

@ -28,7 +28,7 @@
#include <curl/curl.h>
#include <stddef.h>
#ifdef HAVE_ZLIB_H
#ifdef HAVE_LIBZ
#include <zlib.h>
#endif

View file

@ -343,21 +343,9 @@
/* Define to 1 if you have the `socket' library (-lsocket). */
#cmakedefine HAVE_LIBSOCKET 1
/* Define to 1 if you have the `psl' library (-lpsl). */
#cmakedefine HAVE_LIBPSL 1
/* Define to 1 if you have the <libpsl.h> header file. */
#cmakedefine HAVE_LIBPSL_H 1
/* Define to 1 if you have the `ssh2' library (-lssh2). */
#cmakedefine HAVE_LIBSSH2 1
/* Define to 1 if you have the <libssh2.h> header file. */
#cmakedefine HAVE_LIBSSH2_H 1
/* Define to 1 if you have the <libssh/libssh.h> header file. */
#cmakedefine HAVE_LIBSSH_LIBSSH_H 1
/* if zlib is available */
#cmakedefine HAVE_LIBZ 1
@ -604,9 +592,6 @@
/* Define if you have the <process.h> header file. */
#cmakedefine HAVE_PROCESS_H 1
/* if you have the zlib.h header file */
#cmakedefine HAVE_ZLIB_H 1
/* Define to 1 if you need the lber.h header file even with ldap.h */
#cmakedefine NEED_LBER_H 1

View file

@ -185,10 +185,10 @@ typedef CURLcode (*Curl_datastream)(struct Curl_easy *data,
# endif
#endif
#ifdef HAVE_LIBSSH2_H
#ifdef USE_LIBSSH2
#include <libssh2.h>
#include <libssh2_sftp.h>
#endif /* HAVE_LIBSSH2_H */
#endif /* USE_LIBSSH2 */
#define READBUFFER_SIZE CURL_MAX_WRITE_SIZE
#define READBUFFER_MAX CURL_MAX_READ_SIZE

View file

@ -53,7 +53,7 @@
#include <librtmp/rtmp.h>
#endif
#ifdef HAVE_ZLIB_H
#ifdef HAVE_LIBZ
#include <zlib.h>
#endif

View file

@ -26,10 +26,10 @@
#include "curl_setup.h"
#if defined(HAVE_LIBSSH2_H)
#if defined(USE_LIBSSH2)
#include <libssh2.h>
#include <libssh2_sftp.h>
#elif defined(HAVE_LIBSSH_LIBSSH_H)
#elif defined(USE_LIBSSH)
#include <libssh/libssh.h>
#include <libssh/sftp.h>
#elif defined(USE_WOLFSSH)