1# Alsa check, based on libkmid/configure.in.in. 2# 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) 3# It defines ... 4# It offers the following macros: 5# ALSA_CONFIGURE_FILE(config_header) - generate a config.h, typical usage: 6# ALSA_CONFIGURE_FILE(${CMAKE_BINARY_DIR}/config-alsa.h) 7# ALSA_VERSION_STRING(version_string) looks for alsa/version.h and reads the version string into 8# the first argument passed to the macro 9 10# Copyright (c) 2006, David Faure, <faure@kde.org> 11# Copyright (c) 2007, Matthias Kretz <kretz@kde.org> 12# 13# Redistribution and use is allowed according to the terms of the BSD license. 14# For details see the accompanying COPYING-CMAKE-SCRIPTS file. 15 16include(CheckIncludeFiles) 17include(CheckIncludeFileCXX) 18include(CheckLibraryExists) 19 20# Already done by toplevel 21FIND_LIBRARY(ASOUND_LIBRARY asound) 22check_library_exists(asound snd_seq_create_simple_port ${ASOUND_LIBRARY} HAVE_LIBASOUND2) 23if(HAVE_LIBASOUND2) 24 message(STATUS "Found ALSA: ${ASOUND_LIBRARY}") 25 set(ALSA_FOUND HAVE_LIBASOUND2) 26else(HAVE_LIBASOUND2) 27 message(STATUS "ALSA not found") 28endif(HAVE_LIBASOUND2) 29 30 31MACRO(ALSA_VERSION_STRING _result) 32 # check for version in alsa/version.h 33 FIND_PATH(_ALSA_INCLUDE_DIR alsa/version.h) 34 IF(_ALSA_INCLUDE_DIR) 35 FILE(READ "${_ALSA_INCLUDE_DIR}/alsa/version.h" _ALSA_VERSION_CONTENT) 36 STRING(REGEX REPLACE ".*SND_LIB_VERSION_STR.*\"(.*)\".*" "\\1" ${_result} ${_ALSA_VERSION_CONTENT}) 37 ELSE(_ALSA_INCLUDE_DIR) 38 MESSAGE(STATUS "ALSA version not known. ALSA output will probably not work correctly.") 39 ENDIF(_ALSA_INCLUDE_DIR) 40ENDMACRO(ALSA_VERSION_STRING _result) 41 42get_filename_component(_FIND_ALSA_MODULE_DIR ${CMAKE_CURRENT_LIST_FILE} PATH) 43macro(ALSA_CONFIGURE_FILE _destFile) 44 check_include_files(sys/soundcard.h HAVE_SYS_SOUNDCARD_H) 45 check_include_files(machine/soundcard.h HAVE_MACHINE_SOUNDCARD_H) 46 47 check_include_files(linux/awe_voice.h HAVE_LINUX_AWE_VOICE_H) 48 check_include_files(awe_voice.h HAVE_AWE_VOICE_H) 49 check_include_files(/usr/src/sys/i386/isa/sound/awe_voice.h HAVE__USR_SRC_SYS_I386_ISA_SOUND_AWE_VOICE_H) 50 check_include_files(/usr/src/sys/gnu/i386/isa/sound/awe_voice.h HAVE__USR_SRC_SYS_GNU_I386_ISA_SOUND_AWE_VOICE_H) 51 52 check_include_file_cxx(sys/asoundlib.h HAVE_SYS_ASOUNDLIB_H) 53 check_include_file_cxx(alsa/asoundlib.h HAVE_ALSA_ASOUNDLIB_H) 54 55 check_library_exists(asound snd_pcm_resume ${ASOUND_LIBRARY} ASOUND_HAS_SND_PCM_RESUME) 56 if(ASOUND_HAS_SND_PCM_RESUME) 57 set(HAVE_SND_PCM_RESUME 1) 58 endif(ASOUND_HAS_SND_PCM_RESUME) 59 60 # configure_file(${_FIND_ALSA_MODULE_DIR}/config-alsa.h.cmake ${_destFile}) 61endmacro(ALSA_CONFIGURE_FILE _destFile) 62