summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorViktor Szakats <commit@vsz.me>2022-07-19 15:06:26 +0000
committerViktor Szakats <commit@vsz.me>2022-07-19 15:12:19 +0000
commit4d73854462f30948acab12984b611e9e33ee41e6 (patch)
tree68557e38c80d75ac1c67b37727d34724dc785906 /CMakeLists.txt
parent6e83e27f6cfa0ecf0b3eed547121d471aef46854 (diff)
downloadcurl-4d73854462f30948acab12984b611e9e33ee41e6.tar.gz
tidy-up: delete unused build configuration macros
Most of them feature guards: - `CURL_INCLUDES_SYS_UIO` [1] - `HAVE_ALLOCA_H` [2] - `HAVE_CRYPTO_CLEANUP_ALL_EX_DATA` (unused since de71e68000c8624ea13f90b136f8734dd0fb1bdc) - `HAVE_DLFCN_H` - `HAVE_DLOPEN` - `HAVE_DOPRNT` - `HAVE_FCNTL` - `HAVE_GETHOSTBYNAME` [3] - `HAVE_GETOPT_H` - `HAVE_GETPASS` - `HAVE_GETPROTOBYNAME` - `HAVE_GETSERVBYNAME` - `HAVE_IDN_FREE*` - `HAVE_INET_ADDR` - `HAVE_IOCTL` - `HAVE_KRB4` - `HAVE_KRB_GET_OUR_IP_FOR_REALM` - `HAVE_KRB_H` - `HAVE_LDAPSSL_H` - `HAVE_LDAP_INIT_FD` - `HAVE_LIBDL` - `HAVE_LIBNSL` - `HAVE_LIBRESOLV*` - `HAVE_LIBUCB` - `HAVE_LL` - `HAVE_LOCALTIME_R` - `HAVE_MALLOC_H` - `HAVE_MEMCPY` - `HAVE_MEMORY_H` - `HAVE_NETINET_IF_ETHER_H` - `HAVE_NI_WITHSCOPEID` - `HAVE_OPENSSL_CRYPTO_H` - `HAVE_OPENSSL_ERR_H` - `HAVE_OPENSSL_PEM_H` - `HAVE_OPENSSL_PKCS12_H` - `HAVE_OPENSSL_RAND_H` - `HAVE_OPENSSL_RSA_H` - `HAVE_OPENSSL_SSL_H` - `HAVE_OPENSSL_X509_H` - `HAVE_PEM_H` - `HAVE_POLL` - `HAVE_RAND_SCREEN` - `HAVE_RAND_STATUS` - `HAVE_RECVFROM` - `HAVE_SETSOCKOPT` - `HAVE_SETVBUF` - `HAVE_SIZEOF_LONG_DOUBLE` - `HAVE_SOCKIO_H` - `HAVE_SOCK_OPTS` - `HAVE_STDIO_H` - `HAVE_STRCASESTR` - `HAVE_STRFTIME` - `HAVE_STRLCAT` - `HAVE_STRNCMPI` - `HAVE_STRNICMP` - `HAVE_STRSTR` - `HAVE_STRUCT_IN6_ADDR` - `HAVE_TLD_H` - `HAVE_TLD_STRERROR` - `HAVE_UNAME` - `HAVE_USLEEP` - `HAVE_WINBER_H` - `HAVE_WRITEV` - `HAVE_X509_H` - `LT_OBJDIR` - `NEED_BASENAME_PROTO` - `NOT_NEED_LIBNSL` - `OPENSSL_NO_KRB5` - `RECVFROM_TYPE*` - `SIZEOF_LONG_DOUBLE` - `STRERROR_R_TYPE_ARG3` - `USE_YASSLEMUL` - `_USRDLL` (from CMake) [4] [1] Related parts in `m4/curl-functions.m4` and `configure.ac` might also be deleted. [2] Related comment can possibly be deleted in `packages/vms/generate_config_vms_h_curl.com`. [3] There are more instances of this in autotools, but I did not dare to touch those. Looked like it's used to detect socket support. [4] This is necessary for MFC (Microsoft Foundation Class) DLLs to force linking MFC components statically to the DLL. `libcurl.dll` does not use MFC, so we can delete this define. Ref: https://docs.microsoft.com/cpp/build/regular-dlls-statically-linked-to-mfc Script that can help finding unused settings like above: ```shell autoheader configure.ac # generate lib/curl_config.h.in { grep -o -E 'set\([A-Z][A-Z0-9_]{3,}' CMake/Platforms/WindowsCache.cmake | sed -E 's|set\(||g' grep -o -E -h '#define +[A-Z][A-Z0-9_]{3,}' lib/config-*.h | sed -E 's|#define +||g' grep -o -E '#cmakedefine +[A-Z][A-Z0-9_]{3,}' lib/curl_config.h.cmake | sed -E 's|#cmakedefine +||g' grep -o -E '#undef +[A-Z][A-Z0-9_]{3,}' lib/curl_config.h.in | sed -E 's|#undef +||g' } | sort -u | grep -v -F 'HEADER_CURL_' | while read -r def; do c="$(git grep -w -F "${def}" | grep -v -E -c '(/libcurl\.tmpl|^lib/config-|^lib/curl_config\.h\.cmake|^CMakeLists\.txt|^CMake/Platforms/WindowsCache\.cmake|^packages/vms/config_h\.com|^m4/curl-functions\.m4|^acinclude\.m4|^configure\.ac)')" if [ "${c}" = '0' ]; then echo "${def}" fi done ``` Reviewed-by: Daniel Stenberg Closes #9044
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt53
1 files changed, 1 insertions, 52 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 758e7fefa..fce08996a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -327,13 +327,7 @@ if(ENABLE_THREADED_RESOLVER)
endif()
# Check for all needed libraries
-check_library_exists_concat("${CMAKE_DL_LIBS}" dlopen HAVE_LIBDL)
check_library_exists_concat("socket" connect HAVE_LIBSOCKET)
-check_library_exists("c" gethostbyname "" NOT_NEED_LIBNSL)
-
-if(NOT NOT_NEED_LIBNSL)
- check_library_exists_concat("nsl" gethostbyname HAVE_LIBNSL)
-endif()
check_function_exists(gethostname HAVE_GETHOSTNAME)
@@ -445,16 +439,7 @@ if(CURL_USE_OPENSSL)
endif()
set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
- check_include_file("openssl/crypto.h" HAVE_OPENSSL_CRYPTO_H)
- check_include_file("openssl/err.h" HAVE_OPENSSL_ERR_H)
- check_include_file("openssl/pem.h" HAVE_OPENSSL_PEM_H)
- check_include_file("openssl/rsa.h" HAVE_OPENSSL_RSA_H)
- check_include_file("openssl/ssl.h" HAVE_OPENSSL_SSL_H)
- check_include_file("openssl/x509.h" HAVE_OPENSSL_X509_H)
- check_include_file("openssl/rand.h" HAVE_OPENSSL_RAND_H)
- check_symbol_exists(RAND_status "${CURL_INCLUDES}" HAVE_RAND_STATUS)
- check_symbol_exists(RAND_screen "${CURL_INCLUDES}" HAVE_RAND_SCREEN)
- check_symbol_exists(RAND_egd "${CURL_INCLUDES}" HAVE_RAND_EGD)
+ check_symbol_exists(RAND_egd "${CURL_INCLUDES}" HAVE_RAND_EGD)
check_symbol_exists(OPENSSL_IS_BORINGSSL "openssl/base.h" HAVE_BORINGSSL)
add_definitions(-DOPENSSL_SUPPRESS_DEPRECATED)
@@ -591,7 +576,6 @@ if(NOT CURL_DISABLE_LDAP)
# Now that we know, we're not using windows LDAP...
if(USE_WIN32_LDAP)
check_include_file_concat("winldap.h" HAVE_WINLDAP_H)
- check_include_file_concat("winber.h" HAVE_WINBER_H)
else()
# Check for LDAP
set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES})
@@ -674,7 +658,6 @@ endif()
if(NOT CURL_DISABLE_LDAPS)
check_include_file_concat("ldap_ssl.h" HAVE_LDAP_SSL_H)
- check_include_file_concat("ldapssl.h" HAVE_LDAPSSL_H)
endif()
# Check for idn2
@@ -693,9 +676,6 @@ if(WIN32)
endif()
endif()
-# Check for symbol dlopen (same as HAVE_LIBDL)
-check_library_exists("${CURL_LIBS}" dlopen "" HAVE_DLOPEN)
-
set(HAVE_LIBZ OFF)
set(HAVE_ZLIB_H OFF)
set(USE_ZLIB OFF)
@@ -966,7 +946,6 @@ if(NOT UNIX)
check_include_file_concat("wincrypt.h" HAVE_WINCRYPT_H)
endif()
-check_include_file_concat("stdio.h" HAVE_STDIO_H)
check_include_file_concat("inttypes.h" HAVE_INTTYPES_H)
check_include_file_concat("sys/filio.h" HAVE_SYS_FILIO_H)
check_include_file_concat("sys/ioctl.h" HAVE_SYS_IOCTL_H)
@@ -979,11 +958,9 @@ check_include_file_concat("sys/sockio.h" HAVE_SYS_SOCKIO_H)
check_include_file_concat("sys/stat.h" HAVE_SYS_STAT_H)
check_include_file_concat("sys/time.h" HAVE_SYS_TIME_H)
check_include_file_concat("sys/types.h" HAVE_SYS_TYPES_H)
-check_include_file_concat("sys/uio.h" HAVE_SYS_UIO_H)
check_include_file_concat("sys/un.h" HAVE_SYS_UN_H)
check_include_file_concat("sys/utime.h" HAVE_SYS_UTIME_H)
check_include_file_concat("sys/xattr.h" HAVE_SYS_XATTR_H)
-check_include_file_concat("alloca.h" HAVE_ALLOCA_H)
check_include_file_concat("arpa/inet.h" HAVE_ARPA_INET_H)
check_include_file_concat("arpa/tftp.h" HAVE_ARPA_TFTP_H)
check_include_file_concat("assert.h" HAVE_ASSERT_H)
@@ -992,7 +969,6 @@ check_include_file_concat("fcntl.h" HAVE_FCNTL_H)
check_include_file_concat("idn2.h" HAVE_IDN2_H)
check_include_file_concat("ifaddrs.h" HAVE_IFADDRS_H)
check_include_file_concat("io.h" HAVE_IO_H)
-check_include_file_concat("krb.h" HAVE_KRB_H)
check_include_file_concat("libgen.h" HAVE_LIBGEN_H)
check_include_file_concat("locale.h" HAVE_LOCALE_H)
check_include_file_concat("net/if.h" HAVE_NET_IF_H)
@@ -1001,7 +977,6 @@ check_include_file_concat("netinet/in.h" HAVE_NETINET_IN_H)
check_include_file_concat("netinet/tcp.h" HAVE_NETINET_TCP_H)
check_include_file("linux/tcp.h" HAVE_LINUX_TCP_H)
-check_include_file_concat("pem.h" HAVE_PEM_H)
check_include_file_concat("poll.h" HAVE_POLL_H)
check_include_file_concat("pwd.h" HAVE_PWD_H)
check_include_file_concat("setjmp.h" HAVE_SETJMP_H)
@@ -1009,7 +984,6 @@ check_include_file_concat("signal.h" HAVE_SIGNAL_H)
check_include_file_concat("ssl.h" HAVE_SSL_H)
check_include_file_concat("stdbool.h" HAVE_STDBOOL_H)
check_include_file_concat("stdint.h" HAVE_STDINT_H)
-check_include_file_concat("stdio.h" HAVE_STDIO_H)
check_include_file_concat("stdlib.h" HAVE_STDLIB_H)
check_include_file_concat("string.h" HAVE_STRING_H)
check_include_file_concat("strings.h" HAVE_STRINGS_H)
@@ -1019,16 +993,10 @@ check_include_file_concat("termios.h" HAVE_TERMIOS_H)
check_include_file_concat("time.h" HAVE_TIME_H)
check_include_file_concat("unistd.h" HAVE_UNISTD_H)
check_include_file_concat("utime.h" HAVE_UTIME_H)
-check_include_file_concat("x509.h" HAVE_X509_H)
check_include_file_concat("process.h" HAVE_PROCESS_H)
check_include_file_concat("stddef.h" HAVE_STDDEF_H)
-check_include_file_concat("dlfcn.h" HAVE_DLFCN_H)
-check_include_file_concat("malloc.h" HAVE_MALLOC_H)
-check_include_file_concat("memory.h" HAVE_MEMORY_H)
-check_include_file_concat("netinet/if_ether.h" HAVE_NETINET_IF_ETHER_H)
check_include_file_concat("stdint.h" HAVE_STDINT_H)
-check_include_file_concat("sockio.h" HAVE_SOCKIO_H)
check_include_file_concat("sys/utsname.h" HAVE_SYS_UTSNAME_H)
check_type_size(size_t SIZEOF_SIZE_T)
@@ -1038,7 +1006,6 @@ check_type_size("long" SIZEOF_LONG)
check_type_size("short" SIZEOF_SHORT)
check_type_size("int" SIZEOF_INT)
check_type_size("__int64" SIZEOF___INT64)
-check_type_size("long double" SIZEOF_LONG_DOUBLE)
check_type_size("time_t" SIZEOF_TIME_T)
if(NOT HAVE_SIZEOF_SSIZE_T)
if(SIZEOF_LONG EQUAL SIZEOF_SIZE_T)
@@ -1052,7 +1019,6 @@ endif()
if(HAVE_SIZEOF_LONG_LONG)
set(HAVE_LONGLONG 1)
- set(HAVE_LL 1)
endif()
if(NOT CMAKE_CROSSCOMPILING)
@@ -1071,37 +1037,25 @@ check_symbol_exists(fchmod "${CURL_INCLUDES}" HAVE_FCHMOD)
check_symbol_exists(basename "${CURL_INCLUDES}" HAVE_BASENAME)
check_symbol_exists(socket "${CURL_INCLUDES}" HAVE_SOCKET)
check_symbol_exists(select "${CURL_INCLUDES}" HAVE_SELECT)
-check_symbol_exists(poll "${CURL_INCLUDES}" HAVE_POLL)
check_symbol_exists(strdup "${CURL_INCLUDES}" HAVE_STRDUP)
-check_symbol_exists(strstr "${CURL_INCLUDES}" HAVE_STRSTR)
check_symbol_exists(strtok_r "${CURL_INCLUDES}" HAVE_STRTOK_R)
-check_symbol_exists(strftime "${CURL_INCLUDES}" HAVE_STRFTIME)
-check_symbol_exists(uname "${CURL_INCLUDES}" HAVE_UNAME)
check_symbol_exists(strcasecmp "${CURL_INCLUDES}" HAVE_STRCASECMP)
check_symbol_exists(stricmp "${CURL_INCLUDES}" HAVE_STRICMP)
check_symbol_exists(strcmpi "${CURL_INCLUDES}" HAVE_STRCMPI)
-check_symbol_exists(strncmpi "${CURL_INCLUDES}" HAVE_STRNCMPI)
check_symbol_exists(alarm "${CURL_INCLUDES}" HAVE_ALARM)
-if(NOT HAVE_STRNCMPI)
- set(HAVE_STRCMPI)
-endif()
check_symbol_exists(getppid "${CURL_INCLUDES}" HAVE_GETPPID)
check_symbol_exists(utimes "${CURL_INCLUDES}" HAVE_UTIMES)
check_symbol_exists(gettimeofday "${CURL_INCLUDES}" HAVE_GETTIMEOFDAY)
-check_symbol_exists(inet_addr "${CURL_INCLUDES}" HAVE_INET_ADDR)
check_symbol_exists(closesocket "${CURL_INCLUDES}" HAVE_CLOSESOCKET)
check_symbol_exists(sigsetjmp "${CURL_INCLUDES}" HAVE_SIGSETJMP)
check_symbol_exists(getpass_r "${CURL_INCLUDES}" HAVE_GETPASS_R)
check_symbol_exists(getpwuid "${CURL_INCLUDES}" HAVE_GETPWUID)
check_symbol_exists(getpwuid_r "${CURL_INCLUDES}" HAVE_GETPWUID_R)
check_symbol_exists(geteuid "${CURL_INCLUDES}" HAVE_GETEUID)
-check_symbol_exists(usleep "${CURL_INCLUDES}" HAVE_USLEEP)
check_symbol_exists(utime "${CURL_INCLUDES}" HAVE_UTIME)
check_symbol_exists(gmtime_r "${CURL_INCLUDES}" HAVE_GMTIME_R)
-check_symbol_exists(localtime_r "${CURL_INCLUDES}" HAVE_LOCALTIME_R)
-check_symbol_exists(gethostbyname "${CURL_INCLUDES}" HAVE_GETHOSTBYNAME)
check_symbol_exists(gethostbyname_r "${CURL_INCLUDES}" HAVE_GETHOSTBYNAME_R)
check_symbol_exists(signal "${CURL_INCLUDES}" HAVE_SIGNAL_FUNC)
@@ -1109,7 +1063,6 @@ check_symbol_exists(SIGALRM "${CURL_INCLUDES}" HAVE_SIGNAL_MACRO)
if(HAVE_SIGNAL_FUNC AND HAVE_SIGNAL_MACRO)
set(HAVE_SIGNAL 1)
endif()
-check_symbol_exists(uname "${CURL_INCLUDES}" HAVE_UNAME)
check_symbol_exists(strtoll "${CURL_INCLUDES}" HAVE_STRTOLL)
check_symbol_exists(_strtoi64 "${CURL_INCLUDES}" HAVE__STRTOI64)
check_symbol_exists(strerror_r "${CURL_INCLUDES}" HAVE_STRERROR_R)
@@ -1118,7 +1071,6 @@ check_symbol_exists(getaddrinfo "${CURL_INCLUDES}" HAVE_GETADDRINFO)
check_symbol_exists(freeaddrinfo "${CURL_INCLUDES}" HAVE_FREEADDRINFO)
check_symbol_exists(pipe "${CURL_INCLUDES}" HAVE_PIPE)
check_symbol_exists(ftruncate "${CURL_INCLUDES}" HAVE_FTRUNCATE)
-check_symbol_exists(getprotobyname "${CURL_INCLUDES}" HAVE_GETPROTOBYNAME)
check_symbol_exists(getpeername "${CURL_INCLUDES}" HAVE_GETPEERNAME)
check_symbol_exists(getsockname "${CURL_INCLUDES}" HAVE_GETSOCKNAME)
check_symbol_exists(if_nametoindex "${CURL_INCLUDES}" HAVE_IF_NAMETOINDEX)
@@ -1126,9 +1078,6 @@ check_symbol_exists(getrlimit "${CURL_INCLUDES}" HAVE_GETRLIMIT)
check_symbol_exists(setlocale "${CURL_INCLUDES}" HAVE_SETLOCALE)
check_symbol_exists(setmode "${CURL_INCLUDES}" HAVE_SETMODE)
check_symbol_exists(setrlimit "${CURL_INCLUDES}" HAVE_SETRLIMIT)
-check_symbol_exists(fcntl "${CURL_INCLUDES}" HAVE_FCNTL)
-check_symbol_exists(ioctl "${CURL_INCLUDES}" HAVE_IOCTL)
-check_symbol_exists(setsockopt "${CURL_INCLUDES}" HAVE_SETSOCKOPT)
check_function_exists(mach_absolute_time HAVE_MACH_ABSOLUTE_TIME)
check_symbol_exists(inet_pton "${CURL_INCLUDES}" HAVE_INET_PTON)