Changed launcher to not have S3D_SERVER #defined to allow visible dialog messages
[scorched3d.git] / configure-al.m4
blob74510bc9c50fe9cf52162e8383684074e3f45c23
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/])
17 else
19         if test x"$use_static_openal" = x"yes"; then
20                 AL_LIBS="/usr/local/lib/libopenal.a"
21         else
22                 AL_LIBS="`$OPENAL_CONFIG --libs`"
23         fi
24         
25         AL_CFLAGS="`$OPENAL_CONFIG --cflags`"
27         AC_MSG_RESULT(yes)
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."
38 else
40         AL_LIBS="$AL_LIBS `$FREEALUT_CONFIG --libs`"
41         AL_CFLAGS="$AL_CFLAGS `$FREEALUT_CONFIG --cflags`"
43         AC_MSG_RESULT(yes)
46 AC_MSG_CHECKING(for OpenAL compilation)
47 if test "x$enable_openaltest" = "xyes" ; then
49         ac_save_CFLAGS="$CFLAGS"
50         ac_save_LIBS="$LIBS"
51         CFLAGS="$CFLAGS $AL_CFLAGS"
52         LIBS="$AL_LIBS $LIBS"
54         AC_TRY_COMPILE([
55 #ifdef __APPLE__
56                 #include <OpenAL/al.h>
57                 #include <OpenAL/alut.h>
58                 #include <OpenAL/alc.h>
59 #else
60                 #include <AL/al.h>
61                 #include <AL/alut.h>
62                 #include <AL/alc.h>
63 #endif
65                 ],[
66                 ],[
67                 have_openal=yes 
68                 ],[
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.])
72         ])
74         AC_TRY_LINK([
75 #ifdef __APPLE__
76                 #include <OpenAL/al.h>
77                 #include <OpenAL/alut.h>
78                 #include <OpenAL/alc.h>
79 #else
80                 #include <AL/al.h>
81                 #include <AL/alut.h>
82                 #include <AL/alc.h>
83 #endif
85                 int main(int argc, char *argv[])
86                 {
87                         alutInit(argc, argv);
88                         return 0;
89                 }
90 #undef  main
91 #define main K_and_R_C_main
93                 ],[
94                 ],[
95                 have_openal=yes 
96                 ],[
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.])
101         ])
103         CFLAGS="$ac_save_CFLAGS"
104         LIBS="$ac_save_LIBS"
106         AC_MSG_RESULT(yes)
109 AC_SUBST(AL_CFLAGS)
110 AC_SUBST(AL_LIBS)