[podsleuth] [build] Support both sgutils and sgutils2



commit 938b630a0c12d1150b14e528516c0e78dc1b4ef3
Author: Aaron Bockover <abockover novell com>
Date:   Thu Oct 1 14:51:30 2009 -0400

    [build] Support both sgutils and sgutils2
    
    Expanded PODSLEUTH_CHECK_SGUTILS macro to look first for
    sgutils2 (sg_ll_inquiry), then the older sgutils. Export
    the .so name to LIBSGUTILS_SO.
    
    Change the dll name to libsgutils.dll, which now maps
    to the exported LIBSGUTILS_SO value.

 configure.ac                          |    1 +
 m4/podsleuth.m4                       |   16 ++++++++++++++--
 src/PodSleuth/PodSleuth.dll.config.in |    2 +-
 src/PodSleuth/PodSleuth/ScsiReader.cs |    4 ++--
 4 files changed, 18 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e044128..1a17321 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,6 +43,7 @@ echo
 echo "   Prefix:        ${prefix}"
 echo "   HAL Callouts:  ${HALCALLOUTSDIR_EXPANDED}"
 echo "   Updates Cache: ${with_update_dir}"
+echo "   libsgutils:    ${LIBSGUTILS_SO}"
 echo
 
 if test ! -e "${HALCALLOUTSDIR_EXPANDED}/hal-storage-eject"; then 
diff --git a/m4/podsleuth.m4 b/m4/podsleuth.m4
index 76c8fa2..a5591fe 100644
--- a/m4/podsleuth.m4
+++ b/m4/podsleuth.m4
@@ -32,9 +32,21 @@ AC_DEFUN([PODSLEUTH_CHECK_HAL],
 
 AC_DEFUN([PODSLEUTH_CHECK_SGUTILS],
 [
-	AC_CHECK_LIB(sgutils, sg_ll_inquiry, [], 
+	LIBSGUTILS_SO=NONE
+	
+	AC_CHECK_LIB(sgutils2, sg_ll_inquiry,
+		[LIBSGUTILS_SO=libsgutils2.so.2], [])
+	
+	if test "x$LIBSGUTILS_SO" = "xNONE"; then
+		AC_CHECK_LIB(sgutils, sg_ll_inquiry,
+			[LIBSGUTILS_SO=libsgutils.so.1], [])
+	fi
+
+	if test "x$LIBSGUTILS_SO" = "xNONE"; then
 		AC_MSG_ERROR([Error! You need to have libsgutils.])
-	)
+	fi
+
+	AC_SUBST(LIBSGUTILS_SO)
 ])
 
 AC_DEFUN([PODSLEUTH_CHECK_UPDATE_DIR],
diff --git a/src/PodSleuth/PodSleuth.dll.config.in b/src/PodSleuth/PodSleuth.dll.config.in
index 9ec1457..fbf0831 100644
--- a/src/PodSleuth/PodSleuth.dll.config.in
+++ b/src/PodSleuth/PodSleuth.dll.config.in
@@ -1,4 +1,4 @@
 <configuration>
-	<dllmap dll="libsgutils.so.1" target="libsgutils.so.1" />
+	<dllmap dll="libsgutils.dll" target="@LIBSGUTILS_SO@"/>
 </configuration>
 
diff --git a/src/PodSleuth/PodSleuth/ScsiReader.cs b/src/PodSleuth/PodSleuth/ScsiReader.cs
index a8db0ad..242fc90 100644
--- a/src/PodSleuth/PodSleuth/ScsiReader.cs
+++ b/src/PodSleuth/PodSleuth/ScsiReader.cs
@@ -50,7 +50,7 @@ namespace PodSleuth
             }
         }
         
-        [DllImport("libsgutils.so.1")]
+        [DllImport("libsgutils.dll")]
         private static extern int sg_ll_inquiry(int sg_fd, int cmddt, int evpd, int pg_op,
             IntPtr resp, int mx_resp_len, int noisy, int verbose);
             
@@ -74,4 +74,4 @@ namespace PodSleuth
             }
         }
     }
-}
\ No newline at end of file
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]