configure.in
changeset 2049 5f6550e5184f
parent 2040 be848c07f0b9
child 2066 8f8066b84b3e
--- a/configure.in	Sun Oct 01 16:10:41 2006 +0000
+++ b/configure.in	Tue Oct 17 09:15:21 2006 +0000
@@ -511,9 +511,17 @@
 AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
                   , enable_nas=yes)
     if test x$enable_audio = xyes -a x$enable_nas = xyes; then
+        AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
+        AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
+
         AC_MSG_CHECKING(for NAS audio support)
         have_nas=no
-        if test -r /usr/X11R6/include/audio/audiolib.h; then
+
+        if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
+            have_nas=yes
+            NAS_LIBS="-laudio"
+
+        elif test -r /usr/X11R6/include/audio/audiolib.h; then
             have_nas=yes
             NAS_CFLAGS="-I/usr/X11R6/include/"
             NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
@@ -525,12 +533,40 @@
             have_nas=yes
             NAS_LIBS="-lnas -lXt"
         fi
+
         AC_MSG_RESULT($have_nas)
+
         if test x$have_nas = xyes; then
+            AC_ARG_ENABLE(nas-shared,
+AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
+                          , enable_nas_shared=yes)
+            if test "x`echo $NAS_LIBS | grep -- -L`" = "x"; then
+                if test "x`ls /lib/libaudio.so.* 2> /dev/null`" != "x"; then
+                    NAS_LIBS="-L/lib $NAS_LIBS"
+                elif test "x`ls /usr/lib/libaudio.so.* 2> /dev/null`" != "x"; then
+                    NAS_LIBS="-L/usr/lib $NAS_LIBS"
+                elif test "x`ls /usr/local/lib/libaudio.so.* 2> /dev/null`" != "x"; then
+                    NAS_LIBS="-L/usr/local/lib $NAS_LIBS"
+                fi
+            fi
+            nas_lib_spec=`echo $NAS_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libaudio.so.*/'`
+            nas_lib=`ls -- $nas_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
+            echo "-- $nas_lib_spec -> $nas_lib"
+
+            if test x$have_loadso != xyes && \
+               test x$enable_nas_shared = xyes; then
+                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
+            fi
+            if test x$have_loadso = xyes && \
+               test x$enable_nas_shared = xyes && test x$alsa_lib != x; then
+                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib")
+            else
+                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
+            fi
+
             AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
             SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
             EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
             have_audio=yes
         fi
     fi
@@ -2006,7 +2042,7 @@
                 have_audio=yes
             ;;
             aix)
-                AC_DEFINE(SDL_AUDIO_DRIVER_PAUD)
+                AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO)
                 SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
                 have_audio=yes
             ;;
@@ -2206,7 +2242,7 @@
         CheckBeGL
         # Set up files for the audio library
         if test x$enable_audio = xyes; then
-            AC_DEFINE(SDL_AUDIO_DRIVER_BAUDIO)
+            AC_DEFINE(SDL_AUDIO_DRIVER_BEOSAUDIO)
             SOURCES="$SOURCES $srcdir/src/audio/baudio/*.cc"
             have_audio=yes
         fi
@@ -2323,7 +2359,7 @@
         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
         # If either the audio or CD driver is used, add the AudioUnit framework
         if test x$enable_audio = xyes -o x$enable_cdrom = xyes; then
-            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
+            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -framework,AudioToolbox -Wl,-framework,AudioUnit"
         fi
         ;;
     *-*-mint*)