build: Add macro to simplify tests for required programs.

As we implement more checks for required programs (generally used by the
test harness) we're going to end up with a long list of repetative uses of
the AC_CHECK_PROG, AS_IF, AC_MSG_ERROR macros. For the sake of sanity
and efficiency we can keep this from getting unmanageable by using a
simple macro.

Since there isn't a clear place where this macro should live this commit
adds a new file called 'misc.m4' to the 'm4/' directory.

Signed-off-by: Philip Tricca <philip.b.tricca@intel.com>
diff --git a/configure.ac b/configure.ac
index d70fd69..9e36604 100644
--- a/configure.ac
+++ b/configure.ac
@@ -158,12 +158,8 @@
     [enable_integration=$enableval],
     [enable_integration=no])
 AS_IF([test "x$enable_integration" = "xyes"],
-      [AC_CHECK_PROG([tpm_server], [tpm_server], [yes], [no])
-       AS_IF([test "x$tpm_server" != "xyes"],
-             [AC_MSG_ERROR([Integration tests enabled but tpm_server not found, try setting PATH])])
-       AC_CHECK_PROG([netstat], [netstat], [yes], [no])
-       AS_IF([test "x$netstat" != "xyes"],
-             [AC_MSG_ERROR([Integration tests enabled but netstat executable not found.])])
+      [ERROR_IF_NO_PROG([tpm_server])
+       ERROR_IF_NO_PROG([netstat])
        PKG_CHECK_MODULES([LIBCRYPTO],[libcrypto])
        AC_CHECK_HEADER(uthash.h, [], [AC_MSG_ERROR([Can not find uthash.h. Please install uthash-dev])])
        AC_SUBST([ENABLE_INTEGRATION], [$enable_integration])])
diff --git a/m4/misc.m4 b/m4/misc.m4
new file mode 100644
index 0000000..1d9f905
--- /dev/null
+++ b/m4/misc.m4
@@ -0,0 +1,10 @@
+dnl ERROR_IF_NO_PROG
+dnl   A quick / dirty macro to ensure that a required program / executable
+dnl   is on PATH. If it is not we display an error message using AC_MSG_ERROR.
+dnl $1: program name
+AC_DEFUN([ERROR_IF_NO_PROG],[
+    AC_CHECK_PROG([result], [$1], [yes], [no])
+    AS_IF([test "x$result" != "xyes"], [
+        AC_MSG_ERROR([Missing required program '$1': ensure it is installed and on PATH.])
+    ])
+])