summaryrefslogtreecommitdiff
path: root/src/internal/slibtool_lconf_impl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/slibtool_lconf_impl.c')
-rw-r--r--src/internal/slibtool_lconf_impl.c41
1 files changed, 33 insertions, 8 deletions
diff --git a/src/internal/slibtool_lconf_impl.c b/src/internal/slibtool_lconf_impl.c
index b332f9b..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;
@@ -525,6 +526,7 @@ static int slbt_lconf_open(
struct stat stcwd;
struct stat stparent;
ino_t stinode;
+ const char * mconf;
int (*trace_lconf)(struct slbt_driver_ctx *,
const char *);
@@ -539,12 +541,19 @@ static int slbt_lconf_open(
int,int,const char *,int,
char (*)[PATH_MAX]);
- lconf = lconf ? lconf : "libtool";
fderr = slbt_driver_fderr(dctx);
fdcwd = slbt_driver_fdcwd(dctx);
fdlconfdir = fdcwd;
+ fsilent |= (dctx->cctx->drvflags & SLBT_DRIVER_SILENT);
- if (dctx->cctx->drvflags & SLBT_DRIVER_SILENT) {
+ if (lconf) {
+ mconf = 0;
+ } else {
+ mconf = "slibtool.cfg";
+ lconf = "libtool";
+ }
+
+ if (fsilent) {
trace_lconf = 0;
trace_fstat = slbt_lconf_trace_fstat_silent;
trace_openat = slbt_lconf_trace_openat_silent;
@@ -580,8 +589,10 @@ static int slbt_lconf_open(
trace_openat = slbt_lconf_trace_openat_silent;
}
- if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) {
- trace_lconf(dctx,lconf);
+ if (!fsilent) {
+ if (!mconf)
+ trace_lconf(dctx,lconf);
+
slbt_output_fdcwd(dctx);
}
@@ -594,7 +605,14 @@ static int slbt_lconf_open(
return SLBT_SYSTEM_ERROR(dctx,0);
stinode = stcwd.st_ino;
- fdlconf = trace_openat(dctx,fdlconfdir,lconf,O_RDONLY,0);
+ fdlconf = -1;
+
+ if (mconf)
+ if ((fdlconf = trace_openat(dctx,fdlconfdir,mconf,O_RDONLY,0)) >= 0)
+ lconf = mconf;
+
+ if (fdlconf < 0)
+ fdlconf = trace_openat(dctx,fdlconfdir,lconf,O_RDONLY,0);
while (fdlconf < 0) {
fdparent = trace_openat(dctx,fdlconfdir,"../",O_DIRECTORY,0);
@@ -623,8 +641,14 @@ static int slbt_lconf_open(
}
fdlconfdir = fdparent;
- fdlconf = trace_openat(dctx,fdlconfdir,lconf,O_RDONLY,0);
stinode = stparent.st_ino;
+
+ if (mconf)
+ if ((fdlconf = trace_openat(dctx,fdlconfdir,mconf,O_RDONLY,0)) >= 0)
+ lconf = mconf;
+
+ if (fdlconf < 0)
+ fdlconf = trace_openat(dctx,fdlconfdir,lconf,O_RDONLY,0);
}
trace_result(dctx,fdlconf,fdlconfdir,lconf,0,lconfpath);
@@ -725,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;
@@ -740,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) */