[vlc-commits] [Git][videolan/vlc][master] 3 commits: contrib: Fix Apple Clang specific version checks
Steve Lhomme (@robUx4)
gitlab at videolan.org
Wed Sep 2 14:35:14 UTC 2026
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
fb16e8db by Marvin Scholz at 2026-09-02T13:35:27+00:00
contrib: Fix Apple Clang specific version checks
The versions of Clang and Apple Clang can't be treated
the same, so add a version check specific to Apple Clang
and make the normal one always return false when checking
with Apple Clang.
This also makes the check for Xcode 11 for the -fno-stack-check
workaround more accurate, as it does not rely on the assumption
that Apple Clang is used when the host is Darwin, anymore.
- - - - -
eecc23ba by Marvin Scholz at 2026-09-02T13:35:27+00:00
contrib: add try_cxx_compile helper
Accepts the source code as first argument and additional compiler
flags as second argument.
Will be used in the next commit.
- - - - -
6b5eca8b by Marvin Scholz at 2026-09-02T13:35:27+00:00
contrib: live555: actually test the required C++20 feature
- - - - -
3 changed files:
- contrib/src/live555/rules.mak
- contrib/src/main.mak
- contrib/src/vpx/rules.mak
Changes:
=====================================
contrib/src/live555/rules.mak
=====================================
@@ -4,20 +4,15 @@ LIVE555_VERSION := 2026.06.24
LIVE555_FILE := live.$(LIVE555_VERSION).tar.gz
LIVEDOTCOM_URL := $(CONTRIB_VIDEOLAN)/live555/$(LIVE555_FILE)
-ifdef HAVE_GCC
-# older GCC doesn't support -std=c++20 required for std::atomic_flag
-ifeq ($(call gcc_at_least, 10), true)
-HAVE_LIVE555_CPP20=1
-endif
-else
-ifdef HAVE_CLANG
-# older CLANG doesn't support -std=c++20 required for std::atomic_flag
-ifeq ($(call clang_at_least, 12), true)
-HAVE_LIVE555_CPP20=1
-endif
-else
-HAVE_LIVE555_CPP20=1
-endif
+define CXX20_ATOMIC_FLAG_CHECK
+#include <atomic> \n
+#if !defined(__cpp_lib_atomic_flag_test) \n
+FAIL! \n
+#endif \n
+endef
+
+ifeq ($(call try_cxx_compile,$(CXX20_ATOMIC_FLAG_CHECK),-std=c++20),true)
+HAVE_LIVE555_CPP20_ATOMIC_TEST=1
endif
ifdef BUILD_NETWORK
@@ -73,7 +68,7 @@ live555: $(LIVE555_FILE) .sum-live555
# Remove hardcoded cc, c++, ar variables
sed -e 's%C_COMPILER%#C_COMPILER%' -e 's%CPLUSPLUS_COMPILER%#CPLUSPLUS_COMPILER%' -e 's%LIBRARY_LINK%#LIBRARY_LINK%' -i.orig $(UNPACK_DIR)/config.$(LIVE_TARGET)
# Remove hardcoded --std=c+20 on un supported compilers
-ifndef HAVE_LIVE555_CPP20
+ifndef HAVE_LIVE555_CPP20_ATOMIC_TEST
sed -e 's%-std=c++20% -DNO_STD_LIB=1%' -i.orig $(UNPACK_DIR)/config.$(LIVE_TARGET)
endif
# Add the Extra_CFLAGS to the config files
=====================================
contrib/src/main.mak
=====================================
@@ -152,12 +152,23 @@ EXTRA_LDFLAGS += -m32
endif
endif
+apple_clang_at_least = $(shell echo false)
+apple_clang_at_most = $(shell echo false)
+apple_clang_major_is = $(shell echo false)
clang_at_least = $(shell echo false)
clang_at_most = $(shell echo false)
clang_major_is = $(shell echo false)
gcc_at_least = $(shell echo false)
gcc_at_most = $(shell echo false)
gcc_major_is = $(shell echo false)
+ifeq ($(shell $(CC) --version 2>/dev/null | grep -qi "Apple clang" || echo FAIL),)
+HAVE_APPLE_CLANG := 1
+HAVE_CLANG := 1
+CLANG_VERSION := $(shell $(CC) --version | head -1 | grep -o '[0-9]\+\.' | head -1 | cut -d '.' -f 1)
+apple_clang_at_least = $(shell [ $(CLANG_VERSION) -ge $(1) ] && echo true)
+apple_clang_at_most = $(shell [ $(CLANG_VERSION) -le $(1) ] && echo true)
+apple_clang_major_is = $(shell [ $(CLANG_VERSION) -eq $(1) ] && echo true)
+else
ifneq ($(findstring clang, $(shell $(CC) --version 2>/dev/null | grep -qi clang && echo "clang")),)
HAVE_CLANG := 1
CLANG_VERSION := $(shell $(CC) --version | head -1 | grep -o '[0-9]\+\.' | head -1 | cut -d '.' -f 1)
@@ -173,18 +184,19 @@ gcc_at_most = $(shell [ $(GCC_VERSION) -le $(1) ] && echo true)
gcc_major_is = $(shell [ $(GCC_VERSION) -eq $(1) ] && echo true)
endif
endif
+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)
+ifeq ($(call apple_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))
+try_cxx_compile = $(shell printf '$(1)' | $(CXX) $(CXXFLAGS) $(2) -x c++ -c - -o /dev/null 2>/dev/null && echo true)
+
EXTRA_CFLAGS += -I$(PREFIX)/include
CPPFLAGS := $(CPPFLAGS) $(EXTRA_CFLAGS)
CFLAGS := $(CFLAGS) $(EXTRA_CFLAGS)
=====================================
contrib/src/vpx/rules.mak
=====================================
@@ -138,14 +138,12 @@ VPX_CONF += --disable-runtime-cpu-detect
endif
VPX_CONF += --enable-vp8-decoder
endif
-ifdef HAVE_DARWIN_OS
ifeq ($(ARCH),$(filter $(ARCH), arm aarch64))
-ifneq ($(call clang_at_least, 13), true)
-# arm_neon.h broken on clang 12
+ifneq ($(call apple_clang_at_least, 13), true)
+# arm_neon.h broken on Apple Clang 12
VPX_CONF += --disable-neon-dotprod
endif
endif
-endif
ifndef WITH_OPTIMIZATION
VPX_CONF += --disable-optimizations
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c52356f14ee57e3002066ef8834591d1cbfd479d...6b5eca8bb77803eb81d5ac3c895e67f358e55f20
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/c52356f14ee57e3002066ef8834591d1cbfd479d...6b5eca8bb77803eb81d5ac3c895e67f358e55f20
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help
More information about the vlc-commits
mailing list