fc-cache/fc-cache.c | 2 ++ fc-cat/fc-cat.c | 2 ++ fc-conflist/fc-conflist.c | 2 ++ fc-list/fc-list.c | 5 ++++- fc-match/fc-match.c | 5 ++++- fc-pattern/fc-pattern.c | 5 ++++- fc-query/fc-query.c | 5 ++++- fc-scan/fc-scan.c | 5 ++++- fc-validate/fc-validate.c | 5 ++++- src/fcatomic.c | 9 ++++++++- src/fccompat.c | 15 +++++++++++++++ src/fcint.h | 2 ++ test/test-bz106632.c | 4 +++- test/test-d1f48f11.c | 4 +++- test/test-issue107.c | 4 +++- test/test-issue110.c | 4 +++- test/test-migration.c | 5 +++-- 17 files changed, 70 insertions(+), 13 deletions(-) New commits: commit a30e4db9672df89a68d598b98a340d3d5a825b8e Author: Tim-Philipp Müller <tim@xxxxxxxxxxxxxxx> Date: Tue Jul 7 03:48:34 2020 +0000 fccompat: fix build on Windows without unistd.h https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/access-waccess?view=vs-2019 diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c index 091eed4..4138d0b 100644 --- a/fc-cache/fc-cache.c +++ b/fc-cache/fc-cache.c @@ -34,7 +34,9 @@ #include <fontconfig/fontconfig.h> #include <stdio.h> #include <stdlib.h> +#ifdef HAVE_UNISTD_H #include <unistd.h> +#endif #include <sys/types.h> #include <sys/stat.h> #include <errno.h> diff --git a/fc-cat/fc-cat.c b/fc-cat/fc-cat.c index 69611bc..e2be0cb 100644 --- a/fc-cat/fc-cat.c +++ b/fc-cat/fc-cat.c @@ -36,7 +36,9 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#ifdef HAVE_UNISTD_H #include <unistd.h> +#endif #include <sys/types.h> #include <sys/stat.h> #include <errno.h> diff --git a/fc-conflist/fc-conflist.c b/fc-conflist/fc-conflist.c index 5c40a0f..74d2d9c 100644 --- a/fc-conflist/fc-conflist.c +++ b/fc-conflist/fc-conflist.c @@ -35,7 +35,9 @@ #include <fontconfig/fontconfig.h> #include <stdio.h> +#ifdef HAVE_UNISTD_H #include <unistd.h> +#endif #include <stdlib.h> #include <string.h> #include <locale.h> diff --git a/fc-list/fc-list.c b/fc-list/fc-list.c index 2039acd..c268ea9 100644 --- a/fc-list/fc-list.c +++ b/fc-list/fc-list.c @@ -24,7 +24,6 @@ #include <fontconfig/fontconfig.h> #include <stdio.h> -#include <unistd.h> #include <stdlib.h> #include <string.h> #include <locale.h> @@ -37,6 +36,10 @@ #define HAVE_GETOPT 1 #endif +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + #ifdef ENABLE_NLS #include <libintl.h> #define _(x) (dgettext(GETTEXT_PACKAGE, x)) diff --git a/fc-match/fc-match.c b/fc-match/fc-match.c index dee6147..4362ec1 100644 --- a/fc-match/fc-match.c +++ b/fc-match/fc-match.c @@ -33,11 +33,14 @@ #include <fontconfig/fontconfig.h> #include <stdio.h> -#include <unistd.h> #include <stdlib.h> #include <string.h> #include <locale.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + #ifdef ENABLE_NLS #include <libintl.h> #define _(x) (dgettext(GETTEXT_PACKAGE, x)) diff --git a/fc-pattern/fc-pattern.c b/fc-pattern/fc-pattern.c index 7989b81..1e9b1ba 100644 --- a/fc-pattern/fc-pattern.c +++ b/fc-pattern/fc-pattern.c @@ -33,11 +33,14 @@ #include <fontconfig/fontconfig.h> #include <stdio.h> -#include <unistd.h> #include <stdlib.h> #include <string.h> #include <locale.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + #ifdef ENABLE_NLS #include <libintl.h> #define _(x) (dgettext(GETTEXT_PACKAGE, x)) diff --git a/fc-query/fc-query.c b/fc-query/fc-query.c index fbffb84..74841b0 100644 --- a/fc-query/fc-query.c +++ b/fc-query/fc-query.c @@ -36,11 +36,14 @@ #include <fontconfig/fontconfig.h> #include <fontconfig/fcfreetype.h> #include <stdio.h> -#include <unistd.h> #include <stdlib.h> #include <string.h> #include <locale.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + #ifdef ENABLE_NLS #include <libintl.h> #define _(x) (dgettext(GETTEXT_PACKAGE, x)) diff --git a/fc-scan/fc-scan.c b/fc-scan/fc-scan.c index 9302ac5..02831e0 100644 --- a/fc-scan/fc-scan.c +++ b/fc-scan/fc-scan.c @@ -36,11 +36,14 @@ #include <fontconfig/fontconfig.h> #include <fontconfig/fcfreetype.h> #include <stdio.h> -#include <unistd.h> #include <stdlib.h> #include <string.h> #include <locale.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + #ifdef ENABLE_NLS #include <libintl.h> #define _(x) (dgettext(GETTEXT_PACKAGE, x)) diff --git a/fc-validate/fc-validate.c b/fc-validate/fc-validate.c index 327ae63..ecd31c6 100644 --- a/fc-validate/fc-validate.c +++ b/fc-validate/fc-validate.c @@ -36,11 +36,14 @@ #include <fontconfig/fontconfig.h> #include <fontconfig/fcfreetype.h> #include <stdio.h> -#include <unistd.h> #include <stdlib.h> #include <string.h> #include <locale.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + #ifdef ENABLE_NLS #include <libintl.h> #define _(x) (dgettext(GETTEXT_PACKAGE, x)) diff --git a/src/fcatomic.c b/src/fcatomic.c index d12d324..5b5e030 100644 --- a/src/fcatomic.c +++ b/src/fcatomic.c @@ -47,13 +47,20 @@ * held. */ +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + #include "fcint.h" #include <sys/types.h> #include <sys/stat.h> -#include <unistd.h> #include <stdlib.h> #include <time.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + #ifdef _WIN32 #include <direct.h> #define mkdir(path,mode) _mkdir(path) diff --git a/src/fccompat.c b/src/fccompat.c index 16f108d..53436b5 100644 --- a/src/fccompat.c +++ b/src/fccompat.c @@ -71,6 +71,21 @@ #define FC_O_NOINHERIT 0 #endif +#ifndef HAVE_UNISTD_H +/* Values for the second argument to access. These may be OR'd together. */ +#ifndef R_OK +#define R_OK 4 /* Test for read permission. */ +#endif +#ifndef W_OK +#define W_OK 2 /* Test for write permission. */ +#endif +#ifndef F_OK +#define F_OK 0 /* Test for existence. */ +#endif + +typedef int mode_t; +#endif /* !HAVE_UNISTD_H */ + #if !defined (HAVE_MKOSTEMP) && !defined(HAVE_MKSTEMP) && !defined(HAVE__MKTEMP_S) static int mkstemp (char *template) diff --git a/src/fcint.h b/src/fcint.h index 9e1da1e..11efdba 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -40,7 +40,9 @@ #include <limits.h> #include <float.h> #include <math.h> +#ifdef HAVE_UNISTD_H #include <unistd.h> +#endif #include <stddef.h> #include <sys/types.h> #include <sys/stat.h> diff --git a/test/test-bz106632.c b/test/test-bz106632.c index 5db912b..0f37b9c 100644 --- a/test/test-bz106632.c +++ b/test/test-bz106632.c @@ -29,8 +29,10 @@ #include <stdlib.h> #include <string.h> #include <dirent.h> -#include <unistd.h> #include <errno.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif #ifndef HAVE_STRUCT_DIRENT_D_TYPE #include <sys/types.h> #include <sys/stat.h> diff --git a/test/test-d1f48f11.c b/test/test-d1f48f11.c index 929afd9..9237036 100644 --- a/test/test-d1f48f11.c +++ b/test/test-d1f48f11.c @@ -29,8 +29,10 @@ #include <stdlib.h> #include <string.h> #include <dirent.h> -#include <unistd.h> #include <errno.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif #ifndef HAVE_STRUCT_DIRENT_D_TYPE #include <sys/types.h> #include <sys/stat.h> diff --git a/test/test-issue107.c b/test/test-issue107.c index e22c35f..07db3ae 100644 --- a/test/test-issue107.c +++ b/test/test-issue107.c @@ -29,8 +29,10 @@ #include <stdlib.h> #include <string.h> #include <dirent.h> -#include <unistd.h> #include <errno.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif #ifndef HAVE_STRUCT_DIRENT_D_TYPE #include <sys/types.h> #include <sys/stat.h> diff --git a/test/test-issue110.c b/test/test-issue110.c index 3794b08..fa20285 100644 --- a/test/test-issue110.c +++ b/test/test-issue110.c @@ -29,8 +29,10 @@ #include <stdlib.h> #include <string.h> #include <dirent.h> -#include <unistd.h> #include <errno.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif #ifndef HAVE_STRUCT_DIRENT_D_TYPE #include <sys/types.h> #include <sys/stat.h> diff --git a/test/test-migration.c b/test/test-migration.c index b7d96dc..d3a0e42 100644 --- a/test/test-migration.c +++ b/test/test-migration.c @@ -28,13 +28,14 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <unistd.h> #include <sys/types.h> #include <dirent.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif #ifndef HAVE_STRUCT_DIRENT_D_TYPE #include <sys/types.h> #include <sys/stat.h> -#include <unistd.h> #endif #include <fontconfig/fontconfig.h> _______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/fontconfig