summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-04-10 10:27:52 -0400
committermidipix <writeonce@midipix.org>2016-04-10 10:40:11 -0400
commit96566172dadc17dedafdc5c944fb1ab1cb39173b (patch)
tree46d142ffbc813dc05f9c727a6fc6d511ddb37228
parenta2d9fc66d70111088b8f4fdfcbf27738f5dc7636 (diff)
downloadslibtool-96566172dadc17dedafdc5c944fb1ab1cb39173b.tar.bz2
slibtool-96566172dadc17dedafdc5c944fb1ab1cb39173b.tar.xz
driver: account for sub-directories when verifying output file prefix.
-rw-r--r--src/driver/slbt_driver_ctx.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index 46a5ef3..6886b85 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -476,6 +476,7 @@ static int slbt_init_link_params(struct slbt_driver_ctx_impl * ctx)
const char * program;
const char * libname;
const char * prefix;
+ const char * base;
char * dot;
program = argv_program_name(ctx->cctx.targv[0]);
@@ -497,12 +498,16 @@ static int slbt_init_link_params(struct slbt_driver_ctx_impl * ctx)
return 0;
/* todo: archive? library? wrapper? inlined function, avoid repetition */
+ if ((base = strrchr(ctx->cctx.output,'/')))
+ base++;
+ else
+ base = ctx->cctx.output;
/* archive? */
if (!strcmp(dot,ctx->cctx.settings.arsuffix)) {
prefix = ctx->cctx.settings.arprefix;
- if (!strncmp(prefix,ctx->cctx.output,strlen(prefix)))
+ if (!strncmp(prefix,base,strlen(prefix)))
libname = ctx->cctx.output;
else {
if (ctx->cctx.drvflags & SLBT_DRIVER_VERBOSITY_ERRORS)
@@ -519,7 +524,7 @@ static int slbt_init_link_params(struct slbt_driver_ctx_impl * ctx)
else if (!strcmp(dot,ctx->cctx.settings.dsosuffix)) {
prefix = ctx->cctx.settings.dsoprefix;
- if (!strncmp(prefix,ctx->cctx.output,strlen(prefix)))
+ if (!strncmp(prefix,base,strlen(prefix)))
libname = ctx->cctx.output;
else {
if (ctx->cctx.drvflags & SLBT_DRIVER_VERBOSITY_ERRORS)
@@ -536,7 +541,7 @@ static int slbt_init_link_params(struct slbt_driver_ctx_impl * ctx)
else if (!strcmp(dot,".la")) {
prefix = ctx->cctx.settings.dsoprefix;
- if (!strncmp(prefix,ctx->cctx.output,strlen(prefix)))
+ if (!strncmp(prefix,base,strlen(prefix)))
libname = ctx->cctx.output;
else {
if (ctx->cctx.drvflags & SLBT_DRIVER_VERBOSITY_ERRORS)