Codebase list libsdl2-mixer / a78ecd3
New upstream version 2.0.5~20220126.g6845d9f Simon McVittie 2 years ago
7 changed file(s) with 155 addition(s) and 126 deletion(s). Raw diff Collapse all Expand all
+0
-96
CMakeLists.txt less more
0 cmake_minimum_required(VERSION 3.1.0)
1 project(SDL2_mixer C)
2
3 # FIXME: CMAKE SUPPORT IN SDL2_mixer IS VERY INCOMPLETE YET !!!
4 #
5 # FIXME: make it able build against system codec libraries, too.
6 # FIXME: handle library versioning.
7 # FIXME: test accross different target platforms.
8 #
9 # FIXME: missing CMakeLists.txt for MPG123
10 set(SUPPORT_MP3_MPG123 OFF CACHE BOOL "" FORCE)
11
12 option(SUPPORT_WAV "Support loading WAVE music" ON)
13 option(SUPPORT_FLAC "Support loading FLAC music with libFLAC" OFF)
14 option(SUPPORT_OGG "Support loading OGG Vorbis music via Tremor" OFF)
15 option(SUPPORT_MP3_MPG123 "Support loading MP3 music via MPG123" OFF)
16 option(SUPPORT_MOD_MODPLUG "Support loading MOD music via modplug" OFF)
17 option(SUPPORT_MID_TIMIDITY "Support loading MIDI music via TiMidity" OFF)
18
19 option(BUILD_SHARED_LIBS "Enable shared library" ON)
20
21 if (NOT ANDROID AND NOT (TARGET SDL2 OR TARGET SDL2-static))
22 find_package(SDL2 REQUIRED)
23
24 if(NOT TARGET SDL2::SDL2)
25 # SDL < 2.0.12
26 add_library(SDL2::SDL2 INTERFACE IMPORTED)
27 set_target_properties(SDL2::SDL2 PROPERTIES
28 INTERFACE_INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR}
29 INTERFACE_LINK_LIBRARIES ${SDL2_LIBRARIES} ${SDL2_LIBRARY}
30 )
31 endif()
32 endif()
33
34 include_directories(include src src/codecs)
35
36 add_library(SDL2_mixer)
37 add_library(SDL2::mixer ALIAS SDL2_mixer)
38
39 target_sources(SDL2_mixer PRIVATE
40 src/effect_position.c src/effects_internal.c src/effect_stereoreverse.c
41 src/mixer.c src/music.c src/utils.c
42 src/codecs/load_aiff.c src/codecs/load_voc.c
43 src/codecs/music_cmd.c
44 src/codecs/music_wav.c src/codecs/music_flac.c
45 src/codecs/music_mad.c src/codecs/music_mpg123.c
46 src/codecs/music_ogg.c src/codecs/music_opus.c
47 src/codecs/music_mikmod.c src/codecs/music_modplug.c
48 src/codecs/music_xmp.c
49 src/codecs/music_fluidsynth.c src/codecs/music_timidity.c
50 src/codecs/music_nativemidi.c)
51
52 if (SUPPORT_WAV)
53 target_compile_definitions(SDL2_mixer PRIVATE -DMUSIC_WAV)
54 endif()
55
56 if (SUPPORT_FLAC)
57 target_compile_definitions(SDL2_mixer PRIVATE -DMUSIC_FLAC)
58 add_subdirectory(external/flac-1.3.3)
59 target_include_directories(SDL2_mixer PRIVATE external/flac-1.3.3/include)
60 target_link_libraries(SDL2_mixer PRIVATE FLAC)
61 endif()
62
63 if (SUPPORT_OGG)
64 target_compile_definitions(SDL2_mixer PRIVATE -DMUSIC_OGG -DOGG_USE_TREMOR -DOGG_HEADER=<ivorbisfile.h>)
65 add_subdirectory(external/libogg-1.3.2)
66 add_subdirectory(external/libvorbisidec-1.2.1)
67 target_include_directories(SDL2_mixer PRIVATE external/libvorbisidec-1.2.1)
68 target_link_libraries(SDL2_mixer PRIVATE vorbisidec ogg)
69 endif()
70
71 if (SUPPORT_MP3_MPG123)
72 target_compile_definitions(SDL2_mixer PRIVATE -DMUSIC_MP3_MPG123)
73 add_subdirectory(external/mpg123-1.25.13)
74 target_link_libraries(SDL2_mixer PRIVATE mpg123)
75 endif()
76
77 if (SUPPORT_MOD_MODPLUG)
78 target_compile_definitions(SDL2_mixer PRIVATE -DMUSIC_MOD_MODPLUG -DMODPLUG_HEADER=<modplug.h>)
79 add_subdirectory(external/libmodplug-0.8.9.0)
80 target_include_directories(SDL2_mixer PRIVATE external/libmodplug-0.8.9.0/src)
81 target_link_libraries(SDL2_mixer PRIVATE modplug)
82 endif()
83
84 if (SUPPORT_MID_TIMIDITY)
85 target_compile_definitions(SDL2_mixer PRIVATE -DMUSIC_MID_TIMIDITY)
86 add_subdirectory(src/codecs/timidity)
87 target_link_libraries(SDL2_mixer PRIVATE timidity)
88 endif()
89
90 if(WIN32 AND BUILD_SHARED_LIBS)
91 target_compile_definitions(SDL2_mixer PRIVATE -DDLL_EXPORT)
92 endif()
93
94 target_include_directories(SDL2_mixer PUBLIC include)
95 target_link_libraries(SDL2_mixer PRIVATE SDL2::SDL2)
0 # Makefile to build and install the SDL_mixer library
0 # Makefile to build and install the SDL_mixer library.
11
22 top_builddir = .
33 srcdir = @srcdir@
1919 EXE = @EXE@
2020 SHELL = @SHELL@
2121 CC = @CC@
22 CXX = @CXX@
2223 CFLAGS = @BUILD_CFLAGS@
2324 EXTRA_CFLAGS = @EXTRA_CFLAGS@
2425 LDFLAGS = @BUILD_LDFLAGS@
3738 PLAYWAVE_OBJECTS = @PLAYWAVE_OBJECTS@
3839 PLAYMUS_OBJECTS = @PLAYMUS_OBJECTS@
3940
40 SRC_DIST = *.txt Android.mk Makefile.in Makefile.os2 SDL2_mixer.pc.in SDL2_mixer.spec.in include/SDL_mixer.h VisualC VisualC-WinRT Xcode Xcode-iOS acinclude autogen.sh build-scripts configure configure.ac debian external gcc-fat.sh src/utils.c src/utils.h src/effect_position.c src/effect_stereoreverse.c src/effects_internal.c src/effects_internal.h src/codecs/load_aiff.c src/codecs/load_aiff.h src/codecs/load_voc.c src/codecs/load_voc.h src/codecs/mp3utils.c src/codecs/mp3utils.h src/mixer.c src/mixer.h src/music.c src/music.h src/codecs/music_cmd.c src/codecs/music_cmd.h src/codecs/music_flac.c src/codecs/music_flac.h src/codecs/music_fluidsynth.c src/codecs/music_fluidsynth.h src/codecs/music_mad.c src/codecs/music_mad.h src/codecs/music_mikmod.c src/codecs/music_mikmod.h src/codecs/music_modplug.c src/codecs/music_modplug.h src/codecs/music_xmp.c src/codecs/music_xmp.h src/codecs/music_mpg123.c src/codecs/music_mpg123.h src/codecs/music_nativemidi.c src/codecs/music_nativemidi.h src/codecs/music_ogg.c src/codecs/music_ogg.h src/codecs/music_opus.c src/codecs/music_opus.h src/codecs/music_timidity.c src/codecs/music_timidity.h src/codecs/music_wav.c src/codecs/music_wav.h src/codecs/native_midi playmus.c playwave.c src/codecs/timidity version.rc
41 SRC_DIST = LICENSE.txt README.txt CHANGES.txt Android.mk Makefile.in Makefile.os2 SDL2_mixer.pc.in SDL2_mixer.spec.in include/SDL_mixer.h VisualC VisualC-WinRT Xcode Xcode-iOS acinclude autogen.sh build-scripts configure configure.ac external gcc-fat.sh src/utils.c src/utils.h src/effect_position.c src/effect_stereoreverse.c src/effects_internal.c src/effects_internal.h src/codecs/load_aiff.c src/codecs/load_aiff.h src/codecs/load_voc.c src/codecs/load_voc.h src/codecs/mp3utils.c src/codecs/mp3utils.h src/mixer.c src/mixer.h src/music.c src/music.h src/codecs/music_cmd.c src/codecs/music_cmd.h src/codecs/music_flac.c src/codecs/music_flac.h src/codecs/music_fluidsynth.c src/codecs/music_fluidsynth.h src/codecs/music_mad.c src/codecs/music_mad.h src/codecs/music_mikmod.c src/codecs/music_mikmod.h src/codecs/music_modplug.c src/codecs/music_modplug.h src/codecs/music_xmp.c src/codecs/music_xmp.h src/codecs/music_mpg123.c src/codecs/music_mpg123.h src/codecs/music_nativemidi.c src/codecs/music_nativemidi.h src/codecs/music_ogg.c src/codecs/music_ogg.h src/codecs/music_opus.c src/codecs/music_opus.h src/codecs/music_timidity.c src/codecs/music_timidity.h src/codecs/music_wav.c src/codecs/music_wav.h src/codecs/native_midi playmus.c playwave.c src/codecs/timidity version.rc
4142 GEN_DIST = SDL2_mixer.spec
4243
4344 LT_AGE = @LT_AGE@
5858
5959 LIBS = SDL2.lib
6060
61 CFLAGS_BASE = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oteanbmier -ei -j
61 CFLAGS_BASE = -bt=os2 -d0 -q -bm -5s -fp5 -fpi87 -sg -oeatxh -ei -j
6262 # warnings:
6363 CFLAGS_BASE+= -wx
6464 # newer OpenWatcom versions enable W303 by default
186186 @if exist *.err rm *.err
187187 @if exist $(TIMILIB) rm $(TIMILIB)
188188 @if exist $(LNKFILE) rm $(LNKFILE)
189
189190 distclean: .SYMBOLIC clean
190191 @if exist $(DLLFILE) rm $(DLLFILE)
191192 @if exist $(LIBFILE) rm $(LIBFILE)
88 Requires: sdl2 >= @SDL_VERSION@
99 Libs: -L${libdir} -lSDL2_mixer
1010 Cflags: -I${includedir}/SDL2
11
11 Requires.private: @PC_REQUIRES@
12 Libs.private: @PC_LIBS@
4747
4848 dnl Check for tools
4949 AC_PROG_CC
50 AC_PROG_CXX
5051 AC_PROG_INSTALL
5152 AC_PROG_MAKE_SET
5253 LT_PROG_RC
151152 dnl set this to use on systems that use lib64 instead of lib
152153 base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
153154
155 dnl See if GCC's -Wall is supported.
156 CheckWarnAll()
157 {
158 AC_MSG_CHECKING(for GCC -Wall option)
159 have_gcc_Wall=no
160
161 save_CFLAGS="$CFLAGS"
162 CFLAGS="$save_CFLAGS -Wall"
163 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([int x = 0;])], [have_gcc_Wall=yes])
164 AC_MSG_RESULT($have_gcc_Wall)
165 CFLAGS="$save_CFLAGS"
166
167 if test x$have_gcc_Wall = xyes; then
168 EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
169
170 dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall.
171 AC_MSG_CHECKING(for necessary GCC -Wno-multichar option)
172 need_gcc_Wno_multichar=no
173 case "$host" in
174 *-*-haiku*)
175 need_gcc_Wno_multichar=yes
176 ;;
177 esac
178 AC_MSG_RESULT($need_gcc_Wno_multichar)
179 if test x$need_gcc_Wno_multichar = xyes; then
180 EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar"
181 fi
182 fi
183 }
184
154185 dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
155186 CheckVisibilityHidden()
156187 {
207238 )
208239 EXTRA_CFLAGS="$EXTRA_CFLAGS $SDL_CFLAGS"
209240 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SDL_LIBS"
241
242 dnl check for GCC warning options
243 CheckWarnAll
210244
211245 dnl check for GCC visibility attributes
212246 CheckVisibilityHidden
259293 PKG_CHECK_MODULES([MODPLUG], [libmodplug >= 0.8.8], [dnl
260294 have_libmodplug_hdr=yes
261295 have_libmodplug_lib=yes
296 have_libmodplug_pc=yes
262297 ], [dnl
263298 AC_CHECK_HEADER([libmodplug/modplug.h], [have_libmodplug_hdr=yes])
264299 AC_CHECK_LIB([modplug], [ModPlug_Load], [have_libmodplug_lib=yes;MODPLUG_LIBS="-lmodplug"])
286321 EXTRA_CFLAGS="$EXTRA_CFLAGS -DMODPLUG_DYNAMIC=\\\"$modplug_lib\\\""
287322 else
288323 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MODPLUG_LIBS"
324 if test x$have_libmodplug_pc = xyes; then
325 PC_REQUIRES="$PC_REQUIRES libmodplug"
326 else
327 PC_LIBS="$PC_LIBS $MODPLUG_LIBS"
328 fi
289329 fi
290330 else
291331 AC_MSG_WARN([*** Unable to find ModPlug library (http://modplug-xmms.sourceforge.net/)])
309349 PKG_CHECK_MODULES([XMP], [lib$xmplib >= 4.2], [dnl
310350 have_libxmp_hdr=yes
311351 have_libxmp_lib=yes
352 have_libxmp_pc=yes
312353 ], [dnl
313354 AC_CHECK_HEADER([xmp.h], [have_libxmp_hdr=yes])
314355 AC_CHECK_LIB([xmp], [xmp_load_module_from_memory], [have_libxmp_lib=yes;XMP_LIBS="-l$xmplib"])
336377 EXTRA_CFLAGS="$EXTRA_CFLAGS -DXMP_DYNAMIC=\\\"$xmp_lib\\\""
337378 else
338379 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $XMP_LIBS"
380 if test x$have_libxmp_pc = xyes; then
381 PC_REQUIRES="$PC_REQUIRES lib$xmplib"
382 else
383 PC_LIBS="$PC_LIBS $XMP_LIBS"
384 fi
339385 fi
340386 else
341387 AC_MSG_WARN([*** Unable to find xmp library (http://xmp.sourceforge.net/)])
376422 printf("no\n*** libmikmod is older than %d.%d.%d, not using.\n",maj,min,rev);
377423 return 1;
378424 }
379 ]])],[],[have_libmikmod=no],[echo $ac_n "cross compiling; assumed OK... $ac_c"])
425 ]])], [],[have_libmikmod=no],[echo $ac_n "cross compiling; assumed OK... $ac_c"])
380426 fi
381427
382428 if test x$have_libmikmod = xyes; then
400446 EXTRA_CFLAGS="$EXTRA_CFLAGS -DMIKMOD_DYNAMIC=\\\"$mikmod_lib\\\""
401447 else
402448 EXTRA_LDFLAGS="$EXTRA_LDFLAGS `$LIBMIKMOD_CONFIG --libs`"
449 PC_LIBS="$PC_LIBS `$LIBMIKMOD_CONFIG --libs`"
403450 fi
404451 else
405452 AC_MSG_WARN([*** Unable to find MikMod library (http://mikmod.sourceforge.net/)])
439486 *-*-cygwin* | *-*-mingw*)
440487 use_music_midi_native=yes
441488 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lwinmm"
489 PC_LIBS="$PC_LIBS -lwinmm"
442490 ;;
443491 *-*-darwin*)
444492 use_music_midi_native=yes
445493 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,CoreServices"
494 PC_LIBS="$PC_LIBS -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit -Wl,-framework,CoreServices"
446495 ;;
447496 *-*-haiku*)
448497 use_music_midi_native=yes_cpp
449498 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmidi"
499 PC_LIBS="$PC_LIBS -lmidi"
450500 ;;
451501 esac
452502 if test x$use_music_midi_native = xyes; then
465515 [AS_HELP_STRING([--enable-music-midi-fluidsynth-shared], [dynamically load FluidSynth library [default=yes]])],
466516 [], [enable_music_midi_fluidsynth_shared=yes])
467517 if test x$enable_music_midi_fluidsynth = xyes; then
468 AC_CHECK_HEADER([fluidsynth.h], [have_fluidsynth_hdr=yes])
469 AC_CHECK_LIB([fluidsynth], [fluid_player_add_mem], [have_fluidsynth_lib=yes])
518 PKG_CHECK_MODULES([FLUIDSYNTH], [fluidsynth], [dnl
519 have_fluidsynth_hdr=yes
520 have_fluidsynth_lib=yes
521 have_fluidsynth_pc=yes
522 ], [dnl
523 AC_CHECK_HEADER([fluidsynth.h], [have_fluidsynth_hdr=yes])
524 AC_CHECK_LIB([fluidsynth], [fluid_player_add_mem], [have_fluidsynth_lib=yes;FLUIDSYNTH_LIBS="-lfluidsynth"])
525 ])
470526 if test x$have_fluidsynth_hdr = xyes -a x$have_fluidsynth_lib = xyes; then
471527 have_fluidsynth=yes
472528 case "$host" in
486542 fi
487543 ;;
488544 esac
489 EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MID_FLUIDSYNTH"
545 EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MID_FLUIDSYNTH $FLUIDSYNTH_CFLAGS"
490546 if test x$enable_music_midi_fluidsynth_shared = xyes && test x$fluidsynth_lib != x; then
491547 echo "-- dynamic libfluidsynth -> $fluidsynth_lib"
492548 EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLUIDSYNTH_DYNAMIC=\\\"$fluidsynth_lib\\\""
493549 else
494 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lfluidsynth"
550 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FLUIDSYNTH_LIBS"
551 if test x$have_fluidsynth_pc = xyes; then
552 PC_REQUIRES="$PC_REQUIRES fluidsynth"
553 else
554 PC_LIBS="$PC_LIBS $FLUIDSYNTH_LIBS"
555 fi
495556 fi
496557 else
497558 AC_MSG_WARN([*** Unable to find FluidSynth library (http://www.fluidsynth.org/)])
518579 if test x$enable_music_ogg = xyes; then
519580 LIBS_SAVED="$LIBS"
520581 if test x$enable_music_ogg_tremor = xyes; then
521 AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes])
522 AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes], [], [-logg])
582 PKG_CHECK_MODULES([TREMOR], [vorbisidec], [dnl
583 have_tremor_hdr=yes
584 have_tremor_lib=yes
585 have_tremor_pc=yes
586 ], [dnl
587 AC_CHECK_HEADER([tremor/ivorbisfile.h], [have_tremor_hdr=yes])
588 AC_CHECK_LIB([vorbisidec], [ov_open_callbacks], [have_tremor_lib=yes;TREMOR_LIBS="-lvorbisidec -logg"], [], [-logg])
589 ])
523590 if test x$have_tremor_hdr = xyes -a x$have_tremor_lib = xyes; then
524591 case "$host" in
525592 *-*-darwin*)
538605 fi
539606 ;;
540607 esac
541 EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_OGG -DOGG_USE_TREMOR"
608 EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_OGG -DOGG_USE_TREMOR $TREMOR_CFLAGS"
542609 if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
543610 echo "-- dynamic libvorbisidec -> $ogg_lib"
544611 EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
545612 else
546 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisidec"
613 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $TREMOR_LIBS"
614 if test x$have_tremor_pc = xyes; then
615 PC_REQUIRES="$PC_REQUIRES vorbisidec"
616 else
617 PC_LIBS="$PC_LIBS $TREMOR_LIBS"
618 fi
547619 fi
548620 else
549621 AC_MSG_WARN([*** Unable to find Ogg Vorbis Tremor library (http://www.xiph.org/)])
550622 AC_MSG_WARN([Ogg Vorbis support disabled])
551623 fi
552624 else
553 AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
554 AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes], [], [-lvorbis -logg -lm])
625 PKG_CHECK_MODULES([VORBIS], [vorbisfile], [dnl
626 have_ogg_hdr=yes
627 have_ogg_lib=yes
628 have_ogg_pc=yes
629 ], [dnl
630 AC_CHECK_HEADER([vorbis/vorbisfile.h], [have_ogg_hdr=yes])
631 AC_CHECK_LIB([vorbisfile], [ov_open_callbacks], [have_ogg_lib=yes;VORBIS_LIBS="-lvorbisfile -lvorbis -logg -lm"], [], [-lvorbis -logg -lm])
632 ])
555633 if test x$have_ogg_hdr = xyes -a x$have_ogg_lib = xyes; then
556634 case "$host" in
557635 *-*-darwin*)
567645 fi
568646 ;;
569647 esac
570 EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_OGG"
648 EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_OGG $VORBIS_CFLAGS"
571649 if test x$enable_music_ogg_shared = xyes && test x$ogg_lib != x; then
572650 echo "-- dynamic libvorbisfile -> $ogg_lib"
573651 EXTRA_CFLAGS="$EXTRA_CFLAGS -DOGG_DYNAMIC=\\\"$ogg_lib\\\""
574652 else
575 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lvorbisfile -lvorbis"
653 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $VORBIS_LIBS"
654 if test x$have_ogg_pc = xyes; then
655 PC_REQUIRES="$PC_REQUIRES vorbisfile"
656 else
657 PC_LIBS="$PC_LIBS $VORBIS_LIBS"
658 fi
576659 fi
577660 else
578661 AC_MSG_WARN([*** Unable to find Ogg Vorbis library (http://www.xiph.org/)])
610693 fi
611694
612695 if test x$have_flac_ver = xyes; then
613 AC_CHECK_HEADER([FLAC/stream_decoder.h], [have_flac_hdr=yes])
614 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], [have_flac_lib=yes])
696 PKG_CHECK_MODULES([FLAC], [flac], [dnl
697 have_flac_hdr=yes
698 have_flac_lib=yes
699 have_flac_pc=yes
700 ], [dnl
701 AC_CHECK_HEADER([FLAC/stream_decoder.h], [have_flac_hdr=yes])
702 AC_CHECK_LIB([FLAC], [FLAC__stream_decoder_new], [have_flac_lib=yes;FLAC_LIBS="-lFLAC"])
703 ])
615704 if test x$have_flac_hdr = xyes -a x$have_flac_lib = xyes; then
616705 case "$host" in
617706 *-*-darwin*)
627716 fi
628717 ;;
629718 esac
630 EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_FLAC"
719 EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_FLAC $FLAC_CFLAGS"
631720 if test x$enable_music_flac_shared = xyes && test x$flac_lib != x; then
632721 echo "-- dynamic libFLAC -> $flac_lib"
633722 EXTRA_CFLAGS="$EXTRA_CFLAGS -DFLAC_DYNAMIC=\\\"$flac_lib\\\""
634723 else
635 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lFLAC"
724 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FLAC_LIBS"
725 if test x$have_flac_pc = xyes; then
726 PC_REQUIRES="$PC_REQUIRES flac"
727 else
728 PC_LIBS="$PC_LIBS $FLAC_LIBS"
729 fi
636730 fi
637731 fi
638732 else
665759 EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MAD_GPL_DITHERING"
666760 fi
667761 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmad"
762 PC_LIBS="$PC_LIBS -lmad"
668763 else
669764 AC_MSG_WARN([*** Unable to find MAD library (http://www.underbit.com/products/mad/)])
670765 fi
677772 [AS_HELP_STRING([--enable-music-mp3-mpg123-shared], [dynamically load libmpg123 library [default=yes]])],
678773 [], [enable_music_mp3_mpg123_shared=yes])
679774 if test x$enable_music_mp3_mpg123 = xyes; then
680 AC_CHECK_HEADER([mpg123.h], [have_mpg123_hdr=yes])
681 AC_CHECK_LIB([mpg123], [mpg123_replace_reader_handle], [have_mpg123_lib=yes])
775 PKG_CHECK_MODULES([MPG123], [libmpg123], [dnl
776 have_mpg123_hdr=yes
777 have_mpg123_lib=yes
778 have_mpg123_pc=yes
779 ], [dnl
780 AC_CHECK_HEADER([mpg123.h], [have_mpg123_hdr=yes])
781 AC_CHECK_LIB([mpg123], [mpg123_replace_reader_handle], [have_mpg123_lib=yes;MPG123_LIBS="-lmpg123"])
782 ])
682783 if test x$have_mpg123_hdr = xyes -a x$have_mpg123_lib = xyes; then
683784 have_libmpg123=yes
684785 case "$host" in
692793 mpg123_lib=[`find_lib "libmpg123.so.*"`]
693794 ;;
694795 esac
695 EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MPG123"
796 EXTRA_CFLAGS="$EXTRA_CFLAGS -DMUSIC_MP3_MPG123 $MPG123_CFLAGS"
696797 if test x$enable_music_mp3_mpg123_shared = xyes && test x$mpg123_lib != x; then
697798 echo "-- dynamic libmpg123 -> $mpg123_lib"
698799 EXTRA_CFLAGS="$EXTRA_CFLAGS -DMPG123_DYNAMIC=\\\"$mpg123_lib\\\""
699800 else
700 EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmpg123"
801 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $MPG123_LIBS"
802 if test x$have_mpg123_pc = xyes; then
803 PC_REQUIRES="$PC_REQUIRES libmpg123"
804 else
805 PC_LIBS="$PC_LIBS $MPG123_LIBS"
806 fi
701807 fi
702808 else
703809 AC_MSG_WARN([*** Unable to find mpg123 library (https://www.mpg123.de)])
723829 PKG_CHECK_MODULES([OPUSFILE], [opusfile >= 0.2], [dnl
724830 have_opusfile_hdr=yes
725831 have_opusfile_lib=yes
832 have_opusfile_pc=yes
726833 ], [dnl
727834 AC_CHECK_HEADER([opus/opusfile.h], [have_opusfile_hdr=yes])
728835 AC_CHECK_LIB([opusfile], [op_open_callbacks], [have_opusfile_lib=yes;OPUSFILE_LIBS="-lopusfile -lopus"], [], [-lopus -logg -lm])
751858 EXTRA_CFLAGS="$EXTRA_CFLAGS -DOPUS_DYNAMIC=\\\"$opusfile_lib\\\""
752859 else
753860 EXTRA_LDFLAGS="$EXTRA_LDFLAGS $OPUSFILE_LIBS"
861 if test x$have_opusfile_pc = xyes; then
862 PC_REQUIRES="$PC_REQUIRES opusfile"
863 else
864 PC_LIBS="$PC_LIBS $OPUSFILE_LIBS"
865 fi
754866 fi
755867 else
756868 AC_MSG_WARN([*** Unable to find opusfile library (http://opus-codec.org/)])
816928 AC_SUBST(SDL_VERSION)
817929 AC_SUBST(SDL_CFLAGS)
818930 AC_SUBST(SDL_LIBS)
931 AC_SUBST(PC_REQUIRES)
932 AC_SUBST(PC_LIBS)
819933
820934 AC_CONFIG_FILES([
821935 Makefile SDL2_mixer.spec SDL2_mixer.pc
307307 default: /* text block or other krapola. */
308308 for(i = 0; i < sblen; i++)
309309 {
310 if (SDL_RWread(src, &trash, sizeof (Uint8), 1) != 1)
310 if (SDL_RWread(src, trash, sizeof (Uint8), 1) != 1)
311311 return 0;
312312 }
313313
5252 int (*mpg123_open_handle)(mpg123_handle *mh, void *iohandle);
5353 const char* (*mpg123_plain_strerror)(int errcode);
5454 void (*mpg123_rates)(const long **list, size_t *number);
55 #if (MPG123_API_VERSION >= 45) /* api (but not abi) change as of mpg123-1.26.0 */
56 int (*mpg123_read)(mpg123_handle *mh, void *outmemory, size_t outmemsize, size_t *done );
57 #else
5558 int (*mpg123_read)(mpg123_handle *mh, unsigned char *outmemory, size_t outmemsize, size_t *done );
59 #endif
5660 int (*mpg123_replace_reader_handle)( mpg123_handle *mh, MIX_SSIZE_T (*r_read) (void *, void *, size_t), off_t (*r_lseek)(void *, off_t, int), void (*cleanup)(void*) );
5761 off_t (*mpg123_seek)( mpg123_handle *mh, off_t sampleoff, int whence );
5862 off_t (*mpg123_tell)( mpg123_handle *mh);
99103 FUNCTION_LOADER(mpg123_open_handle, int (*)(mpg123_handle *mh, void *iohandle))
100104 FUNCTION_LOADER(mpg123_plain_strerror, const char* (*)(int errcode))
101105 FUNCTION_LOADER(mpg123_rates, void (*)(const long **list, size_t *number))
106 #if (MPG123_API_VERSION >= 45) /* api (but not abi) change as of mpg123-1.26.0 */
107 FUNCTION_LOADER(mpg123_read, int (*)(mpg123_handle *mh, void *outmemory, size_t outmemsize, size_t *done ))
108 #else
102109 FUNCTION_LOADER(mpg123_read, int (*)(mpg123_handle *mh, unsigned char *outmemory, size_t outmemsize, size_t *done ))
110 #endif
103111 FUNCTION_LOADER(mpg123_replace_reader_handle, int (*)( mpg123_handle *mh, MIX_SSIZE_T (*r_read) (void *, void *, size_t), off_t (*r_lseek)(void *, off_t, int), void (*cleanup)(void*) ))
104112 FUNCTION_LOADER(mpg123_seek, off_t (*)( mpg123_handle *mh, off_t sampleoff, int whence ))
105113 FUNCTION_LOADER(mpg123_tell, off_t (*)( mpg123_handle *mh))
262270 rwops_read, rwops_seek, rwops_cleanup
263271 );
264272 if (result != MPG123_OK) {
265 MPG123_Delete(music);
266273 Mix_SetError("mpg123_replace_reader_handle: %s", mpg_err(music->handle, result));
274 MPG123_Delete(music);
267275 return NULL;
268276 }
269277
270278 result = mpg123.mpg123_format_none(music->handle);
271279 if (result != MPG123_OK) {
272 MPG123_Delete(music);
273280 Mix_SetError("mpg123_format_none: %s", mpg_err(music->handle, result));
281 MPG123_Delete(music);
274282 return NULL;
275283 }
276284
289297
290298 result = mpg123.mpg123_open_handle(music->handle, &music->mp3file);
291299 if (result != MPG123_OK) {
292 MPG123_Delete(music);
293300 Mix_SetError("mpg123_open_handle: %s", mpg_err(music->handle, result));
301 MPG123_Delete(music);
294302 return NULL;
295303 }
296304
297305 result = mpg123.mpg123_getformat(music->handle, &rate, &channels, &encoding);
298306 if (result != MPG123_OK) {
299 MPG123_Delete(music);
300307 Mix_SetError("mpg123_getformat: %s", mpg_err(music->handle, result));
308 MPG123_Delete(music);
301309 return NULL;
302310 }
303311 #ifdef DEBUG_MPG123