summaryrefslogtreecommitdiff
path: root/src
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
parent9e90beda5fd3fd4f93eac229e41bb5f3b9f86982 (diff)
downloadslibtool-main.tar.bz2
slibtool-main.tar.xz
slibtoolize: prefer libsltdl unless invoked with the --system-ltdl argument.HEADmain
Diffstat (limited to 'src')
-rw-r--r--src/driver/slbt_amain.c4
-rw-r--r--src/internal/slibtool_driver_impl.h1
-rw-r--r--src/logic/slbt_exec_stoolie.c38
-rw-r--r--src/skin/slbt_skin_stoolie.c5
4 files changed, 45 insertions, 3 deletions
diff --git a/src/driver/slbt_amain.c b/src/driver/slbt_amain.c
index a9cc118..bcf88ba 100644
--- a/src/driver/slbt_amain.c
+++ b/src/driver/slbt_amain.c
@@ -157,10 +157,10 @@ int slbt_main(char ** argv, char ** envp, const struct slbt_fd_ctx * fdctx)
/* slibtoolize (stoolie) mode */
if (!(strcmp(program,"stoolie")))
- flags |= SLBT_DRIVER_MODE_STOOLIE;
+ flags |= SLBT_DRIVER_MODE_STOOLIE | SLBT_DRIVER_PREFER_SLTDL;
else if (!(strcmp(program,"slibtoolize")))
- flags |= SLBT_DRIVER_MODE_STOOLIE;
+ flags |= SLBT_DRIVER_MODE_STOOLIE | SLBT_DRIVER_PREFER_SLTDL;
/* debug */
if (!(strcmp(program,"dlibtool")))
diff --git a/src/internal/slibtool_driver_impl.h b/src/internal/slibtool_driver_impl.h
index 83c7ad9..e20023f 100644
--- a/src/internal/slibtool_driver_impl.h
+++ b/src/internal/slibtool_driver_impl.h
@@ -126,6 +126,7 @@ enum app_tags {
TAG_STLE_WARNINGS,
TAG_STLE_NO_WARNINGS,
TAG_STLE_LTDL,
+ TAG_STLE_SYSTEM_LTDL,
};
struct slbt_split_vector {
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) {
diff --git a/src/skin/slbt_skin_stoolie.c b/src/skin/slbt_skin_stoolie.c
index 3a8cdb1..3140d22 100644
--- a/src/skin/slbt_skin_stoolie.c
+++ b/src/skin/slbt_skin_stoolie.c
@@ -54,5 +54,10 @@ const slbt_hidden struct argv_option slbt_stoolie_options[] = {
"compatibility, and is currently a no-op, thereby "
"deferring -lltdl to the system installed library."},
+ {"system-ltdl",0,TAG_STLE_SYSTEM_LTDL,ARGV_OPTARG_NONE,0,0,0,
+ "Do not enforce the use of libsltdl. "
+ "Without this option, --prefer-sltdl will be added to "
+ "slibtool's configured arguments."},
+
{0,0,0,0,0,0,0,0}
};