Allow building locally without phosphor-logging

Check for phosphor-logging available. It is only available when building
via CI, SDK or if phosphor-logging and associated dbus support has been
installed locally. If phosphor-logging is not available then compile in
minimal logging code. This allows for local testing of changes that are
not affected by or depend on phosphor-logging.

Change-Id: I1b4d54c36b181596beff465307c16ca33f2f91d8
Signed-off-by: Ben Tyner <ben.tyner@ibm.com>
diff --git a/meson.build b/meson.build
index 352e5e4..891b3b5 100644
--- a/meson.build
+++ b/meson.build
@@ -14,6 +14,20 @@
 
 incdir = include_directories('.')
 
+# See if phosphor-logging is available, if not use test case logging code. This
+# allows for local builds outside of CI test sandbox.
+h = 'phosphor-logging/log.hpp'
+cmplr = meson.get_compiler('cpp')
+if cmplr.compiles('#include <@0@>'.format(h), name : '#include <@0@>'.format(h))
+    test_arg = []
+    phosphor_logging = true
+else
+    test_arg = [
+        '-DTEST_TRACE',
+    ]
+    phosphor_logging = false
+endif
+
 subdir('analyzer')
 subdir('attn')
 
@@ -30,6 +44,7 @@
   executable('openpower-hw-diags', 'main.cpp', 'cli.cpp', 'listener.cpp',
               dependencies : [lrt, pthread],
               link_with : [analyzer, attn],
+              cpp_args : test_arg,
               install : true)
 endif