Clean up header checks

* configure.ac: Reformat AC_CHECK_HEADERS to keep it sorted and
easily updated, and reduce merging errors in the future.
* system.c: Convert all non-standard #ifdef checks for specific
headers to regular #ifdef HAVE_*_H checks.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
diff --git a/system.c b/system.c
index f21dca7..63a64b8 100644
--- a/system.c
+++ b/system.c
@@ -66,11 +66,11 @@
 
 #include <sys/syscall.h>
 
-#ifdef SYS_capget
+#ifdef HAVE_LINUX_CAPABILITY_H
 #include <linux/capability.h>
 #endif
 
-#ifdef SYS_cacheflush
+#ifdef HAVE_ASM_CACHECTL_H
 #include <asm/cachectl.h>
 #endif
 
@@ -78,7 +78,7 @@
 #include <linux/utsname.h>
 #endif
 
-#ifdef MIPS
+#ifdef HAVE_ASM_SYSMIPS_H
 #include <asm/sysmips.h>
 #endif