Do not compile scsi ioctl decoding if <scsi/sg.h> is not available
Add a generic test for <scsi/sg.h> availability to fix build with
Bionic libc that does not provide <scsi/sg.h>.
* configure.ac (AC_CHECK_HEADERS): Add scsi/sg.h.
* ioctl.c (ioctl_decode): Do not call scsi_ioctl if !HAVE_SCSI_SG_H.
* scsi.c: Do not compile scsi ioctl decoding if !HAVE_SCSI_SG_H.
Reported-by: Elliott Hughes <enh@google.com>
diff --git a/scsi.c b/scsi.c
index ed5b3bb..c49f954 100644
--- a/scsi.c
+++ b/scsi.c
@@ -27,8 +27,11 @@
*/
#include "defs.h"
-#include <sys/ioctl.h>
-#include <scsi/sg.h>
+
+#ifdef HAVE_SCSI_SG_H
+
+# include <sys/ioctl.h>
+# include <scsi/sg.h>
static const struct xlat sg_io_dxfer_direction[] = {
XLAT(SG_DXFER_NONE),
@@ -137,3 +140,5 @@
}
return 1;
}
+
+#endif /* HAVE_SCSI_SG_H */