configure.in
author Sam Lantinga <slouken@libsdl.org>
Thu, 08 Oct 2009 09:07:58 +0000
changeset 432 e32ef89a6816
parent 429 e85caac687d7
child 435 4b5aa99968ea
permissions -rw-r--r--
Fixed bug #828

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