summaryrefslogtreecommitdiffhomepage
path: root/src/logic
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2025-03-31 03:26:43 +0000
committermidipix <writeonce@midipix.org>2025-03-31 03:33:37 +0000
commite496ed1f66b04f52222b9f6fb83ca8424855ed15 (patch)
tree42f9343b1ae620d8a66f406c28208bc4f46ecb7b /src/logic
parent9e90beda5fd3fd4f93eac229e41bb5f3b9f86982 (diff)
downloadslibtool-e496ed1f66b04f52222b9f6fb83ca8424855ed15.tar.bz2
slibtool-e496ed1f66b04f52222b9f6fb83ca8424855ed15.tar.xz
slibtoolize: prefer libsltdl unless invoked with the --system-ltdl argument.
Diffstat (limited to 'src/logic')
-rw-r--r--src/logic/slbt_exec_stoolie.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/src/logic/slbt_exec_stoolie.c b/src/logic/slbt_exec_stoolie.c
index 779146a..8061833 100644
--- a/src/logic/slbt_exec_stoolie.c
+++ b/src/logic/slbt_exec_stoolie.c
@@ -87,13 +87,18 @@ static int slbt_exec_stoolie_perform_actions(
char m4dir [PATH_MAX];
char auxdir[PATH_MAX];
char slibm4[PATH_MAX];
+ char sltdl [PATH_MAX];
+ char m4ltdl[PATH_MAX];
char ltmain[PATH_MAX];
char arlib [PATH_MAX];
bool fslibm4;
+ bool fsltdl;
bool fltmain;
ictx = slbt_get_stoolie_ictx(stctx);
+ fsltdl = (dctx->cctx->drvflags & SLBT_DRIVER_PREFER_SLTDL);
+
/* source files */
if (slbt_snprintf(
slibm4,sizeof(slibm4),"%s/%s",
@@ -102,6 +107,12 @@ static int slbt_exec_stoolie_perform_actions(
return SLBT_BUFFER_ERROR(dctx);
if (slbt_snprintf(
+ sltdl,sizeof(sltdl),"%s/%s",
+ SLBT_PACKAGE_DATADIR,
+ fsltdl ? "sltdl.m4" : "sysltdl.m4") < 0)
+ return SLBT_BUFFER_ERROR(dctx);
+
+ if (slbt_snprintf(
ltmain,sizeof(ltmain),"%s/%s",
SLBT_PACKAGE_DATADIR,
"ltmain.sh") < 0)
@@ -119,6 +130,10 @@ static int slbt_exec_stoolie_perform_actions(
if (slbt_exec_stoolie_remove_file(dctx,ictx->fdm4,"slibtool.m4") < 0)
return SLBT_NESTED_ERROR(dctx);
+ if (ictx->fdm4 >= 0)
+ if (slbt_exec_stoolie_remove_file(dctx,ictx->fdm4,"sltdl.m4") < 0)
+ return SLBT_NESTED_ERROR(dctx);
+
if (slbt_exec_stoolie_remove_file(dctx,ictx->fdaux,"ltmain.sh") < 0)
return SLBT_NESTED_ERROR(dctx);
@@ -158,8 +173,16 @@ static int slbt_exec_stoolie_perform_actions(
if (slbt_realpath(ictx->fdm4,".",0,m4dir,sizeof(m4dir)) < 0)
return SLBT_SYSTEM_ERROR(dctx,0);
+ if (slbt_snprintf(
+ m4ltdl,sizeof(m4ltdl),"%s/%s",
+ m4dir,"sltdl.m4") < 0)
+ return SLBT_BUFFER_ERROR(dctx);
+
if (slbt_util_copy_file(ectx,slibm4,m4dir) < 0)
return SLBT_NESTED_ERROR(dctx);
+
+ if (slbt_util_copy_file(ectx,sltdl,m4ltdl) < 0)
+ return SLBT_NESTED_ERROR(dctx);
}
if (fltmain) {
@@ -174,7 +197,7 @@ static int slbt_exec_stoolie_perform_actions(
}
} else {
/* default to symlinks */
- if (fslibm4)
+ if (fslibm4) {
if (slbt_create_symlink_ex(
dctx,ectx,
ictx->fdm4,
@@ -183,6 +206,15 @@ static int slbt_exec_stoolie_perform_actions(
SLBT_SYMLINK_LITERAL) < 0)
return SLBT_NESTED_ERROR(dctx);
+ if (slbt_create_symlink_ex(
+ dctx,ectx,
+ ictx->fdm4,
+ sltdl,
+ "sltdl.m4",
+ SLBT_SYMLINK_LITERAL) < 0)
+ return SLBT_NESTED_ERROR(dctx);
+ }
+
if (fltmain) {
if (slbt_create_symlink_ex(
dctx,ectx,
@@ -311,6 +343,10 @@ int slbt_exec_stoolie(const struct slbt_driver_ctx * dctx)
ictx->cctx.drvflags &= ~(uint64_t)SLBT_DRIVER_SILENT;
ictx->cctx.drvflags |= SLBT_DRIVER_VERBOSE;
break;
+
+ case TAG_STLE_SYSTEM_LTDL:
+ ictx->cctx.drvflags &= ~(uint64_t)SLBT_DRIVER_PREFER_SLTDL;
+ break;
}
if (entry->fval) {