OSDN Git Service

Moved pcm_jack plugin to src/pcm/ext directory (must be build manually).
authorJaroslav Kysela <perex@perex.cz>
Wed, 5 Mar 2003 19:56:55 +0000 (19:56 +0000)
committerJaroslav Kysela <perex@perex.cz>
Wed, 5 Mar 2003 19:56:55 +0000 (19:56 +0000)
The pcm open functions looks to /usr/lib/alsa-lib directory for plugins
like jack.

aserver/Makefile.am
configure.in
src/Makefile.am
src/pcm/Makefile.am
src/pcm/ext/Makefile.am [new file with mode: 0644]
src/pcm/ext/pcm_jack.c [moved from src/pcm/pcm_jack.c with 100% similarity]
src/pcm/pcm.c
src/pcm/pcm_symbols.c

index 32caa5d..116f578 100644 (file)
@@ -1,13 +1,7 @@
-if HAVE_JACK
-JACK_LIB = -ljack
-else
-JACK_LIB =
-endif
-
 bin_PROGRAMS = aserver
 aserver_SOURCES = aserver.c
 # aserver_LDADD = -lasound
-aserver_LDADD = ../src/libasound.la $(JACK_LIB)
+aserver_LDADD = ../src/libasound.la
 
 all: aserver
 
index 5ccbea4..7b72dca 100644 (file)
@@ -66,6 +66,15 @@ case "$dir" in
 esac
 AC_DEFINE_UNQUOTED(DATADIR, "$dir", [directory containing ALSA configuration database])
 
