configure.in
author Sam Lantinga <slouken@libsdl.org>
Mon, 19 Oct 2009 01:03:40 +0000
changeset 462 028b317d01d2
parent 461 6f66102b0f72
child 463 47c9366cede1
permissions -rw-r--r--
Added the AudioUnit framework for the native MIDI code.
slouken@0
     1
dnl Process this file with autoconf to produce a configure script.
slouken@0
     2
AC_INIT(README)
slouken@426
     3
AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
slouken@0
     4
slouken@0
     5
dnl Set various version strings - taken gratefully from the GTk sources
slouken@0
     6
slouken@0
     7
# Making releases:
slouken@0
     8
#   MICRO_VERSION += 1;
slouken@0
     9
#   INTERFACE_AGE += 1;
slouken@0
    10
#   BINARY_AGE += 1;
slouken@0
    11
# if any functions have been added, set INTERFACE_AGE to 0.
slouken@0
    12
# if backwards compatibility has been broken,
slouken@0
    13
# set BINARY_AGE and INTERFACE_AGE to 0.
slouken@294
    14
#
slouken@0
    15
MAJOR_VERSION=1
slouken@81
    16
MINOR_VERSION=2
slouken@429
    17
MICRO_VERSION=9
slouken@429
    18
INTERFACE_AGE=7
slouken@429
    19
BINARY_AGE=9
slouken@0
    20
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
slouken@0
    21
slouken@0
    22
AC_SUBST(MAJOR_VERSION)
slouken@0
    23
AC_SUBST(MINOR_VERSION)
slouken@0
    24
AC_SUBST(MICRO_VERSION)
slouken@0
    25
AC_SUBST(INTERFACE_AGE)
slouken@0
    26
AC_SUBST(BINARY_AGE)
slouken@0
    27
AC_SUBST(VERSION)
slouken@0
    28
slouken@0
    29
# libtool versioning
slouken@426
    30
LT_INIT([win32-dll])
slouken@426
    31
slouken@0
    32
LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
slouken@0
    33
LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
slouken@0
    34
LT_REVISION=$INTERFACE_AGE
slouken@0
    35
LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
slouken@435
    36
m4_pattern_allow([^LT_])
slouken@0
    37
slouken@0
    38
AC_SUBST(LT_RELEASE)
slouken@0
    39
AC_SUBST(LT_CURRENT)
slouken@0
    40
AC_SUBST(LT_REVISION)
slouken@0
    41
AC_SUBST(LT_AGE)
slouken@0
    42
slouken@289
    43
dnl Detect the canonical build and host environments
slouken@294
    44
AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
slouken@435
    45
dnl AC_CANONICAL_HOST
slouken@68
    46
slouken@406
    47
dnl Check for tools
slouken@406
    48
AC_PROG_LIBTOOL
slouken@406
    49
AC_PROG_CC
slouken@406
    50
AC_PROG_INSTALL
slouken@406
    51
AC_PROG_MAKE_SET
slouken@406
    52
if test -z "$host_alias"; then
slouken@406
    53
    hostaliaswindres=
slouken@406
    54
else
slouken@406
    55
    hostaliaswindres="$host_alias-windres"
slouken@406
    56
fi
slouken@406
    57
AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres])
slouken@406
    58
slouken@294
    59
dnl Set up the compiler and linker flags
slouken@294
    60
case "$host" in
slouken@294
    61
    *-*-cygwin*)
slouken@294
    62
        # We build SDL on cygwin without the UNIX emulation layer
slouken@294
    63
        BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
slouken@294
    64
        BASE_LDFLAGS="-mno-cygwin"
slouken@294
    65
        ;;
slouken@294
    66
    *)
slouken@294
    67
        BASE_CFLAGS="-D_GNU_SOURCE=1"
slouken@294
    68
        BASE_LDFLAGS=""
slouken@294
    69
        ;;
slouken@294
    70
esac
slouken@294
    71
BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
slouken@294
    72
EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
slouken@294
    73
BUILD_LDFLAGS="$LDFLAGS"
slouken@294
    74
EXTRA_LDFLAGS="$BASE_LDFLAGS"
slouken@368
    75
## These are common directories to find software packages
slouken@368
    76
#for path in /usr/freeware /usr/pkg /usr/local; do
slouken@368
    77
#    if test -d $path/include; then
slouken@368
    78
#        EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
slouken@368
    79
