Warning, /libraries/phonon/cmake/FindAlsa.cmake is written in an unsupported language. File is not indexed.

0001 # Alsa check, based on libkmid/configure.in.in.
0002 # 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)
0003 # It defines ...
0004 # It offers the following macros:
0005 #  ALSA_CONFIGURE_FILE(config_header) - generate a config.h, typical usage: 
0006 #                                       ALSA_CONFIGURE_FILE(${CMAKE_BINARY_DIR}/config-alsa.h)
0007 #  ALSA_VERSION_STRING(version_string)  looks for alsa/version.h and reads the version string into
0008 #                                       the first argument passed to the macro
0009 
0010 # Copyright (c) 2006, David Faure, <faure@kde.org>
0011 # Copyright (c) 2007, Matthias Kretz <kretz@kde.org>
0012 #
0013 # Redistribution and use is allowed according to the terms of the BSD license.
0014 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
0015 
0016 include(CheckIncludeFiles)
0017 include(CheckIncludeFileCXX)
0018 include(CheckLibraryExists)
0019 
0020 # Already done by toplevel
0021 find_library(ASOUND_LIBRARY asound)
0022 set(ASOUND_LIBRARY_DIR "")
0023 if(ASOUND_LIBRARY)
0024    get_filename_component(ASOUND_LIBRARY_DIR ${ASOUND_LIBRARY} PATH)
0025 endif(ASOUND_LIBRARY)
0026 
0027 check_library_exists(asound snd_seq_create_simple_port "${ASOUND_LIBRARY_DIR}" HAVE_LIBASOUND2)
0028 if(HAVE_LIBASOUND2)
0029     message(STATUS "Found ALSA: ${ASOUND_LIBRARY}")
0030 else(HAVE_LIBASOUND2)
0031     message(STATUS "ALSA not found")
0032 endif(HAVE_LIBASOUND2)
0033 set(ALSA_FOUND ${HAVE_LIBASOUND2})
0034 
0035 find_path(ALSA_INCLUDES alsa/version.h)
0036 
0037 macro(ALSA_VERSION_STRING _result)
0038     # check for version in alsa/version.h
0039     if(ALSA_INCLUDES)
0040         file(READ "${ALSA_INCLUDES}/alsa/version.h" _ALSA_VERSION_CONTENT)
0041         string(REGEX REPLACE ".*SND_LIB_VERSION_STR.*\"(.*)\".*" "\\1" ${_result} ${_ALSA_VERSION_CONTENT})
0042     else(ALSA_INCLUDES)
0043         message(STATUS "ALSA version not known. ALSA output will probably not work correctly.")
0044     endif(ALSA_INCLUDES)
0045 endmacro(ALSA_VERSION_STRING _result)
0046 
0047 
0048 get_filename_component(_FIND_ALSA_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH)
0049 macro(ALSA_CONFIGURE_FILE _destFile)
0050     check_include_files(sys/soundcard.h HAVE_SYS_SOUNDCARD_H)
0051     check_include_files(machine/soundcard.h HAVE_MACHINE_SOUNDCARD_H)
0052 
0053     check_include_files(linux/awe_voice.h HAVE_LINUX_AWE_VOICE_H)
0054     check_include_files(awe_voice.h HAVE_AWE_VOICE_H)
0055     check_include_files(/usr/src/sys/i386/isa/sound/awe_voice.h HAVE__USR_SRC_SYS_I386_ISA_SOUND_AWE_VOICE_H)
0056     check_include_files(/usr/src/sys/gnu/i386/isa/sound/awe_voice.h HAVE__USR_SRC_SYS_GNU_I386_ISA_SOUND_AWE_VOICE_H)
0057 
0058     check_include_file_cxx(sys/asoundlib.h HAVE_SYS_ASOUNDLIB_H)
0059     check_include_file_cxx(alsa/asoundlib.h HAVE_ALSA_ASOUNDLIB_H)
0060 
0061     check_library_exists(asound snd_pcm_resume "${ASOUND_LIBRARY_DIR}" ASOUND_HAS_SND_PCM_RESUME)
0062     if(ASOUND_HAS_SND_PCM_RESUME)
0063         set(HAVE_SND_PCM_RESUME 1)
0064     endif(ASOUND_HAS_SND_PCM_RESUME)
0065 
0066     configure_file(${_FIND_ALSA_MODULE_DIR}/config-alsa.h.cmake ${_destFile})
0067 endmacro(ALSA_CONFIGURE_FILE _destFile)
0068 
0069 mark_as_advanced(ALSA_INCLUDES ASOUND_LIBRARY)