configure.in
author Sam Lantinga <slouken@libsdl.org>
Mon, 16 Nov 2009 04:40:54 +0000
changeset 481 286c27f54ea1
parent 477 c44842cb1d90
child 482 7b0c54eed938
permissions -rw-r--r--
Jon Atkins to Sam

I added libmodplug as a possible music player
defaulted to no in configure for now.
libmodplug has higher quality than mikmod, and it seems to be ported to all the major modern OS's (Linux/Win/OSX).
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@477
    17
MICRO_VERSION=11
slouken@477
    18
INTERFACE_AGE=1
slouken@477
    19
BINARY_AGE=11
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
patmandin@464
   176
dnl Check for math library
patmandin@464
   177
AC_CHECK_LIB(m, pow, [LIBM="-lm"])
patmandin@464
   178
slouken@0
   179
dnl Check command-line options
slouken@91
   180
slouken@312
   181
AC_ARG_ENABLE([music-cmd],
slouken@312
   182
AC_HELP_STRING([--enable-music-cmd], [support an external music player [[default=yes]]]),
slouken@467
   183
              [], [enable_music_cmd=detect])
slouken@467
   184
if test "x$enable_music_cmd" != xno; then
slouken@467
   185
    AC_CHECK_FUNCS([fork vfork])
slouken@467
   186
    if test "x$ac_cv_func_fork" = "xyes"; then
slouken@467
   187
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_FORK"
slouken@467
   188
    elif test "x$ac_cv_func_vfork" = "xyes"; then
slouken@467
   189
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_VFORK"
slouken@467
   190
    elif test "x$enable_music_cmd" = "xyes"; then
slouken@467
   191
        AC_MSG_ERROR([external music player not available on your platform])
slouken@467
   192
    else
slouken@467
   193
        enable_music_cmd=no
slouken@467
   194
    fi
slouken@467
   195
    if test "x$enable_music_cmd" != xno; then
slouken@467
   196
        SOURCES="$SOURCES $srcdir/music_cmd.c"
slouken@467
   197
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DCMD_MUSIC"
slouken@467
   198
    fi
slouken@0
   199
fi
slouken@419
   200
slouken@312
   201
AC_ARG_ENABLE([music-wave],
slouken@312
   202
AC_HELP_STRING([--enable-music-wave], [enable streaming WAVE music [[default=yes]]]),
slouken@312
   203
              [], [enable_music_wave=yes])
slouken@0
   204
if test x$enable_music_wave = xyes; then
slouken@294
   205
    SOURCES="$SOURCES $srcdir/wavestream.c"
slouken@294
   206
    EXTRA_CFLAGS="$EXTRA_CFLAGS -DWAV_MUSIC"
slouken@0
   207
fi
slouken@419
   208
slouken@419
   209
AC_ARG_ENABLE([music-mod],
slouken@419
   210
AC_HELP_STRING([--enable-music-mod], [enable MOD music via mikmod [[default=yes]]]),
slouken@419
   211
              [], [enable_music_mod=yes])
slouken@419
   212
AC_ARG_ENABLE([music-mod-shared],
slouken@419
   213
AC_HELP_STRING([--enable-music-mod-shared], [dynamically load MOD support [[default=yes]]]),
slouken@419
   214
              [], [enable_music_mod_shared=yes])
slouken@419
   215
if test x$enable_music_mod = xyes; then
slouken@419
   216
    have_libmikmod=no
slouken@419
   217
    libmikmod_maj=3
slouken@419
   218
    libmikmod_min=1
slouken@419
   219
    libmikmod_rev=10
slouken@419
   220
    libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
slouken@368
   221
    AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH])
slouken@368
   222
    if test "$LIBMIKMOD_CONFIG" != "no" ; then
slouken@419
   223
        
slouken@368
   224
        CFLAGS_SAVED="$CFLAGS"
slouken@368
   225
        LIBS_SAVED="$LIBS"
slouken@368
   226
        CFLAGS="$CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
slouken@368
   227
        LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
slouken@419
   228
        have_libmikmod=yes
slouken@368
   229
        AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver])
