configure.in
author Sam Lantinga <slouken@libsdl.org>
Thu, 08 Oct 2009 09:07:58 +0000
changeset 432 e32ef89a6816
parent 429 e85caac687d7
child 435 4b5aa99968ea
permissions -rw-r--r--
Fixed bug #828

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