#    fi
slouken@368
    80
#    if test -d $path/lib; then
slouken@368
    81
#        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
slouken@368
    82
#    fi
slouken@368
    83
#done
slouken@294
    84
CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
slouken@294
    85
CFLAGS="$CFLAGS $EXTRA_CFLAGS"
slouken@294
    86
LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
slouken@91
    87
slouken@294
    88
dnl Check for compiler characteristics
slouken@294
    89
AC_C_CONST
slouken@0
    90
slouken@432
    91
dnl See whether we can use gcc style dependency tracking
slouken@432
    92
AC_ARG_ENABLE(dependency-tracking,
slouken@432
    93
AC_HELP_STRING([--enable-dependency-tracking],
slouken@432
    94
               [Use gcc -MMD -MT dependency tracking [[default=yes]]]),
slouken@432
    95
              , enable_dependency_tracking=yes)
slouken@432
    96
if test x$enable_dependency_tracking = xyes; then
slouken@432
    97
    have_gcc_mmd_mt=no
slouken@432
    98
    AC_MSG_CHECKING(for GCC -MMD -MT option)
slouken@432
    99
    AC_TRY_COMPILE([
slouken@432
   100
    #if !defined(__GNUC__) || __GNUC__ < 3
slouken@432
   101
    #error Dependency tracking requires GCC 3.0 or newer
slouken@432
   102
    #endif
slouken@432
   103
    ],[
slouken@432
   104
    ],[
slouken@432
   105
    have_gcc_mmd_mt=yes
slouken@432
   106
    ])
slouken@432
   107
    AC_MSG_RESULT($have_gcc_mmd_mt)
slouken@432
   108
slouken@432
   109
    if test x$have_gcc_mmd_mt = xyes; then
slouken@432
   110
        DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
slouken@432
   111
    fi
slouken@432
   112
fi
slouken@432
   113
    
slouken@289
   114
case "$host" in
slouken@294
   115
    *-*-cygwin* | *-*-mingw32*)
slouken@422
   116
        VERSION_SOURCES="$srcdir/version.rc"
slouken@294
   117
        EXE=".exe"
slouken@368
   118
        if test "$build" != "$host"; then # cross-compiling
slouken@368
   119
            # Default cross-compile location
slouken@368
   120
            ac_default_prefix=/usr/local/cross-tools/i386-mingw32
slouken@368
   121
        else
slouken@368
   122
            # Look for the location of the tools and install there
slouken@368
   123
            if test "$BUILD_PREFIX" != ""; then
slouken@368
   124
                ac_default_prefix=$BUILD_PREFIX
slouken@368
   125
            fi
slouken@368
   126
        fi
slouken@6
   127
        ;;
slouken@294
   128
    *)
slouken@368
   129
        SOURCES=""
slouken@294
   130
        EXE=""
slouken@208
   131
        ;;
slouken@6
   132
esac
slouken@6
   133
slouken@294
   134
# Standard C sources
slouken@294
   135
SOURCES="$SOURCES \
slouken@294
   136
$srcdir/effect_position.c \
slouken@294
   137
$srcdir/effect_stereoreverse.c \
slouken@294
   138
$srcdir/effects_internal.c \
slouken@294
   139
$srcdir/load_aiff.c \
slouken@294
   140
$srcdir/load_voc.c \
slouken@294
   141
$srcdir/mixer.c \
slouken@294
   142
$srcdir/music.c"
slouken@294
   143
slouken@451
   144
dnl set this to use on systems that use lib64 instead of lib
slouken@451
   145
base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
slouken@451
   146
slouken@451
   147
dnl Function to find a library in the compiler search path
slouken@368
   148
find_lib()
slouken@368
   149
{
slouken@372
   150
    gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
slouken@372
   151
    gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
slouken@451
   152
    env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
slouken@405
   153
    if test "$cross_compiling" = yes; then
slouken@405
   154
        host_lib_path=""
slouken@405
   155
    else
slouken@451
   156
        host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
slouken@405
   157
    fi
slouken@405
   158
    for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do
slouken@451
   159
        lib=[`ls -- $path/$1 2>/dev/null | sort | sed 's/.*\/\(.*\)/\1/; q'`]
slouken@368
   160
        if test x$lib != x; then
slouken@368
   161
            echo $lib
slouken@368
   162
            return
slouken@368
   163
        fi
slouken@368
   164
    done
slouken@368
   165
}
slouken@368
   166
