configure.in
author Sam Lantinga <slouken@libsdl.org>
Tue, 13 Oct 2009 06:54:57 +0000
changeset 452 78188b7061be
parent 451 1b767145cf8d
child 456 3cc15d601e0c
permissions -rw-r--r--
Removed spurious tabs
     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                 # This doesn't work on Mac OS X 10.5+
   287                 # Max Horn (the original author) recommends disabling it for now.
   288                 #use_music_native_midi=yes
   289                 #EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime -Wl,-framework,CoreServices"
   290                 ;;
   291         esac
   292         if test x$use_music_native_midi = xyes; then
   293             EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
   294             SOURCES="$SOURCES $srcdir/native_midi/*.c"
   295         fi
   296     fi
   297     AC_ARG_ENABLE([music-native-midi-gpl],
   298 AC_HELP_STRING([--enable-music-native-midi-gpl], [enable native MIDI on UNIX using GPL code [[default=no]]]),
   299                   [], [enable_music_native_midi_gpl=no])
   300     if test x$enable_music_native_midi_gpl = xyes; then
   301         use_music_native_midi_gpl=no
   302         case "$host" in
   303             *-*-linux* | *-*-freebsd*)
   304                 use_music_native_midi_gpl=yes
   305                 ;;
   306         esac
   307         if test x$use_music_native_midi_gpl = xyes; then
   308             EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
   309             SOURCES="$SOURCES $srcdir/native_midi_gpl/*.c"
   310         fi
   311     fi
   312 fi
   313 
   314 AC_ARG_ENABLE([music-ogg],
   315 AC_HELP_STRING([--enable-music-ogg], [enable Ogg Vorbis music [[default=yes]]]),
   316               [], [enable_music_ogg=yes])
   317 AC_ARG_ENABLE(music-ogg-tremor,
   318 AC_HELP_STRING([--enable-music-ogg-tremor], [enable OGG Vorbis music via libtremor [[default=no]]]),
   319               [], enable_music_ogg_tremor=no)
   320 AC_ARG_ENABLE([music-ogg-shared],
   321 AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis support [[default=yes]]]),
   322               [], [enable_music_ogg_shared=yes])
   323 if test x$enable_music_ogg = xyes; then
   324     if test x$enable_music_ogg_tremor = xyes; then
   325         AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes])
   326         AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes])
   327         if test x$have_tremor_hdr = xyes -a x$have_tremor_lib = xyes; then
   328             case "$host" in
   329                 *-*-darwin*)
   330                     ogg_lib=[`find_lib libvorbisidec*.dylib`]
   331                     if test x$ogg_lib = x; then
   332                         ogg_lib=[`find_lib libvorbisidec.[0-9]`]
   333                     fi
   334                     if test x$ogg_lib = x; then
   335                         ogg_lib=[`find_lib libvorbisidec.[0-9]*`]
   336                     fi
   337                     ;;
   338                 *-*-cygwin* | *-*-mingw32*)
   339                     ogg_lib=[`find_lib "vorbisidec*.dll"`]
   340                     ;;
   341                 *)
   342                     ogg_lib=[`find_lib "libvorbisidec.so.[0-9]"`]
   343                     if test x$ogg_lib = x; then
   344                         ogg_lib=[`find_lib "libvorbisidec.so.[0-9]*"`]
   345                     fi
   346                     ;;
   347             esac
   348             SOURCES="$SOURCES $srcdir/*_ogg.c"
   349             EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC -DOGG_USE_TREMOR"
   350             if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
   351                 echo "-- dynamic libvorbisidec -> $ogg_lib"
   352                 EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
   353             else
   354                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisidec"
   355             fi
   356         else
   357             AC_MSG_WARN([*** Unable to find Ogg Vorbis Tremor library (http://www.xiph.org/)])
   358             AC_MSG_WARN([Ogg Vorbis support disabled])
   359         fi
   360     else
   361         AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
   362         AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes])
   363         if test x$have_ogg_hdr = xyes -a x$have_ogg_lib = xyes; then
   364             case "$host" in
   365                 *-*-darwin*)
   366                     ogg_lib=[`find_lib libvorbisfile*.dylib`]
   367                     ;;
   368                 *-*-cygwin* | *-*-mingw32*)
   369                     ogg_lib=[`find_lib "libvorbisfile*.dll"`]
   370                     ;;
   371                 *)
   372                     ogg_lib=[`find_lib "libvorbisfile.so.[0-9]"`]
   373                     if test x$ogg_lib = x; then
   374                         ogg_lib=[`find_lib "libvorbisfile.so.[0-9]*"`]
   375                     fi
   376                     ;;
   377             esac
   378             SOURCES="$SOURCES $srcdir/*_ogg.c"
   379             EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC"
   380             if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
   381                 echo "-- dynamic libvorbisfile -> $ogg_lib"
   382                 EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
   383             else
   384                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis -logg"
   385             fi
   386         else
   387             AC_MSG_WARN([*** Unable to find Ogg Vorbis library (http://www.xiph.org/)])
   388             AC_MSG_WARN([Ogg Vorbis support disabled])
   389         fi
   390     fi
   391 fi
   392 
   393 libflac_ver=8
   394 AC_ARG_ENABLE([music-flac],
   395 AC_HELP_STRING([--enable-music-flac], [enable FLAC music [[default=yes]]]),
   396               [], [enable_music_flac=yes])
   397 AC_ARG_ENABLE([music-flac-shared],
   398 AC_HELP_STRING([--enable-music-flac-shared],
   399               [dynamically load FLAC support [[default=yes]]]),
   400               [], [enable_music_flac_shared=yes])
   401 if test x$enable_music_flac = xyes; then
   402     AC_CHECK_HEADER([FLAC/export.h], [have_flac_export=yes])
   403     if test x$have_flac_export = xyes; then
   404         LIBS_SAVED="$LIBS"
   405         LIBS="-lFLAC"
   406         AC_MSG_CHECKING([for libflac so-name version >= $libflac_ver])
   407         AC_TRY_RUN([
   408 #include "FLAC/export.h"
   409 #include "stdio.h"
   410 int main( int argc, char *argv[] ) {
   411 #if defined(FLAC_API_VERSION_CURRENT) && (FLAC_API_VERSION_CURRENT >= $libflac_ver)
   412     return 0;
   413 #else
   414     return 1;
   415 #endif
   416 }
   417 ], have_flac_ver=yes, have_flac_ver=no)
   418         LIBS="$LIBS_SAVED"
   419         AC_MSG_RESULT($have_flac_ver)
   420     fi
   421 
   422     if test x$have_flac_ver = xyes; then
   423         AC_CHECK_HEADER([FLAC/stream_decoder.h], [have_flac_hdr=yes])
   424         AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], [have_flac_lib=yes])
   425         if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then    
   426             case "$host" in
   427                 *-*-darwin*)
   428                     flac_lib=[`find_lib libFLAC*.dylib`]
   429                     ;;
   430                 *-*-cygwin* | *-*-mingw32*)
   431                     flac_lib=[`find_lib "libFLAC*.dll"`]
   432                     ;;
   433                 *)
   434                     flac_lib=[`find_lib "libFLAC.so.[0-9]"`]
   435                     if test x$flac_lib = x; then
   436                         flac_lib=[`find_lib "libFLAC.so.[0-9]*"`]
   437                     fi
   438                     ;;
   439             esac
   440             SOURCES="$SOURCES $srcdir/*_flac.c"
   441             EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_MUSIC"
   442             if test x$enable_music_flac_shared = xyes && test x$flac_lib != x; then
   443                 echo "-- dynamic libFLAC -> $flac_lib"
   444                 EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_DYNAMIC=\\\"$flac_lib\\\""
   445             else
   446                 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lFLAC"
   447             fi
   448         fi
   449     else
   450         AC_MSG_WARN([*** Unable to find FLAC library (http://flac.sourceforge.net/)])
   451         AC_MSG_WARN([FLAC support disabled])
   452     fi
   453 fi
   454 
   455 AC_ARG_ENABLE(music-mp3,
   456 AC_HELP_STRING([--enable-music-mp3], [enable MP3 music via smpeg [[default=yes]]]),
   457               [], enable_music_mp3=yes)
   458 AC_ARG_ENABLE([music-mp3-shared],
   459 AC_HELP_STRING([--enable-music-mp3-shared], [dynamically load MP3 support [[default=yes]]]),
   460               [], [enable_music_mp3_shared=yes])
   461 if test x$enable_music_mp3 = xyes; then
   462     SMPEG_VERSION=0.4.3
   463     AM_PATH_SMPEG($SMPEG_VERSION, have_smpeg=yes, have_smpeg=no)
   464     if test x$have_smpeg = xyes; then
   465         case "$host" in
   466             *-*-darwin*)
   467                 smpeg_lib=[`find_lib libsmpeg*.dylib`]
   468                 ;;
   469             *-*-cygwin* | *-*-mingw32*)
   470                 smpeg_lib=[`find_lib "smpeg*.dll"`]
   471                 ;;
   472             *)
   473                 smpeg_lib=[`find_lib "libsmpeg*.so.[0-9]"`]
   474                 if test x$smpeg_lib = x; then
   475                     smpeg_lib=[`find_lib "libsmpeg*.so.[0-9]*"`]
   476                 fi
   477                 ;;
   478         esac
   479         SOURCES="$SOURCES $srcdir/*_mp3.c"
   480         EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MUSIC $SMPEG_CFLAGS"
   481         if test x$enable_music_mp3_shared = xyes && test x$smpeg_lib != x; then
   482             echo "-- dynamic libsmpeg -> $smpeg_lib"
   483             EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_DYNAMIC=\\\"$smpeg_lib\\\""
   484         else
   485             EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SMPEG_LIBS"
   486         fi
   487     else
   488         AC_MSG_WARN([*** Unable to find SMPEG library (http://icculus.org/smpeg/)])
   489     fi
   490 fi
   491 
   492 AC_ARG_ENABLE(music-mp3-mad-gpl,
   493 AC_HELP_STRING([--enable-music-mp3-mad-gpl], [enable MP3 music via libmad GPL code [[default=no]]]),
   494                   [], [enable_music_mp3_mad_gpl=no])
   495 if test x$enable_music_mp3_mad_gpl = xyes; then
   496     AC_MSG_CHECKING(for libmad headers)
   497     have_libmad=no
   498     AC_TRY_COMPILE([
   499      #include "mad.h"
   500     ],[
   501     ],[
   502     have_libmad=yes
   503     ])
   504     AC_MSG_RESULT($have_libmad)
   505     if test x$have_libmad = xyes; then
   506         SOURCES="$SOURCES $srcdir/music_mad.c"
   507         EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MAD_MUSIC"
   508         EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
   509     else
   510         AC_MSG_WARN([*** Unable to find MAD library (http://www.underbit.com/products/mad/)])
   511     fi
   512 fi
   513 
   514 if test x$have_smpeg != xyes -a x$have_libmad != xyes; then
   515     AC_MSG_WARN([MP3 support disabled])
   516 fi
   517 
   518 
   519 OBJECTS=`echo $SOURCES`
   520 DEPENDS=`echo $SOURCES`
   521 OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
   522 DEPENDS=`echo "$DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
   523 $(objects)/\2.lo: \1/\2.c\\
   524 	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c \$< -o \$@,g'`
   525 
   526 VERSION_OBJECTS=`echo $VERSION_SOURCES`
   527 VERSION_DEPENDS=`echo $VERSION_SOURCES`
   528 VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
   529 VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.rc,\\
   530 $(objects)/\2.o: \1/\2.rc\\
   531 	\$(WINDRES) \$< \$@,g'`
   532 
   533 PLAYWAVE_SOURCES="$srcdir/playwave.c"
   534 PLAYWAVE_OBJECTS=`echo $PLAYWAVE_SOURCES`
   535 PLAYWAVE_DEPENDS=`echo $PLAYWAVE_SOURCES`
   536 PLAYWAVE_OBJECTS=`echo "$PLAYWAVE_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
   537 PLAYWAVE_DEPENDS=`echo "$PLAYWAVE_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
   538 $(objects)/\2.lo: \1/\2.c\\
   539 	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c \$< -o \$@,g'`
   540 
   541 PLAYMUS_SOURCES="$srcdir/playmus.c"
   542 PLAYMUS_OBJECTS=`echo $PLAYMUS_SOURCES`
   543 PLAYMUS_DEPENDS=`echo $PLAYMUS_SOURCES`
   544 PLAYMUS_OBJECTS=`echo "$PLAYMUS_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
   545 PLAYMUS_DEPENDS=`echo "$PLAYMUS_DEPENDS" | sed 's,\([[^ ]]*\)/\([[^ ]]*\)\.c,\\
   546 $(objects)/\2.lo: \1/\2.c\\
   547 	\$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) '"$DEPENDENCY_TRACKING_OPTIONS"' -c \$< -o \$@,g'`
   548 
   549 dnl Expand the sources and objects needed to build the library
   550 AC_SUBST(ac_aux_dir)
   551 AC_SUBST(OBJECTS)
   552 AC_SUBST(DEPENDS)
   553 AC_SUBST(VERSION_OBJECTS)
   554 AC_SUBST(VERSION_DEPENDS)
   555 AC_SUBST(PLAYWAVE_OBJECTS)
   556 AC_SUBST(PLAYWAVE_DEPENDS)
   557 AC_SUBST(PLAYMUS_OBJECTS)
   558 AC_SUBST(PLAYMUS_DEPENDS)
   559 AC_SUBST(BUILD_CFLAGS)
   560 AC_SUBST(EXTRA_CFLAGS)
   561 AC_SUBST(BUILD_LDFLAGS)
   562 AC_SUBST(EXTRA_LDFLAGS)
   563 AC_SUBST(EXE)
   564 AC_SUBST(WINDRES)
   565 AC_SUBST(SDL_VERSION)
   566 AC_SUBST(SDL_CFLAGS)
   567 AC_SUBST(SDL_LIBS)
   568 
   569 AC_OUTPUT([
   570     Makefile SDL_mixer.spec SDL_mixer.qpg SDL_mixer.pc
   571 ])