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