configure.in
changeset 419 e27fe0bfe470
parent 411 cade1e3a4cb8
child 422 614c9a2f8279
     1.1 --- a/configure.in	Sat Oct 03 10:53:24 2009 +0000
     1.2 +++ b/configure.in	Sat Oct 03 20:43:33 2009 +0000
     1.3 @@ -152,6 +152,7 @@
     1.4      SOURCES="$SOURCES $srcdir/music_cmd.c"
     1.5      EXTRA_CFLAGS="$EXTRA_CFLAGS -DCMD_MUSIC"
     1.6  fi
     1.7 +
     1.8  AC_ARG_ENABLE([music-wave],
     1.9  AC_HELP_STRING([--enable-music-wave], [enable streaming WAVE music [[default=yes]]]),
    1.10                [], [enable_music_wave=yes])
    1.11 @@ -159,22 +160,27 @@
    1.12      SOURCES="$SOURCES $srcdir/wavestream.c"
    1.13      EXTRA_CFLAGS="$EXTRA_CFLAGS -DWAV_MUSIC"
    1.14  fi
    1.15 -no_libmikmod=yes
    1.16 -libmikmod_maj=3
    1.17 -libmikmod_min=1
    1.18 -libmikmod_rev=10
    1.19 -libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
    1.20 -AC_ARG_ENABLE([music-libmikmod],
    1.21 -AC_HELP_STRING([--enable-music-libmikmod], [enable MOD music via external libmikmod [[default=no]]]),
    1.22 -              [], [enable_music_libmikmod=no])
    1.23 -if test x$enable_music_libmikmod = xyes; then
    1.24 +
    1.25 +AC_ARG_ENABLE([music-mod],
    1.26 +AC_HELP_STRING([--enable-music-mod], [enable MOD music via mikmod [[default=yes]]]),
    1.27 +              [], [enable_music_mod=yes])
    1.28 +AC_ARG_ENABLE([music-mod-shared],
    1.29 +AC_HELP_STRING([--enable-music-mod-shared], [dynamically load MOD support [[default=yes]]]),
    1.30 +              [], [enable_music_mod_shared=yes])
    1.31 +if test x$enable_music_mod = xyes; then
    1.32 +    have_libmikmod=no
    1.33 +    libmikmod_maj=3
    1.34 +    libmikmod_min=1
    1.35 +    libmikmod_rev=10
    1.36 +    libmikmod_ver="$libmikmod_maj.$libmikmod_min.$libmikmod_rev"
    1.37      AC_PATH_PROG(LIBMIKMOD_CONFIG, libmikmod-config, no, [$PATH])
    1.38      if test "$LIBMIKMOD_CONFIG" != "no" ; then
    1.39 -        no_libmikmod=no
    1.40 +        
    1.41          CFLAGS_SAVED="$CFLAGS"
    1.42          LIBS_SAVED="$LIBS"
    1.43          CFLAGS="$CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
    1.44          LIBS="$LIBS `$LIBMIKMOD_CONFIG --libs`"
    1.45 +        have_libmikmod=yes
    1.46          AC_MSG_CHECKING([for libmikmod - version >= $libmikmod_ver])
    1.47          AC_TRY_RUN([
    1.48  #include "mikmod.h"
    1.49 @@ -182,36 +188,48 @@
    1.50  
    1.51  int main(int argc, char **argv)
    1.52  {
    1.53 -    long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
    1.54 -    /*printf("(%d.%d.%d) ",ver>>16,(ver>>8)&0xff,ver&0xff);*/
    1.55 -    if(ver>=((maj<<16)|(min<<8)|(rev))) {
    1.56 -        printf("yes\n");
    1.57 -        return 0;
    1.58 -    }
    1.59 -    printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
    1.60 -    return 1;
    1.61 +long maj=$libmikmod_maj,min=$libmikmod_min,rev=$libmikmod_rev,ver=MikMod_GetVersion();
    1.62 +/*printf("(%d.%d.%d) ",ver>>16,(ver>>8)&0xff,ver&0xff);*/
    1.63 +if(ver>=((maj<<16)|(min<<8)|(rev))) {
    1.64 +    printf("yes\n");
    1.65 +    return 0;
    1.66  }
    1.67 -], , , [echo $ac_n "cross compiling; assumed OK... $ac_c"])
    1.68 +printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
    1.69 +return 1;
    1.70 +}
    1.71 +], [], have_libmikmod=no; CFLAGS="$CFLAGS_SAVED"; LIBS="$LIBS_SAVED",
    1.72 +        [echo $ac_n "cross compiling; assumed OK... $ac_c"])
    1.73      fi
    1.74 -    CFLAGS="$CFLAGS_SAVED"
    1.75 -    LIBS="$LIBS_SAVED"
    1.76 +
    1.77 +    if test x$have_libmikmod = xyes; then
    1.78 +        case "$host" in
    1.79 +            *-*-darwin*)
    1.80 +                mikmod_lib=[`find_lib libmikmod*.dylib`]
    1.81 +                ;;
    1.82 +            *-*-cygwin* | *-*-mingw32*)
    1.83 +                mikmod_lib=[`find_lib "mikmod*.dll"`]
    1.84 +                ;;
    1.85 +            *)
    1.86 +                mikmod_lib=[`find_lib "libmikmod*.so.[0-9]"`]
    1.87 +                if test x$mikmod_lib = x; then
    1.88 +                    mikmod_lib=[`find_lib "libmikmod*.so.[0-9]*"`]
    1.89 +                fi
    1.90 +                ;;
    1.91 +        esac
    1.92 +        SOURCES="$SOURCES $srcdir/*_mod.c"
    1.93 +        EXTRA_CFLAGS="$EXTRA_CFLAGS -DMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
    1.94 +        if test x$enable_music_mod_shared = xyes && test x$mikmod_lib != x; then
    1.95 +            echo "-- dynamic libmikmod -> $mikmod_lib"
    1.96 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -DMOD_DYNAMIC=\\\"$mikmod_lib\\\""
    1.97 +        else
    1.98 +            EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$LIBMIKMOD_CONFIG --libs`"
    1.99 +        fi
   1.100 +    else
   1.101 +        AC_MSG_WARN([*** Unable to find MikMod library (http://mikmod.raphnet.net/)])
   1.102 +        AC_MSG_WARN([MOD support disabled])
   1.103 +    fi
   1.104  fi
   1.105  
   1.106 -AC_ARG_ENABLE([music-mod],
   1.107 -AC_HELP_STRING([--enable-music-mod], [enable MOD music via mikmod [[default=yes]]]),
   1.108 -              [], [enable_music_mod=yes])
   1.109 -if test x$enable_music_mod = xyes; then
   1.110 -    EXTRA_CFLAGS="$EXTRA_CFLAGS -DMOD_MUSIC"
   1.111 -    SOURCES="$SOURCES $srcdir/music_mod.c"
   1.112 -
   1.113 -    if test x$enable_music_libmikmod = xyes; then
   1.114 -        EXTRA_CFLAGS="$EXTRA_CFLAGS -DLIBMIKMOD_MUSIC `$LIBMIKMOD_CONFIG --cflags`"
   1.115 -        EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$LIBMIKMOD_CONFIG --libs`"
   1.116 -    else
   1.117 -        EXTRA_CFLAGS="$EXTRA_CFLAGS -I\$(srcdir)/mikmod"
   1.118 -        SOURCES="$SOURCES $srcdir/mikmod/*.c"
   1.119 -    fi
   1.120 -fi
   1.121  AC_ARG_ENABLE([music-midi],
   1.122  AC_HELP_STRING([--enable-music-midi], [enable MIDI music via timidity [[default=yes]]]),
   1.123                [], [enable_music_midi=yes])
   1.124 @@ -262,11 +280,12 @@
   1.125          fi
   1.126      fi
   1.127  fi
   1.128 +
   1.129  AC_ARG_ENABLE([music-ogg],
   1.130  AC_HELP_STRING([--enable-music-ogg], [enable Ogg Vorbis music [[default=yes]]]),
   1.131                [], [enable_music_ogg=yes])
   1.132  AC_ARG_ENABLE(music-ogg-tremor,
   1.133 -[  --enable-music-ogg-tremor   enable OGG music via libtremor [[default=no]]],
   1.134 +AC_HELP_STRING([--enable-music-ogg-tremor], [enable OGG Vorbis music via libtremor [[default=no]]]),
   1.135                [], enable_music_ogg_tremor=no)
   1.136  AC_ARG_ENABLE([music-ogg-shared],
   1.137  AC_HELP_STRING([--enable-music-ogg-shared], [dynamically load Ogg Vorbis support [[default=yes]]]),
   1.138 @@ -304,6 +323,9 @@
   1.139              else
   1.140                  EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisidec"
   1.141              fi
   1.142 +        else
   1.143 +            AC_MSG_WARN([*** Unable to find Ogg Vorbis Tremor library (http://www.xiph.org/)])
   1.144 +            AC_MSG_WARN([Ogg Vorbis support disabled])
   1.145          fi
   1.146      else
   1.147          AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
   1.148 @@ -331,9 +353,13 @@
   1.149              else
   1.150                  EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis -logg"
   1.151              fi
   1.152 +        else
   1.153 +            AC_MSG_WARN([*** Unable to find Ogg Vorbis library (http://www.xiph.org/)])
   1.154 +            AC_MSG_WARN([Ogg Vorbis support disabled])
   1.155          fi
   1.156      fi
   1.157  fi
   1.158 +
   1.159  libflac_ver=8
   1.160  AC_ARG_ENABLE([music-flac],
   1.161  AC_HELP_STRING([--enable-music-flac], [enable FLAC music [[default=yes]]]),
   1.162 @@ -359,50 +385,53 @@
   1.163  #endif
   1.164  }
   1.165  ], have_flac_ver=yes, have_flac_ver=no)
   1.166 -		LIBS="$LIBS_SAVED"
   1.167 -		AC_MSG_RESULT($have_flac_ver)
   1.168 -		if test x$have_flac_ver = xno; then
   1.169 -			echo "*** FLAC support has been disabled."
   1.170 -		else
   1.171 -			AC_CHECK_HEADER([FLAC/stream_decoder.h], [have_flac_hdr=yes])
   1.172 -			AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], [have_flac_lib=yes])
   1.173 -			if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then	
   1.174 -			    case "$host" in
   1.175 -			        *-*-darwin*)
   1.176 -			            flac_lib=[`find_lib FLAC*.dylib`]
   1.177 -			            ;;
   1.178 -			        *-*-cygwin* | *-*-mingw32*)
   1.179 -			            flac_lib=[`find_lib "libFLAC*.dll"`]
   1.180 -			            ;;
   1.181 -			        *)
   1.182 -			            flac_lib=[`find_lib "libFLAC.so.[0-9]"`]
   1.183 -			            if test x$flac_lib = x; then
   1.184 -			                flac_lib=[`find_lib "libFLAC.so.[0-9]*"`]
   1.185 -			            fi
   1.186 -			            ;;
   1.187 -			    esac
   1.188 -			    SOURCES="$SOURCES $srcdir/*_flac.c"
   1.189 -			    EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_MUSIC"
   1.190 -			    if test x$enable_music_flac_shared = xyes && test x$flac_lib != x; then
   1.191 -			        echo "-- dynamic libFLAC -> $flac_lib"
   1.192 -			        EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_DYNAMIC=\\\"$flac_lib\\\""
   1.193 -			    else
   1.194 -			        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lFLAC"
   1.195 -			    fi
   1.196 -			fi
   1.197 -		fi
   1.198 -	fi
   1.199 +        LIBS="$LIBS_SAVED"
   1.200 +        AC_MSG_RESULT($have_flac_ver)
   1.201 +    fi
   1.202 +
   1.203 +    if test x$have_flac_ver = xyes; then
   1.204 +        AC_CHECK_HEADER([FLAC/stream_decoder.h], [have_flac_hdr=yes])
   1.205 +        AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], [have_flac_lib=yes])
   1.206 +        if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then    
   1.207 +            case "$host" in
   1.208 +                *-*-darwin*)
   1.209 +                    flac_lib=[`find_lib libFLAC*.dylib`]
   1.210 +                    ;;
   1.211 +                *-*-cygwin* | *-*-mingw32*)
   1.212 +                    flac_lib=[`find_lib "libFLAC*.dll"`]
   1.213 +                    ;;
   1.214 +                *)
   1.215 +                    flac_lib=[`find_lib "libFLAC.so.[0-9]"`]
   1.216 +                    if test x$flac_lib = x; then
   1.217 +                        flac_lib=[`find_lib "libFLAC.so.[0-9]*"`]
   1.218 +                    fi
   1.219 +                    ;;
   1.220 +            esac
   1.221 +            SOURCES="$SOURCES $srcdir/*_flac.c"
   1.222 +            EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_MUSIC"
   1.223 +            if test x$enable_music_flac_shared = xyes && test x$flac_lib != x; then
   1.224 +                echo "-- dynamic libFLAC -> $flac_lib"
   1.225 +                EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_DYNAMIC=\\\"$flac_lib\\\""
   1.226 +            else
   1.227 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lFLAC"
   1.228 +            fi
   1.229 +        fi
   1.230 +    else
   1.231 +        AC_MSG_WARN([*** Unable to find FLAC library (http://flac.sourceforge.net/)])
   1.232 +        AC_MSG_WARN([FLAC support disabled])
   1.233 +    fi
   1.234  fi
   1.235 +
   1.236  AC_ARG_ENABLE(music-mp3,
   1.237 -[  --enable-music-mp3      enable MP3 music via smpeg [[default=yes]]],
   1.238 -              , enable_music_mp3=yes)
   1.239 +AC_HELP_STRING([--enable-music-mp3], [enable MP3 music via smpeg [[default=yes]]]),
   1.240 +              [], enable_music_mp3=yes)
   1.241 +AC_ARG_ENABLE([music-mp3-shared],
   1.242 +AC_HELP_STRING([--enable-music-mp3-shared], [dynamically load MP3 support [[default=yes]]]),
   1.243 +              [], [enable_music_mp3_shared=yes])
   1.244  if test x$enable_music_mp3 = xyes; then
   1.245      SMPEG_VERSION=0.4.3
   1.246      AM_PATH_SMPEG($SMPEG_VERSION, have_smpeg=yes, have_smpeg=no)
   1.247      if test x$have_smpeg = xyes; then
   1.248 -        AC_ARG_ENABLE([music-mp3-shared],
   1.249 -AC_HELP_STRING([--enable-music-mp3-shared], [dynamically load MP3 support [[default=yes]]]),
   1.250 -                      [], [enable_music_mp3_shared=yes])
   1.251          case "$host" in
   1.252              *-*-darwin*)
   1.253                  smpeg_lib=[`find_lib libsmpeg*.dylib`]
   1.254 @@ -425,8 +454,11 @@
   1.255          else
   1.256              EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SMPEG_LIBS"
   1.257          fi
   1.258 +    else
   1.259 +        AC_MSG_WARN([*** Unable to find SMPEG library (http://icculus.org/smpeg/)])
   1.260      fi
   1.261  fi
   1.262 +
   1.263  AC_ARG_ENABLE(music-mp3-mad-gpl,
   1.264  AC_HELP_STRING([--enable-music-mp3-mad-gpl], [enable MP3 music via libmad GPL code [[default=no]]]),
   1.265                    [], [enable_music_mp3_mad_gpl=no])
   1.266 @@ -444,9 +476,15 @@
   1.267          SOURCES="$SOURCES $srcdir/music_mad.c"
   1.268          EXTRA_CFLAGS="$EXTRA_CFLAGS -DMP3_MAD_MUSIC"
   1.269          EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
   1.270 +    else
   1.271 +        AC_MSG_WARN([*** Unable to find MAD library (http://www.underbit.com/products/mad/)])
   1.272      fi
   1.273  fi
   1.274  
   1.275 +if test x$have_smpeg != xyes -a x$have_libmad != xyes; then
   1.276 +    AC_MSG_WARN([MP3 support disabled])
   1.277 +fi
   1.278 +
   1.279  OBJECTS=`echo $SOURCES | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
   1.280  OBJECTS=`echo $OBJECTS | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
   1.281