cmake: make sure check_c_source_compiles uses 2 different variables in CheckOSS

main
Anonymous Maarten 2022-09-27 01:52:28 +02:00 committed by Ozkan Sezer
parent bfecd78159
commit a9524ffa9d
1 changed files with 5 additions and 7 deletions

View File

@ -56,21 +56,19 @@ endmacro()
# - n/a # - n/a
macro(CheckOSS) macro(CheckOSS)
if(SDL_OSS) if(SDL_OSS)
set(OSS_HEADER_FILE "sys/soundcard.h")
check_c_source_compiles(" check_c_source_compiles("
#include <sys/soundcard.h> #include <sys/soundcard.h>
int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" OSS_FOUND) int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" HAVE_OSS_SYS_SOUNDCARD_H)
if(NOT OSS_FOUND) if(NOT HAVE_OSS_SYS_SOUNDCARD_H)
set(OSS_HEADER_FILE "soundcard.h")
check_c_source_compiles(" check_c_source_compiles("
#include <soundcard.h> #include <soundcard.h>
int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" OSS_FOUND) int main(int argc, char **argv) { int arg = SNDCTL_DSP_SETFRAGMENT; return 0; }" HAVE_OSS_SOUNDCARD_H)
endif() endif()
if(OSS_FOUND) if(HAVE_OSS_SYS_SOUNDCARD_H OR HAVE_OSS_SOUNDCARD_H)
set(HAVE_OSS TRUE) set(HAVE_OSS TRUE)
file(GLOB OSS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dsp/*.c) file(GLOB OSS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/dsp/*.c)
if(OSS_HEADER_FILE STREQUAL "soundcard.h") if(HAVE_OSS_SOUNDCARD_H)
set(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1) set(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H 1)
endif() endif()
set(SDL_AUDIO_DRIVER_OSS 1) set(SDL_AUDIO_DRIVER_OSS 1)