File cdrdao-1.2.2-usal.patch of Package cdrdao
--- acinclude.m4
+++ acinclude.m4
@@ -128,7 +128,7 @@
AC_MSG_CHECKING(for libscg/schily version >= $1)
CFLAGS="$scsilib_incl"
- LIBS="$scsilib_libs"
+ LIBS="$scsilib_libs -lscg -lschily"
AC_RUN_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
@@ -161,3 +161,48 @@
]
)
+AC_DEFUN([AC_LIBUSAL],
+[dnl
+dnl Get libusal version
+dnl
+
+ AC_LANG_SAVE
+ AC_LANG_C
+ ac_save_CFLAGS="$CFLAGS"
+ ac_save_LIBS="$LIBS"
+
+ AC_MSG_CHECKING(for libusal/rols version >= $1)
+ CFLAGS="$scsilib_incl"
+ LIBS="$scsilib_libs -lusal -lrols"
+
+ AC_RUN_IFELSE([AC_LANG_PROGRAM([[
+#include <stdio.h>
+#include <standard.h>
+#include <usal/usalcmd.h>
+#include <usal/scsitransp.h>
+]],[[
+ int maj1, maj2, min1, min2;
+ const char* v1 = "$1";
+ const char* v2 = usal_version(0, SCG_VERSION);
+ maj1 = atoi(v1);
+ maj2 = atoi(v2);
+ if (maj2 < maj1) {
+ return -1;
+ }
+ if (!strchr(v1, '.') || !strchr(v2, '.'))
+ return -1;
+
+ min1 = atoi(strchr(v1, '.') + 1);
+ min2 = atoi(strchr(v2, '.') + 1);
+ if (min2 < min1) {
+ return -1;
+ }
+
+]])],[AC_MSG_RESULT(yes); $2],[AC_MSG_RESULT(no); $3],[AC_MSG_RESULT(skipped); $2])
+
+ CFLAGS="$ac_save_CFLAGS"
+ LIBS="$ac_save_LIBS"
+ AC_LANG_RESTORE
+]
+)
+
--- configure.ac
+++ configure.ac
@@ -257,6 +257,7 @@
[sgsysinc=yes; scsilib_incl="-I/usr/include/schily"])
AC_CHECK_FILE(/usr/local/include/schily/schily.h,
[sgsysinc=yes; scsilib_incl="-I/usr/local/include/schily"])
+ AC_CHECK_LIB(usal, usal_version, [sgsyslib=yes], , -lrols)
else
scsilib_incl="-I$scglib_inc"
scsilib_libs="-L$scglib_lib"
@@ -273,7 +274,6 @@
en_scsilib="yes"
fi
- scsilib_libs="$scsilib_libs -lscg -lschily"
scsilib_objs="ScsiIf-lib.o"
case "$host" in
@@ -317,13 +317,30 @@
dnl If we're using custom libsch/schily libs, make sure it'll compile
if test "$en_custom_libscg" = yes; then
- AC_LIBSCG(0.5,[have_scg05=yes],[AC_MSG_ERROR([No cdrtools libraries found. You need to install cdrtools version >= 1.10 (a.k.a. cdrecord-devel). To build the included fallback scsi library, please use --with-scglib=pkg (see INSTALL file)])])
+ AC_LIBSCG(0.5,[have_scg05=yes],[])
+ AC_LIBUSAL(1.1,[have_usal=yes],[])
+
+ if test ! "$have_scg05" = yes -a ! "$have_usal" = yes; then
+ AC_MSG_ERROR([No cdrtools libraries found. You need to install cdrtools version >= 1.10 (a.k.a. cdrecord-devel). To build the included fallback scsi library, please use --with-scglib=pkg (see INSTALL file)])
+ fi
+
AC_LIBSCG(0.7,[have_scg07=yes], [])
+ if test "$have_scg05" = yes; then
+ scsilib_libs="$scsilib_libs -lscg -lschily"
+ fi
+
dnl Special case when we're compiling with cdrtools 1.10
if test "$have_scg05" = yes -a ! "$have_scg07" = yes; then
AC_DEFINE(USE_OLDSCGLIB,1,"")
fi
+ if test "$have_usal" = yes; then
+ AC_DEFINE(USE_LIBUSAL,1,"")
+ scsilib_libs="$scsilib_libs -lusal -lrols"
+ fi
+else
+ dnl internal libscg
+ scsilib_libs="$scsilib_libs -lscg -lschily"
fi
dnl Selection of buffer code
--- dao/ScsiIf-lib.cc
+++ dao/ScsiIf-lib.cc
@@ -30,10 +30,30 @@
#include "xconfig.h"
#include "standard.h"
+#if USE_LIBUSAL
+#include "usal/usalcmd.h"
+#include "usal/scsitransp.h"
+#include "usal/scsireg.h"
+#define scg_open usal_open
+#define scg_close usal_close
+#define scg_bufsize usal_bufsize
+#define scg_getbuf usal_getbuf
+#define scg_cmd usal_cmd
+#define scg_printerr usal_printerr
+#define scg_help usal_help
+#define scg_sense_key usal_sense_key
+#define scg_isatapi usal_isatapi
+#define scg_scsibus usal_scsibus
+#define scg_target usal_target
+#define scg_lun usal_lun
+#define scg_havebus usal_havebus
+#define scg_settarget usal_settarget
+#define scg_version usal_version
+#else
#include "scg/scgcmd.h"
#include "scg/scsitransp.h"
#include "scg/scsireg.h"
-
+#endif /* USE_LIBUSAL */
// schily/standard.h define these, i don't know what they smoked the
// day they came up with those defines.
#undef vendor