summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-03-31 05:02:32 +0000
committermidipix <writeonce@midipix.org>2024-03-31 05:02:32 +0000
commit179d2e4c73c06b4d5486b3d9841c426b4f2660c2 (patch)
tree4f2461cf3e553bcaebd0c55880e2c23f187f5338 /src
parentbfeee90a957413b5e98357c821c958691353d950 (diff)
downloadslibtool-179d2e4c73c06b4d5486b3d9841c426b4f2660c2.tar.bz2
slibtool-179d2e4c73c06b4d5486b3d9841c426b4f2660c2.tar.xz
driver: --heuristics: added slibtool.cfg prioritized support.
Diffstat (limited to 'src')
-rw-r--r--src/internal/slibtool_lconf_impl.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/internal/slibtool_lconf_impl.c b/src/internal/slibtool_lconf_impl.c
index b332f9b..f0e061f 100644
--- a/src/internal/slibtool_lconf_impl.c
+++ b/src/internal/slibtool_lconf_impl.c
@@ -525,6 +525,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,11 +540,17 @@ 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;
+ if (lconf) {
+ mconf = 0;
+ } else {
+ mconf = "slibtool.cfg";
+ lconf = "libtool";
+ }
+
if (dctx->cctx->drvflags & SLBT_DRIVER_SILENT) {
trace_lconf = 0;
trace_fstat = slbt_lconf_trace_fstat_silent;
@@ -581,7 +588,9 @@ static int slbt_lconf_open(
}
if (!(dctx->cctx->drvflags & SLBT_DRIVER_SILENT)) {
- trace_lconf(dctx,lconf);
+ if (!mconf)
+ trace_lconf(dctx,lconf);
+
slbt_output_fdcwd(dctx);
}
@@ -594,7 +603,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 +639,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);