7 # Set up for changers. This first checks the availability of several
8 # changer-related headers, then, based on those results, tries to
9 # compile some test programs for each supported changer API. It finishes
10 # by defining a series of AM_CONDITIONALS which are all used in
11 # changer-src/Makefile.am.
13 # The macro also searches for chio, chs, mtx, and mcutil, which are used
14 # from various shell scripts in the changer-src/ directory.
16 AC_DEFUN([AMANDA_SETUP_CHANGER], [
17 AC_REQUIRE([AMANDA_PROG_CHIO])
18 AC_REQUIRE([AMANDA_PROG_CHS])
19 AC_REQUIRE([AMANDA_PROG_MTX])
20 AC_REQUIRE([AMANDA_PROG_MCUTIL])
35 sys/scsi/impl/uscsi.h \
36 sys/scsi/scsi/ioctl.h, \
37 [], [], [AC_INCLUDES_DEFAULT])
42 if test x"$ac_cv_header_sys_scsi_h" = x"yes"; then
43 AC_CACHE_CHECK([for HP/UX-like scsi changer support],
44 amanda_cv_hpux_scsi_chio,
45 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
48 static struct element_addresses changer_info;
49 int i = SIOC_ELEMENT_ADDRESSES;
50 int j = SIOC_ELEMENT_STATUS;
51 int k = SIOC_MOVE_MEDIUM;
52 ]])],[amanda_cv_hpux_scsi_chio=yes],[amanda_cv_hpux_scsi_chio=no])])
53 if test x"$amanda_cv_hpux_scsi_chio" = x"yes"; then
60 # Linux SCSI based on ioctl
62 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
63 test x"$ac_cv_header_scsi_scsi_ioctl_h" = x"yes"; then
64 AC_CACHE_CHECK([for Linux like scsi support (ioctl)],
66 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
67 #include <scsi/scsi_ioctl.h>
72 ioctl(device, SCSI_IOCTL_SEND_COMMAND, Command);
73 ]])],[amanda_cv_linux_scsi=yes],[amanda_cv_linux_scsi=no])])
77 # Linux SCSI based on sg
79 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
80 test x"$ac_cv_header_scsi_sg_h" = x"yes"; then
81 AC_CACHE_CHECK([for Linux like scsi support (sg)],
82 amanda_cv_linux_sg_scsi,
83 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
84 #include <sys/types.h>
89 struct sg_header *psg_header;
91 write(device, buffer, 1);
92 ]])],[amanda_cv_linux_sg_scsi=yes],[amanda_cv_linux_sg_scsi=no])])
95 if test x"$amanda_cv_linux_scsi" = x"yes" ||
96 test x"$amanda_cv_linux_sg_scsi" = x"yes";then
104 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
105 test x"$ac_cv_header_sys_scsi_h" = x"yes"; then
106 AC_CACHE_CHECK([for HP-UX like scsi support],
108 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
110 #include <sys/ioctl.h>
111 #include <sys/scsi.h>
112 #include <sys/mtio.h>
116 ioctl(device, SIOC_IO, Command);
117 ]])],[amanda_cv_hpux_scsi=yes],[amanda_cv_hpux_scsi=no])])
118 if test x"$amanda_cv_hpux_scsi" = x"yes";then
119 WANT_SCSI_HPUX_NEW=yes
121 WANT_CHG_SCSI_CHIO=yes
128 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
129 test x"$ac_cv_header_sys_dsreq_h" = x"yes"; then
130 AC_CACHE_CHECK([for Irix like scsi support],
132 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
133 #include <sys/types.h>
134 #include <sys/dsreq.h>
135 #include <sys/mtio.h>
139 ioctl(device, DS_ENTER, &Command);
140 ]])],[amanda_cv_irix_scsi=yes],[amanda_cv_irix_scsi=no])])
141 if test x"$amanda_cv_irix_scsi" = x"yes";then
150 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
151 test x"$ac_cv_header_sys_scsi_impl_uscsi_h" = x"yes"; then
152 AC_CACHE_CHECK([for Solaris-like scsi support],
153 amanda_cv_solaris_scsi,
154 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
155 #include <sys/types.h>
156 #include <sys/scsi/impl/uscsi.h>
157 #include <sys/mtio.h>
161 ioctl(device, USCSICMD, Command);
162 ]])],[amanda_cv_solaris_scsi=yes],[amanda_cv_solaris_scsi=no])])
163 if test x"$amanda_cv_solaris_scsi" = x"yes";then
164 WANT_SCSI_SOLARIS=yes
172 if test x"$ac_cv_header_sys_tape_h" = x"yes" &&
173 test x"$ac_cv_header_sys_scarray_h" = x"yes" &&
174 test x"$ac_cv_header_sys_gscdds_h" = x"yes"; then
175 AC_CACHE_CHECK([for AIX like scsi support],
177 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
178 #include <sys/types.h>
179 #include <sys/scarray.h>
180 #include <sys/tape.h>
184 ioctl(device, STIOCMD, Command);
185 ]])],[amanda_cv_aix_scsi=yes],[amanda_cv_aix_scsi=no])])
186 if test x"$amanda_cv_aix_scsi" = x"yes";then
194 if test x"$ac_cv_header_cam_cam_h" = x"yes";then
195 AC_CACHE_CHECK([for CAM like scsi support],
197 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
200 # include <cam/cam.h>
201 # include <cam/cam_ccb.h>
202 # include <cam/scsi/scsi_message.h>
203 # include <cam/scsi/scsi_pass.h>
206 struct cam_device *curdev;
208 curdev = cam_open_pass("", O_RDWR, NULL);
209 ]])],[amanda_cv_cam_scsi=yes],[amanda_cv_cam_scsi=no])])
210 if test x"$amanda_cv_cam_scsi" = x"yes";then
213 AC_CHECK_LIB(cam,main)
221 if test x"$ac_cv_header_sys_mtio_h" = x"yes" &&
222 test x"$ac_cv_header_sys_scsiio_h" = x"yes"; then
223 AC_CACHE_CHECK([for BSD like scsi support],
225 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
226 #include <sys/types.h>
227 #include <sys/scsiio.h>
228 #include <sys/mtio.h>
232 ioctl(device, SCIOCCOMMAND, &Command);
233 ]])],[amanda_cv_bsd_scsi=yes],[amanda_cv_bsd_scsi=no])])
234 if test x"$amanda_cv_bsd_scsi" = x"yes";then
240 # Do not build chg-scsi-chio if we cannot find the needed support
241 # include files for the SCSI interfaces
242 # chio.h and sys/chio.h are chio based systems
243 if test x"$ac_cv_header_chio_h" = x"yes" ||
244 test x"$ac_cv_header_linux_chio_h" = x"yes" ||
245 test x"$ac_cv_header_sys_chio_h" = x"yes"; then
246 # chg-scsi does not support FreeBSD 3.0's chio.h; it became backward
247 # incompatible with the introduction of camlib.h
248 if test x"$ac_cv_header_camlib_h" != x"yes"; then
250 # prefer to use chg-scsi, unless we already have a driver for that,
251 # in which case set it up as chg-scsi-chio.
252 if test x"$WANT_CHG_SCSI" = x"no"; then
255 WANT_CHG_SCSI_CHIO=yes
260 # scsi-based implementations
261 AM_CONDITIONAL(WANT_CHG_SCSI, test x"$WANT_CHG_SCSI" = x"yes")
262 AM_CONDITIONAL(WANT_SCSI_LINUX, test x"$WANT_SCSI_LINUX" = x"yes")
263 AM_CONDITIONAL(WANT_SCSI_HPUX_NEW, test x"$WANT_SCSI_HPUX_NEW" = x"yes")
264 AM_CONDITIONAL(WANT_SCSI_IRIX, test x"$WANT_SCSI_IRIX" = x"yes")
265 AM_CONDITIONAL(WANT_SCSI_SOLARIS, test x"$WANT_SCSI_SOLARIS" = x"yes")
266 AM_CONDITIONAL(WANT_SCSI_AIX, test x"$WANT_SCSI_AIX" = x"yes")
267 AM_CONDITIONAL(WANT_SCSI_CAM, test x"$WANT_SCSI_CAM" = x"yes")
268 AM_CONDITIONAL(WANT_SCSI_BSD, test x"$WANT_SCSI_BSD" = x"yes")
270 # scsi-chio-based implementations
271 AM_CONDITIONAL(WANT_CHG_SCSI_CHIO, test x"$WANT_CHG_SCSI_CHIO" = x"yes")
272 AM_CONDITIONAL(WANT_SCSI_HPUX, test x"$WANT_SCSI_HPUX" = x"yes")
273 AM_CONDITIONAL(WANT_SCSI_CHIO, test x"$WANT_SCSI_CHIO" = x"yes")