slouken@368
   230
        AC_TRY_RUN([
slouken@249
   231
#include "mikmod.h"
slouken@249
   232
#include "stdio.h"
slouken@249
   233
slouken@249
   234
int main(int argc, char **argv)
slouken@249
   235
{
slouken@419
   236
long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
slouken@419
   237
/*printf("(%d.%d.%d) ",ver>>16,(ver>>8)&0xff,ver&0xff);*/
slouken@419
   238
if(ver>=((maj<<16)|(min<<8)|(rev))) {
slouken@419
   239
    printf("yes\n");
slouken@419
   240
    return 0;
slouken@249
   241
}
slouken@419
   242
printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
slouken@419
   243
return 1;
slouken@419
   244
}
slouken@419
   245
], [], have_libmikmod=no; CFLAGS="$CFLAGS_SAVED"; LIBS="$LIBS_SAVED",
slouken@419
   246
        [echo $ac_n "cross compiling; assumed OK... $ac_c"])
slouken@368
   247
    fi
slouken@419
   248
slouken@419
   249
    if test x$have_libmikmod = xyes; then
slouken@419
   250
        case "$host" in
slouken@419
   251
            *-*-darwin*)
slouken@456
   252
                mikmod_lib=[`find_lib libmikmod.dylib`]
slouken@419
   253
                ;;
slouken@419
   254
            *-*-cygwin* | *-*-mingw32*)
slouken@419
   255
                mikmod_lib=[`find_lib "mikmod*.dll"`]
slouken@419
   256
                ;;
slouken@419
   257
            *)
slouken@419
   258
                mikmod_lib=[`find_lib "libmikmod*.so.[0-9]"`]
slouken@419
   259
                if test x$mikmod_lib = x; then
slouken@419
   260
                    mikmod_lib=[`find_lib "libmikmod*.so.[0-9]*"`]
slouken@419
   261
                fi
slouken@419
   262
                ;;
slouken@419
   263
        esac
slouken@419
   264
        SOURCES="$SOURCES $srcdir/*_mod.c"
slouken@419
   265
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
slouken@419
   266
        if test x$enable_music_mod_shared = xyes && test x$mikmod_lib != x; then
slouken@419
   267
            echo "-- dynamic libmikmod -> $mikmod_lib"
slouken@419
   268
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DMOD_DYNAMIC=\\\"$mikmod_lib\\\""
slouken@419
   269
        else