slouken@20
   167
dnl Check for SDL
slouken@308
   168
SDL_VERSION=1.2.10
slouken@20
   169
AM_PATH_SDL($SDL_VERSION,
slouken@20
   170
            :,
slouken@368
   171
            AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
slouken@20
   172
)
slouken@294
   173
EXTRA_CFLAGS="$EXTRA_CFLAGS $SDL_CFLAGS"
slouken@294
   174
EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SDL_LIBS"
slouken@0
   175
slouken@0
   176
dnl Check command-line options
slouken@91
   177
slouken@312
   178
AC_ARG_ENABLE([music-cmd],
slouken@312
   179
AC_HELP_STRING([--enable-music-cmd], [support an external music player [[default=yes]]]),
slouken@312
   180
              [], [enable_music_cmd=yes])
slouken@0
   181
if test x$enable_music_cmd = xyes; then
slouken@294
   182
    SOURCES="$SOURCES $srcdir/music_cmd.c"
slouken@294
   183
    EXTRA_CFLAGS="$EXTRA_CFLAGS -DCMD_MUSIC"
slouken@0
   184
fi
slouken@419
   185
slouken@312
   186
AC_ARG_ENABLE([music-wave],
slouken@312
   187
AC_HELP_STRING([--enable-music-wave], [enable streaming WAVE music [[default=yes]]]),
slouken@312
   188
              [], [enable_music_wave=yes])
slouken@0
   189
if test x$enable_music_wave = xyes; then
slouken@294
   190
    SOURCES="$SOURCES $srcdir/wavestream.c"
slouken@294
   191
    EXTRA_CFLAGS="$EXTRA_CFLAGS -DWAV_MUSIC"
slouken@0
   192
fi
slouken@419
   193
slouken@419
   194
AC_ARG_ENABLE([music-mod],
slouken@419
   195
AC_HELP_STRING([--enable-music-mod], [enable MOD music via mikmod [[default=yes]]]),
slouken@419
   196
              [], [enable_music_mod=yes])
slouken@419
   197
AC_ARG_ENABLE([music-mod-shared],
slouken@419
   198
AC_HELP_STRING([--enable-music-mod-shared], [dynamically load MOD support [[default=yes]]]),
slouken@419
   199
              [], [enable_music_mod_shared=yes])
slouken@419
   200
if test x$enable_music_mod = xyes; then
slouken@419
   201
    have_libmikmod=no
slouken@419
   202
    libmikmod_maj=3
slouken@419
   203
    libmikmod_min=1
slouken@419
   204
    libmikmod_rev=10
slouken@419
   205
    libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
slouken@368
   206
    AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH])
slouken@368
   207
    if test "$LIBMIKMOD_CONFIG" != "no" ; then
slouken@419
   208
        
slouken@368
   209
        CFLAGS_SAVED="$CFLAGS"
slouken@368
   210
        LIBS_SAVED="$LIBS"
slouken@368
   211
        CFLAGS="$CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
slouken@368
   212
        LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
slouken@419
   213
        have_libmikmod=yes
slouken@368
   214
        AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver])
slouken@368
   215
        AC_TRY_RUN([
slouken@249
   216
#include "mikmod.h"
slouken@249
   217
#include "stdio.h"
slouken@249
   218
slouken@249
   219
int main(int argc, char **argv)
slouken@249
   220
{
slouken@419
   221
long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
slouken@419
   222
/*printf("(%d.%d.%d) ",ver>>16,(ver>>8)&0xff,ver&0xff);*/
slouken@419
   223
if(ver>=((maj<<16)|(min<<8)|(rev))) {
slouken@419
   224
    printf("yes\n");
slouken@419
   225
    return 0;
slouken@249
   226
}
slouken@419
   227
printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
slouken@419
   228
return 1;
slouken@419
   229
}
slouken@419
   230
], [], have_libmikmod=no; CFLAGS="$CFLAGS_SAVED"; LIBS="$LIBS_SAVED",
slouken@419
   231
        [echo $ac_n "cross compiling; assumed OK... $ac_c"])
slouken@368
   232
    fi
slouken@419
   233
slouken@419
   234
    if test x$have_libmikmod = xyes; then
slouken@419
   235
        case "$host" in
slouken@419
   236
            *-*-darwin*)
