]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Add config and plugin directory options to configure
authorTakashi Iwai <tiwai@suse.de>
Thu, 3 May 2007 18:55:54 +0000 (20:55 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 3 May 2007 18:55:54 +0000 (20:55 +0200)
Added --with-configdir and --with-plugindir options to configure
which specify the directories for config files and plugin objects
respectively.  The default paths when these options are not
specified are unchanged.

14 files changed:
configure.in
modules/mixer/simple/Makefile.am
modules/mixer/simple/sbasedl.c
src/alisp/alisp.c
src/conf.c
src/conf/Makefile.am
src/conf/cards/Makefile.am
src/conf/pcm/Makefile.am
src/confmisc.c
src/control/control.c
src/mixer/simple_abst.c
src/pcm/Makefile.am
src/pcm/pcm.c
src/pcm/pcm_rate.c

index 268560c4080c1e09f489dcaf05b21cd6348957e4..8df37dad74cd2be328e3a42f889ba01141b5b564 100644 (file)
@@ -61,21 +61,41 @@ AC_SUBST(LIBTOOL_VERSION_INFO)
 
 test "x$prefix" = xNONE && prefix=$ac_default_prefix
 
-eval dir="$datadir"
-case "$dir" in
-/*) ;;
-*) dir="$prefix/share"
-esac
-AC_DEFINE_UNQUOTED(DATADIR, "$dir", [directory containing ALSA configuration database])
+dnl ALSA configuration directory
+AC_ARG_WITH(configdir,
+    AS_HELP_STRING([--with-configdir=dir],
+       [path where ALSA config files are stored]),
+    confdir="$withval", confdir="")
+if test -z "$confdir"; then
+    eval dir="$datadir"
+    case "$dir" in
+    /*) ;;
+    *) dir="$prefix/share"
+    esac
+    confdir="$dir/alsa"
+fi
+ALSA_CONFIG_DIR="$confdir"
+AC_DEFINE_UNQUOTED(ALSA_CONFIG_DIR, "$confdir", [directory containing ALSA configuration database])
+AC_SUBST(ALSA_CONFIG_DIR)
 
+dnl ALSA plugin directory
 test "x$exec_prefix" = xNONE && exec_prefix=$prefix
 
-eval dir="$libdir"
-case "$dir" in
-/*) ;;
-*) dir="$dir"
-esac
-AC_DEFINE_UNQUOTED(PKGLIBDIR, "$dir/$PACKAGE", [directory containing ALSA add-on modules])
+AC_ARG_WITH(plugindir,
+    AS_HELP_STRING([--with-plugindir=dir],
+       [path where ALSA plugin files are stored]),
+    plugindir="$withval", plugindir="")
+if test -z "$plugindir"; then
+    eval dir="$libdir"
+    case "$dir" in
+    /*) ;;
+    *) dir="$dir"
+    esac
+    plugindir="$dir/$PACKAGE"
+fi
+AC_DEFINE_UNQUOTED(ALSA_PLUGIN_DIR, "plugindir", [directory containing ALSA add-on modules])
+ALSA_PLUGIN_DIR="$plugindir"
+AC_SUBST(ALSA_PLUGIN_DIR)
 
 dnl Check for versioned symbols
 AC_MSG_CHECKING(for versioned symbols)
index 82d3a887511c7ac83657ecff0bdfcce0d5e76e28..95b6a51b9f563efd74ebda8143d1a21ddae1e95d 100644 (file)
@@ -1,4 +1,4 @@
-pkglibdir = $(libdir)/@PACKAGE@/smixer
+pkglibdir = @ALSA_PLUGIN_DIR@/smixer
 
 AM_CFLAGS = -g -O2 -W -Wall
 
index 8000183848cfac4a10ac36ec6dd8ab67d0ebfaf0..36d86af601bf629edae7032f0e490509d86b7a17 100644 (file)
@@ -33,7 +33,7 @@
 #include "mixer_abst.h"
 #include "sbase.h"
 
-#define SO_PATH PKGLIBDIR "/smixer"
+#define SO_PATH ALSA_PLUGIN_DIR "/smixer"
 
 int mixer_simple_basic_dlopen(snd_mixer_class_t *class,
                              bclass_base_ops_t **ops)
index 73f49bf8b9aa73d44fdfcc044407b90dcca18cdc..50136ab369b088b1eed028ddb1823c4c2ac6af79 100644 (file)
@@ -2395,7 +2395,7 @@ struct alisp_object * F_path(struct alisp_instance *instance, struct alisp_objec
        }
        if (!strcmp(p1->value.s, "data")) {
                delete_tree(instance, p1);
-               return new_string(instance, DATADIR);
+               return new_string(instance, ALSA_CONFIG_DIR);
        }
        delete_tree(instance, p1);
        return &alsa_lisp_nil;
index 030b6291167a0f311708cc751196e22cd67872f9..e24b08d3d4ecbaf57aefa28ff60dac232bfc9869 100644 (file)
@@ -580,12 +580,12 @@ static int get_char_skip_comments(input_t *input)
                        if (err < 0)
                                return err;
                        if (!strncmp(str, "confdir:", 8)) {
-                               char *tmp = malloc(strlen(DATADIR "/alsa") + 1 + strlen(str + 8) + 1);
+                               char *tmp = malloc(strlen(ALSA_CONFIG_DIR) + 1 + strlen(str + 8) + 1);
                                if (tmp == NULL) {
                                        free(str);
                                        return -ENOMEM;
                                }
-                               sprintf(tmp, DATADIR "/alsa/%s", str + 8);
+                               sprintf(tmp, ALSA_CONFIG_DIR "/%s", str + 8);
                                free(str);
                                str = tmp;
                        }
@@ -2606,7 +2606,7 @@ int snd_config_search_alias_hooks(snd_config_t *config,
 #define ALSA_CONFIG_PATH_VAR "ALSA_CONFIG_PATH"
 
 /** The name of the default files used by #snd_config_update. */
-#define ALSA_CONFIG_PATH_DEFAULT DATADIR "/alsa/alsa.conf"
+#define ALSA_CONFIG_PATH_DEFAULT ALSA_CONFIG_DIR "/alsa.conf"
 
 /**
  * \ingroup Config
index 33607d3cd9184247d996c12bd49de35a5b3d3f86..8698d2919b18ebf7bb9429fd81d8202b676c4e1e 100644 (file)
@@ -10,5 +10,5 @@ endif
 
 EXTRA_DIST = $(cfg_files)
 
-alsadir = $(datadir)/alsa
+alsadir = @ALSA_CONFIG_DIR@
 alsa_DATA = $(cfg_files)
index e3ec7ebc445f5a360698db5b869e6da82f3a322e..8677bca62f1e8b4f3920053b94e65a8ef404abde 100644 (file)
@@ -1,4 +1,4 @@
-alsadir = $(datadir)/alsa/cards
+alsadir = @ALSA_CONFIG_DIR@/cards
 cfg_files = aliases.conf \
        AACI.conf \
        ATIIXP.conf \
@@ -56,7 +56,7 @@ endif
 alsa_DATA = $(cfg_files)
 
 if BUILD_ALISP
-SI7018dir = $(datadir)/alsa/cards/SI7018
+SI7018dir = @ALSA_CONFIG_DIR@/cards/SI7018
 SI7018_files = \
        SI7018/sndoc-mixer.alisp \
        SI7018/sndop-mixer.alisp
index 0b2c7e6efbc85229e3995a39eaba05abedaf45b2..7d9c0772d07d58660bfd77fa62a9f3c32d39bc18 100644 (file)
@@ -7,5 +7,5 @@ cfg_files = default.conf front.conf rear.conf center_lfe.conf side.conf\
 
 EXTRA_DIST = $(cfg_files)
 
-alsadir = $(datadir)/alsa/pcm
+alsadir = @ALSA_CONFIG_DIR@/pcm
 alsa_DATA = $(cfg_files)
index 86b8de9caa9d882712b5cefbbc06732d8f5e082a..b0b0301957ae01589972fbe356c188602c07cb24 100644 (file)
@@ -588,7 +588,7 @@ int snd_func_datadir(snd_config_t **dst, snd_config_t *root ATTRIBUTE_UNUSED,
        err = snd_config_get_id(src, &id);
        if (err < 0)
                return err;
-       return snd_config_imake_string(dst, id, DATADIR "/alsa");
+       return snd_config_imake_string(dst, id, ALSA_CONFIG_DIR);
 }
 #ifndef DOC_HIDDEN
 SND_DLSYM_BUILD_VERSION(snd_func_datadir, SND_CONFIG_DLSYM_VERSION_EVALUATE);
index 785bb94d93b281a5cb34e66e556ec18a49fb79ce..085dc634e7140a1a8cc2509e1ca21fabd7c28eaf 100644 (file)
@@ -849,13 +849,13 @@ static int snd_ctl_open_conf(snd_ctl_t **ctlp, const char *name,
                        build_in++;
                }
                if (*build_in == NULL) {
-                       buf1 = malloc(strlen(str) + sizeof(PKGLIBDIR) + 32);
+                       buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32);
                        if (buf1 == NULL) {
                                err = -ENOMEM;
                                goto _err;
                        }
                        lib = buf1;
-                       sprintf(buf1, "%s/libasound_module_ctl_%s.so", PKGLIBDIR, str);
+                       sprintf(buf1, "%s/libasound_module_ctl_%s.so", ALSA_PLUGIN_DIR, str);
                }
        }
 #ifndef PIC
index 26f620b2eae03fa38b5bd9013d7c3e35a6a0d660..5de2018b0fbd202c8be29086a0c5dd4905b9e6ec 100644 (file)
@@ -41,7 +41,7 @@
 
 #ifndef DOC_HIDDEN
 
-#define SO_PATH PKGLIBDIR "/smixer"
+#define SO_PATH ALSA_PLUGIN_DIR "/smixer"
 
 typedef struct _class_priv {
        char *device;
@@ -239,7 +239,7 @@ int snd_mixer_simple_basic_register(snd_mixer_t *mixer,
                goto __error;
        file = getenv("ALSA_MIXER_SIMPLE");
        if (!file)
-               file = DATADIR "/alsa/smixer.conf";
+               file = ALSA_CONFIG_DIR "/smixer.conf";
        err = snd_config_top(&top);
        if (err >= 0) {
                err = snd_input_stdio_open(&input, file, "r");
index 95e7ad048459715f32fdb1fa6b3a75a4ed5fe002..204b012fc986a319a7f96b5be61a66cee5b30bf6 100644 (file)
@@ -11,7 +11,7 @@ if BUILD_PCM_PLUGIN
 libpcm_la_SOURCES += pcm_generic.c pcm_plugin.c
 endif
 if BUILD_PCM_PLUGIN_COPY
-libpcm_la_SOURCES += pcm_copy.c
+libpcm_la_SOURCES += pcm_copy.c pcm_demux.c
 endif
 if BUILD_PCM_PLUGIN_LINEAR
 libpcm_la_SOURCES += pcm_linear.c
index fa29ceff22418e6c33160283d05c6cc18049f109..4c72d1c2827870a1384da8a780bfe5e399ad3998 100644 (file)
@@ -2080,13 +2080,13 @@ static int snd_pcm_open_conf(snd_pcm_t **pcmp, const char *name,
                        build_in++;
                }
                if (*build_in == NULL) {
-                       buf1 = malloc(strlen(str) + sizeof(PKGLIBDIR) + 32);
+                       buf1 = malloc(strlen(str) + sizeof(ALSA_PLUGIN_DIR) + 32);
                        if (buf1 == NULL) {
                                err = -ENOMEM;
                                goto _err;
                        }
                        lib = buf1;
-                       sprintf(buf1, "%s/libasound_module_pcm_%s.so", PKGLIBDIR, str);
+                       sprintf(buf1, "%s/libasound_module_pcm_%s.so", ALSA_PLUGIN_DIR, str);
                }
        }
 #ifndef PIC
index 8e8fb06a17e96ceb050654e173ff059169e47b53..1eefad40ef1f959135eaa436b4c06e2a1583a4d4 100644 (file)
@@ -1284,7 +1284,7 @@ static int rate_open_func(snd_pcm_rate_t *rate, const char *type)
                char lib_name[128], *lib = NULL;
                if (!is_builtin_plugin(type)) {
                        snprintf(lib_name, sizeof(lib_name),
-                                "%s/libasound_module_rate_%s.so", PKGLIBDIR, type);
+                                "%s/libasound_module_rate_%s.so", ALSA_PLUGIN_DIR, type);
                        lib = lib_name;
                }
                h = snd_dlopen(lib, RTLD_NOW);