1#   BAREOS® - Backup Archiving REcovery Open Sourced
2#
3#   Copyright (C) 2017-2019 Bareos GmbH & Co. KG
4#
5#   This program is Free Software; you can redistribute it and/or
6#   modify it under the terms of version three of the GNU Affero General Public
7#   License as published by the Free Software Foundation and included
8#   in the file LICENSE.
9#
10#   This program is distributed in the hope that it will be useful, but
11#   WITHOUT ANY WARRANTY; without even the implied warranty of
12#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13#   Affero General Public License for more details.
14#
15#   You should have received a copy of the GNU Affero General Public License
16#   along with this program; if not, write to the Free Software
17#   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18#   02110-1301, USA.
19
20# determine value of HAVE_LOWLEVEL_SCSI_INTERFACE
21
22if(${scsi-crypto})
23
24  # LINUX: check if HAVE_SCSI_SG_H and HAVE_SCSI_SCSI_H are true
25  if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
26    if("${HAVE_SCSI_SG_H}" AND "${HAVE_SCSI_SCSI_H}")
27      set(HAVE_LOWLEVEL_SCSI_INTERFACE 1)
28    else()
29      set(HAVE_LOWLEVEL_SCSI_INTERFACE 0)
30      message(
31        FATAL_ERROR
32          "scsi crypto support selected but required headers are missing"
33      )
34    endif()
35  endif()
36
37  # SUN: check if HAVE_SYS_SCSI_IMPL_USCSI_H
38  if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
39    if("${HAVE_SYS_SCSI_IMPL_USCSI_H}")
40      set(HAVE_LOWLEVEL_SCSI_INTERFACE 1)
41    else()
42      set(HAVE_LOWLEVEL_SCSI_INTERFACE 0)
43      message(
44        FATAL_ERROR
45          "scsi crypto support selected but required headers are missing"
46      )
47    endif()
48  endif()
49
50  # FREEBSD: HAVE_CAMLIB_H and HAVE_CAM_SCSI_SCSI_MESSAGE_H also add
51  # CAM_LIBS="-lcam"
52  if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
53    if("${HAVE_CAMLIB_H}" AND "${HAVE_CAM_SCSI_SCSI_MESSAGE_H}")
54      set(HAVE_LOWLEVEL_SCSI_INTERFACE 1)
55      set(CAM_LIBRARIES cam)
56    else()
57      set(HAVE_LOWLEVEL_SCSI_INTERFACE 0)
58      message(
59        FATAL_ERROR
60          "scsi crypto support selected but required headers are missing"
61      )
62    endif()
63  endif()
64
65  # NETBSD: HAVE_DEV_SCSIPI_SCSIPI_ALL_H
66  if(${CMAKE_SYSTEM_NAME} MATCHES "NetBSD")
67    if("${HAVE_DEV_SCSIPI_SCSIPI_ALL_H}")
68      set(HAVE_LOWLEVEL_SCSI_INTERFACE 1)
69    else()
70      set(HAVE_LOWLEVEL_SCSI_INTERFACE 0)
71      message(
72        FATAL_ERROR
73          "scsi crypto support selected but required headers are missing"
74      )
75    endif()
76  endif()
77
78  # OPENBSD: HAVE_USCSI_ALL_H
79  if(${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
80    if("${HAVE_USCSI_ALL_H}")
81      set(HAVE_LOWLEVEL_SCSI_INTERFACE 1)
82    else()
83      set(HAVE_LOWLEVEL_SCSI_INTERFACE 0)
84      message(
85        FATAL_ERROR
86          "scsi crypto support selected but required headers are missing"
87      )
88    endif()
89  endif()
90
91endif()
92