slouken@456
   237
                mikmod_lib=[`find_lib libmikmod.dylib`]
slouken@419
   238
                ;;
slouken@419
   239
            *-*-cygwin* | *-*-mingw32*)
slouken@419
   240
                mikmod_lib=[`find_lib "mikmod*.dll"`]
slouken@419
   241
                ;;
slouken@419
   242
            *)
slouken@419
   243
                mikmod_lib=[`find_lib "libmikmod*.so.[0-9]"`]
slouken@419
   244
                if test x$mikmod_lib = x; then
slouken@419
   245
                    mikmod_lib=[`find_lib "libmikmod*.so.[0-9]*"`]
slouken@419
   246
                fi
slouken@419
   247
                ;;
slouken@419
   248
        esac
slouken@419
   249
        SOURCES="$SOURCES $srcdir/*_mod.c"
slouken@419
   250
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
slouken@419
   251
        if test x$enable_music_mod_shared = xyes && test x$mikmod_lib != x; then
slouken@419
   252
            echo "-- dynamic libmikmod -> $mikmod_lib"
slouken@419
   253
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DMOD_DYNAMIC=\\\"$mikmod_lib\\\""
slouken@419
   254
        else
slouken@419
   255
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$LIBMIKMOD_CONFIG --libs`"
slouken@419
   256
        fi
slouken@419
   257
    else
slouken@419
   258
        AC_MSG_WARN([*** Unable to find MikMod library (http://mikmod.raphnet.net/)])
slouken@419
   259
        AC_MSG_WARN([MOD support disabled])
slouken@419
   260
    fi
slouken@249
   261
fi
slouken@249
   262
slouken@312
   263
AC_ARG_ENABLE([music-midi],
slouken@312
   264
AC_HELP_STRING([--enable-music-midi], [enable MIDI music via timidity [[default=yes]]]),
slouken@312
   265
              [], [enable_music_midi=yes])
slouken@0
   266
if test x$enable_music_midi = xyes; then
slouken@294
   267
    EXTRA_CFLAGS="$EXTRA_CFLAGS -DMID_MUSIC"
slouken@312
   268
    AC_ARG_ENABLE([music-timidity-midi],
slouken@312
   269
AC_HELP_STRING([--enable-music-timidity-midi], [enable timidity MIDI output [[default=yes]]]),
slouken@312
   270
                  [], [enable_music_timidity_midi=yes])
slouken@106
   271
    if test x$enable_music_timidity_midi = xyes; then
slouken@294
   272
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_TIMIDITY_MIDI -I\$(srcdir)/timidity"
slouken@294
   273
        SOURCES="$SOURCES $srcdir/timidity/*.c"
slouken@106
   274
    fi
slouken@312
   275
    AC_ARG_ENABLE([music-native-midi],
slouken@312
   276
AC_HELP_STRING([--enable-music-native-midi], [enable native MIDI music output [[default=yes]]]),
slouken@312
   277
                  [], [enable_music_native_midi=yes])
slouken@99
   278
    if test x$enable_music_native_midi = xyes; then
slouken@99
   279
        use_music_native_midi=no
slouken@289
   280
        case "$host" in
slouken@99
   281
            *-*-cygwin* | *-*-mingw32*)
slouken@99
   282
                use_music_native_midi=yes
slouken@294
   283
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lwinmm"
slouken@99
   284
                ;;
slouken@107
   285
            *-*-darwin*)
icculus@458
   286
                use_music_native_midi=yes
icculus@461
   287
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,CoreServices"
slouken@107
   288
                ;;
slouken@99
   289
        esac
slouken@99
   290
        if test x$use_music_native_midi = xyes; then
slouken@294
   291
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
slouken@294
   292
            SOURCES="$SOURCES $srcdir/native_midi/*.c"
slouken@99
   293
        fi
slouken@99
   294
    fi
slouken@312
   295
    AC_ARG_ENABLE([music-native-midi-gpl],
slouken@312
   296
AC_HELP_STRING([--enable-music-native-midi-gpl], [enable native MIDI on UNIX using GPL code [[default=no]]]),
slouken@312
   297
                  [], [enable_music_native_midi_gpl=no])
slouken@160
   298
    if test x$enable_music_native_midi_gpl = xyes; then
slouken@160
   299
        use_music_native_midi_gpl=no
slouken@289
   300
        case "$host" in
slouken@160
   301
            *-*-linux* | *-*-freebsd*)
slouken@160
   302
                use_music_native_midi_gpl=yes
slouken@160
   303
                ;;
slouken@160
   304
        esac
slouken@160
   305
        if test x$use_music_native_midi_gpl = xyes; then
slouken@294
   306
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
slouken@294
   307
            SOURCES="$SOURCES $srcdir/native_midi_gpl/*.c"
slouken@160
   308
        fi
slouken@160
   309
    fi
slouken@0
   310
fi
slouken@419
   311
slouken@312
   312
AC_ARG_ENABLE([music-ogg],
slouken@312
   313
AC_HELP_STRING([--enable-music-ogg], [enable Ogg Vorbis music [[default=yes]]]),
slouken@312
   314
              [], [enable_music_ogg=yes])
slouken@353
   315
AC_ARG_ENABLE(music-ogg-tremor,
slouken@419
   316
AC_HELP_STRING([--enable-music-ogg-tremor], [enable OGG Vorbis music via libtremor [[default=no]]]),
slouken@368
   317
              [], enable_music_ogg_tremor=no)
slouken@368
   318
AC_ARG_ENABLE([music-ogg-shared],
slouken@368
   319
AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis support [[default=yes]]]),
slouken@368
   320
              [], [enable_music_ogg_shared=yes])
slouken@368
   321
if test x$enable_music_ogg = xyes; then
slouken@368
   322
    if test x$enable_music_ogg_tremor = xyes; then
slouken@368
   323
        AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes])
slouken@368
   324
        AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes])
slouken@368
   325
        if test x$have_tremor_hdr = xyes -a x$have_tremor_lib = xyes; then
slouken@368
   326
            case "$host" in
slouken@368
   327
                *-*-darwin*)
slouken@456
   328
                    ogg_lib=[`find_lib libvorbisidec.dylib`]
slouken@368
   329
                    if test x$ogg_lib = x; then
slouken@368
   330
                        ogg_lib=[`find_lib libvorbisidec.[0-9]`]
slouken@368
   331
                    fi
slouken@368
   332
                    if test x$ogg_lib = x; then
slouken@368
   333
                        ogg_lib=[`find_lib libvorbisidec.[0-9]*`]
slouken@368
   334
                    fi
slouken@368
   335
                    ;;
slouken@368
   336
                *-*-cygwin* | *-*-mingw32*)
slouken@372
   337
                    ogg_lib=[`find_lib "vorbisidec*.dll"`]
slouken@368
   338
                    ;;
slouken@368
   339
                *)
slouken@368
   340
                    ogg_lib=[`find_lib "libvorbisidec.so.[0-9]"`]
slouken@368
   341
                    if test x$ogg_lib = x; then
slouken@368
   342
                        ogg_lib=[`find_lib "libvorbisidec.so.[0-9]*"`]
slouken@368
   343
                    fi
slouken@368
   344
                    ;;
slouken@368
   345
            esac
slouken@368
   346
            SOURCES="$SOURCES $srcdir/*_ogg.c"
slouken@368
   347
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC -DOGG_USE_TREMOR"
slouken@368
   348
            if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
slouken@368
   349
                echo "-- dynamic libvorbisidec -> $ogg_lib"
slouken@368
   350
                EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
slouken@368
   351
            else
slouken@368
   352
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisidec"
slouken@368
   353
            fi
slouken@419
   354
        else
slouken@419
   355
            AC_MSG_WARN([*** Unable to find Ogg Vorbis Tremor library (http://www.xiph.org/)])
slouken@419
   356
            AC_MSG_WARN([Ogg Vorbis support disabled])
slouken@368
   357
        fi
slouken@368
   358
    else
slouken@368
   359
        AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
slouken@368
   360
        AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes])
slouken@368
   361
        if test x$have_ogg_hdr = xyes -a x$have_ogg_lib = xyes; then
slouken@368
   362
            case "$host" in
slouken@368
   363
                *-*-darwin*)
slouken@456
   364
                    ogg_lib=[`find_lib libvorbisfile.dylib`]
slouken@368
   365
                    ;;
slouken@368
   366
                *-*-cygwin* | *-*-mingw32*)
slouken@372
   367
                    ogg_lib=[`find_lib "libvorbisfile*.dll"`]
slouken@368
   368
                    ;;
slouken@368
   369
                *)
slouken@368
   370
                    ogg_lib=[`find_lib "libvorbisfile.so.[0-9]"`]
slouken@368
   371
                    if test x$ogg_lib = x; then
slouken@368
   372
                        ogg_lib=[`find_lib "libvorbisfile.so.[0-9]*"`]
slouken@368
   373
                    fi
slouken@368
   374
                    ;;
slouken@368
   375
            esac
slouken@368
   376
            SOURCES="$SOURCES $srcdir/*_ogg.c"
slouken@368
   377
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC"
slouken@368
   378
            if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
slouken@368
   379
                echo "-- dynamic libvorbisfile -> $ogg_lib"
slouken@368
   380
                EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
slouken@368
   381
            else
slouken@368
   382
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis -logg"
slouken@368
   383
            fi
slouken@419
   384
        else
slouken@419
   385
            AC_MSG_WARN([*** Unable to find Ogg Vorbis library (http://www.xiph.org/)])
slouken@419
   386
            AC_MSG_WARN([Ogg Vorbis support disabled])
slouken@368
   387
        fi
slouken@353
   388
    fi
slouken@353
   389
fi
slouken@419
   390
slouken@396
   391
libflac_ver=8
slouken@382
   392
AC_ARG_ENABLE([music-flac],
slouken@382
   393
AC_HELP_STRING([--enable-music-flac], [enable FLAC music [[default=yes]]]),
slouken@382
   394
              [], [enable_music_flac=yes])
slouken@382
   395
AC_ARG_ENABLE([music-flac-shared],
slouken@382
   396
AC_HELP_STRING([--enable-music-flac-shared],
slouken@382
   397
              [dynamically load FLAC support [[default=yes]]]),
slouken@382
   398
              [], [enable_music_flac_shared=yes])
slouken@382
   399
if test x$enable_music_flac = xyes; then
slouken@452
   400
    AC_CHECK_HEADER([FLAC/export.h], [have_flac_export=yes])
slouken@452
   401
    if test x$have_flac_export = xyes; then
slouken@452
   402
        LIBS_SAVED="$LIBS"
slouken@452
   403
        LIBS="-lFLAC"
slouken@452
   404
        AC_MSG_CHECKING([for libflac so-name version >= $libflac_ver])
slouken@452
   405
        AC_TRY_RUN([
slouken@396
   406
#include "FLAC/export.h"
slouken@396
   407
#include "stdio.h"
slouken@396
   408
int main( int argc, char *argv[] ) {
slouken@396
   409
#if defined(FLAC_API_VERSION_CURRENT) && (FLAC_API_VERSION_CURRENT >= $libflac_ver)
slouken@452
   410
    return 0;
slouken@396
   411
#else
slouken@452
   412
    return 1;
slouken@396
   413
#endif
slouken@396
   414
}
slouken@396
   415
], have_flac_ver=yes, have_flac_ver=no)
slouken@419
   416
        LIBS="$LIBS_SAVED"
slouken@419
   417
        AC_MSG_RESULT($have_flac_ver)
slouken@419
   418
    fi
slouken@419
   419
slouken@419
   420
    if test x$have_flac_ver = xyes; then
slouken@419
   421
        AC_CHECK_HEADER([FLAC/stream_decoder.h], [have_flac_hdr=yes])
slouken@419
   422
        AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], [have_flac_lib=yes])
slouken@419
   423
        if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then    
slouken@419
   424
            case "$host" in
slouken@419
   425
                *-*-darwin*)
slouken@456
   426
                    flac_lib=[`find_lib libFLAC.dylib`]
slouken@419
   427
                    ;;
slouken@419
   428
                *-*-cygwin* | *-*-mingw32*)
slouken@419
   429
                    flac_lib=[`find_lib "libFLAC*.dll"`]
slouken@419
   430
                    ;;
slouken@419
   431
                *)
slouken@419
   432
                    flac_lib=[`find_lib "libFLAC.so.[0-9]"`]
slouken@419
   433
                    if test x$flac_lib = x; then
slouken@419
   434
                        flac_lib=[`find_lib "libFLAC.so.[0-9]*"`]
slouken@419
   435
                    fi
slouken@419
   436
                    ;;
slouken@419
   437
            esac
slouken@419
   438
            SOURCES="$SOURCES $srcdir/*_flac.c"
slouken@419
   439
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_MUSIC"
slouken@419
   440
            if test x$enable_music_flac_shared = xyes && test x$flac_lib != x; then
slouken@419
   441
                echo "-- dynamic libFLAC -> $flac_lib"
slouken@419
   442
                EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_DYNAMIC=\\\"$flac_lib\\\""
slouken@419
   443
            else
slouken@419
   444
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lFLAC"
slouken@419
   445
            fi
slouken@419
   446
        fi
slouken@419
   447
    else
slouken@419
   448
        AC_MSG_WARN([*** Unable to find FLAC library (http://flac.sourceforge.net/)])
slouken@419
   449
        AC_MSG_WARN([FLAC support disabled])
slouken@419
   450
    fi
slouken@382
   451
fi
slouken@419
   452
slouken@0
   453
AC_ARG_ENABLE(music-mp3,
slouken@419
   454
AC_HELP_STRING([--enable-music-mp3], [enable MP3 music via smpeg [[default=yes]]]),
slouken@419
   455
              [], enable_music_mp3=yes)
slouken@419
   456
AC_ARG_ENABLE([music-mp3-shared],
slouken@419
   457
AC_HELP_STRING([--enable-music-mp3-shared], [dynamically load MP3 support [[default=yes]]]),
slouken@419
   458
              [], [enable_music_mp3_shared=yes])
slouken@0
   459
if test x$enable_music_mp3 = xyes; then
slouken@83
   460
    SMPEG_VERSION=0.4.3
slouken@83
   461
    AM_PATH_SMPEG($SMPEG_VERSION, have_smpeg=yes, have_smpeg=no)
slouken@0
   462
    if test x$have_smpeg = xyes; then
slouken@313
   463
        case "$host" in
slouken@313
   464
            *-*-darwin*)
slouken@456
   465
                smpeg_lib=[`find_lib libsmpeg.dylib`]
slouken@313
   466
                ;;
slouken@313
   467
            *-*-cygwin* | *-*-mingw32*)
slouken@372
   468
                smpeg_lib=[`find_lib "smpeg*.dll"`]
slouken@313
   469
                ;;
slouken@313
   470
            *)
slouken@374
   471
                smpeg_lib=[`find_lib "libsmpeg*.so.[0-9]"`]
slouken@368
   472
                if test x$smpeg_lib = x; then
slouken@374
   473
                    smpeg_lib=[`find_lib "libsmpeg*.so.[0-9]*"`]
slouken@368
   474
                fi
slouken@313
   475
                ;;
slouken@313
   476
        esac
slouken@314
   477
        SOURCES="$SOURCES $srcdir/*_mp3.c"
slouken@294
   478
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MUSIC $SMPEG_CFLAGS"
slouken@313
   479
        if test x$enable_music_mp3_shared = xyes && test x$smpeg_lib != x; then
slouken@313
   480
            echo "-- dynamic libsmpeg -> $smpeg_lib"
slouken@313
   481
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_DYNAMIC=\\\"$smpeg_lib\\\""
slouken@313
   482
        else
slouken@313
   483
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SMPEG_LIBS"
slouken@313
   484
        fi
slouken@419
   485
    else
slouken@419
   486
        AC_MSG_WARN([*** Unable to find SMPEG library (http://icculus.org/smpeg/)])
slouken@0
   487
    fi
slouken@0
   488
fi
slouken@419
   489
slouken@357
   490
AC_ARG_ENABLE(music-mp3-mad-gpl,
slouken@357
   491
AC_HELP_STRING([--enable-music-mp3-mad-gpl], [enable MP3 music via libmad GPL code [[default=no]]]),
slouken@357
   492
                  [], [enable_music_mp3_mad_gpl=no])
slouken@357
   493
if test x$enable_music_mp3_mad_gpl = xyes; then
slouken@357
   494
    AC_MSG_CHECKING(for libmad headers)
slouken@357
   495
    have_libmad=no
slouken@357
   496
    AC_TRY_COMPILE([
slouken@357
   497
     #include "mad.h"
slouken@357
   498
    ],[
slouken@357
   499
    ],[
slouken@357
   500
    have_libmad=yes
slouken@357
   501
    ])
slouken@357
   502
    AC_MSG_RESULT($have_libmad)
slouken@357
   503
    if test x$have_libmad = xyes; then
slouken@357
   504
        SOURCES="$SOURCES $srcdir/music_mad.c"
slouken@357
   505
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MAD_MUSIC"
slouken@357
   506
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
slouken@419
   507
    else
slouken@419
   508
        AC_MSG_WARN([*** Unable to find MAD library (http://www.underbit.com/products/mad/)])
slouken@357
   509
    fi
slouken@357
   510
fi
slouken@0
   511
slouken@419
   512
if test x$have_smpeg != xyes -a x$have_libmad != xyes; then
slouken@419
   513
    AC_MSG_WARN([MP3 support disabled])
slouken@419
   514
fi
slouken@419
   515
slouken@422
   516
slouken@422
   517
OBJECTS=`echo $SOURCES`
slouken@422
   518
DEPENDS=`echo $SOURCES`
slouken@422
   519
OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
slouken@422
   520
DEPENDS=`echo "$DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
slouken@422
   521
