From 03aa12c75e117acb0d160212536f6f832e0dc8d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 18 Jul 2020 17:21:09 +0100 Subject: [PATCH] Guard dirent.h includes Might not be available on Windows. --- configure.ac | 2 +- fc-cache/fc-cache.c | 2 ++ src/fccache.c | 2 ++ src/fccfg.c | 2 ++ src/fcdir.c | 3 +++ src/fcstat.c | 2 ++ src/fcxml.c | 3 +++ 7 files changed, 15 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index f0cce3b..2e48952 100644 --- a/configure.ac +++ b/configure.ac @@ -157,7 +157,7 @@ dnl ========================================================================== # Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC -AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h sys/statvfs.h sys/vfs.h sys/statfs.h sys/param.h sys/mount.h]) +AC_CHECK_HEADERS([dirent.h fcntl.h stdlib.h string.h unistd.h sys/statvfs.h sys/vfs.h sys/statfs.h sys/param.h sys/mount.h]) AX_CREATE_STDINT_H([src/fcstdint.h]) # Checks for typedefs, structures, and compiler characteristics. diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c index 4138d0b..2e4eeb2 100644 --- a/fc-cache/fc-cache.c +++ b/fc-cache/fc-cache.c @@ -41,7 +41,9 @@ #include #include #include +#ifdef HAVE_DIRENT_H #include +#endif #include #include diff --git a/src/fccache.c b/src/fccache.c index c3e6364..d10f249 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -25,7 +25,9 @@ #include #include #include +#ifdef HAVE_DIRENT_H #include +#endif #include #include #include diff --git a/src/fccfg.c b/src/fccfg.c index f49657a..74e8746 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -25,7 +25,9 @@ /* Objects MT-safe for readonly access. */ #include "fcint.h" +#ifdef HAVE_DIRENT_H #include +#endif #include #if defined (_WIN32) && !defined (R_OK) diff --git a/src/fcdir.c b/src/fcdir.c index 693c845..0f60f87 100644 --- a/src/fcdir.c +++ b/src/fcdir.c @@ -23,7 +23,10 @@ */ #include "fcint.h" + +#ifdef HAVE_DIRENT_H #include +#endif FcBool FcFileIsDir (const FcChar8 *file) diff --git a/src/fcstat.c b/src/fcstat.c index 5aa1643..5a2bd7c 100644 --- a/src/fcstat.c +++ b/src/fcstat.c @@ -22,7 +22,9 @@ */ #include "fcint.h" #include "fcarch.h" +#ifdef HAVE_DIRENT_H #include +#endif #include #include #include diff --git a/src/fcxml.c b/src/fcxml.c index a366644..c21090a 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -26,7 +26,10 @@ #include "fcint.h" #include #include + +#ifdef HAVE_DIRENT_H #include +#endif #ifdef ENABLE_LIBXML2