summaryrefslogtreecommitdiff
path: root/topology
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2021-12-06 11:00:02 +0100
committerJaroslav Kysela <perex@perex.cz>2021-12-06 11:00:02 +0100
commit15a5a16eb77d7e838d4e44b6c0c4ffe4a8565189 (patch)
treed190100b06796c21599d4ad11e0f97e2c268bcda /topology
parent66693b1a77016626d6b860f0d11597c0564194ac (diff)
downloadalsa-utils-15a5a16eb77d7e838d4e44b6c0c4ffe4a8565189.tar.gz
topology: fix compilation for older alsa-lib
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'topology')
-rw-r--r--topology/pre-processor.c6
-rw-r--r--topology/topology.c14
2 files changed, 18 insertions, 2 deletions
diff --git a/topology/pre-processor.c b/topology/pre-processor.c
index de44ac5..23963a7 100644
--- a/topology/pre-processor.c
+++ b/topology/pre-processor.c
@@ -175,7 +175,7 @@ void free_pre_preprocessor(struct tplg_pre_processor *tplg_pp)
free(tplg_pp);
}
-int init_pre_precessor(struct tplg_pre_processor **tplg_pp, snd_output_type_t type,
+int init_pre_processor(struct tplg_pre_processor **tplg_pp, snd_output_type_t type,
const char *output_file)
{
struct tplg_pre_processor *_tplg_pp;
@@ -224,6 +224,7 @@ err:
return ret;
}
+#if SND_LIB_VER(1, 2, 5) < SND_LIB_VERSION
static int pre_process_defines(struct tplg_pre_processor *tplg_pp, const char *pre_processor_defs,
snd_config_t *top)
{
@@ -513,6 +514,7 @@ static int pre_process_includes_all(struct tplg_pre_processor *tplg_pp, snd_conf
return 0;
}
+#endif /* version < 1.2.6 */
int pre_process(struct tplg_pre_processor *tplg_pp, char *config, size_t config_size,
const char *pre_processor_defs, const char *inc_path)
@@ -542,6 +544,7 @@ int pre_process(struct tplg_pre_processor *tplg_pp, char *config, size_t config_
tplg_pp->input_cfg = top;
+#if SND_LIB_VER(1, 2, 5) < SND_LIB_VERSION
/* parse command line definitions */
err = pre_process_defines(tplg_pp, pre_processor_defs, tplg_pp->input_cfg);
if (err < 0) {
@@ -563,6 +566,7 @@ int pre_process(struct tplg_pre_processor *tplg_pp, char *config, size_t config_
fprintf(stderr, "Failed to expand pre-processor definitions in input config\n");
goto err;
}
+#endif
err = pre_process_config(tplg_pp, tplg_pp->input_cfg);
if (err < 0) {
diff --git a/topology/topology.c b/topology/topology.c
index 0c36e7c..44184d3 100644
--- a/topology/topology.c
+++ b/topology/topology.c
@@ -56,6 +56,9 @@ _("Usage: %s [OPTIONS]...\n"
"-u, --dump=FILE dump (reparse) configuration file\n"
"-v, --verbose=LEVEL set verbosity level (0...1)\n"
"-o, --output=FILE set output file\n"
+#if SND_LIB_VER(1, 2, 5) < SND_LIB_VERSION
+"-D, --define=ARGS define variables (VAR1=VAL1[,VAR2=VAL2] ...)\n"
+#endif
"-s, --sort sort the identifiers in the normalized output\n"
"-g, --group save configuration by group indexes\n"
"-x, --nocheck save configuration without additional integrity checks\n"
@@ -368,7 +371,11 @@ static int decode(const char *source_file, const char *output_file,
int main(int argc, char *argv[])
{
- static const char short_options[] = "hc:d:n:u:v:o:pP:sgxzVD:";
+ static const char short_options[] = "hc:d:n:u:v:o:pP:sgxzV"
+#if SND_LIB_VER(1, 2, 5) < SND_LIB_VERSION
+ "D:"
+#endif
+ ;
static const struct option long_options[] = {
{"help", 0, NULL, 'h'},
{"verbose", 1, NULL, 'v'},
@@ -378,6 +385,9 @@ int main(int argc, char *argv[])
{"normalize", 1, NULL, 'n'},
{"dump", 1, NULL, 'u'},
{"output", 1, NULL, 'o'},
+#if SND_LIB_VER(1, 2, 5) < SND_LIB_VERSION
+ {"define", 1, NULL, 'D'},
+#endif
{"sort", 0, NULL, 's'},
{"group", 0, NULL, 'g'},
{"nocheck", 0, NULL, 'x'},
@@ -439,9 +449,11 @@ int main(int argc, char *argv[])
case 'x':
sflags |= SND_TPLG_SAVE_NOCHECK;
break;
+#if SND_LIB_VER(1, 2, 5) < SND_LIB_VERSION
case 'D':
pre_processor_defs = optarg;
break;
+#endif
case 'V':
version(argv[0]);
return 0;