]> git.sesse.net Git - plocate/blobdiff - meson.build
Support compiling on x86 platforms without working function multiversioning.
[plocate] / meson.build
index 0c0a53f20bd74fb5879105090f7b90b2c159e3ab..c976c028214e93934764b148e9e585f2a3c6bf9a 100644 (file)
@@ -13,6 +13,13 @@ if not uringdep.found()
        add_project_arguments('-DWITHOUT_URING', language: 'cpp')
 endif
 
+# Function multiversioning is x86-only _and_ not available on certain targets
+# (they need “ifunc”, indirect functions, a GNU extension).
+code = '__attribute__((target("default"))) void func();'
+if cxx.compiles(code, name: 'function multiversioning')
+       add_project_arguments('-DHAS_FUNCTION_MULTIVERSIONING', language: 'cpp')
+endif
+
 executable('plocate', ['plocate.cpp', 'io_uring_engine.cpp', 'turbopfor.cpp', 'parse_trigrams.cpp', 'serializer.cpp', 'access_rx_cache.cpp', 'needle.cpp'],
        dependencies: [uringdep, zstddep, threaddep, atomicdep],
        install: true,