configure.in
author Sam Lantinga <slouken@libsdl.org>
Tue, 24 Jan 2006 06:50:05 +0000
changeset 284 d7f32c4e340e
parent 257 8a32c0a3c609
child 289 e893c155075b
permissions -rw-r--r--
Date: Mon, 21 Apr 2003 03:11:14 -0500
From: Jonathan Atkins
Subject: [SDL] configure.in ( if [ ] ) problems

in configure.in, in SDL and SDL_image, perhaps other places...
I'm using the cvs of the libs, and it uses if [ ] in places...
the [ ] is eaten by m4...
please convert the if [ ] statements to: if test

that fixes stuff! :)

--
LIM
     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 test "$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=yes
   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 external libmikmod [default=no]],
   109               , enable_music_libmikmod=no)
   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=no
   114 		CFLAGS_SAVED="$CFLAGS"
   115 		LIBS_SAVED="$LIBS"
   116 		CFLAGS="$CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
   117 		LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
   118 		AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver])
   119 		AC_TRY_RUN([
   120 #include "mikmod.h"
   121 #include "stdio.h"
   122 
   123 int main(int argc, char **argv)
   124 {
   125 	long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
   126 	/*printf("(%d.%d.%d) ",ver>>16,(ver>>8)&0xff,ver&0xff);*/
   127 	if(ver>=((maj<<16)|(min<<8)|(rev))) {
   128 		printf("yes\n");
   129 		return 0;
   130 	}
   131 	printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
   132 	return 1;
   133 }
   134 ],,CFLAGS="$CFLAGS_SAVED";LIBS="$LIBS_SAVED",
   135 [echo $ac_n "cross compiling; assumed OK... $ac_c"])
   136 	fi
   137 fi
   138 
   139 AC_ARG_ENABLE(music-mod,
   140 [  --enable-music-mod      enable MOD music via mikmod [default=yes]],
   141 , enable_music_mod=$no_libmikmod)
   142 if test x$enable_music_mod = xyes; then
   143     CFLAGS="$CFLAGS -DMOD_MUSIC -I\$(top_srcdir)/mikmod"
   144     MUSIC_SUBDIRS="$MUSIC_SUBDIRS mikmod"
   145 fi
   146 AC_ARG_ENABLE(music-midi,
   147 [  --enable-music-midi     enable MIDI music via timidity [default=yes]],
   148               , enable_music_midi=yes)
   149 if test x$enable_music_midi = xyes; then
   150     CFLAGS="$CFLAGS -DMID_MUSIC"
   151     AC_ARG_ENABLE(music-timidity-midi,
   152 [  --enable-music-timidity-midi  enable timidity MIDI output [default=yes]],
   153                   , enable_music_timidity_midi=yes)
   154     if test x$enable_music_timidity_midi = xyes; then
   155         CFLAGS="$CFLAGS -DUSE_TIMIDITY_MIDI -I\$(top_srcdir)/timidity"
   156         MUSIC_SUBDIRS="$MUSIC_SUBDIRS timidity"
   157     fi
   158     AC_ARG_ENABLE(music-native-midi,
   159 [  --enable-music-native-midi  enable native MIDI music output [default=yes]],
   160                   , enable_music_native_midi=yes)
   161     if test x$enable_music_native_midi = xyes; then
   162         use_music_native_midi=no
   163         case "$target" in
   164             *-*-cygwin* | *-*-mingw32*)
   165                 use_music_native_midi=yes
   166                 SYSTEM_LIBS="$SYSTEM_LIBS -lwinmm"
   167                 ;;
   168             *-*-darwin*)
   169                 use_music_native_midi=yes
   170                 SYSTEM_LIBS="$SYSTEM_LIBS -framework QuickTime"
   171                 ;;
   172         esac
   173         if test x$use_music_native_midi = xyes; then
   174             CFLAGS="$CFLAGS -DUSE_NATIVE_MIDI -I\$(top_srcdir)/native_midi"
   175             MUSIC_SUBDIRS="$MUSIC_SUBDIRS native_midi"
   176         fi
   177     fi
   178     AC_ARG_ENABLE(music-native-midi-gpl,
   179 [  --enable-music-native-midi-gpl  enable native MIDI on UNIX using GPL code [default=no]],
   180                   , enable_music_native_midi_gpl=no)
   181     if test x$enable_music_native_midi_gpl = xyes; then
   182         use_music_native_midi_gpl=no
   183         case "$target" in
   184             *-*-linux* | *-*-freebsd*)
   185                 use_music_native_midi_gpl=yes
   186                 ;;
   187         esac
   188         if test x$use_music_native_midi_gpl = xyes; then
   189             CFLAGS="$CFLAGS -DUSE_NATIVE_MIDI -I\$(top_srcdir)/native_midi"
   190             MUSIC_SUBDIRS="$MUSIC_SUBDIRS native_midi_gpl"
   191         fi
   192     fi
   193 fi
   194 AC_ARG_ENABLE(music-ogg,
   195 [  --enable-music-ogg      enable Ogg Vorbis music [default=yes]],
   196               , enable_music_ogg=yes)
   197 if test x$enable_music_ogg = xyes; then
   198     AC_MSG_CHECKING(for Ogg Vorbis headers and libraries)
   199     have_vorbis=no
   200     AC_TRY_COMPILE([
   201      #include <vorbis/vorbisfile.h>
   202     ],[
   203     ],[
   204     have_vorbis=yes
   205     ])
   206     AC_MSG_RESULT($have_vorbis)
   207     if test x$have_vorbis = xyes; then
   208         CFLAGS="$CFLAGS -DOGG_MUSIC"
   209         SYSTEM_LIBS="$SYSTEM_LIBS -lvorbisfile -lvorbis -logg"
   210     fi
   211 fi
   212 AC_ARG_ENABLE(music-mp3,
   213 [  --enable-music-mp3      enable MP3 music via smpeg [default=yes]],
   214               , enable_music_mp3=yes)
   215 if test x$enable_music_mp3 = xyes; then
   216     SMPEG_VERSION=0.4.3
   217     AM_PATH_SMPEG($SMPEG_VERSION, have_smpeg=yes, have_smpeg=no)
   218     if test x$have_smpeg = xyes; then
   219         CFLAGS="$CFLAGS -DMP3_MUSIC $SMPEG_CFLAGS"
   220         SYSTEM_LIBS="$SYSTEM_LIBS $SMPEG_LIBS"
   221     fi
   222 fi
   223 
   224 dnl Add Makefile conditionals
   225 AC_SUBST(MUSIC_SUBDIRS)
   226 AM_CONDITIONAL(USE_MIKMOD, test x$enable_music_mod = xyes)
   227 AM_CONDITIONAL(USE_TIMIDITY, test x$enable_music_timidity_midi = xyes)
   228 AM_CONDITIONAL(USE_NATIVE_MIDI, test x$use_music_native_midi = xyes || test x$use_music_native_midi_gpl = xyes)
   229 AM_CONDITIONAL(USE_NATIVE_MIDI_GPL, test x$use_music_native_midi_gpl = xyes)
   230 
   231 dnl Expand the libraries needed for static and dynamic linking
   232 AC_SUBST(SYSTEM_LIBS)
   233 
   234 # Finally create all the generated files
   235 AC_OUTPUT([
   236 Makefile
   237 mikmod/Makefile
   238 timidity/Makefile
   239 native_midi/Makefile
   240 native_midi_gpl/Makefile
   241 SDL_mixer.spec
   242 SDL_mixer.qpg
   243 ])