From 23be5206327cc09a870db346545f7a6a9e2485b3 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Sat, 27 Jul 2024 13:53:11 +0300 Subject: [PATCH] Fallback to clang in PATH with meson Some distributions put clang into a different path than the llvm binary path. For example, this is the case on NixOS / nixpkgs, which failed to find clang with meson before this patch. Author: Wolfgang Walther Reviewed-by: Nazir Bilal Yavuz, Alvaro Herrera, Peter Eisentraut Reviewed-by: Tristan Partin Discussion: https://www.postgresql.org/message-id/ca8f37e1-a2c3-40e2-91f6-59c3d3652ad4@technowledgy.de Backpatch: 16-, where meson support was added --- meson.build | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 1e8ab0f5d00..f3b84318bdb 100644 --- a/meson.build +++ b/meson.build @@ -805,7 +805,10 @@ if add_languages('cpp', required: llvmopt, native: false) llvm_binpath = llvm.get_variable(configtool: 'bindir') ccache = find_program('ccache', native: true, required: false) - clang = find_program(llvm_binpath / 'clang', required: true) + + # Some distros put LLVM and clang in different paths, so fallback to + # find via PATH, too. + clang = find_program(llvm_binpath / 'clang', 'clang', required: true) endif elif llvmopt.auto() message('llvm requires a C++ compiler') -- 2.39.5