[pacman-dev,2/4] meson.build: Fix detection of symbols

Message ID 20210416194209.191245-3-mark.weiman@markzz.com
State New
Headers show
Series Various fixes for FreeBSD (and perhaps others) | expand

Commit Message

Mark Weiman April 16, 2021, 7:42 p.m. UTC
This patch changes the behavior of meson to define configuration options
*only* when the symbol checked is present. Currently, it defines all of
them in config.h whether the symbol exists or not and the code that
looks for it doesn't check the macro's value, but whether it's defined.

Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
---
 meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch

diff --git a/meson.build b/meson.build
index 483c4fbd..14b3381a 100644
--- a/meson.build
+++ b/meson.build
@@ -146,7 +146,9 @@  foreach sym : [
     'tcflush',
   ]
   have = cc.has_function(sym, args : '-D_GNU_SOURCE')
-  conf.set10('HAVE_' + sym.to_upper(), have)
+  if have
+    conf.set10('HAVE_' + sym.to_upper(), have)
+  endif
 endforeach
 
 foreach member : [