Use the pkg-config file when checking for sndio.

This commit is contained in:
Brad Smith 2022-09-29 20:31:20 -04:00 committed by Sam Lantinga
parent fc720321b3
commit f48823181b
2 changed files with 5 additions and 18 deletions

View File

@ -293,16 +293,14 @@ macro(CheckNAS)
endmacro() endmacro()
# Requires: # Requires:
# - n/a # - PkgCheckModules
# Optional: # Optional:
# - SDL_SNDIO_SHARED opt # - SDL_SNDIO_SHARED opt
# - HAVE_SDL_LOADSO opt # - HAVE_SDL_LOADSO opt
macro(CheckSNDIO) macro(CheckSNDIO)
if(SDL_SNDIO) if(SDL_SNDIO)
# TODO: set include paths properly, so the sndio headers are found pkg_check_modules(PKG_SNDIO sndio)
check_include_file(sndio.h HAVE_SNDIO_H) if(PKG_SNDIO_FOUND)
find_library(D_SNDIO_LIB sndio)
if(HAVE_SNDIO_H AND D_SNDIO_LIB)
set(HAVE_SNDIO TRUE) set(HAVE_SNDIO TRUE)
file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c) file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c)
list(APPEND SOURCE_FILES ${SNDIO_SOURCES}) list(APPEND SOURCE_FILES ${SNDIO_SOURCES})

View File

@ -1288,20 +1288,9 @@ CheckSNDIO()
[AS_HELP_STRING([--enable-sndio], [support the sndio audio API [default=yes]])], [AS_HELP_STRING([--enable-sndio], [support the sndio audio API [default=yes]])],
, enable_sndio=yes) , enable_sndio=yes)
if test x$enable_audio = xyes -a x$enable_sndio = xyes; then if test x$enable_audio = xyes -a x$enable_sndio = xyes; then
AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes) PKG_CHECK_MODULES([SNDIO], [sndio], audio_sndio=yes, audio_sndio=no)
AC_CHECK_LIB(sndio, sio_open, have_sndio_lib=yes)
AC_MSG_CHECKING(for sndio audio support) if test x$audio_sndio = xyes; then
have_sndio=no
if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then
have_sndio=yes
SNDIO_LIBS="-lsndio"
fi
AC_MSG_RESULT($have_sndio)
if test x$have_sndio = xyes; then
AC_ARG_ENABLE(sndio-shared, AC_ARG_ENABLE(sndio-shared,
[AS_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [default=yes]])], [AS_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [default=yes]])],
, enable_sndio_shared=yes) , enable_sndio_shared=yes)