configure.in
author Sam Lantinga <slouken@libsdl.org>
Wed, 27 Feb 2008 07:31:03 +0000
changeset 382 50501e45c57b
parent 374 9f79d3a5eda1
child 392 c9adf3866e87
permissions -rw-r--r--
Austen Dicken - Tue Feb 26 23:28:27 PST 2008

Ok, here is the patch I made for FLAC support.

I have tested it relatively thoroughly and currently the patch allows:
1. Pre-loading FLAC files and playing them via LoadWAV
2. The patch allows for FLAC support in the LoadMUS setting as well as:
* Pause / Resume
* Volume control
* Seeking

I also did a little benchmarking by comparing memory/cpu usage of playmus to
that of mplayer, and the results were very good. playmus typically took about
half the RAM as mplayer, though that may be attributed to mplayer being a more
"bulky" program. As such I would say that the two are probably about equal in
efficiency.

Also, it is important to note that, similar to the OGG support currently
built-in, my FLAC patch only supports 16 bit stereo-encoded sound. Also, it
is only for Native FLAC (standard) and not the derivative, Ogg-FLAC.

I have tried to find a simple way to detect Ogg-FLAC files, as the only
difference between Ogg-FLAC and Native FLAC support is changing the init_
function call, but after digging a little deeper it seems that Ogg-FLAC is
basically FLAC wrapped in an Ogg transport layer, so it would be better to have
a way to read the Ogg transport layer which then reads the inner audio files
according to the proper codec.

But anyway, that's another job for another day! For now this should provide
Native FLAC support!
slouken@0
     1
dnl Process this file with autoconf to produce a configure script.
slouken@0
     2
AC_INIT(README)
slouken@0
     3
slouken@0
     4
dnl Set various version strings - taken gratefully from the GTk sources
slouken@0
     5
slouken@0
     6
# Making releases:
slouken@0
     7
#   MICRO_VERSION += 1;
slouken@0
     8
#   INTERFACE_AGE += 1;
slouken@0
     9
#   BINARY_AGE += 1;
slouken@0
    10
# if any functions have been added, set INTERFACE_AGE to 0.
slouken@0
    11
# if backwards compatibility has been broken,
slouken@0
    12
# set BINARY_AGE and INTERFACE_AGE to 0.
slouken@294
    13
#
slouken@0
    14
MAJOR_VERSION=1
slouken@81
    15
MINOR_VERSION=2
slouken@349
    16
MICRO_VERSION=8
slouken@349
    17
INTERFACE_AGE=6
slouken@349
    18
BINARY_AGE=8
slouken@0
    19
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
slouken@0
    20
slouken@0
    21
AC_SUBST(MAJOR_VERSION)
slouken@0
    22
AC_SUBST(MINOR_VERSION)
slouken@0
    23
AC_SUBST(MICRO_VERSION)
slouken@0
    24
AC_SUBST(INTERFACE_AGE)
slouken@0
    25
AC_SUBST(BINARY_AGE)
slouken@0
    26
AC_SUBST(VERSION)
slouken@0
    27
slouken@0
    28
# libtool versioning
slouken@0
    29
LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
slouken@0
    30
LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
slouken@0
    31
LT_REVISION=$INTERFACE_AGE
slouken@0
    32
LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
slouken@0
    33
slouken@0
    34
AC_SUBST(LT_RELEASE)
slouken@0
    35
AC_SUBST(LT_CURRENT)
slouken@0
    36
AC_SUBST(LT_REVISION)
slouken@0
    37
AC_SUBST(LT_AGE)
slouken@0
    38
slouken@289
    39
dnl Detect the canonical build and host environments
slouken@294
    40
AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
slouken@289
    41
AC_CANONICAL_HOST
slouken@68
    42
slouken@294
    43
dnl Set up the compiler and linker flags
slouken@294
    44
case "$host" in
slouken@294
    45
    *-*-cygwin*)
