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