configure.in
author Sam Lantinga <slouken@libsdl.org>
Sun, 27 Sep 2009 19:34:09 +0000
changeset 402 2bfcf7edcb6f
parent 396 de5061390913
child 405 bfb16c4e42e0
permissions -rw-r--r--
Fixed bug #812

Max Horn 2009-09-27 11:58:18 PDT

I got build failure reports from various people for SDL-mixer on OS X when
compiling in 64bit mode, both in 10.5 and 10.6. The reason: Deprecated
QuickTime APIs that have been removed for 64bit binaries, see below.

Proposed short-term workaround: Disable or just remove the crappy "native" MIDI
code. It's rather bad anyway (I should know, i wrote it ;).

Mid/long-term solution: Write new CoreAudio based code to replace it. That code
then would work on all OS X versions (well, at least on 10.4 upwards for sure),
be more accurate, sound better and take up less system resources. And be
simpler, did I mention that? Generating MIDI output with CoreAudio is pretty
easy, we do it in ScummVM, Exult, Pentagram, DOSBox, ...
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@402
   224
                # This doesn't work on Mac OS X 10.5+
slouken@402
   225
                # Max Horn (the original author) recommends disabling it for now.
slouken@402
   226
                #use_music_native_midi=yes
slouken@402
   227
                #EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime -Wl,-framework,CoreServices"
slouken@107
   228
                ;;
slouken@99
   229
        esac
slouken@99
   230
        if test x$use_music_native_midi = xyes; then
slouken@294
   231
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
slouken@294
   232
            SOURCES="$SOURCES $srcdir/native_midi/*.c"
slouken@99
   233
        fi
slouken@99
   234
    fi
slouken@312
   235
    AC_ARG_ENABLE([music-native-midi-gpl],
slouken@312
   236
AC_HELP_STRING([--enable-music-native-midi-gpl], [enable native MIDI on UNIX using GPL code [[default=no]]]),
slouken@312
   237
                  [], [enable_music_native_midi_gpl=no])
slouken@160
   238
    if test x$enable_music_native_midi_gpl = xyes; then
slouken@160
   239
        use_music_native_midi_gpl=no
slouken@289
   240
        case "$host" in
slouken@160
   241
            *-*-linux* | *-*-freebsd*)
slouken@160
   242
                use_music_native_midi_gpl=yes
slouken@160
   243
                ;;
slouken@160
   244
        esac
slouken@160
   245
        if test x$use_music_native_midi_gpl = xyes; then
slouken@294
   246
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
slouken@294
   247
            SOURCES="$SOURCES $srcdir/native_midi_gpl/*.c"
slouken@160
   248
        fi
slouken@160
   249
    fi
slouken@0
   250
fi
slouken@312
   251
AC_ARG_ENABLE([music-ogg],
slouken@312
   252
AC_HELP_STRING([--enable-music-ogg], [enable Ogg Vorbis music [[default=yes]]]),
slouken@312
   253
              [], [enable_music_ogg=yes])
slouken@353
   254
AC_ARG_ENABLE(music-ogg-tremor,
slouken@353
   255
[  --enable-music-ogg-tremor   enable OGG music via libtremor [[default=no]]],
slouken@368
   256
              [], enable_music_ogg_tremor=no)
slouken@368
   257
AC_ARG_ENABLE([music-ogg-shared],
slouken@368
   258
AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis support [[default=yes]]]),
slouken@368
   259
              [], [enable_music_ogg_shared=yes])
slouken@368
   260
if test x$enable_music_ogg = xyes; then
slouken@368
   261
    if test x$enable_music_ogg_tremor = xyes; then
slouken@368
   262
        AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes])
slouken@368
   263
        AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes])
slouken@368
   264
        if test x$have_tremor_hdr = xyes -a x$have_tremor_lib = xyes; then
slouken@368
   265
            case "$host" in
slouken@368
   266
                *-*-darwin*)
slouken@368
   267
                    ogg_lib=[`find_lib libvorbisidec*.dylib`]