slouken@294
    46
        # We build SDL on cygwin without the UNIX emulation layer
slouken@294
    47
        BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
slouken@294
    48
        BASE_LDFLAGS="-mno-cygwin"
slouken@294
    49
        ;;
slouken@294
    50
    *)
slouken@294
    51
        BASE_CFLAGS="-D_GNU_SOURCE=1"
slouken@294
    52
        BASE_LDFLAGS=""
slouken@294
    53
        ;;
slouken@294
    54
esac
slouken@294
    55
BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
slouken@294
    56
EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
slouken@294
    57
BUILD_LDFLAGS="$LDFLAGS"
slouken@294
    58
EXTRA_LDFLAGS="$BASE_LDFLAGS"
slouken@368
    59
## These are common directories to find software packages
slouken@368
    60
#for path in /usr/freeware /usr/pkg /usr/local; do
slouken@368
    61
#    if test -d $path/include; then
slouken@368
    62
#        EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
slouken@368
    63
#    fi
slouken@368
    64
#    if test -d $path/lib; then
slouken@368
    65
#        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
slouken@368
    66
#    fi
slouken@368
    67
#done
slouken@294
    68
CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
slouken@294
    69
CFLAGS="$CFLAGS $EXTRA_CFLAGS"
slouken@294
    70
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
slouken@91
    71
slouken@0
    72
dnl Check for tools
slouken@294
    73
AC_LIBTOOL_WIN32_DLL
slouken@294
    74
AC_PROG_LIBTOOL
slouken@294
    75
AC_PROG_CC
slouken@294
    76
AC_PROG_INSTALL
slouken@294
    77
AC_PROG_MAKE_SET
slouken@368
    78
if test -z "$host_alias"; then
slouken@368
    79
    hostaliaswindres=
slouken@368
    80
else
slouken@368
    81
    hostaliaswindres="$host_alias-windres"
slouken@368
    82
fi
slouken@368
    83
AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])
slouken@0
    84
slouken@294
    85
dnl Check for compiler characteristics
slouken@294
    86
AC_C_CONST
slouken@0
    87
slouken@289
    88
case "$host" in
slouken@294
    89
    *-*-cygwin* | *-*-mingw32*)
slouken@368
    90
        SOURCES="$srcdir/version.rc"
slouken@294
    91
        EXE=".exe"
slouken@368
    92
        if test "$build" != "$host"; then # cross-compiling
slouken@368
    93
            # Default cross-compile location
slouken@368
    94
            ac_default_prefix=/usr/local/cross-tools/i386-mingw32
slouken@368
    95
        else
slouken@368
    96
            # Look for the location of the tools and install there
slouken@368
    97
            if test "$BUILD_PREFIX" != ""; then
slouken@368
    98
                ac_default_prefix=$BUILD_PREFIX
slouken@368
    99
            fi
slouken@368
   100
        fi
slouken@6
   101
        ;;
slouken@294
   102
    *)
slouken@368
   103
        SOURCES=""
slouken@294
   104
        EXE=""
slouken@208
   105
        ;;
slouken@6
   106
esac
slouken@6
   107
slouken@294
   108
# Standard C sources
slouken@294
   109
SOURCES="$SOURCES \
slouken@294
   110
$srcdir/effect_position.c \
slouken@294
   111
$srcdir/effect_stereoreverse.c \
slouken@294
   112
$srcdir/effects_internal.c \
slouken@294
   113
$srcdir/load_aiff.c \
slouken@294
   114
$srcdir/load_voc.c \
slouken@294
   115
$srcdir/mixer.c \
slouken@294
   116
$srcdir/music.c"
slouken@294
   117
slouken@368
   118
