build: Don't build tests unless asked

This was attempted previously but didn't get the logic quite right.

Include pthread unconditionally since it is needed by the 'all' target.

Change-Id: I9db7fb15280357b53a748f1c385a5523e37e34a4
Fixes: 35aba2347fd0ffbbaf704d4cc067304881348182
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/configure.ac b/configure.ac
index 34a70e5..84a946f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -41,11 +41,11 @@
 AC_ARG_ENABLE([tests], [Whether we should build test cases])
 
 # Check/set gtest specific functions.
-AS_IF([test "x$enable_tests" != "xno"], [
+AS_IF([test "x$enable_tests" = "xyes"], [
     PKG_CHECK_MODULES([GMOCK], [gtest_main],,)
     PKG_CHECK_MODULES([GTEST], [gmock],,)
-    AX_PTHREAD
 ])
+AX_PTHREAD
 
 AC_ARG_ENABLE([oe-sdk],
     AS_HELP_STRING([--enable-oe-sdk], [Link testcases absolutely against OE SDK so they can be ran within it.])