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/ChangeLog b/ChangeLog
index 21cdd0f..13cf0ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2009-06-01  Dmitry V. Levin  <ldv@altlinux.org>
+
+	* 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>
+
 2009-04-20  Denys Vlasenko  <dvlasenk@redhat.com>
 
 	* file.c (printstatsol, printstat_sparc64):
diff --git a/configure.ac b/configure.ac
index ffbfeb4..3b1db7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -209,7 +209,39 @@
 fi
 
 AC_CHECK_FUNCS(sigaction strerror strsignal pread sys_siglist _sys_siglist getdents mctl prctl sendmsg inet_ntop if_indextoname)
-AC_CHECK_HEADERS([sys/reg.h sys/filio.h sys/acl.h sys/asynch.h sys/door.h stropts.h sys/conf.h sys/stream.h sys/tihdr.h sys/tiuser.h sys/sysconfig.h ioctls.h sys/ioctl.h sys/ptrace.h termio.h linux/ptrace.h asm/reg.h sys/uio.h sys/aio.h poll.h sys/poll.h sys/vfs.h asm/sysmips.h linux/utsname.h sys/nscsys.h mqueue.h sys/epoll.h libaio.h inttypes.h], [], [])
+AC_CHECK_HEADERS([ \
+	inttypes.h \
+	ioctls.h \
+	libaio.h \
+	mqueue.h \
+	poll.h \
+	stropts.h \
+	termio.h \
+	sys/acl.h \
+	sys/aio.h \
+	sys/asynch.h \
+	sys/conf.h \
+	sys/door.h \
+	sys/epoll.h \
+	sys/filio.h \
+	sys/ioctl.h \
+	sys/nscsys.h \
+	sys/poll.h \
+	sys/ptrace.h \
+	sys/reg.h \
+	sys/stream.h \
+	sys/sysconfig.h \
+	sys/tihdr.h \
+	sys/tiuser.h \
+	sys/uio.h \
+	sys/vfs.h \
+	asm/cachectl.h \
+	asm/reg.h \
+	asm/sysmips.h \
+	linux/capability.h \
+	linux/ptrace.h \
+	linux/utsname.h \
+], [], [])
 AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
                  [], [], [#include <stddef.h>
 #include <linux/socket.h>])
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