configure.in
branchSDL-1.2
changeset 4192 2f5e884f0a9d
parent 4185 cb2d5514efb3
child 4204 976bc19f8f6b
     1.1 --- a/configure.in	Sat Sep 12 19:41:54 2009 +0000
     1.2 +++ b/configure.in	Sun Sep 13 22:19:56 2009 +0000
     1.3 @@ -591,30 +591,62 @@
     1.4  AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
     1.5                    , enable_nas=yes)
     1.6      if test x$enable_audio = xyes -a x$enable_nas = xyes; then
     1.7 -        save_LDFLAGS="$LDFLAGS"
     1.8 -        LDFLAGS="$LDFLAGS -lXt -lm"
     1.9 -        AC_CHECK_HEADER(audio/audiolib.h, have_audio_hdr=yes)
    1.10 -        AC_CHECK_LIB(audio, AuOpenServer, have_audio_lib=yes)
    1.11 -        AC_CHECK_HEADER(nas/audiolib.h, have_nas_hdr=yes)
    1.12 -        AC_CHECK_LIB(nas, AuOpenServer, have_nas_lib=yes)
    1.13 -        LDFLAGS="$save_LDFLAGS"
    1.14 +        AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
    1.15 +        AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
    1.16  
    1.17          AC_MSG_CHECKING(for NAS audio support)
    1.18          have_nas=no
    1.19 -        if test x$have_audio_hdr = xyes -a x$have_audio_lib = xyes; then
    1.20 +
    1.21 +        if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
    1.22              have_nas=yes
    1.23 -            NAS_LIBS="-laudio -lXt"
    1.24 -        elif test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
    1.25 +            NAS_LIBS="-laudio"
    1.26 +
    1.27 +        elif test -r /usr/X11R6/include/audio/audiolib.h; then
    1.28 +            have_nas=yes
    1.29 +            NAS_CFLAGS="-I/usr/X11R6/include/"
    1.30 +            NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
    1.31 +
    1.32 +        dnl On IRIX, the NAS includes are in a different directory,
    1.33 +        dnl and libnas must be explicitly linked in
    1.34 +
    1.35 +        elif test -r /usr/freeware/include/nas/audiolib.h; then
    1.36              have_nas=yes
    1.37              NAS_LIBS="-lnas -lXt"
    1.38 -	fi
    1.39 +        fi
    1.40 +
    1.41          AC_MSG_RESULT($have_nas)
    1.42  
    1.43          if test x$have_nas = xyes; then
    1.44 +            AC_ARG_ENABLE(nas-shared,
    1.45 +AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
    1.46 +                          , enable_nas_shared=yes)
    1.47 +            if test "x`echo $NAS_LIBS | grep -- -L`" = "x"; then
    1.48 +                if test "x`ls /lib/libaudio.so.* 2> /dev/null`" != "x"; then
    1.49 +                    NAS_LIBS="-L/lib $NAS_LIBS"
    1.50 +                elif test "x`ls /usr/lib/libaudio.so.* 2> /dev/null`" != "x"; then
    1.51 +                    NAS_LIBS="-L/usr/lib $NAS_LIBS"
    1.52 +                elif test "x`ls /usr/local/lib/libaudio.so.* 2> /dev/null`" != "x"; then
    1.53 +                    NAS_LIBS="-L/usr/local/lib $NAS_LIBS"
    1.54 +                fi
    1.55 +            fi
    1.56 +            nas_lib_spec=`echo $NAS_LIBS | sed 's/.*-L\([[^ ]]*\).*/\1\/libaudio.so.*/'`
    1.57 +            nas_lib=`ls -- $nas_lib_spec | sed 's/.*\/\(.*\)/\1/; q'`
    1.58 +            echo "-- $nas_lib_spec -> $nas_lib"
    1.59 +
    1.60 +            if test x$have_loadso != xyes && \
    1.61 +               test x$enable_nas_shared = xyes; then
    1.62 +                AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
    1.63 +            fi
    1.64 +            if test x$have_loadso = xyes && \
    1.65 +               test x$enable_nas_shared = xyes && test x$nas_lib != x; then
    1.66 +                AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib")
    1.67 +            else
    1.68 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
    1.69 +            fi
    1.70 +
    1.71              AC_DEFINE(SDL_AUDIO_DRIVER_NAS)
    1.72              SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
    1.73              EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
    1.74 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
    1.75              have_audio=yes
    1.76          fi
    1.77      fi