summaryrefslogtreecommitdiffhomepage
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
parent9e90beda5fd3fd4f93eac229e41bb5f3b9f86982 (diff)
downloadslibtool-e496ed1f66b04f52222b9f6fb83ca8424855ed15.tar.bz2
slibtool-e496ed1f66b04f52222b9f6fb83ca8424855ed15.tar.xz
slibtoolize: prefer libsltdl unless invoked with the --system-ltdl argument.
-rw-r--r--m4/slibtool.m47
-rw-r--r--m4/sltdl.m439
-rw-r--r--m4/sysltdl.m439
-rw-r--r--project/extras.mk2
-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
8 files changed, 132 insertions, 3 deletions
diff --git a/m4/slibtool.m4 b/m4/slibtool.m4
index b1ed75b..355b8c4 100644
--- a/m4/slibtool.m4
+++ b/m4/slibtool.m4
@@ -253,6 +253,12 @@ slibtool_set_flavor()
;;
esac
+ case "_${slibtool_prefer_sltdl:-}" in
+ '_yes')
+ SLIBTOOL="${SLIBTOOL} --prefer-sltdl"
+ ;;
+ esac
+
# drop-in replacement
enable_shared=${slibtool_enable_shared}
enable_static=${slibtool_enable_static}
@@ -448,6 +454,7 @@ AC_DEFUN([SLIBTOOL_INIT],[
AC_BEFORE([SLIBTOOL_LANG])
AC_REQUIRE([SLIBTOOL_PREREQ])
AC_REQUIRE([_SLIBTOOL_DEFAULTS])
+AC_REQUIRE([_SLIBTOOL_SLTDL_OPTION])
AC_REQUIRE([_SLIBTOOL_SET_FLAVOR])
AC_REQUIRE([_SLIBTOOL_ARGUMENT_HANDLING])
diff --git a/m4/sltdl.m4 b/m4/sltdl.m4
new file mode 100644
index 0000000..4d15333
--- /dev/null
+++ b/m4/sltdl.m4
@@ -0,0 +1,39 @@
+###############################################################################
+# #
+# sltdl.m4: native libsltdl integration for autoconf-based projects #
+# #
+# Copyright (C) 2016--2025 SysDeer Technologies, LLC #
+# #
+# Permission is hereby granted, free of charge, to any person obtaining #
+# a copy of this software and associated documentation files (the #
+# "Software"), to deal in the Software without restriction, including #
+# without limitation the rights to use, copy, modify, merge, publish, #
+# distribute, sublicense, and/or sell copies of the Software, and to #
+# permit persons to whom the Software is furnished to do so, subject to #
+# the following conditions: #
+# #
+# The above copyright notice and this permission notice shall be included #
+# in all copies or substantial portions of the Software. #
+# #
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS #
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF #
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. #
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY #
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, #
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE #
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
+# #
+###############################################################################
+
+
+
+# __SLIBTOOL_SLTDL_OPTION
+# ------------------
+AC_DEFUN([_SLIBTOOL_SLTDL_OPTION],[
+AC_BEFORE([$0],[SLIBTOOL_INIT])
+AC_BEFORE([$0],[_SLIBTOOL_ARGUMENT_HANDLING])
+
+# slibtool: sltdl option
+# ---------------------------------
+slibtool_prefer_sltdl='yes'
+])
diff --git a/m4/sysltdl.m4 b/m4/sysltdl.m4
new file mode 100644
index 0000000..baeb847
--- /dev/null
+++ b/m4/sysltdl.m4
@@ -0,0 +1,39 @@
+###############################################################################
+# #
+# sysltdl.m4: system libltdl integration for autoconf-based projects #
+# #
+# Copyright (C) 2016--2025 SysDeer Technologies, LLC #
+# #
+# Permission is hereby granted, free of charge, to any person obtaining #
+# a copy of this software and associated documentation files (the #
+# "Software"), to deal in the Software without restriction, including #
+# without limitation the rights to use, copy, modify, merge, publish, #
+# distribute, sublicense, and/or sell copies of the Software, and to #
+# permit persons to whom the Software is furnished to do so, subject to #
+# the following conditions: #
+# #
+# The above copyright notice and this permission notice shall be included #
+# in all copies or substantial portions of the Software. #
+# #
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS #
+# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF #
+# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. #
+# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY #
+# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, #
+# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE #
+# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #
+# #
+###############################################################################
+
+
+
+# __SLIBTOOL_SLTDL_OPTION
+# ------------------
+AC_DEFUN([_SLIBTOOL_SLTDL_OPTION],[
+AC_BEFORE([$0],[SLIBTOOL_INIT])
+AC_BEFORE([$0],[_SLIBTOOL_ARGUMENT_HANDLING])
+
+# slibtool: sltdl option
+# ---------------------------------
+slibtool_prefer_sltdl='no'
+])
diff --git a/project/extras.mk b/project/extras.mk
index a254d9c..2679189 100644
--- a/project/extras.mk
+++ b/project/extras.mk
@@ -107,6 +107,8 @@ install-slibtoolize:
mkdir -p $(DESTDIR)$(DATADIR)/$(PACKAGE)
cp -p $(SOURCE_DIR)/m4/slibtool.m4 $(DESTDIR)$(DATADIR)/$(PACKAGE)
+ cp -p $(SOURCE_DIR)/m4/sysltdl.m4 $(DESTDIR)$(DATADIR)/$(PACKAGE)
+ cp -p $(SOURCE_DIR)/m4/sltdl.m4 $(DESTDIR)$(DATADIR)/$(PACKAGE)
cp -p $(SOURCE_DIR)/aux/ltmain.sh $(DESTDIR)$(DATADIR)/$(PACKAGE)
cp -p $(SOURCE_DIR)/aux/slibtool.sh $(DESTDIR)$(DATADIR)/$(PACKAGE)
cp -p $(SOURCE_DIR)/aux/ar-lib $(DESTDIR)$(DATADIR)/$(PACKAGE)
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}
};