slouken@419
   270
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$LIBMIKMOD_CONFIG --libs`"
slouken@419
   271
        fi
slouken@419
   272
    else
slouken@419
   273
        AC_MSG_WARN([*** Unable to find MikMod library (http://mikmod.raphnet.net/)])
slouken@419
   274
    fi
slouken@249
   275
fi
slouken@249
   276
slouken@481
   277
AC_ARG_ENABLE([music-mod-modplug],
slouken@481
   278
AC_HELP_STRING([--enable-music-mod-modplug], [enable MOD music via modplug [[default=no]]]),
slouken@481
   279
              [], [enable_music_mod_modplug=no])
slouken@481
   280
if test x$enable_music_mod_modplug = xyes; then
slouken@481
   281
	PKG_CHECK_MODULES([MODPLUG], [libmodplug >= 0.8.7])
slouken@481
   282
	EXTRA_CFLAGS="$EXTRA_CFLAGS -DMODPLUG_MUSIC  $MODPLUG_CFLAGS"
slouken@481
   283
	EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MODPLUG_LIBS"
slouken@481
   284
dnl	AC_TRY_COMPILE([
slouken@481
   285
dnl     #include "modplug.h"
slouken@481
   286
dnl    ],[
slouken@481
   287
dnl    ],[
slouken@481
   288
    have_libmodplug=yes
slouken@481
   289
dnl    ])
slouken@481
   290
else
slouken@481
   291
	have_libmodplug=no
slouken@481
   292
fi
slouken@481
   293
slouken@481
   294
if test x$have_libmikmod != xyes -a x$have_libmodplug != xyes ; then
slouken@481
   295
	AC_MSG_WARN([MOD support disabled])
slouken@481
   296
fi
slouken@481
   297
slouken@312
   298
AC_ARG_ENABLE([music-midi],
slouken@312
   299
AC_HELP_STRING([--enable-music-midi], [enable MIDI music via timidity [[default=yes]]]),
slouken@312
   300
              [], [enable_music_midi=yes])
slouken@0
   301
if test x$enable_music_midi = xyes; then
slouken@294
   302
    EXTRA_CFLAGS="$EXTRA_CFLAGS -DMID_MUSIC"
slouken@312
   303
    AC_ARG_ENABLE([music-timidity-midi],
slouken@312
   304
AC_HELP_STRING([--enable-music-timidity-midi], [enable timidity MIDI output [[default=yes]]]),
slouken@312
   305
                  [], [enable_music_timidity_midi=yes])
slouken@106
   306
    if test x$enable_music_timidity_midi = xyes; then
slouken@294
   307
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_TIMIDITY_MIDI -I\$(srcdir)/timidity"
slouken@294
   308
        SOURCES="$SOURCES $srcdir/timidity/*.c"
slouken@106
   309
    fi
slouken@312
   310
    AC_ARG_ENABLE([music-native-midi],
slouken@312
   311
AC_HELP_STRING([--enable-music-native-midi], [enable native MIDI music output [[default=yes]]]),
slouken@312
   312
                  [], [enable_music_native_midi=yes])
slouken@99
   313
    if test x$enable_music_native_midi = xyes; then
slouken@99
   314
        use_music_native_midi=no
slouken@289
   315
        case "$host" in
slouken@99
   316
            *-*-cygwin* | *-*-mingw32*)
slouken@99
   317
                use_music_native_midi=yes
slouken@294
   318
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lwinmm"
slouken@99
   319
                ;;
slouken@107
   320
            *-*-darwin*)
icculus@458
   321
                use_music_native_midi=yes
icculus@461
   322
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,CoreServices"
slouken@107
   323
                ;;
slouken@99
   324
        esac
slouken@99
   325
        if test x$use_music_native_midi = xyes; then
slouken@294
   326
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
slouken@294
   327
            SOURCES="$SOURCES $srcdir/native_midi/*.c"
slouken@99
   328
        fi
slouken@99
   329
    fi
slouken@312
   330
    AC_ARG_ENABLE([music-native-midi-gpl],
slouken@312
   331
AC_HELP_STRING([--enable-music-native-midi-gpl], [enable native MIDI on UNIX using GPL code [[default=no]]]),
slouken@312
   332
                  [], [enable_music_native_midi_gpl=no])
slouken@160
   333
    if test x$enable_music_native_midi_gpl = xyes; then
slouken@160
   334
        use_music_native_midi_gpl=no
slouken@289
   335
        case "$host" in
slouken@160
   336
            *-*-linux* | *-*-freebsd*)
slouken@160
   337
                use_music_native_midi_gpl=yes
slouken@160
   338
                ;;
slouken@160
   339
        esac
slouken@160
   340
        if test x$use_music_native_midi_gpl = xyes; then
slouken@294
   341
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
slouken@294
   342
            SOURCES="$SOURCES $srcdir/native_midi_gpl/*.c"
slouken@160
   343
        fi
slouken@160
   344
    fi
slouken@0
   345
fi
slouken@419
   346
slouken@312
   347
AC_ARG_ENABLE([music-ogg],
slouken@312
   348
AC_HELP_STRING([--enable-music-ogg], [enable Ogg Vorbis music [[default=yes]]]),
slouken@312
   349
              [], [enable_music_ogg=yes])
slouken@353
   350
AC_ARG_ENABLE(music-ogg-tremor,
slouken@419
   351
AC_HELP_STRING([--enable-music-ogg-tremor], [enable OGG Vorbis music via libtremor [[default=no]]]),
slouken@368
   352
              [], enable_music_ogg_tremor=no)
slouken@368
   353
AC_ARG_ENABLE([music-ogg-shared],
slouken@368
   354
AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis support [[default=yes]]]),
slouken@368
   355
              [], [enable_music_ogg_shared=yes])
slouken@368
   356
if test x$enable_music_ogg = xyes; then
slouken@368
   357
    if test x$enable_music_ogg_tremor = xyes; then
slouken@368
   358
        AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes])
slouken@468
   359
        AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes])
slouken@368
   360
        if test x$have_tremor_hdr = xyes -a x$have_tremor_lib = xyes; then
slouken@368
   361
            case "$host" in
slouken@368
   362
                *-*-darwin*)
slouken@456
   363
                    ogg_lib=[`find_lib libvorbisidec.dylib`]
slouken@368
   364
                    if test x$ogg_lib = x; then
slouken@368
   365
                        ogg_lib=[`find_lib libvorbisidec.[0-9]`]
slouken@368
   366
                    fi
slouken@368
   367
                    if test x$ogg_lib = x; then
slouken@368
   368
                        ogg_lib=[`find_lib libvorbisidec.[0-9]*`]
slouken@368
   369
                    fi
slouken@368
   370
                    ;;
slouken@368
   371
                *-*-cygwin* | *-*-mingw32*)
slouken@372
   372
                    ogg_lib=[`find_lib "vorbisidec*.dll"`]
slouken@368
   373
                    ;;
slouken@368
   374
                *)
slouken@368
   375
                    ogg_lib=[`find_lib "libvorbisidec.so.[0-9]"`]
slouken@368
   376
                    if test x$ogg_lib = x; then
slouken@368
   377
                        ogg_lib=[`find_lib "libvorbisidec.so.[0-9]*"`]
slouken@368
   378
                    fi
slouken@368
   379
                    ;;
slouken@368
   380
            esac
slouken@368
   381
            SOURCES="$SOURCES $srcdir/*_ogg.c"
slouken@368
   382
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC -DOGG_USE_TREMOR"
slouken@368
   383
            if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
slouken@368
   384
                echo "-- dynamic libvorbisidec -> $ogg_lib"
slouken@368
   385
                EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
slouken@368
   386
            else
patmandin@464
   387
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisidec -lvorbis -logg $LIBM"
slouken@368
   388
            fi
slouken@419
   389
        else
slouken@419
   390
            AC_MSG_WARN([*** Unable to find Ogg Vorbis Tremor library (http://www.xiph.org/)])
slouken@419
   391
            AC_MSG_WARN([Ogg Vorbis support disabled])
slouken@368
   392
        fi
slouken@368
   393
    else
slouken@368
   394
        AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
slouken@468
   395
        AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes])
slouken@368
   396
        if test x$have_ogg_hdr = xyes -a x$have_ogg_lib = xyes; then
slouken@368
   397
            case "$host" in
slouken@368
   398
                *-*-darwin*)
slouken@456
   399
                    ogg_lib=[`find_lib libvorbisfile.dylib`]
slouken@368
   400
                    ;;
slouken@368
   401
                *-*-cygwin* | *-*-mingw32*)
slouken@372
   402
                    ogg_lib=[`find_lib "libvorbisfile*.dll"`]
slouken@368
   403
                    ;;
slouken@368
   404
                *)
slouken@368
   405
                    ogg_lib=[`find_lib "libvorbisfile.so.[0-9]"`]
slouken@368
   406
                    if test x$ogg_lib = x; then
slouken@368
   407
                        ogg_lib=[`find_lib "libvorbisfile.so.[0-9]*"`]
slouken@368
   408
                    fi
slouken@368
   409
                    ;;
slouken@368
   410
            esac
slouken@368
   411
            SOURCES="$SOURCES $srcdir/*_ogg.c"
slouken@368
   412
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC"
slouken@368
   413
            if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
slouken@368
   414
                echo "-- dynamic libvorbisfile -> $ogg_lib"
slouken@368
   415
                EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
slouken@368
   416
            else
patmandin@464
   417
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis -logg $LIBM"
slouken@368
   418
            fi
slouken@419
   419
        else
slouken@419
   420
            AC_MSG_WARN([*** Unable to find Ogg Vorbis library (http://www.xiph.org/)])
slouken@419
   421
            AC_MSG_WARN([Ogg Vorbis support disabled])
slouken@368
   422
        fi
slouken@353
   423
    fi
slouken@353
   424
fi
slouken@419
   425
slouken@396
   426
libflac_ver=8
slouken@382
   427
AC_ARG_ENABLE([music-flac],
slouken@382
   428
AC_HELP_STRING([--enable-music-flac], [enable FLAC music [[default=yes]]]),
slouken@382
   429
              [], [enable_music_flac=yes])
slouken@382
   430
AC_ARG_ENABLE([music-flac-shared],
slouken@382
   431
AC_HELP_STRING([--enable-music-flac-shared],
slouken@382
   432
              [dynamically load FLAC support [[default=yes]]]),
slouken@382
   433
              [], [enable_music_flac_shared=yes])
slouken@382
   434
if test x$enable_music_flac = xyes; then
slouken@452
   435
    AC_CHECK_HEADER([FLAC/export.h], [have_flac_export=yes])
slouken@452
   436
    if test x$have_flac_export = xyes; then
slouken@452
   437
        LIBS_SAVED="$LIBS"
slouken@452
   438
        LIBS="-lFLAC"
slouken@452
   439
        AC_MSG_CHECKING([for libflac so-name version >= $libflac_ver])
slouken@452
   440
        AC_TRY_RUN([
slouken@396
   441
#include "FLAC/export.h"
slouken@396
   442
#include "stdio.h"
slouken@396
   443
int main( int argc, char *argv[] ) {
slouken@396
   444
#if defined(FLAC_API_VERSION_CURRENT) && (FLAC_API_VERSION_CURRENT >= $libflac_ver)
slouken@452
   445
    return 0;
slouken@396
   446
#else
slouken@452
   447
    return 1;
slouken@396
   448
#endif
slouken@396
   449
}
slouken@396
   450
], have_flac_ver=yes, have_flac_ver=no)
slouken@419
   451
        LIBS="$LIBS_SAVED"
slouken@419
   452
        AC_MSG_RESULT($have_flac_ver)
slouken@419
   453
    fi
slouken@419
   454
slouken@419
   455
    if test x$have_flac_ver = xyes; then
slouken@419
   456
        AC_CHECK_HEADER([FLAC/stream_decoder.h], [have_flac_hdr=yes])
slouken@419
   457
        AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], [have_flac_lib=yes])
slouken@419
   458
        if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then    
slouken@419
   459
            case "$host" in
slouken@419
   460
                *-*-darwin*)
slouken@456
   461
                    flac_lib=[`find_lib libFLAC.dylib`]
slouken@419
   462
                    ;;
slouken@419
   463
                *-*-cygwin* | *-*-mingw32*)
slouken@419
   464
                    flac_lib=[`find_lib "libFLAC*.dll"`]
slouken@419
   465
                    ;;
slouken@419
   466
                *)
slouken@419
   467
                    flac_lib=[`find_lib "libFLAC.so.[0-9]"`]
slouken@419
   468
                    if test x$flac_lib = x; then
slouken@419
   469
                        flac_lib=[`find_lib "libFLAC.so.[0-9]*"`]
slouken@419
   470
                    fi
slouken@419
   471
                    ;;
slouken@419
   472
            esac
slouken@419
   473
            SOURCES="$SOURCES $srcdir/*_flac.c"
slouken@419
   474
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_MUSIC"
slouken@419
   475
            if test x$enable_music_flac_shared = xyes && test x$flac_lib != x; then
slouken@419
   476
                echo "-- dynamic libFLAC -> $flac_lib"
slouken@419
   477
                EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_DYNAMIC=\\\"$flac_lib\\\""
slouken@419
   478
            else
slouken@419
   479
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lFLAC"
slouken@419
   480
            fi
slouken@419
   481
        fi
slouken@419
   482
    else
slouken@419
   483
        AC_MSG_WARN([*** Unable to find FLAC library (http://flac.sourceforge.net/)])
slouken@419
   484
        AC_MSG_WARN([FLAC support disabled])
slouken@419
   485
    fi
slouken@382
   486
fi
slouken@419
   487
slouken@0
   488
AC_ARG_ENABLE(music-mp3,
slouken@419
   489
AC_HELP_STRING([--enable-music-mp3], [enable MP3 music via smpeg [[default=yes]]]),
slouken@419
   490
              [], enable_music_mp3=yes)
slouken@419
   491
AC_ARG_ENABLE([music-mp3-shared],
slouken@419
   492
AC_HELP_STRING([--enable-music-mp3-shared], [dynamically load MP3 support [[default=yes]]]),
slouken@419
   493
              [], [enable_music_mp3_shared=yes])
slouken@0
   494
if test x$enable_music_mp3 = xyes; then
slouken@83
   495
    SMPEG_VERSION=0.4.3
slouken@83
   496
    AM_PATH_SMPEG($SMPEG_VERSION, have_smpeg=yes, have_smpeg=no)
slouken@0
   497
    if test x$have_smpeg = xyes; then
slouken@313
   498
        case "$host" in
slouken@313
   499
            *-*-darwin*)
slouken@456
   500
                smpeg_lib=[`find_lib libsmpeg.dylib`]
slouken@313
   501
                ;;
slouken@313
   502
            *-*-cygwin* | *-*-mingw32*)
slouken@372
   503
                smpeg_lib=[`find_lib "smpeg*.dll"`]
slouken@313
   504
                ;;
slouken@313
   505
            *)
slouken@374
   506
                smpeg_lib=[`find_lib "libsmpeg*.so.[0-9]"`]
slouken@368
   507
                if test x$smpeg_lib = x; then
slouken@374
   508
                    smpeg_lib=[`find_lib "libsmpeg*.so.[0-9]*"`]
slouken@368
   509
                fi
slouken@313
   510
                ;;
slouken@313
   511
        esac
slouken@314
   512
        SOURCES="$SOURCES $srcdir/*_mp3.c"
slouken@294
   513
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MUSIC $SMPEG_CFLAGS"
slouken@313
   514
        if test x$enable_music_mp3_shared = xyes && test x$smpeg_lib != x; then
slouken@313
   515
            echo "-- dynamic libsmpeg -> $smpeg_lib"
slouken@313
   516
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_DYNAMIC=\\\"$smpeg_lib\\\""
slouken@313
   517
        else
slouken@313
   518
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SMPEG_LIBS"
slouken@313
   519
        fi
slouken@419
   520
    else
slouken@419
   521
        AC_MSG_WARN([*** Unable to find SMPEG library (http://icculus.org/smpeg/)])
slouken@0
   522
    fi
slouken@0
   523
fi
slouken@419
   524
slouken@357
   525
AC_ARG_ENABLE(music-mp3-mad-gpl,
slouken@357
   526
AC_HELP_STRING([--enable-music-mp3-mad-gpl], [enable MP3 music via libmad GPL code [[default=no]]]),
slouken@357
   527
                  [], [enable_music_mp3_mad_gpl=no])
slouken@357
   528
if test x$enable_music_mp3_mad_gpl = xyes; then
slouken@357
   529
    AC_MSG_CHECKING(for libmad headers)
slouken@357
   530
    have_libmad=no
slouken@357
   531
    AC_TRY_COMPILE([
slouken@357
   532
     #include "mad.h"
slouken@357
   533
    ],[
slouken@357
   534
    ],[
slouken@357
   535
    have_libmad=yes
slouken@357
   536
    ])
slouken@357
   537
    AC_MSG_RESULT($have_libmad)
slouken@357
   538
    if test x$have_libmad = xyes; then
slouken@357
   539
        SOURCES="$SOURCES $srcdir/music_mad.c"
slouken@357
   540
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MAD_MUSIC"
slouken@357
   541
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
slouken@481
   542
        SOURCES="$SOURCES $srcdir/music_modplug.c"
slouken@419
   543
    else
slouken@419
   544
        AC_MSG_WARN([*** Unable to find MAD library (http://www.underbit.com/products/mad/)])
slouken@357
   545
    fi
slouken@357
   546
fi
slouken@0
   547
slouken@419
   548
if test x$have_smpeg != xyes -a x$have_libmad != xyes; then
slouken@419
   549
    AC_MSG_WARN([MP3 support disabled])
slouken@419
   550
fi
slouken@419
   551
slouken@422
   552
slouken@422
   553
OBJECTS=`echo $SOURCES`
slouken@422
   554
DEPENDS=`echo $SOURCES`
slouken@422
   555
OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
slouken@422
   556
DEPENDS=`echo "$DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
slouken@422
   557
