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