From 1094aecab563e8c1601ae80caefb2e4247db87d4 Mon Sep 17 00:00:00 2001 From: David Steele Date: Tue, 25 Jun 2024 16:16:55 +0800 Subject: [PATCH] Require compiler support for __builtin_clzl() and __builtin_bswap64(). These functions will be useful for optimizing varint-128 functions. Require them in the meson build before adding new code in case there are problems with packaging. --- doc/xml/release/2024/2.53.xml | 1 + meson.build | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/doc/xml/release/2024/2.53.xml b/doc/xml/release/2024/2.53.xml index 034cd5f01..48dd10cbb 100644 --- a/doc/xml/release/2024/2.53.xml +++ b/doc/xml/release/2024/2.53.xml @@ -2,6 +2,7 @@

NOTE TO PACKAGERS: The lz4 library is now required by the meson build.

+

NOTE TO PACKAGERS: Compiler support for __builtin_clzl() and __builtin_bswap64() is now required by the meson build.

diff --git a/meson.build b/meson.build index a88fdb37b..0808c4d39 100644 --- a/meson.build +++ b/meson.build @@ -135,6 +135,16 @@ add_project_arguments(cc.get_supported_arguments('-fmacro-prefix-map=@0@/test/sr #################################################################################################################################### configuration = configuration_data() +# Ensure the C compiler supports __builtin_clzl() +if not cc.links('''int main(int arg, char **argv) {__builtin_clzl(1);}''') + error('compiler must support __builtin_clzl()') +endif + +# Ensure the C compiler supports __builtin_bswap64() +if not cc.links('''int main(int arg, char **argv) {__builtin_bswap64(1);}''') + error('compiler must support __builtin_bswap64()') +endif + # Find optional backtrace library lib_backtrace = cc.find_library('backtrace', required: false)