find_lib()
slouken@368
   119
{
slouken@372
   120
    gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
slouken@372
   121
    gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
slouken@368
   122
    env_lib_path=[`echo $LIBS $LDFLAGS | sed 's/-L[ ]*//g'`]
slouken@372
   123
    for path in $gcc_bin_path $gcc_lib_path $env_lib_path /usr/lib /usr/local/lib; do
slouken@368
   124
        lib=[`ls -- $path/$1 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@368
   125
        if test x$lib != x; then
slouken@368
   126
            echo $lib
slouken@368
   127
            return
slouken@368
   128
        fi
slouken@368
   129
    done
slouken@368
   130
}
slouken@368
   131
slouken@20
   132
dnl Check for SDL
slouken@308
   133
SDL_VERSION=1.2.10
slouken@20
   134
AM_PATH_SDL($SDL_VERSION,
slouken@20
   135
            :,
slouken@368
   136
            AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
slouken@20
   137
)
slouken@294
   138
EXTRA_CFLAGS="$EXTRA_CFLAGS $SDL_CFLAGS"
slouken@294
   139
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SDL_LIBS"
slouken@0
   140
slouken@0
   141
dnl Check command-line options
slouken@91
   142
slouken@312
   143
AC_ARG_ENABLE([music-cmd],
slouken@312
   144
AC_HELP_STRING([--enable-music-cmd], [support an external music player [[default=yes]]]),
slouken@312
   145
              [], [enable_music_cmd=yes])
slouken@0
   146
if test x$enable_music_cmd = xyes; then
slouken@294
   147
    SOURCES="$SOURCES $srcdir/music_cmd.c"
slouken@294
   148
    EXTRA_CFLAGS="$EXTRA_CFLAGS -DCMD_MUSIC"
slouken@0
   149
fi
slouken@312
   150
AC_ARG_ENABLE([music-wave],
slouken@312
   151
AC_HELP_STRING([--enable-music-wave], [enable streaming WAVE music [[default=yes]]]),
slouken@312
   152
              [], [enable_music_wave=yes])
slouken@0
   153
if test x$enable_music_wave = xyes; then
slouken@294
   154
    SOURCES="$SOURCES $srcdir/wavestream.c"
slouken@294
   155
    EXTRA_CFLAGS="$EXTRA_CFLAGS -DWAV_MUSIC"
slouken@0
   156
fi
slouken@257
   157
no_libmikmod=yes
slouken@249
   158
libmikmod_maj=3
slouken@249
   159
libmikmod_min=1
slouken@249
   160
libmikmod_rev=10
slouken@249
   161
libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
slouken@312
   162
AC_ARG_ENABLE([music-libmikmod],
slouken@312
   163
AC_HELP_STRING([--enable-music-libmikmod], [enable MOD music via external libmikmod [[default=no]]]),
slouken@312
   164
              [], [enable_music_libmikmod=no])
slouken@249
   165
if test x$enable_music_libmikmod = xyes; then
slouken@368
   166
    AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH])
slouken@368
   167
    if test "$LIBMIKMOD_CONFIG" != "no" ; then
slouken@368
   168
        no_libmikmod=no
slouken@368
   169
        CFLAGS_SAVED="$CFLAGS"
slouken@368
   170
        LIBS_SAVED="$LIBS"
slouken@368
   171
        CFLAGS="$CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
slouken@368
   172
        LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
slouken@368
   173
        AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver])
slouken@368
   174
        AC_TRY_RUN([
slouken@249
   175
#include "mikmod.h"
slouken@249
   176
#include "stdio.h"
slouken@249
   177
slouken@249
   178
int main(int argc, char **argv)
slouken@249
   179
{
slouken@368
   180
    long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
slouken@368
   181
    /*printf("(%d.%d.%d) ",ver>>16,(ver>>8)&0xff,ver&0xff);*/
slouken@368
   182
    if(ver>=((maj<<16)|(min<<8)|(rev))) {
slouken@368
   183
        printf("yes\n");
slouken@368
   184
        return 0;
slouken@368
   185
    }
slouken@368
   186
    printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
slouken@368
   187
    return 1;
slouken@249
   188
}
slouken@332
   189
], EXTRA_CFLAGS="$EXTRA_CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`";EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$LIBMIKMOD_CONFIG --libs`", CFLAGS="$CFLAGS_SAVED";LIBS="$LIBS_SAVED",
slouken@249
   190
[echo $ac_n "cross compiling; assumed OK... $ac_c"])
slouken@368
   191
    fi
slouken@249
   192
fi
slouken@249
   193
slouken@312
   194
AC_ARG_ENABLE([music-mod],
slouken@312
   195
AC_HELP_STRING([--enable-music-mod], [enable MOD music via mikmod [[default=yes]]]),
slouken@312
   196
              [], [enable_music_mod=$no_libmikmod])
slouken@332
   197
if test x$enable_music_mod = xyes -a x$enable_music_libmikmod = xno; then
slouken@294
   198
    EXTRA_CFLAGS="$EXTRA_CFLAGS -DMOD_MUSIC -I\$(srcdir)/mikmod"
slouken@294
   199
    SOURCES="$SOURCES $srcdir/mikmod/*.c"
slouken@1
   200
fi
slouken@312
   201
AC_ARG_ENABLE([music-midi],
slouken@312
   202
AC_HELP_STRING([--enable-music-midi], [enable MIDI music via timidity [[default=yes]]]),
slouken@312
   203
              [], [enable_music_midi=yes])
slouken@0
   204
if test x$enable_music_midi = xyes; then
slouken@294
   205
    EXTRA_CFLAGS="$EXTRA_CFLAGS -DMID_MUSIC"
slouken@312
   206
    AC_ARG_ENABLE([music-timidity-midi],
slouken@312
   207
AC_HELP_STRING([--enable-music-timidity-midi], [enable timidity MIDI output [[default=yes]]]),
slouken@312
   208
                  [], [enable_music_timidity_midi=yes])
slouken@106
   209
    if test x$enable_music_timidity_midi = xyes; then
slouken@294
   210
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_TIMIDITY_MIDI -I\$(srcdir)/timidity"
slouken@294
   211
        SOURCES="$SOURCES $srcdir/timidity/*.c"
slouken@106
   212
    fi
slouken@312
   213
    AC_ARG_ENABLE([music-native-midi],
slouken@312
   214
AC_HELP_STRING([--enable-music-native-midi], [enable native MIDI music output [[default=yes]]]),
slouken@312
   215
                  [], [enable_music_native_midi=yes])
slouken@99
   216
    if test x$enable_music_native_midi = xyes; then
slouken@99
   217
        use_music_native_midi=no
slouken@289
   218
        case "$host" in
slouken@99
   219
            *-*-cygwin* | *-*-mingw32*)
