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