From 8526abc454ad0c2d8eb456c6753e2e333960cc4f Mon Sep 17 00:00:00 2001
From: Andrea Bolognani <abologna@redhat.com>
Date: Wed, 24 Mar 2021 11:33:15 +0100
Subject: [PATCH] meson: Look for GNU tools on macOS too

macOS is similar to FreeBSD in that it ships non-GNU versions
of several utilities that we need in the base system.

macOS actually includes GNU make already, but unfortunately due
to licensing reasons the tool is permanently stuck in 2006, so
even in that case users are better off installing a recent
version from Homebrew along with the dozens of other libvirt
dependencies that already need to be obtained that way.

Note that, unlike FreeBSD ports, Homebrew is fully consistent
in adding the 'g' prefix to the name of the GNU tools, so we
can detect GNU grep without additional hacks.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
---
 build-aux/meson.build | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/build-aux/meson.build b/build-aux/meson.build
index fe88d6b736..1095982397 100644
--- a/build-aux/meson.build
+++ b/build-aux/meson.build
@@ -10,7 +10,7 @@ syntax_check_conf.set('flake8_path', flake8_path)
 syntax_check_conf.set('runutf8', ' '.join(runutf8))
 syntax_check_conf.set('PYTHON3', python3_prog.path())
 
-if host_machine.system() == 'freebsd'
+if host_machine.system() == 'freebsd' or host_machine.system() == 'darwin'
   make_prog = find_program('gmake')
   sed_prog = find_program('gsed')
 else
@@ -31,6 +31,8 @@ if host_machine.system() == 'freebsd'
       error('GNU grep not found')
     endif
   endif
+elif host_machine.system() == 'darwin'
+  grep_prog = find_program('ggrep')
 else
   grep_prog = find_program('grep')
 endif