configure.in
changeset 294 58eb208474e0
parent 289 e893c155075b
child 303 e851b5783fdf
     1.1 --- a/configure.in	Sun Apr 30 08:56:00 2006 +0000
     1.2 +++ b/configure.in	Sun Apr 30 20:27:33 2006 +0000
     1.3 @@ -10,7 +10,7 @@
     1.4  # if any functions have been added, set INTERFACE_AGE to 0.
     1.5  # if backwards compatibility has been broken,
     1.6  # set BINARY_AGE and INTERFACE_AGE to 0.
     1.7 -
     1.8 +#
     1.9  MAJOR_VERSION=1
    1.10  MINOR_VERSION=2
    1.11  MICRO_VERSION=7
    1.12 @@ -37,53 +37,75 @@
    1.13  AC_SUBST(LT_AGE)
    1.14  
    1.15  dnl Detect the canonical build and host environments
    1.16 +AC_CONFIG_AUX_DIRS($srcdir/build-scripts)
    1.17  AC_CANONICAL_HOST
    1.18  
    1.19 -dnl Setup for automake
    1.20 -AM_INIT_AUTOMAKE(SDL_mixer, $VERSION)
    1.21 +dnl Set up the compiler and linker flags
    1.22 +case "$host" in
    1.23 +    *-*-cygwin*)
    1.24 +        # We build SDL on cygwin without the UNIX emulation layer
    1.25 +        BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin"
    1.26 +        BASE_LDFLAGS="-mno-cygwin"
    1.27 +        ;;
    1.28 +    *)
    1.29 +        BASE_CFLAGS="-D_GNU_SOURCE=1"
    1.30 +        BASE_LDFLAGS=""
    1.31 +        ;;
    1.32 +esac
    1.33 +BUILD_CFLAGS="$CFLAGS $CPPFLAGS"
    1.34 +EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
    1.35 +BUILD_LDFLAGS="$LDFLAGS"
    1.36 +EXTRA_LDFLAGS="$BASE_LDFLAGS"
    1.37 +for path in /usr/local; do
    1.38 +    if test -d $path/include; then
    1.39 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
    1.40 +    fi
    1.41 +    if test -d $path/lib; then
    1.42 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
    1.43 +    fi
    1.44 +done
    1.45 +CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
    1.46 +CFLAGS="$CFLAGS $EXTRA_CFLAGS"
    1.47 +LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
    1.48  
    1.49  dnl Check for tools
    1.50 +AC_LIBTOOL_WIN32_DLL
    1.51 +AC_PROG_LIBTOOL
    1.52 +AC_PROG_CC
    1.53 +AC_PROG_CXX
    1.54 +AC_PROG_INSTALL
    1.55 +AC_PROG_MAKE_SET
    1.56  
    1.57 -AC_PROG_MAKE_SET
    1.58 -AC_PROG_CC
    1.59 -AC_LIBTOOL_WIN32_DLL
    1.60 -AM_PROG_LIBTOOL
    1.61 -AC_PROG_INSTALL
    1.62 +dnl Check for compiler characteristics
    1.63 +AC_C_CONST
    1.64  
    1.65 -dnl The alpha architecture needs special flags for binary portability
    1.66  case "$host" in
    1.67 -    alpha*-*-linux*)
    1.68 -        CFLAGS="$CFLAGS -mcpu=ev4 -Wa,-mall"
    1.69 +    *-*-cygwin* | *-*-mingw32*)
    1.70 +        EXE=".exe"
    1.71          ;;
    1.72 -    *-*-beos*)
    1.73 -        ac_default_prefix=/boot/develop/tools/gnupro
    1.74 -        ;;
    1.75 -    *-*-cygwin* | *-*-mingw32*)
    1.76 -        if test "$build" != "$host"; then # cross-compiling
    1.77 -            # Default cross-compile location
    1.78 -            ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc
    1.79 -        else
    1.80 -            # Look for the location of the tools and install there
    1.81 -            if test "$BUILD_PREFIX" != ""; then
    1.82 -                ac_default_prefix=$BUILD_PREFIX
    1.83 -            fi
    1.84 -        fi
    1.85 -        ;;
    1.86 -    *-*-darwin*)
    1.87 -        AC_DEFINE(MACOSX)
    1.88 -        ;;
    1.89 -    m68k-atari-mint*)
    1.90 -        CFLAGS="$CFLAGS -Dunix"
    1.91 +    *)
    1.92 +        EXE=""
    1.93          ;;
    1.94  esac
    1.95  
    1.96 +# Standard C sources
    1.97 +SOURCES="$SOURCES \
    1.98 +$srcdir/effect_position.c \
    1.99 +$srcdir/effect_stereoreverse.c \
   1.100 +$srcdir/effects_internal.c \
   1.101 +$srcdir/load_aiff.c \
   1.102 +$srcdir/load_voc.c \
   1.103 +$srcdir/mixer.c \
   1.104 +$srcdir/music.c"
   1.105 +
   1.106  dnl Check for SDL
   1.107  SDL_VERSION=1.2.4
   1.108  AM_PATH_SDL($SDL_VERSION,
   1.109              :,
   1.110  	    AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
   1.111  )
   1.112 -CFLAGS="$CFLAGS $SDL_CFLAGS"
   1.113 +EXTRA_CFLAGS="$EXTRA_CFLAGS $SDL_CFLAGS"
   1.114 +EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SDL_LIBS"
   1.115  
   1.116  dnl Check command-line options
   1.117  
   1.118 @@ -91,13 +113,15 @@
   1.119  [  --enable-music-cmd      support an external music player [default=yes]],
   1.120                , enable_music_cmd=yes)
   1.121  if test x$enable_music_cmd = xyes; then
   1.122 -    CFLAGS="$CFLAGS -DCMD_MUSIC"
   1.123 +    SOURCES="$SOURCES $srcdir/music_cmd.c"
   1.124 +    EXTRA_CFLAGS="$EXTRA_CFLAGS -DCMD_MUSIC"
   1.125  fi
   1.126  AC_ARG_ENABLE(music-wave,
   1.127  [  --enable-music-wave     enable streaming WAVE music [default=yes]],
   1.128                , enable_music_wave=yes)
   1.129  if test x$enable_music_wave = xyes; then
   1.130 -    CFLAGS="$CFLAGS -DWAV_MUSIC"
   1.131 +    SOURCES="$SOURCES $srcdir/wavestream.c"
   1.132 +    EXTRA_CFLAGS="$EXTRA_CFLAGS -DWAV_MUSIC"
   1.133  fi
   1.134  no_libmikmod=yes
   1.135  libmikmod_maj=3
   1.136 @@ -140,20 +164,20 @@
   1.137  [  --enable-music-mod      enable MOD music via mikmod [default=yes]],
   1.138  , enable_music_mod=$no_libmikmod)
   1.139  if test x$enable_music_mod = xyes; then
   1.140 -    CFLAGS="$CFLAGS -DMOD_MUSIC -I\$(top_srcdir)/mikmod"
   1.141 -    MUSIC_SUBDIRS="$MUSIC_SUBDIRS mikmod"
   1.142 +    EXTRA_CFLAGS="$EXTRA_CFLAGS -DMOD_MUSIC -I\$(srcdir)/mikmod"
   1.143 +    SOURCES="$SOURCES $srcdir/mikmod/*.c"
   1.144  fi
   1.145  AC_ARG_ENABLE(music-midi,
   1.146  [  --enable-music-midi     enable MIDI music via timidity [default=yes]],
   1.147                , enable_music_midi=yes)
   1.148  if test x$enable_music_midi = xyes; then
   1.149 -    CFLAGS="$CFLAGS -DMID_MUSIC"
   1.150 +    EXTRA_CFLAGS="$EXTRA_CFLAGS -DMID_MUSIC"
   1.151      AC_ARG_ENABLE(music-timidity-midi,
   1.152  [  --enable-music-timidity-midi  enable timidity MIDI output [default=yes]],
   1.153                    , enable_music_timidity_midi=yes)
   1.154      if test x$enable_music_timidity_midi = xyes; then
   1.155 -        CFLAGS="$CFLAGS -DUSE_TIMIDITY_MIDI -I\$(top_srcdir)/timidity"
   1.156 -        MUSIC_SUBDIRS="$MUSIC_SUBDIRS timidity"
   1.157 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_TIMIDITY_MIDI -I\$(srcdir)/timidity"
   1.158 +        SOURCES="$SOURCES $srcdir/timidity/*.c"
   1.159      fi
   1.160      AC_ARG_ENABLE(music-native-midi,
   1.161  [  --enable-music-native-midi  enable native MIDI music output [default=yes]],
   1.162 @@ -163,16 +187,16 @@
   1.163          case "$host" in
   1.164              *-*-cygwin* | *-*-mingw32*)
   1.165                  use_music_native_midi=yes
   1.166 -                SYSTEM_LIBS="$SYSTEM_LIBS -lwinmm"
   1.167 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lwinmm"
   1.168                  ;;
   1.169              *-*-darwin*)
   1.170                  use_music_native_midi=yes
   1.171 -                SYSTEM_LIBS="$SYSTEM_LIBS -framework QuickTime"
   1.172 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime"
   1.173                  ;;
   1.174          esac
   1.175          if test x$use_music_native_midi = xyes; then
   1.176 -            CFLAGS="$CFLAGS -DUSE_NATIVE_MIDI -I\$(top_srcdir)/native_midi"
   1.177 -            MUSIC_SUBDIRS="$MUSIC_SUBDIRS native_midi"
   1.178 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
   1.179 +            SOURCES="$SOURCES $srcdir/native_midi/*.c"
   1.180          fi
   1.181      fi
   1.182      AC_ARG_ENABLE(music-native-midi-gpl,
   1.183 @@ -186,8 +210,8 @@
   1.184                  ;;
   1.185          esac
   1.186          if test x$use_music_native_midi_gpl = xyes; then
   1.187 -            CFLAGS="$CFLAGS -DUSE_NATIVE_MIDI -I\$(top_srcdir)/native_midi"
   1.188 -            MUSIC_SUBDIRS="$MUSIC_SUBDIRS native_midi_gpl"
   1.189 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi"
   1.190 +            SOURCES="$SOURCES $srcdir/native_midi_gpl/*.c"
   1.191          fi
   1.192      fi
   1.193  fi
   1.194 @@ -205,8 +229,9 @@
   1.195      ])
   1.196      AC_MSG_RESULT($have_vorbis)
   1.197      if test x$have_vorbis = xyes; then
   1.198 -        CFLAGS="$CFLAGS -DOGG_MUSIC"
   1.199 -        SYSTEM_LIBS="$SYSTEM_LIBS -lvorbisfile -lvorbis -logg"
   1.200 +        SOURCES="$SOURCE $srcdir/load_ogg.c $srcdir/music_ogg.c"
   1.201 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC"
   1.202 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis -logg"
   1.203      fi
   1.204  fi
   1.205  AC_ARG_ENABLE(music-mp3,
   1.206 @@ -216,28 +241,28 @@
   1.207      SMPEG_VERSION=0.4.3
   1.208      AM_PATH_SMPEG($SMPEG_VERSION, have_smpeg=yes, have_smpeg=no)
   1.209      if test x$have_smpeg = xyes; then
   1.210 -        CFLAGS="$CFLAGS -DMP3_MUSIC $SMPEG_CFLAGS"
   1.211 -        SYSTEM_LIBS="$SYSTEM_LIBS $SMPEG_LIBS"
   1.212 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MUSIC $SMPEG_CFLAGS"
   1.213 +        EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SMPEG_LIBS"
   1.214      fi
   1.215  fi
   1.216  
   1.217 -dnl Add Makefile conditionals
   1.218 -AC_SUBST(MUSIC_SUBDIRS)
   1.219 -AM_CONDITIONAL(USE_MIKMOD, test x$enable_music_mod = xyes)
   1.220 -AM_CONDITIONAL(USE_TIMIDITY, test x$enable_music_timidity_midi = xyes)
   1.221 -AM_CONDITIONAL(USE_NATIVE_MIDI, test x$use_music_native_midi = xyes || test x$use_music_native_midi_gpl = xyes)
   1.222 -AM_CONDITIONAL(USE_NATIVE_MIDI_GPL, test x$use_music_native_midi_gpl = xyes)
   1.223 +OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
   1.224  
   1.225 -dnl Expand the libraries needed for static and dynamic linking
   1.226 -AC_SUBST(SYSTEM_LIBS)
   1.227 +dnl Expand the sources and objects needed to build the library
   1.228 +AC_SUBST(ac_aux_dir)
   1.229 +AC_SUBST(SOURCES)
   1.230 +AC_SUBST(OBJECTS)
   1.231 +AC_SUBST(BUILD_CFLAGS)
   1.232 +AC_SUBST(EXTRA_CFLAGS)
   1.233 +AC_SUBST(BUILD_LDFLAGS)
   1.234 +AC_SUBST(EXTRA_LDFLAGS)
   1.235 +AC_SUBST(EXE)
   1.236 +AC_SUBST(SDL_CFLAGS)
   1.237 +AC_SUBST(SDL_LIBS)
   1.238  
   1.239 -# Finally create all the generated files
   1.240  AC_OUTPUT([
   1.241 -Makefile
   1.242 -mikmod/Makefile
   1.243 -timidity/Makefile
   1.244 -native_midi/Makefile
   1.245 -native_midi_gpl/Makefile
   1.246 -SDL_mixer.spec
   1.247 -SDL_mixer.qpg
   1.248 +    Makefile SDL_mixer.spec SDL_mixer.qpg
   1.249 +], [
   1.250 +    : >build-deps
   1.251 +    if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend
   1.252  ])