slouken@99
   220
                use_music_native_midi=yes
slouken@294
   221
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lwinmm"
slouken@99
   222
                ;;
slouken@107
   223
            *-*-darwin*)
slouken@107
   224
                use_music_native_midi=yes
icculus@344
   225
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime -Wl,-framework,CoreServices"
slouken@107
   226
                ;;
slouken@99
   227
        esac
slouken@99
   228
        if test x$use_music_native_midi = xyes; then
slouken@294
   229
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
slouken@294
   230
            SOURCES="$SOURCES $srcdir/native_midi/*.c"
slouken@99
   231
        fi
slouken@99
   232
    fi
slouken@312
   233
    AC_ARG_ENABLE([music-native-midi-gpl],
slouken@312
   234
AC_HELP_STRING([--enable-music-native-midi-gpl], [enable native MIDI on UNIX using GPL code [[default=no]]]),
slouken@312
   235
                  [], [enable_music_native_midi_gpl=no])
slouken@160
   236
    if test x$enable_music_native_midi_gpl = xyes; then
slouken@160
   237
        use_music_native_midi_gpl=no
slouken@289
   238
        case "$host" in
slouken@160
   239
            *-*-linux* | *-*-freebsd*)
slouken@160
   240
                use_music_native_midi_gpl=yes
slouken@160
   241
                ;;
