]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: Print custom message when GNU grep is not installed
authorAndrea Bolognani <abologna@redhat.com>
Wed, 24 Mar 2021 08:45:29 +0000 (09:45 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Thu, 1 Apr 2021 12:14:20 +0000 (14:14 +0200)
Currently, if GNU grep is not installed on a FreeBSD system the
configuration step will fail with

  Program grep found: YES (/usr/bin/grep)
  Program /usr/local/bin/grep found: NO

  ERROR: Program '/usr/local/bin/grep' not found

which is confusing and not very useful; after this change, the
message will be

  Program grep found: YES (/usr/bin/grep)
  Program /usr/local/bin/grep found: NO

  ERROR: Problem encountered: GNU grep not found

instead, which should do a better job helping the user figure
out that they need to install GNU grep from ports to proceed.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
build-aux/meson.build

index c44ed6821cd4f8a0bffe97391d8574c76b298696..06b7a7c01f364a52395a27536a2727e08bc019eb 100644 (file)
@@ -18,7 +18,10 @@ if host_machine.system() == 'freebsd'
 
   grep_cmd = run_command(grep_prog, '--version')
   if grep_cmd.stdout().startswith('grep (BSD grep')
-    grep_prog = find_program('/usr/local/bin/grep')
+    grep_prog = find_program('/usr/local/bin/grep', required: false)
+    if not grep_prog.found()
+      error('GNU grep not found')
+    endif
     grep_cmd = run_command(grep_prog, '--version')
     if grep_cmd.stdout().startswith('grep (BSD grep')
       error('GNU grep not found')