[channesl,oss] fix OSS detection

* generate a include header depending on where the soundcard.h file was
  found as that is in system paths that must not be added to the include
  search paths.
* fix detection, the if/else was mixed up and completely broken.
This commit is contained in:
akallabeth 2024-03-19 09:48:24 +01:00 committed by akallabeth
parent 1bf3f5335e
commit 15cf6b26b1
6 changed files with 39 additions and 31 deletions

View File

@ -30,7 +30,12 @@ set(${MODULE_PREFIX}_LIBS
)
include_directories(..)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${OSS_INCLUDE_DIRS})
configure_file(
${CMAKE_SOURCE_DIR}/cmake/oss-includes.h.in
${CMAKE_CURRENT_BINARY_DIR}/oss-includes.h
@ONLY
)
add_channel_client_subsystem_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} "" TRUE "")

View File

@ -37,11 +37,7 @@
#include <libgen.h>
#include <limits.h>
#include <unistd.h>
#if defined(__OpenBSD__)
#include <soundcard.h>
#else
#include <sys/soundcard.h>
#endif
#include <oss-includes.h>
#include <sys/ioctl.h>
#include <freerdp/freerdp.h>

View File

@ -30,6 +30,12 @@ set(${MODULE_PREFIX}_LIBS
)
include_directories(..)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
include_directories(${OSS_INCLUDE_DIRS})
configure_file(
${CMAKE_SOURCE_DIR}/cmake/oss-includes.h.in
${CMAKE_CURRENT_BINARY_DIR}/oss-includes.h
@ONLY
)
add_channel_client_subsystem_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} "" TRUE "")

View File

@ -37,11 +37,7 @@
#include <libgen.h>
#include <limits.h>
#include <unistd.h>
#if defined(__OpenBSD__)
#include <soundcard.h>
#else
#include <sys/soundcard.h>
#endif
#include <oss-includes.h>
#include <sys/ioctl.h>
#include <freerdp/types.h>

View File

@ -4,29 +4,27 @@
IF(UNIX)
IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(OSS_HDR_NAME "linux/soundcard.h")
ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux")
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
SET(OSS_HDR_NAME "sys/soundcard.h")
ELSE(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
IF(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
SET(OSS_HDR_NAME "soundcard.h")
ELSE(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
SET(OSS_HDR_NAME "machine/soundcard.h")
ENDIF(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux")
set(PLATFORM_PREFIX "linux/")
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
set(PLATFORM_PREFIX "sys/")
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
set(PLATFORM_PREFIX "machine/")
ENDIF(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
ENDIF(UNIX)
FIND_PATH(OSS_INCLUDE_DIR "${OSS_HDR_NAME}"
"/usr/include" "/usr/local/include"
set(OSS_HDR_NAME "${PLATFORM_PREFIX}soundcard.h" CACHE STRING "oss header include file name")
FIND_PATH(OSS_INCLUDE_DIRS ${OSS_HDR_NAME}
PATHS
"/usr/local/include"
PATH_SUFFIXES
${PLATFORM_SUFFIX}
)
IF(OSS_INCLUDE_DIR)
SET(OSS_FOUND TRUE)
ELSE(OSS_INCLUDE_DIR)
SET(OSS_FOUND)
ENDIF(OSS_INCLUDE_DIR)
IF(OSS_INCLUDE_DIRS)
SET(OSS_FOUND ON CACHE BOOL "oss detection status")
ELSE(OSS_INCLUDE_DIRS)
SET(OSS_FOUND OFF CACHE BOOL "oss detection status")
ENDIF(OSS_INCLUDE_DIRS)
IF(OSS_FOUND)
MESSAGE(STATUS "Found OSS Audio")
@ -40,5 +38,6 @@ ENDIF(OSS_FOUND)
MARK_AS_ADVANCED (
OSS_FOUND
OSS_INCLUDE_DIR
OSS_HDR_NAME
OSS_INCLUDE_DIRS
)

6
cmake/oss-includes.h.in Normal file
View File

@ -0,0 +1,6 @@
#ifndef OSS_INCLUDES_H_
#define OSS_INCLUDES_H_
#include <@OSS_HDR_NAME@>
#endif /* OSS_INCLUDES_H_ */