slouken@368
   268
                    if test x$ogg_lib = x; then
slouken@368
   269
                        ogg_lib=[`find_lib libvorbisidec.[0-9]`]
slouken@368
   270
                    fi
slouken@368
   271
                    if test x$ogg_lib = x; then
slouken@368
   272
                        ogg_lib=[`find_lib libvorbisidec.[0-9]*`]
slouken@368
   273
                    fi
slouken@368
   274
                    ;;
slouken@368
   275
                *-*-cygwin* | *-*-mingw32*)
slouken@372
   276
                    ogg_lib=[`find_lib "vorbisidec*.dll"`]
slouken@368
   277
                    ;;
slouken@368
   278
                *)
slouken@368
   279
                    ogg_lib=[`find_lib "libvorbisidec.so.[0-9]"`]
slouken@368
   280
                    if test x$ogg_lib = x; then
slouken@368
   281
                        ogg_lib=[`find_lib "libvorbisidec.so.[0-9]*"`]
slouken@368
   282
                    fi
slouken@368
   283
                    ;;
slouken@368
   284
            esac
slouken@368
   285
            SOURCES="$SOURCES $srcdir/*_ogg.c"
slouken@368
   286
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC -DOGG_USE_TREMOR"
slouken@368
   287
            if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
slouken@368
   288
                echo "-- dynamic libvorbisidec -> $ogg_lib"
slouken@368
   289
                EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
slouken@368
   290
            else
slouken@368
   291
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisidec"
slouken@368
   292
            fi
slouken@368
   293
        fi
slouken@368
   294
    else
slouken@368
   295
        AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
slouken@368
   296
        AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes])
slouken@368
   297
        if test x$have_ogg_hdr = xyes -a x$have_ogg_lib = xyes; then
slouken@368
   298
            case "$host" in
slouken@368
   299
                *-*-darwin*)
slouken@368
   300
                    ogg_lib=[`find_lib libvorbisfile*.dylib`]
slouken@368
   301
                    ;;
slouken@368
   302
                *-*-cygwin* | *-*-mingw32*)
slouken@372
   303
                    ogg_lib=[`find_lib "libvorbisfile*.dll"`]
slouken@368
   304
                    ;;
slouken@368
   305
                *)
slouken@368
   306
                    ogg_lib=[`find_lib "libvorbisfile.so.[0-9]"`]
slouken@368
   307
                    if test x$ogg_lib = x; then
slouken@368
   308
                        ogg_lib=[`find_lib "libvorbisfile.so.[0-9]*"`]
slouken@368
   309
                    fi
slouken@368
   310
                    ;;
slouken@368
   311
            esac
slouken@368
   312
            SOURCES="$SOURCES $srcdir/*_ogg.c"
slouken@368
   313
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC"
slouken@368
   314
            if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
slouken@368
   315
                echo "-- dynamic libvorbisfile -> $ogg_lib"
slouken@368
   316
                EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
slouken@368
   317
            else
slouken@368
   318
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis -logg"
slouken@368
   319
            fi
slouken@368
   320
        fi
slouken@353
   321
    fi
slouken@353
   322
fi
slouken@396
   323
libflac_ver=8
slouken@382
   324
AC_ARG_ENABLE([music-flac],
slouken@382
   325
AC_HELP_STRING([--enable-music-flac], [enable FLAC music [[default=yes]]]),
slouken@382
   326
              [], [enable_music_flac=yes])
slouken@382
   327
AC_ARG_ENABLE([music-flac-shared],
slouken@382
   328
AC_HELP_STRING([--enable-music-flac-shared],
slouken@382
   329
              [dynamically load FLAC support [[default=yes]]]),
slouken@382
   330
              [], [enable_music_flac_shared=yes])
slouken@382
   331
if test x$enable_music_flac = xyes; then
slouken@396
   332
	AC_CHECK_HEADER([FLAC/export.h], [have_flac_export=yes])
