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 c7c42afab9 #22577

Closes #22588
This commit is contained in:
Viktor Szakats 2026-08-15 09:06:05 +02:00
parent bf594226d6
commit e090cf59ad
No known key found for this signature in database
3 changed files with 10 additions and 11 deletions

View file

@ -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)

View file

@ -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)

View file

@ -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 <dirent.h>])
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 <dirent.h>])
AC_CHECK_FUNC(opendir, AC_DEFINE(HAVE_OPENDIR, 1, [if you have opendir]) )
]
)
fi
CURL_CONVERT_INCLUDE_TO_ISYSTEM