From e08d65acaf928d44a41b67fb1cf2a9af73d77a68 Mon Sep 17 00:00:00 2001 From: Jia Tan Date: Wed, 1 Nov 2023 14:39:36 +0800 Subject: [PATCH] Build: Check for dirent.h. For both CMake and Autotools, define HAVE_DIRENT_H if the header file is found. --- CMakeLists.txt | 9 +++++++++ configure.ac | 2 ++ 2 files changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c5573d7b..e0221eab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1006,6 +1006,15 @@ calculation if supported by the system" ON) endif() endif() +# MSVC shouldn't have this header file anyway but this won't waste time +# checking. +if(NOT MSVC) + # dirent.h + check_include_file(dirent.h HAVE_DIRENT_H) + tuklib_add_definition_if(liblzma HAVE_DIRENT_H) +endif() + + # Support -fvisiblity=hidden when building shared liblzma. # These lines do nothing on Windows (even under Cygwin). # HAVE_VISIBILITY should always be defined to 0 or 1. diff --git a/configure.ac b/configure.ac index bb2697f6..3b8db6c3 100644 --- a/configure.ac +++ b/configure.ac @@ -793,6 +793,8 @@ AC_CHECK_HEADERS([fcntl.h limits.h sys/time.h], # cpuid.h may be used for detecting x86 processor features at runtime. AC_CHECK_HEADERS([immintrin.h cpuid.h]) +# dirent.h allows for directory parsing in xz. +AC_CHECK_HEADERS([dirent.h]) ############################################################################### # Checks for typedefs, structures, and compiler characteristics. -- 2.47.2