$(objects)/\2.lo: \1/\2.c\\
slouken@432
   522
	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c \$< -o \$@,g'`
slouken@422
   523
slouken@422
   524
VERSION_OBJECTS=`echo $VERSION_SOURCES`
slouken@422
   525
VERSION_DEPENDS=`echo $VERSION_SOURCES`
slouken@422
   526
VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
slouken@422
   527
VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.rc,\\
slouken@422
   528
$(objects)/\2.o: \1/\2.rc\\
slouken@422
   529
	\$(WINDRES) \$< \$@,g'`
slouken@422
   530
slouken@422
   531
PLAYWAVE_SOURCES="$srcdir/playwave.c"
slouken@422
   532
PLAYWAVE_OBJECTS=`echo $PLAYWAVE_SOURCES`
slouken@422
   533
PLAYWAVE_DEPENDS=`echo $PLAYWAVE_SOURCES`
slouken@422
   534
PLAYWAVE_OBJECTS=`echo "$PLAYWAVE_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
slouken@422
   535
PLAYWAVE_DEPENDS=`echo "$PLAYWAVE_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
slouken@422
   536
$(objects)/\2.lo: \1/\2.c\\
slouken@432
   537
	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c \$< -o \$@,g'`
slouken@422
   538
slouken@422
   539
