configure: Use both check_header and check_lib for pthreads

check_lib can be a stub that always returns true - make sure to
still use check_headers as before 38dc27cc6.

Change-Id: I5d471de56b16c015a0b686fa6c6caefa35bb89b4
diff --git a/build/make/configure.sh b/build/make/configure.sh
index 5efafdf..876255b 100644
--- a/build/make/configure.sh
+++ b/build/make/configure.sh
@@ -1491,7 +1491,7 @@
         # bionic includes basic pthread functionality, obviating -lpthread.
         ;;
       *)
-        check_lib -lpthread <<EOF && enable_feature pthread_h && add_extralibs -lpthread
+        check_header pthread.h && check_lib -lpthread <<EOF && enable_feature pthread_h && add_extralibs -lpthread
 #include <pthread.h>
 #include <stddef.h>
 int main(void) { return pthread_create(NULL, NULL, NULL, NULL); }
diff --git a/configure b/configure
index 3174a9f..b021c12 100755
--- a/configure
+++ b/configure
@@ -582,7 +582,10 @@
 int main(void) {return 0;}
 EOF
     # check system headers
-    check_lib -lpthread <<EOF && enable_feature pthread_h
+
+    # Use both check_header and check_lib here, since check_lib
+    # could be a stub that always returns true.
+    check_header pthread.h && check_lib -lpthread <<EOF && enable_feature pthread_h
 #include <pthread.h>
 #include <stddef.h>
 int main(void) { return pthread_create(NULL, NULL, NULL, NULL); }