Skip to content

Commit 76634c7

Browse files
authored
Merge pull request #4 from piste-jp-ibm/dummy3
Make ltotape for Linux buildable
2 parents e66cd74 + bf73eb8 commit 76634c7

File tree

4 files changed

+63
-35
lines changed

4 files changed

+63
-35
lines changed

Makefile.am

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,23 @@ ACLOCAL_AMFLAGS = -I m4
22

33
nobase_pkginclude_HEADERS = config.h
44

5+
GEN_DRV =
6+
PLAT_DRV =
7+
58
if PLATFORM_LINUX
6-
SUBDIRS = messages src/tape_drivers/linux/ltotape
9+
PLAT_DRV += src/tape_drivers/linux/ltotape
710
endif
811

912
if PLATFORM_MAC
10-
SUBDIRS = messages src/tape_drivers/osx/ltotape
13+
PLAT_DRV += src/tape_drivers/osx/ltotape
1114
endif
1215

1316
if PLATFORM_NETBSD
14-
SUBDIRS = messages src/tape_drivers/netbsd/ltotape
17+
PLAT_DRV += src/tape_drivers/netbsd/ltotape
18+
endif
19+
20+
if CHECKONLY
21+
SUBDIRS = messages src/tape_drivers/generic/dummy
22+
else
23+
SUBDIRS = messages ${GEN_DRV} ${PLAT_DRV}
1524
endif

configure.ac

Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,31 @@ AC_PREREQ([2.69])
55
AC_INIT([ltfs-plugins], [0.1], [[email protected]])
66
AC_CONFIG_SRCDIR([src/tape_drivers/netbsd/ltotape/ltotape.c])
77
AC_CONFIG_MACRO_DIRS([m4])
8-
AC_CONFIG_MACRO_DIR([m4])
8+
AC_CONFIG_MACRO_DIR([m4])
99
AC_CANONICAL_TARGET
1010
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
1111
AC_CONFIG_HEADERS([config.h])
1212
AC_PROG_CC
13+
AC_PROG_CC_C99
14+
AM_PROG_CC_C_O
1315
AM_PROG_AR
1416
AC_PROG_LIBTOOL
1517

18+
# Detecting target OS
19+
case "${target_os}" in
20+
linux*)
21+
target_linux=yes
22+
;;
23+
darwin*)
24+
target_mac=yes
25+
;;
26+
netbsd*)
27+
target_netbsd=yes
28+
;;
29+
*)
30+
AC_MSG_ERROR(["OS $target_os is not supported"])
31+
;;
32+
esac
1633

1734
# Checks for header files.
1835
AC_CHECK_HEADERS([fcntl.h inttypes.h stdlib.h string.h sys/file.h sys/ioctl.h unistd.h])
@@ -28,15 +45,15 @@ AC_TYPE_UINT8_T
2845
# Checks for library functions.
2946
AC_CHECK_FUNCS([memset strerror strstr])
3047

31-
dnl
48+
dnl
3249
dnl Check for pkg-config
33-
dnl
34-
if test -z "$PKG_CONFIG"
50+
dnl
51+
if test -z "$PKG_CONFIG"
3552
then
36-
AC_PATH_PROG(PKG_CONFIG, pkg-config, [no])
37-
fi
53+
AC_PATH_PROG(PKG_CONFIG, pkg-config, [no])
54+
fi
3855
if test "x${PKG_CONFIG}" = "xno"
39-
then
56+
then
4057
AC_MSG_ERROR([pkg-config was not found])
4158
fi
4259

@@ -48,13 +65,13 @@ if test "x${GENRB}" = "xno"
4865
then
4966
AC_MSG_ERROR([genrb was not found])
5067
fi
51-
52-
dnl
68+
69+
dnl
5370
dnl Check for pkgdata
54-
dnl
71+
dnl
5572
AC_PATH_PROG(PKGDATA, pkgdata, no)
5673
if test "x${PKGDATA}" = "xno"
57-
then
74+
then
5875
AC_MSG_ERROR([pkgdata was not found])
5976
fi
6077

@@ -87,6 +104,17 @@ then
87104
AC_MSG_RESULT([$ICU_MODULE_VERSION])
88105
fi
89106

