Fix build with older versions of libaio.h

* configure.ac: When libaio.h is available, check for
struct iocb.u.c.flags, IO_CMD_PWRITE and IO_CMD_PWRITEV.
* desc.c (print_common_flags): Check for HAVE_STRUCT_IOCB_U_C_FLAGS.
(sys_io_submit): Check for HAVE_DECL_IO_CMD_PWRITE and
HAVE_DECL_IO_CMD_PWRITEV.
diff --git a/configure.ac b/configure.ac
index 998324d..2f81382 100644
--- a/configure.ac
+++ b/configure.ac
@@ -204,7 +204,6 @@
 	elf.h
 	inttypes.h
 	ioctls.h
-	libaio.h
 	linux/capability.h
 	linux/perf_event.h
 	linux/ptrace.h
@@ -294,6 +293,11 @@
 AC_CHECK_SIZEOF([long])
 AC_CHECK_SIZEOF([rlim_t],,[#include <sys/resource.h>])
 
+AC_CHECK_HEADERS([libaio.h], [
+	AC_CHECK_MEMBERS([struct iocb.u.c.flags],,, [#include <libaio.h>])
+	AC_CHECK_DECLS([IO_CMD_PWRITE, IO_CMD_PWRITEV],,, [#include <libaio.h>])
+])
+
 AC_PATH_PROG([PERL], [perl])
 
 AC_CONFIG_FILES([Makefile tests/Makefile])