summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/driver/slbt_driver_ctx.c30
-rw-r--r--src/internal/slibtool_lconf_impl.c11
-rw-r--r--src/internal/slibtool_lconf_impl.h3
3 files changed, 38 insertions, 6 deletions
diff --git a/src/driver/slbt_driver_ctx.c b/src/driver/slbt_driver_ctx.c
index 00e1998..de1288e 100644
--- a/src/driver/slbt_driver_ctx.c
+++ b/src/driver/slbt_driver_ctx.c
@@ -400,6 +400,7 @@ int slbt_lib_get_driver_ctx(
struct slbt_obj_list * objlistv;
struct slbt_driver_ctx_impl * ctx;
struct slbt_common_ctx cctx;
+ struct slbt_error_info** errinfp;
const struct argv_option * optv[SLBT_OPTV_ELEMENTS];
struct argv_meta * meta;
struct argv_entry * entry;
@@ -982,10 +983,37 @@ int slbt_lib_get_driver_ctx(
}
/* heuristics */
+ if (mkvars)
+ cctx.drvflags &= ~(uint64_t)SLBT_DRIVER_HEURISTICS;
+
if (cctx.drvflags & SLBT_DRIVER_HEURISTICS) {
- if (slbt_get_lconf_flags(&ctx->ctx,lconf,&lflags) < 0)
+ if (slbt_get_lconf_flags(&ctx->ctx,lconf,&lflags,false) < 0)
return slbt_lib_get_driver_ctx_fail(&ctx->ctx,0);
+ } else {
+ switch (cctx.mode) {
+ case SLBT_MODE_UNKNOWN:
+ case SLBT_MODE_STOOLIE:
+ break;
+
+ case SLBT_MODE_CONFIG:
+ lconf = mkvars ? 0 : "slibtool.cfg";
+ break;
+
+ default:
+ lconf = "slibtool.cfg";
+ break;
+ }
+
+ if (lconf && (errinfp = ctx->errinfp))
+ if (slbt_get_lconf_flags(&ctx->ctx,lconf,&lflags,true) < 0)
+ for (ctx->errinfp=errinfp; *errinfp; errinfp++)
+ *errinfp = 0;
+ if (ctx->lconfctx)
+ cctx.drvflags |= SLBT_DRIVER_HEURISTICS;
+ }
+
+ if (cctx.drvflags & SLBT_DRIVER_HEURISTICS) {
if (ctx->cctx.host.host && !cfgmeta_host)
cfgmeta_host = cfglconf;
diff --git a/src/internal/slibtool_lconf_impl.c b/src/internal/slibtool_lconf_impl.c
index f0e061f..ffe92b0 100644
--- a/src/internal/slibtool_lconf_impl.c
+++ b/src/internal/slibtool_lconf_impl.c
@@ -515,6 +515,7 @@ static int slbt_lconf_trace_result_annotated(
static int slbt_lconf_open(
struct slbt_driver_ctx * dctx,
const char * lconf,
+ bool fsilent,
char (*lconfpath)[PATH_MAX])
{
int fderr;
@@ -543,6 +544,7 @@ static int slbt_lconf_open(
fderr = slbt_driver_fderr(dctx);
fdcwd = slbt_driver_fdcwd(dctx);
fdlconfdir = fdcwd;
+ fsilent |= (dctx->cctx->drvflags & SLBT_DRIVER_SILENT);
if (lconf) {
mconf = 0;
@@ -551,7 +553,7 @@ static int slbt_lconf_open(
lconf = "libtool";
}
- if (dctx->cctx->drvflags & SLBT_DRIVER_SILENT) {
+ if (fsilent) {
trace_lconf = 0;
trace_fstat = slbt_lconf_trace_fstat_silent;
trace_openat = slbt_lconf_trace_openat_silent;
@@ -587,7 +589,7 @@ static int slbt_lconf_open(
trace_openat = slbt_lconf_trace_openat_silent;
}
- if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) {
+ if (!fsilent) {
if (!mconf)
trace_lconf(dctx,lconf);
@@ -747,7 +749,8 @@ static int slbt_get_lconf_var(
slbt_hidden int slbt_get_lconf_flags(
struct slbt_driver_ctx * dctx,
const char * lconf,
- uint64_t * flags)
+ uint64_t * flags,
+ bool fsilent)
{
struct slbt_driver_ctx_impl * ctx;
struct slbt_txtfile_ctx * confctx;
@@ -762,7 +765,7 @@ slbt_hidden int slbt_get_lconf_flags(
ctx = slbt_get_driver_ictx(dctx);
/* open relative libtool script */
- if ((fdlconf = slbt_lconf_open(dctx,lconf,&val)) < 0)
+ if ((fdlconf = slbt_lconf_open(dctx,lconf,fsilent,&val)) < 0)
return SLBT_NESTED_ERROR(dctx);
/* cache the configuration in library friendly form) */
diff --git a/src/internal/slibtool_lconf_impl.h b/src/internal/slibtool_lconf_impl.h
index d2bd44c..05c7537 100644
--- a/src/internal/slibtool_lconf_impl.h
+++ b/src/internal/slibtool_lconf_impl.h
@@ -8,6 +8,7 @@ struct slbt_driver_ctx;
int slbt_get_lconf_flags(
struct slbt_driver_ctx * dctx,
const char * lconf,
- uint64_t * flags);
+ uint64_t * flags,
+ bool fsilent);
#endif