configure.in
author Sam Lantinga <slouken@libsdl.org>
Sat, 13 Nov 2004 00:38:01 +0000
changeset 249 3a26a4b9ab13
parent 232 f974cb06ba25
child 254 1ad5ff083036
permissions -rw-r--r--
Date: Wed, 15 Sep 2004 23:26:42 -0500
From: Jonathan Atkins
Subject: [SDL] [SDL_Mixer] external libmikmod patch

here's a great patch for the CVS of SDL_mixer. It allows people to use the preinstalled version of libmikmod instead of the internal one.
I know that Gentoo users at least want this option, and I also see the logic in it.

It's all ./configure'able so the user can choose whether to use the included mikmod source, or just link with the external.
the new option is --enable-music-libmikmod
if it is disabled or not found, then it rolls off to default to the included mikmod source, like it did before.

This also implements the new SDL_LoadMUS_RW functionality with a libmikmod Player_LoadGeneric adaptor.
This element was tested with a revised playmus that uses RWops to load a module from a fake file with a module at a known offset (see the -o option).
I've attached that new file as well, but if you use it, you'll have to change Makefile.am yourself :)

The only thing that turns into a bogus function is the Mix_(Set/Get)SynchroValue functions, which now just set/get a static int, and print a warning to stderr.
I felt that functionality is not used very much, if at all... and if used, should patched into libmikmod upstream instead, since it doesn't currently support it.
     1 dnl Process this file with autoconf to produce a configure script.
     2 AC_INIT(README)
     3 
     4 dnl Set various version strings - taken gratefully from the GTk sources
     5 
     6 # Making releases:
     7 #   MICRO_VERSION += 1;
     8 #   INTERFACE_AGE += 1;
     9 #   BINARY_AGE += 1;
    10 # if any functions have been added, set INTERFACE_AGE to 0.
    11 # if backwards compatibility has been broken,
    12 # set BINARY_AGE and INTERFACE_AGE to 0.
    13 
    14 MAJOR_VERSION=1
    15 MINOR_VERSION=2
    16 MICRO_VERSION=6
    17 INTERFACE_AGE=4
    18 BINARY_AGE=6
    19 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
    20 
    21 AC_SUBST(MAJOR_VERSION)
    22 AC_SUBST(MINOR_VERSION)
    23 AC_SUBST(MICRO_VERSION)
    24 AC_SUBST(INTERFACE_AGE)
    25 AC_SUBST(BINARY_AGE)
    26 AC_SUBST(VERSION)
    27 
    28 # libtool versioning
    29 LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION
    30 LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE`
    31 LT_REVISION=$INTERFACE_AGE
    32 LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE`
    33 
    34 AC_SUBST(LT_RELEASE)
    35 AC_SUBST(LT_CURRENT)
    36 AC_SUBST(LT_REVISION)
    37 AC_SUBST(LT_AGE)
    38 
    39 dnl Detect the canonical host and target build environment
    40 AC_CANONICAL_SYSTEM
    41 
    42 dnl Setup for automake
    43 AM_INIT_AUTOMAKE(SDL_mixer, $VERSION)
    44 
    45 dnl Check for tools
    46 
    47 AC_PROG_MAKE_SET
    48 AC_PROG_CC
    49 AC_LIBTOOL_WIN32_DLL
    50 AM_PROG_LIBTOOL
    51 AC_PROG_INSTALL
    52 
    53 dnl The alpha architecture needs special flags for binary portability
    54 case "$target" in
    55     alpha*-*-linux*)
    56         CFLAGS="$CFLAGS -mcpu=ev4 -Wa,-mall"
    57         ;;
    58     *-*-beos*)
    59         ac_default_prefix=/boot/develop/tools/gnupro
    60         ;;
    61     *-*-cygwin* | *-*-mingw32*)
    62         if test "$build" != "$target"; then # cross-compiling
    63             # Default cross-compile location
    64             ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
    65         else
    66             # Look for the location of the tools and install there
    67             if [ "$BUILD_PREFIX" != "" ]; then
    68                 ac_default_prefix=$BUILD_PREFIX
    69             fi
    70         fi
    71         ;;
    72     *-*-darwin*)
    73         AC_DEFINE(MACOSX)
    74         ;;
    75     m68k-atari-mint*)
    76         CFLAGS="$CFLAGS -Dunix"
    77         ;;
    78 esac
    79 
    80 dnl Check for SDL
    81 SDL_VERSION=1.2.4
    82 AM_PATH_SDL($SDL_VERSION,
    83             :,
    84 	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
    85 )
    86 CFLAGS="$CFLAGS $SDL_CFLAGS"
    87 
    88 dnl Flag for using SDL_RWops
    89 dnl Matt Campbell (matt@campbellhome.dhs.org)
    90 CFLAGS="$CFLAGS -DUSE_RWOPS"
    91 
    92 dnl Check command-line options
    93 
    94 AC_ARG_ENABLE(music-cmd,
    95 [  --enable-music-cmd      support an external music player [default=yes]],
    96               , enable_music_cmd=yes)
    97 if test x$enable_music_cmd = xyes; then
    98     CFLAGS="$CFLAGS -DCMD_MUSIC"
    99 fi
   100 AC_ARG_ENABLE(music-wave,
   101 [  --enable-music-wave     enable streaming WAVE music [default=yes]],
   102               , enable_music_wave=yes)
   103 if test x$enable_music_wave = xyes; then
   104     CFLAGS="$CFLAGS -DWAV_MUSIC"
   105 fi
   106 no_libmikmod=no
   107 libmikmod_maj=3
   108 libmikmod_min=1
   109 libmikmod_rev=10
   110 libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
   111 AC_ARG_ENABLE(music-libmikmod,
   112 [  --enable-music-libmikmod  enable MOD music via externl libmikmod [default=yes]],
   113               , enable_music_libmikmod=yes)
   114 if test x$enable_music_libmikmod = xyes; then
   115 	AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH])
   116 	if test "$LIBMIKMOD_CONFIG" = "no" ; then
   117 		no_libmikmod==yes
   118 	else
   119 		CFLAGS_SAVED="$CFLAGS"
   120 		LIBS_SAVED="$LIBS"
   121 		CFLAGS="$CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
   122 		LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
   123 		AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver])
   124 		AC_TRY_RUN([
   125 #include "mikmod.h"
   126 #include "stdio.h"
   127 
   128 int main(int argc, char **argv)
   129 {
   130 	long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
   131 	/*printf("(%d.%d.%d) ",ver>>16,(ver>>8)&0xff,ver&0xff);*/
   132 	if(ver>=((maj<<16)|(min<<8)|(rev))) {
   133 		printf("yes\n");
   134 		return 0;
   135 	}
   136 	printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
   137 	return 1;
   138 }
   139 ],, no_libmikmod=yes;CFLAGS="$CFLAGS_SAVED";LIBS="$LIBS_SAVED",
   140 [echo $ac_n "cross compiling; assumed OK... $ac_c"])
   141 	fi
   142 fi
   143 
   144 AC_ARG_ENABLE(music-mod,
   145 [  --enable-music-mod      enable MOD music via mikmod [default=yes]],
   146 , enable_music_mod=$no_libmikmod)
   147 if test x$enable_music_mod = xyes; then
   148     CFLAGS="$CFLAGS -DMOD_MUSIC -I\$(top_srcdir)/mikmod"
   149     MUSIC_SUBDIRS="$MUSIC_SUBDIRS mikmod"
   150 fi
   151 AC_ARG_ENABLE(music-midi,
   152 [  --enable-music-midi     enable MIDI music via timidity [default=yes]],
   153               , enable_music_midi=yes)
   154 if test x$enable_music_midi = xyes; then
   155     CFLAGS="$CFLAGS -DMID_MUSIC"
   156     AC_ARG_ENABLE(music-timidity-midi,
   157 [  --enable-music-timidity-midi  enable timidity MIDI output [default=yes]],
   158                   , enable_music_timidity_midi=yes)
   159     if test x$enable_music_timidity_midi = xyes; then
   160         CFLAGS="$CFLAGS -DUSE_TIMIDITY_MIDI -I\$(top_srcdir)/timidity"
   161         MUSIC_SUBDIRS="$MUSIC_SUBDIRS timidity"
   162     fi
   163     AC_ARG_ENABLE(music-native-midi,
   164 [  --enable-music-native-midi  enable native MIDI music output [default=yes]],
   165                   , enable_music_native_midi=yes)
   166     if test x$enable_music_native_midi = xyes; then
   167         use_music_native_midi=no
   168         case "$target" in
   169             *-*-cygwin* | *-*-mingw32*)
   170                 use_music_native_midi=yes
   171                 SYSTEM_LIBS="$SYSTEM_LIBS -lwinmm"
   172                 ;;
   173             *-*-darwin*)
   174                 use_music_native_midi=yes
   175                 SYSTEM_LIBS="$SYSTEM_LIBS -framework QuickTime"
   176                 ;;
   177         esac
   178         if test x$use_music_native_midi = xyes; then
   179             CFLAGS="$CFLAGS -DUSE_NATIVE_MIDI -I\$(top_srcdir)/native_midi"
   180             MUSIC_SUBDIRS="$MUSIC_SUBDIRS native_midi"
   181         fi
   182     fi
   183     AC_ARG_ENABLE(music-native-midi-gpl,
   184 [  --enable-music-native-midi-gpl  enable native MIDI on UNIX using GPL code [default=no]],
   185                   , enable_music_native_midi_gpl=no)
   186     if test x$enable_music_native_midi_gpl = xyes; then
   187         use_music_native_midi_gpl=no
   188         case "$target" in
   189             *-*-linux* | *-*-freebsd*)
   190                 use_music_native_midi_gpl=yes
   191                 ;;
   192         esac
   193         if test x$use_music_native_midi_gpl = xyes; then
   194             CFLAGS="$CFLAGS -DUSE_NATIVE_MIDI -I\$(top_srcdir)/native_midi"
   195             MUSIC_SUBDIRS="$MUSIC_SUBDIRS native_midi_gpl"
   196         fi
   197     fi
   198 fi
   199 AC_ARG_ENABLE(music-ogg,
   200 [  --enable-music-ogg      enable Ogg Vorbis music [default=yes]],
   201               , enable_music_ogg=yes)
   202 if test x$enable_music_ogg = xyes; then
   203     AC_MSG_CHECKING(for Ogg Vorbis headers and libraries)
   204     have_vorbis=no
   205     AC_TRY_COMPILE([
   206      #include <vorbis/vorbisfile.h>
   207     ],[
   208     ],[
   209     have_vorbis=yes
   210     ])
   211     AC_MSG_RESULT($have_vorbis)
   212     if test x$have_vorbis = xyes; then
   213         CFLAGS="$CFLAGS -DOGG_MUSIC"
   214         SYSTEM_LIBS="$SYSTEM_LIBS -lvorbisfile -lvorbis -logg"
   215     fi
   216 fi
   217 AC_ARG_ENABLE(music-mp3,
   218 [  --enable-music-mp3      enable MP3 music via smpeg [default=yes]],
   219               , enable_music_mp3=yes)
   220 if test x$enable_music_mp3 = xyes; then
   221     SMPEG_VERSION=0.4.3
   222     AM_PATH_SMPEG($SMPEG_VERSION, have_smpeg=yes, have_smpeg=no)
   223     if test x$have_smpeg = xyes; then
   224         CFLAGS="$CFLAGS -DMP3_MUSIC $SMPEG_CFLAGS"
   225         SYSTEM_LIBS="$SYSTEM_LIBS $SMPEG_LIBS"
   226     fi
   227 fi
   228 
   229 dnl Add Makefile conditionals
   230 AC_SUBST(MUSIC_SUBDIRS)
   231 AM_CONDITIONAL(USE_MIKMOD, test x$enable_music_mod = xyes)
   232 AM_CONDITIONAL(USE_TIMIDITY, test x$enable_music_timidity_midi = xyes)
   233 AM_CONDITIONAL(USE_NATIVE_MIDI, test x$use_music_native_midi = xyes || test x$use_music_native_midi_gpl = xyes)
   234 AM_CONDITIONAL(USE_NATIVE_MIDI_GPL, test x$use_music_native_midi_gpl = xyes)
   235 
   236 dnl Expand the libraries needed for static and dynamic linking
   237 AC_SUBST(SYSTEM_LIBS)
   238 
   239 # Finally create all the generated files
   240 AC_OUTPUT([
   241 Makefile
   242 mikmod/Makefile
   243 timidity/Makefile
   244 native_midi/Makefile
   245 native_midi_gpl/Makefile
   246 SDL_mixer.spec
   247 SDL_mixer.qpg
   248 ])