dnl Process this file with autoconf to produce a configure script. AC_INIT(README) dnl Set various version strings - taken gratefully from the GTk sources # Making releases: # MICRO_VERSION += 1; # INTERFACE_AGE += 1; # BINARY_AGE += 1; # if any functions have been added, set INTERFACE_AGE to 0. # if backwards compatibility has been broken, # set BINARY_AGE and INTERFACE_AGE to 0. # MAJOR_VERSION=1 MINOR_VERSION=2 MICRO_VERSION=8 INTERFACE_AGE=6 BINARY_AGE=8 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION AC_SUBST(MAJOR_VERSION) AC_SUBST(MINOR_VERSION) AC_SUBST(MICRO_VERSION) AC_SUBST(INTERFACE_AGE) AC_SUBST(BINARY_AGE) AC_SUBST(VERSION) # libtool versioning LT_RELEASE=$MAJOR_VERSION.$MINOR_VERSION LT_CURRENT=`expr $MICRO_VERSION - $INTERFACE_AGE` LT_REVISION=$INTERFACE_AGE LT_AGE=`expr $BINARY_AGE - $INTERFACE_AGE` AC_SUBST(LT_RELEASE) AC_SUBST(LT_CURRENT) AC_SUBST(LT_REVISION) AC_SUBST(LT_AGE) dnl Detect the canonical build and host environments AC_CONFIG_AUX_DIRS($srcdir/build-scripts) AC_CANONICAL_HOST dnl Set up the compiler and linker flags case "$host" in *-*-cygwin*) # We build SDL on cygwin without the UNIX emulation layer BASE_CFLAGS="-I/usr/include/mingw -mno-cygwin" BASE_LDFLAGS="-mno-cygwin" ;; *) BASE_CFLAGS="-D_GNU_SOURCE=1" BASE_LDFLAGS="" ;; esac BUILD_CFLAGS="$CFLAGS $CPPFLAGS" EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS" BUILD_LDFLAGS="$LDFLAGS" EXTRA_LDFLAGS="$BASE_LDFLAGS" ## These are common directories to find software packages #for path in /usr/freeware /usr/pkg /usr/local; do # if test -d $path/include; then # EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include" # fi # if test -d $path/lib; then # EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib" # fi #done CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS" CFLAGS="$CFLAGS $EXTRA_CFLAGS" LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS" dnl Check for tools AC_LIBTOOL_WIN32_DLL AC_PROG_LIBTOOL AC_PROG_CC AC_PROG_INSTALL AC_PROG_MAKE_SET if test -z "$host_alias"; then hostaliaswindres= else hostaliaswindres="$host_alias-windres" fi AC_CHECK_PROGS(WINDRES, [windres $hostaliaswindres $host_os-windres]) dnl Check for compiler characteristics AC_C_CONST case "$host" in *-*-cygwin* | *-*-mingw32*) SOURCES="$srcdir/version.rc" EXE=".exe" if test "$build" != "$host"; then # cross-compiling # Default cross-compile location ac_default_prefix=/usr/local/cross-tools/i386-mingw32 else # Look for the location of the tools and install there if test "$BUILD_PREFIX" != ""; then ac_default_prefix=$BUILD_PREFIX fi fi ;; *) SOURCES="" EXE="" ;; esac # Standard C sources SOURCES="$SOURCES \ $srcdir/effect_position.c \ $srcdir/effect_stereoreverse.c \ $srcdir/effects_internal.c \ $srcdir/load_aiff.c \ $srcdir/load_voc.c \ $srcdir/mixer.c \ $srcdir/music.c" find_lib() { gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`] gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`] env_lib_path=[`echo $LIBS $LDFLAGS | sed 's/-L[ ]*//g'`] for path in $gcc_bin_path $gcc_lib_path $env_lib_path /usr/lib /usr/local/lib; do lib=[`ls -- $path/$1 2>/dev/null | sort -r | sed 's/.*\/\(.*\)/\1/; q'`] if test x$lib != x; then echo $lib return fi done } dnl Check for SDL SDL_VERSION=1.2.10 AM_PATH_SDL($SDL_VERSION, :, AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]) ) EXTRA_CFLAGS="$EXTRA_CFLAGS $SDL_CFLAGS" EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SDL_LIBS" dnl Check command-line options AC_ARG_ENABLE([music-cmd], AC_HELP_STRING([--enable-music-cmd], [support an external music player [[default=yes]]]), [], [enable_music_cmd=yes]) if test x$enable_music_cmd = xyes; then SOURCES="$SOURCES $srcdir/music_cmd.c" EXTRA_CFLAGS="$EXTRA_CFLAGS -DCMD_MUSIC" fi AC_ARG_ENABLE([music-wave], AC_HELP_STRING([--enable-music-wave], [enable streaming WAVE music [[default=yes]]]), [], [enable_music_wave=yes]) if test x$enable_music_wave = xyes; then SOURCES="$SOURCES $srcdir/wavestream.c" EXTRA_CFLAGS="$EXTRA_CFLAGS -DWAV_MUSIC" fi no_libmikmod=yes libmikmod_maj=3 libmikmod_min=1 libmikmod_rev=10 libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev" AC_ARG_ENABLE([music-libmikmod], AC_HELP_STRING([--enable-music-libmikmod], [enable MOD music via external libmikmod [[default=no]]]), [], [enable_music_libmikmod=no]) if test x$enable_music_libmikmod = xyes; then AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH]) if test "$LIBMIKMOD_CONFIG" != "no" ; then no_libmikmod=no CFLAGS_SAVED="$CFLAGS" LIBS_SAVED="$LIBS" CFLAGS="$CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`" LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`" AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver]) AC_TRY_RUN([ #include "mikmod.h" #include "stdio.h" int main(int argc, char **argv) { long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion(); /*printf("(%d.%d.%d) ",ver>>16,(ver>>8)&0xff,ver&0xff);*/ if(ver>=((maj<<16)|(min<<8)|(rev))) { printf("yes\n"); return 0; } printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev); return 1; } ], EXTRA_CFLAGS="$EXTRA_CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`";EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$LIBMIKMOD_CONFIG --libs`", CFLAGS="$CFLAGS_SAVED";LIBS="$LIBS_SAVED", [echo $ac_n "cross compiling; assumed OK... $ac_c"]) fi fi AC_ARG_ENABLE([music-mod], AC_HELP_STRING([--enable-music-mod], [enable MOD music via mikmod [[default=yes]]]), [], [enable_music_mod=$no_libmikmod]) if test x$enable_music_mod = xyes -a x$enable_music_libmikmod = xno; then EXTRA_CFLAGS="$EXTRA_CFLAGS -DMOD_MUSIC -I\$(srcdir)/mikmod" SOURCES="$SOURCES $srcdir/mikmod/*.c" fi AC_ARG_ENABLE([music-midi], AC_HELP_STRING([--enable-music-midi], [enable MIDI music via timidity [[default=yes]]]), [], [enable_music_midi=yes]) if test x$enable_music_midi = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -DMID_MUSIC" AC_ARG_ENABLE([music-timidity-midi], AC_HELP_STRING([--enable-music-timidity-midi], [enable timidity MIDI output [[default=yes]]]), [], [enable_music_timidity_midi=yes]) if test x$enable_music_timidity_midi = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_TIMIDITY_MIDI -I\$(srcdir)/timidity" SOURCES="$SOURCES $srcdir/timidity/*.c" fi AC_ARG_ENABLE([music-native-midi], AC_HELP_STRING([--enable-music-native-midi], [enable native MIDI music output [[default=yes]]]), [], [enable_music_native_midi=yes]) if test x$enable_music_native_midi = xyes; then use_music_native_midi=no case "$host" in *-*-cygwin* | *-*-mingw32*) use_music_native_midi=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lwinmm" ;; *-*-darwin*) use_music_native_midi=yes EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuickTime -Wl,-framework,CoreServices" ;; esac if test x$use_music_native_midi = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi" SOURCES="$SOURCES $srcdir/native_midi/*.c" fi fi AC_ARG_ENABLE([music-native-midi-gpl], AC_HELP_STRING([--enable-music-native-midi-gpl], [enable native MIDI on UNIX using GPL code [[default=no]]]), [], [enable_music_native_midi_gpl=no]) if test x$enable_music_native_midi_gpl = xyes; then use_music_native_midi_gpl=no case "$host" in *-*-linux* | *-*-freebsd*) use_music_native_midi_gpl=yes ;; esac if test x$use_music_native_midi_gpl = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -DUSE_NATIVE_MIDI -I\$(srcdir)/native_midi" SOURCES="$SOURCES $srcdir/native_midi_gpl/*.c" fi fi fi AC_ARG_ENABLE([music-ogg], AC_HELP_STRING([--enable-music-ogg], [enable Ogg Vorbis music [[default=yes]]]), [], [enable_music_ogg=yes]) AC_ARG_ENABLE(music-ogg-tremor, [ --enable-music-ogg-tremor enable OGG music via libtremor [[default=no]]], [], enable_music_ogg_tremor=no) AC_ARG_ENABLE([music-ogg-shared], AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis support [[default=yes]]]), [], [enable_music_ogg_shared=yes]) if test x$enable_music_ogg = xyes; then if test x$enable_music_ogg_tremor = xyes; then AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes]) AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes]) if test x$have_tremor_hdr = xyes -a x$have_tremor_lib = xyes; then case "$host" in *-*-darwin*) ogg_lib=[`find_lib libvorbisidec*.dylib`] if test x$ogg_lib = x; then ogg_lib=[`find_lib libvorbisidec.[0-9]`] fi if test x$ogg_lib = x; then ogg_lib=[`find_lib libvorbisidec.[0-9]*`] fi ;; *-*-cygwin* | *-*-mingw32*) ogg_lib=[`find_lib "vorbisidec*.dll"`] ;; *) ogg_lib=[`find_lib "libvorbisidec.so.[0-9]"`] if test x$ogg_lib = x; then ogg_lib=[`find_lib "libvorbisidec.so.[0-9]*"`] fi ;; esac SOURCES="$SOURCES $srcdir/*_ogg.c" EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC -DOGG_USE_TREMOR" if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then echo "-- dynamic libvorbisidec -> $ogg_lib" EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\"" else EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisidec" fi fi else AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes]) AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes]) if test x$have_ogg_hdr = xyes -a x$have_ogg_lib = xyes; then case "$host" in *-*-darwin*) ogg_lib=[`find_lib libvorbisfile*.dylib`] ;; *-*-cygwin* | *-*-mingw32*) ogg_lib=[`find_lib "libvorbisfile*.dll"`] ;; *) ogg_lib=[`find_lib "libvorbisfile.so.[0-9]"`] if test x$ogg_lib = x; then ogg_lib=[`find_lib "libvorbisfile.so.[0-9]*"`] fi ;; esac SOURCES="$SOURCES $srcdir/*_ogg.c" EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_MUSIC" if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then echo "-- dynamic libvorbisfile -> $ogg_lib" EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\"" else EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis -logg" fi fi fi fi AC_ARG_ENABLE(music-mp3, [ --enable-music-mp3 enable MP3 music via smpeg [[default=yes]]], , enable_music_mp3=yes) if test x$enable_music_mp3 = xyes; then SMPEG_VERSION=0.4.3 AM_PATH_SMPEG($SMPEG_VERSION, have_smpeg=yes, have_smpeg=no) if test x$have_smpeg = xyes; then AC_ARG_ENABLE([music-mp3-shared], AC_HELP_STRING([--enable-music-mp3-shared], [dynamically load MP3 support [[default=yes]]]), [], [enable_music_mp3_shared=yes]) case "$host" in *-*-darwin*) smpeg_lib=[`find_lib libsmpeg*.dylib`] ;; *-*-cygwin* | *-*-mingw32*) smpeg_lib=[`find_lib "smpeg*.dll"`] ;; *) smpeg_lib=[`find_lib "libsmpeg*.so.[0-9]"`] if test x$smpeg_lib = x; then smpeg_lib=[`find_lib "libsmpeg*.so.[0-9]*"`] fi ;; esac SOURCES="$SOURCES $srcdir/*_mp3.c" EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MUSIC $SMPEG_CFLAGS" if test x$enable_music_mp3_shared = xyes && test x$smpeg_lib != x; then echo "-- dynamic libsmpeg -> $smpeg_lib" EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_DYNAMIC=\\\"$smpeg_lib\\\"" else EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SMPEG_LIBS" fi fi fi AC_ARG_ENABLE(music-mp3-mad-gpl, AC_HELP_STRING([--enable-music-mp3-mad-gpl], [enable MP3 music via libmad GPL code [[default=no]]]), [], [enable_music_mp3_mad_gpl=no]) if test x$enable_music_mp3_mad_gpl = xyes; then AC_MSG_CHECKING(for libmad headers) have_libmad=no AC_TRY_COMPILE([ #include "mad.h" ],[ ],[ have_libmad=yes ]) AC_MSG_RESULT($have_libmad) if test x$have_libmad = xyes; then SOURCES="$SOURCES $srcdir/music_mad.c" EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MAD_MUSIC" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad" fi fi OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'` OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'` dnl Expand the sources and objects needed to build the library AC_SUBST(ac_aux_dir) AC_SUBST(SOURCES) AC_SUBST(OBJECTS) AC_SUBST(BUILD_CFLAGS) AC_SUBST(EXTRA_CFLAGS) AC_SUBST(BUILD_LDFLAGS) AC_SUBST(EXTRA_LDFLAGS) AC_SUBST(EXE) AC_SUBST(WINDRES) AC_SUBST(SDL_CFLAGS) AC_SUBST(SDL_LIBS) AC_OUTPUT([ Makefile SDL_mixer.spec SDL_mixer.qpg ], [ : >build-deps if test x"$MAKE" = x; then MAKE=make; fi; $MAKE depend ])