[vlc-devel] [PATCH v2 01/10] configure: detect if we can run win32 executables

Steve Lhomme robux4 at ycbcr.xyz
Tue May 12 17:08:04 CEST 2020


It is possible to run win32 executables when cross compiling with mingw64. It's
even mandatory to build contribs as it needs to call fxc.exe (currently
hardcoded to use wine).

Whether it's in WSL, msys2 or wine, we can run them.
---
 configure.ac | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/configure.ac b/configure.ac
index 4b13af45e46a..cf54d22bee63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -140,6 +140,7 @@ case "${host_cpu}" in
         ;;
 esac
 
+RUN_HOST_CMD=
 case "${host_os}" in
   "")
     SYS=unknown
@@ -645,6 +646,30 @@ dnl Check for broken versions of mingw-runtime compatability library
 ])
 
 
+AS_IF([test "${SYS}" = "mingw32"], [
+    dnl
+    dnl Detect if we can call windows apps
+    dnl
+    AC_MSG_CHECKING([whether we can call windows executables])
+    win32_run_cmd=no
+    for run_win in "WSLENV=PATH/l" "wine"
+    do
+      ac_try="$run_win attrib.exe . 1>/dev/null 2>/dev/null"
+      (eval "$ac_try") 2>&5
+      ac_status=$?
+      if test $ac_status = 0; then
+        win32_run_cmd=$run_win
+        break
+      fi
+    done
+    AS_IF([test "x${win32_run_cmd}" != "xno"],[
+      RUN_HOST_CMD=${win32_run_cmd}
+      AC_MSG_RESULT([using '${win32_run_cmd} app.exe'])
+    ],[
+      AC_MSG_RESULT([not found])
+    ])
+])
+
 dnl
 dnl Buggy glibc prevention. Purposedly not cached.
 dnl See sourceware.org bugs 5058 and 5443.
@@ -1307,6 +1332,8 @@ case "${host_cpu}" in
     ;;
 esac
 
+AC_SUBST([RUN_HOST_CMD])
+
 dnl Check for backtrace() support
 AC_CHECK_HEADERS([execinfo.h])
 AC_CHECK_FUNCS([backtrace])
-- 
2.26.2



More information about the vlc-devel mailing list