slouken@160
   242
        esac
slouken@160
   243
        if test x$use_music_native_midi_gpl = xyes; then
slouken@294
   244
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
slouken@294
   245
            SOURCES="$SOURCES $srcdir/native_midi_gpl/*.c"
slouken@160
   246
        fi
slouken@160
   247
    fi
slouken@0
   248
fi
slouken@312
   249
AC_ARG_ENABLE([music-ogg],
slouken@312
   250
AC_HELP_STRING([--enable-music-ogg], [enable Ogg Vorbis music [[default=yes]]]),
slouken@312
   251
              [], [enable_music_ogg=yes])
slouken@353
   252
AC_ARG_ENABLE(music-ogg-tremor,
slouken@353
   253
[  --enable-music-ogg-tremor   enable OGG music via libtremor [[default=no]]],
slouken@368
   254
              [], enable_music_ogg_tremor=no)
slouken@368
   255
AC_ARG_ENABLE([music-ogg-shared],
slouken@368
   256
AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis support [[default=yes]]]),
slouken@368
   257
              [], [enable_music_ogg_shared=yes])
slouken@368
   258
if test x$enable_music_ogg = xyes; then
slouken@368
   259
    if test x$enable_music_ogg_tremor = xyes; then
slouken@368
   260
        AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes])
slouken@368
   261
        AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes])
slouken@368
   262
        if test x$have_tremor_hdr = xyes -a x$have_tremor_lib = xyes; then
slouken@368
   263
            case "$host" in
slouken@368
   264
                *-*-darwin*)
slouken@368
   265
                    ogg_lib=[`find_lib libvorbisidec*.dylib`]
slouken@368
   266
                    if test x$ogg_lib = x; then
slouken@368
   267
                        ogg_lib=[`find_lib libvorbisidec.[0-9]`]
slouken@368
   268
                    fi
slouken@368
   269
                    if test x$ogg_lib = x; then
slouken@368
   270
                        ogg_lib=[`find_lib libvorbisidec.[0-9]*`]
slouken@368
   271
                    fi
slouken@368
   272
                    ;;
slouken@368
   273
                *-*-cygwin* | *-*-mingw32*)
slouken@372
   274
                    ogg_lib=[`find_lib "vorbisidec*.dll"`]
slouken@368
   275
                    ;;
slouken@368
   276
                *)
slouken@368
   277
                    ogg_lib=[`find_lib "libvorbisidec.so.[0-9]"`]
slouken@368
   278
                    if test x$ogg_lib = x; then
slouken@368
   279
                        ogg_lib=[`find_lib "libvorbisidec.so.[0-9]*"`]
slouken@368
   280
                    fi
slouken@368
   281
                    ;;
slouken@368
   282
            esac
slouken@368
   283
            SOURCES="$SOURCES $srcdir/*_ogg.c"
slouken@368
   284
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC -DOGG_USE_TREMOR"
slouken@368
   285
            if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
slouken@368
   286
                echo "-- dynamic libvorbisidec -> $ogg_lib"
slouken@368
   287
                EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
slouken@368
   288
            else
slouken@368
   289
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisidec"
slouken@368
   290
            fi
slouken@368
   291
        fi
slouken@368
   292
    else
slouken@368
   293
        AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
slouken@368
   294
        AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes])
slouken@368
   295
        if test x$have_ogg_hdr = xyes -a x$have_ogg_lib = xyes; then
slouken@368
   296
            case "$host" in
slouken@368
   297
                *-*-darwin*)
slouken@368
   298
                    ogg_lib=[`find_lib libvorbisfile*.dylib`]
slouken@368
   299
                    ;;
slouken@368
   300
                *-*-cygwin* | *-*-mingw32*)
slouken@372
   301
                    ogg_lib=[`find_lib "libvorbisfile*.dll"`]
slouken@368
   302
                    ;;
slouken@368
   303
                *)
slouken@368
   304
                    ogg_lib=[`find_lib "libvorbisfile.so.[0-9]"`]
