]> git.alsa-project.org Git - alsa-utils.git/commitdiff
topology: fix compilation for older alsa-lib
authorJaroslav Kysela <perex@perex.cz>
Mon, 6 Dec 2021 10:00:02 +0000 (11:00 +0100)
committerJaroslav Kysela <perex@perex.cz>
Mon, 6 Dec 2021 10:00:02 +0000 (11:00 +0100)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
topology/pre-processor.c
topology/topology.c

index de44ac5d21011c171ab68424e2753346d9ef8662..23963a7df9fa4f3331356b2639a33d9fd4cfa73a 100644 (file)
@@ -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) {
index 0c36e7cbee701a697860da0c72f7923236d4fdce..44184d3d993d6fd226faa495d360762b48b61e7f 100644 (file)
@@ -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;