OpenAL <1.15: check some additional include directories

OpenAL's pkg-config database doesn't list include/AL as a location for
AL headers, but including <AL/al.h> is unusable because some systems
store the headers in OpenAL instead of AL. So check if the file can
actually be found as <al.h> and amend the include directory list
otherwise.
issue1247
Nicolas Hake 2015-01-19 12:50:54 +01:00
parent 9759f72b89
commit bc7fcf5daa
1 changed files with 17 additions and 1 deletions

View File

@ -1,6 +1,6 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2009-2014, The OpenClonk Team and contributors
# Copyright (c) 2009-2015, The OpenClonk Team and contributors
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
@ -17,6 +17,22 @@ macro(__FINDAUDIO_FINDOPENAL)
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND AND NOT(APPLE))
pkg_check_modules(OpenAL "openal>=1.13")
# OpenAL pkg-config data before 1.15 doesn't have .../AL in the include
# path. But we don't want to have to specify <AL/al.h> because some
# systems use <OpenAL/al.h>. So let's see if we find al.h in the list
# of directories that pkg_check_modules returned, and if not, add it to
# the include path.
if (OpenAL_FOUND)
find_path(__findaudio_al_h NAMES al.h PATHS ${OpenAL_INCLUDE_DIRS})
if (NOT __findaudio_al_h)
find_path(__findaudio_al_h NAMES al.h PATHS ${OpenAL_INCLUDE_DIRS} PATH_SUFFIXES OpenAL AL)
if (__findaudio_al_h)
list(APPEND __findaudio_al_h ${OpenAL_INCLUDE_DIRS})
set(OpenAL_INCLUDE_DIRS "${__findaudio_al_h}" CACHE INTERNAL "")
endif()
endif()
endif()
pkg_check_modules(Alut "freealut>=1.1.0")
pkg_check_modules(OggVorbis "vorbisfile>=1.3.2" "vorbis>=1.3.2" "ogg>=1.2.2")
else()