From: Arran Cudbard-Bell Date: Wed, 4 May 2022 23:41:34 +0000 (+0200) Subject: Do partial target matching in jlibtool X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=65d157609d103b3116dd78fa59e93878ce445cfd;p=thirdparty%2Ffreeradius-server.git Do partial target matching in jlibtool --- diff --git a/scripts/jlibtool.c b/scripts/jlibtool.c index af546f2fd2d..279d9a57993 100644 --- a/scripts/jlibtool.c +++ b/scripts/jlibtool.c @@ -439,6 +439,7 @@ static const target_map_t target_map[] = { TARGET("emx", emx), TARGET("ming32", ming32), TARGET("emscripten", emscripten), + TARGET("wasm", emscripten), }; #ifndef LIBDIR @@ -584,7 +585,6 @@ static void usage(int code) printf(" --tag=TAG Ignored for libtool compatibility\n"); printf(" --version print version information\n"); - printf(" --shared Build shared libraries when using --mode=link\n"); printf(" --export-all Try to export 'def' file on some platforms\n"); @@ -1020,6 +1020,7 @@ static int parse_long_opt(char const *arg, command_t *cmd) p < end; p++) { if (strcasecmp(value, p->name) == 0) { + found_target: /* * This is cross-compilation target * switch out the toolset too. @@ -1028,7 +1029,7 @@ static int parse_long_opt(char const *arg, command_t *cmd) toolset = &toolset_target; target = p->target; } - DEBUG("Switching target to %s, and toolset to toolset_target", p->name); + DEBUG("Switching target to %s, and toolset to toolset_target\n", p->name); break; } } @@ -1036,6 +1037,16 @@ static int parse_long_opt(char const *arg, command_t *cmd) * Invalid target */ if (p == end) { + /* + * Can we find a partial match, if so + * use that in preference to failing... + */ + for (p = target_map, end = target_map + (sizeof(target_map) / sizeof(*target_map)); + p < end; + p++) { + if (strstr(value, p->name)) goto found_target; + } + ERROR("Unrecognised --target, valid targets are:\n"); for (p = target_map, end = target_map + (sizeof(target_map) / sizeof(*target_map));