configure.in
changeset 396 de5061390913
parent 392 c9adf3866e87
child 402 2bfcf7edcb6f
     1.1 --- a/configure.in	Tue Sep 22 07:14:27 2009 +0000
     1.2 +++ b/configure.in	Sat Sep 26 09:16:01 2009 +0000
     1.3 @@ -318,6 +318,7 @@
     1.4          fi
     1.5      fi
     1.6  fi
     1.7 +libflac_ver=8
     1.8  AC_ARG_ENABLE([music-flac],
     1.9  AC_HELP_STRING([--enable-music-flac], [enable FLAC music [[default=yes]]]),
    1.10                [], [enable_music_flac=yes])
    1.11 @@ -326,32 +327,55 @@
    1.12                [dynamically load FLAC support [[default=yes]]]),
    1.13                [], [enable_music_flac_shared=yes])
    1.14  if test x$enable_music_flac = xyes; then
    1.15 -    AC_CHECK_HEADER([FLAC/stream_decoder.h], [have_flac_hdr=yes])
    1.16 -    AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], [have_flac_lib=yes])
    1.17 -    if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then
    1.18 -        case "$host" in
    1.19 -            *-*-darwin*)
    1.20 -                flac_lib=[`find_lib FLAC*.dylib`]
    1.21 -                ;;
    1.22 -            *-*-cygwin* | *-*-mingw32*)
    1.23 -                flac_lib=[`find_lib "libFLAC*.dll"`]
    1.24 -                ;;
    1.25 -            *)
    1.26 -                flac_lib=[`find_lib "libFLAC.so.[0-9]"`]
    1.27 -                if test x$flac_lib = x; then
    1.28 -                    flac_lib=[`find_lib "libFLAC.so.[0-9]*"`]
    1.29 -                fi
    1.30 -                ;;
    1.31 -        esac
    1.32 -        SOURCES="$SOURCES $srcdir/*_flac.c"
    1.33 -        EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_MUSIC"
    1.34 -        if test x$enable_music_flac_shared = xyes && test x$flac_lib != x; then
    1.35 -            echo "-- dynamic libFLAC -> $flac_lib"
    1.36 -            EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_DYNAMIC=\\\"$flac_lib\\\""
    1.37 -        else
    1.38 -            EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lFLAC"
    1.39 -        fi
    1.40 -    fi
    1.41 +	AC_CHECK_HEADER([FLAC/export.h], [have_flac_export=yes])
    1.42 +	if test x$have_flac_export = xyes; then
    1.43 +		LIBS_SAVED="$LIBS"
    1.44 +		LIBS="-lFLAC"
    1.45 +	    AC_MSG_CHECKING([for libflac so-name version >= $libflac_ver])
    1.46 +	    AC_TRY_RUN([
    1.47 +#include "FLAC/export.h"
    1.48 +#include "stdio.h"
    1.49 +int main( int argc, char *argv[] ) {
    1.50 +#if defined(FLAC_API_VERSION_CURRENT) && (FLAC_API_VERSION_CURRENT >= $libflac_ver)
    1.51 +	return 0;
    1.52 +#else
    1.53 +	return 1;
    1.54 +#endif
    1.55 +}
    1.56 +], have_flac_ver=yes, have_flac_ver=no)
    1.57 +		LIBS="$LIBS_SAVED"
    1.58 +		AC_MSG_RESULT($have_flac_ver)
    1.59 +		if test x$have_flac_ver = xno; then
    1.60 +			echo "*** FLAC support has been disabled."
    1.61 +		else
    1.62 +			AC_CHECK_HEADER([FLAC/stream_decoder.h], [have_flac_hdr=yes])
    1.63 +			AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], [have_flac_lib=yes])
    1.64 +			if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then	
    1.65 +			    case "$host" in
    1.66 +			        *-*-darwin*)
    1.67 +			            flac_lib=[`find_lib FLAC*.dylib`]
    1.68 +			            ;;
    1.69 +			        *-*-cygwin* | *-*-mingw32*)
    1.70 +			            flac_lib=[`find_lib "libFLAC*.dll"`]
    1.71 +			            ;;
    1.72 +			        *)
    1.73 +			            flac_lib=[`find_lib "libFLAC.so.[0-9]"`]
    1.74 +			            if test x$flac_lib = x; then
    1.75 +			                flac_lib=[`find_lib "libFLAC.so.[0-9]*"`]
    1.76 +			            fi
    1.77 +			            ;;
    1.78 +			    esac
    1.79 +			    SOURCES="$SOURCES $srcdir/*_flac.c"
    1.80 +			    EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_MUSIC"
    1.81 +			    if test x$enable_music_flac_shared = xyes && test x$flac_lib != x; then
    1.82 +			        echo "-- dynamic libFLAC -> $flac_lib"
    1.83 +			        EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_DYNAMIC=\\\"$flac_lib\\\""
    1.84 +			    else
    1.85 +			        EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lFLAC"
    1.86 +			    fi
    1.87 +			fi
    1.88 +		fi
    1.89 +	fi
    1.90  fi
    1.91  AC_ARG_ENABLE(music-mp3,
    1.92  [  --enable-music-mp3      enable MP3 music via smpeg [[default=yes]]],