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