slouken@396
   333
	if test x$have_flac_export = xyes; then
slouken@396
   334
		LIBS_SAVED="$LIBS"
slouken@396
   335
		LIBS="-lFLAC"
slouken@396
   336
	    AC_MSG_CHECKING([for libflac so-name version >= $libflac_ver])
slouken@396
   337
	    AC_TRY_RUN([
slouken@396
   338
#include "FLAC/export.h"
slouken@396
   339
#include "stdio.h"
slouken@396
   340
int main( int argc, char *argv[] ) {
slouken@396
   341
#if defined(FLAC_API_VERSION_CURRENT) && (FLAC_API_VERSION_CURRENT >= $libflac_ver)
slouken@396
   342
	return 0;
slouken@396
   343
#else
slouken@396
   344
	return 1;
slouken@396
   345
#endif
slouken@396
   346
}
slouken@396
   347
], have_flac_ver=yes, have_flac_ver=no)
slouken@396
   348
		LIBS="$LIBS_SAVED"
slouken@396
   349
		AC_MSG_RESULT($have_flac_ver)
slouken@396
   350
		if test x$have_flac_ver = xno; then
slouken@396
   351
			echo "*** FLAC support has been disabled."
slouken@396
   352
		else
slouken@396
   353
			AC_CHECK_HEADER([FLAC/stream_decoder.h], [have_flac_hdr=yes])
slouken@396
   354
			AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], [have_flac_lib=yes])
slouken@396
   355
			if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then	
slouken@396
   356
			    case "$host" in
slouken@396
   357
			        *-*-darwin*)
slouken@396
   358
			            flac_lib=[`find_lib FLAC*.dylib`]
slouken@396
   359
			            ;;
slouken@396
   360
			        *-*-cygwin* | *-*-mingw32*)
slouken@396
   361
			            flac_lib=[`find_lib "libFLAC*.dll"`]
slouken@396
   362
			            ;;
slouken@396
   363
			        *)
slouken@396
   364
			            flac_lib=[`find_lib "libFLAC.so.[0-9]"`]
slouken@396
   365
			            if test x$flac_lib = x; then
slouken@396
   366
			                flac_lib=[`find_lib "libFLAC.so.[0-9]*"`]
slouken@396
   367
			            fi
slouken@396
   368
			            ;;
slouken@396
   369
			    esac
slouken@396
   370
			    SOURCES="$SOURCES $srcdir/*_flac.c"
slouken@396
   371
			    EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_MUSIC"
slouken@396
   372
			    if test x$enable_music_flac_shared = xyes && test x$flac_lib != x; then
slouken@396
   373
			        echo "-- dynamic libFLAC -> $flac_lib"
slouken@396
   374
			        EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_DYNAMIC=\\\"$flac_lib\\\""
slouken@396
   375
			    else
slouken@396
   376
			        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lFLAC"
slouken@396
   377
			    fi
slouken@396
   378
			fi
slouken@396
   379
		fi
slouken@396
   380
	fi
slouken@382
   381
fi
slouken@0
   382
AC_ARG_ENABLE(music-mp3,
slouken@312
   383
[  --enable-music-mp3      enable MP3 music via smpeg [[default=yes]]],
slouken@0
   384
              , enable_music_mp3=yes)
slouken@0
   385
if test x$enable_music_mp3 = xyes; then
slouken@83
   386
    SMPEG_VERSION=0.4.3
slouken@83
   387
    AM_PATH_SMPEG($SMPEG_VERSION, have_smpeg=yes, have_smpeg=no)
slouken@0
   388
    if test x$have_smpeg = xyes; then
slouken@313
   389
        AC_ARG_ENABLE([music-mp3-shared],
slouken@314
   390
AC_HELP_STRING([--enable-music-mp3-shared], [dynamically load MP3 support [[default=yes]]]),
slouken@314
   391
                      [], [enable_music_mp3_shared=yes])
slouken@313
   392
        case "$host" in
