[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [libkcompactdisc] /: Use FindALSA provided by cmake
From:       Heiko Becker <null () kde ! org>
Date:       2016-12-31 13:10:31
Message-ID: E1cNJQd-0002G5-Ao () code ! kde ! org
[Download RAW message or body]

Git commit 0ab138b6ba876a2f6ed0c64aeaad08bb1e369dd4 by Heiko Becker.
Committed on 29/12/2016 at 17:16.
Pushed by heikobecker into branch 'master'.

Use FindALSA provided by cmake

Summary:
...instead of using a copy from KDELibs4Supprt. It has been included
since cmake-2.8.0.

Furthermore drop the special casing for <sys/asoundlib.h> which has
been deprecated since 2001, according to [1].

[1] http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=6157018e8ad7179271791f960570db79b23a481d


Differential Revision: https://phabricator.kde.org/D3862

D  +0    -69   cmake/FindAlsa.cmake
D  +0    -34   cmake/config-alsa.h.cmake
M  +11   -5    src/CMakeLists.txt
A  +1    -0    src/config-alsa.h.cmake
M  +1    -1    src/kcompactdisc.cpp
M  +2    -2    src/wmlib/audio/audio.c
M  +3    -8    src/wmlib/audio/audio_alsa.c

https://commits.kde.org/libkcompactdisc/0ab138b6ba876a2f6ed0c64aeaad08bb1e369dd4

diff --git a/cmake/FindAlsa.cmake b/cmake/FindAlsa.cmake
deleted file mode 100644
index 9a619d8..0000000
--- a/cmake/FindAlsa.cmake
+++ /dev/null
@@ -1,69 +0,0 @@
-# Alsa check, based on libkmid/configure.in.in.
-# Only the support for Alsa >= 0.9.x was included; 0.5.x was dropped (but feel free \
                to re-add it if you need it)
-# It defines ...
-# It offers the following macros:
-#  ALSA_CONFIGURE_FILE(config_header) - generate a config.h, typical usage:
-#                                       \
                ALSA_CONFIGURE_FILE(${CMAKE_BINARY_DIR}/config-alsa.h)
-#  ALSA_VERSION_STRING(version_string)  looks for alsa/version.h and reads the \
                version string into
-#                                       the first argument passed to the macro
-
-# Copyright (c) 2006, David Faure, <faure@kde.org>
-# Copyright (c) 2007, Matthias Kretz <kretz@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-include(CheckIncludeFiles)
-include(CheckIncludeFileCXX)
-include(CheckLibraryExists)
-
-# Already done by toplevel
-find_library(ASOUND_LIBRARY asound)
-set(ASOUND_LIBRARY_DIR "")
-if(ASOUND_LIBRARY)
-   get_filename_component(ASOUND_LIBRARY_DIR ${ASOUND_LIBRARY} PATH)
-endif(ASOUND_LIBRARY)
-
-check_library_exists(asound snd_seq_create_simple_port "${ASOUND_LIBRARY_DIR}" \
                HAVE_LIBASOUND2)
-if(HAVE_LIBASOUND2)
-    message(STATUS "Found ALSA: ${ASOUND_LIBRARY}")
-else(HAVE_LIBASOUND2)
-    message(STATUS "ALSA not found")
-endif(HAVE_LIBASOUND2)
-set(ALSA_FOUND ${HAVE_LIBASOUND2})
-
-find_path(ALSA_INCLUDES alsa/version.h)
-
-macro(ALSA_VERSION_STRING _result)
-    # check for version in alsa/version.h
-    if(ALSA_INCLUDES)
-        file(READ "${ALSA_INCLUDES}/alsa/version.h" _ALSA_VERSION_CONTENT)
-        string(REGEX REPLACE ".*SND_LIB_VERSION_STR.*\"(.*)\".*" "\\1" ${_result} \
                "${_ALSA_VERSION_CONTENT}")
-    else(ALSA_INCLUDES)
-        message(STATUS "ALSA version not known. ALSA output will probably not work \
                correctly.")
