[vlc-commits] [Git][videolan/vlc][master] 3 commits: configure: detect Windows UCRT builds

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun Jan 29 19:50:01 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
92c2653c by Steve Lhomme at 2023-01-29T16:26:06+00:00
configure: detect Windows UCRT builds

- - - - -
425cc9fe by Steve Lhomme at 2023-01-29T16:26:06+00:00
configure: don't enable __USE_MINGW_ANSI_STDIO for UCRT builds

mingw-w64 uses the new UCRT stdio API entries that can handle the standard
format strings.

- - - - -
8ef232fc by Steve Lhomme at 2023-01-29T16:26:06+00:00
meson: only enable __USE_MINGW_ANSI_STDIO for non-UCRT builds

Similar to configure.ac

- - - - -


2 changed files:

- configure.ac
- meson.build


Changes:

=====================================
configure.ac
=====================================
@@ -643,6 +643,21 @@ dnl
 dnl checks for mingw
 AS_IF([test "${SYS}" = "mingw32"], [
 
+    dnl Check if this is a UCRT build
+    AC_MSG_CHECKING([whether compiling with Universal C Runtime])
+    win_ucrt_build=no
+    AC_PREPROC_IFELSE([AC_LANG_SOURCE([
+#include <crtdefs.h>
+#if !(defined(_UCRT) || (__MSVCRT_VERSION__ >= 0x1400) || (__MSVCRT_VERSION__ >= 0xE00 && __MSVCRT_VERSION__ < 0x1000))
+# error This is NOT a UCRT build
+#endif
+    ])], [
+        AC_MSG_RESULT([yes])
+        win_ucrt_build=yes
+    ], [
+        AC_MSG_RESULT([no])
+    ])
+
 AC_PREPROC_IFELSE([AC_LANG_SOURCE([
 #if !defined(__MINGW32__)
 # error Not compiling with mingw
@@ -667,8 +682,13 @@ dnl Check for broken versions of mingw-runtime compatability library
         AC_MSG_ERROR([LibVLC requires Mingw-w64 version 5.0 or higher!])
     ])
 
-    dnl force use of mingw provided c99 *printf over msvcrt
-    CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=1"
+    AS_IF([test "${win_ucrt_build}" = "no"], [
+        dnl force use of mingw provided c99 *printf over msvcrt
+        CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=1"
+    ],[
+        dnl for UCRT build we use the standard compatibility define of UCRT
+        CPPFLAGS="${CPPFLAGS} -D__USE_MINGW_ANSI_STDIO=0"
+    ])
 
     dnl Check for the need to include the mingwex lib for mingw32
     VLC_SAVE_FLAGS


=====================================
meson.build
=====================================
@@ -348,11 +348,28 @@ windows_version_test = '''
         # Defines needed for MinGW
 
         mingw_defines = [
-            ['__USE_MINGW_ANSI_STDIO',      1], # Define to force use of MinGW printf
             ['_POSIX_SOURCE',               1], # IEEE Std 1003.1
             ['_POSIX_C_SOURCE',             '200809L'], #IEEE Std 1003.1
         ]
 
+ucrt_version_test = '''
+#include <crtdefs.h>
+#if !(defined(_UCRT) || (__MSVCRT_VERSION__ >= 0x1400) || (__MSVCRT_VERSION__ >= 0xE00 && __MSVCRT_VERSION__ < 0x1000))
+# error This is NOT a UCRT build
+#endif
+'''
+        if cc.compiles(ucrt_version_test, name: 'compiles with Universal C Runtime')
+            # for UCRT build we use the standard compatibility define of UCRT
+            mingw_defines += [
+                ['__USE_MINGW_ANSI_STDIO',      0],
+            ]
+        else
+            # Define to force use of MinGW printf
+            mingw_defines += [
+                ['__USE_MINGW_ANSI_STDIO',      1],
+            ]
+        endif
+
         foreach d : mingw_defines
             cdata.set(d.get(0), d.get(1))
             vlc_conf_prefix = vlc_conf_prefix + '#define @0@ @1@\n'.format(d.get(0), d.get(1))



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3192d4296f8643bcb0783ffec2838407d9931c70...8ef232fc81c181ba574f8d7657781488f4ec847d

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3192d4296f8643bcb0783ffec2838407d9931c70...8ef232fc81c181ba574f8d7657781488f4ec847d
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list