slouken@313
   393
            *-*-darwin*)
slouken@368
   394
                smpeg_lib=[`find_lib libsmpeg*.dylib`]
slouken@313
   395
                ;;
slouken@313
   396
            *-*-cygwin* | *-*-mingw32*)
slouken@372
   397
                smpeg_lib=[`find_lib "smpeg*.dll"`]
slouken@313
   398
                ;;
slouken@313
   399
            *)
slouken@374
   400
                smpeg_lib=[`find_lib "libsmpeg*.so.[0-9]"`]
slouken@368
   401
                if test x$smpeg_lib = x; then
slouken@374
   402
                    smpeg_lib=[`find_lib "libsmpeg*.so.[0-9]*"`]
slouken@368
   403
                fi
slouken@313
   404
                ;;
slouken@313
   405
        esac
slouken@314
   406
        SOURCES="$SOURCES $srcdir/*_mp3.c"
slouken@294
   407
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MUSIC $SMPEG_CFLAGS"
slouken@313
   408
        if test x$enable_music_mp3_shared = xyes && test x$smpeg_lib != x; then
slouken@313
   409
            echo "-- dynamic libsmpeg -> $smpeg_lib"
slouken@313
   410
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_DYNAMIC=\\\"$smpeg_lib\\\""
slouken@313
   411
        else
slouken@313
   412
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SMPEG_LIBS"
slouken@313
   413
        fi
slouken@0
   414
    fi
slouken@0
   415
fi
slouken@357
   416
AC_ARG_ENABLE(music-mp3-mad-gpl,
slouken@357
   417
AC_HELP_STRING([--enable-music-mp3-mad-gpl], [enable MP3 music via libmad GPL code [[default=no]]]),
slouken@357
   418
                  [], [enable_music_mp3_mad_gpl=no])
slouken@357
   419
if test x$enable_music_mp3_mad_gpl = xyes; then
slouken@357
   420
    AC_MSG_CHECKING(for libmad headers)
slouken@357
   421
    have_libmad=no
slouken@357
   422
    AC_TRY_COMPILE([
slouken@357
   423
     #include "mad.h"
slouken@357
   424
    ],[
slouken@357
   425
    ],[
slouken@357
   426
    have_libmad=yes
slouken@357
   427
    ])
slouken@357
   428
    AC_MSG_RESULT($have_libmad)
slouken@357
   429
    if test x$have_libmad = xyes; then
slouken@357
   430
        SOURCES="$SOURCES $srcdir/music_mad.c"
slouken@357
   431
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MAD_MUSIC"
slouken@357
   432
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
slouken@357
   433
    fi
slouken@357
   434
fi
slouken@0
   435
slouken@294
   436
OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
slouken@368
   437
OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
slouken@1
   438
slouken@294
   439
dnl Expand the sources and objects needed to build the library
slouken@294
   440
AC_SUBST(ac_aux_dir)
slouken@294
   441
AC_SUBST(SOURCES)
slouken@294
   442
AC_SUBST(OBJECTS)
slouken@294
   443
AC_SUBST(BUILD_CFLAGS)
slouken@294
   444
AC_SUBST(EXTRA_CFLAGS)
slouken@294
   445
AC_SUBST(BUILD_LDFLAGS)
slouken@294
   446
AC_SUBST(EXTRA_LDFLAGS)
slouken@294
   447
AC_SUBST(EXE)
slouken@368
   448
AC_SUBST(WINDRES)
slouken@392
   449
AC_SUBST(SDL_VERSION)
slouken@294
   450
AC_SUBST(SDL_CFLAGS)
slouken@294
   451
AC_SUBST(SDL_LIBS)
slouken@206
   452
slouken@0
   453
AC_OUTPUT([
slouken@392
   454
    Makefile SDL_mixer.spec SDL_mixer.qpg SDL_mixer.pc
slouken@294
   455
], [
slouken@294
   456
    : >build-deps
slouken@294
   457
    if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend
slouken@0
   458
])