configure.in
上传用户:nini_0081
上传日期:2022-07-21
资源大小:2628k
文件大小:21k
源码类别:

多媒体编程

开发平台:

DOS

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