slouken@368
   305
                    if test x$ogg_lib = x; then
slouken@368
   306
                        ogg_lib=[`find_lib "libvorbisfile.so.[0-9]*"`]
slouken@368
   307
                    fi
slouken@368
   308
                    ;;
slouken@368
   309
            esac
slouken@368
   310
            SOURCES="$SOURCES $srcdir/*_ogg.c"
slouken@368
   311
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC"
slouken@368
   312
            if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
slouken@368
   313
                echo "-- dynamic libvorbisfile -> $ogg_lib"
slouken@368
   314
                EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
slouken@368
   315
            else
slouken@368
   316
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis -logg"
slouken@368
   317
            fi
slouken@368
   318
        fi
slouken@353
   319
    fi
slouken@353
   320
fi
slouken@382
   321
AC_ARG_ENABLE([music-flac],
slouken@382
   322
AC_HELP_STRING([--enable-music-flac], [enable FLAC music [[default=yes]]]),
slouken@382
   323
              [], [enable_music_flac=yes])
slouken@382
   324
AC_ARG_ENABLE([music-flac-shared],
slouken@382
   325
AC_HELP_STRING([--enable-music-flac-shared],
slouken@382
   326
              [dynamically load FLAC support [[default=yes]]]),
slouken@382
   327
              [], [enable_music_flac_shared=yes])
slouken@382
   328
if test x$enable_music_flac = xyes; then
slouken@382
   329
    AC_CHECK_HEADER([FLAC/stream_decoder.h], [have_flac_hdr=yes])
slouken@382
   330
    AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], [have_flac_lib=yes])
slouken@382
   331
    if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then
slouken@382
   332
        case "$host" in
slouken@382
   333
            *-*-darwin*)
slouken@382
   334
                flac_lib=[`find_lib FLAC*.dylib`]
slouken@382
   335
                ;;
slouken@382
   336
            *-*-cygwin* | *-*-mingw32*)
slouken@382
   337
                flac_lib=[`find_lib "libFLAC*.dll"`]
slouken@382
   338
                ;;
slouken@382
   339
            *)
slouken@382
   340
                flac_lib=[`find_lib "libFLAC.so.[0-9]"`]
slouken@382
   341
                if test x$flac_lib = x; then
slouken@382
   342
                    flac_lib=[`find_lib "libFLAC.so.[0-9]*"`]
slouken@382
   343
                fi
slouken@382
   344
                ;;
slouken@382
   345
        esac
slouken@382
   346
        SOURCES="$SOURCES $srcdir/*_flac.c"
slouken@382
   347
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_MUSIC"
slouken@382
   348
        if test x$enable_music_flac_shared = xyes && test x$flac_lib != x; then
slouken@382
   349
            echo "-- dynamic libFLAC -> $flac_lib"
slouken@382
   350
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_DYNAMIC=\\\"$flac_lib\\\""
slouken@382
   351
        else
slouken@382
   352
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lFLAC"
slouken@382
   353
        fi
slouken@382
   354
    fi
slouken@382
   355
fi
slouken@0
   356
AC_ARG_ENABLE(music-mp3,
slouken@312
   357
[  --enable-music-mp3      enable MP3 music via smpeg [[default=yes]]],
slouken@0
   358
              , enable_music_mp3=yes)
slouken@0
   359
if test x$enable_music_mp3 = xyes; then
slouken@83
   360
    SMPEG_VERSION=0.4.3
slouken@83
   361
    AM_PATH_SMPEG($SMPEG_VERSION, have_smpeg=yes, have_smpeg=no)
slouken@0
   362
    if test x$have_smpeg = xyes; then
slouken@313
   363
        AC_ARG_ENABLE([music-mp3-shared],
slouken@314
   364
AC_HELP_STRING([--enable-music-mp3-shared], [dynamically load MP3 support [[default=yes]]]),
slouken@314
   365
                      [], [enable_music_mp3_shared=yes])