+test "x$exec_prefix" = xNONE && exec_prefix=$prefix
+
+eval dir="$libdir"
+case "$dir" in
+/*) ;;
+*) dir="$PWD/$dir"
+esac
+AC_DEFINE_UNQUOTED(PKGLIBDIR, "$dir/$PACKAGE", [directory containing ALSA add-on modules])
+
 dnl Check for versioned symbols
 AC_MSG_CHECKING(for versioned symbols)
 AC_ARG_WITH(versioned,
@@ -118,19 +127,6 @@ else
   AC_MSG_RESULT(no)
 fi
 
-dnl Check for jack...
-AC_MSG_CHECKING(for jack)
-AC_ARG_WITH(jack,
-  [  --with-jack             do you have installed Jack Audio Connection Kit (optional)],
-  [  AC_DEFINE(HAVE_JACK, "1", [enabled])
-     jack=yes ],)
-if test "$jack" = "yes" ; then
-  AC_MSG_RESULT(yes)
-else
-  AC_MSG_RESULT(no)
-fi
-AM_CONDITIONAL(HAVE_JACK, test x$jack = xyes)
-
 dnl Check for architecture
 AC_MSG_CHECKING(for architecture)
 case "$target" in
@@ -164,7 +160,8 @@ esac
 
 AC_OUTPUT(Makefile doc/Makefile doc/pictures/Makefile include/Makefile
          include/sound/Makefile src/Makefile \
-          src/control/Makefile src/mixer/Makefile src/pcm/Makefile \
+          src/control/Makefile src/mixer/Makefile
+         src/pcm/Makefile src/pcm/ext/Makefile \
          src/rawmidi/Makefile src/timer/Makefile \
           src/hwdep/Makefile src/seq/Makefile src/instr/Makefile \
           src/compat/Makefile src/conf/Makefile \
index 1a7d7df..fa26ecf 100644 (file)
@@ -2,12 +2,6 @@ SUBDIRS=control mixer pcm rawmidi timer hwdep seq instr compat conf
 EXTRA_DIST=Versions
 COMPATNUM=@LIBTOOL_VERSION_INFO@
 
-if HAVE_JACK
-JACK_LIB = -ljack
-else
-JACK_LIB =
-endif
-
 lib_LTLIBRARIES = libasound.la
 libasound_la_SOURCES = conf.c confmisc.c input.c output.c async.c error.c dlmisc.c
 libasound_la_LIBADD = control/libcontrol.la mixer/libmixer.la pcm/libpcm.la \
index 2a1e42b..a32755e 100644 (file)
@@ -1,10 +1,6 @@
-EXTRA_LTLIBRARIES = libpcm.la
+SUBDIRS = ext
 
-if HAVE_JACK
-JACK_PLUGIN = pcm_jack.c
-else
-JACK_PLUGIN =
-endif
+EXTRA_LTLIBRARIES = libpcm.la
 
 libpcm_la_SOURCES = atomic.c mask.c interval.c \
                    pcm.c pcm_params.c \
@@ -13,13 +9,11 @@ libpcm_la_SOURCES = atomic.c mask.c interval.c \
                    pcm_rate.c pcm_plug.c pcm_misc.c pcm_mmap.c pcm_multi.c \
                    pcm_shm.c pcm_file.c pcm_null.c pcm_share.c \
                    pcm_meter.c pcm_hooks.c pcm_lfloat.c pcm_ladspa.c \
-                   pcm_dmix.c $(JACK_PLUGIN) pcm_symbols.c
+                   pcm_dmix.c pcm_symbols.c
 noinst_HEADERS = pcm_local.h pcm_plugin.h mask.h mask_inline.h \
                 interval.h interval_inline.h plugin_ops.h ladspa.h \
                 pcm_dmix_i386.h
 
-EXTRA_libpcm_la_SOURCES = pcm_jack.c
-
 alsadir = $(datadir)/alsa
 
 all: libpcm.la
diff --git a/src/pcm/ext/Makefile.am b/src/pcm/ext/Makefile.am
new file mode 100644 (file)
index 0000000..14dc396
--- /dev/null
@@ -0,0 +1,30 @@
+COMPATNUM=@LIBTOOL_VERSION_INFO@
+
+pkglib_LTLIBRARIES = libasound_module_pcm_jack.la
+
+libasound_module_pcm_jack_la_SOURCES = pcm_jack.c
+libasound_module_pcm_jack_la_LDFLAGS = -version-info $(COMPATNUM)
+libasound_module_pcm_jack_la_LIBADD = -ljack
+alsadir = $(libdir)/alsa_modules
+
+INCLUDES=-I$(top_srcdir)/include -I$(top_srcdir)/src/pcm
+
+.PHONY : help
+
+help:
+       @echo "Specify target by hand, please"
+       @echo "Type 'make jack' to build the jack pcm plugin..."
+       @echo "Type 'make install-jack' to install the jack pcm plugin..."
+
+all: help
+
+all-am: help
+
+install-am: help
+
+hand-install: install-exec-am
+
+jack: libasound_module_pcm_jack.la
+
+install-jack:
+       $(LIBTOOL) --mode=install $(pkglibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) libasound_module_pcm_jack.la $(DESTDIR)$(pkglibdir)/libasound_module_pcm_jack.la
similarity index 100%
rename from src/pcm/pcm_jack.c
rename to src/pcm/ext/pcm_jack.c
index fcc36f2..1375ab8 100644 (file)
@@ -1706,12 +1706,18 @@ snd_pcm_t *snd_async_handler_get_pcm(snd_async_handler_t *handler)
        return handler->u.pcm;
 }
 
+static char *build_in_pcms[] = {
+       "adpcm", "alaw", "copy", "dmix", "file", "hooks", "hw", "ladspa", "lfloat",
+       "linear", "meter", "mulaw", "multi", "null", "plug", "rate", "route", "share",
+       "shm", NULL
+};
+
 static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
                             snd_config_t *pcm_root, snd_config_t *pcm_conf,
                             snd_pcm_stream_t stream, int mode)
 {
        const char *str;
-       char buf[256];
+       char *buf = NULL, *buf1 = NULL;
        int err;
        snd_config_t *conf, *type_conf = NULL;
        snd_config_iterator_t i, next;
@@ -1785,8 +1791,30 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
                }
        }
        if (!open_name) {
+               buf = malloc(strlen(str) + 32);
+               if (buf == NULL) {
+                       err = -ENOMEM;
+                       goto _err;
+               }
                open_name = buf;
-               snprintf(buf, sizeof(buf), "_snd_pcm_%s_open", str);
+               sprintf(buf, "_snd_pcm_%s_open", str);
+       }
+       if (!lib) {
+               char **build_in = build_in_pcms;
+               while (*build_in) {
+                       if (!strcmp(*build_in, str))
+                               break;
+                       build_in++;
+               }
+               if (*build_in == NULL) {
+                       buf1 = malloc(strlen(str) + sizeof(PKGLIBDIR) + 32);
+                       if (buf1 == NULL) {
+                               err = -ENOMEM;
+                               goto _err;
+                       }
+                       lib = buf1;
+                       sprintf(buf1, "%s/libasound_module_pcm_%s.so", PKGLIBDIR, str);
+               }
        }
 #ifndef PIC
        snd_pcm_open_symbols(); /* this call is for static linking only */
@@ -1810,11 +1838,15 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
                err = open_func(pcmp, name, pcm_root, pcm_conf, stream, mode);
                if (err >= 0) {
                        (*pcmp)->dl_handle = h;
-                       return 0;
+                       err = 0;
                } else {
                        snd_dlclose(h);
                }
        }
+       if (buf)
+               free(buf);
+       if (buf1)
+               free(buf1);
        return err;
 }
 
index fc91af9..51f49e8 100644 (file)
@@ -41,9 +41,6 @@ extern const char *_snd_module_pcm_shm;
 extern const char *_snd_module_pcm_lfloat;
 extern const char *_snd_module_pcm_ladspa;
 extern const char *_snd_module_pcm_dmix;
-#ifdef HAVE_JACK
-extern const char *_snd_module_pcm_jack;
-#endif
 
 static const char **snd_pcm_open_objects[] = {
        &_snd_module_pcm_adpcm,
@@ -64,10 +61,7 @@ static const char **snd_pcm_open_objects[] = {
        &_snd_module_pcm_shm,
        &_snd_module_pcm_lfloat,
        &_snd_module_pcm_ladspa,
-       &_snd_module_pcm_dmix,
-#ifdef HAVE_JACK
-       &_snd_module_pcm_jack
-#endif
+       &_snd_module_pcm_dmix
 };
        
 void *snd_pcm_open_symbols(void)