configure.in
author Sam Lantinga <slouken@libsdl.org>
Tue, 21 Dec 2004 17:52:16 +0000
changeset 255 16119b6dc45a
parent 254 1ad5ff083036
child 257 8a32c0a3c609
permissions -rw-r--r--
Version bumped because of the header file change
     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=7
    17 INTERFACE_AGE=5
    18 BINARY_AGE=7
    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 Check command-line options
    89 
    90 AC_ARG_ENABLE(music-cmd,
    91 [  --enable-music-cmd      support an external music player [default=yes]],
    92               , enable_music_cmd=yes)
    93 if test x$enable_music_cmd = xyes; then
    94     CFLAGS="$CFLAGS -DCMD_MUSIC"
    95 fi
    96 AC_ARG_ENABLE(music-wave,
    97 [  --enable-music-wave     enable streaming WAVE music [default=yes]],
    98               , enable_music_wave=yes)
    99 if test x$enable_music_wave = xyes; then
   100     CFLAGS="$CFLAGS -DWAV_MUSIC"
   101 fi
   102 no_libmikmod=no
   103 libmikmod_maj=3
   104 libmikmod_min=1
   105 libmikmod_rev=10
   106 libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
   107 AC_ARG_ENABLE(music-libmikmod,
   108 [  --enable-music-libmikmod  enable MOD music via externl libmikmod [default=yes]],
   109               , enable_music_libmikmod=yes)
   110 if test x$enable_music_libmikmod = xyes; then
   111 	AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH])
   112 	if test "$LIBMIKMOD_CONFIG" = "no" ; then
   113 		no_libmikmod=yes
   114 	else
   115 		CFLAGS_SAVED="$CFLAGS"
   116 		LIBS_SAVED="$LIBS"
   117 		CFLAGS="$CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
   118 		LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
   119 		AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver])
   120 		AC_TRY_RUN([
   121 #include "mikmod.h"
   122 #include "stdio.h"
   123 
   124 int main(int argc, char **argv)
   125 {
   126 	long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
   127 	/*printf("(%d.%d.%d) ",ver>>16,(ver>>8)&0xff,ver&0xff);*/
   128 	if(ver>=((maj<<16)|(min<<8)|(rev))) {
   129 		printf("yes\n");
   130 		return 0;
   131 	}
   132 	printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
   133 	return 1;
   134 }
   135 ],, no_libmikmod=yes;CFLAGS="$CFLAGS_SAVED";LIBS="$LIBS_SAVED",
   136 [echo $ac_n "cross compiling; assumed OK... $ac_c"])
   137 	fi
   138 fi
   139 
   140 AC_ARG_ENABLE(music-mod,
   141 [  --enable-music-mod      enable MOD music via mikmod [default=yes]],
   142 , enable_music_mod=$no_libmikmod)
   143 if test x$enable_music_mod = xyes; then
   144     CFLAGS="$CFLAGS -DMOD_MUSIC -I\$(top_srcdir)/mikmod"
   145     MUSIC_SUBDIRS="$MUSIC_SUBDIRS mikmod"
   146 fi
   147 AC_ARG_ENABLE(music-midi,
   148 [  --enable-music-midi     enable MIDI music via timidity [default=yes]],
   149               , enable_music_midi=yes)
   150 if test x$enable_music_midi = xyes; then
   151     CFLAGS="$CFLAGS -DMID_MUSIC"
   152     AC_ARG_ENABLE(music-timidity-midi,
   153 [  --enable-music-timidity-midi  enable timidity MIDI output [default=yes]],
   154                   , enable_music_timidity_midi=yes)
   155     if test x$enable_music_timidity_midi = xyes; then
   156         CFLAGS="$CFLAGS -DUSE_TIMIDITY_MIDI -I\$(top_srcdir)/timidity"
   157         MUSIC_SUBDIRS="$MUSIC_SUBDIRS timidity"
   158     fi
   159     AC_ARG_ENABLE(music-native-midi,
   160 [  --enable-music-native-midi  enable native MIDI music output [default=yes]],
   161                   , enable_music_native_midi=yes)
   162     if test x$enable_music_native_midi = xyes; then
   163         use_music_native_midi=no
   164         case "$target" in
   165             *-*-cygwin* | *-*-mingw32*)
   166                 use_music_native_midi=yes
   167                 SYSTEM_LIBS="$SYSTEM_LIBS -lwinmm"
   168                 ;;
   169             *-*-darwin*)
   170                 use_music_native_midi=yes
   171                 SYSTEM_LIBS="$SYSTEM_LIBS -framework QuickTime"
   172                 ;;
   173         esac
   174         if test x$use_music_native_midi = xyes; then
   175             CFLAGS="$CFLAGS -DUSE_NATIVE_MIDI -I\$(top_srcdir)/native_midi"
   176             MUSIC_SUBDIRS="$MUSIC_SUBDIRS native_midi"
   177         fi
   178     fi
   179     AC_ARG_ENABLE(music-native-midi-gpl,
   180 [  --enable-music-native-midi-gpl  enable native MIDI on UNIX using GPL code [default=no]],
   181                   , enable_music_native_midi_gpl=no)
   182     if test x$enable_music_native_midi_gpl = xyes; then
   183         use_music_native_midi_gpl=no
   184         case "$target" in
   185             *-*-linux* | *-*-freebsd*)
   186                 use_music_native_midi_gpl=yes
   187                 ;;
   188         esac
   189         if test x$use_music_native_midi_gpl = xyes; then
   190             CFLAGS="$CFLAGS -DUSE_NATIVE_MIDI -I\$(top_srcdir)/native_midi"
   191             MUSIC_SUBDIRS="$MUSIC_SUBDIRS native_midi_gpl"
   192         fi
   193     fi
   194 fi
   195 AC_ARG_ENABLE(music-ogg,
   196 [  --enable-music-ogg      enable Ogg Vorbis music [default=yes]],
   197               , enable_music_ogg=yes)
   198 if test x$enable_music_ogg = xyes; then
   199     AC_MSG_CHECKING(for Ogg Vorbis headers and libraries)
   200     have_vorbis=no
   201     AC_TRY_COMPILE([
   202      #include <vorbis/vorbisfile.h>
   203     ],[
   204     ],[
   205     have_vorbis=yes
   206     ])
   207     AC_MSG_RESULT($have_vorbis)
   208     if test x$have_vorbis = xyes; then
   209         CFLAGS="$CFLAGS -DOGG_MUSIC"
   210         SYSTEM_LIBS="$SYSTEM_LIBS -lvorbisfile -lvorbis -logg"
   211     fi
   212 fi
   213 AC_ARG_ENABLE(music-mp3,
   214 [  --enable-music-mp3      enable MP3 music via smpeg [default=yes]],
   215               , enable_music_mp3=yes)
   216 if test x$enable_music_mp3 = xyes; then
   217     SMPEG_VERSION=0.4.3
   218     AM_PATH_SMPEG($SMPEG_VERSION, have_smpeg=yes, have_smpeg=no)
   219     if test x$have_smpeg = xyes; then
   220         CFLAGS="$CFLAGS -DMP3_MUSIC $SMPEG_CFLAGS"
   221         SYSTEM_LIBS="$SYSTEM_LIBS $SMPEG_LIBS"
   222     fi
   223 fi
   224 
   225 dnl Add Makefile conditionals
   226 AC_SUBST(MUSIC_SUBDIRS)
   227 AM_CONDITIONAL(USE_MIKMOD, test x$enable_music_mod = xyes)
   228 AM_CONDITIONAL(USE_TIMIDITY, test x$enable_music_timidity_midi = xyes)
   229 AM_CONDITIONAL(USE_NATIVE_MIDI, test x$use_music_native_midi = xyes || test x$use_music_native_midi_gpl = xyes)
   230 AM_CONDITIONAL(USE_NATIVE_MIDI_GPL, test x$use_music_native_midi_gpl = xyes)
   231 
   232 dnl Expand the libraries needed for static and dynamic linking
   233 AC_SUBST(SYSTEM_LIBS)
   234 
   235 # Finally create all the generated files
   236 AC_OUTPUT([
   237 Makefile
   238 mikmod/Makefile
   239 timidity/Makefile
   240 native_midi/Makefile
   241 native_midi_gpl/Makefile
   242 SDL_mixer.spec
   243 SDL_mixer.qpg
   244 ])