slouken@313
   366
        case "$host" in
slouken@313
   367
            *-*-darwin*)
slouken@368
   368
                smpeg_lib=[`find_lib libsmpeg*.dylib`]
slouken@313
   369
                ;;
slouken@313
   370
            *-*-cygwin* | *-*-mingw32*)
slouken@372
   371
                smpeg_lib=[`find_lib "smpeg*.dll"`]
slouken@313
   372
                ;;
slouken@313
   373
            *)
slouken@374
   374
                smpeg_lib=[`find_lib "libsmpeg*.so.[0-9]"`]
slouken@368
   375
                if test x$smpeg_lib = x; then
slouken@374
   376
                    smpeg_lib=[`find_lib "libsmpeg*.so.[0-9]*"`]
slouken@368
   377
                fi
slouken@313
   378
                ;;
slouken@313
   379
        esac
slouken@314
   380
        SOURCES="$SOURCES $srcdir/*_mp3.c"
slouken@294
   381
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MUSIC $SMPEG_CFLAGS"
slouken@313
   382
        if test x$enable_music_mp3_shared = xyes && test x$smpeg_lib != x; then
slouken@313
   383
            echo "-- dynamic libsmpeg -> $smpeg_lib"
slouken@313
   384
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_DYNAMIC=\\\"$smpeg_lib\\\""
slouken@313
   385
        else
slouken@313
   386
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SMPEG_LIBS"
slouken@313
   387
        fi
slouken@0
   388
    fi
slouken@0
   389
fi
slouken@357
   390
AC_ARG_ENABLE(music-mp3-mad-gpl,
slouken@357
   391
AC_HELP_STRING([--enable-music-mp3-mad-gpl], [enable MP3 music via libmad GPL code [[default=no]]]),
slouken@357
   392
                  [], [enable_music_mp3_mad_gpl=no])
slouken@357
   393
if test x$enable_music_mp3_mad_gpl = xyes; then
slouken@357
   394
    AC_MSG_CHECKING(for libmad headers)
slouken@357
   395
    have_libmad=no
slouken@357
   396
    AC_TRY_COMPILE([
slouken@357
   397
     #include "mad.h"
slouken@357
   398
    ],[
slouken@357
   399
    ],[
slouken@357
   400
    have_libmad=yes
slouken@357
   401
    ])
slouken@357
   402
    AC_MSG_RESULT($have_libmad)
slouken@357
   403
    if test x$have_libmad = xyes; then
slouken@357
   404
        SOURCES="$SOURCES $srcdir/music_mad.c"
slouken@357
   405
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MAD_MUSIC"
slouken@357
   406
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
slouken@357
   407
    fi
slouken@357
   408
fi
slouken@0
   409
slouken@294
   410
OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
slouken@368
   411
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
slouken@1
   412
slouken@294
   413
dnl Expand the sources and objects needed to build the library
slouken@294
   414
AC_SUBST(ac_aux_dir)
slouken@294
   415
AC_SUBST(SOURCES)
slouken@294
   416
AC_SUBST(OBJECTS)
slouken@294
   417
AC_SUBST(BUILD_CFLAGS)
slouken@294
   418
AC_SUBST(EXTRA_CFLAGS)
slouken@294
   419
AC_SUBST(BUILD_LDFLAGS)
slouken@294
   420
AC_SUBST(EXTRA_LDFLAGS)
slouken@294
   421
AC_SUBST(EXE)
slouken@368
   422
AC_SUBST(WINDRES)
slouken@294
   423
AC_SUBST(SDL_CFLAGS)
slouken@294
   424
AC_SUBST(SDL_LIBS)
slouken@206
   425
slouken@0
   426
AC_OUTPUT([
slouken@294
   427
    Makefile SDL_mixer.spec SDL_mixer.qpg
slouken@294
   428
], [
slouken@294
   429
    : >build-deps
slouken@294
   430
    if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend
slouken@0
   431
])