$(objects)/\2.lo: \1/\2.c\\
slouken@432
   558
	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c \$< -o \$@,g'`
slouken@422
   559
slouken@422
   560
VERSION_OBJECTS=`echo $VERSION_SOURCES`
slouken@422
   561
VERSION_DEPENDS=`echo $VERSION_SOURCES`
slouken@422
   562
VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
slouken@422
   563
VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.rc,\\
slouken@422
   564
$(objects)/\2.o: \1/\2.rc\\
slouken@422
   565
	\$(WINDRES) \$< \$@,g'`
slouken@422
   566
slouken@422
   567
PLAYWAVE_SOURCES="$srcdir/playwave.c"
slouken@422
   568
PLAYWAVE_OBJECTS=`echo $PLAYWAVE_SOURCES`
slouken@422
   569
PLAYWAVE_DEPENDS=`echo $PLAYWAVE_SOURCES`
slouken@422
   570
PLAYWAVE_OBJECTS=`echo "$PLAYWAVE_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
slouken@422
   571
PLAYWAVE_DEPENDS=`echo "$PLAYWAVE_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
slouken@422
   572
$(objects)/\2.lo: \1/\2.c\\
slouken@432
   573
	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c \$< -o \$@,g'`
slouken@422
   574
slouken@422
   575
