From e090cf59ad4c88be9da873fe37dae3487b7ad77e Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 15 Aug 2026 09:06:05 +0200 Subject: [PATCH] build: drop `dirent.h` and `opendir()` detections on Windows `opendir()` was used previously with mingw-w64 for `file://` directory listing support. This was replaced by a native Win32 solution on all Windows platforms, leaving `opendir()` no longer used. Drop related feature detections. Follow-up to c7c42afab91c46e6baaa0e2801626e13acd6c30a #22577 Closes #22588 --- CMake/win32-cache.cmake | 4 ---- CMakeLists.txt | 5 +++-- configure.ac | 12 +++++++----- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/CMake/win32-cache.cmake b/CMake/win32-cache.cmake index 87e0879ab2..a1f0d909f2 100644 --- a/CMake/win32-cache.cmake +++ b/CMake/win32-cache.cmake @@ -28,10 +28,8 @@ endif() if(MINGW) set(HAVE_BASENAME 1) set(HAVE_BOOL_T 1) # = HAVE_STDBOOL_H - set(HAVE_DIRENT_H 1) set(HAVE_GETTIMEOFDAY 1) set(HAVE_LIBGEN_H 1) - set(HAVE_OPENDIR 1) set(HAVE_STDBOOL_H 1) set(HAVE_STDDEF_H 1) # detected by CMake internally in check_type_size() set(HAVE_STDINT_H 1) # detected by CMake internally in check_type_size() @@ -40,10 +38,8 @@ if(MINGW) set(HAVE_UNISTD_H 1) set(HAVE_UTIME_H 1) # wrapper to sys/utime.h else() - set(HAVE_DIRENT_H 0) set(HAVE_GETTIMEOFDAY 0) set(HAVE_LIBGEN_H 0) - set(HAVE_OPENDIR 0) set(HAVE_STRINGS_H 0) set(HAVE_SYS_PARAM_H 0) set(HAVE_UTIME_H 0) diff --git a/CMakeLists.txt b/CMakeLists.txt index cdf47d486b..be5e0e09ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1554,7 +1554,6 @@ check_include_file("sys/un.h" HAVE_SYS_UN_H) check_include_file_concat_curl("sys/utime.h" HAVE_SYS_UTIME_H) # sys/types.h (AmigaOS) check_include_file_concat_curl("arpa/inet.h" HAVE_ARPA_INET_H) -check_include_file("dirent.h" HAVE_DIRENT_H) check_include_file("fcntl.h" HAVE_FCNTL_H) check_include_file_concat_curl("ifaddrs.h" HAVE_IFADDRS_H) check_include_file("io.h" HAVE_IO_H) @@ -1635,7 +1634,6 @@ endif() check_function_exists("accept4" HAVE_ACCEPT4) check_function_exists("fnmatch" HAVE_FNMATCH) check_symbol_exists("basename" "${CURL_INCLUDES};string.h" HAVE_BASENAME) # libgen.h unistd.h -check_symbol_exists("opendir" "dirent.h" HAVE_OPENDIR) check_function_exists("poll" HAVE_POLL) # poll.h check_symbol_exists("socket" "${CURL_INCLUDES}" HAVE_SOCKET) # winsock2.h sys/socket.h check_symbol_exists("socketpair" "${CURL_INCLUDES}" HAVE_SOCKETPAIR) # sys/socket.h @@ -1688,10 +1686,13 @@ else() endif() if(NOT WIN32) + check_include_file("dirent.h" HAVE_DIRENT_H) + check_function_exists("if_nametoindex" HAVE_IF_NAMETOINDEX) # net/if.h check_function_exists("realpath" HAVE_REALPATH) check_function_exists("sched_yield" HAVE_SCHED_YIELD) + check_symbol_exists("opendir" "dirent.h" HAVE_OPENDIR) check_symbol_exists("strcasecmp" "string.h" HAVE_STRCASECMP) check_symbol_exists("stricmp" "string.h" HAVE_STRICMP) check_symbol_exists("strcmpi" "string.h" HAVE_STRCMPI) diff --git a/configure.ac b/configure.ac index 5071f86523..25b9e44961 100644 --- a/configure.ac +++ b/configure.ac @@ -4380,11 +4380,13 @@ elif test "$USE_ARES" = "1"; then curl_res_msg="c-ares" fi -AC_CHECK_HEADER(dirent.h, - [ AC_DEFINE(HAVE_DIRENT_H, 1, [if you have ]) - AC_CHECK_FUNC(opendir, AC_DEFINE(HAVE_OPENDIR, 1, [if you have opendir]) ) - ] -) +if test "$curl_cv_native_windows" != "yes"; then + AC_CHECK_HEADER(dirent.h, + [ AC_DEFINE(HAVE_DIRENT_H, 1, [if you have ]) + AC_CHECK_FUNC(opendir, AC_DEFINE(HAVE_OPENDIR, 1, [if you have opendir]) ) + ] + ) +fi CURL_CONVERT_INCLUDE_TO_ISYSTEM