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