PLAYMUS_SOURCES="$srcdir/playmus.c"
slouken@422
   576
PLAYMUS_OBJECTS=`echo $PLAYMUS_SOURCES`
slouken@422
   577
PLAYMUS_DEPENDS=`echo $PLAYMUS_SOURCES`
slouken@422
   578
PLAYMUS_OBJECTS=`echo "$PLAYMUS_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
slouken@422
   579
PLAYMUS_DEPENDS=`echo "$PLAYMUS_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
slouken@422
   580
$(objects)/\2.lo: \1/\2.c\\
slouken@432
   581
	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c \$< -o \$@,g'`
slouken@1
   582
slouken@294
   583
dnl Expand the sources and objects needed to build the library
slouken@294
   584
AC_SUBST(ac_aux_dir)
slouken@294
   585
AC_SUBST(OBJECTS)
slouken@422
   586
AC_SUBST(DEPENDS)
slouken@422
   587
AC_SUBST(VERSION_OBJECTS)
slouken@422
   588
AC_SUBST(VERSION_DEPENDS)
slouken@422
   589
AC_SUBST(PLAYWAVE_OBJECTS)
slouken@422
   590
AC_SUBST(PLAYWAVE_DEPENDS)
slouken@422
   591
AC_SUBST(PLAYMUS_OBJECTS)
slouken@422
   592
AC_SUBST(PLAYMUS_DEPENDS)
slouken@294
   593
AC_SUBST(BUILD_CFLAGS)
slouken@294
   594
AC_SUBST(EXTRA_CFLAGS)
slouken@294
   595
AC_SUBST(BUILD_LDFLAGS)
slouken@294
   596
AC_SUBST(EXTRA_LDFLAGS)
slouken@294
   597
AC_SUBST(EXE)
slouken@368
   598
AC_SUBST(WINDRES)
slouken@392
   599
AC_SUBST(SDL_VERSION)
slouken@294
   600
AC_SUBST(SDL_CFLAGS)
slouken@294
   601
AC_SUBST(SDL_LIBS)
slouken@206
   602
slouken@0
   603
AC_OUTPUT([
slouken@392
   604
    Makefile SDL_mixer.spec SDL_mixer.qpg SDL_mixer.pc
slouken@0
   605
])