VPP-221 Improve doxygen dependency check

Only try to install packages if they're not installed.
Saves a trip through sudo which is useful when you have a
non-privileged account generating the docs.

Change-Id: I3709aceb15516a45ea2f9510d91c6d2e42c8c349
Signed-off-by: Chris Luke <chrisy@flirble.org>
diff --git a/doxygen/Makefile b/doxygen/Makefile
index df7d07d..f3ddb2c 100644
--- a/doxygen/Makefile
+++ b/doxygen/Makefile
@@ -63,7 +63,11 @@
 
 $(BR)/.doxygen-bootstrap.ok:
 ifeq ($(OS_ID),ubuntu)
-	@sudo -E apt-get $(CONFIRM) $(FORCE) install $(DOC_DEB_DEPENDS)
+	@set -e; inst=; \
+		for i in $(DOC_DEB_DEPENDS); do \
+			dpkg-query --show $$i >/dev/null 2>&1 || inst="$$inst $$i"; \
+		done; \
+		[ "$$inst" ] && sudo apt-get $(CONFIRM) $(FORCE) install $$inst
 else ifneq ("$(wildcard /etc/redhat-release)","")
 	@sudo yum install $(CONFIRM) $(DOC_RPM_DEPENDS)
 else