anti-patterns: explicit missing pkg messages
Nearly all OpenBMC packages rely primarily on other OpenBMC packages to
build and link. Therefore, it's generally sufficient to list the
missing package via the default missing package behavior. In the event
the package name isn't the same as the library expected, then
overwriting the error message is still helpful.
Change-Id: I9fc6eba07e09480f9e1da8662d202be681c7506e
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/anti-patterns.md b/anti-patterns.md
index 65c2d47..1adcaec 100644
--- a/anti-patterns.md
+++ b/anti-patterns.md
@@ -42,6 +42,37 @@
<!-- end copy/paste on previous line -->
+## Explicit AC_MSG_ERROR on PKG_CHECK_MODULES failure
+
+### Identification
+```
+PKG_CHECK_MODULES(
+ [PHOSPHOR_LOGGING],
+ [phosphor-logging],
+ [],
+ [AC_MSG_ERROR([Could not find phosphor-logging...openbmc/phosphor-logging package required])])
+```
+
+### Description
+
+The autotools PKG_CHECK_MODULES macro provides the ability to specify an
+"if found" and "if not found" behavior. By default, the "if not found"
+behavior will list the package not found. In many cases, this is sufficient
+to a developer to know what package is missing. In most cases, it's another
+OpenBMC package.
+
+If the library sought's name isn't related to the package providing it, then
+the failure message should be set to something more useful to the developer.
+
+### Resolution
+
+Use the default macro behavior when it is clear that the missing package is
+another OpenBMC package.
+
+```
+PKG_CHECK_MODULES([PHOSPHOR_LOGGING], [phosphor-logging])
+```
+
## Explicit listing of shared library packages in RDEPENDS in bitbake metadata
### Identification