configure.in
author Sam Lantinga <slouken@libsdl.org>
Sat, 10 Oct 2009 09:58:24 +0000
changeset 435 4b5aa99968ea
parent 432 e32ef89a6816
child 451 1b767145cf8d
permissions -rw-r--r--
Fixed bug #833

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