Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/openal-0.0.8/configure.ac @ 17

Last change on this file since 17 was 17, checked in by landauf, 16 years ago

added openal

File size: 43.4 KB
Line 
1################################################################################
2# Process this file with autoconf to produce a configure script.
3################################################################################
4
5AC_INIT([OpenAL library], [0.0.8], [openal-devel@opensource.creative.com], [openal])
6AC_CONFIG_AUX_DIR([admin/autotools])
7AC_CANONICAL_TARGET
8AM_INIT_AUTOMAKE
9AC_PREREQ([2.56])
10AC_CONFIG_SRCDIR([AUTHORS])
11AC_CONFIG_HEADERS([config.h])
12
13# Compatibility hack for older autoconf versions
14m4_ifdef([AS_HELP_STRING], [], [AC_DEFUN([AS_HELP_STRING], [AC_HELP_STRING($][@)])])
15
16################################################################################
17# Checks for programs.
18################################################################################
19
20# We need ISO C99 features (e.g. snprintf) and POSIX IEEE Std 1003.1b-1993
21# features (e.g. struct timespec, used in <alsa/asoundlib.h>)
22AC_DEFINE([_ISOC99_SOURCE], [1], [Define to 1 if extensions to ISO C89 from ISO C99 are needed.])
23AC_DEFINE([_POSIX_C_SOURCE], [199309], [Define to the POSIX version that should be used.])
24
25AC_DEFINE([AL_BUILD_LIBRARY], [1], [Define to 1 if we are building the OpenAL library.])
26
27AC_PROG_CC
28AC_C_CONST
29ALUT_C__ATTRIBUTE__
30AC_EXEEXT
31AC_LIBTOOL_WIN32_DLL
32AC_PROG_LIBTOOL
33AC_SUBST([LIBTOOL_DEPS])
34AC_PROG_CXX
35AC_ARG_VAR([PKG_CONFIG], [package configuration utility])
36AC_CHECK_PROGS([PKG_CONFIG], [pkg-config], [none])
37
38################################################################################
39# Checks for library functions.
40################################################################################
41
42AC_CHECK_LIBM
43AC_SUBST([LIBM])
44
45ACX_PTHREAD(
46  [LIBS="$PTHREAD_LIBS $LIBS"
47   FEATURECFLAGS="$FEATURECFLAGS $PTHREAD_CFLAGS"
48   CC=$PTHREAD_CC
49   AC_DEFINE([USE_POSIXTHREADING], [1], [Define to 1 if POSIX threading should be used.])],
50  [AC_CHECK_HEADER([windows.h],
51    [AC_DEFINE([USE_WINDOWSTHREADING], [1], [Define to 1 if Windows threading should be used.])],
52    [AC_CHECK_HEADER([dos/dosextens.h],
53      [AC_DEFINE([USE_MORPHOSTHREADING], [1], [Define to 1 if MorphOS threading should be used.])],
54      [AC_DEFINE([NO_THREADING], [1], [undocumented])],
55      [AC_INCLUDES_DEFAULT([])])],
56    [AC_INCLUDES_DEFAULT([])])])
57
58################################################################################
59# Handle warning-related options.
60################################################################################
61
62AC_ARG_ENABLE([warnings],
63[AS_HELP_STRING([--enable-warnings],
64                [enable pedantic compiler warnings @<:@default=yes@:>@])])
65
66if test "x$enable_warnings" = xno; then
67  WARNINGCFLAGS=""
68else
69  # Doing it in two steps gives a nicer message...
70  AX_CFLAGS_WARN_ALL_ANSI([flags])
71  WARNINGCFLAGS=$flags
72fi
73
74AC_ARG_ENABLE([more-warnings],
75[AS_HELP_STRING([--enable-more-warnings],
76                [enable even more compiler warnings @<:@default=no@:>@])])
77
78if test "x$enable_more_warnings" = xyes; then
79  if test "x$enable_warnings" = xno; then
80    AC_MSG_WARN([--enable-more-warnings ignored because of --disable-warnings])
81  elif test "x$GCC" != xyes; then
82    AC_MSG_WARN([--enable-more-warnings ignored because no GCC was detected])
83  else
84    # The long list of warning options below contains every GCC warning option
85    # which is not automatically enabled with -Wall. The only exceptions to this
86    # rule are:
87    #
88    #    -Wpadded:
89    #      Perhaps good for optimizing out data layout, but not in general.
90    #
91    #    -Wconversion:
92    #      Passing e.g. float as an argument is fine, we always have prototypes.
93    #
94    #    -Wfloat-equal:
95    #       Often we should use an epsilon, but there are some correct uses,
96    #       too, so we leave it out for now. ToDo: Fix those warnings, anyway!
97    #
98    # Note that some older GCC versions give false positives about unreachable
99    # code. Furthermore, using GNU's <string.h> header normally results in lots
100    # of string functions like strcmp being macros which result in such false
101    # positives, too. To disable those, one can use -D__NO_STRING_INLINES for
102    # testing. And another source for false positives is inlining, so leaving
103    # out -finline-functions or using -fno-inline-functions explicitly might
104    # help, too.
105    WARNINGCFLAGS="$WARNINGCFLAGS -W -Waggregate-return -Wbad-function-cast -Wcast-align -Wcast-qual -Wdisabled-optimization -Wendif-labels -Winline -Wlong-long -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wpacked -Wpointer-arith -Wredundant-decls -Wshadow -Wsign-compare -Wstrict-prototypes -Wundef -Wunreachable-code -Wwrite-strings"
106
107    # Check for GCC 4.x-only warning options.
108    ALUT_CHECK_FLAG([-Wdeclaration-after-statement],
109                    [WARNINGCFLAGS="$WARNINGCFLAGS -Wdeclaration-after-statement"])
110    ALUT_CHECK_FLAG([-Winvalid-pch],
111                    [WARNINGCFLAGS="$WARNINGCFLAGS -Winvalid-pch"])
112    ALUT_CHECK_FLAG([-Wmissing-field-initializers],
113                    [WARNINGCFLAGS="$WARNINGCFLAGS -Wmissing-field-initializers"])
114    # We cheat here a bit: The code generated by AC_LANG_PROGRAM triggers a
115    # warning with -Wold-style-definition, so we assume that this flag is
116    # supported whenever -Wvariadic-macros is.
117    ALUT_CHECK_FLAG([-Wvariadic-macros],
118                    [WARNINGCFLAGS="$WARNINGCFLAGS -Wvariadic-macros -Wold-style-definition"])
119  fi
120fi
121
122AC_ARG_ENABLE([werror],
123[AS_HELP_STRING([--enable-werror],
124                [enable failure on all warnings @<:@default=no@:>@])])
125
126if test "x$enable_werror" = xyes; then
127  if test "x$enable_warnings" = xno; then
128    AC_MSG_WARN([--enable-werror ignored because of --disable-warnings])
129  elif test "x$GCC" != xyes; then
130    AC_MSG_WARN([--enable-werror ignored because no GCC was detected])
131  else
132    WARNINGCFLAGS="$WARNINGCFLAGS -Werror"
133  fi
134fi
135
136################################################################################
137# Handle debugging-related options.
138################################################################################
139
140AC_ARG_ENABLE([debug],
141[AS_HELP_STRING([--enable-debug],
142                [enable debug code and assertions @<:@default=no@:>@])])
143
144if test "x$enable_debug" = xyes; then
145  AC_DEFINE([DEBUG], [1], [Define to 1 if you want to include debugging code.])
146else
147  AC_DEFINE([NDEBUG], [1], [Define to 1 if you want to disable the assert() macro.])
148fi
149
150AC_ARG_ENABLE([efence],
151[AS_HELP_STRING([--enable-efence],
152                [enable Electric Fence support @<:@default=no@:>@])])
153
154if test "x$enable_efence" = xyes; then
155  openal_saved_LIBS=$LIBS
156  LIBS="-lefence $LIBS"
157  AC_LINK_IFELSE([AC_LANG_PROGRAM([extern int EF_ALIGNMENT;], [EF_ALIGNMENT = 8;])],
158    [:],
159    [AC_MSG_WARN([--enable-efence ignored because the Electric Fence library was not found.])
160     LIBS=$openal_saved_LIBS])
161fi
162
163# stubifying
164AC_ARG_ENABLE([debug-stub],
165[AS_HELP_STRING([--enable-debug-stub],
166                [enable stub debugging @<:@default=no@:>@])])
167
168if test "x$enable_debug_stub" = xyes; then
169  AC_DEFINE([DEBUG_STUB], [1], [Define to 1 to enable stub debugging.])
170fi
171
172# looping debug notification
173AC_ARG_ENABLE([debug-loop],
174[AS_HELP_STRING([--enable-debug-loop],
175                [enable looping debugging @<:@default=no@:>@])])
176
177if test "x$enable_debug_loop" = xyes; then
178  AC_DEFINE([DEBUG_LOOP], [1], [Define to 1 to enable looping debugging.])
179fi
180
181# conversion debug notification
182AC_ARG_ENABLE([debug-convert],
183[AS_HELP_STRING([--enable-debug-convert],
184                [enable conversion debugging @<:@default=no@:>@])])
185
186if test "x$enable_debug_convert" = xyes; then
187  AC_DEFINE([DEBUG_CONVERT], [1], [Define to 1 to enable conversion debugging.])
188fi
189
190# config file debug notification
191AC_ARG_ENABLE([debug-config],
192[AS_HELP_STRING([--enable-debug-config],
193                [enable config file debugging @<:@default=no@:>@])])
194
195if test "x$enable_debug_config" = xyes; then
196  AC_DEFINE([DEBUG_CONFIG], [1], [Define to 1 to enable config file debugging.])
197fi
198
199# lock debug notification
200AC_ARG_ENABLE([debug-lock],
201[AS_HELP_STRING([--enable-debug-lock],
202                [enable lock debugging @<:@default=no@:>@])])
203
204if test "x$enable_debug_lock" = xyes; then
205  AC_DEFINE([DEBUG_LOCK], [1], [Define to 1 to enable lock debugging.])
206fi
207
208# extension debug notification
209AC_ARG_ENABLE([debug-ext],
210[AS_HELP_STRING([--enable-debug-ext],
211                [enable extension debugging @<:@default=no@:>@])])
212
213if test "x$enable_debug_ext" = xyes; then
214  AC_DEFINE([DEBUG_EXT], [1], [Define to 1 to enable extension debugging.])
215fi
216
217# buffer debug notification
218AC_ARG_ENABLE([debug-buffer],
219[AS_HELP_STRING([--enable-debug-buffer],
220                [enable buffer debugging @<:@default=no@:>@])])
221
222if test "x$enable_debug_buffer" = xyes; then
223  AC_DEFINE([DEBUG_BUFFER], [1], [Define to 1 to enable buffer debugging.])
224fi
225
226# source debug notification
227AC_ARG_ENABLE([debug-source],
228[AS_HELP_STRING([--enable-debug-source],
229                [enable source debugging @<:@default=no@:>@])])
230
231if test "x$enable_debug_source" = xyes; then
232  AC_DEFINE([DEBUG_SOURCE], [1], [Define to 1 to enable source debugging.])
233fi
234
235# mixer debug notification
236AC_ARG_ENABLE([debug-mixer],
237[AS_HELP_STRING([--enable-debug-mixer],
238                [enable mixer debugging @<:@default=no@:>@])])
239
240if test "x$enable_debug_mixer" = xyes; then
241  AC_DEFINE([DEBUG_MIXER], [1], [Define to 1 to enable mixer debugging.])
242fi
243
244# streaming debug notification
245AC_ARG_ENABLE([debug-streaming],
246[AS_HELP_STRING([--enable-debug-streaming],
247                [enable streaming debugging @<:@default=no@:>@])])
248
249if test "x$enable_debug_streaming" = xyes; then
250  AC_DEFINE([DEBUG_STREAMING], [1], [Define to 1 to enable streaming debugging.])
251fi
252
253# math debug notification
254AC_ARG_ENABLE([debug-math],
255[AS_HELP_STRING([--enable-debug-math],
256                [enable math debugging @<:@default=no@:>@])])
257
258if test "x$enable_debug_math" = xyes; then
259  AC_DEFINE([DEBUG_MATH], [1], [Define to 1 to enable math debugging.])
260fi
261
262# mem debug notification
263AC_ARG_ENABLE([debug-mem],
264[AS_HELP_STRING([--enable-debug-mem],
265                [enable memory debugging @<:@default=no@:>@])])
266
267if test "x$enable_debug_mem" = xyes; then
268  AC_DEFINE([DEBUG_MEM], [1], [Define to 1 to enable memory debugging.])
269fi
270
271# context debug notification
272AC_ARG_ENABLE([debug-context],
273[AS_HELP_STRING([--enable-debug-context],
274                [enable context debugging @<:@default=no@:>@])])
275
276if test "x$enable_debug_context" = xyes; then
277  AC_DEFINE([DEBUG_CONTEXT], [1], [Define to 1 to enable context debugging.])
278fi
279
280# debug queue structures/functions/etc
281AC_ARG_ENABLE([debug-queue],
282[AS_HELP_STRING([--enable-debug-queue],
283                [enable queue debugging @<:@default=no@:>@])])
284
285if test "x$enable_debug_queue" = xyes; then
286  AC_DEFINE([DEBUG_QUEUE], [1], [Define to 1 to enable queue debugging.])
287fi
288
289# debug filter
290AC_ARG_ENABLE([debug-filter],
291[AS_HELP_STRING([--enable-debug-filter],
292                [enable filter debugging @<:@default=no@:>@])])
293
294if test "x$enable_debug_filter" = xyes; then
295  AC_DEFINE([DEBUG_FILTER], [1], [Define to 1 to enable filter debugging.])
296fi
297
298# debug maximus
299AC_ARG_ENABLE([debug-maximus],
300[AS_HELP_STRING([--enable-debug-maximus],
301                [enable all debugging @<:@default=no@:>@])])
302
303if test "x$enable_debug_maximus" = xyes; then
304  AC_DEFINE([DEBUG_MAXIMUS], [1], [Define to 1 to enable all debugging.])
305fi
306
307################################################################################
308# Handle optimization-related options.
309################################################################################
310
311AC_ARG_ENABLE([optimization],
312[AS_HELP_STRING([--enable-optimization],
313                [enable optimization @<:@default=yes@:>@])])
314
315if test "x$enable_optimization" != xno; then
316  ALUT_CHECK_FLAG([-finline-functions],
317                  [OPTIMIZATIONCFLAGS="$OPTIMIZATIONCFLAGS -finline-functions"])
318  ALUT_CHECK_FLAG([-ffast-math],
319                  [OPTIMIZATIONCFLAGS="$OPTIMIZATIONCFLAGS -ffast-math"])
320  # -pg and -fomit-frame-pointer are incompatible. ToDo: Test for this!
321  if test "x$enable_profile" != xyes; then
322    ALUT_CHECK_FLAG([-fomit-frame-pointer],
323                    [OPTIMIZATIONCFLAGS="$OPTIMIZATIONCFLAGS -fomit-frame-pointer"])
324  fi
325fi
326
327# profiling stuff
328AC_ARG_ENABLE([profile],
329[AS_HELP_STRING([--enable-profile],
330                [enable profile @<:@default=no@:>@])])
331
332if test "x$enable_profile" = xyes; then
333  ALUT_CHECK_FLAG([-pg],
334                  [OPTIMIZATIONCFLAGS="$OPTIMIZATIONCFLAGS -pg"
335                   PROFILINGLDFLAGS="$LDFLAGS -pg"],
336                  [AC_MSG_WARN([--enable-profile ignored because $CC does not support -pg.])])
337fi
338
339AC_C_BIGENDIAN
340
341# A few notes about dynamic loading of libraries: We should really use libtool's
342# mechanisms for this, but for now we have to get our hands dirty with dlopen
343# and friends and hope for the best. These calls are available on a lot of
344# *nices and Cygwin and according to Apple's developer pages, they are available
345# on Mac OS X 10.3 and later, too. In former Mac OS X versions one has to use
346# the dlcompat library to emulate this facility. Furthermore, adding "-ldl"
347# might be required, but not always (e.g. Cygwin).
348
349AC_CHECK_HEADERS([dlfcn.h],
350  [AC_CHECK_LIB([dl], [dlopen], [LIBS="-ldl $LIBS"])],
351  [AC_MSG_WARN([Dynamic loading of libraries is not available.])
352   AC_DEFINE([NODLOPEN], [1], [Define to 1 if dynamic loading of libraries is not available.])])
353
354# ranlib stuff
355case "$target" in
356    *darwin*) RANLIB=ranlib ;;
357    *) RANLIB=echo ;;
358esac
359
360dnl Special OS objs for target systems
361case "$target" in
362  *darwin*) LIBS="$LIBS -I/System/Library/Frameworks/CoreAudio.framework/Headers/ -framework CoreAudio"
363            AC_DEFINE([USE_BACKEND_NATIVE_DARWIN], [1], [undocumented]) ;;
364esac
365
366dnl Special objs for architectures
367case "$target" in
368    *i386* | *i486* | *i586* | *i686* | *x86_64*)
369    openal_x86_support_yn=yes
370
371    AC_MSG_CHECKING([for MMX support])
372    AC_TRY_COMPILE([
373#ifndef __MMX__
374#error no MMX support
375#endif
376      ],, [openal_x86_mmx_support_yn=yes], [openal_x86_mmx_support_yn=no])
377    AC_MSG_RESULT([$openal_x86_mmx_support_yn])
378    ;;
379esac
380
381if test "x$openal_x86_mmx_support_yn" = xyes; then
382case "$target" in
383    *i386* | *i486* | *i586* | *i686*)
384        AC_PATH_PROG([NASM], [nasm], [no])
385
386        if test "x$NASM" != xno; then
387            AC_DEFINE([HAVE_CPU_CAPS_DETECTION], [1], [detect cpu capabilities])
388            openal_x86_nasm_support_yn=yes
389
390            if test "x$openal_x86_mmx_support_yn" = xyes; then
391                AC_DEFINE([HAVE_MMX_MEMCPY], [1], [mmx memcpy])
392                openal_x86_nasm_mmx_support_yn=yes
393            fi
394
395            case "$target" in
396            *linux*)
397                NASM_FORMAT="-f elf"
398                ;;
399            *cygwin* | *mingw*)
400                NASM_FORMAT="-f win32 -DWIN32"
401                ;;
402            esac
403        fi
404        ;;
405    *x86_64*)
406        ;;
407    *)
408        ;;
409esac
410
411
412AC_ARG_ENABLE([optim-generic],
413[AS_HELP_STRING([--enable-optim-generic],
414                [x86(_64): even if mmx enabled, build optimized instead of light generic mixing routines  @<:@i686/x86_64:default=no@:>@])])
415
416if test "x$openal_x86_mmx_support_yn" = xyes; then
417    case "$target" in
418    *i686* | *x86_64*)
419        if test "x$enable_optim_generic" != xyes; then
420            enable_optim_generic=no
421        fi
422        ;;
423    *)
424        if test "x$enable_optim_generic" != xno; then
425            enable_optim_generic=yes
426        fi
427        ;;
428    esac
429
430    if test "x$enable_optim_generic" = xno; then
431        AC_DEFINE([USE_LIGHT_GEN_MIXING], [1], [build light generic mixing routines])
432    fi
433fi
434fi
435
436AM_CONDITIONAL([X86ENABLED], [test "x$openal_x86_support_yn" = xyes])
437AM_CONDITIONAL([X86MMXENABLED], [test "x$openal_x86_mmx_support_yn" = xyes])
438AM_CONDITIONAL([X86NASMENABLED], [test "x$openal_x86_nasm_support_yn" = xyes])
439AM_CONDITIONAL([X86NASMMMXENABLED], [test "x$openal_x86_nasm_mmx_support_yn" = xyes])
440
441# Note that -fvisibility=... support implies __attribute__((visibility(...)))
442# support.
443ALUT_CHECK_FLAG([-fvisibility=hidden],
444                [OPTIMIZATIONCFLAGS="$OPTIMIZATIONCFLAGS -fvisibility=hidden"
445                 AC_DEFINE([HAVE_GCC_VISIBILITY], [1],
446                           [Define to 1 if we are using a GCC with symbol visibility support.])])
447
448################################################################################
449# Checks for backends.
450################################################################################
451#
452# Detecting backends in the various configurations and on the various platforms
453# is a nightmare, but let's at least describe the general ideas:
454#
455#  * Every non-trivial backend has two switches: One for enabling/disabling the
456#    backend and one for enabling/disabling dlopening the relevant libraries at
457#    runtime.
458#
459#  * If the backend has been disabled explicitly, there is nothing to do,
460#    otherwise we need at least the relevant header.
461#
462#  * To find any needed flags for the C compiler, use pkg-config or the outdated
463#    foo-config. If neither is available, assume that no special flags are
464#    needed (and guess a library later if necessary).
465#
466#  * If static linking to the backend has been requested, we have to find out
467#    any needed linker flags, too.
468#
469# ToDo: There is far too much cut-n-paste below, we should really refactor this
470# using some nice macros...
471
472
473# OPENAL_ENABLE(FEATURE-NAME, SUPPORT-VAR, SUPPORT-DEFINE, SUPPORT-MAKEVAR)
474#--------------------------------------------------------------------------
475AC_DEFUN([OPENAL_ENABLE],
476[AC_MSG_CHECKING([for $1 support])
477 AC_MSG_RESULT([[$]$2])
478
479 case [$]$2 in
480   dynamic|static) openal_support_yn=yes ;;
481   *) openal_support_yn=no ;;
482 esac
483
484 if test "x$openal_support_yn" = xyes; then
485   AC_DEFINE([$3], [1], [Define to 1 if the $1 should be used.])
486 fi
487
488 AM_CONDITIONAL([$4], [test "x$openal_support_yn" = xyes])
489]) # OPENAL_ENABLE
490
491
492# check for ALSA backend #######################################################
493
494AC_ARG_ENABLE([alsa],
495[AS_HELP_STRING([--enable-alsa],
496                [enable ALSA backend @<:@default=auto@:>@])])
497
498AC_ARG_ENABLE([alsa-dlopen],
499[AS_HELP_STRING([--enable-alsa-dlopen],
500                [dynamically load ALSA libs @<:@default=yes@:>@])])
501
502if test "x$enable_alsa" = xno; then
503  openal_backend_alsa_support=disabled
504else
505  AC_CACHE_CHECK([for ALSA compiler flags], [openal_cv_cflags_alsa],
506    [openal_cv_cflags_alsa=unknown
507     test "x$PKG_CONFIG" != xnone && "$PKG_CONFIG" --exists alsa && openal_cv_cflags_alsa="`$PKG_CONFIG --cflags alsa`"
508     test -z "$openal_cv_cflags_alsa" && openal_cv_cflags_alsa=none])
509  case $openal_cv_cflags_alsa in
510    unknown|none) openal_cflags_alsa="" ;;
511    *) openal_cflags_alsa=$openal_cv_cflags_alsa ;;
512  esac
513  openal_saved_CFLAGS=$CFLAGS
514  CFLAGS="$CFLAGS $openal_cflags_alsa"
515  AC_CHECK_HEADER([alsa/asoundlib.h],
516    [if test "x$enable_alsa_dlopen" != xno; then
517       openal_backend_alsa_support=dynamic
518       FEATURECFLAGS="$FEATURECFLAGS $openal_cflags_alsa"
519       AC_DEFINE([OPENAL_DLOPEN_ALSA], [1], [dynamically load ALSA libs])
520     else
521       AC_CACHE_CHECK([for ALSA linker flags], [openal_cv_libs_alsa],
522         [if test "x$PKG_CONFIG" != xnone && "$PKG_CONFIG" --exists alsa; then
523            openal_cv_libs_alsa="`$PKG_CONFIG --libs alsa`"
524            if test -z "$openal_cv_libs_alsa"; then
525              openal_cv_libs_alsa=none
526            fi
527          else
528            openal_cv_libs_alsa=unknown
529          fi])
530       if test "x$openal_cv_libs_alsa" = xunknown; then
531         openal_libs_alsa="-lasound"
532       else
533         openal_libs_alsa=$openal_cv_libs_alsa
534       fi
535       openal_saved_LIBS=$LIBS
536       LIBS="$openal_libs_alsa $LIBS"
537       AC_CACHE_CHECK([for snd_pcm_info_sizeof], [openal_cv_func_snd_pcm_info_sizeof],
538         [AC_LINK_IFELSE([AC_LANG_CALL([], [snd_pcm_info_sizeof])],
539            [openal_cv_func_snd_pcm_info_sizeof=yes],
540            [openal_cv_func_snd_pcm_info_sizeof=no])])
541       if test "x$openal_cv_func_snd_pcm_info_sizeof" = xyes; then
542         openal_backend_alsa_support=static
543         FEATURECFLAGS="$FEATURECFLAGS $openal_cflags_alsa"
544         LIBS="$openal_libs_alsa $LIBS"
545       else
546         openal_backend_alsa_support=none
547         LIBS=$openal_saved_LIBS
548         if test "x$enable_alsa" = xyes; then
549           AC_MSG_WARN([--enable-alsa ignored because the ALSA library could not be found.])
550         fi
551       fi
552     fi],
553    [openal_backend_alsa_support=none
554     if test "x$enable_alsa" = xyes; then
555       AC_MSG_WARN([--enable-alsa ignored because the ALSA header could not be found.])
556     fi],
557    [AC_INCLUDES_DEFAULT([])])
558  CFLAGS=$openal_saved_CFLAGS
559fi
560
561OPENAL_ENABLE([ALSA backend], [openal_backend_alsa_support],
562              [USE_BACKEND_ALSA], [USEBACKENDALSA])
563
564# check for aRts backend #######################################################
565
566AC_ARG_ENABLE([arts],
567[AS_HELP_STRING([--enable-arts],
568                [enable aRts backend @<:@default=auto@:>@])])
569
570AC_ARG_ENABLE([arts-dlopen],
571[AS_HELP_STRING([--enable-arts-dlopen],
572                [dynamically load aRts libs @<:@default=yes@:>@])])
573
574if test "x$enable_arts" = xno; then
575  openal_backend_arts_support=disabled
576else
577  AC_ARG_VAR([ARTSC_CONFIG], [aRts configuration utility])
578  AC_CHECK_PROGS([ARTSC_CONFIG], [artsc-config], [none])
579  AC_CACHE_CHECK([for aRts compiler flags], [openal_cv_cflags_arts],
580    [openal_cv_cflags_arts=unknown
581     test "x$ARTSC_CONFIG" != xnone && openal_cv_cflags_arts="`$ARTSC_CONFIG --cflags`"
582     test -z "$openal_cv_cflags_arts" && openal_cv_cflags_arts=none])
583  case $openal_cv_cflags_arts in
584    unknown|none) openal_cflags_arts="" ;;
585    *) openal_cflags_arts=$openal_cv_cflags_arts ;;
586  esac
587  openal_saved_CFLAGS=$CFLAGS
588  CFLAGS="$CFLAGS $openal_cflags_arts"
589  AC_CHECK_HEADER([artsc.h],
590    [if test "x$enable_arts_dlopen" != xno; then
591       openal_backend_arts_support=dynamic
592       FEATURECFLAGS="$FEATURECFLAGS $openal_cflags_arts"
593       AC_DEFINE([OPENAL_DLOPEN_ARTS], [1], [dynamically load aRts libs])
594     else
595       AC_CACHE_CHECK([for aRts linker flags], [openal_cv_libs_arts],
596         [if test "x$ARTSC_CONFIG" != xnone; then
597            openal_cv_libs_arts="`$ARTSC_CONFIG --libs`"
598            if test -z "$openal_cv_libs_arts"; then
599              openal_cv_libs_arts=none
600            fi
601          else
602            openal_cv_libs_arts=unknown
603          fi])
604       if test "x$openal_cv_libs_arts" = xunknown; then
605         openal_libs_arts="-lartsc"
606       else
607         openal_libs_arts=$openal_cv_libs_arts
608       fi
609       openal_saved_LIBS=$LIBS
610       LIBS="$openal_libs_arts $LIBS"
611       AC_CACHE_CHECK([for arts_free], [openal_cv_func_arts_free],
612         [AC_LINK_IFELSE([AC_LANG_CALL([], [arts_free])],
613            [openal_cv_func_arts_free=yes],
614            [openal_cv_func_arts_free=no])])
615       if test "x$openal_cv_func_arts_free" = xyes; then
616         openal_backend_arts_support=static
617         FEATURECFLAGS="$FEATURECFLAGS $openal_cflags_arts"
618         LIBS="$openal_libs_arts $LIBS"
619       else
620         openal_backend_arts_support=none
621         LIBS=$openal_saved_LIBS
622         if test "x$enable_arts" = xyes; then
623           AC_MSG_WARN([--enable-arts ignored because the aRts library could not be found.])
624         fi
625       fi
626     fi],
627    [openal_backend_arts_support=none
628     if test "x$enable_arts" = xyes; then
629       AC_MSG_WARN([--enable-arts ignored because the aRts header could not be found.])
630     fi],
631    [AC_INCLUDES_DEFAULT([])])
632  CFLAGS=$openal_saved_CFLAGS
633fi
634
635OPENAL_ENABLE([aRts backend], [openal_backend_arts_support],
636              [USE_BACKEND_ARTS], [USEBACKENDARTS])
637
638# check for native BSD/OSS backend #############################################
639
640# ToDo: Hmmm, OpenBSD/FreeBSD are using OSS, too, just like Linux. Perhaps some
641# re-use is possible?
642
643AC_ARG_ENABLE([bsd],
644[AS_HELP_STRING([--enable-bsd],
645                [enable native BSD/OSS backend @<:@default=auto@:>@])])
646
647if test "x$enable_bsd" = xno; then
648  openal_backend_bsd_support=disabled
649else
650  case "$target" in
651    *bsd*) openal_backend_bsd_support=static ;;
652    *) openal_backend_bsd_support=none
653       if test "x$enable_bsd" = xyes; then
654         AC_MSG_WARN([--enable-bsd ignored because this is no BSD build.])
655       fi ;;
656  esac
657fi
658
659OPENAL_ENABLE([native BSD/OSS backend], [openal_backend_bsd_support],
660              [USE_BACKEND_NATIVE_BSD], [USEBACKENDNATIVEBSD])
661
662# check for native Darwin backend ##############################################
663
664AC_ARG_ENABLE([darwin],
665[AS_HELP_STRING([--enable-darwin],
666                [enable native Darwin backend @<:@default=auto@:>@])])
667
668if test "x$enable_darwin" = xno; then
669  openal_backend_darwin_support=disabled
670else
671  case "$target" in
672    *darwin*) openal_backend_darwin_support=static ;;
673    *) openal_backend_darwin_support=none
674       if test "x$enable_darwin" = xyes; then
675         AC_MSG_WARN([--enable-darwin ignored because this is no Darwin build.])
676       fi ;;
677  esac
678fi
679
680OPENAL_ENABLE([native Darwin backend], [openal_backend_darwin_support],
681              [USE_BACKEND_NATIVE_DARWIN], [USEBACKENDNATIVEDARWIN])
682
683# check for ESD backend ########################################################
684
685AC_ARG_ENABLE([esd],
686[AS_HELP_STRING([--enable-esd],
687                [enable ESD backend @<:@default=auto@:>@])])
688
689AC_ARG_ENABLE([esd-dlopen],
690[AS_HELP_STRING([--enable-esd-dlopen],
691                [dynamically load ESD libs @<:@default=yes@:>@])])
692
693if test "x$enable_esd" = xno; then
694  openal_backend_esd_support=disabled
695else
696  AC_ARG_VAR([ESD_CONFIG], [esd configuration utility])
697  AC_CHECK_PROGS([ESD_CONFIG], [esd-config], [none])
698  AC_CACHE_CHECK([for ESD compiler flags], [openal_cv_cflags_esd],
699    [openal_cv_cflags_esd=unknown
700     test "x$ESD_CONFIG" != xnone && openal_cv_cflags_esd="`$ESD_CONFIG --cflags`"
701     test -z "$openal_cv_cflags_esd" && openal_cv_cflags_esd=none])
702  case $openal_cv_cflags_esd in
703    unknown|none) openal_cv_cflags_esd="" ;;
704    *) openal_cflags_esd=$openal_cv_cflags_esd ;;
705  esac
706  openal_saved_CFLAGS=$CFLAGS
707  CFLAGS="$CFLAGS $openal_cflags_esd"
708  AC_CHECK_HEADER([esd.h],
709    [if test "x$enable_esd_dlopen" != xno; then
710       openal_backend_esd_support=dynamic
711       FEATURECFLAGS="$FEATURECFLAGS $openal_cflags_esd"
712       AC_DEFINE([OPENAL_DLOPEN_ESD], [1], [dynamically load ESD libs])
713     else
714       AC_CACHE_CHECK([for ESD linker flags], [openal_cv_libs_esd],
715         [if test "x$ESD_CONFIG" != xnone; then
716            openal_cv_libs_esd="`$ESD_CONFIG --libs`"
717            if test -z "$openal_cv_libs_esd"; then
718              openal_cv_libs_esd=none
719            fi
720          else
721            openal_cv_libs_esd=unknown
722          fi])
723       if test "x$openal_cv_libs_esd" = xunknown; then
724         openal_libs_esd="-lesd"
725       else
726         openal_libs_esd=$openal_cv_libs_esd
727       fi
728       openal_saved_LIBS=$LIBS
729       LIBS="$openal_libs_esd $LIBS"
730       AC_CACHE_CHECK([for esd_audio_open], [openal_cv_func_esd_audio_open],
731         [AC_LINK_IFELSE([AC_LANG_CALL([], [esd_audio_open])],
732            [openal_cv_func_esd_audio_open=yes],
733            [openal_cv_func_esd_audio_open=no])])
734       if test "x$openal_cv_func_esd_audio_open" = xyes; then
735         openal_backend_esd_support=static
736         FEATURECFLAGS="$FEATURECFLAGS $openal_cflags_esd"
737         LIBS="$openal_libs_esd $LIBS"
738       else
739         openal_backend_esd_support=none
740         LIBS=$openal_saved_LIBS
741         if test "x$enable_esd" = xyes; then
742           AC_MSG_WARN([--enable-esd ignored because the ESD library could not be found.])
743         fi
744       fi
745     fi],
746    [openal_backend_esd_support=none
747     if test "x$enable_esd" = xyes; then
748       AC_MSG_WARN([--enable-esd ignored because the ESD header could not be found.])
749     fi],
750    [AC_INCLUDES_DEFAULT([])])
751  CFLAGS=$openal_saved_CFLAGS
752fi
753
754OPENAL_ENABLE([ESD backend], [openal_backend_esd_support],
755              [USE_BACKEND_ESD], [USEBACKENDESD])
756
757# check for native IRIX backend ################################################
758
759AC_ARG_ENABLE([irix],
760[AS_HELP_STRING([--enable-irix],
761                [enable native IRIX backend @<:@default=auto@:>@])])
762
763if test "x$enable_irix" = xno; then
764  openal_backend_irix_support=disabled
765else
766  AC_CHECK_HEADER([dmedia/audio.h],
767    [openal_libs_irix="-laudio"
768     openal_saved_LIBS=$LIBS
769     LIBS="$openal_libs_irix $LIBS"
770     AC_CACHE_CHECK([for alGetResourceByName], [openal_cv_func_algetresourcebyname],
771       [AC_LINK_IFELSE([AC_LANG_CALL([], [alGetResourceByName])],
772          [openal_cv_func_algetresourcebyname=yes],
773          [openal_cv_func_algetresourcebyname=no])])
774     if test "x$openal_cv_func_algetresourcebyname" = xyes; then
775       openal_backend_irix_support=static
776       LIBS="$openal_libs_irix $LIBS"
777     else
778       openal_backend_irix_support=none
779       LIBS=$openal_saved_LIBS
780       if test "x$enable_irix" = xyes; then
781         AC_MSG_WARN([--enable-irix ignored because the Irix Multimedia library could not be found.])
782       fi
783     fi],
784    [openal_backend_irix_support=none
785     if test "x$enable_irix" = xyes; then
786       AC_MSG_WARN([--enable-irix ignored because the Irix header could not be found.])
787     fi],
788    [AC_INCLUDES_DEFAULT([])])
789fi
790
791OPENAL_ENABLE([native IRIX backend], [openal_backend_irix_support],
792              [USE_BACKEND_DMEDIA], [USEBACKENDNATIVEIRIX])
793
794# check for native Linux backend ###############################################
795
796AC_ARG_ENABLE([linux],
797[AS_HELP_STRING([--enable-linux],
798                [enable native Linux/OSS backend @<:@default=auto@:>@])])
799
800if test "x$enable_linux" = xno; then
801  openal_backend_linux_support=disabled
802else
803  AC_CHECK_HEADER([linux/soundcard.h],
804    [openal_backend_linux_support=static],
805    [openal_backend_linux_support=none
806     if test "x$enable_linux" = xyes; then
807       AC_MSG_WARN([--enable-linux ignored because the Linux OSS header could not be found.])
808     fi],
809    [AC_INCLUDES_DEFAULT([])])
810fi
811
812OPENAL_ENABLE([native Linux backend], [openal_backend_linux_support],
813              [USE_BACKEND_NATIVE_LINUX], [USEBACKENDNATIVELINUX])
814
815# check for native MorphOS backend #############################################
816
817AC_ARG_ENABLE([morphos],
818[AS_HELP_STRING([--enable-morphos],
819                [enable native MorphOS backend @<:@default=auto@:>@])])
820
821if test "x$enable_morphos" = xno; then
822  openal_backend_morphos_support=disabled
823else
824  case "$target" in
825    *morphos*) openal_backend_morphos_support=static ;;
826    *) openal_backend_morphos_support=none
827       if test "x$enable_morphos" = xyes; then
828         AC_MSG_WARN([--enable-morphos ignored because this is no MorphOS build.])
829       fi ;;
830  esac
831fi
832
833OPENAL_ENABLE([native MorphOS backend], [openal_backend_morphos_support],
834              [USE_BACKEND_NATIVE_MORPHOS], [USEBACKENDNATIVEMORPHOS])
835
836# check for null backend #######################################################
837
838AC_ARG_ENABLE([null],
839[AS_HELP_STRING([--enable-null],
840                [enable null backend @<:@default=yes@:>@])])
841
842case $enable_null in
843  no) openal_backend_null_support=disabled ;;
844  *) openal_backend_null_support=static ;;
845esac
846
847OPENAL_ENABLE([null backend], [openal_backend_null_support],
848              [USE_BACKEND_NULL], [USEBACKENDNULL])
849
850# check for SDL backend ########################################################
851
852AC_ARG_ENABLE([sdl],
853[AS_HELP_STRING([--enable-sdl],
854                [enable SDL backend @<:@default=auto@:>@])])
855
856AC_ARG_ENABLE([sdl-dlopen],
857[AS_HELP_STRING([--enable-sdl-dlopen],
858                [dynamically load SDL libs @<:@default=yes@:>@])])
859
860if test "x$enable_sdl" = xno; then
861  openal_backend_sdl_support=disabled
862else
863  AC_ARG_VAR([SDL_CONFIG], [sdl configuration utility])
864  AC_CHECK_PROGS([SDL_CONFIG], [sdl-config], [none])
865  AC_CACHE_CHECK([for SDL compiler flags], [openal_cv_cflags_sdl],
866    [openal_cv_cflags_sdl=unknown
867     test "x$SDL_CONFIG" != xnone && openal_cv_cflags_sdl="`$SDL_CONFIG --cflags`"
868     test -z "$openal_cv_cflags_sdl" && openal_cv_cflags_sdl=none])
869  case $openal_cv_cflags_sdl in
870    unknown|none) openal_cv_cflags_sdl="" ;;
871    *) openal_cflags_sdl=$openal_cv_cflags_sdl ;;
872  esac
873  openal_saved_CFLAGS=$CFLAGS
874  CFLAGS="$CFLAGS $openal_cflags_sdl"
875  AC_CHECK_HEADER([SDL.h],
876    [if test "x$enable_sdl_dlopen" != xno; then
877       openal_backend_sdl_support=dynamic
878       FEATURECFLAGS="$FEATURECFLAGS $openal_cflags_sdl"
879       AC_DEFINE([OPENAL_DLOPEN_SDL], [1], [dynamically load SDL libs])
880     else
881       AC_CACHE_CHECK([for SDL linker flags], [openal_cv_libs_sdl],
882         [if test "x$SDL_CONFIG" != xnone; then
883            openal_cv_libs_sdl="`$SDL_CONFIG --libs`"
884            if test -z "$openal_cv_libs_sdl"; then
885              openal_cv_libs_sdl=none
886            fi
887          else
888            openal_cv_libs_sdl=unknown
889          fi])
890       if test "x$openal_cv_libs_sdl" = xunknown; then
891         openal_libs_sdl="-lsdl"
892       else
893         openal_libs_sdl=$openal_cv_libs_sdl
894       fi
895       openal_saved_LIBS=$LIBS
896       LIBS="$openal_libs_sdl $LIBS"
897       AC_CACHE_CHECK([for SDL_LockAudio], [openal_cv_func_sdl_lockaudio],
898         [AC_LINK_IFELSE([AC_LANG_CALL([], [SDL_LockAudio])],
899            [openal_cv_func_sdl_lockaudio=yes],
900            [openal_cv_func_sdl_lockaudio=no])])
901       if test "x$openal_cv_func_sdl_lockaudio" = xyes; then
902         openal_backend_sdl_support=static
903         FEATURECFLAGS="$FEATURECFLAGS $openal_cflags_sdl"
904         LIBS="$openal_libs_sdl $LIBS"
905       else
906         openal_backend_sdl_support=none
907         LIBS=$openal_saved_LIBS
908         if test "x$enable_sdl" = xyes; then
909           AC_MSG_WARN([--enable-sdl ignored because the SDL library could not be found.])
910         fi
911       fi
912     fi],
913    [openal_backend_sdl_support=none
914     if test "x$enable_sdl" = xyes; then
915       AC_MSG_WARN([--enable-sdl ignored because the SDL header could not be found.])
916     fi],
917    [AC_INCLUDES_DEFAULT([])])
918  CFLAGS=$openal_saved_CFLAGS
919fi
920
921OPENAL_ENABLE([SDL backend], [openal_backend_sdl_support],
922              [USE_BACKEND_SDL], [USEBACKENDSDL])
923
924# check for native Solaris backend #############################################
925
926AC_ARG_ENABLE([solaris],
927[AS_HELP_STRING([--enable-solaris],
928                [enable native Solaris backend @<:@default=auto@:>@])])
929
930if test "x$enable_solaris" = xno; then
931  openal_backend_solaris_support=disabled
932else
933  AC_CHECK_HEADER([sys/audioio.h],
934    [openal_backend_solaris_support=static],
935    [openal_backend_solaris_support=none
936     if test "x$enable_solaris" = xyes; then
937       AC_MSG_WARN([--enable-solaris ignored because the Solaris audio header could not be found.])
938     fi],
939    [AC_INCLUDES_DEFAULT([])])
940fi
941
942OPENAL_ENABLE([native Solaris backend], [openal_backend_solaris_support],
943              [USE_BACKEND_NATIVE_SOLARIS], [USEBACKENDNATIVESOLARIS])
944
945# check for WAVE backend #######################################################
946
947AC_ARG_ENABLE([waveout],
948[AS_HELP_STRING([--enable-waveout],
949                [enable WAVE backend @<:@default=yes@:>@])])
950
951case $enable_waveout in
952  no) openal_backend_waveout_support=disabled ;;
953  *) openal_backend_waveout_support=static ;;
954esac
955
956OPENAL_ENABLE([WAVE backend], [openal_backend_waveout_support],
957              [USE_BACKEND_WAVEOUT], [USEBACKENDWAVEOUT])
958
959# check for native Windows backend #############################################
960
961AC_ARG_ENABLE([windows],
962[AS_HELP_STRING([--enable-windows],
963                [enable native Windows backend @<:@default=auto@:>@])])
964
965if test "x$enable_windows" = xno; then
966  openal_backend_windows_support=disabled
967else
968  AC_CHECK_HEADER([windows.h],
969    [openal_libs_windows="-lwinmm"
970     openal_saved_LIBS=$LIBS
971     LIBS="$openal_libs_windows $LIBS"
972     AC_CACHE_CHECK([for waveOutOpen], [openal_cv_func_waveoutopen],
973       [AC_LINK_IFELSE(
974         [AC_LANG_PROGRAM([[@%:@include <windows.h>]],
975                          [[waveOutOpen(NULL, WAVE_MAPPER, NULL, 0, 0, CALLBACK_FUNCTION);]])],
976          [openal_cv_func_waveoutopen=yes],
977          [openal_cv_func_waveoutopen=no])])
978     if test "x$openal_cv_func_waveoutopen" = xyes; then
979       openal_backend_windows_support=static
980       LIBS="$openal_libs_windows $LIBS"
981     else
982       openal_backend_windows_support=none
983       LIBS=$openal_saved_LIBS
984       if test "x$enable_windows" = xyes; then
985         AC_MSG_WARN([--enable-windows ignored because the Windows Multimedia library could not be found.])
986       fi
987     fi],
988    [openal_backend_windows_support=none
989     if test "x$enable_windows" = xyes; then
990       AC_MSG_WARN([--enable-windows ignored because the Windows header could not be found.])
991     fi],
992    [AC_INCLUDES_DEFAULT([])])
993fi
994
995OPENAL_ENABLE([native Windows backend], [openal_backend_windows_support],
996              [USE_BACKEND_NATIVE_WINDOWS], [USEBACKENDNATIVEWINDOWS])
997
998################################################################################
999# Checks for extensions.
1000################################################################################
1001
1002# check for AL_EXT_vorbis extension ############################################
1003
1004AC_ARG_ENABLE([vorbis],
1005[AS_HELP_STRING([--enable-vorbis],
1006                [enable AL_EXT_vorbis extension @<:@default=auto@:>@])])
1007
1008AC_ARG_ENABLE([vorbis-dlopen],
1009[AS_HELP_STRING([--enable-vorbis-dlopen],
1010                [dynamically load Vorbis libs @<:@default=yes@:>@])])
1011
1012if test "x$enable_vorbis" = xno; then
1013  openal_extension_vorbis_support=disabled
1014else
1015  AC_CACHE_CHECK([for Vorbis compiler flags], [openal_cv_cflags_vorbis],
1016    [openal_cv_cflags_vorbis=unknown
1017     test "x$PKG_CONFIG" != xnone && "$PKG_CONFIG" --exists vorbis && openal_cv_cflags_vorbis="`$PKG_CONFIG --cflags vorbisfile`"
1018     test -z "$openal_cv_cflags_vorbis" && openal_cv_cflags_vorbis=none])
1019  case $openal_cv_cflags_vorbis in
1020    unknown|none) openal_cflags_vorbis="" ;;
1021    *) openal_cflags_vorbis=$openal_cv_cflags_vorbis ;;
1022  esac
1023  openal_saved_CFLAGS=$CFLAGS
1024  CFLAGS="$CFLAGS $openal_cflags_vorbis"
1025  AC_CHECK_HEADER([vorbis/vorbisfile.h],
1026    [if test "x$enable_vorbis_dlopen" != xno; then
1027       openal_extension_vorbis_support=dynamic
1028       FEATURECFLAGS="$FEATURECFLAGS $openal_cflags_vorbis"
1029       AC_DEFINE([OPENAL_DLOPEN_VORBIS], [1], [dynamically load Vorbis libs])
1030     else
1031       AC_CACHE_CHECK([for Vorbis linker flags], [openal_cv_libs_vorbis],
1032         [if test "x$PKG_CONFIG" != xnone && "$PKG_CONFIG" --exists vorbis; then
1033            openal_cv_libs_vorbis="`$PKG_CONFIG --libs vorbisfile`"
1034            if test -z "$openal_cv_libs_vorbis"; then
1035              openal_cv_libs_vorbis=none
1036            fi
1037          else
1038            openal_cv_libs_vorbis=unknown
1039          fi])
1040       if test "x$openal_cv_libs_vorbis" = xunknown; then
1041         openal_libs_vorbis="-lvorbisfile -lvorbis -logg"
1042       else
1043         openal_libs_vorbis=$openal_cv_libs_vorbis
1044       fi
1045       openal_saved_LIBS=$LIBS
1046       LIBS="$openal_libs_vorbis $LIBS"
1047       AC_CACHE_CHECK([for ov_clear], [openal_cv_func_ov_clear],
1048         [AC_LINK_IFELSE([AC_LANG_CALL([], [ov_clear])],
1049            [openal_cv_func_ov_clear=yes],
1050            [openal_cv_func_ov_clear=no])])
1051       if test "x$openal_cv_func_ov_clear" = xyes; then
1052         openal_extension_vorbis_support=static
1053         FEATURECFLAGS="$FEATURECFLAGS $openal_cflags_vorbis"
1054         LIBS="$openal_libs_vorbis $LIBS"
1055       else
1056         openal_extension_vorbis_support=none
1057         LIBS=$openal_saved_LIBS
1058         if test "x$enable_vorbis" = xyes; then
1059           AC_MSG_WARN([--enable-vorbis ignored because the Vorbis library could not be found.])
1060         fi
1061       fi
1062     fi],
1063    [openal_extension_vorbis_support=none
1064     if test "x$enable_vorbis" = xyes; then
1065       AC_MSG_WARN([--enable-vorbis ignored because the Vorbis header could not be found.])
1066     fi],
1067    [AC_INCLUDES_DEFAULT([])])
1068  CFLAGS=$openal_saved_CFLAGS
1069fi
1070
1071OPENAL_ENABLE([AL_EXT_vorbis supprt], [openal_extension_vorbis_support],
1072              [ENABLE_EXTENSION_AL_EXT_VORBIS], [ENABLEEXTENSIONALEXTVORBIS])
1073
1074# check for AL_EXT_mp3 extension ###############################################
1075
1076AC_ARG_ENABLE([mp3],
1077[AS_HELP_STRING([--enable-mp3],
1078                [enable AL_EXT_mp3 support @<:@default=auto@:>@])])
1079
1080AC_ARG_ENABLE([mp3-dlopen],
1081[AS_HELP_STRING([--enable-mp3-dlopen],
1082                [dynamically load MP3 libs @<:@default=yes@:>@])])
1083
1084# For legacy reasons only, this misnomer will be nuked some day.
1085AC_ARG_ENABLE([smpeg],
1086[AS_HELP_STRING([--enable-smpeg],
1087                [deprecated, use --enable-mp3 instead])],
1088[AC_MSG_WARN([DO NOT USE --enable-smpeg ANYMORE, IT WILL BE REMOVED SOON. USE --enable-mp3 INSTEAD.])
1089 enable_mp3=$enable_smpeg])
1090
1091if test "x$enable_mp3" = xno; then
1092  openal_extension_smpeg_support=disabled
1093else
1094  AC_ARG_VAR([SMPEG_CONFIG], [smpeg configuration utility])
1095  AC_CHECK_PROGS([SMPEG_CONFIG], [smpeg-config], [none])
1096  AC_CACHE_CHECK([for SMPEG compiler flags], [openal_cv_cflags_smpeg],
1097    [openal_cv_cflags_smpeg=unknown
1098     test "x$SMPEG_CONFIG" != xnone && openal_cv_cflags_smpeg="`$SMPEG_CONFIG --cflags`"
1099     test -z "$openal_cv_cflags_smpeg" && openal_cv_cflags_smpeg=none])
1100  case $openal_cv_cflags_smpeg in
1101    unknown|none) openal_cv_cflags_smpeg="" ;;
1102    *) openal_cflags_smpeg=$openal_cv_cflags_smpeg ;;
1103  esac
1104  openal_saved_CFLAGS=$CFLAGS
1105  CFLAGS="$CFLAGS $openal_cflags_smpeg"
1106  AC_CHECK_HEADER([smpeg.h],
1107    [if test "x$enable_mp3_dlopen" != xno; then
1108       openal_extension_smpeg_support=dynamic
1109       FEATURECFLAGS="$FEATURECFLAGS $openal_cflags_smpeg"
1110       AC_DEFINE([OPENAL_DLOPEN_MP3], [1], [dynamically load SMPEG libs])
1111     else
1112       AC_CACHE_CHECK([for SMPEG linker flags], [openal_cv_libs_smpeg],
1113         [if test "x$SMPEG_CONFIG" != xnone; then
1114            openal_cv_libs_smpeg="`$SMPEG_CONFIG --libs`"
1115            if test -z "$openal_cv_libs_smpeg"; then
1116              openal_cv_libs_smpeg=none
1117            fi
1118          else
1119            openal_cv_libs_smpeg=unknown
1120          fi])
1121       if test "x$openal_cv_libs_smpeg" = xunknown; then
1122         openal_libs_smpeg="-lsmpeg"
1123       else
1124         openal_libs_smpeg=$openal_cv_libs_smpeg
1125       fi
1126       openal_saved_LIBS=$LIBS
1127       LIBS="$openal_libs_smpeg $LIBS"
1128       AC_CACHE_CHECK([for SMPEG_play], [openal_cv_func_SMPEG_play],
1129         [AC_LINK_IFELSE([AC_LANG_CALL([], [SMPEG_play])],
1130            [openal_cv_func_SMPEG_play=yes],
1131            [openal_cv_func_SMPEG_play=no])])
1132       if test "x$openal_cv_func_SMPEG_play" = xyes; then
1133         openal_extension_smpeg_support=static
1134         FEATURECFLAGS="$FEATURECFLAGS $openal_cflags_smpeg"
1135         LIBS="$openal_libs_smpeg $LIBS"
1136       else
1137         openal_extension_smpeg_support=none
1138         LIBS=$openal_saved_LIBS
1139         if test "x$enable_mp3" = xyes; then
1140           AC_MSG_WARN([--enable-smpeg ignored because the SMPEG library could not be found.])
1141         fi
1142       fi
1143     fi],
1144    [openal_extension_smpeg_support=none
1145     if test "x$enable_mp3" = xyes; then
1146       AC_MSG_WARN([--enable-smpeg ignored because the SMPEG header could not be found.])
1147     fi],
1148    [AC_INCLUDES_DEFAULT([])])
1149  CFLAGS=$openal_saved_CFLAGS
1150fi
1151
1152OPENAL_ENABLE([AL_EXT_mp3 extension], [openal_extension_smpeg_support],
1153              [ENABLE_EXTENSION_AL_EXT_MP3], [ENABLEEXTENSIONALEXTMP3])
1154
1155################################################################################
1156# Misc stuff
1157################################################################################
1158
1159AC_CHECK_SIZEOF([void *])
1160
1161AC_DEFINE([AL_SUPPORT_BYTE_LOKI_SOURCE_ATTR_], [1], [Define to 1 if the AL_BYTE_LOKI source attribute shall be supported.])
1162
1163AC_SUBST([FEATURECFLAGS])
1164AC_SUBST([LIBS])
1165AC_SUBST([NASM])
1166AC_SUBST([NASM_FORMAT])
1167AC_SUBST([OPTIMIZATIONCFLAGS])
1168AC_SUBST([PROFILINGLDFLAGS])
1169AC_SUBST([RANLIB])
1170AC_SUBST([SIZEOF_VOID_P])
1171AC_SUBST([WARNINGCFLAGS])
1172
1173# Generate output.
1174# NOTE: Do not break the following line, otherwise we are into CR/LF vs. LF
1175# trouble! This is a buglet in autoconf IMHO, but easy to work around.
1176AC_CONFIG_FILES([Makefile admin/Makefile admin/pkgconfig/Makefile admin/pkgconfig/openal-config admin/pkgconfig/openal.pc common/Makefile common/include/Makefile include/Makefile src/Makefile src/arch/Makefile src/arch/i386/Makefile])
1177
1178AC_CONFIG_COMMANDS([default], [chmod +x admin/pkgconfig/openal-config])
1179AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.