-    endif(ALSA_INCLUDES)
-endmacro(ALSA_VERSION_STRING _result)
-
-
-get_filename_component(_FIND_ALSA_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
-macro(ALSA_CONFIGURE_FILE _destFile)
-    check_include_files(sys/soundcard.h HAVE_SYS_SOUNDCARD_H)
-    check_include_files(machine/soundcard.h HAVE_MACHINE_SOUNDCARD_H)
-
-    check_include_files(linux/awe_voice.h HAVE_LINUX_AWE_VOICE_H)
-    check_include_files(awe_voice.h HAVE_AWE_VOICE_H)
-    check_include_files(/usr/src/sys/i386/isa/sound/awe_voice.h \
                HAVE__USR_SRC_SYS_I386_ISA_SOUND_AWE_VOICE_H)
-    check_include_files(/usr/src/sys/gnu/i386/isa/sound/awe_voice.h \
                HAVE__USR_SRC_SYS_GNU_I386_ISA_SOUND_AWE_VOICE_H)
-
-    check_include_file_cxx(sys/asoundlib.h HAVE_SYS_ASOUNDLIB_H)
-    check_include_file_cxx(alsa/asoundlib.h HAVE_ALSA_ASOUNDLIB_H)
-
-    check_library_exists(asound snd_pcm_resume "${ASOUND_LIBRARY_DIR}" \
                ASOUND_HAS_SND_PCM_RESUME)
-    if(ASOUND_HAS_SND_PCM_RESUME)
-        set(HAVE_SND_PCM_RESUME 1)
-    endif(ASOUND_HAS_SND_PCM_RESUME)
-
-    configure_file(${_FIND_ALSA_MODULE_DIR}/config-alsa.h.cmake ${_destFile})
-endmacro(ALSA_CONFIGURE_FILE _destFile)
-
-mark_as_advanced(ALSA_INCLUDES ASOUND_LIBRARY)
diff --git a/cmake/config-alsa.h.cmake b/cmake/config-alsa.h.cmake
deleted file mode 100644
index 10da94d..0000000
--- a/cmake/config-alsa.h.cmake
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Define to 1 if you have the <linux/awe_voice.h> header file. */
-#cmakedefine01 HAVE_LINUX_AWE_VOICE_H
-
-/* Define to 1 if you have the <sys/awe_voice.h> header file. */
-#cmakedefine01 HAVE_SYS_AWE_VOICE_H
-
-/* Define to 1 if you have the </usr/src/sys/gnu/i386/isa/sound/awe_voice.h>
-   header file. */
-#cmakedefine01 HAVE__USR_SRC_SYS_GNU_I386_ISA_SOUND_AWE_VOICE_H
-
-/* Define to 1 if you have the </usr/src/sys/i386/isa/sound/awe_voice.h>
-   header file. */
-#cmakedefine01 HAVE__USR_SRC_SYS_I386_ISA_SOUND_AWE_VOICE_H
-
-/* Define to 1 if you have the <awe_voice.h> header file. */
-#cmakedefine01 HAVE_AWE_VOICE_H
-
-/* Define if you have libasound.so.2 (required for ALSA 0.9.x support) */
-#cmakedefine01 HAVE_LIBASOUND2
-
-/* Define if libasound has snd_pcm_resume() */
-#cmakedefine01 HAVE_SND_PCM_RESUME
-
-/* Define to 1 if you have the <alsa/asoundlib.h> header file. */
-#cmakedefine01 HAVE_ALSA_ASOUNDLIB_H
-
-/* Define to 1 if you have the <sys/asoundlib.h> header file. */
-#cmakedefine01 HAVE_SYS_ASOUNDLIB_H
-
-/* Define to 1 if you have the <sys/soundcard.h> header file. */
-#cmakedefine01 HAVE_SYS_SOUNDCARD_H
-
-/* Define to 1 if you have the <machine/soundcard.h> header file. */
-#cmakedefine01 HAVE_MACHINE_SOUNDCARD_H
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ed35fb8..26632cd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -6,8 +6,14 @@ if(CMAKE_COMPILER_IS_GNUCXX)
     set(CMAKE_C_FLAGS "-std=c99")   ## ALSA no longer compiles with -std=c90, see \
https://bugzilla.novell.com/show_bug.cgi?id=817077  endif()
 
-find_package(Alsa)
-alsa_configure_file(${CMAKE_CURRENT_BINARY_DIR}/config-alsa.h)
+find_package(ALSA)
+set_package_properties(ALSA PROPERTIES
+                       URL "http://www.alsa-project.org/"
+                       DESCRIPTION "ALSA provides audio and MIDI functionality"
+                       TYPE OPTIONAL
+                       PURPOSE "Play back audo CDs via ALSA")
+set(HAVE_ALSA ${ALSA_FOUND})
+configure_file(config-alsa.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-alsa.h)
 
 set(wmlib_audio_SRCS
         wmlib/audio/audio.c
@@ -73,9 +79,9 @@ target_link_libraries(KF5CompactDisc
     Phonon::phonon4qt5
 )
 
-if (HAVE_LIBASOUND2)
-    target_link_libraries(KF5CompactDisc ${ASOUND_LIBRARY})
-endif (HAVE_LIBASOUND2)
+if (HAVE_ALSA)
+    target_link_libraries(KF5CompactDisc ${ALSA_LIBRARY})
+endif ()
 
 if (USE_WMLIB)
     find_package(Threads)
diff --git a/src/config-alsa.h.cmake b/src/config-alsa.h.cmake
new file mode 100644
index 0000000..514e8d9
--- /dev/null
+++ b/src/config-alsa.h.cmake
@@ -0,0 +1 @@
+#cmakedefine HAVE_ALSA
diff --git a/src/kcompactdisc.cpp b/src/kcompactdisc.cpp
index ca278eb..437648f 100644
--- a/src/kcompactdisc.cpp
+++ b/src/kcompactdisc.cpp
@@ -128,7 +128,7 @@ const QStringList KCompactDisc::audioSystems()
     QStringList list;
 
     list << QLatin1String( "phonon" )
-#if defined(HAVE_LIBASOUND2)
+#if defined(HAVE_ALSA)
         << QLatin1String( "alsa" )
 #endif
 #if defined(sun) || defined(__sun__)
diff --git a/src/wmlib/audio/audio.c b/src/wmlib/audio/audio.c
index 09e817f..9ed7a82 100644
--- a/src/wmlib/audio/audio.c
+++ b/src/wmlib/audio/audio.c
@@ -19,7 +19,7 @@
 #include "audio.h"
 #include "../include/wm_config.h"
 
-#ifdef HAVE_LIBASOUND2
+#ifdef HAVE_ALSA
 #include <config-alsa.h>
 #endif
 #include <string.h>
@@ -43,7 +43,7 @@ struct audio_oops *setup_soundsystem(const char *ss, const char \
*dev, const char  if(!strcmp(ss, "arts"))
     return setup_arts(dev, ctl);
 #endif
-#if defined(HAVE_LIBASOUND2)
+#if defined(HAVE_ALSA)
   if(!strcmp(ss, "alsa"))
     return setup_alsa(dev, ctl);
 #endif
diff --git a/src/wmlib/audio/audio_alsa.c b/src/wmlib/audio/audio_alsa.c
index 7c14671..87bbca5 100644
--- a/src/wmlib/audio/audio_alsa.c
+++ b/src/wmlib/audio/audio_alsa.c
@@ -26,15 +26,10 @@
 #include "../include/wm_struct.h"
 #include "../include/wm_config.h"
 
-#ifdef HAVE_LIBASOUND2
+#ifdef HAVE_ALSA
 
 #include <config-alsa.h>
-
-#ifdef HAVE_ALSA_ASOUNDLIB_H
-#	include <alsa/asoundlib.h>
-#elif defined(HAVE_SYS_ASOUNDLIB_H)
-#	include <sys/asoundlib.h>
-#endif
+#include <alsa/asoundlib.h>
 
 static char *device = NULL;
 static snd_pcm_t *handle;
@@ -353,4 +348,4 @@ setup_alsa(const char *dev, const char *ctl)
   return &alsa_oops;
 }
 
-#endif /* HAVE_LIBASOUND2 */
+#endif /* HAVE_ALSA */


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic