configure.in
author Sam Lantinga <slouken@libsdl.org>
Sat, 07 Nov 2009 05:46:47 +0000
changeset 468 391babf75293
parent 467 4b52401dda92
child 469 5b6aac99ebf1
permissions -rw-r--r--
Only add the vorbis libraries if dynamic loading isn't enabled.
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
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
        AC_MSG_WARN([MOD support disabled])
slouken@419
   275
    fi
slouken@249
   276
fi
slouken@249
   277
slouken@312
   278
AC_ARG_ENABLE([music-midi],
slouken@312
   279
AC_HELP_STRING([--enable-music-midi], [enable MIDI music via timidity [[default=yes]]]),
slouken@312
   280
              [], [enable_music_midi=yes])
slouken@0
   281
if test x$enable_music_midi = xyes; then
slouken@294
   282
    EXTRA_CFLAGS="$EXTRA_CFLAGS -DMID_MUSIC"
slouken@312
   283
    AC_ARG_ENABLE([music-timidity-midi],
slouken@312
   284
AC_HELP_STRING([--enable-music-timidity-midi], [enable timidity MIDI output [[default=yes]]]),
slouken@312
   285
                  [], [enable_music_timidity_midi=yes])
slouken@106
   286
    if test x$enable_music_timidity_midi = xyes; then
slouken@294
   287
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_TIMIDITY_MIDI -I\$(srcdir)/timidity"
slouken@294
   288
        SOURCES="$SOURCES $srcdir/timidity/*.c"
slouken@106
   289
    fi
slouken@312
   290
    AC_ARG_ENABLE([music-native-midi],
slouken@312
   291
AC_HELP_STRING([--enable-music-native-midi], [enable native MIDI music output [[default=yes]]]),
slouken@312
   292
                  [], [enable_music_native_midi=yes])
slouken@99
   293
    if test x$enable_music_native_midi = xyes; then
slouken@99
   294
        use_music_native_midi=no
slouken@289
   295
        case "$host" in
slouken@99
   296
            *-*-cygwin* | *-*-mingw32*)
slouken@99
   297
                use_music_native_midi=yes
slouken@294
   298
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lwinmm"
slouken@99
   299
                ;;
slouken@107
   300
            *-*-darwin*)
icculus@458
   301
                use_music_native_midi=yes
icculus@461
   302
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,CoreServices"
slouken@107
   303
                ;;
slouken@99
   304
        esac
slouken@99
   305
        if test x$use_music_native_midi = xyes; then
slouken@294
   306
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
slouken@294
   307
            SOURCES="$SOURCES $srcdir/native_midi/*.c"
slouken@99
   308
        fi
slouken@99
   309
    fi
slouken@312
   310
    AC_ARG_ENABLE([music-native-midi-gpl],
slouken@312
   311
AC_HELP_STRING([--enable-music-native-midi-gpl], [enable native MIDI on UNIX using GPL code [[default=no]]]),
slouken@312
   312
                  [], [enable_music_native_midi_gpl=no])
slouken@160
   313
    if test x$enable_music_native_midi_gpl = xyes; then
slouken@160
   314
        use_music_native_midi_gpl=no
slouken@289
   315
        case "$host" in
slouken@160
   316
            *-*-linux* | *-*-freebsd*)
slouken@160
   317
                use_music_native_midi_gpl=yes
slouken@160
   318
                ;;
slouken@160
   319
        esac
slouken@160
   320
        if test x$use_music_native_midi_gpl = xyes; then
slouken@294
   321
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
slouken@294
   322
            SOURCES="$SOURCES $srcdir/native_midi_gpl/*.c"
slouken@160
   323
        fi
slouken@160
   324
    fi
slouken@0
   325
fi
slouken@419
   326
slouken@312
   327
AC_ARG_ENABLE([music-ogg],
slouken@312
   328
AC_HELP_STRING([--enable-music-ogg], [enable Ogg Vorbis music [[default=yes]]]),
slouken@312
   329
              [], [enable_music_ogg=yes])
slouken@353
   330
AC_ARG_ENABLE(music-ogg-tremor,
slouken@419
   331
AC_HELP_STRING([--enable-music-ogg-tremor], [enable OGG Vorbis music via libtremor [[default=no]]]),
slouken@368
   332
              [], enable_music_ogg_tremor=no)
slouken@368
   333
AC_ARG_ENABLE([music-ogg-shared],
slouken@368
   334
AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis support [[default=yes]]]),
slouken@368
   335
              [], [enable_music_ogg_shared=yes])
slouken@368
   336
if test x$enable_music_ogg = xyes; then
slouken@368
   337
    if test x$enable_music_ogg_tremor = xyes; then
slouken@368
   338
        AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes])
slouken@468
   339
        AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes])
slouken@368
   340
        if test x$have_tremor_hdr = xyes -a x$have_tremor_lib = xyes; then
slouken@368
   341
            case "$host" in
slouken@368
   342
                *-*-darwin*)
slouken@456
   343
                    ogg_lib=[`find_lib libvorbisidec.dylib`]
slouken@368
   344
                    if test x$ogg_lib = x; then
slouken@368
   345
                        ogg_lib=[`find_lib libvorbisidec.[0-9]`]
slouken@368
   346
                    fi
slouken@368
   347
                    if test x$ogg_lib = x; then
slouken@368
   348
                        ogg_lib=[`find_lib libvorbisidec.[0-9]*`]
slouken@368
   349
                    fi
slouken@368
   350
                    ;;
slouken@368
   351
                *-*-cygwin* | *-*-mingw32*)
slouken@372
   352
                    ogg_lib=[`find_lib "vorbisidec*.dll"`]
slouken@368
   353
                    ;;
slouken@368
   354
                *)
slouken@368
   355
                    ogg_lib=[`find_lib "libvorbisidec.so.[0-9]"`]
slouken@368
   356
                    if test x$ogg_lib = x; then
slouken@368
   357
                        ogg_lib=[`find_lib "libvorbisidec.so.[0-9]*"`]
slouken@368
   358
                    fi
slouken@368
   359
                    ;;
slouken@368
   360
            esac
slouken@368
   361
            SOURCES="$SOURCES $srcdir/*_ogg.c"
slouken@368
   362
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC -DOGG_USE_TREMOR"
slouken@368
   363
            if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
slouken@368
   364
                echo "-- dynamic libvorbisidec -> $ogg_lib"
slouken@368
   365
                EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
slouken@368
   366
            else
patmandin@464
   367
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisidec -lvorbis -logg $LIBM"
slouken@368
   368
            fi
slouken@419
   369
        else
slouken@419
   370
            AC_MSG_WARN([*** Unable to find Ogg Vorbis Tremor library (http://www.xiph.org/)])
slouken@419
   371
            AC_MSG_WARN([Ogg Vorbis support disabled])
slouken@368
   372
        fi
slouken@368
   373
    else
slouken@368
   374
        AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
slouken@468
   375
        AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes])
slouken@368
   376
        if test x$have_ogg_hdr = xyes -a x$have_ogg_lib = xyes; then
slouken@368
   377
            case "$host" in
slouken@368
   378
                *-*-darwin*)
slouken@456
   379
                    ogg_lib=[`find_lib libvorbisfile.dylib`]
slouken@368
   380
                    ;;
slouken@368
   381
                *-*-cygwin* | *-*-mingw32*)
slouken@372
   382
                    ogg_lib=[`find_lib "libvorbisfile*.dll"`]
slouken@368
   383
                    ;;
slouken@368
   384
                *)
slouken@368
   385
                    ogg_lib=[`find_lib "libvorbisfile.so.[0-9]"`]
slouken@368
   386
                    if test x$ogg_lib = x; then
slouken@368
   387
                        ogg_lib=[`find_lib "libvorbisfile.so.[0-9]*"`]
slouken@368
   388
                    fi
slouken@368
   389
                    ;;
slouken@368
   390
            esac
slouken@368
   391
            SOURCES="$SOURCES $srcdir/*_ogg.c"
slouken@368
   392
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC"
slouken@368
   393
            if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
slouken@368
   394
                echo "-- dynamic libvorbisfile -> $ogg_lib"
slouken@368
   395
                EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
slouken@368
   396
            else
patmandin@464
   397
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis -logg $LIBM"
slouken@368
   398
            fi
slouken@419
   399
        else
slouken@419
   400
            AC_MSG_WARN([*** Unable to find Ogg Vorbis library (http://www.xiph.org/)])
slouken@419
   401
            AC_MSG_WARN([Ogg Vorbis support disabled])
slouken@368
   402
        fi
slouken@353
   403
    fi
slouken@353
   404
fi
slouken@419
   405
slouken@396
   406
libflac_ver=8
slouken@382
   407
AC_ARG_ENABLE([music-flac],
slouken@382
   408
AC_HELP_STRING([--enable-music-flac], [enable FLAC music [[default=yes]]]),
slouken@382
   409
              [], [enable_music_flac=yes])
slouken@382
   410
AC_ARG_ENABLE([music-flac-shared],
slouken@382
   411
AC_HELP_STRING([--enable-music-flac-shared],
slouken@382
   412
              [dynamically load FLAC support [[default=yes]]]),
slouken@382
   413
              [], [enable_music_flac_shared=yes])
slouken@382
   414
if test x$enable_music_flac = xyes; then
slouken@452
   415
    AC_CHECK_HEADER([FLAC/export.h], [have_flac_export=yes])
slouken@452
   416
    if test x$have_flac_export = xyes; then
slouken@452
   417
        LIBS_SAVED="$LIBS"
slouken@452
   418
        LIBS="-lFLAC"
slouken@452
   419
        AC_MSG_CHECKING([for libflac so-name version >= $libflac_ver])
slouken@452
   420
        AC_TRY_RUN([
slouken@396
   421
#include "FLAC/export.h"
slouken@396
   422
#include "stdio.h"
slouken@396
   423
int main( int argc, char *argv[] ) {
slouken@396
   424
#if defined(FLAC_API_VERSION_CURRENT) && (FLAC_API_VERSION_CURRENT >= $libflac_ver)
slouken@452
   425
    return 0;
slouken@396
   426
#else
slouken@452
   427
    return 1;
slouken@396
   428
#endif
slouken@396
   429
}
slouken@396
   430
], have_flac_ver=yes, have_flac_ver=no)
slouken@419
   431
        LIBS="$LIBS_SAVED"
slouken@419
   432
        AC_MSG_RESULT($have_flac_ver)
slouken@419
   433
    fi
slouken@419
   434
slouken@419
   435
    if test x$have_flac_ver = xyes; then
slouken@419
   436
        AC_CHECK_HEADER([FLAC/stream_decoder.h], [have_flac_hdr=yes])
slouken@419
   437
        AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], [have_flac_lib=yes])
slouken@419
   438
        if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then    
slouken@419
   439
            case "$host" in
slouken@419
   440
                *-*-darwin*)
slouken@456
   441
                    flac_lib=[`find_lib libFLAC.dylib`]
slouken@419
   442
                    ;;
slouken@419
   443
                *-*-cygwin* | *-*-mingw32*)
slouken@419
   444
                    flac_lib=[`find_lib "libFLAC*.dll"`]
slouken@419
   445
                    ;;
slouken@419
   446
                *)
slouken@419
   447
                    flac_lib=[`find_lib "libFLAC.so.[0-9]"`]
slouken@419
   448
                    if test x$flac_lib = x; then
slouken@419
   449
                        flac_lib=[`find_lib "libFLAC.so.[0-9]*"`]
slouken@419
   450
                    fi
slouken@419
   451
                    ;;
slouken@419
   452
            esac
slouken@419
   453
            SOURCES="$SOURCES $srcdir/*_flac.c"
slouken@419
   454
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_MUSIC"
slouken@419
   455
            if test x$enable_music_flac_shared = xyes && test x$flac_lib != x; then
slouken@419
   456
                echo "-- dynamic libFLAC -> $flac_lib"
slouken@419
   457
                EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_DYNAMIC=\\\"$flac_lib\\\""
slouken@419
   458
            else
slouken@419
   459
                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lFLAC"
slouken@419
   460
            fi
slouken@419
   461
        fi
slouken@419
   462
    else
slouken@419
   463
        AC_MSG_WARN([*** Unable to find FLAC library (http://flac.sourceforge.net/)])
slouken@419
   464
        AC_MSG_WARN([FLAC support disabled])
slouken@419
   465
    fi
slouken@382
   466
fi
slouken@419
   467
slouken@0
   468
AC_ARG_ENABLE(music-mp3,
slouken@419
   469
AC_HELP_STRING([--enable-music-mp3], [enable MP3 music via smpeg [[default=yes]]]),
slouken@419
   470
              [], enable_music_mp3=yes)
slouken@419
   471
AC_ARG_ENABLE([music-mp3-shared],
slouken@419
   472
AC_HELP_STRING([--enable-music-mp3-shared], [dynamically load MP3 support [[default=yes]]]),
slouken@419
   473
              [], [enable_music_mp3_shared=yes])
slouken@0
   474
if test x$enable_music_mp3 = xyes; then
slouken@83
   475
    SMPEG_VERSION=0.4.3
slouken@83
   476
    AM_PATH_SMPEG($SMPEG_VERSION, have_smpeg=yes, have_smpeg=no)
slouken@0
   477
    if test x$have_smpeg = xyes; then
slouken@313
   478
        case "$host" in
slouken@313
   479
            *-*-darwin*)
slouken@456
   480
                smpeg_lib=[`find_lib libsmpeg.dylib`]
slouken@313
   481
                ;;
slouken@313
   482
            *-*-cygwin* | *-*-mingw32*)
slouken@372
   483
                smpeg_lib=[`find_lib "smpeg*.dll"`]
slouken@313
   484
                ;;
slouken@313
   485
            *)
slouken@374
   486
                smpeg_lib=[`find_lib "libsmpeg*.so.[0-9]"`]
slouken@368
   487
                if test x$smpeg_lib = x; then
slouken@374
   488
                    smpeg_lib=[`find_lib "libsmpeg*.so.[0-9]*"`]
slouken@368
   489
                fi
slouken@313
   490
                ;;
slouken@313
   491
        esac
slouken@314
   492
        SOURCES="$SOURCES $srcdir/*_mp3.c"
slouken@294
   493
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MUSIC $SMPEG_CFLAGS"
slouken@313
   494
        if test x$enable_music_mp3_shared = xyes && test x$smpeg_lib != x; then
slouken@313
   495
            echo "-- dynamic libsmpeg -> $smpeg_lib"
slouken@313
   496
            EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_DYNAMIC=\\\"$smpeg_lib\\\""
slouken@313
   497
        else
slouken@313
   498
            EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SMPEG_LIBS"
slouken@313
   499
        fi
slouken@419
   500
    else
slouken@419
   501
        AC_MSG_WARN([*** Unable to find SMPEG library (http://icculus.org/smpeg/)])
slouken@0
   502
    fi
slouken@0
   503
fi
slouken@419
   504
slouken@357
   505
AC_ARG_ENABLE(music-mp3-mad-gpl,
slouken@357
   506
AC_HELP_STRING([--enable-music-mp3-mad-gpl], [enable MP3 music via libmad GPL code [[default=no]]]),
slouken@357
   507
                  [], [enable_music_mp3_mad_gpl=no])
slouken@357
   508
if test x$enable_music_mp3_mad_gpl = xyes; then
slouken@357
   509
    AC_MSG_CHECKING(for libmad headers)
slouken@357
   510
    have_libmad=no
slouken@357
   511
    AC_TRY_COMPILE([
slouken@357
   512
     #include "mad.h"
slouken@357
   513
    ],[
slouken@357
   514
    ],[
slouken@357
   515
    have_libmad=yes
slouken@357
   516
    ])
slouken@357
   517
    AC_MSG_RESULT($have_libmad)
slouken@357
   518
    if test x$have_libmad = xyes; then
slouken@357
   519
        SOURCES="$SOURCES $srcdir/music_mad.c"
slouken@357
   520
        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MAD_MUSIC"
slouken@357
   521
        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
slouken@419
   522
    else
slouken@419
   523
        AC_MSG_WARN([*** Unable to find MAD library (http://www.underbit.com/products/mad/)])
slouken@357
   524
    fi
slouken@357
   525
fi
slouken@0
   526
slouken@419
   527
if test x$have_smpeg != xyes -a x$have_libmad != xyes; then
slouken@419
   528
    AC_MSG_WARN([MP3 support disabled])
slouken@419
   529
fi
slouken@419
   530
slouken@422
   531
slouken@422
   532
OBJECTS=`echo $SOURCES`
slouken@422
   533
DEPENDS=`echo $SOURCES`
slouken@422
   534
OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
slouken@422
   535
DEPENDS=`echo "$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
VERSION_OBJECTS=`echo $VERSION_SOURCES`
slouken@422
   540
VERSION_DEPENDS=`echo $VERSION_SOURCES`
slouken@422
   541
VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
slouken@422
   542
VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.rc,\\
slouken@422
   543
$(objects)/\2.o: \1/\2.rc\\
slouken@422
   544
	\$(WINDRES) \$< \$@,g'`
slouken@422
   545
slouken@422
   546
PLAYWAVE_SOURCES="$srcdir/playwave.c"
slouken@422
   547
PLAYWAVE_OBJECTS=`echo $PLAYWAVE_SOURCES`
slouken@422
   548
PLAYWAVE_DEPENDS=`echo $PLAYWAVE_SOURCES`
slouken@422
   549
PLAYWAVE_OBJECTS=`echo "$PLAYWAVE_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
slouken@422
   550
PLAYWAVE_DEPENDS=`echo "$PLAYWAVE_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
slouken@422
   551
$(objects)/\2.lo: \1/\2.c\\
slouken@432
   552
	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c \$< -o \$@,g'`
slouken@422
   553
slouken@422
   554
PLAYMUS_SOURCES="$srcdir/playmus.c"
slouken@422
   555
PLAYMUS_OBJECTS=`echo $PLAYMUS_SOURCES`
slouken@422
   556
PLAYMUS_DEPENDS=`echo $PLAYMUS_SOURCES`
slouken@422
   557
PLAYMUS_OBJECTS=`echo "$PLAYMUS_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
slouken@422
   558
PLAYMUS_DEPENDS=`echo "$PLAYMUS_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
slouken@422
   559
$(objects)/\2.lo: \1/\2.c\\
slouken@432
   560
	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c \$< -o \$@,g'`
slouken@1
   561
slouken@294
   562
dnl Expand the sources and objects needed to build the library
slouken@294
   563
AC_SUBST(ac_aux_dir)
slouken@294
   564
AC_SUBST(OBJECTS)
slouken@422
   565
AC_SUBST(DEPENDS)
slouken@422
   566
AC_SUBST(VERSION_OBJECTS)
slouken@422
   567
AC_SUBST(VERSION_DEPENDS)
slouken@422
   568
AC_SUBST(PLAYWAVE_OBJECTS)
slouken@422
   569
AC_SUBST(PLAYWAVE_DEPENDS)
slouken@422
   570
AC_SUBST(PLAYMUS_OBJECTS)
slouken@422
   571
AC_SUBST(PLAYMUS_DEPENDS)
slouken@294
   572
AC_SUBST(BUILD_CFLAGS)
slouken@294
   573
AC_SUBST(EXTRA_CFLAGS)
slouken@294
   574
AC_SUBST(BUILD_LDFLAGS)
slouken@294
   575
AC_SUBST(EXTRA_LDFLAGS)
slouken@294
   576
AC_SUBST(EXE)
slouken@368
   577
AC_SUBST(WINDRES)
slouken@392
   578
AC_SUBST(SDL_VERSION)
slouken@294
   579
AC_SUBST(SDL_CFLAGS)
slouken@294
   580
AC_SUBST(SDL_LIBS)
slouken@206
   581
slouken@0
   582
AC_OUTPUT([
slouken@392
   583
    Makefile SDL_mixer.spec SDL_mixer.qpg SDL_mixer.pc
slouken@0
   584
])