107+
dnl
108+
dnl interface checker
109+
dnl
110+
AC_MSG_CHECKING([No driver build, only check backend I/F])
111+
AC_ARG_ENABLE([checkonly],
112+
[AS_HELP_STRING([--enable-checkonly],[No driver build, only check backend I/F])],
113+
[checkonly=$enableval],
114+
[checkonly=no]
115+
)
116+
AC_MSG_RESULT([$checkonly])
117+
90118
dnl
91119
dnl test for ENOMEDIUM
92120
dnl
@@ -95,39 +123,30 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <errno.h>],[
95123
#error no ENOMEDIUM
96124
#endif])],[],[AM_CPPFLAGS="${AM_CPPFLAGS} -DENOMEDIUM=EAGAIN"])
97125

126+
if test "x${target_linux}" = "xyes"
127+
then
128+
AM_CPPFLAGS="-D_GNU_SOURCE"
129+
fi
98130

99131
AM_CPPFLAGS="${AM_CPPFLAGS} `${PKG_CONFIG} --cflags ltfs`"
100132
AM_CPPFLAGS="${AM_CPPFLAGS} `${PKG_CONFIG} --cflags fuse`"
101133
AM_CPPFLAGS="${AM_CPPFLAGS} -DIBM_LTFS_BUILD -DGENERIC_OEM_BUILD"
102134
AM_CPPFLAGS="${AM_CPPFLAGS} ${ICU_MODULE_CFLAGS}"
103135

104-
case "${target_os}" in
105-
linux*)
106-
target_linux=yes
107-
;;
108-
darwin*)
109-
host_mac=yes
110-
;;
111-
netbsd*)
112-
target_netbsd=yes
113-
;;
114-
*)
115-
AC_MSG_ERROR(["OS $target_os is not supported"])
116-
;;
117-
esac
118-
119136
AM_CONDITIONAL([PLATFORM_LINUX], [test "x${target_linux}" = "xyes"])
120137
AM_CONDITIONAL([PLATFORM_MAC], [test "x${target_mac}" = "xyes"])
121138
AM_CONDITIONAL([PLATFORM_NETBSD], [test "x${target_netbsd}" = "xyes"])
139+
AM_CONDITIONAL([CHECKONLY], [test "x${checkonly}" = "xyes"])
122140
AM_CONDITIONAL([CHK_MESSAGE], [test "x${use_msg_check}" = "xyes"])
123141

124142
AC_SUBST(CFLAGS)
125143
AC_SUBST(AM_CPPFLAGS)
126144
AC_SUBST(AM_EXTRA_CPPFLAGS)
127145
AC_SUBST(AM_CFLAGS)
128-
AC_SUBST(AM_LDFLAGS)
146+
AC_SUBST(AM_LDFLAGS)
129147

130-
AC_CONFIG_FILES([Makefile messages/Makefile
148+
AC_CONFIG_FILES([Makefile messages/Makefile
149+
src/tape_drivers/generic/dummy/Makefile
131150
src/tape_drivers/linux/ltotape/Makefile
132151
src/tape_drivers/osx/ltotape/Makefile
133152
src/tape_drivers/netbsd/ltotape/Makefile])

src/tape_drivers/linux/ltotape/Makefile.am

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# under the terms of version 2.1 of the GNU Lesser General Public License
1212
# as published by the Free Software Foundation.
1313
#
14-
# This program is distributed in the hope that it will be useful, but
14+
# This program is distributed in the hope that it will be useful, but
1515
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
1616
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
1717
# License for more details.
@@ -31,8 +31,8 @@ libdir = @libdir@/ltfs
3131
AM_LIBTOOLFLAGS = --tag=disable-static
3232

3333
libdriver_ltotape_la_SOURCES = ltotape.c ltotape_diag.c ltotape_platform.c
34-
libdriver_ltotape_la_DEPENDENCIES = $(top_srcdir)/messages/libdriver_ltotape_dat.la
35-
libdriver_ltotape_la_LIBADD = $(top_srcdir)/messages/libdriver_ltotape_dat.la
34+
libdriver_ltotape_la_DEPENDENCIES = $(top_srcdir)/messages/libdriver_ltotape_dat.a
35+
libdriver_ltotape_la_LIBADD = $(top_srcdir)/messages/libdriver_ltotape_dat.a
3636
libdriver_ltotape_la_CPPFLAGS = @AM_CPPFLAGS@ -I$(top_srcdir)/src
3737
libdriver_ltotape_la_LDFLAGS = -avoid-version -module
3838

src/tape_drivers/linux/ltotape/ltotape_platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#include <sys/stat.h>
3636
#include <sys/file.h>
3737
#include <scsi/sg.h>
38-
#include <scsi/scsi.h>
3938
#include <sys/ioctl.h>
4039
#include <fcntl.h>
4140
#include <string.h>
@@ -46,6 +45,7 @@
4645
#include "ltotape.h"
4746
#include "ltotape_diag.h"
4847
#include "ltotape_supdevs.h"
48+
#include <scsi/scsi.h>
4949

5050
/*
5151
* Max transfer size to ask the SG driver to handle (1MB):

0 commit comments

Comments
 (0)