[sane-devel] build fix, use the right scsi header on win32

Ruediger Meier sweet_f_a at gmx.de
Tue Jan 17 17:57:48 UTC 2012


From: Ruediger Meier <ruediger.meier at ga-group.nl>

Now we are using either ddk/ntddscsi.h or ntddscsi.h and even don't
stop if we have none of them.
---
 sanei/sanei_scsi.c        |   10 ++++++++--
 tools/sane-find-scanner.c |   17 +++++++++++------
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/sanei/sanei_scsi.c b/sanei/sanei_scsi.c
index 09127c8..6d171d3 100644
--- a/sanei/sanei_scsi.c
+++ b/sanei/sanei_scsi.c
@@ -62,6 +62,10 @@
 #include <sys/param.h>
 #include <sys/types.h>

+#if defined (HAVE_WINDOWS_H)
+# include <windows.h>
+#endif
+
 #define STUBBED_INTERFACE      0
 #define LINUX_INTERFACE                1
 #define BSD_INTERFACE          2
@@ -211,11 +215,13 @@
 #  include <IOKit/scsi-commands/SCSITaskLib.h>
 # endif
 # endif
-#elif defined (HAVE_WINDOWS_H)
+#elif defined (HAVE_DDK_NTDDSCSI_H)
 # define USE WIN32_INTERFACE
-# include <windows.h>
 # include <ddk/scsi.h>
 # include <ddk/ntddscsi.h>
+#elif defined (HAVE_NTDDSCSI_H)
+# define USE WIN32_INTERFACE
+# include <ntddscsi.h>
 #endif

 #ifndef USE
diff --git a/tools/sane-find-scanner.c b/tools/sane-find-scanner.c
index 2b1b164..bfcfaf0 100644
--- a/tools/sane-find-scanner.c
+++ b/tools/sane-find-scanner.c
@@ -30,10 +30,15 @@
 #include <dirent.h>
 #include <errno.h>

-#if defined (HAVE_WINDOWS_H)
-#include <windows.h>
-#include <ddk/scsi.h>
-#include <ddk/ntddscsi.h>
+#if defined (HAVE_DDK_NTDDSCSI_H) || defined (HAVE_NTDDSCSI_H)
+# define WIN32_SCSI
+# include <windows.h>
+# if defined (HAVE_DDK_NTDDSCSI_H)
+#  include <ddk/scsi.h>
+#  include <ddk/ntddscsi.h>
+# elif defined (HAVE_NTDDSCSI_H)
+#  include <ntddscsi.h>
+# endif
 #endif

 #include "../include/sane/sanei.h"
@@ -1148,7 +1153,7 @@ get_next_file (char *dir_name, DIR * dir)
   return file_name;
 }

-#if defined (HAVE_WINDOWS_H)
+#if defined(WIN32_SCSI)
 /* Return a list of potential scanners. There's a lot of hardcoded values here that might break on a system with lots of scsi devices. */
 static char **build_scsi_dev_list(void)
 {
@@ -1840,7 +1845,7 @@ main (int argc, char **argv)
        0
       };

-#if defined (HAVE_WINDOWS_H) || \
+#if defined (WIN32_SCSI) || \
     defined (HAVE_IOKIT_CDB_IOSCSILIB_H) || \
     defined (HAVE_IOKIT_SCSI_SCSICOMMANDOPERATIONCODES_H) || \
     defined (HAVE_IOKIT_SCSI_COMMANDS_SCSICOMMANDOPERATIONCODES_H)
--
1.7.6.1



More information about the sane-devel mailing list