Imported Upstream version 3.2.0
[debian/amanda] / config / amanda / tape.m4
1 # SYNOPSIS
2 #
3 #   AMANDA_WITH_MAXTAPEBLOCKSIZE
4 #
5 # OVERVIEW
6 #
7 #   Implement the deprecated --with-maxtapeblocksize option.
8 #
9 AC_DEFUN([AMANDA_WITH_MAXTAPEBLOCKSIZE], [
10     AC_ARG_WITH(maxtapeblocksize, [(deprecated)],
11         [ AMANDA_MSG_WARN([--with-maxtapeblocksize is no longer needed]) ]
12     )
13 ])
14
15 # SYNOPSIS
16 #
17 #   AMANDA_TAPE_DEVICE
18 #
19 # OVERVIEW
20 #
21 #   Set up for the 'tape' device.  WANT_TAPE_DEVICE is defined and
22 #   AM_CONDITIONAL'd if the tape device should be supported.
23 #
24 #   If 'struct mtget' fields mt_flags, mt_fileno, mt_blkno, mt_dsreg, and 
25 #   mt_erreg, the corresponding HAVE_MT_* is DEFINEd.
26 #
27 AC_DEFUN([AMANDA_TAPE_DEVICE], [
28     AC_CHECK_HEADERS( \
29         linux/zftape.h \
30         sys/tape.h \
31         sys/mtio.h \
32         )
33
34     # check for MTIOCTOP, an indicator of POSIX tape support
35     AC_CACHE_CHECK([for MTIOCTOP], amanda_cv_HAVE_MTIOCTOP,[
36         AC_TRY_COMPILE([
37 #ifdef HAVE_SYS_TAPE_H
38 # include <sys/tape.h>
39 #endif
40 #ifdef HAVE_SYS_MTIO_H
41 # include <sys/mtio.h>
42 #endif
43 #ifndef MTIOCTOP
44 #error MTIOCTOP not defined
45 #endif
46             ],
47             [ int dummy = 0; ],
48             amanda_cv_HAVE_MTIOCTOP=yes,
49             amanda_cv_HAVE_MTIOCTOP=no,
50             amanda_cv_HAVE_MTIOCTOP=no)]
51
52         HAVE_MTIOCTOP=$amanda_cv_HAVE_MTIOCTOP
53     )
54
55     # maybe we have no tape device at all (e.g., Mac OS X)?
56     if test x"$HAVE_MTIOCTOP" = x"yes"; then
57         want_tape_device=yes
58         AC_DEFINE(WANT_TAPE_DEVICE, 1, [Define if the tape-device will be built])
59     fi
60     AM_CONDITIONAL(WANT_TAPE_DEVICE, test -n "$want_tape_device")
61
62     #
63     # Check for various "mt status" related structure elements.
64     #
65     AC_MSG_CHECKING([for mt_flags mtget structure element])
66     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
67 #include <stdio.h>
68 #include <sys/types.h>
69 #include <sys/mtio.h>
70         ]], [[
71             struct mtget buf;
72             long ds;
73
74             ds = buf.mt_flags;
75         ]])],[
76             AC_MSG_RESULT(yes)
77             AC_DEFINE(HAVE_MT_FLAGS,1,
78                 [Define if the mtget structure has an mt_flags field])
79         ],[
80             AC_MSG_RESULT(no)
81         ])
82
83     AC_MSG_CHECKING([for mt_fileno mtget structure element])
84     mt_fileno_result="found"
85     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
86 #include <stdio.h>
87 #include <sys/types.h>
88 #include <sys/mtio.h>
89         ]], [[
90             struct mtget buf;
91             long ds;
92
93             ds = buf.mt_fileno;
94         ]])],[
95             AC_MSG_RESULT(yes)
96             AC_DEFINE(HAVE_MT_FILENO,1,
97                 [Define if the mtget structure has an mt_fileno field])
98         ],[
99             AC_MSG_RESULT(no)
100         ])
101
102     AC_MSG_CHECKING(for mt_blkno mtget structure element)
103     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
104 #include <stdio.h>
105 #include <sys/types.h>
106 #include <sys/mtio.h>
107         ]], [[
108             struct mtget buf;
109             long ds;
110
111             ds = buf.mt_blkno;
112         ]])],[
113             AC_MSG_RESULT(yes)
114             AC_DEFINE(HAVE_MT_BLKNO,1,
115                 [Define if the mtget structure has an mt_blkno field])
116         ],[
117             AC_MSG_RESULT(no)
118         ])
119
120     AC_MSG_CHECKING(for mt_dsreg mtget structure element)
121     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
122 #include <stdio.h>
123 #include <sys/types.h>
124 #include <sys/mtio.h>
125         ]], [[
126             struct mtget buf;
127             long ds;
128
129             ds = buf.mt_dsreg;
130         ]])],[
131             AC_MSG_RESULT(yes)
132             AC_DEFINE(HAVE_MT_DSREG,1,
133                 [Define if the mtget structure has an mt_dsreg field])
134         ],[
135             AC_MSG_RESULT(no)
136         ])
137
138     AC_MSG_CHECKING(for mt_erreg mtget structure element)
139     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
140 #include <stdio.h>
141 #include <sys/types.h>
142 #include <sys/mtio.h>
143         ]], [[
144             struct mtget buf;
145             long ds;
146
147             ds = buf.mt_erreg;
148         ]])],[
149             AC_MSG_RESULT(yes)
150             AC_DEFINE(HAVE_MT_ERREG,1,
151                 [Define if the mtget structure has an mt_erreg field])
152         ],[
153             AC_MSG_RESULT(no)
154         ])
155
156     case "$host" in
157         *linux*) AC_DEFINE(DEFAULT_TAPE_NON_BLOCKING_OPEN,1,
158                         [Define if open of tape device require O_NONBLOCK]);;
159     esac
160 ])