Fix make check on cross-compiled env
diff --git a/test/Makefile.am b/test/Makefile.am
index 2877a8f..cbbaa03 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -11,6 +11,7 @@
 BUILT_SOURCES = $(builddir)/out.expected
 
 SH_LOG_COMPILER = sh
+LOG_COMPILER = ${srcdir}/wrapper-script.sh
 TESTS=run-test.sh
 
 TESTDATA =			\
@@ -75,6 +76,7 @@
 check_PROGRAMS += test-bz106618
 test_bz106618_LDADD = $(top_builddir)/src/libfontconfig.la
 
+if !OS_WIN32
 check_PROGRAMS += test-hash
 test_hash_CFLAGS = -I$(top_builddir) -I$(top_builddir)/src $(UUID_CFLAGS)
 test_hash_LDADD = $(UUID_LIBS)
@@ -91,6 +93,7 @@
 	$(NULL)
 test_bz106632_LDADD = $(top_builddir)/src/libfontconfig.la
 TESTS += test-bz106632
+endif
 
 check_PROGRAMS += test-issue107
 test_issue107_LDADD =					\
@@ -99,6 +102,7 @@
 TESTS += test-issue107
 
 if !ENABLE_SHARED
+if !OS_WIN32
 check_PROGRAMS += test-issue110
 test_issue110_CFLAGS =					\
 	-I$(top_builddir)				\
@@ -127,6 +131,7 @@
 	$(NULL)
 TESTS += test-d1f48f11
 endif
+endif
 
 EXTRA_DIST=run-test.sh run-test-conf.sh $(TESTDATA) out.expected-long-family-names out.expected-no-long-family-names
 
diff --git a/test/run-test.sh b/test/run-test.sh
index ed41456..2519846 100644
--- a/test/run-test.sh
+++ b/test/run-test.sh
@@ -31,11 +31,12 @@
 FONTDIR="$MyPWD"/fonts
 CACHEDIR="$MyPWD"/cache.dir
 EXPECTED=${EXPECTED-"out.expected"}
+LOG_COMPILER=${LOG_COMPILER-"$TESTDIR/wrapper-script.sh"}
 
 ECHO=true
 
-FCLIST=../fc-list/fc-list$EXEEXT
-FCCACHE=../fc-cache/fc-cache$EXEEXT
+FCLIST="$LOG_COMPILER ../fc-list/fc-list$EXEEXT"
+FCCACHE="$LOG_COMPILER ../fc-cache/fc-cache$EXEEXT"
 
 which bwrap > /dev/null 2>&1
 if [ $? -eq 0 ]; then
@@ -122,6 +123,7 @@
 cp $FONT2 $FONTDIR/a
 check
 
+if [ "x$EXEEXT" = "x" ]; then
 dotest "Re-creating .uuid"
 prep
 cp $FONT1 $FONTDIR
@@ -164,6 +166,7 @@
   ls $CACHEDIR
   exit 1
 fi
+fi
 
 dotest "Keep mtime of the font directory"
 prep
@@ -214,6 +217,7 @@
 rm -rf $TESTTMPDIR out1 out2 xxx flist1 flist2 bind-fonts.conf
 fi
 
+if [ "x$EXEEXT" = "x" ]; then
 dotest "sysroot option"
 prep
 mkdir -p $MyPWD/sysroot/$FONTDIR
@@ -239,6 +243,8 @@
 
 rm -rf $MyPWD/sysroot
 
+fi
+
 # dotest "deleting .uuid file on empty dir"
 # prep
 # cp $FONT1 $FONT2 $FONTDIR
diff --git a/test/test-d1f48f11.c b/test/test-d1f48f11.c
index 6c0ecf0..a5ecac9 100644
--- a/test/test-d1f48f11.c
+++ b/test/test-d1f48f11.c
@@ -45,6 +45,24 @@
 #  define FC_DIR_SEPARATOR_S       "/"
 #endif
 
+#ifdef _WIN32
+#include <direct.h>
+#define mkdir(path,mode) _mkdir(path)
+
+int
+setenv(const char *name, const char *value, int o)
+{
+    size_t len = strlen(name) + strlen(value) + 1;
+    char *s = malloc(len+1);
+    int ret;
+
+    snprintf(s, len, "%s=%s", name, value);
+    ret = _putenv(s);
+    free(s);
+    return ret;
+}
+#endif
+
 extern FcChar8 *FcConfigRealFilename (FcConfig *, FcChar8 *);
 extern FcChar8 *FcStrCanonFilename (const FcChar8 *);
 
diff --git a/test/test-issue107.c b/test/test-issue107.c
index 7f4bfb0..eeb3d68 100644
--- a/test/test-issue107.c
+++ b/test/test-issue107.c
@@ -45,6 +45,24 @@
 #  define FC_DIR_SEPARATOR_S       "/"
 #endif
 
+#ifdef _WIN32
+#include <direct.h>
+#define mkdir(path,mode) _mkdir(path)
+
+int
+setenv(const char *name, const char *value, int o)
+{
+    size_t len = strlen(name) + strlen(value) + 1;
+    char *s = malloc(len+1);
+    int ret;
+
+    snprintf(s, len, "%s=%s", name, value);
+    ret = _putenv(s);
+    free(s);
+    return ret;
+}
+#endif
+
 extern FcChar8 *FcConfigRealFilename (FcConfig *, FcChar8 *);
 
 #ifdef HAVE_MKDTEMP
diff --git a/test/test-issue110.c b/test/test-issue110.c
index 28a3bd2..0ab40e3 100644
--- a/test/test-issue110.c
+++ b/test/test-issue110.c
@@ -45,6 +45,24 @@
 #  define FC_DIR_SEPARATOR_S       "/"
 #endif
 
+#ifdef _WIN32
+#include <direct.h>
+#define mkdir(path,mode) _mkdir(path)
+
+int
+setenv(const char *name, const char *value, int o)
+{
+    size_t len = strlen(name) + strlen(value) + 1;
+    char *s = malloc(len+1);
+    int ret;
+
+    snprintf(s, len, "%s=%s", name, value);
+    ret = _putenv(s);
+    free(s);
+    return ret;
+}
+#endif
+
 extern FcChar8 *FcConfigRealFilename (FcConfig *, FcChar8 *);
 
 #ifdef HAVE_MKDTEMP
diff --git a/test/wrapper-script.sh b/test/wrapper-script.sh
new file mode 100755
index 0000000..4138e4b
--- /dev/null
+++ b/test/wrapper-script.sh
@@ -0,0 +1,13 @@
+#! /bin/bash
+
+case "$1" in
+  *.exe)
+    fccwd=`pwd`
+    cd $(IFS=:;for i in $PATH; do echo $i|grep mingw> /dev/null; [ $? -eq 0 ] && echo $i; done)
+    /usr/bin/env wine $fccwd/$@
+    ;;
+  *)
+    $@
+    ;;
+esac
+