PLAYMUS_SOURCES="$srcdir/playmus.c"
slouken@422
   540
PLAYMUS_OBJECTS=`echo $PLAYMUS_SOURCES`
slouken@422
   541
PLAYMUS_DEPENDS=`echo $PLAYMUS_SOURCES`
slouken@422
   542
PLAYMUS_OBJECTS=`echo "$PLAYMUS_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
slouken@422
   543
PLAYMUS_DEPENDS=`echo "$PLAYMUS_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
slouken@422
   544
$(objects)/\2.lo: \1/\2.c\\
slouken@432
   545
	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c \$< -o \$@,g'`
slouken@1
   546
slouken@294
   547
dnl Expand the sources and objects needed to build the library
slouken@294
   548
AC_SUBST(ac_aux_dir)
slouken@294
   549
AC_SUBST(OBJECTS)
slouken@422
   550
AC_SUBST(DEPENDS)
slouken@422
   551
AC_SUBST(VERSION_OBJECTS)
slouken@422
   552
AC_SUBST(VERSION_DEPENDS)
slouken@422
   553
AC_SUBST(PLAYWAVE_OBJECTS)
slouken@422
   554
AC_SUBST(PLAYWAVE_DEPENDS)
slouken@422
   555
AC_SUBST(PLAYMUS_OBJECTS)
slouken@422
   556
AC_SUBST(PLAYMUS_DEPENDS)
slouken@294
   557
AC_SUBST(BUILD_CFLAGS)
slouken@294
   558
AC_SUBST(EXTRA_CFLAGS)
slouken@294
   559
AC_SUBST(BUILD_LDFLAGS)
slouken@294
   560
AC_SUBST(EXTRA_LDFLAGS)
slouken@294
   561
AC_SUBST(EXE)
slouken@368
   562
AC_SUBST(WINDRES)
slouken@392
   563
AC_SUBST(SDL_VERSION)
slouken@294
   564
AC_SUBST(SDL_CFLAGS)
slouken@294
   565
AC_SUBST(SDL_LIBS)
slouken@206
   566
slouken@0
   567
AC_OUTPUT([
slouken@392
   568
    Makefile SDL_mixer.spec SDL_mixer.qpg SDL_mixer.pc
slouken@0
   569
])