From e7ac62c3c70d6983c8d59c2289fd9ea9b6719916 Mon Sep 17 00:00:00 2001
From: Dylan Baker <dylan@pnwbakers.com>
Date: Mon, 25 Mar 2019 15:22:13 -0700
Subject: [PATCH] meson: work around meson issue #5115

This issue causes openmp arguments to be injected into compilers that
can support openmp, even if they don't. This issue will be fixed in
0.51 (code already landed in mesonbuild#5116), for older versions lets
work around the issue.
---
 meson.build | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/meson.build b/meson.build
index fe77893b..2c6b57fd 100644
--- a/meson.build
+++ b/meson.build
@@ -376,13 +376,15 @@ if get_option('gnuplot')
   config.set('PIXMAN_GNUPLOT', 1)
 endif
 
-use_openmp = get_option('openmp')
-dep_openmp = null_dep
-if not use_openmp.disabled()
-  dep_openmp = dependency('openmp', required : get_option('openmp'))
-  if dep_openmp.found()
-    config.set10('USE_OPENMP', true)
-  endif
+dep_openmp = dependency('openmp', required : get_option('openmp'))
+if dep_openmp.found()
+  config.set10('USE_OPENMP', true)
+elif meson.version().version_compare('<0.51.0')
+# In versions of meson before 0.51 the openmp dependency can still
+# inject arguments in the the auto case when it is not found, the
+# detection does work correctly in that case however, so we just
+# replace dep_openmp with null_dep to work around this.
+  dep_openmp = null_dep
 endif
 
 dep_gtk = dependency('gtk+-2.0', version : '>= 2.16', required : get_option('gtk'))
-- 
GitLab