From dfc9b2db31561b31b3ca5c456e6ff8c815d66ffd Mon Sep 17 00:00:00 2001 From: krcroft Date: Tue, 5 Nov 2019 17:29:58 -0800 Subject: [PATCH] Add the audio handling changes to build system and documentation --- INSTALL | 42 ++++++++++++++++++++++---------- configure.ac | 45 ++++++++++++++++++++++------------- src/Makefile.am | 6 ++--- src/libs/Makefile.am | 3 ++- src/libs/decoders/Makefile.am | 33 +++++++++++++++++++++++++ 5 files changed, 95 insertions(+), 34 deletions(-) create mode 100644 src/libs/decoders/Makefile.am diff --git a/INSTALL b/INSTALL index 21c2e084..93ca1c34 100644 --- a/INSTALL +++ b/INSTALL @@ -1,4 +1,4 @@ -Things needed for compilation. +DOSBox uses the following libraries: SDL The Simple DirectMedia Library available at http://www.libsdl.org @@ -10,6 +10,25 @@ SDL Note that only version 1.2 and its subversions (1.2.8, 1.2.13 etc.) are currently supported. +Opusfile, by Xiph + For compressed audio tracks (.opus) used with CDROM images. + Sources are available at https://opus-codec.org, however it is + also conveniently packages by all popular package managers for + Windows (MSYS2, MinGW, and Chocolatey), Linux (apt, dnf, zypper, + pacman), and OS X (Homebrew and MacPorts). Opus is today's + leading compression format and has replaced Vorbis as Ogg's + recommended lossy format. Is widely used in the largest audio and + video distribution platforms such as YouTube. + License: three-clause BSD + +SpeexDSP, by Xiph + Needed to perform on-the-fly resampling of Opus-compressed CDROM + audio data in the event DOSBox's mixer sampling rate differs from + that of the Opus sampling rate. Sources are available at + https://opus-codec.org, however it is also conveniently packages + by all popular package managers. + License: three-clause BSD + Curses (optional) If you want to enable the debugger you need a curses library. ncurses should be installed on just about every unix distro. @@ -32,19 +51,18 @@ SDL_Net (optional) For modem/ipx support. Get it from http://www.libsdl.org/projects/SDL_net/ Licensed under LGPL -SDL_Sound - For compressed audio on diskimages. (optional) - This is for cue/bin cdrom images with compressed (mp3/ogg) audio tracks. - Get it from http://icculus.org/SDL_sound - Licenced under LGPL - -ALSA_Headers - (optional) - for Alsa support under linux. Part of the linux kernel sources +alsa-lib (optional) + For ALSA audio support under linux. Get it from https://www.alsa-project.org/ Licensed under LGPL -If you want compile from developer sources (SVN) under a unix system, you'll also need -automake (>=1.6), autoconf(>=2.50). Should be available at http://www.gnu.org +If you want compile from developer sources (SVN) under a unix system, you will need: + - Subversion to checkout the sources, or gzip and tar to unpack them from archive + - GCC (>=4.8.1) or Clang (>=3.3) + - automake (>=1.6) + - autoconf (>=2.50) + - autoconf-archive (>=2009.x) + - make (>= 3.8) + - pkg-config (>= 0.25) For building on unix systems. If you are building from developer sources run ./autogen.sh first before doing the following. diff --git a/configure.ac b/configure.ac index fa5a3d83..2f82d9ac 100644 --- a/configure.ac +++ b/configure.ac @@ -63,6 +63,21 @@ AC_CHECK_SIZEOF(unsigned long) AC_CHECK_SIZEOF(unsigned long long) AC_CHECK_SIZEOF(int *) +dnl check and use C++ circa-2003 language constructs. +AX_CXX_COMPILE_STDCXX_0X(noext, mandatory) +if test "$ax_cv_cxx_compile_cxx0x_native" = no; then + if test "$ax_cv_cxx_compile_cxx0x_cxx" = yes; then + CXXFLAGS="$CXXFLAGS -std=c++0x" + else + AC_MSG_ERROR([A C++ compiler that supports the C++03 standard is required]) + fi +fi +# Note that the above macro is deprecated in favor of AX_CXX_COMPILE_STDCXX_11: +# https://www.gnu.org/software/autoconf-archive/ax_cxx_compile_stdcxx_0x.html +# However we use it anyway because it is suggested that C++03 should +# be the limit for now: https://sourceforge.net/p/dosbox/patches/283/#cb9a + + dnl some semi complex check for sys/socket so it works on darwin as well AC_CHECK_HEADERS([stdlib.h sys/types.h]) AC_CHECK_HEADERS([sys/socket.h netinet/in.h pwd.h], [], [], @@ -451,6 +466,15 @@ else AC_MSG_WARN([Can't find SDL_net, internal modem and ipx disabled]) fi +# Check for required Opus decoding libraries +PKG_CHECK_MODULES([OPUSFILE], [opusfile], + [ LIBS="$LIBS ${OPUSFILE_LIBS}" + CPPFLAGS="$CPPFLAGS ${OPUSFILE_CFLAGS}" ], []) + +PKG_CHECK_MODULES([SPEEXDSP], [speexdsp], + [ LIBS="$LIBS ${SPEEXDSP_LIBS}" + CPPFLAGS="$CPPFLAGS ${SPEEXDSP_CFLAGS}" ], []) + AH_TEMPLATE(C_X11_XKB,[define to 1 if you have XKBlib.h and X11 lib]) AC_CHECK_LIB(X11, main, have_x11_lib=yes, have_x11_lib=no, ) AC_CHECK_HEADER(X11/XKBlib.h, have_x11_h=yes, have_x11_h=no, ) @@ -514,22 +538,7 @@ case "$host" in esac fi -AH_TEMPLATE(C_SDL_SOUND,[Define to 1 to enable SDL_sound support]) -AC_CHECK_HEADER(SDL_sound.h,have_SDL_sound_h=yes,) -AC_CHECK_LIB(SDL_sound, Sound_Init, have_SDL_sound_init=yes,,) -AC_CHECK_LIB(SDL_sound, Sound_Seek, have_SDL_sound_seek=yes,,) -if test x$have_SDL_sound_h = xyes -a x$have_SDL_sound_init = xyes ; then - if test x$have_SDL_sound_seek = xyes ; then - LIBS="-lSDL_sound $LIBS" - AC_DEFINE(C_SDL_SOUND,1) - else - AC_MSG_WARN([Can't find SoundSeek in libSDL_Sound, libSDL_sound support disabled]) - fi -else - AC_MSG_WARN([Can't find libSDL_sound, libSDL_sound support disabled]) -fi - -dnl Check for mprotect. Needed for 64 bits linux +dnl Check for mprotect. Needed for 64 bits linux AH_TEMPLATE(C_HAVE_MPROTECT,[Define to 1 if you have the mprotect function]) AC_CHECK_HEADER([sys/mman.h], [ AC_CHECK_FUNC([mprotect],[AC_DEFINE(C_HAVE_MPROTECT,1)]) @@ -551,8 +560,9 @@ int main(int argc,char * argv[]) { dnl Some target detection and actions for them case "$host" in - *-*-cygwin* | *-*-mingw32*) + *-*-cygwin* | *-*-mingw* | *-*-msys*) LIBS="$LIBS -lwinmm" + AC_DEFINE(WIN32, 1, [Compiling on Windows]) AC_DEFINE(C_DIRECTSERIAL, 1, [ Define to 1 if you want serial passthrough support (Win32, Posix and OS/2 only).]) if test x$have_sdl_net_lib = xyes -a x$have_sdl_net_h = xyes ; then LIBS="$LIBS -lws2_32" @@ -619,6 +629,7 @@ src/ints/Makefile src/libs/Makefile src/libs/zmbv/Makefile src/libs/gui_tk/Makefile +src/libs/decoders/Makefile src/misc/Makefile src/shell/Makefile src/platform/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index a4029e83..a9bf13df 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -SUBDIRS = cpu debug dos fpu gui hardware libs ints misc shell platform +SUBDIRS = cpu debug dos fpu gui hardware libs ints misc shell platform bin_PROGRAMS = dosbox @@ -14,8 +14,6 @@ endif dosbox_SOURCES = dosbox.cpp $(ico_stuff) dosbox_LDADD = cpu/libcpu.a debug/libdebug.a dos/libdos.a fpu/libfpu.a hardware/libhardware.a gui/libgui.a \ ints/libints.a misc/libmisc.a shell/libshell.a hardware/mame/libmame.a \ - hardware/serialport/libserial.a libs/gui_tk/libgui_tk.a + hardware/serialport/libserial.a libs/gui_tk/libgui_tk.a libs/decoders/libdecoders.a EXTRA_DIST = winres.rc dosbox.ico - - diff --git a/src/libs/Makefile.am b/src/libs/Makefile.am index 303bc370..c614d53a 100644 --- a/src/libs/Makefile.am +++ b/src/libs/Makefile.am @@ -1,3 +1,4 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -SUBDIRS = zmbv gui_tk +SUBDIRS = zmbv gui_tk decoders + diff --git a/src/libs/decoders/Makefile.am b/src/libs/decoders/Makefile.am new file mode 100644 index 00000000..b7f876ab --- /dev/null +++ b/src/libs/decoders/Makefile.am @@ -0,0 +1,33 @@ +noinst_LIBRARIES = libdecoders.a + +libdecoders_a_SOURCES = \ + SDL_sound.c \ + SDL_sound.h \ + SDL_sound_internal.h \ + audio_convert.c \ + wav.c \ + dr_wav.h \ + flac.c \ + dr_flac.h \ + opus.c \ + vorbis.c \ + stb_vorbis.h \ + mp3.cpp \ + mp3_seek_table.cpp \ + mp3_seek_table.h \ + dr_mp3.h \ + archive.h \ + xxhash.c \ + xxhash.h + +libdecoders_a_CXXFLAGS = \ + $(AM_CXXFLAGS) \ + $(CXXFLAGS) \ + -Wpedantic \ + -Wall + +libdecoders_a_CFLAGS = \ + $(AM_CFLAGS) \ + $(CFLAGS) \ + -Wpedantic \ + -Wall