[vlc-commits] [Git][videolan/vlc][master] 3 commits: contrib: add a macros to check the maximum/exact clang version

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Oct 16 08:48:40 UTC 2025



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
a3f1681d by Steve Lhomme at 2025-10-16T09:49:44+02:00
contrib: add a macros to check the maximum/exact clang version

- - - - -
f08359e7 by Steve Lhomme at 2025-10-16T09:49:44+02:00
contrib: only force -fno-stack-check on XCode/clang 11

This is what the comment suggests and also how it's done in FFmpeg [^1].

Xcode 11 had 11.0.0 and 11.0.3 version strings [^2].

[^1]: https://code.ffmpeg.org/FFmpeg/FFmpeg/src/commit/6b961f5963d8e362137702d38a744b45fba8ba3a/configure#L5994
[^2]: https://en.wikipedia.org/wiki/Xcode#Xcode_11.0_-_14.x_(since_SwiftUI_framework)_2

- - - - -
d2008b8d by Steve Lhomme at 2025-10-16T09:49:44+02:00
configure: only force -fno-stack-check on XCode/clang 11

This is what the comment suggests and also how it's done in FFmpeg [^1].

Xcode 11 had 11.0.0 and 11.0.3 version strings [^2].

[^1]: https://code.ffmpeg.org/FFmpeg/FFmpeg/src/commit/6b961f5963d8e362137702d38a744b45fba8ba3a/configure#L5994
[^2]: https://en.wikipedia.org/wiki/Xcode#Xcode_11.0_-_14.x_(since_SwiftUI_framework)_2

- - - - -


2 changed files:

- configure.ac
- contrib/src/main.mak


Changes:

=====================================
configure.ac
=====================================
@@ -163,10 +163,15 @@ case "${host_os}" in
     SYS=darwin
     ac_cv_func_aligned_alloc=no
 
-    dnl Work around an Xcode 11 bug, fixed in Xcode 11.3.1
-    AX_APPEND_FLAG([-fno-stack-check], [CFLAGS])
-    AX_APPEND_FLAG([-fno-stack-check], [CXXFLAGS])
-    AX_APPEND_FLAG([-fno-stack-check], [OBJCFLAGS])
+    AC_MSG_CHECKING([if AppleClang requires -fno-stack-check])
+    COMPILER_VERSION_MAJ="$(${CC} -dumpversion | cut -d '.' -f -1)"
+    AS_IF([ test ${COMPILER_VERSION_MAJ} -eq 11 ],[
+      dnl Work around an Xcode 11 bug, fixed in Xcode 11.3.1
+      AC_MSG_RESULT([yes])
+      AX_APPEND_FLAG([-fno-stack-check], [CFLAGS])
+      AX_APPEND_FLAG([-fno-stack-check], [CXXFLAGS])
+      AX_APPEND_FLAG([-fno-stack-check], [OBJCFLAGS])
+    ],[AC_MSG_RESULT([no])])
 
     case "${host_cpu}" in
       i?86)


=====================================
contrib/src/main.mak
=====================================
@@ -105,13 +105,6 @@ CXX := clang++
 endif
 endif
 
-# -fno-stack-check is a workaround for a possible
-# bug in Xcode 11 or macOS 10.15+
-ifdef HAVE_DARWIN_OS
-EXTRA_CFLAGS += -fno-stack-check
-XCODE_FLAGS += OTHER_CFLAGS=-fno-stack-check
-endif
-
 ifdef HAVE_MACOSX
 EXTRA_CXXFLAGS += -stdlib=libc++
 ifeq ($(ARCH),aarch64)
@@ -161,8 +154,21 @@ ifneq ($(findstring clang, $(shell $(CC) --version 2>/dev/null)),)
 HAVE_CLANG := 1
 CLANG_VERSION := $(shell $(CC) --version | head -1 | grep -o '[0-9]\+\.' | head -1 | cut -d '.' -f 1)
 clang_at_least = $(shell [ $(CLANG_VERSION) -ge $(1) ] && echo true)
+clang_at_most  = $(shell [ $(CLANG_VERSION) -le $(1) ] && echo true)
+clang_major_is = $(shell [ $(CLANG_VERSION) -eq $(1) ] && echo true)
 else
 clang_at_least = $(shell echo false)
+clang_at_most  = $(shell echo false)
+clang_major_is = $(shell echo false)
+endif
+
+# -fno-stack-check is a workaround for a possible
+# bug in Xcode 11 or macOS 10.15+
+ifdef HAVE_DARWIN_OS
+ifeq ($(call clang_major_is, 11), true)
+EXTRA_CFLAGS += -fno-stack-check
+XCODE_FLAGS += OTHER_CFLAGS=-fno-stack-check
+endif
 endif
 
 cppcheck = $(shell printf '$(2)' | $(CC) $(CFLAGS) -E -dM - 2>/dev/null | grep -E $(1))



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b8805d176bbdb2add99a512405c88d32cb5c9302...d2008b8d09936d339eb2fb2ae73938c1d6362574

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/b8805d176bbdb2add99a512405c88d32cb5c9302...d2008b8d09936d339eb2fb2ae73938c1d6362574
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