1 dnl Checking for OpenAL
2 AC_ARG_WITH([openal-static],
3 AC_HELP_STRING([--with-openal-static],
4 [enable static linking for openal (default no)]),
5 [use_static_openal=${withval}],,)
6 AC_ARG_ENABLE(openaltest,
7 [ --disable-openaltest Do not try to compile and run a test OpenAL program],
8 , enable_openaltest=yes)
9 AC_MSG_CHECKING(for OpenAL support)
10 AC_PATH_PROG(OPENAL_CONFIG, openal-config, no)
11 if test x$OPENAL_CONFIG = xno; then
12 echo "*** The openal-config script installed by OpenAL could not be found"
13 echo "*** Make sure openal-config is in your path, or set the OPENAL_CONFIG"
14 echo "*** environment variable to the full path to openal-config."
16 AC_MSG_ERROR([*** Can't find the openal library. Try: http://www.openal.org/])
19 if test x"$use_static_openal" = x"yes"; then
20 AL_LIBS="/usr/local/lib/libopenal.a"
22 AL_LIBS="`$OPENAL_CONFIG --libs`"
25 AL_CFLAGS="`$OPENAL_CONFIG --cflags`"
30 AC_MSG_CHECKING(for Freealut support)
31 AC_PATH_PROG(FREEALUT_CONFIG, freealut-config, no)
32 if test x$FREEALUT_CONFIG = xno; then
33 echo "*** Warning: The freealut-config script installed by OpenAL could not be found."
34 echo "*** The alut library is required, however some older OpenAL distribitions may include it."
35 echo "*** If Scorched3D fails to link check alut is in the link line."
36 echo "*** Alternatively, make sure freealut-config is in your path, or set the FREEALUT_CONFIG"
37 echo "*** environment variable to the full path to openal-config."
40 AL_LIBS="$AL_LIBS `$FREEALUT_CONFIG --libs`"
41 AL_CFLAGS="$AL_CFLAGS `$FREEALUT_CONFIG --cflags`"
46 AC_MSG_CHECKING(for OpenAL compilation)
47 if test "x$enable_openaltest" = "xyes" ; then
49 ac_save_CFLAGS="$CFLAGS"
51 CFLAGS="$CFLAGS $AL_CFLAGS"
56 #include <OpenAL/al.h>
57 #include <OpenAL/alut.h>
58 #include <OpenAL/alc.h>
69 echo "*** Failed to compile using the OpenAL library."
70 echo "*** CFLAGS = $AL_CFLAGS";
71 AC_MSG_ERROR([*** Check the OpenAL library is correctly installed.])
76 #include <OpenAL/al.h>
77 #include <OpenAL/alut.h>
78 #include <OpenAL/alc.h>
85 int main(int argc, char *argv[])
91 #define main K_and_R_C_main
97 echo "*** Compiled but failed to link using the OpenAL library."
98 echo "*** LIBS = $AL_LIBS";
99 echo "*** Check the OpenAL library is on the LD_LIBRARY_PATH";
100 AC_MSG_ERROR([*** Check the OpenAL library is correctly installed.])
103 CFLAGS="$ac_save_CFLAGS"