Use the pkg-config file when checking for sndio.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
diff --git a/cmake/sdlchecks.cmake b/cmake/sdlchecks.cmake
index 040029d..0043ed6 100644
--- a/cmake/sdlchecks.cmake
+++ b/cmake/sdlchecks.cmake
@@ -293,16 +293,14 @@ macro(CheckNAS)
endmacro()
# Requires:
-# - n/a
+# - PkgCheckModules
# Optional:
# - SDL_SNDIO_SHARED opt
# - HAVE_SDL_LOADSO opt
macro(CheckSNDIO)
if(SDL_SNDIO)
- # TODO: set include paths properly, so the sndio headers are found
- check_include_file(sndio.h HAVE_SNDIO_H)
- find_library(D_SNDIO_LIB sndio)
- if(HAVE_SNDIO_H AND D_SNDIO_LIB)
+ pkg_check_modules(PKG_SNDIO sndio)
+ if(PKG_SNDIO_FOUND)
set(HAVE_SNDIO TRUE)
file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c)
list(APPEND SOURCE_FILES ${SNDIO_SOURCES})
diff --git a/configure.ac b/configure.ac
index 42ae7ab..61f0104 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1288,20 +1288,9 @@ CheckSNDIO()
[AS_HELP_STRING([--enable-sndio], [support the sndio audio API [default=yes]])],
, enable_sndio=yes)
if test x$enable_audio = xyes -a x$enable_sndio = xyes; then
- AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes)
- AC_CHECK_LIB(sndio, sio_open, have_sndio_lib=yes)
+ PKG_CHECK_MODULES([SNDIO], [sndio], audio_sndio=yes, audio_sndio=no)
- AC_MSG_CHECKING(for sndio audio support)
- 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
+ if test x$audio_sndio = xyes; then
AC_ARG_ENABLE(sndio-shared,
[AS_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [default=yes]])],
, enable_sndio_shared=yes)