From 33b38018b60dc7afc51ac5c7db681b2993d12603 Mon Sep 17 00:00:00 2001 From: Element Green Date: Sun, 31 Aug 2003 21:11:00 +0000 Subject: [PATCH] Some build stuff relating to ALSA and OSS support. --- fluidsynth/ChangeLog | 13 +++ fluidsynth/Makefile.am | 6 +- fluidsynth/acinclude.m4 | 174 ++----------------------------------- fluidsynth/configure.ac | 39 +++++++-- fluidsynth/src/Makefile.am | 32 ++++--- fluidsynth/src/config.h.in | 3 - 6 files changed, 72 insertions(+), 195 deletions(-) diff --git a/fluidsynth/ChangeLog b/fluidsynth/ChangeLog index 40ed70fe..50d47dff 100644 --- a/fluidsynth/ChangeLog +++ b/fluidsynth/ChangeLog @@ -1,3 +1,16 @@ +2003-08-31 Josh Green + + * acinclude.m4: Renamed AC_SOUND macro to AC_OSS_AUDIO and removed + the ALSA check from it since pkg-config is now being used to check + for ALSA. Also fixed --enable-alsa-support and --enable-oss-support + which were disabling support instead (reported by Bart Massey). + * configure.ac: pkg-config is now being used to check for ALSA. + ALSA and OSS now use automake conditionals to conditionally compile + source files. + * Makefile.am: Re-arranged SUBDIRS so build output looks nicer. + * src/Makefile.am: ALSA and OSS are now conditionally compiled using + automake conditionals. + 2003-08-29 Josh Green * src/fluid_sys.c: Patch from Eric Van Buggenhaut to make i386 asm diff --git a/fluidsynth/Makefile.am b/fluidsynth/Makefile.am index f2b4ff66..23ef3ceb 100644 --- a/fluidsynth/Makefile.am +++ b/fluidsynth/Makefile.am @@ -1,8 +1,8 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = src doc include macbuild sf2 winbuild -EXTRA_DIST = TODO acinclude.m4 autogen.sh fluidsynth.pc.in fluidsynth.spec.in \ - fluidsynth.spec +SUBDIRS = macbuild sf2 winbuild src doc include +EXTRA_DIST = TODO acinclude.m4 autogen.sh fluidsynth.pc.in \ + fluidsynth.spec.in fluidsynth.spec DISTCLEANFILES = fluidsynth.pc pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = fluidsynth.pc diff --git a/fluidsynth/acinclude.m4 b/fluidsynth/acinclude.m4 index 1e16f84c..ad458d88 100644 --- a/fluidsynth/acinclude.m4 +++ b/fluidsynth/acinclude.m4 @@ -1,12 +1,10 @@ - +dnl Some additional autoconf macros AC_DEFUN(AC_MIDISHARE, [ - midishare=no - AC_ARG_ENABLE(midishare, - [ --enable-midishare Compile MIDISHARE support], - midishare=$enableval) + [ --enable-midishare Compile MIDISHARE support (default=no)], + midishare=$enableval, midishare=no) MIDISHARE_SUPPORT=0 @@ -36,36 +34,14 @@ AC_DEFUN(AC_MIDISHARE, fi dnl enable_midishare != no? ]) - -dnl Copied from Josh Green's Smurf SoundFont Editor -dnl Peter Hanappe, 21/05/2001 -dnl -dnl - AC_SOUND - Determine sound compilability -dnl - Josh Green 08/08/99 - -AC_DEFUN(AC_SOUND, +AC_DEFUN(AC_OSS_AUDIO, [ AC_ARG_ENABLE(oss-support, - [ --disable-oss-support Do not compile OSS support], - enable_oss_support=no) + [ --disable-oss-support Do not compile OSS support (default=auto)], + enable_oss_support=$enableval, enable_oss_support="yes") - AC_ARG_ENABLE(alsa-support, - [ --disable-alsa-support Do not compile ALSA support], - enable_alsa_support=no) - - ALSA_SUPPORT=0 OSS_SUPPORT=0 - AM_PATH_ALSA(0.9.0, [ - if test "x$enable_alsa_support" != "xno"; then - ALSA_SUPPORT=1 - AC_DEFINE(ALSA_SUPPORT, 1, [Define to enable ALSA driver]) - LIBS="${LIBS} ${ALSA_LIBS}" - CFLAGS="${CFLAGS} ${ALSA_CFLAGS}" - COMPOPSTR="ALSA ${COMPOPSTR}" - fi - ]) - if test "x$enable_oss_support" != "xno"; then AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/soundcard.h machine/soundcard.h) if test "${ac_cv_header_fcntl_h}" = "yes" && \ @@ -74,7 +50,6 @@ AC_DEFUN(AC_SOUND, test "${ac_cv_header_machine_soundcard_h}" = "yes"; then OSS_SUPPORT=1 AC_DEFINE(OSS_SUPPORT, 1, [Define to enable OSS driver]) - COMPOPSTR="OSS ${COMPOPSTR}" else AC_MSG_WARN([ *** Could not find soundcard.h, disabling OSS driver]) fi dnl soundcard.h header test @@ -84,143 +59,6 @@ AC_DEFUN(AC_SOUND, fi dnl enable_oss_support != no? ]) -dnl Josh Green ripped and modified from alsa-utils-0.9beta1 Feb 25 2001 -dnl -dnl Configure Paths for Alsa -dnl Some modifications by Richard Boulton -dnl Christopher Lansdown -dnl Jaroslav Kysela -dnl Last modification: 07/01/2001 -dnl AM_PATH_ALSA([MINIMUM-VERSION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) -dnl Test for libasound, and define ALSA_CFLAGS and ALSA_LIBS as appropriate. -dnl enables arguments --with-alsa-prefix= -dnl --with-alsa-enc-prefix= -dnl --disable-alsatest (this has no effect, as yet) -dnl -AC_DEFUN(AM_PATH_ALSA, -[dnl Save the original CFLAGS, LDFLAGS, and LIBS -alsa_save_CFLAGS="$CFLAGS" -alsa_save_LDFLAGS="$LDFLAGS" -alsa_save_LIBS="$LIBS" -alsa_found=yes - -dnl -dnl Get the cflags and libraries for alsa -dnl -AC_ARG_WITH(alsa-prefix, -[ --with-alsa-prefix=PFX Prefix where Alsa library is installed(optional)], -[alsa_prefix="$withval"], [alsa_prefix=""]) - -AC_ARG_WITH(alsa-inc-prefix, -[ --with-alsa-inc-prefix=PFX Prefix where include libraries are (optional)], -[alsa_inc_prefix="$withval"], [alsa_inc_prefix=""]) - -dnl FIXME: this is not yet implemented -AC_ARG_ENABLE(alsatest, -[ --disable-alsatest Do not try to compile and run a test Alsa program], -[enable_alsatest=no], -[enable_alsatest=yes]) - -dnl Add any special include directories -AC_MSG_CHECKING(for ALSA CFLAGS) -if test "$alsa_inc_prefix" != "" ; then - ALSA_CFLAGS="$ALSA_CFLAGS -I$alsa_inc_prefix" - CFLAGS="$CFLAGS -I$alsa_inc_prefix" -fi -AC_MSG_RESULT($ALSA_CFLAGS) - -dnl add any special lib dirs -AC_MSG_CHECKING(for ALSA LDFLAGS) -if test "$alsa_prefix" != "" ; then - ALSA_LIBS="$ALSA_LIBS -L$alsa_prefix" - LDFLAGS="$LDFLAGS $ALSA_LIBS" -fi - -dnl add the alsa library -ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl" -LIBS="$ALSA_LIBS $LIBS" -AC_MSG_RESULT($ALSA_LIBS) - -dnl Check for a working version of libasound that is of the right version. -min_alsa_version=ifelse([$1], ,0.1.1,$1) -AC_MSG_CHECKING(for libasound headers version >= $min_alsa_version) -no_alsa="" - alsa_min_major_version=`echo $min_alsa_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - alsa_min_minor_version=`echo $min_alsa_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - alsa_min_micro_version=`echo $min_alsa_version | \ - sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` - -AC_LANG_SAVE -AC_LANG_C -AC_TRY_COMPILE([ -#include -], [ -int main(void) -{ -/* ensure backward compatibility */ -#if !defined(SND_LIB_MAJOR) && defined(SOUNDLIB_VERSION_MAJOR) -#define SND_LIB_MAJOR SOUNDLIB_VERSION_MAJOR -#endif -#if !defined(SND_LIB_MINOR) && defined(SOUNDLIB_VERSION_MINOR) -#define SND_LIB_MINOR SOUNDLIB_VERSION_MINOR -#endif -#if !defined(SND_LIB_SUBMINOR) && defined(SOUNDLIB_VERSION_SUBMINOR) -#define SND_LIB_SUBMINOR SOUNDLIB_VERSION_SUBMINOR -#endif - -# if(SND_LIB_MAJOR > $alsa_min_major_version) - exit(0); -# else -# if(SND_LIB_MAJOR < $alsa_min_major_version) -# error not present -# endif - -# if(SND_LIB_MINOR > $alsa_min_minor_version) - exit(0); -# else -# if(SND_LIB_MINOR < $alsa_min_minor_version) -# error not present -# endif - -# if(SND_LIB_SUBMINOR < $alsa_min_micro_version) -# error not present -# endif -# endif -# endif -exit(0); -} -], - [AC_MSG_RESULT(found.)], - [AC_MSG_RESULT(not present.) - alsa_found=no] -) -AC_LANG_RESTORE - -dnl Now that we know that we have the right version, let's see if we have the library and not just the headers. -AC_CHECK_LIB([asound], [snd_seq_open],, [alsa_found=no]) - -dnl Restore variables -CFLAGS="$alsa_save_CFLAGS" -LDFLAGS="$alsa_save_LDFLAGS" -LIBS="$alsa_save_LIBS" - -if test "x$alsa_found" = "xyes" ; then - ifelse([$2], , :, [$2]) -fi -if test "x$alsa_found" = "xno" ; then - ifelse([$3], , :, [$3]) - ALSA_CFLAGS="" - ALSA_LIBS="" -fi - -dnl That should be it. Now just export out symbols: -AC_SUBST(ALSA_CFLAGS) -AC_SUBST(ALSA_LIBS) -]) - - dnl Configure Paths for readline (Josh Green 2003-06-10) dnl dnl AM_PATH_READLINE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) diff --git a/fluidsynth/configure.ac b/fluidsynth/configure.ac index 454468db..77155fa0 100644 --- a/fluidsynth/configure.ac +++ b/fluidsynth/configure.ac @@ -189,8 +189,29 @@ dnl AC_DEFINE(AUFILE_SUPPORT, 1, [Define to activate sound output to files]) dnl fi -dnl - Sound support check (ALSA/OSS) -AC_SOUND +dnl - Check support for ALSA + +AC_ARG_ENABLE(alsa-support, + [ --disable-alsa-support Do not compile ALSA support (default=auto)], + [enable_alsa_support=$enableval], enable_alsa_support="yes") + +if test "x$enable_alsa_support" != "xno"; then + PKG_CHECK_MODULES(ALSA, alsa >= 0.9.1, ALSA_SUPPORT=1, ALSA_SUPPORT=0) +else + ALSA_SUPPORT=0 +fi + +if test "$ALSA_SUPPORT" = "1"; then + AC_DEFINE(ALSA_SUPPORT, 1, [Define to enable ALSA driver]) +fi +AM_CONDITIONAL(ALSA_SUPPORT, test "$ALSA_SUPPORT" = "1") +AC_SUBST(ALSA_CFLAGS) +AC_SUBST(ALSA_LIBS) + + +dnl - Check support for OSS audio +AC_OSS_AUDIO +AM_CONDITIONAL(OSS_SUPPORT, test "$OSS_SUPPORT" = "1") dnl - Check support for MidiShare @@ -312,19 +333,19 @@ AM_CONDITIONAL(LADCCA, test "$LADCCA_FOUND" = "yes") AC_OUTPUT([ Makefile + macbuild/Makefile + sf2/Makefile + winbuild/Makefile + winbuild/fluidsynth/Makefile + winbuild/fluidsynth_dll/Makefile + winbuild/fluidsynth_lib/Makefile src/Makefile doc/Makefile include/Makefile include/fluidsynth/Makefile include/fluidsynth/version.h fluidsynth.pc - fluidsynth.spec - macbuild/Makefile - sf2/Makefile - winbuild/Makefile - winbuild/fluidsynth/Makefile - winbuild/fluidsynth_dll/Makefile - winbuild/fluidsynth_lib/Makefile]) + fluidsynth.spec]) echo echo "**************************************************************" diff --git a/fluidsynth/src/Makefile.am b/fluidsynth/src/Makefile.am index 322893ac..18d982ae 100644 --- a/fluidsynth/src/Makefile.am +++ b/fluidsynth/src/Makefile.am @@ -1,34 +1,43 @@ ## Process this file with automake to produce Makefile.in # Tests for optional drivers -if COREAUDIO_SUPPORT -fluid_coreaudio = fluid_coreaudio.c +if ALSA_SUPPORT +fluid_alsa = fluid_alsa.c endif -if MINGW32_SUPPORT -fluid_windows = fluid_dll.c fluid_dsound.c fluid_winmidi.c +if COREAUDIO_SUPPORT +fluid_coreaudio = fluid_coreaudio.c endif if JACK_SUPPORT fluid_jack = fluid_jack.c endif +if MINGW32_SUPPORT +fluid_windows = fluid_dll.c fluid_dsound.c fluid_winmidi.c +endif + +if OSS_SUPPORT +fluid_oss = fluid_oss.c +endif + # Extra files and optional drivers EXTRA_DIST = fluid_dll.c fluid_dsound.c fluid_winmidi.c fluid_portaudio.c \ - fluid_coreaudio.c fluid_dsp_core.c fluid_sndmgr.c \ - config_macos.h config_macosx.h config_macosx_pb.h config_win32.h \ - fluid_sse.h + fluid_coreaudio.c fluid_alsa.c fluid_oss.c fluid_dsp_core.c \ + fluid_sndmgr.c config_macos.h config_macosx.h config_macosx_pb.h \ + config_win32.h fluid_sse.h lib_LTLIBRARIES = libfluidsynth.la bin_PROGRAMS = fluidsynth libfluidsynth_la_SOURCES = \ + $(fluid_alsa) \ $(fluid_coreaudio) \ - $(fluid_windows) \ $(fluid_jack) \ + $(fluid_oss) \ + $(fluid_windows) \ fluid_adriver.c \ fluid_adriver.h \ - fluid_alsa.c \ fluid_chan.c \ fluid_chan.h \ fluid_chorus.c \ @@ -60,7 +69,6 @@ libfluidsynth_la_SOURCES = \ fluid_midishare.c \ fluid_mod.c \ fluid_mod.h \ - fluid_oss.c \ fluid_phase.h \ fluid_ramsfont.c \ fluid_ramsfont.h \ @@ -84,10 +92,10 @@ libfluidsynth_la_SOURCES = \ fluid_voice.h INCLUDES = -I$(srcdir)/../include $(LADCCA_CFLAGS) $(READLINE_CFLAGS) \ - $(JACK_CFLAGS) + $(JACK_CFLAGS) $(ALSA_CFLAGS) libfluidsynth_la_LIBADD = $(LIBFLUID_LIBS) $(LADCCA_LIBS) $(READLINE_LIBS) \ - $(COREAUDIO_LIBS) $(JACK_LIBS) + $(COREAUDIO_LIBS) $(JACK_LIBS) $(ALSA_LIBS) libfluidsynth_la_LDFLAGS = \ -version-info @LIBFLUIDSYNTH_MAJ@:@LIBFLUIDSYNTH_MIN@:0 \ -export-dynamic @FCLDFLAGS@ $(LIBFLUID_LDFLAGS) diff --git a/fluidsynth/src/config.h.in b/fluidsynth/src/config.h.in index edb35b32..4f801c8e 100644 --- a/fluidsynth/src/config.h.in +++ b/fluidsynth/src/config.h.in @@ -33,9 +33,6 @@ /* whether or not we are supporting ladcca */ #undef HAVE_LADCCA -/* Define to 1 if you have the `asound' library (-lasound). */ -#undef HAVE_LIBASOUND - /* Define to 1 if you have the `dl' library (-ldl). */ #undef HAVE_LIBDL